@ikas/storefront 0.0.161 → 0.0.162-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -3,26 +3,27 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var mobx = require('mobx');
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var getConfig = require('next/config');
6
9
  var React = require('react');
7
10
  var mobxReactLite = require('mobx-react-lite');
8
11
  var Head = require('next/head');
9
12
  var router = require('next/router');
10
13
  var Link = require('next/link');
11
14
  var NextImage = require('next/image');
12
- var fs = require('fs');
13
- var getConfig = require('next/config');
14
- var serverSideTranslations = require('next-i18next/serverSideTranslations');
15
15
  var dynamic = require('next/dynamic');
16
16
  var Error$1 = require('next/error');
17
17
 
18
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
19
 
20
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
21
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
22
+ var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
20
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
24
  var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
22
25
  var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
23
26
  var NextImage__default = /*#__PURE__*/_interopDefaultLegacy(NextImage);
24
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
25
- var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
26
27
  var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
27
28
  var Error__default = /*#__PURE__*/_interopDefaultLegacy(Error$1);
28
29
 
@@ -10923,6 +10924,7 @@ var IkasStorefrontConfig = /** @class */ (function () {
10923
10924
  fbpId: IkasStorefrontConfig.fbpId || null,
10924
10925
  favicon: JSON.parse(JSON.stringify(IkasStorefrontConfig.favicon)),
10925
10926
  stockPreference: IkasStorefrontConfig.stockPreference || null,
10927
+ translations: this.translations,
10926
10928
  };
10927
10929
  };
10928
10930
  IkasStorefrontConfig.components = {};
@@ -10930,6 +10932,7 @@ var IkasStorefrontConfig = /** @class */ (function () {
10930
10932
  IkasStorefrontConfig.apiUrlOverride = null;
10931
10933
  IkasStorefrontConfig.routings = [];
10932
10934
  IkasStorefrontConfig.paymentGateways = [];
10935
+ IkasStorefrontConfig.translations = {};
10933
10936
  return IkasStorefrontConfig;
10934
10937
  }());
10935
10938
 
