@ikas/storefront 0.0.100 → 0.0.101

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 +409 -469
  17. package/build/index.js +412 -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 = 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:
@@ -16303,10 +16319,10 @@ var CheckoutViewModel = /** @class */ (function () {
16303
16319
  }
16304
16320
  return [3 /*break*/, 6];
16305
16321
  case 5:
16306
- err_4 = _a.sent();
16307
- if (err_4.type) {
16308
- console.log(err_4);
16309
- this.error = err_4;
16322
+ err_5 = _a.sent();
16323
+ if (err_5.type) {
16324
+ console.log(err_5);
16325
+ this.error = err_5;
16310
16326
  }
16311
16327
  else {
16312
16328
  this.error = {
@@ -16385,9 +16401,6 @@ var CheckoutViewModel = /** @class */ (function () {
16385
16401
  }); };
16386
16402
  this.checkout = checkout;
16387
16403
  this.router = router;
16388
- this.returnPolicy = returnPolicy;
16389
- this.privacyPolicy = privacyPolicy;
16390
- this.termsOfService = termsOfService;
16391
16404
  this.init(queryParams);
16392
16405
  mobx.makeAutoObservable(this);
16393
16406
  }
@@ -16398,6 +16411,15 @@ var CheckoutViewModel = /** @class */ (function () {
16398
16411
  enumerable: false,
16399
16412
  configurable: true
16400
16413
  });
16414
+ Object.defineProperty(CheckoutViewModel.prototype, "storefrontRegion", {
16415
+ get: function () {
16416
+ var _a;
16417
+ return ((_a = this.storefront) === null || _a === void 0 ? void 0 : _a.regions.length) ? this.storefront.regions[0]
16418
+ : undefined;
16419
+ },
16420
+ enumerable: false,
16421
+ configurable: true
16422
+ });
16401
16423
  Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGatewayIndex", {
16402
16424
  get: function () {
16403
16425
  var _this = this;
@@ -17061,7 +17083,6 @@ var IkasCustomerStore = /** @class */ (function () {
17061
17083
  return [2 /*return*/, []];
17062
17084
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
17063
17085
  productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
17064
- priceListId: IkasStorefrontConfig.priceListId,
17065
17086
  })];
17066
17087
  case 2:
17067
17088
  productsResult = _b.sent();
@@ -21896,10 +21917,7 @@ var IkasProductList = /** @class */ (function () {
21896
21917
  Object.defineProperty(IkasProductList.prototype, "isFiltered", {
21897
21918
  get: function () {
21898
21919
  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));
21920
+ return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) || !!this._searchKeyword);
21903
21921
  },
21904
21922
  enumerable: false,
21905
21923
  configurable: true
@@ -21962,20 +21980,13 @@ var IkasProductList = /** @class */ (function () {
21962
21980
  });
21963
21981
  Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
21964
21982
  get: function () {
21965
- var _this = this;
21966
- var _a, _b, _c;
21983
+ var _a;
21967
21984
  var queryParams = {};
21968
21985
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
21969
21986
  queryParams[f.key] = f.keyList;
21970
21987
  });
21971
21988
  if (this._searchKeyword)
21972
21989
  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
21990
  return queryString.stringify(queryParams, { arrayFormat: "comma" });
21980
21991
  },
21981
21992
  enumerable: false,
@@ -22030,7 +22041,6 @@ var IkasProductList = /** @class */ (function () {
22030
22041
  categoryIdList: this._filterCategoryId
22031
22042
  ? [this._filterCategoryId]
22032
22043
  : undefined,
22033
- priceListId: IkasStorefrontConfig.priceListId,
22034
22044
  query: this._searchKeyword,
22035
22045
  })];
22036
22046
  case 1: return [2 /*return*/, _c.sent()];
