feat(loyalty): cross-persona page alignment with shared components
Align loyalty pages across admin, merchant, and store personas so each sees the same page set scoped to their access level. Admin acts as a superset of merchant with "on behalf" capabilities. New pages: - Store: Staff PINs management (CRUD) - Merchant: Cards, Card Detail, Transactions, Staff PINs (CRUD), Settings (read-only) - Admin: Merchant Cards, Card Detail, Transactions, PINs (read-only) Architecture: - 4 shared Jinja2 partials (cards-list, card-detail, transactions, pins) - 4 shared JS factory modules parameterized by apiPrefix/scope - Persona templates are thin wrappers including shared partials - PinDetailResponse schema for cross-store PIN listings API: 17 new endpoints (11 merchant, 6 admin on-behalf) Tests: 38 new integration tests, arch-check green i18n: ~130 new keys across en/fr/de/lb Docs: pages-and-navigation.md with full page matrix Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// app/modules/loyalty/static/admin/js/loyalty-merchant-card-detail.js
|
||||
// Admin wrapper for shared loyalty card detail view (on-behalf view).
|
||||
|
||||
const adminMerchantCardDetailLog = window.LogConfig.loggers.adminMerchantCardDetail || window.LogConfig.createLogger('adminMerchantCardDetail');
|
||||
|
||||
function adminMerchantCardDetail() {
|
||||
// Extract merchant_id and card_id from URL: /admin/loyalty/merchants/{merchant_id}/cards/{card_id}
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const merchantsIndex = pathParts.indexOf('merchants');
|
||||
const merchantId = merchantsIndex !== -1 ? pathParts[merchantsIndex + 1] : null;
|
||||
|
||||
return loyaltyCardDetailView({
|
||||
apiPrefix: '/admin/loyalty/merchants/' + merchantId,
|
||||
backUrl: '/admin/loyalty/merchants/' + merchantId + '/cards',
|
||||
currentPage: 'loyalty-programs',
|
||||
});
|
||||
}
|
||||
|
||||
if (!window.LogConfig.loggers.adminMerchantCardDetail) {
|
||||
window.LogConfig.loggers.adminMerchantCardDetail = window.LogConfig.createLogger('adminMerchantCardDetail');
|
||||
}
|
||||
adminMerchantCardDetailLog.info('Admin merchant card detail module loaded');
|
||||
@@ -0,0 +1,23 @@
|
||||
// app/modules/loyalty/static/admin/js/loyalty-merchant-cards.js
|
||||
// Admin wrapper for shared loyalty cards list (on-behalf view).
|
||||
|
||||
const adminMerchantCardsLog = window.LogConfig.loggers.adminMerchantCards || window.LogConfig.createLogger('adminMerchantCards');
|
||||
|
||||
function adminMerchantCards() {
|
||||
// Extract merchant_id from URL: /admin/loyalty/merchants/{merchant_id}/cards
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const merchantsIndex = pathParts.indexOf('merchants');
|
||||
const merchantId = merchantsIndex !== -1 ? pathParts[merchantsIndex + 1] : null;
|
||||
|
||||
return loyaltyCardsList({
|
||||
apiPrefix: '/admin/loyalty/merchants/' + merchantId,
|
||||
baseUrl: '/admin/loyalty/merchants/' + merchantId + '/cards',
|
||||
showStoreFilter: true,
|
||||
currentPage: 'loyalty-programs',
|
||||
});
|
||||
}
|
||||
|
||||
if (!window.LogConfig.loggers.adminMerchantCards) {
|
||||
window.LogConfig.loggers.adminMerchantCards = window.LogConfig.createLogger('adminMerchantCards');
|
||||
}
|
||||
adminMerchantCardsLog.info('Admin merchant cards module loaded');
|
||||
23
app/modules/loyalty/static/admin/js/loyalty-merchant-pins.js
Normal file
23
app/modules/loyalty/static/admin/js/loyalty-merchant-pins.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// app/modules/loyalty/static/admin/js/loyalty-merchant-pins.js
|
||||
// Admin wrapper for shared loyalty PINs list (on-behalf read-only view).
|
||||
|
||||
const adminMerchantPinsLog = window.LogConfig.loggers.adminMerchantPins || window.LogConfig.createLogger('adminMerchantPins');
|
||||
|
||||
function adminMerchantPins() {
|
||||
// Extract merchant_id from URL: /admin/loyalty/merchants/{merchant_id}/pins
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const merchantsIndex = pathParts.indexOf('merchants');
|
||||
const merchantId = merchantsIndex !== -1 ? pathParts[merchantsIndex + 1] : null;
|
||||
|
||||
return loyaltyPinsList({
|
||||
apiPrefix: '/admin/loyalty/merchants/' + merchantId,
|
||||
showStoreFilter: true,
|
||||
showCrud: false,
|
||||
currentPage: 'loyalty-programs',
|
||||
});
|
||||
}
|
||||
|
||||
if (!window.LogConfig.loggers.adminMerchantPins) {
|
||||
window.LogConfig.loggers.adminMerchantPins = window.LogConfig.createLogger('adminMerchantPins');
|
||||
}
|
||||
adminMerchantPinsLog.info('Admin merchant pins module loaded');
|
||||
@@ -0,0 +1,22 @@
|
||||
// app/modules/loyalty/static/admin/js/loyalty-merchant-transactions.js
|
||||
// Admin wrapper for shared loyalty transactions list (on-behalf view).
|
||||
|
||||
const adminMerchantTransactionsLog = window.LogConfig.loggers.adminMerchantTransactions || window.LogConfig.createLogger('adminMerchantTransactions');
|
||||
|
||||
function adminMerchantTransactions() {
|
||||
// Extract merchant_id from URL: /admin/loyalty/merchants/{merchant_id}/transactions
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
const merchantsIndex = pathParts.indexOf('merchants');
|
||||
const merchantId = merchantsIndex !== -1 ? pathParts[merchantsIndex + 1] : null;
|
||||
|
||||
return loyaltyTransactionsList({
|
||||
apiPrefix: '/admin/loyalty/merchants/' + merchantId,
|
||||
showStoreFilter: true,
|
||||
currentPage: 'loyalty-programs',
|
||||
});
|
||||
}
|
||||
|
||||
if (!window.LogConfig.loggers.adminMerchantTransactions) {
|
||||
window.LogConfig.loggers.adminMerchantTransactions = window.LogConfig.createLogger('adminMerchantTransactions');
|
||||
}
|
||||
adminMerchantTransactionsLog.info('Admin merchant transactions module loaded');
|
||||
Reference in New Issue
Block a user