@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.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 = 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:
@@ -16297,10 +16314,10 @@ var CheckoutViewModel = /** @class */ (function () {
16297
16314
  }
16298
16315
  return [3 /*break*/, 6];
16299
16316
  case 5:
16300
- err_4 = _a.sent();
16301
- if (err_4.type) {
16302
- console.log(err_4);
16303
- this.error = err_4;
16317
+ err_5 = _a.sent();
16318
+ if (err_5.type) {
16319
+ console.log(err_5);
16320
+ this.error = err_5;
16304
16321
  }
16305
16322
  else {
16306
16323
  this.error = {
@@ -16379,9 +16396,6 @@ var CheckoutViewModel = /** @class */ (function () {
16379
16396
  }); };
16380
16397
  this.checkout = checkout;
16381
16398
  this.router = router;
16382
- this.returnPolicy = returnPolicy;
16383
- this.privacyPolicy = privacyPolicy;
16384
- this.termsOfService = termsOfService;
16385
16399
  this.init(queryParams);
16386
16400
  makeAutoObservable(this);
16387
16401
  }
@@ -16392,6 +16406,15 @@ var CheckoutViewModel = /** @class */ (function () {
16392
16406
  enumerable: false,
16393
16407
  configurable: true
16394
16408
  });
16409
+ Object.defineProperty(CheckoutViewModel.prototype, "storefrontRegion", {
16410
+ get: function () {
16411
+ var _a;
16412
+ return ((_a = this.storefront) === null || _a === void 0 ? void 0 : _a.regions.length) ? this.storefront.regions[0]
16413
+ : undefined;
16414
+ },
16415
+ enumerable: false,
16416
+ configurable: true
16417
+ });
16395
16418
  Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGatewayIndex", {
16396
16419
  get: function () {
16397
16420
  var _this = this;
@@ -17055,7 +17078,6 @@ var IkasCustomerStore = /** @class */ (function () {
17055
17078
  return [2 /*return*/, []];
17056
17079
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
17057
17080
  productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
17058
- priceListId: IkasStorefrontConfig.priceListId,
17059
17081
  })];
17060
17082
  case 2:
17061
17083
  productsResult = _b.sent();
@@ -21913,10 +21935,7 @@ var IkasProductList = /** @class */ (function () {
21913
21935
  Object.defineProperty(IkasProductList.prototype, "isFiltered", {
21914
21936
  get: function () {
21915
21937
  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));
21938
+ return (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (f) { return !!f.valueList.length; })) || !!this._searchKeyword);
21920
21939
  },
21921
21940
  enumerable: false,
21922
21941
  configurable: true
@@ -21979,20 +21998,13 @@ var IkasProductList = /** @class */ (function () {
21979
21998
  });
21980
21999
  Object.defineProperty(IkasProductList.prototype, "filterQueryParams", {
21981
22000
  get: function () {
21982
- var _this = this;
21983
- var _a, _b, _c;
22001
+ var _a;
21984
22002
  var queryParams = {};
21985
22003
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (f) {
21986
22004
  queryParams[f.key] = f.keyList;
21987
22005
  });
21988
22006
  if (this._searchKeyword)
21989
22007
  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
22008
  return queryString.stringify(queryParams, { arrayFormat: "comma" });
21997
22009
  },
21998
22010
  enumerable: false,
@@ -22047,7 +22059,6 @@ var IkasProductList = /** @class */ (function () {
22047
22059
  categoryIdList: this._filterCategoryId
22048
22060
  ? [this._filterCategoryId]
22049
22061
  : undefined,
22050
- priceListId: IkasStorefrontConfig.priceListId,
22051
22062
  query: this._searchKeyword,
22052
22063
  })];
22053
22064
  case 1: return [2 /*return*/, _c.sent()];
@@ -22075,7 +22086,6 @@ var IkasProductList = /** @class */ (function () {
22075
22086
  };
22076
22087
  IkasProductList.prototype.applyQueryParamFilters = function (queryParams) {
22077
22088
  var _this = this;
22078
- var _a;
22079
22089
  try {
22080
22090
  queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach(function (value, key) {
22081
22091
  var _a;
@@ -22087,15 +22097,6 @@ var IkasProductList = /** @class */ (function () {
22087
22097
  var querySearch = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get("s");
22088
22098
  if (querySearch)
22089
22099
  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
22100
  }
22100
22101
  catch (err) {
22101
22102
  console.log(err);
@@ -22142,32 +22143,12 @@ var IkasProductList = /** @class */ (function () {
22142
22143
  var _a;
22143
22144
  (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) { return filter.clear(); });
22144
22145
  this._searchKeyword = "";
22145
- if (this._pageType !== IkasThemePageType.CATEGORY) {
22146
- this._filterCategoryId = undefined;
22147
- }
22148
22146
  this.applyFilters();
22149
22147
  };
22150
- IkasProductList.prototype.onFilterCategoryClick = function (filterCategory, disableRoute) {
22148
+ IkasProductList.prototype.onFilterCategoryClick = function (filterCategory) {
22151
22149
  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
- });
22150
+ (_a = this.router) === null || _a === void 0 ? void 0 : _a.push(filterCategory.href +
22151
+ (this.filterQueryParams ? "?" + this.filterQueryParams : ""));
22171
22152
  };
22172
22153
  IkasProductList.prototype.toJSON = function () {
22173
22154
  return {
@@ -24255,7 +24236,7 @@ var IkasCartAPI = /** @class */ (function () {
24255
24236
  return __generator(this, function (_b) {
24256
24237
  switch (_b.label) {
24257
24238
  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 "])));
24239
+ 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
24240
  _b.label = 1;
24260
24241
  case 1:
24261
24242
  _b.trys.push([1, 3, , 4]);
@@ -24290,7 +24271,7 @@ var IkasCartAPI = /** @class */ (function () {
24290
24271
  return __generator(this, function (_b) {
24291
24272
  switch (_b.label) {
24292
24273
  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 "])));
24274
+ 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
24275
  _b.label = 1;
24295
24276
  case 1:
24296
24277
  _b.trys.push([1, 3, , 4]);
@@ -24762,13 +24743,13 @@ var IkasCheckoutAPI = /** @class */ (function () {
24762
24743
  });
24763
24744
  });
24764
24745
  };
24765
- IkasCheckoutAPI.checkStocks = function (lines, stockLocationIdList) {
24746
+ IkasCheckoutAPI.checkStocks = function (lines) {
24766
24747
  return __awaiter(this, void 0, void 0, function () {
24767
24748
  var QUERY, _a, data, errors, err_7;
24768
24749
  return __generator(this, function (_b) {
24769
24750
  switch (_b.label) {
24770
24751
  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 "])));
24752
+ 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
24753
  _b.label = 1;
24773
24754
  case 1:
24774
24755
  _b.trys.push([1, 3, , 4]);
@@ -24778,7 +24759,6 @@ var IkasCheckoutAPI = /** @class */ (function () {
24778
24759
  query: QUERY,
24779
24760
  variables: {
24780
24761
  lines: lines,
24781
- stockLocationIdList: stockLocationIdList,
24782
24762
  },
24783
24763
  })];
24784
24764
  case 2:
@@ -24890,13 +24870,13 @@ var IkasCountryAPI = /** @class */ (function () {
24890
24870
  });
24891
24871
  });
24892
24872
  };
24893
- IkasCountryAPI.listShippingCountries = function (storefrontId) {
24873
+ IkasCountryAPI.listShippingCountries = function () {
24894
24874
  return __awaiter(this, void 0, void 0, function () {
24895
24875
  var QUERY, _a, data, errors, err_2;
24896
24876
  return __generator(this, function (_b) {
24897
24877
  switch (_b.label) {
24898
24878
  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 "])));
24879
+ QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "], ["\n query getAvailableShippingCountries {\n getAvailableShippingCountries\n }\n "])));
24900
24880
  _b.label = 1;
24901
24881
  case 1:
24902
24882
  _b.trys.push([1, 3, , 4]);
@@ -24904,9 +24884,6 @@ var IkasCountryAPI = /** @class */ (function () {
24904
24884
  .getClient()
24905
24885
  .query({
24906
24886
  query: QUERY,
24907
- variables: {
24908
- storefrontId: storefrontId,
24909
- },
24910
24887
  })];
24911
24888
  case 2:
24912
24889
  _a = _b.sent(), data = _a.data, errors = _a.errors;
@@ -25900,6 +25877,150 @@ var IkasStateAPI = /** @class */ (function () {
25900
25877
  }());
25901
25878
  var templateObject_1$e;
25902
25879
 
25880
+ var IkasStorefrontDomain = /** @class */ (function () {
25881
+ function IkasStorefrontDomain(data) {
25882
+ if (data === void 0) { data = {}; }
25883
+ this.id = data.id || "";
25884
+ this.merchantDomainId = data.merchantDomainId || "";
25885
+ this.name = data.name || "";
25886
+ this.redirectDomainName = data.redirectDomainName || null;
25887
+ makeAutoObservable(this);
25888
+ }
25889
+ return IkasStorefrontDomain;
25890
+ }());
25891
+
25892
+ var IkasStorefrontLocation = /** @class */ (function () {
25893
+ function IkasStorefrontLocation(data) {
25894
+ if (data === void 0) { data = {}; }
25895
+ this.countryId = data.countryId || "";
25896
+ this.stateId = data.stateId || null;
25897
+ makeAutoObservable(this);
25898
+ }
25899
+ return IkasStorefrontLocation;
25900
+ }());
25901
+
25902
+ var IkasStorefrontRoute = /** @class */ (function () {
25903
+ function IkasStorefrontRoute(data) {
25904
+ if (data === void 0) { data = {}; }
25905
+ this.domainId = data.domainId || "";
25906
+ this.useSubPath = data.useSubPath || false;
25907
+ makeAutoObservable(this);
25908
+ }
25909
+ return IkasStorefrontRoute;
25910
+ }());
25911
+
25912
+ var IkasStorefrontRegion = /** @class */ (function () {
25913
+ function IkasStorefrontRegion(data) {
25914
+ if (data === void 0) { data = {}; }
25915
+ // Extra
25916
+ this.theme = new IkasTheme();
25917
+ this.id = data.id || "";
25918
+ this.locale = data.locale || "";
25919
+ this.themeJSON = data.themeJSON || "";
25920
+ this.shipping = data.shipping || null;
25921
+ this.paymentSettingsId = data.paymentSettingsId || null;
25922
+ this.priceListId = data.priceListId || null;
25923
+ this.locations = data.locations
25924
+ ? data.locations.map(function (o) { return new IkasStorefrontLocation(o); })
25925
+ : [];
25926
+ this.routes = data.routes
25927
+ ? data.routes.map(function (o) { return new IkasStorefrontRoute(o); })
25928
+ : null;
25929
+ this.termsOfService = data.termsOfService || "";
25930
+ this.privacyPolicy = data.privacyPolicy || "";
25931
+ this.returnPolicy = data.returnPolicy || "";
25932
+ try {
25933
+ this.theme = this.themeJSON
25934
+ ? new IkasTheme(JSON.parse(this.themeJSON))
25935
+ : new IkasTheme();
25936
+ }
25937
+ catch (err) { }
25938
+ makeAutoObservable(this);
25939
+ }
25940
+ return IkasStorefrontRegion;
25941
+ }());
25942
+
25943
+ var IkasStorefront = /** @class */ (function () {
25944
+ function IkasStorefront(data) {
25945
+ if (data === void 0) { data = {}; }
25946
+ this.id = data.id || "";
25947
+ this.name = data.name || "";
25948
+ this.themeId = data.themeId || "";
25949
+ this.themeVersionId = data.themeVersionId || "";
25950
+ this.userId = data.userId || "";
25951
+ this.domains = data.domains
25952
+ ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
25953
+ : [];
25954
+ this.regions = data.regions
25955
+ ? data.regions.map(function (o) { return new IkasStorefrontRegion(o); })
25956
+ : [];
25957
+ makeAutoObservable(this);
25958
+ }
25959
+ return IkasStorefront;
25960
+ }());
25961
+
25962
+ var IkasStorefrontAPI = /** @class */ (function () {
25963
+ function IkasStorefrontAPI() {
25964
+ }
25965
+ IkasStorefrontAPI.getStorefront = function (storefrontId) {
25966
+ return __awaiter(this, void 0, void 0, function () {
25967
+ var QUERY, _a, data, errors;
25968
+ return __generator(this, function (_b) {
25969
+ switch (_b.label) {
25970
+ case 0:
25971
+ 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 "])));
25972
+ _b.label = 1;
25973
+ case 1:
25974
+ _b.trys.push([1, 3, , 4]);
25975
+ return [4 /*yield*/, apollo
25976
+ .getClient()
25977
+ .query({
25978
+ query: QUERY,
25979
+ variables: {
25980
+ storefrontId: storefrontId,
25981
+ },
25982
+ })];
25983
+ case 2:
25984
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
25985
+ if (errors && errors.length) {
25986
+ console.log(errors);
25987
+ }
25988
+ if (data)
25989
+ return [2 /*return*/, new IkasStorefront(data.getStorefront)];
25990
+ return [3 /*break*/, 4];
25991
+ case 3:
25992
+ _b.sent();
25993
+ return [3 /*break*/, 4];
25994
+ case 4: return [2 /*return*/, new IkasStorefront()];
25995
+ }
25996
+ });
25997
+ });
25998
+ };
25999
+ return IkasStorefrontAPI;
26000
+ }());
26001
+ var templateObject_1$f;
26002
+
26003
+ var IkasThemeAPI = /** @class */ (function () {
26004
+ function IkasThemeAPI() {
26005
+ }
26006
+ IkasThemeAPI.fetchTheme = function () {
26007
+ return new Promise(function (resolve, reject) {
26008
+ var serverRuntimeConfig = getConfig().serverRuntimeConfig;
26009
+ var themeJSONPath = serverRuntimeConfig.THEME_JSON_PATH || "./src/theme.json";
26010
+ fs.readFile(themeJSONPath, {
26011
+ flag: "a+",
26012
+ }, function (err, file) {
26013
+ if (err) {
26014
+ return reject(err);
26015
+ }
26016
+ var result = file.length ? JSON.parse(file.toString()) : {};
26017
+ resolve(new IkasTheme(result));
26018
+ });
26019
+ });
26020
+ };
26021
+ return IkasThemeAPI;
26022
+ }());
26023
+
25903
26024
  var IkasVariantTypeAPI = /** @class */ (function () {
25904
26025
  function IkasVariantTypeAPI() {
25905
26026
  }
@@ -25909,7 +26030,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25909
26030
  return __generator(this, function (_b) {
25910
26031
  switch (_b.label) {
25911
26032
  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 "])));
26033
+ 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
26034
  _b.label = 1;
25914
26035
  case 1:
25915
26036
  _b.trys.push([1, 3, , 4]);
@@ -25955,7 +26076,7 @@ var IkasVariantTypeAPI = /** @class */ (function () {
25955
26076
  };
25956
26077
  return IkasVariantTypeAPI;
25957
26078
  }());
25958
- var templateObject_1$f;
26079
+ var templateObject_1$g;
25959
26080
 
25960
26081
  function styleInject(css, ref) {
25961
26082
  if ( ref === void 0 ) ref = {};
@@ -27145,11 +27266,6 @@ var IkasCartStore = /** @class */ (function () {
27145
27266
  name: product.name,
27146
27267
  },
27147
27268
  },
27148
- priceListId: IkasStorefrontConfig.priceListId || null,
27149
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27150
- storefrontId: IkasStorefrontConfig.storefrontId,
27151
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27152
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27153
27269
  };
27154
27270
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27155
27271
  case 1:
@@ -27190,11 +27306,6 @@ var IkasCartStore = /** @class */ (function () {
27190
27306
  name: item.variant.name,
27191
27307
  },
27192
27308
  },
27193
- priceListId: IkasStorefrontConfig.priceListId || null,
27194
- salesChannelId: IkasStorefrontConfig.salesChannelId,
27195
- storefrontId: IkasStorefrontConfig.storefrontId,
27196
- storefrontRoutingId: IkasStorefrontConfig.storefrontRoutingId,
27197
- storefrontThemeId: IkasStorefrontConfig.storefrontThemeId,
27198
27309
  };
27199
27310
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
27200
27311
  case 1:
@@ -27557,11 +27668,9 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27557
27668
 
27558
27669
  var IkasCheckoutPage = observer(function (_a) {
27559
27670
  var _b, _c, _d;
27560
- var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
27671
+ var checkout = _a.checkout, queryParams = _a.queryParams;
27561
27672
  var router = useRouter();
27562
- var vm = useState(function () {
27563
- return new CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService);
27564
- })[0];
27673
+ var vm = useState(function () { return new CheckoutViewModel(checkout, queryParams, router); })[0];
27565
27674
  useEffect(function () {
27566
27675
  Analytics.beginCheckout(vm.checkout);
27567
27676
  Analytics.checkoutStep(vm.checkout, vm.step);
@@ -27586,18 +27695,46 @@ var IkasCheckoutPage = observer(function (_a) {
27586
27695
  var onPolicyModalClose = function () {
27587
27696
  setPolicyModalText("");
27588
27697
  };
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
- };
27698
+ var onReturnPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27699
+ var _a, _b;
27700
+ return __generator(this, function (_c) {
27701
+ switch (_c.label) {
27702
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27703
+ case 1:
27704
+ _c.sent();
27705
+ console.log((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.returnPolicy);
27706
+ setPolicyModalTitle("Para İade Politikası");
27707
+ setPolicyModalText(((_b = vm.storefrontRegion) === null || _b === void 0 ? void 0 : _b.returnPolicy) || "");
27708
+ return [2 /*return*/];
27709
+ }
27710
+ });
27711
+ }); };
27712
+ var onPrivacyPolicyClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27713
+ var _a;
27714
+ return __generator(this, function (_b) {
27715
+ switch (_b.label) {
27716
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27717
+ case 1:
27718
+ _b.sent();
27719
+ setPolicyModalTitle("Gizlilik Politikası");
27720
+ setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.privacyPolicy) || "");
27721
+ return [2 /*return*/];
27722
+ }
27723
+ });
27724
+ }); };
27725
+ var onTermsOfServiceClick = function () { return __awaiter(void 0, void 0, void 0, function () {
27726
+ var _a;
27727
+ return __generator(this, function (_b) {
27728
+ switch (_b.label) {
27729
+ case 0: return [4 /*yield*/, vm.getStorefront()];
27730
+ case 1:
27731
+ _b.sent();
27732
+ setPolicyModalTitle("Hizmet Şartları");
27733
+ setPolicyModalText(((_a = vm.storefrontRegion) === null || _a === void 0 ? void 0 : _a.termsOfService) || "");
27734
+ return [2 /*return*/];
27735
+ }
27736
+ });
27737
+ }); };
27601
27738
  var onErrorClose = function () {
27602
27739
  vm.error = undefined;
27603
27740
  };
@@ -28217,263 +28354,6 @@ var index = /*#__PURE__*/Object.freeze({
28217
28354
  Image: Image
28218
28355
  });
28219
28356
 
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
28357
  var Page = function (_a) {
28478
28358
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28479
28359
  var router = useRouter();
@@ -28481,10 +28361,17 @@ var Page = function (_a) {
28481
28361
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28482
28362
  };
28483
28363
  var getStaticProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28364
+ var theme, provider;
28484
28365
  return __generator(this, function (_a) {
28485
28366
  switch (_a.label) {
28486
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.INDEX)];
28487
- case 1: return [2 /*return*/, _a.sent()];
28367
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28368
+ case 1:
28369
+ theme = _a.sent();
28370
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.INDEX);
28371
+ return [4 /*yield*/, provider.getPageData()];
28372
+ case 2:
28373
+ _a.sent();
28374
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28488
28375
  }
28489
28376
  });
28490
28377
  }); };
@@ -28526,7 +28413,6 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28526
28413
  productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === IkasHTMLMetaDataTargetType.PRODUCT; });
28527
28414
  return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
28528
28415
  productIdList: productMetaData.map(function (p) { return p.targetId; }),
28529
- priceListId: IkasStorefrontConfig.priceListId,
28530
28416
  })];
28531
28417
  case 2:
28532
28418
  productsResponse = _b.sent();
@@ -28573,10 +28459,25 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28573
28459
  });
28574
28460
  }); };
28575
28461
  var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28462
+ var theme, provider;
28576
28463
  return __generator(this, function (_a) {
28577
28464
  switch (_a.label) {
28578
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context)];
28579
- case 1: return [2 /*return*/, _a.sent()];
28465
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28466
+ case 1:
28467
+ theme = _a.sent();
28468
+ provider = new IkasPageDataProvider(theme, context.params, undefined);
28469
+ return [4 /*yield*/, provider.getPageData()];
28470
+ case 2:
28471
+ _a.sent();
28472
+ if (!provider.page) {
28473
+ return [2 /*return*/, {
28474
+ notFound: true,
28475
+ }];
28476
+ }
28477
+ return [2 /*return*/, {
28478
+ props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
28479
+ revalidate: 60,
28480
+ }];
28580
28481
  }
28581
28482
  });
28582
28483
  }); };
@@ -28621,38 +28522,19 @@ var Page$2 = function (_a) {
28621
28522
  return (createElement(IkasPage, { page: page, settingsStr: settingsStr, propValues: propValues }));
28622
28523
  };
28623
28524
  var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28624
- var allSettings, customPagePaths;
28525
+ var theme, customPages, customPagePaths;
28625
28526
  return __generator(this, function (_a) {
28626
28527
  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); }))];
28528
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28634
28529
  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
- });
28530
+ theme = _a.sent();
28531
+ customPages = theme.pages.filter(function (p) { return p.type === IkasThemePageType.CUSTOM; });
28532
+ customPagePaths = customPages.map(function (p) { return ({
28533
+ slug: p.slug,
28534
+ }); });
28652
28535
  return [2 /*return*/, {
28653
28536
  paths: customPagePaths.map(function (p) { return ({
28654
- params: p.params,
28655
- locale: p.locale,
28537
+ params: p,
28656
28538
  }); }),
28657
28539
  fallback: "blocking",
28658
28540
  }];
@@ -28660,10 +28542,17 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
28660
28542
  });
28661
28543
  }); };
