@ikas/storefront 5.0.0-beta.2 → 5.0.0-beta.21

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 (539) hide show
  1. package/build/analytics/analytics.d.ts +32 -37
  2. package/build/analytics/analytics.js +1 -1
  3. package/build/analytics/events.js +1 -1
  4. package/build/analytics/facebookPixel.d.ts +11 -15
  5. package/build/analytics/facebookPixel.js +1 -1
  6. package/build/analytics/googleAnalytics.d.ts +10 -13
  7. package/build/analytics/googleAnalytics.js +1 -1
  8. package/build/analytics/googleTagManager.d.ts +188 -191
  9. package/build/analytics/googleTagManager.js +1 -1
  10. package/build/analytics/googleUniversal.d.ts +5 -8
  11. package/build/analytics/googleUniversal.js +1 -1
  12. package/build/analytics/head/index.js +1 -1
  13. package/build/analytics/ikas.d.ts +33 -40
  14. package/build/analytics/ikas.js +1 -1
  15. package/build/analytics/index.d.ts +1 -1
  16. package/build/analytics/tiktokPixel.d.ts +9 -12
  17. package/build/analytics/tiktokPixel.js +1 -1
  18. package/build/components/checkout/components/address-form/index.js +1 -1
  19. package/build/components/checkout/components/address-form/model.d.ts +6 -6
  20. package/build/components/checkout/components/address-form/model.js +1 -1
  21. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  22. package/build/components/checkout/components/cart-summary/index.js +1 -1
  23. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  24. package/build/components/checkout/components/customer-addresses/model.d.ts +4 -1
  25. package/build/components/checkout/components/customer-addresses/model.js +1 -1
  26. package/build/components/checkout/components/delivery-methods/index.js +1 -1
  27. package/build/components/checkout/components/epaykolay-button/index.d.ts +5 -0
  28. package/build/components/checkout/components/epaykolay-button/index.js +1 -0
  29. package/build/components/checkout/components/epaykolay-button/style.module.scss.js +1 -0
  30. package/build/components/checkout/components/error/customer-login-required-error/index.js +1 -1
  31. package/build/components/checkout/components/error/index.js +1 -1
  32. package/build/components/checkout/components/error/no-shipping-error/index.js +1 -1
  33. package/build/components/checkout/components/error/payment-error/index.d.ts +1 -1
  34. package/build/components/checkout/components/error/payment-error/index.js +1 -1
  35. package/build/components/checkout/components/error/stock-error/index.d.ts +2 -1
  36. package/build/components/checkout/components/error/stock-error/index.js +1 -1
  37. package/build/components/checkout/components/error/unknown-error/index.d.ts +1 -1
  38. package/build/components/checkout/components/error/unknown-error/index.js +1 -1
  39. package/build/components/checkout/components/expandable-section/index.js +1 -1
  40. package/build/components/checkout/components/form-item/index.js +1 -1
  41. package/build/components/checkout/components/klarna/index.js +1 -1
  42. package/build/components/checkout/components/master-pass/credit-card-form/index.js +1 -1
  43. package/build/components/checkout/components/master-pass/link-card-to-client/index.js +1 -1
  44. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
  45. package/build/components/checkout/components/offer-product/index.d.ts +2 -1
  46. package/build/components/checkout/components/offer-product/index.js +1 -1
  47. package/build/components/checkout/components/paypal/index.d.ts +7 -0
  48. package/build/components/checkout/components/paypal/index.js +1 -0
  49. package/build/components/checkout/components/paypal/style.module.scss.js +1 -0
  50. package/build/components/checkout/components/quick-registration/completed.js +1 -1
  51. package/build/components/checkout/components/quick-registration/index.js +1 -1
  52. package/build/components/checkout/components/quick-registration/model.js +1 -1
  53. package/build/components/checkout/components/svg/epaykolay.d.ts +6 -0
  54. package/build/components/checkout/components/svg/epaykolay.js +1 -0
  55. package/build/components/checkout/index.d.ts +1 -1
  56. package/build/components/checkout/index.js +1 -1
  57. package/build/components/checkout/model.d.ts +22 -44
  58. package/build/components/checkout/model.js +1 -1
  59. package/build/components/checkout/modelMasterPass.d.ts +13 -23
  60. package/build/components/checkout/modelMasterPass.js +1 -1
  61. package/build/components/checkout/steps/step-info/index.js +1 -1
  62. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  63. package/build/components/checkout/steps/step-payment/index.js +1 -1
  64. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  65. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -1
  66. package/build/components/checkout/steps/step-payment/style.module.scss.js +1 -1
  67. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  68. package/build/components/checkout/steps/step-success/index.js +1 -1
  69. package/build/components/checkout/style.module.scss.js +1 -1
  70. package/build/components/checkout/types.d.ts +29 -0
  71. package/build/components/checkout/types.js +1 -0
  72. package/build/components/google-captcha/index.js +1 -1
  73. package/build/components/image/index.d.ts +1 -1
  74. package/build/components/image/index.js +1 -1
  75. package/build/components/link/index.js +1 -1
  76. package/build/components/page/ThemeComponent.js +1 -1
  77. package/build/components/page/functions.d.ts +3 -0
  78. package/build/components/page/functions.js +1 -0
  79. package/build/components/page/head.d.ts +1 -1
  80. package/build/components/page/head.js +1 -1
  81. package/build/components/page/index.d.ts +4 -3
  82. package/build/components/page/index.js +1 -1
  83. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  84. package/build/components/page-editor/index.js +1 -1
  85. package/build/components/page-editor/model.d.ts +5 -1
  86. package/build/components/page-editor/model.js +1 -1
  87. package/build/ext/@ikas/fe-api-client/build/utils/api.js +1 -1
  88. package/build/hooks/index.d.ts +0 -1
  89. package/build/hooks/useCustomerReviews.d.ts +2 -3
  90. package/build/hooks/useCustomerReviews.js +1 -1
  91. package/build/index.d.ts +2 -0
  92. package/build/index.js +1 -1
  93. package/build/model-helpers/index.d.ts +5 -0
  94. package/build/model-helpers/order/line-item/option/value/functions.d.ts +3 -0
  95. package/build/model-helpers/order/line-item/option/value/functions.js +1 -0
  96. package/build/model-helpers/product/attribute-value/functions.d.ts +2 -0
  97. package/build/model-helpers/product/attribute-value/functions.js +1 -0
  98. package/build/model-helpers/product/functions.d.ts +10 -0
  99. package/build/model-helpers/product/functions.js +1 -0
  100. package/build/model-helpers/product/option-set/option/functions.d.ts +2 -0
  101. package/build/model-helpers/product/option-set/option/functions.js +1 -0
  102. package/build/model-helpers/product/variant/functions.d.ts +2 -0
  103. package/build/model-helpers/product/variant/functions.js +1 -0
  104. package/build/models/data/checkout/index.d.ts +4 -21
  105. package/build/models/data/index.d.ts +7 -138
  106. package/build/models/data/localized-customer-address/functions.d.ts +65 -0
  107. package/build/models/data/localized-customer-address/functions.js +1 -0
  108. package/build/models/data/localized-customer-address/index.d.ts +6 -0
  109. package/build/models/data/localized-order-address/functions.d.ts +63 -0
  110. package/build/models/data/localized-order-address/functions.js +1 -0
  111. package/build/models/data/localized-order-address/index.d.ts +6 -0
  112. package/build/models/data/review-form/index.d.ts +6 -0
  113. package/build/models/data/theme-json/component/index.d.ts +1 -0
  114. package/build/models/data/theme-json/component/index.js +1 -1
  115. package/build/models/data/theme-json/custom-data/index.d.ts +1 -2
  116. package/build/models/data/theme-json/custom-data/index.js +1 -1
  117. package/build/models/data/theme-json/settings/color/index.js +1 -1
  118. package/build/models/index.d.ts +1 -0
  119. package/build/models/ui/blog-category-list/functions.d.ts +6 -0
  120. package/build/models/ui/blog-category-list/functions.js +1 -0
  121. package/build/models/ui/blog-category-list/index.d.ts +8 -42
  122. package/build/models/ui/blog-category-list/index.js +1 -1
  123. package/build/models/ui/blog-list/functions.d.ts +6 -0
  124. package/build/models/ui/blog-list/functions.js +1 -0
  125. package/build/models/ui/blog-list/index.d.ts +9 -45
  126. package/build/models/ui/blog-list/index.js +1 -1
  127. package/build/models/ui/brand-list/functions.d.ts +8 -0
  128. package/build/models/ui/brand-list/functions.js +1 -0
  129. package/build/models/ui/brand-list/index.d.ts +9 -48
  130. package/build/models/ui/brand-list/index.js +1 -1
  131. package/build/models/ui/category-list/functions.d.ts +8 -0
  132. package/build/models/ui/category-list/functions.js +1 -0
  133. package/build/models/ui/category-list/index.d.ts +9 -48
  134. package/build/models/ui/category-list/index.js +1 -1
  135. package/build/models/ui/customer-review-list/functions.d.ts +7 -0
  136. package/build/models/ui/customer-review-list/functions.js +1 -0
  137. package/build/models/ui/customer-review-list/index.d.ts +8 -40
  138. package/build/models/ui/customer-review-summary-list/functions.d.ts +7 -0
  139. package/build/models/ui/customer-review-summary-list/functions.js +1 -0
  140. package/build/models/ui/customer-review-summary-list/index.d.ts +7 -39
  141. package/build/models/ui/index.d.ts +17 -10
  142. package/build/models/ui/list-commons/index.d.ts +13 -0
  143. package/build/models/ui/list-commons/index.js +1 -0
  144. package/build/models/ui/navigation-link/index.d.ts +3 -3
  145. package/build/models/ui/navigation-link/index.js +1 -1
  146. package/build/models/ui/product-attribute-detail/index.d.ts +1 -1
  147. package/build/models/ui/product-attribute-detail/index.js +1 -1
  148. package/build/models/ui/product-attribute-list/index.js +1 -1
  149. package/build/models/ui/product-list/functions.d.ts +32 -0
  150. package/build/models/ui/product-list/functions.js +1 -0
  151. package/build/models/ui/product-list/index.d.ts +18 -110
  152. package/build/models/ui/product-list/index.js +1 -1
  153. package/build/models/ui/raffle-list/functions.d.ts +6 -0
  154. package/build/models/ui/raffle-list/functions.js +1 -0
  155. package/build/models/ui/raffle-list/index.d.ts +14 -50
  156. package/build/models/ui/validator/form/account-info.js +1 -1
  157. package/build/models/ui/validator/form/address.js +1 -1
  158. package/build/models/ui/validator/form/contact-form.js +1 -1
  159. package/build/models/ui/validator/form/customer-review.js +1 -1
  160. package/build/models/ui/validator/form/forgot-password.js +1 -1
  161. package/build/models/ui/validator/form/ikas-address.d.ts +32 -20
  162. package/build/models/ui/validator/form/ikas-address.js +1 -1
  163. package/build/models/ui/validator/form/login.js +1 -1
  164. package/build/models/ui/validator/form/raffle-form.js +1 -1
  165. package/build/models/ui/validator/form/recover-password.js +1 -1
  166. package/build/models/ui/validator/form/register.d.ts +10 -1
  167. package/build/models/ui/validator/form/register.js +1 -1
  168. package/build/page-data-init/index.d.ts +7 -18
  169. package/build/page-data-init/index.js +1 -1
  170. package/build/pages/account/activate.d.ts +4 -0
  171. package/build/pages/account/activate.js +1 -0
  172. package/build/pages/checkout.js +1 -1
  173. package/build/pages/index.d.ts +1 -0
  174. package/build/store/analytics/index.d.ts +9 -0
  175. package/build/store/analytics/index.js +1 -0
  176. package/build/store/base/functions.d.ts +7 -0
  177. package/build/store/base/functions.js +1 -0
  178. package/build/store/{base.d.ts → base/index.d.ts} +7 -17
  179. package/build/store/base/index.js +1 -0
  180. package/build/store/base/public.d.ts +1 -0
  181. package/build/store/base/public.js +1 -0
  182. package/build/store/cart/functions.d.ts +24 -0
  183. package/build/store/cart/functions.js +1 -0
  184. package/build/store/cart/index.d.ts +7 -28
  185. package/build/store/cart/index.js +1 -1
  186. package/build/store/cart/public.d.ts +1 -0
  187. package/build/store/cart/public.js +1 -0
  188. package/build/store/customer/account-auth/data.d.ts +4 -0
  189. package/build/store/customer/account-auth/data.js +1 -0
  190. package/build/store/customer/account-auth/functions.d.ts +24 -0
  191. package/build/store/customer/account-auth/functions.js +1 -0
  192. package/build/store/customer/account-auth/public.d.ts +1 -0
  193. package/build/store/customer/captcha/data.d.ts +3 -0
  194. package/build/store/customer/captcha/data.js +1 -0
  195. package/build/store/customer/captcha/functions.d.ts +5 -0
  196. package/build/store/customer/captcha/functions.js +1 -0
  197. package/build/store/customer/captcha/public.d.ts +1 -0
  198. package/build/store/customer/consent/data.d.ts +3 -0
  199. package/build/store/customer/consent/data.js +1 -0
  200. package/build/store/customer/consent/functions.d.ts +6 -0
  201. package/build/store/customer/consent/functions.js +1 -0
  202. package/build/store/customer/consent/public.d.ts +1 -0
  203. package/build/store/customer/functions.d.ts +4 -0
  204. package/build/store/customer/functions.js +1 -0
  205. package/build/store/customer/index.d.ts +8 -82
  206. package/build/store/customer/index.js +1 -1
  207. package/build/store/customer/marketing/data.d.ts +3 -0
  208. package/build/store/customer/marketing/data.js +1 -0
  209. package/build/store/customer/marketing/functions.d.ts +5 -0
  210. package/build/store/customer/marketing/functions.js +1 -0
  211. package/build/store/customer/marketing/public.d.ts +1 -0
  212. package/build/store/customer/order/data.d.ts +4 -0
  213. package/build/store/customer/order/data.js +1 -0
  214. package/build/store/customer/order/functions.d.ts +11 -0
  215. package/build/store/customer/order/functions.js +1 -0
  216. package/build/store/customer/order/public.d.ts +1 -0
  217. package/build/store/customer/product/data.d.ts +17 -0
  218. package/build/store/customer/product/data.js +1 -0
  219. package/build/store/customer/product/functions.d.ts +20 -0
  220. package/build/store/customer/product/functions.js +1 -0
  221. package/build/store/customer/product/public.d.ts +1 -0
  222. package/build/store/customer/public.d.ts +8 -0
  223. package/build/store/customer/public.js +1 -0
  224. package/build/store/customer/raffle/functions.d.ts +1 -0
  225. package/build/store/customer/raffle/functions.js +1 -0
  226. package/build/store/customer/raffle/public.d.ts +1 -0
  227. package/build/store/index.d.ts +9 -4
  228. package/build/utils/constants.js +1 -1
  229. package/build/utils/helper.d.ts +1 -1
  230. package/build/utils/helper.js +1 -1
  231. package/build/utils/index.d.ts +1 -2
  232. package/package.json +17 -13
  233. package/build/ext/@builder.io/partytown/integration/index.mjs.js +0 -1
  234. package/build/ext/@builder.io/partytown/react/index.mjs.js +0 -1
  235. package/build/hooks/useStore.d.ts +0 -2
  236. package/build/hooks/useStore.js +0 -1
  237. package/build/models/data/base/index.d.ts +0 -8
  238. package/build/models/data/base/index.js +0 -1
  239. package/build/models/data/blog/category/index.d.ts +0 -12
  240. package/build/models/data/blog/category/index.js +0 -1
  241. package/build/models/data/blog/content/index.d.ts +0 -6
  242. package/build/models/data/blog/content/index.js +0 -1
  243. package/build/models/data/blog/index.d.ts +0 -27
  244. package/build/models/data/blog/index.js +0 -1
  245. package/build/models/data/blog/meta-data/index.d.ts +0 -16
  246. package/build/models/data/blog/meta-data/index.js +0 -1
  247. package/build/models/data/blog/tag/index.d.ts +0 -6
  248. package/build/models/data/blog/tag/index.js +0 -1
  249. package/build/models/data/blog/writer/index.d.ts +0 -6
  250. package/build/models/data/blog/writer/index.js +0 -1
  251. package/build/models/data/brand/index.d.ts +0 -26
  252. package/build/models/data/brand/index.js +0 -1
  253. package/build/models/data/brand/translation/index.d.ts +0 -7
  254. package/build/models/data/brand/translation/index.js +0 -1
  255. package/build/models/data/campaign-offer/index.d.ts +0 -21
  256. package/build/models/data/campaign-offer/index.js +0 -1
  257. package/build/models/data/campaign-offer/product/index.d.ts +0 -25
  258. package/build/models/data/campaign-offer/product/index.js +0 -1
  259. package/build/models/data/cart/available-shipping-method/index.d.ts +0 -10
  260. package/build/models/data/cart/available-shipping-method/index.js +0 -1
  261. package/build/models/data/cart/campaign-offer/index.d.ts +0 -16
  262. package/build/models/data/cart/campaign-offer/index.js +0 -1
  263. package/build/models/data/cart/index.d.ts +0 -14
  264. package/build/models/data/cart/index.js +0 -1
  265. package/build/models/data/category/index.d.ts +0 -22
  266. package/build/models/data/category/index.js +0 -1
  267. package/build/models/data/category/path-item/index.d.ts +0 -14
  268. package/build/models/data/category/path-item/index.js +0 -1
  269. package/build/models/data/category/translations/index.d.ts +0 -7
  270. package/build/models/data/category/translations/index.js +0 -1
  271. package/build/models/data/checkout/country-settings-model.d.ts +0 -141
  272. package/build/models/data/checkout/country-settings-model.js +0 -1
  273. package/build/models/data/checkout/index.js +0 -1
  274. package/build/models/data/checkout-settings/index.d.ts +0 -21
  275. package/build/models/data/checkout-settings/index.js +0 -1
  276. package/build/models/data/checkout-settings/option/index.d.ts +0 -6
  277. package/build/models/data/checkout-settings/option/index.js +0 -1
  278. package/build/models/data/checkout-settings/price/index.d.ts +0 -7
  279. package/build/models/data/checkout-settings/price/index.js +0 -1
  280. package/build/models/data/city/index.d.ts +0 -12
  281. package/build/models/data/city/index.js +0 -1
  282. package/build/models/data/contact-form/index.d.ts +0 -9
  283. package/build/models/data/contact-form/index.js +0 -1
  284. package/build/models/data/country/index.d.ts +0 -18
  285. package/build/models/data/country/index.js +0 -1
  286. package/build/models/data/country/location-translations/index.d.ts +0 -7
  287. package/build/models/data/customer/address/city/index.d.ts +0 -7
  288. package/build/models/data/customer/address/city/index.js +0 -1
  289. package/build/models/data/customer/address/country/index.d.ts +0 -9
  290. package/build/models/data/customer/address/country/index.js +0 -1
  291. package/build/models/data/customer/address/district/index.d.ts +0 -7
  292. package/build/models/data/customer/address/district/index.js +0 -1
  293. package/build/models/data/customer/address/ikas-localized-customer-address.d.ts +0 -50
  294. package/build/models/data/customer/address/ikas-localized-customer-address.js +0 -1
  295. package/build/models/data/customer/address/index.d.ts +0 -40
  296. package/build/models/data/customer/address/index.js +0 -1
  297. package/build/models/data/customer/address/state/index.d.ts +0 -7
  298. package/build/models/data/customer/address/state/index.js +0 -1
  299. package/build/models/data/customer/attribute/index.d.ts +0 -18
  300. package/build/models/data/customer/attribute/index.js +0 -1
  301. package/build/models/data/customer/attribute/option/index.d.ts +0 -9
  302. package/build/models/data/customer/attribute/option/index.js +0 -1
  303. package/build/models/data/customer/attribute/sales-channel/index.d.ts +0 -8
  304. package/build/models/data/customer/attribute/sales-channel/index.js +0 -1
  305. package/build/models/data/customer/attribute/translation/index.d.ts +0 -9
  306. package/build/models/data/customer/attribute/translation/index.js +0 -1
  307. package/build/models/data/customer/attribute/translation/option/index.d.ts +0 -6
  308. package/build/models/data/customer/attribute/translation/option/index.js +0 -1
  309. package/build/models/data/customer/attribute/value/index.d.ts +0 -11
  310. package/build/models/data/customer/attribute/value/index.js +0 -1
  311. package/build/models/data/customer/index.d.ts +0 -38
  312. package/build/models/data/customer/index.js +0 -1
  313. package/build/models/data/customer/review/index.d.ts +0 -24
  314. package/build/models/data/customer/review/index.js +0 -1
  315. package/build/models/data/customer/review/settings/index.d.ts +0 -6
  316. package/build/models/data/customer/review/settings/index.js +0 -1
  317. package/build/models/data/customer/review/summary/index.d.ts +0 -10
  318. package/build/models/data/customer/review/summary/index.js +0 -1
  319. package/build/models/data/customer/review/summary/star/index.d.ts +0 -6
  320. package/build/models/data/customer/review/summary/star/index.js +0 -1
  321. package/build/models/data/district/index.d.ts +0 -12
  322. package/build/models/data/district/index.js +0 -1
  323. package/build/models/data/favorite-product/index.d.ts +0 -7
  324. package/build/models/data/favorite-product/index.js +0 -1
  325. package/build/models/data/filter-category/index.d.ts +0 -12
  326. package/build/models/data/filter-category/index.js +0 -1
  327. package/build/models/data/html-meta-data/index.d.ts +0 -28
  328. package/build/models/data/html-meta-data/index.js +0 -1
  329. package/build/models/data/html-meta-data/translations/index.d.ts +0 -7
  330. package/build/models/data/html-meta-data/translations/index.js +0 -1
  331. package/build/models/data/image/index.d.ts +0 -10
  332. package/build/models/data/image/index.js +0 -1
  333. package/build/models/data/last-viewed-product/index.d.ts +0 -6
  334. package/build/models/data/last-viewed-product/index.js +0 -1
  335. package/build/models/data/merchant-settings/index.d.ts +0 -12
  336. package/build/models/data/merchant-settings/index.js +0 -1
  337. package/build/models/data/order/address/city/index.d.ts +0 -7
  338. package/build/models/data/order/address/city/index.js +0 -1
  339. package/build/models/data/order/address/country/index.d.ts +0 -9
  340. package/build/models/data/order/address/country/index.js +0 -1
  341. package/build/models/data/order/address/district/index.d.ts +0 -7
  342. package/build/models/data/order/address/district/index.js +0 -1
  343. package/build/models/data/order/address/ikas-localized-order-address.d.ts +0 -32
  344. package/build/models/data/order/address/ikas-localized-order-address.js +0 -1
  345. package/build/models/data/order/address/index.d.ts +0 -37
  346. package/build/models/data/order/address/index.js +0 -1
  347. package/build/models/data/order/address/state/index.d.ts +0 -7
  348. package/build/models/data/order/address/state/index.js +0 -1
  349. package/build/models/data/order/adjustment/applied-order-line/index.d.ts +0 -8
  350. package/build/models/data/order/adjustment/applied-order-line/index.js +0 -1
  351. package/build/models/data/order/adjustment/index.d.ts +0 -15
  352. package/build/models/data/order/adjustment/index.js +0 -1
  353. package/build/models/data/order/customer/index.d.ts +0 -11
  354. package/build/models/data/order/customer/index.js +0 -1
  355. package/build/models/data/order/gift-line/index.d.ts +0 -6
  356. package/build/models/data/order/gift-line/index.js +0 -1
  357. package/build/models/data/order/index.d.ts +0 -69
  358. package/build/models/data/order/index.js +0 -1
  359. package/build/models/data/order/invoice/index.d.ts +0 -12
  360. package/build/models/data/order/invoice/index.js +0 -1
  361. package/build/models/data/order/line-item/base-unit/index.d.ts +0 -9
  362. package/build/models/data/order/line-item/base-unit/index.js +0 -1
  363. package/build/models/data/order/line-item/base-unit/unit-type/index.d.ts +0 -6
  364. package/build/models/data/order/line-item/base-unit/unit-type/index.js +0 -1
  365. package/build/models/data/order/line-item/discount/index.d.ts +0 -11
  366. package/build/models/data/order/line-item/discount/index.js +0 -1
  367. package/build/models/data/order/line-item/index.d.ts +0 -46
  368. package/build/models/data/order/line-item/index.js +0 -1
  369. package/build/models/data/order/line-item/option/index.d.ts +0 -10
  370. package/build/models/data/order/line-item/option/index.js +0 -1
  371. package/build/models/data/order/line-item/option/value/index.d.ts +0 -9
  372. package/build/models/data/order/line-item/option/value/index.js +0 -1
  373. package/build/models/data/order/line-item/variant/brand/index.d.ts +0 -6
  374. package/build/models/data/order/line-item/variant/brand/index.js +0 -1
  375. package/build/models/data/order/line-item/variant/category/index.d.ts +0 -12
  376. package/build/models/data/order/line-item/variant/category/index.js +0 -1
  377. package/build/models/data/order/line-item/variant/index.d.ts +0 -32
  378. package/build/models/data/order/line-item/variant/index.js +0 -1
  379. package/build/models/data/order/line-item/variant/price/index.d.ts +0 -10
  380. package/build/models/data/order/line-item/variant/price/index.js +0 -1
  381. package/build/models/data/order/line-item/variant/tag/index.d.ts +0 -6
  382. package/build/models/data/order/line-item/variant/tag/index.js +0 -1
  383. package/build/models/data/order/line-item/variant/unit/index.d.ts +0 -6
  384. package/build/models/data/order/line-item/variant/unit/index.js +0 -1
  385. package/build/models/data/order/line-item/variant/value/index.d.ts +0 -11
  386. package/build/models/data/order/line-item/variant/value/index.js +0 -1
  387. package/build/models/data/order/package/index.d.ts +0 -16
  388. package/build/models/data/order/package/index.js +0 -1
  389. package/build/models/data/order/package/tracking-info/index.d.ts +0 -9
  390. package/build/models/data/order/package/tracking-info/index.js +0 -1
  391. package/build/models/data/order/payment-method/index.d.ts +0 -9
  392. package/build/models/data/order/payment-method/index.js +0 -1
  393. package/build/models/data/order/refund/index.d.ts +0 -7
  394. package/build/models/data/order/refund/index.js +0 -1
  395. package/build/models/data/order/refund/line-item/index.d.ts +0 -6
  396. package/build/models/data/order/refund/line-item/index.js +0 -1
  397. package/build/models/data/order/refund/settings/index.d.ts +0 -7
  398. package/build/models/data/order/refund/settings/index.js +0 -1
  399. package/build/models/data/order/shipping-line/index.d.ts +0 -12
  400. package/build/models/data/order/shipping-line/index.js +0 -1
  401. package/build/models/data/order/tax-line/index.d.ts +0 -6
  402. package/build/models/data/order/tax-line/index.js +0 -1
  403. package/build/models/data/order/transaction/error/index.d.ts +0 -7
  404. package/build/models/data/order/transaction/error/index.js +0 -1
  405. package/build/models/data/order/transaction/index.d.ts +0 -26
  406. package/build/models/data/order/transaction/index.js +0 -1
  407. package/build/models/data/order/transaction/payment-method-detail/index.d.ts +0 -13
  408. package/build/models/data/order/transaction/payment-method-detail/index.js +0 -1
  409. package/build/models/data/order/transaction/payment-method-detail/installment-price/index.d.ts +0 -9
  410. package/build/models/data/order/transaction/payment-method-detail/installment-price/index.js +0 -1
  411. package/build/models/data/payment-gateway/additional-price/index.d.ts +0 -9
  412. package/build/models/data/payment-gateway/additional-price/index.js +0 -1
  413. package/build/models/data/payment-gateway/index.d.ts +0 -31
  414. package/build/models/data/payment-gateway/index.js +0 -1
  415. package/build/models/data/payment-gateway/settings/index.d.ts +0 -10
  416. package/build/models/data/payment-gateway/settings/index.js +0 -1
  417. package/build/models/data/payment-gateway/translation/index.d.ts +0 -7
  418. package/build/models/data/payment-gateway/translation/index.js +0 -1
  419. package/build/models/data/product/attribute/index.d.ts +0 -15
  420. package/build/models/data/product/attribute/index.js +0 -1
  421. package/build/models/data/product/attribute/option/index.d.ts +0 -6
  422. package/build/models/data/product/attribute/option/index.js +0 -1
  423. package/build/models/data/product/attribute/table-cell/index.d.ts +0 -6
  424. package/build/models/data/product/attribute/table-cell/index.js +0 -1
  425. package/build/models/data/product/attribute/table-template/index.d.ts +0 -7
  426. package/build/models/data/product/attribute/table-template/index.js +0 -1
  427. package/build/models/data/product/attribute/translation/index.d.ts +0 -13
  428. package/build/models/data/product/attribute/translation/index.js +0 -1
  429. package/build/models/data/product/attribute-value/index.d.ts +0 -28
  430. package/build/models/data/product/attribute-value/index.js +0 -1
  431. package/build/models/data/product/back-in-stock-settings/index.d.ts +0 -5
  432. package/build/models/data/product/back-in-stock-settings/index.js +0 -1
  433. package/build/models/data/product/base-unit/index.d.ts +0 -12
  434. package/build/models/data/product/base-unit/index.js +0 -1
  435. package/build/models/data/product/campaign/data/index.d.ts +0 -27
  436. package/build/models/data/product/campaign/data/index.js +0 -1
  437. package/build/models/data/product/campaign/filter/index.d.ts +0 -7
  438. package/build/models/data/product/campaign/filter/index.js +0 -1
  439. package/build/models/data/product/campaign/index.d.ts +0 -7
  440. package/build/models/data/product/campaign/index.js +0 -1
  441. package/build/models/data/product/campaign/product-buyx-then-gety/index.d.ts +0 -20
  442. package/build/models/data/product/campaign/product-buyx-then-gety/index.js +0 -1
  443. package/build/models/data/product/campaign/product-campaign-date-range-field/index.d.ts +0 -6
  444. package/build/models/data/product/campaign/product-campaign-date-range-field/index.js +0 -1
  445. package/build/models/data/product/campaign/product-fixed-discount/index.d.ts +0 -14
  446. package/build/models/data/product/campaign/product-fixed-discount/index.js +0 -1
  447. package/build/models/data/product/filter/index.d.ts +0 -82
  448. package/build/models/data/product/filter/index.js +0 -1
  449. package/build/models/data/product/image/index.d.ts +0 -10
  450. package/build/models/data/product/image/index.js +0 -1
  451. package/build/models/data/product/index.d.ts +0 -77
  452. package/build/models/data/product/index.js +0 -1
  453. package/build/models/data/product/option-set/index.d.ts +0 -29
  454. package/build/models/data/product/option-set/index.js +0 -1
  455. package/build/models/data/product/option-set/option/index.d.ts +0 -70
  456. package/build/models/data/product/option-set/option/index.js +0 -1
  457. package/build/models/data/product/star/index.d.ts +0 -6
  458. package/build/models/data/product/star/index.js +0 -1
  459. package/build/models/data/product/stock-location/index.d.ts +0 -8
  460. package/build/models/data/product/stock-location/index.js +0 -1
  461. package/build/models/data/product/tag/index.d.ts +0 -6
  462. package/build/models/data/product/tag/index.js +0 -1
  463. package/build/models/data/product/variant/index.d.ts +0 -31
  464. package/build/models/data/product/variant/index.js +0 -1
  465. package/build/models/data/product/variant/price/index.d.ts +0 -19
  466. package/build/models/data/product/variant/price/index.js +0 -1
  467. package/build/models/data/product/variant/unit/index.d.ts +0 -6
  468. package/build/models/data/product/variant/unit/index.js +0 -1
  469. package/build/models/data/product/variant-type/index.d.ts +0 -8
  470. package/build/models/data/product/variant-type/index.js +0 -1
  471. package/build/models/data/raffle/index.d.ts +0 -63
  472. package/build/models/data/raffle/index.js +0 -1
  473. package/build/models/data/sales-channel/index.d.ts +0 -19
  474. package/build/models/data/sales-channel/index.js +0 -1
  475. package/build/models/data/state/index.d.ts +0 -11
  476. package/build/models/data/state/index.js +0 -1
  477. package/build/models/data/state/location-translations/index.d.ts +0 -7
  478. package/build/models/data/stock-location/address/city/index.d.ts +0 -7
  479. package/build/models/data/stock-location/address/city/index.js +0 -1
  480. package/build/models/data/stock-location/address/country/index.d.ts +0 -7
  481. package/build/models/data/stock-location/address/country/index.js +0 -1
  482. package/build/models/data/stock-location/address/district/index.d.ts +0 -7
  483. package/build/models/data/stock-location/address/district/index.js +0 -1
  484. package/build/models/data/stock-location/address/index.d.ts +0 -15
  485. package/build/models/data/stock-location/address/index.js +0 -1
  486. package/build/models/data/stock-location/address/state/index.d.ts +0 -7
  487. package/build/models/data/stock-location/address/state/index.js +0 -1
  488. package/build/models/data/stock-location/available/index.d.ts +0 -10
  489. package/build/models/data/stock-location/available/index.js +0 -1
  490. package/build/models/data/stock-location/index.d.ts +0 -14
  491. package/build/models/data/stock-location/index.js +0 -1
  492. package/build/models/data/storefront/domain/index.d.ts +0 -9
  493. package/build/models/data/storefront/domain/index.js +0 -1
  494. package/build/models/data/storefront/index.d.ts +0 -30
  495. package/build/models/data/storefront/index.js +0 -1
  496. package/build/models/data/storefront/localization/index.d.ts +0 -8
  497. package/build/models/data/storefront/localization/index.js +0 -1
  498. package/build/models/data/storefront/meta-templates/index.d.ts +0 -8
  499. package/build/models/data/storefront/meta-templates/index.js +0 -1
  500. package/build/models/data/storefront/routing/dynamic-currency/index.d.ts +0 -6
  501. package/build/models/data/storefront/routing/dynamic-currency/index.js +0 -1
  502. package/build/models/data/storefront/routing/index.d.ts +0 -14
  503. package/build/models/data/storefront/routing/index.js +0 -1
  504. package/build/models/data/storefront/theme/index.d.ts +0 -10
  505. package/build/models/data/storefront/theme/index.js +0 -1
  506. package/build/models/data/storefront/theme-localization/index.d.ts +0 -15
  507. package/build/models/data/storefront/theme-localization/index.js +0 -1
  508. package/build/models/data/variant-type/index.d.ts +0 -13
  509. package/build/models/data/variant-type/index.js +0 -1
  510. package/build/models/data/variant-type/variant-value/index.d.ts +0 -12
  511. package/build/models/data/variant-type/variant-value/index.js +0 -1
  512. package/build/models/ui/customer-review-list/index.js +0 -1
  513. package/build/models/ui/customer-review-summary-list/index.js +0 -1
  514. package/build/models/ui/raffle-list/index.js +0 -1
  515. package/build/store/base.js +0 -1
  516. package/build/store/blog/index.d.ts +0 -26
  517. package/build/store/blog/index.js +0 -1
  518. package/build/store/brand/index.d.ts +0 -12
  519. package/build/store/brand/index.js +0 -1
  520. package/build/store/cart/api.d.ts +0 -10
  521. package/build/store/cart/api.js +0 -1
  522. package/build/store/category/index.d.ts +0 -12
  523. package/build/store/category/index.js +0 -1
  524. package/build/store/checkout/index.d.ts +0 -16
  525. package/build/store/checkout/index.js +0 -1
  526. package/build/store/customer/api.d.ts +0 -54
  527. package/build/store/customer/api.js +0 -1
  528. package/build/store/html-meta-data/index.d.ts +0 -6
  529. package/build/store/html-meta-data/index.js +0 -1
  530. package/build/store/location/index.d.ts +0 -9
  531. package/build/store/location/index.js +0 -1
  532. package/build/store/merchant/index.d.ts +0 -6
  533. package/build/store/product/index.d.ts +0 -47
  534. package/build/store/product/index.js +0 -1
  535. package/build/store/raffle/index.d.ts +0 -15
  536. package/build/store/raffle/index.js +0 -1
  537. package/build/store/storefront/index.d.ts +0 -5
  538. package/build/utils/currency.d.ts +0 -7
  539. package/build/utils/currency.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { IkasCheckoutSettings } from "../../models/data/checkout-settings";
