ng-miam 3.3.1 → 3.3.2

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.
@@ -428,11 +428,21 @@
428
428
  }(i1.Resource));
429
429
 
430
430
  // Change to true to enable dev mode
431
- var dev = false;
431
+ var env = 'prod';
432
+ var urls = {
433
+ 'prod': 'https://api.miam.tech',
434
+ 'uat': 'https://api-uat.miam.tech',
435
+ 'dev': 'http://localhost:3000'
436
+ };
437
+ var webUrls = {
438
+ 'prod': 'https://miam.tech',
439
+ 'uat': 'https://uat.miam.tech',
440
+ 'dev': 'http://localhost:4200'
441
+ };
432
442
  var environment = {
433
- development: dev,
434
- miamAPI: dev ? 'http://localhost:3000' : 'https://api.miam.tech',
435
- miamWeb: dev ? 'http://localhost:4200' : 'https://miam.tech'
443
+ miamAPI: urls[env],
444
+ miamWeb: webUrls[env],
445
+ isProd: function () { return env === 'prod'; }
436
446
  };
437
447
 
438
448
  var Supplier = /** @class */ (function (_super) {
@@ -628,6 +638,11 @@
628
638
  // Load Google analytics & optimize scripts into host page DOM & create tracker
629
639
  AnalyticsService.prototype.init = function (gaKey, optimizeKey) {
630
640
  if (optimizeKey === void 0) { optimizeKey = null; }
641
+ // we do not have uat or local analytical service, guard it if you are using a non prod script
642
+ if (!environment.isProd()) {
643
+ console.info('[Miam] you are not in prod, do not initialize analytical service');
644
+ return;
645
+ }
631
646
  if (!gaKey || gaKey.length < 0) {
632
647
  console.error('[Miam] Cannot initialize analytics : invalid key', gaKey);
633
648
  return;
@@ -2527,8 +2542,12 @@
2527
2542
  // Send total in cents
2528
2543
  _this.analyticsService.sendEvent('push-basket', null, (total * 100));
2529
2544
  }
2545
+ // set basket as undefined as it because inconsistent while we reset the list. then wait for new one
2546
+ _this.basket$.next(undefined);
2530
2547
  return _this.listsService.resetList();
2531
- }), operators.map(function () { return confirmedBasket; }));
2548
+ }), operators.switchMap(function () {
2549
+ return _this.basket$;
2550
+ }), operators.skipWhile(function (b) { return !b; }), operators.map(function () { return confirmedBasket; }));
2532
2551
  };
2533
2552
  BasketsService.prototype.basketEntries = function () {
2534
2553
  return this._entries$;