28662
28544
  var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28545
+ var theme, provider;
28663
28546
  return __generator(this, function (_a) {
28664
28547
  switch (_a.label) {
28665
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.CUSTOM)];
28666
- case 1: return [2 /*return*/, _a.sent()];
28548
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28549
+ case 1:
28550
+ theme = _a.sent();
28551
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.CUSTOM);
28552
+ return [4 /*yield*/, provider.getPageData()];
28553
+ case 2:
28554
+ _a.sent();
28555
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28667
28556
  }
28668
28557
  });
28669
28558
  }); };
@@ -28676,36 +28565,18 @@ var _slug_ = /*#__PURE__*/Object.freeze({
28676
28565
  });
28677
28566
 
28678
28567
  var CheckoutPage = function (_a) {
28679
- var checkoutStr = _a.checkoutStr, others = __rest(_a, ["checkoutStr"]);
28568
+ var checkoutStr = _a.checkoutStr, queryParams = _a.queryParams;
28680
28569
  Analytics.disableHTML();
28681
28570
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
28682
- return createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
28571
+ return createElement(IkasCheckoutPage, { checkout: checkout, queryParams: queryParams });
28683
28572
  };
28684
28573
  var _id_ = observer(CheckoutPage);
28685
28574
  var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28686
- var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
28575
+ var id, redirect, checkout;
28687
28576
  return __generator(this, function (_a) {
28688
28577
  switch (_a.label) {
28689
28578
  case 0:
28690
28579
  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
28580
  redirect = function () {
28710
28581
  context.res.writeHead(302, { Location: "/" });
28711
28582
  context.res.end();
@@ -28715,15 +28586,12 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
28715
28586
  return [2 /*return*/, redirect()];
28716
28587
  }
28717
28588
  return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
28718
- case 2:
28589
+ case 1:
28719
28590
  checkout = _a.sent();
28720
28591
  if (checkout) {
28721
28592
  return [2 /*return*/, {
28722
28593
  props: {
28723
28594
  checkoutStr: JSON.stringify(checkout),
28724
- returnPolicy: themeLocalization.returnPolicy || "",
28725
- privacyPolicy: themeLocalization.privacyPolicy || "",
28726
- termsOfService: themeLocalization.termsOfService || "",
28727
28595
  queryParams: context.query,
28728
28596
  },
28729
28597
  }];
@@ -28748,10 +28616,17 @@ var Page$3 = function (_a) {
28748
28616
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28749
28617
  };
28750
28618
  var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28619
+ var theme, provider;
28751
28620
  return __generator(this, function (_a) {
28752
28621
  switch (_a.label) {
28753
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.ACCOUNT)];
28754
- case 1: return [2 /*return*/, _a.sent()];
28622
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28623
+ case 1:
28624
+ theme = _a.sent();
28625
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ACCOUNT);
28626
+ return [4 /*yield*/, provider.getPageData()];
28627
+ case 2:
28628
+ _a.sent();
28629
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28755
28630
  }
28756
28631
  });
28757
28632
  }); };
