ng-miam 10.5.4 → 10.5.5

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.
@@ -1640,7 +1640,7 @@
1640
1640
  env: 'prod',
1641
1641
  miamAPI: 'https://api.miam.tech',
1642
1642
  miamWeb: 'https://miam.tech',
1643
- mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.8/dist',
1643
+ mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.9/dist',
1644
1644
  mealzSsrApi: 'https://ssr-api.mealz.ai',
1645
1645
  lang: 'fr',
1646
1646
  analyticsEnabled: true // Only used in DEV mode
@@ -3115,10 +3115,22 @@
3115
3115
  _this.type = 'suppliers';
3116
3116
  _this.supplier$ = new rxjs.BehaviorSubject(null);
3117
3117
  _this.lastSupplierCart = []; // Stock the last retailer's cart for external purposes
3118
+ _this.token$ = new rxjs.BehaviorSubject(null);
3118
3119
  _this.url = environment$1.miamAPI + "/api/v1";
3119
3120
  _this.register();
3120
3121
  return _this;
3121
3122
  }
3123
+ Object.defineProperty(SuppliersService.prototype, "token", {
3124
+ get: function () {
3125
+ return this._token;
3126
+ },
3127
+ set: function (value) {
3128
+ this._token = value;
3129
+ this.token$.next(value);
3130
+ },
3131
+ enumerable: false,
3132
+ configurable: true
3133
+ });
3122
3134
  SuppliersService.prototype.loadSupplier = function (supplierId) {
3123
3135
  var _this = this;
3124
3136
  this.supplier$.next(null);
@@ -3440,7 +3452,7 @@
3440
3452
  EventJourney["EMPTY"] = "";
3441
3453
  })(EventJourney || (EventJourney = {}));
3442
3454
 
3443
- var VERSION = "10.5.4"; // TODO: replace by ##VERSION## and update it in the CI/CD
3455
+ var VERSION = "10.5.5"; // TODO: replace by ##VERSION## and update it in the CI/CD
3444
3456
 
3445
3457
  var ContextRegistryService = /** @class */ (function () {
3446
3458
  function ContextRegistryService() {
@@ -3917,6 +3929,7 @@
3917
3929
  this.suppliersService = suppliersService;
3918
3930
  this.toasterService = toasterService;
3919
3931
  this.ignoredBasketsService = ignoredBasketsService;
3932
+ this.language$ = new rxjs.BehaviorSubject(null);
3920
3933
  this.isLogged$ = new rxjs.BehaviorSubject(false);
3921
3934
  this.preferencesActivated$ = new rxjs.BehaviorSubject(false);
3922
3935
  this.generatingAuthlessId$ = new rxjs.BehaviorSubject(false);
@@ -3926,6 +3939,17 @@
3926
3939
  this.userProvider$ = new rxjs.BehaviorSubject(undefined);
3927
3940
  this.userSupplier$ = new rxjs.BehaviorSubject(undefined);
3928
3941
  }
3942
+ Object.defineProperty(UserService.prototype, "language", {
3943
+ get: function () {
3944
+ return this._language;
3945
+ },
3946
+ set: function (value) {
3947
+ this._language = value;
3948
+ this.language$.next(value);
3949
+ },
3950
+ enumerable: false,
3951
+ configurable: true
3952
+ });
3929
3953
  Object.defineProperty(UserService.prototype, "userProvider", {
3930
3954
  get: function () {
3931
3955
  return this.userProvider$.pipe(operators.skipWhile(function (provider) { return provider === undefined; }));
@@ -4448,6 +4472,16 @@
4448
4472
  }
4449
4473
  return headers;
4450
4474
  };
4475
+ HttpUtilsService.prototype.waitForSsrHeaders = function () {
4476
+ var _this = this;
4477
+ return rxjs.combineLatest([
4478
+ this.suppliersService.token$,
4479
+ this.userService.language$
4480
+ ]).pipe(operators.filter(function (_a) {
4481
+ var _b = __read(_a, 2), supplierToken = _b[0], languageId = _b[1];
4482
+ return !!supplierToken && !!languageId;
4483
+ }), operators.take(1), operators.map(function () { return _this.buildHeaders(); }));
4484
+ };
4451
4485
  return HttpUtilsService;
4452
4486
  }());
4453
4487
  HttpUtilsService.ɵfac = function HttpUtilsService_Factory(t) { return new (t || HttpUtilsService)(i0__namespace.ɵɵinject(SuppliersService), i0__namespace.ɵɵinject(UserService)); };
@@ -13110,7 +13144,7 @@
13110
13144
  env: 'prod',
13111
13145
  miamAPI: 'https://api.miam.tech',
13112
13146
  miamWeb: 'https://miam.tech',
13113
- mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.8/dist',
13147
+ mealzComponents: 'https://cdn.jsdelivr.net/npm/mealz-components@2.9/dist',
13114
13148
  mealzSsrApi: 'https://ssr-api.mealz.ai',
13115
13149
  lang: 'fr',
13116
13150
  analyticsEnabled: true // Only used in DEV mode
@@ -22077,11 +22111,11 @@
22077
22111
  }
