@ikas/storefront 0.0.100 → 0.0.102

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.
Files changed (33) hide show
  1. package/build/__generated__/global-types.d.ts +1 -7
  2. package/build/api/cart/__generated__/getCart.d.ts +0 -4
  3. package/build/api/cart/__generated__/saveItemToCart.d.ts +0 -4
  4. package/build/api/checkout/__generated__/checkStocks.d.ts +3 -3
  5. package/build/api/checkout/index.d.ts +1 -1
  6. package/build/api/country/__generated__/getAvailableShippingCountries.d.ts +0 -3
  7. package/build/api/country/index.d.ts +1 -1
  8. package/build/api/index.d.ts +2 -0
  9. package/build/api/product-stock-location/__generated__/listProductStockLocation.d.ts +13 -0
  10. package/build/api/product-stock-location/index.d.ts +4 -0
  11. package/build/api/storefront/__generated__/getStorefront.d.ts +23 -0
  12. package/build/api/storefront/index.d.ts +4 -0
  13. package/build/api/theme/index.d.ts +4 -0
  14. package/build/components/checkout/index.d.ts +0 -3
  15. package/build/components/checkout/model.d.ts +3 -4
  16. package/build/index.es.js +410 -469
  17. package/build/index.js +413 -471
  18. package/build/models/data/cart/index.d.ts +0 -9
  19. package/build/models/data/storefront/index.d.ts +6 -19
  20. package/build/models/data/storefront/stockfront-location/index.d.ts +5 -0
  21. package/build/models/data/storefront/stockfront-route/index.d.ts +5 -0
  22. package/build/models/data/storefront/{domain → storefront-domain}/index.d.ts +0 -1
  23. package/build/models/data/storefront/storefront-region/index.d.ts +18 -0
  24. package/build/models/ui/product-list/index.d.ts +1 -1
  25. package/build/pages/checkout/[id].d.ts +0 -3
  26. package/build/storefront/index.d.ts +0 -6
  27. package/package.json +1 -1
  28. package/build/models/data/sales-channel/index.d.ts +0 -12
  29. package/build/models/data/storefront/localization/index.d.ts +0 -7
  30. package/build/models/data/storefront/routing/index.d.ts +0 -9
  31. package/build/models/data/storefront/theme/index.d.ts +0 -13
  32. package/build/models/data/storefront/theme-localization/index.d.ts +0 -12
  33. package/build/utils/settings.d.ts +0 -84
package/build/index.js CHANGED
@@ -3,27 +3,25 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var mobx = require('mobx');
6
- var React = require('react');
6
+ var fs = require('fs');
7
7
  var getConfig = require('next/config');
8
+ var React = require('react');
8
9
  var mobxReactLite = require('mobx-react-lite');
9
10
  var router = require('next/router');
10
11
  var Image$1 = require('next/image');
11
12
  var Link = require('next/link');
12
13
  var Head = require('next/head');
13
- var fs = require('fs');
14
14
  var dynamic = require('next/dynamic');
15
- var Error$1 = require('next/error');
16
15
 
17
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
17
 
19
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
20
19
  var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
20
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
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);
25
24
  var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
26
- var Error__default = /*#__PURE__*/_interopDefaultLegacy(Error$1);
27
25
 
28
26
  /*! *****************************************************************************
29
27
  Copyright (c) Microsoft Corporation.
@@ -11019,7 +11017,6 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
11019
11017
  return [2 /*return*/, null];
11020
11018
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
11021
11019
  productIdList: [this.productDetailPropValue.productId],
11022
- priceListId: IkasStorefrontConfig.priceListId,
11023
11020
  })];
11024
11021
  case 1:
11025
11022
  productSearchResponse = _b.sent();
@@ -12049,7 +12046,6 @@ var IkasPageDataProvider = /** @class */ (function () {
12049
12046
  return [2 /*return*/];
12050
12047
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
12051
12048
  productIdList: [metaDataResponse.metaData.targetId],
12052
- priceListId: IkasStorefrontConfig.priceListId,
12053
12049
  })];
12054
12050
  case 2:
12055
12051
  productsResponse = _b.sent();
@@ -12807,10 +12803,6 @@ var IkasCart = /** @class */ (function () {
12807
12803
  : [];
12808
12804
  this.merchantId = data.merchantId || "";
12809
12805
  this.totalPrice = data.totalPrice || 0;
12810
- this.salesChannelId = data.salesChannelId || "";
12811
- this.storefrontId = data.storefrontId || null;
12812
- this.storefrontRoutingId = data.storefrontRoutingId || null;
12813
- this.storefrontThemeId = data.storefrontThemeId || null;
12814
12806
  mobx.makeAutoObservable(this);
12815
12807
  }
12816
12808
  Object.defineProperty(IkasCart.prototype, "totalTax", {
@@ -15830,7 +15822,7 @@ var MAX_CVC_LENGTH = 4;
15830
15822
  var USE_DIFFERENT_ADDRESS_KEY = "sAddr";
15831
15823
  var isServer$1 = typeof localStorage === "undefined";
15832
15824
  var CheckoutViewModel = /** @class */ (function () {
15833
- function CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService) {
15825
+ function CheckoutViewModel(checkout, queryParams, router) {
15834
15826
  var _this = this;
15835
15827
  this.checkout = new IkasCheckout();
15836
15828
  this.storefront = null;
@@ -15936,7 +15928,7 @@ var CheckoutViewModel = /** @class */ (function () {
15936
15928
  variantId: i.variant.id,
15937
15929
  productId: i.variant.productId,
15938
15930
  }); });
15939
- return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, IkasStorefrontConfig.stockLocationIds || [])];
15931
+ return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines)];
15940
15932
  case 1:
15941
15933
  result = _b.sent();
