// 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');