22078
22112
  NoSupplierAddToCartCtaService.prototype.displayNoSupplierAddToCartCta = function (recipeId, guests) {
22079
22113
  var _this = this;
22080
- var headers = this.httpUtils.buildHeaders();
22081
- this.loadStyles();
22082
- this.loadComponentScripts();
22083
- this.fetchingHTMLLoader$.next(true);
22084
- return this.posService.posWasInitialized().pipe(operators.take(1), operators.map(function (wasInitialized) { return wasInitialized ? _this.posService.pos$.value : null; }), operators.switchMap(function (pos) {
22114
+ return this.httpUtils.waitForSsrHeaders().pipe(operators.tap(function () {
22115
+ _this.loadStyles();
22116
+ _this.loadComponentScripts();
22117
+ _this.fetchingHTMLLoader$.next(true);
22118
+ }), operators.switchMap(function (headers) { return _this.posService.posWasInitialized().pipe(operators.take(1), operators.map(function (wasInitialized) { return wasInitialized ? _this.posService.pos$.value : null; }), operators.switchMap(function (pos) {
22085
22119
  var url = _this.MEALZ_SSR_API + "/no-supplier-add-to-cart-cta?recipe_id=" + recipeId;
22086
22120
  if (pos === null || pos === void 0 ? void 0 : pos.id) {
22087
22121
  url += "&store_id=" + pos.id;
@@ -22090,7 +22124,7 @@
22090
22124
  url += "&guests=" + guests;
22091
22125
  }
22092
22126
  return _this.http.get(url, { headers: headers, responseType: 'text' });
22093
- }), operators.tap(function () { return _this.fetchingHTMLLoader$.next(false); }));
22127
+ })); }), operators.finalize(function () { return _this.fetchingHTMLLoader$.next(false); }));
22094
22128
  };
22095
22129
  return NoSupplierAddToCartCtaService;
22096
22130
  }(LoadSsrScriptsAndLinksService));
@@ -22113,12 +22147,17 @@
22113
22147
  this.clicked = new i0.EventEmitter();
22114
22148
  this.ctaHTML = null;
22115
22149
  }
22116
- NoSupplierAddToCartCtaComponent.prototype.ngOnInit = function () {
22117
- this.loadComponent();
22150
+ NoSupplierAddToCartCtaComponent.prototype.ngOnChanges = function (changes) {
22151
+ var recipeId = String(this.recipeId);
22152
+ if (!changes.recipeId || !this.recipeId || recipeId === this.loadedRecipeId) {
22153
+ return;
22154
+ }
22155
+ this.loadComponent(recipeId);
22118
22156
  };
22119
- NoSupplierAddToCartCtaComponent.prototype.loadComponent = function () {
22157
+ NoSupplierAddToCartCtaComponent.prototype.loadComponent = function (recipeId) {
22120
22158
  var _this = this;
22121
- this.noSupplierAddToCartCtaService.displayNoSupplierAddToCartCta(this.recipeId, this.guests).pipe(operators.take(1)).subscribe({
22159
+ this.loadedRecipeId = recipeId;
22160
+ this.noSupplierAddToCartCtaService.displayNoSupplierAddToCartCta(recipeId, this.guests).pipe(operators.take(1)).subscribe({
22122
22161
  next: function (html) {
22123
22162
  _this.ctaHTML = _this.sanitizer.bypassSecurityTrustHtml(html);
22124
22163
  _this.clicked.emit();
@@ -22132,7 +22171,7 @@
22132
22171
  return NoSupplierAddToCartCtaComponent;
22133
22172
  }());
22134
22173
  NoSupplierAddToCartCtaComponent.ɵfac = function NoSupplierAddToCartCtaComponent_Factory(t) { return new (t || NoSupplierAddToCartCtaComponent)(i0__namespace.ɵɵdirectiveInject(NoSupplierAddToCartCtaService), i0__namespace.ɵɵdirectiveInject(i2__namespace.DomSanitizer), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef)); };
22135
- NoSupplierAddToCartCtaComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: NoSupplierAddToCartCtaComponent, selectors: [["ng-miam-no-supplier-add-to-cart-cta"]], inputs: { recipeId: "recipeId", guests: "guests" }, outputs: { clicked: "clicked" }, decls: 1, vars: 1, consts: [[3, "innerHTML"]], template: function NoSupplierAddToCartCtaComponent_Template(rf, ctx) {
22174
+ NoSupplierAddToCartCtaComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: NoSupplierAddToCartCtaComponent, selectors: [["ng-miam-no-supplier-add-to-cart-cta"]], inputs: { recipeId: "recipeId", guests: "guests" }, outputs: { clicked: "clicked" }, features: [i0__namespace.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "innerHTML"]], template: function NoSupplierAddToCartCtaComponent_Template(rf, ctx) {
22136
22175
  if (rf & 1) {
22137
22176
  i0__namespace.ɵɵelement(0, "div", 0);
22138
22177
  }