@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.es.js CHANGED
@@ -1,14 +1,13 @@
1
1
  import { makeAutoObservable, toJS, runInAction, reaction, makeObservable, computed, observable, action, configure } from 'mobx';
2
- import React, { createElement, Fragment, useState, useEffect, useCallback, useRef, useMemo } from 'react';
2
+ import fs from 'fs';
3
3
  import getConfig from 'next/config';
4
+ import React, { createElement, Fragment, useState, useEffect, useCallback, useRef, useMemo } from 'react';
4
5
  import { observer } from 'mobx-react-lite';
5
6
  import { useRouter } from 'next/router';
6
7
  import Image$1 from 'next/image';
7
8
  import Link from 'next/link';
8
9
  import Head from 'next/head';
9
- import fs from 'fs';
10
10
  import dynamic from 'next/dynamic';
11
- import Error$1 from 'next/error';
12
11
 
13
12
  /*! *****************************************************************************
14
13
  Copyright (c) Microsoft Corporation.
@@ -11004,7 +11003,6 @@ var IkasProductDetailPropValueProvider = /** @class */ (function () {
11004
11003
  return [2 /*return*/, null];
11005
11004
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
11006
11005
  productIdList: [this.productDetailPropValue.productId],
11007
- priceListId: IkasStorefrontConfig.priceListId,
11008
11006
  })];
11009
11007
  case 1:
11010
11008
  productSearchResponse = _b.sent();
@@ -12034,7 +12032,6 @@ var IkasPageDataProvider = /** @class */ (function () {
12034
12032
  return [2 /*return*/];
12035
12033
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
12036
12034
  productIdList: [metaDataResponse.metaData.targetId],
12037
- priceListId: IkasStorefrontConfig.priceListId,
12038
12035
  })];
12039
12036
  case 2:
12040
12037
  productsResponse = _b.sent();
@@ -12793,10 +12790,6 @@ var IkasCart = /** @class */ (function () {
12793
12790
  : [];
12794
12791
  this.merchantId = data.merchantId || "";
12795
12792
  this.totalPrice = data.totalPrice || 0;
12796
- this.salesChannelId = data.salesChannelId || "";
12797
- this.storefrontId = data.storefrontId || null;
12798
- this.storefrontRoutingId = data.storefrontRoutingId || null;
12799
- this.storefrontThemeId = data.storefrontThemeId || null;
12800
12793
  makeAutoObservable(this);
12801
12794
  }
12802
12795
  Object.defineProperty(IkasCart.prototype, "totalTax", {
@@ -15824,7 +15817,7 @@ var MAX_CVC_LENGTH = 4;
15824
15817
  var USE_DIFFERENT_ADDRESS_KEY = "sAddr";
15825
15818
  var isServer$1 = typeof localStorage === "undefined";
15826
15819
  var CheckoutViewModel = /** @class */ (function () {
15827
- function CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService) {
15820
+ function CheckoutViewModel(checkout, queryParams, router) {
15828
15821
  var _this = this;
15829
15822
  this.checkout = new IkasCheckout();
15830
15823
  this.storefront = null;
@@ -15930,7 +15923,7 @@ var CheckoutViewModel = /** @class */ (function () {
15930
15923
  variantId: i.variant.id,
15931
15924
  productId: i.variant.productId,
15932
15925
  }); });
15933
- return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, IkasStorefrontConfig.stockLocationIds || [])];
15926
+ return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines)];
15934
15927
  case 1:
15935
15928
  result = _b.sent();
