@ikas/storefront 0.0.102 → 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 -431
- package/build/index.js +730 -434
- 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:
|
|
@@ -16304,7 +16319,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16304
16319
|
exports.IkasTransactionStatusEnum.SUCCESS,
|
|
16305
16320
|
exports.IkasTransactionStatusEnum.AUTHORIZED,
|
|
16306
16321
|
].includes(transactionStatus)) {
|
|
16307
|
-
localStorage.removeItem(USE_DIFFERENT_ADDRESS_KEY);
|
|
16308
16322
|
this.changeStep(CheckoutStep.SUCCESS);
|
|
16309
16323
|
}
|
|
16310
16324
|
else if (transactionStatus === exports.IkasTransactionStatusEnum.PENDING &&
|
|
@@ -16320,10 +16334,10 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16320
16334
|
}
|
|
16321
16335
|
return [3 /*break*/, 6];
|
|
16322
16336
|
case 5:
|
|
16323
|
-
|
|
16324
|
-
if (
|
|
16325
|
-
console.log(
|
|
16326
|
-
this.error =
|
|
16337
|
+
err_4 = _a.sent();
|
|
16338
|
+
if (err_4.type) {
|
|
16339
|
+
console.log(err_4);
|
|
16340
|
+
this.error = err_4;
|
|
16327
16341
|
}
|
|
16328
16342
|
else {
|
|
16329
16343
|
this.error = {
|
|
@@ -16402,6 +16416,9 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16402
16416
|
}); };
|
|
16403
16417
|
this.checkout = checkout;
|
|
16404
16418
|
this.router = router;
|
|
16419
|
+
this.returnPolicy = returnPolicy;
|
|
16420
|
+
this.privacyPolicy = privacyPolicy;
|
|
16421
|
+
this.termsOfService = termsOfService;
|
|
16405
16422
|
this.init(queryParams);
|
|
16406
16423
|
mobx.makeAutoObservable(this);
|
|
16407
16424
|
}
|
|
@@ -16412,15 +16429,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
16412
16429
|
enumerable: false,
|
|
16413
16430
|
configurable: true
|
|
16414
16431
|
});
|
|
16415
|
-
Object.defineProperty(CheckoutViewModel.prototype, "storefrontRegion", {
|
|
16416
|
-
get: function () {
|
|
16417
|
-
var _a;
|
|
16418
|
-
return ((_a = this.storefront) === null || _a === void 0 ? void 0 : _a.regions.length) ? this.storefront.regions[0]
|
|
16419
|
-
: undefined;
|
|
16420
|
-
},
|
|
16421
|
-
enumerable: false,
|
|
16422
|
-
configurable: true
|
|
16423
|
-
});
|
|
16424
16432
|
Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGatewayIndex", {
|
|
16425
16433
|
get: function () {
|
|
16426
16434
|
var _this = this;
|
|
@@ -17084,6 +17092,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17084
17092
|
return [2 /*return*/, []];
|
|
17085
17093
|
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
17086
17094
|
productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
|
|
17095
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
17087
17096
|
})];
|
|
17088
17097
|
case 2:
|
|
17089
17098
|
productsResult = _b.sent();
|
|
@@ -21918,7 +21927,10 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21918
21927
|
Object.defineProperty(IkasProductList.prototype, "isFiltered", {
|
|
21919
21928
|
get: function () {
|
|
21920
21929
|
var _a;
|
|
21921
|
-
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));
|
|
21922
21934
|
},
|
|
21923
21935
|
enumerable: false,
|
|
21924
21936
|
configurable: true
|
|
@@ -21981,13 +21993,20 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21981
21993
|
});
|
|
21982
21994
|
Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
|
|
21983
21995
|
get: function () {
|
|
21984
|
-
var
|
|
21996
|
+
var _this = this;
|
|
21997
|
+
var _a, _b, _c;
|
|
21985
21998
|
var queryParams = {};
|
|
21986
21999
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
|
|
21987
22000
|
queryParams[f.key] = f.keyList;
|
|
21988
22001
|
});
|
|
21989
22002
|
if (this._searchKeyword)
|
|
21990
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
|
+
}
|
|
21991
22010
|
return queryString.stringify(queryParams, { arrayFormat: "comma" });
|
|
21992
22011
|
},
|
|
21993
22012
|
enumerable: false,
|
|
@@ -22042,6 +22061,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22042
22061
|
categoryIdList: this._filterCategoryId
|
|
22043
22062
|
? [this._filterCategoryId]
|
|
22044
22063
|
: undefined,
|
|
22064
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
22045
22065
|
query: this._searchKeyword,
|
|
22046
22066
|
})];
|
|
22047
22067
|
case 1: return [2 /*return*/, _c.sent()];
|
|
@@ -22069,6 +22089,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22069
22089
|
};
|
|
22070
22090
|
IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
|
|
22071
22091
|
var _this = this;
|
|
22092
|
+
var _a;
|
|
22072
22093
|
try {
|
|
22073
22094
|
queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
|
|
22074
22095
|
var _a;
|
|
@@ -22080,6 +22101,15 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22080
22101
|
var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
|
|
22081
22102
|
if (querySearch)
|
|
22082
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
|
+
}
|
|
22083
22113
|
}
|
|
22084
22114
|
catch (err) {
|
|
22085
22115
|
console.log(err);
|
|
@@ -22126,12 +22156,32 @@ var IkasProductList = /** @class */ (function () {
|
|
|
22126
22156
|
var _a;
|
|
22127
22157
|
(_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
|
|
22128
22158
|
this._searchKeyword = "";
|
|
22159
|
+
if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
|
|
22160
|
+
this._filterCategoryId = undefined;
|
|
22161
|
+
}
|
|
22129
22162
|
this.applyFilters();
|
|
22130
22163
|
};
|
|
22131
|
-
IkasProductList.prototype.onFilterCategoryClick = function (filterCategory) {
|
|
22164
|
+
IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
|
|
22132
22165
|
var _a;
|
|
22133
|
-
(
|
|
22134
|
-
|
|
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
|
+
});
|
|
22135
22185
|
};
|
|
22136
22186
|
IkasProductList.prototype.toJSON = function () {
|
|
22137
22187
|
return {
|
|
@@ -24216,7 +24266,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24216
24266
|
return __generator(this, function (_b) {
|
|
24217
24267
|
switch (_b.label) {
|
|
24218
24268
|
case 0:
|
|
24219
|
-
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 "])));
|
|
24220
24270
|
_b.label = 1;
|
|
24221
24271
|
case 1:
|
|
24222
24272
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24251,7 +24301,7 @@ var IkasCartAPI = /** @class */ (function () {
|
|
|
24251
24301
|
return __generator(this, function (_b) {
|
|
24252
24302
|
switch (_b.label) {
|
|
24253
24303
|
case 0:
|
|
24254
|
-
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 "])));
|
|
24255
24305
|
_b.label = 1;
|
|
24256
24306
|
case 1:
|
|
24257
24307
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24723,13 +24773,13 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
24723
24773
|
});
|
|
24724
24774
|
});
|
|
24725
24775
|
};
|
|
24726
|
-
IkasCheckoutAPI.checkStocks = function (lines) {
|
|
24776
|
+
IkasCheckoutAPI.checkStocks = function (lines, stockLocationIdList) {
|
|
24727
24777
|
return __awaiter(this, void 0, void 0, function () {
|
|
24728
24778
|
var QUERY, _a, data, errors, err_7;
|
|
24729
24779
|
return __generator(this, function (_b) {
|
|
24730
24780
|
switch (_b.label) {
|
|
24731
24781
|
case 0:
|
|
24732
|
-
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 "])));
|
|
24733
24783
|
_b.label = 1;
|
|
24734
24784
|
case 1:
|
|
24735
24785
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24739,6 +24789,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
24739
24789
|
query: QUERY,
|
|
24740
24790
|
variables: {
|
|
24741
24791
|
lines: lines,
|
|
24792
|
+
stockLocationIdList: stockLocationIdList,
|
|
24742
24793
|
},
|
|
24743
24794
|
})];
|
|
24744
24795
|
case 2:
|
|
@@ -24821,7 +24872,7 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24821
24872
|
return __generator(this, function (_b) {
|
|
24822
24873
|
switch (_b.label) {
|
|
24823
24874
|
case 0:
|
|
24824
|
-
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 "])));
|
|
24825
24876
|
_b.label = 1;
|
|
24826
24877
|
case 1:
|
|
24827
24878
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24837,6 +24888,8 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24837
24888
|
return [2 /*return*/, data.listCountry.map(function (c) { return ({
|
|
24838
24889
|
id: c.id,
|
|
24839
24890
|
name: pascalCase(c.locationTranslations.tr),
|
|
24891
|
+
native: c.native || "",
|
|
24892
|
+
iso2: c.iso2 || undefined,
|
|
24840
24893
|
iso3: c.iso3 || undefined,
|
|
24841
24894
|
phoneCode: c.phoneCode || undefined,
|
|
24842
24895
|
}); })];
|
|
@@ -24850,13 +24903,13 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24850
24903
|
});
|
|
24851
24904
|
});
|
|
24852
24905
|
};
|
|
24853
|
-
IkasCountryAPI.listShippingCountries = function () {
|
|
24906
|
+
IkasCountryAPI.listShippingCountries = function (storefrontId) {
|
|
24854
24907
|
return __awaiter(this, void 0, void 0, function () {
|
|
24855
24908
|
var QUERY, _a, data, errors, err_2;
|
|
24856
24909
|
return __generator(this, function (_b) {
|
|
24857
24910
|
switch (_b.label) {
|
|
24858
24911
|
case 0:
|
|
24859
|
-
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 "])));
|
|
24860
24913
|
_b.label = 1;
|
|
24861
24914
|
case 1:
|
|
24862
24915
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -24864,6 +24917,9 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24864
24917
|
.getClient()
|
|
24865
24918
|
.query({
|
|
24866
24919
|
query: QUERY,
|
|
24920
|
+
variables: {
|
|
24921
|
+
storefrontId: storefrontId,
|
|
24922
|
+
},
|
|
24867
24923
|
})];
|
|
24868
24924
|
case 2:
|
|
24869
24925
|
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
@@ -24882,9 +24938,34 @@ var IkasCountryAPI = /** @class */ (function () {
|
|
|
24882
24938
|
});
|
|
24883
24939
|
});
|
|
24884
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
|
+
};
|
|
24885
24966
|
return IkasCountryAPI;
|
|
24886
24967
|
}());
|
|
24887
|
-
var templateObject_1$5, templateObject_2$3;
|
|
24968
|
+
var templateObject_1$5, templateObject_2$3, templateObject_3$1;
|
|
24888
24969
|
|
|
24889
24970
|
var IkasCustomerAPI = /** @class */ (function () {
|
|
24890
24971
|
function IkasCustomerAPI() {
|
|
@@ -24969,7 +25050,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
24969
25050
|
return __generator(this, function (_b) {
|
|
24970
25051
|
switch (_b.label) {
|
|
24971
25052
|
case 0:
|
|
24972
|
-
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 "])));
|
|
24973
25054
|
_b.label = 1;
|
|
24974
25055
|
case 1:
|
|
24975
25056
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25285,7 +25366,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
25285
25366
|
};
|
|
25286
25367
|
return IkasCustomerAPI;
|
|
25287
25368
|
}());
|
|
25288
|
-
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;
|
|
25289
25370
|
|
|
25290
25371
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
25291
25372
|
function IkasDistrictAPI() {
|
|
@@ -25738,7 +25819,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25738
25819
|
return __generator(this, function (_b) {
|
|
25739
25820
|
switch (_b.label) {
|
|
25740
25821
|
case 0:
|
|
25741
|
-
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 "])));
|
|
25742
25823
|
_b.label = 1;
|
|
25743
25824
|
case 1:
|
|
25744
25825
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -25764,7 +25845,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
|
|
|
25764
25845
|
};
|
|
25765
25846
|
return IkasFavoriteProductAPI;
|
|
25766
25847
|
}());
|
|
25767
|
-
var templateObject_1$c, templateObject_2$6, templateObject_3$
|
|
25848
|
+
var templateObject_1$c, templateObject_2$6, templateObject_3$3;
|
|
25768
25849
|
|
|
25769
25850
|
var IkasContactFormAPI = /** @class */ (function () {
|
|
25770
25851
|
function IkasContactFormAPI() {
|
|
@@ -25857,150 +25938,6 @@ var IkasStateAPI = /** @class */ (function () {
|
|
|
25857
25938
|
}());
|
|
25858
25939
|
var templateObject_1$e;
|
|
25859
25940
|
|
|
25860
|
-
var IkasStorefrontDomain = /** @class */ (function () {
|
|
25861
|
-
function IkasStorefrontDomain(data) {
|
|
25862
|
-
if (data === void 0) { data = {}; }
|
|
25863
|
-
this.id = data.id || "";
|
|
25864
|
-
this.merchantDomainId = data.merchantDomainId || "";
|
|
25865
|
-
this.name = data.name || "";
|
|
25866
|
-
this.redirectDomainName = data.redirectDomainName || null;
|
|
25867
|
-
mobx.makeAutoObservable(this);
|
|
25868
|
-
}
|
|
25869
|
-
return IkasStorefrontDomain;
|
|
25870
|
-
}());
|
|
25871
|
-
|
|
25872
|
-
var IkasStorefrontLocation = /** @class */ (function () {
|
|
25873
|
-
function IkasStorefrontLocation(data) {
|
|
25874
|
-
if (data === void 0) { data = {}; }
|
|
25875
|
-
this.countryId = data.countryId || "";
|
|
25876
|
-
this.stateId = data.stateId || null;
|
|
25877
|
-
mobx.makeAutoObservable(this);
|
|
25878
|
-
}
|
|
25879
|
-
return IkasStorefrontLocation;
|
|
25880
|
-
}());
|
|
25881
|
-
|
|
25882
|
-
var IkasStorefrontRoute = /** @class */ (function () {
|
|
25883
|
-
function IkasStorefrontRoute(data) {
|
|
25884
|
-
if (data === void 0) { data = {}; }
|
|
25885
|
-
this.domainId = data.domainId || "";
|
|
25886
|
-
this.useSubPath = data.useSubPath || false;
|
|
25887
|
-
mobx.makeAutoObservable(this);
|
|
25888
|
-
}
|
|
25889
|
-
return IkasStorefrontRoute;
|
|
25890
|
-
}());
|
|
25891
|
-
|
|
25892
|
-
var IkasStorefrontRegion = /** @class */ (function () {
|
|
25893
|
-
function IkasStorefrontRegion(data) {
|
|
25894
|
-
if (data === void 0) { data = {}; }
|
|
25895
|
-
// Extra
|
|
25896
|
-
this.theme = new IkasTheme();
|
|
25897
|
-
this.id = data.id || "";
|
|
25898
|
-
this.locale = data.locale || "";
|
|
25899
|
-
this.themeJSON = data.themeJSON || "";
|
|
25900
|
-
this.shipping = data.shipping || null;
|
|
25901
|
-
this.paymentSettingsId = data.paymentSettingsId || null;
|
|
25902
|
-
this.priceListId = data.priceListId || null;
|
|
25903
|
-
this.locations = data.locations
|
|
25904
|
-
? data.locations.map(function (o) { return new IkasStorefrontLocation(o); })
|
|
25905
|
-
: [];
|
|
25906
|
-
this.routes = data.routes
|
|
25907
|
-
? data.routes.map(function (o) { return new IkasStorefrontRoute(o); })
|
|
25908
|
-
: null;
|
|
25909
|
-
this.termsOfService = data.termsOfService || "";
|
|
25910
|
-
this.privacyPolicy = data.privacyPolicy || "";
|
|
25911
|
-
this.returnPolicy = data.returnPolicy || "";
|
|
25912
|
-
try {
|
|
25913
|
-
this.theme = this.themeJSON
|
|
25914
|
-
? new IkasTheme(JSON.parse(this.themeJSON))
|
|
25915
|
-
: new IkasTheme();
|
|
25916
|
-
}
|
|
25917
|
-
catch (err) { }
|
|
25918
|
-
mobx.makeAutoObservable(this);
|
|
25919
|
-
}
|
|
25920
|
-
return IkasStorefrontRegion;
|
|
25921
|
-
}());
|
|
25922
|
-
|
|
25923
|
-
var IkasStorefront = /** @class */ (function () {
|
|
25924
|
-
function IkasStorefront(data) {
|
|
25925
|
-
if (data === void 0) { data = {}; }
|
|
25926
|
-
this.id = data.id || "";
|
|
25927
|
-
this.name = data.name || "";
|
|
25928
|
-
this.themeId = data.themeId || "";
|
|
25929
|
-
this.themeVersionId = data.themeVersionId || "";
|
|
25930
|
-
this.userId = data.userId || "";
|
|
25931
|
-
this.domains = data.domains
|
|
25932
|
-
? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
|
|
25933
|
-
: [];
|
|
25934
|
-
this.regions = data.regions
|
|
25935
|
-
? data.regions.map(function (o) { return new IkasStorefrontRegion(o); })
|
|
25936
|
-
: [];
|
|
25937
|
-
mobx.makeAutoObservable(this);
|
|
25938
|
-
}
|
|
25939
|
-
return IkasStorefront;
|
|
25940
|
-
}());
|
|
25941
|
-
|
|
25942
|
-
var IkasStorefrontAPI = /** @class */ (function () {
|
|
25943
|
-
function IkasStorefrontAPI() {
|
|
25944
|
-
}
|
|
25945
|
-
IkasStorefrontAPI.getStorefront = function (storefrontId) {
|
|
25946
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
25947
|
-
var QUERY, _a, data, errors;
|
|
25948
|
-
return __generator(this, function (_b) {
|
|
25949
|
-
switch (_b.label) {
|
|
25950
|
-
case 0:
|
|
25951
|
-
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 "])));
|
|
25952
|
-
_b.label = 1;
|
|
25953
|
-
case 1:
|
|
25954
|
-
_b.trys.push([1, 3, , 4]);
|
|
25955
|
-
return [4 /*yield*/, apollo
|
|
25956
|
-
.getClient()
|
|
25957
|
-
.query({
|
|
25958
|
-
query: QUERY,
|
|
25959
|
-
variables: {
|
|
25960
|
-
storefrontId: storefrontId,
|
|
25961
|
-
},
|
|
25962
|
-
})];
|
|
25963
|
-
case 2:
|
|
25964
|
-
_a = _b.sent(), data = _a.data, errors = _a.errors;
|
|
25965
|
-
if (errors && errors.length) {
|
|
25966
|
-
console.log(errors);
|
|
25967
|
-
}
|
|
25968
|
-
if (data)
|
|
25969
|
-
return [2 /*return*/, new IkasStorefront(data.getStorefront)];
|
|
25970
|
-
return [3 /*break*/, 4];
|
|
25971
|
-
case 3:
|
|
25972
|
-
_b.sent();
|
|
25973
|
-
return [3 /*break*/, 4];
|
|
25974
|
-
case 4: return [2 /*return*/, new IkasStorefront()];
|
|
25975
|
-
}
|
|
25976
|
-
});
|
|
25977
|
-
});
|
|
25978
|
-
};
|
|
25979
|
-
return IkasStorefrontAPI;
|
|
25980
|
-
}());
|
|
25981
|
-
var templateObject_1$f;
|
|
25982
|
-
|
|
25983
|
-
var IkasThemeAPI = /** @class */ (function () {
|
|
25984
|
-
function IkasThemeAPI() {
|
|
25985
|
-
}
|
|
25986
|
-
IkasThemeAPI.fetchTheme = function () {
|
|
25987
|
-
return new Promise(function (resolve, reject) {
|
|
25988
|
-
var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
25989
|
-
var themeJSONPath = serverRuntimeConfig.THEME_JSON_PATH || "./src/theme.json";
|
|
25990
|
-
fs__default['default'].readFile(themeJSONPath, {
|
|
25991
|
-
flag: "a+",
|
|
25992
|
-
}, function (err, file) {
|
|
25993
|
-
if (err) {
|
|
25994
|
-
return reject(err);
|
|
25995
|
-
}
|
|
25996
|
-
var result = file.length ? JSON.parse(file.toString()) : {};
|
|
25997
|
-
resolve(new IkasTheme(result));
|
|
25998
|
-
});
|
|
25999
|
-
});
|
|
26000
|
-
};
|
|
26001
|
-
return IkasThemeAPI;
|
|
26002
|
-
}());
|
|
26003
|
-
|
|
26004
25941
|
var IkasVariantTypeAPI = /** @class */ (function () {
|
|
26005
25942
|
function IkasVariantTypeAPI() {
|
|
26006
25943
|
}
|
|
@@ -26010,7 +25947,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
26010
25947
|
return __generator(this, function (_b) {
|
|
26011
25948
|
switch (_b.label) {
|
|
26012
25949
|
case 0:
|
|
26013
|
-
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 "])));
|
|
26014
25951
|
_b.label = 1;
|
|
26015
25952
|
case 1:
|
|
26016
25953
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -26056,7 +25993,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
|
|
|
26056
25993
|
};
|
|
26057
25994
|
return IkasVariantTypeAPI;
|
|
26058
25995
|
}());
|
|
26059
|
-
var templateObject_1$
|
|
25996
|
+
var templateObject_1$f;
|
|
26060
25997
|
|
|
26061
25998
|
function styleInject(css, ref) {
|
|
26062
25999
|
if ( ref === void 0 ) ref = {};
|
|
@@ -27246,6 +27183,11 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
27246
27183
|
name: product.name,
|
|
27247
27184
|
},
|
|
27248
27185
|
},
|
|
27186
|
+
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
27187
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
27188
|
+
storefrontId: IkasStorefrontConfig.storefrontId,
|
|
27189
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
|
|
27190
|
+
storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
|
|
27249
27191
|
};
|
|
27250
27192
|
return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
|
|
27251
27193
|
case 1:
|
|
@@ -27286,6 +27228,11 @@ var IkasCartStore = /** @class */ (function () {
|
|
|
27286
27228
|
name: item.variant.name,
|
|
27287
27229
|
},
|
|
27288
27230
|
},
|
|
27231
|
+
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
27232
|
+
salesChannelId: IkasStorefrontConfig.salesChannelId,
|
|
27233
|
+
storefrontId: IkasStorefrontConfig.storefrontId,
|
|
27234
|
+
storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
|
|
27235
|
+
storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
|
|
27289
27236
|
};
|
|
27290
27237
|
return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
|
|
27291
27238
|
case 1:
|
|
@@ -27648,9 +27595,11 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
|
|
|
27648
27595
|
|
|
27649
27596
|
var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
27650
27597
|
var _b, _c, _d;
|
|
27651
|
-
var checkout = _a.checkout, queryParams = _a.queryParams;
|
|
27598
|
+
var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
|
|
27652
27599
|
var router$1 = router.useRouter();
|
|
27653
|
-
var vm = React.useState(function () {
|
|
27600
|
+
var vm = React.useState(function () {
|
|
27601
|
+
return new CheckoutViewModel(checkout, queryParams, router$1, returnPolicy, privacyPolicy, termsOfService);
|
|
27602
|
+
})[0];
|
|
27654
27603
|
React.useEffect(function () {
|
|
27655
27604
|
Analytics.beginCheckout(vm.checkout);
|
|
27656
27605
|
Analytics.checkoutStep(vm.checkout, vm.step);
|
|
@@ -27675,46 +27624,18 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
|
|
|
27675
27624
|
var onPolicyModalClose = function () {
|
|
27676
27625
|
setPolicyModalText("");
|
|
27677
27626
|
};
|
|
27678
|
-
var onReturnPolicyClick = function () {
|
|
27679
|
-
|
|
27680
|
-
|
|
27681
|
-
|
|
27682
|
-
|
|
27683
|
-
|
|
27684
|
-
|
|
27685
|
-
|
|
27686
|
-
|
|
27687
|
-
|
|
27688
|
-
|
|
27689
|
-
|
|
27690
|
-
});
|
|
27691
|
-
}); };
|
|
27692
|
-
var onPrivacyPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
27693
|
-
var _a;
|
|
27694
|
-
return __generator(this, function (_b) {
|
|
27695
|
-
switch (_b.label) {
|
|
27696
|
-
case 0: return [4 /*yield*/, vm.getStorefront()];
|
|
27697
|
-
case 1:
|
|
27698
|
-
_b.sent();
|
|
27699
|
-
setPolicyModalTitle("Gizlilik Politikası");
|
|
27700
|
-
setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.privacyPolicy) || "");
|
|
27701
|
-
return [2 /*return*/];
|
|
27702
|
-
}
|
|
27703
|
-
});
|
|
27704
|
-
}); };
|
|
27705
|
-
var onTermsOfServiceClick = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
27706
|
-
var _a;
|
|
27707
|
-
return __generator(this, function (_b) {
|
|
27708
|
-
switch (_b.label) {
|
|
27709
|
-
case 0: return [4 /*yield*/, vm.getStorefront()];
|
|
27710
|
-
case 1:
|
|
27711
|
-
_b.sent();
|
|
27712
|
-
setPolicyModalTitle("Hizmet Şartları");
|
|
27713
|
-
setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.termsOfService) || "");
|
|
27714
|
-
return [2 /*return*/];
|
|
27715
|
-
}
|
|
27716
|
-
});
|
|
27717
|
-
}); };
|
|
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
|
+
};
|
|
27718
27639
|
var onErrorClose = function () {
|
|
27719
27640
|
vm.error = undefined;
|
|
27720
27641
|
};
|
|
@@ -27817,6 +27738,9 @@ var IkasPage = mobxReactLite.observer(function (_a) {
|
|
|
27817
27738
|
if (page) {
|
|
27818
27739
|
store.currentPageType = page.type;
|
|
27819
27740
|
}
|
|
27741
|
+
React.useEffect(function () {
|
|
27742
|
+
store.checkLocalization();
|
|
27743
|
+
}, []);
|
|
27820
27744
|
var renderComponent = function (pageComponent, index) {
|
|
27821
27745
|
var pageComponentPropValue = propValues.find(function (pv) { return pv.pageComponent.id === pageComponent.id; });
|
|
27822
27746
|
return (React.createElement(ThemeComponent, { key: pageComponent.id, index: index, pageComponentPropValue: pageComponentPropValue, pageComponent: pageComponent, settingsStr: settingsStr }));
|
|
@@ -28334,24 +28258,358 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
28334
28258
|
Image: Image
|
|
28335
28259
|
});
|
|
28336
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
|
+
|
|
28337
28601
|
var Page = function (_a) {
|
|
28338
|
-
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);
|
|
28339
28604
|
var router$1 = router.useRouter();
|
|
28340
28605
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28341
28606
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
28342
28607
|
};
|
|
28343
28608
|
var getStaticProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28344
|
-
var theme, provider;
|
|
28345
28609
|
return __generator(this, function (_a) {
|
|
28346
28610
|
switch (_a.label) {
|
|
28347
|
-
case 0: return [4 /*yield*/,
|
|
28348
|
-
case 1:
|
|
28349
|
-
theme = _a.sent();
|
|
28350
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.INDEX);
|
|
28351
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28352
|
-
case 2:
|
|
28353
|
-
_a.sent();
|
|
28354
|
-
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()];
|
|
28355
28613
|
}
|
|
28356
28614
|
});
|
|
28357
28615
|
}); };
|
|
@@ -28363,7 +28621,8 @@ var home = /*#__PURE__*/Object.freeze({
|
|
|
28363
28621
|
});
|
|
28364
28622
|
|
|
28365
28623
|
var Page$1 = function (_a) {
|
|
28366
|
-
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);
|
|
28367
28626
|
var router$1 = router.useRouter();
|
|
28368
28627
|
var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
28369
28628
|
var initialPropValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
@@ -28393,6 +28652,7 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
|
|
|
28393
28652
|
productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === exports.IkasHTMLMetaDataTargetType.PRODUCT; });
|
|
28394
28653
|
return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
|
|
28395
28654
|
productIdList: productMetaData.map(function (p) { return p.targetId; }),
|
|
28655
|
+
priceListId: IkasStorefrontConfig.priceListId,
|
|
28396
28656
|
})];
|
|
28397
28657
|
case 2:
|
|
28398
28658
|
productsResponse = _b.sent();
|
|
@@ -28439,25 +28699,10 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
|
|
|
28439
28699
|
});
|
|
28440
28700
|
}); };
|
|
28441
28701
|
var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28442
|
-
var theme, provider;
|
|
28443
28702
|
return __generator(this, function (_a) {
|
|
28444
28703
|
switch (_a.label) {
|
|
28445
|
-
case 0: return [4 /*yield*/,
|
|
28446
|
-
case 1:
|
|
28447
|
-
theme = _a.sent();
|
|
28448
|
-
provider = new IkasPageDataProvider(theme, context.params, undefined);
|
|
28449
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28450
|
-
case 2:
|
|
28451
|
-
_a.sent();
|
|
28452
|
-
if (!provider.page) {
|
|
28453
|
-
return [2 /*return*/, {
|
|
28454
|
-
notFound: true,
|
|
28455
|
-
}];
|
|
28456
|
-
}
|
|
28457
|
-
return [2 /*return*/, {
|
|
28458
|
-
props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
|
|
28459
|
-
revalidate: 60,
|
|
28460
|
-
}];
|
|
28704
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context)];
|
|
28705
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
28461
28706
|
}
|
|
28462
28707
|
});
|
|
28463
28708
|
}); };
|
|
@@ -28496,25 +28741,52 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
28496
28741
|
});
|
|
28497
28742
|
|
|
28498
28743
|
var Page$2 = function (_a) {
|
|
28499
|
-
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);
|
|
28500
28746
|
var router$1 = router.useRouter();
|
|
28501
28747
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28502
28748
|
return (React.createElement(IkasPage, { page: page, settingsStr: settingsStr, propValues: propValues }));
|
|
28503
28749
|
};
|
|
28504
28750
|
var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28505
|
-
var
|
|
28751
|
+
var allSettings, customPagePaths;
|
|
28506
28752
|
return __generator(this, function (_a) {
|
|
28507
28753
|
switch (_a.label) {
|
|
28508
|
-
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); }))];
|
|
28509
28761
|
case 1:
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
|
|
28513
|
-
|
|
28514
|
-
|
|
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
|
+
});
|
|
28515
28786
|
return [2 /*return*/, {
|
|
28516
28787
|
paths: customPagePaths.map(function (p) { return ({
|
|
28517
|
-
params: p,
|
|
28788
|
+
params: p.params,
|
|
28789
|
+
locale: p.locale,
|
|
28518
28790
|
}); }),
|
|
28519
28791
|
fallback: "blocking",
|
|
28520
28792
|
}];
|
|
@@ -28522,17 +28794,10 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
28522
28794
|
});
|
|
28523
28795
|
}); };
|
|
28524
28796
|
var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28525
|
-
var theme, provider;
|
|
28526
28797
|
return __generator(this, function (_a) {
|
|
28527
28798
|
switch (_a.label) {
|
|
28528
|
-
case 0: return [4 /*yield*/,
|
|
28529
|
-
case 1:
|
|
28530
|
-
theme = _a.sent();
|
|
28531
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.CUSTOM);
|
|
28532
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28533
|
-
case 2:
|
|
28534
|
-
_a.sent();
|
|
28535
|
-
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()];
|
|
28536
28801
|
}
|
|
28537
28802
|
});
|
|
28538
28803
|
}); };
|
|
@@ -28545,18 +28810,37 @@ var _slug_ = /*#__PURE__*/Object.freeze({
|
|
|
28545
28810
|
});
|
|
28546
28811
|
|
|
28547
28812
|
var CheckoutPage = function (_a) {
|
|
28548
|
-
var checkoutStr = _a.checkoutStr,
|
|
28813
|
+
var checkoutStr = _a.checkoutStr, configJson = _a.configJson, others = __rest(_a, ["checkoutStr", "configJson"]);
|
|
28814
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
28549
28815
|
Analytics.disableHTML();
|
|
28550
28816
|
var checkout = new IkasCheckout(JSON.parse(checkoutStr));
|
|
28551
|
-
return React.createElement(IkasCheckoutPage, { checkout: checkout,
|
|
28817
|
+
return React.createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
|
|
28552
28818
|
};
|
|
28553
28819
|
var _id_ = mobxReactLite.observer(CheckoutPage);
|
|
28554
28820
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28555
|
-
var id, redirect, checkout;
|
|
28821
|
+
var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
|
|
28556
28822
|
return __generator(this, function (_a) {
|
|
28557
28823
|
switch (_a.label) {
|
|
28558
28824
|
case 0:
|
|
28559
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;
|
|
28560
28844
|
redirect = function () {
|
|
28561
28845
|
context.res.writeHead(302, { Location: "/" });
|
|
28562
28846
|
context.res.end();
|
|
@@ -28566,12 +28850,15 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
28566
28850
|
return [2 /*return*/, redirect()];
|
|
28567
28851
|
}
|
|
28568
28852
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
28569
|
-
case
|
|
28853
|
+
case 2:
|
|
28570
28854
|
checkout = _a.sent();
|
|
28571
28855
|
if (checkout) {
|
|
28572
28856
|
return [2 /*return*/, {
|
|
28573
28857
|
props: {
|
|
28574
28858
|
checkoutStr: JSON.stringify(checkout),
|
|
28859
|
+
returnPolicy: themeLocalization.returnPolicy || "",
|
|
28860
|
+
privacyPolicy: themeLocalization.privacyPolicy || "",
|
|
28861
|
+
termsOfService: themeLocalization.termsOfService || "",
|
|
28575
28862
|
queryParams: context.query,
|
|
28576
28863
|
},
|
|
28577
28864
|
}];
|
|
@@ -28590,23 +28877,17 @@ var _id_$1 = /*#__PURE__*/Object.freeze({
|
|
|
28590
28877
|
});
|
|
28591
28878
|
|
|
28592
28879
|
var Page$3 = function (_a) {
|
|
28593
|
-
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);
|
|
28594
28882
|
var router$1 = router.useRouter();
|
|
28595
28883
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28596
28884
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28597
28885
|
};
|
|
28598
28886
|
var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28599
|
-
var theme, provider;
|
|
28600
28887
|
return __generator(this, function (_a) {
|
|
28601
28888
|
switch (_a.label) {
|
|
28602
|
-
case 0: return [4 /*yield*/,
|
|
28603
|
-
case 1:
|
|
28604
|
-
theme = _a.sent();
|
|
28605
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ACCOUNT);
|
|
28606
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28607
|
-
case 2:
|
|
28608
|
-
_a.sent();
|
|
28609
|
-
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()];
|
|
28610
28891
|
}
|
|
28611
28892
|
});
|
|
28612
28893
|
}); };
|
|
@@ -28618,23 +28899,17 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
28618
28899
|
});
|
|
28619
28900
|
|
|
28620
28901
|
var Page$4 = function (_a) {
|
|
28621
|
-
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);
|
|
28622
28904
|
var router$1 = router.useRouter();
|
|
28623
28905
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28624
28906
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28625
28907
|
};
|
|
28626
28908
|
var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28627
|
-
var theme, provider;
|
|
28628
28909
|
return __generator(this, function (_a) {
|
|
28629
28910
|
switch (_a.label) {
|
|
28630
|
-
case 0: return [4 /*yield*/,
|
|
28631
|
-
case 1:
|
|
28632
|
-
theme = _a.sent();
|
|
28633
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ADDRESSES);
|
|
28634
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28635
|
-
case 2:
|
|
28636
|
-
_a.sent();
|
|
28637
|
-
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()];
|
|
28638
28913
|
}
|
|
28639
28914
|
});
|
|
28640
28915
|
}); };
|
|
@@ -28646,23 +28921,17 @@ var addresses = /*#__PURE__*/Object.freeze({
|
|
|
28646
28921
|
});
|
|
28647
28922
|
|
|
28648
28923
|
var Page$5 = function (_a) {
|
|
28649
|
-
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);
|
|
28650
28926
|
var router$1 = router.useRouter();
|
|
28651
28927
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28652
28928
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28653
28929
|
};
|
|
28654
28930
|
var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28655
|
-
var theme, provider;
|
|
28656
28931
|
return __generator(this, function (_a) {
|
|
28657
28932
|
switch (_a.label) {
|
|
28658
|
-
case 0: return [4 /*yield*/,
|
|
28659
|
-
case 1:
|
|
28660
|
-
theme = _a.sent();
|
|
28661
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ORDERS);
|
|
28662
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28663
|
-
case 2:
|
|
28664
|
-
_a.sent();
|
|
28665
|
-
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()];
|
|
28666
28935
|
}
|
|
28667
28936
|
});
|
|
28668
28937
|
}); };
|
|
@@ -28674,23 +28943,17 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
28674
28943
|
});
|
|
28675
28944
|
|
|
28676
28945
|
var Page$6 = function (_a) {
|
|
28677
|
-
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);
|
|
28678
28948
|
var router$1 = router.useRouter();
|
|
28679
28949
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28680
28950
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28681
28951
|
};
|
|
28682
28952
|
var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28683
|
-
var theme, provider;
|
|
28684
28953
|
return __generator(this, function (_a) {
|
|
28685
28954
|
switch (_a.label) {
|
|
28686
|
-
case 0: return [4 /*yield*/,
|
|
28687
|
-
case 1:
|
|
28688
|
-
theme = _a.sent();
|
|
28689
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ORDER_DETAIL);
|
|
28690
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28691
|
-
case 2:
|
|
28692
|
-
_a.sent();
|
|
28693
|
-
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()];
|
|
28694
28957
|
}
|
|
28695
28958
|
});
|
|
28696
28959
|
}); };
|
|
@@ -28702,23 +28965,17 @@ var _id_$2 = /*#__PURE__*/Object.freeze({
|
|
|
28702
28965
|
});
|
|
28703
28966
|
|
|
28704
28967
|
var Page$7 = function (_a) {
|
|
28705
|
-
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);
|
|
28706
28970
|
var router$1 = router.useRouter();
|
|
28707
28971
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28708
28972
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28709
28973
|
};
|
|
28710
28974
|
var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28711
|
-
var theme, provider;
|
|
28712
28975
|
return __generator(this, function (_a) {
|
|
28713
28976
|
switch (_a.label) {
|
|
28714
|
-
case 0: return [4 /*yield*/,
|
|
28715
|
-
case 1:
|
|
28716
|
-
theme = _a.sent();
|
|
28717
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.LOGIN);
|
|
28718
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28719
|
-
case 2:
|
|
28720
|
-
_a.sent();
|
|
28721
|
-
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()];
|
|
28722
28979
|
}
|
|
28723
28980
|
});
|
|
28724
28981
|
}); };
|
|
@@ -28730,23 +28987,17 @@ var login = /*#__PURE__*/Object.freeze({
|
|
|
28730
28987
|
});
|
|
28731
28988
|
|
|
28732
28989
|
var Page$8 = function (_a) {
|
|
28733
|
-
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);
|
|
28734
28992
|
var router$1 = router.useRouter();
|
|
28735
28993
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28736
28994
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28737
28995
|
};
|
|
28738
28996
|
var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28739
|
-
var theme, provider;
|
|
28740
28997
|
return __generator(this, function (_a) {
|
|
28741
28998
|
switch (_a.label) {
|
|
28742
|
-
case 0: return [4 /*yield*/,
|
|
28743
|
-
case 1:
|
|
28744
|
-
theme = _a.sent();
|
|
28745
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.REGISTER);
|
|
28746
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28747
|
-
case 2:
|
|
28748
|
-
_a.sent();
|
|
28749
|
-
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()];
|
|
28750
29001
|
}
|
|
28751
29002
|
});
|
|
28752
29003
|
}); };
|
|
@@ -28758,23 +29009,17 @@ var register = /*#__PURE__*/Object.freeze({
|
|
|
28758
29009
|
});
|
|
28759
29010
|
|
|
28760
29011
|
var Page$9 = function (_a) {
|
|
28761
|
-
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);
|
|
28762
29014
|
var router$1 = router.useRouter();
|
|
28763
29015
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28764
29016
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28765
29017
|
};
|
|
28766
29018
|
var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28767
|
-
var theme, provider;
|
|
28768
29019
|
return __generator(this, function (_a) {
|
|
28769
29020
|
switch (_a.label) {
|
|
28770
|
-
case 0: return [4 /*yield*/,
|
|
28771
|
-
case 1:
|
|
28772
|
-
theme = _a.sent();
|
|
28773
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FORGOT_PASSWORD);
|
|
28774
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28775
|
-
case 2:
|
|
28776
|
-
_a.sent();
|
|
28777
|
-
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()];
|
|
28778
29023
|
}
|
|
28779
29024
|
});
|
|
28780
29025
|
}); };
|
|
@@ -28786,23 +29031,17 @@ var forgotPassword = /*#__PURE__*/Object.freeze({
|
|
|
28786
29031
|
});
|
|
28787
29032
|
|
|
28788
29033
|
var Page$a = function (_a) {
|
|
28789
|
-
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);
|
|
28790
29036
|
var router$1 = router.useRouter();
|
|
28791
29037
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28792
29038
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28793
29039
|
};
|
|
28794
29040
|
var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28795
|
-
var theme, provider;
|
|
28796
29041
|
return __generator(this, function (_a) {
|
|
28797
29042
|
switch (_a.label) {
|
|
28798
|
-
case 0: return [4 /*yield*/,
|
|
28799
|
-
case 1:
|
|
28800
|
-
theme = _a.sent();
|
|
28801
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.RECOVER_PASSWORD);
|
|
28802
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28803
|
-
case 2:
|
|
28804
|
-
_a.sent();
|
|
28805
|
-
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()];
|
|
28806
29045
|
}
|
|
28807
29046
|
});
|
|
28808
29047
|
}); };
|
|
@@ -28814,7 +29053,8 @@ var recoverPassword = /*#__PURE__*/Object.freeze({
|
|
|
28814
29053
|
});
|
|
28815
29054
|
|
|
28816
29055
|
var Page$b = function (_a) {
|
|
28817
|
-
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);
|
|
28818
29058
|
var router$1 = router.useRouter();
|
|
28819
29059
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28820
29060
|
var store = IkasStorefrontConfig.store;
|
|
@@ -28824,17 +29064,10 @@ var Page$b = function (_a) {
|
|
|
28824
29064
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28825
29065
|
};
|
|
28826
29066
|
var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28827
|
-
var theme, provider;
|
|
28828
29067
|
return __generator(this, function (_a) {
|
|
28829
29068
|
switch (_a.label) {
|
|
28830
|
-
case 0: return [4 /*yield*/,
|
|
28831
|
-
case 1:
|
|
28832
|
-
theme = _a.sent();
|
|
28833
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.CART);
|
|
28834
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28835
|
-
case 2:
|
|
28836
|
-
_a.sent();
|
|
28837
|
-
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()];
|
|
28838
29071
|
}
|
|
28839
29072
|
});
|
|
28840
29073
|
}); };
|
|
@@ -28857,23 +29090,17 @@ var editor$1 = /*#__PURE__*/Object.freeze({
|
|
|
28857
29090
|
});
|
|
28858
29091
|
|
|
28859
29092
|
var Page$d = function (_a) {
|
|
28860
|
-
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);
|
|
28861
29095
|
var router$1 = router.useRouter();
|
|
28862
29096
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28863
29097
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28864
29098
|
};
|
|
28865
29099
|
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28866
|
-
var theme, provider;
|
|
28867
29100
|
return __generator(this, function (_a) {
|
|
28868
29101
|
switch (_a.label) {
|
|
28869
|
-
case 0: return [4 /*yield*/,
|
|
28870
|
-
case 1:
|
|
28871
|
-
theme = _a.sent();
|
|
28872
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FAVORITE_PRODUCTS);
|
|
28873
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28874
|
-
case 2:
|
|
28875
|
-
_a.sent();
|
|
28876
|
-
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()];
|
|
28877
29104
|
}
|
|
28878
29105
|
});
|
|
28879
29106
|
}); };
|
|
@@ -28885,7 +29112,8 @@ var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
|
28885
29112
|
});
|
|
28886
29113
|
|
|
28887
29114
|
var Page$e = function (_a) {
|
|
28888
|
-
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);
|
|
28889
29117
|
var router$1 = router.useRouter();
|
|
28890
29118
|
var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
|
|
28891
29119
|
var initialPropValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
@@ -28899,17 +29127,10 @@ var Page$e = function (_a) {
|
|
|
28899
29127
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
28900
29128
|
};
|
|
28901
29129
|
var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28902
|
-
var theme, provider;
|
|
28903
29130
|
return __generator(this, function (_a) {
|
|
28904
29131
|
switch (_a.label) {
|
|
28905
|
-
case 0: return [4 /*yield*/,
|
|
28906
|
-
case 1:
|
|
28907
|
-
theme = _a.sent();
|
|
28908
|
-
provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.SEARCH);
|
|
28909
|
-
return [4 /*yield*/, provider.getPageData()];
|
|
28910
|
-
case 2:
|
|
28911
|
-
_a.sent();
|
|
28912
|
-
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()];
|
|
28913
29134
|
}
|
|
28914
29135
|
});
|
|
28915
29136
|
}); };
|
|
@@ -28921,23 +29142,29 @@ var search = /*#__PURE__*/Object.freeze({
|
|
|
28921
29142
|
});
|
|
28922
29143
|
|
|
28923
29144
|
var Page$f = function (_a) {
|
|
28924
|
-
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);
|
|
28925
29149
|
var router$1 = router.useRouter();
|
|
28926
29150
|
var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
|
|
28927
29151
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
28928
29152
|
};
|
|
28929
29153
|
var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28930
|
-
var
|
|
29154
|
+
var props;
|
|
28931
29155
|
return __generator(this, function (_a) {
|
|
28932
29156
|
switch (_a.label) {
|
|
28933
|
-
case 0: return [4 /*yield*/,
|
|
29157
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.NOT_FOUND)];
|
|
28934
29158
|
case 1:
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
28940
|
-
|
|
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];
|
|
28941
29168
|
}
|
|
28942
29169
|
});
|
|
28943
29170
|
}); };
|
|
@@ -28954,12 +29181,83 @@ mobx.configure({
|
|
|
28954
29181
|
var IkasBaseStore = /** @class */ (function () {
|
|
28955
29182
|
function IkasBaseStore() {
|
|
28956
29183
|
this.currentPageType = null;
|
|
29184
|
+
this.localeOptions = [];
|
|
29185
|
+
this.showLocaleOptions = false;
|
|
29186
|
+
this.localeChecked = false;
|
|
28957
29187
|
this.customerStore = new IkasCustomerStore(this);
|
|
28958
29188
|
this.cartStore = new IkasCartStore(this);
|
|
28959
29189
|
mobx.makeObservable(this, {
|
|
28960
29190
|
currentPageType: mobx.observable,
|
|
29191
|
+
localeOptions: mobx.observable,
|
|
29192
|
+
showLocaleOptions: mobx.observable,
|
|
28961
29193
|
});
|
|
28962
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
|
+
};
|
|
28963
29261
|
return IkasBaseStore;
|
|
28964
29262
|
}());
|
|
28965
29263
|
|
|
@@ -29037,10 +29335,8 @@ exports.IkasProductSearchAPI = IkasProductSearchAPI;
|
|
|
29037
29335
|
exports.IkasProductVariant = IkasProductVariant;
|
|
29038
29336
|
exports.IkasProductVariantType = IkasProductVariantType;
|
|
29039
29337
|
exports.IkasStateAPI = IkasStateAPI;
|
|
29040
|
-
exports.IkasStorefrontAPI = IkasStorefrontAPI;
|
|
29041
29338
|
exports.IkasStorefrontConfig = IkasStorefrontConfig;
|
|
29042
29339
|
exports.IkasTheme = IkasTheme;
|
|
29043
|
-
exports.IkasThemeAPI = IkasThemeAPI;
|
|
29044
29340
|
exports.IkasThemeComponent = IkasThemeComponent;
|
|
29045
29341
|
exports.IkasThemeComponentProp = IkasThemeComponentProp;
|
|
29046
29342
|
exports.IkasThemeCustomData = IkasThemeCustomData;
|