@ikas/storefront 5.0.0-beta.17 → 5.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (539) hide show
  1. package/build/analytics/analytics.d.ts +32 -37
  2. package/build/analytics/analytics.js +1 -1
  3. package/build/analytics/events.js +1 -1
  4. package/build/analytics/facebookPixel.d.ts +11 -15
  5. package/build/analytics/facebookPixel.js +1 -1
  6. package/build/analytics/googleAnalytics.d.ts +10 -13
  7. package/build/analytics/googleAnalytics.js +1 -1
  8. package/build/analytics/googleTagManager.d.ts +188 -191
  9. package/build/analytics/googleTagManager.js +1 -1
  10. package/build/analytics/googleUniversal.d.ts +5 -8
  11. package/build/analytics/googleUniversal.js +1 -1
  12. package/build/analytics/head/index.js +1 -1
  13. package/build/analytics/ikas.d.ts +33 -40
  14. package/build/analytics/ikas.js +1 -1
  15. package/build/analytics/index.d.ts +1 -1
  16. package/build/analytics/tiktokPixel.d.ts +9 -12
  17. package/build/analytics/tiktokPixel.js +1 -1
  18. package/build/components/checkout/components/address-form/index.js +1 -1
  19. package/build/components/checkout/components/address-form/model.d.ts +6 -6
  20. package/build/components/checkout/components/address-form/model.js +1 -1
  21. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  22. package/build/components/checkout/components/cart-summary/index.js +1 -1
  23. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  24. package/build/components/checkout/components/customer-addresses/model.d.ts +4 -1
  25. package/build/components/checkout/components/customer-addresses/model.js +1 -1
  26. package/build/components/checkout/components/delivery-methods/index.js +1 -1
  27. package/build/components/checkout/components/epaykolay-button/index.d.ts +5 -0
  28. package/build/components/checkout/components/epaykolay-button/index.js +1 -0
  29. package/build/components/checkout/components/epaykolay-button/style.module.scss.js +1 -0
  30. package/build/components/checkout/components/error/customer-login-required-error/index.js +1 -1
  31. package/build/components/checkout/components/error/index.js +1 -1
  32. package/build/components/checkout/components/error/no-shipping-error/index.js +1 -1
  33. package/build/components/checkout/components/error/payment-error/index.d.ts +1 -1
  34. package/build/components/checkout/components/error/payment-error/index.js +1 -1
  35. package/build/components/checkout/components/error/stock-error/index.d.ts +2 -1
  36. package/build/components/checkout/components/error/stock-error/index.js +1 -1
  37. package/build/components/checkout/components/error/unknown-error/index.d.ts +1 -1
  38. package/build/components/checkout/components/error/unknown-error/index.js +1 -1
  39. package/build/components/checkout/components/expandable-section/index.js +1 -1
  40. package/build/components/checkout/components/form-item/index.js +1 -1
  41. package/build/components/checkout/components/klarna/index.js +1 -1
  42. package/build/components/checkout/components/master-pass/credit-card-form/index.js +1 -1
  43. package/build/components/checkout/components/master-pass/link-card-to-client/index.js +1 -1
  44. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
  45. package/build/components/checkout/components/offer-product/index.d.ts +2 -1
  46. package/build/components/checkout/components/offer-product/index.js +1 -1
  47. package/build/components/checkout/components/paypal/index.d.ts +7 -0
  48. package/build/components/checkout/components/paypal/index.js +1 -0
  49. package/build/components/checkout/components/paypal/style.module.scss.js +1 -0
  50. package/build/components/checkout/components/quick-registration/completed.js +1 -1
  51. package/build/components/checkout/components/quick-registration/index.js +1 -1
  52. package/build/components/checkout/components/quick-registration/model.js +1 -1
  53. package/build/components/checkout/components/svg/epaykolay.d.ts +6 -0
  54. package/build/components/checkout/components/svg/epaykolay.js +1 -0
  55. package/build/components/checkout/index.d.ts +1 -1
  56. package/build/components/checkout/index.js +1 -1
  57. package/build/components/checkout/model.d.ts +22 -44
  58. package/build/components/checkout/model.js +1 -1
  59. package/build/components/checkout/modelMasterPass.d.ts +13 -23
  60. package/build/components/checkout/modelMasterPass.js +1 -1
  61. package/build/components/checkout/steps/step-info/index.js +1 -1
  62. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  63. package/build/components/checkout/steps/step-payment/index.js +1 -1
  64. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  65. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -1
  66. package/build/components/checkout/steps/step-payment/style.module.scss.js +1 -1
  67. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  68. package/build/components/checkout/steps/step-success/index.js +1 -1
  69. package/build/components/checkout/style.module.scss.js +1 -1
  70. package/build/components/checkout/types.d.ts +29 -0
  71. package/build/components/checkout/types.js +1 -0
  72. package/build/components/google-captcha/index.js +1 -1
  73. package/build/components/image/index.d.ts +1 -1
  74. package/build/components/image/index.js +1 -1
  75. package/build/components/link/index.js +1 -1
  76. package/build/components/page/ThemeComponent.js +1 -1
  77. package/build/components/page/functions.d.ts +3 -0
  78. package/build/components/page/functions.js +1 -0
  79. package/build/components/page/head.d.ts +1 -1
  80. package/build/components/page/head.js +1 -1
  81. package/build/components/page/index.d.ts +4 -3
  82. package/build/components/page/index.js +1 -1
  83. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  84. package/build/components/page-editor/index.js +1 -1
  85. package/build/components/page-editor/model.d.ts +5 -1
  86. package/build/components/page-editor/model.js +1 -1
  87. package/build/ext/@ikas/fe-api-client/build/utils/api.js +1 -1
  88. package/build/hooks/index.d.ts +0 -1
  89. package/build/hooks/useCustomerReviews.d.ts +3 -4
  90. package/build/hooks/useCustomerReviews.js +1 -1
  91. package/build/index.d.ts +2 -0
  92. package/build/index.js +1 -1
  93. package/build/model-helpers/index.d.ts +5 -0
  94. package/build/model-helpers/order/line-item/option/value/functions.d.ts +3 -0
  95. package/build/model-helpers/order/line-item/option/value/functions.js +1 -0
  96. package/build/model-helpers/product/attribute-value/functions.d.ts +2 -0
  97. package/build/model-helpers/product/attribute-value/functions.js +1 -0
  98. package/build/model-helpers/product/functions.d.ts +10 -0
  99. package/build/model-helpers/product/functions.js +1 -0
  100. package/build/model-helpers/product/option-set/option/functions.d.ts +2 -0
  101. package/build/model-helpers/product/option-set/option/functions.js +1 -0
  102. package/build/model-helpers/product/variant/functions.d.ts +2 -0
  103. package/build/model-helpers/product/variant/functions.js +1 -0
  104. package/build/models/data/checkout/index.d.ts +4 -21
  105. package/build/models/data/index.d.ts +7 -138
  106. package/build/models/data/localized-customer-address/functions.d.ts +65 -0
  107. package/build/models/data/localized-customer-address/functions.js +1 -0
  108. package/build/models/data/localized-customer-address/index.d.ts +6 -0
  109. package/build/models/data/localized-order-address/functions.d.ts +63 -0
  110. package/build/models/data/localized-order-address/functions.js +1 -0
  111. package/build/models/data/localized-order-address/index.d.ts +6 -0
  112. package/build/models/data/review-form/index.d.ts +6 -0
  113. package/build/models/data/theme-json/component/index.d.ts +1 -0
  114. package/build/models/data/theme-json/component/index.js +1 -1
  115. package/build/models/data/theme-json/custom-data/index.d.ts +1 -2
  116. package/build/models/data/theme-json/custom-data/index.js +1 -1
  117. package/build/models/data/theme-json/settings/color/index.js +1 -1
  118. package/build/models/index.d.ts +1 -0
  119. package/build/models/ui/blog-category-list/functions.d.ts +6 -0
  120. package/build/models/ui/blog-category-list/functions.js +1 -0
  121. package/build/models/ui/blog-category-list/index.d.ts +8 -42
  122. package/build/models/ui/blog-category-list/index.js +1 -1
  123. package/build/models/ui/blog-list/functions.d.ts +6 -0
  124. package/build/models/ui/blog-list/functions.js +1 -0
  125. package/build/models/ui/blog-list/index.d.ts +9 -45
  126. package/build/models/ui/blog-list/index.js +1 -1
  127. package/build/models/ui/brand-list/functions.d.ts +8 -0
  128. package/build/models/ui/brand-list/functions.js +1 -0
  129. package/build/models/ui/brand-list/index.d.ts +9 -48
  130. package/build/models/ui/brand-list/index.js +1 -1
  131. package/build/models/ui/category-list/functions.d.ts +8 -0
  132. package/build/models/ui/category-list/functions.js +1 -0
  133. package/build/models/ui/category-list/index.d.ts +9 -48
  134. package/build/models/ui/category-list/index.js +1 -1
  135. package/build/models/ui/customer-review-list/functions.d.ts +7 -0
  136. package/build/models/ui/customer-review-list/functions.js +1 -0
  137. package/build/models/ui/customer-review-list/index.d.ts +8 -40
  138. package/build/models/ui/customer-review-summary-list/functions.d.ts +7 -0
  139. package/build/models/ui/customer-review-summary-list/functions.js +1 -0
  140. package/build/models/ui/customer-review-summary-list/index.d.ts +7 -39
  141. package/build/models/ui/index.d.ts +17 -10
  142. package/build/models/ui/list-commons/index.d.ts +13 -0
  143. package/build/models/ui/list-commons/index.js +1 -0
  144. package/build/models/ui/navigation-link/index.d.ts +3 -3
  145. package/build/models/ui/navigation-link/index.js +1 -1
  146. package/build/models/ui/product-attribute-detail/index.d.ts +1 -1
  147. package/build/models/ui/product-attribute-detail/index.js +1 -1
  148. package/build/models/ui/product-attribute-list/index.js +1 -1
  149. package/build/models/ui/product-list/functions.d.ts +32 -0
  150. package/build/models/ui/product-list/functions.js +1 -0
  151. package/build/models/ui/product-list/index.d.ts +18 -110
  152. package/build/models/ui/product-list/index.js +1 -1
  153. package/build/models/ui/raffle-list/functions.d.ts +6 -0
  154. package/build/models/ui/raffle-list/functions.js +1 -0
  155. package/build/models/ui/raffle-list/index.d.ts +14 -50
  156. package/build/models/ui/validator/form/account-info.js +1 -1
  157. package/build/models/ui/validator/form/address.js +1 -1
  158. package/build/models/ui/validator/form/contact-form.js +1 -1
  159. package/build/models/ui/validator/form/customer-review.js +1 -1
  160. package/build/models/ui/validator/form/forgot-password.js +1 -1
  161. package/build/models/ui/validator/form/ikas-address.d.ts +32 -20
  162. package/build/models/ui/validator/form/ikas-address.js +1 -1
  163. package/build/models/ui/validator/form/login.js +1 -1
  164. package/build/models/ui/validator/form/raffle-form.js +1 -1
  165. package/build/models/ui/validator/form/recover-password.js +1 -1
  166. package/build/models/ui/validator/form/register.d.ts +10 -1
  167. package/build/models/ui/validator/form/register.js +1 -1
  168. package/build/page-data-init/index.d.ts +7 -18
  169. package/build/page-data-init/index.js +1 -1
  170. package/build/pages/account/activate.d.ts +4 -0
  171. package/build/pages/account/activate.js +1 -0
  172. package/build/pages/checkout.js +1 -1
  173. package/build/pages/index.d.ts +1 -0
  174. package/build/store/analytics/index.d.ts +9 -0
  175. package/build/store/analytics/index.js +1 -0
  176. package/build/store/base/functions.d.ts +7 -0
  177. package/build/store/base/functions.js +1 -0
  178. package/build/store/{base.d.ts → base/index.d.ts} +7 -17
  179. package/build/store/base/index.js +1 -0
  180. package/build/store/base/public.d.ts +1 -0
  181. package/build/store/base/public.js +1 -0
  182. package/build/store/cart/functions.d.ts +24 -0
  183. package/build/store/cart/functions.js +1 -0
  184. package/build/store/cart/index.d.ts +7 -28
  185. package/build/store/cart/index.js +1 -1
  186. package/build/store/cart/public.d.ts +1 -0
  187. package/build/store/cart/public.js +1 -0
  188. package/build/store/customer/account-auth/data.d.ts +4 -0
  189. package/build/store/customer/account-auth/data.js +1 -0
  190. package/build/store/customer/account-auth/functions.d.ts +24 -0
  191. package/build/store/customer/account-auth/functions.js +1 -0
  192. package/build/store/customer/account-auth/public.d.ts +1 -0
  193. package/build/store/customer/captcha/data.d.ts +3 -0
  194. package/build/store/customer/captcha/data.js +1 -0
  195. package/build/store/customer/captcha/functions.d.ts +5 -0
  196. package/build/store/customer/captcha/functions.js +1 -0
  197. package/build/store/customer/captcha/public.d.ts +1 -0
  198. package/build/store/customer/consent/data.d.ts +3 -0
  199. package/build/store/customer/consent/data.js +1 -0
  200. package/build/store/customer/consent/functions.d.ts +6 -0
  201. package/build/store/customer/consent/functions.js +1 -0
  202. package/build/store/customer/consent/public.d.ts +1 -0
  203. package/build/store/customer/functions.d.ts +4 -0
  204. package/build/store/customer/functions.js +1 -0
  205. package/build/store/customer/index.d.ts +8 -82
  206. package/build/store/customer/index.js +1 -1
  207. package/build/store/customer/marketing/data.d.ts +3 -0
  208. package/build/store/customer/marketing/data.js +1 -0
  209. package/build/store/customer/marketing/functions.d.ts +5 -0
  210. package/build/store/customer/marketing/functions.js +1 -0
  211. package/build/store/customer/marketing/public.d.ts +1 -0
  212. package/build/store/customer/order/data.d.ts +4 -0
  213. package/build/store/customer/order/data.js +1 -0
  214. package/build/store/customer/order/functions.d.ts +11 -0
  215. package/build/store/customer/order/functions.js +1 -0
  216. package/build/store/customer/order/public.d.ts +1 -0
  217. package/build/store/customer/product/data.d.ts +17 -0
  218. package/build/store/customer/product/data.js +1 -0
  219. package/build/store/customer/product/functions.d.ts +20 -0
  220. package/build/store/customer/product/functions.js +1 -0
  221. package/build/store/customer/product/public.d.ts +1 -0
  222. package/build/store/customer/public.d.ts +8 -0
  223. package/build/store/customer/public.js +1 -0
  224. package/build/store/customer/raffle/functions.d.ts +1 -0
  225. package/build/store/customer/raffle/functions.js +1 -0
  226. package/build/store/customer/raffle/public.d.ts +1 -0
  227. package/build/store/index.d.ts +9 -4
  228. package/build/utils/constants.js +1 -1
  229. package/build/utils/helper.d.ts +1 -1
  230. package/build/utils/helper.js +1 -1
  231. package/build/utils/index.d.ts +1 -2
  232. package/package.json +17 -13
  233. package/build/ext/@builder.io/partytown/integration/index.mjs.js +0 -1
  234. package/build/ext/@builder.io/partytown/react/index.mjs.js +0 -1
  235. package/build/hooks/useStore.d.ts +0 -2
  236. package/build/hooks/useStore.js +0 -1
  237. package/build/models/data/base/index.d.ts +0 -8
  238. package/build/models/data/base/index.js +0 -1
  239. package/build/models/data/blog/category/index.d.ts +0 -12
  240. package/build/models/data/blog/category/index.js +0 -1
  241. package/build/models/data/blog/content/index.d.ts +0 -6
  242. package/build/models/data/blog/content/index.js +0 -1
  243. package/build/models/data/blog/index.d.ts +0 -27
  244. package/build/models/data/blog/index.js +0 -1
  245. package/build/models/data/blog/meta-data/index.d.ts +0 -16
  246. package/build/models/data/blog/meta-data/index.js +0 -1
  247. package/build/models/data/blog/tag/index.d.ts +0 -6
  248. package/build/models/data/blog/tag/index.js +0 -1
  249. package/build/models/data/blog/writer/index.d.ts +0 -6
  250. package/build/models/data/blog/writer/index.js +0 -1
  251. package/build/models/data/brand/index.d.ts +0 -26
  252. package/build/models/data/brand/index.js +0 -1
  253. package/build/models/data/brand/translation/index.d.ts +0 -7
  254. package/build/models/data/brand/translation/index.js +0 -1
  255. package/build/models/data/campaign-offer/index.d.ts +0 -21
  256. package/build/models/data/campaign-offer/index.js +0 -1
  257. package/build/models/data/campaign-offer/product/index.d.ts +0 -25
  258. package/build/models/data/campaign-offer/product/index.js +0 -1
  259. package/build/models/data/cart/available-shipping-method/index.d.ts +0 -10
  260. package/build/models/data/cart/available-shipping-method/index.js +0 -1
  261. package/build/models/data/cart/campaign-offer/index.d.ts +0 -16
  262. package/build/models/data/cart/campaign-offer/index.js +0 -1
  263. package/build/models/data/cart/index.d.ts +0 -14
  264. package/build/models/data/cart/index.js +0 -1
  265. package/build/models/data/category/index.d.ts +0 -22
  266. package/build/models/data/category/index.js +0 -1
  267. package/build/models/data/category/path-item/index.d.ts +0 -14
  268. package/build/models/data/category/path-item/index.js +0 -1
  269. package/build/models/data/category/translations/index.d.ts +0 -7
  270. package/build/models/data/category/translations/index.js +0 -1
  271. package/build/models/data/checkout/country-settings-model.d.ts +0 -141
  272. package/build/models/data/checkout/country-settings-model.js +0 -1
  273. package/build/models/data/checkout/index.js +0 -1
  274. package/build/models/data/checkout-settings/index.d.ts +0 -21
  275. package/build/models/data/checkout-settings/index.js +0 -1
  276. package/build/models/data/checkout-settings/option/index.d.ts +0 -6
  277. package/build/models/data/checkout-settings/option/index.js +0 -1
  278. package/build/models/data/checkout-settings/price/index.d.ts +0 -7
  279. package/build/models/data/checkout-settings/price/index.js +0 -1
  280. package/build/models/data/city/index.d.ts +0 -12
  281. package/build/models/data/city/index.js +0 -1
  282. package/build/models/data/contact-form/index.d.ts +0 -9
  283. package/build/models/data/contact-form/index.js +0 -1
  284. package/build/models/data/country/index.d.ts +0 -18
  285. package/build/models/data/country/index.js +0 -1
  286. package/build/models/data/country/location-translations/index.d.ts +0 -7
  287. package/build/models/data/customer/address/city/index.d.ts +0 -7
  288. package/build/models/data/customer/address/city/index.js +0 -1
  289. package/build/models/data/customer/address/country/index.d.ts +0 -9
  290. package/build/models/data/customer/address/country/index.js +0 -1
  291. package/build/models/data/customer/address/district/index.d.ts +0 -7
  292. package/build/models/data/customer/address/district/index.js +0 -1
  293. package/build/models/data/customer/address/ikas-localized-customer-address.d.ts +0 -50
  294. package/build/models/data/customer/address/ikas-localized-customer-address.js +0 -1
  295. package/build/models/data/customer/address/index.d.ts +0 -40
  296. package/build/models/data/customer/address/index.js +0 -1
  297. package/build/models/data/customer/address/state/index.d.ts +0 -7
  298. package/build/models/data/customer/address/state/index.js +0 -1
  299. package/build/models/data/customer/attribute/index.d.ts +0 -18
  300. package/build/models/data/customer/attribute/index.js +0 -1
  301. package/build/models/data/customer/attribute/option/index.d.ts +0 -9
  302. package/build/models/data/customer/attribute/option/index.js +0 -1
  303. package/build/models/data/customer/attribute/sales-channel/index.d.ts +0 -8
  304. package/build/models/data/customer/attribute/sales-channel/index.js +0 -1
  305. package/build/models/data/customer/attribute/translation/index.d.ts +0 -9
  306. package/build/models/data/customer/attribute/translation/index.js +0 -1
  307. package/build/models/data/customer/attribute/translation/option/index.d.ts +0 -6
  308. package/build/models/data/customer/attribute/translation/option/index.js +0 -1
  309. package/build/models/data/customer/attribute/value/index.d.ts +0 -11
  310. package/build/models/data/customer/attribute/value/index.js +0 -1
  311. package/build/models/data/customer/index.d.ts +0 -38
  312. package/build/models/data/customer/index.js +0 -1
  313. package/build/models/data/customer/review/index.d.ts +0 -24
  314. package/build/models/data/customer/review/index.js +0 -1
  315. package/build/models/data/customer/review/settings/index.d.ts +0 -6
  316. package/build/models/data/customer/review/settings/index.js +0 -1
  317. package/build/models/data/customer/review/summary/index.d.ts +0 -10
  318. package/build/models/data/customer/review/summary/index.js +0 -1
  319. package/build/models/data/customer/review/summary/star/index.d.ts +0 -6
  320. package/build/models/data/customer/review/summary/star/index.js +0 -1
  321. package/build/models/data/district/index.d.ts +0 -12
  322. package/build/models/data/district/index.js +0 -1
  323. package/build/models/data/favorite-product/index.d.ts +0 -7
  324. package/build/models/data/favorite-product/index.js +0 -1
  325. package/build/models/data/filter-category/index.d.ts +0 -12
  326. package/build/models/data/filter-category/index.js +0 -1
  327. package/build/models/data/html-meta-data/index.d.ts +0 -28
  328. package/build/models/data/html-meta-data/index.js +0 -1
  329. package/build/models/data/html-meta-data/translations/index.d.ts +0 -7
  330. package/build/models/data/html-meta-data/translations/index.js +0 -1
  331. package/build/models/data/image/index.d.ts +0 -10
  332. package/build/models/data/image/index.js +0 -1
  333. package/build/models/data/last-viewed-product/index.d.ts +0 -6
  334. package/build/models/data/last-viewed-product/index.js +0 -1
  335. package/build/models/data/merchant-settings/index.d.ts +0 -12
  336. package/build/models/data/merchant-settings/index.js +0 -1
  337. package/build/models/data/order/address/city/index.d.ts +0 -7
  338. package/build/models/data/order/address/city/index.js +0 -1
  339. package/build/models/data/order/address/country/index.d.ts +0 -9
  340. package/build/models/data/order/address/country/index.js +0 -1
  341. package/build/models/data/order/address/district/index.d.ts +0 -7
  342. package/build/models/data/order/address/district/index.js +0 -1
  343. package/build/models/data/order/address/ikas-localized-order-address.d.ts +0 -32
  344. package/build/models/data/order/address/ikas-localized-order-address.js +0 -1
  345. package/build/models/data/order/address/index.d.ts +0 -37
  346. package/build/models/data/order/address/index.js +0 -1
  347. package/build/models/data/order/address/state/index.d.ts +0 -7
  348. package/build/models/data/order/address/state/index.js +0 -1
  349. package/build/models/data/order/adjustment/applied-order-line/index.d.ts +0 -8
  350. package/build/models/data/order/adjustment/applied-order-line/index.js +0 -1
  351. package/build/models/data/order/adjustment/index.d.ts +0 -15
  352. package/build/models/data/order/adjustment/index.js +0 -1
  353. package/build/models/data/order/customer/index.d.ts +0 -11
  354. package/build/models/data/order/customer/index.js +0 -1
  355. package/build/models/data/order/gift-line/index.d.ts +0 -6
  356. package/build/models/data/order/gift-line/index.js +0 -1
  357. package/build/models/data/order/index.d.ts +0 -69
  358. package/build/models/data/order/index.js +0 -1
  359. package/build/models/data/order/invoice/index.d.ts +0 -12
  360. package/build/models/data/order/invoice/index.js +0 -1
  361. package/build/models/data/order/line-item/base-unit/index.d.ts +0 -9
  362. package/build/models/data/order/line-item/base-unit/index.js +0 -1
  363. package/build/models/data/order/line-item/base-unit/unit-type/index.d.ts +0 -6
  364. package/build/models/data/order/line-item/base-unit/unit-type/index.js +0 -1
  365. package/build/models/data/order/line-item/discount/index.d.ts +0 -11
  366. package/build/models/data/order/line-item/discount/index.js +0 -1
  367. package/build/models/data/order/line-item/index.d.ts +0 -46
  368. package/build/models/data/order/line-item/index.js +0 -1
  369. package/build/models/data/order/line-item/option/index.d.ts +0 -10
  370. package/build/models/data/order/line-item/option/index.js +0 -1
  371. package/build/models/data/order/line-item/option/value/index.d.ts +0 -9
  372. package/build/models/data/order/line-item/option/value/index.js +0 -1
  373. package/build/models/data/order/line-item/variant/brand/index.d.ts +0 -6
  374. package/build/models/data/order/line-item/variant/brand/index.js +0 -1
  375. package/build/models/data/order/line-item/variant/category/index.d.ts +0 -12
  376. package/build/models/data/order/line-item/variant/category/index.js +0 -1
  377. package/build/models/data/order/line-item/variant/index.d.ts +0 -32
  378. package/build/models/data/order/line-item/variant/index.js +0 -1
  379. package/build/models/data/order/line-item/variant/price/index.d.ts +0 -10
  380. package/build/models/data/order/line-item/variant/price/index.js +0 -1
  381. package/build/models/data/order/line-item/variant/tag/index.d.ts +0 -6
  382. package/build/models/data/order/line-item/variant/tag/index.js +0 -1
  383. package/build/models/data/order/line-item/variant/unit/index.d.ts +0 -6
  384. package/build/models/data/order/line-item/variant/unit/index.js +0 -1
  385. package/build/models/data/order/line-item/variant/value/index.d.ts +0 -11
  386. package/build/models/data/order/line-item/variant/value/index.js +0 -1
  387. package/build/models/data/order/package/index.d.ts +0 -16
  388. package/build/models/data/order/package/index.js +0 -1
  389. package/build/models/data/order/package/tracking-info/index.d.ts +0 -9
  390. package/build/models/data/order/package/tracking-info/index.js +0 -1
  391. package/build/models/data/order/payment-method/index.d.ts +0 -9
  392. package/build/models/data/order/payment-method/index.js +0 -1
  393. package/build/models/data/order/refund/index.d.ts +0 -7
  394. package/build/models/data/order/refund/index.js +0 -1
  395. package/build/models/data/order/refund/line-item/index.d.ts +0 -6
  396. package/build/models/data/order/refund/line-item/index.js +0 -1
  397. package/build/models/data/order/refund/settings/index.d.ts +0 -7
  398. package/build/models/data/order/refund/settings/index.js +0 -1
  399. package/build/models/data/order/shipping-line/index.d.ts +0 -12
  400. package/build/models/data/order/shipping-line/index.js +0 -1
  401. package/build/models/data/order/tax-line/index.d.ts +0 -6
  402. package/build/models/data/order/tax-line/index.js +0 -1
  403. package/build/models/data/order/transaction/error/index.d.ts +0 -7
  404. package/build/models/data/order/transaction/error/index.js +0 -1
  405. package/build/models/data/order/transaction/index.d.ts +0 -26
  406. package/build/models/data/order/transaction/index.js +0 -1
  407. package/build/models/data/order/transaction/payment-method-detail/index.d.ts +0 -13
  408. package/build/models/data/order/transaction/payment-method-detail/index.js +0 -1
  409. package/build/models/data/order/transaction/payment-method-detail/installment-price/index.d.ts +0 -9
  410. package/build/models/data/order/transaction/payment-method-detail/installment-price/index.js +0 -1
  411. package/build/models/data/payment-gateway/additional-price/index.d.ts +0 -9
  412. package/build/models/data/payment-gateway/additional-price/index.js +0 -1
  413. package/build/models/data/payment-gateway/index.d.ts +0 -31
  414. package/build/models/data/payment-gateway/index.js +0 -1
  415. package/build/models/data/payment-gateway/settings/index.d.ts +0 -10
  416. package/build/models/data/payment-gateway/settings/index.js +0 -1
  417. package/build/models/data/payment-gateway/translation/index.d.ts +0 -7
  418. package/build/models/data/payment-gateway/translation/index.js +0 -1
  419. package/build/models/data/product/attribute/index.d.ts +0 -15
  420. package/build/models/data/product/attribute/index.js +0 -1
  421. package/build/models/data/product/attribute/option/index.d.ts +0 -6
  422. package/build/models/data/product/attribute/option/index.js +0 -1
  423. package/build/models/data/product/attribute/table-cell/index.d.ts +0 -6
  424. package/build/models/data/product/attribute/table-cell/index.js +0 -1
  425. package/build/models/data/product/attribute/table-template/index.d.ts +0 -7
  426. package/build/models/data/product/attribute/table-template/index.js +0 -1
  427. package/build/models/data/product/attribute/translation/index.d.ts +0 -13
  428. package/build/models/data/product/attribute/translation/index.js +0 -1
  429. package/build/models/data/product/attribute-value/index.d.ts +0 -28
  430. package/build/models/data/product/attribute-value/index.js +0 -1
  431. package/build/models/data/product/back-in-stock-settings/index.d.ts +0 -5
  432. package/build/models/data/product/back-in-stock-settings/index.js +0 -1
  433. package/build/models/data/product/base-unit/index.d.ts +0 -12
  434. package/build/models/data/product/base-unit/index.js +0 -1
  435. package/build/models/data/product/campaign/data/index.d.ts +0 -27
  436. package/build/models/data/product/campaign/data/index.js +0 -1
  437. package/build/models/data/product/campaign/filter/index.d.ts +0 -7
  438. package/build/models/data/product/campaign/filter/index.js +0 -1
  439. package/build/models/data/product/campaign/index.d.ts +0 -7
  440. package/build/models/data/product/campaign/index.js +0 -1
  441. package/build/models/data/product/campaign/product-buyx-then-gety/index.d.ts +0 -20
  442. package/build/models/data/product/campaign/product-buyx-then-gety/index.js +0 -1
  443. package/build/models/data/product/campaign/product-campaign-date-range-field/index.d.ts +0 -6
  444. package/build/models/data/product/campaign/product-campaign-date-range-field/index.js +0 -1
  445. package/build/models/data/product/campaign/product-fixed-discount/index.d.ts +0 -14
  446. package/build/models/data/product/campaign/product-fixed-discount/index.js +0 -1
  447. package/build/models/data/product/filter/index.d.ts +0 -82
  448. package/build/models/data/product/filter/index.js +0 -1
  449. package/build/models/data/product/image/index.d.ts +0 -10
  450. package/build/models/data/product/image/index.js +0 -1
  451. package/build/models/data/product/index.d.ts +0 -77
  452. package/build/models/data/product/index.js +0 -1
  453. package/build/models/data/product/option-set/index.d.ts +0 -29
  454. package/build/models/data/product/option-set/index.js +0 -1
  455. package/build/models/data/product/option-set/option/index.d.ts +0 -70
  456. package/build/models/data/product/option-set/option/index.js +0 -1
  457. package/build/models/data/product/star/index.d.ts +0 -6
  458. package/build/models/data/product/star/index.js +0 -1
  459. package/build/models/data/product/stock-location/index.d.ts +0 -8
  460. package/build/models/data/product/stock-location/index.js +0 -1
  461. package/build/models/data/product/tag/index.d.ts +0 -6
  462. package/build/models/data/product/tag/index.js +0 -1
  463. package/build/models/data/product/variant/index.d.ts +0 -31
  464. package/build/models/data/product/variant/index.js +0 -1
  465. package/build/models/data/product/variant/price/index.d.ts +0 -19
  466. package/build/models/data/product/variant/price/index.js +0 -1
  467. package/build/models/data/product/variant/unit/index.d.ts +0 -6
  468. package/build/models/data/product/variant/unit/index.js +0 -1
  469. package/build/models/data/product/variant-type/index.d.ts +0 -8
  470. package/build/models/data/product/variant-type/index.js +0 -1
  471. package/build/models/data/raffle/index.d.ts +0 -63
  472. package/build/models/data/raffle/index.js +0 -1
  473. package/build/models/data/sales-channel/index.d.ts +0 -19
  474. package/build/models/data/sales-channel/index.js +0 -1
  475. package/build/models/data/state/index.d.ts +0 -11
  476. package/build/models/data/state/index.js +0 -1
  477. package/build/models/data/state/location-translations/index.d.ts +0 -7
  478. package/build/models/data/stock-location/address/city/index.d.ts +0 -7
  479. package/build/models/data/stock-location/address/city/index.js +0 -1
  480. package/build/models/data/stock-location/address/country/index.d.ts +0 -7
  481. package/build/models/data/stock-location/address/country/index.js +0 -1
  482. package/build/models/data/stock-location/address/district/index.d.ts +0 -7
  483. package/build/models/data/stock-location/address/district/index.js +0 -1
  484. package/build/models/data/stock-location/address/index.d.ts +0 -15
  485. package/build/models/data/stock-location/address/index.js +0 -1
  486. package/build/models/data/stock-location/address/state/index.d.ts +0 -7
  487. package/build/models/data/stock-location/address/state/index.js +0 -1
  488. package/build/models/data/stock-location/available/index.d.ts +0 -10
  489. package/build/models/data/stock-location/available/index.js +0 -1
  490. package/build/models/data/stock-location/index.d.ts +0 -14
  491. package/build/models/data/stock-location/index.js +0 -1
  492. package/build/models/data/storefront/domain/index.d.ts +0 -9
  493. package/build/models/data/storefront/domain/index.js +0 -1
  494. package/build/models/data/storefront/index.d.ts +0 -30
  495. package/build/models/data/storefront/index.js +0 -1
  496. package/build/models/data/storefront/localization/index.d.ts +0 -8
  497. package/build/models/data/storefront/localization/index.js +0 -1
  498. package/build/models/data/storefront/meta-templates/index.d.ts +0 -8
  499. package/build/models/data/storefront/meta-templates/index.js +0 -1
  500. package/build/models/data/storefront/routing/dynamic-currency/index.d.ts +0 -6
  501. package/build/models/data/storefront/routing/dynamic-currency/index.js +0 -1
  502. package/build/models/data/storefront/routing/index.d.ts +0 -14
  503. package/build/models/data/storefront/routing/index.js +0 -1
  504. package/build/models/data/storefront/theme/index.d.ts +0 -10
  505. package/build/models/data/storefront/theme/index.js +0 -1
  506. package/build/models/data/storefront/theme-localization/index.d.ts +0 -15
  507. package/build/models/data/storefront/theme-localization/index.js +0 -1
  508. package/build/models/data/variant-type/index.d.ts +0 -13
  509. package/build/models/data/variant-type/index.js +0 -1
  510. package/build/models/data/variant-type/variant-value/index.d.ts +0 -12
  511. package/build/models/data/variant-type/variant-value/index.js +0 -1
  512. package/build/models/ui/customer-review-list/index.js +0 -1
  513. package/build/models/ui/customer-review-summary-list/index.js +0 -1
  514. package/build/models/ui/raffle-list/index.js +0 -1
  515. package/build/store/base.js +0 -1
  516. package/build/store/blog/index.d.ts +0 -26
  517. package/build/store/blog/index.js +0 -1
  518. package/build/store/brand/index.d.ts +0 -12
  519. package/build/store/brand/index.js +0 -1
  520. package/build/store/cart/api.d.ts +0 -10
  521. package/build/store/cart/api.js +0 -1
  522. package/build/store/category/index.d.ts +0 -12
  523. package/build/store/category/index.js +0 -1
  524. package/build/store/checkout/index.d.ts +0 -16
  525. package/build/store/checkout/index.js +0 -1
  526. package/build/store/customer/api.d.ts +0 -54
  527. package/build/store/customer/api.js +0 -1
  528. package/build/store/html-meta-data/index.d.ts +0 -6
  529. package/build/store/html-meta-data/index.js +0 -1
  530. package/build/store/location/index.d.ts +0 -9
  531. package/build/store/location/index.js +0 -1
  532. package/build/store/merchant/index.d.ts +0 -6
  533. package/build/store/product/index.d.ts +0 -47
  534. package/build/store/product/index.js +0 -1
  535. package/build/store/raffle/index.d.ts +0 -15
  536. package/build/store/raffle/index.js +0 -1
  537. package/build/store/storefront/index.d.ts +0 -5
  538. package/build/utils/currency.d.ts +0 -7
  539. package/build/utils/currency.js +0 -1
