@ikas/storefront 5.0.12 → 5.0.13

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 (155) hide show
  1. package/build/analytics/analytics.js +1 -1
  2. package/build/analytics/googleAnalytics.js +1 -1
  3. package/build/analytics/googleTagManager.js +1 -1
  4. package/build/analytics/ikas.js +1 -1
  5. package/build/components/checkout/components/address-form/model.js +1 -1
  6. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  7. package/build/components/checkout/components/customer-addresses/model.js +1 -1
  8. package/build/components/checkout/components/error/argument-validation-error/index.d.ts +8 -0
  9. package/build/components/checkout/components/error/argument-validation-error/index.js +1 -0
  10. package/build/components/checkout/components/error/index.js +1 -1
  11. package/build/components/checkout/components/master-pass/credit-card-form/index.js +1 -1
  12. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
  13. package/build/components/checkout/components/offer-product/index.js +1 -1
  14. package/build/components/checkout/components/quick-registration/model.js +1 -1
  15. package/build/components/checkout/index.js +1 -1
  16. package/build/components/checkout/model.d.ts +2 -2
  17. package/build/components/checkout/model.js +1 -1
  18. package/build/components/checkout/modelMasterPass.js +1 -1
  19. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  20. package/build/components/checkout/steps/step-success/index.js +1 -1
  21. package/build/components/page/head.js +1 -1
  22. package/build/components/page/index.js +1 -1
  23. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  24. package/build/components/page-editor/model.js +1 -1
  25. package/build/components/popup/index.d.ts +2 -0
  26. package/build/components/popup/index.js +1 -0
  27. package/build/components/popup/renderer/index.d.ts +11 -0
  28. package/build/components/popup/renderer/index.js +1 -0
  29. package/build/components/popup/renderer/model.d.ts +21 -0
  30. package/build/components/popup/renderer/model.js +1 -0
  31. package/build/components/popup/utils/index.d.ts +8 -0
  32. package/build/components/popup/utils/index.js +1 -0
  33. package/build/ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js +1 -0
  34. package/build/ext/@ikas/popup-renderer/build/popup-renderer/assets/left-arrow.js +1 -0
  35. package/build/ext/@ikas/popup-renderer/build/popup-renderer/assets/right-arrow.js +1 -0
  36. package/build/ext/@ikas/popup-renderer/build/popup-renderer/assets/x-close.js +1 -0
  37. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -0
  38. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/divider-element-renderer/index.js +1 -0
  39. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -0
  40. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +1 -0
  41. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +1 -0
  42. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -0
  43. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -0
  44. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -0
  45. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -0
  46. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -0
  47. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -0
  48. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -0
  49. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/space-element-renderer/index.js +1 -0
  50. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/text-element-renderer/index.js +1 -0
  51. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -0
  52. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/index.js +1 -0
  53. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js +1 -0
  54. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js +1 -0
  55. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js +1 -0
  56. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js +1 -0
  57. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js +1 -0
  58. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js +1 -0
  59. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js +1 -0
  60. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js +1 -0
  61. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-birthday/index.js +1 -0
  62. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-email/index.js +1 -0
  63. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js +1 -0
  64. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-name/index.js +1 -0
  65. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-phone/index.js +1 -0
  66. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-surname/index.js +1 -0
  67. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -0
  68. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js +1 -0
  69. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +1 -0
  70. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +1 -0
  71. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js +1 -0
  72. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +1 -0
  73. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js +1 -0
  74. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js +1 -0
  75. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js +1 -0
  76. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js +1 -0
  77. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js +1 -0
  78. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/window-settings/index.js +1 -0
  79. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js +1 -0
  80. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js +1 -0
  81. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-time/index.js +1 -0
  82. package/build/ext/mobx-react/dist/mobxreact.esm.js +1 -0
  83. package/build/ext/swiper/modules/navigation.css.js +1 -0
  84. package/build/ext/swiper/modules/navigation.mjs.js +1 -0
  85. package/build/ext/swiper/modules/pagination.css.js +1 -0
  86. package/build/ext/swiper/modules/scrollbar.mjs.js +1 -0
  87. package/build/ext/swiper/shared/classes-to-selector.mjs.js +1 -0
  88. package/build/ext/swiper/shared/create-element-if-not-defined.mjs.js +1 -0
  89. package/build/ext/swiper/shared/ssr-window.esm.mjs.js +1 -0
  90. package/build/ext/swiper/shared/swiper-core.mjs.js +1 -0
  91. package/build/ext/swiper/shared/update-on-virtual-data.mjs.js +1 -0
  92. package/build/ext/swiper/shared/update-swiper.mjs.js +1 -0
  93. package/build/ext/swiper/shared/utils.mjs.js +1 -0
  94. package/build/ext/swiper/swiper-react.mjs.js +1 -0
  95. package/build/ext/swiper/swiper.css.js +1 -0
  96. package/build/hooks/useCustomerReviews.js +1 -1
  97. package/build/hooks/useStore.js +1 -1
  98. package/build/index.js +1 -1
  99. package/build/models/data/customer/index.d.ts +8 -1
  100. package/build/models/data/customer/index.js +1 -1
  101. package/build/models/data/customer-form-data-input/customer-register-subscription-input/index.d.ts +7 -0
  102. package/build/models/data/customer-form-data-input/customer-register-subscription-input/index.js +1 -0
  103. package/build/models/data/customer-form-data-input/index.d.ts +19 -0
  104. package/build/models/data/customer-form-data-input/index.js +1 -0
  105. package/build/models/data/index.d.ts +2 -0
  106. package/build/models/data/product/index.js +1 -1
  107. package/build/models/data/storefront-popup/index.d.ts +40 -0
  108. package/build/models/data/storefront-popup/index.js +1 -0
  109. package/build/models/data/storefront-popup/storefront-popup-analytics/index.d.ts +7 -0
  110. package/build/models/data/storefront-popup/storefront-popup-analytics/index.js +1 -0
  111. package/build/models/data/storefront-popup/storefront-popup-date-f/304/261lter/index.d.ts +6 -0
  112. package/build/models/data/storefront-popup/storefront-popup-date-f/304/261lter/index.js +1 -0
  113. package/build/models/data/storefront-popup/storefront-popup-display-filter/index.d.ts +11 -0
  114. package/build/models/data/storefront-popup/storefront-popup-display-filter/index.js +1 -0
  115. package/build/models/data/storefront-popup/storefront-popup-display-settings/index.d.ts +16 -0
  116. package/build/models/data/storefront-popup/storefront-popup-display-settings/index.js +1 -0
  117. package/build/models/data/storefront-popup/storefront-popup-page-filter/index.d.ts +16 -0
  118. package/build/models/data/storefront-popup/storefront-popup-page-filter/index.js +1 -0
  119. package/build/models/data/storefront-popup/storefront-popup-page-filter/storefront-popup-page-filter-data/index.d.ts +12 -0
  120. package/build/models/data/storefront-popup/storefront-popup-page-filter/storefront-popup-page-filter-data/index.js +1 -0
  121. package/build/models/data/storefront-popup/storefront-popup-routing/index.d.ts +6 -0
  122. package/build/models/data/storefront-popup/storefront-popup-routing/index.js +1 -0
  123. package/build/models/ui/blog-category-list/index.js +1 -1
  124. package/build/models/ui/brand-list/index.js +1 -1
  125. package/build/models/ui/category-list/index.js +1 -1
  126. package/build/models/ui/customer-review-list/index.d.ts +3 -0
  127. package/build/models/ui/customer-review-list/index.js +1 -1
  128. package/build/models/ui/customer-review-summary-list/index.js +1 -1
  129. package/build/models/ui/product-list/index.js +1 -1
  130. package/build/models/ui/raffle-list/index.js +1 -1
  131. package/build/models/ui/validator/form/account-info.js +1 -1
  132. package/build/models/ui/validator/form/address.js +1 -1
  133. package/build/models/ui/validator/form/ikas-address.js +1 -1
  134. package/build/models/ui/validator/form/register.js +1 -1
  135. package/build/page-data-init/index.js +1 -1
  136. package/build/pages/checkout.js +1 -1
  137. package/build/store/blog/index.js +1 -1
  138. package/build/store/brand/index.js +1 -1
  139. package/build/store/cart/index.js +1 -1
  140. package/build/store/category/index.js +1 -1
  141. package/build/store/checkout/index.js +1 -1
  142. package/build/store/customer/api.d.ts +2 -1
  143. package/build/store/customer/api.js +1 -1
  144. package/build/store/customer/index.d.ts +2 -0
  145. package/build/store/customer/index.js +1 -1
  146. package/build/store/html-meta-data/index.js +1 -1
  147. package/build/store/location/index.js +1 -1
  148. package/build/store/product/index.js +1 -1
  149. package/build/store/storefront-popup/index.d.ts +74 -0
  150. package/build/store/storefront-popup/index.js +1 -0
  151. package/package.json +18 -12
  152. package/build/components/checkout/components/epaykolay-button/index.d.ts +0 -5
  153. package/build/components/checkout/components/epaykolay-button/index.js +0 -1
  154. package/build/components/checkout/components/epaykolay-button/style.module.scss.js +0 -1
  155. package/build/components/checkout/components/svg/epaykolay.js +0 -1
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as s,__rest as t}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import{useTranslation as a}from"../../utils/i18n.js";import{getMasterPassRequestToken as n,MasterPassOperationTypeEnum as r}from"@ikas/storefront-api";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";var c="ikasMasterPass",u="https://cdn.myikas.com/sf/scripts/mfs-client-nojquery.min.js",d="undefined"==typeof localStorage,l=/000000[0|1]{10}/g,h=/[0|1]1100[0|1]{11}/g,p=/[0|1]11100[0|1]{10}/g,m=function(){function c(){var c=this;this.checkMasterPassData={status:""},this.saveCardToMasterPass={isCheckboxChecked:!1,cardName:"",phoneNumber:"",isSendConfirmationButtonPending:!1},this.otpResponse={status:"",text:""},this.isOtpFormSubmitAtLeastOnce=!1,this.visibleModal=void 0,this.cards=[],this.saveCardToMasterPassPhoneNumberDisabledInputValue=function(e){var s=e.store,t=e.checkout,o=e.withPlus;return c.phoneNumber({store:s,checkout:t,withPlus:o})||""},this.onSaveCardToMasterPassCheckedChange=function(e){c.saveCardToMasterPass.isCheckboxChecked=e},this.onSaveCardToMasterPassCardNameChange=function(e){c.saveCardToMasterPass.cardName=e},this.onSaveCardToMasterPassPhoneNumberChange=function(e){c.saveCardToMasterPass.phoneNumber=e},this.onSaveCardToMasterPassSendConfirmationButtonClick=function(e){var s=e.creditCard,t=e.store,o=e.checkout,a=e.paymentGateway,n=e.callback;console.log("onSaveCardToMasterPassSendConfirmationButtonClick 1"),c.register({creditCard:s,store:t,checkout:o,paymentGateway:a,callback:n})},this.showLinkCardToClient=function(){c.visibleModal="linkCardToClient"},this.hideLinkCardToClient=function(){c.visibleModal=void 0},this.showOtpModal=function(e){c.otpResponse.text="",c.otpResponse.status="",c.visibleModal="masterPassOtp"===e?"otpModalMasterPass":"otpModalBank",console.log("calisti",c.visibleModal)},this.hideOtpModal=function(){c.visibleModal=void 0,c.otpResponse.text="",c.otpResponse.status="",c.isOtpFormSubmitAtLeastOnce=!1},this.onResponseModalClose=function(){c.visibleModal=void 0,c.mfsResponseModalText=""},this.onSuccessModalClose=function(){c.visibleModal=void 0},this.onLinkCardToClientButtonClick=function(e){c.linkCardToClient(e)},this.onOtpFormSubmit=function(e){c.otpResponse.text="",c.otpResponse.status="",c.validateTransaction(e)},this.MFS=function(){var e;if(!d){if(window.MFS&&(null===(e=window.MFS)||void 0===e?void 0:e.setClientId)){var s=window.MFS;return s.setAddress("https://ui.masterpassturkiye.com/v2"),s}console.error("MFS can not use.")}},this.getToken=function(t){var o=t.cartId,a=t.paymentGatewayId,r=t.operationType,i=t.phoneNumber;return e(c,void 0,void 0,(function(){var e;return s(this,(function(s){switch(s.label){case 0:return[4,n({cartId:o,paymentGatewayId:a,operationType:r,phoneNumber:i})];case 1:return(e=s.sent()).data&&e.isSuccess&&!e.errors.length?[2,e.data]:(this.showTokenErrorWithModal(),[2])}}))}))},this.phoneNumber=function(e){var s,t,o=e.store,a=e.checkout,n=e.withPlus,r=void 0!==n&&n,i=(null===(s=o.customerStore.customer)||void 0===s?void 0:s.phone)||(null===(t=a.shippingAddress)||void 0===t?void 0:t.phone);return i&&i.includes("+")&&!r&&(i=i.replace("+","")),i},this.sendSmsLanguage=function(e){var s,t="tur";if(e.localeOptions.length){var o=e.localeOptions.find((function(e){return e.routing.locale===i.getCurrentLocale()}));o&&o.iso3&&(t=null===(s=o.iso3)||void 0===s?void 0:s.toLowerCase())}return t},this.clearSaveCardToMasterPassForm=function(){c.saveCardToMasterPass.isCheckboxChecked=!1,c.saveCardToMasterPass.phoneNumber="",c.saveCardToMasterPass.cardName="",c.saveCardToMasterPass.isSendConfirmationButtonPending=!1},this.mfsResponseHandler=function(e){return function(s,t){console.log({field:"mfsResponseHandler",response:t}),e.callback&&e.callback();var o,a=function(e){var s;return null===(s=null==t?void 0:t.accountStatus)||void 0===s?void 0:s.match(e)};a(l)&&(c.checkMasterPassData.status="noMasterPassAccount",(o=c.phoneNumber({checkout:e.checkout,store:e.store,withPlus:!0}))&&(c.saveCardToMasterPass.phoneNumber=o));a(h)&&(c.checkMasterPassData.status="hasMasterPassAccountButDoesNotHaveAnyOperation",c.showLinkCardToClient(),(o=c.phoneNumber({checkout:e.checkout,store:e.store,withPlus:!0}))&&(c.saveCardToMasterPass.phoneNumber=o));if(a(p)&&(c.checkMasterPassData.status="hasMasterPassAccountAndHasRelation",(null==e?void 0:e.checkout)&&e.store&&(c.listCards({store:e.store,checkout:e.checkout}),console.log("call listcards"))),"validateTransaction"!==e.source&&"resendOtp"!==e.source||!t.responseDescription||(c.otpResponse.text=t.responseDescription,"1409"===t.responseCode&&(c.otpResponse.status="error")),"0000"!=t.responseCode&&""!=t.responseCode||(console.log("Register Success"),"deleteCard"===e.source&&c.listCards({store:e.store,checkout:e.checkout}),"validateTransaction"===e.source&&(null==e?void 0:e.checkout)&&e.store&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===c.checkMasterPassData.status?c.visibleModal="linkCardToClientModalSuccess":c.visibleModal="otpModalSuccess",e.checkout.selectedPaymentGateway=void 0,c.clearSaveCardToMasterPassForm(),c.listCards({store:e.store,checkout:e.checkout}))),"5196"===t.responseCode&&t.responseDescription&&(c.visibleModal="mfsResponseModal",c.mfsResponseModalText=t.responseDescription),"5001"==t.responseCode||"5008"==t.responseCode){var n="5001"===t.responseCode?"bankOtp":"masterPassOtp";c.showOtpModal(n)}if("5010"==t.responseCode&&"undefined"!=typeof window)return console.log('response.responseCode == "5010"'),void window.location.assign(t.url3D+"&returnUrl="+window.location.href);console.log({source:"MFS response.responseDescription",responseDescription:t.responseDescription,response:t})}},this.showTokenErrorWithModal=function(){var e=a().t;c.visibleModal="mfsResponseModal",c.mfsResponseModalText=e("checkout-page:errorUnknown")},this.checkMasterPass=function(o){return e(c,void 0,void 0,(function(){var e,a,n,i,c,u,d=o.checkout,l=o.store;return t(o,["checkout","store"]),s(this,(function(s){switch(s.label){case 0:return console.log("checkMasterPass 1"),(e=this.MFS())?(a=this.phoneNumber({store:l,checkout:d}),console.log("checkMasterPass 2"),n=d.masterPassPaymentGateway,a&&n&&n.masterPassClientId?(console.log("checkMasterPass 3",a),[4,this.getToken({cartId:d.id,paymentGatewayId:n.id,operationType:r.CHECK_MASTER_PASS_USER,phoneNumber:a})]):[2]):[2];case 1:return(i=s.sent())?(e.setClientId(n.masterPassClientId),c=this.sendSmsLanguage(l),u=this.prepareFormData({sendSmsLanguage:c,sendSms:"N",referenceNo:i.requestReferenceNumber,token:i.token,userId:a}),e.checkMasterPass(u,this.mfsResponseHandler({source:"checkMasterPass",checkout:d,store:l})),console.log("checkMasterPass 4"),[2]):[2]}}))}))},this.register=function(t){var o=t.creditCard,a=t.store,n=t.checkout,i=t.paymentGateway,u=t.callback;return e(c,void 0,void 0,(function(){var e,t,c,d;return s(this,(function(s){switch(s.label){case 0:return console.log("register 1"),(e=this.MFS())?(console.log("register 2"),(t=o.phoneNumber)&&i.masterPassClientId?(console.log("register 3"),[4,this.getToken({cartId:n.id,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:t})]):[2]):[2];case 1:return c=s.sent(),console.log("register 4"),(null==c?void 0:c.token)?(d=this.prepareFormData({msisdn:t,token:null==c?void 0:c.token,referenceNo:c.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(a),rtaPan:o.rtaPan,expiryDate:o.expiryDate,cvc:o.cvc,accountAliasName:o.accountAliasName,timeZone:c.timeZone,sendSms:"Y",actionType:"A",clientIp:"",delinkReason:"",eActionType:"A",cardTypeFlag:"05",cpinFlag:"Y",defaultAccount:"Y",mmrpConfig:"110010",identityVerificationFlag:"Y",mobileAccountConfig:"MWA",uiChannelType:"6"}),console.log("reigster 5"),e.setClientId(i.masterPassClientId),e.register(d,this.mfsResponseHandler({source:"register",store:a,checkout:n,callback:u})),[2]):[2]}}))}))},this.resendOtp=function(t){var o=t.store,a=t.checkout,n=t.callback;return e(c,void 0,void 0,(function(){var e,t,r;return s(this,(function(s){return this.isOtpFormSubmitAtLeastOnce&&(e=this.MFS())?(t=e.getLastToken(),r=this.sendSmsLanguage(o),e.resendOtp(t,r,this.mfsResponseHandler({source:"resendOtp",store:o,checkout:a,callback:n})),[2]):[2]}))}))},this.linkCardToClient=function(t){var o=t.store,a=t.checkout,n=t.callback;return e(c,void 0,void 0,(function(){var e,t,i,c,u;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&((t=this.phoneNumber({store:o,checkout:a}))&&(null==(i=a.masterPassPaymentGateway)?void 0:i.id))?[4,this.getToken({cartId:a.id,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:t})]:[2];case 1:return(c=s.sent())?(u=this.prepareFormData({sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(o),token:c.token,referenceNo:c.requestReferenceNumber,cardAliasName:"",msisdn:t}),e.linkCardToClient(u,this.mfsResponseHandler({source:"linkCardToClient",store:o,checkout:a,callback:n})),[2]):(n&&n(),[2])}}))}))},this.validateTransaction=function(t){var o=t.validationCode,a=t.store,n=t.checkout,i=t.callback;return e(c,void 0,void 0,(function(){var e,t,c,u,d;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&((t=this.phoneNumber({store:a,checkout:n}))&&(c=n.masterPassPaymentGateway))?[4,this.getToken({cartId:n.id,paymentGatewayId:c.id,operationType:r.REGISTER_CARD,phoneNumber:t})]:[2];case 1:return(u=s.sent())?(d=this.prepareFormData({pinType:"otp",validationCode:o,sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(a),token:u.token,referenceNo:u.requestReferenceNumber}),this.isOtpFormSubmitAtLeastOnce||(this.isOtpFormSubmitAtLeastOnce=!0),e.validateTransaction(d,this.mfsResponseHandler({source:"validateTransaction",store:a,checkout:n,callback:i})),[2]):[2]}}))}))},this.listCards=function(t){var o=t.store,a=t.checkout;return e(c,void 0,void 0,(function(){var e,t,n,i,c,u,d=this;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&(t=this.phoneNumber({store:o,checkout:a}))?(n=null===(u=a.masterPassPaymentGateway)||void 0===u?void 0:u.id,console.log("listCards paymentGatewayId",n),n?[4,this.getToken({cartId:a.id,paymentGatewayId:n,operationType:r.LIST_CARDS,phoneNumber:t})]:[2]):[2];case 1:return(i=s.sent())?(c=function(e,s){"0000"!=s.responseCode&&""!=s.responseCode&&(console.error({source:"mfs response.responseDescription",responseDescription:s.responseDescription,response:s}),console.log("TransactionID->",s.transactionId));var t=[];if(Array.isArray(s.cards)&&s.cards.length)for(var o=0;o<s.cards.length;o++){var a=s.cards[o];a.paymentGatewayId=n,t.push(a)}d.cards=t,console.log("list_card response->",s),console.log("Cards",t),console.log("TransactionID->",s.transactionId)},e.listCards(t,i.token,c),[2]):[2]}}))}))},this.deleteCard=function(t){var o=t.store,a=t.checkout,n=t.card;return e(c,void 0,void 0,(function(){var e,t,i,c;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&(t=this.phoneNumber({store:o,checkout:a}))?[4,this.getToken({cartId:a.id,paymentGatewayId:n.paymentGatewayId,operationType:r.DELETE_CARD,phoneNumber:t})]:[2];case 1:return(i=s.sent())?(c=this.prepareFormData({sendSms:"N",msisdn:t,token:i.token,referenceNo:i.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(o),accountAliasName:n.Name}),e.deleteCard(c,this.mfsResponseHandler({source:"deleteCard",store:o,checkout:a})),[2]):[2]}}))}))},o(this)}return Object.defineProperty(c.prototype,"isSaveCardToMasterPassPhoneNumberInputVisible",{get:function(){return("hasMasterPassAccountAndHasRelation"!==this.checkMasterPassData.status||!this.cards.length)&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status||this.checkMasterPassData.status,!0)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isSaveCardToMasterPassPhoneNumberInputDisabled",{get:function(){return!("hasMasterPassAccountAndHasRelation"!==this.checkMasterPassData.status||!this.cards.length)||("hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status||"noMasterPassAccount"===this.checkMasterPassData.status)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isSendConfirmationButtonDisabled",{get:function(){return this.isSaveCardToMasterPassPhoneNumberInputVisible?this.isSaveCardToMasterPassPhoneNumberInputDisabled?!this.saveCardToMasterPass.cardName:!this.saveCardToMasterPass.cardName||!this.saveCardToMasterPass.phoneNumber:!this.saveCardToMasterPass.cardName},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isLinkCardToClientVisible",{get:function(){return"linkCardToClient"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isOtpModalVisible",{get:function(){return"otpModalBank"===this.visibleModal||"otpModalMasterPass"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isResponseModalVisible",{get:function(){return!("mfsResponseModal"!==this.visibleModal||!this.mfsResponseModalText)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isSuccessModalVisible",{get:function(){return"linkCardToClientModalSuccess"===this.visibleModal||"otpModalSuccess"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"otpModalType",{get:function(){return"otpModalMasterPass"===this.visibleModal?"masterPassOtp":"bankOtp"},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"successModalType",{get:function(){return"hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status?"linkCardToClient":"register"},enumerable:!1,configurable:!0}),c.prototype.prepareFormData=function(e){var s=new FormData;return Object.entries(e).forEach((function(e){var t=e[0],o=e[1];return s.append(t,o)})),s},c}();export{c as MFS_ELEMENT_ID,u as MFS_SCRIPT_URL,m as default};
1
+ import{__awaiter as e,__generator as t,__rest as s}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as a}from"mobx";import{useTranslation as o}from"../../utils/i18n.js";import{getMasterPassRequestToken as r,MasterPassOperationTypeEnum as n}from"@ikas/storefront-api";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";var c="ikasMasterPass",u="https://cdn.myikas.com/sf/scripts/mfs-client-nojquery.min.js",d="undefined"==typeof localStorage,l=/000000[0|1]{10}/g,h=/[0|1]1100[0|1]{11}/g,p=/[0|1]11100[0|1]{10}/g,m=function(){function c(){var c=this;this.checkMasterPassData={status:""},this.saveCardToMasterPass={isCheckboxChecked:!1,cardName:"",phoneNumber:"",isSendConfirmationButtonPending:!1},this.otpResponse={status:"",text:""},this.isOtpFormSubmitAtLeastOnce=!1,this.visibleModal=void 0,this.cards=[],this.saveCardToMasterPassPhoneNumberDisabledInputValue=function(e){var t=e.store,s=e.checkout,a=e.withPlus;return c.phoneNumber({store:t,checkout:s,withPlus:a})||""},this.onSaveCardToMasterPassCheckedChange=function(e){c.saveCardToMasterPass.isCheckboxChecked=e},this.onSaveCardToMasterPassCardNameChange=function(e){c.saveCardToMasterPass.cardName=e},this.onSaveCardToMasterPassPhoneNumberChange=function(e){c.saveCardToMasterPass.phoneNumber=e},this.onSaveCardToMasterPassSendConfirmationButtonClick=function(e){var t=e.creditCard,s=e.store,a=e.checkout,o=e.paymentGateway,r=e.callback;c.register({creditCard:t,store:s,checkout:a,paymentGateway:o,callback:r})},this.showLinkCardToClient=function(){c.visibleModal="linkCardToClient"},this.hideLinkCardToClient=function(){c.visibleModal=void 0},this.showOtpModal=function(e){c.otpResponse.text="",c.otpResponse.status="",c.visibleModal="masterPassOtp"===e?"otpModalMasterPass":"otpModalBank"},this.hideOtpModal=function(){c.visibleModal=void 0,c.otpResponse.text="",c.otpResponse.status="",c.isOtpFormSubmitAtLeastOnce=!1},this.onResponseModalClose=function(){c.visibleModal=void 0,c.mfsResponseModalText=""},this.onSuccessModalClose=function(){c.visibleModal=void 0},this.onLinkCardToClientButtonClick=function(e){c.linkCardToClient(e)},this.onOtpFormSubmit=function(e){c.otpResponse.text="",c.otpResponse.status="",c.validateTransaction(e)},this.MFS=function(){var e;if(!d){if(window.MFS&&(null===(e=window.MFS)||void 0===e?void 0:e.setClientId)){var t=window.MFS;return t.setAddress("https://ui.masterpassturkiye.com/v2"),t}console.error("MFS can not use.")}},this.getToken=function(s){var a=s.cartId,o=s.paymentGatewayId,n=s.operationType,i=s.phoneNumber;return e(c,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,r({cartId:a,paymentGatewayId:o,operationType:n,phoneNumber:i})];case 1:return(e=t.sent()).data&&e.isSuccess&&!e.errors.length?[2,e.data]:(this.showTokenErrorWithModal(),[2])}}))}))},this.phoneNumber=function(e){var t,s,a=e.store,o=e.checkout,r=e.withPlus,n=void 0!==r&&r,i=(null===(t=a.customerStore.customer)||void 0===t?void 0:t.phone)||(null===(s=o.shippingAddress)||void 0===s?void 0:s.phone);return i&&i.includes("+")&&!n&&(i=i.replace("+","")),i},this.sendSmsLanguage=function(e){var t,s="tur";if(e.localeOptions.length){var a=e.localeOptions.find((function(e){return e.routing.locale===i.getCurrentLocale()}));a&&a.iso3&&(s=null===(t=a.iso3)||void 0===t?void 0:t.toLowerCase())}return s},this.clearSaveCardToMasterPassForm=function(){c.saveCardToMasterPass.isCheckboxChecked=!1,c.saveCardToMasterPass.phoneNumber="",c.saveCardToMasterPass.cardName="",c.saveCardToMasterPass.isSendConfirmationButtonPending=!1},this.mfsResponseHandler=function(e){return function(t,s){e.callback&&e.callback();var a,o=function(e){var t;return null===(t=null==s?void 0:s.accountStatus)||void 0===t?void 0:t.match(e)};o(l)&&(c.checkMasterPassData.status="noMasterPassAccount",(a=c.phoneNumber({checkout:e.checkout,store:e.store,withPlus:!0}))&&(c.saveCardToMasterPass.phoneNumber=a));o(h)&&(c.checkMasterPassData.status="hasMasterPassAccountButDoesNotHaveAnyOperation",c.showLinkCardToClient(),(a=c.phoneNumber({checkout:e.checkout,store:e.store,withPlus:!0}))&&(c.saveCardToMasterPass.phoneNumber=a));if(o(p)&&(c.checkMasterPassData.status="hasMasterPassAccountAndHasRelation",(null==e?void 0:e.checkout)&&e.store&&c.listCards({store:e.store,checkout:e.checkout})),"validateTransaction"!==e.source&&"resendOtp"!==e.source||!s.responseDescription||(c.otpResponse.text=s.responseDescription,"1409"===s.responseCode&&(c.otpResponse.status="error")),"0000"!=s.responseCode&&""!=s.responseCode||("deleteCard"===e.source&&c.listCards({store:e.store,checkout:e.checkout}),"validateTransaction"===e.source&&(null==e?void 0:e.checkout)&&e.store&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===c.checkMasterPassData.status?c.visibleModal="linkCardToClientModalSuccess":c.visibleModal="otpModalSuccess",e.checkout.selectedPaymentGateway=void 0,c.clearSaveCardToMasterPassForm(),c.listCards({store:e.store,checkout:e.checkout}))),"5196"===s.responseCode&&s.responseDescription&&(c.visibleModal="mfsResponseModal",c.mfsResponseModalText=s.responseDescription),"5001"==s.responseCode||"5008"==s.responseCode){var r="5001"===s.responseCode?"bankOtp":"masterPassOtp";c.showOtpModal(r)}"5010"!=s.responseCode||"undefined"==typeof window||window.location.assign(s.url3D+"&returnUrl="+window.location.href)}},this.showTokenErrorWithModal=function(){var e=o().t;c.visibleModal="mfsResponseModal",c.mfsResponseModalText=e("checkout-page:errorUnknown")},this.checkMasterPass=function(a){return e(c,void 0,void 0,(function(){var e,o,r,i,c,u,d=a.checkout,l=a.store;return s(a,["checkout","store"]),t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())?(o=this.phoneNumber({store:l,checkout:d}),r=d.masterPassPaymentGateway,o&&r&&r.masterPassClientId?[4,this.getToken({cartId:d.id,paymentGatewayId:r.id,operationType:n.CHECK_MASTER_PASS_USER,phoneNumber:o})]:[2]):[2];case 1:return(i=t.sent())?(e.setClientId(r.masterPassClientId),c=this.sendSmsLanguage(l),u=this.prepareFormData({sendSmsLanguage:c,sendSms:"N",referenceNo:i.requestReferenceNumber,token:i.token,userId:o}),e.checkMasterPass(u,this.mfsResponseHandler({source:"checkMasterPass",checkout:d,store:l})),[2]):[2]}}))}))},this.register=function(s){var a=s.creditCard,o=s.store,r=s.checkout,i=s.paymentGateway,u=s.callback;return e(c,void 0,void 0,(function(){var e,s,c,d;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&((s=a.phoneNumber)&&i.masterPassClientId)?[4,this.getToken({cartId:r.id,paymentGatewayId:i.id,operationType:n.REGISTER_CARD,phoneNumber:s})]:[2];case 1:return(null==(c=t.sent())?void 0:c.token)?(d=this.prepareFormData({msisdn:s,token:null==c?void 0:c.token,referenceNo:c.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(o),rtaPan:a.rtaPan,expiryDate:a.expiryDate,cvc:a.cvc,accountAliasName:a.accountAliasName,timeZone:c.timeZone,sendSms:"Y",actionType:"A",clientIp:"",delinkReason:"",eActionType:"A",cardTypeFlag:"05",cpinFlag:"Y",defaultAccount:"Y",mmrpConfig:"110010",identityVerificationFlag:"Y",mobileAccountConfig:"MWA",uiChannelType:"6"}),e.setClientId(i.masterPassClientId),e.register(d,this.mfsResponseHandler({source:"register",store:o,checkout:r,callback:u})),[2]):[2]}}))}))},this.resendOtp=function(s){var a=s.store,o=s.checkout,r=s.callback;return e(c,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){return this.isOtpFormSubmitAtLeastOnce&&(e=this.MFS())?(s=e.getLastToken(),n=this.sendSmsLanguage(a),e.resendOtp(s,n,this.mfsResponseHandler({source:"resendOtp",store:a,checkout:o,callback:r})),[2]):[2]}))}))},this.linkCardToClient=function(s){var a=s.store,o=s.checkout,r=s.callback;return e(c,void 0,void 0,(function(){var e,s,i,c,u;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&((s=this.phoneNumber({store:a,checkout:o}))&&(null==(i=o.masterPassPaymentGateway)?void 0:i.id))?[4,this.getToken({cartId:o.id,paymentGatewayId:i.id,operationType:n.REGISTER_CARD,phoneNumber:s})]:[2];case 1:return(c=t.sent())?(u=this.prepareFormData({sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(a),token:c.token,referenceNo:c.requestReferenceNumber,cardAliasName:"",msisdn:s}),e.linkCardToClient(u,this.mfsResponseHandler({source:"linkCardToClient",store:a,checkout:o,callback:r})),[2]):(r&&r(),[2])}}))}))},this.validateTransaction=function(s){var a=s.validationCode,o=s.store,r=s.checkout,i=s.callback;return e(c,void 0,void 0,(function(){var e,s,c,u,d;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&((s=this.phoneNumber({store:o,checkout:r}))&&(c=r.masterPassPaymentGateway))?[4,this.getToken({cartId:r.id,paymentGatewayId:c.id,operationType:n.REGISTER_CARD,phoneNumber:s})]:[2];case 1:return(u=t.sent())?(d=this.prepareFormData({pinType:"otp",validationCode:a,sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(o),token:u.token,referenceNo:u.requestReferenceNumber}),this.isOtpFormSubmitAtLeastOnce||(this.isOtpFormSubmitAtLeastOnce=!0),e.validateTransaction(d,this.mfsResponseHandler({source:"validateTransaction",store:o,checkout:r,callback:i})),[2]):[2]}}))}))},this.listCards=function(s){var a=s.store,o=s.checkout;return e(c,void 0,void 0,(function(){var e,s,r,i,c,u,d=this;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&((s=this.phoneNumber({store:a,checkout:o}))&&(r=null===(u=o.masterPassPaymentGateway)||void 0===u?void 0:u.id))?[4,this.getToken({cartId:o.id,paymentGatewayId:r,operationType:n.LIST_CARDS,phoneNumber:s})]:[2];case 1:return(i=t.sent())?(c=function(e,t){"0000"!=t.responseCode&&""!=t.responseCode&&console.error({source:"mfs response.responseDescription",responseDescription:t.responseDescription,response:t});var s=[];if(Array.isArray(t.cards)&&t.cards.length)for(var a=0;a<t.cards.length;a++){var o=t.cards[a];o.paymentGatewayId=r,s.push(o)}d.cards=s},e.listCards(s,i.token,c),[2]):[2]}}))}))},this.deleteCard=function(s){var a=s.store,o=s.checkout,r=s.card;return e(c,void 0,void 0,(function(){var e,s,i,c;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&(s=this.phoneNumber({store:a,checkout:o}))?[4,this.getToken({cartId:o.id,paymentGatewayId:r.paymentGatewayId,operationType:n.DELETE_CARD,phoneNumber:s})]:[2];case 1:return(i=t.sent())?(c=this.prepareFormData({sendSms:"N",msisdn:s,token:i.token,referenceNo:i.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(a),accountAliasName:r.Name}),e.deleteCard(c,this.mfsResponseHandler({source:"deleteCard",store:a,checkout:o})),[2]):[2]}}))}))},a(this)}return Object.defineProperty(c.prototype,"isSaveCardToMasterPassPhoneNumberInputVisible",{get:function(){return("hasMasterPassAccountAndHasRelation"!==this.checkMasterPassData.status||!this.cards.length)&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status||this.checkMasterPassData.status,!0)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isSaveCardToMasterPassPhoneNumberInputDisabled",{get:function(){return!("hasMasterPassAccountAndHasRelation"!==this.checkMasterPassData.status||!this.cards.length)||("hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status||"noMasterPassAccount"===this.checkMasterPassData.status)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isSendConfirmationButtonDisabled",{get:function(){return this.isSaveCardToMasterPassPhoneNumberInputVisible?this.isSaveCardToMasterPassPhoneNumberInputDisabled?!this.saveCardToMasterPass.cardName:!this.saveCardToMasterPass.cardName||!this.saveCardToMasterPass.phoneNumber:!this.saveCardToMasterPass.cardName},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isLinkCardToClientVisible",{get:function(){return"linkCardToClient"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isOtpModalVisible",{get:function(){return"otpModalBank"===this.visibleModal||"otpModalMasterPass"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isResponseModalVisible",{get:function(){return!("mfsResponseModal"!==this.visibleModal||!this.mfsResponseModalText)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isSuccessModalVisible",{get:function(){return"linkCardToClientModalSuccess"===this.visibleModal||"otpModalSuccess"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"otpModalType",{get:function(){return"otpModalMasterPass"===this.visibleModal?"masterPassOtp":"bankOtp"},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"successModalType",{get:function(){return"hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status?"linkCardToClient":"register"},enumerable:!1,configurable:!0}),c.prototype.prepareFormData=function(e){var t=new FormData;return Object.entries(e).forEach((function(e){var s=e[0],a=e[1];return t.append(s,a)})),t},c}();export{c as MFS_ELEMENT_ID,u as MFS_SCRIPT_URL,m as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/component/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as d}from"./installments/index.js";import i from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import y from"next/dynamic";import u from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as v}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import E from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import g from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=y((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),C=y((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),h=t((function(t){var y=t.vm,h=c().t,k=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},G=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){return"STRIPE"===e.code},M=function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(C,{vm:y}),y.klarnaError&&e.createElement("div",{className:l.ErrorMessage},y.klarnaError.data)))):null},b=function(){var t=y.selectedPaymentGatewayIndex===y.adyenPaymentGatewayIndex;return y.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(f.AdyenSelectBox),onClick:function(){y.setPaymentGateway(y.adyenPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent}),e.createElement("div",{className:"".concat(t?f.BottomContent:""," ")},e.createElement(w,{vm:y,isSelected:t})))):null},T=function(){var t,a=y.selectedPaymentGatewayIndex===y.payPalPaymentGatewayIndex;return y.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.payPalPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.payPalPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,o){var r,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),v=c("9"),f=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},p&&e.createElement(g,null),x&&e.createElement(E,null),v&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===n.INTERNAL?y.installmentInfo&&e.createElement(d,{vm:y}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:f,rightContent:s,bottomContent:P,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new u,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{orderId:y.checkout.id,binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice,currencyCode:y.checkout.currencyCode}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod&&!y.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&y.klarnaPaymentGateway)return M();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&y.adyenPaymentGateway)return b();if(function(e){return"PAYPAL"===e.code}(t)&&y.payPalPaymentGateway)return T();var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(e.Fragment,null,e.createElement(P,{vm:y,pg:t}),y.stripeError&&e.createElement("div",{className:l.ErrorMessage},y.stripeError.data)):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:y}),y.installmentInfo&&e.createElement(d,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(G,null,I(t.additionalPrices[0])):e.createElement(k,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==o&&(y.setPaymentGateway(o),y.mpVM.selectedCard=void 0)}})})))}));export{h as PaymentGateways};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-form-data-input/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/component/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as d}from"./installments/index.js";import i from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import y from"next/dynamic";import u from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as v}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import E from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import g from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=y((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),C=y((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),h=t((function(t){var y=t.vm,h=c().t,k=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},G=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){return"STRIPE"===e.code},M=function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(C,{vm:y}),y.klarnaError&&e.createElement("div",{className:l.ErrorMessage},y.klarnaError.data)))):null},b=function(){var t=y.selectedPaymentGatewayIndex===y.adyenPaymentGatewayIndex;return y.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(f.AdyenSelectBox),onClick:function(){y.setPaymentGateway(y.adyenPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent}),e.createElement("div",{className:"".concat(t?f.BottomContent:""," ")},e.createElement(w,{vm:y,isSelected:t})))):null},T=function(){var t,a=y.selectedPaymentGatewayIndex===y.payPalPaymentGatewayIndex;return y.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.payPalPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.payPalPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,o){var r,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),v=c("9"),f=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},p&&e.createElement(g,null),x&&e.createElement(E,null),v&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===n.INTERNAL?y.installmentInfo&&e.createElement(d,{vm:y}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:f,rightContent:s,bottomContent:P,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new u,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{orderId:y.checkout.id,binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice,currencyCode:y.checkout.currencyCode}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod&&!y.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&y.klarnaPaymentGateway)return M();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&y.adyenPaymentGateway)return b();if(function(e){return"PAYPAL"===e.code}(t)&&y.payPalPaymentGateway)return T();var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(e.Fragment,null,e.createElement(P,{vm:y,pg:t}),y.stripeError&&e.createElement("div",{className:l.ErrorMessage},y.stripeError.data)):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:y}),y.installmentInfo&&e.createElement(d,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(G,null,I(t.additionalPrices[0])):e.createElement(k,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==o&&(y.setPaymentGateway(o),y.mpVM.selectedCard=void 0)}})})))}));export{h as PaymentGateways};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as a}from"../../components/button/index.js";import{CART_LS_KEY as o}from"../../../../store/cart/index.js";import s from"./style.module.scss.js";import r from"../../components/svg/success-circle.js";import i from"../../components/expandable-section/index.js";import n from"../../components/credit-card-form/svg/amex.js";import c from"../../components/credit-card-form/svg/master-card.js";import d from"../../components/credit-card-form/svg/troy.js";import l from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as m}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import"../../../../models/data/blog/category/index.js";import"../../../../models/data/blog/content/index.js";import"../../../../models/data/blog/meta-data/index.js";import"../../../../models/data/blog/tag/index.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import{IkasPaymentMethodType as p,IkasPaymentGatewayType as v,IkasOrderPackageStatus as E,IkasTransactionCardAssociation as f}from"@ikas/storefront-models";import"mobx";import"../../../../models/data/campaign-offer/index.js";import"../../../../models/data/cart/campaign-offer/index.js";import"../../../../models/data/cart/index.js";import"../../../../models/data/category/path-item/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/region/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/order/address/region/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/campaign-offer/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/stock-location/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/theme-json/index.js";import"../../../../models/data/theme-json/component/index.js";import"../../../../models/data/theme-json/custom-data/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/category-list/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/ikas-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 g from"../../components/offer-product/index.js";import{Analytics as h}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import{QuickRegistration as x}from"../../components/quick-registration/index.js";import{ProductFiles as k}from"../../components/product-files/index.js";import j from"../../components/offer-product/offer-arrows/index.js";import y from"../../components/offer-product/offer-dots/index.js";import T from"../../components/svg/shopping-bag.js";import{CartSummary as I}from"../../components/cart-summary/index.js";import N from"../../components/offer-product/useCampaignOffer.js";var A=t((function(t){var E,A,L,P,C,D,S,R,O,_,b,M=t.vm,w=u().t,F=N(M,!0),Y=F.setActiveIndex,U=F.setIsActiveOverlay,B=F.handlePrev,V=F.handleNext,z=F.isActiveOverlay,K=F.activeIndex,G=F.isMobile;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(o);e&&e===M.checkout.id&&(M.successTransaction&&h.purchase(M.checkout,M.successTransaction),localStorage.removeItem(o)),window&&window.handleKlarna&&window.handleKlarna(void 0)}}),[]);var H=((null===(E=M.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(A=M.checkout.customer)||void 0===A?void 0:A.lastName)||""),Q=((null===(L=M.checkout.shippingAddress)||void 0===L?void 0:L.firstName)||"")+" "+((null===(P=M.checkout.shippingAddress)||void 0===P?void 0:P.lastName)||""),q=M.paymentGateways.find((function(e){var t;return e.id===(null===(t=M.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),J=function(e){switch(e){case p.APP_PAYMENT:return w("checkout-page:appPayment");case p.BANK_REDIRECT:return w("checkout-page:bankRedirect");case p.BUY_ONLINE_PAY_AT_STORE:return w("checkout-page:buyOnlinePayAtStore");case p.CASH:return w("checkout-page:cash");case p.CASH_ON_DELIVERY:return w("checkout-page:cashOnDelivery");case p.CREDIT_CARD:return w("checkout-page:creditCard");case p.CREDIT_CARD_ON_DELIVERY:return w("checkout-page:creditCardOnDelivery");case p.DIRECT_DEBIT:return w("checkout-page:directDebit");case p.GIFT_CARD:return w("checkout-page:giftCard");case p.MONEY_ORDER:return w("checkout-page:moneyOrder");case p.OTHER:return w("checkout-page:other");case p.PAY_LATER:return w("checkout-page:payLater");case p.SLICE_IT:return w("checkout-page:sliceIt");case p.WALLET:return w("checkout-page:wallet");default:return""}},X=null===(C=M.successTransaction)||void 0===C?void 0:C.paymentMethodDetail,W=null===(D=M.successTransaction)||void 0===D?void 0:D.paymentGatewayCode,Z=e.useMemo((function(){var t,a,o,r,i,u,E;return e.createElement("div",{className:[s.InfoGrid].join(" ")},!M.isFree&&e.createElement("div",null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:paymentMethod")),q&&e.createElement(e.Fragment,null,!!q.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:q.logoUrl})),!q.logoUrl&&e.createElement("div",{className:s.InfoText},q.paymentMethodType===p.CREDIT_CARD&&q.type===v.INTERNAL?w("checkout-page:creditCard"):q.name),"STRIPE"!==q.code&&"PAYPAL"!==q.code&&"KLARNA"!==q.code||!(null===(t=M.successTransaction)||void 0===t?void 0:t.paymentMethod)?!!q.description&&q.type!==v.EXTERNAL&&e.createElement("div",{className:s.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:q.description}})):e.createElement("div",{className:s.InfoText},J(M.successTransaction.paymentMethod))),"E_PAY_KOLAY"===W&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.EPayKolayLogoContainer},e.createElement("img",{src:"https://cdn.myikas.com/sf/assets/payment/epaykolay.png"})),!!(null===(a=M.successTransaction)||void 0===a?void 0:a.paymentMethod)&&e.createElement("div",{className:s.InfoText},J(null===(o=M.successTransaction)||void 0===o?void 0:o.paymentMethod))),"E_PAY_KOLAY"!==W&&"STRIPE"!==W&&"PAYPAL"!==W&&"KLARNA"!==W&&"CREDIT_CARD"===(null===(r=M.successTransaction)||void 0===r?void 0:r.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.InfoText},e.createElement("div",{className:s.CardLogoContainer},function(){var t,a;switch(null===(a=null===(t=M.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation){case f.AMERICAN_EXPRESS:return e.createElement(n,null);case f.MASTER_CARD:return e.createElement(c,null);case f.TROY:return e.createElement(d,null);case f.VISA:return e.createElement(l,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==X?void 0:X.lastFourDigits)||""))),(null===(i=null==X?void 0:X.installment)||void 0===i?void 0:i.installmentCount)&&X.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.InfoText},"".concat(X.installment.installmentCount," ").concat(w("checkout-page:installments"))),null!==X.installment.installmentPrice&&e.createElement("div",{className:s.InfoText},"".concat(X.installment.installmentCount," x ").concat(m(X.installment.installmentPrice,M.checkout.currencyCode,M.checkout.currencySymbol)))))),e.createElement("div",null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:billingAddress")),!!(null===(u=M.checkout.billingAddress)||void 0===u?void 0:u.company)&&e.createElement("div",{className:[s.InfoText,s.InfoTextBold].join(" ")},M.checkout.billingAddress.company),e.createElement("div",{className:s.InfoText},null===(E=M.checkout.billingAddress)||void 0===E?void 0:E.addressText)))}),[]),$=e.useMemo((function(){return e.createElement(I,{vm:M,isSuccessPageSummary:!0})}),[]),ee=e.useMemo((function(){var t,a,o,r,i;return e.createElement("div",{className:[s.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:contactInfo")),e.createElement("div",{className:s.InfoText},null===(t=M.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:s.InfoText},H),!!(null===(a=M.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&e.createElement("div",{className:s.InfoText},null===(o=M.checkout.shippingAddress)||void 0===o?void 0:o.phone)),e.createElement("div",null,"in-store"===M.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:receiver")),e.createElement("div",{className:[s.InfoText,s.withMBottom].join(" ")},Q)),e.createElement("div",{className:s.InfoTitle},"address"===M.deliveryMethod?w("checkout-page:shippingAddress"):w("checkout-page:pickUpLocation")),!!(null===(r=M.checkout.shippingAddress)||void 0===r?void 0:r.company)&&e.createElement("div",{className:[s.InfoText,s.InfoTextBold].join(" ")},M.checkout.shippingAddress.company),e.createElement("div",{className:s.InfoText},null===(i=M.checkout.shippingAddress)||void 0===i?void 0:i.addressText)))}),[]),te=!!(null===(S=M.customizationProps)||void 0===S?void 0:S.campaignOffersEnableMiddlePhase)&&!!(null===(R=M.customizationProps)||void 0===R?void 0:R.showCampaignIsBiggerImage)&&G&&z,ae=!!(null===(O=M.customizationProps)||void 0===O?void 0:O.campaignOffersEnableMiddlePhase)&&!!(null===(_=M.customizationProps)||void 0===_?void 0:_.showCampaignIsBiggerImage)&&G&&!z;return e.createElement(e.Fragment,null,!!(null===(b=M.customizationProps)||void 0===b?void 0:b.campaignOffersEnableMiddlePhase)&&z&&M.campaignOffers&&M.campaignOffers.length>0&&G&&e.createElement("div",{className:[s.MiddlePhaseOverlay,te?s.MiddlePhaseOverlayPopup:""].join(" ")}),M.campaignOffers&&!!M.campaignOffers.length&&M.isCampaignOfferLoaded&&e.createElement("div",{className:[s.CampaignOfferMain,te?s.OverlayPopupMain:""].join(" ")},e.createElement("div",{className:s.OfferSlider},M.campaignOffers.map((function(t,a){var o;return e.createElement(g,{vm:M,campaignOffer:t,index:a,activeIndex:K,offersLength:(null===(o=M.campaignOffers)||void 0===o?void 0:o.length)||0,handlePrev:B,handleNext:V,setActiveIndex:function(e){return Y(e)},isPopupShow:te,closePopup:function(){return U(!1)},isPopupClosed:ae,showPopup:function(){return U(!0)},step:M.step})}))),M.campaignOffers.length>1&&e.createElement(j,{handlePrev:B,handleNext:V}),M.campaignOffers.length>1&&e.createElement(y,{isPopupShow:te,vm:M,activeIndex:K})),e.createElement("div",{className:s.StepSuccess},e.createElement("div",{className:s.SuccessTitleContainer},e.createElement(r,{className:s.SuccessCircle}),e.createElement("span",{className:s.SuccessTitle},w("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:s.SuccessSubTitle},w(M.isDigitalOnly?"checkout-page:orderSuccessDigitalOnlyDescription":"address"===M.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:H})),M.productFiles.length>0&&e.createElement(k,{vm:M}),e.createElement("div",null,e.createElement("div",{className:s.OrderSummaryMain},e.createElement("div",null,e.createElement("span",{className:s.InfoTitle},w("checkout-page:orderNo")),e.createElement("span",{className:s.InfoText},"#"+(M.checkout.orderNumber||""))),e.createElement("div",null,e.createElement("span",{className:s.InfoTitle},w("checkout-page:orderDate")),e.createElement("span",{className:s.InfoText},M.checkout.dateStr)),e.createElement("div",{className:s.OrderAmountInfoMain},e.createElement("span",{className:s.InfoTitle},w("checkout-page:orderAmount")),e.createElement("span",{className:s.OrderAmountInfo},e.createElement("span",null,"".concat(m(M.finalPrice||0,M.checkout.currencyCode,M.checkout.currencySymbol))),e.createElement("span",{className:s.Slash},"/"),e.createElement("span",{className:s.OrderItemCount},e.createElement(T,null),e.createElement("span",null," ",M.checkout.itemQuantity," ",w("checkout-page:cartItemProduct"))))))),M.hasQuickRegistration&&e.createElement(x,{vm:M}),e.createElement("div",{className:s.HideOnDesktop},e.createElement(i,{title:w("checkout-page:summary")},$)),e.createElement(i,{title:w("checkout-page:paymentSummary")},Z),!M.isDigitalOnly&&e.createElement(i,{title:w("checkout-page:shippingSummary")},ee),e.createElement("div",{className:s.Actions},e.createElement("div",{className:s.HelpText},e.createElement("span",null,w("checkout-page:helpCtaQuestion")),e.createElement("span",{style:{marginLeft:"4px"},className:s.Cta,onClick:function(){return M.setContactModalVisible(!0)}},w("checkout-page:helpCta"))),e.createElement(a,{text:w("checkout-page:actions.backToShopping"),onClick:M.onBackToShoppingClick,style:{flex:"0 0 auto"}}))))}));t((function(t){var a,o=t.vm,r=u().t,i=s.Yellow;switch(o.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:i=s.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:i=s.Red}return e.createElement("div",{className:[s.OrderStatus,i].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[E.UNFULFILLED],text:r("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:r("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:r("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:r("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED],text:r("checkout-page:orderPackageStatus.delivered")},{types:[E.PARTIALLY_DELIVERED],text:r("checkout-page:orderPackageStatus.partiallyDelivered")},{types:[E.UNABLE_TO_DELIVER],text:r("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:r("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:r("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:r("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:r("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:r("checkout-page:orderPackageStatus.refundRejected")},{types:[E.REFUND_REQUESTED],text:r("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(o.checkout.orderPackageStatus)})))||void 0===a?void 0:a.text:"")}));export{A as StepSuccess};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as a}from"../../components/button/index.js";import{CART_LS_KEY as o}from"../../../../store/cart/index.js";import s from"./style.module.scss.js";import r from"../../components/svg/success-circle.js";import i from"../../components/expandable-section/index.js";import n from"../../components/credit-card-form/svg/amex.js";import c from"../../components/credit-card-form/svg/master-card.js";import d from"../../components/credit-card-form/svg/troy.js";import l from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as m}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import"../../../../models/data/blog/category/index.js";import"../../../../models/data/blog/content/index.js";import"../../../../models/data/blog/meta-data/index.js";import"../../../../models/data/blog/tag/index.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import{IkasPaymentMethodType as p,IkasPaymentGatewayType as v,IkasOrderPackageStatus as E,IkasTransactionCardAssociation as f}from"@ikas/storefront-models";import"mobx";import"../../../../models/data/campaign-offer/index.js";import"../../../../models/data/cart/campaign-offer/index.js";import"../../../../models/data/cart/index.js";import"../../../../models/data/category/path-item/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/region/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-form-data-input/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/order/address/region/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/campaign-offer/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/stock-location/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/theme-json/index.js";import"../../../../models/data/theme-json/component/index.js";import"../../../../models/data/theme-json/custom-data/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/category-list/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/ikas-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 g from"../../components/offer-product/index.js";import{Analytics as h}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import{QuickRegistration as x}from"../../components/quick-registration/index.js";import{ProductFiles as k}from"../../components/product-files/index.js";import j from"../../components/offer-product/offer-arrows/index.js";import y from"../../components/offer-product/offer-dots/index.js";import T from"../../components/svg/shopping-bag.js";import{CartSummary as I}from"../../components/cart-summary/index.js";import N from"../../components/offer-product/useCampaignOffer.js";var A=t((function(t){var E,A,L,P,C,D,S,R,O,_,b,M=t.vm,w=u().t,F=N(M,!0),Y=F.setActiveIndex,U=F.setIsActiveOverlay,B=F.handlePrev,V=F.handleNext,z=F.isActiveOverlay,K=F.activeIndex,G=F.isMobile;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(o);e&&e===M.checkout.id&&(M.successTransaction&&h.purchase(M.checkout,M.successTransaction),localStorage.removeItem(o)),window&&window.handleKlarna&&window.handleKlarna(void 0)}}),[]);var H=((null===(E=M.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(A=M.checkout.customer)||void 0===A?void 0:A.lastName)||""),Q=((null===(L=M.checkout.shippingAddress)||void 0===L?void 0:L.firstName)||"")+" "+((null===(P=M.checkout.shippingAddress)||void 0===P?void 0:P.lastName)||""),q=M.paymentGateways.find((function(e){var t;return e.id===(null===(t=M.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),J=function(e){switch(e){case p.APP_PAYMENT:return w("checkout-page:appPayment");case p.BANK_REDIRECT:return w("checkout-page:bankRedirect");case p.BUY_ONLINE_PAY_AT_STORE:return w("checkout-page:buyOnlinePayAtStore");case p.CASH:return w("checkout-page:cash");case p.CASH_ON_DELIVERY:return w("checkout-page:cashOnDelivery");case p.CREDIT_CARD:return w("checkout-page:creditCard");case p.CREDIT_CARD_ON_DELIVERY:return w("checkout-page:creditCardOnDelivery");case p.DIRECT_DEBIT:return w("checkout-page:directDebit");case p.GIFT_CARD:return w("checkout-page:giftCard");case p.MONEY_ORDER:return w("checkout-page:moneyOrder");case p.OTHER:return w("checkout-page:other");case p.PAY_LATER:return w("checkout-page:payLater");case p.SLICE_IT:return w("checkout-page:sliceIt");case p.WALLET:return w("checkout-page:wallet");default:return""}},X=null===(C=M.successTransaction)||void 0===C?void 0:C.paymentMethodDetail,W=null===(D=M.successTransaction)||void 0===D?void 0:D.paymentGatewayCode,Z=e.useMemo((function(){var t,a,o,r,i,u,E;return e.createElement("div",{className:[s.InfoGrid].join(" ")},!M.isFree&&e.createElement("div",null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:paymentMethod")),q&&e.createElement(e.Fragment,null,!!q.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:q.logoUrl})),!q.logoUrl&&e.createElement("div",{className:s.InfoText},q.paymentMethodType===p.CREDIT_CARD&&q.type===v.INTERNAL?w("checkout-page:creditCard"):q.name),"STRIPE"!==q.code&&"PAYPAL"!==q.code&&"KLARNA"!==q.code||!(null===(t=M.successTransaction)||void 0===t?void 0:t.paymentMethod)?!!q.description&&q.type!==v.EXTERNAL&&e.createElement("div",{className:s.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:q.description}})):e.createElement("div",{className:s.InfoText},J(M.successTransaction.paymentMethod))),"E_PAY_KOLAY"===W&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.EPayKolayLogoContainer},e.createElement("img",{src:"https://cdn.myikas.com/sf/assets/payment/epaykolay.png"})),!!(null===(a=M.successTransaction)||void 0===a?void 0:a.paymentMethod)&&e.createElement("div",{className:s.InfoText},J(null===(o=M.successTransaction)||void 0===o?void 0:o.paymentMethod))),"E_PAY_KOLAY"!==W&&"STRIPE"!==W&&"PAYPAL"!==W&&"KLARNA"!==W&&"CREDIT_CARD"===(null===(r=M.successTransaction)||void 0===r?void 0:r.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.InfoText},e.createElement("div",{className:s.CardLogoContainer},function(){var t,a;switch(null===(a=null===(t=M.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation){case f.AMERICAN_EXPRESS:return e.createElement(n,null);case f.MASTER_CARD:return e.createElement(c,null);case f.TROY:return e.createElement(d,null);case f.VISA:return e.createElement(l,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==X?void 0:X.lastFourDigits)||""))),(null===(i=null==X?void 0:X.installment)||void 0===i?void 0:i.installmentCount)&&X.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.InfoText},"".concat(X.installment.installmentCount," ").concat(w("checkout-page:installments"))),null!==X.installment.installmentPrice&&e.createElement("div",{className:s.InfoText},"".concat(X.installment.installmentCount," x ").concat(m(X.installment.installmentPrice,M.checkout.currencyCode,M.checkout.currencySymbol)))))),e.createElement("div",null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:billingAddress")),!!(null===(u=M.checkout.billingAddress)||void 0===u?void 0:u.company)&&e.createElement("div",{className:[s.InfoText,s.InfoTextBold].join(" ")},M.checkout.billingAddress.company),e.createElement("div",{className:s.InfoText},null===(E=M.checkout.billingAddress)||void 0===E?void 0:E.addressText)))}),[]),$=e.useMemo((function(){return e.createElement(I,{vm:M,isSuccessPageSummary:!0})}),[]),ee=e.useMemo((function(){var t,a,o,r,i;return e.createElement("div",{className:[s.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:contactInfo")),e.createElement("div",{className:s.InfoText},null===(t=M.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:s.InfoText},H),!!(null===(a=M.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&e.createElement("div",{className:s.InfoText},null===(o=M.checkout.shippingAddress)||void 0===o?void 0:o.phone)),e.createElement("div",null,"in-store"===M.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:s.InfoTitle},w("checkout-page:receiver")),e.createElement("div",{className:[s.InfoText,s.withMBottom].join(" ")},Q)),e.createElement("div",{className:s.InfoTitle},"address"===M.deliveryMethod?w("checkout-page:shippingAddress"):w("checkout-page:pickUpLocation")),!!(null===(r=M.checkout.shippingAddress)||void 0===r?void 0:r.company)&&e.createElement("div",{className:[s.InfoText,s.InfoTextBold].join(" ")},M.checkout.shippingAddress.company),e.createElement("div",{className:s.InfoText},null===(i=M.checkout.shippingAddress)||void 0===i?void 0:i.addressText)))}),[]),te=!!(null===(S=M.customizationProps)||void 0===S?void 0:S.campaignOffersEnableMiddlePhase)&&!!(null===(R=M.customizationProps)||void 0===R?void 0:R.showCampaignIsBiggerImage)&&G&&z,ae=!!(null===(O=M.customizationProps)||void 0===O?void 0:O.campaignOffersEnableMiddlePhase)&&!!(null===(_=M.customizationProps)||void 0===_?void 0:_.showCampaignIsBiggerImage)&&G&&!z;return e.createElement(e.Fragment,null,!!(null===(b=M.customizationProps)||void 0===b?void 0:b.campaignOffersEnableMiddlePhase)&&z&&M.campaignOffers&&M.campaignOffers.length>0&&G&&e.createElement("div",{className:[s.MiddlePhaseOverlay,te?s.MiddlePhaseOverlayPopup:""].join(" ")}),M.campaignOffers&&!!M.campaignOffers.length&&M.isCampaignOfferLoaded&&e.createElement("div",{className:[s.CampaignOfferMain,te?s.OverlayPopupMain:""].join(" ")},e.createElement("div",{className:s.OfferSlider},M.campaignOffers.map((function(t,a){var o;return e.createElement(g,{vm:M,campaignOffer:t,index:a,activeIndex:K,offersLength:(null===(o=M.campaignOffers)||void 0===o?void 0:o.length)||0,handlePrev:B,handleNext:V,setActiveIndex:function(e){return Y(e)},isPopupShow:te,closePopup:function(){return U(!1)},isPopupClosed:ae,showPopup:function(){return U(!0)},step:M.step})}))),M.campaignOffers.length>1&&e.createElement(j,{handlePrev:B,handleNext:V}),M.campaignOffers.length>1&&e.createElement(y,{isPopupShow:te,vm:M,activeIndex:K})),e.createElement("div",{className:s.StepSuccess},e.createElement("div",{className:s.SuccessTitleContainer},e.createElement(r,{className:s.SuccessCircle}),e.createElement("span",{className:s.SuccessTitle},w("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:s.SuccessSubTitle},w(M.isDigitalOnly?"checkout-page:orderSuccessDigitalOnlyDescription":"address"===M.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:H})),M.productFiles.length>0&&e.createElement(k,{vm:M}),e.createElement("div",null,e.createElement("div",{className:s.OrderSummaryMain},e.createElement("div",null,e.createElement("span",{className:s.InfoTitle},w("checkout-page:orderNo")),e.createElement("span",{className:s.InfoText},"#"+(M.checkout.orderNumber||""))),e.createElement("div",null,e.createElement("span",{className:s.InfoTitle},w("checkout-page:orderDate")),e.createElement("span",{className:s.InfoText},M.checkout.dateStr)),e.createElement("div",{className:s.OrderAmountInfoMain},e.createElement("span",{className:s.InfoTitle},w("checkout-page:orderAmount")),e.createElement("span",{className:s.OrderAmountInfo},e.createElement("span",null,"".concat(m(M.finalPrice||0,M.checkout.currencyCode,M.checkout.currencySymbol))),e.createElement("span",{className:s.Slash},"/"),e.createElement("span",{className:s.OrderItemCount},e.createElement(T,null),e.createElement("span",null," ",M.checkout.itemQuantity," ",w("checkout-page:cartItemProduct"))))))),M.hasQuickRegistration&&e.createElement(x,{vm:M}),e.createElement("div",{className:s.HideOnDesktop},e.createElement(i,{title:w("checkout-page:summary")},$)),e.createElement(i,{title:w("checkout-page:paymentSummary")},Z),!M.isDigitalOnly&&e.createElement(i,{title:w("checkout-page:shippingSummary")},ee),e.createElement("div",{className:s.Actions},e.createElement("div",{className:s.HelpText},e.createElement("span",null,w("checkout-page:helpCtaQuestion")),e.createElement("span",{style:{marginLeft:"4px"},className:s.Cta,onClick:function(){return M.setContactModalVisible(!0)}},w("checkout-page:helpCta"))),e.createElement(a,{text:w("checkout-page:actions.backToShopping"),onClick:M.onBackToShoppingClick,style:{flex:"0 0 auto"}}))))}));t((function(t){var a,o=t.vm,r=u().t,i=s.Yellow;switch(o.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:i=s.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:i=s.Red}return e.createElement("div",{className:[s.OrderStatus,i].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[E.UNFULFILLED],text:r("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:r("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:r("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:r("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED],text:r("checkout-page:orderPackageStatus.delivered")},{types:[E.PARTIALLY_DELIVERED],text:r("checkout-page:orderPackageStatus.partiallyDelivered")},{types:[E.UNABLE_TO_DELIVER],text:r("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:r("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:r("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:r("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:r("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:r("checkout-page:orderPackageStatus.refundRejected")},{types:[E.REFUND_REQUESTED],text:r("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(o.checkout.orderPackageStatus)})))||void 0===a?void 0:a.text:"")}));export{A as StepSuccess};
@@ -1 +1 @@
1
- import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import a from"next/head.js";import{useRouter as i}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../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/ikas-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{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as c}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var l=o((function(o){var s,l,g,v=o.pageType,f=o.pageTitle,h=o.pageDescription,j=o.canonicals,x=o.disableIndex,y=o.pageSpecificData,b=o.merchantSettings,C=o.addOgpMetas,k=o.productReviewSummary,D=o.pageComponentPropValues,T=i(),w="undefined"!=typeof window,L="local"===process.env.NEXT_PUBLIC_ENV,P=T.asPath.split("?")[0].replace("/",""),E=(P="/"===P.charAt(P.length-1)?P.slice(0,-1):P).startsWith("pages/"),O=d.getCurrentRouting(),R=(null==O?void 0:O.path)?"/"+O.path:"",I=L?"http://localhost:3333":"https://"+d.getDomain(),_=null===(s=d.getIndexPageSeoSettings())||void 0===s?void 0:s.find((function(e){return e.locale===d.getCurrentLocale()})),S=_?new n(_):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[v,y]);var V=t.useMemo((function(){if(y&&y.href)return"".concat(I).concat(y.href)}),[y]),A=t.useMemo((function(){var e,t,o=[];if(C){if(o.push({property:"og:type",content:"website"}),o.push({property:"og:site_name",content:"https://"+d.getDomain()}),f&&o.push({property:"og:title",content:f}),h&&o.push({property:"og:description",content:h}),v===r.INDEX){var a=null,i=null;!f&&(null==S?void 0:S.pageTitle)&&(a=S.pageTitle),!h&&(null==S?void 0:S.description)&&(i=S.description);var n=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));n&&(a=u(y,v,n.titleTemplate||""),i=u(y,v,n.descriptionTemplate||"")),a&&o.push({property:"og:title",content:a}),i&&o.push({property:"og:description",content:i})}if(o.push({property:"og:url",content:V||(w?window.location.href:"")||"https://".concat(d.getDomain())}),y&&v===r.PRODUCT){var s=y.selectedVariant.mainImage;(null==s?void 0:s.image)&&o.push({property:"og:image",content:s.image.src.replace(".webp",".jpg")})}else(null==S?void 0:S.icon)?o.push({property:"og:image",content:null===(t=null==S?void 0:S.icon)||void 0===t?void 0:t.src.replace(".webp",".jpg")}):(null==b?void 0:b.logo)&&o.push({property:"og:image",content:b.logo.src.replace(".webp",".jpg")});if(y&&v===r.CATEGORY){var c=y;c.image&&o.push({property:"og:image",content:c.image.src.replace(".webp",".jpg")})}if(y&&v===r.BRAND){var l=y;l.image&&o.push({property:"og:image",content:l.image.src.replace(".webp",".jpg")})}}return o}),[f,y,V,h,b,C,b]),N=t.useMemo((function(){var t=[];if(b){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,a,i,r,n,s,c=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:c,image:c,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(i=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===i?void 0:i.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(b);t.push(o),t.push(a)}if(y&&v===r.PRODUCT){var i=y,n=function(t,o){var a,i,r,n,s;try{var c=d.getCurrentRouting(),l=null==c?void 0:c.path,m=function(e){return l?"https://".concat(d.getDomain(),"/").concat(l).concat(e):"https://".concat(d.getDomain()).concat(e)},p=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(i=p.images)||void 0===i?void 0:i.map((function(e){return e.image?e.image.src:""})),productId:p.id,sku:p.sku,mpn:(null===(r=p.barcodeList)||void 0===r?void 0:r.length)?p.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=t.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:m(t.href),priceCurrency:p.price.currency||"TRY",price:(null!==(s=p.campaignPrice)&&void 0!==s?s:p.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:p.stock>0||p.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(i,k||null);if(n&&t.push(n),i.categories.length)(c=m(i.categories[0],i))&&t.push(c)}if(y&&v===r.CATEGORY){var s=function(e){var t,o;try{var a=d.getCurrentRouting(),i=null==a?void 0:a.path,r=function(e){return i?"https://".concat(d.getDomain(),"/").concat(i).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(y),c=m(y),l=p(D);s&&t.push(s),c&&t.push(c),l&&t.push(l)}y&&v===r.BRAND&&((l=p(D))&&t.push(l));if(y&&v===r.BLOG){var u=function(t){var o;try{var a="https://".concat(d.getDomain()).concat(t.href),i=function(e){var t=new Date(e),o=t.getFullYear(),a=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(a,"-").concat(i)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:a,datePublished:i(t.createdAt),dateCreated:i(t.createdAt),dateModified:i(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(y);u&&t.push(u)}return t}),[y,b]),M=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));return t?u(y,v,t.titleTemplate||""):null}),[v,y]),B=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));return t?u(y,v,t.descriptionTemplate||""):null}),[v,y]),U=t.useMemo((function(){return!d.getFavicon()&&(null==S?void 0:S.favIcon)?S.favIcon:null}),[]),F=t.useCallback((function(){var e=d.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),G=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){G.push({routing:e,hrefLang:e.locale+"-"+t})})):G.push({routing:e,hrefLang:e.locale})}));var Y=function(e){var t,o,a,i,r,n=y,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=G.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(i=null===(a=null==n?void 0:n.metaData)||void 0===a?void 0:a.translations)||void 0===i?void 0:i.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},H=c.getInstance();return t.createElement(a,null,t.createElement("title",null,f||M||(null==S?void 0:S.pageTitle)||""),t.createElement("meta",{name:"description",content:h||B||(null==S?void 0:S.description)||""}),v===r.CHECKOUT&&F()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/".concat((null===(l=d.getApiUrl())||void 0===l?void 0:l.includes("myikas.com"))?"epay":"epay-uat","/").concat((null===(g=d.getApiUrl())||void 0===g?void 0:g.includes("myikas.com"))?"containerServices":"containerServicesTest",".js")}),G.length>1&&G.filter((function(e){return!E||e.routing.id===(null==O?void 0:O.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(I+(e.routing.path?"/"+e.routing.path:""),"/").concat(Y(e.routing))})})),!!x&&t.createElement("meta",{name:"robots",content:"noindex"}),!!C&&A.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!j&&j.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(I).concat(R).concat(e)})})),U&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(U,"/image_180.webp"),type:"image/webp"}),!j&&H.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(I).concat(R,"/").concat(P)}),!!N.length&&N.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function m(e,t){try{var o=c.getInstance(),a=d.getCurrentRouting(),i=null==a?void 0:a.path,n=function(e){return i?"https://".concat(d.getDomain(),"/").concat(i).concat(e):"https://".concat(d.getDomain()).concat(e)},s=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:n(e.href)}}));return s.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:n(e.href)}),o.currentPageType===r.PRODUCT&&t&&s.push({"@type":"ListItem",position:s.length+1,name:t.name,item:n(t.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:s}}catch(e){}}function p(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var a=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(a){var i=Object.values(a.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(i)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(i.data||[]).slice(0,10).map((function(e,t){var a,i,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(i=null===(a=e.selectedVariant.mainImage)||void 0===a?void 0:a.image)||void 0===i?void 0:i.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var a,i,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,c=(null===(a=s.brand)||void 0===a?void 0:a.name)||"",l=s.selectedVariant.sku||"",m=(null===(i=s.selectedVariant.barcodeList)||void 0===i?void 0:i.length)?s.selectedVariant.barcodeList[0]:"",p=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",c)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",l)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",m)),n.includes("{{price}}")&&(n=g(n,"{{price}}",p.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var v=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",v))}}catch(e){}return n.trimEnd()}function g(e,t,o){var a=new RegExp(t,"g");return e.replace(a,o)}export{l as IkasPageHead};
1
+ import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import a from"next/head.js";import{useRouter as i}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../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/ikas-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{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as c}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var l=o((function(o){var s,l,g,v=o.pageType,f=o.pageTitle,h=o.pageDescription,j=o.canonicals,x=o.disableIndex,y=o.pageSpecificData,b=o.merchantSettings,C=o.addOgpMetas,k=o.productReviewSummary,D=o.pageComponentPropValues,T=i(),w="undefined"!=typeof window,L="local"===process.env.NEXT_PUBLIC_ENV,P=T.asPath.split("?")[0].replace("/",""),E=(P="/"===P.charAt(P.length-1)?P.slice(0,-1):P).startsWith("pages/"),O=d.getCurrentRouting(),R=(null==O?void 0:O.path)?"/"+O.path:"",I=L?"http://localhost:3333":"https://"+d.getDomain(),_=null===(s=d.getIndexPageSeoSettings())||void 0===s?void 0:s.find((function(e){return e.locale===d.getCurrentLocale()})),S=_?new n(_):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[v,y]);var V=t.useMemo((function(){if(y&&y.href)return"".concat(I).concat(y.href)}),[y]),A=t.useMemo((function(){var e,t,o=[];if(C){if(o.push({property:"og:type",content:"website"}),o.push({property:"og:site_name",content:"https://"+d.getDomain()}),f&&o.push({property:"og:title",content:f}),h&&o.push({property:"og:description",content:h}),v===r.INDEX){var a=null,i=null;!f&&(null==S?void 0:S.pageTitle)&&(a=S.pageTitle),!h&&(null==S?void 0:S.description)&&(i=S.description);var n=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));n&&(a=u(y,v,n.titleTemplate||""),i=u(y,v,n.descriptionTemplate||"")),a&&o.push({property:"og:title",content:a}),i&&o.push({property:"og:description",content:i})}if(o.push({property:"og:url",content:V||(w?window.location.href:"")||"https://".concat(d.getDomain())}),y&&v===r.PRODUCT){var s=y.selectedVariant.mainImage;(null==s?void 0:s.image)&&o.push({property:"og:image",content:s.image.src.replace(".webp",".jpg")})}else(null==S?void 0:S.icon)?o.push({property:"og:image",content:null===(t=null==S?void 0:S.icon)||void 0===t?void 0:t.src.replace(".webp",".jpg")}):(null==b?void 0:b.logo)&&o.push({property:"og:image",content:b.logo.src.replace(".webp",".jpg")});if(y&&v===r.CATEGORY){var c=y;c.image&&o.push({property:"og:image",content:c.image.src.replace(".webp",".jpg")})}if(y&&v===r.BRAND){var l=y;l.image&&o.push({property:"og:image",content:l.image.src.replace(".webp",".jpg")})}}return o}),[f,y,V,h,b,C,b]),N=t.useMemo((function(){var t=[];if(b){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,a,i,r,n,s,c=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:c,image:c,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(i=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===i?void 0:i.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(b);t.push(o),t.push(a)}if(y&&v===r.PRODUCT){var i=y,n=function(t,o){var a,i,r,n,s;try{var c=d.getCurrentRouting(),l=null==c?void 0:c.path,m=function(e){return l?"https://".concat(d.getDomain(),"/").concat(l).concat(e):"https://".concat(d.getDomain()).concat(e)},p=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(i=p.images)||void 0===i?void 0:i.map((function(e){return e.image?e.image.src:""})),productId:p.id,sku:p.sku,mpn:(null===(r=p.barcodeList)||void 0===r?void 0:r.length)?p.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=t.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:m(t.href),priceCurrency:p.price.currency||"TRY",price:(null!==(s=p.campaignPrice)&&void 0!==s?s:p.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:p.stock>0||p.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(i,k||null);if(n&&t.push(n),i.categories.length)(c=m(i.categories[0],i))&&t.push(c)}if(y&&v===r.CATEGORY){var s=function(e){var t,o;try{var a=d.getCurrentRouting(),i=null==a?void 0:a.path,r=function(e){return i?"https://".concat(d.getDomain(),"/").concat(i).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(y),c=m(y),l=p(D);s&&t.push(s),c&&t.push(c),l&&t.push(l)}y&&v===r.BRAND&&((l=p(D))&&t.push(l));if(y&&v===r.BLOG){var u=function(t){var o;try{var a="https://".concat(d.getDomain()).concat(t.href),i=function(e){var t=new Date(e),o=t.getFullYear(),a=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(a,"-").concat(i)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:a,datePublished:i(t.createdAt),dateCreated:i(t.createdAt),dateModified:i(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(y);u&&t.push(u)}return t}),[y,b]),M=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));return t?u(y,v,t.titleTemplate||""):null}),[v,y]),B=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));return t?u(y,v,t.descriptionTemplate||""):null}),[v,y]),U=t.useMemo((function(){return!d.getFavicon()&&(null==S?void 0:S.favIcon)?S.favIcon:null}),[]),F=t.useCallback((function(){var e=d.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),G=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){G.push({routing:e,hrefLang:e.locale+"-"+t})})):G.push({routing:e,hrefLang:e.locale})}));var Y=function(e){var t,o,a,i,r,n=y,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=G.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(i=null===(a=null==n?void 0:n.metaData)||void 0===a?void 0:a.translations)||void 0===i?void 0:i.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},H=c.getInstance();return t.createElement(a,null,t.createElement("title",null,f||M||(null==S?void 0:S.pageTitle)||""),t.createElement("meta",{name:"description",content:h||B||(null==S?void 0:S.description)||""}),v===r.CHECKOUT&&F()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/".concat((null===(l=d.getApiUrl())||void 0===l?void 0:l.includes("myikas.com"))?"epay":"epay-uat","/").concat((null===(g=d.getApiUrl())||void 0===g?void 0:g.includes("myikas.com"))?"containerServices":"containerServicesTest",".js")}),G.length>1&&G.filter((function(e){return!E||e.routing.id===(null==O?void 0:O.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(I+(e.routing.path?"/"+e.routing.path:""),"/").concat(Y(e.routing))})})),!!x&&t.createElement("meta",{name:"robots",content:"noindex"}),!!C&&A.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!j&&j.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(I).concat(R).concat(e)})})),U&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(U,"/image_180.webp"),type:"image/webp"}),!j&&H.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(I).concat(R,"/").concat(P)}),!!N.length&&N.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function m(e,t){try{var o=c.getInstance(),a=d.getCurrentRouting(),i=null==a?void 0:a.path,n=function(e){return i?"https://".concat(d.getDomain(),"/").concat(i).concat(e):"https://".concat(d.getDomain()).concat(e)},s=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:n(e.href)}}));return s.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:n(e.href)}),o.currentPageType===r.PRODUCT&&t&&s.push({"@type":"ListItem",position:s.length+1,name:t.name,item:n(t.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:s}}catch(e){}}function p(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var a=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(a){var i=Object.values(a.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(i)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(i.data||[]).slice(0,10).map((function(e,t){var a,i,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(i=null===(a=e.selectedVariant.mainImage)||void 0===a?void 0:a.image)||void 0===i?void 0:i.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var a,i,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,c=(null===(a=s.brand)||void 0===a?void 0:a.name)||"",l=s.selectedVariant.sku||"",m=(null===(i=s.selectedVariant.barcodeList)||void 0===i?void 0:i.length)?s.selectedVariant.barcodeList[0]:"",p=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",c)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",l)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",m)),n.includes("{{price}}")&&(n=g(n,"{{price}}",p.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var v=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",v))}}catch(e){}return n.trimEnd()}function g(e,t,o){var a=new RegExp(t,"g");return e.replace(a,o)}export{l as IkasPageHead};
@@ -1 +1 @@
1
- import{__assign as e,__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as r}from"mobx-react-lite";import{useRouter as a}from"next/router.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as s}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as d}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import{IkasThemeJsonCustomData as n}from"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/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/ikas-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{IkasStorefrontConfig as m}from"@ikas/storefront-config";import{Analytics as l}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasPageHead as p}from"./head.js";import{ThemeComponent as c}from"./ThemeComponent.js";import{IkasBaseStore as u}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{initIkasEvents as f}from"../../analytics/events.js";import{IkasPageDataInit as j}from"../../page-data-init/index.js";import{setAPIClientConfig as g}from"@ikas/storefront-api";var x=r((function(r){var c=r.propValues,x=r.themeJsonComponents,y=r.customDataList,h=r.pageType,w=r.pageTitle,b=r.pageDescription,S=r.pageSpecificData,C=r.canonicals,P=r.disableIndex,k=r.settings,D=r.configJson,T=r.reInitOnBrowser,I=r.addOgpMetas,E=r.components,M=r.productReviewSummary,V=a(),O=i.useState(),R=O[0],z=O[1];m.init(e(e({},D),{currentPageComponents:E,loginRequiredCallback:function(){V.push("/account/login")}})),u.getInstance().router=V,g();var A=u.getInstance();A.router=V,A.currentPageType=h;var B=i.useState(!1),F=B[0],H=B[1],U=i.useMemo((function(){return(null==R?void 0:R.id)===(null==S?void 0:S.id)&&j.pageSpecificData&&j.isBrowser?h===s.PRODUCT&&j._initProductOnBrowser(j.pageSpecificData):j.setPageSpecificData(S,h,F),j.initPagePropValues(c,x,y.map((function(e){return new n(e)})),k,F)}),[F,c,h,k,S,x]);i.useEffect((function(){T&&H("undefined"!=typeof window),window.addToCart=A.cartStore._windowAddToCart,A.cartStore.getCart(),A.checkLocalization(),f()}),[]),i.useEffect((function(){S?(null==R?void 0:R.id)!==S.id&&z(S):z(null)}),[S]),i.useEffect((function(){var e=function(){A.customerStore.routeChangeInit()};return V.events.on("routeChangeStart",e),function(){V.events.off("routeChangeStart",e)}}),[]),i.useEffect((function(){!function(e,i){var r,a;t(this,void 0,void 0,(function(){var t,d,n,m,p;return o(this,(function(o){switch(o.label){case 0:t=u.getInstance(),l.pageView(e),o.label=1;case 1:return o.trys.push([1,4,,5]),e===s.PRODUCT&&(d=i,l.productView(d),t.customerStore.onProductView(d.id,d.selectedVariant.id)),e===s.CATEGORY&&(m=null===(r=(n=i).categoryPathItems)||void 0===r?void 0:r.map((function(e){return e.name})).join(" > "),m=n.categoryPathItems&&(null===(a=n.categoryPathItems)||void 0===a?void 0:a.length)>0?m+" > "+n.name:n.name,l.viewCategory(m,n)),e!==s.CART?[3,3]:[4,t.cartStore.waitUntilInitialized()];case 2:o.sent(),l.viewCart(t.cartStore.cart),o.label=3;case 3:return[3,5];case 4:return p=o.sent(),console.error(p),[3,5];case 5:return[2]}}))}))}(h,j.pageSpecificData)}),[h,S]);var _=i.useMemo((function(){var e=U.find((function(e){return e.component.isHeader})),t=U.find((function(e){return e.component.isFooter})),o=U.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[];return i.createElement("div",{style:{position:"relative",minHeight:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"}},i.createElement("div",null,e&&v(e,k,-1),o.map((function(e,t){return v(e,k,t)}))),t&&v(t,k,-1))}),[U,k]),J=i.useMemo((function(){return m.getMerchantSettings()?new d(m.getMerchantSettings()):null}),[m.getMerchantSettings()]);return i.createElement(i.Fragment,null,i.createElement(p,{pageType:h,pageTitle:w,pageDescription:b,pageSpecificData:j.pageSpecificData,canonicals:C,disableIndex:P,merchantSettings:J,addOgpMetas:I,productReviewSummary:M,pageComponentPropValues:U}),_)})),v=function(e,t,o){return i.createElement(c,{key:e.pageComponent.id,index:o,pageComponentPropValue:e,settings:t})};export{x as IkasPage,v as renderComponent};
1
+ import{__assign as e,__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as r}from"mobx-react-lite";import{useRouter as a}from"next/router.js";import s from"next/dynamic";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as n}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import{IkasThemeJsonCustomData as m}from"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/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/ikas-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{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{Analytics as p}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasPageHead as c}from"./head.js";import{ThemeComponent as u}from"./ThemeComponent.js";import{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{initIkasEvents as j}from"../../analytics/events.js";import{IkasPageDataInit as x}from"../../page-data-init/index.js";import{setAPIClientConfig as g}from"@ikas/storefront-api";var v=s((function(){return import("../popup/index.js").then((function(e){return e.PopupListRendererForPage}))}),{ssr:!1}),y=r((function(r){var s=r.propValues,u=r.themeJsonComponents,y=r.customDataList,w=r.pageType,b=r.pageTitle,S=r.pageDescription,C=r.pageSpecificData,P=r.canonicals,k=r.disableIndex,D=r.settings,T=r.configJson,E=r.reInitOnBrowser,I=r.addOgpMetas,M=r.components,R=r.productReviewSummary,V=a(),O=i.useState(),z=O[0],F=O[1];l.init(e(e({},T),{currentPageComponents:M,loginRequiredCallback:function(){V.push("/account/login")}})),f.getInstance().router=V,g();var A=f.getInstance();A.router=V,A.currentPageType=w;var B=i.useState(!1),H=B[0],L=B[1],U=i.useMemo((function(){return(null==z?void 0:z.id)===(null==C?void 0:C.id)&&x.pageSpecificData&&x.isBrowser?w===d.PRODUCT&&x._initProductOnBrowser(x.pageSpecificData):x.setPageSpecificData(C,w,H),x.initPagePropValues(s,u,y.map((function(e){return new m(e)})),D,H)}),[H,s,w,D,C,u]);i.useEffect((function(){E&&L("undefined"!=typeof window),window.addToCart=A.cartStore._windowAddToCart,A.cartStore.getCart(),A.checkLocalization(),j()}),[]),i.useEffect((function(){C?(null==z?void 0:z.id)!==C.id&&F(C):F(null)}),[C]),i.useEffect((function(){var e=function(){A.customerStore.routeChangeInit()};return V.events.on("routeChangeStart",e),function(){V.events.off("routeChangeStart",e)}}),[]),i.useEffect((function(){!function(e,i){var r,a;t(this,void 0,void 0,(function(){var t,s,n,m,l;return o(this,(function(o){switch(o.label){case 0:t=f.getInstance(),p.pageView(e),o.label=1;case 1:return o.trys.push([1,4,,5]),e===d.PRODUCT&&(s=i,p.productView(s),t.customerStore.onProductView(s.id,s.selectedVariant.id)),e===d.CATEGORY&&(m=null===(r=(n=i).categoryPathItems)||void 0===r?void 0:r.map((function(e){return e.name})).join(" > "),m=n.categoryPathItems&&(null===(a=n.categoryPathItems)||void 0===a?void 0:a.length)>0?m+" > "+n.name:n.name,p.viewCategory(m,n)),e!==d.CART?[3,3]:[4,t.cartStore.waitUntilInitialized()];case 2:o.sent(),p.viewCart(t.cartStore.cart),o.label=3;case 3:return[3,5];case 4:return l=o.sent(),console.error(l),[3,5];case 5:return[2]}}))}))}(w,x.pageSpecificData)}),[w,C]);var _=i.useMemo((function(){var e=U.find((function(e){return e.component.isHeader})),t=U.find((function(e){return e.component.isFooter})),o=U.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[];return i.createElement("div",{style:{position:"relative",minHeight:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"}},i.createElement("div",null,e&&h(e,D,-1),o.map((function(e,t){return h(e,D,t)}))),t&&h(t,D,-1),i.createElement(v,null))}),[U,D]),J=i.useMemo((function(){return l.getMerchantSettings()?new n(l.getMerchantSettings()):null}),[l.getMerchantSettings()]);return i.createElement(i.Fragment,null,i.createElement(c,{pageType:w,pageTitle:b,pageDescription:S,pageSpecificData:x.pageSpecificData,canonicals:P,disableIndex:k,merchantSettings:J,addOgpMetas:I,productReviewSummary:R,pageComponentPropValues:U}),_)})),h=function(e,t,o){return i.createElement(u,{key:e.pageComponent.id,index:o,pageComponentPropValue:e,settings:t})};export{y as IkasPage,h as renderComponent};
@@ -1 +1 @@
1
- import{__extends as e,__assign as o}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import r from"./error/index.js";import{makeObservable as i,computed as n}from"mobx";import a from"../checkout/index.js";import{Observer as d}from"mobx-react-lite";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as s,IkasOrderLineItemStatus as m,IkasCheckoutRequirement as l,IkasCouponCodeRequirement as p,IkasThemeJsonComponentPropType as u}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as c}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as f}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import{IkasOrderLineItem as v}from"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/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/ikas-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{IkasStorefrontConfig as j}from"@ikas/storefront-config";import{IkasPageDataInit as g}from"../../page-data-init/index.js";import{IkasBaseStore as x}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";var y=function(y){function h(e){var o=y.call(this,e)||this;return o.state={hasError:!1},o.onMouseEnter=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseOver(r.id)},o.onMouseLeave=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseLeave(r.id)},o.onClick=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onClick(r.id)},o.ref=t.createRef(),i(o,{pageComponentPropValue:n,propValues:n,isSelected:n,isHovered:n,hasNullValue:n,rendered:n,Component:n}),o}return e(h,y),h.prototype.componentDidMount=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},h.prototype.componentDidUpdate=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},h.getDerivedStateFromError=function(e){return console.error(e),{hasError:!0}},Object.defineProperty(h.prototype,"pageComponentPropValue",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.initializedPropValues.find((function(e){return e.pageComponent.id===t.id}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"propValues",{get:function(){var e,t,r=this.props.vm,i=null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.propValues;(null===(t=r.page)||void 0===t?void 0:t.type)===s.CHECKOUT&&(i={checkout:new c({currencyCode:"TRY",currencySymbol:"₺",orderLineItems:[new v({id:"",createdAt:0,updatedAt:0,currencyCode:"TRY",currencySymbol:"₺",discount:null,discountPrice:null,finalPrice:100,options:null,originalOrderLineItemId:null,price:100,quantity:1,status:m.UNFULFILLED,statusUpdatedAt:null,stockLocationId:null,taxValue:null,unitPrice:null,finalUnitPrice:null,variant:{barcodeList:null,brand:null,categories:null,fileId:null,id:null,mainImageId:null,name:"",prices:null,productId:null,sku:null,slug:null,tagIds:null,taxValue:null,type:null,weight:null,hsCode:null,variantValues:[],baseUnit:null,unit:null,tags:null,bundleProducts:null},orderedAt:0})]}),checkoutSettings:new f({createdAt:0,updatedAt:0,id:"",giftPackagePriceList:null,identityNumberRequirement:l.OPTIONAL,isAccountRequired:!1,isGiftPackageEnabled:!1,isQuickRegistrationEnabled:!1,isShowPostalCode:!0,isTermsAndConditionsDefaultChecked:null,options:null,phoneRequirement:l.OPTIONAL,postalCodeRequirement:l.OPTIONAL,showCheckoutNote:!0,showTermsAndConditionsCheckbox:!0,storefrontId:"",couponCodeRequirement:p.DEFAULT}),customizationProps:o({},i),returnPolicy:"",privacyPolicy:"",termsOfService:"",imprint:"",shippingPolicy:""});return i},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isSelected",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.selectedPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isHovered",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.hoveredPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasNullValue",{get:function(){var e,o=this;return!!(null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.props.some((function(e){var t;if(e.isRequired){var r=(o.propValues||{})[e.name],i=null===(t=o.pageComponentPropValue)||void 0===t?void 0:t.component.props.find((function(o){return o.id===e.requiredPropId}));if(i){var n=(o.propValues||{})[i.name];if(i.type===u.BOOLEAN&&!n||i.type===u.CUSTOM&&n!==e.requiredEnumOptionValue)return!1}return null===r||null==r}})))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"rendered",{get:function(){var e,i,n=this.Component,a=this.props.vm;return this.hasNullValue||this.state.hasError?t.createElement(r,{name:null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.displayName}):t.createElement(n,o({},this.propValues,{store:x.getInstance(),settings:null===(i=a.theme)||void 0===i?void 0:i.settings,pageSpecificData:g.pageSpecificData}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"Component",{get:function(){var e,o=this.props,t=o.vm,r=o.pageComponent,i=j.getCurrentPageComponents();if(!i)return null;var n=i[r.componentId];return(null===(e=t.page)||void 0===e?void 0:e.type)===s.CHECKOUT&&(n=a),n},enumerable:!1,configurable:!0}),h.prototype.render=function(){var e=this;return t.createElement(d,null,(function(){var o;return e.state.hasError?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onClick:e.onClick},t.createElement(r,{name:null===(o=e.pageComponentPropValue)||void 0===o?void 0:o.component.displayName})):j.getCurrentPageComponents()?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave},e.rendered):(console.error("Components for the page not found."),null)}))},h}(t.Component);export{y as ThemeEditorComponent};
1
+ import{__extends as e,__assign as o}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import r from"./error/index.js";import{makeObservable as i,computed as n}from"mobx";import a from"../checkout/index.js";import{Observer as d}from"mobx-react-lite";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as s,IkasOrderLineItemStatus as m,IkasCheckoutRequirement as l,IkasCouponCodeRequirement as p,IkasThemeJsonComponentPropType as u}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as c}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as f}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import{IkasOrderLineItem as v}from"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/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/ikas-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{IkasStorefrontConfig as j}from"@ikas/storefront-config";import{IkasPageDataInit as g}from"../../page-data-init/index.js";import{IkasBaseStore as x}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";var y=function(y){function h(e){var o=y.call(this,e)||this;return o.state={hasError:!1},o.onMouseEnter=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseOver(r.id)},o.onMouseLeave=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseLeave(r.id)},o.onClick=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onClick(r.id)},o.ref=t.createRef(),i(o,{pageComponentPropValue:n,propValues:n,isSelected:n,isHovered:n,hasNullValue:n,rendered:n,Component:n}),o}return e(h,y),h.prototype.componentDidMount=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},h.prototype.componentDidUpdate=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},h.getDerivedStateFromError=function(e){return console.error(e),{hasError:!0}},Object.defineProperty(h.prototype,"pageComponentPropValue",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.initializedPropValues.find((function(e){return e.pageComponent.id===t.id}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"propValues",{get:function(){var e,t,r=this.props.vm,i=null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.propValues;(null===(t=r.page)||void 0===t?void 0:t.type)===s.CHECKOUT&&(i={checkout:new c({currencyCode:"TRY",currencySymbol:"₺",orderLineItems:[new v({id:"",createdAt:0,updatedAt:0,currencyCode:"TRY",currencySymbol:"₺",discount:null,discountPrice:null,finalPrice:100,options:null,originalOrderLineItemId:null,price:100,quantity:1,status:m.UNFULFILLED,statusUpdatedAt:null,stockLocationId:null,taxValue:null,unitPrice:null,finalUnitPrice:null,variant:{barcodeList:null,brand:null,categories:null,fileId:null,id:null,mainImageId:null,name:"",prices:null,productId:null,sku:null,slug:null,tagIds:null,taxValue:null,type:null,weight:null,hsCode:null,variantValues:[],baseUnit:null,unit:null,tags:null,bundleProducts:null},orderedAt:0})]}),checkoutSettings:new f({createdAt:0,updatedAt:0,id:"",giftPackagePriceList:null,identityNumberRequirement:l.OPTIONAL,isAccountRequired:!1,isGiftPackageEnabled:!1,isQuickRegistrationEnabled:!1,isShowPostalCode:!0,isTermsAndConditionsDefaultChecked:null,options:null,phoneRequirement:l.OPTIONAL,postalCodeRequirement:l.OPTIONAL,showCheckoutNote:!0,showTermsAndConditionsCheckbox:!0,storefrontId:"",couponCodeRequirement:p.DEFAULT}),customizationProps:o({},i),returnPolicy:"",privacyPolicy:"",termsOfService:"",imprint:"",shippingPolicy:""});return i},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isSelected",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.selectedPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isHovered",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.hoveredPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasNullValue",{get:function(){var e,o=this;return!!(null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.props.some((function(e){var t;if(e.isRequired){var r=(o.propValues||{})[e.name],i=null===(t=o.pageComponentPropValue)||void 0===t?void 0:t.component.props.find((function(o){return o.id===e.requiredPropId}));if(i){var n=(o.propValues||{})[i.name];if(i.type===u.BOOLEAN&&!n||i.type===u.CUSTOM&&n!==e.requiredEnumOptionValue)return!1}return null===r||null==r}})))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"rendered",{get:function(){var e,i,n=this.Component,a=this.props.vm;return this.hasNullValue||this.state.hasError?t.createElement(r,{name:null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.displayName}):t.createElement(n,o({},this.propValues,{store:x.getInstance(),settings:null===(i=a.theme)||void 0===i?void 0:i.settings,pageSpecificData:g.pageSpecificData}))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"Component",{get:function(){var e,o=this.props,t=o.vm,r=o.pageComponent,i=j.getCurrentPageComponents();if(!i)return null;var n=i[r.componentId];return(null===(e=t.page)||void 0===e?void 0:e.type)===s.CHECKOUT&&(n=a),n},enumerable:!1,configurable:!0}),h.prototype.render=function(){var e=this;return t.createElement(d,null,(function(){var o;return e.state.hasError?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onClick:e.onClick},t.createElement(r,{name:null===(o=e.pageComponentPropValue)||void 0===o?void 0:o.component.displayName})):j.getCurrentPageComponents()?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave},e.rendered):(console.error("Components for the page not found."),null)}))},h}(t.Component);export{y as ThemeEditorComponent};