@ikas/storefront 5.0.24 → 5.0.25

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 (226) hide show
  1. package/build/analytics/analytics.js +1 -1
  2. package/build/analytics/googleAnalytics.js +1 -1
  3. package/build/analytics/googleTagManager.js +1 -1
  4. package/build/analytics/ikasV3.js +1 -1
  5. package/build/components/checkout/components/address-form/index.js +1 -1
  6. package/build/components/checkout/components/address-form/model.js +1 -1
  7. package/build/components/checkout/components/adyen/index.js +1 -1
  8. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  9. package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
  10. package/build/components/checkout/components/customer-addresses/model.js +1 -1
  11. package/build/components/checkout/components/customer-addresses/style.module.scss.js +1 -1
  12. package/build/components/checkout/components/form-item/index.js +1 -1
  13. package/build/components/checkout/components/form-item/model.d.ts +5 -0
  14. package/build/components/checkout/components/form-item/model.js +1 -1
  15. package/build/components/checkout/components/offer-product/select/style.module.scss.js +1 -1
  16. package/build/components/checkout/components/offer-product/style.module.scss.js +1 -1
  17. package/build/components/checkout/components/quick-registration/model.js +1 -1
  18. package/build/components/checkout/index.d.ts +1 -0
  19. package/build/components/checkout/index.js +1 -1
  20. package/build/components/checkout/model.d.ts +1 -1
  21. package/build/components/checkout/model.js +1 -1
  22. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  23. package/build/components/checkout/steps/step-success/index.js +1 -1
  24. package/build/components/checkout/steps/step-success/style.module.scss.js +1 -1
  25. package/build/components/checkout/style.module.scss.js +1 -1
  26. package/build/components/page/head.js +1 -1
  27. package/build/components/page/index.js +1 -1
  28. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  29. package/build/components/page-editor/model.js +1 -1
  30. package/build/components/popup/renderer/index.js +1 -1
  31. package/build/components/popup/utils/index.js +1 -1
  32. package/build/hooks/useCustomerReviews.js +1 -1
  33. package/build/hooks/useStore.js +1 -1
  34. package/build/index.js +1 -1
  35. package/build/models/data/index.d.ts +1 -0
  36. package/build/models/data/order/line-item/option/value/index.d.ts +2 -1
  37. package/build/models/data/order/line-item/option/value/index.js +1 -1
  38. package/build/models/data/order/order-transaction-with-prices/index.d.ts +16 -0
  39. package/build/models/data/order/order-transaction-with-prices/index.js +1 -0
  40. package/build/models/data/order/order-transaction-with-prices/list-order-transaction-refundable-transaction/index.d.ts +6 -0
  41. package/build/models/data/order/order-transaction-with-prices/list-order-transaction-refundable-transaction/index.js +1 -0
  42. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/error/index.d.ts +7 -0
  43. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/error/index.js +1 -0
  44. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/index.d.ts +54 -0
  45. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/index.js +1 -0
  46. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-currency-rate-with-prices/index.d.ts +6 -0
  47. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-currency-rate-with-prices/index.js +1 -0
  48. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-fee-with-prices/index.d.ts +7 -0
  49. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-fee-with-prices/index.js +1 -0
  50. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-gift-package-line-item-with-prices/index.d.ts +7 -0
  51. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-gift-package-line-item-with-prices/index.js +1 -0
  52. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-order-line-item-with-prices/index.d.ts +11 -0
  53. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-order-line-item-with-prices/index.js +1 -0
  54. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-order-line-item-with-prices/transaction-order-line-variant-with-prices/index.d.ts +11 -0
  55. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-order-line-item-with-prices/transaction-order-line-variant-with-prices/index.js +1 -0
  56. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-payment-method-detail-with-prices/index.d.ts +14 -0
  57. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-payment-method-detail-with-prices/index.js +1 -0
  58. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-payment-method-detail-with-prices/transaction-installment-price-with-prices/index.d.ts +9 -0
  59. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-payment-method-detail-with-prices/transaction-installment-price-with-prices/index.js +1 -0
  60. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-sales-channel-with-prices/index.d.ts +6 -0
  61. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-sales-channel-with-prices/index.js +1 -0
  62. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-shipping-line-item-with-prices/index.d.ts +9 -0
  63. package/build/models/data/order/order-transaction-with-prices/transaction-with-prices/transaction-shipping-line-item-with-prices/index.js +1 -0
  64. package/build/models/data/product/attribute-value/index.d.ts +3 -1
  65. package/build/models/data/product/attribute-value/index.js +1 -1
  66. package/build/models/data/product/index.d.ts +4 -5
  67. package/build/models/data/product/index.js +1 -1
  68. package/build/models/data/product/option-set/option/index.d.ts +11 -1
  69. package/build/models/data/product/option-set/option/index.js +1 -1
  70. package/build/models/data/product/variant/index.js +1 -1
  71. package/build/models/data/storefront-popup/index.js +1 -1
  72. package/build/models/data/theme-json/index.js +1 -1
  73. package/build/models/ui/blog-category-list/index.js +1 -1
  74. package/build/models/ui/brand-list/index.js +1 -1
  75. package/build/models/ui/category-list/index.js +1 -1
  76. package/build/models/ui/customer-review-list/index.js +1 -1
  77. package/build/models/ui/customer-review-summary-list/index.js +1 -1
  78. package/build/models/ui/product-list/index.js +1 -1
  79. package/build/models/ui/raffle-list/index.js +1 -1
  80. package/build/models/ui/validator/form/account-info.js +1 -1
  81. package/build/models/ui/validator/form/address.js +1 -1
  82. package/build/models/ui/validator/form/ikas-address.js +1 -1
  83. package/build/models/ui/validator/form/register.js +1 -1
  84. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -0
  85. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/divider-element-renderer/index.js +1 -0
  86. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -0
  87. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +1 -0
  88. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +1 -0
  89. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -0
  90. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -0
  91. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -0
  92. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -0
  93. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -0
  94. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -0
  95. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -0
  96. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/space-element-renderer/index.js +1 -0
  97. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/text-element-renderer/index.js +1 -0
  98. package/build/page-data-init/index.js +1 -1
  99. package/build/pages/checkout.js +1 -1
  100. package/build/store/blog/index.js +1 -1
  101. package/build/store/brand/index.js +1 -1
  102. package/build/store/cart/index.js +1 -1
  103. package/build/store/category/index.js +1 -1
  104. package/build/store/checkout/index.js +1 -1
  105. package/build/store/customer/api.d.ts +3 -2
  106. package/build/store/customer/api.js +1 -1
  107. package/build/store/customer/index.d.ts +4 -1
  108. package/build/store/customer/index.js +1 -1
  109. package/build/store/html-meta-data/index.js +1 -1
  110. package/build/store/location/index.js +1 -1
  111. package/build/store/product/index.js +1 -1
  112. package/package.json +11 -11
  113. package/build/analytics/ikas.js +0 -1
  114. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +0 -1
  115. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/divider-element-renderer/index.js +0 -1
  116. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +0 -1
  117. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +0 -1
  118. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +0 -1
  119. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +0 -1
  120. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +0 -1
  121. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +0 -1
  122. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +0 -1
  123. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +0 -1
  124. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +0 -1
  125. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +0 -1
  126. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/space-element-renderer/index.js +0 -1
  127. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/text-element-renderer/index.js +0 -1
  128. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouType.js +0 -0
  129. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +0 -0
  130. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +0 -0
  131. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +0 -0
  132. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js +0 -0
  133. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.util.js +0 -0
  134. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeParser.js +0 -0
  135. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeState.js +0 -0
  136. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js +0 -0
  137. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js +0 -0
  138. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js +0 -0
  139. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/constants.js +0 -0
  140. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/LRUCache.js +0 -0
  141. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/Leniency.js +0 -0
  142. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/RegExpCache.js +0 -0
  143. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js +0 -0
  144. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidPreCandidate.js +0 -0
  145. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js +0 -0
  146. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/parsePreCandidate.js +0 -0
  147. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/utf-8.js +0 -0
  148. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/util.js +0 -0
  149. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/format.js +0 -0
  150. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/RFC3966.js +0 -0
  151. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -0
  152. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -0
  153. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -0
  154. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -0
  155. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -0
  156. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -0
  157. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -0
  158. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -0
  159. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -0
  160. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -0
  161. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -0
  162. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -0
  163. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -0
  164. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -0
  165. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getNumberType.js +0 -0
  166. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -0
  167. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/isObject.js +0 -0
  168. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -0
  169. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -0
  170. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/mergeArrays.js +0 -0
  171. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/parseDigits.js +0 -0
  172. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -0
  173. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/isPossible.js +0 -0
  174. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/isValid.js +0 -0
  175. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/isValidPhoneNumber.js +0 -0
  176. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/legacy/findPhoneNumbersInitialImplementation.js +0 -0
  177. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js +0 -0
  178. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/normalizeArguments.js +0 -0
  179. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parse.js +0 -0
  180. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -0
  181. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parsePhoneNumber.js +0 -0
  182. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -0
  183. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parsePhoneNumber_.js +0 -0
  184. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/tools/semver-compare.js +0 -0
  185. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js +0 -0
  186. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/metadata.min.json.js +0 -0
  187. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js +0 -0
  188. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js +0 -0
  189. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js +0 -0
  190. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isValidPhoneNumber.js +0 -0
  191. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/withMetadataArgument.js +0 -0
  192. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js +0 -0
  193. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/assets/left-arrow.js +0 -0
  194. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/assets/right-arrow.js +0 -0
  195. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/assets/x-close.js +0 -0
  196. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +0 -0
  197. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/index.js +0 -0
  198. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js +0 -0
  199. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js +0 -0
  200. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js +0 -0
  201. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js +0 -0
  202. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js +0 -0
  203. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js +0 -0
  204. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js +0 -0
  205. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js +0 -0
  206. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-birthday/index.js +0 -0
  207. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-email/index.js +0 -0
  208. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js +0 -0
  209. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-name/index.js +0 -0
  210. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-phone/index.js +0 -0
  211. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-surname/index.js +0 -0
  212. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +0 -0
  213. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js +0 -0
  214. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +0 -0
  215. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +0 -0
  216. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js +0 -0
  217. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +0 -0
  218. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js +0 -0
  219. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js +0 -0
  220. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js +0 -0
  221. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js +0 -0
  222. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js +0 -0
  223. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/window-settings/index.js +0 -0
  224. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js +0 -0
  225. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js +0 -0
  226. /package/build/{ext → packages/storefront/ext}/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-time/index.js +0 -0