@@ -22058,7 +22068,6 @@ var IkasProductList = /** @class */ (function () {
22058
22068
  };
22059
22069
  IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
22060
22070
  var _this = this;
22061
- var _a;
22062
22071
  try {
22063
22072
  queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
22064
22073
  var _a;
@@ -22070,15 +22079,6 @@ var IkasProductList = /** @class */ (function () {
22070
22079
  var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
22071
22080
  if (querySearch)
22072
22081
  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
22082
  }
22083
22083
  catch (err) {
22084
22084
  console.log(err);
@@ -22125,32 +22125,12 @@ var IkasProductList = /** @class */ (function () {
22125
22125
  var _a;
22126
22126
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
22127
22127
  this._searchKeyword = "";
22128
- if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
22129
- this._filterCategoryId = undefined;
22130
- }
22131
22128
  this.applyFilters();
22132
22129
  };
22133
- IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
22130
+ IkasProductList.prototype.onFilterCategoryClick = function (filterCategory) {
22134
22131
  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
- });
22132
+ (_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
22133
+ (this.filterQueryParams ? "?" + this.filterQueryParams : ""));
22154
22134
  };
22155
22135
  IkasProductList.prototype.toJSON = function () {
22156
22136
  return {
@@ -24235,7 +24215,7 @@ var IkasCartAPI = /** @class */ (function () {
24235
24215
  return __generator(this, function (_b) {
24236
24216
  switch (_b.label) {
24237
24217
  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 "])));
24218
+ MUTATION = src(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
24239
24219
  _b.label = 1;
24240
24220
  case 1:
24241
24221
  _b.trys.push([1, 3, , 4]);
@@ -24270,7 +24250,7 @@ var IkasCartAPI = /** @class */ (function () {
24270
24250
  return __generator(this, function (_b) {
24271
24251
  switch (_b.label) {
24272
24252
  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 "])));
24253
+ QUERY = src(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart($cartId: String, $customerId: String) {\n getCart(id: $cartId, customerId: $customerId) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
24274
24254
  _b.label = 1;
24275
24255
  case 1:
24276
24256
  _b.trys.push([1, 3, , 4]);
@@ -24742,13 +24722,13 @@ var IkasCheckoutAPI = /** @class */ (function () {
24742
24722
  });
24743
24723
  });
24744
24724
  };
24745
- IkasCheckoutAPI.checkStocks = function (lines, stockLocationIdList) {
24725
+ IkasCheckoutAPI.checkStocks = function (lines) {
24746
24726
  return __awaiter(this, void 0, void 0, function () {
24747
24727
  var QUERY, _a, data, errors, err_7;
24748
24728
  return __generator(this, function (_b) {
24749
24729
  switch (_b.label) {
24750
24730
  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 "])));
24731
+ 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
24732
  _b.label = 1;
24753
24733
  case 1:
24754
24734
  _b.trys.push([1, 3, , 4]);
@@ -24758,7 +24738,6 @@ var IkasCheckoutAPI = /** @class */ (function () {
24758
24738
  query: QUERY,
24759
24739
  variables: {
24760
24740
  lines: lines,
24761
- stockLocationIdList: stockLocationIdList,
24762
24741
  },
24763
24742
  })];
24764
24743
  case 2:
@@ -24870,13 +24849,13 @@ var IkasCountryAPI = /** @class */ (function () {
24870
24849
  });
24871
24850
  });
24872
24851
  };
24873
- IkasCountryAPI.listShippingCountries = function (storefrontId) {
24852
+ IkasCountryAPI.listShippingCountries = function () {
24874
24853
  return __awaiter(this, void 0, void 0, function () {
24875
24854
  var QUERY, _a, data, errors, err_2;
24876
24855
  return __generator(this, function (_b) {
24877
24856
  switch (_b.label) {
24878
24857
  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 "])));
24858
+ QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "], ["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "])));
24880
24859
  _b.label = 1;
24881
24860
  case 1:
24882
24861
  _b.trys.push([1, 3, , 4]);
@@ -24884,9 +24863,6 @@ var IkasCountryAPI = /** @class */ (function () {
24884
24863
  .getClient()
24885
24864
  .query({
24886
24865
  query: QUERY,
24887
- variables: {
24888
- storefrontId: storefrontId,
24889
- },
24890
24866
  })];
24891
24867
  case 2:
24892
24868
  _a = _b.sent(), data = _a.data, errors = _a.errors;
@@ -25880,6 +25856,150 @@ var IkasStateAPI = /** @class */ (function () {
25880
25856
  }());
25881
25857
  var templateObject_1$e;
25882
25858
 
25859
+ var IkasStorefrontDomain = /** @class */ (function () {
25860
+ function IkasStorefrontDomain(data) {
25861
+ if (data === void 0) { data = {}; }
25862
+ this.id = data.id || "";
25863
+ this.merchantDomainId = data.merchantDomainId || "";
25864
+ this.name = data.name || "";
25865
+ this.redirectDomainName = data.redirectDomainName || null;
25866
+ mobx.makeAutoObservable(this);
25867
+ }
25868
+ return IkasStorefrontDomain;
25869
+ }());
25870
+
25871
+ var IkasStorefrontLocation = /** @class */ (function () {
25872
+ function IkasStorefrontLocation(data) {
25873
+ if (data === void 0) { data = {}; }
25874
+ this.countryId = data.countryId || "";
25875
+ this.stateId = data.stateId || null;
25876
+ mobx.makeAutoObservable(this);
25877
+ }
25878
+ return IkasStorefrontLocation;
25879
+ }());
25880
+
25881
+ var IkasStorefrontRoute = /** @class */ (function () {
25882
+ function IkasStorefrontRoute(data) {
25883
+ if (data === void 0) { data = {}; }
25884
+ this.domainId = data.domainId || "";
25885
+ this.useSubPath = data.useSubPath || false;
25886
+ mobx.makeAutoObservable(this);
25887
+ }
25888
+ return IkasStorefrontRoute;
25889
+ }());
25890
+
25891
+ var IkasStorefrontRegion = /** @class */ (function () {
25892
+ function IkasStorefrontRegion(data) {
25893
+ if (data === void 0) { data = {}; }
25894
+ // Extra
25895
+ this.theme = new IkasTheme();
25896
+ this.id = data.id || "";
25897
+ this.locale = data.locale || "";
25898
+ this.themeJSON = data.themeJSON || "";
25899
+ this.shipping = data.shipping || null;
25900
+ this.paymentSettingsId = data.paymentSettingsId || null;
25901
+ this.priceListId = data.priceListId || null;
25902
+ this.locations = data.locations
25903
+ ? data.locations.map(function (o) { return new IkasStorefrontLocation(o); })
25904
+ : [];
25905
+ this.routes = data.routes
25906
+ ? data.routes.map(function (o) { return new IkasStorefrontRoute(o); })
25907
+ : null;
25908
+ this.termsOfService = data.termsOfService || "";
25909
+ this.privacyPolicy = data.privacyPolicy || "";
25910
+ this.returnPolicy = data.returnPolicy || "";
25911
+ try {
25912
+ this.theme = this.themeJSON
25913
+ ? new IkasTheme(JSON.parse(this.themeJSON))
25914
+ : new IkasTheme();
25915
+ }
25916
+ catch (err) { }
25917
+ mobx.makeAutoObservable(this);
25918
+ }
25919
+ return IkasStorefrontRegion;
25920
+ }());
25921
+
25922
+ var IkasStorefront = /** @class */ (function () {
25923
+ function IkasStorefront(data) {
25924
+ if (data === void 0) { data = {}; }
25925
+ this.id = data.id || "";
25926
+ this.name = data.name || "";
25927
+ this.themeId = data.themeId || "";
25928
+ this.themeVersionId = data.themeVersionId || "";
25929
+ this.userId = data.userId || "";
25930
+ this.domains = data.domains
25931
+ ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
25932
+ : [];
25933
+ this.regions = data.regions
25934
+ ? data.regions.map(function (o) { return new IkasStorefrontRegion(o); })
25935
+ : [];
25936
+ mobx.makeAutoObservable(this);
25937
+ }
25938
+ return IkasStorefront;
25939
+ }());
25940
+
25941
+ var IkasStorefrontAPI = /** @class */ (function () {
25942
+ function IkasStorefrontAPI() {
25943
+ }
25944
+ IkasStorefrontAPI.getStorefront = function (storefrontId) {
25945
+ return __awaiter(this, void 0, void 0, function () {
25946
+ var QUERY, _a, data, errors;
25947
+ return __generator(this, function (_b) {
25948
+ switch (_b.label) {
25949
+ case 0:
25950
+ QUERY = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
25951
+ _b.label = 1;
25952
+ case 1:
25953
+ _b.trys.push([1, 3, , 4]);
25954
+ return [4 /*yield*/, apollo
25955
+ .getClient()
25956
+ .query({
25957
+ query: QUERY,
25958
+ variables: {
25959
+ storefrontId: storefrontId,
25960
+ },
25961
+ })];
25962
+ case 2:
25963
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
25964
+ if (errors && errors.length) {
25965
+ console.log(errors);
25966
+ }
25967
+ if (data)
25968
+ return [2 /*return*/, new IkasStorefront(data.getStorefront)];
25969
+ return [3 /*break*/, 4];
25970
+ case 3:
25971
+ _b.sent();
25972
+ return [3 /*break*/, 4];
25973
+ case 4: return [2 /*return*/, new IkasStorefront()];
25974
+ }
25975
+ });
25976
+ });
25977
+ };
25978
+ return IkasStorefrontAPI;
25979
+ }());
25980
+ var templateObject_1$f;
25981
+
25982
+ var IkasThemeAPI = /** @class */ (function () {
25983
+ function IkasThemeAPI() {
25984
+ }
25985
+ IkasThemeAPI.fetchTheme = function () {
25986
+ return new Promise(function (resolve, reject) {
25987
+ var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
25988
+ var themeJSONPath = serverRuntimeConfig.THEME_JSON_PATH || "./src/theme.json";
25989
+ fs__default['default'].readFile(themeJSONPath, {
25990
+ flag: "a+",
25991
+ }, function (err, file) {
25992
+ if (err) {
25993
+ return reject(err);
25994
+ }
25995
+ var result = file.length ? JSON.parse(file.toString()) : {};
25996
+ resolve(new IkasTheme(result));
25997
+ });
25998
+ });
25999
+ };
26000
+ return IkasThemeAPI;
26001
+ }());
26002
+
25883
26003
  var IkasVariantTypeAPI = /** @class */ (function () {
25884
26004
  function IkasVariantTypeAPI() {
25885
26005
  }
@@ -25889,7 +26009,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25889
26009
  return __generator(this, function (_b) {
25890
26010
  switch (_b.label) {
25891
26011
  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 "])));
26012
+ 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
26013
  _b.label = 1;
25894
26014
  case 1:
25895
26015
  _b.trys.push([1, 3, , 4]);
@@ -25935,7 +26055,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25935
26055
  };
25936
26056
  return IkasVariantTypeAPI;
25937
26057
  }());
25938
- var templateObject_1$f;
26058
+ var templateObject_1$g;
25939
26059
 
25940
26060
  function styleInject(css, ref) {
25941
26061
  if ( ref === void 0 ) ref = {};
@@ -27125,11 +27245,6 @@ var IkasCartStore = /** @class */ (function () {
27125
27245
  name: product.name,
27126
27246
  },
27127
27247
  },
27128
- priceListId: IkasStorefrontConfig.priceListId || null,
27129
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27130
- storefrontId: IkasStorefrontConfig.storefrontId,
27131
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27132
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27133
27248
  };
27134
27249
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27135
27250
  case 1:
@@ -27170,11 +27285,6 @@ var IkasCartStore = /** @class */ (function () {
27170
27285
  name: item.variant.name,
27171
27286
  },
27172
27287
  },
27173
- priceListId: IkasStorefrontConfig.priceListId || null,
27174
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27175
- storefrontId: IkasStorefrontConfig.storefrontId,
27176
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27177
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27178
27288
  };
27179
27289
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27180
27290
  case 1:
@@ -27537,11 +27647,9 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27537
27647
 
27538
27648
  var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27539
27649
  var _b, _c, _d;
27540
- var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
27650
+ var checkout = _a.checkout, queryParams = _a.queryParams;
27541
27651
  var router$1 = router.useRouter();
27542
- var vm = React.useState(function () {
27543
- return new CheckoutViewModel(checkout, queryParams, router$1, returnPolicy, privacyPolicy, termsOfService);
27544
- })[0];
27652
+ var vm = React.useState(function () { return new CheckoutViewModel(checkout, queryParams, router$1); })[0];
27545
27653
  React.useEffect(function () {
27546
27654
  Analytics.beginCheckout(vm.checkout);
27547
27655
  Analytics.checkoutStep(vm.checkout, vm.step);
@@ -27566,18 +27674,46 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
27566
27674
  var onPolicyModalClose = function () {
27567
27675
  setPolicyModalText("");
27568
27676
  };
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
- };
27677
+ var onReturnPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27678
+ var _a, _b;
27679
+ return __generator(this, function (_c) {
27680
+ switch (_c.label) {
27681
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27682
+ case 1:
27683
+ _c.sent();
27684
+ console.log((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.returnPolicy);
27685
+ setPolicyModalTitle("Para İade Politikası");
27686
+ setPolicyModalText(((_b = vm.storefrontRegion) === null || _b === void 0 ? void 0 : _b.returnPolicy) || "");
27687
+ return [2 /*return*/];
27688
+ }
27689
+ });
27690
+ }); };
27691
+ var onPrivacyPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27692
+ var _a;
27693
+ return __generator(this, function (_b) {
27694
+ switch (_b.label) {
27695
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27696
+ case 1:
27697
+ _b.sent();
27698
+ setPolicyModalTitle("Gizlilik Politikası");
27699
+ setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.privacyPolicy) || "");
27700
+ return [2 /*return*/];
27701
+ }
27702
+ });
27703
+ }); };
27704
+ var onTermsOfServiceClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27705
+ var _a;
27706
+ return __generator(this, function (_b) {
27707
+ switch (_b.label) {
27708
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27709
+ case 1:
27710
+ _b.sent();
27711
+ setPolicyModalTitle("Hizmet Şartları");
27712
+ setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.termsOfService) || "");
27713
+ return [2 /*return*/];
27714
+ }
27715
+ });
27716
+ }); };
27581
27717
  var onErrorClose = function () {
27582
27718
  vm.error = undefined;
27583
27719
  };
@@ -28197,263 +28333,6 @@ var index = /*#__PURE__*/Object.freeze({
28197
28333
  Image: Image
28198
28334
  });
28199
28335
 
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
28336
  var Page = function (_a) {
28458
28337
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28459
28338
  var router$1 = router.useRouter();
@@ -28461,10 +28340,17 @@ var Page = function (_a) {
28461
28340
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28462
28341
  };
28463
28342
  var getStaticProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28343
+ var theme, provider;
28464
28344
  return __generator(this, function (_a) {
28465
28345
  switch (_a.label) {
28466
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.INDEX)];
28467
- case 1: return [2 /*return*/, _a.sent()];
28346
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28347
+ case 1:
28348
+ theme = _a.sent();
28349
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.INDEX);
28350
+ return [4 /*yield*/, provider.getPageData()];
28351
+ case 2:
28352
+ _a.sent();
28353
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28468
28354
  }
28469
28355
  });
28470
28356
  }); };
@@ -28506,7 +28392,6 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28506
28392
  productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === exports.IkasHTMLMetaDataTargetType.PRODUCT; });
28507
28393
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
28508
28394
  productIdList: productMetaData.map(function (p) { return p.targetId; }),
28509
- priceListId: IkasStorefrontConfig.priceListId,
28510
28395
  })];
28511
28396
  case 2:
28512
28397
  productsResponse = _b.sent();
@@ -28553,10 +28438,25 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28553
28438
  });
28554
28439
  }); };
