@ikas/storefront 0.0.160 → 0.0.161-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.
@@ -221,6 +221,7 @@ export declare enum ProductFilterDisplayTypeEnum {
221
221
  export declare enum ProductFilterSortTypeEnum {
222
222
  ALPHABETICAL_ASC = "ALPHABETICAL_ASC",
223
223
  ALPHABETICAL_DESC = "ALPHABETICAL_DESC",
224
+ CUSTOM_SORT = "CUSTOM_SORT",
224
225
  PRODUCT_COUNT_ASC = "PRODUCT_COUNT_ASC",
225
226
  PRODUCT_COUNT_DESC = "PRODUCT_COUNT_DESC"
226
227
  }
@@ -262,6 +263,7 @@ export declare enum SortByDirectionEnum {
262
263
  export declare enum SortByTypeEnum {
263
264
  CREATED_AT = "CREATED_AT",
264
265
  DISCOUNT_RATIO = "DISCOUNT_RATIO",
266
+ MANUAL_SORT = "MANUAL_SORT",
265
267
  NAME = "NAME",
266
268
  PRICE = "PRICE"
267
269
  }
@@ -67,4 +67,5 @@ export interface registerCustomerVariables {
67
67
  password: string;
68
68
  firstName: string;
69
69
  lastName: string;
70
+ isAcceptMarketing?: boolean | null;
70
71
  }
@@ -9,7 +9,7 @@ export declare class IkasCustomerAPI {
9
9
  token: string;
10
10
  tokenExpiry: number;
11
11
  } | undefined>;
12
- static register(email: string, password: string, firstName: string, lastName: string): Promise<{
12
+ static register(email: string, password: string, firstName: string, lastName: string, isAcceptMarketing?: boolean): Promise<{
13
13
  customer: IkasCustomer;
14
14
  __typename: "CustomerLoginResponse";
15
15
  token: string;
package/build/index.es.js CHANGED
@@ -7,6 +7,7 @@ import Link from 'next/link';
7
7
  import NextImage from 'next/image';
8
8
  import fs from 'fs';
9
9
  import getConfig from 'next/config';
10
+ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
10
11
  import dynamic from 'next/dynamic';
11
12
  import Error$1 from 'next/error';
12
13
 
@@ -23547,11 +23548,11 @@ var IkasCustomerStore = /** @class */ (function () {
23547
23548
  }
23548
23549
  });
23549
23550
  }); };