@@ -28769,10 +28644,17 @@ var Page$4 = function (_a) {
28769
28644
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28770
28645
  };
28771
28646
  var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28647
+ var theme, provider;
28772
28648
  return __generator(this, function (_a) {
28773
28649
  switch (_a.label) {
28774
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.ADDRESSES)];
28775
- case 1: return [2 /*return*/, _a.sent()];
28650
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28651
+ case 1:
28652
+ theme = _a.sent();
28653
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ADDRESSES);
28654
+ return [4 /*yield*/, provider.getPageData()];
28655
+ case 2:
28656
+ _a.sent();
28657
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28776
28658
  }
28777
28659
  });
28778
28660
  }); };
@@ -28790,10 +28672,17 @@ var Page$5 = function (_a) {
28790
28672
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28791
28673
  };
28792
28674
  var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28675
+ var theme, provider;
28793
28676
  return __generator(this, function (_a) {
28794
28677
  switch (_a.label) {
28795
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.ORDERS)];
28796
- case 1: return [2 /*return*/, _a.sent()];
28678
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28679
+ case 1:
28680
+ theme = _a.sent();
28681
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ORDERS);
28682
+ return [4 /*yield*/, provider.getPageData()];
28683
+ case 2:
28684
+ _a.sent();
28685
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28797
28686
  }