15942
15934
  if (!result) {
@@ -15949,7 +15941,7 @@ var CheckoutViewModel = /** @class */ (function () {
15949
15941
  data = unavailableItems.map(function (item) { return ({
15950
15942
  variant: _this.cart.items.find(function (i) { return i.variant.id === item.variantId; })
15951
15943
  .variant,
15952
- availableQuantity: item.stockCount,
15944
+ availableQuantity: item.availableQuantity,
15953
15945
  }); });
15954
15946
  throw {
15955
15947
  type: ErrorType.STOCK_ERROR,
@@ -15966,7 +15958,7 @@ var CheckoutViewModel = /** @class */ (function () {
15966
15958
  switch (_b.label) {
15967
15959
  case 0:
15968
15960
  _a = this;
15969
- return [4 /*yield*/, IkasCountryAPI.listShippingCountries(IkasStorefrontConfig.storefrontId)];
15961
+ return [4 /*yield*/, IkasCountryAPI.listShippingCountries()];
15970
15962
  case 1:
15971
15963
  _a.shippingCountryIds = _b.sent();
15972
15964
  return [2 /*return*/];
@@ -16042,6 +16034,30 @@ var CheckoutViewModel = /** @class */ (function () {
16042
16034
  }
16043
16035
  });
16044
16036
  }); };
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
+ }); };
16045
16061
  this.createCustomer = function () {
16046
16062
  if (_this.customerStore.customer) {
16047
16063
  _this.checkout.customer = _this.customerStore.customer;
@@ -16061,7 +16077,7 @@ var CheckoutViewModel = /** @class */ (function () {
16061
16077
  _this.checkout.billingAddress || new IkasOrderAddress();
16062
16078
  }
16063
16079
  else {
16064
- _this.checkout.billingAddress = _this.checkout.shippingAddress;
16080
+ _this.checkout.billingAddress = new IkasOrderAddress(cloneDeep_1(_this.checkout.shippingAddress) || {});
16065
16081
  }
16066
16082
  }
16067
16083
  };
@@ -16173,7 +16189,7 @@ var CheckoutViewModel = /** @class */ (function () {
16173
16189
  _this.router.push("/");
16174
16190
  };
16175
16191
  this.onProceedToShippingClick = function () { return __awaiter(_this, void 0, void 0, function () {
16176
- var newAddress, customer, err_2;
16192
+ var newAddress, customer, err_3;
16177
16193
  return __generator(this, function (_a) {
16178
16194
  switch (_a.label) {
16179
16195
  case 0:
@@ -16203,12 +16219,12 @@ var CheckoutViewModel = /** @class */ (function () {
16203
16219
  this.changeStep(CheckoutStep.SHIPPING);
16204
16220
  return [3 /*break*/, 7];
16205
16221
  case 6:
16206
- err_2 = _a.sent();
16207
- if (err_2.type) {
16208
- this.error = err_2;
16222
+ err_3 = _a.sent();
16223
+ if (err_3.type) {
16224
+ this.error = err_3;
16209
16225
  }
16210
16226
  else {
16211
- console.log(err_2);
16227
+ console.log(err_3);
16212
16228
  this.error = {
16213
16229
  type: ErrorType.UNKNOWN,
16214
16230
  };
@@ -16220,7 +16236,7 @@ var CheckoutViewModel = /** @class */ (function () {
16220
16236
  });
16221
16237
  }); };
16222
16238
  this.onProceedToPaymentClick = function () { return __awaiter(_this, void 0, void 0, function () {
16223
- var err_3;
16239
+ var err_4;
16224
16240
  return __generator(this, function (_a) {
16225
16241
  switch (_a.label) {
16226
16242
  case 0:
@@ -16240,12 +16256,12 @@ var CheckoutViewModel = /** @class */ (function () {
16240
16256
  this.changeStep(CheckoutStep.PAYMENT);
16241
16257
  return [3 /*break*/, 4];
16242
16258
  case 3:
16243
- err_3 = _a.sent();
16244
- if (err_3.type) {
16245
- this.error = err_3;
16259
+ err_4 = _a.sent();
16260
+ if (err_4.type) {
16261
+ this.error = err_4;
16246
16262
  }
16247
16263
  else {
16248
- console.log(err_3);
16264
+ console.log(err_4);
16249
16265
  this.error = {
16250
16266
  type: ErrorType.UNKNOWN,
16251
16267
  };
@@ -16257,7 +16273,7 @@ var CheckoutViewModel = /** @class */ (function () {
16257
16273
  });
16258
16274
  }); };
16259
16275
  this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
16260
- var response, transactionStatus, err_4;
16276
+ var response, transactionStatus, err_5;
16261
16277
  return __generator(this, function (_a) {
16262
16278
  switch (_a.label) {
16263
16279
  case 0:
@@ -16288,6 +16304,7 @@ var CheckoutViewModel = /** @class */ (function () {
16288
16304
  exports.IkasTransactionStatusEnum.SUCCESS,
16289
16305
  exports.IkasTransactionStatusEnum.AUTHORIZED,
16290
16306
  ].includes(transactionStatus)) {
16307
+ localStorage.removeItem(USE_DIFFERENT_ADDRESS_KEY);
16291
16308
  this.changeStep(CheckoutStep.SUCCESS);
16292
16309
  }
16293
16310
  else if (transactionStatus === exports.IkasTransactionStatusEnum.PENDING &&
@@ -16303,10 +16320,10 @@ var CheckoutViewModel = /** @class */ (function () {
16303
16320
  }
16304
16321
  return [3 /*break*/, 6];
16305
16322
  case 5:
16306
- err_4 = _a.sent();
16307
- if (err_4.type) {
16308
- console.log(err_4);
16309
- this.error = err_4;
16323
+ err_5 = _a.sent();
16324
+ if (err_5.type) {
16325
+ console.log(err_5);
16326
+ this.error = err_5;
16310
16327
  }
16311
16328
  else {
16312
16329
  this.error = {
@@ -16385,9 +16402,6 @@ var CheckoutViewModel = /** @class */ (function () {
16385
16402
  }); };
16386
16403
  this.checkout = checkout;
16387
16404
  this.router = router;
16388
- this.returnPolicy = returnPolicy;
16389
- this.privacyPolicy = privacyPolicy;
16390
- this.termsOfService = termsOfService;
16391
16405
  this.init(queryParams);
16392
16406
  mobx.makeAutoObservable(this);
16393
16407
  }
@@ -16398,6 +16412,15 @@ var CheckoutViewModel = /** @class */ (function () {
16398
16412
  enumerable: false,
16399
16413
  configurable: true
16400
16414
  });
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
+ });
16401
16424
  Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGatewayIndex", {
16402
16425
  get: function () {
16403
16426
  var _this = this;
@@ -17061,7 +17084,6 @@ var IkasCustomerStore = /** @class */ (function () {
17061
17084
  return [2 /*return*/, []];
17062
17085
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
17063
17086
  productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
17064
- priceListId: IkasStorefrontConfig.priceListId,
17065
17087
  })];
17066
17088
  case 2:
17067
17089
  productsResult = _b.sent();
@@ -21896,10 +21918,7 @@ var IkasProductList = /** @class */ (function () {
21896
21918
  Object.defineProperty(IkasProductList.prototype, "isFiltered", {
21897
21919
  get: function () {
21898
21920
  var _a;
21899
- return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) ||
21900
- !!this._searchKeyword ||
21901
- (this._pageType !== exports.IkasThemePageType.CATEGORY &&
21902
- !!this._filterCategoryId));
21921
+ return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) || !!this._searchKeyword);
21903
21922
  },
21904
21923
  enumerable: false,
21905
21924
  configurable: true
@@ -21962,20 +21981,13 @@ var IkasProductList = /** @class */ (function () {
21962
21981
  });
21963
21982
  Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
21964
21983
  get: function () {
21965
- var _this = this;
21966
- var _a, _b, _c;
21984
+ var _a;
21967
21985
  var queryParams = {};
21968
21986
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
21969
21987
  queryParams[f.key] = f.keyList;
21970
21988
  });
21971
21989
  if (this._searchKeyword)
21972
21990
  queryParams.s = this._searchKeyword;
21973
- if (this._pageType !== exports.IkasThemePageType.CATEGORY &&
21974
- this._filterCategoryId) {
21975
- 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;
21976
- if (slug)
21977
- queryParams.c = slug;
21978
- }
21979
21991
  return queryString.stringify(queryParams, { arrayFormat: "comma" });
21980
21992
  },
21981
21993
  enumerable: false,
@@ -22030,7 +22042,6 @@ var IkasProductList = /** @class */ (function () {
22030
22042
  categoryIdList: this._filterCategoryId
22031
22043
  ? [this._filterCategoryId]
22032
22044
  : undefined,
22033
- priceListId: IkasStorefrontConfig.priceListId,
22034
22045
  query: this._searchKeyword,
22035
22046
  })];
22036
22047
  case 1: return [2 /*return*/, _c.sent()];
@@ -22058,7 +22069,6 @@ var IkasProductList = /** @class */ (function () {
22058
22069
  };
22059
22070
  IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
22060
22071
  var _this = this;
22061
- var _a;
22062
22072
  try {
22063
22073
  queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
22064
22074
  var _a;
@@ -22070,15 +22080,6 @@ var IkasProductList = /** @class */ (function () {
22070
22080
  var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
22071
22081
  if (querySearch)
22072
22082
  this._searchKeyword = querySearch;
22073
- if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
22074
- var queryCategory_1 = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("c");
22075
- if (queryCategory_1) {
22076
- var filterCategory = (_a = this.filterCategories) === null || _a === void 0 ? void 0 : _a.find(function (fc) { return fc.slug === queryCategory_1; });
22077
- if (filterCategory) {
22078
- this._filterCategoryId = filterCategory.id;
22079
- }
22080
- }
22081
- }
22082
22083
  }
22083
22084
  catch (err) {
22084
22085
  console.log(err);
@@ -22125,32 +22126,12 @@ var IkasProductList = /** @class */ (function () {
22125
22126
  var _a;
22126
22127
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
22127
22128
  this._searchKeyword = "";
22128
- if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
22129
- this._filterCategoryId = undefined;
22130
- }
22131
22129
  this.applyFilters();
22132
22130
  };
22133
- IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
22131
+ IkasProductList.prototype.onFilterCategoryClick = function (filterCategory) {
22134
22132
  var _a;
22135
- if (disableRoute === void 0) { disableRoute = false; }
22136
- return __awaiter(this, void 0, void 0, function () {
22137
- return __generator(this, function (_b) {
22138
- switch (_b.label) {
22139
- case 0:
22140
- if (!disableRoute) return [3 /*break*/, 2];
22141
- this._filterCategoryId = filterCategory.id;
22142
- return [4 /*yield*/, this.applyFilters()];
22143
- case 1:
22144
- _b.sent();
22145
- return [3 /*break*/, 3];
22146
- case 2:
22147
- (_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
22148
- (this.filterQueryParams ? "?" + this.filterQueryParams : ""));
22149
- _b.label = 3;
22150
- case 3: return [2 /*return*/];
22151
- }
22152
- });
22153
- });
22133
+ (_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
22134
+ (this.filterQueryParams ? "?" + this.filterQueryParams : ""));
22154
22135
  };
22155
22136
  IkasProductList.prototype.toJSON = function () {
22156
22137
  return {
@@ -24235,7 +24216,7 @@ var IkasCartAPI = /** @class */ (function () {
24235
24216
  return __generator(this, function (_b) {
24236
24217
  switch (_b.label) {
24237
24218
  case 0:
24238
- MUTATION = src(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
24219
+ 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 "])));
24239
24220
  _b.label = 1;
24240
24221
  case 1:
24241
24222
  _b.trys.push([1, 3, , 4]);
@@ -24270,7 +24251,7 @@ var IkasCartAPI = /** @class */ (function () {
24270
24251
  return __generator(this, function (_b) {
24271
24252
  switch (_b.label) {
24272
24253
  case 0:
24273
- QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
24254
+ 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 "])));
24274
24255
  _b.label = 1;
24275
24256
  case 1:
24276
24257
  _b.trys.push([1, 3, , 4]);
@@ -24742,13 +24723,13 @@ var IkasCheckoutAPI = /** @class */ (function () {
24742
24723
  });
24743
24724
  });
24744
24725
  };
24745
- IkasCheckoutAPI.checkStocks = function (lines, stockLocationIdList) {
24726
+ IkasCheckoutAPI.checkStocks = function (lines) {
24746
24727
  return __awaiter(this, void 0, void 0, function () {
24747
24728
  var QUERY, _a, data, errors, err_7;
24748
24729
  return __generator(this, function (_b) {
24749
24730
  switch (_b.label) {
24750
24731
  case 0:
24751
- QUERY = src(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n query checkStocks(\n $lines: [CheckStocksLineInput!]!\n $stockLocationIdList: [String!]\n ) {\n checkStocks(lines: $lines, stockLocationIdList: $stockLocationIdList) {\n lines {\n stockCount\n isAvailable\n variantId\n }\n }\n }\n "], ["\n query checkStocks(\n $lines: [CheckStocksLineInput!]!\n $stockLocationIdList: [String!]\n ) {\n checkStocks(lines: $lines, stockLocationIdList: $stockLocationIdList) {\n lines {\n stockCount\n isAvailable\n variantId\n }\n }\n }\n "])));
24732
+ QUERY = src(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n query checkStocks($lines: [CheckStocksLineInput!]!) {\n checkStocks(lines: $lines) {\n lines {\n availableQuantity\n isAvailable\n stockLocationId\n variantId\n }\n }\n }\n "], ["\n query checkStocks($lines: [CheckStocksLineInput!]!) {\n checkStocks(lines: $lines) {\n lines {\n availableQuantity\n isAvailable\n stockLocationId\n variantId\n }\n }\n }\n "])));
24752
24733
  _b.label = 1;
24753
24734
  case 1:
24754
24735
  _b.trys.push([1, 3, , 4]);
@@ -24758,7 +24739,6 @@ var IkasCheckoutAPI = /** @class */ (function () {
24758
24739
  query: QUERY,
24759
24740
  variables: {
24760
24741
  lines: lines,
24761
- stockLocationIdList: stockLocationIdList,
24762
24742
  },
24763
24743
  })];
24764
24744
  case 2:
@@ -24870,13 +24850,13 @@ var IkasCountryAPI = /** @class */ (function () {
24870
24850
  });
24871
24851
  });
24872
24852
  };
24873
- IkasCountryAPI.listShippingCountries = function (storefrontId) {
24853
+ IkasCountryAPI.listShippingCountries = function () {
24874
24854
  return __awaiter(this, void 0, void 0, function () {
24875
24855
  var QUERY, _a, data, errors, err_2;
24876
24856
  return __generator(this, function (_b) {
24877
24857
  switch (_b.label) {
24878
24858
  case 0:
24879
- QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries($storefrontId: String!) {\n getAvailableShippingCountries(storefrontId: $storefrontId)\n }\n "], ["\n query getAvailableShippingCountries($storefrontId: String!) {\n getAvailableShippingCountries(storefrontId: $storefrontId)\n }\n "])));
24859
+ QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "], ["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "])));
24880
24860
  _b.label = 1;
24881
24861
  case 1:
24882
24862
  _b.trys.push([1, 3, , 4]);
@@ -24884,9 +24864,6 @@ var IkasCountryAPI = /** @class */ (function () {
24884
24864
  .getClient()
24885
24865
  .query({
24886
24866
  query: QUERY,
24887
- variables: {
24888
- storefrontId: storefrontId,
24889
- },
24890
24867
  })];
24891
24868
  case 2:
24892
24869
  _a = _b.sent(), data = _a.data, errors = _a.errors;
@@ -25880,6 +25857,150 @@ var IkasStateAPI = /** @class */ (function () {
25880
25857
  }());
25881
25858
  var templateObject_1$e;
25882
25859
 
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
+
25883
26004
  var IkasVariantTypeAPI = /** @class */ (function () {
25884
26005
  function IkasVariantTypeAPI() {
25885
26006
  }
@@ -25889,7 +26010,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25889
26010
  return __generator(this, function (_b) {
25890
26011
  switch (_b.label) {
25891
26012
  case 0:
25892
- LIST_VARIANT_TYPE = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "], ["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "])));
26013
+ LIST_VARIANT_TYPE = src(templateObject_1$g || (templateObject_1$g = __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 "])));
25893
26014
  _b.label = 1;
25894
26015
  case 1:
25895
26016
  _b.trys.push([1, 3, , 4]);
@@ -25935,7 +26056,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25935
26056
  };
25936
26057
  return IkasVariantTypeAPI;
25937
26058
  }());
25938
- var templateObject_1$f;
26059
+ var templateObject_1$g;
25939
26060
 
25940
26061
  function styleInject(css, ref) {
25941
26062
  if ( ref === void 0 ) ref = {};
@@ -27125,11 +27246,6 @@ var IkasCartStore = /** @class */ (function () {
27125
27246
  name: product.name,
27126
27247
  },
27127
27248
  },
27128
- priceListId: IkasStorefrontConfig.priceListId || null,
27129
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27130
- storefrontId: IkasStorefrontConfig.storefrontId,
27131
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27132
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27133
27249
  };
27134
27250
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27135
27251
  case 1:
@@ -27170,11 +27286,6 @@ var IkasCartStore = /** @class */ (function () {
27170
27286
  name: item.variant.name,
27171
27287
  },
27172
27288
  },
27173
- priceListId: IkasStorefrontConfig.priceListId || null,
27174
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27175
- storefrontId: IkasStorefrontConfig.storefrontId,
27176
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27177
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27178
27289
  };
27179
27290
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27180
27291
  case 1:
@@ -27537,11 +27648,9 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27537
27648
 
27538
27649
  var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27539
27650
  var _b, _c, _d;
27540
- var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
27651
+ var checkout = _a.checkout, queryParams = _a.queryParams;
27541
27652
  var router$1 = router.useRouter();
27542
- var vm = React.useState(function () {
27543
- return new CheckoutViewModel(checkout, queryParams, router$1, returnPolicy, privacyPolicy, termsOfService);
27544
- })[0];
27653
+ var vm = React.useState(function () { return new CheckoutViewModel(checkout, queryParams, router$1); })[0];
27545
27654
  React.useEffect(function () {
27546
27655
  Analytics.beginCheckout(vm.checkout);
27547
27656
  Analytics.checkoutStep(vm.checkout, vm.step);
@@ -27566,18 +27675,46 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27566
27675
  var onPolicyModalClose = function () {
27567
27676
  setPolicyModalText("");
27568
27677
  };
27569
- var onReturnPolicyClick = function () {
27570
- setPolicyModalTitle("Para İade Politikası");
27571
- setPolicyModalText(vm.returnPolicy);
27572
- };
27573
- var onPrivacyPolicyClick = function () {
27574
- setPolicyModalTitle("Gizlilik Politikası");
27575
- setPolicyModalText(vm.privacyPolicy);
27576
- };
27577
- var onTermsOfServiceClick = function () {
27578
- setPolicyModalTitle("Hizmet Şartları");
27579
- setPolicyModalText(vm.termsOfService);
27580
- };
27678
+ var onReturnPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27679
+ var _a, _b;
27680
+ return __generator(this, function (_c) {
27681
+ switch (_c.label) {
27682
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27683
+ case 1:
27684
+ _c.sent();
27685
+ console.log((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.returnPolicy);
27686
+ setPolicyModalTitle("Para İade Politikası");
27687
+ setPolicyModalText(((_b = vm.storefrontRegion) === null || _b === void 0 ? void 0 : _b.returnPolicy) || "");
27688
+ return [2 /*return*/];
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
+ }); };
27581
27718
  var onErrorClose = function () {
27582
27719
  vm.error = undefined;
27583
27720
  };
@@ -28197,263 +28334,6 @@ var index = /*#__PURE__*/Object.freeze({
28197
28334
  Image: Image
28198
28335
  });
28199
28336
 
28200
- var IkasStorefrontLocalization = /** @class */ (function () {
28201
- function IkasStorefrontLocalization(data) {
28202
- this.id = data.id || "";
28203
- this.isDefault = data.isDefault || false;
28204
- this.locale = data.locale || "";
28205
- this.name = data.name || "";
28206
- }
28207
- return IkasStorefrontLocalization;
28208
- }());
28209
-
28210
- var IkasStorefrontDomain = /** @class */ (function () {
28211
- function IkasStorefrontDomain(data) {
28212
- if (data === void 0) { data = {}; }
28213
- this.id = data.id || "";
28214
- this.merchantDomainId = data.merchantDomainId || "";
28215
- this.name = data.name || "";
28216
- this.redirectDomainName = data.redirectDomainName || null;
28217
- this.isDefault = data.isDefault || false;
28218
- mobx.makeAutoObservable(this);
28219
- }
28220
- return IkasStorefrontDomain;
28221
- }());
28222
-
28223
- var IkasStorefrontRouting = /** @class */ (function () {
28224
- function IkasStorefrontRouting(data) {
28225
- this.id = data.id || "";
28226
- this.countryCodes = data.countryCodes || null;
28227
- this.domain = data.domain || null;
28228
- this.locale = data.locale || "";
28229
- this.path = data.path || null;
28230
- this.priceListId = data.priceListId || null;
28231
- }
28232
- return IkasStorefrontRouting;
28233
- }());
28234
-
28235
- var IkasStorefrontThemeStatus;
28236
- (function (IkasStorefrontThemeStatus) {
28237
- IkasStorefrontThemeStatus["WAITING"] = "WAITING";
28238
- IkasStorefrontThemeStatus["READY"] = "READY";
28239
- })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
28240
- var IkasStorefrontTheme = /** @class */ (function () {
28241
- function IkasStorefrontTheme(data) {
28242
- this.id = data.id || "";
28243
- this.isMainTheme = data.isMainTheme || false;
28244
- this.name = data.name || "";
28245
- this.status = data.status || IkasStorefrontThemeStatus.WAITING;
28246
- this.themeId = data.themeId || "";
28247
- this.themeVersionId = data.themeVersionId || "";
28248
- }
28249
- return IkasStorefrontTheme;
28250
- }());
28251
-
28252
- var IkasStorefrontThemeLocalization = /** @class */ (function () {
28253
- function IkasStorefrontThemeLocalization(data) {
28254
- this.id = data.id || "";
28255
- this.locale = data.locale || "";
28256
- this.storefrontId = data.storefrontId || "";
28257
- this.storefrontThemeId = data.storefrontThemeId || "";
28258
- this.themeJson = data.themeJson
28259
- ? new IkasTheme(data.themeJson)
28260
- : new IkasTheme();
28261
- this.privacyPolicy = data.privacyPolicy || null;
28262
- this.returnPolicy = data.returnPolicy || null;
28263
- this.termsOfService = data.termsOfService || null;
28264
- }
28265
- return IkasStorefrontThemeLocalization;
28266
- }());
28267
-
28268
- var StorefrontStatus;
28269
- (function (StorefrontStatus) {
28270
- StorefrontStatus["WAITING"] = "WAITING";
28271
- StorefrontStatus["READY"] = "READY";
28272
- })(StorefrontStatus || (StorefrontStatus = {}));
28273
- var IkasStorefront = /** @class */ (function () {
28274
- function IkasStorefront(data) {
28275
- if (data === void 0) { data = {}; }
28276
- this.id = data.id || "";
28277
- this.name = data.name || "";
28278
- this.status = data.status || StorefrontStatus.WAITING;
28279
- this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
28280
- this.emailSettingsId = data.emailSettingsId || null;
28281
- this.salesChannelId = data.salesChannelId || null;
28282
- this.gtmId = data.gtmId || null;
28283
- this.fbpId = data.fbpId || null;
28284
- // Sub Models
28285
- this.localizations = data.localizations
28286
- ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
28287
- : [];
28288
- this.routings = data.routings
28289
- ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
28290
- : [];
28291
- this.domains = data.domains
28292
- ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
28293
- : [];
28294
- this.themes = data.themes
28295
- ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
28296
- : [];
28297
- this.regions = data.regions
28298
- ? data.regions.map(function (r) { return new IkasStorefrontThemeLocalization(r); })
28299
- : [];
28300
- }
28301
- return IkasStorefront;
28302
- }());
28303
-
28304
- var IkasSalesChannel = /** @class */ (function () {
28305
- function IkasSalesChannel(data) {
28306
- var _a;
28307
- this.id = data.id || "";
28308
- this.name = data.name || "";
28309
- this.priceListId = data.priceListId || "";
28310
- this.stockLocations =
28311
- ((_a = data.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return new IkasSalesChannelStockLocation(sl); })) ||
28312
- [];
28313
- }
28314
- return IkasSalesChannel;
28315
- }());
28316
- var IkasSalesChannelStockLocation = /** @class */ (function () {
28317
- function IkasSalesChannelStockLocation(data) {
28318
- this.id = data.id || "";
28319
- this.order = data.order || 0;
28320
- }
28321
- return IkasSalesChannelStockLocation;
28322
- }());
28323
-
28324
- var SettingsHelper = /** @class */ (function () {
28325
- function SettingsHelper() {
28326
- }
28327
- SettingsHelper.readSettingsFile = function () {
28328
- return new Promise(function (resolve) {
28329
- var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
28330
- var settingsPath = serverRuntimeConfig.SETTINGS;
28331
- fs__default['default'].readFile(settingsPath, {
28332
- flag: "a+",
28333
- }, function (err, file) {
28334
- if (err) {
28335
- console.error("SETTINGS FILE READ ERROR!!!");
28336
- console.error(err);
28337
- return resolve(null);
28338
- }
28339
- var result = file.length ? JSON.parse(file.toString()) : {};
28340
- resolve(result);
28341
- });
28342
- });
28343
- };
28344
- SettingsHelper.getSettings = function (locale) {
28345
- var _this = this;
28346
- return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
28347
- var settings, storefront, salesChannel, localizationMap, themeLocalizationPath, routing;
28348
- return __generator(this, function (_a) {
28349
- switch (_a.label) {
28350
- case 0: return [4 /*yield*/, SettingsHelper.readSettingsFile()];
28351
- case 1:
28352
- settings = _a.sent();
28353
- if (!settings)
28354
- return [2 /*return*/, resolve(null)];
28355
- storefront = new IkasStorefront(settings.storefront);
28356
- salesChannel = new IkasSalesChannel(settings.salesChannel);
28357
- localizationMap = settings.localizationMap;
28358
- themeLocalizationPath = localizationMap[locale];
28359
- routing = storefront.routings.find(function (r) { return r.id === locale || r.path === locale; });
28360
- if (!themeLocalizationPath || !routing) {
28361
- console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!");
28362
- return [2 /*return*/, resolve(null)];
28363
- }
28364
- fs__default['default'].readFile(themeLocalizationPath, {
28365
- flag: "a+",
28366
- }, function (err, file) {
28367
- if (err) {
28368
- console.error("THEME LOCALZIATION FILE READ ERROR!!!");
28369
- console.error(err);
28370
- return resolve(null);
28371
- }
28372
- var result = file.length ? JSON.parse(file.toString()) : {};
28373
- resolve({
28374
- storefront: storefront,
28375
- themeLocalization: new IkasStorefrontThemeLocalization(result),
28376
- salesChannel: salesChannel,
28377
- routing: routing,
28378
- });
28379
- });
28380
- return [2 /*return*/];
28381
- }
28382
- });
28383
- }); });
28384
- };
28385
- SettingsHelper.getPageData = function (context, isServer, pageType) {
28386
- var _a;
28387
- return __awaiter(this, void 0, void 0, function () {
28388
- var locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
28389
- return __generator(this, function (_b) {
28390
- switch (_b.label) {
28391
- case 0:
28392
- locale = context.locale || context.defaultLocale || "en";
28393
- return [4 /*yield*/, SettingsHelper.getSettings(locale)];
28394
- case 1:
28395
- settings = _b.sent();
28396
- if (!settings ||
28397
- !settings.storefront.mainStorefrontThemeId ||
28398
- !settings.storefront.salesChannelId) {
28399
- return [2 /*return*/, {
28400
- props: {},
28401
- notFound: true,
28402
- }];
28403
- }
28404
- storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
28405
- IkasStorefrontConfig.storefrontId = storefront.id;
28406
- IkasStorefrontConfig.storefrontRoutingId = routing.id;
28407
- IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28408
- IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28409
- IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
28410
- IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28411
- provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
28412
- return [4 /*yield*/, provider.getPageData()];
28413
- case 2:
28414
- _b.sent();
28415
- if (!provider.page) {
28416
- return [2 /*return*/, {
28417
- props: {},
28418
- notFound: true,
28419
- }];
28420
- }
28421
- if (isServer)
28422
- return [2 /*return*/, provider.nextPageData];
28423
- else
28424
- return [2 /*return*/, {
28425
- props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: provider.pageSpecificData
28426
- ? JSON.stringify(provider.pageSpecificData || {})
28427
- : "" }),
28428
- revalidate: 60,
28429
- }];
28430
- }
28431
- });
28432
- });
28433
- };
28434
- SettingsHelper.getStaticProps = function (context, pageType) {
28435
- return __awaiter(this, void 0, void 0, function () {
28436
- return __generator(this, function (_a) {
28437
- switch (_a.label) {
28438
- case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType)];
28439
- case 1: return [2 /*return*/, _a.sent()];
28440
- }
28441
- });
28442
- });
28443
- };
28444
- SettingsHelper.getServerSideProps = function (context, pageType) {
28445
- return __awaiter(this, void 0, void 0, function () {
28446
- return __generator(this, function (_a) {
28447
- switch (_a.label) {
28448
- case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType)];
28449
- case 1: return [2 /*return*/, _a.sent()];
28450
- }
28451
- });
28452
- });
28453
- };
28454
- return SettingsHelper;
28455
- }());
28456
-
28457
28337
  var Page = function (_a) {
28458
28338
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28459
28339
  var router$1 = router.useRouter();
@@ -28461,10 +28341,17 @@ var Page = function (_a) {
28461
28341
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28462
28342
  };
28463
28343
  var getStaticProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28344
+ var theme, provider;
28464
28345
  return __generator(this, function (_a) {
28465
28346
  switch (_a.label) {
28466
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.INDEX)];
28467
- case 1: return [2 /*return*/, _a.sent()];
28347
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28468
28355
  }
28469
28356
  });
28470
28357
  }); };
@@ -28506,7 +28393,6 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28506
28393
  productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === exports.IkasHTMLMetaDataTargetType.PRODUCT; });
28507
28394
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
28508
28395
  productIdList: productMetaData.map(function (p) { return p.targetId; }),
28509
- priceListId: IkasStorefrontConfig.priceListId,
28510
28396
  })];
28511
28397
  case 2:
28512
28398
  productsResponse = _b.sent();
@@ -28553,10 +28439,25 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28553
28439
  });
28554
28440
  }); };
28555
28441
  var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28442
+ var theme, provider;
28556
28443
  return __generator(this, function (_a) {
28557
28444
  switch (_a.label) {
28558
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context)];
28559
- case 1: return [2 /*return*/, _a.sent()];
28445
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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
+ }];
28560
28461
  }
28561
28462
  });
28562
28463
  }); };
@@ -28601,38 +28502,19 @@ var Page$2 = function (_a) {
28601
28502
  return (React.createElement(IkasPage, { page: page, settingsStr: settingsStr, propValues: propValues }));
28602
28503
  };
28603
28504
  var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28604
- var allSettings, customPagePaths;
28505
+ var theme, customPages, customPagePaths;
28605
28506
  return __generator(this, function (_a) {
28606
28507
  switch (_a.label) {
28607
- case 0:
28608
- if (!context.locales)
28609
- return [2 /*return*/, {
28610
- paths: [],
28611
- fallback: "blocking",
28612
- }];
28613
- return [4 /*yield*/, Promise.all(context.locales.map(function (locale) { return SettingsHelper.getSettings(locale); }))];
28508
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28614
28509
  case 1:
28615
- allSettings = (_a.sent());
28616
- customPagePaths = [];
28617
- allSettings.forEach(function (_a) {
28618
- var themeLocalization = _a.themeLocalization, routing = _a.routing;
28619
- if (!themeLocalization)
28620
- return;
28621
- var customPages = themeLocalization.themeJson.pages.filter(function (p) { return p.type === exports.IkasThemePageType.CUSTOM; });
28622
- customPages.forEach(function (customPage) {
28623
- if (customPage.slug &&
28624
- !customPagePaths.some(function (p) { return p.params.slug === customPage.slug; })) {
28625
- customPagePaths.push({
28626
- params: { slug: customPage.slug },
28627
- locale: routing.path || routing.id,
28628
- });
28629
- }
28630
- });
28631
- });
28510
+ theme = _a.sent();
28511
+ customPages = theme.pages.filter(function (p) { return p.type === exports.IkasThemePageType.CUSTOM; });
28512
+ customPagePaths = customPages.map(function (p) { return ({
28513
+ slug: p.slug,
28514
+ }); });
28632
28515
  return [2 /*return*/, {
28633
28516
  paths: customPagePaths.map(function (p) { return ({
28634
- params: p.params,
28635
- locale: p.locale,
28517
+ params: p,
28636
28518
  }); }),
28637
28519
  fallback: "blocking",
28638
28520
  }];
@@ -28640,10 +28522,17 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
28640
28522
  });
28641
28523
  }); };
28642
28524
  var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28525
+ var theme, provider;
28643
28526
  return __generator(this, function (_a) {
28644
28527
  switch (_a.label) {
28645
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.CUSTOM)];
28646
- case 1: return [2 /*return*/, _a.sent()];
28528
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28647
28536
  }
28648
28537
  });
28649
28538
  }); };
@@ -28656,36 +28545,18 @@ var _slug_ = /*#__PURE__*/Object.freeze({
28656
28545
  });
28657
28546
 
28658
28547
  var CheckoutPage = function (_a) {
28659
- var checkoutStr = _a.checkoutStr, others = __rest(_a, ["checkoutStr"]);
28548
+ var checkoutStr = _a.checkoutStr, queryParams = _a.queryParams;
28660
28549
  Analytics.disableHTML();
28661
28550
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
28662
- return React.createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
28551
+ return React.createElement(IkasCheckoutPage, { checkout: checkout, queryParams: queryParams });
28663
28552
  };
28664
28553
  var _id_ = mobxReactLite.observer(CheckoutPage);
28665
28554
  var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28666
- var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
28555
+ var id, redirect, checkout;
28667
28556
  return __generator(this, function (_a) {
28668
28557
  switch (_a.label) {
28669
28558
  case 0:
28670
28559
  id = context.query.id;
28671
- locale = context.locale || context.defaultLocale || "en";
28672
- return [4 /*yield*/, SettingsHelper.getSettings(locale)];
28673
- case 1:
28674
- settings = _a.sent();
28675
- // TODO maybe remove this and convert this page to static
28676
- if (!settings ||
28677
- !settings.storefront.mainStorefrontThemeId ||
28678
- !settings.storefront.salesChannelId) {
28679
- return [2 /*return*/, {
28680
- props: {},
28681
- notFound: true,
28682
- }];
28683
- }
28684
- storefront = settings.storefront, themeLocalization = settings.themeLocalization, routing = settings.routing;
28685
- IkasStorefrontConfig.storefrontId = storefront.id;
28686
- IkasStorefrontConfig.storefrontRoutingId = routing.id;
28687
- IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28688
- IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28689
28560
  redirect = function () {
28690
28561
  context.res.writeHead(302, { Location: "/" });
28691
28562
  context.res.end();
@@ -28695,15 +28566,12 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
28695
28566
  return [2 /*return*/, redirect()];
28696
28567
  }
28697
28568
  return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
28698
- case 2:
28569
+ case 1:
28699
28570
  checkout = _a.sent();
28700
28571
  if (checkout) {
28701
28572
  return [2 /*return*/, {
28702
28573
  props: {
28703
28574
  checkoutStr: JSON.stringify(checkout),
28704
- returnPolicy: themeLocalization.returnPolicy || "",
28705
- privacyPolicy: themeLocalization.privacyPolicy || "",
28706
- termsOfService: themeLocalization.termsOfService || "",
28707
28575
  queryParams: context.query,
28708
28576
  },
28709
28577
  }];
@@ -28728,10 +28596,17 @@ var Page$3 = function (_a) {
28728
28596
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28729
28597
  };
28730
28598
  var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28599
+ var theme, provider;
28731
28600
  return __generator(this, function (_a) {
28732
28601
  switch (_a.label) {
28733
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ACCOUNT)];
28734
- case 1: return [2 /*return*/, _a.sent()];
28602
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28735
28610
  }
28736
28611
  });
28737
28612
  }); };
@@ -28749,10 +28624,17 @@ var Page$4 = function (_a) {
28749
28624
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28750
28625
  };
28751
28626
  var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28627
+ var theme, provider;
28752
28628
  return __generator(this, function (_a) {
28753
28629
  switch (_a.label) {
28754
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ADDRESSES)];
28755
- case 1: return [2 /*return*/, _a.sent()];
28630
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28756
28638
  }
28757
28639
  });
28758
28640
  }); };
@@ -28770,10 +28652,17 @@ var Page$5 = function (_a) {
28770
28652
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28771
28653
  };
28772
28654
  var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28655
+ var theme, provider;
28773
28656
  return __generator(this, function (_a) {
28774
28657
  switch (_a.label) {
28775
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ORDERS)];
28776
- case 1: return [2 /*return*/, _a.sent()];
28658
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28777
28666
  }
28778
28667
  });
28779
28668
  }); };
