@ikas/storefront 0.0.107 → 0.0.109

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.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { makeAutoObservable, toJS, runInAction, reaction, makeObservable, computed, observable, action, configure } from 'mobx';
2
2
  import React, { createElement, Fragment, useState, useEffect, useCallback, useRef, useMemo } from 'react';
3
- import getConfig from 'next/config';
4
3
  import { observer } from 'mobx-react-lite';
5
4
  import { useRouter } from 'next/router';
6
5
  import Image$1 from 'next/image';
7
6
  import Link from 'next/link';
8
7
  import Head from 'next/head';
9
8
  import fs from 'fs';
9
+ import getConfig from 'next/config';
10
10
  import dynamic from 'next/dynamic';
11
11
  import Error$1 from 'next/error';
12
12
 
@@ -10897,6 +10897,8 @@ var IkasStorefrontConfig = /** @class */ (function () {
10897
10897
  priceListId: IkasStorefrontConfig.priceListId || null,
10898
10898
  stockLocationIds: IkasStorefrontConfig.stockLocationIds || null,
10899
10899
  routings: JSON.parse(JSON.stringify(IkasStorefrontConfig.routings)) || null,
10900
+ gtmId: IkasStorefrontConfig.gtmId || null,
10901
+ fbpId: IkasStorefrontConfig.fbpId || null,
10900
10902
  };
10901
10903
  };
10902
10904
  IkasStorefrontConfig.components = {};
@@ -12560,6 +12562,32 @@ var IkasFilterCategory = /** @class */ (function () {
12560
12562
  return IkasFilterCategory;
12561
12563
  }());
12562
12564
 
