@ikas/storefront 2.0.32 → 2.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
  2. package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
  3. package/build/analytics/analytics.js +1 -1
  4. package/build/analytics/googleTagManager.js +1 -1
  5. package/build/analytics/ikas.js +1 -1
  6. package/build/api/brand/index.js +1 -1
  7. package/build/api/category/index.js +1 -1
  8. package/build/api/checkout/index.js +1 -1
  9. package/build/api/customer/__generated__/createOrderRefundRequest.d.ts +1 -1
  10. package/build/api/customer/index.js +1 -1
  11. package/build/api/customer-review/index.js +1 -1
  12. package/build/api/customer-review-summary/__generated__/listCustomerReviewSummary.d.ts +56 -0
  13. package/build/api/customer-review-summary/index.d.ts +22 -0
  14. package/build/api/customer-review-summary/index.js +1 -0
  15. package/build/api/favorite-product/index.js +1 -1
  16. package/build/api/html-meta-data/index.js +1 -1
  17. package/build/api/index.d.ts +1 -0
  18. package/build/api/merchant/index.js +1 -1
  19. package/build/api/product-search/index.js +1 -1
  20. package/build/components/checkout/components/address-form/model.js +1 -1
  21. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  22. package/build/components/checkout/components/credit-card-form/index.js +1 -1
  23. package/build/components/checkout/components/customer-addresses/model.js +1 -1
  24. package/build/components/checkout/index.js +1 -1
  25. package/build/components/checkout/model.js +1 -1
  26. package/build/components/checkout/steps/step-success/index.js +1 -1
  27. package/build/components/page/head.js +1 -1
  28. package/build/components/page/index.js +1 -1
  29. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  30. package/build/components/page-editor/model.js +1 -1
  31. package/build/ikas.js +7 -7
  32. package/build/index.js +1 -1
  33. package/build/models/data/customer-review-summary/index.d.ts +16 -0
  34. package/build/models/data/customer-review-summary/index.js +1 -0
  35. package/build/models/data/index.d.ts +1 -0
  36. package/build/models/data/product/variant/index.js +1 -1
  37. package/build/models/data/storefront/theme-localization/index.js +1 -1
  38. package/build/models/theme/page/component/prop-value/product-list.js +1 -1
  39. package/build/models/ui/blog-category-list/index.js +1 -1
  40. package/build/models/ui/blog-list/index.js +1 -1
  41. package/build/models/ui/brand-list/index.js +1 -1
  42. package/build/models/ui/category-list/index.js +1 -1
  43. package/build/models/ui/customer-review-list/index.js +1 -1
  44. package/build/models/ui/customer-review-summary-list/index.d.ts +43 -0
  45. package/build/models/ui/customer-review-summary-list/index.js +1 -0
  46. package/build/models/ui/index.d.ts +1 -0
  47. package/build/models/ui/product-detail/index.d.ts +2 -1
  48. package/build/models/ui/product-detail/index.js +1 -1
  49. package/build/models/ui/product-list/index.js +1 -1
  50. package/build/models/ui/raffle-list/index.js +1 -1
  51. package/build/models/ui/validator/form/address.js +1 -1
  52. package/build/pages/404.js +1 -1
  53. package/build/pages/_slug_/index.js +1 -1
  54. package/build/pages/account/addresses.js +1 -1
  55. package/build/pages/account/favorite-products.js +1 -1
  56. package/build/pages/account/forgot-password.js +1 -1
  57. package/build/pages/account/index.js +1 -1
  58. package/build/pages/account/login.js +1 -1
  59. package/build/pages/account/orders/_id_.js +1 -1
  60. package/build/pages/account/orders/index.js +1 -1
  61. package/build/pages/account/raffles.js +1 -1
  62. package/build/pages/account/recover-password.js +1 -1
  63. package/build/pages/account/register.js +1 -1
  64. package/build/pages/blog/_slug_.js +1 -1
  65. package/build/pages/blog/index.js +1 -1
  66. package/build/pages/cart.js +1 -1
  67. package/build/pages/checkout.js +1 -1
  68. package/build/pages/home.js +1 -1
  69. package/build/pages/pages/_slug_.js +1 -1
  70. package/build/pages/raffle/_slug_.js +1 -1
  71. package/build/pages/raffle/index.js +1 -1
  72. package/build/pages/search.js +1 -1
  73. package/build/providers/helpers/raffles.js +1 -1
  74. package/build/providers/page-data-get.js +1 -1
  75. package/build/providers/page-data-init.js +1 -1
  76. package/build/providers/page-data-next.js +1 -1
  77. package/build/providers/placeholders.js +1 -1
  78. package/build/providers/prop-value/attribute-list.js +1 -1
  79. package/build/providers/prop-value/attribute.js +1 -1
  80. package/build/providers/prop-value/blog-category-list.js +1 -1
  81. package/build/providers/prop-value/blog-category.js +1 -1
  82. package/build/providers/prop-value/blog-list.js +1 -1
  83. package/build/providers/prop-value/blog.js +1 -1
  84. package/build/providers/prop-value/brand-list.js +1 -1
  85. package/build/providers/prop-value/brand.js +1 -1
  86. package/build/providers/prop-value/category-list.js +1 -1
  87. package/build/providers/prop-value/category.js +1 -1
  88. package/build/providers/prop-value/custom.js +1 -1
  89. package/build/providers/prop-value/image-list.js +1 -1
  90. package/build/providers/prop-value/image.js +1 -1
  91. package/build/providers/prop-value/link.js +1 -1
  92. package/build/providers/prop-value/product-detail.js +1 -1
  93. package/build/providers/prop-value/product-list.js +1 -1
  94. package/build/providers/prop-value/raffle-list.js +1 -1
  95. package/build/providers/prop-value/raffle.js +1 -1
  96. package/build/scripts/generators/types/index.js +1 -1
  97. package/build/store/base.js +1 -1
  98. package/build/store/cart.js +1 -1
  99. package/build/store/customer.js +1 -1
  100. package/package.json +1 -1
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import"../../../../api/blog/index.js";import"../../../../api/brand/index.js";import"../../../../api/cart/index.js";import"../../../../api/category/index.js";import"../../../../api/checkout/index.js";import{IkasCityAPI as s}from"../../../../api/city/index.js";import{IkasCountryAPI as r}from"../../../../api/country/index.js";import"../../../../api/customer/index.js";import"../../../../api/customer-review/index.js";import{IkasDistrictAPI as o}from"../../../../api/district/index.js";import"../../../../api/html-meta-data/index.js";import"../../../../api/merchant/index.js";import"../../../../api/product-search/index.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/installment-info/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/order-transaction/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import"../../../../api/apollo.js";import"../../../../api/favorite-product/index.js";import"../../../../api/contact-form/index.js";import{IkasStateAPI as n}from"../../../../api/state/index.js";import"../../../../api/product-option-set/index.js";import"../../../../api/raffle/index.js";import"../../../../api/back-in-stock-reminder/index.js";import"../../../../api/product-campaign/index.js";import{stringSorter as a}from"../../../../utils/helper.js";import{IkasStorefrontConfig as d}from"../../../../storefront/index.js";import"../../../../utils/i18n.js";import{FREE_TEXT_CITY_COUNTRY_LIST as l}from"../../../../utils/constants.js";var u=function(){function u(a){var l=this;this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=function(){return t(l,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.listCountries()];case 1:return t.sent(),[4,this.listStates()];case 2:return t.sent(),[4,this.listCities()];case 3:return t.sent(),[4,this.listDistricts()];case 4:return t.sent(),[2]}}))}))},this.listCountries=function(){return t(l,void 0,void 0,(function(){var t,e,s,o,n,a,l,u=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.myCountryCode?[3,2]:(t=this,[4,r.getMyCountry()]);case 1:t.myCountryCode=i.sent()||void 0,i.label=2;case 2:return[4,r.listCountries(void 0,(null===(a=this.allowedCountryIds)||void 0===a?void 0:a.length)?this.allowedCountryIds:void 0)];case 3:return e=i.sent(),s=d.routings.find((function(t){return t.id===d.storefrontRoutingId})),(null===(l=null==s?void 0:s.countryCodes)||void 0===l?void 0:l.length)?e=e.filter((function(t){var i;return t.iso2&&(null===(i=s.countryCodes)||void 0===i?void 0:i.includes(t.iso2))})):(o=d.routings.filter((function(t){return t.id!==d.storefrontRoutingId})),e=e.filter((function(t){return t.iso2&&!o.some((function(i){var e;return null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2)}))}))),this.countries=e,1!==this.countries.length||this.country?this.myCountryCode&&!this.country&&(n=this.countries.find((function(t){return t.iso2===u.myCountryCode})))&&this.onCountryChange(n.id):this.onCountryChange(this.countries[0].id),[3,5];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))},this.listStates=function(){return t(l,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.listStates(this.country.id)];case 2:return t=i.sent(),this.states=t,this.hasState||this.onStateChange(this.states[0].id),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listCities=function(){return t(l,void 0,void 0,(function(){var t,e,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,s.listCities(this.state.id,null===(r=this.country)||void 0===r?void 0:r.id)];case 2:return t.cities=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listDistricts=function(){return t(l,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,o.listDistricts(this.city.id,null===(s=this.state)||void 0===s?void 0:s.id)];case 2:return t.districts=i.sent(),this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1,[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.modelToOption=function(t){return{label:t.name,value:t.id+""}},this.onFirstNameChange=function(t){l.firstNameChangeCallback&&l.firstNameChangeCallback(t),l.address.firstName=t},this.onLastNameChange=function(t){l.lastNameChangeCallback&&l.lastNameChangeCallback(t),l.address.lastName=t},this.onPhoneChange=function(t){l.address.phone=t},this.onIdentityNumberChange=function(t){t?t.length<=11&&(l.address.identityNumber=t):l.address.identityNumber=""},this.onAddressTitleChange=function(t){l.address.title=t},this.onAddressLine1Change=function(t){l.address.addressLine1=t},this.onAddressLine2Change=function(t){l.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){l.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=l.country)||void 0===i?void 0:i.id)!==t){var e=l.countries.find((function(i){return i.id===t}));l.address.country={id:null==e?void 0:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.iso3,iso2:null==e?void 0:e.iso2,iso3:null==e?void 0:e.iso3},l.address.state=void 0,l.address.city=void 0,l.address.district=void 0,l.states=[],l.cities=[],l.districts=[],l.listStates()}},this.onStateChange=function(t){var i;if((null===(i=l.state)||void 0===i?void 0:i.id)!==t){var e=l.states.find((function(i){return i.id===t}));l.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},l.address.city=void 0,l.address.district=void 0,l.cities=[],l.districts=[],l.listCities()}},this.onCityChange=function(t){var i;if((null===(i=l.city)||void 0===i?void 0:i.id)!==t){var e=l.cities.find((function(i){return i.id===t}));l.address.city={id:e.id,name:e.name},l.address.district=void 0,l.districts=[],l.listDistricts()}},this.onCityInputChange=function(t){l.districts=[],l.address.city={id:void 0,name:t}},this.onDistrictChange=function(t){var i;if((null===(i=l.district)||void 0===i?void 0:i.id)!==t){var e=l.districts.find((function(i){return i.id===t}));l.address.district={id:e.id,name:e.name}}},this.onDistrictInputChange=function(t){l.address.district={id:void 0,name:t}},this.onCorporateChange=function(t){l.isCorporate=t,t||(l.address.company=null,l.address.taxNumber=null,l.address.taxOffice=null)},this.onCompanyChange=function(t){l.address.company=t},this.onTaxNumberChange=function(t){l.address.taxNumber=t},this.onTaxOfficeChange=function(t){l.address.taxOffice=t},this.address=a.address,this.isCorporate=a.isCorporate||!1,this.isErrorsVisible=a.isErrorsVisible||!1,this.isCustomerAddress=a.isCustomerAddress||!1,this.allowedCountryIds=a.allowedCountryIds,this.allowCorporateInfo=a.allowCorporateInfo||!1,this.allowTitleChange=a.allowTitleChange||!1,this.firstNameChangeCallback=a.firstNameChangeCallback||null,this.lastNameChangeCallback=a.lastNameChangeCallback||null,e(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}return Object.defineProperty(u.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"countryOptions",{get:function(){var t=this.countries.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"stateOptions",{get:function(){var t=this.states.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"cityOptions",{get:function(){var t=this.cities.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"districtOptions",{get:function(){var t=this.districts.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isFreeTextCity",{get:function(){var t=this;return l.some((function(i){var e,s;return(null===(s=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===s?void 0:s.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),u}();export{u as default};
1
+ import{__awaiter as t,__generator as i}from'../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import"../../../../api/blog/index.js";import"../../../../api/brand/index.js";import"../../../../api/cart/index.js";import"../../../../api/category/index.js";import"../../../../api/checkout/index.js";import{IkasCityAPI as s}from"../../../../api/city/index.js";import{IkasCountryAPI as r}from"../../../../api/country/index.js";import"../../../../api/customer/index.js";import"../../../../api/customer-review/index.js";import"../../../../api/customer-review-summary/index.js";import{IkasDistrictAPI as o}from"../../../../api/district/index.js";import"../../../../api/html-meta-data/index.js";import"../../../../api/merchant/index.js";import"../../../../api/product-search/index.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/installment-info/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/order-transaction/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import"../../../../api/apollo.js";import"../../../../api/favorite-product/index.js";import"../../../../api/contact-form/index.js";import{IkasStateAPI as n}from"../../../../api/state/index.js";import"../../../../api/product-option-set/index.js";import"../../../../api/raffle/index.js";import"../../../../api/back-in-stock-reminder/index.js";import"../../../../api/product-campaign/index.js";import{stringSorter as a}from"../../../../utils/helper.js";import{IkasStorefrontConfig as d}from"../../../../storefront/index.js";import"../../../../utils/i18n.js";import{FREE_TEXT_CITY_COUNTRY_LIST as l}from"../../../../utils/constants.js";var u=function(){function u(a){var l=this;this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=function(){return t(l,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.listCountries()];case 1:return t.sent(),[4,this.listStates()];case 2:return t.sent(),[4,this.listCities()];case 3:return t.sent(),[4,this.listDistricts()];case 4:return t.sent(),[2]}}))}))},this.listCountries=function(){return t(l,void 0,void 0,(function(){var t,e,s,o,n,a,l,u=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.myCountryCode?[3,2]:(t=this,[4,r.getMyCountry()]);case 1:t.myCountryCode=i.sent()||void 0,i.label=2;case 2:return[4,r.listCountries(void 0,(null===(a=this.allowedCountryIds)||void 0===a?void 0:a.length)?this.allowedCountryIds:void 0)];case 3:return e=i.sent(),s=d.routings.find((function(t){return t.id===d.storefrontRoutingId})),(null===(l=null==s?void 0:s.countryCodes)||void 0===l?void 0:l.length)?e=e.filter((function(t){var i;return t.iso2&&(null===(i=s.countryCodes)||void 0===i?void 0:i.includes(t.iso2))})):(o=d.routings.filter((function(t){return t.id!==d.storefrontRoutingId})),e=e.filter((function(t){return t.iso2&&!o.some((function(i){var e;return null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2)}))}))),this.countries=e,1!==this.countries.length||this.country?this.myCountryCode&&!this.country&&(n=this.countries.find((function(t){return t.iso2===u.myCountryCode})))&&this.onCountryChange(n.id):this.onCountryChange(this.countries[0].id),[3,5];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))},this.listStates=function(){return t(l,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.listStates(this.country.id)];case 2:return t=i.sent(),this.states=t,this.hasState||this.onStateChange(this.states[0].id),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listCities=function(){return t(l,void 0,void 0,(function(){var t,e,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,s.listCities(this.state.id,null===(r=this.country)||void 0===r?void 0:r.id)];case 2:return t.cities=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listDistricts=function(){return t(l,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),t=this,[4,o.listDistricts(this.city.id,null===(s=this.state)||void 0===s?void 0:s.id)];case 2:return t.districts=i.sent(),this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1,[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.modelToOption=function(t){return{label:t.name,value:t.id+""}},this.onFirstNameChange=function(t){l.firstNameChangeCallback&&l.firstNameChangeCallback(t),l.address.firstName=t},this.onLastNameChange=function(t){l.lastNameChangeCallback&&l.lastNameChangeCallback(t),l.address.lastName=t},this.onPhoneChange=function(t){l.address.phone=t},this.onIdentityNumberChange=function(t){t?t.length<=11&&(l.address.identityNumber=t):l.address.identityNumber=""},this.onAddressTitleChange=function(t){l.address.title=t},this.onAddressLine1Change=function(t){l.address.addressLine1=t},this.onAddressLine2Change=function(t){l.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){l.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=l.country)||void 0===i?void 0:i.id)!==t){var e=l.countries.find((function(i){return i.id===t}));l.address.country={id:null==e?void 0:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.iso3,iso2:null==e?void 0:e.iso2,iso3:null==e?void 0:e.iso3},l.address.state=void 0,l.address.city=void 0,l.address.district=void 0,l.states=[],l.cities=[],l.districts=[],l.listStates()}},this.onStateChange=function(t){var i;if((null===(i=l.state)||void 0===i?void 0:i.id)!==t){var e=l.states.find((function(i){return i.id===t}));l.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},l.address.city=void 0,l.address.district=void 0,l.cities=[],l.districts=[],l.listCities()}},this.onCityChange=function(t){var i;if((null===(i=l.city)||void 0===i?void 0:i.id)!==t){var e=l.cities.find((function(i){return i.id===t}));l.address.city={id:e.id,name:e.name},l.address.district=void 0,l.districts=[],l.listDistricts()}},this.onCityInputChange=function(t){l.districts=[],l.address.city={id:void 0,name:t}},this.onDistrictChange=function(t){var i;if((null===(i=l.district)||void 0===i?void 0:i.id)!==t){var e=l.districts.find((function(i){return i.id===t}));l.address.district={id:e.id,name:e.name}}},this.onDistrictInputChange=function(t){l.address.district={id:void 0,name:t}},this.onCorporateChange=function(t){l.isCorporate=t,t||(l.address.company=null,l.address.taxNumber=null,l.address.taxOffice=null)},this.onCompanyChange=function(t){l.address.company=t},this.onTaxNumberChange=function(t){l.address.taxNumber=t},this.onTaxOfficeChange=function(t){l.address.taxOffice=t},this.address=a.address,this.isCorporate=a.isCorporate||!1,this.isErrorsVisible=a.isErrorsVisible||!1,this.isCustomerAddress=a.isCustomerAddress||!1,this.allowedCountryIds=a.allowedCountryIds,this.allowCorporateInfo=a.allowCorporateInfo||!1,this.allowTitleChange=a.allowTitleChange||!1,this.firstNameChangeCallback=a.firstNameChangeCallback||null,this.lastNameChangeCallback=a.lastNameChangeCallback||null,e(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}return Object.defineProperty(u.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"countryOptions",{get:function(){var t=this.countries.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"stateOptions",{get:function(){var t=this.states.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"cityOptions",{get:function(){var t=this.cities.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"districtOptions",{get:function(){var t=this.districts.map(this.modelToOption);return t.sort((function(t,i){return a(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isFreeTextCity",{get:function(){var t=this;return l.some((function(i){var e,s;return(null===(s=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===s?void 0:s.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),u}();export{u as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-review/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/installment-info/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/order/line-item/index.js";import"mobx";import"../../../../../api/product-option-file/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product-attribute/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product-filter/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"../../../../../models/data/order-transaction/index.js";import{IkasProductOptionType as i}from"../../../../../models/data/product-option-set/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/product-campaing/campaign/index.js";import"../../../../../models/theme/theme.js";import"../../../../../models/theme/page/index.js";import"../../../../../models/theme/component/prop/index.js";import"../../../../../models/theme/page/component/prop-value/link.js";import"../../../../../models/ui/brand-list/index.js";import"../../../../../models/ui/blog-list/index.js";import"../../../../../models/ui/blog-category-list/index.js";import"../../../../../models/ui/category-list/index.js";import"../../../../../models/ui/product-detail/index.js";import"../../../../../models/ui/product-list/index.js";import"../../../../../models/ui/product-attribute-detail/index.js";import"../../../../../models/ui/product-attribute-list/index.js";import"../../../../../models/ui/customer-review-list/index.js";import"../../../../../models/ui/validator/index.js";import"../../../../../models/ui/validator/rules/index.js";import"../../../../../models/ui/validator/form/login.js";import"../../../../../models/ui/validator/form/address.js";import"../../../../../models/ui/validator/form/register.js";import"../../../../../models/ui/validator/form/contact-form.js";import"../../../../../models/ui/validator/form/forgot-password.js";import"../../../../../models/ui/validator/form/recover-password.js";import"../../../../../models/ui/validator/form/account-info.js";import"../../../../../models/ui/validator/form/raffle-form.js";import"../../../../../models/ui/validator/form/customer-review.js";import"../../../../../models/ui/raffle-list/index.js";import"../../../../../models/theme/settings/index.js";import"../../../../../models/theme/custom-data/index.js";import{formatDate as a}from"../../../../../utils/helper.js";import{formatMoney as o}from"../../../../../utils/currency.js";import{useTranslation as r}from"../../../../../utils/i18n.js";import{Modal as m}from"../../modal/index.js";import s from"./style.module.scss.js";var n=t((function(t){var n,d,l,c=t.vm,u=t.currencyCode,p=t.cartItem,v=r().t,j=e.useState(!1),f=j[0],x=j[1],E=null===(n=c.checkout.adjustments)||void 0===n?void 0:n.map((function(e){var t;return(null===(t=e.appliedOrderLines)||void 0===t?void 0:t.filter((function(e){return e.orderLineId===p.id})).reduce((function(e,t){return e+(t.amount||0)}),0))||0})),N=null==E?void 0:E.reduce((function(e,t){return e+t}),0),g=e.useMemo((function(){var t;return e.createElement("div",null,null===(t=p.options)||void 0===t?void 0:t.map((function(t){switch(t.type){case i.TEXT:case i.TEXT_AREA:case i.CHOICE:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return e.name||e.value})).join(", ")));case i.DATE_PICKER:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return t=e.value,(i=a(new Date(t)).split(" ")).splice(-1),i.join(" ");var t,i})).join(", ")));case i.FILE:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return t=e.value,decodeURIComponent(t.split("/")[t.split("/").length-1]);var t})).join(", ")));case i.CHECKBOX:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.length&&"true"===t.values[0].value?v("checkout-page:yes"):v("checkout-page:no")));case i.COLOR_PICKER:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionsHorContainer},t.values.map((function(t,i){return e.createElement("div",{key:i,className:s.OptionColorValue,style:{backgroundColor:t.value}})}))))}})))}),[]);return e.createElement("div",{className:s.CheckoutItem},e.createElement("div",{className:s.ImageContainer},e.createElement("img",{className:s.Image,src:null===(d=p.variant.mainImage)||void 0===d?void 0:d.thumbnailSrc})),e.createElement("div",{className:s.Right},e.createElement("div",{className:s.Name},p.variant.name),e.createElement("div",{className:s.LightText},"".concat(v("checkout-page:quantity"),": ")+p.quantity),e.createElement("div",{className:s.LightText},p.variant.variantValues.map((function(e){return e.variantValueName})).join(" / ")),!!(null===(l=p.options)||void 0===l?void 0:l.length)&&e.createElement("div",{className:s.OptionsText,onClick:function(){return x(!0)}},v("checkout-page:customizedProduct")),!!f&&e.createElement(m,{title:p.variant.name,modalContent:g,onClose:function(){return x(!1)}}),e.createElement("div",{className:s.Price},!!p.overridenPriceWithQuantity&&e.createElement("span",{className:s.GrayPrice},o(N?p.finalPriceWithQuantity:p.overridenPriceWithQuantity,u)),o(N?p.finalPriceWithQuantity-N:p.finalPriceWithQuantity,u))))}));export{n as CartItem};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-review/index.js";import"mobx";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/installment-info/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../api/product-option-file/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product-attribute/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product-filter/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"../../../../../models/data/order-transaction/index.js";import{IkasProductOptionType as i}from"../../../../../models/data/product-option-set/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/product-campaing/campaign/index.js";import"../../../../../models/theme/theme.js";import"../../../../../models/theme/page/index.js";import"../../../../../models/theme/component/prop/index.js";import"../../../../../models/theme/page/component/prop-value/link.js";import"../../../../../models/ui/brand-list/index.js";import"../../../../../models/ui/blog-list/index.js";import"../../../../../models/ui/blog-category-list/index.js";import"../../../../../models/ui/category-list/index.js";import"../../../../../models/ui/product-detail/index.js";import"../../../../../models/ui/product-list/index.js";import"../../../../../models/ui/product-attribute-detail/index.js";import"../../../../../models/ui/product-attribute-list/index.js";import"../../../../../models/ui/customer-review-list/index.js";import"../../../../../models/ui/customer-review-summary-list/index.js";import"../../../../../models/ui/validator/index.js";import"../../../../../models/ui/validator/rules/index.js";import"../../../../../models/ui/validator/form/login.js";import"../../../../../models/ui/validator/form/address.js";import"../../../../../models/ui/validator/form/register.js";import"../../../../../models/ui/validator/form/contact-form.js";import"../../../../../models/ui/validator/form/forgot-password.js";import"../../../../../models/ui/validator/form/recover-password.js";import"../../../../../models/ui/validator/form/account-info.js";import"../../../../../models/ui/validator/form/raffle-form.js";import"../../../../../models/ui/validator/form/customer-review.js";import"../../../../../models/ui/raffle-list/index.js";import"../../../../../models/theme/settings/index.js";import"../../../../../models/theme/custom-data/index.js";import{formatDate as a}from"../../../../../utils/helper.js";import{formatMoney as o}from"../../../../../utils/currency.js";import{useTranslation as r}from"../../../../../utils/i18n.js";import{Modal as m}from"../../modal/index.js";import s from"./style.module.scss.js";var n=t((function(t){var n,d,l,c=t.vm,u=t.currencyCode,p=t.cartItem,v=r().t,j=e.useState(!1),x=j[0],f=j[1],E=null===(n=c.checkout.adjustments)||void 0===n?void 0:n.map((function(e){var t;return(null===(t=e.appliedOrderLines)||void 0===t?void 0:t.filter((function(e){return e.orderLineId===p.id})).reduce((function(e,t){return e+(t.amount||0)}),0))||0})),N=null==E?void 0:E.reduce((function(e,t){return e+t}),0),g=e.useMemo((function(){var t;return e.createElement("div",null,null===(t=p.options)||void 0===t?void 0:t.map((function(t){switch(t.type){case i.TEXT:case i.TEXT_AREA:case i.CHOICE:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return e.name||e.value})).join(", ")));case i.DATE_PICKER:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return t=e.value,(i=a(new Date(t)).split(" ")).splice(-1),i.join(" ");var t,i})).join(", ")));case i.FILE:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.map((function(e){return t=e.value,decodeURIComponent(t.split("/")[t.split("/").length-1]);var t})).join(", ")));case i.CHECKBOX:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionValue},t.values.length&&"true"===t.values[0].value?v("checkout-page:yes"):v("checkout-page:no")));case i.COLOR_PICKER:return e.createElement("div",{className:s.OptionRow},e.createElement("div",{className:s.OptionName},t.name),e.createElement("div",{className:s.OptionsHorContainer},t.values.map((function(t,i){return e.createElement("div",{key:i,className:s.OptionColorValue,style:{backgroundColor:t.value}})}))))}})))}),[]);return e.createElement("div",{className:s.CheckoutItem},e.createElement("div",{className:s.ImageContainer},e.createElement("img",{className:s.Image,src:null===(d=p.variant.mainImage)||void 0===d?void 0:d.thumbnailSrc})),e.createElement("div",{className:s.Right},e.createElement("div",{className:s.Name},p.variant.name),e.createElement("div",{className:s.LightText},"".concat(v("checkout-page:quantity"),": ")+p.quantity),e.createElement("div",{className:s.LightText},p.variant.variantValues.map((function(e){return e.variantValueName})).join(" / ")),!!(null===(l=p.options)||void 0===l?void 0:l.length)&&e.createElement("div",{className:s.OptionsText,onClick:function(){return f(!0)}},v("checkout-page:customizedProduct")),!!x&&e.createElement(m,{title:p.variant.name,modalContent:g,onClose:function(){return f(!1)}}),e.createElement("div",{className:s.Price},!!p.overridenPriceWithQuantity&&e.createElement("span",{className:s.GrayPrice},o(N?p.finalPriceWithQuantity:p.overridenPriceWithQuantity,u)),o(N?p.finalPriceWithQuantity-N:p.finalPriceWithQuantity,u))))}));export{n as CartItem};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as o}from"mobx-react-lite";import t from"../../styles/common.module.scss.js";import r from"../../style.module.scss.js";import{FormItem as i}from"../form-item/index.js";import{FormItemInputType as a,FormItemType as m}from"../form-item/model.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import{IkasCardAssociation as s}from"../../../../models/data/installment-info/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"mobx";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/order-transaction/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import d from"./svg/amex.js";import l from"./svg/master-card.js";import n from"./svg/troy.js";import p from"./svg/visa.js";import c from"./style.module.scss.js";import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{useTranslation as u}from"../../../../utils/i18n.js";var j=o((function(o){var j,x=o.vm,v=u().t,f=x.cardData;if(!f)return null;return e.createElement("div",null,e.createElement("div",{className:r.RowPB},e.createElement(i,{name:"cardnumber",autocomplete:"cc-number",inputType:a.NUMERIC,type:m.TEXT,label:v("checkout-page:cardNumber"),value:f.cardNumber,onChange:x.onCardNumberChange,errorText:v("checkout-page:cardNumberError"),rightContent:(null===(j=x.installmentInfo)||void 0===j?void 0:j.cardAssociation)?e.createElement("div",{className:c.CardLogo},function(o){switch(o){case s.AMERICAN_EXPRESS:return e.createElement(d,null);case s.MASTER_CARD:return e.createElement(l,null);case s.TROY:return e.createElement(n,null);case s.VISA:return e.createElement(p,null);default:return e.createElement("div",null)}}(x.installmentInfo.cardAssociation)):void 0,hasError:x.isErrorsVisible&&!f.validationResult.cardNumber})),e.createElement("div",{className:r.RowPB},e.createElement(i,{name:"ccname",autocomplete:"cc-name",type:m.TEXT,label:v("checkout-page:cardHolderName"),value:f.cardHolderName,onChange:x.onCardHolderNameChange,errorText:v("checkout-page:cardHolderError"),hasError:x.isErrorsVisible&&!f.validationResult.cardHolderName})),e.createElement("div",{className:[t.Grid,t.Grid2].join(" ")},e.createElement(i,{name:"cc-exp",autocomplete:"cc-exp",inputType:a.NUMERIC,type:m.TEXT,label:v("checkout-page:cardExpiry"),value:f.expirationDate,onChange:x.onExpirationDateChange,errorText:v("checkout-page:cardExpiryError"),hasError:x.isErrorsVisible&&!f.validationResult.expirationDate}),e.createElement(i,{name:"cvc",autocomplete:"cc-csc",inputType:a.NUMERIC,type:m.TEXT,label:v("checkout-page:cardCVC"),value:f.cvv,onChange:x.onCvcChange,errorText:v("checkout-page:cardCVCError"),tooltipText:v("checkout-page:cardCVCTooltip"),hasError:x.isErrorsVisible&&!f.validationResult.cvv})))}));export{j as CreditCardForm};
1
+ import*as e from"react";import{observer as o}from"mobx-react-lite";import t from"../../styles/common.module.scss.js";import r from"../../style.module.scss.js";import{FormItem as i}from"../form-item/index.js";import{FormItemInputType as a,FormItemType as m}from"../form-item/model.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"mobx";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import{IkasCardAssociation as s}from"../../../../models/data/installment-info/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/order-transaction/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import d from"./svg/amex.js";import l from"./svg/master-card.js";import n from"./svg/troy.js";import p from"./svg/visa.js";import c from"./style.module.scss.js";import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{useTranslation as u}from"../../../../utils/i18n.js";var j=o((function(o){var j,x=o.vm,v=u().t,f=x.cardData;if(!f)return null;return e.createElement("div",null,e.createElement("div",{className:r.RowPB},e.createElement(i,{name:"cardnumber",autocomplete:"cc-number",inputType:a.NUMERIC,type:m.TEXT,label:v("checkout-page:cardNumber"),value:f.cardNumber,onChange:x.onCardNumberChange,errorText:v("checkout-page:cardNumberError"),rightContent:(null===(j=x.installmentInfo)||void 0===j?void 0:j.cardAssociation)?e.createElement("div",{className:c.CardLogo},function(o){switch(o){case s.AMERICAN_EXPRESS:return e.createElement(d,null);case s.MASTER_CARD:return e.createElement(l,null);case s.TROY:return e.createElement(n,null);case s.VISA:return e.createElement(p,null);default:return e.createElement("div",null)}}(x.installmentInfo.cardAssociation)):void 0,hasError:x.isErrorsVisible&&!f.validationResult.cardNumber})),e.createElement("div",{className:r.RowPB},e.createElement(i,{name:"ccname",autocomplete:"cc-name",type:m.TEXT,label:v("checkout-page:cardHolderName"),value:f.cardHolderName,onChange:x.onCardHolderNameChange,errorText:v("checkout-page:cardHolderError"),hasError:x.isErrorsVisible&&!f.validationResult.cardHolderName})),e.createElement("div",{className:[t.Grid,t.Grid2].join(" ")},e.createElement(i,{name:"cc-exp",autocomplete:"cc-exp",inputType:a.NUMERIC,type:m.TEXT,label:v("checkout-page:cardExpiry"),value:f.expirationDate,onChange:x.onExpirationDateChange,errorText:v("checkout-page:cardExpiryError"),hasError:x.isErrorsVisible&&!f.validationResult.expirationDate}),e.createElement(i,{name:"cvc",autocomplete:"cc-csc",inputType:a.NUMERIC,type:m.TEXT,label:v("checkout-page:cardCVC"),value:f.cvv,onChange:x.onCvcChange,errorText:v("checkout-page:cardCVCError"),tooltipText:v("checkout-page:cardCVCTooltip"),hasError:x.isErrorsVisible&&!f.validationResult.cvv})))}));export{j as CreditCardForm};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as s}from'../../../../ext/tslib/tslib.es6.js';import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import{IkasCustomerAddress as t}from"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/installment-info/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import{makeAutoObservable as i}from"mobx";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/order-transaction/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import d from'../../../../ext/lodash/cloneDeep.js';var r=function(){function r(r,o){var n=this;this.editingCustomerAddress=null,this.isDeleteAddressLoading=!1,this.isEditAddressLoading=!1,this.isEditAddressErrorsVisible=!1,this.onAddressSelect=function(e){("shipping"===n.addressType?n.vm.onSelectedShippingAddressIdChange:n.vm.onSelectedBillingAddressIdChange)((null==e?void 0:e.id)||"-1")},this.onEditAddressClick=function(e){var s=new t(d(e));s.checkoutSettings=n.vm.checkoutSettings,n.editingCustomerAddress=s},this.onCancelEditAddressClick=function(){n.isDeleteAddressLoading||n.isEditAddressLoading||(n.editingCustomerAddress=null)},this.onDeleteAddressClick=function(){return e(n,void 0,void 0,(function(){var e,t,i,r=this;return s(this,(function(s){switch(s.label){case 0:if(-1===(e=null===(i=this.vm.store.customerStore.customer)||void 0===i?void 0:i.addresses.findIndex((function(e){var s;return e.id===(null===(s=r.editingCustomerAddress)||void 0===s?void 0:s.id)})))||void 0===e)return[3,5];(t=d(this.vm.store.customerStore.customer)).addresses.splice(e,1),s.label=1;case 1:return s.trys.push([1,3,4,5]),this.isDeleteAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(t)];case 2:return s.sent()&&(this.editingCustomerAddress=null),[3,5];case 3:return s.sent(),[3,5];case 4:return this.isDeleteAddressLoading=!1,[7];case 5:return[2]}}))}))},this.onSaveAddressClick=function(){return e(n,void 0,void 0,(function(){var e,t,i,r,o=this;return s(this,(function(s){switch(s.label){case 0:if(this.isDeleteAddressLoading||this.isEditAddressLoading)return[2];if(!(null===(i=this.editingCustomerAddress)||void 0===i?void 0:i.isValid))return this.isEditAddressErrorsVisible=!0,[2];if(-1===(e=null===(r=this.vm.store.customerStore.customer)||void 0===r?void 0:r.addresses.findIndex((function(e){var s;return e.id===(null===(s=o.editingCustomerAddress)||void 0===s?void 0:s.id)})))||void 0===e)return[3,5];(t=d(this.vm.store.customerStore.customer)).addresses[e]=this.editingCustomerAddress,s.label=1;case 1:return s.trys.push([1,3,4,5]),this.isEditAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(t)];case 2:return s.sent()&&(this.onAddressSelect(this.editingCustomerAddress),this.editingCustomerAddress=null,this.isEditAddressErrorsVisible=!1),[3,5];case 3:return s.sent(),[3,5];case 4:return this.isEditAddressLoading=!1,[7];case 5:return[2]}}))}))},this.firstNameChangeCallback=function(e){n.vm.checkout.hasCustomer||"shipping"!==n.addressType||(n.vm.checkout.customer.firstName=e)},this.lastNameChangeCallback=function(e){n.vm.checkout.hasCustomer||"shipping"!==n.addressType||(n.vm.checkout.customer.lastName=e)},this.vm=r,this.addressType=o,i(this)}return Object.defineProperty(r.prototype,"address",{get:function(){return"shipping"===this.addressType?this.vm.checkout.shippingAddress:this.vm.checkout.billingAddress},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedAddressId",{get:function(){return"shipping"===this.addressType?this.vm.selectedShippingAddressId:this.vm.selectedBillingAddressId},enumerable:!1,configurable:!0}),r}();export{r as default};
1
+ import{__awaiter as e,__generator as s}from'../../../../ext/tslib/tslib.es6.js';import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import{IkasCustomerAddress as t}from"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import{makeAutoObservable as i}from"mobx";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/installment-info/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/order-transaction/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import d from'../../../../ext/lodash/cloneDeep.js';var r=function(){function r(r,o){var m=this;this.editingCustomerAddress=null,this.isDeleteAddressLoading=!1,this.isEditAddressLoading=!1,this.isEditAddressErrorsVisible=!1,this.onAddressSelect=function(e){("shipping"===m.addressType?m.vm.onSelectedShippingAddressIdChange:m.vm.onSelectedBillingAddressIdChange)((null==e?void 0:e.id)||"-1")},this.onEditAddressClick=function(e){var s=new t(d(e));s.checkoutSettings=m.vm.checkoutSettings,m.editingCustomerAddress=s},this.onCancelEditAddressClick=function(){m.isDeleteAddressLoading||m.isEditAddressLoading||(m.editingCustomerAddress=null)},this.onDeleteAddressClick=function(){return e(m,void 0,void 0,(function(){var e,t,i,r=this;return s(this,(function(s){switch(s.label){case 0:if(-1===(e=null===(i=this.vm.store.customerStore.customer)||void 0===i?void 0:i.addresses.findIndex((function(e){var s;return e.id===(null===(s=r.editingCustomerAddress)||void 0===s?void 0:s.id)})))||void 0===e)return[3,5];(t=d(this.vm.store.customerStore.customer)).addresses.splice(e,1),s.label=1;case 1:return s.trys.push([1,3,4,5]),this.isDeleteAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(t)];case 2:return s.sent()&&(this.editingCustomerAddress=null),[3,5];case 3:return s.sent(),[3,5];case 4:return this.isDeleteAddressLoading=!1,[7];case 5:return[2]}}))}))},this.onSaveAddressClick=function(){return e(m,void 0,void 0,(function(){var e,t,i,r,o=this;return s(this,(function(s){switch(s.label){case 0:if(this.isDeleteAddressLoading||this.isEditAddressLoading)return[2];if(!(null===(i=this.editingCustomerAddress)||void 0===i?void 0:i.isValid))return this.isEditAddressErrorsVisible=!0,[2];if(-1===(e=null===(r=this.vm.store.customerStore.customer)||void 0===r?void 0:r.addresses.findIndex((function(e){var s;return e.id===(null===(s=o.editingCustomerAddress)||void 0===s?void 0:s.id)})))||void 0===e)return[3,5];(t=d(this.vm.store.customerStore.customer)).addresses[e]=this.editingCustomerAddress,s.label=1;case 1:return s.trys.push([1,3,4,5]),this.isEditAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(t)];case 2:return s.sent()&&(this.onAddressSelect(this.editingCustomerAddress),this.editingCustomerAddress=null,this.isEditAddressErrorsVisible=!1),[3,5];case 3:return s.sent(),[3,5];case 4:return this.isEditAddressLoading=!1,[7];case 5:return[2]}}))}))},this.firstNameChangeCallback=function(e){m.vm.checkout.hasCustomer||"shipping"!==m.addressType||(m.vm.checkout.customer.firstName=e)},this.lastNameChangeCallback=function(e){m.vm.checkout.hasCustomer||"shipping"!==m.addressType||(m.vm.checkout.customer.lastName=e)},this.vm=r,this.addressType=o,i(this)}return Object.defineProperty(r.prototype,"address",{get:function(){return"shipping"===this.addressType?this.vm.checkout.shippingAddress:this.vm.checkout.billingAddress},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedAddressId",{get:function(){return"shipping"===this.addressType?this.vm.selectedShippingAddressId:this.vm.selectedBillingAddressId},enumerable:!1,configurable:!0}),r}();export{r as default};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import s,{CheckoutStep as c}from"./model.js";import n from"./steps/step-info/index.js";import{CheckoutStepShipping as a}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as l}from"./steps/step-payment/index.js";import{CartSummary as m}from"./components/cart-summary/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"mobx";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as d}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import{ContactForm as u}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{StepSuccess as p}from"./steps/step-success/index.js";import{Modal as v}from"./components/modal/index.js";import h from"./style.module.scss.js";import{IkasPageHead as E}from"../page/head.js";import{Analytics as g}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{Image as f}from"../image/index.js";import k from"next/link.js";import y,{Step as x}from"./components/step-container/index.js";import{IkasStorefrontConfig as j}from"../../storefront/index.js";import'../../ext/lodash/isArguments.js';import'../../ext/lodash/isBuffer.js';import'../../ext/lodash/isTypedArray.js';import'../../ext/lodash/_baseGetTag.js';import{formatMoney as C}from"../../utils/currency.js";import{useTranslation as N}from"../../utils/i18n.js";import{StockError as F}from"./components/error/stock-error/index.js";import b from"./components/svg/ikas.js";import P from'../../ext/react-tooltip/dist/index.es.js';import{FullscreenLoading as T}from"./components/fullscreen-loading/index.js";import S from"./components/notification-box/index.js";import{FormItem as M}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";var I=r((function(e){var t,r,n,a=e.checkout,l=e.checkoutSettings,u=e.merchantSettings,f=e.customizationProps,k=e.returnPolicy,y=e.privacyPolicy,x=e.termsOfService,C=N().t,S=i(),M=o.useState((function(){return new s(a,l,u,S,k,y,x,C)}))[0];return M.step===c.PAYMENT&&g.disableHTML(),o.useEffect((function(){M.checkoutSettings.isAccountRequired&&!M.checkout.hasCustomer&&S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),g.beginCheckout(M.checkout),g.pageView(d.CHECKOUT)}),[]),o.useEffect((function(){!function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(f)}),[f]),M.isCheckoutLoaded&&M.store.customerStore.initialized?M.checkout.hasCustomer&&(null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=M.checkout.customer)||void 0===r?void 0:r.id)?(S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(E,{pageType:d.CHECKOUT,pageTitle:((null===(n=M.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+C("checkout-page:securePayment"),pageDescription:C("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:h.CheckoutPage},o.createElement(P,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:h.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:h.Left},o.createElement("div",{className:h.LeftContent},o.createElement("div",null,o.createElement(B,{vm:M}),M.hasStockError&&o.createElement("div",{className:h.ErrorContainer},o.createElement(F,{vm:M,error:M.error})),!M.hasStockError&&o.createElement(o.Fragment,null,o.createElement("div",{className:h.MobileCartSummary},o.createElement(m,{vm:M,allowExpand:!0})),M.step===c.SUCCESS?o.createElement(p,{vm:M}):o.createElement(L,{vm:M})),o.createElement("div",{className:h.Space})),o.createElement(U,{vm:M}))),o.createElement("div",{className:h.Right},o.createElement("div",{className:h.RightContent},o.createElement(m,{vm:M}),o.createElement("div",{className:h.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===j.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(b,null))))),!!M.policyModalText&&o.createElement(v,{title:M.policyModalTitle,modalContent:M.policyModalText,onClose:function(){M.policyModalText=""}}),M.isContactModalVisible&&o.createElement(H,{vm:M,setVisible:M.setContactModalVisible}))):o.createElement(T,null)})),B=r((function(e){var t,r,i=e.vm,s=N().t;return o.createElement("div",{className:h.Header},o.createElement(k,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=i.merchantSettings)||void 0===t?void 0:t.logoId)?o.createElement("div",{className:h.Logo},o.createElement(f,{layout:"fill",image:i.merchantSettings.logo,sizes:"360px"})):(null===(r=i.merchantSettings)||void 0===r?void 0:r.merchantName)||"")),!i.checkout.hasCustomer&&o.createElement("div",{className:h.LoginText},o.createElement("span",{className:h.LoginCta},s("checkout-page:alreadyHaveAnAccount")),o.createElement(k,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:h.LoginBtn},s("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:h.CustomerInfo},o.createElement("div",{className:h.Name},i.checkout.customerFullName),o.createElement("div",{className:h.Email},i.checkout.customerEmail)))})),L=r((function(e){var t=e.vm,r=N().t,i=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(n,{vm:t});case c.SHIPPING:return o.createElement(a,{vm:t});case c.PAYMENT:return o.createElement(l,{vm:t});case c.SUCCESS:return o.createElement(p,{vm:t})}}),[t,t.step]),s=[new x(r("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:h.AdressStepInfo},o.createElement(O,{vm:t}),o.createElement("div",{className:h.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(O,{vm:t})):void 0),new x(r("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:h.AdressStepInfo},o.createElement(R,{vm:t}),t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:h.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(R,{vm:t})):void 0),new x(r("checkout-page:payment"),t.step===c.PAYMENT,!1)];return o.createElement(y,{steps:s,stepContent:i})})),O=r((function(e){var t,r,i,s,c,n=e.vm;return o.createElement("div",{className:h.Address},o.createElement("div",{className:[h.Text,h.WithMBottom].join(" ")},(null===(t=n.checkout.customer)||void 0===t?void 0:t.email)||""),o.createElement("div",{className:h.Text},((null===(r=n.checkout.customer)||void 0===r?void 0:r.firstName)||"")+" "+((null===(i=n.checkout.customer)||void 0===i?void 0:i.lastName)||"")),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(s=n.checkout.shippingAddress)||void 0===s?void 0:s.phone),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(c=n.checkout.shippingAddress)||void 0===c?void 0:c.addressText))})),R=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:h.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):C(t.checkout.shippingLines[0].price,t.checkout.cart.currencyCode)))):r("checkout-page:standartShipping"))})),U=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Footer},o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),H=r((function(r){var i,s,c=r.vm,n=r.setVisible,a=N().t,l=o.useState(!1),m=l[0],d=l[1],p=o.useState(!1),h=p[0],E=p[1],g=o.useState(new u({message:{requiredRule:"",emailRule:"",minRule:""},store:c.store}))[0];g.email=c.checkout.customerEmail,g.firstName=(null===(i=c.checkout.customer)||void 0===i?void 0:i.firstName)||"",g.lastName=(null===(s=c.checkout.customer)||void 0===s?void 0:s.lastName)||"";var f=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,n(!1)]:(d(!0),[4,g.saveContactForm()]);case 1:return e.sent()&&E(!0),d(!1),[2]}}))}))}),[m]);return o.createElement(v,{title:a("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(S,{type:"success",title:a("checkout-page:contactFormSent"),content:a("checkout-page:contactFormDescription")})),o.createElement(M,{type:A.TEXT_AREA,label:"",value:g.message||"",onChange:g.onMessageChange,textAreaPlaceholder:a("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:a(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:m,isDisabled:!g.message,onClick:f})),onClose:function(){return n(!1)}})}));export{I as default};
1
+ import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import s,{CheckoutStep as c}from"./model.js";import n from"./steps/step-info/index.js";import{CheckoutStepShipping as a}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as l}from"./steps/step-payment/index.js";import{CartSummary as m}from"./components/cart-summary/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"mobx";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as d}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import{ContactForm as u}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{StepSuccess as p}from"./steps/step-success/index.js";import{Modal as v}from"./components/modal/index.js";import h from"./style.module.scss.js";import{IkasPageHead as E}from"../page/head.js";import{Analytics as g}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{Image as f}from"../image/index.js";import y from"next/link.js";import k,{Step as x}from"./components/step-container/index.js";import{IkasStorefrontConfig as j}from"../../storefront/index.js";import'../../ext/lodash/isArguments.js';import'../../ext/lodash/isBuffer.js';import'../../ext/lodash/isTypedArray.js';import'../../ext/lodash/_baseGetTag.js';import{formatMoney as C}from"../../utils/currency.js";import{useTranslation as N}from"../../utils/i18n.js";import{StockError as F}from"./components/error/stock-error/index.js";import b from"./components/svg/ikas.js";import P from'../../ext/react-tooltip/dist/index.es.js';import{FullscreenLoading as T}from"./components/fullscreen-loading/index.js";import S from"./components/notification-box/index.js";import{FormItem as M}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";var I=r((function(e){var t,r,n,a=e.checkout,l=e.checkoutSettings,u=e.merchantSettings,f=e.customizationProps,y=e.returnPolicy,k=e.privacyPolicy,x=e.termsOfService,C=N().t,S=i(),M=o.useState((function(){return new s(a,l,u,S,y,k,x,C)}))[0];return M.step===c.PAYMENT&&g.disableHTML(),o.useEffect((function(){M.checkoutSettings.isAccountRequired&&!M.checkout.hasCustomer&&S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),g.beginCheckout(M.checkout),g.pageView(d.CHECKOUT)}),[]),o.useEffect((function(){!function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(f)}),[f]),M.isCheckoutLoaded&&M.store.customerStore.initialized?M.checkout.hasCustomer&&(null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=M.checkout.customer)||void 0===r?void 0:r.id)?(S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(E,{pageType:d.CHECKOUT,pageTitle:((null===(n=M.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+C("checkout-page:securePayment"),pageDescription:C("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:h.CheckoutPage},o.createElement(P,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:h.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:h.Left},o.createElement("div",{className:h.LeftContent},o.createElement("div",null,o.createElement(B,{vm:M}),M.hasStockError&&o.createElement("div",{className:h.ErrorContainer},o.createElement(F,{vm:M,error:M.error})),!M.hasStockError&&o.createElement(o.Fragment,null,o.createElement("div",{className:h.MobileCartSummary},o.createElement(m,{vm:M,allowExpand:!0})),M.step===c.SUCCESS?o.createElement(p,{vm:M}):o.createElement(L,{vm:M})),o.createElement("div",{className:h.Space})),o.createElement(U,{vm:M}))),o.createElement("div",{className:h.Right},o.createElement("div",{className:h.RightContent},o.createElement(m,{vm:M}),o.createElement("div",{className:h.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===j.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(b,null))))),!!M.policyModalText&&o.createElement(v,{title:M.policyModalTitle,modalContent:M.policyModalText,onClose:function(){M.policyModalText=""}}),M.isContactModalVisible&&o.createElement(H,{vm:M,setVisible:M.setContactModalVisible}))):o.createElement(T,null)})),B=r((function(e){var t,r,i=e.vm,s=N().t;return o.createElement("div",{className:h.Header},o.createElement(y,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=i.merchantSettings)||void 0===t?void 0:t.logoId)?o.createElement("div",{className:h.Logo},o.createElement(f,{layout:"fill",image:i.merchantSettings.logo,sizes:"360px"})):(null===(r=i.merchantSettings)||void 0===r?void 0:r.merchantName)||"")),!i.checkout.hasCustomer&&o.createElement("div",{className:h.LoginText},o.createElement("span",{className:h.LoginCta},s("checkout-page:alreadyHaveAnAccount")),o.createElement(y,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:h.LoginBtn},s("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:h.CustomerInfo},o.createElement("div",{className:h.Name},i.checkout.customerFullName),o.createElement("div",{className:h.Email},i.checkout.customerEmail)))})),L=r((function(e){var t=e.vm,r=N().t,i=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(n,{vm:t});case c.SHIPPING:return o.createElement(a,{vm:t});case c.PAYMENT:return o.createElement(l,{vm:t});case c.SUCCESS:return o.createElement(p,{vm:t})}}),[t,t.step]),s=[new x(r("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:h.AdressStepInfo},o.createElement(O,{vm:t}),o.createElement("div",{className:h.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(O,{vm:t})):void 0),new x(r("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:h.AdressStepInfo},o.createElement(R,{vm:t}),t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:h.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(R,{vm:t})):void 0),new x(r("checkout-page:payment"),t.step===c.PAYMENT,!1)];return o.createElement(k,{steps:s,stepContent:i})})),O=r((function(e){var t,r,i,s,c,n=e.vm;return o.createElement("div",{className:h.Address},o.createElement("div",{className:[h.Text,h.WithMBottom].join(" ")},(null===(t=n.checkout.customer)||void 0===t?void 0:t.email)||""),o.createElement("div",{className:h.Text},((null===(r=n.checkout.customer)||void 0===r?void 0:r.firstName)||"")+" "+((null===(i=n.checkout.customer)||void 0===i?void 0:i.lastName)||"")),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(s=n.checkout.shippingAddress)||void 0===s?void 0:s.phone),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(c=n.checkout.shippingAddress)||void 0===c?void 0:c.addressText))})),R=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:h.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):C(t.checkout.shippingLines[0].price,t.checkout.cart.currencyCode)))):r("checkout-page:standartShipping"))})),U=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Footer},o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),H=r((function(r){var i,s,c=r.vm,n=r.setVisible,a=N().t,l=o.useState(!1),m=l[0],d=l[1],p=o.useState(!1),h=p[0],E=p[1],g=o.useState(new u({message:{requiredRule:"",emailRule:"",minRule:""},store:c.store}))[0];g.email=c.checkout.customerEmail,g.firstName=(null===(i=c.checkout.customer)||void 0===i?void 0:i.firstName)||"",g.lastName=(null===(s=c.checkout.customer)||void 0===s?void 0:s.lastName)||"";var f=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,n(!1)]:(d(!0),[4,g.saveContactForm()]);case 1:return e.sent()&&E(!0),d(!1),[2]}}))}))}),[m]);return o.createElement(v,{title:a("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(S,{type:"success",title:a("checkout-page:contactFormSent"),content:a("checkout-page:contactFormDescription")})),o.createElement(M,{type:A.TEXT_AREA,label:"",value:g.message||"",onChange:g.onMessageChange,textAreaPlaceholder:a("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:a(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:m,isDisabled:!g.message,onClick:f})),onClose:function(){return n(!1)}})}));export{I as default};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as i}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from'../../ext/lodash/cloneDeep.js';import r from'../../ext/lodash/sortBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import{IkasCheckout as o,IkasCheckoutCustomer as a}from"../../models/data/checkout/index.js";import{IkasCustomerAddress as c}from"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import{IkasTransactionStatusEnum as d}from"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasOrderAddress as u}from"../../models/data/order/address/index.js";import{IkasPaymentMethodType as h,IkasPaymentGatewayType as l}from"../../models/data/payment-gateway/index.js";import"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import{IkasCheckoutAPI as p}from"../../api/checkout/index.js";import"../../api/city/index.js";import{IkasCountryAPI as m}from"../../api/country/index.js";import{IkasCustomerAPI as f}from"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/district/index.js";import"../../api/html-meta-data/index.js";import{IkasMerchantAPI as g}from"../../api/merchant/index.js";import"../../api/product-search/index.js";import"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import"../../api/product-option-set/index.js";import"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import"../../api/product-campaign/index.js";import v from"./components/credit-card-form/model.js";import{IkasStorefrontConfig as k}from"../../storefront/index.js";import{IkasCheckoutSettings as S}from"../../models/data/checkout-settings/index.js";import{Analytics as y}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import C from'../../ext/uuid/dist/esm-browser/v4.js';var b,I,P=/^\d+$/,A="undefined"==typeof localStorage,j=function(){function P(P,j,N,x,E,O,T,D){var G=this;this.checkout=new o,this.checkoutSettings=new S,this.storefront=null,this.store=k.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=b.INFO,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!1,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.policyModalTitle="",this.policyModalText="",this.error=null,this.init=function(){return t(G,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.store.customerStore.waitUntilInitialized()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getMerchantSettings()];case 2:return t.sent(),[4,this.initStep()];case 3:return t.sent(),[2]}}))}))},this.initStep=function(){return t(G,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(k.isEditor)return this.step=b.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===b.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(b.INFO)];if(this.step===b.PAYMENT&&!this.canProceedToPayment)return[2,this.changeStep(b.INFO)];if(![b.INFO,b.SUCCESS,b.SHIPPING,b.PAYMENT].includes(this.step))return[2,this.changeStep(b.INFO)]}return s&&(this.error={type:I.PAYMENT_ERROR,data:n||null}),this.step!==b.INFO?[3,2]:[4,this.getShippingCountries()];case 1:e.sent(),this.checkShippingCountries(),e.label=2;case 2:return this.step!==b.SHIPPING||1!==this.checkout.availableShippingMethods.length||this.checkoutSettings.isGiftPackageEnabled||(this.step=b.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==b.SHIPPING||this.checkout.availableShippingMethods.length?this.step!==b.PAYMENT&&this.step!==b.SUCCESS?[3,4]:[4,this.listPaymentGateways()]:(this.error={type:I.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 3:if(e.sent(),!this.paymentGateways.length)return this.error={type:I.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=4;case 4:return this.step===b.SUCCESS?[3,8]:this.checkout.isComplete?[2,this.changeStep(b.SUCCESS)]:[3,5];case 5:return[4,this.initialStockCheck()];case 6:e.sent(),e.label=7;case 7:return[3,11];case 8:return r=this,[4,p.getOrder(this.checkout.orderId)];case 9:return r.order=e.sent(),[4,f.getOrderTransactions({orderId:this.checkout.orderId})];case 10:o=e.sent(),this.successTransaction=o.length?o[0]:void 0,this.successTransaction&&(a=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===a}))),e.label=11;case 11:return this.isCheckoutLoaded=!0,y.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getMerchantSettings=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.merchantSettings?[3,2]:(t=this,[4,g.listMerchantSettings()]);case 1:t.merchantSettings=e.sent(),e.label=2;case 2:return[2]}}))}))},this.saveCheckout=function(){return t(G,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:return[4,p.saveCheckout(this.checkout)];case 1:if((null==(t=e.sent())?void 0:t.errors)&&t.errors.length)throw i=t.errors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(s=i.extensions)||void 0===s?void 0:s.code)?{type:I.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:I.API_ERROR};return[2]}}))}))},this.checkStocks=function(){return t(G,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,h;return e(this,(function(e){switch(e.label){case 0:return t=this.cart.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,p.checkStocks(t,k.stockLocationIds||[])];case 1:if(!(i=e.sent()))throw{type:I.API_ERROR};if(null==(s=null===(u=i.lines)||void 0===u?void 0:u.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(h=o.store.cartStore.cart)||void 0===h?void 0:h.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:I.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(G,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,this.store.cartStore.removeItem(n)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,m.listShippingCountries(k.salesChannelId)];case 1:return t.shippingCountryIds=e.sent(),[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=G.shippingCountryIds)||void 0===t?void 0:t.length)||(G.error={type:I.NO_SHIPPING_ERROR})},this.initialStockCheck=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:I.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(G,void 0,void 0,(function(){var t,i,s,n,o,a,c=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=k.paymentGateways.map((function(t){return t.id})),[4,p.listPaymentGateway(t?void 0:i)];case 1:return(s=e.sent())&&s.length?(this.step===b.PAYMENT&&(s=s.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(c.checkout.cart.currencyCode)})),(n=null===(a=this.checkout.shippingAddress)||void 0===a?void 0:a.country)&&n.iso2&&(s=s.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(n.iso2||"")})))),o=[],r(k.paymentGateways,"order").forEach((function(t){var e=null==s?void 0:s.find((function(e){return e.id===t.id}));e&&o.push(e)})),this.paymentGateways=t?s:o,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),[2]):(this.error={type:I.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p.retrieveInstallmentInfo(i)];case 1:return null==(t=e.sent())||t.installmentPrices.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=t,[2]}}))}))},this.createCustomer=function(){G.store.customerStore.customer?(G.store.customerStore.customer.addresses.forEach((function(t){return t.checkoutSettings=G.checkoutSettings})),G.checkout.customer=new a(G.store.customerStore.customer)):G.checkout.customer||(G.checkout.customer=new a({}))},this.createShippingAddress=function(){var t;if(G.checkout.shippingAddress)G.selectedShippingAddressId=G.checkout.shippingAddress.id||"-1",G.checkout.shippingAddress.checkoutSettings=G.checkoutSettings;else{var e=null===(t=G.store.customerStore.customer)||void 0===t?void 0:t.addresses;G.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(G.useDifferentAddress=!!localStorage.getItem("sAddr"),G.useDifferentAddress?(G.checkout.billingAddress&&(G.selectedBillingAddressId=G.checkout.billingAddress.id||"-1"),G.checkout.billingAddress=G.checkout.billingAddress||new u):G.checkout.billingAddress=new u(n(G.checkout.shippingAddress)||{}),G.checkout.billingAddress.checkoutSettings=G.checkoutSettings)},this.onShippingMethodChange=function(i){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCheckout()]);case 1:return e.sent(),[4,p.getCheckoutById(this.checkout.id)];case 2:return(t=e.sent())&&(this.checkout=t),this.isChangingShippingMethod=!1,[2]}}))}))},this.onCouponCodeApply=function(){return t(G,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:if(!this.checkout.couponCode)return[2];e.label=1;case 1:return e.trys.push([1,5,,6]),[4,p.addCouponCodeToCheckout(this.checkout.id,this.checkout.couponCode)];case 2:return e.sent()?[4,p.getCheckoutById(this.checkout.id)]:[3,4];case 3:(t=e.sent())&&(s=this.checkout,this.checkout=new o(i(i({},t),{shippingAddress:s.shippingAddress,billingAddress:s.billingAddress,customer:s.customer,selectedPaymentGateway:s.selectedPaymentGateway}))),e.label=4;case 4:return[3,6];case 5:return e.sent(),[3,6];case 6:return[2]}}))}))},this.onCouponCodeDelete=function(){return t(G,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,this.saveCheckout()];case 1:return e.sent(),[4,p.getCheckoutById(this.checkout.id)];case 2:return(t=e.sent())&&(s=this.checkout,this.checkout=new o(i(i({},t),{shippingAddress:s.shippingAddress,billingAddress:s.billingAddress,customer:s.customer,selectedPaymentGateway:s.selectedPaymentGateway}))),[3,4];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e;if(G.selectedShippingAddressId=t,"-1"===t)G.checkout.shippingAddress=new u;else{var i=null===(e=G.store.customerStore.customer)||void 0===e?void 0:e.addresses.find((function(e){return e.id===t}));i&&(G.checkout.shippingAddress=new u(i))}G.checkout.shippingAddress&&(G.checkout.shippingAddress.checkoutSettings=G.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e;if(G.selectedBillingAddressId=t,"-1"===t)G.checkout.billingAddress=new u;else{var i=null===(e=G.store.customerStore.customer)||void 0===e?void 0:e.addresses.find((function(e){return e.id===t}));i&&(G.checkout.billingAddress=new u(i))}G.checkout.billingAddress&&(G.checkout.billingAddress.checkoutSettings=G.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){G.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(G.cardData&&(!(t.length>G.cardData.cardNumber.length)||R(t))){var e=(G.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!G.installmentInfo?G.retrieveInstallmentInfo({binNumber:i.slice(0,6),paymentGatewayId:G.checkout.selectedPaymentGateway.id,price:G.checkout.totalFinalPrice}):i.length<6&&e.length>i.length&&(G.cardData.installmentCount=1,G.installmentInfo=void 0),G.cardData.cardNumber=w(i,4).join(" "))}},this.onCardHolderNameChange=function(t){G.cardData&&(G.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(G.cardData&&(!(t.length>G.cardData.expirationDate.length)||R(t))){if(0===(null===(e=G.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(G.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(G.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(G.cardData.expirationDate=w(a,2).join(" / "))}},this.onCvcChange=function(t){G.cardData&&(t.length>G.cardData.cvv.length&&!R(t)||t.length>4||(G.cardData.cvv=t))},this.saveAddress=function(s){return t(G,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.shouldSaveAddress?(t=new c(i(i({},"shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress),{title:this.addressTitle||this.t("checkout-page:newAddress"),id:C()})),(r=n(this.store.customerStore.customer)).addresses.push(t),[4,this.store.customerStore.saveCustomer(r)]):[3,2];case 1:e.sent(),"shipping"===s?(this.checkout.shippingAddress.id=t.id,this.selectedShippingAddressId=t.id||"-1"):(this.checkout.billingAddress.id=t.id,this.selectedBillingAddressId=t.id||"-1"),e.label=2;case 2:return[2]}}))}))},this.onGoToCartClick=function(){G.router.push("/cart")},this.onBackToShoppingClick=function(){G.router.push("/")},this.onProceedToShippingClick=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,5,,6]),this.isStepLoading=!0,[4,this.saveAddress("shipping")];case 2:return e.sent(),[4,this.checkStocks()];case 3:return e.sent(),[4,this.saveCheckout()];case 4:return e.sent(),this.changeStep(b.SHIPPING),[3,6];case 5:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:I.UNKNOWN}),this.isStepLoading=!1,[3,6];case 6:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCheckout()];case 3:return e.sent(),this.error=void 0,this.changeStep(b.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:I.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canPerformPayment)return this.isErrorsVisible=!0,[2];this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),e.label=1;case 1:return e.trys.push([1,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveAddress("billing")];case 3:return e.sent(),[4,this.saveCheckout()];case 4:return e.sent(),[4,this.createSaleTransaction()];case 5:return e.sent(),[3,7];case 6:return(t=e.sent()).type?this.error=t:this.error={type:I.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return t(G,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?[4,p.createSaleTransactionWithCheckout(this.checkout.id,this.checkout.selectedPaymentGateway.id,this.checkout.selectedPaymentGateway.paymentMethodType===h.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0)]:[2];case 1:return t=e.sent(),i=null==t?void 0:t.transactionStatus,s=i&&[d.SUCCESS,d.AUTHORIZED].includes(i),n=i===d.PENDING,s?[4,this.onCheckoutTransactionSuccess()]:[3,3];case 2:return e.sent(),[3,4];case 3:if(!n||!(null==t?void 0:t.returnSlug))throw{type:I.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+t.returnSlug,e.label=4;case 4:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(G,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(b.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){G.changeStep(b.INFO)},this.onBackToShippingClick=function(){G.changeStep(b.SHIPPING)},this.setCustomerConsentGranted=function(t){G.checkout.customer&&(G.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){G.useDifferentAddress=t,G.useDifferentAddress?(localStorage.setItem("sAddr","1"),G.checkout.billingAddress=G.checkout.billingAddress||new u):(localStorage.removeItem("sAddr"),G.checkout.billingAddress=G.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){G.shouldSaveAddress=t},this.setAddressTitle=function(t){G.addressTitle=t},this.setPaymentGateway=function(t){if(G.paymentGateways.length){var e=G.paymentGateways[t];G.checkout.selectedPaymentGateway=e,G.step!==b.SUCCESS&&(e.paymentMethodType===h.CREDIT_CARD&&e.type===l.INTERNAL&&(G.cardData=new v),G.installmentInfo=void 0)}},this.setInstallmentCount=function(t){G.cardData&&(G.cardData.installmentCount=t)},this.changeStep=function(i){return t(G,void 0,void 0,(function(){return e(this,(function(t){return A||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(G,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=void 0,this.store.customerStore.logout(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCheckout()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){G.isContactModalVisible=t},this.checkout=P,this.checkoutSettings=j,this.router=x,this.returnPolicy=E,this.privacyPolicy=O,this.termsOfService=T,this.t=D,N&&(this.merchantSettings=N),this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked,this.store.cartStore.cart=this.checkout.cart,this.init(),s(this)}return Object.defineProperty(P.prototype,"cart",{get:function(){return this.checkout.cart},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"selectedInstallmentIndex",{get:function(){var t,e=this;return(null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices.findIndex((function(t){var i;return t.installmentCount===(null===(i=e.cardData)||void 0===i?void 0:i.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"customerAddressOptions",{get:function(){var t,e={label:this.t("checkout-page:newAddress"),value:"-1"},i=(null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses.map((function(t){return{label:t.title+" - "+t.addressText,value:t.id}})))||[];return[e].concat(i)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"installmentPrice",{get:function(){var t,e,i=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(e=this.installmentInfo.installmentPrices.find((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===e?void 0:e.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"finalPrice",{get:function(){return this.step===b.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===I.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"canProceedToShipping",{get:function(){var t,e;return(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValid)&&this.checkout.hasValidCustomer&&(null===(e=this.error)||void 0===e?void 0:e.type)!==I.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway;return this.canProceedToShipping&&!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid)&&((null==i?void 0:i.paymentMethodType)===h.CREDIT_CARD&&i.type===l.INTERNAL?null===(e=this.cardData)||void 0===e?void 0:e.isValid:!!i)},enumerable:!1,configurable:!0}),P}();function w(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function R(t){return t&&P.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(b||(b={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.API_ERROR=1]="API_ERROR",t[t.STOCK_ERROR=2]="STOCK_ERROR",t[t.PAYMENT_ERROR=3]="PAYMENT_ERROR",t[t.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",t[t.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR"}(I||(I={}));export{b as CheckoutStep,I as ErrorType,j as default};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from'../../ext/lodash/cloneDeep.js';import r from'../../ext/lodash/sortBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import{IkasCheckout as o,IkasCheckoutCustomer as a}from"../../models/data/checkout/index.js";import{IkasCustomerAddress as c}from"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import{IkasTransactionStatusEnum as d}from"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasOrderAddress as u}from"../../models/data/order/address/index.js";import{IkasPaymentMethodType as h,IkasPaymentGatewayType as l}from"../../models/data/payment-gateway/index.js";import"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import{IkasCheckoutAPI as p}from"../../api/checkout/index.js";import"../../api/city/index.js";import{IkasCountryAPI as m}from"../../api/country/index.js";import{IkasCustomerAPI as f}from"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/customer-review-summary/index.js";import"../../api/district/index.js";import"../../api/html-meta-data/index.js";import{IkasMerchantAPI as g}from"../../api/merchant/index.js";import"../../api/product-search/index.js";import"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import"../../api/product-option-set/index.js";import"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import"../../api/product-campaign/index.js";import v from"./components/credit-card-form/model.js";import{IkasStorefrontConfig as k}from"../../storefront/index.js";import{IkasCheckoutSettings as S}from"../../models/data/checkout-settings/index.js";import{Analytics as y}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import C from'../../ext/uuid/dist/esm-browser/v4.js';var b,I,P=/^\d+$/,A="undefined"==typeof localStorage,j=function(){function P(P,j,N,x,E,O,T,D){var G=this;this.checkout=new o,this.checkoutSettings=new S,this.storefront=null,this.store=k.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=b.INFO,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!1,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.policyModalTitle="",this.policyModalText="",this.error=null,this.init=function(){return t(G,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.store.customerStore.waitUntilInitialized()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getMerchantSettings()];case 2:return t.sent(),[4,this.initStep()];case 3:return t.sent(),[2]}}))}))},this.initStep=function(){return t(G,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(k.isEditor)return this.step=b.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===b.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(b.INFO)];if(this.step===b.PAYMENT&&!this.canProceedToPayment)return[2,this.changeStep(b.INFO)];if(![b.INFO,b.SUCCESS,b.SHIPPING,b.PAYMENT].includes(this.step))return[2,this.changeStep(b.INFO)]}return s&&(this.error={type:I.PAYMENT_ERROR,data:n||null}),this.step!==b.INFO?[3,2]:[4,this.getShippingCountries()];case 1:e.sent(),this.checkShippingCountries(),e.label=2;case 2:return this.step!==b.SHIPPING||1!==this.checkout.availableShippingMethods.length||this.checkoutSettings.isGiftPackageEnabled||(this.step=b.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==b.SHIPPING||this.checkout.availableShippingMethods.length?this.step!==b.PAYMENT&&this.step!==b.SUCCESS?[3,4]:[4,this.listPaymentGateways()]:(this.error={type:I.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 3:if(e.sent(),!this.paymentGateways.length)return this.error={type:I.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=4;case 4:return this.step===b.SUCCESS?[3,8]:this.checkout.isComplete?[2,this.changeStep(b.SUCCESS)]:[3,5];case 5:return[4,this.initialStockCheck()];case 6:e.sent(),e.label=7;case 7:return[3,11];case 8:return r=this,[4,p.getOrder(this.checkout.orderId)];case 9:return r.order=e.sent(),[4,f.getOrderTransactions({orderId:this.checkout.orderId})];case 10:o=e.sent(),this.successTransaction=o.length?o[0]:void 0,this.successTransaction&&(a=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===a}))),e.label=11;case 11:return this.isCheckoutLoaded=!0,y.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getMerchantSettings=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.merchantSettings?[3,2]:(t=this,[4,g.listMerchantSettings()]);case 1:t.merchantSettings=e.sent(),e.label=2;case 2:return[2]}}))}))},this.saveCheckout=function(){return t(G,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:return[4,p.saveCheckout(this.checkout)];case 1:if((null==(t=e.sent())?void 0:t.errors)&&t.errors.length)throw i=t.errors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(s=i.extensions)||void 0===s?void 0:s.code)?{type:I.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:I.API_ERROR};return[2]}}))}))},this.checkStocks=function(){return t(G,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,h;return e(this,(function(e){switch(e.label){case 0:return t=this.cart.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,p.checkStocks(t,k.stockLocationIds||[])];case 1:if(!(i=e.sent()))throw{type:I.API_ERROR};if(null==(s=null===(u=i.lines)||void 0===u?void 0:u.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(h=o.store.cartStore.cart)||void 0===h?void 0:h.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:I.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(G,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,this.store.cartStore.removeItem(n)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,m.listShippingCountries(k.salesChannelId)];case 1:return t.shippingCountryIds=e.sent(),[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=G.shippingCountryIds)||void 0===t?void 0:t.length)||(G.error={type:I.NO_SHIPPING_ERROR})},this.initialStockCheck=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:I.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(G,void 0,void 0,(function(){var t,i,s,n,o,a,c=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=k.paymentGateways.map((function(t){return t.id})),[4,p.listPaymentGateway(t?void 0:i)];case 1:return(s=e.sent())&&s.length?(this.step===b.PAYMENT&&(s=s.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(c.checkout.cart.currencyCode)})),(n=null===(a=this.checkout.shippingAddress)||void 0===a?void 0:a.country)&&n.iso2&&(s=s.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(n.iso2||"")})))),o=[],r(k.paymentGateways,"order").forEach((function(t){var e=null==s?void 0:s.find((function(e){return e.id===t.id}));e&&o.push(e)})),this.paymentGateways=t?s:o,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),[2]):(this.error={type:I.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p.retrieveInstallmentInfo(i)];case 1:return null==(t=e.sent())||t.installmentPrices.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=t,[2]}}))}))},this.createCustomer=function(){G.store.customerStore.customer?(G.store.customerStore.customer.addresses.forEach((function(t){return t.checkoutSettings=G.checkoutSettings})),G.checkout.customer=new a(G.store.customerStore.customer)):G.checkout.customer||(G.checkout.customer=new a({}))},this.createShippingAddress=function(){var t;if(G.checkout.shippingAddress)G.selectedShippingAddressId=G.checkout.shippingAddress.id||"-1",G.checkout.shippingAddress.checkoutSettings=G.checkoutSettings;else{var e=null===(t=G.store.customerStore.customer)||void 0===t?void 0:t.addresses;G.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(G.useDifferentAddress=!!localStorage.getItem("sAddr"),G.useDifferentAddress?(G.checkout.billingAddress&&(G.selectedBillingAddressId=G.checkout.billingAddress.id||"-1"),G.checkout.billingAddress=G.checkout.billingAddress||new u):G.checkout.billingAddress=new u(n(G.checkout.shippingAddress)||{}),G.checkout.billingAddress.checkoutSettings=G.checkoutSettings)},this.onShippingMethodChange=function(i){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCheckout()]);case 1:return e.sent(),[4,p.getCheckoutById(this.checkout.id)];case 2:return(t=e.sent())&&(this.checkout=t),this.isChangingShippingMethod=!1,[2]}}))}))},this.onCouponCodeApply=function(){return t(G,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:if(!this.checkout.couponCode)return[2];e.label=1;case 1:return e.trys.push([1,5,,6]),[4,p.addCouponCodeToCheckout(this.checkout.id,this.checkout.couponCode)];case 2:return e.sent()?[4,p.getCheckoutById(this.checkout.id)]:[3,4];case 3:(t=e.sent())&&(s=this.checkout,this.checkout=new o(i(i({},t),{shippingAddress:s.shippingAddress,billingAddress:s.billingAddress,customer:s.customer,selectedPaymentGateway:s.selectedPaymentGateway}))),e.label=4;case 4:return[3,6];case 5:return e.sent(),[3,6];case 6:return[2]}}))}))},this.onCouponCodeDelete=function(){return t(G,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,this.saveCheckout()];case 1:return e.sent(),[4,p.getCheckoutById(this.checkout.id)];case 2:return(t=e.sent())&&(s=this.checkout,this.checkout=new o(i(i({},t),{shippingAddress:s.shippingAddress,billingAddress:s.billingAddress,customer:s.customer,selectedPaymentGateway:s.selectedPaymentGateway}))),[3,4];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e;if(G.selectedShippingAddressId=t,"-1"===t)G.checkout.shippingAddress=new u;else{var i=null===(e=G.store.customerStore.customer)||void 0===e?void 0:e.addresses.find((function(e){return e.id===t}));i&&(G.checkout.shippingAddress=new u(i))}G.checkout.shippingAddress&&(G.checkout.shippingAddress.checkoutSettings=G.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e;if(G.selectedBillingAddressId=t,"-1"===t)G.checkout.billingAddress=new u;else{var i=null===(e=G.store.customerStore.customer)||void 0===e?void 0:e.addresses.find((function(e){return e.id===t}));i&&(G.checkout.billingAddress=new u(i))}G.checkout.billingAddress&&(G.checkout.billingAddress.checkoutSettings=G.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){G.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(G.cardData&&(!(t.length>G.cardData.cardNumber.length)||R(t))){var e=(G.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!G.installmentInfo?G.retrieveInstallmentInfo({binNumber:i.slice(0,6),paymentGatewayId:G.checkout.selectedPaymentGateway.id,price:G.checkout.totalFinalPrice}):i.length<6&&e.length>i.length&&(G.cardData.installmentCount=1,G.installmentInfo=void 0),G.cardData.cardNumber=w(i,4).join(" "))}},this.onCardHolderNameChange=function(t){G.cardData&&(G.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(G.cardData&&(!(t.length>G.cardData.expirationDate.length)||R(t))){if(0===(null===(e=G.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(G.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(G.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(G.cardData.expirationDate=w(a,2).join(" / "))}},this.onCvcChange=function(t){G.cardData&&(t.length>G.cardData.cvv.length&&!R(t)||t.length>4||(G.cardData.cvv=t))},this.saveAddress=function(s){return t(G,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.shouldSaveAddress?(t=new c(i(i({},"shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress),{title:this.addressTitle||this.t("checkout-page:newAddress"),id:C()})),(r=n(this.store.customerStore.customer)).addresses.push(t),[4,this.store.customerStore.saveCustomer(r)]):[3,2];case 1:e.sent(),"shipping"===s?(this.checkout.shippingAddress.id=t.id,this.selectedShippingAddressId=t.id||"-1"):(this.checkout.billingAddress.id=t.id,this.selectedBillingAddressId=t.id||"-1"),e.label=2;case 2:return[2]}}))}))},this.onGoToCartClick=function(){G.router.push("/cart")},this.onBackToShoppingClick=function(){G.router.push("/")},this.onProceedToShippingClick=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,5,,6]),this.isStepLoading=!0,[4,this.saveAddress("shipping")];case 2:return e.sent(),[4,this.checkStocks()];case 3:return e.sent(),[4,this.saveCheckout()];case 4:return e.sent(),this.changeStep(b.SHIPPING),[3,6];case 5:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:I.UNKNOWN}),this.isStepLoading=!1,[3,6];case 6:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCheckout()];case 3:return e.sent(),this.error=void 0,this.changeStep(b.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:I.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(G,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canPerformPayment)return this.isErrorsVisible=!0,[2];this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),e.label=1;case 1:return e.trys.push([1,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveAddress("billing")];case 3:return e.sent(),[4,this.saveCheckout()];case 4:return e.sent(),[4,this.createSaleTransaction()];case 5:return e.sent(),[3,7];case 6:return(t=e.sent()).type?this.error=t:this.error={type:I.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return t(G,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?[4,p.createSaleTransactionWithCheckout(this.checkout.id,this.checkout.selectedPaymentGateway.id,this.checkout.selectedPaymentGateway.paymentMethodType===h.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0)]:[2];case 1:return t=e.sent(),i=null==t?void 0:t.transactionStatus,s=i&&[d.SUCCESS,d.AUTHORIZED].includes(i),n=i===d.PENDING,s?[4,this.onCheckoutTransactionSuccess()]:[3,3];case 2:return e.sent(),[3,4];case 3:if(!n||!(null==t?void 0:t.returnSlug))throw{type:I.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+t.returnSlug,e.label=4;case 4:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(G,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(b.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){G.changeStep(b.INFO)},this.onBackToShippingClick=function(){G.changeStep(b.SHIPPING)},this.setCustomerConsentGranted=function(t){G.checkout.customer&&(G.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){G.useDifferentAddress=t,G.useDifferentAddress?(localStorage.setItem("sAddr","1"),G.checkout.billingAddress=G.checkout.billingAddress||new u):(localStorage.removeItem("sAddr"),G.checkout.billingAddress=G.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){G.shouldSaveAddress=t},this.setAddressTitle=function(t){G.addressTitle=t},this.setPaymentGateway=function(t){if(G.paymentGateways.length){var e=G.paymentGateways[t];G.checkout.selectedPaymentGateway=e,G.step!==b.SUCCESS&&(e.paymentMethodType===h.CREDIT_CARD&&e.type===l.INTERNAL&&(G.cardData=new v),G.installmentInfo=void 0)}},this.setInstallmentCount=function(t){G.cardData&&(G.cardData.installmentCount=t)},this.changeStep=function(i){return t(G,void 0,void 0,(function(){return e(this,(function(t){return A||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(G,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=void 0,this.store.customerStore.logout(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCheckout()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){G.isContactModalVisible=t},this.checkout=P,this.checkoutSettings=j,this.router=x,this.returnPolicy=E,this.privacyPolicy=O,this.termsOfService=T,this.t=D,N&&(this.merchantSettings=N),this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked,this.store.cartStore.cart=this.checkout.cart,this.init(),s(this)}return Object.defineProperty(P.prototype,"cart",{get:function(){return this.checkout.cart},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"selectedInstallmentIndex",{get:function(){var t,e=this;return(null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices.findIndex((function(t){var i;return t.installmentCount===(null===(i=e.cardData)||void 0===i?void 0:i.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"customerAddressOptions",{get:function(){var t,e={label:this.t("checkout-page:newAddress"),value:"-1"},i=(null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses.map((function(t){return{label:t.title+" - "+t.addressText,value:t.id}})))||[];return[e].concat(i)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"installmentPrice",{get:function(){var t,e,i=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(e=this.installmentInfo.installmentPrices.find((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===e?void 0:e.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"finalPrice",{get:function(){return this.step===b.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===I.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"canProceedToShipping",{get:function(){var t,e;return(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValid)&&this.checkout.hasValidCustomer&&(null===(e=this.error)||void 0===e?void 0:e.type)!==I.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway;return this.canProceedToShipping&&!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid)&&((null==i?void 0:i.paymentMethodType)===h.CREDIT_CARD&&i.type===l.INTERNAL?null===(e=this.cardData)||void 0===e?void 0:e.isValid:!!i)},enumerable:!1,configurable:!0}),P}();function w(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function R(t){return t&&P.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(b||(b={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.API_ERROR=1]="API_ERROR",t[t.STOCK_ERROR=2]="STOCK_ERROR",t[t.PAYMENT_ERROR=3]="PAYMENT_ERROR",t[t.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",t[t.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR"}(I||(I={}));export{b as CheckoutStep,I as ErrorType,j as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as a,CHECKOUT_LS_KEY as s}from"../../../../store/cart.js";import r from"./style.module.scss.js";import{Analytics as i}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import n from"../../components/svg/success-circle.js";import l from"../../components/expandable-section/index.js";import{IkasTransactionCardAssociationEnum as c}from"../../../../models/data/order-transaction/index.js";import d from"../../components/credit-card-form/svg/amex.js";import m from"../../components/credit-card-form/svg/master-card.js";import u from"../../components/credit-card-form/svg/troy.js";import p from"../../components/credit-card-form/svg/visa.js";import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{formatMoney as E}from"../../../../utils/currency.js";import{useTranslation as v}from"../../../../utils/i18n.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/installment-info/index.js";import{IkasOrderPackageStatus as f}from"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"mobx";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import{IkasPaymentMethodType as g,IkasPaymentGatewayType as x}from"../../../../models/data/payment-gateway/index.js";var h=t((function(t){var f,h,k,T,I=t.vm,N=v().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(a),t=localStorage.getItem(s);e&&e===I.checkout.cartId&&localStorage.removeItem(a),t&&t===I.checkout.id&&localStorage.removeItem(s)}I.successTransaction&&i.purchase(I.checkout,I.successTransaction)}),[]);var y=((null===(f=I.checkout.customer)||void 0===f?void 0:f.firstName)||"")+" "+((null===(h=I.checkout.customer)||void 0===h?void 0:h.lastName)||""),L=I.paymentGateways.find((function(e){var t;return e.id===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),A=null===(k=I.successTransaction)||void 0===k?void 0:k.paymentMethodDetail,S=e.useMemo((function(){var t,o,a,s;return e.createElement("div",{className:[r.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:paymentMethod")),L&&e.createElement(e.Fragment,null,!!L.logoUrl&&e.createElement("div",{className:r.PaymentLogoContainer},e.createElement("img",{src:L.logoUrl})),!L.logoUrl&&e.createElement("div",{className:r.InfoText},L.paymentMethodType===g.CREDIT_CARD&&L.type===x.INTERNAL?N("checkout-page:creditCard"):L.name),!!L.description&&L.type!==x.EXTERNAL&&e.createElement("div",{className:r.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:L.description}}))),"CREDIT_CARD"===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:r.InfoText},e.createElement("div",{className:r.CardLogoContainer},function(){var t,o;switch(null===(o=null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation){case c.AMERICAN_EXPRESS:return e.createElement(d,null);case c.MASTER_CARD:return e.createElement(m,null);case c.TROY:return e.createElement(u,null);case c.VISA:return e.createElement(p,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==A?void 0:A.lastFourDigits)||""))),(null===(o=null==A?void 0:A.installment)||void 0===o?void 0:o.installmentCount)&&A.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:r.InfoText},"".concat(A.installment.installmentCount," ").concat(N("checkout-page:installments"))),null!==A.installment.installmentPrice&&e.createElement("div",{className:r.InfoText},"".concat(A.installment.installmentCount," x ").concat(E(A.installment.installmentPrice,I.checkout.cart.currencyCode)))))),e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:billingAddress")),!!(null===(a=I.checkout.billingAddress)||void 0===a?void 0:a.company)&&e.createElement("div",{className:[r.InfoText,r.InfoTextBold].join(" ")},I.checkout.billingAddress.company),e.createElement("div",{className:r.InfoText},null===(s=I.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),D=e.useMemo((function(){var t,o,a,s,i;return e.createElement("div",{className:[r.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:contactInfo")),e.createElement("div",{className:r.InfoText},null===(t=I.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:r.InfoText},y),!!(null===(o=I.checkout.shippingAddress)||void 0===o?void 0:o.phone)&&e.createElement("div",{className:r.InfoText},null===(a=I.checkout.shippingAddress)||void 0===a?void 0:a.phone)),e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:shippingAddress")),!!(null===(s=I.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[r.InfoText,r.InfoTextBold].join(" ")},I.checkout.shippingAddress.company),e.createElement("div",{className:r.InfoText},null===(i=I.checkout.shippingAddress)||void 0===i?void 0:i.addressText)))}),[]);return e.createElement("div",{className:r.StepSuccess},e.createElement("div",{className:r.SuccessTitleContainer},e.createElement(n,null),e.createElement("span",{className:r.SuccessTitle},N("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:r.SuccessSubTitle},N("checkout-page:orderSuccessDescription",{customerName:y})),e.createElement("div",{className:[r.InfoGrid,r.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:orderNoAndDate")),e.createElement("div",{className:[r.InfoText,r.InfoTextBold].join(" ")},"#"+(I.checkout.orderNumber||"")),e.createElement("div",{className:r.InfoText},I.checkout.dateStr),e.createElement(j,{vm:I})),e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:contactInfo")),e.createElement("div",{className:r.InfoText},null===(T=I.checkout.customer)||void 0===T?void 0:T.email),e.createElement("div",{className:r.InfoText},y))),e.createElement(l,{title:N("checkout-page:paymentSummary")},S),e.createElement(l,{title:N("checkout-page:shippingSummary")},D),e.createElement("div",{className:r.Actions},e.createElement("div",{className:r.HelpText},e.createElement("span",null,N("checkout-page:helpCtaQuestion")),e.createElement("span",{className:r.Cta,onClick:function(){return I.setContactModalVisible(!0)}},N("checkout-page:helpCta"))),e.createElement(o,{text:N("checkout-page:actions.backToShopping"),onClick:I.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),j=t((function(t){var o,a,s,i=t.vm,n=v().t,l=r.Yellow;switch(null===(o=i.order)||void 0===o?void 0:o.orderPackageStatus){case f.FULFILLED:case f.PARTIALLY_FULFILLED:case f.DELIVERED:case f.PARTIALLY_DELIVERED:l=r.Green;break;case f.CANCELLED:case f.PARTIALLY_CANCELLED:case f.CANCEL_REJECTED:case f.CANCEL_REQUESTED:l=r.Red}return e.createElement("div",{className:[r.OrderStatus,l].join(" ")},(null===(a=i.order)||void 0===a?void 0:a.orderPackageStatus)?null===(s=[{types:[f.UNFULFILLED],text:n("checkout-page:orderPackageStatus.unfulfilled")},{types:[f.READY_FOR_SHIPMENT],text:n("checkout-page:orderPackageStatus.readyForShipment")},{types:[f.PARTIALLY_FULFILLED],text:n("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[f.FULFILLED],text:n("checkout-page:orderPackageStatus.fulfilled")},{types:[f.DELIVERED,f.PARTIALLY_DELIVERED],text:n("checkout-page:orderPackageStatus.delivered")},{types:[f.UNABLE_TO_DELIVER],text:n("checkout-page:orderPackageStatus.unableToDeliver")},{types:[f.CANCELLED,f.PARTIALLY_CANCELLED],text:n("checkout-page:orderPackageStatus.cancelled")},{types:[f.CANCEL_REJECTED],text:n("checkout-page:orderPackageStatus.cancelRejected")},{types:[f.REFUNDED,f.PARTIALLY_REFUNDED],text:n("checkout-page:orderPackageStatus.refunded")},{types:[f.REFUND_REQUEST_ACCEPTED],text:n("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[f.REFUND_REJECTED],text:n("checkout-page:orderPackageStatus.refundRejected")},{types:[f.REFUND_REQUESTED],text:n("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(i.order.orderPackageStatus)})))||void 0===s?void 0:s.text:"")}));export{h as StepSuccess};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as a,CHECKOUT_LS_KEY as s}from"../../../../store/cart.js";import r from"./style.module.scss.js";import{Analytics as i}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import n from"../../components/svg/success-circle.js";import l from"../../components/expandable-section/index.js";import{IkasTransactionCardAssociationEnum as c}from"../../../../models/data/order-transaction/index.js";import d from"../../components/credit-card-form/svg/amex.js";import m from"../../components/credit-card-form/svg/master-card.js";import u from"../../components/credit-card-form/svg/troy.js";import p from"../../components/credit-card-form/svg/visa.js";import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{formatMoney as v}from"../../../../utils/currency.js";import{useTranslation as E}from"../../../../utils/i18n.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-review/index.js";import"mobx";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/installment-info/index.js";import{IkasOrderPackageStatus as f}from"../../../../models/data/order/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../api/product-option-file/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/product-campaing/campaign/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import{IkasPaymentMethodType as g,IkasPaymentGatewayType as x}from"../../../../models/data/payment-gateway/index.js";var h=t((function(t){var f,h,k,T,I=t.vm,N=E().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(a),t=localStorage.getItem(s);e&&e===I.checkout.cartId&&localStorage.removeItem(a),t&&t===I.checkout.id&&localStorage.removeItem(s)}I.successTransaction&&i.purchase(I.checkout,I.successTransaction)}),[]);var y=((null===(f=I.checkout.customer)||void 0===f?void 0:f.firstName)||"")+" "+((null===(h=I.checkout.customer)||void 0===h?void 0:h.lastName)||""),L=I.paymentGateways.find((function(e){var t;return e.id===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),A=null===(k=I.successTransaction)||void 0===k?void 0:k.paymentMethodDetail,S=e.useMemo((function(){var t,o,a,s;return e.createElement("div",{className:[r.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:paymentMethod")),L&&e.createElement(e.Fragment,null,!!L.logoUrl&&e.createElement("div",{className:r.PaymentLogoContainer},e.createElement("img",{src:L.logoUrl})),!L.logoUrl&&e.createElement("div",{className:r.InfoText},L.paymentMethodType===g.CREDIT_CARD&&L.type===x.INTERNAL?N("checkout-page:creditCard"):L.name),!!L.description&&L.type!==x.EXTERNAL&&e.createElement("div",{className:r.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:L.description}}))),"CREDIT_CARD"===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:r.InfoText},e.createElement("div",{className:r.CardLogoContainer},function(){var t,o;switch(null===(o=null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation){case c.AMERICAN_EXPRESS:return e.createElement(d,null);case c.MASTER_CARD:return e.createElement(m,null);case c.TROY:return e.createElement(u,null);case c.VISA:return e.createElement(p,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==A?void 0:A.lastFourDigits)||""))),(null===(o=null==A?void 0:A.installment)||void 0===o?void 0:o.installmentCount)&&A.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:r.InfoText},"".concat(A.installment.installmentCount," ").concat(N("checkout-page:installments"))),null!==A.installment.installmentPrice&&e.createElement("div",{className:r.InfoText},"".concat(A.installment.installmentCount," x ").concat(v(A.installment.installmentPrice,I.checkout.cart.currencyCode)))))),e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:billingAddress")),!!(null===(a=I.checkout.billingAddress)||void 0===a?void 0:a.company)&&e.createElement("div",{className:[r.InfoText,r.InfoTextBold].join(" ")},I.checkout.billingAddress.company),e.createElement("div",{className:r.InfoText},null===(s=I.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),D=e.useMemo((function(){var t,o,a,s,i;return e.createElement("div",{className:[r.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:contactInfo")),e.createElement("div",{className:r.InfoText},null===(t=I.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:r.InfoText},y),!!(null===(o=I.checkout.shippingAddress)||void 0===o?void 0:o.phone)&&e.createElement("div",{className:r.InfoText},null===(a=I.checkout.shippingAddress)||void 0===a?void 0:a.phone)),e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:shippingAddress")),!!(null===(s=I.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[r.InfoText,r.InfoTextBold].join(" ")},I.checkout.shippingAddress.company),e.createElement("div",{className:r.InfoText},null===(i=I.checkout.shippingAddress)||void 0===i?void 0:i.addressText)))}),[]);return e.createElement("div",{className:r.StepSuccess},e.createElement("div",{className:r.SuccessTitleContainer},e.createElement(n,null),e.createElement("span",{className:r.SuccessTitle},N("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:r.SuccessSubTitle},N("checkout-page:orderSuccessDescription",{customerName:y})),e.createElement("div",{className:[r.InfoGrid,r.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:orderNoAndDate")),e.createElement("div",{className:[r.InfoText,r.InfoTextBold].join(" ")},"#"+(I.checkout.orderNumber||"")),e.createElement("div",{className:r.InfoText},I.checkout.dateStr),e.createElement(j,{vm:I})),e.createElement("div",null,e.createElement("div",{className:r.InfoTitle},N("checkout-page:contactInfo")),e.createElement("div",{className:r.InfoText},null===(T=I.checkout.customer)||void 0===T?void 0:T.email),e.createElement("div",{className:r.InfoText},y))),e.createElement(l,{title:N("checkout-page:paymentSummary")},S),e.createElement(l,{title:N("checkout-page:shippingSummary")},D),e.createElement("div",{className:r.Actions},e.createElement("div",{className:r.HelpText},e.createElement("span",null,N("checkout-page:helpCtaQuestion")),e.createElement("span",{className:r.Cta,onClick:function(){return I.setContactModalVisible(!0)}},N("checkout-page:helpCta"))),e.createElement(o,{text:N("checkout-page:actions.backToShopping"),onClick:I.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),j=t((function(t){var o,a,s,i=t.vm,n=E().t,l=r.Yellow;switch(null===(o=i.order)||void 0===o?void 0:o.orderPackageStatus){case f.FULFILLED:case f.PARTIALLY_FULFILLED:case f.DELIVERED:case f.PARTIALLY_DELIVERED:l=r.Green;break;case f.CANCELLED:case f.PARTIALLY_CANCELLED:case f.CANCEL_REJECTED:case f.CANCEL_REQUESTED:l=r.Red}return e.createElement("div",{className:[r.OrderStatus,l].join(" ")},(null===(a=i.order)||void 0===a?void 0:a.orderPackageStatus)?null===(s=[{types:[f.UNFULFILLED],text:n("checkout-page:orderPackageStatus.unfulfilled")},{types:[f.READY_FOR_SHIPMENT],text:n("checkout-page:orderPackageStatus.readyForShipment")},{types:[f.PARTIALLY_FULFILLED],text:n("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[f.FULFILLED],text:n("checkout-page:orderPackageStatus.fulfilled")},{types:[f.DELIVERED,f.PARTIALLY_DELIVERED],text:n("checkout-page:orderPackageStatus.delivered")},{types:[f.UNABLE_TO_DELIVER],text:n("checkout-page:orderPackageStatus.unableToDeliver")},{types:[f.CANCELLED,f.PARTIALLY_CANCELLED],text:n("checkout-page:orderPackageStatus.cancelled")},{types:[f.CANCEL_REJECTED],text:n("checkout-page:orderPackageStatus.cancelRejected")},{types:[f.REFUNDED,f.PARTIALLY_REFUNDED],text:n("checkout-page:orderPackageStatus.refunded")},{types:[f.REFUND_REQUEST_ACCEPTED],text:n("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[f.REFUND_REJECTED],text:n("checkout-page:orderPackageStatus.refundRejected")},{types:[f.REFUND_REQUESTED],text:n("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(i.order.orderPackageStatus)})))||void 0===s?void 0:s.text:"")}));export{h as StepSuccess};
@@ -1 +1 @@
1
- import*as t from"react";import{observer as e}from"mobx-react-lite";import o from"next/head.js";import"../../models/data/blog/index.js";import{IkasBrand as i}from"../../models/data/brand/index.js";import{IkasCategory as r}from"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import{IkasMerchantSettings as a}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"mobx";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as n}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductDetail as d}from"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasStorefrontConfig as s}from"../../storefront/index.js";import{IkasPageDataInit as m}from"../../providers/page-data-init.js";var p=e((function(e){var p=e.pageType,l=e.pageTitle,c=e.pageDescription,u=e.pageSpecificDataStr,f=e.merchantSettingsStr,h=e.addOgpMetas,v="undefined"!=typeof window;t.useEffect((function(){var t;document.documentElement.lang=(null===(t=s.routings.find((function(t){return t.id===s.storefrontRoutingId})))||void 0===t?void 0:t.locale)||"tr"}),[p]);var g=t.useMemo((function(){if(f)return new a(JSON.parse(f))}),[f]),j=t.useMemo((function(){if(!u)return u;var t=JSON.parse(u);switch(p){case n.PRODUCT:return new d(t.product,t.selectedVariantValues);case n.CATEGORY:return new r(t);case n.BRAND:return new i(t);default:return u}}),[u]),x=t.useMemo((function(){if(j&&j.href)return"https://".concat(s.domain).concat(j.href)}),[j]),y=t.useMemo((function(){var t,e=[];if(h)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+s.domain}),l&&e.push({property:"og:title",content:l}),c&&e.push({property:"og:description",content:c}),e.push({property:"og:url",content:x||(v?window.location.href:"")||"https://".concat(s.domain)}),j&&p===n.PRODUCT){var o=j;o.selectedVariant.mainImage&&e.push({property:"og:image",content:null===(t=o.selectedVariant.mainImage)||void 0===t?void 0:t.src})}else g&&e.push({property:"og:image",content:g.logo.src});return e}),[l,j,x,c,g,h,g]),b=t.useMemo((function(){var t=[];if(g){var e={"@context":"https://schema.org","@type":"Website",url:"https://"+s.domain},o=function(t){var e,o;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:null===(e=null==t?void 0:t.logo)||void 0===e?void 0:e.src,image:null===(o=null==t?void 0:t.logo)||void 0===o?void 0:o.src,url:"https://"+s.domain}}(g);t.push(e),t.push(o)}if(j&&p===n.PRODUCT){var i=function(t){var e,o;try{"undefined"!=typeof window&&m._initProductDetailOnBrowser(t);var i="https://".concat(s.domain).concat(t.href);return{"@context":"https://schema.org/","@type":"Product",name:t.product.name,description:null===(e=t.product.metaData)||void 0===e?void 0:e.description,image:t.selectedVariant.images.map((function(t){return t.src})),productId:t.selectedVariant.id,sku:t.selectedVariant.sku,mpn:t.selectedVariant.barcodeList.length?t.selectedVariant.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(o=t.product.brand)||void 0===o?void 0:o.name},offers:{"@type":"Offer",url:i,priceCurrency:t.selectedVariant.price.currency||"TRY",price:t.selectedVariant.price.finalPrice,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:t.selectedVariant.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}catch(t){}}(j);i&&t.push(i)}if(j&&p===n.CATEGORY){var r=function(t){var e,o,i;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(s.domain).concat(t.href),name:null===(e=t.metaData)||void 0===e?void 0:e.pageTitle,description:null===(o=t.metaData)||void 0===o?void 0:o.description,image:null===(i=t.image)||void 0===i?void 0:i.src}}catch(t){}}(j),a=function(t){try{return{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:t.path.map((function(t,e){return{"@type":"ListItem",position:e+1,name:t.name,item:"https://"+s.domain+t.href}}))}}catch(t){}}(j);r&&t.push(r),a&&t.push(a)}return t}),[j,g]);return t.createElement(o,null,t.createElement("title",null,l||""),t.createElement("meta",{name:"description",content:c||""}),!!h&&y.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!b.length&&b.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));export{p as IkasPageHead};
1
+ import*as t from"react";import{observer as e}from"mobx-react-lite";import o from"next/head.js";import"../../models/data/blog/index.js";import{IkasBrand as i}from"../../models/data/brand/index.js";import{IkasCategory as r}from"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"mobx";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import{IkasMerchantSettings as a}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../api/product-option-file/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/product-campaing/campaign/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as n}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductDetail as d}from"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasStorefrontConfig as s}from"../../storefront/index.js";import{IkasPageDataInit as m}from"../../providers/page-data-init.js";var p=e((function(e){var p=e.pageType,l=e.pageTitle,c=e.pageDescription,u=e.pageSpecificDataStr,f=e.merchantSettingsStr,h=e.addOgpMetas,v="undefined"!=typeof window;t.useEffect((function(){var t;document.documentElement.lang=(null===(t=s.routings.find((function(t){return t.id===s.storefrontRoutingId})))||void 0===t?void 0:t.locale)||"tr"}),[p]);var g=t.useMemo((function(){if(f)return new a(JSON.parse(f))}),[f]),j=t.useMemo((function(){if(!u)return u;var t=JSON.parse(u);switch(p){case n.PRODUCT:return new d(t.product,t.selectedVariantValues);case n.CATEGORY:return new r(t);case n.BRAND:return new i(t);default:return u}}),[u]),x=t.useMemo((function(){if(j&&j.href)return"https://".concat(s.domain).concat(j.href)}),[j]),y=t.useMemo((function(){var t,e=[];if(h)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+s.domain}),l&&e.push({property:"og:title",content:l}),c&&e.push({property:"og:description",content:c}),e.push({property:"og:url",content:x||(v?window.location.href:"")||"https://".concat(s.domain)}),j&&p===n.PRODUCT){var o=j;o.selectedVariant.mainImage&&e.push({property:"og:image",content:null===(t=o.selectedVariant.mainImage)||void 0===t?void 0:t.src})}else g&&e.push({property:"og:image",content:g.logo.src});return e}),[l,j,x,c,g,h,g]),w=t.useMemo((function(){var t=[];if(g){var e={"@context":"https://schema.org","@type":"Website",url:"https://"+s.domain},o=function(t){var e,o;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:null===(e=null==t?void 0:t.logo)||void 0===e?void 0:e.src,image:null===(o=null==t?void 0:t.logo)||void 0===o?void 0:o.src,url:"https://"+s.domain}}(g);t.push(e),t.push(o)}if(j&&p===n.PRODUCT){var i=function(t){var e,o;try{"undefined"!=typeof window&&m._initProductDetailOnBrowser(t);var i="https://".concat(s.domain).concat(t.href);return{"@context":"https://schema.org/","@type":"Product",name:t.product.name,description:null===(e=t.product.metaData)||void 0===e?void 0:e.description,image:t.selectedVariant.images.map((function(t){return t.src})),productId:t.selectedVariant.id,sku:t.selectedVariant.sku,mpn:t.selectedVariant.barcodeList.length?t.selectedVariant.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(o=t.product.brand)||void 0===o?void 0:o.name},offers:{"@type":"Offer",url:i,priceCurrency:t.selectedVariant.price.currency||"TRY",price:t.selectedVariant.price.finalPrice,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:t.selectedVariant.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}catch(t){}}(j);i&&t.push(i)}if(j&&p===n.CATEGORY){var r=function(t){var e,o,i;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(s.domain).concat(t.href),name:null===(e=t.metaData)||void 0===e?void 0:e.pageTitle,description:null===(o=t.metaData)||void 0===o?void 0:o.description,image:null===(i=t.image)||void 0===i?void 0:i.src}}catch(t){}}(j),a=function(t){try{return{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:t.path.map((function(t,e){return{"@type":"ListItem",position:e+1,name:t.name,item:"https://"+s.domain+t.href}}))}}catch(t){}}(j);r&&t.push(r),a&&t.push(a)}return t}),[j,g]);return t.createElement(o,null,t.createElement("title",null,l||""),t.createElement("meta",{name:"description",content:c||""}),!!h&&y.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!w.length&&w.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));export{p as IkasPageHead};