ng-miam 10.5.1 → 10.5.3

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.
@@ -3440,7 +3440,7 @@
3440
3440
  EventJourney["EMPTY"] = "";
3441
3441
  })(EventJourney || (EventJourney = {}));
3442
3442
 
3443
- var VERSION = "10.5.1"; // TODO: replace by ##VERSION## and update it in the CI/CD
3443
+ var VERSION = "10.5.3"; // TODO: replace by ##VERSION## and update it in the CI/CD
3444
3444
 
3445
3445
  var ContextRegistryService = /** @class */ (function () {
3446
3446
  function ContextRegistryService() {
@@ -8169,53 +8169,53 @@
8169
8169
  }], function () { return [{ type: BasketsService }]; }, null);
8170
8170
  })();
8171
8171
 
8172
- var RemoveRecipeAction = /** @class */ (function (_super) {
8173
- __extends(RemoveRecipeAction, _super);
8174
- function RemoveRecipeAction() {
8172
+ var RemoveIngredientAction = /** @class */ (function (_super) {
8173
+ __extends(RemoveIngredientAction, _super);
8174
+ function RemoveIngredientAction() {
8175
8175
  return _super !== null && _super.apply(this, arguments) || this;
8176
8176
  }
8177
- Object.defineProperty(RemoveRecipeAction.prototype, "type", {
8177
+ Object.defineProperty(RemoveIngredientAction.prototype, "type", {
8178
8178
  get: function () {
8179
8179
  return 'REMOVE-PRODUCT';
8180
8180
  },
8181
8181
  enumerable: false,
8182
8182
  configurable: true
8183
8183
  });
8184
- // eslint-disable-next-line no-empty-function
8185
- RemoveRecipeAction.prototype.updateMealzBasket = function () {
8184
+ RemoveIngredientAction.prototype.updateMealzBasket = function () {
8185
+ if (this.updateMealzParams.recipeId) {
8186
+ this.basketsService.removeIngredientsFromBasket(this.basketEntry, this.updateMealzParams.recipeId, [this.updateMealzParams.ingredientId], this.updateMealzParams.eventTrace);
8187
+ }
8188
+ else {
8189
+ this.basketsService.removeProduct(this.basketEntry, this.updateMealzParams.eventTrace);
8190
+ }
8186
8191
  };
8187
8192
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
8188
- RemoveRecipeAction.prototype.shouldRemoveAction = function (basketEntryFound) {
8193
+ RemoveIngredientAction.prototype.shouldRemoveAction = function (basketEntryFound) {
8189
8194
  return true;
8190
8195
  };
8191
- return RemoveRecipeAction;
8196
+ return RemoveIngredientAction;
8192
8197
  }(BasketAction));
8193
8198
 
8194
- var RemoveIngredientAction = /** @class */ (function (_super) {
8195
- __extends(RemoveIngredientAction, _super);
8196
- function RemoveIngredientAction() {
8199
+ var RemoveRecipeAction = /** @class */ (function (_super) {
8200
+ __extends(RemoveRecipeAction, _super);
8201
+ function RemoveRecipeAction() {
8197
8202
  return _super !== null && _super.apply(this, arguments) || this;
8198
8203
  }
8199
- Object.defineProperty(RemoveIngredientAction.prototype, "type", {
8204
+ Object.defineProperty(RemoveRecipeAction.prototype, "type", {
8200
8205
  get: function () {
8201
8206
  return 'REMOVE-PRODUCT';
8202
8207
  },
8203
8208
  enumerable: false,
8204
8209
  configurable: true
8205
8210
  });
8206
- RemoveIngredientAction.prototype.updateMealzBasket = function () {
8207
- if (this.updateMealzParams.recipeId) {
8208
- this.basketsService.removeIngredientsFromBasket(this.basketEntry, this.updateMealzParams.recipeId, [this.updateMealzParams.ingredientId], this.updateMealzParams.eventTrace);
8209
- }
8210
- else {
8211
- this.basketsService.removeProduct(this.basketEntry, this.updateMealzParams.eventTrace);
8212
- }
8211
+ // eslint-disable-next-line no-empty-function
8212
+ RemoveRecipeAction.prototype.updateMealzBasket = function () {
8213
8213
  };
8214
8214
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
8215
- RemoveIngredientAction.prototype.shouldRemoveAction = function (basketEntryFound) {
8215
+ RemoveRecipeAction.prototype.shouldRemoveAction = function (basketEntryFound) {
8216
8216
  return true;
8217
8217
  };
8218
- return RemoveIngredientAction;
8218
+ return RemoveRecipeAction;
8219
8219
  }(BasketAction));
8220
8220
 
8221
8221
  var UpdateIngredientAction = /** @class */ (function (_super) {
@@ -8243,13 +8243,148 @@
8243
8243
  return UpdateIngredientAction;
8244
8244
  }(BasketAction));
8245
8245
 
8246
+ var LoadSsrScriptsAndLinksService = /** @class */ (function () {
8247
+ function LoadSsrScriptsAndLinksService(http) {
8248
+ this.http = http;
8249
+ this.MEALZ_SSR_API = environment$1.mealzSsrApi + "/v2";
8250
+ this.componentStylesUrl = '';
8251
+ this.scriptsPaths = [];
8252
+ this.allScriptLoaded$ = new rxjs.BehaviorSubject(false);
8253
+ this.scriptLoaded = 0;
8254
+ }
8255
+ LoadSsrScriptsAndLinksService.prototype.getComponentStyles = function () {
8256
+ return this.http.get(this.componentStylesUrl, {});
8257
+ };
8258
+ LoadSsrScriptsAndLinksService.prototype.loadStyles = function () {
8259
+ var _this = this;
8260
+ this.getComponentStyles().subscribe(function (styles) {
8261
+ var _a;
8262
+ (_a = styles === null || styles === void 0 ? void 0 : styles.links) === null || _a === void 0 ? void 0 : _a.forEach(function (link) {
8263
+ _this.appendElementToHead('link', { rel: 'stylesheet', href: link });
8264
+ });
8265
+ });
8266
+ };
8267
+ /**
8268
+ * Fetches style link URLs from SSR and waits until each stylesheet has loaded (or failed),
8269
+ * so consumers can paint without a FOUC.
8270
+ */
8271
+ LoadSsrScriptsAndLinksService.prototype.loadStylesWhenReady = function () {
8272
+ var _this = this;
8273
+ return this.getComponentStyles().pipe(operators.switchMap(function (styles) {
8274
+ var _a;
8275
+ var links = (_a = styles === null || styles === void 0 ? void 0 : styles.links) !== null && _a !== void 0 ? _a : [];
8276
+ if (links.length === 0) {
8277
+ return rxjs.of(undefined);
8278
+ }
8279
+ return rxjs.forkJoin(links.map(function (href) { return _this.waitForStylesheet(href); })).pipe(operators.map(function () { return undefined; }));
8280
+ }));
8281
+ };
8282
+ LoadSsrScriptsAndLinksService.prototype.waitForStylesheet = function (href) {
8283
+ var existing = Array.from(document.head.querySelectorAll('link[rel="stylesheet"]')).find(function (node) { return node.getAttribute('href') === href; });
8284
+ if (existing === null || existing === void 0 ? void 0 : existing.sheet) {
8285
+ return rxjs.of(undefined);
8286
+ }
8287
+ if (existing) {
8288
+ return new rxjs.Observable(function (subscriber) {
8289
+ var done = function () {
8290
+ subscriber.next();
8291
+ subscriber.complete();
8292
+ };
8293
+ existing.addEventListener('load', done, { once: true });
8294
+ existing.addEventListener('error', done, { once: true });
8295
+ });
8296
+ }
8297
+ return new rxjs.Observable(function (subscriber) {
8298
+ var link = document.createElement('link');
8299
+ link.rel = 'stylesheet';
8300
+ link.href = href;
8301
+ var done = function () {
8302
+ subscriber.next();
8303
+ subscriber.complete();
8304
+ };
8305
+ link.addEventListener('load', done, { once: true });
8306
+ link.addEventListener('error', done, { once: true });
8307
+ document.head.appendChild(link);
8308
+ });
8309
+ };
8310
+ LoadSsrScriptsAndLinksService.prototype.loadComponentScripts = function () {
8311
+ var _this = this;
8312
+ var _a;
8313
+ (_a = this.scriptsPaths) === null || _a === void 0 ? void 0 : _a.forEach(function (script) {
8314
+ var exists = document.head.querySelector("script[type=\"module\"][src=\"" + script + "\"]");
8315
+ if (!exists) {
8316
+ _this.appendElementToHead('script', { type: 'module', src: script });
8317
+ }
8318
+ });
8319
+ };
8320
+ LoadSsrScriptsAndLinksService.prototype.appendElementToHead = function (tag, attributes) {
8321
+ var _this = this;
8322
+ var element = document.createElement(tag);
8323
+ Object.entries(attributes).forEach(function (_b) {
8324
+ var _c = __read(_b, 2), key = _c[0], value = _c[1];
8325
+ return element.setAttribute(key, value);
8326
+ });
8327
+ document.head.appendChild(element);
8328
+ element.onload = function () {
8329
+ _this.scriptLoaded += 1;
8330
+ if (_this.scriptLoaded === _this.scriptsPaths.length) {
8331
+ _this.allScriptLoaded$.next(true);
8332
+ }
8333
+ };
8334
+ };
8335
+ return LoadSsrScriptsAndLinksService;
8336
+ }());
8337
+ LoadSsrScriptsAndLinksService.ɵfac = function LoadSsrScriptsAndLinksService_Factory(t) { return new (t || LoadSsrScriptsAndLinksService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); };
8338
+ LoadSsrScriptsAndLinksService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: LoadSsrScriptsAndLinksService, factory: LoadSsrScriptsAndLinksService.ɵfac, providedIn: 'root' });
8339
+ (function () {
8340
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LoadSsrScriptsAndLinksService, [{
8341
+ type: i0.Injectable,
8342
+ args: [{
8343
+ providedIn: 'root'
8344
+ }]
8345
+ }], function () { return [{ type: i1__namespace.HttpClient }]; }, null);
8346
+ })();
8347
+
8348
+ var LoadLitDrawerService = /** @class */ (function (_super) {
8349
+ __extends(LoadLitDrawerService, _super);
8350
+ function LoadLitDrawerService(http) {
8351
+ var _this = _super.call(this, http) || this;
8352
+ _this.http = http;
8353
+ _this.componentStylesUrl = _this.MEALZ_SSR_API + "/styles/drawer";
8354
+ _this.scriptsPaths = [
8355
+ environment$1.mealzComponents + "/drawer/drawer.min.js",
8356
+ environment$1.mealzComponents + "/drawer-view-swapper/drawer-view-swapper.min.js"
8357
+ ];
8358
+ return _this;
8359
+ }
8360
+ LoadLitDrawerService.prototype.ensureLoaded = function () {
8361
+ if (!this.drawerReady$) {
8362
+ this.loadComponentScripts();
8363
+ this.drawerReady$ = this.loadStylesWhenReady().pipe(operators.catchError(function () { return rxjs.of(undefined); }), operators.shareReplay(1));
8364
+ }
8365
+ return this.drawerReady$;
8366
+ };
8367
+ return LoadLitDrawerService;
8368
+ }(LoadSsrScriptsAndLinksService));
8369
+ LoadLitDrawerService.ɵfac = function LoadLitDrawerService_Factory(t) { return new (t || LoadLitDrawerService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); };
8370
+ LoadLitDrawerService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: LoadLitDrawerService, factory: LoadLitDrawerService.ɵfac, providedIn: 'root' });
8371
+ (function () {
8372
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LoadLitDrawerService, [{
8373
+ type: i0.Injectable,
8374
+ args: [{
8375
+ providedIn: 'root'
8376
+ }]
8377
+ }], function () { return [{ type: i1__namespace.HttpClient }]; }, null);
8378
+ })();
8379
+
8246
8380
  var BasketUtilsService = /** @class */ (function () {
8247
- function BasketUtilsService(basketsService, recipesService, priceService, basketSynchroService, analyticsService) {
8381
+ function BasketUtilsService(basketsService, recipesService, priceService, basketSynchroService, analyticsService, loadLitDrawerService) {
8248
8382
  this.basketsService = basketsService;
8249
8383
  this.recipesService = recipesService;
8250
8384
  this.priceService = priceService;
8251
8385
  this.basketSynchroService = basketSynchroService;
8252
8386
  this.analyticsService = analyticsService;
8387
+ this.loadLitDrawerService = loadLitDrawerService;
8253
8388
  this.recipesWithEntries = [];
8254
8389
  this.basketPreviewState$ = new rxjs.BehaviorSubject({
8255
8390
  isOpen: false,
@@ -8268,13 +8403,16 @@
8268
8403
  return this.matchRecipesWithBasketEntries().pipe(operators.switchMap(function (builtRecipes) { return _this.formatPreview(builtRecipes); }));
8269
8404
  };
8270
8405
  BasketUtilsService.prototype.openBasket = function (analyticsPath, selectedTab) {
8406
+ var _this = this;
8271
8407
  if (analyticsPath === void 0) { analyticsPath = ''; }
8272
8408
  if (selectedTab === void 0) { selectedTab = 0; }
8273
- this.basketPreviewState$.next({
8274
- isOpen: true,
8275
- activeTabIndex: selectedTab
8409
+ this.loadLitDrawerService.ensureLoaded().pipe(operators.take(1)).subscribe(function () {
8410
+ _this.basketPreviewState$.next({
8411
+ isOpen: true,
8412
+ activeTabIndex: selectedTab
8413
+ });
8414
+ _this.analyticsService.sendEvent('basket.display', analyticsPath, {});
8276
8415
  });
8277
- this.analyticsService.sendEvent('basket.display', analyticsPath, {});
8278
8416
  };
8279
8417
  BasketUtilsService.prototype.removeRecipe = function (recipeId, analyticsPath) {
8280
8418
  var _this = this;
@@ -8387,7 +8525,7 @@
8387
8525
  };
8388
8526
  return BasketUtilsService;
8389
8527
  }());
8390
- BasketUtilsService.ɵfac = function BasketUtilsService_Factory(t) { return new (t || BasketUtilsService)(i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(PriceService), i0__namespace.ɵɵinject(BasketsSynchronizerService), i0__namespace.ɵɵinject(AnalyticsService)); };
8528
+ BasketUtilsService.ɵfac = function BasketUtilsService_Factory(t) { return new (t || BasketUtilsService)(i0__namespace.ɵɵinject(BasketsService), i0__namespace.ɵɵinject(RecipesService), i0__namespace.ɵɵinject(PriceService), i0__namespace.ɵɵinject(BasketsSynchronizerService), i0__namespace.ɵɵinject(AnalyticsService), i0__namespace.ɵɵinject(LoadLitDrawerService)); };
8391
8529
  BasketUtilsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: BasketUtilsService, factory: BasketUtilsService.ɵfac, providedIn: 'root' });
8392
8530
  (function () {
8393
8531
  (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(BasketUtilsService, [{
@@ -8395,7 +8533,7 @@
8395
8533
  args: [{
8396
8534
  providedIn: 'root'
8397
8535
  }]
8398
- }], function () { return [{ type: BasketsService }, { type: RecipesService }, { type: PriceService }, { type: BasketsSynchronizerService }, { type: AnalyticsService }]; }, null);
8536
+ }], function () { return [{ type: BasketsService }, { type: RecipesService }, { type: PriceService }, { type: BasketsSynchronizerService }, { type: AnalyticsService }, { type: LoadLitDrawerService }]; }, null);
8399
8537
  })();
8400
8538
 
8401
8539
  var BasketTransferAction = /** @class */ (function (_super) {
@@ -12921,65 +13059,6 @@
12921
13059
  }], function () { return [{ type: i1__namespace.HttpClient }]; }, null);
12922
13060
  })();
12923
13061
 
12924
- var LoadSsrScriptsAndLinksService = /** @class */ (function () {
12925
- function LoadSsrScriptsAndLinksService(http) {
12926
- this.http = http;
12927
- this.MEALZ_SSR_API = environment$1.mealzSsrApi + "/v2";
12928
- this.componentStylesUrl = '';
12929
- this.scriptsPaths = [];
12930
- this.allScriptLoaded$ = new rxjs.BehaviorSubject(false);
12931
- this.scriptLoaded = 0;
12932
- }
12933
- LoadSsrScriptsAndLinksService.prototype.getComponentStyles = function () {
12934
- return this.http.get(this.componentStylesUrl, {});
12935
- };
12936
- LoadSsrScriptsAndLinksService.prototype.loadStyles = function () {
12937
- var _this = this;
12938
- this.getComponentStyles().subscribe(function (styles) {
12939
- var _a;
12940
- (_a = styles === null || styles === void 0 ? void 0 : styles.links) === null || _a === void 0 ? void 0 : _a.forEach(function (link) {
12941
- _this.appendElementToHead('link', { rel: 'stylesheet', href: link });
12942
- });
12943
- });
12944
- };
12945
- LoadSsrScriptsAndLinksService.prototype.loadComponentScripts = function () {
12946
- var _this = this;
12947
- var _a;
12948
- (_a = this.scriptsPaths) === null || _a === void 0 ? void 0 : _a.forEach(function (script) {
12949
- var exists = document.head.querySelector("script[type=\"module\"][src=\"" + script + "\"]");
12950
- if (!exists) {
12951
- _this.appendElementToHead('script', { type: 'module', src: script });
12952
- }
12953
- });
12954
- };
12955
- LoadSsrScriptsAndLinksService.prototype.appendElementToHead = function (tag, attributes) {
12956
- var _this = this;
12957
- var element = document.createElement(tag);
12958
- Object.entries(attributes).forEach(function (_b) {
12959
- var _c = __read(_b, 2), key = _c[0], value = _c[1];
12960
- return element.setAttribute(key, value);
12961
- });
12962
- document.head.appendChild(element);
12963
- element.onload = function () {
12964
- _this.scriptLoaded += 1;
12965
- if (_this.scriptLoaded === _this.scriptsPaths.length) {
12966
- _this.allScriptLoaded$.next(true);
12967
- }
12968
- };
12969
- };
12970
- return LoadSsrScriptsAndLinksService;
12971
- }());
12972
- LoadSsrScriptsAndLinksService.ɵfac = function LoadSsrScriptsAndLinksService_Factory(t) { return new (t || LoadSsrScriptsAndLinksService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); };
12973
- LoadSsrScriptsAndLinksService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: LoadSsrScriptsAndLinksService, factory: LoadSsrScriptsAndLinksService.ɵfac, providedIn: 'root' });
12974
- (function () {
12975
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LoadSsrScriptsAndLinksService, [{
12976
- type: i0.Injectable,
12977
- args: [{
12978
- providedIn: 'root'
12979
- }]
12980
- }], function () { return [{ type: i1__namespace.HttpClient }]; }, null);
12981
- })();
12982
-
12983
13062
  var HistoryService = /** @class */ (function (_super) {
12984
13063
  __extends(HistoryService, _super);
12985
13064
  function HistoryService(http, posService, httpUtils) {
@@ -17352,33 +17431,6 @@
17352
17431
  })();
17353
17432
  var templateObject_1$a;
17354
17433
 
17355
- var LoadLitDrawerService = /** @class */ (function (_super) {
17356
- __extends(LoadLitDrawerService, _super);
17357
- function LoadLitDrawerService(http) {
17358
- var _this = _super.call(this, http) || this;
17359
- _this.http = http;
17360
- _this.componentStylesUrl = _this.MEALZ_SSR_API + "/styles/drawer";
17361
- _this.scriptsPaths = [
17362
- environment$1.mealzComponents + "/drawer/drawer.min.js",
17363
- environment$1.mealzComponents + "/drawer-view-swapper/drawer-view-swapper.min.js",
17364
- ];
17365
- _this.loadStyles();
17366
- _this.loadComponentScripts();
17367
- return _this;
17368
- }
17369
- return LoadLitDrawerService;
17370
- }(LoadSsrScriptsAndLinksService));
17371
- LoadLitDrawerService.ɵfac = function LoadLitDrawerService_Factory(t) { return new (t || LoadLitDrawerService)(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); };
17372
- LoadLitDrawerService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: LoadLitDrawerService, factory: LoadLitDrawerService.ɵfac, providedIn: 'root' });
17373
- (function () {
17374
- (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(LoadLitDrawerService, [{
17375
- type: i0.Injectable,
17376
- args: [{
17377
- providedIn: 'root'
17378
- }]
17379
- }], function () { return [{ type: i1__namespace.HttpClient }]; }, null);
17380
- })();
17381
-
17382
17434
  function RecipeCardCtaComponent_div_0_ng_container_2_Template(rf, ctx) {
17383
17435
  if (rf & 1) {
17384
17436
  i0__namespace.ɵɵelementContainerStart(0);
@@ -17992,6 +18044,7 @@
17992
18044
  }
17993
18045
  RecipeCardComponent.prototype.ngOnInit = function () {
17994
18046
  var _this = this;
18047
+ this.loadLitDrawerService.ensureLoaded().pipe(operators.take(1)).subscribe();
17995
18048
  this.subscriptions.push(this.recipeService.displayedRecipeChanged$.subscribe(function () { return _this.cdr.detectChanges(); }));
17996
18049
  };
17997
18050
  RecipeCardComponent.prototype.currentPath = function () {