28798
28687
  });
28799
28688
  }); };
@@ -28811,10 +28700,17 @@ var Page$6 = function (_a) {
28811
28700
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28812
28701
  };
28813
28702
  var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28703
+ var theme, provider;
28814
28704
  return __generator(this, function (_a) {
28815
28705
  switch (_a.label) {
28816
- case 0: return [4 /*yield*/, SettingsHelper.getServerSideProps(context, IkasThemePageType.ORDER_DETAIL)];
28817
- case 1: return [2 /*return*/, _a.sent()];
28706
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28707
+ case 1:
28708
+ theme = _a.sent();
28709
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.ORDER_DETAIL);
28710
+ return [4 /*yield*/, provider.getPageData()];
28711
+ case 2:
28712
+ _a.sent();
28713
+ return [2 /*return*/, provider.nextPageData];
28818
28714
  }
28819
28715
  });
28820
28716
  }); };
@@ -28832,10 +28728,17 @@ var Page$7 = function (_a) {
28832
28728
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28833
28729
  };
28834
28730
  var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28731
+ var theme, provider;
28835
28732
  return __generator(this, function (_a) {
28836
28733
  switch (_a.label) {
28837
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.LOGIN)];
28838
- case 1: return [2 /*return*/, _a.sent()];
28734
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28735
+ case 1:
28736
+ theme = _a.sent();
28737
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.LOGIN);
28738
+ return [4 /*yield*/, provider.getPageData()];
28739
+ case 2:
28740
+ _a.sent();
28741
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28839
28742
  }