@@ -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{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType 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-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/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/customer-form-data-input/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/region/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 c,IkasProductFilterValue as u}from"../../data/product/filter/index.js";import"../../data/product/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";import p from"../../../store/product/index.js";import h from"query-string";import{SortByDirectionEnum as f,SortByTypeEnum as m,GetSuggestedProductsMethodEnum as g}from"@ikas/storefront-api";import{IkasStorefrontConfig as _}from"@ikas/storefront-config";import{Analytics as v}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{IkasProductVariantFunctions as y}from"@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"../../../pages/account/activate.js";import{IkasBaseStore as E}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var I,S,C,P,T,A=function(){function I(a,n){var u=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._recommendedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._disabledSortTypes=null,this.applyFilters=function(){return t(u,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(this._pageType)?(t&&this.setQueryParams(),[2]):[2]}}))}))},this.getSelectedVariant=function(t){return t.variants[0]},this.getInitial=function(r,s){return t(u,void 0,void 0,(function(){var t,o,a,n,d,c,u,p,h,f,m,g,_,v,I,S=this;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,E.getInstance().customerStore.getLastViewedProducts()];case 8:return(c=e.sent())&&c.length?(n=c.map((function(t){return t.productId})),d=E.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=E.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(u=p)&&this._fetchRequestTime===t?(h=[],!d&&this.isLastViewed&&E.getInstance().customerStore.setSavedLastViewedProductsResponse(u),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:E.getInstance().customerStore._lastViewedProducts,h=(null==f?void 0:f.map((function(t){var e,r,s=null===(r=null===(e=u.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)&&y.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&y.hasStock(t)}))),s&&o)return new l(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):h=(null===(_=null===(g=u.data)||void 0===g?void 0:g.data)||void 0===_?void 0:_.map((function(t){var e=S.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(v=u.data)||void 0===v?void 0:v.facets),this.data=h,this._count=(null===(I=u.data)||void 0===I?void 0:I.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return m=e.sent(),console.log(m),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(u,void 0,void 0,(function(){var t,r,s,o,a,n,d,c=this;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=c.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.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(),this.setIsStaticForProducts(),[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(u,void 0,void 0,(function(){var t,r,s,o,a,n,d=this;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=d.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.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(),this.setIsStaticForProducts(),[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(u,void 0,void 0,(function(){var t,s,o,a,n,d,c=this;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=c.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.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(),this.setIsStaticForProducts(),[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;u._infiniteScrollPage!==t&&(u._infiniteScrollPage=t,_.getIsEditor()||null===(e=u.router)||void 0===e||e.replace("".concat(location.pathname).concat(u.queryParams?"?"+u.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){u.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){v.search(u._searchKeyword,u.data.length)}),1e3);var p=a,h=a;if(this.data=a.data?a.data.map((function(t){return new l(t)})):[],this._type=p.type||h._type||p.productListPropValue.productListType||h._productListPropValue.productListType||S.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||C.LAST_ADDED,this._limit=a.limit||p.productListPropValue.initialLimit||h._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.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._recommendedProductData=p.recommendedProductData||h._recommendedProductData||null,this._viewedTogetherProductData=p.viewedTogetherProductData||h._viewedTogetherProductData||null,this._excludedFields=p.excludedFields||h._excludedFields||null,this._disabledSortTypes=p.disabledSortTypes||h._disabledSortTypes||null,this._recommendFor=p.recommendFor||h._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new c(t,u)})):null,this._filterCategories=a.filterCategories?a.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.setIsStaticForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===S.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(I.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFilterable",{get:function(){return this._type===S.ALL||this._type===S.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(I.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!==o.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(I.prototype,"isStatic",{get:function(){return this._type===S.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isDiscounted",{get:function(){return this._type===S.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommended",{get:function(){return this._type===S.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLastViewed",{get:function(){return this._type===S.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRelatedProducts",{get:function(){return this._type===S.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommendedProducts",{get:function(){return this._type===S.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isViewedTogetherProducts",{get:function(){return this._type===S.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isSearch",{get:function(){return this._type===S.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"queryParams",{get:function(){var t,e,i,r,s=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=D[this._sort]),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==o.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))a.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&&(a.c=d)}}return h.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.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(I.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[S.ALL,S.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),I.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},I.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},I.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[S.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=C.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=C.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=C.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=C.INCREASING_PRICE;break;case a.NEWEST:this._sort=C.LAST_ADDED;break;case a.OLDEST:this._sort=C.FIRST_ADDED;break;case a.MANUALLY:this._sort=C.FEATURED}},I.prototype.getSortParams=function(){var t,e;switch(this._sort){case C.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case C.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case C.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case C.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case C.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case C.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case C.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT;break;case C.DEFAULT:t=void 0,e=void 0;break;case C.AVERAGE_RATING:t=f.DESC,e=m.AVERAGE_RATING;break;case C.REVIEW_COUNT:t=f.DESC,e=m.REVIEW_COUNT;break;case C.SALE_COUNT:t=f.DESC,e=m.SALE_COUNT;break;case C.A_Z:t=f.ASC,e=m.NAME;break;case C.Z_A:t=f.DESC,e=m.NAME}if(t&&e)return{direction:t,type:e}},I.prototype.searchProducts=function(i,r,s){var a,d,c;return t(this,void 0,void 0,(function(){var t,l,h,f,m;return e(this,(function(e){switch(e.label){case 0:return t=[],l=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new u({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:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:case 7:return[2,e.sent()];case 2:return this.isRecommendedProducts&&this._recommendedProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),brandIds:this._recommendedProductData.brandIds,categoryIds:this._recommendedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,4];case 4:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),method:g.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:_.getCurrentLocale()})]:[3,6];case 6:return m={input:{page:i,perPage:r,productIdList:this.isStatic?null===(c=this._productListPropValue.productIds)||void 0===c?void 0:c.map((function(t){return t.productId})):s,filterList:t,facetList:l,brandId:this._pageType===o.BRAND&&this._type!==S.SEARCH?this._filterBrandId:void 0,categoryIdList:h&&h.length?h:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),query:this._searchKeyword,order:f?[f]:[],showStockOption:_.getStockPreference()||n.SHOW_ALL}},[4,p.searchProducts(m,this._excludedFields)]}}))}))},I.prototype.getFilters=function(){var i,r,s,a;return t(this,void 0,void 0,(function(){var t,n,d=this;return e(this,(function(e){switch(e.label){case 0:return[4,p.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:_.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 c(t,d)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this._disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,this.pageType!==o.CATEGORY&&this._filterCategoryId&&(n=null===(a=this._filterCategories)||void 0===a?void 0:a.find((function(t){return t.id===d._filterCategoryId})))&&(n.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},I.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");r&&(this._searchKeyword=r);var s=null==t?void 0:t.get("o");if(s){var a=parseInt(s),n=Object.entries(D).find((function(t){return t[1]===a}));n&&(this._sort=n[0])}if(this._pageType!==o.CATEGORY){var d=null==t?void 0:t.get("c"),c=null==d?void 0:d.split(",");c&&c.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=c.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},I.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})))},I.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||_.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},I.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==o.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},I.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()&&this.setQueryParams(),[2]}}))}))},I.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:_.getIsEditor()||null===(o=E.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},I.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}},I.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)}},I.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},I.prototype.isBrowser=function(){return"undefined"!=typeof window},I.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){E.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},I.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?v.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===S.ALL&&v.viewListing(this.data)},I}();!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",t.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(S||(S={})),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",t.AVERAGE_RATING="AVERAGE_RATING",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT",t.A_Z="A_Z",t.Z_A="Z_A"}(C||(C={})),function(t){t.AVERAGE_RATING="AVERAGE_RATING",t.CREATED_AT="CREATED_AT",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.MANUAL_SORT="MANUAL_SORT",t.NAME="NAME",t.PRICE="PRICE",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT"}(P||(P={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(T||(T={}));var D=((I={})[C.INCREASING_PRICE]=1,I[C.DECREASING_PRICE]=2,I[C.LAST_ADDED]=3,I[C.FIRST_ADDED]=4,I[C.INCREASING_DISCOUNT]=5,I[C.DECRASING_DISCOUNT]=6,I[C.FEATURED]=7,I[C.DEFAULT]=8,I[C.AVERAGE_RATING]=9,I[C.REVIEW_COUNT]=10,I[C.SALE_COUNT]=11,I[C.A_Z]=12,I[C.Z_A]=13,I);export{A as IkasProductList,P as IkasProductListSortByTypeEnum,C as IkasProductListSortType,S as IkasProductListType,T as IkasRelatedProductsType};
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{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType 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-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/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/customer-form-data-input/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/region/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/order-transaction-with-prices/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 c,IkasProductFilterValue as u}from"../../data/product/filter/index.js";import"../../data/product/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";import p from"../../../store/product/index.js";import h from"query-string";import{SortByDirectionEnum as f,SortByTypeEnum as m,GetSuggestedProductsMethodEnum as g}from"@ikas/storefront-api";import{IkasStorefrontConfig as _}from"@ikas/storefront-config";import{Analytics as v}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{IkasProductVariantFunctions as y}from"@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"../../../pages/account/activate.js";import{IkasBaseStore as E}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var I,S,C,P,T,A=function(){function I(a,n){var u=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._recommendedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._disabledSortTypes=null,this.applyFilters=function(){return t(u,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(this._pageType)?(t&&this.setQueryParams(),[2]):[2]}}))}))},this.getSelectedVariant=function(t){return t.variants[0]},this.getInitial=function(r,s){return t(u,void 0,void 0,(function(){var t,o,a,n,d,c,u,p,h,f,m,g,_,v,I,S=this;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,E.getInstance().customerStore.getLastViewedProducts()];case 8:return(c=e.sent())&&c.length?(n=c.map((function(t){return t.productId})),d=E.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=E.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(u=p)&&this._fetchRequestTime===t?(h=[],!d&&this.isLastViewed&&E.getInstance().customerStore.setSavedLastViewedProductsResponse(u),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:E.getInstance().customerStore._lastViewedProducts,h=(null==f?void 0:f.map((function(t){var e,r,s=null===(r=null===(e=u.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)&&y.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&y.hasStock(t)}))),s&&o)return new l(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):h=(null===(_=null===(g=u.data)||void 0===g?void 0:g.data)||void 0===_?void 0:_.map((function(t){var e=S.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(v=u.data)||void 0===v?void 0:v.facets),this.data=h,this._count=(null===(I=u.data)||void 0===I?void 0:I.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return m=e.sent(),console.log(m),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(u,void 0,void 0,(function(){var t,r,s,o,a,n,d,c=this;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=c.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.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(),this.setIsStaticForProducts(),[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(u,void 0,void 0,(function(){var t,r,s,o,a,n,d=this;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=d.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.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(),this.setIsStaticForProducts(),[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(u,void 0,void 0,(function(){var t,s,o,a,n,d,c=this;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=c.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.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(),this.setIsStaticForProducts(),[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;u._infiniteScrollPage!==t&&(u._infiniteScrollPage=t,_.getIsEditor()||null===(e=u.router)||void 0===e||e.replace("".concat(location.pathname).concat(u.queryParams?"?"+u.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){u.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){v.search(u._searchKeyword,u.data.length)}),1e3);var p=a,h=a;if(this.data=a.data?a.data.map((function(t){return new l(t)})):[],this._type=p.type||h._type||p.productListPropValue.productListType||h._productListPropValue.productListType||S.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||C.LAST_ADDED,this._limit=a.limit||p.productListPropValue.initialLimit||h._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.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._recommendedProductData=p.recommendedProductData||h._recommendedProductData||null,this._viewedTogetherProductData=p.viewedTogetherProductData||h._viewedTogetherProductData||null,this._excludedFields=p.excludedFields||h._excludedFields||null,this._disabledSortTypes=p.disabledSortTypes||h._disabledSortTypes||null,this._recommendFor=p.recommendFor||h._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new c(t,u)})):null,this._filterCategories=a.filterCategories?a.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.setIsStaticForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===S.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(I.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFilterable",{get:function(){return this._type===S.ALL||this._type===S.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(I.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!==o.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(I.prototype,"isStatic",{get:function(){return this._type===S.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isDiscounted",{get:function(){return this._type===S.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommended",{get:function(){return this._type===S.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLastViewed",{get:function(){return this._type===S.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRelatedProducts",{get:function(){return this._type===S.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommendedProducts",{get:function(){return this._type===S.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isViewedTogetherProducts",{get:function(){return this._type===S.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isSearch",{get:function(){return this._type===S.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"queryParams",{get:function(){var t,e,i,r,s=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=D[this._sort]),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==o.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))a.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&&(a.c=d)}}return h.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.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(I.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[S.ALL,S.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),I.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},I.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},I.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[S.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=C.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=C.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=C.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=C.INCREASING_PRICE;break;case a.NEWEST:this._sort=C.LAST_ADDED;break;case a.OLDEST:this._sort=C.FIRST_ADDED;break;case a.MANUALLY:this._sort=C.FEATURED}},I.prototype.getSortParams=function(){var t,e;switch(this._sort){case C.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case C.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case C.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case C.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case C.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case C.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case C.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT;break;case C.DEFAULT:t=void 0,e=void 0;break;case C.AVERAGE_RATING:t=f.DESC,e=m.AVERAGE_RATING;break;case C.REVIEW_COUNT:t=f.DESC,e=m.REVIEW_COUNT;break;case C.SALE_COUNT:t=f.DESC,e=m.SALE_COUNT;break;case C.A_Z:t=f.ASC,e=m.NAME;break;case C.Z_A:t=f.DESC,e=m.NAME}if(t&&e)return{direction:t,type:e}},I.prototype.searchProducts=function(i,r,s){var a,d,c;return t(this,void 0,void 0,(function(){var t,l,h,f,m;return e(this,(function(e){switch(e.label){case 0:return t=[],l=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new u({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:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:case 7:return[2,e.sent()];case 2:return this.isRecommendedProducts&&this._recommendedProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),brandIds:this._recommendedProductData.brandIds,categoryIds:this._recommendedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,4];case 4:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),method:g.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:_.getCurrentLocale()})]:[3,6];case 6:return m={input:{page:i,perPage:r,productIdList:this.isStatic?null===(c=this._productListPropValue.productIds)||void 0===c?void 0:c.map((function(t){return t.productId})):s,filterList:t,facetList:l,brandId:this._pageType===o.BRAND&&this._type!==S.SEARCH?this._filterBrandId:void 0,categoryIdList:h&&h.length?h:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),query:this._searchKeyword,order:f?[f]:[],showStockOption:_.getStockPreference()||n.SHOW_ALL}},[4,p.searchProducts(m,this._excludedFields)]}}))}))},I.prototype.getFilters=function(){var i,r,s,a;return t(this,void 0,void 0,(function(){var t,n,d=this;return e(this,(function(e){switch(e.label){case 0:return[4,p.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:_.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 c(t,d)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this._disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,this.pageType!==o.CATEGORY&&this._filterCategoryId&&(n=null===(a=this._filterCategories)||void 0===a?void 0:a.find((function(t){return t.id===d._filterCategoryId})))&&(n.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},I.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");r&&(this._searchKeyword=r);var s=null==t?void 0:t.get("o");if(s){var a=parseInt(s),n=Object.entries(D).find((function(t){return t[1]===a}));n&&(this._sort=n[0])}if(this._pageType!==o.CATEGORY){var d=null==t?void 0:t.get("c"),c=null==d?void 0:d.split(",");c&&c.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=c.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},I.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})))},I.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||_.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},I.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==o.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},I.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()&&this.setQueryParams(),[2]}}))}))},I.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:_.getIsEditor()||null===(o=E.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},I.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}},I.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)}},I.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},I.prototype.isBrowser=function(){return"undefined"!=typeof window},I.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){E.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},I.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?v.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===S.ALL&&v.viewListing(this.data)},I}();!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",t.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(S||(S={})),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",t.AVERAGE_RATING="AVERAGE_RATING",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT",t.A_Z="A_Z",t.Z_A="Z_A"}(C||(C={})),function(t){t.AVERAGE_RATING="AVERAGE_RATING",t.CREATED_AT="CREATED_AT",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.MANUAL_SORT="MANUAL_SORT",t.NAME="NAME",t.PRICE="PRICE",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT"}(P||(P={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(T||(T={}));var D=((I={})[C.INCREASING_PRICE]=1,I[C.DECREASING_PRICE]=2,I[C.LAST_ADDED]=3,I[C.FIRST_ADDED]=4,I[C.INCREASING_DISCOUNT]=5,I[C.DECRASING_DISCOUNT]=6,I[C.FEATURED]=7,I[C.DEFAULT]=8,I[C.AVERAGE_RATING]=9,I[C.REVIEW_COUNT]=10,I[C.SALE_COUNT]=11,I[C.A_Z]=12,I[C.Z_A]=13,I);export{A as IkasProductList,P as IkasProductListSortByTypeEnum,C as IkasProductListSortType,S as IkasProductListType,T as IkasRelatedProductsType};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{populateRaffleProducts as e}from"@ikas/storefront-providers";import{makeAutoObservable as a,runInAction as r}from"mobx";import n from"../../../store/raffle/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-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/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/customer-form-data-input/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/region/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/campaign-offer/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{IkasRaffle as o}from"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var s=function(){function s(e){void 0===e&&(e={});var n=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getPrev=function(){return t(n,void 0,void 0,(function(){var t,e,a,r,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.getRaffleList(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(n=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(n,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(n,void 0,void 0,(function(){var t,a,n=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(e,this.limit)];case 2:return t=i.sent(),r((function(){var i,a;n.data=(null===(i=t.data)||void 0===i?void 0:i.data)||[],n._count=(null===(a=t.data)||void 0===a?void 0:a.count)||0,n._page=e,n._minPage=e})),[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new o(t)})):[],this._limit=e.limit||20,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._minPage=e.minPage||null,this._start=e.start||null,this._end=e.end||null,this._includeDeleted=e.includeDeleted||null,this._name=e.name||null,this._search=e.search||null,this._id=e.id||null,a(this)}return Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),s.prototype.getRaffleList=function(a,r){var o;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,n.listStorefrontRaffle({start:this._start?{eq:this._start}:void 0,end:this._end?{eq:this._end}:void 0,includeDeleted:this._includeDeleted||!1,name:this._name?{eq:this._name}:void 0,id:this._id?{eq:this._id}:void 0,search:this._search||void 0,pagination:{limit:r,page:a}})];case 1:return t=i.sent(),[4,e((null===(o=t.data)||void 0===o?void 0:o.data)||[])];case 2:return i.sent(),[2,t]}}))}))},s.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage}},s}();export{s as IkasRaffleList};
1
+ import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{populateRaffleProducts as e}from"@ikas/storefront-providers";import{makeAutoObservable as a,runInAction as r}from"mobx";import n from"../../../store/raffle/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-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/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/customer-form-data-input/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/region/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/order-transaction-with-prices/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/campaign-offer/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{IkasRaffle as o}from"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var s=function(){function s(e){void 0===e&&(e={});var n=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getPrev=function(){return t(n,void 0,void 0,(function(){var t,e,a,r,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.getRaffleList(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(n=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(n,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(n,void 0,void 0,(function(){var t,a,n=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(e,this.limit)];case 2:return t=i.sent(),r((function(){var i,a;n.data=(null===(i=t.data)||void 0===i?void 0:i.data)||[],n._count=(null===(a=t.data)||void 0===a?void 0:a.count)||0,n._page=e,n._minPage=e})),[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new o(t)})):[],this._limit=e.limit||20,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._minPage=e.minPage||null,this._start=e.start||null,this._end=e.end||null,this._includeDeleted=e.includeDeleted||null,this._name=e.name||null,this._search=e.search||null,this._id=e.id||null,a(this)}return Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),s.prototype.getRaffleList=function(a,r){var o;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,n.listStorefrontRaffle({start:this._start?{eq:this._start}:void 0,end:this._end?{eq:this._end}:void 0,includeDeleted:this._includeDeleted||!1,name:this._name?{eq:this._name}:void 0,id:this._id?{eq:this._id}:void 0,search:this._search||void 0,pagination:{limit:r,page:a}})];case 1:return t=i.sent(),[4,e((null===(o=t.data)||void 0===o?void 0:o.data)||[])];case 2:return i.sent(),[2,t]}}))}))},s.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage}},s}();export{s as IkasRaffleList};
@@ -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 p}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/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/customer-form-data-input/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/region/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var u=function(){function u(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(u.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(t){this.customer.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(t){this.customer.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(t){this.customer.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isMarketingAccepted",{get:function(){return this.customer.isSubscribed},set:function(t){this.customer.subscriptionStatus=t?p.SUBSCRIBED:p.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(u.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(u.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(u.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}),u.prototype.validateAll=function(){return this.validator.validateAll()},u.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]}}))}))},u}();export{u as AccountInfoForm};
1
+ import{__awaiter as t,__generator as e,__spreadArray as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as i,computed as a,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 p}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/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/customer-form-data-input/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/region/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/order-transaction-with-prices/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var u=function(){function u(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())},i(this,{firstNameErrorMessage:a,lastNameErrorMessage:a,phoneErrorMessage:a,isMarketingAccepted:a,hasError:a,firstName:a,lastName:a,phone:a,validateAll:o,submit:o}),this.customer=t.customer,this.message=t.message,this.validator=new s(this.customer,this.validatorRules())}return Object.defineProperty(u.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(t){this.customer.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(t){this.customer.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(t){this.customer.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isMarketingAccepted",{get:function(){return this.customer.isSubscribed},set:function(t){this.customer.subscriptionStatus=t?p.SUBSCRIBED:p.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(u.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(u.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(u.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}),u.prototype.validateAll=function(){return this.validator.validateAll()},u.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]}}))}))},u}();export{u 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 p,listCity as m,listDistrict as h}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/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/customer-form-data-input/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/region/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var j=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},x=function(t){return{label:t.name,value:t.id+""}},b=function(){function b(g){var j=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:j.address,fieldKey:"firstName",valuePath:"firstName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"lastName",valuePath:"lastName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"country",valuePath:"country",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"state",valuePath:"state",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"city",valuePath:"city",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"title",valuePath:"title",message:j.message.requiredRule})],e?[new u({model:j.address,fieldKey:"phone",valuePath:"phone",message:j.message.phoneRule})]:[],!0)},this.onTitleChange=function(t){j.address.title=t},this.onFirstNameChange=function(t){j.address.firstName=t},this.onLastNameChange=function(t){j.address.lastName=t},this.onPhoneChange=function(t){j.address.phone=t,t||j.validator.setRules(j.validatorRules())},this.onAddressLine1Change=function(t){j.address.addressLine1=t},this.onAddressLine2Change=function(t){j.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){j.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=j.address.country)||void 0===e?void 0:e.id)!==t){var i=j.countries.find((function(e){return e.id===t}));j.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},j.address.state=null,j.address.city=null,j.address.district=null,j.states=[],j.cities=[],j.districts=[],j.listStates()}},this.onStateChange=function(t){var e;if((null===(e=j.address.state)||void 0===e?void 0:e.id)!==t){var i=j.states.find((function(e){return e.id===t}));j.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},j.address.city=null,j.address.district=null,j.cities=[],j.districts=[],j.listCities()}},this.onCityChange=function(t){var e;if((null===(e=j.address.city)||void 0===e?void 0:e.id)!==t){var i=j.cities.find((function(e){return e.id===t}));j.address.city={id:i.id,name:i.name,code:null},j.address.district=null,j.districts=[],j.listDistricts()}},this.onCityInputChange=function(t){j.districts=[],j.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=j.address.district)||void 0===e?void 0:e.id)!==t){var i=j.districts.find((function(e){return e.id===t}));j.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){j.address.district={id:null,name:t,code:null}},this.listCountries=function(){return e(j,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(j,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,p({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(j,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,m({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(j,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,h({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 j.validator.validateAll()},this.submit=function(){return e(j,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(b.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(b.prototype,"isFreeTextDistrict",{get:function(){return!this.districtOptions.length},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(b.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(b.prototype,"countryOptions",{get:function(){var t=this.countries.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"stateOptions",{get:function(){var t=this.states.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"cityOptions",{get:function(){var t=this.cities.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"districtOptions",{get:function(){var t=this.districts.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),b}();export{b as AddressForm};
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 p,listCity as m,listDistrict as h}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/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/customer-form-data-input/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/region/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/order-transaction-with-prices/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var j=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},x=function(t){return{label:t.name,value:t.id+""}},b=function(){function b(g){var j=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:j.address,fieldKey:"firstName",valuePath:"firstName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"lastName",valuePath:"lastName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"country",valuePath:"country",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"state",valuePath:"state",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"city",valuePath:"city",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"title",valuePath:"title",message:j.message.requiredRule})],e?[new u({model:j.address,fieldKey:"phone",valuePath:"phone",message:j.message.phoneRule})]:[],!0)},this.onTitleChange=function(t){j.address.title=t},this.onFirstNameChange=function(t){j.address.firstName=t},this.onLastNameChange=function(t){j.address.lastName=t},this.onPhoneChange=function(t){j.address.phone=t,t||j.validator.setRules(j.validatorRules())},this.onAddressLine1Change=function(t){j.address.addressLine1=t},this.onAddressLine2Change=function(t){j.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){j.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=j.address.country)||void 0===e?void 0:e.id)!==t){var i=j.countries.find((function(e){return e.id===t}));j.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},j.address.state=null,j.address.city=null,j.address.district=null,j.states=[],j.cities=[],j.districts=[],j.listStates()}},this.onStateChange=function(t){var e;if((null===(e=j.address.state)||void 0===e?void 0:e.id)!==t){var i=j.states.find((function(e){return e.id===t}));j.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},j.address.city=null,j.address.district=null,j.cities=[],j.districts=[],j.listCities()}},this.onCityChange=function(t){var e;if((null===(e=j.address.city)||void 0===e?void 0:e.id)!==t){var i=j.cities.find((function(e){return e.id===t}));j.address.city={id:i.id,name:i.name,code:null},j.address.district=null,j.districts=[],j.listDistricts()}},this.onCityInputChange=function(t){j.districts=[],j.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=j.address.district)||void 0===e?void 0:e.id)!==t){var i=j.districts.find((function(e){return e.id===t}));j.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){j.address.district={id:null,name:t,code:null}},this.listCountries=function(){return e(j,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(j,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,p({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(j,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,m({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(j,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,h({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 j.validator.validateAll()},this.submit=function(){return e(j,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(b.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(b.prototype,"isFreeTextDistrict",{get:function(){return!this.districtOptions.length},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(b.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(b.prototype,"countryOptions",{get:function(){var t=this.countries.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"stateOptions",{get:function(){var t=this.states.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"cityOptions",{get:function(){var t=this.cities.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"districtOptions",{get:function(){var t=this.districts.map(x);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),b}();export{b as AddressForm};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as e,observable as s,computed as n,action as r}from"mobx";import d from"lodash/cloneDeep";import{listCheckoutSettings as o,listCountry as a,listState as u,listCity as l,listDistrict as c}from"@ikas/storefront-api";import{IkasStorefrontConfig as p}from"@ikas/storefront-config";import{IkasBaseStore as h}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/index.js";import"../../../data/customer/address/index.js";import{IkasLocalizedCustomerAddress as m}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/customer-form-data-input/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{IkasOrderAddressRegion as f}from"../../../data/order/address/region/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import{AddressFormItem as g,LocalizedAddressModel as v}from"@ikas/localized-address";import y from"lodash/mapValues";import b from"../../../../store/location/index.js";import{stringSorter as j}from"../../../../utils/helper.js";var x=function(t){return t.sort((function(t,i){return t.label.localeCompare(i.label)}))},C=function(t){return{label:t.name,value:t.id+""}},P=function(){function P(g){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,e,s,n;return i(this,(function(i){switch(i.label){case 0:return this.address.countrySettings=new v({currentLocale:p.getCurrentLocale()}),[4,this.address.countrySettings.waitUntilInitialized()];case 1:return i.sent(),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts(),[4,o({})];case 2:return t=i.sent(),[4,b.getAvailableShippingZones({salesChannelId:p.getSalesChannelId()})];case 3:return e=i.sent(),t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.length)&&(this.address.checkoutSettings=t.data[0]),e.isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.length)&&(this.address.shippingZones=e.data),this.address.getValidatedCustomerAddress(),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 i;if((null===(i=y.address.country)||void 0===i?void 0:i.id)!==t){var e=y.countries.find((function(i){return i.id===t}));y.address.country={id:(null==e?void 0:e.id)||null,name:(null==e?void 0:e.name)||"",code:(null==e?void 0:e.iso3)||null,iso2:(null==e?void 0:e.iso2)||null,iso3:(null==e?void 0:e.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 i;if((null===(i=y.address.state)||void 0===i?void 0:i.id)!==t){var e=y.states.find((function(i){return i.id===t}));y.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.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 i;if((null===(i=y.address.city)||void 0===i?void 0:i.id)!==t){var e=y.cities.find((function(i){return i.id===t}));y.address.city={id:e.id,name:e.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 i;if((null===(i=y.address.district)||void 0===i?void 0:i.id)!==t){var e=y.districts.find((function(i){return i.id===t}));y.address.district={id:e.id,name:e.name,code:null},y.address.region=null}},this.onDistrictInputChange=function(t){y.address.district={id:null,name:t,code:null}},this.onRegionChange=function(t){var i,e,s;if((null===(i=y.address.region)||void 0===i?void 0:i.id)!==t){var n=null===(s=null===(e=y.shippingZoneDistrict)||void 0===e?void 0:e.regions)||void 0===s?void 0:s.find((function(i){return i.id===t}));y.address.region=new f({id:n.id,name:n.name})}},this.listCountries=function(){return t(y,void 0,void 0,(function(){var t,e,s,n,r,d,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,5,6,7]),this._isCountriesPending=!0,[4,a({})];case 1:return t=i.sent(),e=p.getCurrentRouting(),s=t.data||[],(null===(o=null==e?void 0:e.countryCodes)||void 0===o?void 0:o.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?[3,2]:(this.onCountryChange(this.countries[0].id),[3,4]);case 2:return!this.countries.length||this.address.country?[3,4]:[4,b.getMyCountry()];case 3:n=i.sent(),r=n.data,(d=this.countries.find((function(t){return t.iso2===r})))?this.onCountryChange(d.id):this.onCountryChange(this.countries[0].id),i.label=4;case 4:return this.countries=s,[3,7];case 5:return i.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,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,u({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 t(y,void 0,void 0,(function(){var t,e,s,n;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,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=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 t(y,void 0,void 0,(function(){var t,e,s,n;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,c({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=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.submit=function(){return t(y,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(t={isFormError:!1,isSuccess:!1},this.isFormSubmit=!0,!this.address.isValidAddress)return t.isFormError=!0,[2,t];if(!(e=d(h.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=1;case 1:return i.trys.push([1,3,,4]),[4,h.getInstance().customerStore.saveCustomer(e)];case 2:return i.sent()&&(t.isSuccess=!0),[2,t];case 3:return i.sent(),[2,t];case 4:return[2]}}))}))},e(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=g.address||new m({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,region:null,id:"",createdAt:0,updatedAt:0}),this.message=g.message,this.init()}return Object.defineProperty(P.prototype,"shippingZone",{get:function(){var t,i=this;return null===(t=this.address.shippingZones)||void 0===t?void 0:t.find((function(t){var e;return t.countryId===(null===(e=i.address.country)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneState",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.state)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneCity",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneState)||void 0===t?void 0:t.cities)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.city)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneDistrict",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneCity)||void 0===t?void 0:t.districts)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.district)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneRegion",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.region)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFreeTextCity",{get:function(){return this.address.isFreeTextCity},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFreeTextDistrict",{get:function(){return this.address.isFreeTextDistrict},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"editingAddressIndex",{get:function(){var t,i,e,s=this;return null!==(e=null===(i=null===(t=h.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===i?void 0:i.findIndex((function(t){return t.id===s.address.id})))&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"countryOptions",{get:function(){var t=this.countries.map(C);return x(t)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"stateOptions",{get:function(){var t,i,e=this,s=this.states.map(C);return this.shippingZone&&!this.shippingZone.showAllStates&&(null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.length)&&(s=s.filter((function(t){var i,s;return null===(s=null===(i=e.shippingZone)||void 0===i?void 0:i.states)||void 0===s?void 0:s.some((function(i){return i.id===t.value}))}))),x(s)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"cityOptions",{get:function(){var t,i,e,s=this,n=this.cities.map(C);return this.shippingZone&&!(null===(t=this.shippingZoneState)||void 0===t?void 0:t.showAllCities)&&(null===(e=null===(i=this.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.length)&&(n=n.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),x(n)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"districtOptions",{get:function(){var t,i,e,s=this,n=this.districts.map(C);return this.shippingZone&&!(null===(t=this.shippingZoneCity)||void 0===t?void 0:t.showAllDistricts)&&(null===(e=null===(i=this.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.length)&&(n=n.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),x(n)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"regionOptions",{get:function(){var t,i;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.map(C).sort((function(t,i){return j(t.label,i.label)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fieldSettings",{get:function(){return this.address.fieldSettings},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fieldLabels",{get:function(){return this.address.fieldLabels},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"addressFormat",{get:function(){return this.countryOptions.length<=1?this.address.addressFormatIgnoreCountry:this.address.addressFormat},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"validationResult",{get:function(){var t=this;if(this.address.validationResults)return y(this.address.validationResults,(function(i,e){return{hasError:t.isFormSubmit&&i.hasError,message:t.isFormSubmit&&i.hasError?e===g.PHONE?t.message.phoneRule?"string"==typeof t.message.phoneRule?t.message.phoneRule:t.message.phoneRule(t.address):"":i.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}),P}();export{P as IkasAddressForm};
1
+ import{__awaiter as t,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as e,observable as s,computed as n,action as r}from"mobx";import d from"lodash/cloneDeep";import{listCheckoutSettings as o,listCountry as a,listState as u,listCity as l,listDistrict as c}from"@ikas/storefront-api";import{IkasStorefrontConfig as p}from"@ikas/storefront-config";import{IkasBaseStore as h}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/index.js";import"../../../data/customer/address/index.js";import{IkasLocalizedCustomerAddress as m}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/customer-form-data-input/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{IkasOrderAddressRegion as f}from"../../../data/order/address/region/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/order-transaction-with-prices/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import{AddressFormItem as g,LocalizedAddressModel as v}from"@ikas/localized-address";import y from"lodash/mapValues";import b from"../../../../store/location/index.js";import{stringSorter as j}from"../../../../utils/helper.js";var x=function(t){return t.sort((function(t,i){return t.label.localeCompare(i.label)}))},C=function(t){return{label:t.name,value:t.id+""}},P=function(){function P(g){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,e,s,n;return i(this,(function(i){switch(i.label){case 0:return this.address.countrySettings=new v({currentLocale:p.getCurrentLocale()}),[4,this.address.countrySettings.waitUntilInitialized()];case 1:return i.sent(),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts(),[4,o({})];case 2:return t=i.sent(),[4,b.getAvailableShippingZones({salesChannelId:p.getSalesChannelId()})];case 3:return e=i.sent(),t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.length)&&(this.address.checkoutSettings=t.data[0]),e.isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.length)&&(this.address.shippingZones=e.data),this.address.getValidatedCustomerAddress(),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 i;if((null===(i=y.address.country)||void 0===i?void 0:i.id)!==t){var e=y.countries.find((function(i){return i.id===t}));y.address.country={id:(null==e?void 0:e.id)||null,name:(null==e?void 0:e.name)||"",code:(null==e?void 0:e.iso3)||null,iso2:(null==e?void 0:e.iso2)||null,iso3:(null==e?void 0:e.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 i;if((null===(i=y.address.state)||void 0===i?void 0:i.id)!==t){var e=y.states.find((function(i){return i.id===t}));y.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.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 i;if((null===(i=y.address.city)||void 0===i?void 0:i.id)!==t){var e=y.cities.find((function(i){return i.id===t}));y.address.city={id:e.id,name:e.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 i;if((null===(i=y.address.district)||void 0===i?void 0:i.id)!==t){var e=y.districts.find((function(i){return i.id===t}));y.address.district={id:e.id,name:e.name,code:null},y.address.region=null}},this.onDistrictInputChange=function(t){y.address.district={id:null,name:t,code:null}},this.onRegionChange=function(t){var i,e,s;if((null===(i=y.address.region)||void 0===i?void 0:i.id)!==t){var n=null===(s=null===(e=y.shippingZoneDistrict)||void 0===e?void 0:e.regions)||void 0===s?void 0:s.find((function(i){return i.id===t}));y.address.region=new f({id:n.id,name:n.name})}},this.listCountries=function(){return t(y,void 0,void 0,(function(){var t,e,s,n,r,d,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,5,6,7]),this._isCountriesPending=!0,[4,a({})];case 1:return t=i.sent(),e=p.getCurrentRouting(),s=t.data||[],(null===(o=null==e?void 0:e.countryCodes)||void 0===o?void 0:o.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?[3,2]:(this.onCountryChange(this.countries[0].id),[3,4]);case 2:return!this.countries.length||this.address.country?[3,4]:[4,b.getMyCountry()];case 3:n=i.sent(),r=n.data,(d=this.countries.find((function(t){return t.iso2===r})))?this.onCountryChange(d.id):this.onCountryChange(this.countries[0].id),i.label=4;case 4:return this.countries=s,[3,7];case 5:return i.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,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,u({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 t(y,void 0,void 0,(function(){var t,e,s,n;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,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=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 t(y,void 0,void 0,(function(){var t,e,s,n;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,c({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=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.submit=function(){return t(y,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(t={isFormError:!1,isSuccess:!1},this.isFormSubmit=!0,!this.address.isValidAddress)return t.isFormError=!0,[2,t];if(!(e=d(h.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=1;case 1:return i.trys.push([1,3,,4]),[4,h.getInstance().customerStore.saveCustomer(e)];case 2:return i.sent()&&(t.isSuccess=!0),[2,t];case 3:return i.sent(),[2,t];case 4:return[2]}}))}))},e(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=g.address||new m({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,region:null,id:"",createdAt:0,updatedAt:0}),this.message=g.message,this.init()}return Object.defineProperty(P.prototype,"shippingZone",{get:function(){var t,i=this;return null===(t=this.address.shippingZones)||void 0===t?void 0:t.find((function(t){var e;return t.countryId===(null===(e=i.address.country)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneState",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.state)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneCity",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneState)||void 0===t?void 0:t.cities)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.city)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneDistrict",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneCity)||void 0===t?void 0:t.districts)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.district)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneRegion",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.region)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFreeTextCity",{get:function(){return this.address.isFreeTextCity},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFreeTextDistrict",{get:function(){return this.address.isFreeTextDistrict},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"editingAddressIndex",{get:function(){var t,i,e,s=this;return null!==(e=null===(i=null===(t=h.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===i?void 0:i.findIndex((function(t){return t.id===s.address.id})))&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"countryOptions",{get:function(){var t=this.countries.map(C);return x(t)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"stateOptions",{get:function(){var t,i,e=this,s=this.states.map(C);return this.shippingZone&&!this.shippingZone.showAllStates&&(null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.length)&&(s=s.filter((function(t){var i,s;return null===(s=null===(i=e.shippingZone)||void 0===i?void 0:i.states)||void 0===s?void 0:s.some((function(i){return i.id===t.value}))}))),x(s)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"cityOptions",{get:function(){var t,i,e,s=this,n=this.cities.map(C);return this.shippingZone&&!(null===(t=this.shippingZoneState)||void 0===t?void 0:t.showAllCities)&&(null===(e=null===(i=this.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.length)&&(n=n.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),x(n)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"districtOptions",{get:function(){var t,i,e,s=this,n=this.districts.map(C);return this.shippingZone&&!(null===(t=this.shippingZoneCity)||void 0===t?void 0:t.showAllDistricts)&&(null===(e=null===(i=this.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.length)&&(n=n.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),x(n)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"regionOptions",{get:function(){var t,i;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.map(C).sort((function(t,i){return j(t.label,i.label)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fieldSettings",{get:function(){return this.address.fieldSettings},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fieldLabels",{get:function(){return this.address.fieldLabels},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"addressFormat",{get:function(){return this.countryOptions.length<=1?this.address.addressFormatIgnoreCountry:this.address.addressFormat},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"validationResult",{get:function(){var t=this;if(this.address.validationResults)return y(this.address.validationResults,(function(i,e){return{hasError:t.isFormSubmit&&i.hasError,message:t.isFormSubmit&&i.hasError?e===g.PHONE?t.message.phoneRule?"string"==typeof t.message.phoneRule?t.message.phoneRule:t.message.phoneRule(t.address):"":i.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}),P}();export{P as IkasAddressForm};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__spreadArray as r,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as a,computed as o,observable as s,action as n}from"mobx";import d from"lodash/toNumber";import{Validator as u}from"../index.js";import{IkasBaseStore as m}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as l,RequiredRule as p,EmailRule as c,MinRule as f}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{IkasCustomerAttributeType as b,IkasCustomerAttributeRegisterPageRequirement as h}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/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/customer-form-data-input/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/region/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var g=function(){function g(t){var e=this;this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=function(t){return void 0===t&&(t=!1),r([new p({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new p({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new p({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new p({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new c({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new f({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})],t?[new l({fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(t){e.firstName=t},this.onLastNameChange=function(t){e.lastName=t},this.onEmailChange=function(t){e.email=t},this.onPasswordChange=function(t){e.password=t},this.onPhoneChange=function(t){e.phone=t},this.setCustomerAttributes=function(t){e._customerAttributes=(null==t?void 0:t.filter((function(t){return t.registerPageRequirement!==h.INVISIBLE})).map((function(t){return{attribute:t,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:t.registerPageRequirement===h.MANDATORY,hasError:!1,message:""}}})))||[]},this.onAttributeChange=function(t,r){var i;if(e._customerAttributes){var a=e._customerAttributes.find((function(e){return e.attribute.id===t}));if(a){var o=null===(i=e._customerAttributes)||void 0===i?void 0:i.findIndex((function(e){return e.attribute.id===t}));void 0!==o&&-1!==o&&(e._customerAttributes[o].attributeValue=e.getAttributeValue(a.attribute,r),e.validateCustomerAttribute())}}},a(this,{emailErrorMessage:o,passwordErrorMessage:o,firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,hasError:o,redirect:o,model:s,validateAll:n,register:n,customerAttributes:o,_customerAttributes:s}),this.message=t.message,this.validator=new u(this.model,this.validatorRules())}return Object.defineProperty(g.prototype,"firstName",{get:function(){return this.model.firstName},set:function(t){this.model.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastName",{get:function(){return this.model.lastName},set:function(t){this.model.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"email",{get:function(){return this.model.email},set:function(t){this.model.email=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"password",{get:function(){return this.model.password},set:function(t){this.model.password=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(t){this.model.isMarketingAccepted=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phone",{get:function(){return this.model.phone},set:function(t){this.model.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phoneErrorMessage",{get:function(){var t;return null===(t=this.validator.results.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"attributes",{get:function(){return this.model.attributes},set:function(t){this.model.attributes=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"customerAttributes",{get:function(){return this._customerAttributes},enumerable:!1,configurable:!0}),g.prototype.getAttributeValue=function(t,e){var r={isChecked:void 0,value:void 0,selectedIdList:void 0};return"string"!=typeof e||t.type!==b.TEXT&&t.type!==b.DATETIME&&t.type!==b.DATE&&t.type!==b.CHOICE||(r.value=e),"string"==typeof e&&t.type===b.NUMERIC&&(Number.isInteger(d(e))?r.value=e:r.value=e.slice(0,-1)),"boolean"==typeof e&&t.type===b.BOOLEAN&&(r.isChecked=e),"object"==typeof e&&t.type===b.MULTIPLE_CHOICE&&(r.selectedIdList=e),r},Object.defineProperty(g.prototype,"formattedAttributesInput",{get:function(){if(!this._customerAttributes)return null;if(!this._customerAttributes.some((function(t){return void 0!==t.attributeValue.value||void 0!==t.attributeValue.isChecked||void 0!==t.attributeValue.selectedIdList})))return null;var t=[];return this._customerAttributes.map((function(e){var r=e.attributeValue,i=r.selectedIdList,a=r.isChecked,o=r.value;void 0!==i&&b.MULTIPLE_CHOICE&&i.map((function(r){t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:r,value:null})})),e.attribute.type===b.BOOLEAN&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:a?a.toString():"false"}),void 0!==o&&(e.attribute.type!==b.TEXT&&e.attribute.type!==b.NUMERIC||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:o.toString()}),e.attribute.type===b.CHOICE&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:o,value:null}),e.attribute.type!==b.DATETIME&&e.attribute.type!==b.DATE||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:new Date(o).getTime().toString()}))})),t},enumerable:!1,configurable:!0}),g.prototype.validateCustomerAttribute=function(){var t,e=this;this._customerAttributes=null===(t=this._customerAttributes)||void 0===t?void 0:t.map((function(t){var r;return t.validator.isRequired&&e.isFormSubmit&&(t.attribute.type===b.BOOLEAN||t.attributeValue.value||(null===(r=t.attributeValue.selectedIdList)||void 0===r?void 0:r.length)?(t.validator.hasError=!1,t.validator.message=""):(t.validator.hasError=!0,t.validator.message="string"==typeof e.message.requiredRule?e.message.requiredRule:e.message.requiredRule(e.model))),t}))},g.prototype.validateAll=function(){var r;return t(this,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this.validateCustomerAttribute(),[4,this.validator.validateAll()];case 1:return t=e.sent(),i=null===(r=this._customerAttributes)||void 0===r?void 0:r.some((function(t){return t.validator.hasError})),[2,t||i]}}))}))},g.prototype.register=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={isFormError:!1,isSuccess:!1,errorCodes:[]},this.email&&(this.email=this.email.trim()),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,m.getInstance().customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0,this.model.phone)];case 3:return r=e.sent(),[2,i(i({},t),r)];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},g}();export{g as RegisterForm};
1
+ import{__awaiter as t,__generator as e,__spreadArray as r,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as a,computed as o,observable as s,action as n}from"mobx";import d from"lodash/toNumber";import{Validator as u}from"../index.js";import{IkasBaseStore as m}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as l,RequiredRule as p,EmailRule as c,MinRule as f}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{IkasCustomerAttributeType as b,IkasCustomerAttributeRegisterPageRequirement as h}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-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/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/customer-form-data-input/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/region/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/order-transaction-with-prices/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/campaign-offer/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/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var g=function(){function g(t){var e=this;this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=function(t){return void 0===t&&(t=!1),r([new p({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new p({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new p({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new p({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new c({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new f({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})],t?[new l({fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(t){e.firstName=t},this.onLastNameChange=function(t){e.lastName=t},this.onEmailChange=function(t){e.email=t},this.onPasswordChange=function(t){e.password=t},this.onPhoneChange=function(t){e.phone=t},this.setCustomerAttributes=function(t){e._customerAttributes=(null==t?void 0:t.filter((function(t){return t.registerPageRequirement!==h.INVISIBLE})).map((function(t){return{attribute:t,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:t.registerPageRequirement===h.MANDATORY,hasError:!1,message:""}}})))||[]},this.onAttributeChange=function(t,r){var i;if(e._customerAttributes){var a=e._customerAttributes.find((function(e){return e.attribute.id===t}));if(a){var o=null===(i=e._customerAttributes)||void 0===i?void 0:i.findIndex((function(e){return e.attribute.id===t}));void 0!==o&&-1!==o&&(e._customerAttributes[o].attributeValue=e.getAttributeValue(a.attribute,r),e.validateCustomerAttribute())}}},a(this,{emailErrorMessage:o,passwordErrorMessage:o,firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,hasError:o,redirect:o,model:s,validateAll:n,register:n,customerAttributes:o,_customerAttributes:s}),this.message=t.message,this.validator=new u(this.model,this.validatorRules())}return Object.defineProperty(g.prototype,"firstName",{get:function(){return this.model.firstName},set:function(t){this.model.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastName",{get:function(){return this.model.lastName},set:function(t){this.model.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"email",{get:function(){return this.model.email},set:function(t){this.model.email=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"password",{get:function(){return this.model.password},set:function(t){this.model.password=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(t){this.model.isMarketingAccepted=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phone",{get:function(){return this.model.phone},set:function(t){this.model.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phoneErrorMessage",{get:function(){var t;return null===(t=this.validator.results.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"attributes",{get:function(){return this.model.attributes},set:function(t){this.model.attributes=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"customerAttributes",{get:function(){return this._customerAttributes},enumerable:!1,configurable:!0}),g.prototype.getAttributeValue=function(t,e){var r={isChecked:void 0,value:void 0,selectedIdList:void 0};return"string"!=typeof e||t.type!==b.TEXT&&t.type!==b.DATETIME&&t.type!==b.DATE&&t.type!==b.CHOICE||(r.value=e),"string"==typeof e&&t.type===b.NUMERIC&&(Number.isInteger(d(e))?r.value=e:r.value=e.slice(0,-1)),"boolean"==typeof e&&t.type===b.BOOLEAN&&(r.isChecked=e),"object"==typeof e&&t.type===b.MULTIPLE_CHOICE&&(r.selectedIdList=e),r},Object.defineProperty(g.prototype,"formattedAttributesInput",{get:function(){if(!this._customerAttributes)return null;if(!this._customerAttributes.some((function(t){return void 0!==t.attributeValue.value||void 0!==t.attributeValue.isChecked||void 0!==t.attributeValue.selectedIdList})))return null;var t=[];return this._customerAttributes.map((function(e){var r=e.attributeValue,i=r.selectedIdList,a=r.isChecked,o=r.value;void 0!==i&&b.MULTIPLE_CHOICE&&i.map((function(r){t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:r,value:null})})),e.attribute.type===b.BOOLEAN&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:a?a.toString():"false"}),void 0!==o&&(e.attribute.type!==b.TEXT&&e.attribute.type!==b.NUMERIC||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:o.toString()}),e.attribute.type===b.CHOICE&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:o,value:null}),e.attribute.type!==b.DATETIME&&e.attribute.type!==b.DATE||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:new Date(o).getTime().toString()}))})),t},enumerable:!1,configurable:!0}),g.prototype.validateCustomerAttribute=function(){var t,e=this;this._customerAttributes=null===(t=this._customerAttributes)||void 0===t?void 0:t.map((function(t){var r;return t.validator.isRequired&&e.isFormSubmit&&(t.attribute.type===b.BOOLEAN||t.attributeValue.value||(null===(r=t.attributeValue.selectedIdList)||void 0===r?void 0:r.length)?(t.validator.hasError=!1,t.validator.message=""):(t.validator.hasError=!0,t.validator.message="string"==typeof e.message.requiredRule?e.message.requiredRule:e.message.requiredRule(e.model))),t}))},g.prototype.validateAll=function(){var r;return t(this,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this.validateCustomerAttribute(),[4,this.validator.validateAll()];case 1:return t=e.sent(),i=null===(r=this._customerAttributes)||void 0===r?void 0:r.some((function(t){return t.validator.hasError})),[2,t||i]}}))}))},g.prototype.register=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={isFormError:!1,isSuccess:!1,errorCodes:[]},this.email&&(this.email=this.email.trim()),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,m.getInstance().customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0,this.model.phone)];case 3:return r=e.sent(),[2,i(i({},t),r)];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},g}();export{g as RegisterForm};
@@ -0,0 +1 @@
1
+ import{__assign as t}from"../../../ext/tslib/tslib.es6.mjs.js";import e from"react";import{observer as n}from'./../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';import{ButtonActionTypeEnum as o}from"../../models/modal/step/elements/button/index.js";import{getHorizontalAlignment as r,injectFontScript as i}from"../../helpers/index.js";var a=n((function(n){var a=n.element,c=n.isStandaloneButtonComponent,l=n.onClose,s=e.useRef(null),d=a,u={display:"flex",alignItems:"center",justifyContent:r(d.horizontalAlignment),padding:"".concat(d.outerVerticalPadding,"px ").concat(d.outerHorizontalPadding,"px"),backgroundColor:d.bgColor},m={color:d.color,backgroundColor:d.buttonBgColor,fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:i(d.fontFamily),textAlign:"center",border:"".concat(d.borderWidth,"px ").concat(d.borderStyle," ").concat(d.borderColor),borderRadius:d.borderRadius,padding:"".concat(d.verticalPadding,"px ").concat(d.horizontalPadding,"px")},f={width:"".concat(d.width,"%"),minWidth:"fit-content",cursor:"pointer"},p=e.useCallback((function(){if(s.current){var t=d.link||void 0;if(!c&&t)s.current.href=t||"",s.current.click();else switch(d.actionType){case o.NAVIGATE_TO_LINK_AND_CLOSE:s.current.href=t||"",null==l||l(!0),s.current.click();break;case o.NAVIGATE_TO_LINK:s.current.href=t||"",s.current.click();break;case o.CLOSE:null==l||l(!0)}}}),[s,s.current]);return e.createElement("div",{style:u},e.createElement("a",{onClick:p,style:f,target:d.openLinkInNewWindow?"_blank":"_self",ref:s},e.createElement("div",{dangerouslySetInnerHTML:{__html:d.text},style:t({},m)})))}));export{a as default};
@@ -0,0 +1 @@
1
+ import t from"react";import{observer as o}from'./../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';import{getHorizontalAlignment as e}from"../../helpers/index.js";import{ButtonBorderStyle as r}from"../../models/modal/background-settings/index.js";var d=o((function(o){var d=o.element,n={display:"flex",alignItems:"center",justifyContent:e(d.horizontalAlignment),padding:"".concat(d.verticalPadding,"px ").concat(d.horizontalPadding,"px"),backgroundColor:d.bgColor,width:"100%"},a=d.borderStyle===r.SOLID?"solid":d.borderStyle===r.DASHED?"dashed":"dotted",i={width:"".concat(d.width,"%"),height:"".concat(d.borderWidth,"px"),borderRadius:"".concat(d.borderRadius,"px"),borderBottom:"".concat(d.borderWidth,"px ").concat(a," ").concat(d.borderColor)};return t.createElement("div",{style:n},t.createElement("div",{style:i}))}));export{d as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from'./../../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';var r=t((function(t){var r=t.checkboxItem;e.useEffect((function(){r.showInCheckedStatus?r.isChecked=!0:r.isChecked=!1}),[r.showInCheckedStatus]);var o=r.requiredToBeChecked,i=e.useCallback((function(){var e=/<pre[^>]*>([\s\S]*?)<\/pre>/.exec(r.text);return e?e[1]:r.text}),[r.text]);return e.createElement("div",{style:{width:"100%",display:"flex",gap:6,flexDirection:"column"}},e.createElement("div",{style:{width:"100%",display:"flex",gap:8,flexDirection:"row",alignItems:"baseline",wordBreak:"break-word"}},e.createElement("input",{style:{width:"16px",height:"16px",cursor:"pointer",position:"relative",top:3},type:"checkbox",checked:r.isChecked,onChange:function(){r.isChecked=!r.isChecked,o&&o.hasError&&r.isChecked&&(o.hasError=!1)}}),e.createElement("div",{dangerouslySetInnerHTML:{__html:i()}})),!!o&&o.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},o.validationErrorMessage))}));export{r as CheckboxItemView};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as r}from'./../../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';import t from"react-date-picker";var a=r((function(r){var a=e.useState(!1),o=a[0],l=a[1],n=e.useRef(null);r.placeholder;var c=r.isRequired,i=r.inputLabel;r.updateCurrentInfo;var s=r.formInputSettings,d=r.value,u=r.onValueChange;return e.useEffect((function(){if(n.current){var e=n.current.getElementsByClassName("react-date-picker__wrapper");if(e.length>0){var r=e[0];r.style.backgroundColor=s.bgColor,r.style.border="".concat(s.borderWidth,"px solid ").concat(o?s.focusBorderColor:s.borderColor),r.style.borderRadius="".concat(s.borderRadius,"px"),r.style.fontSize="14px",r.style.padding="10px 12px",r.style.height="".concat(s.height,"px")}}}),[n.current]),e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"},ref:n},(i||c)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},i&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},i.text),c&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},"*")),c&&c.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},c.validationErrorMessage)),e.createElement(t,{onChange:function(e){return function(e){var r=e?e.valueOf().toString():"";u(r),c&&c.hasError&&r.length>0&&(c.hasError=!1)}(e)},value:d?new Date(Number(d)):null,className:"ikas-popup-datepicker",disableCalendar:!0,format:"dd / MM / yyyy",maxDate:new Date,clearIcon:null,onFocus:function(){return l(!0)},onBlur:function(){return function(){if(l(!1),n.current){var e=n.current.getElementsByClassName("react-date-picker__wrapper");e.length>0&&(e[0].style.border="".concat(s.borderWidth,"px solid ").concat(s.borderColor))}}()}}))}));export{a as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as r}from'./../../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';var t=r((function(r){var t,o=e.useState(!1),n=o[0],i=o[1],l=r.genderFormItem,a=r.formInputSettings;r.onValueChange;var d={width:"100%",backgroundColor:a.bgColor,border:"".concat(a.borderWidth,"px solid ").concat(n?a.focusBorderColor:a.borderColor),color:l.genders.find((function(e){return e.isSelected}))?"black":"#697586",borderRadius:"".concat(a.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(a.height,"px"),appearance:"none",backgroundImage:"url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' strokeWidth='2' strokeLinecap='round' strokeLinejoin='round' %3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 12px center",backgroundSize:"20px",cursor:"pointer"};return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(l.inputLabel||l.required)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},l.inputLabel&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},l.inputLabel.text),l.required&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},"*")),l.required&&l.required.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},l.required.validationErrorMessage)),e.createElement("select",{value:(null===(t=l.genders.find((function(e){return e.isSelected})))||void 0===t?void 0:t.type)||void 0,onChange:function(e){return r=e.target.value,l.genders.forEach((function(e){e.isSelected=e.type===r})),void(l.required&&l.required.hasError&&(l.required.hasError=!1));var r},style:d,onFocus:function(){return i(!0)},onBlur:function(){return i(!1)}},!!l.placeholder&&e.createElement("option",{value:"",disabled:!0,selected:!0,hidden:!0},l.placeholder.text),l.genders.filter((function(e){return!!e.label})).map((function(r){return e.createElement("option",{key:r.type,value:r.type},r.label)}))))}));export{t as default};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as r}from"../../../ext/tslib/tslib.es6.mjs.js";import t from"react";import{observer as n}from'./../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';import{getHorizontalAlignment as o,injectFontScript as a,validateEmail as i,validatePhoneNumber as l}from"../../helpers/index.js";import{FormItemTypeEnum as s}from"../../models/modal/step/elements/form/index.js";import u from"../button-element-renderer/index.js";import m from"./input-item-view/index.js";import{CheckboxItemView as d}from"./checkbox-item-view/index.js";import c from"./date-item-view/index.js";import f from"./gender-item-view/index.js";var E=n((function(n){var E=n.element,p=n.popup,v=n.isPreviewMode,C=n.sfProps,I=t.useState(!1);I[0];var h=I[1],M=E,S=M.rows.slice().sort((function(e,r){return e.order-r.order})),g=M.formSettings,R=M.buttonSettings,O=M.bgColor,_={display:"flex",flexDirection:"column",justifyContent:o(M.horizontalAlignment),gap:"".concat(g.gapBetweenItems,"px"),padding:"".concat(M.outerVerticalPadding,"px ").concat(M.outerHorizontalPadding,"px"),backgroundColor:O,width:"100%"},T={display:"flex",flexDirection:"row",width:"100%",gap:"".concat(g.gapBetweenItems,"px")},b={flex:1,display:"flex",alignItems:"flex-end",fontFamily:a(g.fontFamily),fontSize:g.fontSize},U=function(){return e(void 0,void 0,void 0,(function(){var e,t,n;return r(this,(function(r){switch(r.label){case 0:return e=p.modal.steps.findIndex((function(e){return e.id===p.modal.selectedStep.id})),t=e===p.modal.steps.length-2,!v&&C&&t?(h(!0),o=0,M.rows.forEach((function(e){e.columns.forEach((function(e){switch(e.type){case s.CUSTOMER_BIRTHDAY:var r=e.formItem;r.required&&!r.value&&(r.required.hasError=!0,o++);break;case s.CUSTOMER_EMAIL:case s.CUSTOMER_PHONE:case s.CUSTOMER_NAME:case s.CUSTOMER_SURNAME:var t=e.formItem;if(t.required&&!t.value){if(t.type===s.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn))return;t.required.hasError=!0,o++}else if(e.type===s.CUSTOMER_EMAIL){var n=i(t.value||"");t.validEmailError.hasError=!n,n||o++}else if(e.type===s.CUSTOMER_PHONE){var a=l(t.value||"",null==C?void 0:C.currentCountryCode);t.validPhoneError.hasError=!a,a||o++}break;case s.CUSTOMER_GENDER:var u=e.formItem,m=u.genders.find((function(e){return e.isSelected}));u.required&&!m&&(u.required.hasError=!0,o++);break;case s.CHECKBOX_FORM_ITEM:var d=e.formItem;d.requiredToBeChecked&&!d.isChecked&&(d.requiredToBeChecked.hasError=!0,o++)}}))})),o>0?(h(!1),[2]):(n={},M.rows.forEach((function(e){e.columns.forEach((function(e){var r;switch(e.type){case s.CUSTOMER_BIRTHDAY:n.birthday=e.formItem.value;break;case s.CUSTOMER_EMAIL:n.email=e.formItem.value;break;case s.CUSTOMER_GENDER:n.gender=(null===(r=e.formItem.genders.find((function(e){return e.isSelected})))||void 0===r?void 0:r.type)||"";break;case s.CUSTOMER_PHONE:n.phone=e.formItem.value;break;case s.CUSTOMER_NAME:n.firstName=e.formItem.value||"";break;case s.CUSTOMER_SURNAME:n.lastName=e.formItem.value||"";break;case s.CHECKBOX_FORM_ITEM:n.hasPermission=e.formItem.isChecked}}))})),[4,C.onCustomerSave(n)])):[3,2];case 1:r.sent(),h(!1),r.label=2;case 2:return-1!==e&&e<p.modal.steps.length&&(p.modal.selectedStep=p.modal.steps[e+1]),[2]}var o}))}))};return t.createElement("div",{style:_},S.map((function(e,r){return t.createElement("div",{style:T,key:r},e.columns.slice().sort((function(e,r){return e.order-r.order})).map((function(e,r){return t.createElement("div",{style:b,key:r},function(e){switch(e.type){case s.CUSTOMER_EMAIL:case s.CUSTOMER_PHONE:case s.CUSTOMER_NAME:case s.CUSTOMER_SURNAME:var r=e.formItem;if(r.type===s.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn)&&!v)return null;var n=null;if(e.type===s.CUSTOMER_EMAIL){var o=r;o.validEmailError.hasError&&(n=o.validEmailError.validationErrorMessage)}else if(e.type===s.CUSTOMER_PHONE){var a=r;a.validPhoneError.hasError&&(n=a.validPhoneError.validationErrorMessage)}return t.createElement(m,{formInputSettings:g.formInputSettings,inputLabel:r.inputLabel,isRequired:r.required,onValueChange:function(e){return v?null:r.value=e},placeholder:r.placeholder,updateCurrentInfo:r.updateCurrentInfo,value:r.value||"",validationErrorMessage:n});case s.CUSTOMER_BIRTHDAY:var i=e.formItem;return t.createElement(c,{formInputSettings:g.formInputSettings,inputLabel:i.inputLabel,isRequired:i.required,onValueChange:function(e){return v?null:i.value=e},placeholder:i.placeholder,updateCurrentInfo:i.updateCurrentInfo,value:i.value||""});case s.CUSTOMER_GENDER:var l=e.formItem;return t.createElement(f,{genderFormItem:l,formInputSettings:g.formInputSettings,onValueChange:function(e){return v?null:l.genders.forEach((function(r){r.isSelected=r.label===e}))}});case s.CHECKBOX_FORM_ITEM:return t.createElement(d,{checkboxItem:e.formItem})}}(e))})))})),t.createElement("div",{style:{width:"100%",minWidth:"fit-content"},onClick:function(e){U(),e.preventDefault(),e.stopPropagation()}},t.createElement(u,{element:R})," "))}));export{E as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from'./../../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';var r=t((function(t){var r=e.useState(!1),o=r[0],n=r[1];e.useRef(null);var l=t.placeholder,a=t.isRequired,i=t.inputLabel;t.updateCurrentInfo;var c=t.validationErrorMessage,d=t.formInputSettings,u=t.value,s=t.onValueChange,p={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(o?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},x=a?((null==l?void 0:l.text)||"")+" *":(null==l?void 0:l.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(i||a)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},i&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},i.text)),a&&a.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},a.validationErrorMessage),!!c&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},c)),e.createElement("input",{type:"text",placeholder:x,value:u||"",onChange:function(e){return function(e){s(e),a&&a.hasError&&e.length>0&&(a.hasError=!1)}(e.target.value)},style:p,onFocus:function(){return n(!0)},onBlur:function(){return n(!1)}}))}));export{r as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from'./../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';import{ImageFitEnum as r}from"../../models/modal/step/elements/image/index.js";var i=t((function(t){var i=t.element,o=t.popup,a=t.editModeChildren,d=t.isMobile,n=i;n.cdnURL||(n.cdnURL=o.cdnURL),n.merchantId||(n.merchantId=o.merchantId);var c=o.modal.windowSettings,m={width:c.takeFullWidth||d?"100%":c.maxWidth,backgroundColor:n.bgColor,padding:"".concat(n.verticalPadding,"px ").concat(n.horizontalPadding,"px"),borderRadius:n.borderRadius};if(!n.src&&o.isPreviewMode&&a)return e.createElement("div",{style:m},a);var l={objectFit:n.objectFit===r.CONTAIN?"contain":"cover",height:"100%"};return e.createElement("a",{href:n.link||void 0,style:m,target:"_blank"},n.src&&e.createElement("img",{src:n.src||void 0,width:"100% !important",style:l}))}));export{i as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from'./../../../../../../../../../ext/mobx-react/dist/mobxreact.esm.js';import{ImagePositionEnum as i,ImageFitEnum as o}from"../../models/modal/step/elements/image/index.js";var a=t((function(t){var a=t.element,r=t.popup,n=t.editModeChildren,d=a;if(d.cdnURL||(d.cdnURL=r.cdnURL),d.merchantId||(d.merchantId=r.merchantId),!d.src&&r.isPreviewMode&&n)return n;var m={display:"flex",alignItems:"center",justifyContent:d.imagePosition===i.DISABLE_FLOAT?"center":d.imagePosition===i.FLOAT_LEFT?"flex-start":"flex-end",padding:"".concat(d.verticalPadding,"px ").concat(d.horizontalPadding,"px"),backgroundColor:d.bgColor,maxWidth:"100%"},c={borderRadius:"".concat(d.borderRadius,"px"),objectFit:d.objectFit===o.CONTAIN?"contain":"cover",width:"".concat(d.maxWidth,"%")};return e.createElement("a",{href:d.link||void 0,style:m,target:"_blank"},e.createElement("img",{src:d.src||void 0,width:100===d.maxWidth?"100% !important":void 0,style:c}))}));export{a as default};