28555
28440
  var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28441
+ var theme, provider;
28556
28442
  return __generator(this, function (_a) {
28557
28443
  switch (_a.label) {
28558
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context)];
28559
- case 1: return [2 /*return*/, _a.sent()];
28444
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28445
+ case 1:
28446
+ theme = _a.sent();
28447
+ provider = new IkasPageDataProvider(theme, context.params, undefined);
28448
+ return [4 /*yield*/, provider.getPageData()];
28449
+ case 2:
28450
+ _a.sent();
28451
+ if (!provider.page) {
28452
+ return [2 /*return*/, {
28453
+ notFound: true,
28454
+ }];
28455
+ }
28456
+ return [2 /*return*/, {
28457
+ props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
28458
+ revalidate: 60,
28459
+ }];
28560
28460
  }
28561
28461
  });
28562
28462
  }); };
@@ -28601,38 +28501,19 @@ var Page$2 = function (_a) {
28601
28501
  return (React.createElement(IkasPage, { page: page, settingsStr: settingsStr, propValues: propValues }));
28602
28502
  };
28603
28503
  var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28604
- var allSettings, customPagePaths;
28504
+ var theme, customPages, customPagePaths;
28605
28505
  return __generator(this, function (_a) {
28606
28506
  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); }))];
28507
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28614
28508
  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
