@ikas/storefront 0.0.101 → 0.0.103
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 +22 -1
- package/build/api/cart/__generated__/getCart.d.ts +4 -0
- package/build/api/cart/__generated__/saveItemToCart.d.ts +4 -0
- package/build/api/checkout/__generated__/checkStocks.d.ts +3 -3
- package/build/api/checkout/index.d.ts +1 -1
- package/build/api/country/__generated__/getAvailableShippingCountries.d.ts +3 -0
- package/build/api/country/__generated__/getMyCountry.d.ts +3 -0
- package/build/api/country/__generated__/listCountry.d.ts +2 -0
- package/build/api/country/index.d.ts +2 -1
- package/build/api/index.d.ts +0 -2
- package/build/api/storefront/__generated__/getStorefront.d.ts +39 -10
- package/build/api/storefront/index.d.ts +1 -1
- package/build/components/checkout/index.d.ts +3 -0
- package/build/components/checkout/model.d.ts +4 -3
- package/build/index.es.js +728 -430
- package/build/index.js +730 -433
- package/build/models/data/cart/index.d.ts +9 -0
- package/build/models/data/country/index.d.ts +2 -0
- package/build/models/data/sales-channel/index.d.ts +12 -0
- package/build/models/data/storefront/{storefront-domain → domain}/index.d.ts +1 -0
- package/build/models/data/storefront/index.d.ts +17 -6
- package/build/models/data/storefront/localization/index.d.ts +7 -0
- package/build/models/data/storefront/routing/index.d.ts +9 -0
- package/build/models/data/storefront/theme/index.d.ts +13 -0
- package/build/models/data/storefront/theme-localization/index.d.ts +12 -0
- package/build/models/ui/product-list/index.d.ts +1 -1
- package/build/pages/404.d.ts +1 -0
- package/build/pages/[slug]/index.d.ts +1 -0
- package/build/pages/account/addresses.d.ts +1 -0
- package/build/pages/account/favorite-products.d.ts +1 -0
- package/build/pages/account/forgot-password.d.ts +1 -0
- package/build/pages/account/index.d.ts +1 -0
- package/build/pages/account/login.d.ts +1 -0
- package/build/pages/account/orders/[id].d.ts +1 -0
- package/build/pages/account/orders/index.d.ts +1 -0
- package/build/pages/account/recover-password.d.ts +1 -0
- package/build/pages/account/register.d.ts +1 -0
- package/build/pages/cart.d.ts +1 -0
- package/build/pages/checkout/[id].d.ts +4 -0
- package/build/pages/home.d.ts +1 -0
- package/build/pages/pages/[slug].d.ts +1 -0
- package/build/pages/search.d.ts +1 -0
- package/build/store/base.d.ts +13 -0
- package/build/storefront/index.d.ts +18 -0
- package/build/utils/providers/page-data.d.ts +10 -0
- package/build/utils/settings.d.ts +142 -0
- package/package.json +1 -1
- package/build/api/product-stock-location/__generated__/listProductStockLocation.d.ts +0 -13
- package/build/api/product-stock-location/index.d.ts +0 -4
- package/build/api/theme/index.d.ts +0 -4
- package/build/models/data/storefront/stockfront-location/index.d.ts +0 -5
- package/build/models/data/storefront/stockfront-route/index.d.ts +0 -5
- package/build/models/data/storefront/storefront-region/index.d.ts +0 -18
package/build/index.js
CHANGED
|
@@ -3,25 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var mobx = require('mobx');
|
|
6
|
-
var fs = require('fs');
|
|
7
|
-
var getConfig = require('next/config');
|
|
8
6
|
var React = require('react');
|
|
7
|
+
var getConfig = require('next/config');
|
|
9
8
|
var mobxReactLite = require('mobx-react-lite');
|
|
10
9
|
var router = require('next/router');
|
|
11
10
|
var Image$1 = require('next/image');
|
|
12
11
|
var Link = require('next/link');
|
|
13
12
|
var Head = require('next/head');
|
|
13
|
+
var fs = require('fs');
|
|
14
14
|
var dynamic = require('next/dynamic');
|
|
15
|
+
var Error$1 = require('next/error');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
18
|
|
|
18
|
-
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
19
|
-
var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
|
|
20
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
+
var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
|
|
21
21
|
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image$1);
|
|
22
22
|
var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
|
|
23
23
|
var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
|
|
24
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
24
25
|
var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
|
|
26
|
+
var Error__default = /*#__PURE__*/_interopDefaultLegacy(Error$1);
|
|
25
27
|
|
|
26
28
|
/*! *****************************************************************************
|
|
27
29
|
Copyright (c) Microsoft Corporation.
|
|
@@ -10885,10 +10887,37 @@ var IkasStorefrontConfig = /** @class */ (function () {
|
|
|
10885
10887
|
IkasStorefrontConfig.components = components;
|
|
10886
10888
|
IkasStorefrontConfig.config = config;
|
|
10887
10889
|
IkasStorefrontConfig.apiUrlOverride = apiUrlOverride || null;
|
|
10890
|
+
if (process.env.NEXT_PUBLIC_ENV === "local") {
|
|
10891
|
+
this.storefrontId = config.storefrontId;
|
|
10892
|
+
}
|
|
10893
|
+
};
|
|
10894
|
+
IkasStorefrontConfig.initWithJson = function (json) {
|
|
10895
|
+
try {
|
|
10896
|
+
Object.entries(json).forEach(function (_a) {
|
|
10897
|
+
var key = _a[0], value = _a[1];
|
|
10898
|
+
//@ts-ignore
|
|
10899
|
+
IkasStorefrontConfig[key] = value;
|
|
10900
|
+
});
|
|
10901
|
+
}
|
|
10902
|
+
catch (err) {
|
|
10903
|
+
console.log(err);
|
|
10904
|
+
}
|
|
10905
|
+
};
|
|
10906
|
+
IkasStorefrontConfig.getJson = function () {
|
|
10907
|
+
return {
|
|
10908
|
+
storefrontId: IkasStorefrontConfig.storefrontId || null,
|
|
10909
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId || null,
|
|
10910
|
+
storefrontThemeId: IkasStorefrontConfig.storefrontThemeId || null,
|
|
10911
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId || null,
|
|
10912
|
+
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
10913
|
+
stockLocationIds: IkasStorefrontConfig.stockLocationIds || null,
|
|
10914
|
+
routings: JSON.parse(JSON.stringify(IkasStorefrontConfig.routings)) || null,
|
|
10915
|
+
};
|
|
10888
10916
|
};
|
|
10889
10917
|
IkasStorefrontConfig.components = {};
|
|
10890
10918
|
IkasStorefrontConfig.config = {};
|
|
10891
10919
|
IkasStorefrontConfig.apiUrlOverride = null;
|
|
10920
|
+
IkasStorefrontConfig.routings = [];
|
|
10892
10921
|
return IkasStorefrontConfig;
|
|
10893
10922
|
}());
|
|
10894
10923
|
|
|
@@ -11017,6 +11046,7 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
|
|
|
11017
11046
|
return [2 /*return*/, null];
|
|
11018
11047
|
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
11019
11048
|
productIdList: [this.productDetailPropValue.productId],
|
|
11049
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
11020
11050
|
})];
|
|
11021
11051
|
case 1:
|
|
11022
11052
|
productSearchResponse = _b.sent();
|
|
@@ -11825,11 +11855,15 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11825
11855
|
return {
|
|
11826
11856
|
props: {
|
|
11827
11857
|
propValuesStr: JSON.stringify(this.pageComponentPropValues),
|
|
11858
|
+
pageSpecificDataStr: this.pageSpecificData
|
|
11859
|
+
? JSON.stringify(this.pageSpecificData || {})
|
|
11860
|
+
: "",
|
|
11828
11861
|
page: mobx.toJS(this.page) || null,
|
|
11829
11862
|
settingsStr: JSON.stringify(this.theme.settings || {}),
|
|
11830
11863
|
merchantSettings: this.merchantSettings
|
|
11831
11864
|
? JSON.stringify(this.merchantSettings)
|
|
11832
11865
|
: null,
|
|
11866
|
+
configJson: IkasStorefrontConfig.getJson(),
|
|
11833
11867
|
},
|
|
11834
11868
|
};
|
|
11835
11869
|
},
|
|
@@ -12046,6 +12080,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12046
12080
|
return [2 /*return*/];
|
|
12047
12081
|
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
12048
12082
|
productIdList: [metaDataResponse.metaData.targetId],
|
|
12083
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
12049
12084
|
})];
|
|
12050
12085
|
case 2:
|
|
12051
12086
|
productsResponse = _b.sent();
|
|
@@ -12803,6 +12838,10 @@ var IkasCart = /** @class */ (function () {
|
|
|
12803
12838
|
: [];
|
|
12804
12839
|
this.merchantId = data.merchantId || "";
|
|
12805
12840
|
this.totalPrice = data.totalPrice || 0;
|
|
12841
|
+
this.salesChannelId = data.salesChannelId || "";
|
|
12842
|
+
this.storefrontId = data.storefrontId || null;
|
|
12843
|
+
this.storefrontRoutingId = data.storefrontRoutingId || null;
|
|
12844
|
+
this.storefrontThemeId = data.storefrontThemeId || null;
|
|
12806
12845
|
mobx.makeAutoObservable(this);
|
|
12807
12846
|
}
|
|
12808
12847
|
Object.defineProperty(IkasCart.prototype, "totalTax", {
|
|
@@ -15822,7 +15861,7 @@ var MAX_CVC_LENGTH = 4;
|
|
|
15822
15861
|
var USE_DIFFERENT_ADDRESS_KEY = "sAddr";
|
|
15823
15862
|
var isServer$1 = typeof localStorage === "undefined";
|
|
15824
15863
|
var CheckoutViewModel = /** @class */ (function () {
|
|
15825
|
-
function CheckoutViewModel(checkout, queryParams, router) {
|
|
15864
|
+
function CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService) {
|
|
15826
15865
|
var _this = this;
|
|
15827
15866
|
this.checkout = new IkasCheckout();
|
|
15828
15867
|
this.storefront = null;
|
|
@@ -15928,7 +15967,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
15928
15967
|
variantId: i.variant.id,
|
|
15929
15968
|
productId: i.variant.productId,
|
|
15930
15969
|
}); });
|
|
15931
|
-
return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines)];
|
|
15970
|
+
return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, IkasStorefrontConfig.stockLocationIds || [])];
|
|
15932
15971
|
case 1:
|
|
15933
15972
|
result = _b.sent();
|
|
15934
15973
|
if (!result) {
|
|
@@ -15941,7 +15980,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
15941
15980
|
data = unavailableItems.map(function (item) { return ({
|
|
15942
15981
|
variant: _this.cart.items.find(function (i) { return i.variant.id === item.variantId; })
|
|
15943
15982
|
.variant,
|
|
15944
|
-
availableQuantity: item.
|
|
15983
|
+
availableQuantity: item.stockCount,
|
|
15945
15984
|
}); });
|
|
15946
15985
|
throw {
|
|
15947
15986
|
type: ErrorType.STOCK_ERROR,
|
|
@@ -15958,7 +15997,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
15958
15997
|
switch (_b.label) {
|
|
15959
15998
|
case 0:
|
|
15960
15999
|
_a = this;
|
|
15961
|
-
return [4 /*yield*/, IkasCountryAPI.listShippingCountries()];
|
|
16000
|
+
return [4 /*yield*/, IkasCountryAPI.listShippingCountries(IkasStorefrontConfig.storefrontId)];
|
|
15962
16001
|
case 1:
|
|
15963
16002
|
_a.shippingCountryIds = _b.sent();
|
|
15964
16003
|
return [2 /*return*/];
|
|
@@ -16034,30 +16073,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16034
16073
|
}
|
|
16035
16074
|
});
|
|
16036
16075
|
}); };
|
|
16037
|
-
this.getStorefront = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16038
|
-
var storefront;
|
|
16039
|
-
return __generator(this, function (_a) {
|
|
16040
|
-
switch (_a.label) {
|
|
16041
|
-
case 0:
|
|
16042
|
-
if (!IkasStorefrontConfig.config.storefrontId || !!this.storefront)
|
|
16043
|
-
return [2 /*return*/];
|
|
16044
|
-
_a.label = 1;
|
|
16045
|
-
case 1:
|
|
16046
|
-
_a.trys.push([1, 3, , 4]);
|
|
16047
|
-
return [4 /*yield*/, IkasStorefrontAPI.getStorefront(IkasStorefrontConfig.config.storefrontId)];
|
|
16048
|
-
case 2:
|
|
16049
|
-
storefront = _a.sent();
|
|
16050
|
-
if (storefront) {
|
|
16051
|
-
this.storefront = storefront;
|
|
16052
|
-
}
|
|
16053
|
-
return [3 /*break*/, 4];
|
|
16054
|
-
case 3:
|
|
16055
|
-
_a.sent();
|
|
16056
|
-
return [3 /*break*/, 4];
|
|
16057
|
-
case 4: return [2 /*return*/];
|
|
16058
|
-
}
|
|
16059
|
-
});
|
|
16060
|
-
}); };
|
|
16061
16076
|
this.createCustomer = function () {
|
|
16062
16077
|
if (_this.customerStore.customer) {
|
|
16063
16078
|
_this.checkout.customer = _this.customerStore.customer;
|
|
@@ -16077,7 +16092,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16077
16092
|
_this.checkout.billingAddress || new IkasOrderAddress();
|
|
16078
16093
|
}
|
|
16079
16094
|
else {
|
|
16080
|
-
_this.checkout.billingAddress =
|
|
16095
|
+
_this.checkout.billingAddress = _this.checkout.shippingAddress;
|
|
16081
16096
|
}
|
|
16082
16097
|
}
|
|
16083
16098
|
};
|
|
@@ -16189,7 +16204,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16189
16204
|
_this.router.push("/");
|
|
16190
16205
|
};
|
|
16191
16206
|
this.onProceedToShippingClick = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16192
|
-
var newAddress, customer,
|
|
16207
|
+
var newAddress, customer, err_2;
|
|
16193
16208
|
return __generator(this, function (_a) {
|
|
16194
16209
|
switch (_a.label) {
|
|
16195
16210
|
case 0:
|
|
@@ -16219,12 +16234,12 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16219
16234
|
this.changeStep(CheckoutStep.SHIPPING);
|
|
16220
16235
|
return [3 /*break*/, 7];
|
|
16221
16236
|
case 6:
|
|
16222
|
-
|
|
16223
|
-
if (
|
|
16224
|
-
this.error =
|
|
16237
|
+
err_2 = _a.sent();
|
|
16238
|
+
if (err_2.type) {
|
|
16239
|
+
this.error = err_2;
|
|
16225
16240
|
}
|
|
16226
16241
|
else {
|
|
16227
|
-
console.log(
|
|
16242
|
+
console.log(err_2);
|
|
16228
16243
|
this.error = {
|
|
16229
16244
|
type: ErrorType.UNKNOWN,
|
|
16230
16245
|
};
|
|
@@ -16236,7 +16251,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16236
16251
|
});
|
|
16237
16252
|
}); };
|
|
16238
16253
|
this.onProceedToPaymentClick = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16239
|
-
var
|
|
16254
|
+
var err_3;
|
|
16240
16255
|
return __generator(this, function (_a) {
|
|
16241
16256
|
switch (_a.label) {
|
|
16242
16257
|
case 0:
|
|
@@ -16256,12 +16271,12 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16256
16271
|
this.changeStep(CheckoutStep.PAYMENT);
|
|
16257
16272
|
return [3 /*break*/, 4];
|
|
16258
16273
|
case 3:
|
|
16259
|
-
|
|
16260
|
-
if (
|
|
16261
|
-
this.error =
|
|
16274
|
+
err_3 = _a.sent();
|
|
16275
|
+
if (err_3.type) {
|
|
16276
|
+
this.error = err_3;
|
|
16262
16277
|
}
|
|
16263
16278
|
else {
|
|
16264
|
-
console.log(
|
|
16279
|
+
console.log(err_3);
|
|
16265
16280
|
this.error = {
|
|
16266
16281
|
type: ErrorType.UNKNOWN,
|
|
16267
16282
|
};
|
|
@@ -16273,7 +16288,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16273
16288
|
});
|
|
16274
16289
|
}); };
|
|
16275
16290
|
this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16276
|
-
var response, transactionStatus,
|
|
16291
|
+
var response, transactionStatus, err_4;
|
|
16277
16292
|
return __generator(this, function (_a) {
|
|
16278
16293
|
switch (_a.label) {
|
|
16279
16294
|
case 0:
|
|
@@ -16319,10 +16334,10 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16319
16334
|
}
|
|
16320
16335
|
return [3 /*break*/, 6];
|
|
16321
16336
|
case 5:
|
|
16322
|
-
|
|
16323
|
-
if (
|
|
16324
|
-
console.log(
|
|
16325
|
-
this.error =
|
|
16337
|
+
err_4 = _a.sent();
|
|
16338
|
+
if (err_4.type) {
|
|
16339
|
+
console.log(err_4);
|
|
16340
|
+
this.error = err_4;
|
|
16326
16341
|
}
|
|
16327
16342
|
else {
|
|
16328
16343
|
this.error = {
|
|
@@ -16401,6 +16416,9 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16401
16416
|
}); };
|
|
16402
16417
|
this.checkout = checkout;
|
|
16403
16418
|
this.router = router;
|
|
16419
|
+
this.returnPolicy = returnPolicy;
|
|
16420
|
+
this.privacyPolicy = privacyPolicy;
|
|
16421
|
+
this.termsOfService = termsOfService;
|
|
16404
16422
|
this.init(queryParams);
|
|
16405
16423
|
mobx.makeAutoObservable(this);
|
|
16406
16424
|
}
|
|
@@ -16411,15 +16429,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16411
16429
|
enumerable: false,
|
|
16412
16430
|
configurable: true
|
|
16413
16431
|
});
|
|
16414
|
-
Object.defineProperty(CheckoutViewModel.prototype, "storefrontRegion", {
|
|
16415
|
-
get: function () {
|
|
16416
|
-
var _a;
|
|
16417
|
-
return ((_a = this.storefront) === null || _a === void 0 ? void 0 : _a.regions.length) ? this.storefront.regions[0]
|
|
16418
|
-
: undefined;
|
|
16419
|
-
},
|
|
16420
|
-
enumerable: false,
|
|
16421
|
-
configurable: true
|
|
16422
|
-
});
|
|
16423
16432
|
Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGatewayIndex", {
|
|
16424
16433
|
get: function () {
|
|
16425
16434
|
var _this = this;
|
|
@@ -17083,6 +17092,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17083
17092
|
return [2 /*return*/, []];
|
|
17084
17093
|
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
17085
17094
|
productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
17095
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
17086
17096
|
})];
|
|
17087
17097
|
case 2:
|
|
17088
17098
|
productsResult = _b.sent();
|
|
@@ -21917,7 +21927,10 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21917
21927
|
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
21918
21928
|
get: function () {
|
|
21919
21929
|
var _a;
|
|
21920
|
-
return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) ||
|
|
21930
|
+
return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) ||
|
|
21931
|
+
!!this._searchKeyword ||
|
|
21932
|
+
(this._pageType !== exports.IkasThemePageType.CATEGORY &&
|
|
21933
|
+
!!this._filterCategoryId));
|
|
21921
21934
|
},
|
|
21922
21935
|
enumerable: false,
|
|
21923
21936
|
configurable: true
|
|
@@ -21980,13 +21993,20 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21980
21993
|
});
|
|
21981
21994
|
Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
|
|
21982
21995
|
get: function () {
|
|
21983
|
-
var
|
|
21996
|
+
var _this = this;
|
|
21997
|
+
var _a, _b, _c;
|
|
21984
21998
|
var queryParams = {};
|
|
21985
21999
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
21986
22000
|
queryParams[f.key] = f.keyList;
|
|
21987
22001
|
});
|
|
21988
22002
|
if (this._searchKeyword)
|
|
21989
22003
|
queryParams.s = this._searchKeyword;
|
|
22004
|
+
if (this._pageType !== exports.IkasThemePageType.CATEGORY &&
|
|
22005
|
+
this._filterCategoryId) {
|
|
22006
|
+
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;
|
|
22007
|
+
if (slug)
|
|
22008
|
+
queryParams.c = slug;
|
|
22009
|
+
}
|
|
21990
22010
|
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
21991
22011
|
},
|
|
21992
22012
|
enumerable: false,
|
|
@@ -22041,6 +22061,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22041
22061
|
categoryIdList: this._filterCategoryId
|
|
22042
22062
|
? [this._filterCategoryId]
|
|
22043
22063
|
: undefined,
|
|
22064
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
22044
22065
|
query: this._searchKeyword,
|
|
22045
22066
|
})];
|
|
22046
22067
|
case 1: return [2 /*return*/, _c.sent()];
|
|
@@ -22068,6 +22089,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22068
22089
|
};
|
|
22069
22090
|
IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
|
|
22070
22091
|
var _this = this;
|
|
22092
|
+
var _a;
|
|
22071
22093
|
try {
|
|
22072
22094
|
queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
|
|
22073
22095
|
var _a;
|
|
@@ -22079,6 +22101,15 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22079
22101
|
var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
|
|
22080
22102
|
if (querySearch)
|
|
22081
22103
|
this._searchKeyword = querySearch;
|
|
22104
|
+
if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
|
|
22105
|
+
var queryCategory_1 = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("c");
|
|
22106
|
+
if (queryCategory_1) {
|
|
22107
|
+
var filterCategory = (_a = this.filterCategories) === null || _a === void 0 ? void 0 : _a.find(function (fc) { return fc.slug === queryCategory_1; });
|
|
22108
|
+
if (filterCategory) {
|
|
22109
|
+
this._filterCategoryId = filterCategory.id;
|
|
22110
|
+
}
|
|
22111
|
+
}
|
|
22112
|
+
}
|
|
22082
22113
|
}
|
|
22083
22114
|
catch (err) {
|
|
22084
22115
|
console.log(err);
|
|
@@ -22125,12 +22156,32 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22125
22156
|
var _a;
|
|
22126
22157
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
|
|
22127
22158
|
this._searchKeyword = "";
|
|
22159
|
+
if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
|
|
22160
|
+
this._filterCategoryId = undefined;
|
|
22161
|
+
}
|
|
22128
22162
|
this.applyFilters();
|
|
22129
22163
|
};
|
|
22130
|
-
IkasProductList.prototype.onFilterCategoryClick = function (filterCategory) {
|
|
22164
|
+
IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
|
|
22131
22165
|
var _a;
|
|
22132
|
-
(
|
|
22133
|
-
|
|
22166
|
+
if (disableRoute === void 0) { disableRoute = false; }
|
|
22167
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
22168
|
+
return __generator(this, function (_b) {
|
|
22169
|
+
switch (_b.label) {
|
|
22170
|
+
case 0:
|
|
22171
|
+
if (!disableRoute) return [3 /*break*/, 2];
|
|
22172
|
+
this._filterCategoryId = filterCategory.id;
|
|
22173
|
+
return [4 /*yield*/, this.applyFilters()];
|
|
22174
|
+
case 1:
|
|
22175
|
+
_b.sent();
|
|
22176
|
+
return [3 /*break*/, 3];
|
|
22177
|
+
case 2:
|
|
22178
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
|
|
22179
|
+
(this.filterQueryParams ? "?" + this.filterQueryParams : ""));
|
|
22180
|
+
_b.label = 3;
|
|
22181
|
+
case 3: return [2 /*return*/];
|
|
22182
|
+
}
|
|
22183
|
+
});
|
|
22184
|
+
});
|
|
22134
22185
|
};
|
|
22135
22186
|
IkasProductList.prototype.toJSON = function () {
|
|
22136
22187
|
return {
|
|
@@ -24215,7 +24266,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24215
24266
|
return __generator(this, function (_b) {
|
|
24216
24267
|
switch (_b.label) {
|
|
24217
24268
|
case 0:
|
|
24218
|
-
MUTATION = src(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
|
|
24269
|
+
MUTATION = src(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
|
|
24219
24270
|
_b.label = 1;
|
|
24220
24271
|
case 1:
|
|
24221
24272
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24250,7 +24301,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24250
24301
|
return __generator(this, function (_b) {
|
|
24251
24302
|
switch (_b.label) {
|
|
24252
24303
|
case 0:
|
|
24253
|
-
QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
|
|
24304
|
+
QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
|
|
24254
24305
|
_b.label = 1;
|
|
24255
24306
|
case 1:
|
|
24256
24307
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24722,13 +24773,13 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
24722
24773
|
});
|
|
24723
24774
|
});
|
|
24724
24775
|
};
|
|
24725
|
-
IkasCheckoutAPI.checkStocks = function (lines) {
|
|
24776
|
+
IkasCheckoutAPI.checkStocks = function (lines, stockLocationIdList) {
|
|
24726
24777
|
return __awaiter(this, void 0, void 0, function () {
|
|
24727
24778
|
var QUERY, _a, data, errors, err_7;
|
|
24728
24779
|
return __generator(this, function (_b) {
|
|
24729
24780
|
switch (_b.label) {
|
|
24730
24781
|
case 0:
|
|
24731
|
-
QUERY = src(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n query checkStocks($lines: [CheckStocksLineInput!]!) {\n checkStocks(lines: $lines) {\n lines {\n
|
|
24782
|
+
QUERY = src(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n query checkStocks(\n $lines: [CheckStocksLineInput!]!\n $stockLocationIdList: [String!]\n ) {\n checkStocks(lines: $lines, stockLocationIdList: $stockLocationIdList) {\n lines {\n stockCount\n isAvailable\n variantId\n }\n }\n }\n "], ["\n query checkStocks(\n $lines: [CheckStocksLineInput!]!\n $stockLocationIdList: [String!]\n ) {\n checkStocks(lines: $lines, stockLocationIdList: $stockLocationIdList) {\n lines {\n stockCount\n isAvailable\n variantId\n }\n }\n }\n "])));
|
|
24732
24783
|
_b.label = 1;
|
|
24733
24784
|
case 1:
|
|
24734
24785
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24738,6 +24789,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
24738
24789
|
query: QUERY,
|
|
24739
24790
|
variables: {
|
|
24740
24791
|
lines: lines,
|
|
24792
|
+
stockLocationIdList: stockLocationIdList,
|
|
24741
24793
|
},
|
|
24742
24794
|
})];
|
|
24743
24795
|
case 2:
|
|
@@ -24820,7 +24872,7 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24820
24872
|
return __generator(this, function (_b) {
|
|
24821
24873
|
switch (_b.label) {
|
|
24822
24874
|
case 0:
|
|
24823
|
-
QUERY = src(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n query listCountry {\n listCountry {\n id\n name\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "], ["\n query listCountry {\n listCountry {\n id\n name\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "])));
|
|
24875
|
+
QUERY = src(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n query listCountry {\n listCountry {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "], ["\n query listCountry {\n listCountry {\n id\n name\n native\n iso2\n iso3\n phoneCode\n locationTranslations {\n tr\n en\n }\n }\n }\n "])));
|
|
24824
24876
|
_b.label = 1;
|
|
24825
24877
|
case 1:
|
|
24826
24878
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24836,6 +24888,8 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24836
24888
|
return [2 /*return*/, data.listCountry.map(function (c) { return ({
|
|
24837
24889
|
id: c.id,
|
|
24838
24890
|
name: pascalCase(c.locationTranslations.tr),
|
|
24891
|
+
native: c.native || "",
|
|
24892
|
+
iso2: c.iso2 || undefined,
|
|
24839
24893
|
iso3: c.iso3 || undefined,
|
|
24840
24894
|
phoneCode: c.phoneCode || undefined,
|
|
24841
24895
|
}); })];
|
|
@@ -24849,13 +24903,13 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24849
24903
|
});
|
|
24850
24904
|
});
|
|
24851
24905
|
};
|
|
24852
|
-
IkasCountryAPI.listShippingCountries = function () {
|
|
24906
|
+
IkasCountryAPI.listShippingCountries = function (storefrontId) {
|
|
24853
24907
|
return __awaiter(this, void 0, void 0, function () {
|
|
24854
24908
|
var QUERY, _a, data, errors, err_2;
|
|
24855
24909
|
return __generator(this, function (_b) {
|
|
24856
24910
|
switch (_b.label) {
|
|
24857
24911
|
case 0:
|
|
24858
|
-
QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "], ["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "])));
|
|
24912
|
+
QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries($storefrontId: String!) {\n getAvailableShippingCountries(storefrontId: $storefrontId)\n }\n "], ["\n query getAvailableShippingCountries($storefrontId: String!) {\n getAvailableShippingCountries(storefrontId: $storefrontId)\n }\n "])));
|
|
24859
24913
|
_b.label = 1;
|
|
24860
24914
|
case 1:
|
|
24861
24915
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24863,6 +24917,9 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24863
24917
|
.getClient()
|
|
24864
24918
|
.query({
|
|
24865
24919
|
query: QUERY,
|
|
24920
|
+
variables: {
|
|
24921
|
+
storefrontId: storefrontId,
|
|
24922
|
+
},
|
|
24866
24923
|
})];
|
|
24867
24924
|
case 2:
|
|
24868
24925
|
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
@@ -24881,9 +24938,34 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24881
24938
|
});
|
|
24882
24939
|
});
|
|
24883
24940
|
};
|
|
24941
|
+
IkasCountryAPI.getMyCountry = function () {
|
|
24942
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24943
|
+
var QUERY, data, err_3;
|
|
24944
|
+
return __generator(this, function (_a) {
|
|
24945
|
+
switch (_a.label) {
|
|
24946
|
+
case 0:
|
|
24947
|
+
QUERY = src(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n query getMyCountry {\n getMyCountry\n }\n "], ["\n query getMyCountry {\n getMyCountry\n }\n "])));
|
|
24948
|
+
_a.label = 1;
|
|
24949
|
+
case 1:
|
|
24950
|
+
_a.trys.push([1, 3, , 4]);
|
|
24951
|
+
return [4 /*yield*/, apollo.getClient().query({
|
|
24952
|
+
query: QUERY,
|
|
24953
|
+
})];
|
|
24954
|
+
case 2:
|
|
24955
|
+
data = (_a.sent()).data;
|
|
24956
|
+
return [2 /*return*/, data.getMyCountry];
|
|
24957
|
+
case 3:
|
|
24958
|
+
err_3 = _a.sent();
|
|
24959
|
+
console.log(err_3);
|
|
24960
|
+
return [3 /*break*/, 4];
|
|
24961
|
+
case 4: return [2 /*return*/];
|
|
24962
|
+
}
|
|
24963
|
+
});
|
|
24964
|
+
});
|
|
24965
|
+
};
|
|
24884
24966
|
return IkasCountryAPI;
|
|
24885
24967
|
}());
|
|
24886
|
-
var templateObject_1$5, templateObject_2$3;
|
|
24968
|
+
var templateObject_1$5, templateObject_2$3, templateObject_3$1;
|
|
24887
24969
|
|
|
24888
24970
|
var IkasCustomerAPI = /** @class */ (function () {
|
|
24889
24971
|
function IkasCustomerAPI() {
|
|
@@ -24968,7 +25050,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
24968
25050
|
return __generator(this, function (_b) {
|
|
24969
25051
|
switch (_b.label) {
|
|
24970
25052
|
case 0:
|
|
24971
|
-
MUTATION = src(templateObject_3$
|
|
25053
|
+
MUTATION = src(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n mutation customerRefreshToken($token: String!) {\n customerRefreshToken(token: $token) {\n token\n tokenExpiry\n }\n }\n "], ["\n mutation customerRefreshToken($token: String!) {\n customerRefreshToken(token: $token) {\n token\n tokenExpiry\n }\n }\n "])));
|
|
24972
25054
|
_b.label = 1;
|
|
24973
25055
|
case 1:
|
|
24974
25056
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25284,7 +25366,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
25284
25366
|
};
|
|
25285
25367
|
return IkasCustomerAPI;
|
|
25286
25368
|
}());
|
|
25287
|
-
var templateObject_1$6, templateObject_2$4, templateObject_3$
|
|
25369
|
+
var templateObject_1$6, templateObject_2$4, templateObject_3$2, templateObject_4$1, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
25288
25370
|
|
|
25289
25371
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
25290
25372
|
function IkasDistrictAPI() {
|
|
@@ -25737,7 +25819,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25737
25819
|
return __generator(this, function (_b) {
|
|
25738
25820
|
switch (_b.label) {
|
|
25739
25821
|
case 0:
|
|
25740
|
-
SAVE_FAVORITE_PRODUCT = src(templateObject_3$
|
|
25822
|
+
SAVE_FAVORITE_PRODUCT = src(templateObject_3$3 || (templateObject_3$3 = __makeTemplateObject(["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "], ["\n mutation saveFavoriteProduct($isFavorite: Boolean!, $productId: String!) {\n saveFavoriteProduct(isFavorite: $isFavorite, productId: $productId)\n }\n "])));
|
|
25741
25823
|
_b.label = 1;
|
|
25742
25824
|
case 1:
|
|
25743
25825
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25763,7 +25845,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25763
25845
|
};
|
|
25764
25846
|
return IkasFavoriteProductAPI;
|
|
25765
25847
|
}());
|
|
25766
|
-
var templateObject_1$c, templateObject_2$6, templateObject_3$
|
|
25848
|
+
var templateObject_1$c, templateObject_2$6, templateObject_3$3;
|
|
25767
25849
|
|
|
25768
25850
|
var IkasContactFormAPI = /** @class */ (function () {
|
|
25769
25851
|
function IkasContactFormAPI() {
|
|
@@ -25856,150 +25938,6 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25856
25938
|
}());
|
|
25857
25939
|
var templateObject_1$e;
|
|
25858
25940
|
|
|
25859
|
-
var IkasStorefrontDomain = /** @class */ (function () {
|
|
25860
|
-
function IkasStorefrontDomain(data) {
|
|
25861
|
-
if (data === void 0) { data = {}; }
|
|
25862
|
-
this.id = data.id || "";
|
|
25863
|
-
this.merchantDomainId = data.merchantDomainId || "";
|
|
25864
|
-
this.name = data.name || "";
|
|
25865
|
-
this.redirectDomainName = data.redirectDomainName || null;
|
|
25866
|
-
mobx.makeAutoObservable(this);
|
|
25867
|
-
}
|
|
25868
|
-
return IkasStorefrontDomain;
|
|
25869
|
-
}());
|
|
25870
|
-
|
|
25871
|
-
var IkasStorefrontLocation = /** @class */ (function () {
|
|
25872
|
-
function IkasStorefrontLocation(data) {
|
|
25873
|
-
if (data === void 0) { data = {}; }
|
|
25874
|
-
this.countryId = data.countryId || "";
|
|
25875
|
-
this.stateId = data.stateId || null;
|
|
25876
|
-
mobx.makeAutoObservable(this);
|
|
25877
|
-
}
|
|
25878
|
-
return IkasStorefrontLocation;
|
|
25879
|
-
}());
|
|
25880
|
-
|
|
25881
|
-
var IkasStorefrontRoute = /** @class */ (function () {
|
|
25882
|
-
function IkasStorefrontRoute(data) {
|
|
25883
|
-
if (data === void 0) { data = {}; }
|
|
25884
|
-
this.domainId = data.domainId || "";
|
|
25885
|
-
this.useSubPath = data.useSubPath || false;
|
|
25886
|
-
mobx.makeAutoObservable(this);
|
|
25887
|
-
}
|
|
25888
|
-
return IkasStorefrontRoute;
|
|
25889
|
-
}());
|
|
25890
|
-
|
|
25891
|
-
var IkasStorefrontRegion = /** @class */ (function () {
|
|
25892
|
-
function IkasStorefrontRegion(data) {
|
|
25893
|
-
if (data === void 0) { data = {}; }
|
|
25894
|
-
// Extra
|
|
25895
|
-
this.theme = new IkasTheme();
|
|
25896
|
-
this.id = data.id || "";
|
|
25897
|
-
this.locale = data.locale || "";
|
|
25898
|
-
this.themeJSON = data.themeJSON || "";
|
|
25899
|
-
this.shipping = data.shipping || null;
|
|
25900
|
-
this.paymentSettingsId = data.paymentSettingsId || null;
|
|
25901
|
-
this.priceListId = data.priceListId || null;
|
|
25902
|
-
this.locations = data.locations
|
|
25903
|
-
? data.locations.map(function (o) { return new IkasStorefrontLocation(o); })
|
|
25904
|
-
: [];
|
|
25905
|
-
this.routes = data.routes
|
|
25906
|
-
? data.routes.map(function (o) { return new IkasStorefrontRoute(o); })
|
|
25907
|
-
: null;
|
|
25908
|
-
this.termsOfService = data.termsOfService || "";
|
|
25909
|
-
this.privacyPolicy = data.privacyPolicy || "";
|
|
25910
|
-
this.returnPolicy = data.returnPolicy || "";
|
|
25911
|
-
try {
|
|
25912
|
-
this.theme = this.themeJSON
|
|
25913
|
-
? new IkasTheme(JSON.parse(this.themeJSON))
|
|
25914
|
-
: new IkasTheme();
|
|
25915
|
-
}
|
|
25916
|
-
catch (err) { }
|
|
25917
|
-
mobx.makeAutoObservable(this);
|
|
25918
|
-
}
|
|
25919
|
-
return IkasStorefrontRegion;
|
|
25920
|
-
}());
|
|
25921
|
-
|
|
25922
|
-
var IkasStorefront = /** @class */ (function () {
|
|
25923
|
-
function IkasStorefront(data) {
|
|
25924
|
-
if (data === void 0) { data = {}; }
|
|
25925
|
-
this.id = data.id || "";
|
|
25926
|
-
this.name = data.name || "";
|
|
25927
|
-
this.themeId = data.themeId || "";
|
|
25928
|
-
this.themeVersionId = data.themeVersionId || "";
|
|
25929
|
-
this.userId = data.userId || "";
|
|
25930
|
-
this.domains = data.domains
|
|
25931
|
-
? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
|
|
25932
|
-
: [];
|
|
25933
|
-
this.regions = data.regions
|
|
25934
|
-
? data.regions.map(function (o) { return new IkasStorefrontRegion(o); })
|
|
25935
|
-
: [];
|
|
25936
|
-
mobx.makeAutoObservable(this);
|
|
25937
|
-
}
|
|
25938
|
-
return IkasStorefront;
|
|
25939
|
-
}());
|
|
25940
|
-
|
|
25941
|
-
var IkasStorefrontAPI = /** @class */ (function () {
|
|
25942
|
-
function IkasStorefrontAPI() {
|
|
25943
|
-
}
|
|
25944
|
-
IkasStorefrontAPI.getStorefront = function (storefrontId) {
|
|
25945
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
25946
|
-
var QUERY, _a, data, errors;
|
|
25947
|
-
return __generator(this, function (_b) {
|
|
25948
|
-
switch (_b.label) {
|
|
25949
|
-
case 0:
|
|
25950
|
-
QUERY = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
|
|
25951
|
-
_b.label = 1;
|
|
25952
|
-
case 1:
|
|
25953
|
-
_b.trys.push([1, 3, , 4]);
|
|
25954
|
-
return [4 /*yield*/, apollo
|
|
25955
|
-
.getClient()
|
|
25956
|
-
.query({
|
|
25957
|
-
query: QUERY,
|
|
25958
|
-
variables: {
|
|
25959
|
-
storefrontId: storefrontId,
|
|
25960
|
-
},
|
|
25961
|
-
})];
|
|
25962
|
-
case 2:
|
|
25963
|
-
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
25964
|
-
if (errors && errors.length) {
|
|
25965
|
-
console.log(errors);
|
|
25966
|
-
}
|
|
25967
|
-
if (data)
|
|
25968
|
-
return [2 /*return*/, new IkasStorefront(data.getStorefront)];
|
|
25969
|
-
return [3 /*break*/, 4];
|
|
25970
|
-
case 3:
|
|
25971
|
-
_b.sent();
|
|
25972
|
-
return [3 /*break*/, 4];
|
|
25973
|
-
case 4: return [2 /*return*/, new IkasStorefront()];
|
|
25974
|
-
}
|
|
25975
|
-
});
|
|
25976
|
-
});
|
|
25977
|
-
};
|
|
25978
|
-
return IkasStorefrontAPI;
|
|
25979
|
-
}());
|
|
25980
|
-
var templateObject_1$f;
|
|
25981
|
-
|
|
25982
|
-
var IkasThemeAPI = /** @class */ (function () {
|
|
25983
|
-
function IkasThemeAPI() {
|
|
25984
|
-
}
|
|
25985
|
-
IkasThemeAPI.fetchTheme = function () {
|
|
25986
|
-
return new Promise(function (resolve, reject) {
|
|
25987
|
-
var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
25988
|
-
var themeJSONPath = serverRuntimeConfig.THEME_JSON_PATH || "./src/theme.json";
|
|
25989
|
-
fs__default['default'].readFile(themeJSONPath, {
|
|
25990
|
-
flag: "a+",
|
|
25991
|
-
}, function (err, file) {
|
|
25992
|
-
if (err) {
|
|
25993
|
-
return reject(err);
|
|
25994
|
-
}
|
|
25995
|
-
var result = file.length ? JSON.parse(file.toString()) : {};
|
|
25996
|
-
resolve(new IkasTheme(result));
|
|
25997
|
-
});
|
|
25998
|
-
});
|
|
25999
|
-
};
|
|
26000
|
-
return IkasThemeAPI;
|
|
26001
|
-
}());
|
|
26002
|
-
|
|
26003
25941
|
var IkasVariantTypeAPI = /** @class */ (function () {
|
|
26004
25942
|
function IkasVariantTypeAPI() {
|
|
26005
25943
|
}
|
|
@@ -26009,7 +25947,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
26009
25947
|
return __generator(this, function (_b) {
|
|
26010
25948
|
switch (_b.label) {
|
|
26011
25949
|
case 0:
|
|
26012
|
-
LIST_VARIANT_TYPE = src(templateObject_1$
|
|
25950
|
+
LIST_VARIANT_TYPE = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "], ["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "])));
|
|
26013
25951
|
_b.label = 1;
|
|
26014
25952
|
case 1:
|
|
26015
25953
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -26055,7 +25993,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
26055
25993
|
};
|
|
26056
25994
|
return IkasVariantTypeAPI;
|
|
26057
25995
|
}());
|
|
26058
|
-
var templateObject_1$
|
|
25996
|
+
var templateObject_1$f;
|
|
26059
25997
|
|
|
26060
25998
|
function styleInject(css, ref) {
|
|
26061
25999
|
if ( ref === void 0 ) ref = {};
|
|
@@ -27245,6 +27183,11 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
27245
27183
|
name: product.name,
|
|
27246
27184
|
},
|
|
27247
27185
|
},
|
|
27186
|
+
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
27187
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
27188
|
+
storefrontId: IkasStorefrontConfig.storefrontId,
|
|
27189
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
|
|
27190
|
+
storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
|
|
27248
27191
|
};
|
|
27249
27192
|
return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
|
|
27250
27193
|
case 1:
|
|
@@ -27285,6 +27228,11 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
27285
27228
|
name: item.variant.name,
|
|
27286
27229
|
},
|
|
27287
27230
|
},
|
|
27231
|
+
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
27232
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
27233
|
+
storefrontId: IkasStorefrontConfig.storefrontId,
|
|
27234
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
|
|
27235
|
+
storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
|
|
27288
27236
|
};
|
|
27289
27237
|
return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
|
|
27290
27238
|
case 1:
|
|
@@ -27647,9 +27595,11 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
|
|
|
27647
27595
|
|
|
27648
27596
|
var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
27649
27597
|
var _b, _c, _d;
|
|
27650
|
-
var checkout = _a.checkout, queryParams = _a.queryParams;
|
|
27598
|
+
var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
|
|
27651
27599
|
var router$1 = router.useRouter();
|
|
27652
|
-
var vm = React.useState(function () {
|
|
27600
|
+
var vm = React.useState(function () {
|
|
27601
|
+
return new CheckoutViewModel(checkout, queryParams, router$1, returnPolicy, privacyPolicy, termsOfService);
|
|
27602
|
+
})[0];
|
|
27653
27603
|
React.useEffect(function () {
|
|
27654
27604
|
Analytics.beginCheckout(vm.checkout);
|
|
27655
27605
|
Analytics.checkoutStep(vm.checkout, vm.step);
|
|
@@ -27674,46 +27624,18 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
27674
27624
|
var onPolicyModalClose = function () {
|
|
27675
27625
|
setPolicyModalText("");
|
|
27676
27626
|
};
|
|
27677
|
-
var onReturnPolicyClick = function () {
|
|
27678
|
-
|
|
27679
|
-
|
|
27680
|
-
|
|
27681
|
-
|
|
27682
|
-
|
|
27683
|
-
|
|
27684
|
-
|
|
27685
|
-
|
|
27686
|
-
|
|
27687
|
-
|
|
27688
|
-
|
|
27689
|
-
});
|
|
27690
|
-
}); };
|
|
27691
|
-
var onPrivacyPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
27692
|
-
var _a;
|
|
27693
|
-
return __generator(this, function (_b) {
|
|
27694
|
-
switch (_b.label) {
|
|
27695
|
-
case 0: return [4 /*yield*/, vm.getStorefront()];
|
|
27696
|
-
case 1:
|
|
27697
|
-
_b.sent();
|
|
27698
|
-
setPolicyModalTitle("Gizlilik Politikası");
|
|
27699
|
-
setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.privacyPolicy) || "");
|
|
27700
|
-
return [2 /*return*/];
|
|
27701
|
-
}
|
|
27702
|
-
});
|
|
27703
|
-
}); };
|
|
27704
|
-
var onTermsOfServiceClick = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
27705
|
-
var _a;
|
|
27706
|
-
return __generator(this, function (_b) {
|
|
27707
|
-
switch (_b.label) {
|
|
27708
|
-
case 0: return [4 /*yield*/, vm.getStorefront()];
|
|
27709
|
-
case 1:
|
|
27710
|
-
_b.sent();
|
|
27711
|
-
setPolicyModalTitle("Hizmet Şartları");
|
|
27712
|
-
setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.termsOfService) || "");
|
|
27713
|
-
return [2 /*return*/];
|
|
27714
|
-
}
|
|
27715
|
-
});
|
|
27716
|
-
}); };
|
|
27627
|
+
var onReturnPolicyClick = function () {
|
|
27628
|
+
setPolicyModalTitle("Para İade Politikası");
|
|
27629
|
+
setPolicyModalText(vm.returnPolicy);
|
|
27630
|
+
};
|
|
27631
|
+
var onPrivacyPolicyClick = function () {
|
|
27632
|
+
setPolicyModalTitle("Gizlilik Politikası");
|
|
27633
|
+
setPolicyModalText(vm.privacyPolicy);
|
|
27634
|
+
};
|
|
27635
|
+
var onTermsOfServiceClick = function () {
|
|
27636
|
+
setPolicyModalTitle("Hizmet Şartları");
|
|
27637
|
+
setPolicyModalText(vm.termsOfService);
|
|
27638
|
+
};
|
|
27717
27639
|
var onErrorClose = function () {
|
|
27718
27640
|
vm.error = undefined;
|
|
27719
27641
|
};
|
|
@@ -27816,6 +27738,9 @@ var IkasPage = mobxReactLite.observer(function (_a) {
|
|
|
27816
27738
|
if (page) {
|
|
27817
27739
|
store.currentPageType = page.type;
|
|
27818
27740
|
}
|
|
27741
|
+
React.useEffect(function () {
|
|
27742
|
+
store.checkLocalization();
|
|
27743
|
+
}, []);
|
|
27819
27744
|
var renderComponent = function (pageComponent, index) {
|
|
27820
27745
|
var pageComponentPropValue = propValues.find(function (pv) { return pv.pageComponent.id === pageComponent.id; });
|
|
27821
27746
|
return (React.createElement(ThemeComponent, { key: pageComponent.id, index: index, pageComponentPropValue: pageComponentPropValue, pageComponent: pageComponent, settingsStr: settingsStr }));
|
|
@@ -28333,24 +28258,358 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
28333
28258
|
Image: Image
|
|
28334
28259
|
});
|
|
28335
28260
|
|
|
28261
|
+
var IkasStorefrontLocalization = /** @class */ (function () {
|
|
28262
|
+
function IkasStorefrontLocalization(data) {
|
|
28263
|
+
this.id = data.id || "";
|
|
28264
|
+
this.isDefault = data.isDefault || false;
|
|
28265
|
+
this.locale = data.locale || "";
|
|
28266
|
+
this.name = data.name || "";
|
|
28267
|
+
}
|
|
28268
|
+
return IkasStorefrontLocalization;
|
|
28269
|
+
}());
|
|
28270
|
+
|
|
28271
|
+
var IkasStorefrontDomain = /** @class */ (function () {
|
|
28272
|
+
function IkasStorefrontDomain(data) {
|
|
28273
|
+
if (data === void 0) { data = {}; }
|
|
28274
|
+
this.id = data.id || "";
|
|
28275
|
+
this.merchantDomainId = data.merchantDomainId || "";
|
|
28276
|
+
this.name = data.name || "";
|
|
28277
|
+
this.redirectDomainName = data.redirectDomainName || null;
|
|
28278
|
+
this.isDefault = data.isDefault || false;
|
|
28279
|
+
mobx.makeAutoObservable(this);
|
|
28280
|
+
}
|
|
28281
|
+
return IkasStorefrontDomain;
|
|
28282
|
+
}());
|
|
28283
|
+
|
|
28284
|
+
var IkasStorefrontRouting = /** @class */ (function () {
|
|
28285
|
+
function IkasStorefrontRouting(data) {
|
|
28286
|
+
this.id = data.id || "";
|
|
28287
|
+
this.countryCodes = data.countryCodes || null;
|
|
28288
|
+
this.domain = data.domain || null;
|
|
28289
|
+
this.locale = data.locale || "";
|
|
28290
|
+
this.path = data.path || null;
|
|
28291
|
+
this.priceListId = data.priceListId || null;
|
|
28292
|
+
}
|
|
28293
|
+
return IkasStorefrontRouting;
|
|
28294
|
+
}());
|
|
28295
|
+
|
|
28296
|
+
var IkasStorefrontThemeStatus;
|
|
28297
|
+
(function (IkasStorefrontThemeStatus) {
|
|
28298
|
+
IkasStorefrontThemeStatus["WAITING"] = "WAITING";
|
|
28299
|
+
IkasStorefrontThemeStatus["READY"] = "READY";
|
|
28300
|
+
})(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
|
|
28301
|
+
var IkasStorefrontTheme = /** @class */ (function () {
|
|
28302
|
+
function IkasStorefrontTheme(data) {
|
|
28303
|
+
this.id = data.id || "";
|
|
28304
|
+
this.isMainTheme = data.isMainTheme || false;
|
|
28305
|
+
this.name = data.name || "";
|
|
28306
|
+
this.status = data.status || IkasStorefrontThemeStatus.WAITING;
|
|
28307
|
+
this.themeId = data.themeId || "";
|
|
28308
|
+
this.themeVersionId = data.themeVersionId || "";
|
|
28309
|
+
}
|
|
28310
|
+
return IkasStorefrontTheme;
|
|
28311
|
+
}());
|
|
28312
|
+
|
|
28313
|
+
var StorefrontStatus;
|
|
28314
|
+
(function (StorefrontStatus) {
|
|
28315
|
+
StorefrontStatus["WAITING"] = "WAITING";
|
|
28316
|
+
StorefrontStatus["READY"] = "READY";
|
|
28317
|
+
})(StorefrontStatus || (StorefrontStatus = {}));
|
|
28318
|
+
var IkasStorefront = /** @class */ (function () {
|
|
28319
|
+
function IkasStorefront(data) {
|
|
28320
|
+
if (data === void 0) { data = {}; }
|
|
28321
|
+
this.id = data.id || "";
|
|
28322
|
+
this.name = data.name || "";
|
|
28323
|
+
this.status = data.status || StorefrontStatus.WAITING;
|
|
28324
|
+
this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
|
|
28325
|
+
this.emailSettingsId = data.emailSettingsId || null;
|
|
28326
|
+
this.salesChannelId = data.salesChannelId || null;
|
|
28327
|
+
this.gtmId = data.gtmId || null;
|
|
28328
|
+
this.fbpId = data.fbpId || null;
|
|
28329
|
+
// Sub Models
|
|
28330
|
+
this.localizations = data.localizations
|
|
28331
|
+
? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
|
|
28332
|
+
: [];
|
|
28333
|
+
this.routings = data.routings
|
|
28334
|
+
? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
|
|
28335
|
+
: [];
|
|
28336
|
+
this.domains = data.domains
|
|
28337
|
+
? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
|
|
28338
|
+
: [];
|
|
28339
|
+
this.themes = data.themes
|
|
28340
|
+
? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
|
|
28341
|
+
: [];
|
|
28342
|
+
}
|
|
28343
|
+
return IkasStorefront;
|
|
28344
|
+
}());
|
|
28345
|
+
|
|
28346
|
+
var IkasSalesChannel = /** @class */ (function () {
|
|
28347
|
+
function IkasSalesChannel(data) {
|
|
28348
|
+
if (data === void 0) { data = {}; }
|
|
28349
|
+
var _a;
|
|
28350
|
+
this.id = data.id || "";
|
|
28351
|
+
this.name = data.name || "";
|
|
28352
|
+
this.priceListId = data.priceListId || "";
|
|
28353
|
+
this.stockLocations =
|
|
28354
|
+
((_a = data.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return new IkasSalesChannelStockLocation(sl); })) ||
|
|
28355
|
+
[];
|
|
28356
|
+
}
|
|
28357
|
+
return IkasSalesChannel;
|
|
28358
|
+
}());
|
|
28359
|
+
var IkasSalesChannelStockLocation = /** @class */ (function () {
|
|
28360
|
+
function IkasSalesChannelStockLocation(data) {
|
|
28361
|
+
this.id = data.id || "";
|
|
28362
|
+
this.order = data.order || 0;
|
|
28363
|
+
}
|
|
28364
|
+
return IkasSalesChannelStockLocation;
|
|
28365
|
+
}());
|
|
28366
|
+
|
|
28367
|
+
var IkasStorefrontThemeLocalization = /** @class */ (function () {
|
|
28368
|
+
function IkasStorefrontThemeLocalization(data) {
|
|
28369
|
+
this.id = data.id || "";
|
|
28370
|
+
this.locale = data.locale || "";
|
|
28371
|
+
this.storefrontId = data.storefrontId || "";
|
|
28372
|
+
this.storefrontThemeId = data.storefrontThemeId || "";
|
|
28373
|
+
this.themeJson = data.themeJson
|
|
28374
|
+
? new IkasTheme(data.themeJson)
|
|
28375
|
+
: new IkasTheme();
|
|
28376
|
+
this.privacyPolicy = data.privacyPolicy || null;
|
|
28377
|
+
this.returnPolicy = data.returnPolicy || null;
|
|
28378
|
+
this.termsOfService = data.termsOfService || null;
|
|
28379
|
+
}
|
|
28380
|
+
return IkasStorefrontThemeLocalization;
|
|
28381
|
+
}());
|
|
28382
|
+
|
|
28383
|
+
var IkasStorefrontAPI = /** @class */ (function () {
|
|
28384
|
+
function IkasStorefrontAPI() {
|
|
28385
|
+
}
|
|
28386
|
+
IkasStorefrontAPI.getStorefront = function (id) {
|
|
28387
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28388
|
+
var QUERY, _a, data, errors, err_1;
|
|
28389
|
+
return __generator(this, function (_b) {
|
|
28390
|
+
switch (_b.label) {
|
|
28391
|
+
case 0:
|
|
28392
|
+
QUERY = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query getStorefront($id: String!) {\n getStorefront(id: $id) {\n createdAt\n emailSettingsId\n fbpId\n gtmId\n id\n localizations {\n createdAt\n id\n isDefault\n locale\n name\n }\n mainStorefrontThemeId\n name\n salesChannelId\n routings {\n countryCodes\n createdAt\n domain\n id\n locale\n path\n priceListId\n updatedAt\n }\n status\n themes {\n createdAt\n id\n isMainTheme\n name\n status\n themeId\n themeVersionId\n updatedAt\n }\n }\n }\n "], ["\n query getStorefront($id: String!) {\n getStorefront(id: $id) {\n createdAt\n emailSettingsId\n fbpId\n gtmId\n id\n localizations {\n createdAt\n id\n isDefault\n locale\n name\n }\n mainStorefrontThemeId\n name\n salesChannelId\n routings {\n countryCodes\n createdAt\n domain\n id\n locale\n path\n priceListId\n updatedAt\n }\n status\n themes {\n createdAt\n id\n isMainTheme\n name\n status\n themeId\n themeVersionId\n updatedAt\n }\n }\n }\n "])));
|
|
28393
|
+
_b.label = 1;
|
|
28394
|
+
case 1:
|
|
28395
|
+
_b.trys.push([1, 3, , 4]);
|
|
28396
|
+
return [4 /*yield*/, apollo
|
|
28397
|
+
.getClient()
|
|
28398
|
+
.query({
|
|
28399
|
+
query: QUERY,
|
|
28400
|
+
variables: {
|
|
28401
|
+
id: id,
|
|
28402
|
+
},
|
|
28403
|
+
})];
|
|
28404
|
+
case 2:
|
|
28405
|
+
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
28406
|
+
if (errors && errors.length) {
|
|
28407
|
+
console.log(errors);
|
|
28408
|
+
}
|
|
28409
|
+
if (data)
|
|
28410
|
+
return [2 /*return*/, new IkasStorefront(data.getStorefront)];
|
|
28411
|
+
return [3 /*break*/, 4];
|
|
28412
|
+
case 3:
|
|
28413
|
+
err_1 = _b.sent();
|
|
28414
|
+
console.log(err_1);
|
|
28415
|
+
return [3 /*break*/, 4];
|
|
28416
|
+
case 4: return [2 /*return*/];
|
|
28417
|
+
}
|
|
28418
|
+
});
|
|
28419
|
+
});
|
|
28420
|
+
};
|
|
28421
|
+
return IkasStorefrontAPI;
|
|
28422
|
+
}());
|
|
28423
|
+
var templateObject_1$g;
|
|
28424
|
+
|
|
28425
|
+
var SettingsHelper = /** @class */ (function () {
|
|
28426
|
+
function SettingsHelper() {
|
|
28427
|
+
}
|
|
28428
|
+
SettingsHelper.readLocalTheme = function () {
|
|
28429
|
+
return new Promise(function (resolve, reject) {
|
|
28430
|
+
var themeJSONPath = "./src/theme.json";
|
|
28431
|
+
fs__default['default'].readFile(themeJSONPath, {
|
|
28432
|
+
flag: "a+",
|
|
28433
|
+
}, function (err, file) {
|
|
28434
|
+
if (err) {
|
|
28435
|
+
return reject(err);
|
|
28436
|
+
}
|
|
28437
|
+
var result = file.length ? JSON.parse(file.toString()) : {};
|
|
28438
|
+
resolve(new IkasTheme(result));
|
|
28439
|
+
});
|
|
28440
|
+
});
|
|
28441
|
+
};
|
|
28442
|
+
SettingsHelper.readSettingsFile = function () {
|
|
28443
|
+
return new Promise(function (resolve) {
|
|
28444
|
+
var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
28445
|
+
var settingsPath = serverRuntimeConfig.SETTINGS;
|
|
28446
|
+
fs__default['default'].readFile(settingsPath, {
|
|
28447
|
+
flag: "a+",
|
|
28448
|
+
}, function (err, file) {
|
|
28449
|
+
if (err) {
|
|
28450
|
+
console.error("SETTINGS FILE READ ERROR!!!");
|
|
28451
|
+
console.error(err);
|
|
28452
|
+
return resolve(null);
|
|
28453
|
+
}
|
|
28454
|
+
var result = file.length ? JSON.parse(file.toString()) : {};
|
|
28455
|
+
resolve(result);
|
|
28456
|
+
});
|
|
28457
|
+
});
|
|
28458
|
+
};
|
|
28459
|
+
SettingsHelper.getSettings = function (locale) {
|
|
28460
|
+
var _this = this;
|
|
28461
|
+
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
28462
|
+
var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, themeLocalizationPath, routing_1;
|
|
28463
|
+
return __generator(this, function (_a) {
|
|
28464
|
+
switch (_a.label) {
|
|
28465
|
+
case 0:
|
|
28466
|
+
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
28467
|
+
if (!isLocal) return [3 /*break*/, 3];
|
|
28468
|
+
if (!IkasStorefrontConfig.storefrontId) {
|
|
28469
|
+
console.error("Missing storefrontId in the config.json file!");
|
|
28470
|
+
return [2 /*return*/, resolve(null)];
|
|
28471
|
+
}
|
|
28472
|
+
return [4 /*yield*/, IkasStorefrontAPI.getStorefront(IkasStorefrontConfig.storefrontId)];
|
|
28473
|
+
case 1:
|
|
28474
|
+
storefrontResponse = _a.sent();
|
|
28475
|
+
if (!storefrontResponse)
|
|
28476
|
+
return [2 /*return*/, resolve(null)];
|
|
28477
|
+
storefront = storefrontResponse;
|
|
28478
|
+
return [4 /*yield*/, SettingsHelper.readLocalTheme()];
|
|
28479
|
+
case 2:
|
|
28480
|
+
localTheme = _a.sent();
|
|
28481
|
+
resolve({
|
|
28482
|
+
storefront: storefront,
|
|
28483
|
+
themeLocalization: new IkasStorefrontThemeLocalization({
|
|
28484
|
+
themeJson: localTheme,
|
|
28485
|
+
}),
|
|
28486
|
+
salesChannel: new IkasSalesChannel({
|
|
28487
|
+
id: storefront.salesChannelId,
|
|
28488
|
+
}),
|
|
28489
|
+
routing: storefront.routings.length
|
|
28490
|
+
? storefront.routings[0]
|
|
28491
|
+
: new IkasStorefrontRouting({}),
|
|
28492
|
+
});
|
|
28493
|
+
return [3 /*break*/, 5];
|
|
28494
|
+
case 3: return [4 /*yield*/, SettingsHelper.readSettingsFile()];
|
|
28495
|
+
case 4:
|
|
28496
|
+
settings = _a.sent();
|
|
28497
|
+
if (!settings)
|
|
28498
|
+
return [2 /*return*/, resolve(null)];
|
|
28499
|
+
storefront_1 = new IkasStorefront(settings.storefront);
|
|
28500
|
+
salesChannel_1 = new IkasSalesChannel(settings.salesChannel);
|
|
28501
|
+
localizationMap = settings.localizationMap;
|
|
28502
|
+
themeLocalizationPath = localizationMap[locale];
|
|
28503
|
+
routing_1 = storefront_1.routings.find(function (r) { return r.id === locale || r.path === locale; });
|
|
28504
|
+
if (!themeLocalizationPath || !routing_1) {
|
|
28505
|
+
console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!");
|
|
28506
|
+
return [2 /*return*/, resolve(null)];
|
|
28507
|
+
}
|
|
28508
|
+
fs__default['default'].readFile(themeLocalizationPath, {
|
|
28509
|
+
flag: "a+",
|
|
28510
|
+
}, function (err, file) {
|
|
28511
|
+
if (err) {
|
|
28512
|
+
console.error("THEME LOCALZIATION FILE READ ERROR!!!");
|
|
28513
|
+
console.error(err);
|
|
28514
|
+
return resolve(null);
|
|
28515
|
+
}
|
|
28516
|
+
var result = file.length ? JSON.parse(file.toString()) : {};
|
|
28517
|
+
resolve({
|
|
28518
|
+
storefront: storefront_1,
|
|
28519
|
+
themeLocalization: new IkasStorefrontThemeLocalization(result),
|
|
28520
|
+
salesChannel: salesChannel_1,
|
|
28521
|
+
routing: routing_1,
|
|
28522
|
+
});
|
|
28523
|
+
});
|
|
28524
|
+
_a.label = 5;
|
|
28525
|
+
case 5: return [2 /*return*/];
|
|
28526
|
+
}
|
|
28527
|
+
});
|
|
28528
|
+
}); });
|
|
28529
|
+
};
|
|
28530
|
+
SettingsHelper.getPageData = function (context, isServer, pageType) {
|
|
28531
|
+
var _a;
|
|
28532
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28533
|
+
var locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
|
|
28534
|
+
return __generator(this, function (_b) {
|
|
28535
|
+
switch (_b.label) {
|
|
28536
|
+
case 0:
|
|
28537
|
+
locale = context.locale || context.defaultLocale || "en";
|
|
28538
|
+
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
28539
|
+
case 1:
|
|
28540
|
+
settings = _b.sent();
|
|
28541
|
+
if (!settings ||
|
|
28542
|
+
!settings.storefront.mainStorefrontThemeId ||
|
|
28543
|
+
!settings.storefront.salesChannelId) {
|
|
28544
|
+
return [2 /*return*/, {
|
|
28545
|
+
props: {},
|
|
28546
|
+
notFound: true,
|
|
28547
|
+
}];
|
|
28548
|
+
}
|
|
28549
|
+
storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
|
|
28550
|
+
IkasStorefrontConfig.storefrontId = storefront.id;
|
|
28551
|
+
IkasStorefrontConfig.storefrontRoutingId = routing.id;
|
|
28552
|
+
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
28553
|
+
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
28554
|
+
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
28555
|
+
IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
|
|
28556
|
+
IkasStorefrontConfig.routings = storefront.routings;
|
|
28557
|
+
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
28558
|
+
return [4 /*yield*/, provider.getPageData()];
|
|
28559
|
+
case 2:
|
|
28560
|
+
_b.sent();
|
|
28561
|
+
if (!provider.page) {
|
|
28562
|
+
return [2 /*return*/, {
|
|
28563
|
+
props: {},
|
|
28564
|
+
notFound: true,
|
|
28565
|
+
}];
|
|
28566
|
+
}
|
|
28567
|
+
if (isServer)
|
|
28568
|
+
return [2 /*return*/, provider.nextPageData];
|
|
28569
|
+
else
|
|
28570
|
+
return [2 /*return*/, {
|
|
28571
|
+
props: provider.nextPageData.props,
|
|
28572
|
+
revalidate: 60,
|
|
28573
|
+
}];
|
|
28574
|
+
}
|
|
28575
|
+
});
|
|
28576
|
+
});
|
|
28577
|
+
};
|
|
28578
|
+
SettingsHelper.getStaticProps = function (context, pageType) {
|
|
28579
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28580
|
+
return __generator(this, function (_a) {
|
|
28581
|
+
switch (_a.label) {
|
|
28582
|
+
case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType)];
|
|
28583
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28584
|
+
}
|
|
28585
|
+
});
|
|
28586
|
+
});
|
|
28587
|
+
};
|
|
28588
|
+
SettingsHelper.getServerSideProps = function (context, pageType) {
|
|
28589
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28590
|
+
return __generator(this, function (_a) {
|
|
28591
|
+
switch (_a.label) {
|
|
28592
|
+
case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType)];
|
|
28593
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28594
|
+
}
|
|
28595
|
+
});
|
|
28596
|
+
});
|
|
28597
|
+
};
|
|
28598
|
+
return SettingsHelper;
|
|
28599
|
+
}());
|
|
28600
|
+
|
|
28336
28601
|
var Page = function (_a) {
|
|
28337
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
28602
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
28603
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28338
28604
|
var router$1 = router.useRouter();
|
|
28339
28605
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28340
28606
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
28341
28607
|
};
|
|
28342
28608
|
var getStaticProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28343
|
-
var theme, provider;
|
|
28344
28609
|
return __generator(this, function (_a) {
|
|
28345
28610
|
switch (_a.label) {
|
|
28346
|
-
case 0: return [4 /*yield*/,
|
|
28347
|
-
case 1:
|
|
28348
|
-
theme = _a.sent();
|
|
28349
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.INDEX);
|
|
28350
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28351
|
-
case 2:
|
|
28352
|
-
_a.sent();
|
|
28353
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28611
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.INDEX)];
|
|
28612
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28354
28613
|
}
|
|
28355
28614
|
});
|
|
28356
28615
|
}); };
|
|
@@ -28362,7 +28621,8 @@ var home = /*#__PURE__*/Object.freeze({
|
|
|
28362
28621
|
});
|
|
28363
28622
|
|
|
28364
28623
|
var Page$1 = function (_a) {
|
|
28365
|
-
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
28624
|
+
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
28625
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28366
28626
|
var router$1 = router.useRouter();
|
|
28367
28627
|
var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
28368
28628
|
var initialPropValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
@@ -28392,6 +28652,7 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
|
|
|
28392
28652
|
productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === exports.IkasHTMLMetaDataTargetType.PRODUCT; });
|
|
28393
28653
|
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
28394
28654
|
productIdList: productMetaData.map(function (p) { return p.targetId; }),
|
|
28655
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
28395
28656
|
})];
|
|
28396
28657
|
case 2:
|
|
28397
28658
|
productsResponse = _b.sent();
|
|
@@ -28438,25 +28699,10 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
|
|
|
28438
28699
|
});
|
|
28439
28700
|
}); };
|
|
28440
28701
|
var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28441
|
-
var theme, provider;
|
|
28442
28702
|
return __generator(this, function (_a) {
|
|
28443
28703
|
switch (_a.label) {
|
|
28444
|
-
case 0: return [4 /*yield*/,
|
|
28445
|
-
case 1:
|
|
28446
|
-
theme = _a.sent();
|
|
28447
|
-
provider = new IkasPageDataProvider(theme, context.params, undefined);
|
|
28448
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28449
|
-
case 2:
|
|
28450
|
-
_a.sent();
|
|
28451
|
-
if (!provider.page) {
|
|
28452
|
-
return [2 /*return*/, {
|
|
28453
|
-
notFound: true,
|
|
28454
|
-
}];
|
|
28455
|
-
}
|
|
28456
|
-
return [2 /*return*/, {
|
|
28457
|
-
props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
|
|
28458
|
-
revalidate: 60,
|
|
28459
|
-
}];
|
|
28704
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context)];
|
|
28705
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28460
28706
|
}
|
|
28461
28707
|
});
|
|
28462
28708
|
}); };
|
|
@@ -28495,25 +28741,52 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
28495
28741
|
});
|
|
28496
28742
|
|
|
28497
28743
|
var Page$2 = function (_a) {
|
|
28498
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28744
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
28745
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28499
28746
|
var router$1 = router.useRouter();
|
|
28500
28747
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28501
28748
|
return (React.createElement(IkasPage, { page: page, settingsStr: settingsStr, propValues: propValues }));
|
|
28502
28749
|
};
|
|
28503
28750
|
var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28504
|
-
var
|
|
28751
|
+
var allSettings, customPagePaths;
|
|
28505
28752
|
return __generator(this, function (_a) {
|
|
28506
28753
|
switch (_a.label) {
|
|
28507
|
-
case 0:
|
|
28754
|
+
case 0:
|
|
28755
|
+
if (!context.locales)
|
|
28756
|
+
return [2 /*return*/, {
|
|
28757
|
+
paths: [],
|
|
28758
|
+
fallback: "blocking",
|
|
28759
|
+
}];
|
|
28760
|
+
return [4 /*yield*/, Promise.all(context.locales.map(function (locale) { return SettingsHelper.getSettings(locale); }))];
|
|
28508
28761
|
case 1:
|
|
28509
|
-
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
|
|
28513
|
-
|
|
28762
|
+
allSettings = (_a.sent());
|
|
28763
|
+
customPagePaths = [];
|
|
28764
|
+
allSettings.forEach(function (_a) {
|
|
28765
|
+
var themeLocalization = _a.themeLocalization, routing = _a.routing;
|
|
28766
|
+
if (!themeLocalization)
|
|
28767
|
+
return;
|
|
28768
|
+
var customPages = themeLocalization.themeJson.pages.filter(function (p) { return p.type === exports.IkasThemePageType.CUSTOM; });
|
|
28769
|
+
customPages.forEach(function (customPage) {
|
|
28770
|
+
if (customPage.slug &&
|
|
28771
|
+
!customPagePaths.some(function (p) { return p.params.slug === customPage.slug; })) {
|
|
28772
|
+
if (process.env.NEXT_PUBLIC_ENV === "local") {
|
|
28773
|
+
customPagePaths.push({
|
|
28774
|
+
params: { slug: customPage.slug },
|
|
28775
|
+
});
|
|
28776
|
+
}
|
|
28777
|
+
else {
|
|
28778
|
+
customPagePaths.push({
|
|
28779
|
+
params: { slug: customPage.slug },
|
|
28780
|
+
locale: routing.path || routing.id,
|
|
28781
|
+
});
|
|
28782
|
+
}
|
|
28783
|
+
}
|
|
28784
|
+
});
|
|
28785
|
+
});
|
|
28514
28786
|
return [2 /*return*/, {
|
|
28515
28787
|
paths: customPagePaths.map(function (p) { return ({
|
|
28516
|
-
params: p,
|
|
28788
|
+
params: p.params,
|
|
28789
|
+
locale: p.locale,
|
|
28517
28790
|
}); }),
|
|
28518
28791
|
fallback: "blocking",
|
|
28519
28792
|
}];
|
|
@@ -28521,17 +28794,10 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
28521
28794
|
});
|
|
28522
28795
|
}); };
|
|
28523
28796
|
var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28524
|
-
var theme, provider;
|
|
28525
28797
|
return __generator(this, function (_a) {
|
|
28526
28798
|
switch (_a.label) {
|
|
28527
|
-
case 0: return [4 /*yield*/,
|
|
28528
|
-
case 1:
|
|
28529
|
-
theme = _a.sent();
|
|
28530
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.CUSTOM);
|
|
28531
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28532
|
-
case 2:
|
|
28533
|
-
_a.sent();
|
|
28534
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28799
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.CUSTOM)];
|
|
28800
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28535
28801
|
}
|
|
28536
28802
|
});
|
|
28537
28803
|
}); };
|
|
@@ -28544,18 +28810,37 @@ var _slug_ = /*#__PURE__*/Object.freeze({
|
|
|
28544
28810
|
});
|
|
28545
28811
|
|
|
28546
28812
|
var CheckoutPage = function (_a) {
|
|
28547
|
-
var checkoutStr = _a.checkoutStr,
|
|
28813
|
+
var checkoutStr = _a.checkoutStr, configJson = _a.configJson, others = __rest(_a, ["checkoutStr", "configJson"]);
|
|
28814
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28548
28815
|
Analytics.disableHTML();
|
|
28549
28816
|
var checkout = new IkasCheckout(JSON.parse(checkoutStr));
|
|
28550
|
-
return React.createElement(IkasCheckoutPage, { checkout: checkout,
|
|
28817
|
+
return React.createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
|
|
28551
28818
|
};
|
|
28552
28819
|
var _id_ = mobxReactLite.observer(CheckoutPage);
|
|
28553
28820
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28554
|
-
var id, redirect, checkout;
|
|
28821
|
+
var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
|
|
28555
28822
|
return __generator(this, function (_a) {
|
|
28556
28823
|
switch (_a.label) {
|
|
28557
28824
|
case 0:
|
|
28558
28825
|
id = context.query.id;
|
|
28826
|
+
locale = context.locale || context.defaultLocale || "en";
|
|
28827
|
+
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
28828
|
+
case 1:
|
|
28829
|
+
settings = _a.sent();
|
|
28830
|
+
// TODO maybe remove this and convert this page to static
|
|
28831
|
+
if (!settings ||
|
|
28832
|
+
!settings.storefront.mainStorefrontThemeId ||
|
|
28833
|
+
!settings.storefront.salesChannelId) {
|
|
28834
|
+
return [2 /*return*/, {
|
|
28835
|
+
props: {},
|
|
28836
|
+
notFound: true,
|
|
28837
|
+
}];
|
|
28838
|
+
}
|
|
28839
|
+
storefront = settings.storefront, themeLocalization = settings.themeLocalization, routing = settings.routing;
|
|
28840
|
+
IkasStorefrontConfig.storefrontId = storefront.id;
|
|
28841
|
+
IkasStorefrontConfig.storefrontRoutingId = routing.id;
|
|
28842
|
+
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
28843
|
+
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
28559
28844
|
redirect = function () {
|
|
28560
28845
|
context.res.writeHead(302, { Location: "/" });
|
|
28561
28846
|
context.res.end();
|
|
@@ -28565,12 +28850,15 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
28565
28850
|
return [2 /*return*/, redirect()];
|
|
28566
28851
|
}
|
|
28567
28852
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
28568
|
-
case
|
|
28853
|
+
case 2:
|
|
28569
28854
|
checkout = _a.sent();
|
|
28570
28855
|
if (checkout) {
|
|
28571
28856
|
return [2 /*return*/, {
|
|
28572
28857
|
props: {
|
|
28573
28858
|
checkoutStr: JSON.stringify(checkout),
|
|
28859
|
+
returnPolicy: themeLocalization.returnPolicy || "",
|
|
28860
|
+
privacyPolicy: themeLocalization.privacyPolicy || "",
|
|
28861
|
+
termsOfService: themeLocalization.termsOfService || "",
|
|
28574
28862
|
queryParams: context.query,
|
|
28575
28863
|
},
|
|
28576
28864
|
}];
|
|
@@ -28589,23 +28877,17 @@ var _id_$1 = /*#__PURE__*/Object.freeze({
|
|
|
28589
28877
|
});
|
|
28590
28878
|
|
|
28591
28879
|
var Page$3 = function (_a) {
|
|
28592
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28880
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
28881
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28593
28882
|
var router$1 = router.useRouter();
|
|
28594
28883
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28595
28884
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28596
28885
|
};
|
|
28597
28886
|
var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28598
|
-
var theme, provider;
|
|
28599
28887
|
return __generator(this, function (_a) {
|
|
28600
28888
|
switch (_a.label) {
|
|
28601
|
-
case 0: return [4 /*yield*/,
|
|
28602
|
-
case 1:
|
|
28603
|
-
theme = _a.sent();
|
|
28604
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ACCOUNT);
|
|
28605
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28606
|
-
case 2:
|
|
28607
|
-
_a.sent();
|
|
28608
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28889
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ACCOUNT)];
|
|
28890
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28609
28891
|
}
|
|
28610
28892
|
});
|
|
28611
28893
|
}); };
|
|
@@ -28617,23 +28899,17 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
28617
28899
|
});
|
|
28618
28900
|
|
|
28619
28901
|
var Page$4 = function (_a) {
|
|
28620
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28902
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
28903
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28621
28904
|
var router$1 = router.useRouter();
|
|
28622
28905
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28623
28906
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28624
28907
|
};
|
|
28625
28908
|
var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28626
|
-
var theme, provider;
|
|
28627
28909
|
return __generator(this, function (_a) {
|
|
28628
28910
|
switch (_a.label) {
|
|
28629
|
-
case 0: return [4 /*yield*/,
|
|
28630
|
-
case 1:
|
|
28631
|
-
theme = _a.sent();
|
|
28632
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ADDRESSES);
|
|
28633
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28634
|
-
case 2:
|
|
28635
|
-
_a.sent();
|
|
28636
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28911
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ADDRESSES)];
|
|
28912
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28637
28913
|
}
|
|
28638
28914
|
});
|
|
28639
28915
|
}); };
|
|
@@ -28645,23 +28921,17 @@ var addresses = /*#__PURE__*/Object.freeze({
|
|
|
28645
28921
|
});
|
|
28646
28922
|
|
|
28647
28923
|
var Page$5 = function (_a) {
|
|
28648
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28924
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
28925
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28649
28926
|
var router$1 = router.useRouter();
|
|
28650
28927
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28651
28928
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28652
28929
|
};
|
|
28653
28930
|
var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28654
|
-
var theme, provider;
|
|
28655
28931
|
return __generator(this, function (_a) {
|
|
28656
28932
|
switch (_a.label) {
|
|
28657
|
-
case 0: return [4 /*yield*/,
|
|
28658
|
-
case 1:
|
|
28659
|
-
theme = _a.sent();
|
|
28660
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ORDERS);
|
|
28661
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28662
|
-
case 2:
|
|
28663
|
-
_a.sent();
|
|
28664
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28933
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ORDERS)];
|
|
28934
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28665
28935
|
}
|
|
28666
28936
|
});
|
|
28667
28937
|
}); };
|
|
@@ -28673,23 +28943,17 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
28673
28943
|
});
|
|
28674
28944
|
|
|
28675
28945
|
var Page$6 = function (_a) {
|
|
28676
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
28946
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
28947
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28677
28948
|
var router$1 = router.useRouter();
|
|
28678
28949
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28679
28950
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28680
28951
|
};
|
|
28681
28952
|
var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28682
|
-
var theme, provider;
|
|
28683
28953
|
return __generator(this, function (_a) {
|
|
28684
28954
|
switch (_a.label) {
|
|
28685
|
-
case 0: return [4 /*yield*/,
|
|
28686
|
-
case 1:
|
|
28687
|
-
theme = _a.sent();
|
|
28688
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ORDER_DETAIL);
|
|
28689
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28690
|
-
case 2:
|
|
28691
|
-
_a.sent();
|
|
28692
|
-
return [2 /*return*/, provider.nextPageData];
|
|
28955
|
+
case 0: return [4 /*yield*/, SettingsHelper.getServerSideProps(context, exports.IkasThemePageType.ORDER_DETAIL)];
|
|
28956
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28693
28957
|
}
|
|
28694
28958
|
});
|
|
28695
28959
|
}); };
|
|
@@ -28701,23 +28965,17 @@ var _id_$2 = /*#__PURE__*/Object.freeze({
|
|
|
28701
28965
|
});
|
|
28702
28966
|
|
|
28703
28967
|
var Page$7 = function (_a) {
|
|
28704
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
28968
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
28969
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28705
28970
|
var router$1 = router.useRouter();
|
|
28706
28971
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28707
28972
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28708
28973
|
};
|
|
28709
28974
|
var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28710
|
-
var theme, provider;
|
|
28711
28975
|
return __generator(this, function (_a) {
|
|
28712
28976
|
switch (_a.label) {
|
|
28713
|
-
case 0: return [4 /*yield*/,
|
|
28714
|
-
case 1:
|
|
28715
|
-
theme = _a.sent();
|
|
28716
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.LOGIN);
|
|
28717
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28718
|
-
case 2:
|
|
28719
|
-
_a.sent();
|
|
28720
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28977
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.LOGIN)];
|
|
28978
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28721
28979
|
}
|
|
28722
28980
|
});
|
|
28723
28981
|
}); };
|
|
@@ -28729,23 +28987,17 @@ var login = /*#__PURE__*/Object.freeze({
|
|
|
28729
28987
|
});
|
|
28730
28988
|
|
|
28731
28989
|
var Page$8 = function (_a) {
|
|
28732
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
28990
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
28991
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28733
28992
|
var router$1 = router.useRouter();
|
|
28734
28993
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28735
28994
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28736
28995
|
};
|
|
28737
28996
|
var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28738
|
-
var theme, provider;
|
|
28739
28997
|
return __generator(this, function (_a) {
|
|
28740
28998
|
switch (_a.label) {
|
|
28741
|
-
case 0: return [4 /*yield*/,
|
|
28742
|
-
case 1:
|
|
28743
|
-
theme = _a.sent();
|
|
28744
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.REGISTER);
|
|
28745
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28746
|
-
case 2:
|
|
28747
|
-
_a.sent();
|
|
28748
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
28999
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.REGISTER)];
|
|
29000
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28749
29001
|
}
|
|
28750
29002
|
});
|
|
28751
29003
|
}); };
|
|
@@ -28757,23 +29009,17 @@ var register = /*#__PURE__*/Object.freeze({
|
|
|
28757
29009
|
});
|
|
28758
29010
|
|
|
28759
29011
|
var Page$9 = function (_a) {
|
|
28760
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
29012
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
29013
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28761
29014
|
var router$1 = router.useRouter();
|
|
28762
29015
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28763
29016
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28764
29017
|
};
|
|
28765
29018
|
var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28766
|
-
var theme, provider;
|
|
28767
29019
|
return __generator(this, function (_a) {
|
|
28768
29020
|
switch (_a.label) {
|
|
28769
|
-
case 0: return [4 /*yield*/,
|
|
28770
|
-
case 1:
|
|
28771
|
-
theme = _a.sent();
|
|
28772
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FORGOT_PASSWORD);
|
|
28773
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28774
|
-
case 2:
|
|
28775
|
-
_a.sent();
|
|
28776
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
29021
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FORGOT_PASSWORD)];
|
|
29022
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28777
29023
|
}
|
|
28778
29024
|
});
|
|
28779
29025
|
}); };
|
|
@@ -28785,23 +29031,17 @@ var forgotPassword = /*#__PURE__*/Object.freeze({
|
|
|
28785
29031
|
});
|
|
28786
29032
|
|
|
28787
29033
|
var Page$a = function (_a) {
|
|
28788
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
29034
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
29035
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28789
29036
|
var router$1 = router.useRouter();
|
|
28790
29037
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28791
29038
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28792
29039
|
};
|
|
28793
29040
|
var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28794
|
-
var theme, provider;
|
|
28795
29041
|
return __generator(this, function (_a) {
|
|
28796
29042
|
switch (_a.label) {
|
|
28797
|
-
case 0: return [4 /*yield*/,
|
|
28798
|
-
case 1:
|
|
28799
|
-
theme = _a.sent();
|
|
28800
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.RECOVER_PASSWORD);
|
|
28801
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28802
|
-
case 2:
|
|
28803
|
-
_a.sent();
|
|
28804
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
29043
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.RECOVER_PASSWORD)];
|
|
29044
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28805
29045
|
}
|
|
28806
29046
|
});
|
|
28807
29047
|
}); };
|
|
@@ -28813,7 +29053,8 @@ var recoverPassword = /*#__PURE__*/Object.freeze({
|
|
|
28813
29053
|
});
|
|
28814
29054
|
|
|
28815
29055
|
var Page$b = function (_a) {
|
|
28816
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
29056
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
29057
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28817
29058
|
var router$1 = router.useRouter();
|
|
28818
29059
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28819
29060
|
var store = IkasStorefrontConfig.store;
|
|
@@ -28823,17 +29064,10 @@ var Page$b = function (_a) {
|
|
|
28823
29064
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28824
29065
|
};
|
|
28825
29066
|
var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28826
|
-
var theme, provider;
|
|
28827
29067
|
return __generator(this, function (_a) {
|
|
28828
29068
|
switch (_a.label) {
|
|
28829
|
-
case 0: return [4 /*yield*/,
|
|
28830
|
-
case 1:
|
|
28831
|
-
theme = _a.sent();
|
|
28832
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.CART);
|
|
28833
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28834
|
-
case 2:
|
|
28835
|
-
_a.sent();
|
|
28836
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
29069
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.CART)];
|
|
29070
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28837
29071
|
}
|
|
28838
29072
|
});
|
|
28839
29073
|
}); };
|
|
@@ -28856,23 +29090,17 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
28856
29090
|
});
|
|
28857
29091
|
|
|
28858
29092
|
var Page$d = function (_a) {
|
|
28859
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr;
|
|
29093
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, configJson = _a.configJson;
|
|
29094
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28860
29095
|
var router$1 = router.useRouter();
|
|
28861
29096
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28862
29097
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28863
29098
|
};
|
|
28864
29099
|
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28865
|
-
var theme, provider;
|
|
28866
29100
|
return __generator(this, function (_a) {
|
|
28867
29101
|
switch (_a.label) {
|
|
28868
|
-
case 0: return [4 /*yield*/,
|
|
28869
|
-
case 1:
|
|
28870
|
-
theme = _a.sent();
|
|
28871
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FAVORITE_PRODUCTS);
|
|
28872
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28873
|
-
case 2:
|
|
28874
|
-
_a.sent();
|
|
28875
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
29102
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FAVORITE_PRODUCTS)];
|
|
29103
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28876
29104
|
}
|
|
28877
29105
|
});
|
|
28878
29106
|
}); };
|
|
@@ -28884,7 +29112,8 @@ var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
|
28884
29112
|
});
|
|
28885
29113
|
|
|
28886
29114
|
var Page$e = function (_a) {
|
|
28887
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
29115
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
29116
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28888
29117
|
var router$1 = router.useRouter();
|
|
28889
29118
|
var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
28890
29119
|
var initialPropValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
@@ -28898,17 +29127,10 @@ var Page$e = function (_a) {
|
|
|
28898
29127
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
28899
29128
|
};
|
|
28900
29129
|
var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28901
|
-
var theme, provider;
|
|
28902
29130
|
return __generator(this, function (_a) {
|
|
28903
29131
|
switch (_a.label) {
|
|
28904
|
-
case 0: return [4 /*yield*/,
|
|
28905
|
-
case 1:
|
|
28906
|
-
theme = _a.sent();
|
|
28907
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.SEARCH);
|
|
28908
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28909
|
-
case 2:
|
|
28910
|
-
_a.sent();
|
|
28911
|
-
return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
|
|
29132
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.SEARCH)];
|
|
29133
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28912
29134
|
}
|
|
28913
29135
|
});
|
|
28914
29136
|
}); };
|
|
@@ -28920,23 +29142,29 @@ var search = /*#__PURE__*/Object.freeze({
|
|
|
28920
29142
|
});
|
|
28921
29143
|
|
|
28922
29144
|
var Page$f = function (_a) {
|
|
28923
|
-
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
|
|
29145
|
+
var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, configJson = _a.configJson;
|
|
29146
|
+
if (!propValuesStr || !page)
|
|
29147
|
+
return React.createElement(Error__default['default'], { statusCode: 404 });
|
|
29148
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28924
29149
|
var router$1 = router.useRouter();
|
|
28925
29150
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28926
29151
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28927
29152
|
};
|
|
28928
29153
|
var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28929
|
-
var
|
|
29154
|
+
var props;
|
|
28930
29155
|
return __generator(this, function (_a) {
|
|
28931
29156
|
switch (_a.label) {
|
|
28932
|
-
case 0: return [4 /*yield*/,
|
|
29157
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.NOT_FOUND)];
|
|
28933
29158
|
case 1:
|
|
28934
|
-
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
29159
|
+
props = _a.sent();
|
|
29160
|
+
//@ts-ignore
|
|
29161
|
+
if (props.notFound)
|
|
29162
|
+
return [2 /*return*/, {
|
|
29163
|
+
props: {},
|
|
29164
|
+
revalidate: 60,
|
|
29165
|
+
}];
|
|
29166
|
+
else
|
|
29167
|
+
return [2 /*return*/, props];
|
|
28940
29168
|
}
|
|
28941
29169
|
});
|
|
28942
29170
|
}); };
|
|
@@ -28953,12 +29181,83 @@ mobx.configure({
|
|
|
28953
29181
|
var IkasBaseStore = /** @class */ (function () {
|
|
28954
29182
|
function IkasBaseStore() {
|
|
28955
29183
|
this.currentPageType = null;
|
|
29184
|
+
this.localeOptions = [];
|
|
29185
|
+
this.showLocaleOptions = false;
|
|
29186
|
+
this.localeChecked = false;
|
|
28956
29187
|
this.customerStore = new IkasCustomerStore(this);
|
|
28957
29188
|
this.cartStore = new IkasCartStore(this);
|
|
28958
29189
|
mobx.makeObservable(this, {
|
|
28959
29190
|
currentPageType: mobx.observable,
|
|
29191
|
+
localeOptions: mobx.observable,
|
|
29192
|
+
showLocaleOptions: mobx.observable,
|
|
28960
29193
|
});
|
|
28961
29194
|
}
|
|
29195
|
+
IkasBaseStore.prototype.checkLocalization = function () {
|
|
29196
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
29197
|
+
var myCountryCode, currentRouting, correctRouting, isCorrectLocale, countries_1, localeOptions_1;
|
|
29198
|
+
return __generator(this, function (_a) {
|
|
29199
|
+
switch (_a.label) {
|
|
29200
|
+
case 0:
|
|
29201
|
+
if (this.localeChecked)
|
|
29202
|
+
return [2 /*return*/];
|
|
29203
|
+
if (typeof window === undefined) {
|
|
29204
|
+
console.warn("checkRegion should be called on the client side!");
|
|
29205
|
+
return [2 /*return*/];
|
|
29206
|
+
}
|
|
29207
|
+
return [4 /*yield*/, IkasCountryAPI.getMyCountry()];
|
|
29208
|
+
case 1:
|
|
29209
|
+
myCountryCode = _a.sent();
|
|
29210
|
+
currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
|
|
29211
|
+
if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
|
|
29212
|
+
correctRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); });
|
|
29213
|
+
isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
|
|
29214
|
+
return [4 /*yield*/, IkasCountryAPI.listCountries()];
|
|
29215
|
+
case 2:
|
|
29216
|
+
countries_1 = _a.sent();
|
|
29217
|
+
localeOptions_1 = [];
|
|
29218
|
+
IkasStorefrontConfig.routings.map(function (r) {
|
|
29219
|
+
var _a;
|
|
29220
|
+
if ((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
29221
|
+
r.countryCodes.forEach(function (countryCode) {
|
|
29222
|
+
var _a;
|
|
29223
|
+
var country = countries_1.find(function (c) { return c.iso2 === countryCode; });
|
|
29224
|
+
localeOptions_1.push({
|
|
29225
|
+
id: v4(),
|
|
29226
|
+
countryName: (country === null || country === void 0 ? void 0 : country.native) || (country === null || country === void 0 ? void 0 : country.name) || "",
|
|
29227
|
+
routing: r,
|
|
29228
|
+
isRecommended: ((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode)) || false,
|
|
29229
|
+
});
|
|
29230
|
+
});
|
|
29231
|
+
}
|
|
29232
|
+
else {
|
|
29233
|
+
localeOptions_1.push({
|
|
29234
|
+
id: v4(),
|
|
29235
|
+
routing: r,
|
|
29236
|
+
isRecommended: !IkasStorefrontConfig.routings.some(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); }),
|
|
29237
|
+
});
|
|
29238
|
+
}
|
|
29239
|
+
});
|
|
29240
|
+
this.localeOptions = localeOptions_1;
|
|
29241
|
+
if (!isCorrectLocale) {
|
|
29242
|
+
this.showLocaleOptions = true;
|
|
29243
|
+
}
|
|
29244
|
+
this.localeChecked = true;
|
|
29245
|
+
_a.label = 3;
|
|
29246
|
+
case 3: return [2 /*return*/];
|
|
29247
|
+
}
|
|
29248
|
+
});
|
|
29249
|
+
});
|
|
29250
|
+
};
|
|
29251
|
+
IkasBaseStore.prototype.setLocalization = function (localeOption) {
|
|
29252
|
+
document.cookie = "NEXT_LOCALE=" + (localeOption.routing.path || localeOption.routing.id) + "; expires=Thu, 1 Dec 2050 12:00:00 UTC";
|
|
29253
|
+
if (localeOption.routing.domain) {
|
|
29254
|
+
window.location.replace("https://" + localeOption.routing.domain);
|
|
29255
|
+
}
|
|
29256
|
+
else {
|
|
29257
|
+
window.location.replace(window.location.origin +
|
|
29258
|
+
(localeOption.routing.path ? "/" + localeOption.routing.path : ""));
|
|
29259
|
+
}
|
|
29260
|
+
};
|
|
28962
29261
|
return IkasBaseStore;
|
|
28963
29262
|
}());
|
|
28964
29263
|
|
|
@@ -29036,10 +29335,8 @@ exports.IkasProductSearchAPI = IkasProductSearchAPI;
|
|
|
29036
29335
|
exports.IkasProductVariant = IkasProductVariant;
|
|
29037
29336
|
exports.IkasProductVariantType = IkasProductVariantType;
|
|
29038
29337
|
exports.IkasStateAPI = IkasStateAPI;
|
|
29039
|
-
exports.IkasStorefrontAPI = IkasStorefrontAPI;
|
|
29040
29338
|
exports.IkasStorefrontConfig = IkasStorefrontConfig;
|
|
29041
29339
|
exports.IkasTheme = IkasTheme;
|
|
29042
|
-
exports.IkasThemeAPI = IkasThemeAPI;
|
|
29043
29340
|
exports.IkasThemeComponent = IkasThemeComponent;
|
|
29044
29341
|
exports.IkasThemeComponentProp = IkasThemeComponentProp;
|
|
29045
29342
|
exports.IkasThemeCustomData = IkasThemeCustomData;
|