ng-miam 8.8.13 → 8.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ng-miam.umd.js +139 -11
- package/bundles/ng-miam.umd.js.map +1 -1
- package/bundles/ng-miam.umd.min.js +1 -1
- package/bundles/ng-miam.umd.min.js.map +1 -1
- package/esm2015/lib/_services/basket-transfer.service.js +125 -8
- package/esm2015/lib/_web-components/basket-transfer-modal/basket-transfer-modal.component.js +2 -2
- package/esm2015/lib/_web-components/no-supplier-onboarding/no-supplier-onboarding.component.js +14 -6
- package/fesm2015/ng-miam.js +137 -12
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_services/basket-transfer.service.d.ts +9 -2
- package/lib/_services/basket-transfer.service.d.ts.map +1 -1
- package/lib/_web-components/no-supplier-onboarding/no-supplier-onboarding.component.d.ts +4 -2
- package/lib/_web-components/no-supplier-onboarding/no-supplier-onboarding.component.d.ts.map +1 -1
- package/package.json +1 -1
package/bundles/ng-miam.umd.js
CHANGED
|
@@ -8273,7 +8273,8 @@
|
|
|
8273
8273
|
};
|
|
8274
8274
|
BasketTransferService.prototype.setSessionData = function (params) {
|
|
8275
8275
|
sessionStorage.setItem('_miam/transferredBasketToken', params.basketToken);
|
|
8276
|
-
|
|
8276
|
+
// ITM specific: use pdvref if posExtId is not set
|
|
8277
|
+
sessionStorage.setItem('_miam/pointOfSaleExtId', params.posExtId || params.pdvref);
|
|
8277
8278
|
};
|
|
8278
8279
|
BasketTransferService.prototype.clearTransferSessionData = function () {
|
|
8279
8280
|
sessionStorage.removeItem('_miam/transferredBasketToken');
|
|
@@ -8294,16 +8295,41 @@
|
|
|
8294
8295
|
}));
|
|
8295
8296
|
}), operators.switchMap(function (transferResponse) {
|
|
8296
8297
|
sessionStorage.setItem('_miam/transferUrl', transferResponse.transfer_url);
|
|
8297
|
-
_this.
|
|
8298
|
+
_this.navigateToTransferUrl();
|
|
8298
8299
|
_this.recipesService.hide();
|
|
8299
8300
|
return rxjs.of(null);
|
|
8300
8301
|
})).subscribe());
|
|
8301
8302
|
};
|
|
8302
|
-
BasketTransferService.prototype.
|
|
8303
|
+
BasketTransferService.prototype.navigateToTransferUrl = function () {
|
|
8303
8304
|
var transferUrl = sessionStorage.getItem('_miam/transferUrl');
|
|
8304
8305
|
if (transferUrl) {
|
|
8306
|
+
// Adjust pdvref only for ITM (supplier 23) when navigating
|
|
8307
|
+
var finalUrl_1 = transferUrl;
|
|
8308
|
+
if (this.isITMSupplier()) {
|
|
8309
|
+
try {
|
|
8310
|
+
var urlObj = new URL(transferUrl);
|
|
8311
|
+
var rawPdvref = urlObj.searchParams.get('pdvref');
|
|
8312
|
+
if (rawPdvref) {
|
|
8313
|
+
var padded = this.padPdvref(rawPdvref);
|
|
8314
|
+
if (padded && padded !== rawPdvref) {
|
|
8315
|
+
urlObj.searchParams.set('pdvref', padded);
|
|
8316
|
+
}
|
|
8317
|
+
}
|
|
8318
|
+
finalUrl_1 = urlObj.toString();
|
|
8319
|
+
}
|
|
8320
|
+
catch (err) {
|
|
8321
|
+
// Fallback for non-standard URLs
|
|
8322
|
+
var match = transferUrl.match(/([?&])pdvref=([^&]+)/);
|
|
8323
|
+
if (match) {
|
|
8324
|
+
var padded = this.padPdvref(match[2]);
|
|
8325
|
+
if (padded) {
|
|
8326
|
+
finalUrl_1 = transferUrl.replace(/([?&])pdvref=[^&]+/, "$1pdvref=" + padded);
|
|
8327
|
+
}
|
|
8328
|
+
}
|
|
8329
|
+
}
|
|
8330
|
+
}
|
|
8305
8331
|
// Apparently Safari blocks window.open(..., "_blank") if called in an async function and setTimeout makes it run on the main thread
|
|
8306
|
-
setTimeout(function () { return window.open(
|
|
8332
|
+
setTimeout(function () { return window.open(finalUrl_1, '_blank'); });
|
|
8307
8333
|
}
|
|
8308
8334
|
};
|
|
8309
8335
|
BasketTransferService.prototype.abortTransfer = function () {
|
|
@@ -8326,7 +8352,9 @@
|
|
|
8326
8352
|
};
|
|
8327
8353
|
BasketTransferService.prototype.tryToTransferBasket = function (params) {
|
|
8328
8354
|
var _this = this;
|
|
8329
|
-
return this.callHookbackIfNotLogged().pipe(operators.skipWhile(function (isLogged) { return !isLogged; }),
|
|
8355
|
+
return this.callHookbackIfNotLogged().pipe(operators.skipWhile(function (isLogged) { return !isLogged; }),
|
|
8356
|
+
// ITM specific: use pdvref if posExtId is not set
|
|
8357
|
+
operators.switchMap(function () { return _this.ensureTransferPosSelected(params.posExtId || params.pdvref); }), operators.skipWhile(function (isPosSet) { return !isPosSet; }), operators.switchMap(function () { return _this.posService.waitForPos.pipe(operators.take(1), operators.switchMap(function (pos) { return _this.basketsService.waitForBasket.pipe(operators.map(function () { return pos; })); }), operators.switchMap(function (pos) { return _this.transferBasketForPos(pos, params.basketToken); }), operators.take(1)); }));
|
|
8330
8358
|
};
|
|
8331
8359
|
BasketTransferService.prototype.transferBasketForPos = function (pos, basketToken) {
|
|
8332
8360
|
var _this = this;
|
|
@@ -8359,12 +8387,41 @@
|
|
|
8359
8387
|
return rxjs.of(posSet);
|
|
8360
8388
|
}));
|
|
8361
8389
|
};
|
|
8390
|
+
BasketTransferService.prototype.ensureTransferPosSelected = function (transferPosExtId) {
|
|
8391
|
+
var _this = this;
|
|
8392
|
+
return this.posService.posWasInitialized().pipe(operators.takeUntil(this.transferComplete$), operators.switchMap(function () { return _this.posService.pos$.pipe(operators.take(1)); }), operators.switchMap(function (pos) {
|
|
8393
|
+
var posSet = pos && pos.extId === transferPosExtId;
|
|
8394
|
+
if (!posSet) {
|
|
8395
|
+
// Special handling for ITM (supplier ID 23)
|
|
8396
|
+
if (_this.isITMSupplier()) {
|
|
8397
|
+
return _this.handleITMPosChange(transferPosExtId);
|
|
8398
|
+
}
|
|
8399
|
+
else {
|
|
8400
|
+
if (transferPosExtId) {
|
|
8401
|
+
_this.contextService.forcePosCallback(transferPosExtId);
|
|
8402
|
+
}
|
|
8403
|
+
}
|
|
8404
|
+
}
|
|
8405
|
+
return rxjs.of(posSet);
|
|
8406
|
+
}));
|
|
8407
|
+
};
|
|
8408
|
+
BasketTransferService.prototype.getCookie = function (name) {
|
|
8409
|
+
var _a;
|
|
8410
|
+
var value = "; " + document.cookie;
|
|
8411
|
+
var parts = value.split("; " + name + "=");
|
|
8412
|
+
if (parts.length === 2) {
|
|
8413
|
+
return ((_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(';').shift()) || null;
|
|
8414
|
+
}
|
|
8415
|
+
return null;
|
|
8416
|
+
};
|
|
8362
8417
|
BasketTransferService.prototype.getTransferData = function () {
|
|
8363
8418
|
var _a;
|
|
8364
8419
|
var currentUrl = window.location.href;
|
|
8365
8420
|
var urlParams = new URL(currentUrl).searchParams;
|
|
8366
8421
|
var basketToken = urlParams.get('transferred_basket_token') || sessionStorage.getItem('_miam/transferredBasketToken');
|
|
8367
|
-
var posExtId = urlParams.get('point_of_sale_ext_id') ||
|
|
8422
|
+
var posExtId = urlParams.get('point_of_sale_ext_id') ||
|
|
8423
|
+
urlParams.get('magasin_id') ||
|
|
8424
|
+
sessionStorage.getItem('_miam/pointOfSaleExtId');
|
|
8368
8425
|
var affiliate = (_a = urlParams.get('affiliate')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
8369
8426
|
if (basketToken && posExtId) {
|
|
8370
8427
|
this.removeTransferParamsFromUrl();
|
|
@@ -8383,6 +8440,7 @@
|
|
|
8383
8440
|
urlParams.delete('point_of_sale_ext_id');
|
|
8384
8441
|
urlParams.delete('magasin_id');
|
|
8385
8442
|
urlParams.delete('affiliate');
|
|
8443
|
+
urlParams.delete('pdvref'); // Remove ITM specific parameter
|
|
8386
8444
|
var newUrl = currentUrl.split('?')[0] + (urlParams.toString().length > 0 ? '?' + urlParams.toString() : '');
|
|
8387
8445
|
history.replaceState({}, document.title, newUrl);
|
|
8388
8446
|
}
|
|
@@ -8397,6 +8455,68 @@
|
|
|
8397
8455
|
miam_amount: basket.totalPrice
|
|
8398
8456
|
};
|
|
8399
8457
|
};
|
|
8458
|
+
// ITM specific methods
|
|
8459
|
+
BasketTransferService.prototype.isITMSupplier = function () {
|
|
8460
|
+
var currentPos = this.posService.pos$.getValue();
|
|
8461
|
+
return currentPos && currentPos.relationships.supplier.data.id === '23';
|
|
8462
|
+
};
|
|
8463
|
+
BasketTransferService.prototype.padPdvref = function (pdvref) {
|
|
8464
|
+
if (!pdvref) {
|
|
8465
|
+
return pdvref;
|
|
8466
|
+
}
|
|
8467
|
+
// Pad pdvref to exactly 5 characters with leading zeros only if shorter than 5
|
|
8468
|
+
return pdvref.length < 5 ? pdvref.padStart(5, '0') : pdvref;
|
|
8469
|
+
};
|
|
8470
|
+
BasketTransferService.prototype.handleITMPosChange = function (transferPosExtId) {
|
|
8471
|
+
var _this = this;
|
|
8472
|
+
var expectedPosId = transferPosExtId;
|
|
8473
|
+
return this.waitForITMCookie(expectedPosId).pipe(operators.catchError(function (error) {
|
|
8474
|
+
console.warn('ITM cookie check failed, falling back to normal POS callback:', error);
|
|
8475
|
+
if (expectedPosId) {
|
|
8476
|
+
_this.contextService.forcePosCallback(transferPosExtId);
|
|
8477
|
+
}
|
|
8478
|
+
return rxjs.of(false);
|
|
8479
|
+
}));
|
|
8480
|
+
};
|
|
8481
|
+
BasketTransferService.prototype.waitForITMCookie = function (transferPosExtId) {
|
|
8482
|
+
var _this = this;
|
|
8483
|
+
return new rxjs.Observable(function (observer) {
|
|
8484
|
+
var maxRetries = 50; // 5 seconds total (50 * 100ms)
|
|
8485
|
+
var retryCount = 0;
|
|
8486
|
+
var checkCookie = function () {
|
|
8487
|
+
retryCount++;
|
|
8488
|
+
var itmPdvCookie = _this.getCookie('itm_pdv');
|
|
8489
|
+
if (itmPdvCookie) {
|
|
8490
|
+
try {
|
|
8491
|
+
var decodedCookie = decodeURIComponent(itmPdvCookie);
|
|
8492
|
+
var pdvData = JSON.parse(decodedCookie);
|
|
8493
|
+
var cookiePosRef = pdvData.ref;
|
|
8494
|
+
// Check if the cookie POS matches the required transfer POS
|
|
8495
|
+
if (cookiePosRef === transferPosExtId) {
|
|
8496
|
+
// Refresh the page to ensure the new POS context is loaded
|
|
8497
|
+
observer.next(true);
|
|
8498
|
+
observer.complete();
|
|
8499
|
+
window.location.reload();
|
|
8500
|
+
return;
|
|
8501
|
+
}
|
|
8502
|
+
}
|
|
8503
|
+
catch (error) {
|
|
8504
|
+
console.warn('Failed to parse itm_pdv cookie:', error);
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
// Check if we've exceeded max retries
|
|
8508
|
+
if (retryCount >= maxRetries) {
|
|
8509
|
+
console.error("Failed to detect ITM POS change after " + maxRetries + " attempts (" + maxRetries * 100 + "ms)");
|
|
8510
|
+
observer.error(new Error("ITM POS change timeout: expected POS " + transferPosExtId + " not detected in cookie"));
|
|
8511
|
+
return;
|
|
8512
|
+
}
|
|
8513
|
+
// If cookie doesn't match or doesn't exist, check again in 100ms
|
|
8514
|
+
setTimeout(checkCookie, 100);
|
|
8515
|
+
};
|
|
8516
|
+
// Start checking immediately
|
|
8517
|
+
checkCookie();
|
|
8518
|
+
});
|
|
8519
|
+
};
|
|
8400
8520
|
return BasketTransferService;
|
|
8401
8521
|
}());
|
|
8402
8522
|
BasketTransferService.ɵfac = function BasketTransferService_Factory(t) { return new (t || BasketTransferService)(i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(ContextService), i0__namespace.ɵɵinject(PointOfSalesService), i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(SuppliersService)); };
|
|
@@ -16538,7 +16658,7 @@
|
|
|
16538
16658
|
BasketTransferModalComponent.prototype.continueTransfer = function () {
|
|
16539
16659
|
this.displayFirstStep = true;
|
|
16540
16660
|
this.displaySecondStep = false;
|
|
16541
|
-
this.basketTransferService.
|
|
16661
|
+
this.basketTransferService.navigateToTransferUrl();
|
|
16542
16662
|
this.cdr.detectChanges();
|
|
16543
16663
|
};
|
|
16544
16664
|
return BasketTransferModalComponent;
|
|
@@ -25878,10 +25998,11 @@
|
|
|
25878
25998
|
}
|
|
25879
25999
|
var NoSupplierOnboardingComponent = /** @class */ (function (_super) {
|
|
25880
26000
|
__extends(NoSupplierOnboardingComponent, _super);
|
|
25881
|
-
function NoSupplierOnboardingComponent(storeLocatoreService, cdr, analyticsService) {
|
|
26001
|
+
function NoSupplierOnboardingComponent(storeLocatoreService, cdr, elRef, analyticsService) {
|
|
25882
26002
|
var _this = _super.call(this, analyticsService) || this;
|
|
25883
26003
|
_this.storeLocatoreService = storeLocatoreService;
|
|
25884
26004
|
_this.cdr = cdr;
|
|
26005
|
+
_this.elRef = elRef;
|
|
25885
26006
|
_this.analyticsService = analyticsService;
|
|
25886
26007
|
_this.display = false;
|
|
25887
26008
|
_this.step = 1;
|
|
@@ -25915,6 +26036,13 @@
|
|
|
25915
26036
|
this.sendEvent(this.analyticsService.EVENT_ONBOARDING_ACTION);
|
|
25916
26037
|
this.confirm();
|
|
25917
26038
|
};
|
|
26039
|
+
NoSupplierOnboardingComponent.prototype.onConfirmButtonClick = function () {
|
|
26040
|
+
this.elRef.nativeElement.dispatchEvent(new CustomEvent('mealz-onboarding-confirm-select-store', {
|
|
26041
|
+
bubbles: true,
|
|
26042
|
+
composed: true
|
|
26043
|
+
}));
|
|
26044
|
+
this.onConfirm();
|
|
26045
|
+
};
|
|
25918
26046
|
NoSupplierOnboardingComponent.prototype.onClose = function () {
|
|
25919
26047
|
this.sendEvent(this.analyticsService.EVENT_ONBOARDING_CLOSE);
|
|
25920
26048
|
this.onConfirm();
|
|
@@ -25935,7 +26063,7 @@
|
|
|
25935
26063
|
};
|
|
25936
26064
|
return NoSupplierOnboardingComponent;
|
|
25937
26065
|
}(EventTracerComponent));
|
|
25938
|
-
NoSupplierOnboardingComponent.ɵfac = function NoSupplierOnboardingComponent_Factory(t) { return new (t || NoSupplierOnboardingComponent)(i0__namespace.ɵɵdirectiveInject(StoreLocatorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(AnalyticsService)); };
|
|
26066
|
+
NoSupplierOnboardingComponent.ɵfac = function NoSupplierOnboardingComponent_Factory(t) { return new (t || NoSupplierOnboardingComponent)(i0__namespace.ɵɵdirectiveInject(StoreLocatorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(AnalyticsService)); };
|
|
25939
26067
|
NoSupplierOnboardingComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: NoSupplierOnboardingComponent, selectors: [["ng-miam-no-supplier-onboarding"]], features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 25, vars: 27, consts: function () {
|
|
25940
26068
|
var i18n_0;
|
|
25941
26069
|
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
|
|
@@ -26037,7 +26165,7 @@
|
|
|
26037
26165
|
}, template: function NoSupplierOnboardingComponent_Template(rf, ctx) {
|
|
26038
26166
|
if (rf & 1) {
|
|
26039
26167
|
i0__namespace.ɵɵelementStart(0, "ng-miam-modal", 0);
|
|
26040
|
-
i0__namespace.ɵɵlistener("confirm", function NoSupplierOnboardingComponent_Template_ng_miam_modal_confirm_0_listener() { return ctx.
|
|
26168
|
+
i0__namespace.ɵɵlistener("confirm", function NoSupplierOnboardingComponent_Template_ng_miam_modal_confirm_0_listener() { return ctx.onConfirmButtonClick(); })("close", function NoSupplierOnboardingComponent_Template_ng_miam_modal_close_0_listener() { return ctx.onClose(); });
|
|
26041
26169
|
i0__namespace.ɵɵelementStart(1, "div", 1);
|
|
26042
26170
|
i0__namespace.ɵɵelementStart(2, "div", 2);
|
|
26043
26171
|
i0__namespace.ɵɵelementStart(3, "span", 3);
|
|
@@ -26122,7 +26250,7 @@
|
|
|
26122
26250
|
encapsulation: i0.ViewEncapsulation.None,
|
|
26123
26251
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
26124
26252
|
}]
|
|
26125
|
-
}], function () { return [{ type: StoreLocatorService }, { type: i0__namespace.ChangeDetectorRef }, { type: AnalyticsService }]; }, null);
|
|
26253
|
+
}], function () { return [{ type: StoreLocatorService }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.ElementRef }, { type: AnalyticsService }]; }, null);
|
|
26126
26254
|
})();
|
|
26127
26255
|
var templateObject_1$1, templateObject_2$1, templateObject_3$1, templateObject_4$1, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
|
|
26128
26256
|
|