- });
28509
+ theme = _a.sent();
28510
+ customPages = theme.pages.filter(function (p) { return p.type === exports.IkasThemePageType.CUSTOM; });
28511
+ customPagePaths = customPages.map(function (p) { return ({
28512
+ slug: p.slug,
28513
+ }); });
28632
28514
  return [2 /*return*/, {
28633
28515
  paths: customPagePaths.map(function (p) { return ({
28634
- params: p.params,
28635
- locale: p.locale,
28516
+ params: p,
28636
28517
  }); }),
28637
28518
  fallback: "blocking",
28638
28519
  }];
@@ -28640,10 +28521,17 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
28640
28521
  });
28641
28522
  }); };
28642
28523
  var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28524
+ var theme, provider;
28643
28525
  return __generator(this, function (_a) {
28644
28526
  switch (_a.label) {
28645
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.CUSTOM)];
28646
- case 1: return [2 /*return*/, _a.sent()];
28527
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28528
+ case 1:
28529
+ theme = _a.sent();
28530
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.CUSTOM);
28531
+ return [4 /*yield*/, provider.getPageData()];
28532
+ case 2:
28533
+ _a.sent();
28534
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28647
28535
  }
28648
28536
  });
28649
28537
  }); };
@@ -28656,36 +28544,18 @@ var _slug_ = /*#__PURE__*/Object.freeze({
28656
28544
  });
