fix(loyalty): align menu item IDs with URL segments for sidebar highlight

The store and merchant init-alpine.js derive currentPage from the URL's
last segment (e.g., /loyalty/program -> 'program'). Loyalty menu items
used prefixed IDs like 'loyalty-program' which never matched, so sidebar
items never highlighted.

Fixed by renaming all store/merchant menu item IDs and JS currentPage
values to match URL segments: program, cards, analytics, transactions,
pins, settings — consistent with how every other module works.

Also reverted the init-alpine.js guard that broke storeCode extraction,
and added missing loyalty.common.contact_admin_setup translation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 18:32:50 +01:00
parent ce0caa5685
commit 1d90bfe044
20 changed files with 3497 additions and 3494 deletions

View File

@@ -6,7 +6,7 @@ const loyaltyAnalyticsLog = window.LogConfig.loggers.loyaltyAnalytics || window.
function merchantLoyaltyAnalytics() {
return {
...data(),
currentPage: 'loyalty-analytics',
currentPage: 'analytics',
program: null,
locations: [],

View File

@@ -7,7 +7,7 @@ function merchantLoyaltyCardDetail() {
return loyaltyCardDetailView({
apiPrefix: '/merchants/loyalty',
backUrl: '/merchants/loyalty/cards',
currentPage: 'loyalty-cards',
currentPage: 'cards',
});
}

View File

@@ -8,7 +8,7 @@ function merchantLoyaltyCards() {
apiPrefix: '/merchants/loyalty',
baseUrl: '/merchants/loyalty/cards',
showStoreFilter: true,
currentPage: 'loyalty-cards',
currentPage: 'cards',
});
}

View File

@@ -6,7 +6,7 @@ const merchantSettingsViewLog = window.LogConfig.loggers.merchantSettingsView ||
function merchantLoyaltyMerchantSettings() {
return {
...data(),
currentPage: 'loyalty-settings',
currentPage: 'settings',
settings: null,
loading: false,

View File

@@ -8,7 +8,7 @@ function merchantLoyaltyPins() {
apiPrefix: '/merchants/loyalty',
showStoreFilter: true,
showCrud: true,
currentPage: 'loyalty-pins',
currentPage: 'pins',
});
}

View File

@@ -7,7 +7,7 @@ function merchantLoyaltySettings() {
return {
...data(),
...createProgramFormMixin(),
currentPage: 'loyalty-program',
currentPage: 'program',
loading: false,
error: null,

View File

@@ -7,7 +7,7 @@ function merchantLoyaltyTransactions() {
return loyaltyTransactionsList({
apiPrefix: '/merchants/loyalty',
showStoreFilter: true,
currentPage: 'loyalty-transactions',
currentPage: 'transactions',
});
}

View File

@@ -6,7 +6,7 @@ const loyaltyAnalyticsLog = window.LogConfig.loggers.loyaltyAnalytics || window.
function storeLoyaltyAnalytics() {
return {
...data(),
currentPage: 'loyalty-analytics',
currentPage: 'analytics',
program: null,

View File

@@ -6,7 +6,7 @@ const loyaltyCardDetailLog = window.LogConfig.loggers.loyaltyCardDetail || windo
function storeLoyaltyCardDetail() {
return {
...data(),
currentPage: 'loyalty-card-detail',
currentPage: 'cards',
cardId: null,
card: null,

View File

@@ -6,7 +6,7 @@ const loyaltyCardsLog = window.LogConfig.loggers.loyaltyCards || window.LogConfi
function storeLoyaltyCards() {
return {
...data(),
currentPage: 'loyalty-cards',
currentPage: 'cards',
// Data
cards: [],

View File

@@ -6,7 +6,7 @@ const loyaltyEnrollLog = window.LogConfig.loggers.loyaltyEnroll || window.LogCon
function storeLoyaltyEnroll() {
return {
...data(),
currentPage: 'loyalty-enroll',
currentPage: 'terminal',
program: null,
form: {

View File

@@ -13,7 +13,7 @@ function loyaltySettings() {
...createProgramFormMixin(),
// Page identifier
currentPage: 'loyalty-program',
currentPage: 'program',
// State
loading: false,

View File

@@ -13,7 +13,7 @@ function storeLoyaltyTerminal() {
...data(),
// Page identifier
currentPage: 'loyalty-terminal',
currentPage: 'terminal',
// Program state
program: null,