28840
28743
  });
28841
28744
  }); };
@@ -28853,10 +28756,17 @@ var Page$8 = function (_a) {
28853
28756
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28854
28757
  };
28855
28758
  var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28759
+ var theme, provider;
28856
28760
  return __generator(this, function (_a) {
28857
28761
  switch (_a.label) {
28858
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.REGISTER)];
28859
- case 1: return [2 /*return*/, _a.sent()];
28762
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28763
+ case 1:
28764
+ theme = _a.sent();
28765
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.REGISTER);
28766
+ return [4 /*yield*/, provider.getPageData()];
28767
+ case 2:
28768
+ _a.sent();
28769
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28860
28770
  }
28861
28771
  });
28862
28772
  }); };
@@ -28874,10 +28784,17 @@ var Page$9 = function (_a) {
28874
28784
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28875
28785
  };
28876
28786
  var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28787
+ var theme, provider;
28877
28788
  return __generator(this, function (_a) {
28878
28789
  switch (_a.label) {
28879
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.FORGOT_PASSWORD)];
28880
- case 1: return [2 /*return*/, _a.sent()];
28790
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28791
+ case 1:
28792
+ theme = _a.sent();
28793
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.FORGOT_PASSWORD);
28794
+ return [4 /*yield*/, provider.getPageData()];
28795
+ case 2:
28796
+ _a.sent();
28797
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28881
28798
  }