15936
15929
  if (!result) {
@@ -15943,7 +15936,7 @@ var CheckoutViewModel = /** @class */ (function () {
15943
15936
  data = unavailableItems.map(function (item) { return ({
15944
15937
  variant: _this.cart.items.find(function (i) { return i.variant.id === item.variantId; })
15945
15938
  .variant,
15946
- availableQuantity: item.stockCount,
15939
+ availableQuantity: item.availableQuantity,
15947
15940
  }); });
15948
15941
  throw {
15949
15942
  type: ErrorType.STOCK_ERROR,
@@ -15960,7 +15953,7 @@ var CheckoutViewModel = /** @class */ (function () {
15960
15953
  switch (_b.label) {
15961
15954
  case 0:
15962
15955
  _a = this;
15963
- return [4 /*yield*/, IkasCountryAPI.listShippingCountries(IkasStorefrontConfig.storefrontId)];
15956
+ return [4 /*yield*/, IkasCountryAPI.listShippingCountries()];
15964
15957
  case 1:
15965
15958
  _a.shippingCountryIds = _b.sent();
15966
15959
  return [2 /*return*/];
@@ -16036,6 +16029,30 @@ var CheckoutViewModel = /** @class */ (function () {
16036
16029
  }
16037
16030
  });
16038
16031
  }); };
16032
+ this.getStorefront = function () { return __awaiter(_this, void 0, void 0, function () {
16033
+ var storefront;
16034
+ return __generator(this, function (_a) {
16035
+ switch (_a.label) {
16036
+ case 0:
16037
+ if (!IkasStorefrontConfig.config.storefrontId || !!this.storefront)
16038
+ return [2 /*return*/];
16039
+ _a.label = 1;
16040
+ case 1:
16041
+ _a.trys.push([1, 3, , 4]);
16042
+ return [4 /*yield*/, IkasStorefrontAPI.getStorefront(IkasStorefrontConfig.config.storefrontId)];
16043
+ case 2:
16044
+ storefront = _a.sent();
16045
+ if (storefront) {
16046
+ this.storefront = storefront;
16047
+ }
16048
+ return [3 /*break*/, 4];
16049
+ case 3:
16050
+ _a.sent();
16051
+ return [3 /*break*/, 4];
16052
+ case 4: return [2 /*return*/];
16053
+ }
16054
+ });
16055
+ }); };
16039
16056
  this.createCustomer = function () {
16040
16057
  if (_this.customerStore.customer) {
16041
16058
  _this.checkout.customer = _this.customerStore.customer;
@@ -16055,7 +16072,7 @@ var CheckoutViewModel = /** @class */ (function () {
16055
16072
  _this.checkout.billingAddress || new IkasOrderAddress();
16056
16073
  }
16057
16074
  else {
16058
- _this.checkout.billingAddress = _this.checkout.shippingAddress;
16075
+ _this.checkout.billingAddress = new IkasOrderAddress(cloneDeep_1(_this.checkout.shippingAddress) || {});
16059
16076
  }
16060
16077
  }
16061
16078
  };
@@ -16167,7 +16184,7 @@ var CheckoutViewModel = /** @class */ (function () {
16167
16184
  _this.router.push("/");
16168
16185
  };
16169
16186
  this.onProceedToShippingClick = function () { return __awaiter(_this, void 0, void 0, function () {
16170
- var newAddress, customer, err_2;
16187
+ var newAddress, customer, err_3;
16171
16188
  return __generator(this, function (_a) {
16172
16189
  switch (_a.label) {
16173
16190
  case 0:
@@ -16197,12 +16214,12 @@ var CheckoutViewModel = /** @class */ (function () {
16197
16214
  this.changeStep(CheckoutStep.SHIPPING);
16198
16215
  return [3 /*break*/, 7];
16199
16216
  case 6:
16200
- err_2 = _a.sent();
16201
- if (err_2.type) {
16202
- this.error = err_2;
16217
+ err_3 = _a.sent();
16218
+ if (err_3.type) {
16219
+ this.error = err_3;
16203
16220
  }
16204
16221
  else {
16205
- console.log(err_2);
16222
+ console.log(err_3);
16206
16223
  this.error = {
16207
16224
  type: ErrorType.UNKNOWN,
16208
16225
  };
@@ -16214,7 +16231,7 @@ var CheckoutViewModel = /** @class */ (function () {
16214
16231
  });
16215
16232
  }); };
16216
16233
  this.onProceedToPaymentClick = function () { return __awaiter(_this, void 0, void 0, function () {
16217
- var err_3;
16234
+ var err_4;
16218
16235
  return __generator(this, function (_a) {
16219
16236
  switch (_a.label) {
16220
16237
  case 0:
@@ -16234,12 +16251,12 @@ var CheckoutViewModel = /** @class */ (function () {
16234
16251
  this.changeStep(CheckoutStep.PAYMENT);
16235
16252
  return [3 /*break*/, 4];
16236
16253
  case 3:
16237
- err_3 = _a.sent();
16238
- if (err_3.type) {
16239
- this.error = err_3;
16254
+ err_4 = _a.sent();
16255
+ if (err_4.type) {
16256
+ this.error = err_4;
16240
16257
  }
16241
16258
  else {
16242
- console.log(err_3);
16259
+ console.log(err_4);
16243
16260
  this.error = {
16244
16261
  type: ErrorType.UNKNOWN,
16245
16262
  };
@@ -16251,7 +16268,7 @@ var CheckoutViewModel = /** @class */ (function () {
16251
16268
  });
16252
16269
  }); };
16253
16270
  this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
16254
- var response, transactionStatus, err_4;
16271
+ var response, transactionStatus, err_5;
16255
16272
  return __generator(this, function (_a) {
16256
16273
  switch (_a.label) {
16257
16274
  case 0:
@@ -16282,6 +16299,7 @@ var CheckoutViewModel = /** @class */ (function () {
16282
16299
  IkasTransactionStatusEnum.SUCCESS,
16283
16300
  IkasTransactionStatusEnum.AUTHORIZED,
16284
16301
  ].includes(transactionStatus)) {
16302
+ localStorage.removeItem(USE_DIFFERENT_ADDRESS_KEY);
16285
16303
  this.changeStep(CheckoutStep.SUCCESS);
16286
16304
  }
16287
16305
  else if (transactionStatus === IkasTransactionStatusEnum.PENDING &&
@@ -16297,10 +16315,10 @@ var CheckoutViewModel = /** @class */ (function () {
16297
16315
  }
16298
16316
  return [3 /*break*/, 6];
16299
16317
  case 5:
16300
- err_4 = _a.sent();
16301
- if (err_4.type) {
16302
- console.log(err_4);
16303
- this.error = err_4;
16318
+ err_5 = _a.sent();
16319
+ if (err_5.type) {
16320
+ console.log(err_5);
16321
+ this.error = err_5;
16304
16322
  }
16305
16323
  else {
16306
16324
  this.error = {
@@ -16379,9 +16397,6 @@ var CheckoutViewModel = /** @class */ (function () {
16379
16397
  }); };
16380
16398
  this.checkout = checkout;
16381
16399
  this.router = router;
16382
- this.returnPolicy = returnPolicy;
16383
- this.privacyPolicy = privacyPolicy;
16384
- this.termsOfService = termsOfService;
16385
16400
  this.init(queryParams);
16386
16401
  makeAutoObservable(this);
16387
16402
  }
@@ -16392,6 +16407,15 @@ var CheckoutViewModel = /** @class */ (function () {
16392
16407
  enumerable: false,
16393
16408
  configurable: true
16394
16409
  });
16410
+ Object.defineProperty(CheckoutViewModel.prototype, "storefrontRegion", {
16411
+ get: function () {
16412
+ var _a;
16413
+ return ((_a = this.storefront) === null || _a === void 0 ? void 0 : _a.regions.length) ? this.storefront.regions[0]
16414
+ : undefined;
16415
+ },
16416
+ enumerable: false,
16417
+ configurable: true
16418
+ });
16395
16419
  Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGatewayIndex", {
16396
16420
  get: function () {
16397
16421
  var _this = this;
@@ -17055,7 +17079,6 @@ var IkasCustomerStore = /** @class */ (function () {
17055
17079
  return [2 /*return*/, []];
17056
17080
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
17057
17081
  productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
17058
- priceListId: IkasStorefrontConfig.priceListId,
17059
17082
  })];
17060
17083
  case 2:
17061
17084
  productsResult = _b.sent();
@@ -21913,10 +21936,7 @@ var IkasProductList = /** @class */ (function () {
21913
21936
  Object.defineProperty(IkasProductList.prototype, "isFiltered", {
21914
21937
  get: function () {
21915
21938
  var _a;
21916
- return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) ||
21917
- !!this._searchKeyword ||
21918
- (this._pageType !== IkasThemePageType.CATEGORY &&
21919
- !!this._filterCategoryId));
21939
+ return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) || !!this._searchKeyword);
21920
21940
  },
21921
21941
  enumerable: false,
21922
21942
  configurable: true
@@ -21979,20 +21999,13 @@ var IkasProductList = /** @class */ (function () {
21979
21999
  });
21980
22000
  Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
21981
22001
  get: function () {
21982
- var _this = this;
21983
- var _a, _b, _c;
22002
+ var _a;
21984
22003
  var queryParams = {};
21985
22004
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
21986
22005
  queryParams[f.key] = f.keyList;
21987
22006
  });
21988
22007
  if (this._searchKeyword)
21989
22008
  queryParams.s = this._searchKeyword;
21990
- if (this._pageType !== IkasThemePageType.CATEGORY &&
21991
- this._filterCategoryId) {
21992
- 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;
21993
- if (slug)
21994
- queryParams.c = slug;
21995
- }
21996
22009
  return queryString.stringify(queryParams, { arrayFormat: "comma" });
21997
22010
  },
21998
22011
  enumerable: false,
@@ -22047,7 +22060,6 @@ var IkasProductList = /** @class */ (function () {
22047
22060
  categoryIdList: this._filterCategoryId
22048
22061
  ? [this._filterCategoryId]
22049
22062
  : undefined,
22050
- priceListId: IkasStorefrontConfig.priceListId,
22051
22063
  query: this._searchKeyword,
22052
22064
  })];
22053
22065
  case 1: return [2 /*return*/, _c.sent()];
@@ -22075,7 +22087,6 @@ var IkasProductList = /** @class */ (function () {
22075
22087
  };
22076
22088
  IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
22077
22089
  var _this = this;
22078
- var _a;
22079
22090
  try {
22080
22091
  queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
22081
22092
  var _a;
@@ -22087,15 +22098,6 @@ var IkasProductList = /** @class */ (function () {
22087
22098
  var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
22088
22099
  if (querySearch)
22089
22100
  this._searchKeyword = querySearch;
22090
- if (this._pageType !== IkasThemePageType.CATEGORY) {
22091
- var queryCategory_1 = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("c");
22092
- if (queryCategory_1) {
22093
- var filterCategory = (_a = this.filterCategories) === null || _a === void 0 ? void 0 : _a.find(function (fc) { return fc.slug === queryCategory_1; });
22094
- if (filterCategory) {
22095
- this._filterCategoryId = filterCategory.id;
22096
- }
22097
- }
22098
- }
22099
22101
  }
22100
22102
  catch (err) {
22101
22103
  console.log(err);
@@ -22142,32 +22144,12 @@ var IkasProductList = /** @class */ (function () {
22142
22144
  var _a;
22143
22145
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
22144
22146
  this._searchKeyword = "";
22145
- if (this._pageType !== IkasThemePageType.CATEGORY) {
22146
- this._filterCategoryId = undefined;
22147
- }
22148
22147
  this.applyFilters();
22149
22148
  };
22150
- IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
22149
+ IkasProductList.prototype.onFilterCategoryClick = function (filterCategory) {
22151
22150
  var _a;
22152
- if (disableRoute === void 0) { disableRoute = false; }
22153
- return __awaiter(this, void 0, void 0, function () {
22154
- return __generator(this, function (_b) {
22155
- switch (_b.label) {
22156
- case 0:
22157
- if (!disableRoute) return [3 /*break*/, 2];
22158
- this._filterCategoryId = filterCategory.id;
22159
- return [4 /*yield*/, this.applyFilters()];
22160
- case 1:
22161
- _b.sent();
22162
- return [3 /*break*/, 3];
22163
- case 2:
22164
- (_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
22165
- (this.filterQueryParams ? "?" + this.filterQueryParams : ""));
22166
- _b.label = 3;
22167
- case 3: return [2 /*return*/];
22168
- }
22169
- });
22170
- });
22151
+ (_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
22152
+ (this.filterQueryParams ? "?" + this.filterQueryParams : ""));
22171
22153
  };
22172
22154
  IkasProductList.prototype.toJSON = function () {
22173
22155
  return {
@@ -24255,7 +24237,7 @@ var IkasCartAPI = /** @class */ (function () {
24255
24237
  return __generator(this, function (_b) {
24256
24238
  switch (_b.label) {
24257
24239
  case 0:
24258
- 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 "])));
24240
+ 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 "])));
24259
24241
  _b.label = 1;
24260
24242
  case 1:
24261
24243
  _b.trys.push([1, 3, , 4]);
@@ -24290,7 +24272,7 @@ var IkasCartAPI = /** @class */ (function () {
24290
24272
  return __generator(this, function (_b) {
24291
24273
  switch (_b.label) {
24292
24274
  case 0:
24293
- 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 "])));
24275
+ 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 "])));
24294
24276
  _b.label = 1;
24295
24277
  case 1:
24296
24278
  _b.trys.push([1, 3, , 4]);
@@ -24762,13 +24744,13 @@ var IkasCheckoutAPI = /** @class */ (function () {
24762
24744
  });
24763
24745
  });
24764
24746
  };
24765
- IkasCheckoutAPI.checkStocks = function (lines, stockLocationIdList) {
24747
+ IkasCheckoutAPI.checkStocks = function (lines) {
24766
24748
  return __awaiter(this, void 0, void 0, function () {
24767
24749
  var QUERY, _a, data, errors, err_7;
24768
24750
  return __generator(this, function (_b) {
24769
24751
  switch (_b.label) {
24770
24752
  case 0:
24771
- 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 "])));
24753
+ 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 "])));
24772
24754
  _b.label = 1;
24773
24755
  case 1:
24774
24756
  _b.trys.push([1, 3, , 4]);
@@ -24778,7 +24760,6 @@ var IkasCheckoutAPI = /** @class */ (function () {
24778
24760
  query: QUERY,
24779
24761
  variables: {
24780
24762
  lines: lines,
24781
- stockLocationIdList: stockLocationIdList,
24782
24763
  },
24783
24764
  })];
24784
24765
  case 2:
@@ -24890,13 +24871,13 @@ var IkasCountryAPI = /** @class */ (function () {
24890
24871
  });
24891
24872
  });
24892
24873
  };
24893
- IkasCountryAPI.listShippingCountries = function (storefrontId) {
24874
+ IkasCountryAPI.listShippingCountries = function () {
24894
24875
  return __awaiter(this, void 0, void 0, function () {
24895
24876
  var QUERY, _a, data, errors, err_2;
24896
24877
  return __generator(this, function (_b) {
24897
24878
  switch (_b.label) {
24898
24879
  case 0:
24899
- 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 "])));
24880
+ QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "], ["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "])));
24900
24881
  _b.label = 1;
24901
24882
  case 1:
24902
24883
  _b.trys.push([1, 3, , 4]);
@@ -24904,9 +24885,6 @@ var IkasCountryAPI = /** @class */ (function () {
24904
24885
  .getClient()
24905
24886
  .query({
24906
24887
  query: QUERY,
24907
- variables: {
24908
- storefrontId: storefrontId,
24909
- },
24910
24888
  })];
24911
24889
  case 2:
24912
24890
  _a = _b.sent(), data = _a.data, errors = _a.errors;
@@ -25900,6 +25878,150 @@ var IkasStateAPI = /** @class */ (function () {
25900
25878
  }());
25901
25879
  var templateObject_1$e;
25902
25880
 
25881
+ var IkasStorefrontDomain = /** @class */ (function () {
25882
+ function IkasStorefrontDomain(data) {
25883
+ if (data === void 0) { data = {}; }
25884
+ this.id = data.id || "";
25885
+ this.merchantDomainId = data.merchantDomainId || "";
25886
+ this.name = data.name || "";
25887
+ this.redirectDomainName = data.redirectDomainName || null;
25888
+ makeAutoObservable(this);
25889
+ }
25890
+ return IkasStorefrontDomain;
25891
+ }());
25892
+
25893
+ var IkasStorefrontLocation = /** @class */ (function () {
25894
+ function IkasStorefrontLocation(data) {
25895
+ if (data === void 0) { data = {}; }
25896
+ this.countryId = data.countryId || "";
25897
+ this.stateId = data.stateId || null;
25898
+ makeAutoObservable(this);
25899
+ }
25900
+ return IkasStorefrontLocation;
25901
+ }());
25902
+
25903
+ var IkasStorefrontRoute = /** @class */ (function () {
25904
+ function IkasStorefrontRoute(data) {
25905
+ if (data === void 0) { data = {}; }
25906
+ this.domainId = data.domainId || "";
25907
+ this.useSubPath = data.useSubPath || false;
25908
+ makeAutoObservable(this);
25909
+ }
25910
+ return IkasStorefrontRoute;
25911
+ }());
25912
+
25913
+ var IkasStorefrontRegion = /** @class */ (function () {
25914
+ function IkasStorefrontRegion(data) {
25915
+ if (data === void 0) { data = {}; }
25916
+ // Extra
25917
+ this.theme = new IkasTheme();
25918
+ this.id = data.id || "";
25919
+ this.locale = data.locale || "";
25920
+ this.themeJSON = data.themeJSON || "";
25921
+ this.shipping = data.shipping || null;
25922
+ this.paymentSettingsId = data.paymentSettingsId || null;
25923
+ this.priceListId = data.priceListId || null;
25924
+ this.locations = data.locations
25925
+ ? data.locations.map(function (o) { return new IkasStorefrontLocation(o); })
25926
+ : [];
25927
+ this.routes = data.routes
25928
+ ? data.routes.map(function (o) { return new IkasStorefrontRoute(o); })
25929
+ : null;
25930
+ this.termsOfService = data.termsOfService || "";
25931
+ this.privacyPolicy = data.privacyPolicy || "";
25932
+ this.returnPolicy = data.returnPolicy || "";
25933
+ try {
25934
+ this.theme = this.themeJSON
25935
+ ? new IkasTheme(JSON.parse(this.themeJSON))
25936
+ : new IkasTheme();
25937
+ }
25938
+ catch (err) { }
25939
+ makeAutoObservable(this);
25940
+ }
25941
+ return IkasStorefrontRegion;
25942
+ }());
25943
+
25944
+ var IkasStorefront = /** @class */ (function () {
25945
+ function IkasStorefront(data) {
25946
+ if (data === void 0) { data = {}; }
25947
+ this.id = data.id || "";
25948
+ this.name = data.name || "";
25949
+ this.themeId = data.themeId || "";
25950
+ this.themeVersionId = data.themeVersionId || "";
25951
+ this.userId = data.userId || "";
25952
+ this.domains = data.domains
25953
+ ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
25954
+ : [];
25955
+ this.regions = data.regions
25956
+ ? data.regions.map(function (o) { return new IkasStorefrontRegion(o); })
25957
+ : [];
25958
+ makeAutoObservable(this);
25959
+ }
25960
+ return IkasStorefront;
25961
+ }());
25962
+
25963
+ var IkasStorefrontAPI = /** @class */ (function () {
25964
+ function IkasStorefrontAPI() {
25965
+ }
25966
+ IkasStorefrontAPI.getStorefront = function (storefrontId) {
25967
+ return __awaiter(this, void 0, void 0, function () {
25968
+ var QUERY, _a, data, errors;
25969
+ return __generator(this, function (_b) {
25970
+ switch (_b.label) {
25971
+ case 0:
25972
+ 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 "])));
25973
+ _b.label = 1;
25974
+ case 1:
25975
+ _b.trys.push([1, 3, , 4]);
25976
+ return [4 /*yield*/, apollo
25977
+ .getClient()
25978
+ .query({
25979
+ query: QUERY,
25980
+ variables: {
25981
+ storefrontId: storefrontId,
25982
+ },
25983
+ })];
25984
+ case 2:
25985
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
25986
+ if (errors && errors.length) {
25987
+ console.log(errors);
25988
+ }
25989
+ if (data)
25990
+ return [2 /*return*/, new IkasStorefront(data.getStorefront)];
25991
+ return [3 /*break*/, 4];
25992
+ case 3:
25993
+ _b.sent();
25994
+ return [3 /*break*/, 4];
25995
+ case 4: return [2 /*return*/, new IkasStorefront()];
25996
+ }
25997
+ });
25998
+ });
25999
+ };
26000
+ return IkasStorefrontAPI;
26001
+ }());
26002
+ var templateObject_1$f;
26003
+
26004
+ var IkasThemeAPI = /** @class */ (function () {
26005
+ function IkasThemeAPI() {
26006
+ }
26007
+ IkasThemeAPI.fetchTheme = function () {
26008
+ return new Promise(function (resolve, reject) {
26009
+ var serverRuntimeConfig = getConfig().serverRuntimeConfig;
26010
+ var themeJSONPath = serverRuntimeConfig.THEME_JSON_PATH || "./src/theme.json";
26011
+ fs.readFile(themeJSONPath, {
26012
+ flag: "a+",
26013
+ }, function (err, file) {
26014
+ if (err) {
26015
+ return reject(err);
26016
+ }
26017
+ var result = file.length ? JSON.parse(file.toString()) : {};
26018
+ resolve(new IkasTheme(result));
26019
+ });
26020
+ });
26021
+ };
26022
+ return IkasThemeAPI;
26023
+ }());
26024
+
25903
26025
  var IkasVariantTypeAPI = /** @class */ (function () {
25904
26026
  function IkasVariantTypeAPI() {
25905
26027
  }
@@ -25909,7 +26031,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25909
26031
  return __generator(this, function (_b) {
25910
26032
  switch (_b.label) {
25911
26033
  case 0:
25912
- 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 "])));
26034
+ 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 "])));
25913
26035
  _b.label = 1;
25914
26036
  case 1:
25915
26037
  _b.trys.push([1, 3, , 4]);
@@ -25955,7 +26077,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25955
26077
  };
25956
26078
  return IkasVariantTypeAPI;
25957
26079
  }());
25958
- var templateObject_1$f;
26080
+ var templateObject_1$g;
25959
26081
 
25960
26082
  function styleInject(css, ref) {
25961
26083
  if ( ref === void 0 ) ref = {};
@@ -27145,11 +27267,6 @@ var IkasCartStore = /** @class */ (function () {
27145
27267
  name: product.name,
27146
27268
  },
27147
27269
  },
27148
- priceListId: IkasStorefrontConfig.priceListId || null,
27149
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27150
- storefrontId: IkasStorefrontConfig.storefrontId,
27151
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27152
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27153
27270
  };
27154
27271
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27155
27272
  case 1:
@@ -27190,11 +27307,6 @@ var IkasCartStore = /** @class */ (function () {
27190
27307
  name: item.variant.name,
27191
27308
  },
27192
27309
  },
27193
- priceListId: IkasStorefrontConfig.priceListId || null,
27194
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27195
- storefrontId: IkasStorefrontConfig.storefrontId,
27196
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27197
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27198
27310
  };
27199
27311
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27200
27312
  case 1:
@@ -27557,11 +27669,9 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27557
27669
 
27558
27670
  var IkasCheckoutPage = observer(function (_a) {
27559
27671
  var _b, _c, _d;
27560
- var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
27672
+ var checkout = _a.checkout, queryParams = _a.queryParams;
27561
27673
  var router = useRouter();
27562
- var vm = useState(function () {
27563
- return new CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService);
27564
- })[0];
27674
+ var vm = useState(function () { return new CheckoutViewModel(checkout, queryParams, router); })[0];
27565
27675
  useEffect(function () {
27566
27676
  Analytics.beginCheckout(vm.checkout);
27567
27677
  Analytics.checkoutStep(vm.checkout, vm.step);
@@ -27586,18 +27696,46 @@ var IkasCheckoutPage = observer(function (_a) {
27586
27696
  var onPolicyModalClose = function () {
27587
27697
  setPolicyModalText("");
27588
27698
  };
27589
- var onReturnPolicyClick = function () {
27590
- setPolicyModalTitle("Para İade Politikası");
27591
- setPolicyModalText(vm.returnPolicy);
27592
- };
27593
- var onPrivacyPolicyClick = function () {
27594
- setPolicyModalTitle("Gizlilik Politikası");
27595
- setPolicyModalText(vm.privacyPolicy);
27596
- };
27597
- var onTermsOfServiceClick = function () {
27598
- setPolicyModalTitle("Hizmet Şartları");
27599
- setPolicyModalText(vm.termsOfService);
27600
- };
27699
+ var onReturnPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27700
+ var _a, _b;
27701
+ return __generator(this, function (_c) {
27702
+ switch (_c.label) {
27703
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27704
+ case 1:
27705
+ _c.sent();
27706
+ console.log((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.returnPolicy);
27707
+ setPolicyModalTitle("Para İade Politikası");
27708
+ setPolicyModalText(((_b = vm.storefrontRegion) === null || _b === void 0 ? void 0 : _b.returnPolicy) || "");
27709
+ return [2 /*return*/];
27710
+ }
27711
+ });
27712
+ }); };
27713
+ var onPrivacyPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27714
+ var _a;
27715
+ return __generator(this, function (_b) {
27716
+ switch (_b.label) {
27717
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27718
+ case 1:
27719
+ _b.sent();
27720
+ setPolicyModalTitle("Gizlilik Politikası");
27721
+ setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.privacyPolicy) || "");
27722
+ return [2 /*return*/];
27723
+ }
27724
+ });
27725
+ }); };
27726
+ var onTermsOfServiceClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27727
+ var _a;
27728
+ return __generator(this, function (_b) {
27729
+ switch (_b.label) {
27730
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27731
+ case 1:
27732
+ _b.sent();
27733
+ setPolicyModalTitle("Hizmet Şartları");
27734
+ setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.termsOfService) || "");
27735
+ return [2 /*return*/];
27736
+ }
27737
+ });
27738
+ }); };
27601
27739
  var onErrorClose = function () {
27602
27740
  vm.error = undefined;
27603
27741
  };
@@ -28217,263 +28355,6 @@ var index = /*#__PURE__*/Object.freeze({
28217
28355
  Image: Image
28218
28356
  });
28219
28357
 
28220
- var IkasStorefrontLocalization = /** @class */ (function () {
28221
- function IkasStorefrontLocalization(data) {
28222
- this.id = data.id || "";
28223
- this.isDefault = data.isDefault || false;
28224
- this.locale = data.locale || "";
28225
- this.name = data.name || "";
28226
- }
28227
- return IkasStorefrontLocalization;
28228
- }());
28229
-
28230
- var IkasStorefrontDomain = /** @class */ (function () {
28231
- function IkasStorefrontDomain(data) {
28232
- if (data === void 0) { data = {}; }
28233
- this.id = data.id || "";
28234
- this.merchantDomainId = data.merchantDomainId || "";
28235
- this.name = data.name || "";
28236
- this.redirectDomainName = data.redirectDomainName || null;
28237
- this.isDefault = data.isDefault || false;
28238
- makeAutoObservable(this);
28239
- }
28240
- return IkasStorefrontDomain;
28241
- }());
28242
-
28243
- var IkasStorefrontRouting = /** @class */ (function () {
28244
- function IkasStorefrontRouting(data) {
28245
- this.id = data.id || "";
28246
- this.countryCodes = data.countryCodes || null;
28247
- this.domain = data.domain || null;
28248
- this.locale = data.locale || "";
28249
- this.path = data.path || null;
28250
- this.priceListId = data.priceListId || null;
28251
- }
28252
- return IkasStorefrontRouting;
28253
- }());
28254
-
28255
- var IkasStorefrontThemeStatus;
28256
- (function (IkasStorefrontThemeStatus) {
28257
- IkasStorefrontThemeStatus["WAITING"] = "WAITING";
28258
- IkasStorefrontThemeStatus["READY"] = "READY";
28259
- })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
28260
- var IkasStorefrontTheme = /** @class */ (function () {
28261
- function IkasStorefrontTheme(data) {
28262
- this.id = data.id || "";
28263
- this.isMainTheme = data.isMainTheme || false;
28264
- this.name = data.name || "";
28265
- this.status = data.status || IkasStorefrontThemeStatus.WAITING;
28266
- this.themeId = data.themeId || "";
28267
- this.themeVersionId = data.themeVersionId || "";
28268
- }
28269
- return IkasStorefrontTheme;
28270
- }());
28271
-
28272
- var IkasStorefrontThemeLocalization = /** @class */ (function () {
28273
- function IkasStorefrontThemeLocalization(data) {
28274
- this.id = data.id || "";
28275
- this.locale = data.locale || "";
28276
- this.storefrontId = data.storefrontId || "";
28277
- this.storefrontThemeId = data.storefrontThemeId || "";
28278
- this.themeJson = data.themeJson
28279
- ? new IkasTheme(data.themeJson)
28280
- : new IkasTheme();
28281
- this.privacyPolicy = data.privacyPolicy || null;
28282
- this.returnPolicy = data.returnPolicy || null;
28283
- this.termsOfService = data.termsOfService || null;
28284
- }
28285
- return IkasStorefrontThemeLocalization;
28286
- }());
28287
-
28288
- var StorefrontStatus;
28289
- (function (StorefrontStatus) {
28290
- StorefrontStatus["WAITING"] = "WAITING";
28291
- StorefrontStatus["READY"] = "READY";
28292
- })(StorefrontStatus || (StorefrontStatus = {}));
28293
- var IkasStorefront = /** @class */ (function () {
28294
- function IkasStorefront(data) {
28295
- if (data === void 0) { data = {}; }
28296
- this.id = data.id || "";
28297
- this.name = data.name || "";
28298
- this.status = data.status || StorefrontStatus.WAITING;
28299
- this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
28300
- this.emailSettingsId = data.emailSettingsId || null;
28301
- this.salesChannelId = data.salesChannelId || null;
28302
- this.gtmId = data.gtmId || null;
28303
- this.fbpId = data.fbpId || null;
28304
- // Sub Models
28305
- this.localizations = data.localizations
28306
- ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
28307
- : [];
28308
- this.routings = data.routings
28309
- ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
28310
- : [];
28311
- this.domains = data.domains
28312
- ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
28313
- : [];
28314
- this.themes = data.themes
28315
- ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
28316
- : [];
28317
- this.regions = data.regions
28318
- ? data.regions.map(function (r) { return new IkasStorefrontThemeLocalization(r); })
28319
- : [];
28320
- }
28321
- return IkasStorefront;
28322
- }());
28323
-
28324
- var IkasSalesChannel = /** @class */ (function () {
28325
- function IkasSalesChannel(data) {
28326
- var _a;
28327
- this.id = data.id || "";
28328
- this.name = data.name || "";
28329
- this.priceListId = data.priceListId || "";
28330
- this.stockLocations =
28331
- ((_a = data.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return new IkasSalesChannelStockLocation(sl); })) ||
28332
- [];
28333
- }
28334
- return IkasSalesChannel;
28335
- }());
28336
- var IkasSalesChannelStockLocation = /** @class */ (function () {
28337
- function IkasSalesChannelStockLocation(data) {
28338
- this.id = data.id || "";
28339
- this.order = data.order || 0;
28340
- }
28341
- return IkasSalesChannelStockLocation;
28342
- }());
28343
-
28344
- var SettingsHelper = /** @class */ (function () {
28345
- function SettingsHelper() {
28346
- }
28347
- SettingsHelper.readSettingsFile = function () {
28348
- return new Promise(function (resolve) {
28349
- var serverRuntimeConfig = getConfig().serverRuntimeConfig;
28350
- var settingsPath = serverRuntimeConfig.SETTINGS;
28351
- fs.readFile(settingsPath, {
28352
- flag: "a+",
28353
- }, function (err, file) {
28354
- if (err) {
28355
- console.error("SETTINGS FILE READ ERROR!!!");
28356
- console.error(err);
28357
- return resolve(null);
28358
- }
28359
- var result = file.length ? JSON.parse(file.toString()) : {};
28360
- resolve(result);
28361
- });
28362
- });
28363
- };
28364
- SettingsHelper.getSettings = function (locale) {
28365
- var _this = this;
28366
- return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
28367
- var settings, storefront, salesChannel, localizationMap, themeLocalizationPath, routing;
28368
- return __generator(this, function (_a) {
28369
- switch (_a.label) {
28370
- case 0: return [4 /*yield*/, SettingsHelper.readSettingsFile()];
28371
- case 1:
28372
- settings = _a.sent();
28373
- if (!settings)
28374
- return [2 /*return*/, resolve(null)];
28375
- storefront = new IkasStorefront(settings.storefront);
28376
- salesChannel = new IkasSalesChannel(settings.salesChannel);
28377
- localizationMap = settings.localizationMap;
28378
- themeLocalizationPath = localizationMap[locale];
28379
- routing = storefront.routings.find(function (r) { return r.id === locale || r.path === locale; });
28380
- if (!themeLocalizationPath || !routing) {
28381
- console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!");
28382
- return [2 /*return*/, resolve(null)];
28383
- }
28384
- fs.readFile(themeLocalizationPath, {
28385
- flag: "a+",
28386
- }, function (err, file) {
28387
- if (err) {
28388
- console.error("THEME LOCALZIATION FILE READ ERROR!!!");
28389
- console.error(err);
28390
- return resolve(null);
28391
- }
28392
- var result = file.length ? JSON.parse(file.toString()) : {};
28393
- resolve({
28394
- storefront: storefront,
28395
- themeLocalization: new IkasStorefrontThemeLocalization(result),
28396
- salesChannel: salesChannel,
28397
- routing: routing,
28398
- });
28399
- });
28400
- return [2 /*return*/];
28401
- }
28402
- });
28403
- }); });
28404
- };
28405
- SettingsHelper.getPageData = function (context, isServer, pageType) {
28406
- var _a;
28407
- return __awaiter(this, void 0, void 0, function () {
28408
- var locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
28409
- return __generator(this, function (_b) {
28410
- switch (_b.label) {
28411
- case 0:
28412
- locale = context.locale || context.defaultLocale || "en";
28413
- return [4 /*yield*/, SettingsHelper.getSettings(locale)];
28414
- case 1:
28415
- settings = _b.sent();
28416
- if (!settings ||
28417
- !settings.storefront.mainStorefrontThemeId ||
28418
- !settings.storefront.salesChannelId) {
28419
- return [2 /*return*/, {
28420
- props: {},
28421
- notFound: true,
28422
- }];
28423
- }
28424
- storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
28425
- IkasStorefrontConfig.storefrontId = storefront.id;
28426
- IkasStorefrontConfig.storefrontRoutingId = routing.id;
28427
- IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28428
- IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28429
- IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
28430
- IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28431
- provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
28432
- return [4 /*yield*/, provider.getPageData()];
28433
- case 2:
28434
- _b.sent();
28435
- if (!provider.page) {
28436
- return [2 /*return*/, {
28437
- props: {},
28438
- notFound: true,
28439
- }];
28440
- }
28441
- if (isServer)
28442
- return [2 /*return*/, provider.nextPageData];
28443
- else
28444
- return [2 /*return*/, {
28445
- props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: provider.pageSpecificData
28446
- ? JSON.stringify(provider.pageSpecificData || {})
28447
- : "" }),
28448
- revalidate: 60,
28449
- }];
28450
- }
28451
- });
28452
- });
28453
- };
28454
- SettingsHelper.getStaticProps = function (context, pageType) {
28455
- return __awaiter(this, void 0, void 0, function () {
28456
- return __generator(this, function (_a) {
28457
- switch (_a.label) {
28458
- case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType)];
28459
- case 1: return [2 /*return*/, _a.sent()];
28460
- }
28461
- });
28462
- });
28463
- };
28464
- SettingsHelper.getServerSideProps = function (context, pageType) {
28465
- return __awaiter(this, void 0, void 0, function () {
28466
- return __generator(this, function (_a) {
28467
- switch (_a.label) {
28468
- case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType)];
28469
- case 1: return [2 /*return*/, _a.sent()];
28470
- }
28471
- });
28472
- });
28473
- };
28474
- return SettingsHelper;
28475
- }());
28476
-
28477
28358
  var Page = function (_a) {
28478
28359
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28479
28360
  var router = useRouter();
@@ -28481,10 +28362,17 @@ var Page = function (_a) {
28481
28362
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28482
28363
  };
28483
28364
  var getStaticProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28365
+ var theme, provider;
28484
28366
  return __generator(this, function (_a) {
28485
28367
  switch (_a.label) {
28486
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.INDEX)];
28487
- case 1: return [2 /*return*/, _a.sent()];
28368
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28369
+ case 1:
28370
+ theme = _a.sent();
28371
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.INDEX);
28372
+ return [4 /*yield*/, provider.getPageData()];
28373
+ case 2:
28374
+ _a.sent();
28375
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28488
28376
  }
28489
28377
  });
28490
28378
  }); };
@@ -28526,7 +28414,6 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28526
28414
  productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === IkasHTMLMetaDataTargetType.PRODUCT; });
28527
28415
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
28528
28416
  productIdList: productMetaData.map(function (p) { return p.targetId; }),
28529
- priceListId: IkasStorefrontConfig.priceListId,
28530
28417
  })];
28531
28418
  case 2:
28532
28419
  productsResponse = _b.sent();
@@ -28573,10 +28460,25 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28573
28460
  });
28574
28461
  }); };
28575
28462
  var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28463
+ var theme, provider;
28576
28464
  return __generator(this, function (_a) {
28577
28465
  switch (_a.label) {
28578
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context)];
28579
- case 1: return [2 /*return*/, _a.sent()];
28466
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28467
+ case 1:
28468
+ theme = _a.sent();
28469
+ provider = new IkasPageDataProvider(theme, context.params, undefined);
28470
+ return [4 /*yield*/, provider.getPageData()];
28471
+ case 2:
28472
+ _a.sent();
28473
+ if (!provider.page) {
28474
+ return [2 /*return*/, {
28475
+ notFound: true,
28476
+ }];
28477
+ }
28478
+ return [2 /*return*/, {
28479
+ props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
28480
+ revalidate: 60,
28481
+ }];
28580
28482
  }
28581
28483
  });
28582
28484
  }); };
@@ -28621,38 +28523,19 @@ var Page$2 = function (_a) {
28621
28523
  return (createElement(IkasPage, { page: page, settingsStr: settingsStr, propValues: propValues }));
28622
28524
  };
28623
28525
  var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28624
- var allSettings, customPagePaths;
28526
+ var theme, customPages, customPagePaths;
28625
28527
  return __generator(this, function (_a) {
28626
28528
  switch (_a.label) {
28627
- case 0:
28628
- if (!context.locales)
28629
- return [2 /*return*/, {
28630
- paths: [],
28631
- fallback: "blocking",
28632
- }];
28633
- return [4 /*yield*/, Promise.all(context.locales.map(function (locale) { return SettingsHelper.getSettings(locale); }))];
28529
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28634
28530
  case 1:
28635
- allSettings = (_a.sent());
28636
- customPagePaths = [];
28637
- allSettings.forEach(function (_a) {
28638
- var themeLocalization = _a.themeLocalization, routing = _a.routing;
28639
- if (!themeLocalization)
28640
- return;
28641
- var customPages = themeLocalization.themeJson.pages.filter(function (p) { return p.type === IkasThemePageType.CUSTOM; });
28642
- customPages.forEach(function (customPage) {
28643
- if (customPage.slug &&
28644
- !customPagePaths.some(function (p) { return p.params.slug === customPage.slug; })) {
28645
- customPagePaths.push({
28646
- params: { slug: customPage.slug },
28647
- locale: routing.path || routing.id,
28648
- });
28649
- }
28650
- });
28651
- });
28531
+ theme = _a.sent();
28532
+ customPages = theme.pages.filter(function (p) { return p.type === IkasThemePageType.CUSTOM; });
28533
+ customPagePaths = customPages.map(function (p) { return ({
28534
+ slug: p.slug,
28535
+ }); });
28652
28536
  return [2 /*return*/, {
28653
28537
  paths: customPagePaths.map(function (p) { return ({
28654
- params: p.params,
28655
- locale: p.locale,
28538
+ params: p,
28656
28539
  }); }),
28657
28540
  fallback: "blocking",
28658
28541
  }];
@@ -28660,10 +28543,17 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
28660
28543
  });
28661
28544
  }); };
28662
28545
  var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28546
+ var theme, provider;
28663
28547
  return __generator(this, function (_a) {
28664
28548
  switch (_a.label) {
28665
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.CUSTOM)];
28666
- case 1: return [2 /*return*/, _a.sent()];
28549
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28550
+ case 1:
28551
+ theme = _a.sent();
28552
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.CUSTOM);
28553
+ return [4 /*yield*/, provider.getPageData()];
28554
+ case 2:
28555
+ _a.sent();
28556
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28667
28557
  }
28668
28558
  });
28669
28559
  }); };
@@ -28676,36 +28566,18 @@ var _slug_ = /*#__PURE__*/Object.freeze({
28676
28566
  });
28677
28567
 
28678
28568
  var CheckoutPage = function (_a) {
28679
- var checkoutStr = _a.checkoutStr, others = __rest(_a, ["checkoutStr"]);
28569
+ var checkoutStr = _a.checkoutStr, queryParams = _a.queryParams;
28680
28570
  Analytics.disableHTML();
28681
28571
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
28682
- return createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
28572
+ return createElement(IkasCheckoutPage, { checkout: checkout, queryParams: queryParams });
28683
28573
  };
28684
28574
  var _id_ = observer(CheckoutPage);
28685
28575
  var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28686
- var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
28576
+ var id, redirect, checkout;
28687
28577
  return __generator(this, function (_a) {
28688
28578
  switch (_a.label) {
28689
28579
  case 0:
28690
28580
  id = context.query.id;
28691
- locale = context.locale || context.defaultLocale || "en";
28692
- return [4 /*yield*/, SettingsHelper.getSettings(locale)];
28693
- case 1:
28694
- settings = _a.sent();
28695
- // TODO maybe remove this and convert this page to static
28696
- if (!settings ||
28697
- !settings.storefront.mainStorefrontThemeId ||
28698
- !settings.storefront.salesChannelId) {
28699
- return [2 /*return*/, {
28700
- props: {},
28701
- notFound: true,
28702
- }];
28703
- }
28704
- storefront = settings.storefront, themeLocalization = settings.themeLocalization, routing = settings.routing;
28705
- IkasStorefrontConfig.storefrontId = storefront.id;
28706
- IkasStorefrontConfig.storefrontRoutingId = routing.id;
28707
- IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28708
- IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28709
28581
  redirect = function () {
28710
28582
  context.res.writeHead(302, { Location: "/" });
28711
28583
  context.res.end();
@@ -28715,15 +28587,12 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
28715
28587
  return [2 /*return*/, redirect()];
28716
28588
  }
28717
28589
  return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
28718
- case 2:
28590
+ case 1:
28719
28591
  checkout = _a.sent();
28720
28592
  if (checkout) {
28721
28593
  return [2 /*return*/, {
28722
28594
  props: {
28723
28595
  checkoutStr: JSON.stringify(checkout),
28724
- returnPolicy: themeLocalization.returnPolicy || "",
28725
- privacyPolicy: themeLocalization.privacyPolicy || "",
28726
- termsOfService: themeLocalization.termsOfService || "",
28727
28596
  queryParams: context.query,
28728
28597
  },
28729
28598
  }];
@@ -28748,10 +28617,17 @@ var Page$3 = function (_a) {
28748
28617
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28749
28618
  };
28750
28619
  var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28620
+ var theme, provider;
28751
28621
  return __generator(this, function (_a) {
28752
28622
  switch (_a.label) {
28753
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.ACCOUNT)];
28754
- case 1: return [2 /*return*/, _a.sent()];
28623
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28624
+ case 1:
28625
+ theme = _a.sent();
28626
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ACCOUNT);
28627
+ return [4 /*yield*/, provider.getPageData()];
28628
+ case 2:
28629
+ _a.sent();
28630
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28755
28631
  }
28756
28632
  });
28757
28633
  }); };