28657
28545
 
28658
28546
  var CheckoutPage = function (_a) {
28659
- var checkoutStr = _a.checkoutStr, others = __rest(_a, ["checkoutStr"]);
28547
+ var checkoutStr = _a.checkoutStr, queryParams = _a.queryParams;
28660
28548
  Analytics.disableHTML();
28661
28549
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
28662
- return React.createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
28550
+ return React.createElement(IkasCheckoutPage, { checkout: checkout, queryParams: queryParams });
28663
28551
  };
28664
28552
  var _id_ = mobxReactLite.observer(CheckoutPage);
28665
28553
  var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28666
- var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
28554
+ var id, redirect, checkout;
28667
28555
  return __generator(this, function (_a) {
28668
28556
  switch (_a.label) {
28669
28557
  case 0:
28670
28558
  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
28559
  redirect = function () {
28690
28560
  context.res.writeHead(302, { Location: "/" });
28691
28561
  context.res.end();
@@ -28695,15 +28565,12 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
28695
28565
  return [2 /*return*/, redirect()];
28696
28566
  }
28697
28567
  return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
28698
- case 2:
28568
+ case 1:
28699
28569
  checkout = _a.sent();
28700
28570
  if (checkout) {
28701
28571
  return [2 /*return*/, {
28702
28572
  props: {
28703
28573
  checkoutStr: JSON.stringify(checkout),
28704
- returnPolicy: themeLocalization.returnPolicy || "",
28705
- privacyPolicy: themeLocalization.privacyPolicy || "",
28706
- termsOfService: themeLocalization.termsOfService || "",
28707
28574
  queryParams: context.query,
28708
28575
  },
28709
28576
  }];
@@ -28728,10 +28595,17 @@ var Page$3 = function (_a) {
28728
28595
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28729
28596
  };
28730
28597
  var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28598
+ var theme, provider;
28731
28599
  return __generator(this, function (_a) {
28732
28600
  switch (_a.label) {
28733
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ACCOUNT)];
28734
- case 1: return [2 /*return*/, _a.sent()];
28601
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28602
+ case 1:
28603
+ theme = _a.sent();
28604
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ACCOUNT);
28605
+ return [4 /*yield*/, provider.getPageData()];
28606
+ case 2:
28607
+ _a.sent();
28608
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28735
28609
  }
28736
28610
  });
28737
28611
  }); };
