@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.js
CHANGED
|
@@ -11075,6 +11075,8 @@ var IkasCategoryPath = /** @class */ (function () {
|
|
|
11075
11075
|
}());
|
|
11076
11076
|
var IkasFilterCategory = /** @class */ (function () {
|
|
11077
11077
|
function IkasFilterCategory(data) {
|
|
11078
|
+
// Extra
|
|
11079
|
+
this._isSelected = false;
|
|
11078
11080
|
this.id = data.id || "";
|
|
11079
11081
|
this.name = data.name || "";
|
|
11080
11082
|
this.slug = data.slug || "";
|
|
@@ -11082,8 +11084,16 @@ var IkasFilterCategory = /** @class */ (function () {
|
|
|
11082
11084
|
data.resultCount !== undefined && data.resultCount !== null
|
|
11083
11085
|
? data.resultCount
|
|
11084
11086
|
: null;
|
|
11087
|
+
this._isSelected = data.isSelected || false;
|
|
11085
11088
|
mobx.makeAutoObservable(this);
|
|
11086
11089
|
}
|
|
11090
|
+
Object.defineProperty(IkasFilterCategory.prototype, "isSelected", {
|
|
11091
|
+
get: function () {
|
|
11092
|
+
return this._isSelected;
|
|
11093
|
+
},
|
|
11094
|
+
enumerable: false,
|
|
11095
|
+
configurable: true
|
|
11096
|
+
});
|
|
11087
11097
|
Object.defineProperty(IkasFilterCategory.prototype, "href", {
|
|
11088
11098
|
get: function () {
|
|
11089
11099
|
if (!this.slug)
|
|
@@ -11093,6 +11103,9 @@ var IkasFilterCategory = /** @class */ (function () {
|
|
|
11093
11103
|
enumerable: false,
|
|
11094
11104
|
configurable: true
|
|
11095
11105
|
});
|
|
11106
|
+
IkasFilterCategory.prototype.toJSON = function () {
|
|
11107
|
+
return __assign(__assign({}, this), { isSelected: this._isSelected });
|
|
11108
|
+
};
|
|
11096
11109
|
return IkasFilterCategory;
|
|
11097
11110
|
}());
|
|
11098
11111
|
|
|
@@ -11185,7 +11198,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
11185
11198
|
});
|
|
11186
11199
|
Object.defineProperty(IkasOrderAddress.prototype, "validationResult", {
|
|
11187
11200
|
get: function () {
|
|
11188
|
-
var _a, _b, _c, _d
|
|
11201
|
+
var _a, _b, _c, _d;
|
|
11189
11202
|
var isValidPhone = !!this.phone &&
|
|
11190
11203
|
this.phone.length >= 10 &&
|
|
11191
11204
|
validatePhoneNumber(this.phone);
|
|
@@ -11206,10 +11219,7 @@ var IkasOrderAddress = /** @class */ (function () {
|
|
|
11206
11219
|
? isValidPhone
|
|
11207
11220
|
: true,
|
|
11208
11221
|
identityNumber: ((_d = this.checkoutSettings) === null || _d === void 0 ? void 0 : _d.identityNumberRequirement) ===
|
|
11209
|
-
IkasCheckoutRequirementEnum.MANDATORY
|
|
11210
|
-
(((_e = this.checkoutSettings) === null || _e === void 0 ? void 0 : _e.identityNumberRequirement) ===
|
|
11211
|
-
IkasCheckoutRequirementEnum.OPTIONAL &&
|
|
11212
|
-
this.phone)
|
|
11222
|
+
IkasCheckoutRequirementEnum.MANDATORY
|
|
11213
11223
|
? !!this.identityNumber
|
|
11214
11224
|
: true,
|
|
11215
11225
|
};
|
|
@@ -11340,6 +11350,13 @@ var IkasOrderLineItem = /** @class */ (function () {
|
|
|
11340
11350
|
this.status = data.status || OrderLineItemStatusEnum.FULFILLED;
|
|
11341
11351
|
mobx.makeAutoObservable(this);
|
|
11342
11352
|
}
|
|
11353
|
+
Object.defineProperty(IkasOrderLineItem.prototype, "priceWithQuantity", {
|
|
11354
|
+
get: function () {
|
|
11355
|
+
return this.price * this.quantity;
|
|
11356
|
+
},
|
|
11357
|
+
enumerable: false,
|
|
11358
|
+
configurable: true
|
|
11359
|
+
});
|
|
11343
11360
|
Object.defineProperty(IkasOrderLineItem.prototype, "finalPriceWithQuantity", {
|
|
11344
11361
|
get: function () {
|
|
11345
11362
|
return this.finalPrice * this.quantity;
|
|
@@ -17474,6 +17491,8 @@ var LS_TOKEN_KEY = "customerToken";
|
|
|
17474
17491
|
var LS_TOKEN_EXPIRY = "customerTokenExpiry";
|
|
17475
17492
|
var LS_CUSTOMER_KEY = "customer";
|
|
17476
17493
|
var LS_CUSTOMER_SUB_KEY = "customerEmailSubscription";
|
|
17494
|
+
var LS_LAST_VIEWED_PRODUCTS_KEY = "lastViewedProducts";
|
|
17495
|
+
var LS_CUSTOMER_CONSENT = "customerConsent";
|
|
17477
17496
|
var IkasCustomerStore = /** @class */ (function () {
|
|
17478
17497
|
function IkasCustomerStore(baseStore) {
|
|
17479
17498
|
var _this = this;
|
|
@@ -17483,6 +17502,8 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17483
17502
|
this.baseStore = null;
|
|
17484
17503
|
this._initialized = false;
|
|
17485
17504
|
this._visitorSubscribedEmail = false;
|
|
17505
|
+
this._lastViewedProducts = [];
|
|
17506
|
+
this._customerConsentGranted = false;
|
|
17486
17507
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17487
17508
|
var response, cart;
|
|
17488
17509
|
var _a;
|
|
@@ -17502,7 +17523,9 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17502
17523
|
case 2:
|
|
17503
17524
|
_b.sent();
|
|
17504
17525
|
_b.label = 3;
|
|
17505
|
-
case 3:
|
|
17526
|
+
case 3:
|
|
17527
|
+
this.saveLocalLastViewedProducts();
|
|
17528
|
+
return [2 /*return*/, true];
|
|
17506
17529
|
case 4: return [2 /*return*/, false];
|
|
17507
17530
|
}
|
|
17508
17531
|
});
|
|
@@ -17517,6 +17540,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17517
17540
|
if (response) {
|
|
17518
17541
|
this.setToken(response.token, response.tokenExpiry);
|
|
17519
17542
|
this.setCustomer(response.customer);
|
|
17543
|
+
this.saveLocalLastViewedProducts();
|
|
17520
17544
|
return [2 /*return*/, true];
|
|
17521
17545
|
}
|
|
17522
17546
|
return [2 /*return*/, false];
|
|
@@ -17732,6 +17756,9 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17732
17756
|
}
|
|
17733
17757
|
});
|
|
17734
17758
|
}); };
|
|
17759
|
+
this.onCustomerConsentGrant = function () {
|
|
17760
|
+
_this.saveCustomerConsent();
|
|
17761
|
+
};
|
|
17735
17762
|
this.baseStore = baseStore;
|
|
17736
17763
|
this.init();
|
|
17737
17764
|
mobx.makeAutoObservable(this);
|
|
@@ -17754,6 +17781,13 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17754
17781
|
enumerable: false,
|
|
17755
17782
|
configurable: true
|
|
17756
17783
|
});
|
|
17784
|
+
Object.defineProperty(IkasCustomerStore.prototype, "customerConsentGranted", {
|
|
17785
|
+
get: function () {
|
|
17786
|
+
return this._customerConsentGranted;
|
|
17787
|
+
},
|
|
17788
|
+
enumerable: false,
|
|
17789
|
+
configurable: true
|
|
17790
|
+
});
|
|
17757
17791
|
IkasCustomerStore.prototype.init = function () {
|
|
17758
17792
|
return __awaiter(this, void 0, void 0, function () {
|
|
17759
17793
|
return __generator(this, function (_a) {
|
|
@@ -17761,6 +17795,8 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17761
17795
|
case 0:
|
|
17762
17796
|
this.loadToken();
|
|
17763
17797
|
this.loadCustomer();
|
|
17798
|
+
this.loadLastViewedProducts();
|
|
17799
|
+
this.loadCustomerConsent();
|
|
17764
17800
|
return [4 /*yield*/, this.refreshToken()];
|
|
17765
17801
|
case 1:
|
|
17766
17802
|
_a.sent();
|
|
@@ -17831,6 +17867,127 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17831
17867
|
}
|
|
17832
17868
|
catch (err) { }
|
|
17833
17869
|
};
|
|
17870
|
+
IkasCustomerStore.prototype.getLastViewedProducts = function () {
|
|
17871
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17872
|
+
var _a;
|
|
17873
|
+
return __generator(this, function (_b) {
|
|
17874
|
+
switch (_b.label) {
|
|
17875
|
+
case 0:
|
|
17876
|
+
if (!this.customer) return [3 /*break*/, 2];
|
|
17877
|
+
_a = this;
|
|
17878
|
+
return [4 /*yield*/, IkasCustomerAPI.getLastViewedProducts(this.customer.id)];
|
|
17879
|
+
case 1:
|
|
17880
|
+
_a._lastViewedProducts = _b.sent();
|
|
17881
|
+
return [3 /*break*/, 3];
|
|
17882
|
+
case 2:
|
|
17883
|
+
this.loadLastViewedProducts();
|
|
17884
|
+
_b.label = 3;
|
|
17885
|
+
case 3: return [2 /*return*/, this._lastViewedProducts];
|
|
17886
|
+
}
|
|
17887
|
+
});
|
|
17888
|
+
});
|
|
17889
|
+
};
|
|
17890
|
+
IkasCustomerStore.prototype.saveLastViewedProducts = function () {
|
|
17891
|
+
if (isServer$3)
|
|
17892
|
+
return;
|
|
17893
|
+
window.localStorage.setItem(LS_LAST_VIEWED_PRODUCTS_KEY, JSON.stringify(this._lastViewedProducts));
|
|
17894
|
+
};
|
|
17895
|
+
IkasCustomerStore.prototype.loadLastViewedProducts = function () {
|
|
17896
|
+
if (isServer$3)
|
|
17897
|
+
return;
|
|
17898
|
+
try {
|
|
17899
|
+
var lvpStr = window.localStorage.getItem(LS_LAST_VIEWED_PRODUCTS_KEY);
|
|
17900
|
+
if (lvpStr) {
|
|
17901
|
+
this._lastViewedProducts = JSON.parse(lvpStr);
|
|
17902
|
+
this._lastViewedProducts = this._lastViewedProducts.reverse();
|
|
17903
|
+
}
|
|
17904
|
+
}
|
|
17905
|
+
catch (err) { }
|
|
17906
|
+
};
|
|
17907
|
+
IkasCustomerStore.prototype.removeLastViewedProducts = function () {
|
|
17908
|
+
if (isServer$3)
|
|
17909
|
+
return;
|
|
17910
|
+
window.localStorage.removeItem(LS_LAST_VIEWED_PRODUCTS_KEY);
|
|
17911
|
+
};
|
|
17912
|
+
IkasCustomerStore.prototype.onProductView = function (productId, variantId) {
|
|
17913
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17914
|
+
var isSuccess;
|
|
17915
|
+
return __generator(this, function (_a) {
|
|
17916
|
+
switch (_a.label) {
|
|
17917
|
+
case 0:
|
|
17918
|
+
if (!this.customer) return [3 /*break*/, 2];
|
|
17919
|
+
return [4 /*yield*/, IkasCustomerAPI.saveLastViewedProducts({
|
|
17920
|
+
customerId: this.customer.id,
|
|
17921
|
+
products: [
|
|
17922
|
+
{
|
|
17923
|
+
productId: productId,
|
|
17924
|
+
variantId: variantId,
|
|
17925
|
+
},
|
|
17926
|
+
],
|
|
17927
|
+
})];
|
|
17928
|
+
case 1:
|
|
17929
|
+
isSuccess = _a.sent();
|
|
17930
|
+
if (isSuccess)
|
|
17931
|
+
this._lastViewedProducts.push({ productId: productId, variantId: variantId });
|
|
17932
|
+
return [3 /*break*/, 3];
|
|
17933
|
+
case 2:
|
|
17934
|
+
this._lastViewedProducts.push({ productId: productId, variantId: variantId });
|
|
17935
|
+
this._lastViewedProducts = this._lastViewedProducts.slice(0, 20);
|
|
17936
|
+
this.saveLastViewedProducts();
|
|
17937
|
+
_a.label = 3;
|
|
17938
|
+
case 3: return [2 /*return*/];
|
|
17939
|
+
}
|
|
17940
|
+
});
|
|
17941
|
+
});
|
|
17942
|
+
};
|
|
17943
|
+
IkasCustomerStore.prototype.saveLocalLastViewedProducts = function () {
|
|
17944
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
17945
|
+
var isSuccess;
|
|
17946
|
+
return __generator(this, function (_a) {
|
|
17947
|
+
switch (_a.label) {
|
|
17948
|
+
case 0:
|
|
17949
|
+
if (isServer$3)
|
|
17950
|
+
return [2 /*return*/];
|
|
17951
|
+
_a.label = 1;
|
|
17952
|
+
case 1:
|
|
17953
|
+
_a.trys.push([1, 4, , 5]);
|
|
17954
|
+
this.loadLastViewedProducts();
|
|
17955
|
+
if (!this._lastViewedProducts.length) return [3 /*break*/, 3];
|
|
17956
|
+
return [4 /*yield*/, IkasCustomerAPI.saveLastViewedProducts({
|
|
17957
|
+
customerId: this.customer.id,
|
|
17958
|
+
products: this._lastViewedProducts,
|
|
17959
|
+
})];
|
|
17960
|
+
case 2:
|
|
17961
|
+
isSuccess = _a.sent();
|
|
17962
|
+
if (isSuccess) {
|
|
17963
|
+
this.removeLastViewedProducts();
|
|
17964
|
+
}
|
|
17965
|
+
_a.label = 3;
|
|
17966
|
+
case 3: return [3 /*break*/, 5];
|
|
17967
|
+
case 4:
|
|
17968
|
+
_a.sent();
|
|
17969
|
+
return [3 /*break*/, 5];
|
|
17970
|
+
case 5: return [2 /*return*/];
|
|
17971
|
+
}
|
|
17972
|
+
});
|
|
17973
|
+
});
|
|
17974
|
+
};
|
|
17975
|
+
IkasCustomerStore.prototype.saveCustomerConsent = function () {
|
|
17976
|
+
if (isServer$3)
|
|
17977
|
+
return;
|
|
17978
|
+
this._customerConsentGranted = true;
|
|
17979
|
+
window.localStorage.setItem(LS_CUSTOMER_CONSENT, "true");
|
|
17980
|
+
};
|
|
17981
|
+
IkasCustomerStore.prototype.loadCustomerConsent = function () {
|
|
17982
|
+
if (isServer$3)
|
|
17983
|
+
return;
|
|
17984
|
+
this._customerConsentGranted = !!window.localStorage.getItem(LS_CUSTOMER_CONSENT);
|
|
17985
|
+
};
|
|
17986
|
+
IkasCustomerStore.prototype.removeCustomerConsent = function () {
|
|
17987
|
+
if (isServer$3)
|
|
17988
|
+
return;
|
|
17989
|
+
window.localStorage.removeItem(LS_CUSTOMER_CONSENT);
|
|
17990
|
+
};
|
|
17834
17991
|
IkasCustomerStore.prototype.setToken = function (token, tokenExpiry) {
|
|
17835
17992
|
if (isServer$3)
|
|
17836
17993
|
return;
|
|
@@ -20919,6 +21076,15 @@ var CustomerAccountStatusesEnum;
|
|
|
20919
21076
|
CustomerAccountStatusesEnum["DISABLED_ACCOUNT"] = "DISABLED_ACCOUNT";
|
|
20920
21077
|
CustomerAccountStatusesEnum["INVITED_TO_CREATE_ACCOUNT"] = "INVITED_TO_CREATE_ACCOUNT";
|
|
20921
21078
|
})(CustomerAccountStatusesEnum || (CustomerAccountStatusesEnum = {}));
|
|
21079
|
+
/**
|
|
21080
|
+
* Customer Email Subscription Statuses
|
|
21081
|
+
*/
|
|
21082
|
+
var CustomerEmailSubscriptionStatusesEnum;
|
|
21083
|
+
(function (CustomerEmailSubscriptionStatusesEnum) {
|
|
21084
|
+
CustomerEmailSubscriptionStatusesEnum["NOT_SUBSCRIBED"] = "NOT_SUBSCRIBED";
|
|
21085
|
+
CustomerEmailSubscriptionStatusesEnum["PENDING_CONFIRMATION"] = "PENDING_CONFIRMATION";
|
|
21086
|
+
CustomerEmailSubscriptionStatusesEnum["SUBSCRIBED"] = "SUBSCRIBED";
|
|
21087
|
+
})(CustomerEmailSubscriptionStatusesEnum || (CustomerEmailSubscriptionStatusesEnum = {}));
|
|
20922
21088
|
/**
|
|
20923
21089
|
* Url Slug Target Type Enum Codes
|
|
20924
21090
|
*/
|
|
@@ -21172,6 +21338,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21172
21338
|
var _this = this;
|
|
21173
21339
|
this.filters = null;
|
|
21174
21340
|
this._filterCategories = null;
|
|
21341
|
+
this._infiniteScrollPage = null;
|
|
21175
21342
|
this._initialized = false;
|
|
21176
21343
|
this._minPage = null;
|
|
21177
21344
|
this._filterBrandId = null;
|
|
@@ -21182,12 +21349,12 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21182
21349
|
this.router = null;
|
|
21183
21350
|
this.applyFilters = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
21184
21351
|
var resultsSet;
|
|
21185
|
-
var _a
|
|
21186
|
-
return __generator(this, function (
|
|
21187
|
-
switch (
|
|
21352
|
+
var _a;
|
|
21353
|
+
return __generator(this, function (_b) {
|
|
21354
|
+
switch (_b.label) {
|
|
21188
21355
|
case 0: return [4 /*yield*/, this.getInitial()];
|
|
21189
21356
|
case 1:
|
|
21190
|
-
resultsSet =
|
|
21357
|
+
resultsSet = _b.sent();
|
|
21191
21358
|
if (![
|
|
21192
21359
|
exports.IkasThemePageType.CATEGORY,
|
|
21193
21360
|
exports.IkasThemePageType.BRAND,
|
|
@@ -21196,38 +21363,30 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21196
21363
|
return [2 /*return*/];
|
|
21197
21364
|
// Change url params
|
|
21198
21365
|
if (resultsSet && this.isBrowser()) {
|
|
21199
|
-
|
|
21200
|
-
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace("" + location.pathname + (this.filterQueryParams ? "?" + this.filterQueryParams : ""), undefined, { shallow: true });
|
|
21201
|
-
}
|
|
21202
|
-
else {
|
|
21203
|
-
(_b = this.router) === null || _b === void 0 ? void 0 : _b.replace("" + location.pathname, undefined, {
|
|
21204
|
-
shallow: true,
|
|
21205
|
-
});
|
|
21206
|
-
}
|
|
21366
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace("" + location.pathname + (this.filterQueryParams ? "?" + this.filterQueryParams : ""), undefined, { shallow: true });
|
|
21207
21367
|
}
|
|
21208
21368
|
return [2 /*return*/];
|
|
21209
21369
|
}
|
|
21210
21370
|
});
|
|
21211
21371
|
}); };
|
|
21212
21372
|
this.getInitial = function (queryParams, isInfiteScrollReturn) { return __awaiter(_this, void 0, void 0, function () {
|
|
21213
|
-
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
21214
|
-
|
|
21215
|
-
|
|
21216
|
-
switch (_b.label) {
|
|
21373
|
+
var fetchRequestTime, page, limit, productIdList, lastViewedProducts, response_1, data, idList, err_1;
|
|
21374
|
+
return __generator(this, function (_a) {
|
|
21375
|
+
switch (_a.label) {
|
|
21217
21376
|
case 0:
|
|
21218
21377
|
this._isLoading = true;
|
|
21219
21378
|
fetchRequestTime = Date.now();
|
|
21220
21379
|
this._fetchRequestTime = fetchRequestTime;
|
|
21221
|
-
|
|
21380
|
+
_a.label = 1;
|
|
21222
21381
|
case 1:
|
|
21223
|
-
|
|
21382
|
+
_a.trys.push([1, 12, 13, 14]);
|
|
21224
21383
|
page = isInfiteScrollReturn ? this._page : 1;
|
|
21225
21384
|
limit = this._limit;
|
|
21226
21385
|
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
21227
21386
|
return [4 /*yield*/, this.getFilters()];
|
|
21228
21387
|
case 2:
|
|
21229
|
-
|
|
21230
|
-
|
|
21388
|
+
_a.sent();
|
|
21389
|
+
_a.label = 3;
|
|
21231
21390
|
case 3:
|
|
21232
21391
|
this.applyQueryParamFilters(queryParams);
|
|
21233
21392
|
if (this.isSearch && !this.hasAppliedfilter) {
|
|
@@ -21238,27 +21397,48 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21238
21397
|
this._initialized = true;
|
|
21239
21398
|
return [2 /*return*/, true];
|
|
21240
21399
|
}
|
|
21241
|
-
|
|
21242
|
-
|
|
21243
|
-
|
|
21244
|
-
|
|
21245
|
-
|
|
21246
|
-
page = 1;
|
|
21247
|
-
limit = 10;
|
|
21248
|
-
}
|
|
21249
|
-
else if (this.isRecommended) {
|
|
21250
|
-
page = 1;
|
|
21251
|
-
limit = 10;
|
|
21252
|
-
}
|
|
21253
|
-
return [4 /*yield*/, this.searchProducts(page || 1, limit || 10)];
|
|
21400
|
+
productIdList = void 0;
|
|
21401
|
+
if (!this.isStatic) return [3 /*break*/, 4];
|
|
21402
|
+
page = undefined;
|
|
21403
|
+
limit = undefined;
|
|
21404
|
+
return [3 /*break*/, 10];
|
|
21254
21405
|
case 4:
|
|
21255
|
-
|
|
21406
|
+
if (!this.isDiscounted) return [3 /*break*/, 5];
|
|
21407
|
+
page = 1;
|
|
21408
|
+
limit = 10;
|
|
21409
|
+
return [3 /*break*/, 10];
|
|
21410
|
+
case 5:
|
|
21411
|
+
if (!this.isRecommended) return [3 /*break*/, 6];
|
|
21412
|
+
page = 1;
|
|
21413
|
+
limit = 10;
|
|
21414
|
+
return [3 /*break*/, 10];
|
|
21415
|
+
case 6:
|
|
21416
|
+
if (!this.isLastViewed) return [3 /*break*/, 10];
|
|
21417
|
+
if (!this.isBrowser()) return [3 /*break*/, 9];
|
|
21418
|
+
return [4 /*yield*/, this.waitForCustomerStoreInit()];
|
|
21419
|
+
case 7:
|
|
21420
|
+
_a.sent();
|
|
21421
|
+
return [4 /*yield*/, IkasStorefrontConfig.store.customerStore.getLastViewedProducts()];
|
|
21422
|
+
case 8:
|
|
21423
|
+
lastViewedProducts = _a.sent();
|
|
21424
|
+
if (lastViewedProducts && lastViewedProducts.length) {
|
|
21425
|
+
productIdList = lastViewedProducts.map(function (p) { return p.productId; });
|
|
21426
|
+
}
|
|
21427
|
+
return [3 /*break*/, 10];
|
|
21428
|
+
case 9: return [2 /*return*/];
|
|
21429
|
+
case 10: return [4 /*yield*/, this.searchProducts(page || 1, limit || 10, productIdList)];
|
|
21430
|
+
case 11:
|
|
21431
|
+
response_1 = _a.sent();
|
|
21256
21432
|
if (!response_1 || this._fetchRequestTime !== fetchRequestTime)
|
|
21257
21433
|
return [2 /*return*/];
|
|
21258
21434
|
data = [];
|
|
21259
|
-
if (this.isStatic) {
|
|
21435
|
+
if (this.isStatic || this.isLastViewed) {
|
|
21436
|
+
idList = this.isStatic
|
|
21437
|
+
? this._productListPropValue.productIds
|
|
21438
|
+
: //@ts-ignore
|
|
21439
|
+
IkasStorefrontConfig.store.customerStore._lastViewedProducts;
|
|
21260
21440
|
data =
|
|
21261
|
-
(
|
|
21441
|
+
(idList === null || idList === void 0 ? void 0 : idList.map(function (pID) {
|
|
21262
21442
|
var product = response_1.data.find(function (p) { return p.id === pID.productId; });
|
|
21263
21443
|
var variant = product === null || product === void 0 ? void 0 : product.variants.find(function (v) { return v.id === pID.variantId; });
|
|
21264
21444
|
if (product && variant)
|
|
@@ -21276,16 +21456,18 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21276
21456
|
this._initialized = true;
|
|
21277
21457
|
this._page = page || 1;
|
|
21278
21458
|
this._minPage = this.page;
|
|
21459
|
+
if (!isInfiteScrollReturn)
|
|
21460
|
+
this._infiniteScrollPage = null;
|
|
21279
21461
|
return [2 /*return*/, true];
|
|
21280
|
-
case
|
|
21281
|
-
err_1 =
|
|
21462
|
+
case 12:
|
|
21463
|
+
err_1 = _a.sent();
|
|
21282
21464
|
console.log(err_1);
|
|
21283
|
-
return [3 /*break*/,
|
|
21284
|
-
case
|
|
21465
|
+
return [3 /*break*/, 14];
|
|
21466
|
+
case 13:
|
|
21285
21467
|
if (fetchRequestTime === this._fetchRequestTime)
|
|
21286
21468
|
this._isLoading = false;
|
|
21287
21469
|
return [7 /*endfinally*/];
|
|
21288
|
-
case
|
|
21470
|
+
case 14: return [2 /*return*/];
|
|
21289
21471
|
}
|
|
21290
21472
|
});
|
|
21291
21473
|
}); };
|
|
@@ -21297,6 +21479,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21297
21479
|
if (this.isStatic ||
|
|
21298
21480
|
this.isDiscounted ||
|
|
21299
21481
|
this.isRecommended ||
|
|
21482
|
+
this.isLastViewed ||
|
|
21300
21483
|
this._isLoading ||
|
|
21301
21484
|
!this.hasPrev)
|
|
21302
21485
|
return [2 /*return*/];
|
|
@@ -21336,6 +21519,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21336
21519
|
if (this.isStatic ||
|
|
21337
21520
|
this.isDiscounted ||
|
|
21338
21521
|
this.isRecommended ||
|
|
21522
|
+
this.isLastViewed ||
|
|
21339
21523
|
this._isLoading ||
|
|
21340
21524
|
!this.hasNext)
|
|
21341
21525
|
return [2 /*return*/];
|
|
@@ -21374,7 +21558,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21374
21558
|
if (this._isLoading ||
|
|
21375
21559
|
this.isStatic ||
|
|
21376
21560
|
this.isDiscounted ||
|
|
21377
|
-
this.isRecommended
|
|
21561
|
+
this.isRecommended ||
|
|
21562
|
+
this.isLastViewed)
|
|
21378
21563
|
return [2 /*return*/];
|
|
21379
21564
|
this._isLoading = true;
|
|
21380
21565
|
_a.label = 1;
|
|
@@ -21404,6 +21589,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21404
21589
|
}
|
|
21405
21590
|
});
|
|
21406
21591
|
}); };
|
|
21592
|
+
this.setVisibleInfiniteScrollPage = function (page) {
|
|
21593
|
+
var _a;
|
|
21594
|
+
if (_this._infiniteScrollPage === page)
|
|
21595
|
+
return;
|
|
21596
|
+
_this._infiniteScrollPage = page;
|
|
21597
|
+
(_a = _this.router) === null || _a === void 0 ? void 0 : _a.replace("" + location.pathname + (_this.filterQueryParams ? "?" + _this.filterQueryParams : ""), undefined, { shallow: true });
|
|
21598
|
+
};
|
|
21407
21599
|
this.searchDebouncer = debounce_1(function () {
|
|
21408
21600
|
_this.applyFilters();
|
|
21409
21601
|
}, 100);
|
|
@@ -21444,15 +21636,18 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21444
21636
|
this.router = router;
|
|
21445
21637
|
mobx.makeAutoObservable(this);
|
|
21446
21638
|
if (this.isBrowser()) {
|
|
21447
|
-
this.
|
|
21639
|
+
this.restoreInfiniteScrollPage();
|
|
21448
21640
|
if (location.search &&
|
|
21449
21641
|
(this.isFilterable || this._type === exports.IkasProductListType.SEARCH)) {
|
|
21450
21642
|
var queryParams = this.getQueryParams();
|
|
21451
|
-
this.getInitial(queryParams);
|
|
21643
|
+
this.getInitial(queryParams, this._page > 1);
|
|
21452
21644
|
}
|
|
21453
21645
|
else if (this._page > 1) {
|
|
21454
21646
|
this.getInitial(undefined, true);
|
|
21455
21647
|
}
|
|
21648
|
+
else if (this.isLastViewed) {
|
|
21649
|
+
this.getInitial();
|
|
21650
|
+
}
|
|
21456
21651
|
}
|
|
21457
21652
|
}
|
|
21458
21653
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
@@ -21483,6 +21678,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21483
21678
|
enumerable: false,
|
|
21484
21679
|
configurable: true
|
|
21485
21680
|
});
|
|
21681
|
+
Object.defineProperty(IkasProductList.prototype, "minPage", {
|
|
21682
|
+
get: function () {
|
|
21683
|
+
return this._minPage || 1;
|
|
21684
|
+
},
|
|
21685
|
+
enumerable: false,
|
|
21686
|
+
configurable: true
|
|
21687
|
+
});
|
|
21486
21688
|
Object.defineProperty(IkasProductList.prototype, "count", {
|
|
21487
21689
|
get: function () {
|
|
21488
21690
|
return this._count;
|
|
@@ -21558,6 +21760,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21558
21760
|
enumerable: false,
|
|
21559
21761
|
configurable: true
|
|
21560
21762
|
});
|
|
21763
|
+
Object.defineProperty(IkasProductList.prototype, "isLastViewed", {
|
|
21764
|
+
get: function () {
|
|
21765
|
+
return this._type === exports.IkasProductListType.LAST_VIEWED;
|
|
21766
|
+
},
|
|
21767
|
+
enumerable: false,
|
|
21768
|
+
configurable: true
|
|
21769
|
+
});
|
|
21561
21770
|
Object.defineProperty(IkasProductList.prototype, "isSearch", {
|
|
21562
21771
|
get: function () {
|
|
21563
21772
|
return this._type === exports.IkasProductListType.SEARCH;
|
|
@@ -21599,10 +21808,13 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21599
21808
|
var _a, _b, _c;
|
|
21600
21809
|
var queryParams = {};
|
|
21601
21810
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
21602
|
-
|
|
21811
|
+
if (f.keyList.length)
|
|
21812
|
+
queryParams[f.key] = f.keyList;
|
|
21603
21813
|
});
|
|
21604
21814
|
if (this._searchKeyword)
|
|
21605
21815
|
queryParams.s = this._searchKeyword;
|
|
21816
|
+
if (this._infiniteScrollPage)
|
|
21817
|
+
queryParams.page = this._infiniteScrollPage;
|
|
21606
21818
|
if (this._pageType !== exports.IkasThemePageType.CATEGORY &&
|
|
21607
21819
|
this._filterCategoryId) {
|
|
21608
21820
|
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;
|
|
@@ -21672,7 +21884,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21672
21884
|
type: type,
|
|
21673
21885
|
};
|
|
21674
21886
|
};
|
|
21675
|
-
IkasProductList.prototype.searchProducts = function (page, limit) {
|
|
21887
|
+
IkasProductList.prototype.searchProducts = function (page, limit, productIdList) {
|
|
21676
21888
|
var _a, _b;
|
|
21677
21889
|
return __awaiter(this, void 0, void 0, function () {
|
|
21678
21890
|
var filterList;
|
|
@@ -21700,7 +21912,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21700
21912
|
page: page,
|
|
21701
21913
|
perPage: limit,
|
|
21702
21914
|
productIdList: this.isStatic
|
|
21703
|
-
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) :
|
|
21915
|
+
? (_b = this._productListPropValue.productIds) === null || _b === void 0 ? void 0 : _b.map(function (p) { return p.productId; }) : productIdList,
|
|
21704
21916
|
filterList: filterList,
|
|
21705
21917
|
brandId: this._pageType === exports.IkasThemePageType.BRAND &&
|
|
21706
21918
|
this._type !== exports.IkasProductListType.SEARCH
|
|
@@ -21826,32 +22038,34 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21826
22038
|
});
|
|
21827
22039
|
};
|
|
21828
22040
|
IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
|
|
21829
|
-
var _a;
|
|
22041
|
+
var _a, _b;
|
|
21830
22042
|
if (disableRoute === void 0) { disableRoute = false; }
|
|
21831
22043
|
return __awaiter(this, void 0, void 0, function () {
|
|
21832
|
-
return __generator(this, function (
|
|
21833
|
-
switch (
|
|
22044
|
+
return __generator(this, function (_c) {
|
|
22045
|
+
switch (_c.label) {
|
|
21834
22046
|
case 0:
|
|
21835
22047
|
if (!disableRoute) return [3 /*break*/, 2];
|
|
21836
|
-
this._filterCategoryId
|
|
22048
|
+
if (this._filterCategoryId === filterCategory.id)
|
|
22049
|
+
this._filterCategoryId = undefined;
|
|
22050
|
+
else
|
|
22051
|
+
this._filterCategoryId = filterCategory.id;
|
|
22052
|
+
(_a = this._filterCategories) === null || _a === void 0 ? void 0 : _a.forEach(function (fc) {
|
|
22053
|
+
//@ts-ignore
|
|
22054
|
+
fc._isSelected = fc.id === filterCategory.id;
|
|
22055
|
+
});
|
|
21837
22056
|
return [4 /*yield*/, this.applyFilters()];
|
|
21838
22057
|
case 1:
|
|
21839
|
-
|
|
22058
|
+
_c.sent();
|
|
21840
22059
|
return [3 /*break*/, 3];
|
|
21841
22060
|
case 2:
|
|
21842
|
-
(
|
|
22061
|
+
(_b = this.router) === null || _b === void 0 ? void 0 : _b.push(filterCategory.href +
|
|
21843
22062
|
(this.filterQueryParams ? "?" + this.filterQueryParams : ""));
|
|
21844
|
-
|
|
22063
|
+
_c.label = 3;
|
|
21845
22064
|
case 3: return [2 /*return*/];
|
|
21846
22065
|
}
|
|
21847
22066
|
});
|
|
21848
22067
|
});
|
|
21849
22068
|
};
|
|
21850
|
-
IkasProductList.prototype.setVisibleInfiniteScrollPage = function (page) {
|
|
21851
|
-
//@ts-ignore
|
|
21852
|
-
var infiniteScrollPages = IkasStorefrontConfig.store.infiniteScrollPages;
|
|
21853
|
-
infiniteScrollPages[this._productListPropValue.id] = page;
|
|
21854
|
-
};
|
|
21855
22069
|
IkasProductList.prototype.toJSON = function () {
|
|
21856
22070
|
return {
|
|
21857
22071
|
data: this.data,
|
|
@@ -21872,22 +22086,17 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21872
22086
|
productListPropValue: this._productListPropValue,
|
|
21873
22087
|
};
|
|
21874
22088
|
};
|
|
21875
|
-
IkasProductList.prototype.
|
|
21876
|
-
|
|
21877
|
-
var
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
if (
|
|
22089
|
+
IkasProductList.prototype.restoreInfiniteScrollPage = function () {
|
|
22090
|
+
var queryParams = this.getQueryParams();
|
|
22091
|
+
var pageStr = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("page");
|
|
22092
|
+
if (pageStr) {
|
|
22093
|
+
var page = parseInt(pageStr);
|
|
22094
|
+
if (!isNaN(page)) {
|
|
21881
22095
|
this._page = page;
|
|
21882
|
-
|
|
21883
|
-
else {
|
|
21884
|
-
delete infiniteScrollPages[this._productListPropValue.id];
|
|
22096
|
+
this._infiniteScrollPage = page;
|
|
21885
22097
|
}
|
|
21886
22098
|
}
|
|
21887
22099
|
};
|
|
21888
|
-
IkasProductList.prototype.hasForwardRoute = function () {
|
|
21889
|
-
return this.isBrowser() && !!window.history.forward;
|
|
21890
|
-
};
|
|
21891
22100
|
IkasProductList.prototype.getQueryParams = function () {
|
|
21892
22101
|
if (!this.isBrowser())
|
|
21893
22102
|
return;
|
|
@@ -21896,6 +22105,16 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21896
22105
|
IkasProductList.prototype.isBrowser = function () {
|
|
21897
22106
|
return typeof window !== "undefined";
|
|
21898
22107
|
};
|
|
22108
|
+
IkasProductList.prototype.waitForCustomerStoreInit = function () {
|
|
22109
|
+
return new Promise(function (resolve) {
|
|
22110
|
+
var interval = setInterval(function () {
|
|
22111
|
+
if (IkasStorefrontConfig.store.customerStore.initialized) {
|
|
22112
|
+
clearInterval(interval);
|
|
22113
|
+
resolve(null);
|
|
22114
|
+
}
|
|
22115
|
+
}, 1000);
|
|
22116
|
+
});
|
|
22117
|
+
};
|
|
21899
22118
|
return IkasProductList;
|
|
21900
22119
|
}());
|
|
21901
22120
|
(function (IkasProductListType) {
|
|
@@ -21905,6 +22124,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21905
22124
|
IkasProductListType["RECOMMENDED"] = "RECOMMENDED";
|
|
21906
22125
|
IkasProductListType["CATEGORY"] = "CATEGORY";
|
|
21907
22126
|
IkasProductListType["SEARCH"] = "SEARCH";
|
|
22127
|
+
IkasProductListType["LAST_VIEWED"] = "LAST_VIEWED";
|
|
21908
22128
|
})(exports.IkasProductListType || (exports.IkasProductListType = {}));
|
|
21909
22129
|
(function (IkasProductListSortType) {
|
|
21910
22130
|
// A_Z = "A_Z",
|
|
@@ -27658,9 +27878,73 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27658
27878
|
});
|
|
27659
27879
|
});
|
|
27660
27880
|
};
|
|
27881
|
+
IkasCustomerAPI.getLastViewedProducts = function (customerId) {
|
|
27882
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27883
|
+
var QUERY, _a, data, errors, error_2;
|
|
27884
|
+
return __generator(this, function (_b) {
|
|
27885
|
+
switch (_b.label) {
|
|
27886
|
+
case 0:
|
|
27887
|
+
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 "])));
|
|
27888
|
+
_b.label = 1;
|
|
27889
|
+
case 1:
|
|
27890
|
+
_b.trys.push([1, 3, , 4]);
|
|
27891
|
+
return [4 /*yield*/, apollo
|
|
27892
|
+
.getClient()
|
|
27893
|
+
.query({
|
|
27894
|
+
query: QUERY,
|
|
27895
|
+
variables: {
|
|
27896
|
+
customerId: customerId,
|
|
27897
|
+
},
|
|
27898
|
+
})];
|
|
27899
|
+
case 2:
|
|
27900
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
27901
|
+
if (errors && errors.length)
|
|
27902
|
+
return [2 /*return*/, []];
|
|
27903
|
+
return [2 /*return*/, data.getLastViewedProducts.products];
|
|
27904
|
+
case 3:
|
|
27905
|
+
error_2 = _b.sent();
|
|
27906
|
+
console.log(error_2);
|
|
27907
|
+
return [2 /*return*/, []];
|
|
27908
|
+
case 4: return [2 /*return*/];
|
|
27909
|
+
}
|
|
27910
|
+
});
|
|
27911
|
+
});
|
|
27912
|
+
};
|
|
27913
|
+
IkasCustomerAPI.saveLastViewedProducts = function (input) {
|
|
27914
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27915
|
+
var MUTATION, errors, err_12;
|
|
27916
|
+
return __generator(this, function (_a) {
|
|
27917
|
+
switch (_a.label) {
|
|
27918
|
+
case 0:
|
|
27919
|
+
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 "])));
|
|
27920
|
+
_a.label = 1;
|
|
27921
|
+
case 1:
|
|
27922
|
+
_a.trys.push([1, 3, , 4]);
|
|
27923
|
+
return [4 /*yield*/, apollo
|
|
27924
|
+
.getClient()
|
|
27925
|
+
.mutate({
|
|
27926
|
+
mutation: MUTATION,
|
|
27927
|
+
variables: {
|
|
27928
|
+
input: input,
|
|
27929
|
+
},
|
|
27930
|
+
})];
|
|
27931
|
+
case 2:
|
|
27932
|
+
errors = (_a.sent()).errors;
|
|
27933
|
+
if (errors && errors.length)
|
|
27934
|
+
return [2 /*return*/, false];
|
|
27935
|
+
return [3 /*break*/, 4];
|
|
27936
|
+
case 3:
|
|
27937
|
+
err_12 = _a.sent();
|
|
27938
|
+
console.log(err_12);
|
|
27939
|
+
return [2 /*return*/, false];
|
|
27940
|
+
case 4: return [2 /*return*/, true];
|
|
27941
|
+
}
|
|
27942
|
+
});
|
|
27943
|
+
});
|
|
27944
|
+
};
|
|
27661
27945
|
return IkasCustomerAPI;
|
|
27662
27946
|
}());
|
|
27663
|
-
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;
|
|
27947
|
+
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;
|
|
27664
27948
|
|
|
27665
27949
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
27666
27950
|
function IkasDistrictAPI() {
|
|
@@ -29890,11 +30174,11 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
29890
30174
|
};
|
|
29891
30175
|
var onPrivacyPolicyClick = function () {
|
|
29892
30176
|
vm.policyModalTitle = "Gizlilik Politikası";
|
|
29893
|
-
vm.policyModalText = vm.
|
|
30177
|
+
vm.policyModalText = vm.privacyPolicy;
|
|
29894
30178
|
};
|
|
29895
30179
|
var onTermsOfServiceClick = function () {
|
|
29896
30180
|
vm.policyModalTitle = "Hizmet Şartları";
|
|
29897
|
-
vm.policyModalText = vm.
|
|
30181
|
+
vm.policyModalText = vm.termsOfService;
|
|
29898
30182
|
};
|
|
29899
30183
|
var onErrorClose = function () {
|
|
29900
30184
|
vm.error = undefined;
|
|
@@ -29975,7 +30259,7 @@ var style = {
|
|
|
29975
30259
|
backgroundColor: "rgba(255, 0, 0, 0.5)",
|
|
29976
30260
|
};
|
|
29977
30261
|
|
|
29978
|
-
var PACKAGE_VERSION = "0.0.
|
|
30262
|
+
var PACKAGE_VERSION = "0.0.158";
|
|
29979
30263
|
var PageViewModel = /** @class */ (function () {
|
|
29980
30264
|
function PageViewModel(router) {
|
|
29981
30265
|
var _this = this;
|
|
@@ -30866,6 +31150,20 @@ var Page$1 = function (_a) {
|
|
|
30866
31150
|
React.useEffect(function () {
|
|
30867
31151
|
setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router$1, settingsStr, isBrowser));
|
|
30868
31152
|
}, [isBrowser, propValuesStr]);
|
|
31153
|
+
// If the user clicks a link for the same page, we need this logic to re-render the page
|
|
31154
|
+
React.useEffect(function () {
|
|
31155
|
+
router$1.events.on("routeChangeComplete", handleRouteChange);
|
|
31156
|
+
return function () {
|
|
31157
|
+
router$1.events.off("routeChangeComplete", handleRouteChange);
|
|
31158
|
+
};
|
|
31159
|
+
}, []);
|
|
31160
|
+
var handleRouteChange = function (url, options) {
|
|
31161
|
+
var shallow = options.shallow;
|
|
31162
|
+
if (!shallow &&
|
|
31163
|
+
[exports.IkasThemePageType.CATEGORY, exports.IkasThemePageType.BRAND].includes(page.type)) {
|
|
31164
|
+
setPropValues(IkasPageDataProvider.initPropValues(propValuesStr, router$1, settingsStr, isBrowser));
|
|
31165
|
+
}
|
|
31166
|
+
};
|
|
30869
31167
|
return (React.createElement(IkasPage, { page: page, propValues: propValues, pageSpecificDataStr: pageSpecificDataStr, settingsStr: settingsStr, merchantSettings: merchantSettings, addOgpMetas: true }));
|
|
30870
31168
|
};
|
|
30871
31169
|
var index$1 = mobxReactLite.observer(Page$1);
|
|
@@ -30913,6 +31211,8 @@ function handleAnalytics(page, pageSpecificDataStr) {
|
|
|
30913
31211
|
var productDetailParsed = JSON.parse(pageSpecificDataStr);
|
|
30914
31212
|
var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
|
|
30915
31213
|
Analytics.productView(productDetail);
|
|
31214
|
+
// @ts-ignore
|
|
31215
|
+
IkasStorefrontConfig.store.customerStore.onProductView(productDetail.product.id, productDetail.selectedVariant.id);
|
|
30916
31216
|
}
|
|
30917
31217
|
if (page.type === exports.IkasThemePageType.CATEGORY) {
|
|
30918
31218
|
var category = JSON.parse(pageSpecificDataStr);
|
|
@@ -31514,7 +31814,6 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
31514
31814
|
this.showLocaleOptions = false;
|
|
31515
31815
|
this.localeChecked = false;
|
|
31516
31816
|
this.settingsSet = false;
|
|
31517
|
-
this.infiniteScrollPages = {}; // key is productListPropValueId
|
|
31518
31817
|
this.customerStore = new IkasCustomerStore(this);
|
|
31519
31818
|
this.cartStore = new IkasCartStore(this);
|
|
31520
31819
|
mobx.makeObservable(this, {
|