@@ -28769,10 +28645,17 @@ var Page$4 = function (_a) {
28769
28645
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28770
28646
  };
28771
28647
  var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28648
+ var theme, provider;
28772
28649
  return __generator(this, function (_a) {
28773
28650
  switch (_a.label) {
28774
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.ADDRESSES)];
28775
- case 1: return [2 /*return*/, _a.sent()];
28651
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28652
+ case 1:
28653
+ theme = _a.sent();
28654
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ADDRESSES);
28655
+ return [4 /*yield*/, provider.getPageData()];
28656
+ case 2:
28657
+ _a.sent();
28658
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28776
28659
  }
28777
28660
  });
28778
28661
  }); };
@@ -28790,10 +28673,17 @@ var Page$5 = function (_a) {
28790
28673
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28791
28674
  };
28792
28675
  var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28676
+ var theme, provider;
28793
28677
  return __generator(this, function (_a) {
28794
28678
  switch (_a.label) {
28795
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.ORDERS)];
28796
- case 1: return [2 /*return*/, _a.sent()];
28679
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28680
+ case 1:
28681
+ theme = _a.sent();
28682
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ORDERS);
28683
+ return [4 /*yield*/, provider.getPageData()];
28684
+ case 2:
28685
+ _a.sent();
28686
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28797
28687
  }