@@ -28749,10 +28623,17 @@ var Page$4 = function (_a) {
28749
28623
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28750
28624
  };
28751
28625
  var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28626
+ var theme, provider;
28752
28627
  return __generator(this, function (_a) {
28753
28628
  switch (_a.label) {
28754
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ADDRESSES)];
28755
- case 1: return [2 /*return*/, _a.sent()];
28629
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28630
+ case 1:
28631
+ theme = _a.sent();
28632
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ADDRESSES);
28633
+ return [4 /*yield*/, provider.getPageData()];
28634
+ case 2:
28635
+ _a.sent();
28636
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28756
28637
  }
28757
28638
  });
28758
28639
  }); };
@@ -28770,10 +28651,17 @@ var Page$5 = function (_a) {
28770
28651
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28771
28652
  };
28772
28653
  var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28654
+ var theme, provider;
28773
28655
  return __generator(this, function (_a) {
28774
28656
  switch (_a.label) {
28775
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.ORDERS)];
28776
- case 1: return [2 /*return*/, _a.sent()];
28657
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28658
+ case 1:
28659
+ theme = _a.sent();
28660
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ORDERS);
28661
+ return [4 /*yield*/, provider.getPageData()];
28662
+ case 2:
28663
+ _a.sent();
28664
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28777
28665
  }