28882
28799
  });
28883
28800
  }); };
@@ -28895,10 +28812,17 @@ var Page$a = function (_a) {
28895
28812
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28896
28813
  };
28897
28814
  var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28815
+ var theme, provider;
28898
28816
  return __generator(this, function (_a) {
28899
28817
  switch (_a.label) {
28900
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.RECOVER_PASSWORD)];
28901
- case 1: return [2 /*return*/, _a.sent()];
28818
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28819
+ case 1:
28820
+ theme = _a.sent();
28821
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.RECOVER_PASSWORD);
28822
+ return [4 /*yield*/, provider.getPageData()];
28823
+ case 2:
28824
+ _a.sent();
28825
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28902
28826
  }
28903
28827
  });
28904
28828
  }); };
@@ -28920,10 +28844,17 @@ var Page$b = function (_a) {
28920
28844
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28921
28845
  };
28922
28846
  var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28847
+ var theme, provider;
28923
28848
  return __generator(this, function (_a) {
28924
28849
  switch (_a.label) {
28925
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.CART)];
28926
- case 1: return [2 /*return*/, _a.sent()];
28850
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28851
+ case 1:
28852
+ theme = _a.sent();
28853
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.CART);
28854
+ return [4 /*yield*/, provider.getPageData()];
28855
+ case 2:
28856
+ _a.sent();
28857
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28927
28858
  }