28798
28688
  });
28799
28689
  }); };
@@ -28811,10 +28701,17 @@ var Page$6 = function (_a) {
28811
28701
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28812
28702
  };
28813
28703
  var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28704
+ var theme, provider;
28814
28705
  return __generator(this, function (_a) {
28815
28706
  switch (_a.label) {
28816
- case 0: return [4 /*yield*/, SettingsHelper.getServerSideProps(context, IkasThemePageType.ORDER_DETAIL)];
28817
- case 1: return [2 /*return*/, _a.sent()];
28707
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28708
+ case 1:
28709
+ theme = _a.sent();
28710
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ORDER_DETAIL);
28711
+ return [4 /*yield*/, provider.getPageData()];
28712
+ case 2:
28713
+ _a.sent();
28714
+ return [2 /*return*/, provider.nextPageData];
28818
28715
  }
28819
28716
  });
28820
28717
  }); };
@@ -28832,10 +28729,17 @@ var Page$7 = function (_a) {
28832
28729
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28833
28730
  };
28834
28731
  var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28732
+ var theme, provider;
28835
28733
  return __generator(this, function (_a) {
28836
28734
  switch (_a.label) {
28837
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.LOGIN)];
28838
- case 1: return [2 /*return*/, _a.sent()];
28735
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28736
+ case 1:
28737
+ theme = _a.sent();
28738
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.LOGIN);
28739
+ return [4 /*yield*/, provider.getPageData()];
28740
+ case 2:
28741
+ _a.sent();
28742
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28839
28743
  }
