@ikas/storefront 0.0.157 → 0.0.158-alpha.10
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/build/__generated__/global-types.d.ts +24 -0
- package/build/api/customer/__generated__/customerLogin.d.ts +2 -1
- package/build/api/customer/__generated__/getLastViewedProducts.d.ts +15 -0
- package/build/api/customer/__generated__/saveLastViewedProducts.d.ts +11 -0
- package/build/api/customer/index.d.ts +13 -1
- package/build/index.es.js +381 -82
- package/build/index.js +381 -82
- package/build/models/data/category/index.d.ts +5 -0
- package/build/models/data/order/line-item/index.d.ts +1 -0
- package/build/models/ui/product-list/index.d.ts +8 -4
- package/build/store/base.d.ts +0 -1
- package/build/store/customer.d.ts +19 -6
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -11061,6 +11061,8 @@ var IkasCategoryPath = /** @class */ (function () {
|
|
|
11061
11061
|
}());
|
|
11062
11062
|
var IkasFilterCategory = /** @class */ (function () {
|
|
11063
11063
|
function IkasFilterCategory(data) {
|
|
11064
|
+
// Extra
|
|
11065
|
+
this._isSelected = false;
|
|
11064
11066
|
this.id = data.id || "";
|
|
11065
11067
|
this.name = data.name || "";
|
|
11066
11068
|
this.slug = data.slug || "";
|
|
@@ -11068,8 +11070,16 @@ var IkasFilterCategory = /** @class */ (function () {
|
|
|
11068
11070
|
data.resultCount !== undefined && data.resultCount !== null
|
|
11069
11071
|
? data.resultCount
|
|
11070
11072
|
: null;
|
|
11073
|
+
this._isSelected = data.isSelected || false;
|
|
11071
11074
|
makeAutoObservable(this);
|
|
11072
11075
|
}
|
|
11076
|
+
Object.defineProperty(IkasFilterCategory.prototype, "isSelected", {
|
|
11077
|
+
get: function () {
|
|
11078
|
+
return this._isSelected;
|
|
11079
|
+
},
|
|
11080
|
+
enumerable: false,
|
|
11081
|
+
configurable: true
|
|
11082
|
+
});
|
|
11073
11083
|
Object.defineProperty(IkasFilterCategory.prototype, "href", {
|
|
11074
11084
|
get: function () {
|
|
11075
11085
|
if (!this.slug)
|
|
@@ -11079,6 +11089,9 @@ var IkasFilterCategory = /** @class */ (function () {
|
|
|
11079
11089
|
enumerable: false,
|
|
11080
11090
|
configurable: true
|
|
11081
11091
|
});
|
|
11092
|
+
IkasFilterCategory.prototype.toJSON = function () {
|
|
11093
|
+
return __assign(__assign({}, this), { isSelected: this._isSelected });
|
|
11094
|
+
};
|
|
11082
11095
|
return IkasFilterCategory;
|
|
11083
11096
|
}());
|
|
11084
11097
|
|
|
@@ -11171,7 +11184,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
11171
11184
|
});
|
|
11172
11185
|
Object.defineProperty(IkasOrderAddress.prototype, "validationResult", {
|
|
11173
11186
|
get: function () {
|
|
11174
|
-
var _a, _b, _c, _d
|
|
11187
|
+
var _a, _b, _c, _d;
|
|
11175
11188
|
var isValidPhone = !!this.phone &&
|
|
11176
11189
|
this.phone.length >= 10 &&
|
|
11177
11190
|
validatePhoneNumber(this.phone);
|
|
@@ -11192,10 +11205,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
11192
11205
|
? isValidPhone
|
|
11193
11206
|
: true,
|
|
11194
11207
|
identityNumber: ((_d = this.checkoutSettings) === null || _d === void 0 ? void 0 : _d.identityNumberRequirement) ===
|
|
11195
|
-
IkasCheckoutRequirementEnum.MANDATORY
|
|
11196
|
-
(((_e = this.checkoutSettings) === null || _e === void 0 ? void 0 : _e.identityNumberRequirement) ===
|
|
11197
|
-
IkasCheckoutRequirementEnum.OPTIONAL &&
|
|
11198
|
-
this.phone)
|
|
11208
|
+
IkasCheckoutRequirementEnum.MANDATORY
|
|
11199
11209
|
? !!this.identityNumber
|
|
11200
11210
|
: true,
|
|
11201
11211
|
};
|
|
@@ -11326,6 +11336,13 @@ var IkasOrderLineItem = /** @class */ (function () {
|
|
|
11326
11336
|
this.status = data.status || OrderLineItemStatusEnum.FULFILLED;
|
|
11327
11337
|
makeAutoObservable(this);
|
|
11328
11338
|
}
|
|
11339
|
+
Object.defineProperty(IkasOrderLineItem.prototype, "priceWithQuantity", {
|
|
11340
|
+
get: function () {
|
|
11341
|
+
return this.price * this.quantity;
|
|
11342
|
+
},
|
|
11343
|
+
enumerable: false,
|
|
11344
|
+
configurable: true
|
|
11345
|
+
});
|
|
11329
11346
|
Object.defineProperty(IkasOrderLineItem.prototype, "finalPriceWithQuantity", {
|
|
11330
11347
|
get: function () {
|
|
11331
11348
|
return this.finalPrice * this.quantity;
|
|
@@ -17468,6 +17485,8 @@ var LS_TOKEN_KEY = "customerToken";
|
|
|
17468
17485
|
var LS_TOKEN_EXPIRY = "customerTokenExpiry";
|
|
17469
17486
|
var LS_CUSTOMER_KEY = "customer";
|
|
17470
17487
|
var LS_CUSTOMER_SUB_KEY = "customerEmailSubscription";
|
|
17488
|
+
var LS_LAST_VIEWED_PRODUCTS_KEY = "lastViewedProducts";
|
|
17489
|
+
var LS_CUSTOMER_CONSENT = "customerConsent";
|
|
17471
17490
|
var IkasCustomerStore = /** @class */ (function () {
|
|
17472
17491
|
function IkasCustomerStore(baseStore) {
|
|
17473
17492
|
var _this = this;
|
|
@@ -17477,6 +17496,8 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17477
17496
|
this.baseStore = null;
|
|
17478
17497
|
this._initialized = false;
|
|
17479
17498
|
this._visitorSubscribedEmail = false;
|
|
17499
|
+
this._lastViewedProducts = [];
|
|
17500
|
+
this._customerConsentGranted = false;
|
|
17480
17501
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17481
17502
|
var response, cart;
|
|
17482
17503
|
var _a;
|
|
@@ -17496,7 +17517,9 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17496
17517
|
case 2:
|
|
17497
17518
|
_b.sent();
|
|
17498
17519
|
_b.label = 3;
|
|
17499
|
-
case 3:
|
|
17520
|
+
case 3:
|
|
17521
|
+
this.saveLocalLastViewedProducts();
|
|
17522
|
+
return [2 /*return*/, true];
|
|
17500
17523
|
case 4: return [2 /*return*/, false];
|
|
17501
17524
|
}
|
|
17502
17525
|
});
|
|
@@ -17511,6 +17534,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17511
17534
|
if (response) {
|
|
17512
17535
|
this.setToken(response.token, response.tokenExpiry);
|
|
17513
17536
|
this.setCustomer(response.customer);
|
|
17537
|
+
this.saveLocalLastViewedProducts();
|
|
17514
17538
|
return [2 /*return*/, true];
|
|
17515
17539
|
}
|
|
17516
17540
|
return [2 /*return*/, false];
|
|
@@ -17726,6 +17750,9 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17726
17750
|
}
|
|
17727
17751
|
});
|
|
17728
17752
|
}); };
|
|
17753
|
+
this.onCustomerConsentGrant = function () {
|
|
17754
|
+
_this.saveCustomerConsent();
|
|
17755
|
+
};
|
|
17729
17756
|
this.baseStore = baseStore;
|
|
17730
17757
|
this.init();
|
|
17731
17758
|
makeAutoObservable(this);
|
|
@@ -17748,6 +17775,13 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17748
17775
|
enumerable: false,
|
|
17749
17776
|
configurable: true
|
|
17750
17777
|
});
|
|
17778
|
+
Object.defineProperty(IkasCustomerStore.prototype, "customerConsentGranted", {
|
|
17779
|
+
get: function () {
|
|
17780
|
+
return this._customerConsentGranted;
|
|
17781
|
+
},
|
|
17782
|
+
enumerable: false,
|
|
17783
|
+
configurable: true
|
|
17784
|
+
});
|
|
17751
17785
|
IkasCustomerStore.prototype.init = function () {
|
|
17752
17786
|
return __awaiter(this, void 0, void 0, function () {
|
|
17753
17787
|
return __generator(this, function (_a) {
|
|
@@ -17755,6 +17789,8 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17755
17789
|
case 0:
|
|
17756
17790
|
this.loadToken();
|
|
17757
17791
|
this.loadCustomer();
|
|
17792
|
+
this.loadLastViewedProducts();
|
|
17793
|
+
this.loadCustomerConsent();
|
|
17758
17794
|
return [4 /*yield*/, this.refreshToken()];
|
|
17759
17795
|
case 1:
|
|
17760
17796
|
_a.sent();
|
|
@@ -17825,6 +17861,127 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17825
17861
|
}
|
|
17826
17862
|
catch (err) { }
|
|
17827
17863
|
};
|
|
17864
|
+
IkasCustomerStore.prototype.getLastViewedProducts = function () {
|
|
17865
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17866
|
+
var _a;
|
|
17867
|
+
return __generator(this, function (_b) {
|
|
17868
|
+
switch (_b.label) {
|
|
17869
|
+
case 0:
|
|
17870
|
+
if (!this.customer) return [3 /*break*/, 2];
|
|
17871
|
+
_a = this;
|
|
17872
|
+
return [4 /*yield*/, IkasCustomerAPI.getLastViewedProducts(this.customer.id)];
|
|
17873
|
+
case 1:
|
|
17874
|
+
_a._lastViewedProducts = _b.sent();
|
|
17875
|
+
return [3 /*break*/, 3];
|
|
17876
|
+
case 2:
|
|
17877
|
+
this.loadLastViewedProducts();
|
|
17878
|
+
_b.label = 3;
|
|
17879
|
+
case 3: return [2 /*return*/, this._lastViewedProducts];
|
|
17880
|
+
}
|
|
17881
|
+
});
|
|
17882
|
+
});
|
|
17883
|
+
};
|
|
17884
|
+
IkasCustomerStore.prototype.saveLastViewedProducts = function () {
|
|
17885
|
+
if (isServer$3)
|
|
17886
|
+
return;
|
|
17887
|
+
window.localStorage.setItem(LS_LAST_VIEWED_PRODUCTS_KEY, JSON.stringify(this._lastViewedProducts));
|
|
17888
|
+
};
|
|
17889
|
+
IkasCustomerStore.prototype.loadLastViewedProducts = function () {
|
|
17890
|
+
if (isServer$3)
|
|
17891
|
+
return;
|
|
17892
|
+
try {
|
|
17893
|
+
var lvpStr = window.localStorage.getItem(LS_LAST_VIEWED_PRODUCTS_KEY);
|
|
17894
|
+
if (lvpStr) {
|
|
17895
|
+
this._lastViewedProducts = JSON.parse(lvpStr);
|
|
17896
|
+
this._lastViewedProducts = this._lastViewedProducts.reverse();
|
|
17897
|
+
}
|
|
17898
|
+
}
|
|
17899
|
+
catch (err) { }
|
|
17900
|
+
};
|
|
17901
|
+
IkasCustomerStore.prototype.removeLastViewedProducts = function () {
|
|
17902
|
+
if (isServer$3)
|
|
17903
|
+
return;
|
|
17904
|
+
window.localStorage.removeItem(LS_LAST_VIEWED_PRODUCTS_KEY);
|
|
17905
|
+
};
|
|
17906
|
+
IkasCustomerStore.prototype.onProductView = function (productId, variantId) {
|
|
17907
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17908
|
+
var isSuccess;
|
|
17909
|
+
return __generator(this, function (_a) {
|
|
17910
|
+
switch (_a.label) {
|
|
17911
|
+
case 0:
|
|
17912
|
+
if (!this.customer) return [3 /*break*/, 2];
|
|
17913
|
+
return [4 /*yield*/, IkasCustomerAPI.saveLastViewedProducts({
|
|
17914
|
+
customerId: this.customer.id,
|
|
17915
|
+
products: [
|
|
17916
|
+
{
|
|
17917
|
+
productId: productId,
|
|
17918
|
+
variantId: variantId,
|
|
17919
|
+
},
|
|
17920
|
+
],
|
|
17921
|
+
})];
|
|
17922
|
+
case 1:
|
|
17923
|
+
isSuccess = _a.sent();
|
|
17924
|
+
if (isSuccess)
|
|
17925
|
+
this._lastViewedProducts.push({ productId: productId, variantId: variantId });
|
|
17926
|
+
return [3 /*break*/, 3];
|
|
17927
|
+
case 2:
|
|
17928
|
+
this._lastViewedProducts.push({ productId: productId, variantId: variantId });
|
|
17929
|
+
this._lastViewedProducts = this._lastViewedProducts.slice(0, 20);
|
|
17930
|
+
this.saveLastViewedProducts();
|
|
17931
|
+
_a.label = 3;
|
|
17932
|
+
case 3: return [2 /*return*/];
|
|
17933
|
+
}
|
|
17934
|
+
});
|
|
17935
|
+
});
|
|
17936
|
+
};
|
|
17937
|
+
IkasCustomerStore.prototype.saveLocalLastViewedProducts = function () {
|
|
17938
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17939
|
+
var isSuccess;
|
|
17940
|
+
return __generator(this, function (_a) {
|
|
17941
|
+
switch (_a.label) {
|
|
17942
|
+
case 0:
|
|
17943
|
+
if (isServer$3)
|
|
17944
|
+
return [2 /*return*/];
|
|
17945
|
+
_a.label = 1;
|
|
17946
|
+
case 1:
|
|
17947
|
+
_a.trys.push([1, 4, , 5]);
|
|
17948
|
+
this.loadLastViewedProducts();
|
|
17949
|
+
if (!this._lastViewedProducts.length) return [3 /*break*/, 3];
|
|
17950
|
+
return [4 /*yield*/, IkasCustomerAPI.saveLastViewedProducts({
|
|
17951
|
+
customerId: this.customer.id,
|
|
17952
|
+
products: this._lastViewedProducts,
|
|
17953
|
+
})];
|
|
17954
|
+
case 2:
|
|
17955
|
+
isSuccess = _a.sent();
|
|
17956
|
+
if (isSuccess) {
|
|
17957
|
+
this.removeLastViewedProducts();
|
|
17958
|
+
}
|
|
17959
|
+
_a.label = 3;
|
|
17960
|
+
case 3: return [3 /*break*/, 5];
|
|
17961
|
+
case 4:
|
|
17962
|
+
_a.sent();
|
|
17963
|
+
return [3 /*break*/, 5];
|
|
17964
|
+
case 5: return [2 /*return*/];
|
|
17965
|
+
}
|
|
17966
|
+
});
|
|
17967
|
+
});
|
|
17968
|
+
};
|
|
17969
|
+
IkasCustomerStore.prototype.saveCustomerConsent = function () {
|
|
17970
|
+
if (isServer$3)
|
|
17971
|
+
return;
|
|
17972
|
+
this._customerConsentGranted = true;
|
|
17973
|
+
window.localStorage.setItem(LS_CUSTOMER_CONSENT, "true");
|
|
17974
|
+
};
|
|
17975
|
+
IkasCustomerStore.prototype.loadCustomerConsent = function () {
|
|
17976
|
+
if (isServer$3)
|
|
17977
|
+
return;
|
|
17978
|
+
this._customerConsentGranted = !!window.localStorage.getItem(LS_CUSTOMER_CONSENT);
|
|
17979
|
+
};
|
|
17980
|
+
IkasCustomerStore.prototype.removeCustomerConsent = function () {
|
|
17981
|
+
if (isServer$3)
|
|
17982
|
+
return;
|
|
17983
|
+
window.localStorage.removeItem(LS_CUSTOMER_CONSENT);
|
|
17984
|
+
};
|
|
17828
17985
|
IkasCustomerStore.prototype.setToken = function (token, tokenExpiry) {
|
|
17829
17986
|
if (isServer$3)
|
|
17830
17987
|
return;
|
|
@@ -20936,6 +21093,15 @@ var CustomerAccountStatusesEnum;
|
|
|
20936
21093
|
CustomerAccountStatusesEnum["DISABLED_ACCOUNT"] = "DISABLED_ACCOUNT";
|
|
20937
21094
|
CustomerAccountStatusesEnum["INVITED_TO_CREATE_ACCOUNT"] = "INVITED_TO_CREATE_ACCOUNT";
|
|
20938
21095
|
})(CustomerAccountStatusesEnum || (CustomerAccountStatusesEnum = {}));
|
|
21096
|
+
/**
|
|
21097
|
+
* Customer Email Subscription Statuses
|
|
21098
|
+
*/
|
|
21099
|
+
var CustomerEmailSubscriptionStatusesEnum;
|
|
21100
|
+
(function (CustomerEmailSubscriptionStatusesEnum) {
|
|
21101
|
+
CustomerEmailSubscriptionStatusesEnum["NOT_SUBSCRIBED"] = "NOT_SUBSCRIBED";
|
|
21102
|
+
CustomerEmailSubscriptionStatusesEnum["PENDING_CONFIRMATION"] = "PENDING_CONFIRMATION";
|
|
21103
|
+
CustomerEmailSubscriptionStatusesEnum["SUBSCRIBED"] = "SUBSCRIBED";
|
|
21104
|
+
})(CustomerEmailSubscriptionStatusesEnum || (CustomerEmailSubscriptionStatusesEnum = {}));
|
|
20939
21105
|
/**
|
|
20940
21106
|
* Url Slug Target Type Enum Codes
|
|
20941
21107
|
*/
|
|
@@ -21189,6 +21355,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21189
21355
|
var _this = this;
|
|
21190
21356
|
this.filters = null;
|
|
21191
21357
|
this._filterCategories = null;
|
|
21358
|
+
this._infiniteScrollPage = null;
|
|
21192
21359
|
this._initialized = false;
|
|
21193
21360
|
this._minPage = null;
|
|
21194
21361
|
this._filterBrandId = null;
|
|
@@ -21199,12 +21366,12 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21199
21366
|
this.router = null;
|
|
21200
21367
|
this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
21201
21368
|
var resultsSet;
|
|
21202
|
-
var _a
|
|
21203
|
-
return __generator(this, function (
|
|
21204
|
-
switch (
|
|
21369
|
+
var _a;
|
|
21370
|
+
return __generator(this, function (_b) {
|
|
21371
|
+
switch (_b.label) {
|
|
21205
21372
|
case 0: return [4 /*yield*/, this.getInitial()];
|
|
21206
21373
|
case 1:
|
|
21207
|
-
resultsSet =
|
|
21374
|
+
resultsSet = _b.sent();
|
|
21208
21375
|
if (![
|
|
21209
21376
|
IkasThemePageType.CATEGORY,
|
|
21210
21377
|
IkasThemePageType.BRAND,
|
|
@@ -21213,38 +21380,30 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21213
21380
|
return [2 /*return*/];
|
|
21214
21381
|
// Change url params
|
|
21215
21382
|
if (resultsSet && this.isBrowser()) {
|
|
21216
|
-
|
|
21217
|
-
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace("" + location.pathname + (this.filterQueryParams ? "?" + this.filterQueryParams : ""), undefined, { shallow: true });
|
|
21218
|
-
}
|
|
21219
|
-
else {
|
|
21220
|
-
(_b = this.router) === null || _b === void 0 ? void 0 : _b.replace("" + location.pathname, undefined, {
|
|
21221
|
-
shallow: true,
|
|
21222
|
-
});
|
|
21223
|
-
}
|
|
21383
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace("" + location.pathname + (this.filterQueryParams ? "?" + this.filterQueryParams : ""), undefined, { shallow: true });
|
|
21224
21384
|
}
|
|
21225
21385
|
return [2 /*return*/];
|
|
21226
21386
|
}
|
|
21227
21387
|
});
|
|
21228
21388
|
}); };
|
|
21229
21389
|
this.getInitial = function (queryParams, isInfiteScrollReturn) { return __awaiter(_this, void 0, void 0, function () {
|
|
21230
|
-
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
21231
|
-
|
|
21232
|
-
|
|
21233
|
-
switch (_b.label) {
|
|
21390
|
+
var fetchRequestTime, page, limit, productIdList, lastViewedProducts, response_1, data, idList, err_1;
|
|
21391
|
+
return __generator(this, function (_a) {
|
|
21392
|
+
switch (_a.label) {
|
|
21234
21393
|
case 0:
|
|
21235
21394
|
this._isLoading = true;
|
|
21236
21395
|
fetchRequestTime = Date.now();
|
|
21237
21396
|
this._fetchRequestTime = fetchRequestTime;
|
|
21238
|
-
|
|
21397
|
+
_a.label = 1;
|
|
21239
21398
|
case 1:
|
|
21240
|
-
|
|
21399
|
+
_a.trys.push([1, 12, 13, 14]);
|
|
21241
21400
|
page = isInfiteScrollReturn ? this._page : 1;
|
|
21242
21401
|
limit = this._limit;
|
|
21243
21402
|
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
21244
21403
|
return [4 /*yield*/, this.getFilters()];
|
|
21245
21404
|
case 2:
|
|
21246
|
-
|
|
21247
|
-
|
|
21405
|
+
_a.sent();
|
|
21406
|
+
_a.label = 3;
|
|
21248
21407
|
case 3:
|
|
21249
21408
|
this.applyQueryParamFilters(queryParams);
|
|
21250
21409
|
if (this.isSearch && !this.hasAppliedfilter) {
|
|
@@ -21255,27 +21414,48 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21255
21414
|
this._initialized = true;
|
|
21256
21415
|
return [2 /*return*/, true];
|
|
21257
21416
|
}
|
|
21258
|
-
|
|
21259
|
-
|
|
21260
|
-
|
|
21261
|
-
|
|
21262
|
-
|
|
21263
|
-
page = 1;
|
|
21264
|
-
limit = 10;
|
|
21265
|
-
}
|
|
21266
|
-
else if (this.isRecommended) {
|
|
21267
|
-
page = 1;
|
|
21268
|
-
limit = 10;
|
|
21269
|
-
}
|
|
21270
|
-
return [4 /*yield*/, this.searchProducts(page || 1, limit || 10)];
|
|
21417
|
+
productIdList = void 0;
|
|
21418
|
+
if (!this.isStatic) return [3 /*break*/, 4];
|
|
21419
|
+
page = undefined;
|
|
21420
|
+
limit = undefined;
|
|
21421
|
+
return [3 /*break*/, 10];
|
|
21271
21422
|
case 4:
|
|
21272
|
-
|
|
21423
|
+
if (!this.isDiscounted) return [3 /*break*/, 5];
|
|
21424
|
+
page = 1;
|
|
21425
|
+
limit = 10;
|
|
21426
|
+
return [3 /*break*/, 10];
|
|
21427
|
+
case 5:
|
|
21428
|
+
if (!this.isRecommended) return [3 /*break*/, 6];
|
|
21429
|
+
page = 1;
|
|
21430
|
+
limit = 10;
|
|
21431
|
+
return [3 /*break*/, 10];
|
|
21432
|
+
case 6:
|
|
21433
|
+
if (!this.isLastViewed) return [3 /*break*/, 10];
|
|
21434
|
+
if (!this.isBrowser()) return [3 /*break*/, 9];
|
|
21435
|
+
return [4 /*yield*/, this.waitForCustomerStoreInit()];
|
|
21436
|
+
case 7:
|
|
21437
|
+
_a.sent();
|
|
21438
|
+
return [4 /*yield*/, IkasStorefrontConfig.store.customerStore.getLastViewedProducts()];
|
|
21439
|
+
case 8:
|
|
21440
|
+
lastViewedProducts = _a.sent();
|
|
21441
|
+
if (lastViewedProducts && lastViewedProducts.length) {
|
|
21442
|
+
productIdList = lastViewedProducts.map(function (p) { return p.productId; });
|
|
21443
|
+
}
|
|
21444
|
+
return [3 /*break*/, 10];
|
|
21445
|
+
case 9: return [2 /*return*/];
|
|
21446
|
+
case 10: return [4 /*yield*/, this.searchProducts(page || 1, limit || 10, productIdList)];
|
|
21447
|
+
case 11:
|
|
21448
|
+
response_1 = _a.sent();
|
|
21273
21449
|
if (!response_1 || this._fetchRequestTime !== fetchRequestTime)
|
|
21274
21450
|
return [2 /*return*/];
|
|
21275
21451
|
data = [];
|
|
21276
|
-
if (this.isStatic) {
|
|
21452
|
+
if (this.isStatic || this.isLastViewed) {
|
|
21453
|
+
idList = this.isStatic
|
|
21454
|
+
? this._productListPropValue.productIds
|
|
21455
|
+
: //@ts-ignore
|
|
21456
|
+
IkasStorefrontConfig.store.customerStore._lastViewedProducts;
|
|
21277
21457
|
data =
|
|
21278
|
-
(
|
|
21458
|
+
(idList === null || idList === void 0 ? void 0 : idList.map(function (pID) {
|
|
21279
21459
|
var product = response_1.data.find(function (p) { return p.id === pID.productId; });
|
|
21280
21460
|
var variant = product === null || product === void 0 ? void 0 : product.variants.find(function (v) { return v.id === pID.variantId; });
|
|
21281
21461
|
if (product && variant)
|
|
@@ -21293,16 +21473,18 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21293
21473
|
this._initialized = true;
|
|
21294
21474
|
this._page = page || 1;
|
|
21295
21475
|
this._minPage = this.page;
|
|
21476
|
+
if (!isInfiteScrollReturn)
|
|
21477
|
+
this._infiniteScrollPage = null;
|
|
21296
21478
|
return [2 /*return*/, true];
|
|
21297
|
-
case
|
|
21298
|
-
err_1 =
|
|
21479
|
+
case 12:
|
|
21480
|
+
err_1 = _a.sent();
|
|
21299
21481
|
console.log(err_1);
|
|
21300
|
-
return [3 /*break*/,
|
|
21301
|
-
case
|
|
21482
|
+
return [3 /*break*/, 14];
|
|
21483
|
+
case 13:
|
|
21302
21484
|
if (fetchRequestTime === this._fetchRequestTime)
|
|
21303
21485
|
this._isLoading = false;
|
|
21304
21486
|
return [7 /*endfinally*/];
|
|
21305
|
-
case
|
|
21487
|
+
case 14: return [2 /*return*/];
|
|
21306
21488
|
}
|
|
21307
21489
|
});
|
|
21308
21490
|
}); };
|
|
@@ -21314,6 +21496,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21314
21496
|
if (this.isStatic ||
|
|
21315
21497
|
this.isDiscounted ||
|
|
21316
21498
|
this.isRecommended ||
|
|
21499
|
+
this.isLastViewed ||
|
|
21317
21500
|
this._isLoading ||
|
|
21318
21501
|
!this.hasPrev)
|
|
21319
21502
|
return [2 /*return*/];
|
|
@@ -21353,6 +21536,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21353
21536
|
if (this.isStatic ||
|
|
21354
21537
|
this.isDiscounted ||
|
|
21355
21538
|
this.isRecommended ||
|
|
21539
|
+
this.isLastViewed ||
|
|
21356
21540
|
this._isLoading ||
|
|
21357
21541
|
!this.hasNext)
|
|
21358
21542
|
return [2 /*return*/];
|
|
@@ -21391,7 +21575,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21391
21575
|
if (this._isLoading ||
|
|
21392
21576
|
this.isStatic ||
|
|
21393
21577
|
this.isDiscounted ||
|
|
21394
|
-
this.isRecommended
|
|
21578
|
+
this.isRecommended ||
|
|
21579
|
+
this.isLastViewed)
|
|
21395
21580
|
return [2 /*return*/];
|
|
21396
21581
|
this._isLoading = true;
|
|
21397
21582
|
_a.label = 1;
|
|
@@ -21421,6 +21606,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21421
21606
|
}
|
|
21422
21607
|
});
|
|
21423
21608
|
}); };
|
|
21609
|
+
this.setVisibleInfiniteScrollPage = function (page) {
|
|
21610
|
+
var _a;
|
|
21611
|
+
if (_this._infiniteScrollPage === page)
|
|
21612
|
+
return;
|
|
21613
|
+
_this._infiniteScrollPage = page;
|
|
21614
|
+
(_a = _this.router) === null || _a === void 0 ? void 0 : _a.replace("" + location.pathname + (_this.filterQueryParams ? "?" + _this.filterQueryParams : ""), undefined, { shallow: true });
|
|
21615
|
+
};
|
|
21424
21616
|
this.searchDebouncer = debounce_1(function () {
|
|
21425
21617
|
_this.applyFilters();
|
|
21426
21618
|
}, 100);
|
|
@@ -21461,15 +21653,18 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21461
21653
|
this.router = router;
|
|
21462
21654
|
makeAutoObservable(this);
|
|
21463
21655
|
if (this.isBrowser()) {
|
|
21464
|
-
this.
|
|
21656
|
+
this.restoreInfiniteScrollPage();
|
|
21465
21657
|
if (location.search &&
|
|
21466
21658
|
(this.isFilterable || this._type === IkasProductListType.SEARCH)) {
|
|
21467
21659
|
var queryParams = this.getQueryParams();
|
|
21468
|
-
this.getInitial(queryParams);
|
|
21660
|
+
this.getInitial(queryParams, this._page > 1);
|
|
21469
21661
|
}
|
|
21470
21662
|
else if (this._page > 1) {
|
|
21471
21663
|
this.getInitial(undefined, true);
|
|
21472
21664
|
}
|
|
21665
|
+
else if (this.isLastViewed) {
|
|
21666
|
+
this.getInitial();
|
|
21667
|
+
}
|
|
21473
21668
|
}
|
|
21474
21669
|
}
|
|
21475
21670
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
@@ -21500,6 +21695,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21500
21695
|
enumerable: false,
|
|
21501
21696
|
configurable: true
|
|
21502
21697
|
});
|
|
21698
|
+
Object.defineProperty(IkasProductList.prototype, "minPage", {
|
|
21699
|
+
get: function () {
|
|
21700
|
+
return this._minPage || 1;
|
|
21701
|
+
},
|
|
21702
|
+
enumerable: false,
|
|
21703
|
+
configurable: true
|
|
21704
|
+
});
|
|
21503
21705
|
Object.defineProperty(IkasProductList.prototype, "count", {
|
|
21504
21706
|
get: function () {
|
|
21505
21707
|
return this._count;
|
|
@@ -21575,6 +21777,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21575
21777
|
enumerable: false,
|
|
21576
21778
|
configurable: true
|
|
21577
21779
|
});
|
|
21780
|
+
Object.defineProperty(IkasProductList.prototype, "isLastViewed", {
|
|
21781
|
+
get: function () {
|
|
21782
|
+
return this._type === IkasProductListType.LAST_VIEWED;
|
|
21783
|
+
},
|
|
21784
|
+
enumerable: false,
|
|
21785
|
+
configurable: true
|
|
21786
|
+
});
|
|
21578
21787
|
Object.defineProperty(IkasProductList.prototype, "isSearch", {
|
|
21579
21788
|
get: function () {
|
|
21580
21789
|
return this._type === IkasProductListType.SEARCH;
|
|
@@ -21616,10 +21825,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21616
21825
|
var _a, _b, _c;
|
|
21617
21826
|
var queryParams = {};
|
|
21618
21827
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
21619
|
-
|
|
21828
|
+
if (f.keyList.length)
|
|
21829
|
+
queryParams[f.key] = f.keyList;
|
|
21620
21830
|
});
|
|
21621
21831
|
if (this._searchKeyword)
|
|
21622
21832
|
queryParams.s = this._searchKeyword;
|
|
21833
|
+
if (this._infiniteScrollPage)
|
|
21834
|
+
queryParams.page = this._infiniteScrollPage;
|
|
21623
21835
|
if (this._pageType !== IkasThemePageType.CATEGORY &&
|
|
21624
21836
|
this._filterCategoryId) {
|
|
21625
21837
|
var slug = (_c = (_b = this.filterCategories) === null || _b === void 0 ? void 0 : _b.find(function (fc) { return fc.id === _this._filterCategoryId; })) === null || _c === void 0 ? void 0 : _c.slug;
|
|
@@ -21689,7 +21901,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21689
21901
|
type: type,
|
|
21690
21902
|
};
|
|
21691
21903
|
};
|
|
21692
|
-
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
21904
|
+
IkasProductList.prototype.searchProducts = function (page, limit, productIdList) {
|
|
21693
21905
|
var _a, _b;
|
|
21694
21906
|
return __awaiter(this, void 0, void 0, function () {
|
|
21695
21907
|
var filterList;
|
|
@@ -21717,7 +21929,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21717
21929
|
page: page,
|
|
21718
21930
|
perPage: limit,
|
|
21719
21931
|
productIdList: this.isStatic
|
|
21720
|
-
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) :
|
|
21932
|
+
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) : productIdList,
|
|
21721
21933
|
filterList: filterList,
|
|
21722
21934
|
brandId: this._pageType === IkasThemePageType.BRAND &&
|
|
21723
21935
|
this._type !== IkasProductListType.SEARCH
|
|
@@ -21843,32 +22055,34 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21843
22055
|
});
|
|
21844
22056
|
};
|
|
21845
22057
|
IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
|
|
21846
|
-
var _a;
|
|
22058
|
+
var _a, _b;
|
|
21847
22059
|
if (disableRoute === void 0) { disableRoute = false; }
|
|
21848
22060
|
return __awaiter(this, void 0, void 0, function () {
|
|
21849
|
-
return __generator(this, function (
|
|
21850
|
-
switch (
|
|
22061
|
+
return __generator(this, function (_c) {
|
|
22062
|
+
switch (_c.label) {
|
|
21851
22063
|
case 0:
|
|
21852
22064
|
if (!disableRoute) return [3 /*break*/, 2];
|
|
21853
|
-
this._filterCategoryId
|
|
22065
|
+
if (this._filterCategoryId === filterCategory.id)
|
|
22066
|
+
this._filterCategoryId = undefined;
|
|
22067
|
+
else
|
|
22068
|
+
this._filterCategoryId = filterCategory.id;
|
|
22069
|
+
(_a = this._filterCategories) === null || _a === void 0 ? void 0 : _a.forEach(function (fc) {
|
|
22070
|
+
//@ts-ignore
|
|
22071
|
+
fc._isSelected = fc.id === filterCategory.id;
|
|
22072
|
+
});
|
|
21854
22073
|
return [4 /*yield*/, this.applyFilters()];
|
|
21855
22074
|
case 1:
|
|
21856
|
-
|
|
22075
|
+
_c.sent();
|
|
21857
22076
|
return [3 /*break*/, 3];
|
|
21858
22077
|
case 2:
|
|
21859
|
-
(
|
|
22078
|
+
(_b = this.router) === null || _b === void 0 ? void 0 : _b.push(filterCategory.href +
|
|
21860
22079
|
(this.filterQueryParams ? "?" + this.filterQueryParams : ""));
|
|
21861
|
-
|
|
22080
|
+
_c.label = 3;
|
|
21862
22081
|
case 3: return [2 /*return*/];
|
|
21863
22082
|
}
|
|
21864
22083
|
});
|
|
21865
22084
|
});
|
|
21866
22085
|
};
|
|
21867
|
-
IkasProductList.prototype.setVisibleInfiniteScrollPage = function (page) {
|
|
21868
|
-
//@ts-ignore
|
|
21869
|
-
var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
|
|
21870
|
-
infiniteScrollPages[this._productListPropValue.id] = page;
|
|
21871
|
-
};
|
|
21872
22086
|
IkasProductList.prototype.toJSON = function () {
|
|
21873
22087
|
return {
|
|
21874
22088
|
data: this.data,
|
|
@@ -21889,22 +22103,17 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21889
22103
|
productListPropValue: this._productListPropValue,
|
|
21890
22104
|
};
|
|
21891
22105
|
};
|
|
21892
|
-
IkasProductList.prototype.
|
|
21893
|
-
|
|
21894
|
-
var
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
if (
|
|
22106
|
+
IkasProductList.prototype.restoreInfiniteScrollPage = function () {
|
|
22107
|
+
var queryParams = this.getQueryParams();
|
|
22108
|
+
var pageStr = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("page");
|
|
22109
|
+
if (pageStr) {
|
|
22110
|
+
var page = parseInt(pageStr);
|
|
22111
|
+
if (!isNaN(page)) {
|
|
21898
22112
|
this._page = page;
|
|
21899
|
-
|
|
21900
|
-
else {
|
|
21901
|
-
delete infiniteScrollPages[this._productListPropValue.id];
|
|
22113
|
+
this._infiniteScrollPage = page;
|
|
21902
22114
|
}
|
|
21903
22115
|
}
|
|
21904
22116
|
};
|
|
21905
|
-
IkasProductList.prototype.hasForwardRoute = function () {
|
|
21906
|
-
return this.isBrowser() && !!window.history.forward;
|
|
21907
|
-
};
|
|
21908
22117
|
IkasProductList.prototype.getQueryParams = function () {
|
|
21909
22118
|
if (!this.isBrowser())
|
|
21910
22119
|
return;
|
|
@@ -21913,6 +22122,16 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21913
22122
|
IkasProductList.prototype.isBrowser = function () {
|
|
21914
22123
|
return typeof window !== "undefined";
|
|
21915
22124
|
};
|
|
22125
|
+
IkasProductList.prototype.waitForCustomerStoreInit = function () {
|
|
22126
|
+
return new Promise(function (resolve) {
|
|
22127
|
+
var interval = setInterval(function () {
|
|
22128
|
+
if (IkasStorefrontConfig.store.customerStore.initialized) {
|
|
22129
|
+
clearInterval(interval);
|
|
22130
|
+
resolve(null);
|
|
22131
|
+
}
|
|
22132
|
+
}, 1000);
|
|
22133
|
+
});
|
|
22134
|
+
};
|
|
21916
22135
|
return IkasProductList;
|
|
21917
22136
|
}());
|
|
21918
22137
|
var IkasProductListType;
|
|
@@ -21923,6 +22142,7 @@ var IkasProductListType;
|
|
|
21923
22142
|
IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
|
|
21924
22143
|
IkasProductListType["CATEGORY"] = "CATEGORY";
|
|
21925
22144
|
IkasProductListType["SEARCH"] = "SEARCH";
|
|
22145
|
+
IkasProductListType["LAST_VIEWED"] = "LAST_VIEWED";
|
|
21926
22146
|
})(IkasProductListType || (IkasProductListType = {}));
|
|
21927
22147
|
var IkasProductListSortType;
|
|
21928
22148
|
(function (IkasProductListSortType) {
|
|
@@ -27679,9 +27899,73 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27679
27899
|
});
|
|
27680
27900
|
});
|
|
27681
27901
|
};
|
|
27902
|
+
IkasCustomerAPI.getLastViewedProducts = function (customerId) {
|
|
27903
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27904
|
+
var QUERY, _a, data, errors, error_2;
|
|
27905
|
+
return __generator(this, function (_b) {
|
|
27906
|
+
switch (_b.label) {
|
|
27907
|
+
case 0:
|
|
27908
|
+
QUERY = src(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "], ["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "])));
|
|
27909
|
+
_b.label = 1;
|
|
27910
|
+
case 1:
|
|
27911
|
+
_b.trys.push([1, 3, , 4]);
|
|
27912
|
+
return [4 /*yield*/, apollo
|
|
27913
|
+
.getClient()
|
|
27914
|
+
.query({
|
|
27915
|
+
query: QUERY,
|
|
27916
|
+
variables: {
|
|
27917
|
+
customerId: customerId,
|
|
27918
|
+
},
|
|
27919
|
+
})];
|
|
27920
|
+
case 2:
|
|
27921
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
27922
|
+
if (errors && errors.length)
|
|
27923
|
+
return [2 /*return*/, []];
|
|
27924
|
+
return [2 /*return*/, data.getLastViewedProducts.products];
|
|
27925
|
+
case 3:
|
|
27926
|
+
error_2 = _b.sent();
|
|
27927
|
+
console.log(error_2);
|
|
27928
|
+
return [2 /*return*/, []];
|
|
27929
|
+
case 4: return [2 /*return*/];
|
|
27930
|
+
}
|
|
27931
|
+
});
|
|
27932
|
+
});
|
|
27933
|
+
};
|
|
27934
|
+
IkasCustomerAPI.saveLastViewedProducts = function (input) {
|
|
27935
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27936
|
+
var MUTATION, errors, err_12;
|
|
27937
|
+
return __generator(this, function (_a) {
|
|
27938
|
+
switch (_a.label) {
|
|
27939
|
+
case 0:
|
|
27940
|
+
MUTATION = src(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n mutation saveLastViewedProducts($input: ProductLastViewedInput!) {\n saveLastViewedProducts(input: $input) {\n id\n }\n }\n "], ["\n mutation saveLastViewedProducts($input: ProductLastViewedInput!) {\n saveLastViewedProducts(input: $input) {\n id\n }\n }\n "])));
|
|
27941
|
+
_a.label = 1;
|
|
27942
|
+
case 1:
|
|
27943
|
+
_a.trys.push([1, 3, , 4]);
|
|
27944
|
+
return [4 /*yield*/, apollo
|
|
27945
|
+
.getClient()
|
|
27946
|
+
.mutate({
|
|
27947
|
+
mutation: MUTATION,
|
|
27948
|
+
variables: {
|
|
27949
|
+
input: input,
|
|
27950
|
+
},
|
|
27951
|
+
})];
|
|
27952
|
+
case 2:
|
|
27953
|
+
errors = (_a.sent()).errors;
|
|
27954
|
+
if (errors && errors.length)
|
|
27955
|
+
return [2 /*return*/, false];
|
|
27956
|
+
return [3 /*break*/, 4];
|
|
27957
|
+
case 3:
|
|
27958
|
+
err_12 = _a.sent();
|
|
27959
|
+
console.log(err_12);
|
|
27960
|
+
return [2 /*return*/, false];
|
|
27961
|
+
case 4: return [2 /*return*/, true];
|
|
27962
|
+
}
|
|
27963
|
+
});
|
|
27964
|
+
});
|
|
27965
|
+
};
|
|
27682
27966
|
return IkasCustomerAPI;
|
|
27683
27967
|
}());
|
|
27684
|
-
var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
|
|
27968
|
+
var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
|
|
27685
27969
|
|
|
27686
27970
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
27687
27971
|
function IkasDistrictAPI() {
|
|
@@ -29911,11 +30195,11 @@ var IkasCheckoutPage = observer(function (_a) {
|
|
|
29911
30195
|
};
|
|
29912
30196
|
var onPrivacyPolicyClick = function () {
|
|
29913
30197
|
vm.policyModalTitle = "Gizlilik Politikası";
|
|
29914
|
-
vm.policyModalText = vm.
|
|
30198
|
+
vm.policyModalText = vm.privacyPolicy;
|
|
29915
30199
|
};
|
|
29916
30200
|
var onTermsOfServiceClick = function () {
|
|
29917
30201
|
vm.policyModalTitle = "Hizmet Şartları";
|
|
29918
|
-
vm.policyModalText = vm.
|
|
30202
|
+
vm.policyModalText = vm.termsOfService;
|
|
29919
30203
|
};
|
|
29920
30204
|
var onErrorClose = function () {
|
|
29921
30205
|
vm.error = undefined;
|
|
@@ -29996,7 +30280,7 @@ var style = {
|
|
|
29996
30280
|
backgroundColor: "rgba(255, 0, 0, 0.5)",
|
|
29997
30281
|
};
|
|
29998
30282
|
|
|
29999
|
-
var PACKAGE_VERSION = "0.0.
|
|
30283
|
+
var PACKAGE_VERSION = "0.0.158";
|
|
30000
30284
|
var PageViewModel = /** @class */ (function () {
|
|
30001
30285
|
function PageViewModel(router) {
|
|
30002
30286
|
var _this = this;
|
|
@@ -30887,6 +31171,20 @@ var Page$1 = function (_a) {
|
|
|
30887
31171
|
useEffect(function () {
|
|
30888
31172
|
setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router, settingsStr, isBrowser));
|
|
30889
31173
|
}, [isBrowser, propValuesStr]);
|
|
31174
|
+
// If the user clicks a link for the same page, we need this logic to re-render the page
|
|
31175
|
+
useEffect(function () {
|
|
31176
|
+
router.events.on("routeChangeComplete", handleRouteChange);
|
|
31177
|
+
return function () {
|
|
31178
|
+
router.events.off("routeChangeComplete", handleRouteChange);
|
|
31179
|
+
};
|
|
31180
|
+
}, []);
|
|
31181
|
+
var handleRouteChange = function (url, options) {
|
|
31182
|
+
var shallow = options.shallow;
|
|
31183
|
+
if (!shallow &&
|
|
31184
|
+
[IkasThemePageType.CATEGORY, IkasThemePageType.BRAND].includes(page.type)) {
|
|
31185
|
+
setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router, settingsStr, isBrowser));
|
|
31186
|
+
}
|
|
31187
|
+
};
|
|
30890
31188
|
return (createElement(IkasPage, { page: page, propValues: propValues, pageSpecificDataStr: pageSpecificDataStr, settingsStr: settingsStr, merchantSettings: merchantSettings, addOgpMetas: true }));
|
|
30891
31189
|
};
|
|
30892
31190
|
var index$1 = observer(Page$1);
|
|
@@ -30934,6 +31232,8 @@ function handleAnalytics(page, pageSpecificDataStr) {
|
|
|
30934
31232
|
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
30935
31233
|
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
30936
31234
|
Analytics.productView(productDetail);
|
|
31235
|
+
// @ts-ignore
|
|
31236
|
+
IkasStorefrontConfig.store.customerStore.onProductView(productDetail.product.id, productDetail.selectedVariant.id);
|
|
30937
31237
|
}
|
|
30938
31238
|
if (page.type === IkasThemePageType.CATEGORY) {
|
|
30939
31239
|
var category = JSON.parse(pageSpecificDataStr);
|
|
@@ -31535,7 +31835,6 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
31535
31835
|
this.showLocaleOptions = false;
|
|
31536
31836
|
this.localeChecked = false;
|
|
31537
31837
|
this.settingsSet = false;
|
|
31538
|
-
this.infiniteScrollPages = {}; // key is productListPropValueId
|
|
31539
31838
|
this.customerStore = new IkasCustomerStore(this);
|
|
31540
31839
|
this.cartStore = new IkasCartStore(this);
|
|
31541
31840
|
makeObservable(this, {
|