@ikas/storefront 4.0.0-alpha.50 → 4.0.0-alpha.52

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 (1026) hide show
  1. package/build/_virtual/_commonjsHelpers.js +1 -0
  2. package/build/_virtual/axios.js +1 -0
  3. package/build/_virtual/index.js +1 -0
  4. package/build/_virtual/index2.js +1 -0
  5. package/build/_virtual/index3.js +1 -0
  6. package/build/_virtual/index4.js +1 -0
  7. package/build/_virtual/react-is.development.js +1 -0
  8. package/build/_virtual/react-is.production.min.js +1 -0
  9. package/build/_virtual/react-stripe.umd.js +1 -0
  10. package/build/analytics/analytics.d.ts +37 -0
  11. package/build/analytics/analytics.js +1 -0
  12. package/build/analytics/events.d.ts +37 -0
  13. package/build/analytics/events.js +1 -0
  14. package/build/analytics/facebookPixel.d.ts +15 -0
  15. package/build/analytics/facebookPixel.js +1 -0
  16. package/build/analytics/googleAnalytics.d.ts +13 -0
  17. package/build/analytics/googleAnalytics.js +1 -0
  18. package/build/analytics/googleTagManager.d.ts +203 -0
  19. package/build/analytics/googleTagManager.js +1 -0
  20. package/build/analytics/googleUniversal.d.ts +9 -0
  21. package/build/analytics/googleUniversal.js +1 -0
  22. package/build/analytics/head/index.d.ts +7 -0
  23. package/build/analytics/head/index.js +1 -0
  24. package/build/analytics/ikas.d.ts +134 -0
  25. package/build/analytics/ikas.js +1 -0
  26. package/build/analytics/index.d.ts +2 -0
  27. package/build/analytics/tiktokPixel.d.ts +13 -0
  28. package/build/analytics/tiktokPixel.js +1 -0
  29. package/build/components/checkout/components/address-form/index.d.ts +3 -0
  30. package/build/components/checkout/components/address-form/index.js +1 -0
  31. package/build/components/checkout/components/address-form/model.d.ts +87 -0
  32. package/build/components/checkout/components/address-form/model.js +1 -0
  33. package/build/components/checkout/components/button/index.d.ts +13 -0
  34. package/build/components/checkout/components/button/index.js +1 -0
  35. package/build/components/checkout/components/button/style.module.scss.js +1 -0
  36. package/build/components/checkout/components/cart-summary/cart-item/index.d.ts +10 -0
  37. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -0
  38. package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -0
  39. package/build/components/checkout/components/cart-summary/index.d.ts +8 -0
  40. package/build/components/checkout/components/cart-summary/index.js +1 -0
  41. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -0
  42. package/build/components/checkout/components/checkbox/check.d.ts +6 -0
  43. package/build/components/checkout/components/checkbox/check.js +1 -0
  44. package/build/components/checkout/components/checkbox/index.d.ts +10 -0
  45. package/build/components/checkout/components/checkbox/index.js +1 -0
  46. package/build/components/checkout/components/checkbox/style.module.scss.js +1 -0
  47. package/build/components/checkout/components/credit-card-form/index.d.ts +7 -0
  48. package/build/components/checkout/components/credit-card-form/index.js +1 -0
  49. package/build/components/checkout/components/credit-card-form/model.d.ts +26 -0
  50. package/build/components/checkout/components/credit-card-form/model.js +1 -0
  51. package/build/components/checkout/components/credit-card-form/style.module.scss.js +1 -0
  52. package/build/components/checkout/components/credit-card-form/svg/amex.d.ts +6 -0
  53. package/build/components/checkout/components/credit-card-form/svg/amex.js +1 -0
  54. package/build/components/checkout/components/credit-card-form/svg/master-card.d.ts +6 -0
  55. package/build/components/checkout/components/credit-card-form/svg/master-card.js +1 -0
  56. package/build/components/checkout/components/credit-card-form/svg/troy.d.ts +6 -0
  57. package/build/components/checkout/components/credit-card-form/svg/troy.js +1 -0
  58. package/build/components/checkout/components/credit-card-form/svg/visa.d.ts +6 -0
  59. package/build/components/checkout/components/credit-card-form/svg/visa.js +1 -0
  60. package/build/components/checkout/components/customer-addresses/index.d.ts +19 -0
  61. package/build/components/checkout/components/customer-addresses/index.js +1 -0
  62. package/build/components/checkout/components/customer-addresses/model.d.ts +21 -0
  63. package/build/components/checkout/components/customer-addresses/model.js +1 -0
  64. package/build/components/checkout/components/customer-addresses/style.module.scss.js +1 -0
  65. package/build/components/checkout/components/delivery-methods/icon-button/index.d.ts +10 -0
  66. package/build/components/checkout/components/delivery-methods/icon-button/index.js +1 -0
  67. package/build/components/checkout/components/delivery-methods/icon-button/style.module.scss.js +1 -0
  68. package/build/components/checkout/components/delivery-methods/icons/box.d.ts +6 -0
  69. package/build/components/checkout/components/delivery-methods/icons/box.js +1 -0
  70. package/build/components/checkout/components/delivery-methods/icons/store.d.ts +6 -0
  71. package/build/components/checkout/components/delivery-methods/icons/store.js +1 -0
  72. package/build/components/checkout/components/delivery-methods/index.d.ts +7 -0
  73. package/build/components/checkout/components/delivery-methods/index.js +1 -0
  74. package/build/components/checkout/components/delivery-methods/style.module.scss.js +1 -0
  75. package/build/components/checkout/components/error/customer-login-required-error/index.d.ts +8 -0
  76. package/build/components/checkout/components/error/customer-login-required-error/index.js +1 -0
  77. package/build/components/checkout/components/error/index.d.ts +7 -0
  78. package/build/components/checkout/components/error/index.js +1 -0
  79. package/build/components/checkout/components/error/no-shipping-error/index.d.ts +3 -0
  80. package/build/components/checkout/components/error/no-shipping-error/index.js +1 -0
  81. package/build/components/checkout/components/error/payment-error/index.d.ts +8 -0
  82. package/build/components/checkout/components/error/payment-error/index.js +1 -0
  83. package/build/components/checkout/components/error/stock-error/index.d.ts +8 -0
  84. package/build/components/checkout/components/error/stock-error/index.js +1 -0
  85. package/build/components/checkout/components/error/stock-error/style.module.scss.js +1 -0
  86. package/build/components/checkout/components/error/unknown-error/index.d.ts +8 -0
  87. package/build/components/checkout/components/error/unknown-error/index.js +1 -0
  88. package/build/components/checkout/components/expandable-section/index.d.ts +6 -0
  89. package/build/components/checkout/components/expandable-section/index.js +1 -0
  90. package/build/components/checkout/components/expandable-section/style.module.scss.js +1 -0
  91. package/build/components/checkout/components/form-item/caret-down.d.ts +6 -0
  92. package/build/components/checkout/components/form-item/caret-down.js +1 -0
  93. package/build/components/checkout/components/form-item/index.d.ts +3 -0
  94. package/build/components/checkout/components/form-item/index.js +1 -0
  95. package/build/components/checkout/components/form-item/model.d.ts +61 -0
  96. package/build/components/checkout/components/form-item/model.js +1 -0
  97. package/build/components/checkout/components/form-item/style.module.scss.js +1 -0
  98. package/build/components/checkout/components/fullscreen-loading/index.d.ts +2 -0
  99. package/build/components/checkout/components/fullscreen-loading/index.js +1 -0
  100. package/build/components/checkout/components/fullscreen-loading/style.module.scss.js +1 -0
  101. package/build/components/checkout/components/input-with-button/index.d.ts +11 -0
  102. package/build/components/checkout/components/input-with-button/index.js +1 -0
  103. package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -0
  104. package/build/components/checkout/components/master-pass/credit-card-form/index.d.ts +8 -0
  105. package/build/components/checkout/components/master-pass/credit-card-form/index.js +1 -0
  106. package/build/components/checkout/components/master-pass/credit-card-form/style.module.scss.js +1 -0
  107. package/build/components/checkout/components/master-pass/modal/index.d.ts +11 -0
  108. package/build/components/checkout/components/master-pass/modal/index.js +1 -0
  109. package/build/components/checkout/components/master-pass/modal/style.module.scss.js +1 -0
  110. package/build/components/checkout/components/master-pass/modal/svg/modal-close.d.ts +2 -0
  111. package/build/components/checkout/components/master-pass/modal/svg/modal-close.js +1 -0
  112. package/build/components/checkout/components/master-pass/modal-link-card-to-client/index.d.ts +10 -0
  113. package/build/components/checkout/components/master-pass/modal-link-card-to-client/index.js +1 -0
  114. package/build/components/checkout/components/master-pass/modal-link-card-to-client/style.module.scss.js +1 -0
  115. package/build/components/checkout/components/master-pass/modal-link-card-to-client/svg/info-mark.d.ts +2 -0
  116. package/build/components/checkout/components/master-pass/modal-link-card-to-client/svg/info-mark.js +1 -0
  117. package/build/components/checkout/components/master-pass/modal-link-card-to-client/svg/master-pass-by-master-card-big.d.ts +2 -0
  118. package/build/components/checkout/components/master-pass/modal-link-card-to-client/svg/master-pass-by-master-card-big.js +1 -0
  119. package/build/components/checkout/components/master-pass/modal-otp/index.d.ts +10 -0
  120. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -0
  121. package/build/components/checkout/components/master-pass/modal-otp/style.module.scss.js +1 -0
  122. package/build/components/checkout/components/master-pass/modal-otp/svg/master-pass.d.ts +2 -0
  123. package/build/components/checkout/components/master-pass/modal-otp/svg/master-pass.js +1 -0
  124. package/build/components/checkout/components/master-pass/modal-response/index.d.ts +9 -0
  125. package/build/components/checkout/components/master-pass/modal-response/index.js +1 -0
  126. package/build/components/checkout/components/master-pass/modal-response/style.module.scss.js +1 -0
  127. package/build/components/checkout/components/master-pass/modal-success/index.d.ts +10 -0
  128. package/build/components/checkout/components/master-pass/modal-success/index.js +1 -0
  129. package/build/components/checkout/components/master-pass/modal-success/style.module.scss.js +1 -0
  130. package/build/components/checkout/components/master-pass/modal-success/svg/master-pass-by-master-card-small.d.ts +2 -0
  131. package/build/components/checkout/components/master-pass/modal-success/svg/master-pass-by-master-card-small.js +1 -0
  132. package/build/components/checkout/components/master-pass/modal-success/svg/success.d.ts +2 -0
  133. package/build/components/checkout/components/master-pass/modal-success/svg/success.js +1 -0
  134. package/build/components/checkout/components/master-pass/payment-gateway/svg/master-card.d.ts +2 -0
  135. package/build/components/checkout/components/master-pass/payment-gateway/svg/master-card.js +1 -0
  136. package/build/components/checkout/components/master-pass/svg/master-pass-by-master-card.d.ts +3 -0
  137. package/build/components/checkout/components/master-pass/svg/master-pass-by-master-card.js +1 -0
  138. package/build/components/checkout/components/modal/index.d.ts +8 -0
  139. package/build/components/checkout/components/modal/index.js +1 -0
  140. package/build/components/checkout/components/modal/style.module.scss.js +1 -0
  141. package/build/components/checkout/components/modal/useEscape.d.ts +5 -0
  142. package/build/components/checkout/components/modal/useEscape.js +1 -0
  143. package/build/components/checkout/components/notification-box/index.d.ts +9 -0
  144. package/build/components/checkout/components/notification-box/index.js +1 -0
  145. package/build/components/checkout/components/notification-box/style.module.scss.js +1 -0
  146. package/build/components/checkout/components/offer-product/index.d.ts +8 -0
  147. package/build/components/checkout/components/offer-product/index.js +1 -0
  148. package/build/components/checkout/components/offer-product/select/arrows.d.ts +6 -0
  149. package/build/components/checkout/components/offer-product/select/arrows.js +1 -0
  150. package/build/components/checkout/components/offer-product/select/index.d.ts +11 -0
  151. package/build/components/checkout/components/offer-product/select/index.js +1 -0
  152. package/build/components/checkout/components/offer-product/select/style.module.scss.js +1 -0
  153. package/build/components/checkout/components/offer-product/style.module.scss.js +1 -0
  154. package/build/components/checkout/components/phone-number-input/compare-strings.d.ts +2 -0
  155. package/build/components/checkout/components/phone-number-input/compare-strings.js +1 -0
  156. package/build/components/checkout/components/phone-number-input/get-countries.d.ts +7 -0
  157. package/build/components/checkout/components/phone-number-input/get-countries.js +1 -0
  158. package/build/components/checkout/components/phone-number-input/index.d.ts +10 -0
  159. package/build/components/checkout/components/phone-number-input/index.js +1 -0
  160. package/build/components/checkout/components/phone-number-input/style.module.scss.js +1 -0
  161. package/build/components/checkout/components/select-box/index.d.ts +13 -0
  162. package/build/components/checkout/components/select-box/index.js +1 -0
  163. package/build/components/checkout/components/select-box/style.module.scss.js +1 -0
  164. package/build/components/checkout/components/step-container/index.d.ts +15 -0
  165. package/build/components/checkout/components/step-container/index.js +1 -0
  166. package/build/components/checkout/components/step-container/style.module.scss.js +1 -0
  167. package/build/components/checkout/components/stripe/checkout-form.d.ts +8 -0
  168. package/build/components/checkout/components/stripe/checkout-form.js +1 -0
  169. package/build/components/checkout/components/stripe/index.d.ts +9 -0
  170. package/build/components/checkout/components/stripe/index.js +1 -0
  171. package/build/components/checkout/components/stripe/style.module.scss.js +1 -0
  172. package/build/components/checkout/components/svg/arrow-down.d.ts +6 -0
  173. package/build/components/checkout/components/svg/arrow-down.js +1 -0
  174. package/build/components/checkout/components/svg/arrow-left.d.ts +6 -0
  175. package/build/components/checkout/components/svg/arrow-right.d.ts +6 -0
  176. package/build/components/checkout/components/svg/cross.d.ts +6 -0
  177. package/build/components/checkout/components/svg/cross.js +1 -0
  178. package/build/components/checkout/components/svg/discount.d.ts +6 -0
  179. package/build/components/checkout/components/svg/external.d.ts +6 -0
  180. package/build/components/checkout/components/svg/external.js +1 -0
  181. package/build/components/checkout/components/svg/gift.d.ts +7 -0
  182. package/build/components/checkout/components/svg/gift.js +1 -0
  183. package/build/components/checkout/components/svg/ikas.d.ts +6 -0
  184. package/build/components/checkout/components/svg/ikas.js +1 -0
  185. package/build/components/checkout/components/svg/lock.d.ts +6 -0
  186. package/build/components/checkout/components/svg/lock.js +1 -0
  187. package/build/components/checkout/components/svg/shopping-cart.d.ts +6 -0
  188. package/build/components/checkout/components/svg/success-circle.d.ts +6 -0
  189. package/build/components/checkout/components/svg/success-circle.js +1 -0
  190. package/build/components/checkout/components/svg/tag.d.ts +6 -0
  191. package/build/components/checkout/components/svg/warning.d.ts +6 -0
  192. package/build/components/checkout/components/svg/warning.js +1 -0
  193. package/build/components/checkout/components/toggle/index.d.ts +10 -0
  194. package/build/components/checkout/components/toggle/index.js +1 -0
  195. package/build/components/checkout/components/toggle/style.module.scss.js +1 -0
  196. package/build/components/checkout/components/tooltip/index.d.ts +8 -0
  197. package/build/components/checkout/components/tooltip/index.js +1 -0
  198. package/build/components/checkout/components/tooltip/style.module.scss.js +1 -0
  199. package/build/components/checkout/index.d.ts +32 -0
  200. package/build/components/checkout/index.js +1 -0
  201. package/build/components/checkout/model.d.ts +161 -0
  202. package/build/components/checkout/model.js +1 -0
  203. package/build/components/checkout/modelMasterPass.d.ts +201 -0
  204. package/build/components/checkout/modelMasterPass.js +1 -0
  205. package/build/components/checkout/steps/step-info/index.d.ts +7 -0
  206. package/build/components/checkout/steps/step-info/index.js +1 -0
  207. package/build/components/checkout/steps/step-payment/billing-address/index.d.ts +7 -0
  208. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -0
  209. package/build/components/checkout/steps/step-payment/index.d.ts +7 -0
  210. package/build/components/checkout/steps/step-payment/index.js +1 -0
  211. package/build/components/checkout/steps/step-payment/payment-gateways/index.d.ts +7 -0
  212. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -0
  213. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.d.ts +7 -0
  214. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -0
  215. package/build/components/checkout/steps/step-payment/payment-gateways/installments/style.module.scss.js +1 -0
  216. package/build/components/checkout/steps/step-payment/payment-gateways/style.module.scss.js +1 -0
  217. package/build/components/checkout/steps/step-payment/style.module.scss.js +1 -0
  218. package/build/components/checkout/steps/step-shipping/index.d.ts +7 -0
  219. package/build/components/checkout/steps/step-shipping/index.js +1 -0
  220. package/build/components/checkout/steps/step-shipping/style.module.scss.js +1 -0
  221. package/build/components/checkout/steps/step-success/index.d.ts +7 -0
  222. package/build/components/checkout/steps/step-success/index.js +1 -0
  223. package/build/components/checkout/steps/step-success/style.module.scss.js +1 -0
  224. package/build/components/checkout/style.module.scss.js +1 -0
  225. package/build/components/checkout/styles/common.module.scss.js +1 -0
  226. package/build/components/image/index.d.ts +10 -0
  227. package/build/components/image/index.js +1 -0
  228. package/build/components/index.d.ts +5 -0
  229. package/build/components/link/index.d.ts +16 -0
  230. package/build/components/link/index.js +1 -0
  231. package/build/components/page/ThemeComponent.d.ts +21 -0
  232. package/build/components/page/ThemeComponent.js +1 -0
  233. package/build/components/page/head.d.ts +15 -0
  234. package/build/components/page/head.js +1 -0
  235. package/build/components/page/index.d.ts +21 -0
  236. package/build/components/page/index.js +1 -0
  237. package/build/components/page-editor/ThemeComponentEditor.d.ts +32 -0
  238. package/build/components/page-editor/ThemeComponentEditor.js +1 -0
  239. package/build/components/page-editor/error/index.d.ts +4 -0
  240. package/build/components/page-editor/error/index.js +1 -0
  241. package/build/components/page-editor/index.d.ts +4 -0
  242. package/build/components/page-editor/index.js +1 -0
  243. package/build/components/page-editor/loader/index.d.ts +6 -0
  244. package/build/components/page-editor/loader/index.js +1 -0
  245. package/build/components/page-editor/loader/style.module.scss.js +1 -0
  246. package/build/components/page-editor/model.d.ts +75 -0
  247. package/build/components/page-editor/model.js +1 -0
  248. package/build/index.d.ts +6 -0
  249. package/build/index.js +1 -0
  250. package/build/models/data/base/index.d.ts +8 -0
  251. package/build/models/data/base/index.js +1 -0
  252. package/build/models/data/blog/category/index.d.ts +12 -0
  253. package/build/models/data/blog/category/index.js +1 -0
  254. package/build/models/data/blog/content/index.d.ts +6 -0
  255. package/build/models/data/blog/content/index.js +1 -0
  256. package/build/models/data/blog/index.d.ts +27 -0
  257. package/build/models/data/blog/index.js +1 -0
  258. package/build/models/data/blog/meta-data/index.d.ts +16 -0
  259. package/build/models/data/blog/meta-data/index.js +1 -0
  260. package/build/models/data/blog/tag/index.d.ts +6 -0
  261. package/build/models/data/blog/tag/index.js +1 -0
  262. package/build/models/data/blog/writer/index.d.ts +6 -0
  263. package/build/models/data/blog/writer/index.js +1 -0
  264. package/build/models/data/brand/index.d.ts +26 -0
  265. package/build/models/data/brand/index.js +1 -0
  266. package/build/models/data/brand/translation/index.d.ts +7 -0
  267. package/build/models/data/brand/translation/index.js +1 -0
  268. package/build/models/data/campaign-offer/index.d.ts +21 -0
  269. package/build/models/data/campaign-offer/index.js +1 -0
  270. package/build/models/data/campaign-offer/product/index.d.ts +24 -0
  271. package/build/models/data/campaign-offer/product/index.js +1 -0
  272. package/build/models/data/cart/available-shipping-method/index.d.ts +10 -0
  273. package/build/models/data/cart/available-shipping-method/index.js +1 -0
  274. package/build/models/data/cart/campaign-offer/index.d.ts +16 -0
  275. package/build/models/data/cart/campaign-offer/index.js +1 -0
  276. package/build/models/data/cart/index.d.ts +13 -0
  277. package/build/models/data/cart/index.js +1 -0
  278. package/build/models/data/category/index.d.ts +22 -0
  279. package/build/models/data/category/index.js +1 -0
  280. package/build/models/data/category/path-item/index.d.ts +14 -0
  281. package/build/models/data/category/path-item/index.js +1 -0
  282. package/build/models/data/category/translations/index.d.ts +7 -0
  283. package/build/models/data/category/translations/index.js +1 -0
  284. package/build/models/data/checkout/index.d.ts +22 -0
  285. package/build/models/data/checkout/index.js +1 -0
  286. package/build/models/data/checkout-settings/index.d.ts +20 -0
  287. package/build/models/data/checkout-settings/index.js +1 -0
  288. package/build/models/data/checkout-settings/option/index.d.ts +6 -0
  289. package/build/models/data/checkout-settings/option/index.js +1 -0
  290. package/build/models/data/checkout-settings/price/index.d.ts +7 -0
  291. package/build/models/data/checkout-settings/price/index.js +1 -0
  292. package/build/models/data/city/index.d.ts +12 -0
  293. package/build/models/data/city/index.js +1 -0
  294. package/build/models/data/contact-form/index.d.ts +9 -0
  295. package/build/models/data/contact-form/index.js +1 -0
  296. package/build/models/data/country/index.d.ts +18 -0
  297. package/build/models/data/country/index.js +1 -0
  298. package/build/models/data/country/location-translations/index.d.ts +7 -0
  299. package/build/models/data/customer/address/city/index.d.ts +7 -0
  300. package/build/models/data/customer/address/city/index.js +1 -0
  301. package/build/models/data/customer/address/country/index.d.ts +9 -0
  302. package/build/models/data/customer/address/country/index.js +1 -0
  303. package/build/models/data/customer/address/district/index.d.ts +7 -0
  304. package/build/models/data/customer/address/district/index.js +1 -0
  305. package/build/models/data/customer/address/index.d.ts +40 -0
  306. package/build/models/data/customer/address/index.js +1 -0
  307. package/build/models/data/customer/address/state/index.d.ts +7 -0
  308. package/build/models/data/customer/address/state/index.js +1 -0
  309. package/build/models/data/customer/attribute/index.d.ts +17 -0
  310. package/build/models/data/customer/attribute/index.js +1 -0
  311. package/build/models/data/customer/attribute/option/index.d.ts +9 -0
  312. package/build/models/data/customer/attribute/option/index.js +1 -0
  313. package/build/models/data/customer/attribute/sales-channel/index.d.ts +8 -0
  314. package/build/models/data/customer/attribute/sales-channel/index.js +1 -0
  315. package/build/models/data/customer/attribute/translation/index.d.ts +9 -0
  316. package/build/models/data/customer/attribute/translation/index.js +1 -0
  317. package/build/models/data/customer/attribute/translation/option/index.d.ts +6 -0
  318. package/build/models/data/customer/attribute/translation/option/index.js +1 -0
  319. package/build/models/data/customer/attribute/value/index.d.ts +11 -0
  320. package/build/models/data/customer/attribute/value/index.js +1 -0
  321. package/build/models/data/customer/index.d.ts +38 -0
  322. package/build/models/data/customer/index.js +1 -0
  323. package/build/models/data/customer/review/index.d.ts +22 -0
  324. package/build/models/data/customer/review/index.js +1 -0
  325. package/build/models/data/customer/review/settings/index.d.ts +6 -0
  326. package/build/models/data/customer/review/settings/index.js +1 -0
  327. package/build/models/data/customer/review/summary/index.d.ts +10 -0
  328. package/build/models/data/customer/review/summary/index.js +1 -0
  329. package/build/models/data/customer/review/summary/star/index.d.ts +6 -0
  330. package/build/models/data/customer/review/summary/star/index.js +1 -0
  331. package/build/models/data/district/index.d.ts +12 -0
  332. package/build/models/data/district/index.js +1 -0
  333. package/build/models/data/favorite-product/index.d.ts +7 -0
  334. package/build/models/data/favorite-product/index.js +1 -0
  335. package/build/models/data/filter-category/index.d.ts +12 -0
  336. package/build/models/data/filter-category/index.js +1 -0
  337. package/build/models/data/html-meta-data/index.d.ts +28 -0
  338. package/build/models/data/html-meta-data/index.js +1 -0
  339. package/build/models/data/html-meta-data/translations/index.d.ts +7 -0
  340. package/build/models/data/html-meta-data/translations/index.js +1 -0
  341. package/build/models/data/image/index.d.ts +9 -0
  342. package/build/models/data/image/index.js +1 -0
  343. package/build/models/data/index.d.ts +136 -0
  344. package/build/models/data/last-viewed-product/index.d.ts +6 -0
  345. package/build/models/data/last-viewed-product/index.js +1 -0
  346. package/build/models/data/merchant-settings/index.d.ts +12 -0
  347. package/build/models/data/merchant-settings/index.js +1 -0
  348. package/build/models/data/order/address/city/index.d.ts +7 -0
  349. package/build/models/data/order/address/city/index.js +1 -0
  350. package/build/models/data/order/address/country/index.d.ts +9 -0
  351. package/build/models/data/order/address/country/index.js +1 -0
  352. package/build/models/data/order/address/district/index.d.ts +7 -0
  353. package/build/models/data/order/address/district/index.js +1 -0
  354. package/build/models/data/order/address/index.d.ts +37 -0
  355. package/build/models/data/order/address/index.js +1 -0
  356. package/build/models/data/order/address/state/index.d.ts +7 -0
  357. package/build/models/data/order/address/state/index.js +1 -0
  358. package/build/models/data/order/adjustment/applied-order-line/index.d.ts +8 -0
  359. package/build/models/data/order/adjustment/applied-order-line/index.js +1 -0
  360. package/build/models/data/order/adjustment/index.d.ts +15 -0
  361. package/build/models/data/order/adjustment/index.js +1 -0
  362. package/build/models/data/order/customer/index.d.ts +11 -0
  363. package/build/models/data/order/customer/index.js +1 -0
  364. package/build/models/data/order/gift-line/index.d.ts +6 -0
  365. package/build/models/data/order/gift-line/index.js +1 -0
  366. package/build/models/data/order/index.d.ts +67 -0
  367. package/build/models/data/order/index.js +1 -0
  368. package/build/models/data/order/invoice/index.d.ts +12 -0
  369. package/build/models/data/order/invoice/index.js +1 -0
  370. package/build/models/data/order/line-item/base-unit/index.d.ts +9 -0
  371. package/build/models/data/order/line-item/base-unit/index.js +1 -0
  372. package/build/models/data/order/line-item/base-unit/unit-type/index.d.ts +6 -0
  373. package/build/models/data/order/line-item/base-unit/unit-type/index.js +1 -0
  374. package/build/models/data/order/line-item/discount/index.d.ts +11 -0
  375. package/build/models/data/order/line-item/discount/index.js +1 -0
  376. package/build/models/data/order/line-item/index.d.ts +45 -0
  377. package/build/models/data/order/line-item/index.js +1 -0
  378. package/build/models/data/order/line-item/option/index.d.ts +10 -0
  379. package/build/models/data/order/line-item/option/index.js +1 -0
  380. package/build/models/data/order/line-item/option/value/index.d.ts +7 -0
  381. package/build/models/data/order/line-item/option/value/index.js +1 -0
  382. package/build/models/data/order/line-item/variant/brand/index.d.ts +6 -0
  383. package/build/models/data/order/line-item/variant/brand/index.js +1 -0
  384. package/build/models/data/order/line-item/variant/category/index.d.ts +12 -0
  385. package/build/models/data/order/line-item/variant/category/index.js +1 -0
  386. package/build/models/data/order/line-item/variant/index.d.ts +30 -0
  387. package/build/models/data/order/line-item/variant/index.js +1 -0
  388. package/build/models/data/order/line-item/variant/price/index.d.ts +10 -0
  389. package/build/models/data/order/line-item/variant/price/index.js +1 -0
  390. package/build/models/data/order/line-item/variant/unit/index.d.ts +6 -0
  391. package/build/models/data/order/line-item/variant/unit/index.js +1 -0
  392. package/build/models/data/order/line-item/variant/value/index.d.ts +11 -0
  393. package/build/models/data/order/line-item/variant/value/index.js +1 -0
  394. package/build/models/data/order/package/index.d.ts +14 -0
  395. package/build/models/data/order/package/index.js +1 -0
  396. package/build/models/data/order/package/tracking-info/index.d.ts +9 -0
  397. package/build/models/data/order/package/tracking-info/index.js +1 -0
  398. package/build/models/data/order/payment-method/index.d.ts +9 -0
  399. package/build/models/data/order/payment-method/index.js +1 -0
  400. package/build/models/data/order/refund/index.d.ts +7 -0
  401. package/build/models/data/order/refund/index.js +1 -0
  402. package/build/models/data/order/refund/line-item/index.d.ts +6 -0
  403. package/build/models/data/order/refund/line-item/index.js +1 -0
  404. package/build/models/data/order/refund/settings/index.d.ts +7 -0
  405. package/build/models/data/order/refund/settings/index.js +1 -0
  406. package/build/models/data/order/shipping-line/index.d.ts +12 -0
  407. package/build/models/data/order/shipping-line/index.js +1 -0
  408. package/build/models/data/order/tax-line/index.d.ts +6 -0
  409. package/build/models/data/order/tax-line/index.js +1 -0
  410. package/build/models/data/order/transaction/error/index.d.ts +7 -0
  411. package/build/models/data/order/transaction/error/index.js +1 -0
  412. package/build/models/data/order/transaction/index.d.ts +25 -0
  413. package/build/models/data/order/transaction/index.js +1 -0
  414. package/build/models/data/order/transaction/payment-method-detail/index.d.ts +13 -0
  415. package/build/models/data/order/transaction/payment-method-detail/index.js +1 -0
  416. package/build/models/data/order/transaction/payment-method-detail/installment-price/index.d.ts +9 -0
  417. package/build/models/data/order/transaction/payment-method-detail/installment-price/index.js +1 -0
  418. package/build/models/data/payment-gateway/additional-price/index.d.ts +9 -0
  419. package/build/models/data/payment-gateway/additional-price/index.js +1 -0
  420. package/build/models/data/payment-gateway/index.d.ts +31 -0
  421. package/build/models/data/payment-gateway/index.js +1 -0
  422. package/build/models/data/payment-gateway/settings/index.d.ts +10 -0
  423. package/build/models/data/payment-gateway/settings/index.js +1 -0
  424. package/build/models/data/payment-gateway/translation/index.d.ts +7 -0
  425. package/build/models/data/payment-gateway/translation/index.js +1 -0
  426. package/build/models/data/product/attribute/index.d.ts +15 -0
  427. package/build/models/data/product/attribute/index.js +1 -0
  428. package/build/models/data/product/attribute/option/index.d.ts +6 -0
  429. package/build/models/data/product/attribute/option/index.js +1 -0
  430. package/build/models/data/product/attribute/table-cell/index.d.ts +6 -0
  431. package/build/models/data/product/attribute/table-cell/index.js +1 -0
  432. package/build/models/data/product/attribute/table-template/index.d.ts +7 -0
  433. package/build/models/data/product/attribute/table-template/index.js +1 -0
  434. package/build/models/data/product/attribute/translation/index.d.ts +13 -0
  435. package/build/models/data/product/attribute/translation/index.js +1 -0
  436. package/build/models/data/product/attribute-value/index.d.ts +28 -0
  437. package/build/models/data/product/attribute-value/index.js +1 -0
  438. package/build/models/data/product/back-in-stock-settings/index.d.ts +5 -0
  439. package/build/models/data/product/back-in-stock-settings/index.js +1 -0
  440. package/build/models/data/product/base-unit/index.d.ts +12 -0
  441. package/build/models/data/product/base-unit/index.js +1 -0
  442. package/build/models/data/product/campaign/data/index.d.ts +27 -0
  443. package/build/models/data/product/campaign/data/index.js +1 -0
  444. package/build/models/data/product/campaign/filter/index.d.ts +7 -0
  445. package/build/models/data/product/campaign/filter/index.js +1 -0
  446. package/build/models/data/product/campaign/index.d.ts +7 -0
  447. package/build/models/data/product/campaign/index.js +1 -0
  448. package/build/models/data/product/campaign/product-buyx-then-gety/index.d.ts +20 -0
  449. package/build/models/data/product/campaign/product-buyx-then-gety/index.js +1 -0
  450. package/build/models/data/product/campaign/product-campaign-date-range-field/index.d.ts +6 -0
  451. package/build/models/data/product/campaign/product-campaign-date-range-field/index.js +1 -0
  452. package/build/models/data/product/campaign/product-fixed-discount/index.d.ts +14 -0
  453. package/build/models/data/product/campaign/product-fixed-discount/index.js +1 -0
  454. package/build/models/data/product/filter/index.d.ts +84 -0
  455. package/build/models/data/product/filter/index.js +1 -0
  456. package/build/models/data/product/image/index.d.ts +10 -0
  457. package/build/models/data/product/image/index.js +1 -0
  458. package/build/models/data/product/index.d.ts +62 -0
  459. package/build/models/data/product/index.js +1 -0
  460. package/build/models/data/product/option-set/index.d.ts +29 -0
  461. package/build/models/data/product/option-set/index.js +1 -0
  462. package/build/models/data/product/option-set/option/index.d.ts +72 -0
  463. package/build/models/data/product/option-set/option/index.js +1 -0
  464. package/build/models/data/product/tag/index.d.ts +6 -0
  465. package/build/models/data/product/tag/index.js +1 -0
  466. package/build/models/data/product/variant/index.d.ts +31 -0
  467. package/build/models/data/product/variant/index.js +1 -0
  468. package/build/models/data/product/variant/price/index.d.ts +19 -0
  469. package/build/models/data/product/variant/price/index.js +1 -0
  470. package/build/models/data/product/variant/unit/index.d.ts +6 -0
  471. package/build/models/data/product/variant/unit/index.js +1 -0
  472. package/build/models/data/product/variant-type/index.d.ts +8 -0
  473. package/build/models/data/product/variant-type/index.js +1 -0
  474. package/build/models/data/product/variant-type/init.d.ts +2 -0
  475. package/build/models/data/raffle/index.d.ts +63 -0
  476. package/build/models/data/raffle/index.js +1 -0
  477. package/build/models/data/sales-channel/index.d.ts +19 -0
  478. package/build/models/data/sales-channel/index.js +1 -0
  479. package/build/models/data/state/index.d.ts +8 -0
  480. package/build/models/data/state/index.js +1 -0
  481. package/build/models/data/stock-location/address/city/index.d.ts +7 -0
  482. package/build/models/data/stock-location/address/city/index.js +1 -0
  483. package/build/models/data/stock-location/address/country/index.d.ts +7 -0
  484. package/build/models/data/stock-location/address/country/index.js +1 -0
  485. package/build/models/data/stock-location/address/district/index.d.ts +7 -0
  486. package/build/models/data/stock-location/address/district/index.js +1 -0
  487. package/build/models/data/stock-location/address/index.d.ts +15 -0
  488. package/build/models/data/stock-location/address/index.js +1 -0
  489. package/build/models/data/stock-location/address/state/index.d.ts +7 -0
  490. package/build/models/data/stock-location/address/state/index.js +1 -0
  491. package/build/models/data/stock-location/available/index.d.ts +10 -0
  492. package/build/models/data/stock-location/available/index.js +1 -0
  493. package/build/models/data/stock-location/index.d.ts +14 -0
  494. package/build/models/data/stock-location/index.js +1 -0
  495. package/build/models/data/storefront/domain/index.d.ts +9 -0
  496. package/build/models/data/storefront/domain/index.js +1 -0
  497. package/build/models/data/storefront/index.d.ts +27 -0
  498. package/build/models/data/storefront/index.js +1 -0
  499. package/build/models/data/storefront/localization/index.d.ts +8 -0
  500. package/build/models/data/storefront/localization/index.js +1 -0
  501. package/build/models/data/storefront/routing/dynamic-currency/index.d.ts +6 -0
  502. package/build/models/data/storefront/routing/dynamic-currency/index.js +1 -0
  503. package/build/models/data/storefront/routing/index.d.ts +14 -0
  504. package/build/models/data/storefront/routing/index.js +1 -0
  505. package/build/models/data/storefront/theme/index.d.ts +10 -0
  506. package/build/models/data/storefront/theme/index.js +1 -0
  507. package/build/models/data/storefront/theme-localization/index.d.ts +13 -0
  508. package/build/models/data/storefront/theme-localization/index.js +1 -0
  509. package/build/models/data/theme-json/component/index.d.ts +20 -0
  510. package/build/models/data/theme-json/component/index.js +1 -0
  511. package/build/models/data/theme-json/component/prop/index.d.ts +26 -0
  512. package/build/models/data/theme-json/component/prop/index.js +1 -0
  513. package/build/models/data/theme-json/custom-data/index.d.ts +43 -0
  514. package/build/models/data/theme-json/custom-data/index.js +1 -0
  515. package/build/models/data/theme-json/index.d.ts +16 -0
  516. package/build/models/data/theme-json/index.js +1 -0
  517. package/build/models/data/theme-json/page/component/index.d.ts +7 -0
  518. package/build/models/data/theme-json/page/component/index.js +1 -0
  519. package/build/models/data/theme-json/page/index.d.ts +21 -0
  520. package/build/models/data/theme-json/page/index.js +1 -0
  521. package/build/models/data/theme-json/settings/color/index.d.ts +15 -0
  522. package/build/models/data/theme-json/settings/color/index.js +1 -0
  523. package/build/models/data/theme-json/settings/favicon/index.d.ts +5 -0
  524. package/build/models/data/theme-json/settings/favicon/index.js +1 -0
  525. package/build/models/data/theme-json/settings/font-family/index.d.ts +6 -0
  526. package/build/models/data/theme-json/settings/font-family/index.js +1 -0
  527. package/build/models/data/theme-json/settings/index.d.ts +13 -0
  528. package/build/models/data/theme-json/settings/index.js +1 -0
  529. package/build/models/data/variant-type/index.d.ts +13 -0
  530. package/build/models/data/variant-type/index.js +1 -0
  531. package/build/models/data/variant-type/variant-value/index.d.ts +12 -0
  532. package/build/models/data/variant-type/variant-value/index.js +1 -0
  533. package/build/models/index.d.ts +2 -0
  534. package/build/models/ui/blog-category-list/index.d.ts +51 -0
  535. package/build/models/ui/blog-category-list/index.js +1 -0
  536. package/build/models/ui/blog-list/index.d.ts +55 -0
  537. package/build/models/ui/blog-list/index.js +1 -0
  538. package/build/models/ui/brand-list/index.d.ts +61 -0
  539. package/build/models/ui/brand-list/index.js +1 -0
  540. package/build/models/ui/category-list/index.d.ts +61 -0
  541. package/build/models/ui/category-list/index.js +1 -0
  542. package/build/models/ui/component-renderer/index.d.ts +7 -0
  543. package/build/models/ui/component-renderer/index.js +1 -0
  544. package/build/models/ui/customer-review-list/index.d.ts +43 -0
  545. package/build/models/ui/customer-review-list/index.js +1 -0
  546. package/build/models/ui/customer-review-summary-list/index.d.ts +43 -0
  547. package/build/models/ui/customer-review-summary-list/index.js +1 -0
  548. package/build/models/ui/index.d.ts +25 -0
  549. package/build/models/ui/navigation-link/index.d.ts +8 -0
  550. package/build/models/ui/navigation-link/index.js +1 -0
  551. package/build/models/ui/product-attribute-detail/index.d.ts +8 -0
  552. package/build/models/ui/product-attribute-detail/index.js +1 -0
  553. package/build/models/ui/product-attribute-list/index.d.ts +8 -0
  554. package/build/models/ui/product-attribute-list/index.js +1 -0
  555. package/build/models/ui/product-list/index.d.ts +137 -0
  556. package/build/models/ui/product-list/index.js +1 -0
  557. package/build/models/ui/raffle-list/index.d.ts +53 -0
  558. package/build/models/ui/raffle-list/index.js +1 -0
  559. package/build/models/ui/validator/form/account-info.d.ts +39 -0
  560. package/build/models/ui/validator/form/account-info.js +1 -0
  561. package/build/models/ui/validator/form/address.d.ts +75 -0
  562. package/build/models/ui/validator/form/address.js +1 -0
  563. package/build/models/ui/validator/form/contact-form.d.ts +42 -0
  564. package/build/models/ui/validator/form/contact-form.js +1 -0
  565. package/build/models/ui/validator/form/customer-review.d.ts +34 -0
  566. package/build/models/ui/validator/form/customer-review.js +1 -0
  567. package/build/models/ui/validator/form/forgot-password.d.ts +26 -0
  568. package/build/models/ui/validator/form/forgot-password.js +1 -0
  569. package/build/models/ui/validator/form/login.d.ts +32 -0
  570. package/build/models/ui/validator/form/login.js +1 -0
  571. package/build/models/ui/validator/form/raffle-form.d.ts +62 -0
  572. package/build/models/ui/validator/form/raffle-form.js +1 -0
  573. package/build/models/ui/validator/form/recover-password.d.ts +33 -0
  574. package/build/models/ui/validator/form/recover-password.js +1 -0
  575. package/build/models/ui/validator/form/register.d.ts +49 -0
  576. package/build/models/ui/validator/form/register.js +1 -0
  577. package/build/models/ui/validator/index.d.ts +27 -0
  578. package/build/models/ui/validator/index.js +1 -0
  579. package/build/models/ui/validator/rules/index.d.ts +101 -0
  580. package/build/models/ui/validator/rules/index.js +1 -0
  581. package/build/page-data-init/index.d.ts +39 -0
  582. package/build/page-data-init/index.js +1 -0
  583. package/build/pages/404.d.ts +4 -0
  584. package/build/pages/404.js +1 -0
  585. package/build/pages/[slug]/index.d.ts +4 -0
  586. package/build/pages/_slug_/index.js +1 -0
  587. package/build/pages/account/addresses.d.ts +4 -0
  588. package/build/pages/account/addresses.js +1 -0
  589. package/build/pages/account/favorite-products.d.ts +4 -0
  590. package/build/pages/account/favorite-products.js +1 -0
  591. package/build/pages/account/forgot-password.d.ts +4 -0
  592. package/build/pages/account/forgot-password.js +1 -0
  593. package/build/pages/account/index.d.ts +4 -0
  594. package/build/pages/account/index.js +1 -0
  595. package/build/pages/account/login.d.ts +4 -0
  596. package/build/pages/account/login.js +1 -0
  597. package/build/pages/account/orders/[id].d.ts +4 -0
  598. package/build/pages/account/orders/_id_.js +1 -0
  599. package/build/pages/account/orders/index.d.ts +4 -0
  600. package/build/pages/account/orders/index.js +1 -0
  601. package/build/pages/account/raffles.d.ts +4 -0
  602. package/build/pages/account/raffles.js +1 -0
  603. package/build/pages/account/recover-password.d.ts +4 -0
  604. package/build/pages/account/recover-password.js +1 -0
  605. package/build/pages/account/register.d.ts +4 -0
  606. package/build/pages/account/register.js +1 -0
  607. package/build/pages/blog/[slug].d.ts +4 -0
  608. package/build/pages/blog/_slug_.js +1 -0
  609. package/build/pages/blog/index.d.ts +4 -0
  610. package/build/pages/blog/index.js +1 -0
  611. package/build/pages/cart.d.ts +4 -0
  612. package/build/pages/cart.js +1 -0
  613. package/build/pages/checkout.d.ts +16 -0
  614. package/build/pages/checkout.js +1 -0
  615. package/build/pages/editor.d.ts +10 -0
  616. package/build/pages/editor.js +1 -0
  617. package/build/pages/home.d.ts +4 -0
  618. package/build/pages/home.js +1 -0
  619. package/build/pages/index.d.ts +22 -0
  620. package/build/pages/pages/[slug].d.ts +4 -0
  621. package/build/pages/pages/_slug_.js +1 -0
  622. package/build/pages/raffle/[slug].d.ts +4 -0
  623. package/build/pages/raffle/_slug_.js +1 -0
  624. package/build/pages/raffle/index.d.ts +4 -0
  625. package/build/pages/raffle/index.js +1 -0
  626. package/build/pages/search.d.ts +4 -0
  627. package/build/pages/search.js +1 -0
  628. package/build/store/base.d.ts +44 -0
  629. package/build/store/base.js +1 -0
  630. package/build/store/blog/index.d.ts +26 -0
  631. package/build/store/blog/index.js +1 -0
  632. package/build/store/brand/index.d.ts +12 -0
  633. package/build/store/brand/index.js +1 -0
  634. package/build/store/cart/api.d.ts +10 -0
  635. package/build/store/cart/api.js +1 -0
  636. package/build/store/cart/index.d.ts +27 -0
  637. package/build/store/cart/index.js +1 -0
  638. package/build/store/category/index.d.ts +12 -0
  639. package/build/store/category/index.js +1 -0
  640. package/build/store/checkout/index.d.ts +14 -0
  641. package/build/store/checkout/index.js +1 -0
  642. package/build/store/customer/api.d.ts +54 -0
  643. package/build/store/customer/api.js +1 -0
  644. package/build/store/customer/index.d.ts +74 -0
  645. package/build/store/customer/index.js +1 -0
  646. package/build/store/html-meta-data/index.d.ts +6 -0
  647. package/build/store/html-meta-data/index.js +1 -0
  648. package/build/store/index.d.ts +3 -0
  649. package/build/store/location/index.d.ts +9 -0
  650. package/build/store/location/index.js +1 -0
  651. package/build/store/merchant/index.d.ts +6 -0
  652. package/build/store/product/index.d.ts +36 -0
  653. package/build/store/product/index.js +1 -0
  654. package/build/store/raffle/index.d.ts +15 -0
  655. package/build/store/raffle/index.js +1 -0
  656. package/build/store/storefront/index.d.ts +5 -0
  657. package/build/utils/constants.d.ts +2 -0
  658. package/build/utils/constants.js +1 -0
  659. package/build/utils/currency.d.ts +7 -0
  660. package/build/utils/currency.js +1 -0
  661. package/build/utils/google-fonts.d.ts +2 -0
  662. package/build/utils/google-fonts.js +1 -0
  663. package/build/utils/helper.d.ts +4 -0
  664. package/build/utils/helper.js +1 -0
  665. package/build/utils/i18n.d.ts +11 -0
  666. package/build/utils/i18n.js +1 -0
  667. package/build/utils/index.d.ts +3 -0
  668. package/package.json +14 -14
  669. package/src/analytics/analytics.ts +0 -537
  670. package/src/analytics/events.ts +0 -116
  671. package/src/analytics/facebookPixel.ts +0 -226
  672. package/src/analytics/googleAnalytics.ts +0 -227
  673. package/src/analytics/googleTagManager.ts +0 -341
  674. package/src/analytics/googleUniversal.ts +0 -146
  675. package/src/analytics/head/index.tsx +0 -134
  676. package/src/analytics/ikas.ts +0 -568
  677. package/src/analytics/index.ts +0 -2
  678. package/src/analytics/tiktokPixel.ts +0 -223
  679. package/src/components/checkout/components/address-form/index.tsx +0 -406
  680. package/src/components/checkout/components/address-form/model.ts +0 -398
  681. package/src/components/checkout/components/button/index.tsx +0 -44
  682. package/src/components/checkout/components/button/style.module.scss +0 -103
  683. package/src/components/checkout/components/cart-summary/cart-item/index.tsx +0 -167
  684. package/src/components/checkout/components/cart-summary/cart-item/style.module.scss +0 -144
  685. package/src/components/checkout/components/cart-summary/index.tsx +0 -512
  686. package/src/components/checkout/components/cart-summary/style.module.scss +0 -296
  687. package/src/components/checkout/components/checkbox/check.tsx +0 -23
  688. package/src/components/checkout/components/checkbox/index.tsx +0 -50
  689. package/src/components/checkout/components/checkbox/style.module.scss +0 -72
  690. package/src/components/checkout/components/credit-card-form/index.tsx +0 -122
  691. package/src/components/checkout/components/credit-card-form/model.ts +0 -56
  692. package/src/components/checkout/components/credit-card-form/style.module.scss +0 -6
  693. package/src/components/checkout/components/credit-card-form/svg/amex.tsx +0 -30
  694. package/src/components/checkout/components/credit-card-form/svg/master-card.tsx +0 -38
  695. package/src/components/checkout/components/credit-card-form/svg/troy.tsx +0 -54
  696. package/src/components/checkout/components/credit-card-form/svg/visa.tsx +0 -46
  697. package/src/components/checkout/components/customer-addresses/index.tsx +0 -338
  698. package/src/components/checkout/components/customer-addresses/model.ts +0 -134
  699. package/src/components/checkout/components/customer-addresses/style.module.scss +0 -38
  700. package/src/components/checkout/components/delivery-methods/icon-button/index.tsx +0 -29
  701. package/src/components/checkout/components/delivery-methods/icon-button/style.module.scss +0 -41
  702. package/src/components/checkout/components/delivery-methods/icons/box.tsx +0 -22
  703. package/src/components/checkout/components/delivery-methods/icons/store.tsx +0 -22
  704. package/src/components/checkout/components/delivery-methods/index.tsx +0 -39
  705. package/src/components/checkout/components/delivery-methods/style.module.scss +0 -4
  706. package/src/components/checkout/components/error/customer-login-required-error/index.tsx +0 -23
  707. package/src/components/checkout/components/error/index.tsx +0 -54
  708. package/src/components/checkout/components/error/no-shipping-error/index.tsx +0 -14
  709. package/src/components/checkout/components/error/payment-error/index.tsx +0 -21
  710. package/src/components/checkout/components/error/stock-error/index.tsx +0 -72
  711. package/src/components/checkout/components/error/stock-error/style.module.scss +0 -11
  712. package/src/components/checkout/components/error/unknown-error/index.tsx +0 -21
  713. package/src/components/checkout/components/expandable-section/index.tsx +0 -37
  714. package/src/components/checkout/components/expandable-section/style.module.scss +0 -29
  715. package/src/components/checkout/components/form-item/caret-down.tsx +0 -20
  716. package/src/components/checkout/components/form-item/index.tsx +0 -207
  717. package/src/components/checkout/components/form-item/model.ts +0 -145
  718. package/src/components/checkout/components/form-item/style.module.scss +0 -216
  719. package/src/components/checkout/components/fullscreen-loading/index.tsx +0 -10
  720. package/src/components/checkout/components/fullscreen-loading/style.module.scss +0 -56
  721. package/src/components/checkout/components/input-with-button/index.tsx +0 -53
  722. package/src/components/checkout/components/input-with-button/style.module.scss +0 -104
  723. package/src/components/checkout/components/master-pass/credit-card-form/index.tsx +0 -162
  724. package/src/components/checkout/components/master-pass/credit-card-form/style.module.scss +0 -15
  725. package/src/components/checkout/components/master-pass/modal/index.tsx +0 -32
  726. package/src/components/checkout/components/master-pass/modal/style.module.scss +0 -42
  727. package/src/components/checkout/components/master-pass/modal/svg/modal-close.tsx +0 -20
  728. package/src/components/checkout/components/master-pass/modal-link-card-to-client/index.tsx +0 -62
  729. package/src/components/checkout/components/master-pass/modal-link-card-to-client/style.module.scss +0 -27
  730. package/src/components/checkout/components/master-pass/modal-link-card-to-client/svg/info-mark.tsx +0 -19
  731. package/src/components/checkout/components/master-pass/modal-link-card-to-client/svg/master-pass-by-master-card-big.tsx +0 -41
  732. package/src/components/checkout/components/master-pass/modal-otp/index.tsx +0 -202
  733. package/src/components/checkout/components/master-pass/modal-otp/style.module.scss +0 -47
  734. package/src/components/checkout/components/master-pass/modal-otp/svg/master-pass.tsx +0 -28
  735. package/src/components/checkout/components/master-pass/modal-response/index.tsx +0 -24
  736. package/src/components/checkout/components/master-pass/modal-response/style.module.scss +0 -7
  737. package/src/components/checkout/components/master-pass/modal-success/index.tsx +0 -54
  738. package/src/components/checkout/components/master-pass/modal-success/style.module.scss +0 -25
  739. package/src/components/checkout/components/master-pass/modal-success/svg/master-pass-by-master-card-small.tsx +0 -41
  740. package/src/components/checkout/components/master-pass/modal-success/svg/success.tsx +0 -21
  741. package/src/components/checkout/components/master-pass/payment-gateway/svg/master-card.tsx +0 -14
  742. package/src/components/checkout/components/master-pass/svg/master-pass-by-master-card.tsx +0 -34
  743. package/src/components/checkout/components/modal/index.tsx +0 -41
  744. package/src/components/checkout/components/modal/style.module.scss +0 -68
  745. package/src/components/checkout/components/modal/useEscape.tsx +0 -20
  746. package/src/components/checkout/components/notification-box/index.tsx +0 -70
  747. package/src/components/checkout/components/notification-box/style.module.scss +0 -69
  748. package/src/components/checkout/components/offer-product/index.tsx +0 -177
  749. package/src/components/checkout/components/offer-product/select/arrows.tsx +0 -22
  750. package/src/components/checkout/components/offer-product/select/index.tsx +0 -40
  751. package/src/components/checkout/components/offer-product/select/style.module.scss +0 -28
  752. package/src/components/checkout/components/offer-product/style.module.scss +0 -115
  753. package/src/components/checkout/components/phone-number-input/compare-strings.ts +0 -5
  754. package/src/components/checkout/components/phone-number-input/get-countries.ts +0 -52
  755. package/src/components/checkout/components/phone-number-input/index.tsx +0 -125
  756. package/src/components/checkout/components/phone-number-input/style.module.scss +0 -83
  757. package/src/components/checkout/components/select-box/index.tsx +0 -60
  758. package/src/components/checkout/components/select-box/style.module.scss +0 -55
  759. package/src/components/checkout/components/step-container/index.tsx +0 -107
  760. package/src/components/checkout/components/step-container/style.module.scss +0 -86
  761. package/src/components/checkout/components/stripe/checkout-form.tsx +0 -55
  762. package/src/components/checkout/components/stripe/index.tsx +0 -91
  763. package/src/components/checkout/components/stripe/style.module.scss +0 -75
  764. package/src/components/checkout/components/svg/arrow-down.tsx +0 -23
  765. package/src/components/checkout/components/svg/arrow-left.tsx +0 -23
  766. package/src/components/checkout/components/svg/arrow-right.tsx +0 -23
  767. package/src/components/checkout/components/svg/cross.tsx +0 -23
  768. package/src/components/checkout/components/svg/discount.tsx +0 -34
  769. package/src/components/checkout/components/svg/external.tsx +0 -101
  770. package/src/components/checkout/components/svg/gift.tsx +0 -40
  771. package/src/components/checkout/components/svg/ikas.tsx +0 -39
  772. package/src/components/checkout/components/svg/lock.tsx +0 -23
  773. package/src/components/checkout/components/svg/shopping-cart.tsx +0 -23
  774. package/src/components/checkout/components/svg/success-circle.tsx +0 -26
  775. package/src/components/checkout/components/svg/tag.tsx +0 -23
  776. package/src/components/checkout/components/svg/warning.tsx +0 -30
  777. package/src/components/checkout/components/toggle/index.tsx +0 -51
  778. package/src/components/checkout/components/toggle/style.module.scss +0 -75
  779. package/src/components/checkout/components/tooltip/index.tsx +0 -27
  780. package/src/components/checkout/components/tooltip/style.module.scss +0 -86
  781. package/src/components/checkout/index.tsx +0 -650
  782. package/src/components/checkout/model.ts +0 -1589
  783. package/src/components/checkout/modelMasterPass.ts +0 -1001
  784. package/src/components/checkout/steps/step-info/index.tsx +0 -91
  785. package/src/components/checkout/steps/step-payment/billing-address/index.tsx +0 -48
  786. package/src/components/checkout/steps/step-payment/index.tsx +0 -113
  787. package/src/components/checkout/steps/step-payment/payment-gateways/index.tsx +0 -227
  788. package/src/components/checkout/steps/step-payment/payment-gateways/installments/index.tsx +0 -56
  789. package/src/components/checkout/steps/step-payment/payment-gateways/installments/style.module.scss +0 -50
  790. package/src/components/checkout/steps/step-payment/payment-gateways/style.module.scss +0 -32
  791. package/src/components/checkout/steps/step-payment/style.module.scss +0 -37
  792. package/src/components/checkout/steps/step-shipping/index.tsx +0 -131
  793. package/src/components/checkout/steps/step-shipping/style.module.scss +0 -44
  794. package/src/components/checkout/steps/step-success/index.tsx +0 -374
  795. package/src/components/checkout/steps/step-success/style.module.scss +0 -161
  796. package/src/components/checkout/style.module.scss +0 -366
  797. package/src/components/checkout/styles/common.module.scss +0 -59
  798. package/src/components/checkout/styles/variables.scss +0 -40
  799. package/src/components/image/index.tsx +0 -43
  800. package/src/components/index.ts +0 -5
  801. package/src/components/link/index.tsx +0 -26
  802. package/src/components/page/ThemeComponent.tsx +0 -108
  803. package/src/components/page/head.tsx +0 -370
  804. package/src/components/page/index.tsx +0 -220
  805. package/src/components/page-editor/ThemeComponentEditor.tsx +0 -281
  806. package/src/components/page-editor/error/index.tsx +0 -18
  807. package/src/components/page-editor/index.tsx +0 -194
  808. package/src/components/page-editor/loader/index.tsx +0 -18
  809. package/src/components/page-editor/loader/style.module.scss +0 -59
  810. package/src/components/page-editor/model.ts +0 -784
  811. package/src/index.ts +0 -6
  812. package/src/models/data/base/index.ts +0 -15
  813. package/src/models/data/blog/category/index.ts +0 -36
  814. package/src/models/data/blog/content/index.ts +0 -16
  815. package/src/models/data/blog/index.ts +0 -75
  816. package/src/models/data/blog/meta-data/index.ts +0 -39
  817. package/src/models/data/blog/tag/index.ts +0 -16
  818. package/src/models/data/blog/writer/index.ts +0 -17
  819. package/src/models/data/brand/index.ts +0 -58
  820. package/src/models/data/brand/translation/index.ts +0 -16
  821. package/src/models/data/campaign-offer/index.ts +0 -79
  822. package/src/models/data/campaign-offer/product/index.ts +0 -69
  823. package/src/models/data/cart/available-shipping-method/index.ts +0 -25
  824. package/src/models/data/cart/campaign-offer/index.ts +0 -54
  825. package/src/models/data/cart/index.ts +0 -38
  826. package/src/models/data/category/index.ts +0 -69
  827. package/src/models/data/category/path-item/index.ts +0 -46
  828. package/src/models/data/category/translations/index.ts +0 -16
  829. package/src/models/data/checkout/index.ts +0 -87
  830. package/src/models/data/checkout-settings/index.ts +0 -63
  831. package/src/models/data/checkout-settings/option/index.ts +0 -14
  832. package/src/models/data/checkout-settings/price/index.ts +0 -16
  833. package/src/models/data/city/index.ts +0 -34
  834. package/src/models/data/contact-form/index.ts +0 -20
  835. package/src/models/data/country/index.ts +0 -50
  836. package/src/models/data/country/location-translations/index.ts +0 -15
  837. package/src/models/data/customer/address/city/index.ts +0 -16
  838. package/src/models/data/customer/address/country/index.ts +0 -20
  839. package/src/models/data/customer/address/district/index.ts +0 -16
  840. package/src/models/data/customer/address/index.tsx +0 -136
  841. package/src/models/data/customer/address/state/index.ts +0 -16
  842. package/src/models/data/customer/attribute/index.ts +0 -61
  843. package/src/models/data/customer/attribute/option/index.ts +0 -20
  844. package/src/models/data/customer/attribute/sales-channel/index.ts +0 -24
  845. package/src/models/data/customer/attribute/translation/index.ts +0 -23
  846. package/src/models/data/customer/attribute/translation/option/index.ts +0 -16
  847. package/src/models/data/customer/attribute/value/index.ts +0 -29
  848. package/src/models/data/customer/index.ts +0 -122
  849. package/src/models/data/customer/review/index.ts +0 -70
  850. package/src/models/data/customer/review/settings/index.ts +0 -14
  851. package/src/models/data/customer/review/summary/index.ts +0 -29
  852. package/src/models/data/customer/review/summary/star/index.ts +0 -16
  853. package/src/models/data/district/index.ts +0 -36
  854. package/src/models/data/favorite-product/index.ts +0 -23
  855. package/src/models/data/filter-category/index.ts +0 -30
  856. package/src/models/data/html-meta-data/index.ts +0 -69
  857. package/src/models/data/html-meta-data/translations/index.ts +0 -16
  858. package/src/models/data/image/index.ts +0 -33
  859. package/src/models/data/index.ts +0 -195
  860. package/src/models/data/last-viewed-product/index.ts +0 -14
  861. package/src/models/data/merchant-settings/index.ts +0 -35
  862. package/src/models/data/order/address/city/index.ts +0 -16
  863. package/src/models/data/order/address/country/index.ts +0 -20
  864. package/src/models/data/order/address/district/index.ts +0 -16
  865. package/src/models/data/order/address/index.ts +0 -96
  866. package/src/models/data/order/address/state/index.ts +0 -16
  867. package/src/models/data/order/adjustment/applied-order-line/index.ts +0 -20
  868. package/src/models/data/order/adjustment/index.ts +0 -39
  869. package/src/models/data/order/customer/index.ts +0 -24
  870. package/src/models/data/order/gift-line/index.ts +0 -14
  871. package/src/models/data/order/index.ts +0 -260
  872. package/src/models/data/order/invoice/index.ts +0 -29
  873. package/src/models/data/order/line-item/base-unit/index.ts +0 -22
  874. package/src/models/data/order/line-item/base-unit/unit-type/index.ts +0 -14
  875. package/src/models/data/order/line-item/discount/index.ts +0 -23
  876. package/src/models/data/order/line-item/index.ts +0 -211
  877. package/src/models/data/order/line-item/option/index.ts +0 -24
  878. package/src/models/data/order/line-item/option/value/index.ts +0 -16
  879. package/src/models/data/order/line-item/variant/brand/index.ts +0 -14
  880. package/src/models/data/order/line-item/variant/category/index.ts +0 -36
  881. package/src/models/data/order/line-item/variant/index.ts +0 -70
  882. package/src/models/data/order/line-item/variant/price/index.ts +0 -22
  883. package/src/models/data/order/line-item/variant/unit/index.ts +0 -17
  884. package/src/models/data/order/line-item/variant/value/index.ts +0 -31
  885. package/src/models/data/order/package/index.ts +0 -41
  886. package/src/models/data/order/package/tracking-info/index.ts +0 -20
  887. package/src/models/data/order/payment-method/index.ts +0 -23
  888. package/src/models/data/order/refund/index.ts +0 -17
  889. package/src/models/data/order/refund/line-item/index.ts +0 -16
  890. package/src/models/data/order/refund/settings/index.ts +0 -16
  891. package/src/models/data/order/shipping-line/index.ts +0 -29
  892. package/src/models/data/order/tax-line/index.ts +0 -14
  893. package/src/models/data/order/transaction/error/index.ts +0 -16
  894. package/src/models/data/order/transaction/index.ts +0 -55
  895. package/src/models/data/order/transaction/payment-method-detail/index.ts +0 -33
  896. package/src/models/data/order/transaction/payment-method-detail/installment-price/index.ts +0 -22
  897. package/src/models/data/payment-gateway/additional-price/index.ts +0 -29
  898. package/src/models/data/payment-gateway/index.ts +0 -90
  899. package/src/models/data/payment-gateway/settings/index.ts +0 -21
  900. package/src/models/data/payment-gateway/translation/index.ts +0 -18
  901. package/src/models/data/product/attribute/index.ts +0 -37
  902. package/src/models/data/product/attribute/option/index.ts +0 -14
  903. package/src/models/data/product/attribute/table-cell/index.ts +0 -16
  904. package/src/models/data/product/attribute/table-template/index.ts +0 -19
  905. package/src/models/data/product/attribute/translation/index.ts +0 -39
  906. package/src/models/data/product/attribute-value/index.ts +0 -109
  907. package/src/models/data/product/back-in-stock-settings/index.ts +0 -14
  908. package/src/models/data/product/base-unit/index.ts +0 -32
  909. package/src/models/data/product/campaign/data/index.ts +0 -70
  910. package/src/models/data/product/campaign/filter/index.ts +0 -19
  911. package/src/models/data/product/campaign/index.ts +0 -15
  912. package/src/models/data/product/campaign/product-buyx-then-gety/index.ts +0 -57
  913. package/src/models/data/product/campaign/product-campaign-date-range-field/index.ts +0 -16
  914. package/src/models/data/product/campaign/product-fixed-discount/index.ts +0 -40
  915. package/src/models/data/product/filter/index.ts +0 -276
  916. package/src/models/data/product/image/index.ts +0 -22
  917. package/src/models/data/product/index.ts +0 -336
  918. package/src/models/data/product/option-set/index.ts +0 -99
  919. package/src/models/data/product/option-set/option/index.ts +0 -268
  920. package/src/models/data/product/tag/index.ts +0 -14
  921. package/src/models/data/product/variant/index.ts +0 -129
  922. package/src/models/data/product/variant/price/index.ts +0 -74
  923. package/src/models/data/product/variant/unit/index.ts +0 -17
  924. package/src/models/data/product/variant-type/index.ts +0 -19
  925. package/src/models/data/product/variant-type/init.ts +0 -15
  926. package/src/models/data/raffle/index.ts +0 -157
  927. package/src/models/data/sales-channel/index.ts +0 -56
  928. package/src/models/data/state/index.ts +0 -22
  929. package/src/models/data/stock-location/address/city/index.ts +0 -16
  930. package/src/models/data/stock-location/address/country/index.ts +0 -18
  931. package/src/models/data/stock-location/address/district/index.ts +0 -18
  932. package/src/models/data/stock-location/address/index.ts +0 -34
  933. package/src/models/data/stock-location/address/state/index.ts +0 -18
  934. package/src/models/data/stock-location/available/index.ts +0 -22
  935. package/src/models/data/stock-location/index.ts +0 -35
  936. package/src/models/data/storefront/domain/index.ts +0 -20
  937. package/src/models/data/storefront/index.ts +0 -67
  938. package/src/models/data/storefront/localization/index.tsx +0 -18
  939. package/src/models/data/storefront/routing/dynamic-currency/index.ts +0 -16
  940. package/src/models/data/storefront/routing/index.tsx +0 -29
  941. package/src/models/data/storefront/theme/index.tsx +0 -25
  942. package/src/models/data/storefront/theme-localization/index.tsx +0 -31
  943. package/src/models/data/theme-json/component/index.ts +0 -41
  944. package/src/models/data/theme-json/component/prop/index.ts +0 -55
  945. package/src/models/data/theme-json/custom-data/index.ts +0 -132
  946. package/src/models/data/theme-json/index.ts +0 -210
  947. package/src/models/data/theme-json/page/component/index.ts +0 -22
  948. package/src/models/data/theme-json/page/index.ts +0 -54
  949. package/src/models/data/theme-json/settings/color/index.ts +0 -35
  950. package/src/models/data/theme-json/settings/favicon/index.ts +0 -12
  951. package/src/models/data/theme-json/settings/font-family/index.ts +0 -14
  952. package/src/models/data/theme-json/settings/index.ts +0 -30
  953. package/src/models/data/variant-type/index.ts +0 -44
  954. package/src/models/data/variant-type/variant-value/index.ts +0 -32
  955. package/src/models/index.ts +0 -2
  956. package/src/models/ui/blog-category-list/index.ts +0 -169
  957. package/src/models/ui/blog-list/index.ts +0 -175
  958. package/src/models/ui/brand-list/index.ts +0 -237
  959. package/src/models/ui/category-list/index.ts +0 -237
  960. package/src/models/ui/component-renderer/index.ts +0 -9
  961. package/src/models/ui/customer-review-list/index.ts +0 -173
  962. package/src/models/ui/customer-review-summary-list/index.ts +0 -175
  963. package/src/models/ui/index.ts +0 -40
  964. package/src/models/ui/navigation-link/index.ts +0 -23
  965. package/src/models/ui/product-attribute-detail/index.ts +0 -29
  966. package/src/models/ui/product-attribute-list/index.ts +0 -52
  967. package/src/models/ui/product-list/index.ts +0 -1007
  968. package/src/models/ui/raffle-list/index.ts +0 -178
  969. package/src/models/ui/validator/form/account-info.ts +0 -167
  970. package/src/models/ui/validator/form/address.ts +0 -490
  971. package/src/models/ui/validator/form/contact-form.ts +0 -177
  972. package/src/models/ui/validator/form/customer-review.ts +0 -132
  973. package/src/models/ui/validator/form/forgot-password.ts +0 -96
  974. package/src/models/ui/validator/form/login.ts +0 -128
  975. package/src/models/ui/validator/form/raffle-form.ts +0 -289
  976. package/src/models/ui/validator/form/recover-password.ts +0 -148
  977. package/src/models/ui/validator/form/register.ts +0 -206
  978. package/src/models/ui/validator/index.ts +0 -121
  979. package/src/models/ui/validator/rules/index.ts +0 -311
  980. package/src/page-data-init/index.ts +0 -659
  981. package/src/pages/404.tsx +0 -10
  982. package/src/pages/[slug]/index.tsx +0 -9
  983. package/src/pages/account/addresses.tsx +0 -10
  984. package/src/pages/account/favorite-products.tsx +0 -9
  985. package/src/pages/account/forgot-password.tsx +0 -9
  986. package/src/pages/account/index.tsx +0 -9
  987. package/src/pages/account/login.tsx +0 -9
  988. package/src/pages/account/orders/[id].tsx +0 -9
  989. package/src/pages/account/orders/index.tsx +0 -9
  990. package/src/pages/account/raffles.tsx +0 -9
  991. package/src/pages/account/recover-password.tsx +0 -9
  992. package/src/pages/account/register.tsx +0 -9
  993. package/src/pages/blog/[slug].tsx +0 -9
  994. package/src/pages/blog/index.tsx +0 -9
  995. package/src/pages/cart.tsx +0 -9
  996. package/src/pages/checkout.tsx +0 -164
  997. package/src/pages/editor.tsx +0 -33
  998. package/src/pages/home.tsx +0 -10
  999. package/src/pages/index.ts +0 -22
  1000. package/src/pages/pages/[slug].tsx +0 -9
  1001. package/src/pages/raffle/[slug].tsx +0 -9
  1002. package/src/pages/raffle/index.tsx +0 -9
  1003. package/src/pages/search.tsx +0 -9
  1004. package/src/store/base.ts +0 -238
  1005. package/src/store/blog/index.ts +0 -49
  1006. package/src/store/brand/index.ts +0 -16
  1007. package/src/store/cart/api.ts +0 -58
  1008. package/src/store/cart/index.ts +0 -311
  1009. package/src/store/category/index.ts +0 -16
  1010. package/src/store/checkout/index.ts +0 -92
  1011. package/src/store/customer/api.ts +0 -273
  1012. package/src/store/customer/index.ts +0 -648
  1013. package/src/store/html-meta-data/index.ts +0 -16
  1014. package/src/store/index.ts +0 -3
  1015. package/src/store/location/index.ts +0 -56
  1016. package/src/store/merchant/index.ts +0 -16
  1017. package/src/store/product/index.ts +0 -113
  1018. package/src/store/raffle/index.ts +0 -55
  1019. package/src/store/storefront/index.ts +0 -18
  1020. package/src/typings/global.d.ts +0 -7
  1021. package/src/utils/constants.ts +0 -2
  1022. package/src/utils/currency.ts +0 -76
  1023. package/src/utils/google-fonts.ts +0 -52
  1024. package/src/utils/helper.ts +0 -77
  1025. package/src/utils/i18n.ts +0 -126
  1026. package/src/utils/index.ts +0 -3
