fix: make storefront API referer extraction platform-aware and fix script loading
Some checks failed
Some checks failed
Two bugs causing "Program Not Available" on storefront enrollment: 1. extract_store_from_referer() was not platform-aware — used settings.main_domain (wizard.lu) instead of platform.domain (rewardflow.lu) for subdomain detection, and restricted path-based extraction to localhost only. Now mirrors the platform-aware logic from _detect_store_from_host_and_path(): checks platform.domain for subdomain detection (fashionhub.rewardflow.lu → fashionhub) and allows path-based extraction on platform domains (rewardflow.lu/storefront/FASHIONHUB/... → FASHIONHUB). 2. Storefront JS scripts (enroll, dashboard, history) were missing defer attribute, causing them to execute before log-config.js and crash on window.LogConfig access. Also fix quote escaping in server-side rendered x-text expressions for French translations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -230,5 +230,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script src="{{ url_for('loyalty_static', path='storefront/js/loyalty-dashboard.js') }}"></script>
|
||||
<script defer src="{{ url_for('loyalty_static', path='storefront/js/loyalty-dashboard.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
class="w-full py-3 px-4 text-white font-semibold rounded-lg transition-colors disabled:opacity-50"
|
||||
:style="'background-color: ' + (program?.card_color || 'var(--color-primary)')">
|
||||
<span x-show="enrolling" x-html="$icon('spinner', 'w-5 h-5 inline animate-spin mr-2')"></span>
|
||||
<span x-text="enrolling ? '{{ _('loyalty.enrollment.form.joining') }}' : '{{ _('loyalty.enrollment.form.join_button', points=program.welcome_bonus_points if program else 0) }}'"></span>
|
||||
<span x-text="enrolling ? '{{ _('loyalty.enrollment.form.joining')|replace("'", "\\'") }}' : '{{ _('loyalty.enrollment.form.join_button', points=program.welcome_bonus_points if program else 0)|replace("'", "\\'") }}'"></span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -170,5 +170,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script src="{{ url_for('loyalty_static', path='storefront/js/loyalty-enroll.js') }}"></script>
|
||||
<script defer src="{{ url_for('loyalty_static', path='storefront/js/loyalty-enroll.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -105,5 +105,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_scripts %}
|
||||
<script src="{{ url_for('loyalty_static', path='storefront/js/loyalty-history.js') }}"></script>
|
||||
<script defer src="{{ url_for('loyalty_static', path='storefront/js/loyalty-history.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user