28840
28744
  });
28841
28745
  }); };
@@ -28853,10 +28757,17 @@ var Page$8 = function (_a) {
28853
28757
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28854
28758
  };
28855
28759
  var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28760
+ var theme, provider;
28856
28761
  return __generator(this, function (_a) {
28857
28762
  switch (_a.label) {
28858
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.REGISTER)];
28859
- case 1: return [2 /*return*/, _a.sent()];
28763
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28764
+ case 1:
28765
+ theme = _a.sent();
28766
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.REGISTER);
28767
+ return [4 /*yield*/, provider.getPageData()];
28768
+ case 2:
28769
+ _a.sent();
28770
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28860
28771
  }
28861
28772
  });
28862
28773
  }); };
@@ -28874,10 +28785,17 @@ var Page$9 = function (_a) {
28874
28785
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28875
28786
  };
28876
28787
  var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28788
+ var theme, provider;
28877
28789
  return __generator(this, function (_a) {
28878
28790
  switch (_a.label) {
28879
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.FORGOT_PASSWORD)];
28880
- case 1: return [2 /*return*/, _a.sent()];
28791
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28792
+ case 1:
28793
+ theme = _a.sent();
28794
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.FORGOT_PASSWORD);
28795
+ return [4 /*yield*/, provider.getPageData()];
28796
+ case 2:
28797
+ _a.sent();
28798
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28881
28799
  }