2
+ import { IkasCheckoutSettings } from "../../models";
3
3
  import { IkasCheckout } from "../../models/data/checkout";
4
4
  export declare type IkasCheckoutPageProps = {
5
5
  checkout: IkasCheckout;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import s from"next/link.js";import a from"react-tooltip";import l,{CheckoutStep as n}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CartSummary as h}from"./components/cart-summary/index.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 g}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/country-settings-model.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/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/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/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/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";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{ContactForm as E}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{StepSuccess as f}from"./steps/step-success/index.js";import{Modal as y}from"./components/modal/index.js";import x from"./components/master-pass/modal-otp/index.js";import k from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as C}from"../image/index.js";import b,{Step as N}from"./components/step-container/index.js";import{StockError as F}from"./components/error/stock-error/index.js";import{FullscreenLoading as M}from"./components/fullscreen-loading/index.js";import T from"./components/notification-box/index.js";import{FormItem as P}from"./components/form-item/index.js";import{FormItemType as S}from"./components/form-item/model.js";import{Button as A}from"./components/button/index.js";import{IkasPageHead as w}from"../page/head.js";import I from"./components/offer-product/index.js";import V from"./components/svg/ikas.js";import O from"./style.module.scss.js";import{Analytics as B}from"../../analytics/analytics.js";import"../../analytics/head/index.js";var L=i((function(e){var t,i,s,m=e.checkout,p=e.checkoutSettings,u=e.customizationProps,v=e.returnPolicy,E=e.privacyPolicy,C=e.termsOfService,b=e.imprint,N=e.shippingPolicy,T=d().t,P=r(),S=o.useState((function(){return new l(m,p,P,v,E,C,b,N,T,u||{})}))[0];return S.step===n.PAYMENT&&B.disableHTML(),o.useEffect((function(){S.checkoutSettings.isAccountRequired&&!S.checkout.hasCustomer&&P.push("/account/login?redirect="+encodeURIComponent(S.checkoutUrl)),B.beginCheckout(S.checkout),B.pageView(g.CHECKOUT)}),[]),o.useEffect((function(){S.customizationProps=u,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(u)}),[u]),S.isCheckoutLoaded&&S.store.customerStore.initialized?S.checkout.hasCustomer&&(null===(t=S.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(i=S.checkout.customer)||void 0===i?void 0:i.id)?(P.push("/account/login?redirect="+encodeURIComponent(S.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(w,{pageType:g.CHECKOUT,pageTitle:((null===(s=S.merchantSettings)||void 0===s?void 0:s.merchantName)||"")+" - "+T("checkout-page:securePayment"),pageDescription:T("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:O.CheckoutPage},o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:O.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:O.Left},o.createElement("div",{className:O.LeftContent},o.createElement("div",null,o.createElement(R,{vm:S}),S.hasStockError&&o.createElement("div",{className:O.ErrorContainer},o.createElement(F,{vm:S,error:S.error})),!S.hasStockError&&o.createElement(o.Fragment,null,o.createElement(h,{vm:S,allowExpand:!0}),S.step===n.SUCCESS?o.createElement(f,{vm:S}):o.createElement(o.Fragment,null,S.checkoutCampaignOffer&&o.createElement(I,{vm:S,campaignOffer:S.checkoutCampaignOffer}),o.createElement(D,{vm:S}))),o.createElement("div",{className:O.Space})),o.createElement(G,{vm:S}))),o.createElement("div",{className:O.Right},o.createElement("div",{className:O.RightContent},o.createElement(h,{vm:S}),o.createElement("div",{className:O.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(V,null))))),!!S.policyModalText&&o.createElement(y,{title:S.policyModalTitle,modalContent:S.policyModalText,onClose:function(){S.policyModalText=""}}),S.isContactModalVisible&&o.createElement(Y,{vm:S,setVisible:S.setContactModalVisible}),S.mpVM.isOtpModalVisible&&o.createElement(x,{vm:S,visible:S.mpVM.isOtpModalVisible,type:S.mpVM.otpModalType,onClose:S.mpVM.hideOtpModal}),S.mpVM.isResponseModalVisible&&o.createElement(k,{visible:S.mpVM.isResponseModalVisible,text:S.mpVM.mfsResponseModalText,onClose:S.mpVM.onResponseModalClose}),S.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:S.mpVM.isSuccessModalVisible,type:S.mpVM.successModalType,onClose:S.mpVM.onSuccessModalClose}))):o.createElement(M,null)})),R=i((function(e){var t,i,r,a=e.vm,l=d().t;return o.createElement("div",{className:O.Header},o.createElement(s,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=a.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:O.Logo},o.createElement(C,{layout:"fill",image:a.merchantSettings.logo,sizes:"360px"})):(null===(i=a.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!a.checkout.hasCustomer&&o.createElement("div",{className:O.LoginText},o.createElement("span",{className:O.LoginCta},l("checkout-page:alreadyHaveAnAccount")),o.createElement(s,{href:"/account/login?redirect="+encodeURIComponent(a.checkoutUrl),passHref:!0},o.createElement("a",{className:O.LoginBtn},l("checkout-page:actions.login")))),a.checkout.hasCustomer&&o.createElement("div",{className:O.CustomerInfo},o.createElement("div",{className:O.Name},a.checkout.customerFullName),o.createElement("div",{className:O.Email},null===(r=a.checkout.customer)||void 0===r?void 0:r.email)))})),D=i((function(e){var t=e.vm,i=d().t,r=o.useMemo((function(){switch(t.step){case n.INFO:return o.createElement(p,{vm:t});case n.SHIPPING:return o.createElement(u,{vm:t});case n.PAYMENT:return o.createElement(v,{vm:t});case n.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),s=[new N(i("checkout-page:address"),t.step===n.INFO,t.step!==n.INFO,t.step!==n.INFO?o.createElement("div",{className:O.AdressStepInfo},o.createElement(U,{vm:t}),o.createElement("div",{className:O.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==n.INFO?o.createElement("div",{className:O.AddressStepInfoMobile},o.createElement(U,{vm:t})):void 0),new N(i("checkout-page:payment"),t.step===n.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||s.splice(1,0,new N(i("checkout-page:shipping"),t.step===n.SHIPPING,t.step===n.PAYMENT,t.step===n.PAYMENT?o.createElement("div",{className:O.AdressStepInfo},o.createElement(H,{vm:t}),(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:O.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===n.PAYMENT?o.createElement("div",{className:O.AddressStepInfoMobile},o.createElement(H,{vm:t})):void 0)),o.createElement(b,{steps:s,stepContent:r})})),U=i((function(e){var t,i,r,s,a,l,n,c,m,p=e.vm,u=d().t,v=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(i=p.checkout.billingAddress)||void 0===i?void 0:i.lastName)||""):((null===(r=p.checkout.shippingAddress)||void 0===r?void 0:r.firstName)||"")+" "+((null===(s=p.checkout.shippingAddress)||void 0===s?void 0:s.lastName)||"");return o.createElement("div",{className:O.Address},o.createElement("div",{className:[O.Text,O.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:O.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:O.Text},u("checkout-page:receiver")),o.createElement("div",{className:[O.Text,O.Gray].join(" ")},v)),o.createElement("div",{className:[O.Text,O.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.phone:null===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[O.Text,O.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[O.Text,O.Gray].join(" ")},p.isDigitalOnly?null===(c=p.checkout.billingAddress)||void 0===c?void 0:c.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),H=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:O.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:O.LightText}," / "+(0===t.checkout.shippingLines[0].price?i("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),G=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:O.Footer},o.createElement("div",{className:O.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:O.FooterBullet},"•"),o.createElement("div",{className:O.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:O.FooterBullet},"•"),o.createElement("div",{className:O.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:O.FooterBullet},"•"),o.createElement("div",{className:O.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:imprint"),t.policyModalText=t.imprint}},i("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:O.FooterBullet},"•"),o.createElement("div",{className:O.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),Y=i((function(i){var r,s,a,l=i.vm,n=i.setVisible,c=d().t,m=o.useState(!1),p=m[0],u=m[1],v=o.useState(!1),h=v[0],g=v[1],f=o.useState(new E({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];f.email=(null===(r=l.checkout.customer)||void 0===r?void 0:r.email)||"",f.firstName=(null===(s=l.checkout.customer)||void 0===s?void 0:s.firstName)||"",f.lastName=(null===(a=l.checkout.customer)||void 0===a?void 0:a.lastName)||"";var x=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,n(!1)]:(u(!0),[4,f.saveContactForm()]);case 1:return e.sent()&&g(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(y,{title:c("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(T,{type:"success",title:c("checkout-page:contactFormSent"),content:c("checkout-page:contactFormDescription")})),o.createElement(P,{type:S.TEXT_AREA,label:"",value:f.message||"",onChange:f.onMessageChange,textAreaPlaceholder:c("checkout-page:contactFormCta")}),o.createElement(A,{style:{width:"100%",marginTop:"24px"},text:c(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!f.message,onClick:x})),onClose:function(){return n(!1)}})}));export{L as default};
1
+ import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import n from"next/link.js";import c from"react-tooltip";import s from"./model.js";import{IkasOrderFunctions as a,IkasOrderAddressFunctions as l,formatCurrency as m}from"@ikas/storefront-model-functions";import{useTranslation as d}from"../../utils/i18n.js";import u from"./steps/step-info/index.js";import{CheckoutStepShipping as p}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CartSummary as h}from"./components/cart-summary/index.js";import{IkasThemeJsonPageType as f}from"@ikas/storefront-models";import"@ikas/localized-address";import"mobx";import"@ikas/storefront-api";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasStorefrontConfig as g}from"@ikas/storefront-config";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/product-list/functions.js";import"../../models/ui/product-list/index.js";import"@ikas/storefront-providers";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{ContactForm as E}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import{StepSuccess as y}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import C from"./components/master-pass/modal-otp/index.js";import x from"./components/master-pass/modal-response/index.js";import b from"./components/master-pass/modal-success/index.js";import{Image as j}from"../image/index.js";import N,{Step as F}from"./components/step-container/index.js";import{StockError as P}from"./components/error/stock-error/index.js";import{FullscreenLoading as M}from"./components/fullscreen-loading/index.js";import T from"./components/notification-box/index.js";import{FormItem as S}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as I}from"../page/head.js";import B from"./components/offer-product/index.js";import O from"./components/svg/ikas.js";import L from"./style.module.scss.js";import{disableHTML as V,beginCheckout as _,pageView as R}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import U from"./components/epaykolay-button/index.js";import"../../store/base/index.js";import"lodash/flatten";import"lodash/sortBy";import"../../store/customer/account-auth/data.js";import"../../store/customer/consent/data.js";import"../../store/customer/captcha/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"lodash/cloneDeep";import{IkasCustomerStore as D}from"../../store/customer/index.js";import'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import"../../store/cart/index.js";import"../../store/customer/marketing/data.js";import"../../store/customer/order/data.js";import{CheckoutStep as K}from"./types.js";var H=i((function(i){var n,l,m,u=i.checkout,p=i.checkoutSettings,v=i.customizationProps,E=i.returnPolicy,j=i.privacyPolicy,N=i.termsOfService,F=i.imprint,T=i.shippingPolicy,S=d().t,A=r(),w=o.useState((function(){return new s(u,p,A,E,j,N,F,T,S,v||{})}))[0];w.step===K.PAYMENT&&V();var H=function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/get-basket"),[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":g.getApiKey()},body:JSON.stringify({cartId:w.checkout.id,customerNumber:o,sessionsState:Date.now()})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){w.checkoutSettings.isAccountRequired&&!W(w.checkout)&&A.push("/account/login?redirect="+encodeURIComponent(w.checkoutUrl)),_(w.checkout),R(f.CHECKOUT)}),[]),o.useEffect((function(){w.customizationProps=v,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(v)}),[v]),o.useEffect((function(){if(w.isEPayKolayEnabled)var o=setInterval((function(){var i;window.setContainerService&&w.isCheckoutLoaded&&(window.setContainerService(null===(i=g.getMerchantSettings())||void 0===i?void 0:i.merchantId,H,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,z(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),w.isEPayKolayPayment=!0}),"https://cdn-epeykolay.mncdn.com/epay/"),clearInterval(o))}),100)}),[]);var z=o.useCallback((function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/complete-payment"),{method:"POST",body:JSON.stringify({data:o,cartId:w.checkout.id}),headers:{"Content-Type":"application/json","x-api-key":g.getApiKey()}})];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),[2,"".concat(window.location.pathname,"?id=").concat(w.checkout.id,"&step=").concat(e.success?"success":"info")]}}))}))}),[]);if(!w.isCheckoutLoaded||!D.initialized)return o.createElement(M,null);var W=a.hasCustomer;if(W(u)&&(null===(n=D.customer)||void 0===n?void 0:n.id)!==(null===(l=w.checkout.customer)||void 0===l?void 0:l.id))return A.push("/account/login?redirect="+encodeURIComponent(w.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(I,{pageType:f.CHECKOUT,pageTitle:((null===(m=w.merchantSettings)||void 0===m?void 0:m.merchantName)||"")+" - "+S("checkout-page:securePayment"),pageDescription:S("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:L.CheckoutPage},o.createElement(c,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:L.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[L.Left,w.isEPayKolayPayment?L.epaykolay:""].join(" ")},w.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!w.isEPayKolayPayment&&o.createElement("div",{className:L.LeftContent},o.createElement("div",null,o.createElement(G,{vm:w}),o.createElement("div",null,w.step!==K.SUCCESS&&w.isEPayKolayEnabled&&o.createElement(U,{onClick:function(){window.frictionless()}})),w.hasStockError&&o.createElement("div",{className:L.ErrorContainer},o.createElement(P,{vm:w,error:w.error})),!w.hasStockError&&o.createElement(o.Fragment,null,o.createElement(h,{vm:w,allowExpand:!0}),w.step===K.SUCCESS?o.createElement(y,{vm:w}):o.createElement(o.Fragment,null,w.checkoutCampaignOffer&&o.createElement(B,{vm:w,campaignOffer:w.checkoutCampaignOffer}),o.createElement(Y,{vm:w}))),o.createElement("div",{className:L.Space})),o.createElement(X,{vm:w}))),o.createElement("div",{className:L.Right},o.createElement("div",{className:L.RightContent},o.createElement(h,{vm:w}),o.createElement("div",{className:L.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===g.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(O,null))))),!!w.policyModalText&&o.createElement(k,{title:w.policyModalTitle,modalContent:w.policyModalText,onClose:function(){w.policyModalText=""}}),w.isContactModalVisible&&o.createElement(q,{vm:w,setVisible:w.setContactModalVisible}),w.mpVM.isOtpModalVisible&&o.createElement(C,{vm:w,visible:w.mpVM.isOtpModalVisible,type:w.mpVM.otpModalType,onClose:w.mpVM.hideOtpModal}),w.mpVM.isResponseModalVisible&&o.createElement(x,{visible:w.mpVM.isResponseModalVisible,text:w.mpVM.mfsResponseModalText,onClose:w.mpVM.onResponseModalClose}),w.mpVM.isSuccessModalVisible&&o.createElement(b,{visible:w.mpVM.isSuccessModalVisible,type:w.mpVM.successModalType,onClose:w.mpVM.onSuccessModalClose})))})),G=i((function(e){var t,i,r,c=e.vm,s=d().t,l=a.hasCustomer,m=a.getCustomerFullName;return o.createElement("div",{className:L.Header},o.createElement(n,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=c.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:L.Logo},o.createElement(j,{layout:"fill",image:c.merchantSettings.logo,sizes:"360px"})):(null===(i=c.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!l(c.checkout)&&o.createElement("div",{className:L.LoginText},o.createElement("span",{className:L.LoginCta},s("checkout-page:alreadyHaveAnAccount")),o.createElement(n,{href:"/account/login?redirect="+encodeURIComponent(c.checkoutUrl),passHref:!0},o.createElement("a",{className:L.LoginBtn},s("checkout-page:actions.login")))),l(c.checkout)&&o.createElement("div",{className:L.CustomerInfo},o.createElement("div",{className:L.Name},m(c.checkout)),o.createElement("div",{className:L.Email},null===(r=c.checkout.customer)||void 0===r?void 0:r.email)))})),Y=i((function(e){var t=e.vm,i=d().t,r=o.useMemo((function(){switch(t.step){case K.INFO:return o.createElement(u,{vm:t});case K.SHIPPING:return o.createElement(p,{vm:t});case K.PAYMENT:return o.createElement(v,{vm:t});case K.SUCCESS:return o.createElement(y,{vm:t})}}),[t,t.step]),n=[new F(i("checkout-page:address"),t.step===K.INFO,t.step!==K.INFO,t.step!==K.INFO?o.createElement("div",{className:L.AdressStepInfo},o.createElement(z,{vm:t}),o.createElement("div",{className:L.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==K.INFO?o.createElement("div",{className:L.AddressStepInfoMobile},o.createElement(z,{vm:t})):void 0),new F(i("checkout-page:payment"),t.step===K.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new F(i("checkout-page:shipping"),t.step===K.SHIPPING,t.step===K.PAYMENT,t.step===K.PAYMENT?o.createElement("div",{className:L.AdressStepInfo},o.createElement(W,{vm:t}),(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:L.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===K.PAYMENT?o.createElement("div",{className:L.AddressStepInfoMobile},o.createElement(W,{vm:t})):void 0)),o.createElement(N,{steps:n,stepContent:r})})),z=i((function(e){var t,i,r,n,c,s,a,m=e.vm,u=d().t,p=l.getOrderAddressText,v=m.isDigitalOnly?((null===(t=m.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(i=m.checkout.billingAddress)||void 0===i?void 0:i.lastName)||""):((null===(r=m.checkout.shippingAddress)||void 0===r?void 0:r.firstName)||"")+" "+((null===(n=m.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:L.Address},o.createElement("div",{className:[L.Text,L.WithMBottom].join(" ")},(null===(c=m.checkout.customer)||void 0===c?void 0:c.email)||""),"address"===m.deliveryMethod?o.createElement("div",{className:L.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:L.Text},u("checkout-page:receiver")),o.createElement("div",{className:[L.Text,L.Gray].join(" ")},v)),o.createElement("div",{className:[L.Text,L.Gray].join(" ")},m.isDigitalOnly?null===(s=m.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(a=m.checkout.shippingAddress)||void 0===a?void 0:a.phone),"in-store"===m.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[L.Text,L.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[L.Text,L.Gray].join(" ")},m.isDigitalOnly?m.checkout.billingAddress?p(m.checkout.billingAddress):"":m.checkout.shippingAddress?p(m.checkout.shippingAddress):""))})),W=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:L.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:L.LightText}," / "+(0===t.checkout.shippingLines[0].price?i("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),X=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:L.Footer},o.createElement("div",{className:L.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:L.FooterBullet},"•"),o.createElement("div",{className:L.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:L.FooterBullet},"•"),o.createElement("div",{className:L.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:L.FooterBullet},"•"),o.createElement("div",{className:L.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:imprint"),t.policyModalText=t.imprint}},i("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:L.FooterBullet},"•"),o.createElement("div",{className:L.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),q=i((function(i){var r,n,c,s=i.vm,a=i.setVisible,l=d().t,m=o.useState(!1),u=m[0],p=m[1],v=o.useState(!1),h=v[0],f=v[1],g=o.useState(new E({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];g.email=(null===(r=s.checkout.customer)||void 0===r?void 0:r.email)||"",g.firstName=(null===(n=s.checkout.customer)||void 0===n?void 0:n.firstName)||"",g.lastName=(null===(c=s.checkout.customer)||void 0===c?void 0:c.lastName)||"";var y=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,a(!1)]:(p(!0),[4,g.saveContactForm()]);case 1:return e.sent()&&f(!0),p(!1),[2]}}))}))}),[u]);return o.createElement(k,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(T,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(S,{type:A.TEXT_AREA,label:"",value:g.message||"",onChange:g.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:l(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:u,isDisabled:!g.message,onClick:y})),onClose:function(){return a(!1)}})}));export{H as default};
@@ -1,18 +1,16 @@
1
1
  import { NextRouter } from "next/router.js";
2
- import { IkasMerchantSettings, IkasAvailableShippingMethod, IkasOrderLineItem, IkasOrderTransaction, IkasProduct, IkasProductVariant, IkasCartCampaignOffer, IkasCheckout, IkasStockLocation, IkasAvailableStockLocation, IkasCampaignOfferTargetPageType, IkasCampaignOfferProduct, IkasLocalizedCustomerAddress } from "../../models";
3
- import { IkasPaymentGateway } from "../../models/data/payment-gateway";
4
- import { IkasOrderLineVariant } from "../../models/data/order/line-item/variant";
5
- import { IkasStorefront } from "../../models/data/storefront";
2
+ import { IkasAvailableShippingMethod, IkasOrderLineItem, IkasOrderTransaction, IkasProduct, IkasProductVariant, IkasCartCampaignOffer, IkasStockLocation, IkasAvailableStockLocation, IkasCampaignOfferTargetPageType, IkasCampaignOfferProduct, IkasLocalizedCustomerAddress } from "../../models";
6
3
  import CreditCardData from "./components/credit-card-form/model";
7
- import { IkasCheckoutSettings } from "../../models/data/checkout-settings";
8
4
  import { TFunction } from "../../utils/i18n";
9
5
  import { IkasCheckoutCustomizationProps } from ".";
10
6
  import MasterPassModel from "./modelMasterPass";
11
7
  import { APIResponse } from "@ikas/fe-api-client";
12
- import { CreateStripePaymentIntentResponse, RetrieveInstallmentInfoResponse, UpdateCartCampaignOfferInput, CreateKlarnaTokenResponse, CreateAdyenSessionResponse } from "@ikas/storefront-api";
13
- import { IkasBaseStore } from "../../store";
8
+ import { CreateStripePaymentIntentResponse, RetrieveInstallmentInfoResponse, UpdateCartCampaignOfferInput, CreateKlarnaTokenResponse, CreateAdyenSessionResponse, GetPaypalClientIdResponse, CreatePaypalOrderResponse } from "@ikas/storefront-api";
14
9
  import { RetrieveInstallmentInfoQueryParams, SaveCartInput } from "@ikas/storefront-api";
15
- import CountrySettingsModel from "../../models/data/checkout/country-settings-model";
10
+ import { LocalizedAddressModel } from "@ikas/localized-address";
11
+ import { IkasCheckoutSettings, IkasPaymentGateway, IkasStorefront } from "@ikas/storefront-models";
12
+ import { IkasCheckout } from "../../models/data/checkout";
13
+ import { CampaignOfferType, CheckoutError, CheckoutStep } from "./types";
16
14
  export declare type IUnavailableItems = {
17
15
  item: IkasOrderLineItem;
18
16
  stockCount: number;
@@ -28,6 +26,7 @@ export default class CheckoutViewModel {
28
26
  isTermsAndConditionsChecked: boolean;
29
27
  isChangingShippingMethod: boolean;
30
28
  isContactModalVisible: boolean;
29
+ isEPayKolayPayment: boolean;
31
30
  step: CheckoutStep;
32
31
  customizationProps?: IkasCheckoutCustomizationProps | null;
33
32
  cardData?: CreditCardData | null;
@@ -47,9 +46,11 @@ export default class CheckoutViewModel {
47
46
  isKlarnaPaymentCompleted: boolean;
48
47
  adyenResponse: CreateAdyenSessionResponse | null;
49
48
  adyenDropinElement: any;
49
+ payPalClientIdResponse: GetPaypalClientIdResponse | null;
50
+ paypalOrderResponse: CreatePaypalOrderResponse | null;
50
51
  checkoutCampaignOffer: CampaignOfferType | undefined;
51
52
  postCheckoutCampaignOffer: CampaignOfferType | undefined;
52
- countrySettings: CountrySettingsModel;
53
+ countrySettings: LocalizedAddressModel;
53
54
  returnPolicy: string;
54
55
  privacyPolicy: string;
55
56
  termsOfService: string;
@@ -67,7 +68,7 @@ export default class CheckoutViewModel {
67
68
  init: () => Promise<void>;
68
69
  initStep: () => Promise<void>;
69
70
  getSuccessTransaction: () => Promise<void>;
70
- get merchantSettings(): IkasMerchantSettings;
71
+ get merchantSettings(): import("@ikas/storefront-models").IkasMerchantSettings;
71
72
  get selectedPaymentGatewayIndex(): number;
72
73
  get selectedInstallmentIndex(): number;
73
74
  get checkoutUrl(): string;
@@ -81,22 +82,26 @@ export default class CheckoutViewModel {
81
82
  get hasStockError(): boolean;
82
83
  get isPaymentGatewayHasMasterPass(): boolean;
83
84
  get hasQuickRegistration(): boolean | null;
84
- get canProceedToShipping(): boolean | undefined;
85
+ get canProceedToShipping(): boolean | null | undefined;
85
86
  get canProceedToInStoreDelivery(): boolean;
86
- get canProceedToPayment(): boolean | undefined;
87
+ get canProceedToPayment(): boolean | null | undefined;
87
88
  get isInStoreDelivery(): boolean;
88
89
  get klarnaPaymentGateway(): IkasPaymentGateway | undefined;
89
90
  get klarnaPaymentGatewayIndex(): number;
90
91
  get adyenPaymentGateway(): IkasPaymentGateway | undefined;
91
92
  get adyenPaymentGatewayIndex(): number;
92
- get isCustomFlowStripe(): false | import("../../models").IkasPaymentGatewaySettings | null | undefined;
93
+ get payPalPaymentGateway(): IkasPaymentGateway | undefined;
94
+ get payPalPaymentGatewayIndex(): number;
95
+ get isCustomFlowStripe(): false | import("@ikas/storefront-models").IkasPaymentGatewaySettings | null | undefined;
93
96
  get isKlarna(): boolean | null | undefined;
94
97
  get isAdyen(): boolean | null | undefined;
95
- get store(): IkasBaseStore;
98
+ get isPayPal(): boolean | null | undefined;
96
99
  get canPerformPayment(): boolean | undefined;
97
100
  get isDigitalOnly(): boolean;
98
101
  get customerAddresses(): IkasLocalizedCustomerAddress[] | undefined;
99
- saveCart: () => Promise<import("../../models").IkasCart | null | undefined>;
102
+ get isManualOrder(): boolean;
103
+ get isEPayKolayEnabled(): boolean;
104
+ saveCart: () => Promise<import("@ikas/storefront-models").IkasCart | null | undefined>;
100
105
  inStockDeliveryInputData: (input: SaveCartInput) => Promise<SaveCartInput>;
101
106
  checkStocks: () => Promise<void>;
102
107
  setIsKlarnaPaymentCompleted: (status: boolean) => Promise<void>;
@@ -131,6 +136,7 @@ export default class CheckoutViewModel {
131
136
  onProceedToShippingClick: () => Promise<void>;
132
137
  onProceedToDigitalOnlyPaymentClick: () => Promise<void>;
133
138
  onProceedToPaymentClick: () => Promise<void>;
139
+ checkPaypalButtonAvailable: () => boolean;
134
140
  onCompletePaymentClick: () => Promise<void>;
135
141
  onCompleteDigitalOnlyPaymentClick: () => Promise<void>;
136
142
  createSaleTransaction: () => Promise<void>;
@@ -155,37 +161,9 @@ export default class CheckoutViewModel {
155
161
  getCampaignOffer: () => Promise<void>;
156
162
  updateCartCampaignOffer: (props: UpdateCartCampaignOfferInput) => Promise<void>;
157
163
  registerCustomer: (password: string) => Promise<APIResponse<{
158
- customer: import("../../models").IkasCustomer | null;
164
+ customer: import("@ikas/storefront-models").IkasCustomer | null;
159
165
  token: string;
160
166
  tokenExpiry: number;
161
167
  } | null> | undefined>;
162
168
  setAdyenDropinElement(element: any): void;
163
169
  }
164
- export declare enum CheckoutStep {
165
- INFO = "info",
166
- SHIPPING = "shipping",
167
- PAYMENT = "payment",
168
- SUCCESS = "success"
169
- }
170
- export declare enum ErrorType {
171
- UNKNOWN = 0,
172
- API_ERROR = 1,
173
- STOCK_ERROR = 2,
174
- PAYMENT_ERROR = 3,
175
- NO_SHIPPING_ERROR = 4,
176
- CUSTOMER_LOGIN_REQUIRED_ERROR = 5
177
- }
178
- export declare type CheckoutError = {
179
- type: ErrorType;
180
- data?: any;
181
- };
182
- export declare type StockErrorData = {
183
- variant: IkasOrderLineVariant;
184
- availableQuantity: number;
185
- };
186
- export declare type CampaignOfferType = {
187
- product: IkasProduct;
188
- variants: IkasProductVariant[];
189
- campaignOffer: IkasCartCampaignOffer;
190
- offer: IkasCampaignOfferProduct;
191
- };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";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 o,IkasPaymentGatewayType as a,IkasOrderShippingMethod as c,IkasTransactionStatus as d,IkasCartCampaignOfferStatus as u,IkasCampaignOfferTargetPageType as l}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 h}from"../../models/data/checkout/index.js";import p from"../../models/data/checkout/country-settings-model.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import{IkasCustomerAddress as m}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as f}from"../../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 g}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as v}from"../../models/data/order/customer/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/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{IkasProduct as y}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";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 S from"./components/credit-card-form/model.js";import k from"../../store/customer/api.js";import b from"../../store/checkout/index.js";import C from"../../store/cart/api.js";import I,{MFS_ELEMENT_ID as A,MFS_SCRIPT_URL as P}from"./modelMasterPass.js";import w from"../../store/product/index.js";import{IkasBaseStore as N}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as E}from"@ikas/storefront-config";import{Analytics as j}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as O,CheckStocksLineInput as R}from"@ikas/storefront-api";import x from"../../models/data/order/address/ikas-localized-order-address.js";var D,T,G=/^\d+$/,M="undefined"==typeof localStorage,L=function(){function G(c,f,g,G,L,U,K,F,B,H){var Y=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=D.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.adyenResponse=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return t(Y,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,N.getInstance().customerStore.waitUntilInitialized()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 3:return t.sent(),[4,this.initStep()];case 4:return t.sent(),[2]}}))}))},this.initStep=function(){return t(Y,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(E.getIsEditor())return this.step=D.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===D.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(D.INFO)];if(this.step!==D.PAYMENT||this.canProceedToPayment){if(this.step===D.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(D.INFO)];if(![D.INFO,D.SUCCESS,D.SHIPPING,D.PAYMENT].includes(this.step))return[2,this.changeStep(D.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(D.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:T.PAYMENT_ERROR,data:n||null}),this.step!==D.INFO?[3,4]:[4,this.getShippingCountries()];case 1:return e.sent(),this.checkShippingCountries(),[4,this.getStockLocations()];case 2:return e.sent(),[4,this.getAvailableStockLocations()];case 3:e.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),e.label=4;case 4:return this.step!==D.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=D.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==D.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==D.PAYMENT&&this.step!==D.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:T.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 5:return e.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,7];case 6:e.sent(),e.label=7;case 7:if(!this.paymentGateways.length)return this.error={type:T.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===D.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(D.SUCCESS)]:[3,9];case 9:return[4,this.initialStockCheck()];case 10:e.sent(),e.label=11;case 11:return[3,14];case 12:return[4,this.getSuccessTransaction()];case 13:e.sent(),this.successTransaction&&(r=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===r}))),e.label=14;case 14:return this.isCheckoutLoaded=!0,j.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,k.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return t=e.sent(),this.successTransaction=t.isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)?t.data[t.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return t(Y,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return t=new O(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return this.step!==D.INFO&&this.step!==D.SHIPPING||this.isDigitalOnly||(t.billingAddress=null),this.isDigitalOnly&&(t.shippingAddress=null),[4,C.saveCart({input:t})];case 3:if((null==(i=e.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(n=s.extensions)||void 0===n?void 0:n.code)?{type:T.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:T.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(Y,void 0,void 0,(function(){var t,s,n=this;return e(this,(function(e){return t=i,(s=this.stockLocations.find((function(t){return t.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(Y,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,l,h;return e(this,(function(e){switch(e.label){case 0:return t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,b.checkStocks({lines:t.map((function(t){return new R(t)})),stockLocationIdList:(null===(u=E.getStockLocationIds())||void 0===u?void 0:u.length)?E.getStockLocationIds():null})];case 1:if(!(i=e.sent()).isSuccess)throw{type:T.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(h=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=o.checkout.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push({item:e,stockCount:t.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:T.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return t(Y,void 0,void 0,(function(){return e(this,(function(t){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return t(Y,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,N.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,b.getAvailableShippingCountries({salesChannelId:E.getSalesChannelId()})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return E.getPickupStockLocationIds()?[4,b.listStockLocation({id:{in:E.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:T.API_ERROR,data:t.firstErrorMessage},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return E.getPickupStockLocationIds()?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,b.getAvailableStockLocations({lines:t.map((function(t){return new R(t)})),stockLocationIdList:E.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:T.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=Y.shippingCountryIds)||void 0===t?void 0:t.length)||(Y.error={type:T.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(Y.checkout.stockLocationId=null),Y.deliveryMethod=t,Y.isErrorsVisible=!1},this.initialStockCheck=function(){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:T.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(Y,void 0,void 0,(function(){var t,i,s,n,o,a,c,d,u,l,h=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=E.getPaymentGateways().map((function(t){return t.id})),[4,b.listPaymentGateway({id:t?void 0:{in:i},locale:E.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=e.sent()).isSuccess&&(null===(u=s.data)||void 0===u?void 0:u.length)?(n=s.data,this.step===D.PAYMENT&&(n=n.filter((function(t){var e;return!(null===(e=t.supportedCurrencies)||void 0===e?void 0:e.length)||t.supportedCurrencies.includes(h.checkout.currencyCode)})),(o=null===(l=this.checkout.shippingAddress)||void 0===l?void 0:l.country)&&o.iso2&&(n=n.filter((function(t){var e;return!(null===(e=t.availableCountries)||void 0===e?void 0:e.length)||t.availableCountries.includes(o.iso2||"")})))),a=[],r(E.getPaymentGateways(),"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===D.PAYMENT&&(c=n.find((function(t){return!!t.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=A,d.src=P,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:N.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:T.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(Y,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,b.retrieveInstallmentInfo(i)];case 1:return t=e.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;Y.store.customerStore.customer?(null===(t=Y.customerAddresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=Y.checkoutSettings})),Y.checkout.customer=new v(Y.store.customerStore.customer)):Y.checkout.customer=new v(Y.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){Y.checkout.shippingAddress&&(Y.checkout.shippingAddress.checkoutSettings=Y.checkoutSettings,Y.checkout.shippingAddress.countrySettings=Y.countrySettings)},this.setCheckoutBillingAddressSettings=function(){Y.checkout.billingAddress&&(Y.checkout.billingAddress.checkoutSettings=Y.checkoutSettings,Y.checkout.billingAddress.countrySettings=Y.countrySettings)},this.createShippingAddress=function(){if(!Y.isDigitalOnly)if(Y.isInStoreDelivery)Y.setCheckoutShippingAddressSettings();else if(Y.checkout.shippingAddress){if(Y.store.customerStore.customer){var t=null==(e=Y.customerAddresses)?void 0:e.find((function(t){var e;return t.id===(null===(e=Y.checkout.shippingAddress)||void 0===e?void 0:e.id)}));if(t)return Y.onSelectedShippingAddressIdChange(t.id||"-1"),void Y.setCheckoutShippingAddressSettings()}Y.checkout.shippingAddress=new x(n(Y.checkout.shippingAddress)||{}),Y.setCheckoutShippingAddressSettings()}else if(Y.store.customerStore.customer){var e=Y.customerAddresses;Y.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}else Y.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(Y.useDifferentAddress=!!localStorage.getItem("sAddr"),Y.checkout.billingAddress){if(Y.store.customerStore.customer){var t=null==(e=Y.customerAddresses)?void 0:e.find((function(t){var e;return t.id===(null===(e=Y.checkout.billingAddress)||void 0===e?void 0:e.id)}));if(t)return Y.onSelectedBillingAddressIdChange(t.id||"-1"),void Y.setCheckoutBillingAddressSettings()}Y.checkout.billingAddress=new x(n(Y.checkout.billingAddress)||{}),Y.setCheckoutBillingAddressSettings()}else if(Y.store.customerStore.customer){var e=Y.customerAddresses;Y.onSelectedBillingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1"),(null==e?void 0:e.length)||Y.useDifferentAddress||!Y.checkout.shippingAddress||Y.isInStoreDelivery||(Y.checkout.billingAddress=new x(n(Y.checkout.shippingAddress)),Y.setCheckoutBillingAddressSettings())}else Y.onSelectedBillingAddressIdChange("-1"),Y.useDifferentAddress||!Y.checkout.shippingAddress||Y.isInStoreDelivery||(Y.checkout.billingAddress=new x(n(Y.checkout.shippingAddress)),Y.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCart()]);case 1:return(t=e.sent())&&(this.checkout=new h(t,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(Y,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(Y,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,C.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=e.sent()).isSuccess&&t.data?(s=t.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===D.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice}})]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:s&&(r=this.checkout,this.checkout=new h(i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),e.label=4;case 4:return t.isSuccess||(this.couponError=t.errorCodes[0]),[3,6];case 5:return e.sent(),[3,6];case 6:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e;if(Y.selectedShippingAddressId=t,"-1"===t)Y.checkout.shippingAddress=new x,Y.checkout.shippingAddress.countrySettings=Y.countrySettings;else{var i=null===(e=Y.customerAddresses)||void 0===e?void 0:e.find((function(e){return e.id===t}));i&&(Y.checkout.shippingAddress=new x(i),Y.checkout.shippingAddress.countrySettings=Y.countrySettings)}Y.checkout.shippingAddress&&(Y.checkout.shippingAddress.checkoutSettings=Y.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e;if(Y.selectedBillingAddressId=t,"-1"===t)Y.checkout.billingAddress=new x,Y.checkout.billingAddress.countrySettings=Y.countrySettings;else{var i=null===(e=Y.customerAddresses)||void 0===e?void 0:e.find((function(e){return e.id===t}));i&&(Y.checkout.billingAddress=new x(i),Y.checkout.billingAddress.countrySettings=Y.countrySettings)}Y.checkout.billingAddress&&(Y.checkout.billingAddress.checkoutSettings=Y.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){Y.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(Y.cardData&&(!(t.length>Y.cardData.cardNumber.length)||V(t))){var e=(Y.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!Y.installmentInfo?Y.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:Y.checkout.selectedPaymentGateway.id,price:Y.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(Y.cardData.installmentCount=1,Y.installmentInfo=void 0),Y.cardData.cardNumber=_(i,4).join(" "))}},this.onCardHolderNameChange=function(t){Y.cardData&&(Y.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(Y.cardData&&(!(t.length>Y.cardData.expirationDate.length)||V(t))){if(0===(null===(e=Y.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.replace(".","/").split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(Y.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(Y.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(Y.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=t.split(" / ").join("");d.length>4||(Y.cardData.expirationDate=_(d,2).join(" / "))}},this.onCvcChange=function(t){Y.cardData&&(t.length>Y.cardData.cvv.length&&!V(t)||t.length>4||(Y.cardData.cvv=t))},this.saveAddress=function(s){return t(Y,void 0,void 0,(function(){var t,r,o,a,c,d,u,l,h,p,f,g,v=this;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(t){return t.id})),o=new m(i(i({},t),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:e.sent(),null===(f=this.customerAddresses)||void 0===f||f.forEach((function(t){return t.checkoutSettings=v.checkoutSettings})),c=null===(g=this.customerAddresses)||void 0===g?void 0:g.map((function(t){return t.id})),d=null==c?void 0:c.filter((function(t){return!(null==r?void 0:r.includes(t))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),e.label=2;case 2:return[3,4];case 3:return l=e.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){Y.router.push("/cart")},this.onBackToShoppingClick=function(){Y.router.push("/")},this.onGoToLoginClick=function(){Y.router.push("/account/login")},this.onProceedToShippingClick=function(){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:e.sent(),e.label=3;case 3:return[4,this.checkStocks()];case 4:return e.sent(),[4,this.saveCart()];case 5:return e.sent(),"address"===this.deliveryMethod?this.changeStep(D.SHIPPING):this.changeStep(D.PAYMENT),[3,7];case 6:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:T.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.changeStep(D.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:T.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.error=void 0,this.changeStep(D.PAYMENT),[3,5];case 4:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:T.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isKlarna?[4,this.saveCart()]:[3,2]):(this.isErrorsVisible=!0,[2]);case 1:return e.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return e.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return e.sent(),"address"!==this.deliveryMethod?[3,5]:[4,this.saveAddress("billing")];case 4:e.sent(),e.label=5;case 5:return[4,this.saveCart()];case 6:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):[4,this.createSaleTransaction()];case 7:return e.sent(),[3,9];case 8:return void 0!==typeof(i=e.sent()).type?this.error=i:this.error={type:T.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return e.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return e.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return e.sent(),[4,this.saveCart()];case 4:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):[4,this.createSaleTransaction()];case 5:return e.sent(),[3,7];case 6:return(i=e.sent()).type?this.error=i:this.error={type:T.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return t(Y,void 0,void 0,(function(){var t,i,s,n,r,c,u,l,h,p,m,f,g,v,y;return e(this,(function(e){switch(e.label){case 0:return(i=this.mpVM.selectedCard)&&(null===(l=this.mpVM.selectedCard)||void 0===l?void 0:l.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(t=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,b.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:t,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)}}})]):[3,2];case 1:return s=e.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,b.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===o.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===a.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=e.sent(),e.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,c=r&&[d.SUCCESS,d.AUTHORIZED].includes(r),u=r===d.PENDING,c?[4,this.getSuccessTransaction()]:[3,7];case 5:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return e.sent(),[3,8];case 7:if(!u||!(null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.returnSlug))throw{data:s.firstErrorMessage,type:T.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,e.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(D.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){Y.changeStep(D.INFO)},this.onBackToShippingClick=function(){Y.changeStep(D.SHIPPING)},this.setCustomerConsentGranted=function(t){Y.checkout.customer&&(Y.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){Y.useDifferentAddress=t,Y.useDifferentAddress?(localStorage.setItem("sAddr","1"),Y.checkout.billingAddress=Y.checkout.billingAddress||new x,Y.checkout.billingAddress.countrySettings=Y.countrySettings):(localStorage.removeItem("sAddr"),Y.checkout.billingAddress=Y.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){Y.shouldSaveAddress=t},this.setAddressTitle=function(t){Y.addressTitle=t},this.setPaymentGateway=function(i){return t(Y,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||!(null===(n=t.settings)||void 0===n?void 0:n.find((function(t){return"allow_custom_flow"===t.label&&"1"===t.value})))||this.stripeResponse?[3,2]:[4,b.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})]:[2];case 1:(s=e.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),e.label=2;case 2:return"KLARNA"!==t.code||this.klarnaResponse?[3,4]:[4,b.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 3:(s=e.sent()).isSuccess&&s.data&&(this.klarnaResponse=s.data),e.label=4;case 4:return"ADYEN"!==t.code||this.adyenResponse?[3,6]:[4,b.createAdyenClientToken({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 5:(s=e.sent()).isSuccess&&s.data&&(this.adyenResponse=s.data),e.label=6;case 6:return this.checkout.selectedPaymentGateway=t,this.step!==D.SUCCESS&&(t.paymentMethodType===o.CREDIT_CARD&&t.type===a.INTERNAL&&(this.cardData=new S,t.masterPassClientId&&(console.log("called 1511 ikas log"),this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store}))),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){Y.cardData&&(Y.cardData.installmentCount=t)},this.changeStep=function(i){return t(Y,void 0,void 0,(function(){return e(this,(function(t){return M||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(Y,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){Y.isContactModalVisible=t},this.getCampaignOfferProducts=function(i){return t(Y,void 0,void 0,(function(){var t,s,n,r;return e(this,(function(o){switch(o.label){case 0:if(!this.checkout.campaignOffers||!this.checkout.campaignOffers.length)return[3,4];if(t=this.checkout.campaignOffers.filter((function(t){var e;return t.status===u.WAITING_FOR_ACTION&&(null===(e=t.campaignOffer)||void 0===e?void 0:e.targetPageTypes.some((function(t){return t===i})))})),!t.length)return[3,4];s=function(i){var s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return(s=t[i]).campaignOffer&&(n=s.campaignOffer.offers.find((function(t){return t.id===s.campaignOfferProductId})))?[4,w.searchProducts({input:{productIdList:[n.productId]}})]:[3,2];case 1:if((r=e.sent()).isSuccess&&r.data&&r.data.data&&r.data.data.length&&(o=r.data.data[0],a=[],n.excludedVariantIdList&&n.excludedVariantIdList.length?o.variants.map((function(t){var e;t.hasStock&&!(null===(e=n.excludedVariantIdList)||void 0===e?void 0:e.some((function(e){return e===t.id})))&&a.push(t)})):a.push.apply(a,o.variants.filter((function(t){return t.hasStock}))),a.length))return[2,{value:{product:new y(o),variants:a,campaignOffer:s,offer:n}}];e.label=2;case 2:return[2]}}))},n=0,o.label=1;case 1:return n<t.length?[5,s(n)]:[3,4];case 2:if("object"==typeof(r=o.sent()))return[2,r.value];o.label=3;case 3:return n++,[3,1];case 4:return[2,void 0]}}))}))},this.getCampaignOffer=function(){return t(Y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getCampaignOfferProducts(l.CHECKOUT)];case 1:return t.checkoutCampaignOffer=e.sent(),i=this,[4,this.getCampaignOfferProducts(l.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=e.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return t(Y,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isCheckoutLoaded=!1,[4,C.updateCartCampaignOffer({input:i})];case 1:return(t=e.sent())&&t.isSuccess&&t.data&&(this.checkout=new h(t.data,this.countrySettings),i.accepted&&this.step===D.SUCCESS?this.changeStep(D.INFO):this.changeStep(this.step)),[2]}}))}))},this.registerCustomer=function(i){return t(Y,void 0,void 0,(function(){var t,s,n,r;return e(this,(function(e){switch(e.label){case 0:return this.checkout.customer?(t=this.checkout.customer,s=t.firstName,n=t.lastName,r=t.email,s&&n&&r?[4,k.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,e.sent()];case 2:return[2]}}))}))},this.checkout=c,this.checkoutSettings=f,this.router=g,this.returnPolicy=G,this.privacyPolicy=L,this.termsOfService=U,this.imprint=K,this.shippingPolicy=F,this.t=B,this.customizationProps=H,this.mpVM=new I,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new p({checkoutSettings:this.checkoutSettings}),this.init(),s(this)}return Object.defineProperty(G.prototype,"merchantSettings",{get:function(){return new g(E.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"selectedInstallmentIndex",{get:function(){var t,e,i=this;return(null===(e=null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices)||void 0===e?void 0:e.findIndex((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=N.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return{label:t.title+" - "+t.addressText,value:t.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"installmentPrice",{get:function(){var t,e,i,s=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(i=null===(e=this.installmentInfo.installmentPrices)||void 0===e?void 0:e.find((function(t){var e;return t.installmentCount===(null===(e=s.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"finalPrice",{get:function(){return this.step===D.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===T.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"canProceedToShipping",{get:function(){var t,e,i;return(this.isDigitalOnly?null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValidAddress:null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.isValidAddress)&&this.checkout.hasValidCustomerEmail&&(null===(i=this.error)||void 0===i?void 0:i.type)!==T.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"klarnaPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"adyenPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"ADYEN"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"ADYEN"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isCustomFlowStripe",{get:function(){var t,e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(t){return"allow_custom_flow"===t.label&&"1"===t.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isKlarna",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"KLARNA"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isAdyen",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"ADYEN"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"store",{get:function(){return N.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValidAddress),r=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===o.CREDIT_CARD&&i.type===a.INTERNAL?!!this.isCustomFlowStripe||(!!this.isKlarna||(null===(e=this.cardData)||void 0===e?void 0:e.isValid)):!!i);return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===c.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"customerAddresses",{get:function(){var t,e,s=this;return null===(e=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return new f(i({countrySettings:s.countrySettings},t))}))},enumerable:!1,configurable:!0}),G.prototype.setAdyenDropinElement=function(t){this.adyenDropinElement=t},G}();function _(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function V(t){return t&&G.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(D||(D={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.API_ERROR=1]="API_ERROR",t[t.STOCK_ERROR=2]="STOCK_ERROR",t[t.PAYMENT_ERROR=3]="PAYMENT_ERROR",t[t.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",t[t.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR"}(T||(T={}));export{D as CheckoutStep,T as ErrorType,L as default};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s,observable as n}from"mobx";import r from"lodash/cloneDeep";import o from"lodash/sortBy";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as c,IkasOrderShippingMethod as d,IkasCartCreatedBy as u,IkasTransactionStatus as l,IkasCartCampaignOfferStatus as h,IkasCampaignOfferTargetPageType as p}from"@ikas/storefront-models";import{LocalizedAddressModel as f}from"@ikas/localized-address";import{createIkasLocalizedOrderAddress as m,isValidAddress as g}from"../../models/data/localized-order-address/functions.js";import{listOrderTransactions as v,saveCart as y,SaveCartInput as k,checkStocks as S,CheckStocksLineInput as b,getAvailableShippingCountries as P,listStockLocations as C,getAvailableStockLocations as A,listPaymentGateway as I,retrieveInstallmentInfo as w,saveCartCouponCode as N,createSaleTransactionWithCart as E,createStripePaymentIntent as O,searchProducts as D,updateCartCampaignOffer as G,register as T,getPayPalClientId as R,createAdyenClientToken as L,createKlarnaClientToken as j}from"@ikas/storefront-api";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasStorefrontConfig as M}from"@ikas/storefront-config";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/product-list/functions.js";import"../../models/ui/product-list/index.js";import"@ikas/storefront-providers";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 x from"./components/credit-card-form/model.js";import V,{MFS_ELEMENT_ID as _,MFS_SCRIPT_URL as U}from"./modelMasterPass.js";import"../../store/base/index.js";import"lodash/flatten";import{IkasCustomerAddressFunctions as K,IkasCheckoutFunctions as B,IkasOrderFunctions as F,IkasProductVariantFunctions as Y}from"@ikas/storefront-model-functions";import{waitForCustomerStoreInit as H,initCustomerStore as W}from"../../store/customer/functions.js";import{checkoutStep as q}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasCustomerStore as Q}from"../../store/customer/index.js";import{saveCustomer as z,logout as Z}from"../../store/customer/account-auth/functions.js";import"../../store/customer/captcha/data.js";import"../../store/customer/consent/data.js";import{createEmailSubscription as X}from"../../store/customer/marketing/functions.js";import"../../store/customer/order/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"../../store/cart/index.js";import{changeItemQuantity as $}from"../../store/cart/functions.js";import{CheckoutStep as J,ErrorType as tt}from"./types.js";var et=/^\d+$/,it="undefined"==typeof localStorage,st=function(){function et(n,d,u,g,K,F,et,st,ot,at){var ct=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isEPayKolayPayment=!1,this.step=J.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return t(ct,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,W()];case 2:return t.sent(),[4,H()];case 3:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 4:return t.sent(),[4,this.initStep()];case 5:return t.sent(),[2]}}))}))},this.initStep=function(){return t(ct,void 0,void 0,(function(){var t,i,s,n,r,o,a,c;return e(this,(function(e){switch(e.label){case 0:if(M.getIsEditor())return this.step=J.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===J.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(J.INFO)];if(this.step!==J.PAYMENT||this.canProceedToPayment){if(this.step===J.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(J.INFO)];if(![J.INFO,J.SUCCESS,J.SHIPPING,J.PAYMENT].includes(this.step))return[2,this.changeStep(J.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(J.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:tt.PAYMENT_ERROR,data:n||null}),this.step!==J.INFO?[3,4]:[4,this.getShippingCountries()];case 1:return e.sent(),this.checkShippingCountries(),[4,this.getStockLocations()];case 2:return e.sent(),[4,this.getAvailableStockLocations()];case 3:e.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),e.label=4;case 4:return this.step!==J.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=J.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==J.SHIPPING||(null===(c=this.checkout.availableShippingMethods)||void 0===c?void 0:c.length)?this.step!==J.PAYMENT&&this.step!==J.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:tt.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 5:return e.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,7];case 6:e.sent(),e.label=7;case 7:if(!this.paymentGateways.length)return this.error={type:tt.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return r=B.isCheckoutComplete,this.step===J.SUCCESS?[3,12]:r(this.checkout)?[2,this.changeStep(J.SUCCESS)]:[3,9];case 9:return[4,this.initialStockCheck()];case 10:e.sent(),e.label=11;case 11:return[3,14];case 12:return[4,this.getSuccessTransaction()];case 13:e.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===o}))),e.label=14;case 14:return this.isCheckoutLoaded=!0,q(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,v({orderId:{eq:this.checkout.id}})];case 1:return t=e.sent(),this.successTransaction=t.isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)?t.data[t.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return t(ct,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return t=new k(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return this.step!==J.INFO&&this.step!==J.SHIPPING||this.isDigitalOnly||(t.billingAddress=null),this.isDigitalOnly&&(t.shippingAddress=null),[4,y({input:t})];case 3:if((null==(i=e.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(n=s.extensions)||void 0===n?void 0:n.code)?{type:tt.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:tt.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(ct,void 0,void 0,(function(){var t,s,n=this;return e(this,(function(e){return t=i,(s=this.stockLocations.find((function(t){return t.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(ct,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,l,h;return e(this,(function(e){switch(e.label){case 0:return this.isManualOrder?[2]:(t=this.checkout.orderLineItems.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,S({lines:t.map((function(t){return new b(t)})),stockLocationIdList:(null===(u=M.getStockLocationIds())||void 0===u?void 0:u.length)?M.getStockLocationIds():null})]);case 1:if(!(i=e.sent()).isSuccess)throw{type:tt.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(h=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=o.checkout.orderLineItems.find((function(e){return e.variant.id===t.variantId}));e&&n.push({item:e,stockCount:t.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:tt.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return t(ct,void 0,void 0,(function(){return e(this,(function(t){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return t(ct,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,$(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,P({salesChannelId:M.getSalesChannelId()})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return M.getPickupStockLocationIds()?[4,C({id:{in:M.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:tt.API_ERROR,data:t.firstErrorMessage},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return M.getPickupStockLocationIds()?(t=this.checkout.orderLineItems.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,A({lines:t.map((function(t){return new b(t)})),stockLocationIdList:M.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:tt.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=ct.shippingCountryIds)||void 0===t?void 0:t.length)||(ct.error={type:tt.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(ct.checkout.stockLocationId=null),ct.deliveryMethod=t,ct.isErrorsVisible=!1},this.initialStockCheck=function(){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:tt.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(ct,void 0,void 0,(function(){var t,i,s,n,r,a,c,d,u,l,h=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=M.getPaymentGateways().map((function(t){return t.id})),[4,I({id:t?void 0:{in:i},locale:M.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=e.sent()).isSuccess&&(null===(u=s.data)||void 0===u?void 0:u.length)?(n=s.data,this.step===J.PAYMENT&&(n=n.filter((function(t){var e;return!(null===(e=t.supportedCurrencies)||void 0===e?void 0:e.length)||t.supportedCurrencies.includes(h.checkout.currencyCode)})),(r=null===(l=this.checkout.shippingAddress)||void 0===l?void 0:l.country)&&r.iso2&&(n=n.filter((function(t){var e;return!(null===(e=t.availableCountries)||void 0===e?void 0:e.length)||t.availableCountries.includes(r.iso2||"")})))),a=[],o(M.getPaymentGateways(),"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===J.PAYMENT&&(c=n.find((function(t){return!!t.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=_,d.src=U,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout})},document.head.appendChild(d)),[2]):(this.error={type:tt.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(ct,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,w(i)];case 1:return t=e.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;Q.customer?(null===(t=ct.customerAddresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=ct.checkoutSettings})),ct.checkout.customer=r(Q.customer)):ct.checkout.customer=r(ct.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ct.checkout.shippingAddress&&(ct.checkout.shippingAddress.checkoutSettings=ct.checkoutSettings,ct.checkout.shippingAddress.countrySettings=ct.countrySettings)},this.setCheckoutBillingAddressSettings=function(){ct.checkout.billingAddress&&(ct.checkout.billingAddress.checkoutSettings=ct.checkoutSettings,ct.checkout.billingAddress.countrySettings=ct.countrySettings)},this.createShippingAddress=function(){if(!ct.isDigitalOnly)if(ct.isInStoreDelivery)ct.setCheckoutShippingAddressSettings();else if(ct.checkout.shippingAddress){if(Q.customer){var t=null==(e=ct.customerAddresses)?void 0:e.find((function(t){var e;return t.id===(null===(e=ct.checkout.shippingAddress)||void 0===e?void 0:e.id)}));if(t)return ct.onSelectedShippingAddressIdChange(t.id||"-1"),void ct.setCheckoutShippingAddressSettings()}ct.checkout.shippingAddress=r(ct.checkout.shippingAddress)||{},ct.setCheckoutShippingAddressSettings()}else if(Q.customer){var e=ct.customerAddresses;ct.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}else ct.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ct.useDifferentAddress=!!localStorage.getItem("sAddr"),ct.checkout.billingAddress){if(Q.customer){var t=null==(e=ct.customerAddresses)?void 0:e.find((function(t){var e;return t.id===(null===(e=ct.checkout.billingAddress)||void 0===e?void 0:e.id)}));if(t)return ct.onSelectedBillingAddressIdChange(t.id||"-1"),void ct.setCheckoutBillingAddressSettings()}ct.checkout.billingAddress=r(ct.checkout.billingAddress)||{},ct.setCheckoutBillingAddressSettings()}else if(Q.customer){var e=ct.customerAddresses;ct.onSelectedBillingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1"),(null==e?void 0:e.length)||ct.useDifferentAddress||!ct.checkout.shippingAddress||ct.isInStoreDelivery||(ct.checkout.billingAddress=r(ct.checkout.shippingAddress),ct.setCheckoutBillingAddressSettings())}else ct.onSelectedBillingAddressIdChange("-1"),ct.useDifferentAddress||!ct.checkout.shippingAddress||ct.isInStoreDelivery||(ct.checkout.billingAddress=r(ct.checkout.shippingAddress),ct.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(s){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=s.shippingSettingsId,this.checkout.shippingZoneRateId=s.shippingZoneRateId,[4,this.saveCart()]);case 1:return(t=e.sent())&&(this.checkout=i(i({},t),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway})),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(ct,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(ct,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,N({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=e.sent()).isSuccess&&t.data?(s=t.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===J.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice}})]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:s&&(r=this.checkout,this.checkout=i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway})),e.label=4;case 4:return t.isSuccess||(this.couponError=t.errorCodes[0]),[3,6];case 5:return e.sent(),[3,6];case 6:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e;if(ct.selectedShippingAddressId=t,"-1"===t)ct.checkout.shippingAddress=m({},ct.checkoutSettings,ct.countrySettings),ct.checkout.shippingAddress.countrySettings=ct.countrySettings;else{var i=null===(e=ct.customerAddresses)||void 0===e?void 0:e.find((function(e){return e.id===t}));i&&(ct.checkout.shippingAddress=m(i,ct.checkoutSettings,ct.countrySettings))}ct.checkout.shippingAddress&&(ct.checkout.shippingAddress.checkoutSettings=ct.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e;if(ct.selectedBillingAddressId=t,"-1"===t)ct.checkout.billingAddress=m({},ct.checkoutSettings,ct.countrySettings);else{var i=null===(e=ct.customerAddresses)||void 0===e?void 0:e.find((function(e){return e.id===t}));i&&(ct.checkout.billingAddress=m(i,ct.checkoutSettings,ct.countrySettings))}ct.checkout.billingAddress&&(ct.checkout.billingAddress.checkoutSettings=ct.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){ct.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(ct.cardData&&(!(t.length>ct.cardData.cardNumber.length)||rt(t))){var e=(ct.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!ct.installmentInfo?ct.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:ct.checkout.selectedPaymentGateway.id,price:ct.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(ct.cardData.installmentCount=1,ct.installmentInfo=void 0),ct.cardData.cardNumber=nt(i,4).join(" "))}},this.onCardHolderNameChange=function(t){ct.cardData&&(ct.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(ct.cardData&&(!(t.length>ct.cardData.expirationDate.length)||rt(t))){if(0===(null===(e=ct.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.replace(".","/").split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(ct.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(ct.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(ct.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=t.split(" / ").join("");d.length>4||(ct.cardData.expirationDate=nt(d,2).join(" / "))}},this.onCvcChange=function(t){ct.cardData&&(t.length>ct.cardData.cvv.length&&!rt(t)||t.length>4||(ct.cardData.cvv=t))},this.saveAddress=function(s){return t(ct,void 0,void 0,(function(){var t,n,o,a,c,d,u,l,h,p,f,m,g=this;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),this.shouldSaveAddress&&Q.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(n=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(t){return t.id})),o=i(i({},t),{title:this.addressTitle||this.t("checkout-page:newAddress")}),(a=r(Q.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,z(a)])):[3,2];case 1:e.sent(),null===(f=this.customerAddresses)||void 0===f||f.forEach((function(t){return t.checkoutSettings=g.checkoutSettings})),c=null===(m=this.customerAddresses)||void 0===m?void 0:m.map((function(t){return t.id})),d=null==c?void 0:c.filter((function(t){return!(null==n?void 0:n.includes(t))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),e.label=2;case 2:return[3,4];case 3:return l=e.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){ct.router.push("/cart")},this.onBackToShoppingClick=function(){ct.router.push("/")},this.onGoToLoginClick=function(){ct.router.push("/account/login")},this.onProceedToShippingClick=function(){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:e.sent(),e.label=3;case 3:return[4,this.checkStocks()];case 4:return e.sent(),[4,this.saveCart()];case 5:return e.sent(),"address"===this.deliveryMethod?this.changeStep(J.SHIPPING):this.changeStep(J.PAYMENT),[3,7];case 6:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:tt.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.changeStep(J.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:tt.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.error=void 0,this.changeStep(J.PAYMENT),[3,5];case 4:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:tt.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ct.canPerformPayment||(ct.isErrorsVisible=!0,!1)},this.onCompletePaymentClick=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isKlarna?[4,this.saveCart()]:[3,2]):(this.isErrorsVisible=!0,[2]);case 1:return e.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return e.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return e.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:e.sent(),e.label=5;case 5:return[4,this.saveCart()];case 6:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 7:return e.sent(),[3,9];case 8:return void 0!==typeof(i=e.sent()).type?this.error=i:this.error={type:tt.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return e.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return e.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return e.sent(),[4,this.saveCart()];case 4:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 5:return e.sent(),[3,7];case 6:return(i=e.sent()).type?this.error=i:this.error={type:tt.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return t(ct,void 0,void 0,(function(){var t,i,s,n,r,o,d,u,h,p,f,m,g,v,y;return e(this,(function(e){switch(e.label){case 0:return(i=this.mpVM.selectedCard)&&(null===(u=this.mpVM.selectedCard)||void 0===u?void 0:u.Name)?((n=this.mpVM.phoneNumber({checkout:this.checkout}))&&(t=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,E({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:t,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(f=this.mpVM.selectedCard)||void 0===f?void 0:f.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(m=this.cardData)||void 0===m?void 0:m.threeDSecure)}}})]):[3,2];case 1:return s=e.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,E({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===a.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===c.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=e.sent(),e.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[l.SUCCESS,l.AUTHORIZED].includes(r),d=r===l.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return e.sent(),[3,8];case 7:if(!d||!(null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.returnSlug))throw{data:s.firstErrorMessage,type:tt.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,e.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,X((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(J.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){ct.changeStep(J.INFO)},this.onBackToShippingClick=function(){ct.changeStep(J.SHIPPING)},this.setCustomerConsentGranted=function(t){ct.checkout.customer&&(ct.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){ct.useDifferentAddress=t,ct.useDifferentAddress?(localStorage.setItem("sAddr","1"),ct.checkout.billingAddress=ct.checkout.billingAddress||m({},ct.checkoutSettings,ct.countrySettings),ct.checkout.billingAddress.countrySettings=ct.countrySettings):(localStorage.removeItem("sAddr"),ct.checkout.billingAddress=ct.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){ct.shouldSaveAddress=t},this.setAddressTitle=function(t){ct.addressTitle=t},this.setPaymentGateway=function(i){return t(ct,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||!(null===(n=t.settings)||void 0===n?void 0:n.find((function(t){return"allow_custom_flow"===t.label&&"1"===t.value})))||this.stripeResponse?[3,2]:[4,O({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})]:[2];case 1:(s=e.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),e.label=2;case 2:return"KLARNA"!==t.code||this.klarnaResponse?[3,4]:[4,j({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 3:(s=e.sent()).isSuccess&&s.data&&(this.klarnaResponse=s.data),e.label=4;case 4:return"ADYEN"!==t.code||this.adyenResponse?[3,6]:[4,L({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 5:(s=e.sent()).isSuccess&&s.data&&(this.adyenResponse=s.data),e.label=6;case 6:return"PAYPAL"!==t.code||this.payPalClientIdResponse?[3,8]:[4,R({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 7:(s=e.sent()).isSuccess&&s.data&&(this.payPalClientIdResponse=s.data),e.label=8;case 8:return this.checkout.selectedPaymentGateway=t,this.step!==J.SUCCESS&&(t.paymentMethodType===a.CREDIT_CARD&&t.type===c.INTERNAL&&(this.cardData=new x,t.masterPassClientId&&(console.log("called 1511 ikas log"),this.mpVM.checkMasterPass({checkout:this.checkout}))),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){ct.cardData&&(ct.cardData.installmentCount=t)},this.changeStep=function(i){return t(ct,void 0,void 0,(function(){return e(this,(function(t){return it||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(ct,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=null,Z(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){ct.isContactModalVisible=t},this.getCampaignOfferProducts=function(i){return t(ct,void 0,void 0,(function(){var t,s,n,r;return e(this,(function(o){switch(o.label){case 0:if(!this.checkout.campaignOffers||!this.checkout.campaignOffers.length)return[3,4];if(t=this.checkout.campaignOffers.filter((function(t){var e;return t.status===h.WAITING_FOR_ACTION&&(null===(e=t.campaignOffer)||void 0===e?void 0:e.targetPageTypes.some((function(t){return t===i})))})),!t.length)return[3,4];s=function(i){var s,n,r,o,a,c;return e(this,(function(e){switch(e.label){case 0:return(s=t[i]).campaignOffer&&(n=s.campaignOffer.offers.find((function(t){return t.id===s.campaignOfferProductId})))?[4,D({input:{productIdList:[n.productId]}})]:[3,2];case 1:if((r=e.sent()).isSuccess&&r.data&&r.data.data&&r.data.data.length&&(o=r.data.data[0],a=[],c=Y.hasVariantStock,n.excludedVariantIdList&&n.excludedVariantIdList.length?o.variants.map((function(t){var e;c(t)&&!(null===(e=n.excludedVariantIdList)||void 0===e?void 0:e.some((function(e){return e===t.id})))&&a.push(t)})):a.push.apply(a,o.variants.filter((function(t){return c(t)}))),a.length))return[2,{value:{product:o,variants:a,campaignOffer:s,offer:n}}];e.label=2;case 2:return[2]}}))},n=0,o.label=1;case 1:return n<t.length?[5,s(n)]:[3,4];case 2:if("object"==typeof(r=o.sent()))return[2,r.value];o.label=3;case 3:return n++,[3,1];case 4:return[2,void 0]}}))}))},this.getCampaignOffer=function(){return t(ct,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getCampaignOfferProducts(p.CHECKOUT)];case 1:return t.checkoutCampaignOffer=e.sent(),i=this,[4,this.getCampaignOfferProducts(p.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=e.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(s){return t(ct,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isCheckoutLoaded=!1,[4,G({input:s})];case 1:return(t=e.sent())&&t.isSuccess&&t.data&&(this.checkout=i(i({},t.data),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),s.accepted&&this.step===J.SUCCESS?this.changeStep(J.INFO):this.changeStep(this.step)),[2]}}))}))},this.registerCustomer=function(i){return t(ct,void 0,void 0,(function(){var t,s,n,r;return e(this,(function(e){switch(e.label){case 0:return this.checkout.customer?(t=this.checkout.customer,s=t.firstName,n=t.lastName,r=t.email,s&&n&&r?[4,T({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,e.sent()];case 2:return[2]}}))}))},this.checkout=n,this.checkoutSettings=d,this.router=u,this.returnPolicy=g,this.privacyPolicy=K,this.termsOfService=F,this.imprint=et,this.shippingPolicy=st,this.t=ot,this.customizationProps=at,this.mpVM=new V,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new f({currentLocale:M.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(et.prototype,"merchantSettings",{get:function(){return M.getMerchantSettings()},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"selectedInstallmentIndex",{get:function(){var t,e,i=this;return(null===(e=null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices)||void 0===e?void 0:e.findIndex((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=K.getCustomerAddressText,n=(null===(e=null===(t=Q.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return{label:t.title+" - "+s(t),value:t.id}})))||[];return[i].concat(n)},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"installmentPrice",{get:function(){var t,e,i,s=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(i=null===(e=this.installmentInfo.installmentPrices)||void 0===e?void 0:e.find((function(t){var e;return t.installmentCount===(null===(e=s.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"finalPrice",{get:function(){if(this.step===J.SUCCESS)return this.checkout.totalFinalPrice;var t=B.getCheckoutTotalFinalPrice;return this.installmentPrice||t(this.checkout)},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===tt.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"canProceedToShipping",{get:function(){var t,e=g,i=F.hasValidCustomerEmail;return(this.isDigitalOnly?!!this.checkout.billingAddress&&e(this.checkout.billingAddress):this.checkout.shippingAddress&&e(this.checkout.shippingAddress))&&i(this.checkout)&&(null===(t=this.error)||void 0===t?void 0:t.type)!==tt.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"klarnaPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"adyenPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"ADYEN"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"ADYEN"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"payPalPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"PAYPAL"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"PAYPAL"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isCustomFlowStripe",{get:function(){var t,e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(t){return"allow_custom_flow"===t.label&&"1"===t.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isKlarna",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"KLARNA"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isAdyen",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"ADYEN"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isPayPal",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"PAYPAL"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"canPerformPayment",{get:function(){var t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var e=g,i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!this.checkout.billingAddress&&!!e(this.checkout.billingAddress),r=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===a.CREDIT_CARD&&i.type===c.INTERNAL?!!this.isCustomFlowStripe||(!(!this.isKlarna&&!this.isPayPal)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i);return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===d.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"customerAddresses",{get:function(){var t,e,s=this;return null===(e=null===(t=Q.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return n(i({countrySettings:s.countrySettings,checkoutSettings:s.checkoutSettings},t))}))},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===u.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(et.prototype,"isEPayKolayEnabled",{get:function(){var t=M.getCustom();return!!t&&!!t.isEPayKolayEnabled},enumerable:!1,configurable:!0}),et.prototype.setAdyenDropinElement=function(t){this.adyenDropinElement=t},et}();function nt(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function rt(t){return t&&et.test(t.charAt(t.length-1))}export{st as default};
@@ -1,14 +1,13 @@
1
1
  import { OtpModalType } from "./components/master-pass/modal-otp";
2
2
  import { SuccessModalType } from "./components/master-pass/modal-success";
3
- import { IkasBaseStore } from "../../store";
4
- import { IkasCheckout, IkasPaymentGateway } from "../../models";
3
+ import { IkasPaymentGateway } from "../../models";
5
4
  import { MasterPassOperationTypeEnum } from "@ikas/storefront-api";
5
+ import { IkasCheckout } from "../../models/data/checkout";
6
6
  export declare const MFS_ELEMENT_ID = "ikasMasterPass";
7
7
  export declare const MFS_SCRIPT_URL = "https://cdn.myikas.com/sf/scripts/mfs-client-nojquery.min.js";
8
8
  declare type MFS_CB_HOC_TYPE_SOURCE = "checkMasterPass" | "register" | "resendOtp" | "linkCardToClient" | "validateTransaction" | "listCards" | "deleteCard";
9
9
  declare type MFS_CB_HOC_TYPE = (params: {
10
10
  source: MFS_CB_HOC_TYPE_SOURCE;
11
- store: IkasBaseStore;
12
11
  checkout: IkasCheckout;
13
12
  callback?: () => void;
14
13
  }) => MFS_CB_TYPE;
@@ -71,16 +70,15 @@ export default class MasterPassModel {
71
70
  /**
72
71
  * Use when phone number input disabled
73
72
  */
74
- saveCardToMasterPassPhoneNumberDisabledInputValue: ({ store, checkout, withPlus, }: {
73
+ saveCardToMasterPassPhoneNumberDisabledInputValue: ({ checkout, withPlus, }: {
75
74
  withPlus: boolean;
76
- store: IkasBaseStore;
77
75
  checkout: IkasCheckout;
78
76
  }) => string;
79
77
  get isSendConfirmationButtonDisabled(): boolean;
80
78
  onSaveCardToMasterPassCheckedChange: (value: boolean) => void;
81
79
  onSaveCardToMasterPassCardNameChange: (value: string) => void;
82
80
  onSaveCardToMasterPassPhoneNumberChange: (value: string) => void;
83
- onSaveCardToMasterPassSendConfirmationButtonClick: ({ creditCard, store, checkout, paymentGateway, callback, }: RegisterParams) => void;
81
+ onSaveCardToMasterPassSendConfirmationButtonClick: ({ creditCard, checkout, paymentGateway, callback, }: RegisterParams) => void;
84
82
  get isLinkCardToClientVisible(): boolean;
85
83
  get isOtpModalVisible(): boolean;
86
84
  get isResponseModalVisible(): boolean;
@@ -102,12 +100,11 @@ export default class MasterPassModel {
102
100
  operationType: MasterPassOperationTypeEnum;
103
101
  phoneNumber: string;
104
102
  }) => Promise<import("@ikas/storefront-api/build/__api/types").MasterPassTokenResponse | undefined>;
105
- phoneNumber: ({ store, checkout, withPlus, }: {
106
- store: IkasBaseStore;
103
+ phoneNumber: ({ checkout, withPlus, }: {
107
104
  checkout: IkasCheckout;
108
105
  withPlus?: boolean | undefined;
109
106
  }) => string | null | undefined;
110
- sendSmsLanguage: (store: IkasBaseStore) => string;
107
+ sendSmsLanguage: () => string;
111
108
  /**
112
109
  * Send object return value is FormData
113
110
  * @returns FormData
@@ -139,13 +136,12 @@ export default class MasterPassModel {
139
136
  * Bu durumda kullanıcıdan herhangi bir aksiyon almasını beklemeden doğrudan
140
137
  * kayıtlı kartlarının listelenmesi (ListCard servisi ile) gerekiyor.
141
138
  */
142
- checkMasterPass: ({ checkout, store, ...rest }: CheckMasterPassParams) => Promise<void>;
139
+ checkMasterPass: ({ checkout, ...rest }: CheckMasterPassParams) => Promise<void>;
143
140
  /**
144
141
  * Save card to MasterPass
145
142
  */
146
- register: ({ creditCard, store, checkout, paymentGateway, callback, }: RegisterParams) => Promise<void>;
147
- resendOtp: ({ store, checkout, callback, }: {
148
- store: IkasBaseStore;
143
+ register: ({ creditCard, checkout, paymentGateway, callback, }: RegisterParams) => Promise<void>;
144
+ resendOtp: ({ checkout, callback, }: {
149
145
  checkout: IkasCheckout;
150
146
  callback: () => void;
151
147
  }) => Promise<void>;
@@ -158,10 +154,10 @@ export default class MasterPassModel {
158
154
  * ve evet cevabında linkCardtoClient servisi çağrılır. Sms doğrulaması yapıldıktan
159
155
  * sonra linkleme başarıyla gerçekleşeceği için ListCard servisi ile kartlar listelenir.
160
156
  */
161
- linkCardToClient: ({ store, checkout, callback, }: LinkCardToClientParams) => Promise<void>;
162
- validateTransaction: ({ validationCode, store, checkout, callback, }: ValidateTransactionParams) => Promise<void>;
163
- listCards: ({ store, checkout }: ListCardsParams) => Promise<void>;
164
- deleteCard: ({ store, checkout, card }: DeleteCardParams) => Promise<void>;
157
+ linkCardToClient: ({ checkout, callback }: LinkCardToClientParams) => Promise<void>;
158
+ validateTransaction: ({ validationCode, checkout, callback, }: ValidateTransactionParams) => Promise<void>;
159
+ listCards: ({ checkout }: ListCardsParams) => Promise<void>;
160
+ deleteCard: ({ checkout, card }: DeleteCardParams) => Promise<void>;
165
161
  }
166
162
  declare type RegisterParams = {
167
163
  creditCard: {
@@ -172,32 +168,26 @@ declare type RegisterParams = {
172
168
  phoneNumber: string;
173
169
  };
174
170
  paymentGateway: IkasPaymentGateway;
175
- store: IkasBaseStore;
176
171
  checkout: IkasCheckout;
177
172
  callback: () => void;
178
173
  };
179
174
  declare type CheckMasterPassParams = {
180
175
  checkout: IkasCheckout;
181
- store: IkasBaseStore;
182
176
  };
183
177
  declare type LinkCardToClientParams = {
184
178
  cartId: string;
185
179
  checkout: IkasCheckout;
186
- store: IkasBaseStore;
187
180
  callback?: () => void;
188
181
  };
189
182
  declare type ValidateTransactionParams = {
190
183
  validationCode: string;
191
- store: IkasBaseStore;
192
184
  checkout: IkasCheckout;
193
185
  callback: () => void;
194
186
  };
195
187
  declare type ListCardsParams = {
196
- store: IkasBaseStore;
197
188
  checkout: IkasCheckout;
198
189
  };
199
190
  declare type DeleteCardParams = {
200
- store: IkasBaseStore;
201
191
  checkout: IkasCheckout;
202
192
  card: Card;
203
193
  };