define([ 'jquery', 'Magento_Customer/js/customer-data', 'mage/url' ], function ($, customerData, urlBuilder) { 'use strict'; return function (originalMinicart) { console.log("Applying minicart mixin for punchout session"); return originalMinicart.extend({ initialize: function () { this._super(); this.customsection_punchout = customerData.get('customsection_punchout')(); return this; }, isPunchoutSession: function () { var isPunchoutSession = false; $.ajax({ url: urlBuilder.build('punchout/ajax/isPunchoutSession'), type: 'GET', dataType: 'json', async: false, success: function(response) { if (response.success && response.is_punchout) { isPunchoutSession = true; } } }); return !!(this.customsection_punchout?.is_punchout_session || isPunchoutSession); }, /** * ✅ Genera URL respetando el store actual */ getCartUrl: function () { return urlBuilder.build('checkout/cart'); } }); }; });