@@ -1,1589 +0,0 @@
1
- import { makeAutoObservable } from "mobx";
2
- import { NextRouter } from "next/router.js";
3
- import _cloneDeep from "lodash/cloneDeep";
4
- import _sortBy from "lodash/sortBy";
5
-
6
- import {
7
- IkasCustomerAddress,
8
- IkasMerchantSettings,
9
- IkasAvailableShippingMethod,
10
- IkasOrderLineItem,
11
- IkasOrderTransaction,
12
- IkasOrderCustomer,
13
- IkasCartCampaignOfferStatus,
14
- IkasProduct,
15
- IkasProductVariant,
16
- IkasCartCampaignOffer,
17
- IkasCheckout,
18
- IkasStockLocation,
19
- IkasAvailableStockLocation,
20
- IkasTransactionStatus,
21
- IkasCampaignOfferTargetPageType,
22
- IkasCampaignOfferProduct,
23
- IkasOrderShippingMethod,
24
- } from "../../models";
25
- import { IkasOrderAddress } from "../../models/data/order/address";
26
- import {
27
- IkasPaymentGateway,
28
- IkasPaymentGatewayType,
29
- IkasPaymentMethodType,
30
- } from "../../models/data/payment-gateway";
31
- import { IkasOrderLineVariant } from "../../models/data/order/line-item/variant";
32
- import { IkasStorefront } from "../../models/data/storefront";
33
- import CreditCardData from "./components/credit-card-form/model";
34
- import { IkasCheckoutSettings } from "../../models/data/checkout-settings";
35
- import { TFunction } from "../../utils/i18n";
36
- import CustomerStoreAPI from "../../store/customer/api";
37
- import CheckoutStore from "../../store/checkout";
38
- import CartStoreAPI from "../../store/cart/api";
39
- import { IkasCheckoutCustomizationProps } from ".";
40
-
41
- import MasterPassModel from "./modelMasterPass";
42
- import { APIResponse } from "@ikas/fe-api-client";
43
- import ProductStoreAPI from "../../store/product";
44
- import {
45
- CreateStripePaymentIntentResponse,
46
- RetrieveInstallmentInfoResponse,
47
- TransactionResponse,
48
- UpdateCartCampaignOfferInput,
49
- } from "@ikas/storefront-api";
50
- import { IkasBaseStore } from "../../store";
51
- import { IkasStorefrontConfig } from "@ikas/storefront-config";
52
- import { Analytics } from "../../analytics";
53
- import {
54
- CheckStocksLineInput,
55
- RetrieveInstallmentInfoQueryParams,
56
- SaveCartInput,
57
- } from "@ikas/storefront-api";
58
-
59
- const NUMBER_ONLY_REGEX = /^\d+$/;
60
- const MAX_CARD_NUMBER_LENGTH = 16;
61
- const MAX_CVC_LENGTH = 4;
62
- const USE_DIFFERENT_ADDRESS_KEY = "sAddr";
63
- const isServer = typeof localStorage === "undefined";
64
-
65
- export default class CheckoutViewModel {
66
- checkout: IkasCheckout;
67
- checkoutSettings: IkasCheckoutSettings;
68
- storefront?: IkasStorefront | null = null;
69
- router: NextRouter;
70
- isCheckoutLoaded = false;
71
- isErrorsVisible = false;
72
- isStepLoading = false;
73
- isTermsAndConditionsChecked = false;
74
- isChangingShippingMethod = false;
75
- isContactModalVisible = false;
76
- step: CheckoutStep = CheckoutStep.INFO;
77
- customizationProps?: IkasCheckoutCustomizationProps | null = null;
78
-
79
- cardData?: CreditCardData | null = null;
80
- paymentGateways: IkasPaymentGateway[] = [];
81
- installmentInfo?: RetrieveInstallmentInfoResponse | null = null;
82
- useDifferentAddress = false;
83
- shouldSaveAddress = true;
84
- addressTitle = "";
85
-
86
- shippingCountryIds?: string[] | null = null;
87
- selectedShippingAddressId?: string = "-1";
88
- selectedBillingAddressId?: string = "-1";
89
-
90
- stockLocations: IkasStockLocation[] = [];
91
- availableStockLocations: IkasAvailableStockLocation[] = [];
92
- deliveryMethod: "address" | "in-store" = "address";
93
-
94
- stripeResponse: CreateStripePaymentIntentResponse | null = null;
95
-
96
- checkoutCampaignOffer?: CampaignOfferType;
97
- postCheckoutCampaignOffer?: CampaignOfferType;
98
-
99
- returnPolicy: string;
100
- privacyPolicy: string;
101
- termsOfService: string;
102
-
103
- policyModalTitle = "";
104
- policyModalText = "";
105
-
106
- error?: CheckoutError | null = null;
107
-
108
- // For success step
109
- successTransaction?: IkasOrderTransaction;
110
-
111
- // For MasterPass Model
112
- mpVM: MasterPassModel;
113
- showTestModal = false;
114
-
115
- t: TFunction;
116
-
117
- constructor(
118
- checkout: IkasCheckout,
119
- checkoutSettings: IkasCheckoutSettings,
120
- router: NextRouter,
121
- returnPolicy: string,
122
- privacyPolicy: string,
123
- termsOfService: string,
124
- t: TFunction,
125
- customizationProps: IkasCheckoutCustomizationProps
126
- ) {
127
- this.checkout = checkout;
128
- this.checkoutSettings = checkoutSettings;
129
- this.router = router;
130
- this.returnPolicy = returnPolicy;
131
- this.privacyPolicy = privacyPolicy;
132
- this.termsOfService = termsOfService;
133
- this.t = t;
134
- this.customizationProps = customizationProps;
135
- this.mpVM = new MasterPassModel();
136
-
137
- this.isTermsAndConditionsChecked =
138
- this.checkoutSettings.isTermsAndConditionsDefaultChecked || false;
139
-
140
- this.init();
141
- makeAutoObservable(this);
142
- }
143
-
144
- init = async () => {
145
- await IkasBaseStore.getInstance().customerStore.waitUntilInitialized();
146
- this.createCustomer();
147
- this.createShippingAddress();
148
- this.createBillingAddress();
149
- await this.getCampaignOffer();
150
- await this.initStep();
151
- };
152
-
153
- initStep = async () => {
154
- if (IkasStorefrontConfig.getIsEditor()) {
155
- this.step = CheckoutStep.INFO;
156
- this.isCheckoutLoaded = true;
157
- return;
158
- }
159
- const queryParams = new URLSearchParams(window.location.search);
160
- const queryStep = queryParams.get("step");
161
- const queryFailed = queryParams.get("failed");
162
- const queryError = queryParams.get("error");
163
-
164
- if (queryStep) {
165
- this.step = queryStep as CheckoutStep;
166
-
167
- if (this.step === CheckoutStep.SHIPPING && !this.canProceedToShipping) {
168
- return this.changeStep(CheckoutStep.INFO);
169
- } else if (
170
- this.step === CheckoutStep.PAYMENT &&
171
- !this.canProceedToPayment
172
- ) {
173
- if (this.isInStoreDelivery) {
174
- this.deliveryMethod = "in-store";
175
- } else {
176
- return this.changeStep(CheckoutStep.INFO);
177
- }
178
- } else if (
179
- this.step === CheckoutStep.SUCCESS &&
180
- !this.canProceedToPayment
181
- ) {
182
- return this.changeStep(CheckoutStep.INFO);
183
- } else if (
184
- ![
185
- CheckoutStep.INFO,
186
- CheckoutStep.SUCCESS,
187
- CheckoutStep.SHIPPING,
188
- CheckoutStep.PAYMENT,
189
- ].includes(this.step)
190
- ) {
191
- return this.changeStep(CheckoutStep.INFO);
192
- }
193
- }
194
-
195
- if (queryFailed) {
196
- this.error = {
197
- type: ErrorType.PAYMENT_ERROR,
198
- data: queryError || null,
199
- };
200
- }
201
-
202
- if (this.step === CheckoutStep.INFO) {
203
- await this.getShippingCountries();
204
- this.checkShippingCountries();
205
- await this.getStockLocations();
206
- await this.getAvailableStockLocations();
207
- if (this.isInStoreDelivery) {
208
- this.deliveryMethod = "in-store";
209
- }
210
- }
211
-
212
- // Skip shipping if there is only 1 shipping method
213
- if (
214
- this.step === CheckoutStep.SHIPPING &&
215
- this.checkout.availableShippingMethods?.length === 1 &&
216
- !this.checkoutSettings.isGiftPackageEnabled
217
- ) {
218
- this.step = CheckoutStep.PAYMENT;
219
- this.router.replace(
220
- `/checkout?id=${this.checkout.id}&step=${this.step}`,
221
- undefined,
222
- {
223
- shallow: true,
224
- }
225
- );
226
- }
227
-
228
- // Check if there are available shipping methods for the shipping address
229
- if (
230
- this.step === CheckoutStep.SHIPPING &&
231
- !this.checkout.availableShippingMethods?.length
232
- ) {
233
- this.error = {
234
- type: ErrorType.NO_SHIPPING_ERROR,
235
- };
236
- this.isCheckoutLoaded = true;
237
- return;
238
- }
239
-
240
- if (
241
- this.step === CheckoutStep.PAYMENT ||
242
- this.step === CheckoutStep.SUCCESS
243
- ) {
244
- await this.listPaymentGateways();
245
- if (this.isInStoreDelivery) {
246
- this.deliveryMethod = "in-store";
247
- await this.getStockLocations();
248
- }
249
-
250
- if (!this.paymentGateways.length) {
251
- this.error = {
252
- type: ErrorType.NO_SHIPPING_ERROR,
253
- };
254
- this.isCheckoutLoaded = true;
255
- return;
256
- }
257
- }
258
-
259
- if (this.step !== CheckoutStep.SUCCESS) {
260
- if (this.checkout.isComplete) {
261
- return this.changeStep(CheckoutStep.SUCCESS);
262
- } else {
263
- await this.initialStockCheck();
264
- }
265
- } else {
266
- await this.getSuccessTransaction();
267
-
268
- if (this.successTransaction) {
269
- const paymentGatewayId = this.successTransaction.paymentGatewayId;
270
- this.checkout.selectedPaymentGateway = this.paymentGateways.find(
271
- (pg) => pg.id === paymentGatewayId
272
- );
273
- }
274
- }
275
-
276
- this.isCheckoutLoaded = true;
277
- Analytics.checkoutStep(this.checkout, this.step as any);
278
- };
279
-
280
- getSuccessTransaction = async () => {
281
- const transactionsResponse = await CustomerStoreAPI.listOrderTransactions({
282
- orderId: { eq: this.checkout.id },
283
- });
284
-
285
- this.successTransaction =
286
- transactionsResponse.isSuccess && transactionsResponse.data?.length
287
- ? transactionsResponse.data[0]
288
- : undefined;
289
- };
290
-
291
- get merchantSettings() {
292
- return new IkasMerchantSettings(
293
- IkasStorefrontConfig.getMerchantSettings()!
294
- );
295
- }
296
-
297
- get selectedPaymentGatewayIndex() {
298
- return this.paymentGateways.findIndex(
299
- (pg) => pg.id === this.checkout.selectedPaymentGateway?.id
300
- );
301
- }
302
-
303
- get selectedInstallmentIndex() {
304
- return (
305
- this.installmentInfo?.installmentPrices?.findIndex(
306
- (ip) => ip.installmentCount === this.cardData?.installmentCount
307
- ) || 0
308
- );
309
- }
310
-
311
- get checkoutUrl() {
312
- return `/checkout?id=${this.checkout.id}&step=info`;
313
- }
314
-
315
- get customerAddressOptions() {
316
- const defaultOption = {
317
- label: this.t("checkout-page:newAddress"),
318
- value: "-1",
319
- };
320
-
321
- const addressOptions =
322
- IkasBaseStore.getInstance().customerStore.customer?.addresses?.map(
323
- (a) => ({
324
- label: a.title + " - " + a.addressText,
325
- value: a.id!,
326
- })
327
- ) || [];
328
-
329
- return [defaultOption].concat(addressOptions);
330
- }
331
-
332
- get installmentPrice() {
333
- if (this.installmentInfo && this.cardData?.installmentCount) {
334
- return this.installmentInfo.installmentPrices?.find(
335
- (ip) => ip.installmentCount === this.cardData?.installmentCount
336
- )?.totalPrice;
337
- }
338
- }
339
-
340
- get installmentExtraPrice() {
341
- if (this.installmentPrice && this.checkout.totalFinalPrice) {
342
- return this.installmentPrice - this.checkout.totalFinalPrice;
343
- }
344
- }
345
-
346
- get finalPrice() {
347
- if (this.step === CheckoutStep.SUCCESS)
348
- return this.checkout.totalFinalPrice;
349
- return this.installmentPrice || this.checkout.$totalFinalPrice;
350
- }
351
-
352
- get hasStockError() {
353
- return this.error?.type === ErrorType.STOCK_ERROR;
354
- }
355
-
356
- // MasterPass PaymentGateway Control
357
- get isPaymentGatewayHasMasterPass() {
358
- if (this.selectedPaymentGatewayIndex === -1) return false;
359
- if (!this.paymentGateways.length) return false;
360
-
361
- return !!this.paymentGateways[this.selectedPaymentGatewayIndex]
362
- .masterPassClientId;
363
- }
364
-
365
- // VALIDATIONS
366
-
367
- get canProceedToShipping() {
368
- return (
369
- (this.isDigitalOnly
370
- ? this.checkout.billingAddress?.isValid
371
- : this.checkout.shippingAddress?.isValid) &&
372
- this.checkout.hasValidCustomerEmail &&
373
- this.error?.type !== ErrorType.NO_SHIPPING_ERROR
374
- );
375
- }
376
-
377
- get canProceedToInStoreDelivery() {
378
- return (
379
- !!this.checkout.shippingAddress?.firstName &&
380
- !!this.checkout.shippingAddress?.lastName &&
381
- !!this.checkout.customer?.email &&
382
- !!this.checkout.stockLocationId
383
- );
384
- }
385
-
386
- get canProceedToPayment() {
387
- return this.canProceedToShipping;
388
- }
389
-
390
- get isInStoreDelivery() {
391
- return !!this.checkout.stockLocationId;
392
- }
393
-
394
- get isCustomFlowStripe() {
395
- const pg = this.checkout.selectedPaymentGateway;
396
- return (
397
- pg &&
398
- pg.code === "STRIPE" &&
399
- pg.settings?.find(
400
- (setting) =>
401
- setting.label === "allow_custom_flow" && setting.value === "true"
402
- )
403
- );
404
- }
405
-
406
- get store() {
407
- return IkasBaseStore.getInstance();
408
- }
409
-
410
- get canPerformPayment() {
411
- if (
412
- this.checkoutSettings.showTermsAndConditionsCheckbox &&
413
- !this.isTermsAndConditionsChecked
414
- )
415
- return false;
416
-
417
- const pg = this.checkout.selectedPaymentGateway;
418
- const isInStoreDelivery = this.deliveryMethod === "in-store";
419
- const canProceedToShipping = isInStoreDelivery
420
- ? true
421
- : !!this.canProceedToShipping;
422
- const isBillingAddressValid = !!this.checkout.billingAddress?.isValid;
423
- const isPaymentGatewayValid = this.mpVM.selectedCard
424
- ? true
425
- : pg?.paymentMethodType === IkasPaymentMethodType.CREDIT_CARD &&
426
- pg.type === IkasPaymentGatewayType.INTERNAL
427
- ? this.isCustomFlowStripe
428
- ? true
429
- : this.cardData?.isValid
430
- : !!pg;
431
-
432
- return (
433
- canProceedToShipping && isBillingAddressValid && isPaymentGatewayValid
434
- );
435
- }
436
-
437
- get isDigitalOnly() {
438
- return (
439
- this.checkout.shippingMethod === IkasOrderShippingMethod.DIGITAL_DELIVERY
440
- );
441
- }
442
-
443
- // VALIDATIONS END
444
-
445
- saveCart = async () => {
446
- let input = new SaveCartInput(this.checkout as unknown as SaveCartInput);
447
-
448
- if (this.deliveryMethod === "in-store") {
449
- input = await this.inStockDeliveryInputData(input);
450
- }
451
-
452
- if (
453
- (this.step === CheckoutStep.INFO ||
454
- this.step === CheckoutStep.SHIPPING) &&
455
- !this.isDigitalOnly
456
- ) {
457
- input.billingAddress = null;
458
- }
459
-
460
- if (this.isDigitalOnly) {
461
- input.shippingAddress = null;
462
- }
463
-
464
- const response = await CartStoreAPI.saveCart({ input });
465
-
466
- if (response?.graphQLErrors && response.graphQLErrors.length) {
467
- const firstError = response.graphQLErrors[0];
468
-
469
- if (firstError.extensions?.code === "CUSTOMER_LOGIN_REQUIRED") {
470
- throw {
471
- type: ErrorType.CUSTOMER_LOGIN_REQUIRED_ERROR,
472
- };
473
- } else {
474
- throw {
475
- type: ErrorType.API_ERROR,
476
- data: response.firstErrorMessage,
477
- };
478
- }
479
- }
480
-
481
- return response.data;
482
- };
483
-
484
- inStockDeliveryInputData = async (input: SaveCartInput) => {
485
- const inputData = input;
486
-
487
- const inStoreLocation = this.stockLocations.find(
488
- (location) => location.id === this.checkout.stockLocationId
489
- );
490
-
491
- if (
492
- inStoreLocation &&
493
- inputData.shippingAddress &&
494
- inStoreLocation.address
495
- ) {
496
- inputData.shippingAddress.country = inStoreLocation.address
497
- .country as any;
498
- inputData.shippingAddress.city = inStoreLocation.address.city as any;
499
- inputData.shippingAddress.state = inStoreLocation.address.state as any;
500
- inputData.shippingAddress.district = inStoreLocation.address
501
- .district as any;
502
- inputData.shippingAddress.postalCode = inStoreLocation.address.postalCode;
503
- inputData.shippingAddress.addressLine1 =
504
- inStoreLocation.address.address || "";
505
- inputData.shippingAddress.addressLine2 = null;
506
- }
507
-
508
- return inputData;
509
- };
510
-
511
- checkStocks = async () => {
512
- const lines = this.checkout.items.map((i) => ({
513
- quantity: i.quantity,
514
- variantId: i.variant.id,
515
- productId: i.variant.productId,
516
- }));
517
-
518
- const checkStocksResponse = await CheckoutStore.checkStocks({
519
- lines: lines.map(
520
- (l) => new CheckStocksLineInput(l as CheckStocksLineInput)
521
- ),
522
- stockLocationIdList: IkasStorefrontConfig.getStockLocationIds()?.length
523
- ? IkasStorefrontConfig.getStockLocationIds()
524
- : null,
525
- //stockLocationIdList: IkasStorefrontConfig.pickUpStockLocationIds || [], // REMOVE ME
526
- });
527
-
528
- if (!checkStocksResponse.isSuccess) {
529
- throw {
530
- type: ErrorType.API_ERROR,
531
- data: checkStocksResponse.firstErrorMessage,
532
- };
533
- }
534
-
535
- const unavailableItems = checkStocksResponse.data?.lines?.filter(
536
- (i) => !i.isAvailable
537
- );
538
-
539
- if (unavailableItems?.length) {
540
- const _unavailableItems: IkasOrderLineItem[] = [];
541
-
542
- for (const item of unavailableItems) {
543
- const cartItem = IkasBaseStore.getInstance().cartStore.cart?.items.find(
544
- (i) => i.variant.id === item.variantId
545
- );
546
- if (cartItem) _unavailableItems.push(cartItem);
547
- }
548
-
549
- throw {
550
- type: ErrorType.STOCK_ERROR,
551
- data: _unavailableItems,
552
- };
553
- }
554
- };
555
-
556
- removeUnavailableItems = async (items: IkasOrderLineItem[]) => {
557
- for (const item of items) {
558
- await IkasBaseStore.getInstance().cartStore.removeItem(item);
559
- }
560
- };
561
-
562
- getShippingCountries = async () => {
563
- const response = await CheckoutStore.getAvailableShippingCountries({
564
- salesChannelId: IkasStorefrontConfig.getSalesChannelId(),
565
- });
566
- this.shippingCountryIds = response.data;
567
- };
568
-
569
- getStockLocations = async () => {
570
- if (IkasStorefrontConfig.getPickupStockLocationIds()) {
571
- const response = await CheckoutStore.listStockLocation({
572
- id: { in: IkasStorefrontConfig.getPickupStockLocationIds() },
573
- });
574
- if (!response.isSuccess || !response.data?.length) {
575
- this.error = {
576
- type: ErrorType.API_ERROR,
577
- data: response.firstErrorMessage,
578
- };
579
- return;
580
- }
581
-
582
- this.stockLocations = response.data;
583
- }
584
- };
585
-
586
- getAvailableStockLocations = async () => {
587
- if (IkasStorefrontConfig.getPickupStockLocationIds()) {
588
- const lines = this.checkout.items.map((i) => ({
589
- quantity: i.quantity,
590
- variantId: i.variant.id,
591
- productId: i.variant.productId,
592
- }));
593
-
594
- const response = await CheckoutStore.getAvailableStockLocations({
595
- lines: lines.map(
596
- (l) => new CheckStocksLineInput(l as CheckStocksLineInput)
597
- ),
598
- stockLocationIdList: IkasStorefrontConfig.getPickupStockLocationIds(),
599
- });
600
- if (!response.isSuccess) {
601
- this.error = {
602
- type: ErrorType.API_ERROR,
603
- };
604
- return;
605
- }
606
-
607
- this.availableStockLocations = response.data || [];
608
- }
609
- };
610
-
611
- checkShippingCountries = () => {
612
- if (!this.shippingCountryIds?.length) {
613
- this.error = {
614
- type: ErrorType.NO_SHIPPING_ERROR,
615
- };
616
- }
617
- };
618
-
619
- onDeliveryMethodChange = (deliveryMethod: "address" | "in-store") => {
620
- if (deliveryMethod === "address") {
621
- this.checkout.stockLocationId = null;
622
- }
623
- this.deliveryMethod = deliveryMethod;
624
- this.isErrorsVisible = false;
625
- };
626
-
627
- initialStockCheck = async () => {
628
- try {
629
- await this.checkStocks();
630
- } catch (err) {
631
- if (typeof err.type !== undefined) {
632
- this.error = err;
633
- } else {
634
- console.log(err);
635
- this.error = {
636
- type: ErrorType.UNKNOWN,
637
- };
638
- }
639
- }
640
- };
641
-
642
- listPaymentGateways = async () => {
643
- const isLocal = process.env.NEXT_PUBLIC_ENV === "local";
644
- const idList = IkasStorefrontConfig.getPaymentGateways().map((pg) => pg.id);
645
- const paymentGatewaysResponse = await CheckoutStore.listPaymentGateway({
646
- id: isLocal ? undefined : { in: idList },
647
- });
648
-
649
- if (
650
- !paymentGatewaysResponse.isSuccess ||
651
- !paymentGatewaysResponse.data?.length
652
- ) {
653
- this.error = {
654
- type: ErrorType.API_ERROR,
655
- data: paymentGatewaysResponse.firstErrorMessage,
656
- };
657
- return;
658
- }
659
-
660
- let paymentGateways = paymentGatewaysResponse.data;
661
-
662
- if (this.step === CheckoutStep.PAYMENT) {
663
- paymentGateways = paymentGateways.filter((pg) =>
664
- pg.supportedCurrencies?.length
665
- ? pg.supportedCurrencies.includes(this.checkout.currencyCode)
666
- : true
667
- );
668
-
669
- const shippingCountry = this.checkout.shippingAddress?.country;
670
- if (shippingCountry && shippingCountry.iso2) {
671
- paymentGateways = paymentGateways.filter((pg) =>
672
- pg.availableCountries?.length
673
- ? pg.availableCountries.includes(shippingCountry.iso2 || "")
674
- : true
675
- );
676
- }
677
- }
678
-
679
- const orderedPaymentGateways: IkasPaymentGateway[] = [];
680
-
681
- _sortBy(IkasStorefrontConfig.getPaymentGateways(), "order").forEach(
682
- (pg) => {
683
- const _pg = paymentGateways?.find((p) => p.id === pg.id);
684
- if (_pg) orderedPaymentGateways.push(_pg);
685
- }
686
- );
687
-
688
- this.paymentGateways = isLocal ? paymentGateways : orderedPaymentGateways;
689
- if (!this.checkout.selectedPaymentGateway) this.setPaymentGateway(0);
690
-
691
- if (this.step === CheckoutStep.PAYMENT) {
692
- const masterPassPG = paymentGateways.find(
693
- (pG) => !!pG.masterPassClientId
694
- );
695
- if (masterPassPG) {
696
- this.checkout.masterPassPaymentGateway = masterPassPG;
697
- this.mpVM.checkMasterPass({
698
- checkout: this.checkout,
699
- store: IkasBaseStore.getInstance(),
700
- });
701
- }
702
- }
703
- };
704
-
705
- retrieveInstallmentInfo = async (
706
- params: RetrieveInstallmentInfoQueryParams
707
- ) => {
708
- const installmentInfoResponse = await CheckoutStore.retrieveInstallmentInfo(
709
- params
710
- );
711
-
712
- const installmentInfo = installmentInfoResponse.data;
713
-
714
- installmentInfo?.installmentPrices?.sort((a, b) =>
715
- (a.installmentCount || -1) > (b.installmentCount || -1) ? 1 : -1
716
- );
717
- this.installmentInfo = installmentInfo;
718
- };
719
-
720
- createCustomer = () => {
721
- if (this.store.customerStore.customer) {
722
- this.store.customerStore.customer.addresses?.forEach(
723
- (address) => (address.checkoutSettings = this.checkoutSettings)
724
- );
725
- this.checkout.customer = new IkasOrderCustomer(
726
- this.store.customerStore.customer as any
727
- );
728
- } else {
729
- this.checkout.customer = new IkasOrderCustomer(
730
- this.checkout.customer || {}
731
- );
732
- }
733
- };
734
-
735
- createShippingAddress = () => {
736
- if (this.isDigitalOnly) return;
737
-
738
- if (!this.checkout.shippingAddress) {
739
- if (!!this.store.customerStore.customer) {
740
- const customerAddresses = this.store.customerStore.customer.addresses;
741
- this.onSelectedShippingAddressIdChange(
742
- customerAddresses?.length ? customerAddresses[0].id! : "-1"
743
- );
744
- } else {
745
- this.onSelectedShippingAddressIdChange("-1");
746
- }
747
- } else {
748
- this.checkout.shippingAddress = new IkasOrderAddress(
749
- _cloneDeep(this.checkout.shippingAddress) || {}
750
- );
751
- this.checkout.shippingAddress.checkoutSettings = this.checkoutSettings;
752
- }
753
- };
754
-
755
- createBillingAddress = () => {
756
- if (typeof localStorage !== "undefined") {
757
- this.useDifferentAddress = !!localStorage.getItem(
758
- USE_DIFFERENT_ADDRESS_KEY
759
- );
760
-
761
- if (!this.checkout.billingAddress) {
762
- if (!!this.store.customerStore.customer) {
763
- const customerAddresses = this.store.customerStore.customer.addresses;
764
- this.onSelectedBillingAddressIdChange(
765
- customerAddresses?.length ? customerAddresses[0].id! : "-1"
766
- );
767
- } else {
768
- this.onSelectedBillingAddressIdChange("-1");
769
- }
770
- } else {
771
- this.checkout.billingAddress = new IkasOrderAddress(
772
- _cloneDeep(this.checkout.billingAddress) || {}
773
- );
774
- this.checkout.billingAddress.checkoutSettings = this.checkoutSettings;
775
- }
776
- }
777
- };
778
-
779
- onShippingMethodChange = async (
780
- shippingMethod: IkasAvailableShippingMethod
781
- ) => {
782
- if (this.isChangingShippingMethod) return;
783
-
784
- this.isChangingShippingMethod = true;
785
- this.checkout.shippingSettingsId = shippingMethod.shippingSettingsId;
786
- this.checkout.shippingZoneRateId = shippingMethod.shippingZoneRateId;
787
- const newCart = await this.saveCart();
788
-
789
- if (newCart) this.checkout = new IkasCheckout(newCart);
790
- if (this.checkout.shippingAddress)
791
- this.checkout.shippingAddress.checkoutSettings = this.checkoutSettings;
792
- this.isChangingShippingMethod = false;
793
- };
794
-
795
- onStockLocationChange = async (location: IkasStockLocation) => {
796
- this.checkout.stockLocationId = location.id;
797
- };
798
-
799
- onCouponCodeApply = async () => {
800
- try {
801
- const saveCouponCodeResponse = await CartStoreAPI.saveCartCouponCode({
802
- cartId: this.checkout.id!,
803
- couponCode: this.checkout.couponCode || null,
804
- });
805
-
806
- if (saveCouponCodeResponse.isSuccess && saveCouponCodeResponse.data) {
807
- const newCart = saveCouponCodeResponse.data;
808
- const cardNumber = this.cardData?.cardNumber?.split(" ").join("");
809
-
810
- if (
811
- this.step === CheckoutStep.PAYMENT &&
812
- cardNumber?.length &&
813
- cardNumber.length >= 6
814
- ) {
815
- this.retrieveInstallmentInfo({
816
- input: {
817
- binNumber: cardNumber.slice(0, 6),
818
- paymentGatewayId: this.checkout.selectedPaymentGateway!.id!,
819
- price: newCart.totalFinalPrice!,
820
- },
821
- });
822
- }
823
-
824
- if (newCart) {
825
- const oldCheckout = this.checkout;
826
-
827
- this.checkout = new IkasCheckout({
828
- ...newCart,
829
- shippingAddress: oldCheckout.shippingAddress,
830
- billingAddress: oldCheckout.billingAddress,
831
- customer: oldCheckout.customer,
832
- selectedPaymentGateway: oldCheckout.selectedPaymentGateway,
833
- });
834
- }
835
- }
836
- } catch (err) {}
837
- };
838
-
839
- onSelectedShippingAddressIdChange = (value: string) => {
840
- this.selectedShippingAddressId = value;
841
- if (value === "-1") {
842
- this.checkout.shippingAddress = new IkasOrderAddress();
843
- } else {
844
- const address = this.store.customerStore.customer?.addresses?.find(
845
- (a) => a.id === value
846
- );
847
- if (address)
848
- this.checkout.shippingAddress = new IkasOrderAddress(address as any);
849
- }
850
-
851
- if (this.checkout.shippingAddress)
852
- this.checkout.shippingAddress.checkoutSettings = this.checkoutSettings;
853
- };
854
-
855
- onSelectedBillingAddressIdChange = (value: string) => {
856
- this.selectedBillingAddressId = value;
857
- if (value === "-1") {
858
- this.checkout.billingAddress = new IkasOrderAddress();
859
- } else {
860
- const address = this.store.customerStore.customer?.addresses?.find(
861
- (a) => a.id === value
862
- );
863
- if (address)
864
- this.checkout.billingAddress = new IkasOrderAddress(address as any);
865
- }
866
-
867
- if (this.checkout.billingAddress)
868
- this.checkout.billingAddress.checkoutSettings = this.checkoutSettings;
869
- };
870
-
871
- onTermsAndConditionsCheckedChange = (value: boolean) => {
872
- this.isTermsAndConditionsChecked = value;
873
- };
874
-
875
- // CREDIT CARD START
876
-
877
- onCardNumberChange = (value: string) => {
878
- if (!this.cardData) return;
879
- if (
880
- value.length > this.cardData.cardNumber!.length &&
881
- !isLastCharNumber(value)
882
- )
883
- return;
884
-
885
- const oldOriginalValue = (this.cardData.cardNumber || "")
886
- .split(" ")
887
- .join("");
888
- const originalValue = value.split(" ").join("");
889
-
890
- if (originalValue.length > MAX_CARD_NUMBER_LENGTH) return;
891
- if (
892
- oldOriginalValue.length < 6 &&
893
- originalValue.length >= 6 &&
894
- !this.installmentInfo
895
- ) {
896
- this.retrieveInstallmentInfo({
897
- input: {
898
- binNumber: originalValue.slice(0, 6),
899
- paymentGatewayId: this.checkout.selectedPaymentGateway!.id!,
900
- price: this.checkout.totalFinalPrice!,
901
- },
902
- });
903
- }
904
- // Deleting characters below 6
905
- else if (
906
- originalValue.length < 6 &&
907
- oldOriginalValue.length > originalValue.length
908
- ) {
909
- this.cardData.installmentCount = 1;
910
- this.installmentInfo = undefined;
911
- }
912
-
913
- this.cardData.cardNumber = chunkString(originalValue, 4).join(" ");
914
- };
915
-
916
- onCardHolderNameChange = (value: string) => {
917
- if (!this.cardData) return;
918
- this.cardData.cardHolderName = value;
919
- };
920
-
921
- onExpirationDateChange = (value: string) => {
922
- if (!this.cardData) return;
923
- if (
924
- value.length > this.cardData.expirationDate!.length &&
925
- !isLastCharNumber(value)
926
- ) {
927
- return;
928
- }
929
-
930
- // Check autocomplete
931
- if (this.cardData.expirationDate?.length === 0) {
932
- const splitValues = value.split("/");
933
-
934
- if (splitValues.length === 2) {
935
- const firstPart = splitValues[0].trim();
936
- const lastPart = splitValues[1].trim();
937
-
938
- // YYYY-MM format
939
- if (firstPart.length === 4 && lastPart.length === 2) {
940
- const year = parseInt(firstPart.slice(2));
941
- const month = parseInt(lastPart);
942
-
943
- if (!isNaN(year) && !isNaN(month)) {
944
- this.cardData.expirationDate = `${
945
- month < 10 ? "0" + month : month
946
- } / ${year < 10 ? "0" + year : year}`;
947
- return;
948
- }
949
- }
950
-
951
- // MM-YYYY format
952
- if (firstPart.length === 2 && lastPart.length === 4) {
953
- const month = parseInt(firstPart);
954
- const year = parseInt(lastPart.slice(2));
955
-
956
- if (!isNaN(year) && !isNaN(month)) {
957
- this.cardData.expirationDate = `${
958
- month < 10 ? "0" + month : month
959
- } / ${year < 10 ? "0" + year : year}`;
960
- return;
961
- }
962
- }
963
- }
964
-
965
- // const autoCompleteValue = value.split("/").join("");
966
- // if (
967
- // autoCompleteValue.length === 4 &&
968
- // !isNaN(parseInt(autoCompleteValue))
969
- // ) {
970
- // this.cardData.expirationDate = chunkString(autoCompleteValue, 2).join(
971
- // " / "
972
- // );
973
- // return;
974
- // }
975
- }
976
-
977
- const originalValue = value.split(" / ").join("");
978
- if (originalValue.length > 4) return;
979
-
980
- this.cardData.expirationDate = chunkString(originalValue, 2).join(" / ");
981
- };
982
-
983
- onCvcChange = (value: string) => {
984
- if (!this.cardData) return;
985
- if (value.length > this.cardData.cvv!.length && !isLastCharNumber(value))
986
- return;
987
- if (value.length > MAX_CVC_LENGTH) return;
988
- this.cardData.cvv = value;
989
- };
990
-
991
- // CREDIT CARD END
992
-
993
- saveAddress = async (type: "billing" | "shipping") => {
994
- try {
995
- if (this.shouldSaveAddress && this.store.customerStore.customer) {
996
- const address =
997
- type === "shipping"
998
- ? this.checkout.shippingAddress
999
- : this.checkout.billingAddress;
1000
-
1001
- const existingAddress =
1002
- this.store.customerStore.customer.addresses?.find(
1003
- (a) => a.id === address?.id
1004
- );
1005
- if (existingAddress) return;
1006
-
1007
- const newAddress = new IkasCustomerAddress({
1008
- ...address,
1009
- title: this.addressTitle || this.t("checkout-page:newAddress"),
1010
- } as any);
1011
- const customer = _cloneDeep(this.store.customerStore.customer);
1012
- if (!customer.addresses) customer.addresses = [];
1013
- customer.addresses.push(newAddress);
1014
-
1015
- await this.store.customerStore.saveCustomer(customer);
1016
- this.store.customerStore.customer.addresses?.forEach(
1017
- (address) => (address.checkoutSettings = this.checkoutSettings)
1018
- );
1019
-
1020
- if (type === "shipping") {
1021
- this.checkout.shippingAddress!.id = newAddress.id;
1022
- this.selectedShippingAddressId = newAddress.id || "-1";
1023
- } else {
1024
- this.checkout.billingAddress!.id = newAddress.id;
1025
- this.selectedBillingAddressId = newAddress.id || "-1";
1026
- }
1027
- }
1028
- } catch (err) {
1029
- console.error(err);
1030
- }
1031
- };
1032
-
1033
- onGoToCartClick = () => {
1034
- this.router.push("/cart");
1035
- };
1036
-
1037
- onBackToShoppingClick = () => {
1038
- this.router.push("/");
1039
- };
1040
-
1041
- onProceedToShippingClick = async () => {
1042
- if (this.deliveryMethod === "address") {
1043
- if (!this.canProceedToShipping) {
1044
- this.isErrorsVisible = true;
1045
- return;
1046
- }
1047
- } else {
1048
- if (!this.canProceedToInStoreDelivery) {
1049
- this.isErrorsVisible = true;
1050
- return;
1051
- }
1052
- }
1053
-
1054
- this.isErrorsVisible = false;
1055
-
1056
- try {
1057
- this.isStepLoading = true;
1058
-
1059
- if (this.deliveryMethod === "address") {
1060
- await this.saveAddress("shipping");
1061
- }
1062
-
1063
- await this.checkStocks();
1064
- await this.saveCart();
1065
-
1066
- if (this.deliveryMethod === "address") {
1067
- this.changeStep(CheckoutStep.SHIPPING);
1068
- } else {
1069
- this.changeStep(CheckoutStep.PAYMENT);
1070
- }
1071
- } catch (err) {
1072
- if (typeof err.type !== undefined) {
1073
- this.error = err;
1074
- } else {
1075
- console.log(err);
1076
- this.error = {
1077
- type: ErrorType.UNKNOWN,
1078
- };
1079
- }
1080
- this.isStepLoading = false;
1081
- }
1082
- };
1083
-
1084
- onProceedToDigitalOnlyPaymentClick = async () => {
1085
- if (!this.canProceedToPayment) {
1086
- this.isErrorsVisible = true;
1087
- return;
1088
- }
1089
-
1090
- this.isErrorsVisible = false;
1091
-
1092
- try {
1093
- this.isStepLoading = true;
1094
-
1095
- await this.checkStocks();
1096
- await this.saveCart();
1097
-
1098
- this.changeStep(CheckoutStep.PAYMENT);
1099
- } catch (err) {
1100
- if (err.type) {
1101
- this.error = err;
1102
- } else {
1103
- console.log(err);
1104
- this.error = {
1105
- type: ErrorType.UNKNOWN,
1106
- };
1107
- }
1108
- this.isStepLoading = false;
1109
- }
1110
- };
1111
-
1112
- onProceedToPaymentClick = async () => {
1113
- if (!this.canProceedToPayment) {
1114
- this.isErrorsVisible = true;
1115
- return;
1116
- }
1117
- this.isErrorsVisible = false;
1118
-
1119
- try {
1120
- this.isStepLoading = true;
1121
- await this.checkStocks();
1122
- await this.saveCart();
1123
-
1124
- this.error = undefined;
1125
- this.changeStep(CheckoutStep.PAYMENT);
1126
- } catch (err) {
1127
- if (typeof err.type !== undefined) {
1128
- this.error = err;
1129
- } else {
1130
- console.log(err);
1131
- this.error = {
1132
- type: ErrorType.UNKNOWN,
1133
- };
1134
- }
1135
- this.isStepLoading = false;
1136
- }
1137
- };
1138
-
1139
- onCompletePaymentClick = async () => {
1140
- if (!this.canPerformPayment) {
1141
- this.isErrorsVisible = true;
1142
- return;
1143
- }
1144
-
1145
- if (!this.useDifferentAddress) {
1146
- this.checkout.billingAddress = this.checkout.shippingAddress;
1147
- }
1148
-
1149
- try {
1150
- this.isErrorsVisible = false;
1151
- this.isStepLoading = true;
1152
-
1153
- await this.checkStocks();
1154
- if (this.deliveryMethod === "address") {
1155
- await this.saveAddress("billing");
1156
- }
1157
- await this.saveCart();
1158
-
1159
- if (this.isCustomFlowStripe) {
1160
- const stripeFromBtn = document.querySelector("#stripe-form-btn");
1161
- if (stripeFromBtn) {
1162
- //@ts-ignore
1163
- stripeFromBtn.click();
1164
- }
1165
-
1166
- return;
1167
- }
1168
-
1169
- await this.createSaleTransaction();
1170
- } catch (err) {
1171
- if (typeof err.type !== undefined) {
1172
- this.error = err;
1173
- } else {
1174
- this.error = {
1175
- type: ErrorType.UNKNOWN,
1176
- };
1177
- }
1178
- this.isStepLoading = false;
1179
- }
1180
- };
1181
-
1182
- onCompleteDigitalOnlyPaymentClick = async () => {
1183
- if (
1184
- !this.canProceedToPayment ||
1185
- (this.checkoutSettings.showTermsAndConditionsCheckbox &&
1186
- !this.isTermsAndConditionsChecked)
1187
- ) {
1188
- this.isErrorsVisible = true;
1189
- return;
1190
- }
1191
-
1192
- try {
1193
- this.isErrorsVisible = false;
1194
- this.isStepLoading = true;
1195
-
1196
- await this.checkStocks();
1197
- await this.saveCart();
1198
-
1199
- if (this.isCustomFlowStripe) {
1200
- const stripeFromBtn = document.querySelector("#stripe-form-btn");
1201
- if (stripeFromBtn) {
1202
- //@ts-ignore
1203
- stripeFromBtn.click();
1204
- }
1205
-
1206
- return;
1207
- }
1208
-
1209
- await this.createSaleTransaction();
1210
- } catch (err) {
1211
- if (err.type) {
1212
- this.error = err;
1213
- } else {
1214
- this.error = {
1215
- type: ErrorType.UNKNOWN,
1216
- };
1217
- }
1218
- this.isStepLoading = false;
1219
- }
1220
- };
1221
-
1222
- createSaleTransaction = async () => {
1223
- let phoneNumber;
1224
- const isMasterPass = this.mpVM.selectedCard;
1225
-
1226
- let response: APIResponse<TransactionResponse> | APIResponse<undefined>;
1227
- if (isMasterPass && this.mpVM.selectedCard?.Name) {
1228
- const _phoneNumber = this.mpVM.phoneNumber({
1229
- store: this.store,
1230
- checkout: this.checkout,
1231
- });
1232
- if (_phoneNumber) phoneNumber = _phoneNumber;
1233
- if (typeof this.cardData?.installmentCount === "undefined") return;
1234
- response = await CheckoutStore.createSaleTransactionWithCart({
1235
- input: {
1236
- cartId: this.checkout.id!,
1237
- masterPassDetail: {
1238
- phoneNumber,
1239
- savedCardName: this.mpVM.selectedCard?.Name,
1240
- },
1241
- paymentGatewayId: this.mpVM.selectedCard?.paymentGatewayId,
1242
- paymentMethodDetail: {
1243
- cardNumber: this.mpVM.selectedCard.Value1,
1244
- cardHolderName: this.mpVM.selectedCard.Name!,
1245
- cvv: this.mpVM.selectedCard.Value2,
1246
- expiredMonth: 11,
1247
- expiredYear: 11,
1248
- installmentCount: this.cardData.installmentCount,
1249
- threeDSecure: !!this.cardData?.threeDSecure,
1250
- },
1251
- },
1252
- });
1253
- } else {
1254
- if (!this.checkout.selectedPaymentGateway) return;
1255
- response = await CheckoutStore.createSaleTransactionWithCart({
1256
- input: {
1257
- cartId: this.checkout.id!,
1258
- masterPassDetail:
1259
- isMasterPass && phoneNumber
1260
- ? { phoneNumber, savedCardName: this.mpVM.selectedCard?.Name }
1261
- : undefined,
1262
- paymentGatewayId: this.checkout.selectedPaymentGateway.id!,
1263
- paymentMethodDetail: isMasterPass
1264
- ? undefined
1265
- : this.checkout.selectedPaymentGateway.paymentMethodType ===
1266
- IkasPaymentMethodType.CREDIT_CARD &&
1267
- this.checkout.selectedPaymentGateway.type ===
1268
- IkasPaymentGatewayType.INTERNAL &&
1269
- this.cardData
1270
- ? this.cardData.toInput()
1271
- : undefined,
1272
- },
1273
- });
1274
- }
1275
-
1276
- const transactionStatus = response?.data?.transactionStatus as unknown as
1277
- | IkasTransactionStatus
1278
- | undefined;
1279
-
1280
- const transactionSuccess =
1281
- transactionStatus &&
1282
- [
1283
- IkasTransactionStatus.SUCCESS,
1284
- IkasTransactionStatus.AUTHORIZED,
1285
- ].includes(transactionStatus);
1286
-
1287
- const transactionPending =
1288
- transactionStatus === IkasTransactionStatus.PENDING;
1289
-
1290
- if (transactionSuccess) {
1291
- await this.getSuccessTransaction();
1292
- await this.onCheckoutTransactionSuccess();
1293
- } else if (transactionPending && !!response?.data?.returnSlug) {
1294
- window.location.href =
1295
- process.env.NEXT_PUBLIC_BASE_URL + response.data.returnSlug;
1296
- } else {
1297
- throw {
1298
- data: response.firstErrorMessage,
1299
- type: ErrorType.UNKNOWN,
1300
- };
1301
- }
1302
- };
1303
-
1304
- onCheckoutTransactionSuccess = async () => {
1305
- localStorage.removeItem(USE_DIFFERENT_ADDRESS_KEY);
1306
-
1307
- if (this.checkout.customer?.notificationsAccepted) {
1308
- await this.store.customerStore.createEmailSubscription(
1309
- this.checkout.customer?.email || ""
1310
- );
1311
- }
1312
-
1313
- this.changeStep(CheckoutStep.SUCCESS);
1314
- };
1315
-
1316
- onBackToInfoClick = () => {
1317
- this.changeStep(CheckoutStep.INFO);
1318
- };
1319
-
1320
- onBackToShippingClick = () => {
1321
- this.changeStep(CheckoutStep.SHIPPING);
1322
- };
1323
-
1324
- setCustomerConsentGranted = (value: boolean) => {
1325
- if (this.checkout.customer)
1326
- this.checkout.customer.notificationsAccepted = value;
1327
- };
1328
-
1329
- setUseDifferentAddress = (value: boolean) => {
1330
- this.useDifferentAddress = value;
1331
- if (this.useDifferentAddress) {
1332
- localStorage.setItem(USE_DIFFERENT_ADDRESS_KEY, "1");
1333
- this.checkout.billingAddress =
1334
- this.checkout.billingAddress || new IkasOrderAddress();
1335
- } else {
1336
- localStorage.removeItem(USE_DIFFERENT_ADDRESS_KEY);
1337
- this.checkout.billingAddress = this.checkout.shippingAddress;
1338
- }
1339
- };
1340
-
1341
- setShouldSaveAddress = (value: boolean) => {
1342
- this.shouldSaveAddress = value;
1343
- };
1344
-
1345
- setAddressTitle = (value: string) => {
1346
- this.addressTitle = value;
1347
- };
1348
-
1349
- setPaymentGateway = async (index: number) => {
1350
- if (!this.paymentGateways.length) return;
1351
-
1352
- const paymentGateway = this.paymentGateways[index];
1353
-
1354
- if (
1355
- paymentGateway.code === "STRIPE" &&
1356
- paymentGateway.settings?.find(
1357
- (setting) =>
1358
- setting.label === "allow_custom_flow" && setting.value === "true"
1359
- ) &&
1360
- !this.stripeResponse
1361
- ) {
1362
- const response = await CheckoutStore.createStripePaymentIntent({
1363
- input: {
1364
- cartId: this.checkout.id,
1365
- paymentGatewayId: paymentGateway.id || "",
1366
- },
1367
- });
1368
- if (response.isSuccess && response.data) {
1369
- this.stripeResponse = response.data;
1370
- }
1371
- }
1372
-
1373
- this.checkout.selectedPaymentGateway = paymentGateway;
1374
-
1375
- if (this.step !== CheckoutStep.SUCCESS) {
1376
- if (
1377
- paymentGateway.paymentMethodType ===
1378
- IkasPaymentMethodType.CREDIT_CARD &&
1379
- paymentGateway.type === IkasPaymentGatewayType.INTERNAL
1380
- ) {
1381
- this.cardData = new CreditCardData();
1382
- // const masterpass = paymentGateway.masterPassClientId;
1383
- // if (masterpass) {
1384
- // this.mpVM.checkMasterPass({
1385
- // checkout: this.checkout,
1386
- // store: this.store,
1387
- // });
1388
- // }
1389
- }
1390
-
1391
- this.installmentInfo = undefined;
1392
- }
1393
- };
1394
-
1395
- setInstallmentCount = (count: number) => {
1396
- if (!this.cardData) return;
1397
- this.cardData.installmentCount = count;
1398
- };
1399
-
1400
- changeStep = async (step: CheckoutStep) => {
1401
- if (!isServer) {
1402
- window.location.replace(
1403
- `${window.location.pathname}?id=${this.checkout.id}&step=${step}`
1404
- );
1405
- }
1406
- };
1407
-
1408
- logout = async () => {
1409
- this.checkout.customer = null;
1410
- this.store.customerStore.logout();
1411
- try {
1412
- await this.saveCart();
1413
- } catch (err) {}
1414
- this.createCustomer();
1415
- };
1416
-
1417
- setContactModalVisible = (value: boolean) => {
1418
- this.isContactModalVisible = value;
1419
- };
1420
-
1421
- getWaitingForActionCampaignOffers = (
1422
- targetPage: IkasCampaignOfferTargetPageType
1423
- ) => {
1424
- if (!this.checkout.campaignOffers || !this.checkout.campaignOffers.length)
1425
- return;
1426
-
1427
- const filteredCampaignOffers = this.checkout.campaignOffers.filter(
1428
- (co) =>
1429
- co.status === IkasCartCampaignOfferStatus.WAITING_FOR_ACTION &&
1430
- co.campaignOffer?.targetPageTypes.some((tpt) => tpt === targetPage)
1431
- );
1432
- return filteredCampaignOffers;
1433
- };
1434
-
1435
- getOffer = (waitingForActionCampaignOffer: IkasCartCampaignOffer) => {
1436
- if (!waitingForActionCampaignOffer.campaignOffer) return null;
1437
- return waitingForActionCampaignOffer.campaignOffer.offers.find(
1438
- (o) => o.id === waitingForActionCampaignOffer.campaignOfferProductId
1439
- );
1440
- };
1441
-
1442
- getProduct = async (productId: string) => {
1443
- const productsResponse = await ProductStoreAPI.searchProducts({
1444
- input: {
1445
- productIdList: [productId],
1446
- },
1447
- });
1448
-
1449
- if (!productsResponse.isSuccess || !productsResponse?.data?.data?.length)
1450
- return null;
1451
-
1452
- const product = productsResponse.data.data[0];
1453
- const selectedVariant = product.variants.find((v) => v.isActive);
1454
- const productDetail = new IkasProduct({
1455
- ...product,
1456
- selectedVariantValues: (selectedVariant || product.variants[0])
1457
- .variantValues,
1458
- });
1459
-
1460
- return productDetail;
1461
- };
1462
-
1463
- getOfferProductVariants = ({
1464
- offer,
1465
- product,
1466
- }: {
1467
- offer: IkasCampaignOfferProduct;
1468
- product: IkasProduct;
1469
- }) => {
1470
- const variants: IkasProductVariant[] = [];
1471
-
1472
- if (offer.excludedVariantIdList?.length) {
1473
- product.variants.forEach((v) => {
1474
- const isVariantExcluded = offer!.excludedVariantIdList?.some(
1475
- (ev) => ev === v.id
1476
- );
1477
- if (!v.hasStock || isVariantExcluded) return;
1478
-
1479
- variants.push(v);
1480
- });
1481
- } else {
1482
- variants.push(...product.variants.filter((v) => v.hasStock));
1483
- }
1484
-
1485
- return variants;
1486
- };
1487
-
1488
- getCampaignOfferProducts = async (
1489
- targetPage: IkasCampaignOfferTargetPageType
1490
- ): Promise<CampaignOfferType | undefined> => {
1491
- const waitingForActionCampaignOffers =
1492
- this.getWaitingForActionCampaignOffers(targetPage);
1493
-
1494
- if (
1495
- !waitingForActionCampaignOffers ||
1496
- !waitingForActionCampaignOffers.length
1497
- )
1498
- return;
1499
-
1500
- for (let i = 0; i < waitingForActionCampaignOffers.length; i++) {
1501
- const waitingForActionCampaignOffer = waitingForActionCampaignOffers[i];
1502
-
1503
- const offer = this.getOffer(waitingForActionCampaignOffer);
1504
- if (!offer) continue;
1505
-
1506
- const product = await this.getProduct(offer.productId);
1507
- if (!product) continue;
1508
-
1509
- const variants: IkasProductVariant[] = this.getOfferProductVariants({
1510
- offer,
1511
- product,
1512
- });
1513
- if (!variants.length) continue;
1514
-
1515
- return {
1516
- product,
1517
- variants,
1518
- campaignOffer: waitingForActionCampaignOffer,
1519
- offer,
1520
- };
1521
- }
1522
- };
1523
-
1524
- getCampaignOffer = async () => {
1525
- this.checkoutCampaignOffer = await this.getCampaignOfferProducts(
1526
- IkasCampaignOfferTargetPageType.CHECKOUT
1527
- );
1528
- this.postCheckoutCampaignOffer = await this.getCampaignOfferProducts(
1529
- IkasCampaignOfferTargetPageType.POST_CHECKOUT
1530
- );
1531
- };
1532
-
1533
- updateCartCampaignOffer = async (props: UpdateCartCampaignOfferInput) => {
1534
- this.isCheckoutLoaded = false;
1535
-
1536
- const getCartResponse = await CartStoreAPI.updateCartCampaignOffer({
1537
- input: props,
1538
- });
1539
-
1540
- if (getCartResponse && getCartResponse.isSuccess && getCartResponse.data) {
1541
- this.checkout = new IkasCheckout(getCartResponse.data);
1542
-
1543
- await this.init();
1544
- }
1545
-
1546
- this.isCheckoutLoaded = true;
1547
- };
1548
- }
1549
-
1550
- function chunkString(str: string, length: number) {
1551
- return str.match(new RegExp(".{1," + length + "}", "g")) || [];
1552
- }
1553
-
1554
- function isLastCharNumber(str: string) {
1555
- return str && NUMBER_ONLY_REGEX.test(str.charAt(str.length - 1));
1556
- }
1557
-
1558
- export enum CheckoutStep {
1559
- INFO = "info",
1560
- SHIPPING = "shipping",
1561
- PAYMENT = "payment",
1562
- SUCCESS = "success",
1563
- }
1564
-
1565
- export enum ErrorType {
1566
- UNKNOWN,
1567
- API_ERROR,
1568
- STOCK_ERROR,
1569
- PAYMENT_ERROR,
1570
- NO_SHIPPING_ERROR,
1571
- CUSTOMER_LOGIN_REQUIRED_ERROR,
1572
- }
1573
-
1574
- export type CheckoutError = {
1575
- type: ErrorType;
1576
- data?: any;
1577
- };
1578
-
1579
- export type StockErrorData = {
1580
- variant: IkasOrderLineVariant;
1581
- availableQuantity: number;
1582
- };
1583
-
1584
- export type CampaignOfferType = {
1585
- product: IkasProduct;
1586
- variants: IkasProductVariant[];
1587
- campaignOffer: IkasCartCampaignOffer;
1588
- offer: IkasCampaignOfferProduct;
1589
- };