@@ -28791,10 +28680,17 @@ var Page$6 = function (_a) {
28791
28680
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28792
28681
  };
28793
28682
  var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28683
+ var theme, provider;
28794
28684
  return __generator(this, function (_a) {
28795
28685
  switch (_a.label) {
28796
- case 0: return [4 /*yield*/, SettingsHelper.getServerSideProps(context, exports.IkasThemePageType.ORDER_DETAIL)];
28797
- case 1: return [2 /*return*/, _a.sent()];
28686
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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];
28798
28694
  }
28799
28695
  });
28800
28696
  }); };
@@ -28812,10 +28708,17 @@ var Page$7 = function (_a) {
28812
28708
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28813
28709
  };
28814
28710
  var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28711
+ var theme, provider;
28815
28712
  return __generator(this, function (_a) {
28816
28713
  switch (_a.label) {
28817
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.LOGIN)];
28818
- case 1: return [2 /*return*/, _a.sent()];
28714
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28819
28722
  }
28820
28723
  });
28821
28724
  }); };
@@ -28833,10 +28736,17 @@ var Page$8 = function (_a) {
28833
28736
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28834
28737
  };
28835
28738
  var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28739
+ var theme, provider;
28836
28740
  return __generator(this, function (_a) {
28837
28741
  switch (_a.label) {
28838
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.REGISTER)];
28839
- case 1: return [2 /*return*/, _a.sent()];
28742
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28840
28750
  }