28928
28859
  });
28929
28860
  }); };
@@ -28952,10 +28883,17 @@ var Page$d = function (_a) {
28952
28883
  return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
28953
28884
  };
28954
28885
  var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28886
+ var theme, provider;
28955
28887
  return __generator(this, function (_a) {
28956
28888
  switch (_a.label) {
28957
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.FAVORITE_PRODUCTS)];
28958
- case 1: return [2 /*return*/, _a.sent()];
28889
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28890
+ case 1:
28891
+ theme = _a.sent();
28892
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.FAVORITE_PRODUCTS);
28893
+ return [4 /*yield*/, provider.getPageData()];
28894
+ case 2:
28895
+ _a.sent();
28896
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28959
28897
  }
28960
28898
  });
28961
28899
  }); };
@@ -28981,10 +28919,17 @@ var Page$e = function (_a) {
28981
28919
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
28982
28920
  };
28983
28921
  var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28922
+ var theme, provider;
28984
28923
  return __generator(this, function (_a) {
28985
28924
  switch (_a.label) {
28986
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.SEARCH)];
28987
- case 1: return [2 /*return*/, _a.sent()];
28925
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
28926
+ case 1:
28927
+ theme = _a.sent();
28928
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.SEARCH);
28929
+ return [4 /*yield*/, provider.getPageData()];
28930
+ case 2:
28931
+ _a.sent();
28932
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
28988
28933
  }