28778
28666
  });
28779
28667
  }); };
@@ -28791,10 +28679,17 @@ var Page$6 = function (_a) {
28791
28679
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28792
28680
  };
28793
28681
  var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28682
+ var theme, provider;
28794
28683
  return __generator(this, function (_a) {
28795
28684
  switch (_a.label) {
28796
- case 0: return [4 /*yield*/, SettingsHelper.getServerSideProps(context, exports.IkasThemePageType.ORDER_DETAIL)];
28797
- case 1: return [2 /*return*/, _a.sent()];
28685
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28686
+ case 1:
28687
+ theme = _a.sent();
28688
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.ORDER_DETAIL);
28689
+ return [4 /*yield*/, provider.getPageData()];
28690
+ case 2:
28691
+ _a.sent();
28692
+ return [2 /*return*/, provider.nextPageData];
28798
28693
  }
28799
28694
  });
28800
28695
  }); };
@@ -28812,10 +28707,17 @@ var Page$7 = function (_a) {
28812
28707
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28813
28708
  };
28814
28709
  var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28710
+ var theme, provider;
28815
28711
  return __generator(this, function (_a) {
28816
28712
  switch (_a.label) {
28817
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.LOGIN)];
28818
- case 1: return [2 /*return*/, _a.sent()];
28713
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28714
+ case 1:
28715
+ theme = _a.sent();
28716
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.LOGIN);
28717
+ return [4 /*yield*/, provider.getPageData()];
28718
+ case 2:
28719
+ _a.sent();
28720
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28819
28721
  }
28820
28722
  });
28821
28723
  }); };
@@ -28833,10 +28735,17 @@ var Page$8 = function (_a) {
28833
28735
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28834
28736
  };
28835
28737
  var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28738
+ var theme, provider;
28836
28739
  return __generator(this, function (_a) {
28837
28740
  switch (_a.label) {
28838
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.REGISTER)];
28839
- case 1: return [2 /*return*/, _a.sent()];
28741
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28742
+ case 1:
28743
+ theme = _a.sent();
28744
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.REGISTER);
28745
+ return [4 /*yield*/, provider.getPageData()];
28746
+ case 2:
28747
+ _a.sent();
28748
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28840
28749
  }
28841
28750
  });
28842
28751
  }); };
@@ -28854,10 +28763,17 @@ var Page$9 = function (_a) {
28854
28763
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28855
28764
  };
28856
28765
  var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28766
+ var theme, provider;
28857
28767
  return __generator(this, function (_a) {
28858
28768
  switch (_a.label) {
28859
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FORGOT_PASSWORD)];
28860
- case 1: return [2 /*return*/, _a.sent()];
28769
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28770
+ case 1:
28771
+ theme = _a.sent();
28772
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FORGOT_PASSWORD);
28773
+ return [4 /*yield*/, provider.getPageData()];
28774
+ case 2:
28775
+ _a.sent();
28776
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28861
28777
  }
28862
28778
  });
28863
28779
  }); };
@@ -28875,10 +28791,17 @@ var Page$a = function (_a) {
28875
28791
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28876
28792
  };
28877
28793
  var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28794