@@ -1,120 +1,28 @@
1
- import { NextRouter } from "next/router.js";
2
1
  import { IkasBrand, IkasProduct, IkasProductFilter, IkasFilterCategory, IkasThemeJsonPageType, IkasCategory } from "../../../models/data";
3
2
  import { IkasProductListPropValue, IkasRelatedProductProps, IkasViewedTogetherProductProps } from "@ikas/storefront-providers";
4
- export declare class IkasProductList {
3
+ export declare type IkasProductList = {
5
4
  data: IkasProduct[];
6
- filters?: IkasProductFilter[] | null;
7
- private _filterCategories?;
8
- private _type;
9
- private _pageType;
10
- private _sort;
11
- private _limit;
12
- private _page;
13
- private _infiniteScrollPage;
14
- private _count;
15
- private _searchKeyword;
16
- private _initialized;
17
- private _minPage?;
18
- private _productListPropValue;
19
- private _filterBrandId?;
20
- private _filterCategoryId?;
21
- private _relatedProductData?;
22
- private _viewedTogetherProductData?;
23
- private pageSpecificData?;
24
- private _recommendFor?;
25
- private _isLoading;
26
- private _fetchRequestTime;
27
- private router?;
28
- constructor(data: IkasProductListParams | IkasProductList, router?: NextRouter);
29
- get sort(): IkasProductListSortType;
30
- get limit(): number;
31
- get pageType(): IkasThemeJsonPageType;
32
- get page(): number;
33
- get minPage(): number;
34
- get count(): number;
35
- get pageCount(): number;
36
- get searchKeyword(): string;
37
- set searchKeyword(value: string);
38
- get isInitialized(): boolean;
39
- get isFilterable(): boolean;
40
- get isFiltered(): boolean | undefined;
41
- get isStatic(): boolean;
42
- get isDiscounted(): boolean;
43
- get isRecommended(): boolean;
44
- get isLastViewed(): boolean;
45
- get isRelatedProducts(): boolean;
46
- get isViewedTogetherProducts(): boolean;
47
- get isSearch(): boolean;
48
- get hasPrev(): boolean;
49
- get hasNext(): boolean;
50
- get isLoading(): boolean;
51
- get filterQueryParams(): string;
52
- get filterCategories(): IkasFilterCategory[] | undefined;
53
- get hasAppliedfilter(): boolean | undefined;
54
- get isFeaturedSortEnabled(): boolean;
55
- private setIsFilteredForProducts;
56
- private setPageSpecificSort;
57
- private getSortParams;
58
- private searchProducts;
59
- private getFilters;
60
- private applyQueryParamFilters;
61
- private applyFacets;
62
- private applyFilters;
63
- clearFilters(): void;
64
- private getInitial;
65
- getPrev: () => Promise<void>;
66
- getNext: () => Promise<void>;
67
- getPage: (page: number) => Promise<void>;
68
- setSortType(sortType: IkasProductListSortType): Promise<void>;
69
- onFilterCategoryClick(filterCategory: IkasFilterCategory, disableRoute?: boolean): Promise<void>;
70
- toJSON(): {
71
- data: IkasProduct[];
72
- type: IkasProductListType;
73
- pageType: IkasThemeJsonPageType;
74
- sort: IkasProductListSortType;
75
- limit: number;
76
- page: number;
77
- count: number;
78
- searchKeyword: string;
79
- initialized: boolean;
80
- minPage: number | null | undefined;
81
- filterBrandId: string | null | undefined;
82
- filterCategoryId: string | null | undefined;
83
- filterCategories: IkasFilterCategory[] | null | undefined;
84
- filters: IkasProductFilter[] | null | undefined;
85
- recommendFor: string | null | undefined;
86
- productListPropValue: IkasProductListPropValue;
87
- pageSpecificData: IkasCategory | IkasBrand | null | undefined;
88
- };
89
- setVisibleInfiniteScrollPage: (page: number) => void;
90
- private restoreInfiniteScrollPage;
91
- private getQueryParams;
92
- private isBrowser;
93
- private waitForCustomerStoreInit;
94
- private handleListingEvent;
95
- private searchDebouncer;
96
- private searchAnalyticsDebouncer;
97
- }
98
- export declare type IkasProductListParams = {
99
- data?: IkasProduct[];
100
- type?: IkasProductListType;
5
+ type: IkasProductListType;
101
6
  pageType: IkasThemeJsonPageType;
102
- sort?: IkasProductListSortType;
103
- limit?: number;
104
- page?: number;
105
- count?: number;
106
- searchKeyword?: string;
107
- initialized?: boolean;
108
- minPage?: number;
109
- filterBrandId?: string;
110
- filterCategoryId?: string;
111
- filters?: IkasProductFilter[];
112
- filterCategories?: IkasFilterCategory[];
113
- recommendFor?: string;
114
- productListPropValue: IkasProductListPropValue;
7
+ sort: IkasProductListSortType;
8
+ limit: number;
9
+ page: number;
10
+ infiniteScrollPage: number | null;
11
+ count: number;
12
+ searchKeyword?: string | null;
13
+ initialized: boolean;
14
+ minPage: number;
15
+ filterBrandId?: string | null;
16
+ filterCategoryId?: string | null;
17
+ filters?: IkasProductFilter[] | null;
18
+ filterCategories?: IkasFilterCategory[] | null;
19
+ recommendFor?: string | null;
20
+ productListPropValue: IkasProductListPropValue | null;
115
21
  pageSpecificData?: IkasCategory | IkasBrand | null;
116
22
  relatedProductData?: IkasRelatedProductProps | null;
117
23
  viewedTogetherProductData?: IkasViewedTogetherProductProps | null;
24
+ isLoading: boolean;
25
+ fetchRequestTime: number;
118
26
  };
119
27
  export declare enum IkasProductListType {
120
28
  ALL = "ALL",
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import s from"lodash/debounce";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{IkasCategoryProductsOrderType as o,IkasThemeJsonPageType as a,IkasThemeJsonStockPreference as n}from"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout/country-settings-model.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import{IkasFilterCategory as d}from"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as c}from"../../data/product/filter/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import{IkasProduct as l}from"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/state/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import p from"../../../store/product/index.js";import h from"query-string";import{SortByDirectionEnum as f,SortByTypeEnum as g,GetSuggestedProductsMethodEnum as m}from"@ikas/storefront-api";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{Analytics as _}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"../../../components/page/index.js";import"../../../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../../../components/link/index.js";import"../../../components/page-editor/loader/style.module.scss.js";import"../../../components/google-captcha/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../brand-list/index.js";import"../category-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/ikas-address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../../pages/home.js";import"../../../pages/_slug_/index.js";import"../../../pages/pages/_slug_.js";import"../../../pages/checkout.js";import"../../../pages/account/index.js";import"../../../pages/account/addresses.js";import"../../../pages/account/orders/index.js";import"../../../pages/account/orders/_id_.js";import"../../../pages/account/login.js";import"../../../pages/account/register.js";import"../../../pages/account/forgot-password.js";import"../../../pages/account/recover-password.js";import"../../../pages/cart.js";import"../../../pages/editor.js";import"../../../pages/account/favorite-products.js";import"../../../pages/search.js";import"next/error.js";import"../../../pages/blog/index.js";import"../../../pages/blog/_slug_.js";import"../../../pages/raffle/_slug_.js";import"../../../pages/raffle/index.js";import"../../../pages/account/raffles.js";import{IkasBaseStore as y}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var I,E,P,S=function(){function P(o,n){var c=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.applyFilters=function(){return t(c,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[a.CATEGORY,a.BRAND,a.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&!v.getIsEditor()&&(null===(i=this.router)||void 0===i||i.replace("".concat(location.pathname).concat(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(r,s){return t(c,void 0,void 0,(function(){var t,o,a,n,d,u,c,p,h,f,g,m,v,_,I;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,14,15,16]),o=s?this._page:1,a=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(r),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(n=void 0,d=!1,this.isStatic?(o=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(o=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(o=1,a=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,y.getInstance().customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length?(n=u.map((function(t){return t.productId})),d=y.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=y.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:p=e.sent(),e.label=13;case 13:return(c=p)&&this._fetchRequestTime===t?(h=[],!d&&this.isLastViewed&&y.getInstance().customerStore.setSavedLastViewedProductsResponse(c),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:y.getInstance().customerStore._lastViewedProducts,h=(null==f?void 0:f.map((function(t){var e,r,s=null===(r=null===(e=c.data)||void 0===e?void 0:e.data)||void 0===r?void 0:r.find((function(e){return e.id===t.productId})),o=null==s?void 0:s.variants.find((function(e){return e.id===t.variantId}));if((null==o?void 0:o.isActive)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive}))),s&&o)return new l(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):h=(null===(v=null===(m=c.data)||void 0===m?void 0:m.data)||void 0===v?void 0:v.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new l(i(i({},t),{selectedVariantValues:(e||t.variants[0]).variantValues}))})))||[],this.applyFacets(null===(_=c.data)||void 0===_?void 0:_.facets),this.data=h,this._count=(null===(I=c.data)||void 0===I?void 0:I.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this.setIsFilteredForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return g=e.sent(),console.log(g),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(c,void 0,void 0,(function(){var t,r,s,o,a,n,d;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(r=e.sent())?(s=null===(n=null===(a=r.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new l(i(i({},t),{selectedVariantValues:(e||t.variants[0]).variantValues}))})),this.data=(null==s?void 0:s.concat(this.data))||this.data,this._count=(null===(d=r.data)||void 0===d?void 0:d.count)||this._count,this._minPage=t,this.setIsFilteredForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(c,void 0,void 0,(function(){var t,r,s,o,a,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(r=null===(a=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new l(i(i({},t),{selectedVariantValues:(e||t.variants[0]).variantValues}))})),this.data=this.data.concat(r||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,this.setIsFilteredForProducts(),[3,5]):[2];case 3:return s=e.sent(),console.log(s),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(r){return t(c,void 0,void 0,(function(){var t,s,o,a,n,d;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(r,this.limit)];case 2:return(t=e.sent())?(s=null===(n=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new l(i(i({},t),{selectedVariantValues:(e||t.variants[0]).variantValues}))})),this.data=s||[],this._count=(null===(d=t.data)||void 0===d?void 0:d.count)||0,this._page=r,this._minPage=r,this.setIsFilteredForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;c._infiniteScrollPage!==t&&(c._infiniteScrollPage=t,v.getIsEditor()||null===(e=c.router)||void 0===e||e.replace("".concat(location.pathname).concat(c.filterQueryParams?"?"+c.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){c.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){_.search(c._searchKeyword)}),1e3);var p=o,h=o;if(this.data=o.data?o.data.map((function(t){return new l(t)})):[],this._type=p.type||h._type||p.productListPropValue.productListType||h._productListPropValue.productListType||I.ALL,this._pageType=o.pageType,this._sort=o.sort||o.productListPropValue.initialSort||E.LAST_ADDED,this._limit=o.limit||p.productListPropValue.initialLimit||h._productListPropValue.initialLimit||20,this._page=o.page||1,this._minPage=o.minPage||null,this._count=o.count||0,this._searchKeyword=o.searchKeyword||"",this._productListPropValue=p.productListPropValue||h._productListPropValue,this._filterBrandId=p.filterBrandId||h._filterBrandId||null,this._filterCategoryId=p.filterCategoryId||h._filterCategoryId||null,this._relatedProductData=p.relatedProductData||h._relatedProductData||null,this._viewedTogetherProductData=p.viewedTogetherProductData||h._viewedTogetherProductData||null,this._recommendFor=p.recommendFor||h._recommendFor,this.filters=o.filters?o.filters.map((function(t){return new u(t,c)})):null,this._filterCategories=o.filterCategories?o.filterCategories.map((function(t){return new d(t)})):null,this.pageSpecificData=p.pageSpecificData||h.pageSpecificData||null,this.router=n,r(this,{router:!1}),this.setPageSpecificSort(),this.setIsFilteredForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===I.SEARCH)){var f=this.getQueryParams();this.getInitial(f,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(P.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFilterable",{get:function(){return this._type===I.ALL||this._type===I.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==a.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isStatic",{get:function(){return this._type===I.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isDiscounted",{get:function(){return this._type===I.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRecommended",{get:function(){return this._type===I.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isLastViewed",{get:function(){return this._type===I.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRelatedProducts",{get:function(){return this._type===I.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isViewedTogetherProducts",{get:function(){return this._type===I.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isSearch",{get:function(){return this._type===I.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"filterQueryParams",{get:function(){var t,e,i,r,s=this,o={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(o[t.key]=t.keyList)})),this._searchKeyword&&(o.s=this._searchKeyword),this._infiniteScrollPage&&(o.page=this._infiniteScrollPage),this._pageType!==a.CATEGORY){var n=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==n?void 0:n.length))o.c=null==n?void 0:n.map((function(t){return t.slug}));else if(this._filterCategoryId){var d=null===(r=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===s._filterCategoryId})))||void 0===r?void 0:r.slug;d&&(o.c=d)}}return h.stringify(o,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===o.MANUALLY&&[I.ALL,I.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),P.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},P.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[I.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case o.HIGHEST_DISCOUNT_RATIO:this._sort=E.DECRASING_DISCOUNT;break;case o.LOWEST_DISCOUNT_RATIO:this._sort=E.INCREASING_DISCOUNT;break;case o.HIGHEST_PRICE:this._sort=E.DECREASING_PRICE;break;case o.LOWEST_PRICE:this._sort=E.INCREASING_PRICE;break;case o.NEWEST:this._sort=E.LAST_ADDED;break;case o.OLDEST:this._sort=E.FIRST_ADDED;break;case o.MANUALLY:this._sort=E.FEATURED}},P.prototype.getSortParams=function(){var t,e;switch(this._sort){case E.INCREASING_PRICE:t=f.ASC,e=g.PRICE;break;case E.DECREASING_PRICE:t=f.DESC,e=g.PRICE;break;case E.FIRST_ADDED:t=f.ASC,e=g.CREATED_AT;break;case E.LAST_ADDED:t=f.DESC,e=g.CREATED_AT;break;case E.INCREASING_DISCOUNT:t=f.ASC,e=g.DISCOUNT_RATIO;break;case E.DECRASING_DISCOUNT:t=f.DESC,e=g.DISCOUNT_RATIO;break;case E.FEATURED:if(this.isSearch)return;t=f.ASC,e=g.MANUAL_SORT;break;case E.DEFAULT:t=void 0,e=void 0}if(t&&e)return{direction:t,type:e}},P.prototype.searchProducts=function(i,r,s){var o,d,u;return t(this,void 0,void 0,(function(){var t,l,h,f;return e(this,(function(e){switch(e.label){case 0:return t=[],l=[],null===(o=this.filters)||void 0===o||o.forEach((function(e){e.valueList.length&&t.push(new c({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&l.push({id:e.id,type:e.type,displayType:e.displayType})})),h=null===(d=this._filterCategories)||void 0===d?void 0:d.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,p.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:v.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,p.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),method:m.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:v.getCurrentLocale()})]:[3,4];case 4:return[4,p.searchProducts({input:{page:i,perPage:r,productIdList:this.isStatic?null===(u=this._productListPropValue.productIds)||void 0===u?void 0:u.map((function(t){return t.productId})):s,filterList:t,facetList:l,brandId:this._pageType===a.BRAND&&this._type!==I.SEARCH?this._filterBrandId:void 0,categoryIdList:h&&h.length?h:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),query:this._searchKeyword,order:this._type===I.SEARCH?[]:f?[f]:[],showStockOption:v.getStockPreference()||n.SHOW_ALL}})]}}))}))},P.prototype.getFilters=function(){var i,r,s;return t(this,void 0,void 0,(function(){var t,o,n=this;return e(this,(function(e){switch(e.label){case 0:return[4,p.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:v.getCurrentLocale()})];case 1:return t=e.sent(),this.filters=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.filters.map((function(t){return new u(t,n)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this.pageType!==a.CATEGORY&&this._filterCategoryId&&(o=null===(s=this._filterCategories)||void 0===s?void 0:s.find((function(t){return t.id===n._filterCategoryId})))&&(o.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},P.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var r=null==t?void 0:t.get("s");if(r&&(this._searchKeyword=r),this._pageType!==a.CATEGORY){var s=null==t?void 0:t.get("c"),o=null==s?void 0:s.split(",");o&&o.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=o.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},P.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=o.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},P.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==a.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},P.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},P.prototype.onFilterCategoryClick=function(i,r){var s,o;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t.isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:v.getIsEditor()||null===(o=y.getInstance().router)||void 0===o||o.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},P.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},P.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},P.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},P.prototype.isBrowser=function(){return"undefined"!=typeof window},P.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){y.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},P.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?_.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===I.ALL&&_.viewListing(this.data)},P}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS",t.VIEWED_TOGETHER="VIEWED_TOGETHER"}(I||(I={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED",t.DEFAULT="DEFAULT"}(E||(E={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(P||(P={}));export{S as IkasProductList,E as IkasProductListSortType,I as IkasProductListType,P as IkasRelatedProductsType};
1
+ var E,D,A;!function(E){E.ALL="ALL",E.STATIC="STATIC",E.DISCOUNTED="DISCOUNTED",E.RECOMMENDED="RECOMMENDED",E.CATEGORY="CATEGORY",E.SEARCH="SEARCH",E.LAST_VIEWED="LAST_VIEWED",E.RELATED_PRODUCTS="RELATED_PRODUCTS",E.VIEWED_TOGETHER="VIEWED_TOGETHER"}(E||(E={})),function(E){E.INCREASING_PRICE="INCREASING_PRICE",E.DECREASING_PRICE="DECREASING_PRICE",E.LAST_ADDED="LAST_ADDED",E.FIRST_ADDED="FIRST_ADDED",E.INCREASING_DISCOUNT="INCREASING_DISCOUNT",E.DECRASING_DISCOUNT="DECRASING_DISCOUNT",E.FEATURED="FEATURED",E.DEFAULT="DEFAULT"}(D||(D={})),function(E){E.CATEGORY="CATEGORY",E.BRAND="BRAND"}(A||(A={}));export{D as IkasProductListSortType,E as IkasProductListType,A as IkasRelatedProductsType};
@@ -0,0 +1,6 @@
1
+ import { IkasRaffleList } from ".";
2
+ export * from "../list-commons";
3
+ export declare function createIkasRaffleList(params: Partial<IkasRaffleList>): IkasRaffleList;
4
+ export declare function getPrev(list: IkasRaffleList): Promise<void>;
5
+ export declare function getNext(list: IkasRaffleList): Promise<void>;
6
+ export declare function getPage(list: IkasRaffleList, page: number): Promise<void>;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as n}from'./../../../ext/tslib/tslib.es6.js';import{listStorefrontRaffle as i}from"@ikas/storefront-api";import{populateRaffleProducts as e}from"@ikas/storefront-providers";import{observable as a}from"mobx";import{hasPrev as o,hasNext as r}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function s(t){var n,i;return a({data:t.data||[],limit:t.limit||10,page:t.page||1,count:t.count||0,initialized:t.initialized||!1,minPage:t.minPage||1,start:null!==(n=t.start)&&void 0!==n?n:null,end:null!==(i=t.end)&&void 0!==i?i:null,includeDeleted:t.includeDeleted||!1,name:t.name||null,search:t.search||null,id:t.id||"",customerId:t.customerId||null,isLoading:t.isLoading||!1})}function d(a,o,r){var s;return t(this,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,i({start:a.start?{eq:a.start}:void 0,end:a.end?{eq:a.end}:void 0,includeDeleted:a.includeDeleted||!1,name:a.name?{eq:a.name}:void 0,id:a.id?{eq:a.id}:void 0,search:a.search||void 0,pagination:{limit:r,page:o}})];case 1:return t=n.sent(),[4,e((null===(s=t.data)||void 0===s?void 0:s.data)||[])];case 2:return n.sent(),[2,t]}}))}))}function u(i){var e,a,r;return t(this,void 0,void 0,(function(){var t,s,u;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading||!o(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),t=i.minPage-1,[4,d(i,t,i.limit)];case 2:return s=n.sent(),i.data=(null===(a=null===(e=s.data)||void 0===e?void 0:e.data)||void 0===a?void 0:a.concat(i.data))||i.data,i.count=(null===(r=s.data)||void 0===r?void 0:r.count)||i.count,i.minPage=t,[3,5];case 3:return u=n.sent(),console.log(u),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function l(i){var e,a;return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading||!r(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,d(i,i.page+1,i.limit)];case 2:return t=n.sent(),i.data=i.data.concat((null===(e=t.data)||void 0===e?void 0:e.data)||[]),i.count=(null===(a=t.data)||void 0===a?void 0:a.count)||i.count,i.page=i.page+1,[3,5];case 3:return o=n.sent(),console.log(o),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function c(i,e){var a,o;return t(this,void 0,void 0,(function(){var t,r;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading)return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,d(i,e,i.limit)];case 2:return t=n.sent(),i.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],i.count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,i.page=e,i.minPage=e,[3,5];case 3:return r=n.sent(),console.log(r),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}export{s as createIkasRaffleList,l as getNext,c as getPage,u as getPrev};
@@ -1,53 +1,17 @@
1
1
  import { IkasRaffle } from "../../data";
2
- export declare class IkasRaffleList {
2
+ export declare type IkasRaffleList = {
3
3
  data: IkasRaffle[];
4
- private _limit;
5
- private _page;
6
- private _count;
7
- private _initialized;
8
- private _minPage?;
9
- private _start;
10
- private _end;
11
- private _includeDeleted;
12
- private _name;
13
- private _search;
14
- private _id;
15
- private _isLoading;
16
- constructor(data?: IkasRaffleListParams);
17
- get limit(): number;
18
- get page(): number;
19
- get count(): number;
20
- get pageCount(): number;
21
- get isInitialized(): boolean;
22
- get hasPrev(): boolean;
23
- get hasNext(): boolean;
24
- get isLoading(): boolean;
25
- get minPage(): number;
26
- private getRaffleList;
27
- getPrev: () => Promise<void>;
28
- getNext: () => Promise<void>;
29
- getPage: (page: number) => Promise<void>;
30
- toJSON(): {
31
- data: IkasRaffle[];
32
- limit: number;
33
- page: number;
34
- count: number;
35
- initialized: boolean;
36
- minPage: number | null | undefined;
37
- };
38
- }
39
- export declare type IkasRaffleListParams = {
40
- data?: IkasRaffle[];
41
- limit?: number;
42
- page?: number;
43
- count?: number;
44
- initialized?: boolean;
45
- minPage?: number;
46
- start?: number;
47
- end?: number;
48
- includeDeleted?: boolean;
49
- name?: string;
50
- search?: string;
51
- id?: string;
52
- customerId?: string;
4
+ limit: number;
5
+ page: number;
6
+ count: number;
7
+ initialized: boolean;
8
+ minPage: number;
9
+ start: number | null;
10
+ end: number | null;
11
+ includeDeleted: boolean;
12
+ name: string | null;
13
+ search: string | null;
14
+ id: string;
15
+ customerId: string | null;
16
+ isLoading: boolean;
53
17
  };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__spreadArray as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as a,computed as i,action as o}from"mobx";import{Validator as s}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as d,RequiredRule as m}from"../rules/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import{IkasCustomerEmailSubscriptionStatus as u}from"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/checkout/country-settings-model.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/index.js";import"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";var p=function(){function p(t){var e=this;this.validatorRules=function(t){return void 0===t&&(t=!1),r([new m({model:e.customer,fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new m({model:e.customer,fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule})],t?[new d({model:e.customer,fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(t){e.customer.firstName=t},this.onLastNameChange=function(t){e.customer.lastName=t},this.onPhoneChange=function(t){e.customer.phone=t||null,t||e.validator.setRules(e.validatorRules())},a(this,{firstNameErrorMessage:i,lastNameErrorMessage:i,phoneErrorMessage:i,isMarketingAccepted:i,hasError:i,firstName:i,lastName:i,phone:i,validateAll:o,submit:o}),this.customer=t.customer,this.message=t.message,this.validator=new s(this.customer,this.validatorRules())}return Object.defineProperty(p.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(t){this.customer.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(t){this.customer.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(t){this.customer.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isMarketingAccepted",{get:function(){return this.customer.isSubscribed},set:function(t){this.customer.subscriptionStatus=t?u.SUBSCRIBED:u.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstNameErrorMessage",{get:function(){var t,e;return null===(e=null===(t=this.validator.results)||void 0===t?void 0:t.firstName)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastNameErrorMessage",{get:function(){var t,e;return null===(e=null===(t=this.validator.results)||void 0===t?void 0:t.lastName)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"phoneErrorMessage",{get:function(){var t,e;return null===(e=null===(t=this.validator.results)||void 0===t?void 0:t.phone)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),p.prototype.validateAll=function(){return this.validator.validateAll()},p.prototype.submit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(e.sent())return t.isFormError=!0,[2,t];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,n.getInstance().customerStore.saveCustomer(this.customer)];case 3:return e.sent()&&(t.isSuccess=!0),[2,t];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},p}();export{p as AccountInfoForm};
1
+ import{__awaiter as e,__generator as t,__spreadArray as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as o,action as i}from"mobx";import{Validator as a}from"../index.js";import{PhoneRule as n,RequiredRule as u}from"../rules/index.js";import{IkasCustomerEmailSubscriptionStatus as l}from"@ikas/storefront-models";import"@ikas/localized-address";import{saveCustomer as m}from"../../../../store/customer/account-auth/functions.js";import{IkasCustomerFunctions as c}from"@ikas/storefront-model-functions";var f=function(){function f(e){var t=this;this.validatorRules=function(e){return void 0===e&&(e=!1),r([new u({model:t.customer,fieldKey:"firstName",valuePath:"firstName",message:t.message.requiredRule}),new u({model:t.customer,fieldKey:"lastName",valuePath:"lastName",message:t.message.requiredRule})],e?[new n({model:t.customer,fieldKey:"phone",valuePath:"phone",message:t.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(e){t.customer.firstName=e},this.onLastNameChange=function(e){t.customer.lastName=e},this.onPhoneChange=function(e){t.customer.phone=e||null,e||t.validator.setRules(t.validatorRules())},s(this,{firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,isMarketingAccepted:o,hasError:o,firstName:o,lastName:o,phone:o,validateAll:i,submit:i}),this.customer=e.customer,this.message=e.message,this.validator=new a(this.customer,this.validatorRules())}return Object.defineProperty(f.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(e){this.customer.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(e){this.customer.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(e){this.customer.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isMarketingAccepted",{get:function(){return(0,c.isCustomerSubscribedToEmails)(this.customer)},set:function(e){this.customer.subscriptionStatus=e?l.SUBSCRIBED:l.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"firstNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.firstName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"lastNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.lastName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"phoneErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),f.prototype.validateAll=function(){return this.validator.validateAll()},f.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,m(this.customer)];case 3:return t.sent()&&(e.isSuccess=!0),[2,e];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},f}();export{f as AccountInfoForm};
@@ -1 +1 @@
1
- import{__spreadArray as t,__awaiter as e,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as r,observable as n,action as d}from"mobx";import a from"lodash/cloneDeep";import{Validator as o}from"../index.js";import{PhoneRule as u,RequiredRule as l}from"../rules/index.js";import{listCountry as c,listState as m,listCity as h,listDistrict as p}from"@ikas/storefront-api";import{IkasStorefrontConfig as f}from"@ikas/storefront-config";import{FREE_TEXT_CITY_COUNTRY_LIST as g}from"../../../../utils/constants.js";import{IkasBaseStore as v}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/checkout/country-settings-model.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import{IkasCustomerAddress as y}from"../../../data/customer/address/index.js";import"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";var b=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},j=function(t){return{label:t.name,value:t.id+""}},x=function(){function x(g){var b=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.validatorRules=function(e){return void 0===e&&(e=!1),t([new l({model:b.address,fieldKey:"firstName",valuePath:"firstName",message:b.message.requiredRule}),new l({model:b.address,fieldKey:"lastName",valuePath:"lastName",message:b.message.requiredRule}),new l({model:b.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:b.message.requiredRule}),new l({model:b.address,fieldKey:"country",valuePath:"country",message:b.message.requiredRule}),new l({model:b.address,fieldKey:"state",valuePath:"state",message:b.message.requiredRule}),new l({model:b.address,fieldKey:"city",valuePath:"city",message:b.message.requiredRule}),new l({model:b.address,fieldKey:"title",valuePath:"title",message:b.message.requiredRule})],e?[new u({model:b.address,fieldKey:"phone",valuePath:"phone",message:b.message.phoneRule})]:[],!0)},this.onTitleChange=function(t){b.address.title=t},this.onFirstNameChange=function(t){b.address.firstName=t},this.onLastNameChange=function(t){b.address.lastName=t},this.onPhoneChange=function(t){b.address.phone=t,t||b.validator.setRules(b.validatorRules())},this.onAddressLine1Change=function(t){b.address.addressLine1=t},this.onAddressLine2Change=function(t){b.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){b.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=b.address.country)||void 0===e?void 0:e.id)!==t){var i=b.countries.find((function(e){return e.id===t}));b.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},b.address.state=null,b.address.city=null,b.address.district=null,b.states=[],b.cities=[],b.districts=[],b.listStates()}},this.onStateChange=function(t){var e;if((null===(e=b.address.state)||void 0===e?void 0:e.id)!==t){var i=b.states.find((function(e){return e.id===t}));b.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},b.address.city=null,b.address.district=null,b.cities=[],b.districts=[],b.listCities()}},this.onCityChange=function(t){var e;if((null===(e=b.address.city)||void 0===e?void 0:e.id)!==t){var i=b.cities.find((function(e){return e.id===t}));b.address.city={id:i.id,name:i.name,code:null},b.address.district=null,b.districts=[],b.listDistricts()}},this.onCityInputChange=function(t){b.districts=[],b.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=b.address.district)||void 0===e?void 0:e.id)!==t){var i=b.districts.find((function(e){return e.id===t}));b.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){b.address.district={id:null,name:t,code:null}},this.listCountries=function(){return e(b,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this._isCountriesPending=!0,[4,c({})];case 1:return t=i.sent(),e=f.getCurrentRouting(),s=t.data||[],(null===(r=null==e?void 0:e.countryCodes)||void 0===r?void 0:r.length)&&(s=s.filter((function(t){var i;return t.iso2&&(null===(i=e.countryCodes)||void 0===i?void 0:i.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country||this.onCountryChange(this.countries[0].id),this.countries=s,[3,4];case 2:return i.sent(),[3,4];case 3:return this._isCountriesPending=!1,[7];case 4:return[2]}}))}))},this.listStates=function(){return e(b,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,m({countryId:{eq:this.address.country.id}})];case 2:return t=i.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return e(b,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,h({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(r=this.address.country)||void 0===r?void 0:r.id}:void 0})];case 2:return t=i.sent(),this.cities=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return e(b,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,p({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(r=this.address.state)||void 0===r?void 0:r.id}:void 0})];case 2:return t=i.sent(),this.districts=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.validateAll=function(){return b.validator.validateAll()},this.submit=function(){return e(b,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return t={isFormError:!1,isSuccess:!1},this.address.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(i.sent())return t.isFormError=!0,[2,t];if(!(e=a(v.getInstance().customerStore.customer))||!this.address)return[2,t];(null==e?void 0:e.addresses)||(e.addresses=[]),this.isEdit?e.addresses[this.editingAddressIndex]=this.address:e.addresses.push(this.address),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,v.getInstance().customerStore.saveCustomer(e)];case 3:return i.sent()&&(t.isSuccess=!0),[2,t];case 4:return i.sent(),[2,t];case 5:return[2]}}))}))},s(this,{hasValidatorError:r,isEdit:r,results:r,editingAddressIndex:r,isFreeTextCity:r,isFreeTextDistrict:r,countries:n,states:n,cities:n,districts:n,_isCountriesPending:n,_isStatesPending:n,_isCitiesPending:n,_isDistrictsPending:n,isCountriesPending:r,isStatesPending:r,isCitiesPending:r,isDistrictsPending:r,onCountryChange:d,validateAll:d,submit:d}),this.address=g.address||new y({addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,id:"",createdAt:0,updatedAt:0}),this.message=g.message,this.validator=new o(this.address,this.validatorRules()),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts()}return Object.defineProperty(x.prototype,"isFreeTextCity",{get:function(){var t=this;return g.some((function(e){var i,s;return(null===(s=null===(i=t.address.country)||void 0===i?void 0:i.iso2)||void 0===s?void 0:s.toLowerCase())===e.toLowerCase()}))},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isFreeTextDistrict",{get:function(){return!this.districtOptions.length},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"editingAddressIndex",{get:function(){var t,e,i,s=this;return null!==(i=null===(e=null===(t=v.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.findIndex((function(t){return t.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"countryOptions",{get:function(){var t=this.countries.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"stateOptions",{get:function(){var t=this.states.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cityOptions",{get:function(){var t=this.cities.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"districtOptions",{get:function(){var t=this.districts.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),x}();export{x as AddressForm};
1
+ import{__spreadArray as e,__awaiter as t,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as n,observable as r,action as d}from"mobx";import o from"lodash/cloneDeep";import{Validator as a}from"../index.js";import{PhoneRule as u,RequiredRule as l}from"../rules/index.js";import{listCountry as c,listState as h,listCity as f,listDistrict as g}from"@ikas/storefront-api";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{FREE_TEXT_CITY_COUNTRY_LIST as m}from"../../../../utils/constants.js";import{IkasCustomerStore as p}from"../../../../store/customer/index.js";import{saveCustomer as y}from"../../../../store/customer/account-auth/functions.js";import{IkasCustomerAddressFunctions as b}from"@ikas/storefront-model-functions";var P=function(e){return e.sort((function(e,t){return e.label.localeCompare(t.label)}))},C=function(e){return{label:e.name,value:e.id+""}},j=function(){function j(m){var P=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.validatorRules=function(t){return void 0===t&&(t=!1),e([new l({model:P.address,fieldKey:"firstName",valuePath:"firstName",message:P.message.requiredRule}),new l({model:P.address,fieldKey:"lastName",valuePath:"lastName",message:P.message.requiredRule}),new l({model:P.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:P.message.requiredRule}),new l({model:P.address,fieldKey:"country",valuePath:"country",message:P.message.requiredRule}),new l({model:P.address,fieldKey:"state",valuePath:"state",message:P.message.requiredRule}),new l({model:P.address,fieldKey:"city",valuePath:"city",message:P.message.requiredRule}),new l({model:P.address,fieldKey:"title",valuePath:"title",message:P.message.requiredRule})],t?[new u({model:P.address,fieldKey:"phone",valuePath:"phone",message:P.message.phoneRule})]:[],!0)},this.onTitleChange=function(e){P.address.title=e},this.onFirstNameChange=function(e){P.address.firstName=e},this.onLastNameChange=function(e){P.address.lastName=e},this.onPhoneChange=function(e){P.address.phone=e,e||P.validator.setRules(P.validatorRules())},this.onAddressLine1Change=function(e){P.address.addressLine1=e},this.onAddressLine2Change=function(e){P.address.addressLine2=e},this.onAddressPostalCodeChange=function(e){P.address.postalCode=e},this.onCountryChange=function(e){var t;if((null===(t=P.address.country)||void 0===t?void 0:t.id)!==e){var i=P.countries.find((function(t){return t.id===e}));P.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},P.address.state=null,P.address.city=null,P.address.district=null,P.states=[],P.cities=[],P.districts=[],P.listStates()}},this.onStateChange=function(e){var t;if((null===(t=P.address.state)||void 0===t?void 0:t.id)!==e){var i=P.states.find((function(t){return t.id===e}));P.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},P.address.city=null,P.address.district=null,P.cities=[],P.districts=[],P.listCities()}},this.onCityChange=function(e){var t;if((null===(t=P.address.city)||void 0===t?void 0:t.id)!==e){var i=P.cities.find((function(t){return t.id===e}));P.address.city={id:i.id,name:i.name,code:null},P.address.district=null,P.districts=[],P.listDistricts()}},this.onCityInputChange=function(e){P.districts=[],P.address.city={id:null,name:e,code:null}},this.onDistrictChange=function(e){var t;if((null===(t=P.address.district)||void 0===t?void 0:t.id)!==e){var i=P.districts.find((function(t){return t.id===e}));P.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(e){P.address.district={id:null,name:e,code:null}},this.listCountries=function(){return t(P,void 0,void 0,(function(){var e,t,s,n;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this._isCountriesPending=!0,[4,c({})];case 1:return e=i.sent(),t=v.getCurrentRouting(),s=e.data||[],(null===(n=null==t?void 0:t.countryCodes)||void 0===n?void 0:n.length)&&(s=s.filter((function(e){var i;return e.iso2&&(null===(i=t.countryCodes)||void 0===i?void 0:i.includes(e.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country||this.onCountryChange(this.countries[0].id),this.countries=s,[3,4];case 2:return i.sent(),[3,4];case 3:return this._isCountriesPending=!1,[7];case 4:return[2]}}))}))},this.listStates=function(){return t(P,void 0,void 0,(function(){var e,t;return i(this,(function(i){switch(i.label){case 0:if(!(null===(t=this.address.country)||void 0===t?void 0:t.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,h({countryId:{eq:this.address.country.id}})];case 2:return e=i.sent(),this.states=e.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return t(P,void 0,void 0,(function(){var e,t,s,n;return i(this,(function(i){switch(i.label){case 0:if(!(null===(t=this.address.state)||void 0===t?void 0:t.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,f({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.country)||void 0===n?void 0:n.id}:void 0})];case 2:return e=i.sent(),this.cities=e.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return t(P,void 0,void 0,(function(){var e,t,s,n;return i(this,(function(i){switch(i.label){case 0:if(!(null===(t=this.address.city)||void 0===t?void 0:t.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,g({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.state)||void 0===n?void 0:n.id}:void 0})];case 2:return e=i.sent(),this.districts=e.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.validateAll=function(){return P.validator.validateAll()},this.submit=function(){return t(P,void 0,void 0,(function(){var e,t;return i(this,(function(i){switch(i.label){case 0:return e={isFormError:!1,isSuccess:!1},this.address.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(i.sent())return e.isFormError=!0,[2,e];if(!(t=o(p.customer))||!this.address)return[2,e];(null==t?void 0:t.addresses)||(t.addresses=[]),this.isEdit?t.addresses[this.editingAddressIndex]=this.address:t.addresses.push(this.address),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,y(t)];case 3:return i.sent()&&(e.isSuccess=!0),[2,e];case 4:return i.sent(),[2,e];case 5:return[2]}}))}))};var C=b.createCustomerAddress;s(this,{hasValidatorError:n,isEdit:n,results:n,editingAddressIndex:n,isFreeTextCity:n,isFreeTextDistrict:n,countries:r,states:r,cities:r,districts:r,_isCountriesPending:r,_isStatesPending:r,_isCitiesPending:r,_isDistrictsPending:r,isCountriesPending:n,isStatesPending:n,isCitiesPending:n,isDistrictsPending:n,onCountryChange:d,validateAll:d,submit:d}),this.address=m.address||C(),this.message=m.message,this.validator=new a(this.address,this.validatorRules()),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts()}return Object.defineProperty(j.prototype,"isFreeTextCity",{get:function(){var e=this;return m.some((function(t){var i,s;return(null===(s=null===(i=e.address.country)||void 0===i?void 0:i.iso2)||void 0===s?void 0:s.toLowerCase())===t.toLowerCase()}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isFreeTextDistrict",{get:function(){return!this.districtOptions.length},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"editingAddressIndex",{get:function(){var e,t,i,s=this;return null!==(i=null===(t=null===(e=p.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.findIndex((function(e){return e.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"countryOptions",{get:function(){var e=this.countries.map(C);return P(e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"stateOptions",{get:function(){var e=this.states.map(C);return P(e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"cityOptions",{get:function(){var e=this.cities.map(C);return P(e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"districtOptions",{get:function(){var e=this.districts.map(C);return P(e)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),j}();export{j as AddressForm};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as s,observable as a,action as i}from"mobx";import{Validator as o}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{RequiredRule as l,EmailRule as m}from"../rules/index.js";var u=function(){function u(e){var r=this;this.model={firstName:"",lastName:"",email:"",message:""},this.onFirstNameChange=function(e){r.firstName=e},this.onLastNameChange=function(e){r.lastName=e},this.onEmailChange=function(e){r.email=e},this.onMessageChange=function(e){r.message=e},t(this,{emailErrorMessage:s,messageErrorMessage:s,firstNameErrorMessage:s,lastNameErrorMessage:s,hasError:s,redirect:s,model:a,validateAll:i,saveContactForm:i}),this.validator=new o(this.model,[new l({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new l({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new l({fieldKey:"message",valuePath:"message",message:e.message.requiredRule}),new m({fieldKey:"email",valuePath:"email",message:e.message.emailRule})])}return Object.defineProperty(u.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"message",{get:function(){return this.model.message},set:function(e){this.model.message=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"messageErrorMessage",{get:function(){return this.validator.results.message.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),u.prototype.validateAll=function(){return this.validator.validateAll()},u.prototype.saveContactForm=function(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n.getInstance().customerStore.saveContactForm({firstName:this.model.firstName,lastName:this.model.lastName,email:this.model.email,message:this.model.message,referer:window.location.href})];case 3:return r.sent()&&(e.isSuccess=!0),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},u}();export{u as ContactForm};
1
+ import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as s,observable as a,action as i}from"mobx";import{Validator as o}from"../index.js";import{saveContactForm as n}from"../../../../store/customer/marketing/functions.js";import{RequiredRule as l,EmailRule as m}from"../rules/index.js";var u=function(){function u(e){var r=this;this.model={firstName:"",lastName:"",email:"",message:""},this.onFirstNameChange=function(e){r.firstName=e},this.onLastNameChange=function(e){r.lastName=e},this.onEmailChange=function(e){r.email=e},this.onMessageChange=function(e){r.message=e},t(this,{emailErrorMessage:s,messageErrorMessage:s,firstNameErrorMessage:s,lastNameErrorMessage:s,hasError:s,redirect:s,model:a,validateAll:i,saveContactForm:i}),this.validator=new o(this.model,[new l({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new l({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new l({fieldKey:"message",valuePath:"message",message:e.message.requiredRule}),new m({fieldKey:"email",valuePath:"email",message:e.message.emailRule})])}return Object.defineProperty(u.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"message",{get:function(){return this.model.message},set:function(e){this.model.message=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"messageErrorMessage",{get:function(){return this.validator.results.message.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),u.prototype.validateAll=function(){return this.validator.validateAll()},u.prototype.saveContactForm=function(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n({firstName:this.model.firstName,lastName:this.model.lastName,email:this.model.email,message:this.model.message,referer:window.location.href})];case 3:return r.sent()&&(e.isSuccess=!0),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},u}();export{u as ContactForm};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as r,computed as s,observable as o,action as i}from"mobx";import{Validator as n}from"../index.js";import{IkasBaseStore as a}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{RequiredRule as l,MinRule as u,MaxRule as m}from"../rules/index.js";var c=function(){function c(e){var t=this;this.model={title:"",comment:"",star:0},this.onTitleChange=function(e){t.title=e},this.onCommentChange=function(e){t.comment=e},this.onStarChange=function(e){t.star=e},r(this,{starErrorMessage:s,hasError:s,model:o,validateAll:i,submit:i}),this.productId=e.productId,this.validator=new n(this.model,[new l({fieldKey:"star",valuePath:"star",message:e.message.starRule}),new u({fieldKey:"star",valuePath:"star",minValue:1,message:e.message.starRule}),new m({fieldKey:"star",valuePath:"star",maxValue:5,message:e.message.starRule})])}return Object.defineProperty(c.prototype,"title",{get:function(){return this.model.title},set:function(e){this.model.title=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"comment",{get:function(){return this.model.comment},set:function(e){this.model.comment=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"star",{get:function(){return this.model.star},set:function(e){this.model.star=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"starErrorMessage",{get:function(){return this.validator.results.star.errorMessage},enumerable:!1,configurable:!0}),c.prototype.validateAll=function(){return this.validator.validateAll()},c.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,a.getInstance().customerStore.sendReview({title:this.model.title,comment:this.model.comment,star:this.model.star,productId:this.productId})];case 3:return t.sent()&&(e.isSuccess=!0),[2,e];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},c}();export{c as CustomerReviewForm};
1
+ import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as r,computed as s,observable as o,action as i}from"mobx";import{Validator as n}from"../index.js";import{sendReview as a}from"../../../../store/customer/product/functions.js";import{RequiredRule as l,MinRule as u,MaxRule as m}from"../rules/index.js";var c=function(){function c(t){var e=this;this.model={title:"",comment:"",star:0},this.onTitleChange=function(t){e.title=t},this.onCommentChange=function(t){e.comment=t},this.onStarChange=function(t){e.star=t},r(this,{starErrorMessage:s,hasError:s,model:o,validateAll:i,submit:i}),this.productId=t.productId,this.validator=new n(this.model,[new l({fieldKey:"star",valuePath:"star",message:t.message.starRule}),new u({fieldKey:"star",valuePath:"star",minValue:1,message:t.message.starRule}),new m({fieldKey:"star",valuePath:"star",maxValue:5,message:t.message.starRule})])}return Object.defineProperty(c.prototype,"title",{get:function(){return this.model.title},set:function(t){this.model.title=t},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"comment",{get:function(){return this.model.comment},set:function(t){this.model.comment=t},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"star",{get:function(){return this.model.star},set:function(t){this.model.star=t},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"starErrorMessage",{get:function(){return this.validator.results.star.errorMessage},enumerable:!1,configurable:!0}),c.prototype.validateAll=function(){return this.validator.validateAll()},c.prototype.submit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(e.sent())return t.isFormError=!0,[2,t];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,a({title:this.model.title,comment:this.model.comment,star:this.model.star,productId:this.productId})];case 3:return e.sent()&&(t.isSuccess=!0),[2,t];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},c}();export{c as CustomerReviewForm};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as i,observable as o,action as a}from"mobx";import{Validator as s}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{RequiredRule as l,EmailRule as m}from"../rules/index.js";var u=function(){function u(e){var r=this;this.model={email:""},this.onEmailChange=function(e){r.email=e},t(this,{emailErrorMessage:i,hasValidatorError:i,redirect:i,email:i,model:o,validateAll:a,submit:a}),this.validator=new s(this.model,[new l({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new m({fieldKey:"email",valuePath:"email",message:e.message.emailRule})])}return Object.defineProperty(u.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),u.prototype.validateAll=function(){return this.validator.validateAll()},u.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n.getInstance().customerStore.forgotPassword(this.model.email)];case 3:return r.sent()&&(e.isSuccess=!0),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},u}();export{u as ForgotPasswordForm};
1
+ import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as i,observable as o,action as a}from"mobx";import{Validator as s}from"../index.js";import{forgotPassword as n}from"../../../../store/customer/account-auth/functions.js";import{RequiredRule as l,EmailRule as u}from"../rules/index.js";var m=function(){function m(e){var r=this;this.model={email:""},this.onEmailChange=function(e){r.email=e},t(this,{emailErrorMessage:i,hasValidatorError:i,redirect:i,email:i,model:o,validateAll:a,submit:a}),this.validator=new s(this.model,[new l({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new u({fieldKey:"email",valuePath:"email",message:e.message.emailRule})])}return Object.defineProperty(m.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),m.prototype.validateAll=function(){return this.validator.validateAll()},m.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n(this.model.email)];case 3:return r.sent()&&(e.isSuccess=!0),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},m}();export{m as ForgotPasswordForm};
@@ -1,5 +1,5 @@
1
1
  import { IkasCity, IkasCountry, IkasDistrict, IkasLocalizedCustomerAddress, IkasState } from "../../../data";
2
- import { AddressFormItem } from "../../../data/checkout/country-settings-model";
2
+ import { AddressFormItem } from "@ikas/localized-address";
3
3
  declare type IkasAddressFormPropsValidatorMessage<T> = {
4
4
  requiredRule: ((model: T) => string) | string;
5
5
  invalidRule: ((model: T) => string) | string;
@@ -22,7 +22,6 @@ export declare class IkasAddressForm {
22
22
  private _isCitiesPending;
23
23
  private _isDistrictsPending;
24
24
  private message;
25
- private countrySettings;
26
25
  constructor(props: IkasAddressFormProps<IkasLocalizedCustomerAddress>);
27
26
  init: () => Promise<void>;
28
27
  onTitleChange: (value: string) => void;
@@ -63,29 +62,30 @@ export declare class IkasAddressForm {
63
62
  label: string;
64
63
  value: string;
65
64
  }[];
65
+ get isDistrictRequired(): boolean;
66
66
  get hasState(): boolean;
67
67
  get isCountriesPending(): boolean;
68
68
  get isStatesPending(): boolean;
69
69
  get isCitiesPending(): boolean;
70
70
  get isDistrictsPending(): boolean;
71
71
  get fieldSettings(): {
72
- firstName: import("../../../data").AddressFormField;
73
- lastName: import("../../../data").AddressFormField;
74
- identityNumber: import("../../../data").AddressFormField;
75
- phone: import("../../../data").AddressFormField;
76
- addressLine1: import("../../../data").AddressFormField;
77
- addressLine2: import("../../../data").AddressFormField;
78
- postalCode: import("../../../data").AddressFormField;
79
- country: import("../../../data").AddressFormField;
80
- state: import("../../../data").AddressFormField;
81
- city: import("../../../data").AddressFormField;
82
- district: import("../../../data").AddressFormField;
83
- company?: import("../../../data").AddressFormField | undefined;
84
- taxOffice?: import("../../../data").AddressFormField | undefined;
85
- taxNumber?: import("../../../data").AddressFormField | undefined;
86
- title: import("../../../data").AddressFormField;
72
+ firstName: import("@ikas/localized-address").AddressFormField;
73
+ lastName: import("@ikas/localized-address").AddressFormField;
74
+ identityNumber: import("@ikas/localized-address").AddressFormField;
75
+ addressLine1: import("@ikas/localized-address").AddressFormField;
76
+ addressLine2: import("@ikas/localized-address").AddressFormField;
77
+ postalCode: import("@ikas/localized-address").AddressFormField;
78
+ country: import("@ikas/localized-address").AddressFormField;
79
+ state: import("@ikas/localized-address").AddressFormField;
80
+ city: import("@ikas/localized-address").AddressFormField;
81
+ district: import("@ikas/localized-address").AddressFormField;
82
+ phone: import("@ikas/localized-address").AddressFormField;
83
+ company: import("@ikas/localized-address").AddressFormField;
84
+ taxOffice: import("@ikas/localized-address").AddressFormField;
85
+ taxNumber: import("@ikas/localized-address").AddressFormField;
86
+ title: import("@ikas/localized-address").AddressFormField;
87
87
  } | undefined;
88
- get fieldLabels(): import("../../../data").IkasAddressFormLabels | undefined;
88
+ get fieldLabels(): import("@ikas/localized-address").IkasAddressFormLabels | undefined;
89
89
  get addressFormat(): AddressFormItem[][] | undefined;
90
90
  get validationResult(): {
91
91
  firstName: {
@@ -96,6 +96,10 @@ export declare class IkasAddressForm {
96
96
  hasError: boolean;
97
97
  message: string;
98
98
  };
99
+ identityNumber: {
100
+ hasError: boolean;
101
+ message: string;
102
+ };
99
103
  addressLine1: {
100
104
  hasError: boolean;
101
105
  message: string;
@@ -104,6 +108,10 @@ export declare class IkasAddressForm {
104
108
  hasError: boolean;
105
109
  message: string;
106
110
  };
111
+ postalCode: {
112
+ hasError: boolean;
113
+ message: string;
114
+ };
107
115
  country: {
108
116
  hasError: boolean;
109
117
  message: string;
@@ -124,11 +132,15 @@ export declare class IkasAddressForm {
124
132
  hasError: boolean;
125
133
  message: string;
126
134
  };
127
- postalCode: {
135
+ company: {
128
136
  hasError: boolean;
129
137
  message: string;
130
138
  };
131
- identityNumber: {
139
+ taxOffice: {
140
+ hasError: boolean;
141
+ message: string;
142
+ };
143
+ taxNumber: {
132
144
  hasError: boolean;
133
145
  message: string;
134
146
  };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as i,observable as s,computed as n,action as r}from"mobx";import d from"lodash/cloneDeep";import{listCheckoutSettings as a,listCountry as o,listState as u,listCity as c,listDistrict as l}from"@ikas/storefront-api";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";import{IkasBaseStore as m}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import p,{AddressFormItem as f}from"../../../data/checkout/country-settings-model.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/index.js";import{IkasLocalizedCustomerAddress as g}from"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import y from"lodash/mapValues";import v from"../../../../store/location/index.js";var b=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},j=function(t){return{label:t.name,value:t.id+""}},x=function(){function x(f){var y=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this.isLoaded=!1,this.isFormSubmit=!1,this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.init=function(){return t(y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,a({})];case 1:return(t=e.sent()).isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)&&(this.countrySettings=new p({checkoutSettings:t.data[0]})),[4,this.countrySettings.waitUntilInitialized()];case 2:return e.sent(),this.address.countrySettings=this.countrySettings,this.isLoaded=!0,[2]}}))}))},this.onTitleChange=function(t){y.address.title=t},this.onFirstNameChange=function(t){y.address.firstName=t},this.onLastNameChange=function(t){y.address.lastName=t},this.onIdentityNumberChange=function(t){y.address.identityNumber=t},this.onPhoneChange=function(t){y.address.phone=t},this.onAddressLine1Change=function(t){y.address.addressLine1=t},this.onAddressLine2Change=function(t){y.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){y.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=y.address.country)||void 0===e?void 0:e.id)!==t){var i=y.countries.find((function(e){return e.id===t}));y.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},y.address.state=null,y.address.city=null,y.address.district=null,y.states=[],y.cities=[],y.districts=[],y.listStates()}},this.onStateChange=function(t){var e;if((null===(e=y.address.state)||void 0===e?void 0:e.id)!==t){var i=y.states.find((function(e){return e.id===t}));y.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},y.address.isFreeTextCity||(y.address.city=null,y.cities=[],y.listCities()),y.address.isFreeTextDistrict||(y.address.district=null,y.districts=[])}},this.onCityChange=function(t){var e;if((null===(e=y.address.city)||void 0===e?void 0:e.id)!==t){var i=y.cities.find((function(e){return e.id===t}));y.address.city={id:i.id,name:i.name,code:null},y.address.isFreeTextDistrict||(y.address.district=null,y.districts=[],y.listDistricts())}},this.onCityInputChange=function(t){y.districts=[],y.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=y.address.district)||void 0===e?void 0:e.id)!==t){var i=y.districts.find((function(e){return e.id===t}));y.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){y.address.district={id:null,name:t,code:null}},this.listCountries=function(){return t(y,void 0,void 0,(function(){var t,i,s,n,r,d,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,6,7]),this._isCountriesPending=!0,[4,o({})];case 1:return t=e.sent(),i=h.getCurrentRouting(),s=t.data||[],(null===(a=null==i?void 0:i.countryCodes)||void 0===a?void 0:a.length)&&(s=s.filter((function(t){var e;return t.iso2&&(null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country?[3,2]:(this.onCountryChange(this.countries[0].id),[3,4]);case 2:return!this.countries.length||this.address.country?[3,4]:[4,v.getMyCountry()];case 3:n=e.sent(),r=n.data,(d=this.countries.find((function(t){return t.iso2===r})))?this.onCountryChange(d.id):this.onCountryChange(this.countries[0].id),e.label=4;case 4:return this.countries=s,[3,7];case 5:return e.sent(),[3,7];case 6:return this._isCountriesPending=!1,[7];case 7:return[2]}}))}))},this.listStates=function(){return t(y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.country)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,u({countryId:{eq:this.address.country.id}})];case 2:return t=e.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return e.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return t(y,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.state)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,c({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.country)||void 0===n?void 0:n.id}:void 0})];case 2:return t=e.sent(),this.cities=t.data||[],[3,5];case 3:return e.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return t(y,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.city)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,l({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.state)||void 0===n?void 0:n.id}:void 0})];case 2:return t=e.sent(),this.districts=t.data||[],[3,5];case 3:return e.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.submit=function(){return t(y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(t={isFormError:!1,isSuccess:!1},this.isFormSubmit=!0,!this.address.isValidAddress)return t.isFormError=!0,[2,t];if(!(i=d(m.getInstance().customerStore.customer))||!this.address)return[2,t];(null==i?void 0:i.addresses)||(i.addresses=[]),this.isEdit?i.addresses[this.editingAddressIndex]=this.address:i.addresses.push(this.address),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,m.getInstance().customerStore.saveCustomer(i)];case 2:return e.sent()&&(t.isSuccess=!0),[2,t];case 3:return e.sent(),[2,t];case 4:return[2]}}))}))},i(this,{isLoaded:s,isEdit:n,editingAddressIndex:n,isFreeTextCity:n,isFreeTextDistrict:n,countries:s,states:s,cities:s,districts:s,_isCountriesPending:s,_isStatesPending:s,_isCitiesPending:s,_isDistrictsPending:s,isCountriesPending:n,isStatesPending:n,isCitiesPending:n,isDistrictsPending:n,onCountryChange:r,submit:r}),this.address=f.address||new g({addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,id:"",createdAt:0,updatedAt:0}),this.message=f.message,this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts(),this.countrySettings=new p,this.init()}return Object.defineProperty(x.prototype,"isFreeTextCity",{get:function(){return this.address.isFreeTextCity},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isFreeTextDistrict",{get:function(){return this.address.isFreeTextDistrict},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"editingAddressIndex",{get:function(){var t,e,i,s=this;return null!==(i=null===(e=null===(t=m.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.findIndex((function(t){return t.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"countryOptions",{get:function(){var t=this.countries.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"stateOptions",{get:function(){var t=this.states.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cityOptions",{get:function(){var t=this.cities.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"districtOptions",{get:function(){var t=this.districts.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fieldSettings",{get:function(){return this.address.fieldSettings},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fieldLabels",{get:function(){return this.address.fieldLabels},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"addressFormat",{get:function(){return this.countryOptions.length<=1?this.address.addressFormatIgnoreCountry:this.address.addressFormat},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"validationResult",{get:function(){var t=this;if(this.address.validationResults)return y(this.address.validationResults,(function(e,i){return{hasError:t.isFormSubmit&&e.hasError,message:t.isFormSubmit&&e.hasError?i===f.PHONE?t.message.phoneRule?"string"==typeof t.message.phoneRule?t.message.phoneRule:t.message.phoneRule(t.address):"":e.isInvalid?"string"==typeof t.message.invalidRule?t.message.invalidRule:t.message.invalidRule(t.address):"string"==typeof t.message.requiredRule?t.message.requiredRule:t.message.requiredRule(t.address):""}}))},enumerable:!1,configurable:!0}),x}();export{x as IkasAddressForm};
1
+ import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as i,observable as s,computed as n,action as r}from"mobx";import o from"lodash/cloneDeep";import{listCheckoutSettings as d,getMyCountry as a,listCountry as u,listState as c,listCity as l,listDistrict as h}from"@ikas/storefront-api";import{IkasStorefrontConfig as f}from"@ikas/storefront-config";import"../../../../store/base/index.js";import"lodash/flatten";import"lodash/sortBy";import"@ikas/storefront-model-functions";import"../../../../store/cart/index.js";import"../../../../components/checkout/types.js";import{IkasCustomerStore as m}from"../../../../store/customer/index.js";import"../../../../analytics/events.js";import"../../../../store/analytics/index.js";import"../../../../analytics/ikas.js";import"../../../../store/customer/consent/data.js";import"../../../../analytics/head/index.js";import"../../../../store/customer/account-auth/data.js";import{saveCustomer as g}from"../../../../store/customer/account-auth/functions.js";import"../../../../store/customer/product/data.js";import"lodash/xorBy";import"../../../../store/customer/captcha/data.js";import"@ikas/storefront-models";import{isFreeTextCity as p,isFreeTextDistrict as y,getFieldSettings as v,getFieldLabels as b,getAddressFormat as C,getAddressFormatIgnoreCountry as P,validateIkasLocalizedCustomerAddress as j,isValidLocalizedCustomerAddress as S}from"../../../data/localized-customer-address/functions.js";import{AddressFormItem as O,LocalizedAddressModel as _}from"@ikas/localized-address";import"../../../../store/customer/marketing/data.js";import"../../../../store/customer/order/data.js";import"@ikas/storefront-providers";import x from"lodash/mapValues";var D=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},I=function(t){return{label:t.name,value:t.id+""}},L=function(){function L(v){var b=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this.isLoaded=!1,this.isFormSubmit=!1,this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.init=function(){return t(b,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,d({})];case 1:return(t=e.sent()).isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)&&(this.address.checkoutSettings=t.data[0]),this.address.countrySettings=new _({currentLocale:f.getCurrentLocale()}),[4,this.address.countrySettings.waitUntilInitialized()];case 2:return e.sent(),this.isLoaded=!0,[2]}}))}))},this.onTitleChange=function(t){b.address.title=t},this.onFirstNameChange=function(t){b.address.firstName=t},this.onLastNameChange=function(t){b.address.lastName=t},this.onIdentityNumberChange=function(t){b.address.identityNumber=t},this.onPhoneChange=function(t){b.address.phone=t},this.onAddressLine1Change=function(t){b.address.addressLine1=t},this.onAddressLine2Change=function(t){b.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){b.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=b.address.country)||void 0===e?void 0:e.id)!==t){var i=b.countries.find((function(e){return e.id===t}));b.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},b.address.state=null,b.address.city=null,b.address.district=null,b.states=[],b.cities=[],b.districts=[],b.listStates()}},this.onStateChange=function(t){var e;if((null===(e=b.address.state)||void 0===e?void 0:e.id)!==t){var i=p,s=y,n=b.states.find((function(e){return e.id===t}));b.address.state={id:n.id,name:null==n?void 0:n.name,code:null==n?void 0:n.stateCode},i(b.address)||(b.address.city=null,b.cities=[],b.listCities()),s(b.address)||(b.address.district=null,b.districts=[])}},this.onCityChange=function(t){var e;if((null===(e=b.address.city)||void 0===e?void 0:e.id)!==t){var i=y,s=b.cities.find((function(e){return e.id===t}));b.address.city={id:s.id,name:s.name,code:null},i(b.address)||(b.address.district=null,b.districts=[],b.listDistricts())}},this.onCityInputChange=function(t){b.districts=[],b.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=b.address.district)||void 0===e?void 0:e.id)!==t){var i=b.districts.find((function(e){return e.id===t}));b.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){b.address.district={id:null,name:t,code:null}},this.listCountries=function(){return t(b,void 0,void 0,(function(){var t,i,s,n,r,o,d;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,6,7]),this._isCountriesPending=!0,[4,u({})];case 1:return t=e.sent(),i=f.getCurrentRouting(),s=t.data||[],(null===(d=null==i?void 0:i.countryCodes)||void 0===d?void 0:d.length)&&(s=s.filter((function(t){var e;return t.iso2&&(null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country?[3,2]:(this.onCountryChange(this.countries[0].id),[3,4]);case 2:return!this.countries.length||this.address.country?[3,4]:[4,a()];case 3:n=e.sent(),r=n.data,(o=this.countries.find((function(t){return t.iso2===r})))?this.onCountryChange(o.id):this.onCountryChange(this.countries[0].id),e.label=4;case 4:return this.countries=s,[3,7];case 5:return e.sent(),[3,7];case 6:return this._isCountriesPending=!1,[7];case 7:return[2]}}))}))},this.listStates=function(){return t(b,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.country)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,c({countryId:{eq:this.address.country.id}})];case 2:return t=e.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return e.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return t(b,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.state)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,l({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.country)||void 0===n?void 0:n.id}:void 0})];case 2:return t=e.sent(),this.cities=t.data||[],[3,5];case 3:return e.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return t(b,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.city)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,h({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.state)||void 0===n?void 0:n.id}:void 0})];case 2:return t=e.sent(),this.districts=t.data||[],[3,5];case 3:return e.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.submit=function(){return t(b,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:if(t={isFormError:!1,isSuccess:!1},i=S,this.isFormSubmit=!0,!i(this.address))return t.isFormError=!0,[2,t];if(!(s=o(m.customer))||!this.address)return[2,t];(null==s?void 0:s.addresses)||(s.addresses=[]),this.isEdit?s.addresses[this.editingAddressIndex]=this.address:s.addresses.push(this.address),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,g(s)];case 2:return e.sent()&&(t.isSuccess=!0),[2,t];case 3:return e.sent(),[2,t];case 4:return[2]}}))}))},i(this,{isLoaded:s,isEdit:n,editingAddressIndex:n,isFreeTextCity:n,isFreeTextDistrict:n,countries:s,states:s,cities:s,districts:s,_isCountriesPending:s,_isStatesPending:s,_isCitiesPending:s,_isDistrictsPending:s,isCountriesPending:n,isStatesPending:n,isCitiesPending:n,isDistrictsPending:n,onCountryChange:r,submit:r}),this.address=v.address||{addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,id:"",createdAt:0,updatedAt:0,countrySettings:null,checkoutSettings:null},this.message=v.message,this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts(),this.init()}return Object.defineProperty(L.prototype,"isFreeTextCity",{get:function(){return p(this.address)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isFreeTextDistrict",{get:function(){return y(this.address)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"editingAddressIndex",{get:function(){var t,e,i,s=this;return null!==(i=null===(e=null===(t=m.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.findIndex((function(t){return t.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"countryOptions",{get:function(){var t=this.countries.map(I);return D(t)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"stateOptions",{get:function(){var t=this.states.map(I);return D(t)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"cityOptions",{get:function(){var t=this.cities.map(I);return D(t)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"districtOptions",{get:function(){var t=this.districts.map(I);return D(t)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isDistrictRequired",{get:function(){return!!this.districts.length},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"fieldSettings",{get:function(){return v(this.address)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"fieldLabels",{get:function(){return b(this.address)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"addressFormat",{get:function(){var t=C,e=P;return this.countryOptions.length<=1?e(this.address):t(this.address)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"validationResult",{get:function(){var t=this,e=j(this.address);if(e)return x(e,(function(e,i){return{hasError:t.isFormSubmit&&e.hasError,message:t.isFormSubmit&&e.hasError?i===O.PHONE?t.message.phoneRule?"string"==typeof t.message.phoneRule?t.message.phoneRule:t.message.phoneRule(t.address):"":e.isInvalid?"string"==typeof t.message.invalidRule?t.message.invalidRule:t.message.invalidRule(t.address):"string"==typeof t.message.requiredRule?t.message.requiredRule:t.message.requiredRule(t.address):""}}))},enumerable:!1,configurable:!0}),L}();export{L as IkasAddressForm};