12565
+ var IkasCheckoutSettings = /** @class */ (function () {
12566
+ function IkasCheckoutSettings(data) {
12567
+ if (data === void 0) { data = {}; }
12568
+ this.id = data.id || "";
12569
+ this.createdAt = data.createdAt || 0;
12570
+ this.updatedAt = data.updatedAt || 0;
12571
+ this.phoneRequirement =
12572
+ data.phoneRequirement || IkasCheckoutRequirementEnum.OPTIONAL;
12573
+ this.identityNumberRequirement =
12574
+ data.identityNumberRequirement || IkasCheckoutRequirementEnum.INVISIBLE;
12575
+ this.isAccountRequired = data.isAccountRequired || false;
12576
+ this.isTermsAndConditionsDefaultChecked =
12577
+ data.isTermsAndConditionsDefaultChecked || false;
12578
+ this.showTermsAndConditionsCheckbox =
12579
+ data.showTermsAndConditionsCheckbox || false;
12580
+ this.storefrontId = data.storefrontId || "";
12581
+ }
12582
+ return IkasCheckoutSettings;
12583
+ }());
12584
+ var IkasCheckoutRequirementEnum;
12585
+ (function (IkasCheckoutRequirementEnum) {
12586
+ IkasCheckoutRequirementEnum["INVISIBLE"] = "INVISIBLE";
12587
+ IkasCheckoutRequirementEnum["MANDATORY"] = "MANDATORY";
12588
+ IkasCheckoutRequirementEnum["OPTIONAL"] = "OPTIONAL";
12589
+ })(IkasCheckoutRequirementEnum || (IkasCheckoutRequirementEnum = {}));
12590
+
12563
12591
  var IkasOrderAddress = /** @class */ (function () {
12564
12592
  function IkasOrderAddress(data) {
12565
12593
  if (data === void 0) { data = {}; }
@@ -12619,6 +12647,10 @@ var IkasOrderAddress = /** @class */ (function () {
12619
12647
  });
12620
12648
  Object.defineProperty(IkasOrderAddress.prototype, "validationResult", {
12621
12649
  get: function () {
12650
+ var _a, _b, _c, _d;
12651
+ var isValidPhone = !!this.phone &&
12652
+ this.phone.length >= 10 &&
12653
+ validatePhoneNumber(this.phone);
12622
12654
  var results = {
12623
12655
  firstName: !!this.firstName,
12624
12656
  lastName: !!this.lastName,
@@ -12627,8 +12659,19 @@ var IkasOrderAddress = /** @class */ (function () {
12627
12659
  country: !!this.country,
12628
12660
  state: !!this.state,
12629
12661
  city: !!this.city,
12630
- phone: this.phone
12631
- ? this.phone.length >= 10 && validatePhoneNumber(this.phone)
12662
+ phone: ((_a = this.checkoutSettings) === null || _a === void 0 ? void 0 : _a.phoneRequirement) ===
12663
+ IkasCheckoutRequirementEnum.MANDATORY ||
12664
+ (((_b = this.checkoutSettings) === null || _b === void 0 ? void 0 : _b.phoneRequirement) ===
12665
+ IkasCheckoutRequirementEnum.OPTIONAL &&
12666
+ this.phone)
12667
+ ? isValidPhone
12668
+ : true,
12669
+ identityNumber: ((_c = this.checkoutSettings) === null || _c === void 0 ? void 0 : _c.identityNumberRequirement) ===
12670
+ IkasCheckoutRequirementEnum.MANDATORY ||
12671
+ (((_d = this.checkoutSettings) === null || _d === void 0 ? void 0 : _d.identityNumberRequirement) ===
12672
+ IkasCheckoutRequirementEnum.OPTIONAL &&
12673
+ this.phone)
12674
+ ? !!this.identityNumber
12632
12675
  : true,
12633
12676
  };
12634
12677
  return results;
@@ -12643,6 +12686,11 @@ var IkasOrderAddress = /** @class */ (function () {
12643
12686
  enumerable: false,
12644
12687
  configurable: true
12645
12688
  });
12689
+ IkasOrderAddress.prototype.toJSON = function () {
12690
+ var obj = __assign({}, this);
12691
+ delete obj.checkoutSettings;
12692
+ return obj;
12693
+ };
12646
12694
  return IkasOrderAddress;
12647
12695
  }());
12648
12696
 
@@ -15855,14 +15903,16 @@ var MAX_CVC_LENGTH = 4;
15855
15903
  var USE_DIFFERENT_ADDRESS_KEY = "sAddr";
15856
15904
  var isServer$1 = typeof localStorage === "undefined";
15857
15905
  var CheckoutViewModel = /** @class */ (function () {
15858
- function CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService) {
15906
+ function CheckoutViewModel(checkout, checkoutSettings, queryParams, router, returnPolicy, privacyPolicy, termsOfService) {
15859
15907
  var _this = this;
15860
15908
  this.checkout = new IkasCheckout();
15909
+ this.checkoutSettings = new IkasCheckoutSettings();
15861
15910
  this.storefront = null;
15862
15911
  this.customerStore = new IkasCustomerStore();
15863
15912
  this.isCheckoutLoaded = false;
15864
15913
  this.isErrorsVisible = false;
15865
15914
  this.isStepLoading = false;
15915
+ this.isTermsAndConditionsChecked = false;
15866
15916
  this.step = CheckoutStep.INFO;
15867
15917
  this.cardData = null;
15868
15918
  this.paymentGatewayId = null;
@@ -15874,6 +15924,8 @@ var CheckoutViewModel = /** @class */ (function () {
15874
15924
  this.shippingCountryIds = null;
15875
15925
  this.selectedShippingAddressId = "-1";
15876
15926
  this.selectedBillingAddressId = "-1";
15927
+ this.policyModalTitle = "";
15928
+ this.policyModalText = "";
15877
15929
  this.error = null;
15878
15930
  this.init = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
15879
15931
  var merchantId, _a;
@@ -15991,7 +16043,7 @@ var CheckoutViewModel = /** @class */ (function () {
15991
16043
  switch (_b.label) {
15992
16044
  case 0:
15993
16045
  _a = this;
15994
- return [4 /*yield*/, IkasCountryAPI.listShippingCountries(IkasStorefrontConfig.storefrontId)];
16046
+ return [4 /*yield*/, IkasCountryAPI.listShippingCountries(IkasStorefrontConfig.salesChannelId)];
15995
16047
  case 1:
15996
16048
  _a.shippingCountryIds = _b.sent();
15997
16049
  return [2 /*return*/];
@@ -16077,6 +16129,7 @@ var CheckoutViewModel = /** @class */ (function () {
16077
16129
  this.createShippingAddress = function () {
16078
16130
  if (!_this.checkout.shippingAddress)
16079
16131
  _this.checkout.shippingAddress = new IkasOrderAddress();
16132
+ _this.checkout.shippingAddress.checkoutSettings = _this.checkoutSettings;
16080
16133
  };
16081
16134
  this.createBillingAddress = function () {
16082
16135
  if (typeof localStorage !== "undefined") {
@@ -16139,6 +16192,9 @@ var CheckoutViewModel = /** @class */ (function () {
16139
16192
  _this.checkout.billingAddress = new IkasOrderAddress(address);
16140
16193
  }
16141
16194
  };
16195
+ this.onTermsAndConditionsCheckedChange = function (value) {
16196
+ _this.isTermsAndConditionsChecked = value;
16197
+ };
16142
16198
  // CREDIT CARD START
16143
16199
  this.onCardNumberChange = function (value) {
16144
16200
  if (!_this.cardData)
@@ -16410,10 +16466,12 @@ var CheckoutViewModel = /** @class */ (function () {
16410
16466
  });
16411
16467
  }); };
16412
16468
  this.checkout = checkout;
16469
+ this.checkoutSettings = checkoutSettings;
16413
16470
  this.router = router;
16414
16471
  this.returnPolicy = returnPolicy;
16415
16472
  this.privacyPolicy = privacyPolicy;
16416
16473
  this.termsOfService = termsOfService;
16474
+ this.isTermsAndConditionsChecked = this.checkoutSettings.isTermsAndConditionsDefaultChecked;
16417
16475
  this.init(queryParams);
16418
16476
  makeAutoObservable(this);
16419
16477
  }
@@ -16432,6 +16490,14 @@ var CheckoutViewModel = /** @class */ (function () {
16432
16490
  enumerable: false,
16433
16491
  configurable: true
16434
16492
  });
16493
+ Object.defineProperty(CheckoutViewModel.prototype, "selectedPaymentGateway", {
16494
+ get: function () {
16495
+ var _this = this;
16496
+ return this.paymentGateways.find(function (pg) { return pg.id === _this.paymentGatewayId; });
16497
+ },
16498
+ enumerable: false,
16499
+ configurable: true
16500
+ });
16435
16501
  Object.defineProperty(CheckoutViewModel.prototype, "selectedInstallmentIndex", {
16436
16502
  get: function () {
16437
16503
  var _this = this;
@@ -16505,10 +16571,15 @@ var CheckoutViewModel = /** @class */ (function () {
16505
16571
  });
16506
16572
  Object.defineProperty(CheckoutViewModel.prototype, "canPerformPayment", {
16507
16573
  get: function () {
16508
- var _a, _b;
16574
+ var _a, _b, _c;
16575
+ if (this.checkoutSettings.showTermsAndConditionsCheckbox &&
16576
+ !this.isTermsAndConditionsChecked)
16577
+ return false;
16509
16578
  return (this.canProceedToShipping &&
16510
16579
  !!((_a = this.checkout.billingAddress) === null || _a === void 0 ? void 0 : _a.isValid) &&
16511
- (!!this.cardData ? (_b = this.cardData) === null || _b === void 0 ? void 0 : _b.isValid : true));
16580
+ (((_b = this.selectedPaymentGateway) === null || _b === void 0 ? void 0 : _b.paymentMethodType) ===
16581
+ IkasPaymentMethodType.CREDIT_CARD
16582
+ ? (_c = this.cardData) === null || _c === void 0 ? void 0 : _c.isValid : true));
16512
16583
  },
16513
16584
  enumerable: false,
16514
16585
  configurable: true
@@ -16889,9 +16960,8 @@ var Analytics = /** @class */ (function () {
16889
16960
 
16890
16961
  var AnalyticsHead = function (_a) {
16891
16962
  var blockHTML = _a.blockHTML;
16892
- var serverRuntimeConfig = getConfig().serverRuntimeConfig;
16893
- var gtmId = serverRuntimeConfig.GTM_ID;
16894
- var fbpId = serverRuntimeConfig.FBP_ID;
16963
+ var gtmId = IkasStorefrontConfig.gtmId;
16964
+ var fbpId = IkasStorefrontConfig.fbpId;
16895
16965
  return (createElement(Fragment, null,
16896
16966
  blockHTML && (createElement("script", { dangerouslySetInnerHTML: {
16897
16967
  __html: "dataLayer = [{'gtm.blocklist': ['html']}];",
@@ -16904,9 +16974,8 @@ var AnalyticsHead = function (_a) {
16904
16974
  } }))));
16905
16975
  };
16906
16976
  var AnalyticsBody = function () {
16907
- var serverRuntimeConfig = getConfig().serverRuntimeConfig;
16908
- var gtmId = serverRuntimeConfig.GTM_ID;
16909
- var fbpId = serverRuntimeConfig.FBP_ID;
16977
+ var gtmId = IkasStorefrontConfig.gtmId;
16978
+ var fbpId = IkasStorefrontConfig.fbpId;
16910
16979
  return (createElement(Fragment, null,
16911
16980
  gtmId && (createElement("noscript", { dangerouslySetInnerHTML: {
16912
16981
  __html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
@@ -24637,6 +24706,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
24637
24706
  taxNumber: checkout.billingAddress.taxNumber || null,
24638
24707
  taxOffice: checkout.billingAddress.taxOffice || null,
24639
24708
  isDefault: checkout.billingAddress.isDefault || false,
24709
+ identityNumber: checkout.billingAddress.identityNumber || null,
24640
24710
  }
24641
24711
  : null,
24642
24712
  shippingAddress: checkout.shippingAddress &&
@@ -24656,6 +24726,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
24656
24726
  taxNumber: checkout.shippingAddress.taxNumber || null,
24657
24727
  taxOffice: checkout.shippingAddress.taxOffice || null,
24658
24728
  isDefault: checkout.shippingAddress.isDefault || false,
24729
+ identityNumber: checkout.shippingAddress.identityNumber || null,
24659
24730
  }
24660
24731
  : null,
24661
24732
  couponCode: checkout.couponCode || null,
@@ -24830,9 +24901,44 @@ var IkasCheckoutAPI = /** @class */ (function () {
24830
24901
  });
24831
24902
  });
24832
24903
  };
24904
+ IkasCheckoutAPI.listCheckoutSettings = function () {
24905
+ return __awaiter(this, void 0, void 0, function () {
24906
+ var QUERY, _a, data, errors, err_8;
24907
+ return __generator(this, function (_b) {
24908
+ switch (_b.label) {
24909
+ case 0:
24910
+ QUERY = src(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n query listCheckoutSettings($storefrontId: StringFilterInput!) {\n listCheckoutSettings(storefrontId: $storefrontId) {\n createdAt\n id\n identityNumberRequirement\n isAccountRequired\n isTermsAndConditionsDefaultChecked\n options {\n name\n required\n }\n phoneRequirement\n showTermsAndConditionsCheckbox\n storefrontId\n updatedAt\n }\n }\n "], ["\n query listCheckoutSettings($storefrontId: StringFilterInput!) {\n listCheckoutSettings(storefrontId: $storefrontId) {\n createdAt\n id\n identityNumberRequirement\n isAccountRequired\n isTermsAndConditionsDefaultChecked\n options {\n name\n required\n }\n phoneRequirement\n showTermsAndConditionsCheckbox\n storefrontId\n updatedAt\n }\n }\n "])));
24911
+ _b.label = 1;
24912
+ case 1:
24913
+ _b.trys.push([1, 3, , 4]);
24914
+ return [4 /*yield*/, apollo
24915
+ .getClient()
24916
+ .query({
24917
+ query: QUERY,
24918
+ variables: {
24919
+ storefrontId: { eq: IkasStorefrontConfig.storefrontId },
24920
+ },
24921
+ })];
24922
+ case 2:
24923
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
24924
+ if (errors && errors.length) {
24925
+ console.log(errors);
24926
+ }
24927
+ if (data)
24928
+ return [2 /*return*/, data.listCheckoutSettings.map(function (cs) { return new IkasCheckoutSettings(cs); })];
24929
+ return [3 /*break*/, 4];
24930
+ case 3:
24931
+ err_8 = _b.sent();
24932
+ console.log(err_8);
24933
+ return [3 /*break*/, 4];
24934
+ case 4: return [2 /*return*/];
24935
+ }
24936
+ });
24937
+ });
24938
+ };
24833
24939
  return IkasCheckoutAPI;
24834
24940
  }());
24835
- var templateObject_1$3, templateObject_2$2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
24941
+ var templateObject_1$3, templateObject_2$2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
24836
24942
 
24837
24943
  var IkasCityAPI = /** @class */ (function () {
24838
24944
  function IkasCityAPI() {
@@ -24924,13 +25030,13 @@ var IkasCountryAPI = /** @class */ (function () {
24924
25030
  });
24925
25031
  });
24926
25032
  };
24927
- IkasCountryAPI.listShippingCountries = function (storefrontId) {
25033
+ IkasCountryAPI.listShippingCountries = function (salesChannelId) {
24928
25034
  return __awaiter(this, void 0, void 0, function () {
24929
25035
  var QUERY, _a, data, errors, err_2;
24930
25036
  return __generator(this, function (_b) {
24931
25037
  switch (_b.label) {
24932
25038
  case 0:
24933
- 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 "])));
25039
+ QUERY = src(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query getAvailableShippingCountries($salesChannelId: String!) {\n getAvailableShippingCountries(salesChannelId: $salesChannelId)\n }\n "], ["\n query getAvailableShippingCountries($salesChannelId: String!) {\n getAvailableShippingCountries(salesChannelId: $salesChannelId)\n }\n "])));
24934
25040
  _b.label = 1;
24935
25041
  case 1:
24936
25042
  _b.trys.push([1, 3, , 4]);
@@ -24939,7 +25045,7 @@ var IkasCountryAPI = /** @class */ (function () {
24939
25045
  .query({
24940
25046
  query: QUERY,
24941
25047
  variables: {
24942
- storefrontId: storefrontId,
25048
+ salesChannelId: salesChannelId,
24943
25049
  },
24944
25050
  })];
24945
25051
  case 2:
@@ -25241,7 +25347,7 @@ var IkasCustomerAPI = /** @class */ (function () {
25241
25347
  return __generator(this, function (_b) {
25242
25348
  switch (_b.label) {
25243
25349
  case 0:
25244
- MUTATION = src(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\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 phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\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 phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
25350
+ MUTATION = src(templateObject_8$1 || (templateObject_8$1 = __makeTemplateObject(["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\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 phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "], ["\n mutation saveMyCustomer($input: SaveMyCustomerInput!) {\n saveMyCustomer(input: $input) {\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 phone\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n "])));
25245
25351
  _b.label = 1;
25246
25352
  case 1:
25247
25353
  _b.trys.push([1, 3, , 4]);
@@ -25387,7 +25493,7 @@ var IkasCustomerAPI = /** @class */ (function () {
25387
25493
  };
25388
25494
  return IkasCustomerAPI;
25389
25495
  }());
25390
- var templateObject_1$6, templateObject_2$4, templateObject_3$2, templateObject_4$1, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
25496
+ var templateObject_1$6, templateObject_2$4, templateObject_3$2, templateObject_4$1, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11;
25391
25497
 
25392
25498
  var IkasDistrictAPI = /** @class */ (function () {
25393
25499
  function IkasDistrictAPI() {
@@ -26352,6 +26458,9 @@ var AddressFormViewModel = /** @class */ (function () {
26352
26458
  this.onPhoneChange = function (value) {
26353
26459
  _this.address.phone = value;
26354
26460
  };
26461
+ this.onIdentityNumberChange = function (value) {
26462
+ _this.address.identityNumber = value;
26463
+ };
26355
26464
  this.onAddressLine1Change = function (value) {
26356
26465
  _this.address.addressLine1 = value;
26357
26466
  };
@@ -26456,6 +26565,13 @@ var AddressFormViewModel = /** @class */ (function () {
26456
26565
  enumerable: false,
26457
26566
  configurable: true
26458
26567
  });
26568
+ Object.defineProperty(AddressFormViewModel.prototype, "identityNumber", {
26569
+ get: function () {
26570
+ return this.address.identityNumber;
26571
+ },
26572
+ enumerable: false,
26573
+ configurable: true
26574
+ });
26459
26575
  Object.defineProperty(AddressFormViewModel.prototype, "country", {
26460
26576
  get: function () {
26461
26577
  return this.address.country;
@@ -26531,12 +26647,12 @@ var css_248z$2 = ".common-module_FormSectionTitle___Mykh {\n width: 100%;\n di
26531
26647
  var commonStyles = {"FormSectionTitle":"common-module_FormSectionTitle___Mykh","Title":"common-module_Title__3JTHt","WithSubTitle":"common-module_WithSubTitle__1VHWv","SubTitle":"common-module_SubTitle__1H4kH","Grid":"common-module_Grid__2CuvH","Grid2":"common-module_Grid2__9CCag","Grid3":"common-module_Grid3__3p0jJ","FormContainer":"common-module_FormContainer__2I_Lj","mtFormRow":"common-module_mtFormRow__2tsDn","mt1":"common-module_mt1__3tpC1","mt2":"common-module_mt2__2bl5q","fadeInFromRight":"common-module_fadeInFromRight__3RYk5"};
26532
26648
  styleInject(css_248z$2);
26533
26649
 
26534
- var css_248z$3 = ".style-module_CheckoutPage__A_f2V {\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n font-size: 16px;\n width: 100%;\n height: 100vh;\n overflow: auto;\n overflow-x: hidden;\n display: flex; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 {\n width: 50%;\n flex: 0 0 auto;\n display: flex;\n justify-content: flex-end;\n padding-left: 20px;\n padding-right: 40px; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 {\n width: 100%;\n min-width: 400px;\n max-width: 600px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n min-height: 100vh; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Space__1e2de {\n width: 100%;\n height: 100px; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg {\n flex: 0 0 auto;\n height: 50px;\n background-color: white;\n width: calc(100% - 1em);\n display: flex;\n align-items: center;\n border-top: 1px solid #d9d9d9; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg .style-module_FooterItem__1ofBc {\n font-size: 0.7em;\n margin-right: 1.4em;\n color: #737373;\n cursor: pointer;\n user-select: none; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg .style-module_FooterItem__1ofBc:hover {\n color: #111111; }\n @media only screen and (max-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg {\n width: 100%;\n padding-left: 0.7em; } }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 {\n width: 100%;\n height: 96px;\n display: flex;\n align-items: center;\n font-weight: 500;\n font-size: 1.5em;\n padding-left: 0.4em; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 a {\n width: 100%; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 .style-module_Logo__2E8Do {\n width: 100%;\n height: 64px;\n position: relative;\n user-select: none;\n cursor: pointer; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 .style-module_Logo__2E8Do img {\n object-fit: contain;\n object-position: left;\n pointer-events: none; }\n @media only screen and (min-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_MobileCartSummary__3NrcP {\n display: none; } }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_RowPB__3M7Tz {\n padding-bottom: 0.7em; }\n @media only screen and (max-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 {\n width: 100%;\n justify-content: center;\n padding-right: 0px;\n padding-left: 0px; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 {\n width: 100%;\n min-width: auto;\n max-width: 100%; } }\n .style-module_CheckoutPage__A_f2V .style-module_Right__3AN4f {\n width: 50%;\n min-height: 100%;\n flex: 0 0 auto;\n background-color: #FAFAFA;\n border-left: 1px solid #d9d9d9;\n display: flex;\n padding-left: 40px;\n padding-right: 20px;\n position: sticky;\n top: 0;\n overflow-y: auto; }\n .style-module_CheckoutPage__A_f2V .style-module_Right__3AN4f .style-module_RightContent__1TcO5 {\n width: 100%;\n max-width: 600px;\n padding-top: 80px; }\n @media only screen and (max-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Right__3AN4f {\n display: none; } }\n";
26650
+ var css_248z$3 = ".style-module_CheckoutPage__A_f2V {\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n font-size: 16px;\n width: 100%;\n height: 100vh;\n overflow: auto;\n overflow-x: hidden;\n display: flex; }\n .style-module_CheckoutPage__A_f2V * {\n box-sizing: border-box !important; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 {\n width: 50%;\n flex: 0 0 auto;\n display: flex;\n justify-content: flex-end;\n padding-left: 20px;\n padding-right: 40px; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 {\n width: 100%;\n min-width: 400px;\n max-width: 600px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n min-height: 100vh; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Space__1e2de {\n width: 100%;\n height: 100px; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg {\n flex: 0 0 auto;\n height: 50px;\n background-color: white;\n width: calc(100% - 1em);\n display: flex;\n align-items: center;\n border-top: 1px solid #d9d9d9; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg .style-module_FooterItem__1ofBc {\n font-size: 0.7em;\n margin-right: 1.4em;\n color: #737373;\n cursor: pointer;\n user-select: none; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg .style-module_FooterItem__1ofBc:hover {\n color: #111111; }\n @media only screen and (max-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 .style-module_Footer__ebdyg {\n width: 100%;\n padding-left: 0.7em; } }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 {\n width: 100%;\n height: 96px;\n display: flex;\n align-items: center;\n font-weight: 500;\n font-size: 1.5em;\n padding-left: 0.4em; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 a {\n width: 100%; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 .style-module_Logo__2E8Do {\n width: 100%;\n height: 64px;\n position: relative;\n user-select: none;\n cursor: pointer; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_Header__1vfF1 .style-module_Logo__2E8Do img {\n object-fit: contain;\n object-position: left;\n pointer-events: none; }\n @media only screen and (min-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_MobileCartSummary__3NrcP {\n display: none; } }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_RowPB__3M7Tz {\n padding-bottom: 0.7em; }\n @media only screen and (max-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 {\n width: 100%;\n justify-content: center;\n padding-right: 0px;\n padding-left: 0px; }\n .style-module_CheckoutPage__A_f2V .style-module_Left__2dWz6 .style-module_LeftContent__1Tyb7 {\n width: 100%;\n min-width: auto;\n max-width: 100%; } }\n .style-module_CheckoutPage__A_f2V .style-module_Right__3AN4f {\n width: 50%;\n min-height: 100%;\n flex: 0 0 auto;\n background-color: #FAFAFA;\n border-left: 1px solid #d9d9d9;\n display: flex;\n padding-left: 40px;\n padding-right: 20px;\n position: sticky;\n top: 0;\n overflow-y: auto; }\n .style-module_CheckoutPage__A_f2V .style-module_Right__3AN4f .style-module_RightContent__1TcO5 {\n width: 100%;\n max-width: 600px;\n padding-top: 80px; }\n @media only screen and (max-width: 1000px) {\n .style-module_CheckoutPage__A_f2V .style-module_Right__3AN4f {\n display: none; } }\n";
26535
26651
  var styles$2 = {"CheckoutPage":"style-module_CheckoutPage__A_f2V","Left":"style-module_Left__2dWz6","LeftContent":"style-module_LeftContent__1Tyb7","Space":"style-module_Space__1e2de","Footer":"style-module_Footer__ebdyg","FooterItem":"style-module_FooterItem__1ofBc","Header":"style-module_Header__1vfF1","Logo":"style-module_Logo__2E8Do","MobileCartSummary":"style-module_MobileCartSummary__3NrcP","RowPB":"style-module_RowPB__3M7Tz","Right":"style-module_Right__3AN4f","RightContent":"style-module_RightContent__1TcO5"};
26536
26652
  styleInject(css_248z$3);
26537
26653
 
26538
26654
  var AddressForm$1 = observer(function (_a) {
26539
- var _b, _c, _d, _e, _f;
26655
+ var _b, _c, _d, _e, _f, _g, _h;
26540
26656
  var isErrorsVisible = _a.isErrorsVisible, validationResult = _a.validationResult, props = __rest(_a, ["isErrorsVisible", "validationResult"]);
26541
26657
  var vm = useState(function () { return new AddressFormViewModel(props); })[0];
26542
26658
  useEffect(function () {
@@ -26564,9 +26680,10 @@ var AddressForm$1 = observer(function (_a) {
26564
26680
  vm.hasState && (createElement(FormItem, { type: FormItemType.SELECT, label: "Eyalet", value: ((_c = vm.state) === null || _c === void 0 ? void 0 : _c.id) || "", onChange: vm.onStateChange, options: vm.stateOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.state), errorText: "Eyalet seçin" })),
26565
26681
  createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l", value: ((_d = vm.city) === null || _d === void 0 ? void 0 : _d.id) || "", onChange: vm.onCityChange, options: vm.cityOptions, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.city), errorText: "Şehir seçin" }),
26566
26682
  vm.districtOptions.length ? (createElement(FormItem, { type: FormItemType.SELECT, label: "\u0130l\u00E7e", value: ((_e = vm.district) === null || _e === void 0 ? void 0 : _e.id) || "", onChange: vm.onDistrictChange, options: vm.districtOptions, errorText: "İlçe seçin" })) : (createElement(FormItem, { type: FormItemType.TEXT, label: "\u0130l\u00E7e", value: ((_f = vm.district) === null || _f === void 0 ? void 0 : _f.name) || "", onChange: vm.onDistrictInputChange })),
26567
- !vm.hasState && (createElement(FormItem, { type: FormItemType.TEXT, label: "Telefon", autocomplete: "tel", value: vm.phone || "", onChange: vm.onPhoneChange, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.phone), errorText: "Geçerli bir telefon girin" }))),
26568
- vm.hasState && (createElement("div", { className: [styles$2.RowPB, commonStyles.mtFormRow].join(" ") },
26569
- createElement(FormItem, { type: FormItemType.TEXT, label: "Telefon", autocomplete: "tel", value: vm.phone || "", onChange: vm.onPhoneChange, hasError: isErrorsVisible && (validationResult === null || validationResult === void 0 ? void 0 : validationResult.phone), errorText: "Geçerli bir telefon girin" })))));
26683
+ ((_g = vm.address.checkoutSettings) === null || _g === void 0 ? void 0 : _g.phoneRequirement) !==
26684
+ IkasCheckoutRequirementEnum.INVISIBLE && (createElement(FormItem, { type: FormItemType.TEXT, label: "Telefon", autocomplete: "tel", value: vm.phone || "", onChange: vm.onPhoneChange, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.phone), errorText: "Geçerli bir telefon girin" })),
26685
+ ((_h = vm.address.checkoutSettings) === null || _h === void 0 ? void 0 : _h.identityNumberRequirement) !==
26686
+ IkasCheckoutRequirementEnum.INVISIBLE && (createElement(FormItem, { type: FormItemType.TEXT, label: "TC Kimlik No", value: vm.identityNumber || "", onChange: vm.onIdentityNumberChange, hasError: isErrorsVisible && !(validationResult === null || validationResult === void 0 ? void 0 : validationResult.identityNumber), errorText: "TC kimlik no girin" })))));
26570
26687
  });
26571
26688
 
26572
26689
  var css_248z$4 = ".style-module_Button__1UPMN {\n cursor: pointer;\n border: 1px transparent solid;\n border-radius: 6px;\n font-weight: 500;\n text-align: center;\n position: relative;\n transition: all .2s;\n display: flex;\n justify-content: center;\n align-items: center; }\n .style-module_Button__1UPMN.style-module_Large__2wPlw {\n height: 64px;\n padding: 0 1.7em; }\n .style-module_Button__1UPMN.style-module_Dark__1Z_hs {\n background-color: #111111;\n color: white; }\n .style-module_Button__1UPMN.style-module_Disabled__3HYF_ {\n background-color: #c8c8c8;\n color: #545454;\n pointer-events: none; }\n @media only screen and (max-width: 1000px) {\n .style-module_Button__1UPMN.style-module_FullWidthMobile__3MTFv {\n width: 100%; } }\n .style-module_Button__1UPMN .style-module_loader__3v6kq,\n .style-module_Button__1UPMN .style-module_loader__3v6kq:after {\n border-radius: 50%;\n width: 5em;\n height: 5em; }\n .style-module_Button__1UPMN .style-module_loader__3v6kq {\n font-size: 6px;\n position: relative;\n text-indent: -9999em;\n border-top: 0.5em solid rgba(255, 255, 255, 0.2);\n border-right: 0.5em solid rgba(255, 255, 255, 0.2);\n border-bottom: 0.5em solid rgba(255, 255, 255, 0.2);\n border-left: 0.5em solid #ffffff;\n -webkit-transform: translateZ(0);\n -ms-transform: translateZ(0);\n transform: translateZ(0);\n -webkit-animation: style-module_load8__2z7nj 1.1s infinite linear;\n animation: style-module_load8__2z7nj 1.1s infinite linear; }\n\n@-webkit-keyframes style-module_load8__2z7nj {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes style-module_load8__2z7nj {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n";
@@ -26880,16 +26997,25 @@ var BillingAddress = observer(function (_a) {
26880
26997
  createElement(ExpandableList, { options: expandableListOptionsBilling.get(), selectedIndex: selectedBillingRowIndex, onRowSelect: onSelectedBillingRowIndexChange })));
26881
26998
  });
26882
26999
 
26883
- var css_248z$e = ".style-module_StepPayment__3STxe {\n margin-top: 1em; }\n";
26884
- var styles$d = {"StepPayment":"style-module_StepPayment__3STxe"};
27000
+ var css_248z$e = ".style-module_StepPayment__3STxe {\n margin-top: 1em; }\n .style-module_StepPayment__3STxe .style-module_TermsLabelSpan__35xVC {\n text-decoration: underline; }\n";
27001
+ var styles$d = {"StepPayment":"style-module_StepPayment__3STxe","TermsLabelSpan":"style-module_TermsLabelSpan__35xVC"};
26885
27002
  styleInject(css_248z$e);
26886
27003
 
26887
27004
  var CheckoutStepPayment = observer(function (_a) {
26888
27005
  var vm = _a.vm;
27006
+ var onShowTermsClick = function (e) {
27007
+ e.stopPropagation();
27008
+ vm.policyModalText = vm.termsOfService;
27009
+ };
26889
27010
  return (createElement("div", { className: [styles$d.StepPayment, commonStyles.FormContainer].join(" ") },
26890
27011
  createElement(InfoBox, { vm: vm, showShipping: true }),
26891
27012
  createElement(PaymentGateways, { vm: vm }),
26892
27013
  createElement(BillingAddress, { vm: vm }),
27014
+ createElement("div", { style: { marginTop: "12px" } },
27015
+ createElement(Checkbox, { value: vm.isTermsAndConditionsChecked, label: createElement(Fragment, null,
27016
+ createElement("span", { className: styles$d.TermsLabelSpan, onClick: onShowTermsClick }, "Mesafeli sat\u0131\u015F s\u00F6zle\u015Fmesini"),
27017
+ " ",
27018
+ "okudum ve onayl\u0131yorum"), onChange: vm.onTermsAndConditionsCheckedChange })),
26893
27019
  createElement(StepActionButtons, { mainBtnText: "Şimdi öde", mainBtnOnClick: vm.performPayment, backBtnText: "Kargoya Geri Dön", backBtnOnClick: vm.onBackToShippingClick, isLoading: vm.isStepLoading })));
26894
27020
  });
26895
27021
 
@@ -27620,17 +27746,18 @@ function createCategoryBreadcrumbSchema(pageSpecificDataStr) {
27620
27746
 
27621
27747
  var IkasCheckoutPage = observer(function (_a) {
27622
27748
  var _b, _c, _d;
27623
- var checkout = _a.checkout, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
27749
+ var checkout = _a.checkout, checkoutSettings = _a.checkoutSettings, returnPolicy = _a.returnPolicy, privacyPolicy = _a.privacyPolicy, termsOfService = _a.termsOfService, queryParams = _a.queryParams;
27624
27750
  var router = useRouter();
27625
27751
  var vm = useState(function () {
27626
- return new CheckoutViewModel(checkout, queryParams, router, returnPolicy, privacyPolicy, termsOfService);
27752
+ return new CheckoutViewModel(checkout, checkoutSettings, queryParams, router, returnPolicy, privacyPolicy, termsOfService);
27627
27753
  })[0];
27628
27754
  useEffect(function () {
27755
+ if (vm.checkoutSettings.isAccountRequired && !vm.checkout.hasCustomer) {
27756
+ router.push("/account/login?redirect=" + encodeURIComponent(vm.checkoutUrl));
27757
+ }
27629
27758
  Analytics.beginCheckout(vm.checkout);
27630
27759
  Analytics.checkoutStep(vm.checkout, vm.step);
27631
27760
  }, []);
27632
- var _e = useState(""), policyModalTitle = _e[0], setPolicyModalTitle = _e[1];
27633
- var _f = useState(""), policyModalText = _f[0], setPolicyModalText = _f[1];
27634
27761
  var step;
27635
27762
  switch (vm.step) {
27636
27763
  case CheckoutStep.INFO:
@@ -27647,19 +27774,19 @@ var IkasCheckoutPage = observer(function (_a) {
27647
27774
  break;
27648
27775
  }
27649
27776
  var onPolicyModalClose = function () {
27650
- setPolicyModalText("");
27777
+ vm.policyModalText = "";
27651
27778
  };
27652
27779
  var onReturnPolicyClick = function () {
27653
- setPolicyModalTitle("Para İade Politikası");
27654
- setPolicyModalText(vm.returnPolicy);
27780
+ vm.policyModalTitle = "Para İade Politikası";
27781
+ vm.policyModalText = vm.returnPolicy;
27655
27782
  };
27656
27783
  var onPrivacyPolicyClick = function () {
27657
- setPolicyModalTitle("Gizlilik Politikası");
27658
- setPolicyModalText(vm.privacyPolicy);
27784
+ vm.policyModalTitle = "Gizlilik Politikası";
27785
+ vm.policyModalText = vm.returnPolicy;
27659
27786
  };
27660
27787
  var onTermsOfServiceClick = function () {
27661
- setPolicyModalTitle("Hizmet Şartları");
27662
- setPolicyModalText(vm.termsOfService);
27788
+ vm.policyModalTitle = "Hizmet Şartları";
27789
+ vm.policyModalText = vm.returnPolicy;
27663
27790
  };
27664
27791
  var onErrorClose = function () {
27665
27792
  vm.error = undefined;
@@ -27716,7 +27843,7 @@ var IkasCheckoutPage = observer(function (_a) {
27716
27843
  createElement("div", { className: styles$2.Right },
27717
27844
  createElement("div", { className: styles$2.RightContent },
27718
27845
  createElement(CartSummary, { vm: vm }))),
27719
- !!policyModalText && (createElement(PolicyModal, { title: policyModalTitle, modalContent: policyModalText, onClose: onPolicyModalClose })))));
27846
+ !!vm.policyModalText && (createElement(PolicyModal, { title: vm.policyModalTitle, modalContent: vm.policyModalText, onClose: onPolicyModalClose })))));
27720
27847
  });
27721
27848
 
27722
27849
  function ErrorComponent(_a) {
@@ -28555,11 +28682,12 @@ var SettingsHelper = /** @class */ (function () {
28555
28682
  SettingsHelper.getPageData = function (context, isServer, pageType) {
28556
28683
  var _a;
28557
28684
  return __awaiter(this, void 0, void 0, function () {
28558
- var locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
28685
+ var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
28559
28686
  return __generator(this, function (_b) {
28560
28687
  switch (_b.label) {
28561
28688
  case 0:
28562
- locale = context.locale;
28689
+ isLocal = process.env.NEXT_PUBLIC_ENV === "local";
28690
+ locale = isLocal ? "en" : context.locale;
28563
28691
  if (!locale) {
28564
28692
  return [2 /*return*/, {
28565
28693
  props: {},
@@ -28585,6 +28713,8 @@ var SettingsHelper = /** @class */ (function () {
28585
28713
  IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
28586
28714
  IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28587
28715
  IkasStorefrontConfig.routings = storefront.routings;
28716
+ IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
28717
+ IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
28588
28718
  provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
28589
28719
  return [4 /*yield*/, provider.getPageData()];
28590
28720
  case 2:
@@ -28841,15 +28971,18 @@ var _slug_ = /*#__PURE__*/Object.freeze({
28841
28971
  });
28842
28972
 
28843
28973
  var CheckoutPage = function (_a) {
28844
- var checkoutStr = _a.checkoutStr, configJson = _a.configJson, others = __rest(_a, ["checkoutStr", "configJson"]);
28974
+ var checkoutStr = _a.checkoutStr, checkoutSettingsStr = _a.checkoutSettingsStr, configJson = _a.configJson, others = __rest(_a, ["checkoutStr", "checkoutSettingsStr", "configJson"]);
28845
28975
  IkasStorefrontConfig.initWithJson(configJson);
28846
28976
  Analytics.disableHTML();
28847
28977
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
28848
- return createElement(IkasCheckoutPage, __assign({ checkout: checkout }, others));
28978
+ var checkoutSettings = checkoutSettingsStr
28979
+ ? new IkasCheckoutSettings(JSON.parse(checkoutSettingsStr))
28980
+ : new IkasCheckoutSettings();
28981
+ return (createElement(IkasCheckoutPage, __assign({ checkout: checkout, checkoutSettings: checkoutSettings }, others)));
28849
28982
  };
28850
28983
  var _id_ = observer(CheckoutPage);
28851
28984
  var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28852
- var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout;
28985
+ var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout, checkoutSettings;
28853
28986
  return __generator(this, function (_a) {
28854
28987
  switch (_a.label) {
28855
28988
  case 0:
@@ -28883,20 +29016,23 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
28883
29016
  return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
28884
29017
  case 2:
28885
29018
  checkout = _a.sent();
28886
- if (checkout) {
28887
- return [2 /*return*/, {
28888
- props: {
28889
- checkoutStr: JSON.stringify(checkout),
28890
- returnPolicy: themeLocalization.returnPolicy || "",
28891
- privacyPolicy: themeLocalization.privacyPolicy || "",
28892
- termsOfService: themeLocalization.termsOfService || "",
28893
- queryParams: context.query,
28894
- },
28895
- }];
28896
- }
28897
- else {
28898
- return [2 /*return*/, redirect()];
28899
- }
29019
+ if (!checkout) return [3 /*break*/, 4];
29020
+ return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
29021
+ case 3:
29022
+ checkoutSettings = _a.sent();
29023
+ return [2 /*return*/, {
29024
+ props: {
29025
+ checkoutStr: JSON.stringify(checkout),
29026
+ checkoutSettingsStr: (checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.length) ? JSON.stringify(checkoutSettings[0])
29027
+ : null,
29028
+ configJson: IkasStorefrontConfig.getJson(),
29029
+ returnPolicy: themeLocalization.returnPolicy || "",
29030
+ privacyPolicy: themeLocalization.privacyPolicy || "",
29031
+ termsOfService: themeLocalization.termsOfService || "",
29032
+ queryParams: context.query,
29033
+ },
29034
+ }];
29035
+ case 4: return [2 /*return*/, redirect()];
28900
29036
  }
28901
29037
  });
28902
29038
  }); };