23550
- this.register = function (firstName, lastName, email, password) { return __awaiter(_this, void 0, void 0, function () {
23551
+ this.register = function (firstName, lastName, email, password, isMarketingAccepted) { return __awaiter(_this, void 0, void 0, function () {
23551
23552
  var response;
23552
23553
  return __generator(this, function (_a) {
23553
23554
  switch (_a.label) {
23554
- case 0: return [4 /*yield*/, IkasCustomerAPI.register(email, password, firstName, lastName)];
23555
+ case 0: return [4 /*yield*/, IkasCustomerAPI.register(email, password, firstName, lastName, isMarketingAccepted)];
23555
23556
  case 1:
23556
23557
  response = _a.sent();
23557
23558
  if (response) {
@@ -27625,6 +27626,7 @@ var ProductFilterSortTypeEnum;
27625
27626
  (function (ProductFilterSortTypeEnum) {
27626
27627
  ProductFilterSortTypeEnum["ALPHABETICAL_ASC"] = "ALPHABETICAL_ASC";
27627
27628
  ProductFilterSortTypeEnum["ALPHABETICAL_DESC"] = "ALPHABETICAL_DESC";
27629
+ ProductFilterSortTypeEnum["CUSTOM_SORT"] = "CUSTOM_SORT";
27628
27630
  ProductFilterSortTypeEnum["PRODUCT_COUNT_ASC"] = "PRODUCT_COUNT_ASC";
27629
27631
  ProductFilterSortTypeEnum["PRODUCT_COUNT_DESC"] = "PRODUCT_COUNT_DESC";
27630
27632
  })(ProductFilterSortTypeEnum || (ProductFilterSortTypeEnum = {}));
@@ -27671,6 +27673,7 @@ var SortByTypeEnum;
27671
27673
  (function (SortByTypeEnum) {
27672
27674
  SortByTypeEnum["CREATED_AT"] = "CREATED_AT";
27673
27675
  SortByTypeEnum["DISCOUNT_RATIO"] = "DISCOUNT_RATIO";
27676
+ SortByTypeEnum["MANUAL_SORT"] = "MANUAL_SORT";
27674
27677
  SortByTypeEnum["NAME"] = "NAME";
27675
27678
  SortByTypeEnum["PRICE"] = "PRICE";
27676
27679
  })(SortByTypeEnum || (SortByTypeEnum = {}));
@@ -29673,6 +29676,7 @@ var RegisterForm = /** @class */ (function () {
29673
29676
  lastName: "",
29674
29677
  email: "",
29675
29678
  password: "",
29679
+ isMarketingAccepted: false,
29676
29680
  };
29677
29681
  this.onFirstNameChange = function (value) {
29678
29682
  _this.firstName = value;
@@ -29772,6 +29776,16 @@ var RegisterForm = /** @class */ (function () {
29772
29776
  enumerable: false,
29773
29777
  configurable: true
29774
29778
  });
29779
+ Object.defineProperty(RegisterForm.prototype, "isMarketingAccepted", {
29780
+ get: function () {
29781
+ return this.model.isMarketingAccepted;
29782
+ },
29783
+ set: function (value) {
29784
+ this.model.isMarketingAccepted = value;
29785
+ },
29786
+ enumerable: false,
29787
+ configurable: true
29788
+ });
29775
29789
  Object.defineProperty(RegisterForm.prototype, "hasError", {
29776
29790
  get: function () {
29777
29791
  return this.validator.hasError;
@@ -29837,7 +29851,7 @@ var RegisterForm = /** @class */ (function () {
29837
29851
  _b.label = 2;
29838
29852
  case 2:
29839
29853
  _b.trys.push([2, 4, , 5]);
29840
- return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password)];
29854
+ return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password, this.model.isMarketingAccepted)];
29841
29855
  case 3:
29842
29856
  isRegisterSuccess = _b.sent();
29843
29857
  if (isRegisterSuccess) {
@@ -34352,13 +34366,13 @@ var IkasCustomerAPI = /** @class */ (function () {
34352
34366
  });
34353
34367
  });
34354
34368
  };
34355
- IkasCustomerAPI.register = function (email, password, firstName, lastName) {
34369
+ IkasCustomerAPI.register = function (email, password, firstName, lastName, isAcceptMarketing) {
34356
34370
  return __awaiter(this, void 0, void 0, function () {
34357
34371
  var MUTATION, _a, data, errors, err_2;
34358
34372
  return __generator(this, function (_b) {
34359
34373
  switch (_b.label) {
34360
34374
  case 0:
34361
- MUTATION = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "], ["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "])));
34375
+ MUTATION = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "], ["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "])));
34362
34376
  _b.label = 1;
34363
34377
  case 1:
34364
34378
  _b.trys.push([1, 3, , 4]);
@@ -34371,6 +34385,7 @@ var IkasCustomerAPI = /** @class */ (function () {
34371
34385
  password: password,
34372
34386
  firstName: firstName,
34373
34387
  lastName: lastName,
34388
+ isAcceptMarketing: isAcceptMarketing,
34374
34389
  },
34375
34390
  })];
34376
34391
  case 2:
@@ -36758,7 +36773,7 @@ var IkasCartStore = /** @class */ (function () {
36758
36773
  return [2 /*return*/];
36759
36774
  _c.label = 1;
36760
36775
  case 1:
36761
- _c.trys.push([1, 5, 6, 7]);
36776
+ _c.trys.push([1, 6, 7, 8]);
36762
36777
  this._isLoadingCart = true;
36763
36778
  customerId = (_a = this.baseStore.customerStore.customer) === null || _a === void 0 ? void 0 : _a.id;
36764
36779
  cartId = ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.id) || localStorage.getItem(CART_LS_KEY);
@@ -36773,17 +36788,20 @@ var IkasCartStore = /** @class */ (function () {
36773
36788
  return [4 /*yield*/, this.setCart(cart)];
36774
36789
  case 3:
36775
36790
  _c.sent();
36776
- _c.label = 4;
36777
- case 4: return [3 /*break*/, 7];
36778
- case 5:
36791
+ return [3 /*break*/, 5];
36792
+ case 4:
36793
+ this.removeCart();
36794
+ _c.label = 5;
36795
+ case 5: return [3 /*break*/, 8];
36796
+ case 6:
36779
36797
  err_1 = _c.sent();
36780
36798
  console.log(err_1);
36781
- return [3 /*break*/, 7];
36782
- case 6:
36799
+ return [3 /*break*/, 8];
36800
+ case 7:
36783
36801
  this._isLoadingCart = false;
36784
36802
  this._cartLoadFinished = true;
36785
36803
  return [7 /*endfinally*/];
36786
- case 7: return [2 /*return*/];
36804
+ case 8: return [2 /*return*/];
36787
36805
  }
36788
36806
  });
36789
36807
  }); };
@@ -37902,7 +37920,7 @@ var SettingsHelper = /** @class */ (function () {
37902
37920
  id: storefront.salesChannelId,
37903
37921
  }),
37904
37922
  routing: storefront.routings.length
37905
- ? storefront.routings.find(function (r) { return !r.path && !r.domain; }) ||
37923
+ ? storefront.routings.find(function (r) { return r.locale === locale || r.id === locale; }) || //storefront.routings.find((r) => !r.path && !r.domain) ||
37906
37924
  storefront.routings[0]
37907
37925
  : new IkasStorefrontRouting({}),
37908
37926
  favicon: localTheme.settings.favicon,
@@ -37953,9 +37971,10 @@ var SettingsHelper = /** @class */ (function () {
37953
37971
  SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
37954
37972
  var _a;
37955
37973
  return __awaiter(this, void 0, void 0, function () {
37956
- var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider;
37957
- return __generator(this, function (_b) {
37958
- switch (_b.label) {
37974
+ var isLocal, locale, serverRuntimeConfig, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, nextI18nConf, _b, _c;
37975
+ var _d, _e;
37976
+ return __generator(this, function (_f) {
37977
+ switch (_f.label) {
37959
37978
  case 0:
37960
37979
  isLocal = process.env.NEXT_PUBLIC_ENV === "local";
37961
37980
  locale = isLocal ? "en" : context.locale;
@@ -37965,9 +37984,10 @@ var SettingsHelper = /** @class */ (function () {
37965
37984
  notFound: true,
37966
37985
  }];
37967
37986
  }
37987
+ serverRuntimeConfig = getConfig().serverRuntimeConfig;
37968
37988
  return [4 /*yield*/, SettingsHelper.getSettings(locale)];
37969
37989
  case 1:
37970
- settings = _b.sent();
37990
+ settings = _f.sent();
37971
37991
  if (!settings ||
37972
37992
  !settings.storefront.mainStorefrontThemeId ||
37973
37993
  !settings.storefront.salesChannelId) {
@@ -37993,20 +38013,46 @@ var SettingsHelper = /** @class */ (function () {
37993
38013
  provider.possiblePageTypes = possiblePageTypes;
37994
38014
  return [4 /*yield*/, provider.getPageData()];
37995
38015
  case 2:
37996
- _b.sent();
38016
+ _f.sent();
37997
38017
  if (!provider.page) {
37998
38018
  return [2 /*return*/, {
37999
38019
  props: {},
38000
38020
  notFound: true,
38001
38021
  }];
38002
38022
  }
38003
- if (isServer)
38004
- return [2 /*return*/, provider.nextPageData];
38005
- else
38006
- return [2 /*return*/, {
38007
- props: provider.nextPageData.props,
38008
- revalidate: 60,
38009
- }];
38023
+ componentIds = provider.page.components.map(function (pc) { return pc.componentId; });
38024
+ components = themeLocalization.themeJson.components.filter(function (c) {
38025
+ return componentIds.includes(c.id);
38026
+ });
38027
+ componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
38028
+ nextI18nConf = serverRuntimeConfig.nextI18nConf;
38029
+ if (!isServer) return [3 /*break*/, 4];
38030
+ _d = {};
38031
+ _b = [{}];
38032
+ return [4 /*yield*/, serverSideTranslations(locale, componentDirs, {
38033
+ i18n: {
38034
+ locales: nextI18nConf.i18n.locales,
38035
+ defaultLocale: nextI18nConf.i18n.defaultLocale,
38036
+ },
38037
+ serializeConfig: false,
38038
+ localePath: nextI18nConf.localePath,
38039
+ })];
38040
+ case 3: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
38041
+ _d)];
38042
+ case 4:
38043
+ _e = {};
38044
+ _c = [{}];
38045
+ return [4 /*yield*/, serverSideTranslations(locale, componentDirs, {
38046
+ i18n: {
38047
+ locales: nextI18nConf.i18n.locales,
38048
+ defaultLocale: nextI18nConf.i18n.defaultLocale,
38049
+ },
38050
+ serializeConfig: false,
38051
+ localePath: nextI18nConf.localePath,
38052
+ })];
38053
+ case 5: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
38054
+ _e.revalidate = 60,
38055
+ _e)];
38010
38056
  }
38011
38057
  });
38012
38058
  });
package/build/index.js CHANGED
@@ -11,6 +11,7 @@ var Link = require('next/link');
11
11
  var NextImage = require('next/image');
12
12
  var fs = require('fs');
13
13
  var getConfig = require('next/config');
14
+ var serverSideTranslations = require('next-i18next/serverSideTranslations');
14
15
  var dynamic = require('next/dynamic');
15
16
  var Error$1 = require('next/error');
16
17
 
@@ -23553,11 +23554,11 @@ var IkasCustomerStore = /** @class */ (function () {
23553
23554
  }
23554
23555
  });
23555
23556
  }); };
23556
- this.register = function (firstName, lastName, email, password) { return __awaiter(_this, void 0, void 0, function () {
23557
+ this.register = function (firstName, lastName, email, password, isMarketingAccepted) { return __awaiter(_this, void 0, void 0, function () {
23557
23558
  var response;
23558
23559
  return __generator(this, function (_a) {
23559
23560
  switch (_a.label) {
23560
- case 0: return [4 /*yield*/, IkasCustomerAPI.register(email, password, firstName, lastName)];
23561
+ case 0: return [4 /*yield*/, IkasCustomerAPI.register(email, password, firstName, lastName, isMarketingAccepted)];
23561
23562
  case 1:
23562
23563
  response = _a.sent();
23563
23564
  if (response) {
@@ -27606,6 +27607,7 @@ var ProductFilterSortTypeEnum;
27606
27607
  (function (ProductFilterSortTypeEnum) {
27607
27608
  ProductFilterSortTypeEnum["ALPHABETICAL_ASC"] = "ALPHABETICAL_ASC";
27608
27609
  ProductFilterSortTypeEnum["ALPHABETICAL_DESC"] = "ALPHABETICAL_DESC";
27610
+ ProductFilterSortTypeEnum["CUSTOM_SORT"] = "CUSTOM_SORT";
27609
27611
  ProductFilterSortTypeEnum["PRODUCT_COUNT_ASC"] = "PRODUCT_COUNT_ASC";
27610
27612
  ProductFilterSortTypeEnum["PRODUCT_COUNT_DESC"] = "PRODUCT_COUNT_DESC";
27611
27613
  })(ProductFilterSortTypeEnum || (ProductFilterSortTypeEnum = {}));
@@ -27652,6 +27654,7 @@ var SortByTypeEnum;
27652
27654
  (function (SortByTypeEnum) {
27653
27655
  SortByTypeEnum["CREATED_AT"] = "CREATED_AT";
27654
27656
  SortByTypeEnum["DISCOUNT_RATIO"] = "DISCOUNT_RATIO";
27657
+ SortByTypeEnum["MANUAL_SORT"] = "MANUAL_SORT";
27655
27658
  SortByTypeEnum["NAME"] = "NAME";
27656
27659
  SortByTypeEnum["PRICE"] = "PRICE";
27657
27660
  })(SortByTypeEnum || (SortByTypeEnum = {}));
@@ -29651,6 +29654,7 @@ var RegisterForm = /** @class */ (function () {
29651
29654
  lastName: "",
29652
29655
  email: "",
29653
29656
  password: "",
29657
+ isMarketingAccepted: false,
29654
29658
  };
29655
29659
  this.onFirstNameChange = function (value) {
29656
29660
  _this.firstName = value;
@@ -29750,6 +29754,16 @@ var RegisterForm = /** @class */ (function () {
29750
29754
  enumerable: false,
29751
29755
  configurable: true
29752
29756
  });
29757
+ Object.defineProperty(RegisterForm.prototype, "isMarketingAccepted", {
29758
+ get: function () {
29759
+ return this.model.isMarketingAccepted;
29760
+ },
29761
+ set: function (value) {
29762
+ this.model.isMarketingAccepted = value;
29763
+ },
29764
+ enumerable: false,
29765
+ configurable: true
29766
+ });
29753
29767
  Object.defineProperty(RegisterForm.prototype, "hasError", {
29754
29768
  get: function () {
29755
29769
  return this.validator.hasError;
@@ -29815,7 +29829,7 @@ var RegisterForm = /** @class */ (function () {
29815
29829
  _b.label = 2;
29816
29830
  case 2:
29817
29831
  _b.trys.push([2, 4, , 5]);
29818
- return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password)];
29832
+ return [4 /*yield*/, this.store.customerStore.register(this.model.firstName, this.model.lastName, this.model.email, this.model.password, this.model.isMarketingAccepted)];
29819
29833
  case 3:
29820
29834
  isRegisterSuccess = _b.sent();
29821
29835
  if (isRegisterSuccess) {
@@ -34329,13 +34343,13 @@ var IkasCustomerAPI = /** @class */ (function () {
34329
34343
  });
34330
34344
  });
34331
34345
  };
34332
- IkasCustomerAPI.register = function (email, password, firstName, lastName) {
34346
+ IkasCustomerAPI.register = function (email, password, firstName, lastName, isAcceptMarketing) {
34333
34347
  return __awaiter(this, void 0, void 0, function () {
34334
34348
  var MUTATION, _a, data, errors, err_2;
34335
34349
  return __generator(this, function (_b) {
34336
34350
  switch (_b.label) {
34337
34351
  case 0:
34338
- MUTATION = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "], ["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "])));
34352
+ MUTATION = src(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "], ["\n mutation registerCustomer(\n $email: String!\n $password: String!\n $firstName: String!\n $lastName: String!\n $isAcceptMarketing: Boolean\n ) {\n registerCustomer(\n email: $email\n password: $password\n firstName: $firstName\n lastName: $lastName\n isAcceptMarketing: $isAcceptMarketing\n ) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "])));
34339
34353
  _b.label = 1;
34340
34354
  case 1:
34341
34355
  _b.trys.push([1, 3, , 4]);
@@ -34348,6 +34362,7 @@ var IkasCustomerAPI = /** @class */ (function () {
34348
34362
  password: password,
34349
34363
  firstName: firstName,
34350
34364
  lastName: lastName,
34365
+ isAcceptMarketing: isAcceptMarketing,
34351
34366
  },
34352
34367
  })];
34353
34368
  case 2:
@@ -36735,7 +36750,7 @@ var IkasCartStore = /** @class */ (function () {
36735
36750
  return [2 /*return*/];
36736
36751
  _c.label = 1;
36737
36752
  case 1:
36738
- _c.trys.push([1, 5, 6, 7]);
36753
+ _c.trys.push([1, 6, 7, 8]);
36739
36754
  this._isLoadingCart = true;
36740
36755
  customerId = (_a = this.baseStore.customerStore.customer) === null || _a === void 0 ? void 0 : _a.id;
36741
36756
  cartId = ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.id) || localStorage.getItem(CART_LS_KEY);
@@ -36750,17 +36765,20 @@ var IkasCartStore = /** @class */ (function () {
36750
36765
  return [4 /*yield*/, this.setCart(cart)];
36751
36766
  case 3:
36752
36767
  _c.sent();
36753
- _c.label = 4;
36754
- case 4: return [3 /*break*/, 7];
36755
- case 5:
36768
+ return [3 /*break*/, 5];
36769
+ case 4:
36770
+ this.removeCart();
36771
+ _c.label = 5;
36772
+ case 5: return [3 /*break*/, 8];
36773
+ case 6:
36756
36774
  err_1 = _c.sent();
36757
36775
  console.log(err_1);
36758
- return [3 /*break*/, 7];
36759
- case 6:
36776
+ return [3 /*break*/, 8];
36777
+ case 7:
36760
36778
  this._isLoadingCart = false;
36761
36779
  this._cartLoadFinished = true;
36762
36780
  return [7 /*endfinally*/];
36763
- case 7: return [2 /*return*/];
36781
+ case 8: return [2 /*return*/];
36764
36782
  }
36765
36783
  });
36766
36784
  }); };
@@ -37879,7 +37897,7 @@ var SettingsHelper = /** @class */ (function () {
37879
37897
  id: storefront.salesChannelId,
37880
37898
  }),
37881
37899
  routing: storefront.routings.length
37882
- ? storefront.routings.find(function (r) { return !r.path && !r.domain; }) ||
37900
+ ? storefront.routings.find(function (r) { return r.locale === locale || r.id === locale; }) || //storefront.routings.find((r) => !r.path && !r.domain) ||
37883
37901
  storefront.routings[0]
37884
37902
  : new IkasStorefrontRouting({}),
37885
37903
  favicon: localTheme.settings.favicon,
@@ -37930,9 +37948,10 @@ var SettingsHelper = /** @class */ (function () {
37930
37948
  SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
37931
37949
  var _a;
37932
37950
  return __awaiter(this, void 0, void 0, function () {
37933
- var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider;
37934
- return __generator(this, function (_b) {
37935
- switch (_b.label) {
37951
+ var isLocal, locale, serverRuntimeConfig, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, nextI18nConf, _b, _c;
37952
+ var _d, _e;
37953
+ return __generator(this, function (_f) {
37954
+ switch (_f.label) {
37936
37955
  case 0:
37937
37956
  isLocal = process.env.NEXT_PUBLIC_ENV === "local";
37938
37957
  locale = isLocal ? "en" : context.locale;
@@ -37942,9 +37961,10 @@ var SettingsHelper = /** @class */ (function () {
37942
37961
  notFound: true,
37943
37962
  }];
37944
37963
  }
37964
+ serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
37945
37965
  return [4 /*yield*/, SettingsHelper.getSettings(locale)];
37946
37966
  case 1:
37947
- settings = _b.sent();
37967
+ settings = _f.sent();
37948
37968
  if (!settings ||
37949
37969
  !settings.storefront.mainStorefrontThemeId ||
37950
37970
  !settings.storefront.salesChannelId) {
@@ -37970,20 +37990,46 @@ var SettingsHelper = /** @class */ (function () {
37970
37990
  provider.possiblePageTypes = possiblePageTypes;
37971
37991
  return [4 /*yield*/, provider.getPageData()];
37972
37992
  case 2:
37973
- _b.sent();
37993
+ _f.sent();
37974
37994
  if (!provider.page) {
37975
37995
  return [2 /*return*/, {
37976
37996
  props: {},
37977
37997
  notFound: true,
37978
37998
  }];
37979
37999
  }
37980
- if (isServer)
37981
- return [2 /*return*/, provider.nextPageData];
37982
- else
37983
- return [2 /*return*/, {
37984
- props: provider.nextPageData.props,
37985
- revalidate: 60,
37986
- }];
38000
+ componentIds = provider.page.components.map(function (pc) { return pc.componentId; });
38001
+ components = themeLocalization.themeJson.components.filter(function (c) {
38002
+ return componentIds.includes(c.id);
38003
+ });
38004
+ componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
38005
+ nextI18nConf = serverRuntimeConfig.nextI18nConf;
38006
+ if (!isServer) return [3 /*break*/, 4];
38007
+ _d = {};
38008
+ _b = [{}];
38009
+ return [4 /*yield*/, serverSideTranslations.serverSideTranslations(locale, componentDirs, {
38010
+ i18n: {
38011
+ locales: nextI18nConf.i18n.locales,
38012
+ defaultLocale: nextI18nConf.i18n.defaultLocale,
38013
+ },
38014
+ serializeConfig: false,
38015
+ localePath: nextI18nConf.localePath,
38016
+ })];
38017
+ case 3: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
38018
+ _d)];
38019
+ case 4:
38020
+ _e = {};
38021
+ _c = [{}];
38022
+ return [4 /*yield*/, serverSideTranslations.serverSideTranslations(locale, componentDirs, {
38023
+ i18n: {
38024
+ locales: nextI18nConf.i18n.locales,
38025
+ defaultLocale: nextI18nConf.i18n.defaultLocale,
38026
+ },
38027
+ serializeConfig: false,
38028
+ localePath: nextI18nConf.localePath,
38029
+ })];
38030
+ case 5: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
38031
+ _e.revalidate = 60,
38032
+ _e)];
37987
38033
  }
37988
38034
  });
37989
38035
  });
@@ -12,6 +12,7 @@ declare type RegisterFormModel = {
12
12
  lastName: string;
13
13
  email: string;
14
14
  password: string;
15
+ isMarketingAccepted?: boolean;
15
16
  };
16
17
  export declare class RegisterForm {
17
18
  private model;
@@ -26,6 +27,8 @@ export declare class RegisterForm {
26
27
  set email(value: string);
27
28
  get password(): string;
28
29
  set password(value: string);
30
+ get isMarketingAccepted(): boolean | undefined;
31
+ set isMarketingAccepted(value: boolean | undefined);
29
32
  get hasError(): boolean;
30
33
  get firstNameErrorMessage(): string | undefined;
31
34
  get lastNameErrorMessage(): string | undefined;
@@ -15,7 +15,7 @@ export declare class IkasCustomerStore {
15
15
  get canCreateEmailSubscription(): boolean;
16
16
  get customerConsentGranted(): boolean;
17
17
  login: (email: string, password: string) => Promise<boolean>;
18
- register: (firstName: string, lastName: string, email: string, password: string) => Promise<boolean>;
18
+ register: (firstName: string, lastName: string, email: string, password: string, isMarketingAccepted?: boolean | undefined) => Promise<boolean>;
19
19
  saveContactForm: (input: SaveContactForm) => Promise<boolean | undefined>;
20
20
  checkEmail: (email: string) => Promise<boolean>;
21
21
  forgotPassword: (email: string) => Promise<boolean>;
@@ -13,6 +13,10 @@ export declare class SettingsHelper {
13
13
  static readSettingsFile(): Promise<any>;
14
14
  static getSettings(locale: string): Promise<SettingsData | null>;
15
15
  static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[]): Promise<{
16
+ props: {};
17
+ notFound: boolean;
18
+ revalidate?: undefined;
19
+ } | {
16
20
  props: {
17
21
  propValuesStr: string;
18
22
  pageSpecificDataStr: string;
@@ -33,10 +37,13 @@ export declare class SettingsHelper {
33
37
  favicon: any;
34
38
  stockPreference: IkasThemeStockPreference;
35
39
  };
40
+ _nextI18Next: {
41
+ initialI18nStore: any;
42
+ initialLocale: string;
43
+ userConfig: import("next-i18next").UserConfig | null;
44
+ };
36
45
  };
37
- } | {
38
- props: {};
39
- notFound: boolean;
46
+ notFound?: undefined;
40
47
  revalidate?: undefined;
41
48
  } | {
42
49
  props: {
@@ -59,11 +66,20 @@ export declare class SettingsHelper {
59
66
  favicon: any;
60
67
  stockPreference: IkasThemeStockPreference;
61
68
  };
69
+ _nextI18Next: {
70
+ initialI18nStore: any;
71
+ initialLocale: string;
72
+ userConfig: import("next-i18next").UserConfig | null;
73
+ };
62
74
  };
63
75
  revalidate: number;
64
76
  notFound?: undefined;
65
77
  }>;
66
78
  static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[]): Promise<{
79
+ props: {};
80
+ notFound: boolean;
81
+ revalidate?: undefined;
82
+ } | {
67
83
  props: {
68
84
  propValuesStr: string;
69
85
  pageSpecificDataStr: string;
@@ -84,10 +100,13 @@ export declare class SettingsHelper {
84
100
  favicon: any;
85
101
  stockPreference: IkasThemeStockPreference;
86
102
  };
103
+ _nextI18Next: {
104
+ initialI18nStore: any;
105
+ initialLocale: string;
106
+ userConfig: import("next-i18next").UserConfig | null;
107
+ };
87
108
  };
88
- } | {
89
- props: {};
90
- notFound: boolean;
109
+ notFound?: undefined;
91
110
  revalidate?: undefined;
92
111
  } | {
93
112
  props: {
@@ -110,11 +129,20 @@ export declare class SettingsHelper {
110
129
  favicon: any;
111
130
  stockPreference: IkasThemeStockPreference;
112
131
  };
132
+ _nextI18Next: {
133
+ initialI18nStore: any;
134
+ initialLocale: string;
135
+ userConfig: import("next-i18next").UserConfig | null;
136
+ };
113
137
  };
114
138
  revalidate: number;
115
139
  notFound?: undefined;
116
140
  }>;
117
141
  static getServerSideProps(context: GetServerSidePropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType): Promise<{
142
+ props: {};
143
+ notFound: boolean;
144
+ revalidate?: undefined;
145
+ } | {
118
146
  props: {
119
147
  propValuesStr: string;
120
148
  pageSpecificDataStr: string;
@@ -135,10 +163,13 @@ export declare class SettingsHelper {
135
163
  favicon: any;
136
164
  stockPreference: IkasThemeStockPreference;
137
165
  };
166
+ _nextI18Next: {
167
+ initialI18nStore: any;
168
+ initialLocale: string;
169
+ userConfig: import("next-i18next").UserConfig | null;
170
+ };
138
171
  };
139
- } | {
140
- props: {};
141
- notFound: boolean;
172
+ notFound?: undefined;
142
173
  revalidate?: undefined;
143
174
  } | {
144
175
  props: {
@@ -161,6 +192,11 @@ export declare class SettingsHelper {
161
192
  favicon: any;
162
193
  stockPreference: IkasThemeStockPreference;
163
194
  };
195
+ _nextI18Next: {
196
+ initialI18nStore: any;
197
+ initialLocale: string;
198
+ userConfig: import("next-i18next").UserConfig | null;
199
+ };
164
200
  };
165
201
  revalidate: number;
166
202
  notFound?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.160",
3
+ "version": "0.0.161-alpha.10",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",
@@ -19,6 +19,7 @@
19
19
  "mobx": "^6.1.3",
20
20
  "mobx-react-lite": "^3.1.5",
21
21
  "next": "10.0.6",
22
+ "next-i18next": "^8.5.5",
22
23
  "react": "17.0.1",
23
24
  "react-dom": "17.0.1"
24
25
  },
@@ -70,6 +71,7 @@
70
71
  "mobx": "^6.1.3",
71
72
  "mobx-react-lite": "^3.1.5",
72
73
  "next": "10.0.6",
74
+ "next-i18next": "^8.5.5",
73
75
  "node-sass": "^5.0.0",
74
76
  "postcss": "^8.2.4",
75
77
  "prettier": "^2.2.1",