+ var theme, provider;
28878
28795
  return __generator(this, function (_a) {
28879
28796
  switch (_a.label) {
28880
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.RECOVER_PASSWORD)];
28881
- case 1: return [2 /*return*/, _a.sent()];
28797
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28798
+ case 1:
28799
+ theme = _a.sent();
28800
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.RECOVER_PASSWORD);
28801
+ return [4 /*yield*/, provider.getPageData()];
28802
+ case 2:
28803
+ _a.sent();
28804
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28882
28805
  }
28883
28806
  });
28884
28807
  }); };
@@ -28900,10 +28823,17 @@ var Page$b = function (_a) {
28900
28823
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28901
28824
  };
28902
28825
  var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28826
+ var theme, provider;
28903
28827
  return __generator(this, function (_a) {
28904
28828
  switch (_a.label) {
28905
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.CART)];
28906
- case 1: return [2 /*return*/, _a.sent()];
28829
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28830
+ case 1:
28831
+ theme = _a.sent();
28832
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.CART);
28833
+ return [4 /*yield*/, provider.getPageData()];
28834
+ case 2:
28835
+ _a.sent();
28836
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28907
28837
  }
28908
28838
  });
28909
28839
  }); };
@@ -28932,10 +28862,17 @@ var Page$d = function (_a) {
28932
28862
  return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28933
28863
  };
28934
28864
  var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28865
+ var theme, provider;
28935
28866
  return __generator(this, function (_a) {
28936
28867
  switch (_a.label) {
28937
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FAVORITE_PRODUCTS)];
28938
- case 1: return [2 /*return*/, _a.sent()];
28868
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28869
+ case 1:
28870
+ theme = _a.sent();
28871
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.FAVORITE_PRODUCTS);
28872
+ return [4 /*yield*/, provider.getPageData()];
28873
+ case 2:
28874
+ _a.sent();
28875
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28939
28876
  }
28940
28877
  });
28941
28878
  }); };
@@ -28961,10 +28898,17 @@ var Page$e = function (_a) {
28961
28898
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28962
28899
  };
28963
28900
  var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28901
+ var theme, provider;
28964
28902
  return __generator(this, function (_a) {
28965
28903
  switch (_a.label) {
28966
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.SEARCH)];
28967
- case 1: return [2 /*return*/, _a.sent()];
28904
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28905
+ case 1:
28906
+ theme = _a.sent();
28907
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.SEARCH);
28908
+ return [4 /*yield*/, provider.getPageData()];
28909
+ case 2:
28910
+ _a.sent();
28911
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28968
28912
  }
28969
28913
  });
28970
28914
  }); };
@@ -28977,27 +28921,22 @@ var search = /*#__PURE__*/Object.freeze({
28977
28921
 
28978
28922
  var Page$f = function (_a) {
28979
28923
  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
28924
  var router$1 = router.useRouter();
28983
28925
  var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
28984
28926
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28985
28927
  };
28986
28928
  var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28987
- var props;
28929
+ var theme, provider;
28988
28930
  return __generator(this, function (_a) {
28989
28931
  switch (_a.label) {
28990
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.NOT_FOUND)];
28932
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28991
28933
  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];
28934
+ theme = _a.sent();
28935
+ provider = new IkasPageDataProvider(theme, context.params, exports.IkasThemePageType.NOT_FOUND);
28936
+ return [4 /*yield*/, provider.getPageData()];
28937
+ case 2:
28938
+ _a.sent();
28939
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
29001
28940
  }
29002
28941
  });
29003
28942
  }); };
@@ -29097,8 +29036,10 @@ exports.IkasProductSearchAPI = IkasProductSearchAPI;
29097
29036
  exports.IkasProductVariant = IkasProductVariant;
29098
29037
  exports.IkasProductVariantType = IkasProductVariantType;
29099
29038
  exports.IkasStateAPI = IkasStateAPI;
29039
+ exports.IkasStorefrontAPI = IkasStorefrontAPI;
29100
29040
  exports.IkasStorefrontConfig = IkasStorefrontConfig;
29101
29041
  exports.IkasTheme = IkasTheme;
29042
+ exports.IkasThemeAPI = IkasThemeAPI;
29102
29043
  exports.IkasThemeComponent = IkasThemeComponent;
29103
29044
  exports.IkasThemeComponentProp = IkasThemeComponentProp;
29104
29045
  exports.IkasThemeCustomData = IkasThemeCustomData;