@@ -11013,12 +11016,14 @@ var IkasBrand = /** @class */ (function () {
11013
11016
  if (data === void 0) { data = {}; }
11014
11017
  this.metaData = null;
11015
11018
  this.image = null;
11019
+ this.orderType = null;
11016
11020
  this.id = data.id || Date.now() + "";
11017
11021
  this.name = data.name || "";
11018
11022
  this.metaData = data.metaData
11019
11023
  ? new IkasHTMLMetaData(data.metaData)
11020
11024
  : undefined;
11021
11025
  this.image = data.image ? new IkasImage(data.image.id) : null;
11026
+ this.orderType = data.orderType || null;
11022
11027
  mobx.makeAutoObservable(this);
11023
11028
  }
11024
11029
  Object.defineProperty(IkasBrand.prototype, "href", {
@@ -11039,6 +11044,7 @@ var IkasCategory = /** @class */ (function () {
11039
11044
  if (data === void 0) { data = {}; }
11040
11045
  this.metaData = null;
11041
11046
  this.image = null;
11047
+ this.orderType = null;
11042
11048
  this.id = data.id || Date.now() + "";
11043
11049
  this.name = data.name || "";
11044
11050
  this.parentId = data.parentId || null;
@@ -11047,6 +11053,7 @@ var IkasCategory = /** @class */ (function () {
11047
11053
  : undefined;
11048
11054
  this.image = data.image ? new IkasImage(data.image.id) : null;
11049
11055
  this.path = data.path ? data.path.map(function (p) { return new IkasCategoryPath(p); }) : [];
11056
+ this.orderType = data.orderType || null;
11050
11057
  mobx.makeAutoObservable(this);
11051
11058
  }
11052
11059
  Object.defineProperty(IkasCategory.prototype, "href", {
@@ -11113,7 +11120,18 @@ var IkasFilterCategory = /** @class */ (function () {
11113
11120
  return __assign(__assign({}, this), { isSelected: this._isSelected });
11114
11121
  };
11115
11122
  return IkasFilterCategory;
11116
- }());
11123
+ }());
11124
+ var ModelOrder;
11125
+ (function (ModelOrder) {
11126
+ ModelOrder["BEST_SELLER"] = "BEST_SELLER";
11127
+ ModelOrder["HIGHEST_DISCOUNT_RATIO"] = "HIGHEST_DISCOUNT_RATIO";
11128
+ ModelOrder["HIGHEST_PRICE"] = "HIGHEST_PRICE";
11129
+ ModelOrder["LOWEST_DISCOUNT_RATIO"] = "LOWEST_DISCOUNT_RATIO";
11130
+ ModelOrder["LOWEST_PRICE"] = "LOWEST_PRICE";
11131
+ ModelOrder["MANUALLY"] = "MANUALLY";
11132
+ ModelOrder["NEWEST"] = "NEWEST";
11133
+ ModelOrder["OLDEST"] = "OLDEST";
11134
+ })(ModelOrder || (ModelOrder = {}));
11117
11135
 
11118
11136
  var IkasCheckoutSettings = /** @class */ (function () {
11119
11137
  function IkasCheckoutSettings(data) {
@@ -27403,6 +27421,20 @@ var CartStatusEnum;
27403
27421
  CartStatusEnum["ACTIVE"] = "ACTIVE";
27404
27422
  CartStatusEnum["PASSIVE"] = "PASSIVE";
27405
27423
  })(CartStatusEnum || (CartStatusEnum = {}));
27424
+ /**
27425
+ * CategoryProductsOrder Types
27426
+ */
27427
+ var CategoryProductsOrderTypeEnum;
27428
+ (function (CategoryProductsOrderTypeEnum) {
27429
+ CategoryProductsOrderTypeEnum["BEST_SELLER"] = "BEST_SELLER";
27430
+ CategoryProductsOrderTypeEnum["HIGHEST_DISCOUNT_RATIO"] = "HIGHEST_DISCOUNT_RATIO";
27431
+ CategoryProductsOrderTypeEnum["HIGHEST_PRICE"] = "HIGHEST_PRICE";
27432
+ CategoryProductsOrderTypeEnum["LOWEST_DISCOUNT_RATIO"] = "LOWEST_DISCOUNT_RATIO";
27433
+ CategoryProductsOrderTypeEnum["LOWEST_PRICE"] = "LOWEST_PRICE";
27434
+ CategoryProductsOrderTypeEnum["MANUALLY"] = "MANUALLY";
27435
+ CategoryProductsOrderTypeEnum["NEWEST"] = "NEWEST";
27436
+ CategoryProductsOrderTypeEnum["OLDEST"] = "OLDEST";
27437
+ })(CategoryProductsOrderTypeEnum || (CategoryProductsOrderTypeEnum = {}));
27406
27438
  /**
27407
27439
  * Checkout Recovery Email Status Enum
27408
27440
  */
@@ -27738,6 +27770,7 @@ var IkasProductList = /** @class */ (function () {
27738
27770
  this._minPage = null;
27739
27771
  this._filterBrandId = null;
27740
27772
  this._filterCategoryId = null;
27773
+ this.pageSpecificData = null;
27741
27774
  this._recommendFor = null; // productId
27742
27775
  this._isLoading = false;
27743
27776
  this._fetchRequestTime = 0;
@@ -28028,8 +28061,10 @@ var IkasProductList = /** @class */ (function () {
28028
28061
  this._filterCategories = data.filterCategories
28029
28062
  ? data.filterCategories.map(function (c) { return new IkasFilterCategory(c); })
28030
28063
  : null;
28064
+ this.pageSpecificData = data.pageSpecificData || null;
28031
28065
  this.router = router;
28032
28066
  mobx.makeAutoObservable(this);
28067
+ this.setPageSpecificSort();
28033
28068
  if (this.isBrowser()) {
28034
28069
  this.restoreInfiniteScrollPage();
28035
28070
  if (location.search &&
@@ -28243,6 +28278,44 @@ var IkasProductList = /** @class */ (function () {
28243
28278
  enumerable: false,
28244
28279
  configurable: true
28245
28280
  });
28281
+ Object.defineProperty(IkasProductList.prototype, "isFeaturedSortEnabled", {
28282
+ get: function () {
28283
+ var _a;
28284
+ return (((_a = this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.orderType) === ModelOrder.MANUALLY &&
28285
+ [exports.IkasProductListType.ALL, exports.IkasProductListType.CATEGORY].includes(this._type));
28286
+ },
28287
+ enumerable: false,
28288
+ configurable: true
28289
+ });
28290
+ IkasProductList.prototype.setPageSpecificSort = function () {
28291
+ var _a;
28292
+ if (((_a = this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.orderType) &&
28293
+ [exports.IkasProductListType.ALL, exports.IkasProductListType.CATEGORY].includes(this._type)) {
28294
+ switch (this.pageSpecificData.orderType) {
28295
+ case ModelOrder.HIGHEST_DISCOUNT_RATIO:
28296
+ this._sort = exports.IkasProductListSortType.DECRASING_DISCOUNT;
28297
+ break;
28298
+ case ModelOrder.LOWEST_DISCOUNT_RATIO:
28299
+ this._sort = exports.IkasProductListSortType.INCREASING_DISCOUNT;
28300
+ break;
28301
+ case ModelOrder.HIGHEST_PRICE:
28302
+ this._sort = exports.IkasProductListSortType.DECREASING_PRICE;
28303
+ break;
28304
+ case ModelOrder.LOWEST_PRICE:
28305
+ this._sort = exports.IkasProductListSortType.INCREASING_PRICE;
28306
+ break;
28307
+ case ModelOrder.NEWEST:
28308
+ this._sort = exports.IkasProductListSortType.LAST_ADDED;
28309
+ break;
28310
+ case ModelOrder.OLDEST:
28311
+ this._sort = exports.IkasProductListSortType.FIRST_ADDED;
28312
+ break;
28313
+ case ModelOrder.MANUALLY:
28314
+ this._sort = exports.IkasProductListSortType.FEATURED;
28315
+ break;
28316
+ }
28317
+ }
28318
+ };
28246
28319
  IkasProductList.prototype.getSortParams = function () {
28247
28320
  var direction = SortByDirectionEnum.DESC;
28248
28321
  var type = SortByTypeEnum.CREATED_AT;
@@ -28279,6 +28352,10 @@ var IkasProductList = /** @class */ (function () {
28279
28352
  direction = SortByDirectionEnum.DESC;
28280
28353
  type = SortByTypeEnum.DISCOUNT_RATIO;
28281
28354
  break;
28355
+ case exports.IkasProductListSortType.FEATURED:
28356
+ direction = SortByDirectionEnum.ASC;
28357
+ type = SortByTypeEnum.MANUAL_SORT;
28358
+ break;
28282
28359
  }
28283
28360
  return {
28284
28361
  direction: direction,
@@ -28500,6 +28577,7 @@ var IkasProductList = /** @class */ (function () {
28500
28577
  filters: this.filters,
28501
28578
  recommendFor: this._recommendFor,
28502
28579
  productListPropValue: this._productListPropValue,
28580
+ pageSpecificData: this.pageSpecificData,
28503
28581
  };
28504
28582
  };
28505
28583
  IkasProductList.prototype.restoreInfiniteScrollPage = function () {
@@ -28551,6 +28629,7 @@ var IkasProductList = /** @class */ (function () {
28551
28629
  IkasProductListSortType["FIRST_ADDED"] = "FIRST_ADDED";
28552
28630
  IkasProductListSortType["INCREASING_DISCOUNT"] = "INCREASING_DISCOUNT";
28553
28631
  IkasProductListSortType["DECRASING_DISCOUNT"] = "DECRASING_DISCOUNT";
28632
+ IkasProductListSortType["FEATURED"] = "FEATURED";
28554
28633
  })(exports.IkasProductListSortType || (exports.IkasProductListSortType = {}));
28555
28634
 
28556
28635
  /**
@@ -30615,6 +30694,12 @@ var IkasProductListPropValueProvider = /** @class */ (function () {
30615
30694
  filterBrandId: filterBrandId,
30616
30695
  filterCategoryId: filterCategoryId,
30617
30696
  pageType: this.pageType,
30697
+ pageSpecificData: [
30698
+ exports.IkasThemePageType.CATEGORY,
30699
+ exports.IkasThemePageType.BRAND,
30700
+ ].includes(this.pageType)
30701
+ ? this.pageSpecificData
30702
+ : undefined,
30618
30703
  });
30619
30704
  //@ts-ignore
30620
30705
  return [4 /*yield*/, productList.getInitial()];
@@ -31991,6 +32076,20 @@ function stringSorter(atitle, btitle) {
31991
32076
  }
31992
32077
  }
31993
32078
  return 0;
32079
+ }
32080
+ function findAllIndexes(str, pattern) {
32081
+ var indexes = [];
32082
+ if (!str || !pattern)
32083
+ return [];
32084
+ var index = 0;
32085
+ while (index < str.length) {
32086
+ var patternIndex = str.indexOf(pattern, index);
32087
+ if (patternIndex === -1)
32088
+ break;
32089
+ index = patternIndex + 1;
32090
+ indexes.push(patternIndex);
32091
+ }
32092
+ return indexes;
31994
32093
  }
31995
32094
 
31996
32095
  var ThemeComponent = mobxReactLite.observer(function (_a) {
@@ -33128,6 +33227,178 @@ var formatMoney = function (price, currency) {
33128
33227
  return formatter.format(price);
33129
33228
  };
33130
33229
 
33230
+ var I18NFileReader = /** @class */ (function () {
33231
+ function I18NFileReader(locale, namespaces, localePath) {
33232
+ this.locale = locale;
33233
+ this.namespaces = namespaces;
33234
+ this.localePath = localePath;
33235
+ }
33236
+ I18NFileReader.prototype.read = function () {
33237
+ return __awaiter(this, void 0, void 0, function () {
33238
+ var serverRuntimeConfig, translations, _i, _a, namespace, filePath, fileExists, localeTranslation, err_1;
33239
+ return __generator(this, function (_b) {
33240
+ switch (_b.label) {
33241
+ case 0:
33242
+ serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
33243
+ translations = {};
33244
+ _i = 0, _a = this.namespaces;
33245
+ _b.label = 1;
33246
+ case 1:
33247
+ if (!(_i < _a.length)) return [3 /*break*/, 7];
33248
+ namespace = _a[_i];
33249
+ _b.label = 2;
33250
+ case 2:
33251
+ _b.trys.push([2, 5, , 6]);
33252
+ filePath = this.localePath
33253
+ ? path__default['default'].join(this.localePath, this.locale, namespace + ".json")
33254
+ : path__default['default'].join(serverRuntimeConfig.PROJECT_ROOT, "public", "locales", this.locale, namespace + ".json");
33255
+ fileExists = fs__default['default'].existsSync(filePath);
33256
+ if (!fileExists) return [3 /*break*/, 4];
33257
+ return [4 /*yield*/, this.readLocaleFile(filePath)];
33258
+ case 3:
33259
+ localeTranslation = _b.sent();
33260
+ translations[namespace] = localeTranslation;
33261
+ _b.label = 4;
33262
+ case 4: return [3 /*break*/, 6];
33263
+ case 5:
33264
+ err_1 = _b.sent();
33265
+ console.error(err_1);
33266
+ return [3 /*break*/, 6];
33267
+ case 6:
33268
+ _i++;
33269
+ return [3 /*break*/, 1];
33270
+ case 7: return [2 /*return*/, translations];
33271
+ }
33272
+ });
33273
+ });
33274
+ };
33275
+ I18NFileReader.prototype.readLocaleFile = function (filePath) {
33276
+ return __awaiter(this, void 0, void 0, function () {
33277
+ return __generator(this, function (_a) {
33278
+ return [2 /*return*/, new Promise(function (resolve, reject) {
33279
+ fs__default['default'].readFile(filePath, {
33280
+ flag: "r",
33281
+ }, function (err, file) {
33282
+ if (err) {
33283
+ return reject(err);
33284
+ }
33285
+ var result = file.length ? JSON.parse(file.toString()) : {};
33286
+ resolve(result);
33287
+ });
33288
+ })];
33289
+ });
33290
+ });
33291
+ };
33292
+ return I18NFileReader;
33293
+ }());
33294
+ function t(pathString, params) {
33295
+ var namespace = "common";
33296
+ var path = "";
33297
+ var parts = pathString.split(":");
33298
+ if (parts.length > 2) {
33299
+ return pathString;
33300
+ }
33301
+ else if (parts.length === 2) {
33302
+ namespace = parts[0];
33303
+ path = parts[1];
33304
+ }
33305
+ else {
33306
+ path = parts[0];
33307
+ }
33308
+ var namespaceTranslations = IkasStorefrontConfig.translations[namespace];
33309
+ if (!namespaceTranslations)
33310
+ return pathString;
33311
+ var str = get_1(namespaceTranslations, path);
33312
+ if (str) {
33313
+ if (params) {
33314
+ var allInputData = createInputData(str);
33315
+ var newStr = "";
33316
+ for (var _i = 0, allInputData_1 = allInputData; _i < allInputData_1.length; _i++) {
33317
+ var inputData = allInputData_1[_i];
33318
+ if (inputData.isVariable) {
33319
+ var variableName = inputData.value
33320
+ .replace("{{", "")
33321
+ .replace("}}", "")
33322
+ .trim();
33323
+ if (params[variableName]) {
33324
+ newStr += params[variableName];
33325
+ }
33326
+ else {
33327
+ newStr += inputData.value;
33328
+ }
33329
+ }
33330
+ else {
33331
+ newStr += inputData.value;
33332
+ }
33333
+ }
33334
+ return newStr;
33335
+ }
33336
+ else
33337
+ return str;
33338
+ }
33339
+ return pathString;
33340
+ }
33341
+ function useTranslation(namespace) {
33342
+ return {
33343
+ t: t,
33344
+ };
33345
+ }
33346
+ function createInputData(value) {
33347
+ var currentData = [];
33348
+ if (!value)
33349
+ return currentData;
33350
+ var variableStartIndexes = findAllIndexes(value, "{{");
33351
+ var variableEndIndexes = findAllIndexes(value, "}}");
33352
+ var variableIndexPairs = variableStartIndexes.map(function (startIndex, index) {
33353
+ var endIndex = variableEndIndexes[index] + 1;
33354
+ return {
33355
+ start: startIndex,
33356
+ end: endIndex,
33357
+ };
33358
+ });
33359
+ var isVariableIndex = function (index) {
33360
+ return variableIndexPairs.some(function (pair) { return pair.start <= index && pair.end >= index; });
33361
+ };
33362
+ var currentValue = "";
33363
+ var isVariable = false;
33364
+ for (var i = 0; i < value.length; i++) {
33365
+ var currentChar = value.charAt(i);
33366
+ if (isVariable) {
33367
+ if (isVariableIndex(i)) {
33368
+ currentValue += currentChar;
33369
+ }
33370
+ else {
33371
+ currentData.push({
33372
+ isVariable: true,
33373
+ value: currentValue,
33374
+ });
33375
+ currentValue = currentChar;
33376
+ isVariable = false;
33377
+ }
33378
+ }
33379
+ else {
33380
+ if (isVariableIndex(i)) {
33381
+ currentData.push({
33382
+ isVariable: false,
33383
+ value: currentValue,
33384
+ });
33385
+ currentValue = currentChar;
33386
+ isVariable = true;
33387
+ }
33388
+ else {
33389
+ currentValue += currentChar;
33390
+ }
33391
+ }
33392
+ if (i === value.length - 1) {
33393
+ currentData.push({
33394
+ isVariable: isVariable,
33395
+ value: currentValue,
33396
+ });
33397
+ }
33398
+ }
33399
+ return currentData;
33400
+ }
33401
+
33131
33402
  var IkasImage = /** @class */ (function () {
33132
33403
  function IkasImage(id) {
33133
33404
  this.id = id;
@@ -33484,7 +33755,7 @@ var IkasBrandAPI = /** @class */ (function () {
33484
33755
  return __generator(this, function (_b) {
33485
33756
  switch (_b.label) {
33486
33757
  case 0:
33487
- LIST_QUERY = src(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n query listProductBrand(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listProductBrand(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n name\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "], ["\n query listProductBrand(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listProductBrand(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n name\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "])));
33758
+ LIST_QUERY = src(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n query listProductBrand(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listProductBrand(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n name\n imageId\n orderType\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "], ["\n query listProductBrand(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listProductBrand(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n name\n imageId\n orderType\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n }\n count\n }\n }\n "])));
33488
33759
  _b.label = 1;
33489
33760
  case 1:
33490
33761
  _b.trys.push([1, 3, , 4]);
@@ -33523,6 +33794,7 @@ var IkasBrandAPI = /** @class */ (function () {
33523
33794
  name: b.name,
33524
33795
  metaData: b.metaData || undefined,
33525
33796
  image: b.imageId ? new IkasImage(b.imageId) : undefined,
33797
+ orderType: b.orderType,
33526
33798
  });
33527
33799
  });
33528
33800
  return [2 /*return*/, {
@@ -33633,7 +33905,7 @@ var IkasCategoryAPI = /** @class */ (function () {
33633
33905
  return __generator(this, function (_b) {
33634
33906
  switch (_b.label) {
33635
33907
  case 0:
33636
- LIST_QUERY = src(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n query listCategory(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listCategory(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryPath\n }\n count\n }\n }\n "], ["\n query listCategory(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listCategory(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryPath\n }\n count\n }\n }\n "])));
33908
+ LIST_QUERY = src(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n query listCategory(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listCategory(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n orderType\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryPath\n }\n count\n }\n }\n "], ["\n query listCategory(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $sort: String\n ) {\n listCategory(\n id: $id\n pagination: $pagination\n search: $search\n sort: $sort\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n parentId\n imageId\n orderType\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n categoryPath\n }\n count\n }\n }\n "])));
33637
33909
  _b.label = 1;
33638
33910
  case 1:
33639
33911
  _b.trys.push([1, 10, , 11]);
@@ -33672,6 +33944,7 @@ var IkasCategoryAPI = /** @class */ (function () {
33672
33944
  parentId: c.parentId,
33673
33945
  metaData: c.metaData || undefined,
33674
33946
  image: c.imageId ? new IkasImage(c.imageId) : undefined,
33947
+ orderType: c.orderType,
33675
33948
  });
33676
33949
  });
33677
33950
  _b.label = 3;
@@ -37174,7 +37447,92 @@ var style = {
37174
37447
  backgroundColor: "rgba(255, 0, 0, 0.5)",
37175
37448
  };
37176
37449
 
37177
- var PACKAGE_VERSION = "0.0.158";
37450
+ var IkasStorefrontLocalization = /** @class */ (function () {
37451
+ function IkasStorefrontLocalization(data) {
37452
+ this.id = data.id || "";
37453
+ this.isDefault = data.isDefault || false;
37454
+ this.locale = data.locale || "";
37455
+ this.name = data.name || "";
37456
+ }
37457
+ return IkasStorefrontLocalization;
37458
+ }());
37459
+
37460
+ var IkasStorefrontDomain = /** @class */ (function () {
37461
+ function IkasStorefrontDomain(data) {
37462
+ if (data === void 0) { data = {}; }
37463
+ this.id = data.id || "";
37464
+ this.merchantDomainId = data.merchantDomainId || "";
37465
+ this.name = data.name || "";
37466
+ this.redirectDomainName = data.redirectDomainName || null;
37467
+ this.isDefault = data.isDefault || false;
37468
+ mobx.makeAutoObservable(this);
37469
+ }
37470
+ return IkasStorefrontDomain;
37471
+ }());
37472
+
37473
+ var IkasStorefrontRouting = /** @class */ (function () {
37474
+ function IkasStorefrontRouting(data) {
37475
+ this.id = data.id || "";
37476
+ this.countryCodes = data.countryCodes || null;
37477
+ this.domain = data.domain || null;
37478
+ this.locale = data.locale || "";
37479
+ this.path = data.path || null;
37480
+ this.priceListId = data.priceListId || null;
37481
+ }
37482
+ return IkasStorefrontRouting;
37483
+ }());
37484
+
37485
+ var IkasStorefrontThemeStatus;
37486
+ (function (IkasStorefrontThemeStatus) {
37487
+ IkasStorefrontThemeStatus["WAITING"] = "WAITING";
37488
+ IkasStorefrontThemeStatus["READY"] = "READY";
37489
+ })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
37490
+ var IkasStorefrontTheme = /** @class */ (function () {
37491
+ function IkasStorefrontTheme(data) {
37492
+ this.id = data.id || "";
37493
+ this.isMainTheme = data.isMainTheme || false;
37494
+ this.name = data.name || "";
37495
+ this.status = data.status || IkasStorefrontThemeStatus.WAITING;
37496
+ this.themeId = data.themeId || "";
37497
+ this.themeVersionId = data.themeVersionId || "";
37498
+ }
37499
+ return IkasStorefrontTheme;
37500
+ }());
37501
+
37502
+ var StorefrontStatus;
37503
+ (function (StorefrontStatus) {
37504
+ StorefrontStatus["WAITING"] = "WAITING";
37505
+ StorefrontStatus["READY"] = "READY";
37506
+ })(StorefrontStatus || (StorefrontStatus = {}));
37507
+ var IkasStorefront = /** @class */ (function () {
37508
+ function IkasStorefront(data) {
37509
+ if (data === void 0) { data = {}; }
37510
+ this.id = data.id || "";
37511
+ this.name = data.name || "";
37512
+ this.status = data.status || StorefrontStatus.WAITING;
37513
+ this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
37514
+ this.emailSettingsId = data.emailSettingsId || null;
37515
+ this.salesChannelId = data.salesChannelId || null;
37516
+ this.gtmId = data.gtmId || null;
37517
+ this.fbpId = data.fbpId || null;
37518
+ // Sub Models
37519
+ this.localizations = data.localizations
37520
+ ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
37521
+ : [];
37522
+ this.routings = data.routings
37523
+ ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
37524
+ : [];
37525
+ this.domains = data.domains
37526
+ ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
37527
+ : [];
37528
+ this.themes = data.themes
37529
+ ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
37530
+ : [];
37531
+ }
37532
+ return IkasStorefront;
37533
+ }());
37534
+
37535
+ var PACKAGE_VERSION = "0.0.161";
37178
37536
  var PageViewModel = /** @class */ (function () {
37179
37537
  function PageViewModel(router) {
37180
37538
  var _this = this;
@@ -37184,6 +37542,8 @@ var PageViewModel = /** @class */ (function () {
37184
37542
  this.hoveredPageComponentId = null;
37185
37543
  this.componentRefs = {};
37186
37544
  this.isLoading = false;
37545
+ // Sent from dashboard for localization (handleUpdateFrameData)
37546
+ this.locale = "en";
37187
37547
  this.pageParams = {};
37188
37548
  this.queryParams = {};
37189
37549
  this.apiKey = null;
@@ -37328,6 +37688,8 @@ var PageViewModel = /** @class */ (function () {
37328
37688
  };
37329
37689
  // Message Handlers
37330
37690
  this.handleUpdateFrameData = function (data) { return __awaiter(_this, void 0, void 0, function () {
37691
+ var storefront, _storefront, routing;
37692
+ var _this = this;
37331
37693
  return __generator(this, function (_a) {
37332
37694
  switch (_a.label) {
37333
37695
  case 0:
@@ -37336,6 +37698,27 @@ var PageViewModel = /** @class */ (function () {
37336
37698
  this.pageParams = data.pageParams;
37337
37699
  this.queryParams = data.queryParams;
37338
37700
  this.apiKey = data.apiKey;
37701
+ this.locale = data.locale || "en";
37702
+ this.translations = data.translations || undefined;
37703
+ storefront = data.storefront;
37704
+ if (storefront) {
37705
+ _storefront = new IkasStorefront(storefront);
37706
+ routing = _storefront.routings.find(function (sr) { return sr.locale === _this.locale; });
37707
+ IkasStorefrontConfig.storefrontId = _storefront.id;
37708
+ IkasStorefrontConfig.storefrontRoutingId = routing === null || routing === void 0 ? void 0 : routing.id;
37709
+ if (_storefront.mainStorefrontThemeId)
37710
+ IkasStorefrontConfig.storefrontThemeId =
37711
+ _storefront.mainStorefrontThemeId;
37712
+ if (_storefront.salesChannelId)
37713
+ IkasStorefrontConfig.salesChannelId = _storefront.salesChannelId;
37714
+ if (routing === null || routing === void 0 ? void 0 : routing.priceListId)
37715
+ IkasStorefrontConfig.priceListId = routing.priceListId;
37716
+ IkasStorefrontConfig.routings = _storefront.routings;
37717
+ IkasStorefrontConfig.stockPreference = this.theme.settings.stockPreference;
37718
+ }
37719
+ // Production editor mode
37720
+ if (this.translations)
37721
+ IkasStorefrontConfig.translations = this.translations;
37339
37722
  apollo.createApolloClient(this.apiKey || undefined);
37340
37723
  window.editorApiKey = data.apiKey;
37341
37724
  return [4 /*yield*/, this.getPagePropValues()];
@@ -37659,115 +38042,6 @@ var index = /*#__PURE__*/Object.freeze({
37659
38042
  Image: Image
37660
38043
  });
37661
38044
 
37662
- /**
37663
- * Creates a duplicate-free version of an array, using
37664
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
37665
- * for equality comparisons, in which only the first occurrence of each element
37666
- * is kept. The order of result values is determined by the order they occur
37667
- * in the array.
37668
- *
37669
- * @static
37670
- * @memberOf _
37671
- * @since 0.1.0
37672
- * @category Array
37673
- * @param {Array} array The array to inspect.
37674
- * @returns {Array} Returns the new duplicate free array.
37675
- * @example
37676
- *
37677
- * _.uniq([2, 1, 2]);
37678
- * // => [2, 1]
37679
- */
37680
- function uniq(array) {
37681
- return (array && array.length) ? _baseUniq(array) : [];
37682
- }
37683
-
37684
- var uniq_1 = uniq;
37685
-
37686
- var IkasStorefrontLocalization = /** @class */ (function () {
37687
- function IkasStorefrontLocalization(data) {
37688
- this.id = data.id || "";
37689
- this.isDefault = data.isDefault || false;
37690
- this.locale = data.locale || "";
37691
- this.name = data.name || "";
37692
- }
37693
- return IkasStorefrontLocalization;
37694
- }());
37695
-
37696
- var IkasStorefrontDomain = /** @class */ (function () {
37697
- function IkasStorefrontDomain(data) {
37698
- if (data === void 0) { data = {}; }
37699
- this.id = data.id || "";
37700
- this.merchantDomainId = data.merchantDomainId || "";
37701
- this.name = data.name || "";
37702
- this.redirectDomainName = data.redirectDomainName || null;
37703
- this.isDefault = data.isDefault || false;
37704
- mobx.makeAutoObservable(this);
37705
- }
37706
- return IkasStorefrontDomain;
37707
- }());
37708
-
37709
- var IkasStorefrontRouting = /** @class */ (function () {
37710
- function IkasStorefrontRouting(data) {
37711
- this.id = data.id || "";
37712
- this.countryCodes = data.countryCodes || null;
37713
- this.domain = data.domain || null;
37714
- this.locale = data.locale || "";
37715
- this.path = data.path || null;
37716
- this.priceListId = data.priceListId || null;
37717
- }
37718
- return IkasStorefrontRouting;
37719
- }());
37720
-
37721
- var IkasStorefrontThemeStatus;
37722
- (function (IkasStorefrontThemeStatus) {
37723
- IkasStorefrontThemeStatus["WAITING"] = "WAITING";
37724
- IkasStorefrontThemeStatus["READY"] = "READY";
37725
- })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
37726
- var IkasStorefrontTheme = /** @class */ (function () {
37727
- function IkasStorefrontTheme(data) {
37728
- this.id = data.id || "";
37729
- this.isMainTheme = data.isMainTheme || false;
37730
- this.name = data.name || "";
37731
- this.status = data.status || IkasStorefrontThemeStatus.WAITING;
37732
- this.themeId = data.themeId || "";
37733
- this.themeVersionId = data.themeVersionId || "";
37734
- }
37735
- return IkasStorefrontTheme;
37736
- }());
37737
-
37738
- var StorefrontStatus;
37739
- (function (StorefrontStatus) {
37740
- StorefrontStatus["WAITING"] = "WAITING";
37741
- StorefrontStatus["READY"] = "READY";
37742
- })(StorefrontStatus || (StorefrontStatus = {}));
37743
- var IkasStorefront = /** @class */ (function () {
37744
- function IkasStorefront(data) {
37745
- if (data === void 0) { data = {}; }
37746
- this.id = data.id || "";
37747
- this.name = data.name || "";
37748
- this.status = data.status || StorefrontStatus.WAITING;
37749
- this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
37750
- this.emailSettingsId = data.emailSettingsId || null;
37751
- this.salesChannelId = data.salesChannelId || null;
37752
- this.gtmId = data.gtmId || null;
37753
- this.fbpId = data.fbpId || null;
37754
- // Sub Models
37755
- this.localizations = data.localizations
37756
- ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
37757
- : [];
37758
- this.routings = data.routings
37759
- ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
37760
- : [];
37761
- this.domains = data.domains
37762
- ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
37763
- : [];
37764
- this.themes = data.themes
37765
- ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
37766
- : [];
37767
- }
37768
- return IkasStorefront;
37769
- }());
37770
-
37771
38045
  var IkasSalesChannel = /** @class */ (function () {
37772
38046
  function IkasSalesChannel(data) {
37773
38047
  if (data === void 0) { data = {}; }
@@ -37972,26 +38246,29 @@ var SettingsHelper = /** @class */ (function () {
37972
38246
  SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes, isEditor) {
37973
38247
  var _a;
37974
38248
  return __awaiter(this, void 0, void 0, function () {
37975
- var isLocal, locale, serverRuntimeConfig, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, nextI18nConf, routingLocales, defaultRoutingLocale, _b, _c;
37976
- var _d, _e;
37977
- return __generator(this, function (_f) {
37978
- switch (_f.label) {
38249
+ var isLocal, isProdEditor, serverRuntimeConfig, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds_1, components, componentDirs, nextI18nConf, currentLocale, i18nReader, translations;
38250
+ return __generator(this, function (_b) {
38251
+ switch (_b.label) {
37979
38252
  case 0:
37980
38253
  isLocal = process.env.NEXT_PUBLIC_ENV === "local";
37981
- locale = isLocal ? "en" : context.locale;
38254
+ isProdEditor = !isLocal && isEditor;
38255
+ serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
38256
+ if (!!isProdEditor) return [3 /*break*/, 5];
38257
+ locale = context.locale;
37982
38258
  if (!locale) {
38259
+ console.log("locale not found");
37983
38260
  return [2 /*return*/, {
37984
38261
  props: {},
37985
38262
  notFound: true,
37986
38263
  }];
37987
38264
  }
37988
- serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
37989
38265
  return [4 /*yield*/, SettingsHelper.getSettings(locale)];
37990
38266
  case 1:
37991
- settings = _f.sent();
38267
+ settings = _b.sent();
37992
38268
  if (!settings ||
37993
38269
  !settings.storefront.mainStorefrontThemeId ||
37994
38270
  !settings.storefront.salesChannelId) {
38271
+ console.log("id not found", settings === null || settings === void 0 ? void 0 : settings.storefront.mainStorefrontThemeId, settings === null || settings === void 0 ? void 0 : settings.storefront.salesChannelId);
37995
38272
  return [2 /*return*/, {
37996
38273
  props: {},
37997
38274
  notFound: true,
@@ -38015,55 +38292,40 @@ var SettingsHelper = /** @class */ (function () {
38015
38292
  if (!!isEditor) return [3 /*break*/, 3];
38016
38293
  return [4 /*yield*/, provider.getPageData()];
38017
38294
  case 2:
38018
- _f.sent();
38019
- _f.label = 3;
38020
- case 3:
38295
+ _b.sent();
38021
38296
  if (!provider.page) {
38022
- if (!isEditor)
38023
- return [2 /*return*/, {
38024
- props: {},
38025
- notFound: true,
38026
- }];
38297
+ return [2 /*return*/, {
38298
+ props: {},
38299
+ notFound: true,
38300
+ }];
38027
38301
  }
38028
- componentIds = isEditor
38302
+ _b.label = 3;
38303
+ case 3:
38304
+ componentIds_1 = isEditor
38029
38305
  ? provider.theme.components.map(function (c) { return c.id; })
38030
38306
  : provider.page.components.map(function (pc) { return pc.componentId; });
38031
- components = themeLocalization.themeJson.components.filter(function (c) { return isEditor || componentIds.includes(c.id); });
38307
+ components = themeLocalization.themeJson.components.filter(function (c) { return isEditor || componentIds_1.includes(c.id); });
38032
38308
  componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
38033
38309
  nextI18nConf = serverRuntimeConfig.nextI18nConf;
38034
- routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
38035
- defaultRoutingLocale = routing.locale;
38036
- if (!isServer) return [3 /*break*/, 5];
38037
- _d = {};
38038
- _b = [{}];
38039
- return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
38040
- ? undefined
38041
- : {
38042
- i18n: {
38043
- locales: routingLocales,
38044
- defaultLocale: defaultRoutingLocale,
38045
- },
38046
- serializeConfig: false,
38047
- localePath: nextI18nConf.localePath,
38048
- })];
38049
- case 4: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
38050
- _d)];
38051
- case 5:
38052
- _e = {};
38053
- _c = [{}];
38054
- return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
38055
- ? undefined
38056
- : {
38057
- i18n: {
38058
- locales: routingLocales,
38059
- defaultLocale: defaultRoutingLocale,
38060
- },
38061
- serializeConfig: false,
38062
- localePath: nextI18nConf.localePath,
38063
- })];
38064
- case 6: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
38065
- _e.revalidate = 60,
38066
- _e)];
38310
+ currentLocale = routing.locale;
38311
+ i18nReader = new I18NFileReader(currentLocale, componentDirs, isLocal ? undefined : nextI18nConf.localePath);
38312
+ return [4 /*yield*/, i18nReader.read()];
38313
+ case 4:
38314
+ translations = _b.sent();
38315
+ IkasStorefrontConfig.translations = translations;
38316
+ if (isServer)
38317
+ return [2 /*return*/, {
38318
+ props: provider.nextPageData.props,
38319
+ }];
38320
+ else
38321
+ return [2 /*return*/, {
38322
+ props: provider.nextPageData.props,
38323
+ revalidate: 60,
38324
+ }];
38325
+ case 5: return [2 /*return*/, {
38326
+ props: {},
38327
+ }];
38328
+ case 6: return [2 /*return*/];
38067
38329
  }
38068
38330
  });
38069
38331
  });
@@ -38149,27 +38411,26 @@ var Page$1 = function (_a) {
38149
38411
  };
38150
38412
  var index$1 = mobxReactLite.observer(Page$1);
38151
38413
  var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
38152
- var targetTypes, metaData;
38153
38414
  return __generator(this, function (_a) {
38154
- switch (_a.label) {
38155
- case 0:
38156
- targetTypes = [
38157
- exports.IkasHTMLMetaDataTargetType.BRAND,
38158
- exports.IkasHTMLMetaDataTargetType.CATEGORY,
38159
- ];
38160
- return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(undefined, undefined, targetTypes)];
38161
- case 1:
38162
- metaData = _a.sent();
38163
- return [2 /*return*/, {
38164
- paths: metaData.map(function (m) { return ({
38165
- params: {
38166
- slug: m.slug,
38167
- originalSlug: m.slug,
38168
- },
38169
- }); }),
38170
- fallback: "blocking",
38171
- }];
38172
- }
38415
+ // const targetTypes = [
38416
+ // IkasHTMLMetaDataTargetType.BRAND,
38417
+ // IkasHTMLMetaDataTargetType.CATEGORY,
38418
+ // ];
38419
+ // const metaData = await IkasHTMLMetaDataAPI.listHTMLMetaData(
38420
+ // undefined,
38421
+ // undefined,
38422
+ // targetTypes
38423
+ // );
38424
+ // metaData.map((m) => ({
38425
+ // params: {
38426
+ // slug: m.slug,
38427
+ // originalSlug: m.slug,
38428
+ // },
38429
+ // }))
38430
+ return [2 /*return*/, {
38431
+ paths: [],
38432
+ fallback: "blocking",
38433
+ }];
38173
38434
  });
38174
38435
  }); };
38175
38436
  var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -38302,17 +38563,16 @@ var CheckoutPage = function (_a) {
38302
38563
  };
38303
38564
  var _id_ = mobxReactLite.observer(CheckoutPage);
38304
38565
  var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
38305
- var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings, componentDirs, isLocal, serverRuntimeConfig, routingLocales, defaultRoutingLocale, nextI18nConf, _a;
38306
- var _b;
38307
- var _c;
38308
- return __generator(this, function (_d) {
38309
- switch (_d.label) {
38566
+ var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings, componentDirs, isLocal, serverRuntimeConfig, currentLocale, nextI18nConf, i18nReader, translations;
38567
+ var _a;
38568
+ return __generator(this, function (_b) {
38569
+ switch (_b.label) {
38310
38570
  case 0:
38311
38571
  id = context.query.id;
38312
38572
  locale = context.locale || context.defaultLocale || "en";
38313
38573
  return [4 /*yield*/, SettingsHelper.getSettings(locale)];
38314
38574
  case 1:
38315
- settings = _d.sent();
38575
+ settings = _b.sent();
38316
38576
  // TODO maybe remove this and convert this page to static
38317
38577
  if (!settings ||
38318
38578
  !settings.storefront.mainStorefrontThemeId ||
@@ -38328,7 +38588,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
38328
38588
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
38329
38589
  IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
38330
38590
  IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
38331
- IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
38591
+ IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
38332
38592
  IkasStorefrontConfig.routings = storefront.routings;
38333
38593
  IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
38334
38594
  IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
@@ -38344,32 +38604,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
38344
38604
  }
38345
38605
  return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
38346
38606
  case 2:
38347
- checkout = _d.sent();
38607
+ checkout = _b.sent();
38348
38608
  if (!checkout) return [3 /*break*/, 5];
38349
38609
  return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
38350
38610
  case 3:
38351
- checkoutSettings = _d.sent();
38611
+ checkoutSettings = _b.sent();
38352
38612
  componentDirs = ["common", "checkout-page"];
38353
38613
  isLocal = process.env.NEXT_PUBLIC_ENV === "local";
38354
38614
  serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
38355
- routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
38356
- defaultRoutingLocale = routing.locale;
38615
+ currentLocale = routing.locale;
38357
38616
  nextI18nConf = serverRuntimeConfig.nextI18nConf;
38358
- _b = {};
38359
- _a = [{}];
38360
- return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
38361
- ? undefined
38362
- : {
38363
- i18n: {
38364
- locales: routingLocales,
38365
- defaultLocale: defaultRoutingLocale,
38366
- },
38367
- serializeConfig: false,
38368
- localePath: nextI18nConf.localePath,
38369
- })];
38370
- case 4: return [2 /*return*/, (_b.props = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), { checkoutStr: JSON.stringify(checkout), checkoutSettingsStr: (checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.length) ? JSON.stringify(checkoutSettings[0])
38371
- : null, configJson: IkasStorefrontConfig.getJson(), returnPolicy: themeLocalization.returnPolicy || "", privacyPolicy: themeLocalization.privacyPolicy || "", termsOfService: themeLocalization.termsOfService || "", queryParams: context.query }]),
38372
- _b)];
38617
+ i18nReader = new I18NFileReader(currentLocale, componentDirs, isLocal ? undefined : nextI18nConf.localePath);
38618
+ return [4 /*yield*/, i18nReader.read()];
38619
+ case 4:
38620
+ translations = _b.sent();
38621
+ IkasStorefrontConfig.translations = translations;
38622
+ return [2 /*return*/, {
38623
+ props: {
38624
+ checkoutStr: JSON.stringify(checkout),
38625
+ checkoutSettingsStr: (checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.length) ? JSON.stringify(checkoutSettings[0])
38626
+ : null,
38627
+ configJson: IkasStorefrontConfig.getJson(),
38628
+ returnPolicy: themeLocalization.returnPolicy || "",
38629
+ privacyPolicy: themeLocalization.privacyPolicy || "",
38630
+ termsOfService: themeLocalization.termsOfService || "",
38631
+ queryParams: context.query,
38632
+ },
38633
+ }];
38373
38634
  case 5: return [2 /*return*/, redirect()];
38374
38635
  }
38375
38636
  });
@@ -38602,7 +38863,10 @@ var cart = /*#__PURE__*/Object.freeze({
38602
38863
  });
38603
38864
 
38604
38865
  var IkasPageEditor$1 = dynamic__default['default'](function () { return Promise.resolve().then(function () { return index; }).then(function (mod) { return mod.IkasPageEditor; }); }, { ssr: false });
38605
- var Page$c = function () {
38866
+ var Page$c = function (_a) {
38867
+ var configJson = _a.configJson;
38868
+ if (configJson)
38869
+ IkasStorefrontConfig.initWithJson(configJson);
38606
38870
  return React.createElement(IkasPageEditor$1, null);
38607
38871
  };
38608
38872
  var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -39037,6 +39301,7 @@ exports.ValidationRule = ValidationRule;
39037
39301
  exports.Validator = Validator;
39038
39302
  exports.apollo = apollo;
39039
39303
  exports.decodeBase64 = decodeBase64;
39304
+ exports.findAllIndexes = findAllIndexes;
39040
39305
  exports.formatMoney = formatMoney;
39041
39306
  exports.getPlaceholderBlog = getPlaceholderBlog;
39042
39307
  exports.getPlaceholderBlogCategory = getPlaceholderBlogCategory;
@@ -39047,4 +39312,5 @@ exports.parseRangeStr = parseRangeStr;
39047
39312
  exports.pascalCase = pascalCase;
39048
39313
  exports.stringSorter = stringSorter;
39049
39314
  exports.stringToSlug = stringToSlug;
39315
+ exports.useTranslation = useTranslation;
39050
39316
  exports.validatePhoneNumber = validatePhoneNumber;