28882
28800
  });
28883
28801
  }); };
@@ -28895,10 +28813,17 @@ var Page$a = function (_a) {
28895
28813
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28896
28814
  };
28897
28815
  var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28816
+ var theme, provider;
28898
28817
  return __generator(this, function (_a) {
28899
28818
  switch (_a.label) {
28900
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.RECOVER_PASSWORD)];
28901
- case 1: return [2 /*return*/, _a.sent()];
28819
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28820
+ case 1:
28821
+ theme = _a.sent();
28822
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.RECOVER_PASSWORD);
28823
+ return [4 /*yield*/, provider.getPageData()];
28824
+ case 2:
28825
+ _a.sent();
28826
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28902
28827
  }
28903
28828
  });
28904
28829
  }); };
@@ -28920,10 +28845,17 @@ var Page$b = function (_a) {
28920
28845
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28921
28846
  };
28922
28847
  var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28848
+ var theme, provider;
28923
28849
  return __generator(this, function (_a) {
28924
28850
  switch (_a.label) {
28925
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.CART)];
28926
- case 1: return [2 /*return*/, _a.sent()];
28851
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28852
+ case 1:
28853
+ theme = _a.sent();
28854
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.CART);
28855
+ return [4 /*yield*/, provider.getPageData()];
28856
+ case 2:
28857
+ _a.sent();
28858
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28927
28859
  }
