ng-miam 9.1.31 → 9.1.32
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 +178 -14
- 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/_components/product-card/product-card.component.js +11 -3
- package/esm2015/lib/_services/analytics.service.js +5 -1
- package/esm2015/lib/_services/context.service.js +4 -2
- package/esm2015/lib/_types/builded/mealz-interface.js +1 -1
- package/esm2015/lib/_utils/attach-product-show-tracking.js +56 -0
- package/esm2015/lib/_utils/product-show-tracker.js +61 -0
- package/esm2015/lib/_web-components/basket-preview/basket-preview-line/basket-preview-line.component.js +7 -5
- package/esm2015/lib/_web-components/recipe-details/recipe-details.component.js +9 -1
- package/esm2015/lib/_web-components/recipe-modal/recipe-modal.component.js +19 -3
- package/esm2015/lib/environments/version.js +2 -2
- package/fesm2015/ng-miam.js +165 -14
- package/fesm2015/ng-miam.js.map +1 -1
- package/lib/_components/product-card/product-card.component.d.ts +1 -0
- package/lib/_components/product-card/product-card.component.d.ts.map +1 -1
- package/lib/_services/analytics.service.d.ts.map +1 -1
- package/lib/_services/context.service.d.ts.map +1 -1
- package/lib/_types/builded/mealz-interface.d.ts +7 -0
- package/lib/_types/builded/mealz-interface.d.ts.map +1 -1
- package/lib/_utils/attach-product-show-tracking.d.ts +14 -0
- package/lib/_utils/attach-product-show-tracking.d.ts.map +1 -0
- package/lib/_utils/product-show-tracker.d.ts +24 -0
- package/lib/_utils/product-show-tracker.d.ts.map +1 -0
- package/lib/_web-components/basket-preview/basket-preview-line/basket-preview-line.component.d.ts.map +1 -1
- package/lib/_web-components/recipe-details/recipe-details.component.d.ts.map +1 -1
- package/lib/_web-components/recipe-modal/recipe-modal.component.d.ts +1 -0
- package/lib/_web-components/recipe-modal/recipe-modal.component.d.ts.map +1 -1
- package/lib/environments/version.d.ts +1 -1
- package/package.json +1 -1
package/bundles/ng-miam.umd.js
CHANGED
|
@@ -1838,7 +1838,7 @@
|
|
|
1838
1838
|
analyticsEnabled: true // Only used in DEV mode
|
|
1839
1839
|
};
|
|
1840
1840
|
|
|
1841
|
-
var WINDOW_SINGLETON_KEY = '__mealzRecipeCardShowTracker__';
|
|
1841
|
+
var WINDOW_SINGLETON_KEY$1 = '__mealzRecipeCardShowTracker__';
|
|
1842
1842
|
/**
|
|
1843
1843
|
* Tracks recipe.show events and prevents duplicates for 5 minutes per recipe.
|
|
1844
1844
|
* Shared across SDK and Lit recipe cards via {@link WINDOW_SINGLETON_KEY} on window.
|
|
@@ -1861,7 +1861,7 @@
|
|
|
1861
1861
|
var w = typeof window !== 'undefined'
|
|
1862
1862
|
? window
|
|
1863
1863
|
: undefined;
|
|
1864
|
-
var fromWindow = w === null || w === void 0 ? void 0 : w[WINDOW_SINGLETON_KEY];
|
|
1864
|
+
var fromWindow = w === null || w === void 0 ? void 0 : w[WINDOW_SINGLETON_KEY$1];
|
|
1865
1865
|
if (fromWindow) {
|
|
1866
1866
|
RecipeCardShowTracker.instance = fromWindow;
|
|
1867
1867
|
return fromWindow;
|
|
@@ -1869,7 +1869,7 @@
|
|
|
1869
1869
|
if (!RecipeCardShowTracker.instance) {
|
|
1870
1870
|
RecipeCardShowTracker.instance = new RecipeCardShowTracker();
|
|
1871
1871
|
if (w) {
|
|
1872
|
-
w[WINDOW_SINGLETON_KEY] = RecipeCardShowTracker.instance;
|
|
1872
|
+
w[WINDOW_SINGLETON_KEY$1] = RecipeCardShowTracker.instance;
|
|
1873
1873
|
}
|
|
1874
1874
|
}
|
|
1875
1875
|
return RecipeCardShowTracker.instance;
|
|
@@ -1922,7 +1922,7 @@
|
|
|
1922
1922
|
this.trackedRecipes.clear();
|
|
1923
1923
|
RecipeCardShowTracker.instance = null;
|
|
1924
1924
|
if (typeof window !== 'undefined') {
|
|
1925
|
-
delete window[WINDOW_SINGLETON_KEY];
|
|
1925
|
+
delete window[WINDOW_SINGLETON_KEY$1];
|
|
1926
1926
|
}
|
|
1927
1927
|
};
|
|
1928
1928
|
RecipeCardShowTracker.prototype.startAutoCleanup = function () {
|
|
@@ -2010,6 +2010,134 @@
|
|
|
2010
2010
|
};
|
|
2011
2011
|
}
|
|
2012
2012
|
|
|
2013
|
+
var WINDOW_SINGLETON_KEY = '__mealzProductShowTracker__';
|
|
2014
|
+
/**
|
|
2015
|
+
* Dedupes product.show per recipe visit (recipeId:itemId).
|
|
2016
|
+
* Cleared by recipe-modal on drawer close or recipe switch, and by standalone recipe-details on destroy.
|
|
2017
|
+
*/
|
|
2018
|
+
var ProductShowTracker = /** @class */ (function () {
|
|
2019
|
+
function ProductShowTracker() {
|
|
2020
|
+
var _this = this;
|
|
2021
|
+
this.trackedKeys = new Set();
|
|
2022
|
+
this.handlePageUnload = function () {
|
|
2023
|
+
_this.destroy();
|
|
2024
|
+
};
|
|
2025
|
+
if (typeof window !== 'undefined') {
|
|
2026
|
+
window.addEventListener('beforeunload', this.handlePageUnload);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
ProductShowTracker.getInstance = function () {
|
|
2030
|
+
var windowRef = typeof window !== 'undefined' ? window : undefined;
|
|
2031
|
+
var fromWindow = windowRef === null || windowRef === void 0 ? void 0 : windowRef[WINDOW_SINGLETON_KEY];
|
|
2032
|
+
if (fromWindow) {
|
|
2033
|
+
ProductShowTracker.instance = fromWindow;
|
|
2034
|
+
return fromWindow;
|
|
2035
|
+
}
|
|
2036
|
+
if (!ProductShowTracker.instance) {
|
|
2037
|
+
ProductShowTracker.instance = new ProductShowTracker();
|
|
2038
|
+
if (windowRef) {
|
|
2039
|
+
windowRef[WINDOW_SINGLETON_KEY] = ProductShowTracker.instance;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
return ProductShowTracker.instance;
|
|
2043
|
+
};
|
|
2044
|
+
ProductShowTracker.prototype.trackProductShow = function (analyticsPath, props) {
|
|
2045
|
+
var _a, _b;
|
|
2046
|
+
var trackingKey = props.recipe_id + ":" + props.item_id;
|
|
2047
|
+
if (this.trackedKeys.has(trackingKey)) {
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
this.trackedKeys.add(trackingKey);
|
|
2051
|
+
(_b = (_a = window.mealzInternal) === null || _a === void 0 ? void 0 : _a.analytics) === null || _b === void 0 ? void 0 : _b.sendEvent('product.show', analyticsPath, props);
|
|
2052
|
+
};
|
|
2053
|
+
ProductShowTracker.prototype.clearForRecipe = function (recipeId) {
|
|
2054
|
+
var e_1, _c;
|
|
2055
|
+
var prefix = recipeId + ":";
|
|
2056
|
+
try {
|
|
2057
|
+
for (var _d = __values(this.trackedKeys), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2058
|
+
var key = _e.value;
|
|
2059
|
+
if (key.startsWith(prefix)) {
|
|
2060
|
+
this.trackedKeys.delete(key);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2065
|
+
finally {
|
|
2066
|
+
try {
|
|
2067
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
2068
|
+
}
|
|
2069
|
+
finally { if (e_1) throw e_1.error; }
|
|
2070
|
+
}
|
|
2071
|
+
};
|
|
2072
|
+
ProductShowTracker.prototype.clearAll = function () {
|
|
2073
|
+
this.trackedKeys.clear();
|
|
2074
|
+
};
|
|
2075
|
+
ProductShowTracker.prototype.destroy = function () {
|
|
2076
|
+
if (typeof window !== 'undefined') {
|
|
2077
|
+
window.removeEventListener('beforeunload', this.handlePageUnload);
|
|
2078
|
+
delete window[WINDOW_SINGLETON_KEY];
|
|
2079
|
+
}
|
|
2080
|
+
this.trackedKeys.clear();
|
|
2081
|
+
ProductShowTracker.instance = null;
|
|
2082
|
+
};
|
|
2083
|
+
return ProductShowTracker;
|
|
2084
|
+
}());
|
|
2085
|
+
ProductShowTracker.instance = null;
|
|
2086
|
+
|
|
2087
|
+
var PRODUCT_SHOW_ANALYTICS_PATH_SUFFIX = '/shopping';
|
|
2088
|
+
var PRODUCT_SHOW_VISIBILITY_THRESHOLD = 0.8;
|
|
2089
|
+
var PRODUCT_SHOW_DEBOUNCE_MS = 1000;
|
|
2090
|
+
var SKIP_PRODUCT_SHOW_STATUSES = ['unavailable', 'out_of_stock', 'ignored', 'deleted', 'often_deleted'];
|
|
2091
|
+
function buildProductShowProps(product, recipeId) {
|
|
2092
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2093
|
+
var basketEntry = product === null || product === void 0 ? void 0 : product.basketEntry;
|
|
2094
|
+
var selectedItem = basketEntry === null || basketEntry === void 0 ? void 0 : basketEntry.selectedItem;
|
|
2095
|
+
var item = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) != null ? selectedItem : product === null || product === void 0 ? void 0 : product.item;
|
|
2096
|
+
if ((item === null || item === void 0 ? void 0 : item.id) == null) {
|
|
2097
|
+
return null;
|
|
2098
|
+
}
|
|
2099
|
+
var itemAttributes = item.attributes || {};
|
|
2100
|
+
var entryName = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) != null
|
|
2101
|
+
? ((_c = (_a = basketEntry.name) !== null && _a !== void 0 ? _a : (_b = basketEntry.attributes) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '')
|
|
2102
|
+
: ((_h = (_f = (_e = (_d = product.ingredient) === null || _d === void 0 ? void 0 : _d.attributes) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : (_g = product.ingredient) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : '');
|
|
2103
|
+
var productBasePrice = ((_j = product === null || product === void 0 ? void 0 : product.price) === null || _j === void 0 ? void 0 : _j.unit) != null ? String(product.price.unit) : '0.0';
|
|
2104
|
+
return {
|
|
2105
|
+
entry_name: entryName,
|
|
2106
|
+
item_id: String(item.id),
|
|
2107
|
+
ext_item_id: String((_k = itemAttributes['ext-id']) !== null && _k !== void 0 ? _k : ''),
|
|
2108
|
+
item_ean: String((_m = (_l = item.ean) !== null && _l !== void 0 ? _l : itemAttributes.ean) !== null && _m !== void 0 ? _m : ''),
|
|
2109
|
+
recipe_id: recipeId,
|
|
2110
|
+
product_base_price: productBasePrice
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
function isProductShowEligible(status) {
|
|
2114
|
+
return !!status && !SKIP_PRODUCT_SHOW_STATUSES.includes(status);
|
|
2115
|
+
}
|
|
2116
|
+
function getProductShowStatus(product) {
|
|
2117
|
+
var _a, _b;
|
|
2118
|
+
return (_b = (_a = product.basketEntry) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : product.status;
|
|
2119
|
+
}
|
|
2120
|
+
function attachProductShowTracking(options) {
|
|
2121
|
+
var element = options.element, product = options.product, recipeId = options.recipeId, _o = options.analyticsPath, analyticsPath = _o === void 0 ? "/recipes/" + recipeId + PRODUCT_SHOW_ANALYTICS_PATH_SUFFIX : _o;
|
|
2122
|
+
ProductShowTracker.getInstance();
|
|
2123
|
+
var listener = new ViewportListener(element, function () {
|
|
2124
|
+
if (!isProductShowEligible(getProductShowStatus(product))) {
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
2127
|
+
var props = buildProductShowProps(product, recipeId);
|
|
2128
|
+
if (!props) {
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2131
|
+
ProductShowTracker.getInstance().trackProductShow(analyticsPath, props);
|
|
2132
|
+
}, {
|
|
2133
|
+
threshold: PRODUCT_SHOW_VISIBILITY_THRESHOLD,
|
|
2134
|
+
debounce: PRODUCT_SHOW_DEBOUNCE_MS
|
|
2135
|
+
});
|
|
2136
|
+
return {
|
|
2137
|
+
disconnect: function () { return listener.disconnect(); }
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2013
2141
|
var Ingredient = /** @class */ (function (_super) {
|
|
2014
2142
|
__extends(Ingredient, _super);
|
|
2015
2143
|
function Ingredient() {
|
|
@@ -3823,7 +3951,7 @@
|
|
|
3823
3951
|
EventJourney["EMPTY"] = "";
|
|
3824
3952
|
})(EventJourney || (EventJourney = {}));
|
|
3825
3953
|
|
|
3826
|
-
var VERSION = "9.1.
|
|
3954
|
+
var VERSION = "9.1.32"; // TODO: replace by ##VERSION## and update it in the CI/CD
|
|
3827
3955
|
|
|
3828
3956
|
var ContextRegistryService = /** @class */ (function () {
|
|
3829
3957
|
function ContextRegistryService() {
|
|
@@ -3960,6 +4088,7 @@
|
|
|
3960
4088
|
var detectedJourney = journey !== null && journey !== void 0 ? journey : detectJourney();
|
|
3961
4089
|
var isBulk = actions.length > 1;
|
|
3962
4090
|
actions.forEach(function (action) {
|
|
4091
|
+
var _a;
|
|
3963
4092
|
// Determine add_source: replacement if previousItem exists, otherwise unit or bulk based on actions count
|
|
3964
4093
|
var addSource;
|
|
3965
4094
|
if (action.params.previousItem) {
|
|
@@ -3977,6 +4106,7 @@
|
|
|
3977
4106
|
ext_item_id: action.params.basketEntry.selectedItem.attributes['ext-id'],
|
|
3978
4107
|
item_ean: action.params.basketEntry.selectedItem.ean,
|
|
3979
4108
|
product_quantity: action.params.basketEntry.quantity.toString(),
|
|
4109
|
+
product_base_price: ((_a = action.params.basketEntry.price) !== null && _a !== void 0 ? _a : 0).toString(),
|
|
3980
4110
|
recipe_id: action.params.recipeId,
|
|
3981
4111
|
add_source: addSource
|
|
3982
4112
|
}, detectedJourney);
|
|
@@ -3986,12 +4116,14 @@
|
|
|
3986
4116
|
var _this = this;
|
|
3987
4117
|
var detectedJourney = journey !== null && journey !== void 0 ? journey : detectJourney();
|
|
3988
4118
|
actions.forEach(function (action) {
|
|
4119
|
+
var _a;
|
|
3989
4120
|
_this.sendEvent('entry.deleted', action.params.eventTrace.originPath, {
|
|
3990
4121
|
entry_name: action.params.basketEntry.name,
|
|
3991
4122
|
item_id: action.params.basketEntry.selectedItem.id,
|
|
3992
4123
|
ext_item_id: action.params.basketEntry.selectedItem.attributes['ext-id'],
|
|
3993
4124
|
item_ean: action.params.basketEntry.selectedItem.ean,
|
|
3994
4125
|
product_quantity: action.params.basketEntry.quantity.toString(),
|
|
4126
|
+
product_base_price: ((_a = action.params.basketEntry.price) !== null && _a !== void 0 ? _a : 0).toString(),
|
|
3995
4127
|
recipe_id: action.params.recipeId
|
|
3996
4128
|
}, detectedJourney);
|
|
3997
4129
|
});
|
|
@@ -8303,7 +8435,8 @@
|
|
|
8303
8435
|
},
|
|
8304
8436
|
eventSent$: this.analyticsService.eventEmitter,
|
|
8305
8437
|
setAbTestKey: function (key) { return _this.analyticsService.setAbTestKey(key); },
|
|
8306
|
-
attachRecipeCardShowTracking: attachRecipeCardShowTracking
|
|
8438
|
+
attachRecipeCardShowTracking: attachRecipeCardShowTracking,
|
|
8439
|
+
attachProductShowTracking: attachProductShowTracking
|
|
8307
8440
|
},
|
|
8308
8441
|
basket: {
|
|
8309
8442
|
basketIsReady$: this.basketsService.basketStats$.pipe(operators.skipWhile(function (stats) { return !stats; }), operators.take(1), operators.map(function () { return true; })),
|
|
@@ -15315,10 +15448,17 @@
|
|
|
15315
15448
|
var _this = this;
|
|
15316
15449
|
this.subscriptions.push(this.recipeDetailsService.productsByCategory$.subscribe(function () { return _this.isProductSponsored(); }), this.executeActionFromStorage(), this.loadOnRecipesActions(), this.loadOnIngredientsUpdate(), this.updateIngredientQuantityOnRecipeChange(), this.productIsBeingAdded(), this.scrollBackOnProductReplaced());
|
|
15317
15450
|
this.getHeaderHeight();
|
|
15451
|
+
this.productShowTrackingHandle = attachProductShowTracking({
|
|
15452
|
+
element: this.elementRef.nativeElement,
|
|
15453
|
+
product: this.product,
|
|
15454
|
+
recipeId: this.recipeDetailsService.recipe.id,
|
|
15455
|
+
analyticsPath: this.path || undefined
|
|
15456
|
+
});
|
|
15318
15457
|
};
|
|
15319
15458
|
ProductCardComponent.prototype.ngOnDestroy = function () {
|
|
15320
|
-
var _a;
|
|
15321
|
-
(_a = this.
|
|
15459
|
+
var _a, _b;
|
|
15460
|
+
(_a = this.productShowTrackingHandle) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
15461
|
+
(_b = this.subscriptions) === null || _b === void 0 ? void 0 : _b.forEach(function (sub) { return sub.unsubscribe(); });
|
|
15322
15462
|
};
|
|
15323
15463
|
ProductCardComponent.prototype.scrollBackOnProductReplaced = function () {
|
|
15324
15464
|
var _this = this;
|
|
@@ -17578,7 +17718,7 @@
|
|
|
17578
17718
|
}
|
|
17579
17719
|
};
|
|
17580
17720
|
BasketPreviewLineComponent.prototype.deleteEntry = function (line) {
|
|
17581
|
-
var _a;
|
|
17721
|
+
var _a, _b;
|
|
17582
17722
|
var entry = line.record;
|
|
17583
17723
|
this.analyticsService.sendEvent('entry.deleted', this.path, {
|
|
17584
17724
|
entry_name: entry.name,
|
|
@@ -17586,7 +17726,8 @@
|
|
|
17586
17726
|
ext_item_id: entry.selectedItem.attributes['ext-id'],
|
|
17587
17727
|
item_ean: entry.selectedItem.ean,
|
|
17588
17728
|
product_quantity: entry.quantity.toString(),
|
|
17589
|
-
|
|
17729
|
+
product_base_price: ((_a = entry.price) !== null && _a !== void 0 ? _a : 0).toString(),
|
|
17730
|
+
recipe_id: (_b = this.line.recipe) === null || _b === void 0 ? void 0 : _b.id
|
|
17590
17731
|
});
|
|
17591
17732
|
var deletedBasketEntry = deepCloneWithClass(entry);
|
|
17592
17733
|
deletedBasketEntry.quantity = 0;
|
|
@@ -17633,14 +17774,15 @@
|
|
|
17633
17774
|
};
|
|
17634
17775
|
BasketPreviewLineComponent.prototype.addEntry = function (entry) {
|
|
17635
17776
|
var _this = this;
|
|
17636
|
-
var _a;
|
|
17777
|
+
var _a, _b;
|
|
17637
17778
|
this.analyticsService.sendEvent('entry.added', this.path, {
|
|
17638
17779
|
entry_name: entry.name,
|
|
17639
17780
|
item_id: entry.selectedItem.id,
|
|
17640
17781
|
ext_item_id: entry.selectedItem.attributes['ext-id'],
|
|
17641
17782
|
item_ean: entry.selectedItem.ean,
|
|
17642
17783
|
product_quantity: entry.quantity.toString(),
|
|
17643
|
-
|
|
17784
|
+
product_base_price: ((_a = entry.price) !== null && _a !== void 0 ? _a : 0).toString(),
|
|
17785
|
+
recipe_id: (_b = this.line.recipe) === null || _b === void 0 ? void 0 : _b.id
|
|
17644
17786
|
});
|
|
17645
17787
|
entry.status = 'active';
|
|
17646
17788
|
this.subscriptions.push(entry.save().pipe(operators.switchMap(function () { return _this.basketsService.reloadBasket(); })).subscribe());
|
|
@@ -28091,6 +28233,13 @@
|
|
|
28091
28233
|
this.recipeDetailsService.allIngredientsToBasketLoading = false;
|
|
28092
28234
|
};
|
|
28093
28235
|
RecipeDetailsComponent.prototype.ngOnDestroy = function () {
|
|
28236
|
+
var _a, _b, _c;
|
|
28237
|
+
if (!((_a = this.recipesService.displayedRecipe$.value) === null || _a === void 0 ? void 0 : _a.recipe)) {
|
|
28238
|
+
var recipeId = (_b = this.recipeId) !== null && _b !== void 0 ? _b : (_c = this.recipeDetailsService.recipe) === null || _c === void 0 ? void 0 : _c.id;
|
|
28239
|
+
if (recipeId != null) {
|
|
28240
|
+
ProductShowTracker.getInstance().clearForRecipe(String(recipeId));
|
|
28241
|
+
}
|
|
28242
|
+
}
|
|
28094
28243
|
this.recipeDetailsService.pageviewEventWasSent = false;
|
|
28095
28244
|
this.subscriptions.forEach(function (sub) { return sub === null || sub === void 0 ? void 0 : sub.unsubscribe(); });
|
|
28096
28245
|
if (this.contextService.seoEnabled) {
|
|
@@ -29587,6 +29736,8 @@
|
|
|
29587
29736
|
}));
|
|
29588
29737
|
};
|
|
29589
29738
|
RecipeModalComponent.prototype.closeRecipeModal = function () {
|
|
29739
|
+
var _a;
|
|
29740
|
+
this.clearProductShowForRecipe((_a = this.recipe) === null || _a === void 0 ? void 0 : _a.id);
|
|
29590
29741
|
this.show = false;
|
|
29591
29742
|
this._storeLocatorInit = false;
|
|
29592
29743
|
this.storeLocatorService.closeStoreLocator();
|
|
@@ -29601,7 +29752,12 @@
|
|
|
29601
29752
|
this.cdr.detectChanges();
|
|
29602
29753
|
};
|
|
29603
29754
|
RecipeModalComponent.prototype.handleRecipeDisplay = function (result) {
|
|
29604
|
-
var _a;
|
|
29755
|
+
var _a, _b, _c;
|
|
29756
|
+
var previousRecipeId = (_a = this.recipe) === null || _a === void 0 ? void 0 : _a.id;
|
|
29757
|
+
var nextRecipeId = (_b = result.recipe) === null || _b === void 0 ? void 0 : _b.id;
|
|
29758
|
+
if (previousRecipeId && previousRecipeId !== nextRecipeId) {
|
|
29759
|
+
this.clearProductShowForRecipe(previousRecipeId);
|
|
29760
|
+
}
|
|
29605
29761
|
this.recipeWasAdded = result.wasAdded;
|
|
29606
29762
|
this.recipe = result.recipe;
|
|
29607
29763
|
this.previewMode.next(result.previewMode);
|
|
@@ -29611,7 +29767,7 @@
|
|
|
29611
29767
|
this.show = true;
|
|
29612
29768
|
// Put back if/when printing is reimplemented
|
|
29613
29769
|
// this.printService.prepareForPrint(this.elRef);
|
|
29614
|
-
(
|
|
29770
|
+
(_c = this.detailsComponent) === null || _c === void 0 ? void 0 : _c.cdr.markForCheck();
|
|
29615
29771
|
if (this.detailsComponent) {
|
|
29616
29772
|
this.detailsComponent.showAddon = false;
|
|
29617
29773
|
}
|
|
@@ -29627,10 +29783,13 @@
|
|
|
29627
29783
|
};
|
|
29628
29784
|
RecipeModalComponent.prototype.hide = function (isDetail) {
|
|
29629
29785
|
if (isDetail === void 0) { isDetail = false; }
|
|
29786
|
+
var _a;
|
|
29630
29787
|
if (this.canCloseModal) {
|
|
29788
|
+
var recipeId = (_a = this.recipe) === null || _a === void 0 ? void 0 : _a.id;
|
|
29631
29789
|
this.recipeDetailsService.pageviewEventWasSent = false;
|
|
29632
29790
|
this.recipe = null; // trigger again a change on recipe if we re-open the view
|
|
29633
29791
|
if (!isDetail) {
|
|
29792
|
+
this.clearProductShowForRecipe(recipeId);
|
|
29634
29793
|
this.show = false;
|
|
29635
29794
|
this.recipesService.hide();
|
|
29636
29795
|
}
|
|
@@ -29685,6 +29844,11 @@
|
|
|
29685
29844
|
RecipeModalComponent.prototype.updateShowPlaceOrderFooter = function () {
|
|
29686
29845
|
this.showPlaceOrderFooter = this.contextService.noSupplier && !this.showStoreLocator && this.totalPrice > 0;
|
|
29687
29846
|
};
|
|
29847
|
+
RecipeModalComponent.prototype.clearProductShowForRecipe = function (recipeId) {
|
|
29848
|
+
if (recipeId != null) {
|
|
29849
|
+
ProductShowTracker.getInstance().clearForRecipe(String(recipeId));
|
|
29850
|
+
}
|
|
29851
|
+
};
|
|
29688
29852
|
return RecipeModalComponent;
|
|
29689
29853
|
}());
|
|
29690
29854
|
RecipeModalComponent.ɵfac = function RecipeModalComponent_Factory(t) { return new (t || RecipeModalComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(RecipesService), i0__namespace.ɵɵdirectiveInject(ContextService), i0__namespace.ɵɵdirectiveInject(PrintService), i0__namespace.ɵɵdirectiveInject(BasketTransferService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(BasketsService), i0__namespace.ɵɵdirectiveInject(RecipeDetailsService), i0__namespace.ɵɵdirectiveInject(ProductReplacementService), i0__namespace.ɵɵdirectiveInject(PointOfSalesService), i0__namespace.ɵɵdirectiveInject(StoreLocatorService), i0__namespace.ɵɵdirectiveInject(BasketTransferService)); };
|