28989
28934
  });
28990
28935
  }); };
@@ -28997,27 +28942,22 @@ var search = /*#__PURE__*/Object.freeze({
28997
28942
 
28998
28943
  var Page$f = function (_a) {
28999
28944
  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
28945
  var router = useRouter();
29003
28946
  var propValues = useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router); }, [propValuesStr]);
29004
28947
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
29005
28948
  };
29006
28949
  var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
29007
- var props;
28950
+ var theme, provider;
29008
28951
  return __generator(this, function (_a) {
29009
28952
  switch (_a.label) {
29010
- case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.NOT_FOUND)];
28953
+ case 0: return [4 /*yield*/, IkasThemeAPI.fetchTheme()];
29011
28954
  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];
28955
+ theme = _a.sent();
28956
+ provider = new IkasPageDataProvider(theme, context.params, IkasThemePageType.NOT_FOUND);
28957
+ return [4 /*yield*/, provider.getPageData()];
28958
+ case 2:
28959
+ _a.sent();
28960
+ return [2 /*return*/, __assign(__assign({}, provider.nextPageData), { revalidate: 60 })];
29021
28961
  }
29022
28962
  });
29023
28963
  }); };
@@ -29043,4 +28983,4 @@ var IkasBaseStore = /** @class */ (function () {
29043
28983
  return IkasBaseStore;
29044
28984
  }());
29045
28985
 
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 };
28986
+ 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 };