28928
28860
  });
28929
28861
  }); };
@@ -28952,10 +28884,17 @@ var Page$d = function (_a) {
28952
28884
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28953
28885
  };
28954
28886
  var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28887
+ var theme, provider;
28955
28888
  return __generator(this, function (_a) {
28956
28889
  switch (_a.label) {
28957
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.FAVORITE_PRODUCTS)];
28958
- case 1: return [2 /*return*/, _a.sent()];
28890
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28891
+ case 1:
28892
+ theme = _a.sent();
28893
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.FAVORITE_PRODUCTS);
28894
+ return [4 /*yield*/, provider.getPageData()];
28895
+ case 2:
28896
+ _a.sent();
28897
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28959
28898
  }
28960
28899
  });
28961
28900
  }); };
@@ -28981,10 +28920,17 @@ var Page$e = function (_a) {
28981
28920
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28982
28921
  };
28983
28922
  var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28923
+ var theme, provider;
28984
28924
  return __generator(this, function (_a) {
28985
28925
  switch (_a.label) {
28986
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.SEARCH)];
28987
- case 1: return [2 /*return*/, _a.sent()];
28926
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28927
+ case 1:
28928
+ theme = _a.sent();
28929
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.SEARCH);
28930
+ return [4 /*yield*/, provider.getPageData()];
28931
+ case 2:
28932
+ _a.sent();
28933
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28988
28934
  }
