ng-miam 8.6.5 → 8.6.7
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 +34 -13
- 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/baskets-synchronizing/baskets-synchronizer.service.js +24 -7
- package/esm2015/lib/_services/baskets.service.js +4 -2
- package/esm2015/lib/_services/context.service.js +8 -7
- package/esm2015/lib/_services/interceptor.service.js +2 -2
- package/fesm2015/ng-miam.js +32 -13
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts +6 -0
- package/lib/_services/baskets-synchronizing/baskets-synchronizer.service.d.ts.map +1 -1
- package/lib/_services/baskets.service.d.ts +1 -0
- package/lib/_services/baskets.service.d.ts.map +1 -1
- package/lib/_services/context.service.d.ts.map +1 -1
- package/package.json +1 -1
package/bundles/ng-miam.umd.js
CHANGED
|
@@ -4114,6 +4114,7 @@
|
|
|
4114
4114
|
_this.basketIsFetching = false;
|
|
4115
4115
|
_this.basketPreviewIsCalculating = false;
|
|
4116
4116
|
_this.basketInitCalled = false;
|
|
4117
|
+
_this.confirming = new rxjs.BehaviorSubject(false);
|
|
4117
4118
|
_this.basketActionsQueue = new rxjs.BehaviorSubject([]);
|
|
4118
4119
|
_this._entries$ = new rxjs.BehaviorSubject([]);
|
|
4119
4120
|
_this.actionsBeingProcessed = new rxjs.BehaviorSubject([]);
|
|
@@ -4346,13 +4347,14 @@
|
|
|
4346
4347
|
*/
|
|
4347
4348
|
BasketsService.prototype.confirmPaymentAndBasket = function (totalPrice) {
|
|
4348
4349
|
var _this = this;
|
|
4350
|
+
this.confirming.next(true);
|
|
4349
4351
|
return this.waitForBasket.pipe(operators.switchMap(function (basket) {
|
|
4350
4352
|
if (+totalPrice > 0 && basket.totalPrice > 0) {
|
|
4351
4353
|
_this.analyticsService.sendEventWhenReady(_this.analyticsService.EVENT_PAYMENT_CONFIRMED, null, _this.eventProps(basket, totalPrice));
|
|
4352
4354
|
return _this.confirmBasket(basket, totalPrice);
|
|
4353
4355
|
}
|
|
4354
4356
|
return _this._basket$;
|
|
4355
|
-
}));
|
|
4357
|
+
}), operators.tap(function () { return _this.confirming.next(false); }));
|
|
4356
4358
|
};
|
|
4357
4359
|
/**
|
|
4358
4360
|
* Tries to confirm basket. Sends analytic event and refresh current basket on successfull confirmation
|
|
@@ -5323,6 +5325,7 @@
|
|
|
5323
5325
|
this.supplierService = supplierService;
|
|
5324
5326
|
this.ignoreUpdatesFromMiam = false;
|
|
5325
5327
|
this.firstMiamBasketProcess = true;
|
|
5328
|
+
this.lockWhileConfirming = new rxjs.BehaviorSubject(false);
|
|
5326
5329
|
/**
|
|
5327
5330
|
* This method needs to be passed to Miam by the retailer
|
|
5328
5331
|
*/
|
|
@@ -5332,6 +5335,7 @@
|
|
|
5332
5335
|
};
|
|
5333
5336
|
// Begin listening for miam's basket (will not fetch basket automatically)
|
|
5334
5337
|
this.supplierService.supplier$.pipe(operators.skipWhile(function (s) { return !s; }), operators.take(1), operators.tap(function () {
|
|
5338
|
+
_this.listenToConfirm();
|
|
5335
5339
|
_this.listenToMiam();
|
|
5336
5340
|
})).subscribe();
|
|
5337
5341
|
}
|
|
@@ -5351,6 +5355,19 @@
|
|
|
5351
5355
|
enumerable: false,
|
|
5352
5356
|
configurable: true
|
|
5353
5357
|
});
|
|
5358
|
+
/**
|
|
5359
|
+
* When basketsService.confirming's last emitted value was true and current emitted value is false,
|
|
5360
|
+
* Reset basket-sync
|
|
5361
|
+
*/
|
|
5362
|
+
BasketsSynchronizerService.prototype.listenToConfirm = function () {
|
|
5363
|
+
var _this = this;
|
|
5364
|
+
this.basketsService.confirming.pipe(operators.skipWhile(function (confirming) { return confirming === _this.lockWhileConfirming.value; })).subscribe(function (confirming) {
|
|
5365
|
+
if (!confirming && _this.lockWhileConfirming.value) {
|
|
5366
|
+
_this.resetMiam();
|
|
5367
|
+
}
|
|
5368
|
+
_this.lockWhileConfirming.next(confirming);
|
|
5369
|
+
});
|
|
5370
|
+
};
|
|
5354
5371
|
/**
|
|
5355
5372
|
* Start listening on Miam's basket
|
|
5356
5373
|
*/
|
|
@@ -5512,14 +5529,17 @@
|
|
|
5512
5529
|
* @param retailerBasket current basket of the retailer
|
|
5513
5530
|
*/
|
|
5514
5531
|
BasketsSynchronizerService.prototype.retailerBasketChanged = function (retailerBasket) {
|
|
5532
|
+
var _this = this;
|
|
5515
5533
|
// eslint-disable-next-line no-console
|
|
5516
5534
|
console.debug("[Miam] Update received from retailer\n - " + JSON.stringify(retailerBasket) + "\n - First retailer basket was : " + JSON.stringify(this.firstRetailerBasket));
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5535
|
+
this.lockWhileConfirming.pipe(operators.skipWhile(function (locked) { return locked; }), operators.take(1)).subscribe(function () {
|
|
5536
|
+
if (!_this.isReady()) {
|
|
5537
|
+
return _this.initFirstRetailerBasket(retailerBasket);
|
|
5538
|
+
}
|
|
5539
|
+
_this.isProcessingRetailerEvent = true;
|
|
5540
|
+
var toRemoveFromMiam = _this.comparatorService.updateReceivedFromRetailer(retailerBasket);
|
|
5541
|
+
_this.sendUpdateToMiam(toRemoveFromMiam);
|
|
5542
|
+
});
|
|
5523
5543
|
};
|
|
5524
5544
|
/**
|
|
5525
5545
|
* Handle Payment and confirm Miam's basket before restarting the synchronization by resetting retailer's basket
|
|
@@ -5913,11 +5933,12 @@
|
|
|
5913
5933
|
};
|
|
5914
5934
|
ContextService.prototype.generateAuthlessIdIfNecessary = function () {
|
|
5915
5935
|
var _this = this;
|
|
5916
|
-
return this.userService.generatingAuthlessId$.pipe(operators.take(1), operators.switchMap(function (isGenerating) {
|
|
5917
|
-
|| _this.loggedOnSession
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5936
|
+
return this.userService.generatingAuthlessId$.pipe(operators.debounceTime(800), operators.take(1), operators.switchMap(function (isGenerating) {
|
|
5937
|
+
if (isGenerating || _this.loggedOnSession || !!localStorage.getItem('_miam/authlessId')) {
|
|
5938
|
+
return rxjs.of(null);
|
|
5939
|
+
}
|
|
5940
|
+
return _this.userService.generateAnonymousUserId();
|
|
5941
|
+
}));
|
|
5921
5942
|
};
|
|
5922
5943
|
return ContextService;
|
|
5923
5944
|
}());
|
|
@@ -8783,7 +8804,7 @@
|
|
|
8783
8804
|
MiamInterceptor.prototype.setMiamHeaders = function (request) {
|
|
8784
8805
|
var headersToAdd = {
|
|
8785
8806
|
'miam-origin': this.context.origin.value,
|
|
8786
|
-
'miam-front-version': '8.6.
|
|
8807
|
+
'miam-front-version': '8.6.7',
|
|
8787
8808
|
'miam-front-type': 'web',
|
|
8788
8809
|
'miam-api-version': '4.7.0'
|
|
8789
8810
|
};
|