28841
28751
  });
28842
28752
  }); };
@@ -28854,10 +28764,17 @@ var Page$9 = function (_a) {
28854
28764
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28855
28765
  };
28856
28766
  var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28767
+ var theme, provider;
28857
28768
  return __generator(this, function (_a) {
28858
28769
  switch (_a.label) {
28859
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FORGOT_PASSWORD)];
28860
- case 1: return [2 /*return*/, _a.sent()];
28770
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28861
28778
  }
28862
28779
  });
28863
28780
  }); };
@@ -28875,10 +28792,17 @@ var Page$a = function (_a) {
28875
28792
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28876
28793
  };
28877
28794
  var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28795
+ var theme, provider;
28878
28796
  return __generator(this, function (_a) {
28879
28797
  switch (_a.label) {
28880
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.RECOVER_PASSWORD)];
28881
- case 1: return [2 /*return*/, _a.sent()];
28798
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28882
28806
  }
28883
28807
  });
28884
28808
  }); };
@@ -28900,10 +28824,17 @@ var Page$b = function (_a) {
28900
28824
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28901
28825
  };
28902
28826
  var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28827
+ var theme, provider;
28903
28828
  return __generator(this, function (_a) {
28904
28829
  switch (_a.label) {
28905
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.CART)];
28906
- case 1: return [2 /*return*/, _a.sent()];
28830
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28907
28838
  }
28908
28839
  });
28909
28840
  }); };
@@ -28932,10 +28863,17 @@ var Page$d = function (_a) {
28932
28863
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28933
28864
  };
28934
28865
  var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28866
+ var theme, provider;
28935
28867
  return __generator(this, function (_a) {
28936
28868
  switch (_a.label) {
28937
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FAVORITE_PRODUCTS)];
28938
- case 1: return [2 /*return*/, _a.sent()];
28869
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28939
28877
  }
28940
28878
  });
28941
28879
  }); };
@@ -28961,10 +28899,17 @@ var Page$e = function (_a) {
28961
28899
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28962
28900
  };
28963
28901
  var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28902
+ var theme, provider;
28964
28903
  return __generator(this, function (_a) {
28965
28904
  switch (_a.label) {
28966
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.SEARCH)];
28967
- case 1: return [2 /*return*/, _a.sent()];
28905
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
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 })];
28968
28913
  }
28969
28914
  });
28970
28915
  }); };
@@ -28977,27 +28922,22 @@ var search = /*#__PURE__*/Object.freeze({
28977
28922
 
28978
28923
  var Page$f = function (_a) {
28979
28924
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28980
- if (!propValuesStr || !page)
28981
- return React.createElement(Error__default['default'], { statusCode: 404 });
28982
28925
  var router$1 = router.useRouter();
28983
28926
  var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
28984
28927
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28985
28928
  };
28986
28929
  var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28987
- var props;
28930
+ var theme, provider;
28988
28931
  return __generator(this, function (_a) {
28989
28932
  switch (_a.label) {
28990
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.NOT_FOUND)];
28933
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28991
28934
  case 1:
28992
- props = _a.sent();
28993
- //@ts-ignore
28994
- if (props.notFound)
28995
- return [2 /*return*/, {
28996
- props: {},
28997
- revalidate: 60,
28998
- }];
28999
- else
29000
- return [2 /*return*/, props];
28935
+ theme = _a.sent();
28936
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.NOT_FOUND);
28937
+ return [4 /*yield*/, provider.getPageData()];
28938
+ case 2:
28939
+ _a.sent();
28940
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
29001
28941
  }
29002
28942
  });
29003
28943
  }); };
@@ -29097,8 +29037,10 @@ exports.IkasProductSearchAPI = IkasProductSearchAPI;
29097
29037
  exports.IkasProductVariant = IkasProductVariant;
29098
29038
  exports.IkasProductVariantType = IkasProductVariantType;
29099
29039
  exports.IkasStateAPI = IkasStateAPI;
29040
+ exports.IkasStorefrontAPI = IkasStorefrontAPI;
29100
29041
  exports.IkasStorefrontConfig = IkasStorefrontConfig;
29101
29042
  exports.IkasTheme = IkasTheme;
29043
+ exports.IkasThemeAPI = IkasThemeAPI;
29102
29044
  exports.IkasThemeComponent = IkasThemeComponent;
29103
29045
  exports.IkasThemeComponentProp = IkasThemeComponentProp;
29104
29046
  exports.IkasThemeCustomData = IkasThemeCustomData;