28989
28935
  });
28990
28936
  }); };
@@ -28997,27 +28943,22 @@ var search = /*#__PURE__*/Object.freeze({
28997
28943
 
28998
28944
  var Page$f = function (_a) {
28999
28945
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
29000
- if (!propValuesStr || !page)
29001
- return createElement(Error$1, { statusCode: 404 });
29002
28946
  var router = useRouter();
29003
28947
  var propValues = useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router); }, [propValuesStr]);
29004
28948
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
29005
28949
  };
29006
28950
  var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
29007
- var props;
28951
+ var theme, provider;
29008
28952
  return __generator(this, function (_a) {
29009
28953
  switch (_a.label) {
29010
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.NOT_FOUND)];
28954
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
29011
28955
  case 1:
29012
- props = _a.sent();
29013
- //@ts-ignore
29014
- if (props.notFound)
29015
- return [2 /*return*/, {
29016
- props: {},
29017
- revalidate: 60,
29018
- }];
29019
- else
29020
- return [2 /*return*/, props];
28956
+ theme = _a.sent();
28957
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.NOT_FOUND);
28958
+ return [4 /*yield*/, provider.getPageData()];
28959
+ case 2:
28960
+ _a.sent();
28961
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
29021
28962
  }
29022
28963
  });
29023
28964
  }); };
@@ -29043,4 +28984,4 @@ var IkasBaseStore = /** @class */ (function () {
29043
28984
  return IkasBaseStore;
29044
28985
  }());
29045
28986
 
29046
- export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontConfig, IkasTheme, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, OrderLineItemStatusEnum$1 as OrderLineItemStatusEnum, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
28987
+ export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, OrderLineItemStatusEnum$1 as OrderLineItemStatusEnum, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };