@ikas/storefront 6.1.0-beta.19 → 6.1.0-beta.190

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 (170) hide show
  1. package/build/analytics/analytics.d.ts +3 -3
  2. package/build/analytics/analytics.js +1 -1
  3. package/build/analytics/googleAnalytics.js +1 -1
  4. package/build/analytics/googleTagManager.d.ts +3 -2
  5. package/build/analytics/googleTagManager.js +1 -1
  6. package/build/analytics/ikasV3.d.ts +6 -0
  7. package/build/analytics/ikasV3.js +1 -1
  8. package/build/components/checkout/components/address-form/index.js +1 -1
  9. package/build/components/checkout/components/address-form/model.d.ts +5 -0
  10. package/build/components/checkout/components/address-form/model.js +1 -1
  11. package/build/components/checkout/components/adyen/index.js +1 -1
  12. package/build/components/checkout/components/button/index.d.ts +1 -0
  13. package/build/components/checkout/components/button/index.js +1 -1
  14. package/build/components/checkout/components/button/style.module.scss.js +1 -1
  15. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  16. package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
  17. package/build/components/checkout/components/cart-summary/index.d.ts +2 -1
  18. package/build/components/checkout/components/cart-summary/index.js +1 -1
  19. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
  20. package/build/components/checkout/components/customer-addresses/index.d.ts +1 -0
  21. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  22. package/build/components/checkout/components/error/stock-error/index.js +1 -1
  23. package/build/components/checkout/components/form-item/index.js +1 -1
  24. package/build/components/checkout/components/form-item/model.d.ts +5 -3
  25. package/build/components/checkout/components/form-item/model.js +1 -1
  26. package/build/components/checkout/components/form-item/style.module.scss.js +1 -1
  27. package/build/components/checkout/components/hepsipay/index.d.ts +9 -0
  28. package/build/components/checkout/components/hepsipay/index.js +1 -0
  29. package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -1
  30. package/build/components/checkout/components/modal/index.d.ts +1 -0
  31. package/build/components/checkout/components/modal/index.js +1 -1
  32. package/build/components/checkout/components/modal/style.module.scss.js +1 -1
  33. package/build/components/checkout/components/offer-product/index.js +1 -1
  34. package/build/components/checkout/components/phone-number-input/index.d.ts +1 -1
  35. package/build/components/checkout/components/phone-number-input/index.js +1 -1
  36. package/build/components/checkout/components/quick-registration/completed.js +1 -1
  37. package/build/components/checkout/components/quick-registration/index.js +1 -1
  38. package/build/components/checkout/components/stripe/checkout-form.js +1 -1
  39. package/build/components/checkout/components/svg/coupon-code-tag.d.ts +6 -0
  40. package/build/components/checkout/components/svg/coupon-code-tag.js +1 -0
  41. package/build/components/checkout/components/svg/credit-balance.d.ts +6 -0
  42. package/build/components/checkout/components/svg/credit-balance.js +1 -0
  43. package/build/components/checkout/components/svg/gift-cart-tag.d.ts +6 -0
  44. package/build/components/checkout/components/svg/gift-cart-tag.js +1 -0
  45. package/build/components/checkout/components/svg/store-credit-tag.d.ts +6 -0
  46. package/build/components/checkout/components/svg/store-credit-tag.js +1 -0
  47. package/build/components/checkout/components/svg/subscription.d.ts +6 -0
  48. package/build/components/checkout/components/svg/subscription.js +1 -0
  49. package/build/components/checkout/index.js +1 -1
  50. package/build/components/checkout/model.d.ts +25 -6
  51. package/build/components/checkout/model.js +1 -1
  52. package/build/components/checkout/steps/step-info/index.js +1 -1
  53. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  54. package/build/components/checkout/steps/step-payment/index.js +1 -1
  55. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  56. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.d.ts +7 -0
  57. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.js +1 -0
  58. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/style.module.scss.js +1 -0
  59. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  60. package/build/components/checkout/steps/step-success/index.js +1 -1
  61. package/build/components/image/index.d.ts +1 -0
  62. package/build/components/image/index.js +1 -1
  63. package/build/components/index.d.ts +2 -0
  64. package/build/components/page/head.js +1 -1
  65. package/build/components/page/index.d.ts +6 -0
  66. package/build/components/page/index.js +1 -1
  67. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  68. package/build/components/page-editor/model.js +1 -1
  69. package/build/components/paypal-express-checkout/index.d.ts +9 -0
  70. package/build/components/paypal-express-checkout/index.js +1 -0
  71. package/build/components/plain-image/index.d.ts +13 -0
  72. package/build/components/plain-image/index.js +1 -0
  73. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
  74. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/getCountries.js +1 -0
  75. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
  76. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountries.js +1 -0
  77. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
  78. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
  79. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
  80. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/ObserverComponent.js +1 -0
  81. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/index.js +1 -0
  82. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/observer.js +1 -0
  83. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/useObserver.js +1 -0
  84. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -0
  85. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/assertEnvironment.js +1 -0
  86. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerBatching.js +1 -0
  87. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -0
  88. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/printDebugValue.js +1 -0
  89. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
  90. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -1
  91. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
  92. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -0
  93. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -0
  94. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
  95. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
  96. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -1
  97. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +1 -1
  98. package/build/hooks/useCustomerReviews.d.ts +2 -0
  99. package/build/hooks/useCustomerReviews.js +1 -1
  100. package/build/hooks/useStore.js +1 -1
  101. package/build/index.js +1 -1
  102. package/build/models/data/checkout-settings/index.d.ts +1 -0
  103. package/build/models/data/checkout-settings/index.js +1 -1
  104. package/build/models/data/customer/review/index.d.ts +4 -1
  105. package/build/models/data/customer/review/index.js +1 -1
  106. package/build/models/data/index.d.ts +1 -0
  107. package/build/models/data/order/gift-card-line/index.d.ts +2 -1
  108. package/build/models/data/order/gift-card-line/index.js +1 -1
  109. package/build/models/data/order/index.d.ts +1 -0
  110. package/build/models/data/order/index.js +1 -1
  111. package/build/models/data/order/line-item/bundle-product-settings/index.d.ts +7 -0
  112. package/build/models/data/order/line-item/bundle-product-settings/index.js +1 -0
  113. package/build/models/data/order/line-item/index.d.ts +4 -0
  114. package/build/models/data/order/line-item/index.js +1 -1
  115. package/build/models/data/order/line-item/order-line-item-subscription-plan/index.d.ts +8 -0
  116. package/build/models/data/order/line-item/order-line-item-subscription-plan/index.js +1 -0
  117. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.d.ts +6 -0
  118. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.js +1 -0
  119. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.d.ts +14 -0
  120. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.js +1 -0
  121. package/build/models/data/order/order-transaction-with-prices/index.d.ts +1 -0
  122. package/build/models/data/order/order-transaction-with-prices/index.js +1 -1
  123. package/build/models/data/product/campaign-offer/index.d.ts +2 -0
  124. package/build/models/data/product/campaign-offer/index.js +1 -1
  125. package/build/models/data/product/filter/index.d.ts +2 -0
  126. package/build/models/data/product/filter/index.js +1 -1
  127. package/build/models/data/product/index.d.ts +8 -0
  128. package/build/models/data/product/index.js +1 -1
  129. package/build/models/data/product/translations/index.d.ts +7 -0
  130. package/build/models/data/product/translations/index.js +1 -0
  131. package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -1
  132. package/build/models/data/product/variant/index.d.ts +3 -0
  133. package/build/models/data/product/variant/index.js +1 -1
  134. package/build/models/data/product/variant/subscription-plan/index.d.ts +12 -0
  135. package/build/models/data/product/variant/subscription-plan/index.js +1 -0
  136. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-discount/index.d.ts +6 -0
  137. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.d.ts +23 -0
  138. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.js +1 -0
  139. package/build/models/data/store-credit-balance/index.d.ts +26 -0
  140. package/build/models/data/store-credit-balance/index.js +1 -0
  141. package/build/models/data/theme-json/component/prop/index.d.ts +1 -0
  142. package/build/models/data/theme-json/component/prop/index.js +1 -1
  143. package/build/models/data/theme-json/custom-data/index.d.ts +1 -0
  144. package/build/models/data/theme-json/custom-data/index.js +1 -1
  145. package/build/models/ui/customer-review-list/index.d.ts +8 -0
  146. package/build/models/ui/customer-review-list/index.js +1 -1
  147. package/build/models/ui/product-list/index.d.ts +17 -0
  148. package/build/models/ui/product-list/index.js +1 -1
  149. package/build/models/ui/validator/form/login.d.ts +20 -6
  150. package/build/models/ui/validator/form/login.js +1 -1
  151. package/build/models/ui/validator/form/register.d.ts +15 -6
  152. package/build/models/ui/validator/form/register.js +1 -1
  153. package/build/pages/checkout.js +1 -1
  154. package/build/store/cart/index.d.ts +1 -0
  155. package/build/store/cart/index.js +1 -1
  156. package/build/store/checkout/index.d.ts +4 -1
  157. package/build/store/checkout/index.js +1 -1
  158. package/build/store/customer/api.d.ts +15 -2
  159. package/build/store/customer/api.js +1 -1
  160. package/build/store/customer/index.d.ts +40 -5
  161. package/build/store/customer/index.js +1 -1
  162. package/build/store/product/index.d.ts +1 -0
  163. package/build/utils/helper.d.ts +1 -0
  164. package/build/utils/helper.js +1 -1
  165. package/package.json +13 -12
  166. package/build/components/popup/index.js +0 -1
  167. package/build/components/popup/renderer/index.js +0 -1
  168. package/build/components/popup/renderer/model.js +0 -1
  169. package/build/components/popup/utils/index.js +0 -1
  170. package/build/store/storefront-popup/index.js +0 -1
@@ -1 +1 @@
1
- import{__rest as o,__awaiter as e,__generator as t,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as s from"react";import{observer as i}from"mobx-react-lite";import d from"../components/checkout/index.js";import{useRouter as n}from"next/router.js";import{FullscreenLoading as a}from"../components/checkout/components/fullscreen-loading/index.js";import{CheckoutStep as m}from"../components/checkout/model.js";import{setAPIClientConfig as l,getCartById as c}from"@ikas/storefront-api";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as p}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import{IkasCheckout as j}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import{LocalizedAddressConfig as f}from"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"./home.js";import"./_slug_/index.js";import"./pages/_slug_.js";import"./account/index.js";import"./account/addresses.js";import"./account/orders/index.js";import"./account/orders/_id_.js";import"./account/login.js";import"./account/register.js";import"./account/forgot-password.js";import"./account/recover-password.js";import"./cart.js";import"./editor.js";import"./account/favorite-products.js";import"./search.js";import"next/error.js";import"./blog/index.js";import"./blog/_slug_.js";import"./raffle/_slug_.js";import"./raffle/index.js";import"./account/raffles.js";import"./account/activate.js";import{IkasBaseStore as g}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import{initIkasEvents as x}from"../analytics/events.js";import{APIErrorCode as y}from'./../ext/@ikas/fe-api-client/build/utils/api.js';import'./../ext/axios/index.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import v from"../store/checkout/index.js";var h=i((function(i){var h=i.customizationProps,b=i.configJson,E=o(i,["customizationProps","configJson"]),k=n(),C=s.useState(),F=C[0],P=C[1],w=s.useState(E.checkoutSettings),_=w[0],B=w[1];u.init(b),f.setCDNUrl(process.env.NEXT_PUBLIC_SETTINGS_CDN_URL),l(),s.useEffect((function(){!function(o){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==o?void 0:o.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==o?void 0:o.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==o?void 0:o.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==o?void 0:o.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==o?void 0:o.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==o?void 0:o.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==o?void 0:o.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==o?void 0:o.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==o?void 0:o.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==o?void 0:o.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==o?void 0:o.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==o?void 0:o.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==o?void 0:o.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==o?void 0:o.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==o?void 0:o.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==o?void 0:o.successLightColor)||"#F6FFED"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==o?void 0:o.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==o?void 0:o.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==o?void 0:o.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==o?void 0:o.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==o?void 0:o.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==o?void 0:o.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==o?void 0:o.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==o?void 0:o.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==o?void 0:o.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==o?void 0:o.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==o?void 0:o.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==o?void 0:o.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(h)}),[h]),s.useEffect((function(){g.getInstance().checkLocalization(),S(),x()}),[]);var S=s.useCallback((function(){return e(void 0,void 0,void 0,(function(){var o,e,r,s,i,d,n,a,l,u,f,x,h,b,E,C,F;return t(this,(function(t){switch(t.label){case 0:if(o=new URLSearchParams(window.location.search),e=o.get("id"),r=o.get("step"),s=o.get("lines"),i=o.get("couponCode"),!s)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),(d=g.getInstance().cartStore).removeCart(),n=s.split(","),a=n.map((function(o){var e=o.split(":"),t=e[0],r=e[1];return{variantId:t,quantity:parseInt(r)}})),l={variantLines:a,couponCode:i||void 0},[4,d.createCart(l)];case 2:return(u=t.sent()).success&&(window.location.href="/checkout?id=".concat(null===(C=u.response.data)||void 0===C?void 0:C.id,"&step=info")),[3,4];case 3:return f=t.sent(),console.error("Error creating cart:",f),[3,4];case 4:return[2];case 5:return e?(x=!1,r&&r===m.SUCCESS&&(x=!0),[4,c({id:e,getCompletedCart:x})]):[2,k.replace("/")];case 6:return h=t.sent(),_?[3,8]:[4,v.listCheckoutSettings({})];case 7:(b=t.sent()).isSuccess&&(null===(F=b.data)||void 0===F?void 0:F.length)?B(b.data[0]):(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(b),console.error(b.graphQLErrors),console.error(b.errorCodes)),t.label=8;case 8:return h.isSuccess&&h.data?(E=h.data,P(new j(E)),g.getInstance().cartStore.setCart(new p(E))):h.errorCodes.some((function(o){return o===y.LOGIN_REQUIRED}))?k.replace("/account/login?redirect="+encodeURIComponent(window.location.href)):k.replace("/"),[2]}}))}))}),[]);return F&&_?s.createElement(d,r({checkout:F,customizationProps:h},E,{checkoutSettings:_})):s.createElement(a,null)}));export{h as default};
1
+ import{__rest as o,__awaiter as e,__generator as t,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as s from"react";import{observer as i}from"mobx-react-lite";import d from"../components/checkout/index.js";import{useRouter as n}from"next/router.js";import{FullscreenLoading as a}from"../components/checkout/components/fullscreen-loading/index.js";import{CheckoutStep as m}from"../components/checkout/model.js";import{setAPIClientConfig as l,getCartById as c,CampaignOfferTargetPageTypeEnum as p}from"@ikas/storefront-api";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as j}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import{IkasCheckout as f}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import{LocalizedAddressConfig as g}from"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"./home.js";import"./_slug_/index.js";import"./pages/_slug_.js";import"./account/index.js";import"./account/addresses.js";import"./account/orders/index.js";import"./account/orders/_id_.js";import"./account/login.js";import"./account/register.js";import"./account/forgot-password.js";import"./account/recover-password.js";import"./cart.js";import"./editor.js";import"./account/favorite-products.js";import"./search.js";import"next/error.js";import"./blog/index.js";import"./blog/_slug_.js";import"./raffle/_slug_.js";import"./raffle/index.js";import"./account/raffles.js";import"./account/activate.js";import{IkasBaseStore as x}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import{initIkasEvents as y}from"../analytics/events.js";import{APIErrorCode as v}from'./../ext/@ikas/fe-api-client/build/utils/api.js';import'./../ext/axios/index.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import h from"../store/checkout/index.js";var b=i((function(i){var b=i.customizationProps,C=i.configJson,E=o(i,["customizationProps","configJson"]),k=n(),F=s.useState(),P=F[0],w=F[1],_=s.useState(E.checkoutSettings),B=_[0],T=_[1];u.init(C),g.setCDNUrl(process.env.NEXT_PUBLIC_SETTINGS_CDN_URL),l(),s.useEffect((function(){!function(o){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==o?void 0:o.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==o?void 0:o.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==o?void 0:o.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==o?void 0:o.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==o?void 0:o.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==o?void 0:o.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==o?void 0:o.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==o?void 0:o.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==o?void 0:o.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==o?void 0:o.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==o?void 0:o.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==o?void 0:o.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==o?void 0:o.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==o?void 0:o.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==o?void 0:o.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==o?void 0:o.successLightColor)||"#F6FFED"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==o?void 0:o.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==o?void 0:o.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==o?void 0:o.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==o?void 0:o.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==o?void 0:o.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==o?void 0:o.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==o?void 0:o.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==o?void 0:o.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==o?void 0:o.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==o?void 0:o.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==o?void 0:o.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==o?void 0:o.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(b)}),[b]),s.useEffect((function(){x.getInstance().checkLocalization(),S(),y()}),[]);var S=s.useCallback((function(){return e(void 0,void 0,void 0,(function(){var o,e,r,s,i,d,n,a,l,u,g,y,b,C,E,F,P;return t(this,(function(t){switch(t.label){case 0:if(o=new URLSearchParams(window.location.search),e=o.get("id"),r=o.get("step"),s=o.get("lines"),i=o.get("couponCode"),!s)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),(d=x.getInstance().cartStore).removeCart(),n=s.split(","),a=n.map((function(o){var e=o.split(":"),t=e[0],r=e[1];return{variantId:t,quantity:parseInt(r)}})),l={variantLines:a,couponCode:i||void 0},[4,d.createCart(l)];case 2:return(u=t.sent()).success&&(window.location.href="/checkout?id=".concat(null===(F=u.response.data)||void 0===F?void 0:F.id,"&step=info")),[3,4];case 3:return g=t.sent(),console.error("Error creating cart:",g),[3,4];case 4:return[2];case 5:return e?(y=!1,r&&r===m.SUCCESS&&(y=!0),[4,c({id:e,getCompletedCart:y,targetPageType:p.CHECKOUT})]):[2,k.replace("/")];case 6:return b=t.sent(),B?[3,8]:[4,h.listCheckoutSettings({})];case 7:(C=t.sent()).isSuccess&&(null===(P=C.data)||void 0===P?void 0:P.length)?T(C.data[0]):(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(C),console.error(C.graphQLErrors),console.error(C.errorCodes)),t.label=8;case 8:return b.isSuccess&&b.data?(E=b.data,w(new f(E)),x.getInstance().cartStore.setCart(new j(E))):b.errorCodes.some((function(o){return o===v.LOGIN_REQUIRED}))?k.replace("/account/login?redirect="+encodeURIComponent(window.location.href)):k.replace("/"),[2]}}))}))}),[]);return P&&B?s.createElement(d,r({checkout:P,customizationProps:b},E,{checkoutSettings:B})):s.createElement(a,null)}));export{b as default};
@@ -27,6 +27,7 @@ export declare class IkasCartStore {
27
27
  private isSameBundleItem;
28
28
  saveCouponCode: (couponCode?: string | null) => Promise<IkasCartOperationResult>;
29
29
  removeCouponCode: () => Promise<IkasCartOperationResult>;
30
+ removeGiftCardLine: (giftCardId?: string | null) => Promise<IkasCartOperationResult>;
30
31
  saveCart: (cart: IkasCart) => Promise<IkasCartOperationResult>;
31
32
  private removeCardIfEmpty;
32
33
  getCart: () => Promise<void>;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import r from"./api.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCustomerEmailSubscriptionStatus as n}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{Analytics as o}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as s}from"@ikas/storefront-api";import{getCookieValue as d}from"../../utils/helper.js";var u,c="cartId",l=function(){function c(c){var l=this;this.cart=null,this._isLoadingCart=!1,this._isCartLoadFinished=!1,this.addItem=function(i,n,s){return void 0===s&&(s=1),t(l,void 0,void 0,(function(){var t,c,l,m,p,f,v,h,I,g,C,b,S,j,y,x;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),n.productOptionSetId&&!n.productOptionSet&&this.baseStore.router?(this.baseStore.router.push(n.productHref),[2,{success:!1,validationError:u.INVALID_PRODUCT_OPTION_VALUES}]):n.hasValidProductOptionValues?i.hasStock||i.sellIfOutOfStock?[4,this.beforeCartOperationCheck()]:[2,{success:!1,validationError:u.INSUFFICIENT_STOCK}]:[2,{success:!1,validationError:u.INVALID_PRODUCT_OPTION_VALUES}];case 1:if(e.sent(),t=void 0,this.cart&&(t=this.findExistingItem(i,n))){if(null===(g=n.productOptionSet)||void 0===g||g.initOptionValues(),!i.bundleSettings)return[2,this.changeItemQuantity(t,t.quantity+1,n.offers,n)];if(!this.getEditLineID())return[2,this.changeItemQuantity(t,t.quantity+1,n.offers,n)]}return c=this.getOptionValues(n),l=s,(null==(m=null===(C=n.salesChannels)||void 0===C?void 0:C.find((function(t){return t.id===a.getSalesChannelId()})))?void 0:m.minQuantityPerCart)&&s<m.minQuantityPerCart&&(l=m.minQuantityPerCart),(null==m?void 0:m.maxQuantityPerCart)&&s>m.maxQuantityPerCart&&(l=m.maxQuantityPerCart),p=(null===(b=this.cart)||void 0===b?void 0:b.id)||localStorage.getItem("cartId"),[4,r.addItemToCart({input:{cartId:p,item:{id:null!==(S=null==t?void 0:t.id)&&void 0!==S?S:null,quantity:null!==(j=null==t?void 0:t.quantity)&&void 0!==j?j:l,variant:{id:i.id,name:n.name,bundleProducts:null===(y=i.bundleSettings)||void 0===y?void 0:y.products.map((function(t){var e,i,r;return{id:t.id,productId:(null===(e=t.product)||void 0===e?void 0:e.id)||"",variantId:(null===(r=null===(i=t.product)||void 0===i?void 0:i.selectedVariant)||void 0===r?void 0:r.id)||"",quantity:t.quantity}}))}},acceptedOffers:this.getAcceptedOffers(n.offers),options:c.length?c:null,priceListId:a.getPriceListId()||null,salesChannelId:a.getSalesChannelId(),storefrontThemeId:a.getStorefrontThemeId(),metadata:{_fbp:d("_fbp"),_fbc:d("_fbc")}}})];case 2:return(f=e.sent()).isSuccess&&f.data?[4,this.setCart(f.data)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(v="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(h=this.cart.items.find((function(t){return t.variant.id===i.id})))&&o.addToCart(h,s,v,this.cart,n)),null===(x=n.productOptionSet)||void 0===x||x.initOptionValues(),[2,{success:f.isSuccess,response:f}];case 5:return I=e.sent(),console.log(I),[2,{success:!1}];case 6:return[2]}}))}))},this.changeItemQuantity=function(i,n,s,u){return t(l,void 0,void 0,(function(){var t,c,l,m,p,f;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.beforeCartOperationCheck()];case 1:return e.sent(),[4,r.addItemToCart({input:{cartId:(null===(p=this.cart)||void 0===p?void 0:p.id)||null,item:{id:i.id,quantity:n,variant:{id:i.variant.id,name:i.variant.name,bundleProducts:null===(f=i.variant.bundleProducts)||void 0===f?void 0:f.map((function(t){return{id:t.id,productId:t.variant.productId||"",variantId:t.variant.id||"",quantity:t.quantity}}))}},acceptedOffers:this.getAcceptedOffers(s),options:this.createCartLineOptions(i),priceListId:a.getPriceListId()||null,salesChannelId:a.getSalesChannelId(),storefrontThemeId:a.getStorefrontThemeId(),metadata:{_fbp:d("_fbp"),_fbc:d("_fbc")}}})];case 2:return(t=e.sent()).isSuccess&&t.data?[4,this.setCart(t.data)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(c="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(l=i.quantity)>n?o.removeFromCart(i,l-n,this.cart):o.addToCart(i,n-l,c,this.cart,u)),this.removeCardIfEmpty(),[2,{success:t.isSuccess,response:t}];case 5:return m=e.sent(),console.log(m),[2,{success:!1}];case 6:return[2]}}))}))},this.createCart=function(i){return t(l,void 0,void 0,(function(){var t,n=this;return e(this,(function(e){switch(e.label){case 0:return[4,r.createCart({input:{items:i.variantLines.map((function(t){return{variant:{id:t.variantId},quantity:t.quantity}})),couponCode:i.couponCode,salesChannelId:a.getSalesChannelId(),storefrontThemeId:a.getStorefrontThemeId()}})];case 1:return(t=e.sent()).isSuccess&&t.data?[4,this.setCart(t.data)]:[3,3];case 2:e.sent(),e.label=3;case 3:return i.variantLines.forEach((function(t){if(n.cart){var e="".concat(n.cart.id,"-").concat(n.cart.updatedAt),i=n.cart.items.find((function(e){return e.variant.id===t.variantId}));i&&o.addToCart(i,t.quantity,e,n.cart)}})),[2,{success:t.isSuccess,response:t}]}}))}))},this.removeItem=function(i){return t(l,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.changeItemQuantity(i,0)];case 1:return[2,t.sent()]}}))}))},this.removeCart=function(){localStorage.removeItem("cartId"),l.cart=void 0},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){l.isCartLoadFinished&&(clearInterval(e),t(null))}),100)}))},this.getEditLineID=function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("editLineID")||""},this.findExistingItem=function(t,e){var i,r,n,a,o,s;if(!e.productOptionSetId&&!t.bundleSettings)return null===(i=l.cart)||void 0===i?void 0:i.orderLineItems.find((function(e){return e.variant.id===t.id}));if(t.bundleSettings){var d=l.getEditLineID();if(d)if(S=null===(r=l.cart)||void 0===r?void 0:r.orderLineItems.find((function(t){return t.id===d})))return S}var u=(null===(n=l.cart)||void 0===n?void 0:n.orderLineItems.filter((function(e){return e.variant.id===t.id})))||[];if(e.productOptionSetId)for(var c=l.getOptionValues(e),m=u.filter((function(t){var e;return(null===(e=t.options)||void 0===e?void 0:e.length)===c.length}))||[],p=0,f=m;p<f.length;p++){if((S=f[p]).options){for(var v=!0,h=function(t){var i=t.values.map((function(t){return t.value})),r=null===(s=null===(o=null===(a=e.productOptionSet)||void 0===a?void 0:a.options)||void 0===o?void 0:o.find((function(e){return e.id===t.productOptionId})))||void 0===s?void 0:s.values;if(!(v=v&&i.length===(null==r?void 0:r.length)&&i.every((function(t){return null==r?void 0:r.includes(t)}))))return"break"},I=0,g=S.options;I<g.length;I++){if("break"===h(g[I]))break}if(v){if(!t.bundleSettings)return S;if(l.isSameBundleItem(t,S))return S}}}else if(t.bundleSettings)for(var C=0,b=u;C<b.length;C++){var S=b[C];if(l.isSameBundleItem(t,S))return S}},this.isSameBundleItem=function(t,e){var i,r=null===(i=t.bundleSettings)||void 0===i?void 0:i.products,n=e.variant.bundleProducts;return!!r&&((null==r?void 0:r.length)===(null==n?void 0:n.length)&&(null==r?void 0:r.every((function(t){return!!(null==n?void 0:n.find((function(e){var i;return e.id===t.id&&e.quantity===t.quantity&&e.variant.id===(null===(i=t.product)||void 0===i?void 0:i.selectedVariant.id)})))}))))},this.saveCouponCode=function(i){return t(l,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.cart?[4,r.saveCartCouponCode({cartId:this.cart.id,couponCode:i})]:[2,{success:!1,validationError:u.EMPTY_CART}];case 1:return(t=e.sent()).isSuccess&&t.data&&(this.cart=t.data),[2,{success:t.isSuccess,response:t}]}}))}))},this.removeCouponCode=function(){return t(l,void 0,void 0,(function(){return e(this,(function(t){return[2,this.saveCouponCode(null)]}))}))},this.saveCart=function(i){return t(l,void 0,void 0,(function(){var t,a;return e(this,(function(e){switch(e.label){case 0:return(t=new s(i)).customer&&this.baseStore.customerStore.customer&&(t.customer.notificationsAccepted=this.baseStore.customerStore.customer.subscriptionStatus===n.SUBSCRIBED),[4,r.saveCart({input:t})];case 1:return[2,{success:(a=e.sent()).isSuccess,response:a}]}}))}))},this.removeCardIfEmpty=function(){var t;0===(null===(t=l.cart)||void 0===t?void 0:t.itemCount)&&l.removeCart()},this.getCart=function(){return t(l,void 0,void 0,(function(){var t,i,n,a,o,s;return e(this,(function(e){switch(e.label){case 0:if(!("undefined"!=typeof localStorage))return[2];e.label=1;case 1:return e.trys.push([1,6,7,8]),this._isLoadingCart=!0,t=null===(o=this.baseStore.customerStore.customer)||void 0===o?void 0:o.id,(i=(null===(s=this.cart)||void 0===s?void 0:s.id)||localStorage.getItem("cartId"))||t?[4,r.getCartById({id:i})]:[2];case 2:return(n=e.sent()).isSuccess&&n.data?[4,this.setCart(n.data)]:[3,4];case 3:return e.sent(),[3,5];case 4:this.removeCart(),e.label=5;case 5:return[3,8];case 6:return a=e.sent(),console.log(a),[3,8];case 7:return this._isLoadingCart=!1,this._isCartLoadFinished=!0,[7];case 8:return[2]}}))}))},this.setCart=function(i){return t(l,void 0,void 0,(function(){return e(this,(function(t){return localStorage.setItem("cartId",i.id),this.cart=i,[2]}))}))},this.beforeCartOperationCheck=function(){return t(l,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t=localStorage.getItem("cartId"),!this.cart||t?[3,1]:(this.removeCart(),[3,3]);case 1:return this.cart||!t?[3,3]:[4,this.getCart()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},this.createCartLineOptions=function(t){if(t&&t.options){for(var e=[],i=0,r=t.options;i<r.length;i++){var n=r[i],a={productOptionId:n.productOptionId,productOptionsSetId:n.productOptionsSetId,values:n.values.map((function(t){return t.value}))};e.push(a)}return e}return null},this.getOptionValues=function(t){var e,i=[];return null===(e=t.productOptionSet)||void 0===e||e.options.forEach((function(t){t.values.length&&i.push({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:t.values})})),i},this._windowAddToCart=function(i){return t(l,void 0,void 0,(function(){var t,n,s,u,c,l,m,p,f,v,h;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.beforeCartOperationCheck()];case 1:return e.sent(),t=i.itemId?null===(f=this.cart)||void 0===f?void 0:f.items.find((function(t){return t.id===i.itemId})):null,[4,r.addItemToCart({input:{cartId:(null===(v=this.cart)||void 0===v?void 0:v.id)||null,item:{id:i.itemId||null,quantity:i.quantity,variant:{id:i.variantId}},priceListId:a.getPriceListId()||null,salesChannelId:a.getSalesChannelId(),storefrontThemeId:a.getStorefrontThemeId(),metadata:{_fbp:d("_fbp"),_fbc:d("_fbc")}}})];case 2:return(n=e.sent()).isSuccess&&n.data?(i.itemId||(s=(null===(h=this.cart)||void 0===h?void 0:h.items.map((function(t){return t.id})))||[],u=n.data.items.map((function(t){return t.id})),(c=u.find((function(t){return!s.includes(t)})))&&(t=n.data.items.find((function(t){return t.id===c})))),[4,this.setCart(n.data)]):[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&t&&(l="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(m=i.quantity)>i.quantity?o.removeFromCart(t,m-i.quantity,this.cart):o.addToCart(t,i.quantity-m,l,this.cart)),this.removeCardIfEmpty(),[2,{success:n.isSuccess,response:n}];case 5:return p=e.sent(),console.log(p),[2,{success:!1}];case 6:return[2]}}))}))},this.baseStore=c,i(this)}return Object.defineProperty(c.prototype,"isLoadingCart",{get:function(){return this._isLoadingCart},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isCartLoadFinished",{get:function(){return this._isCartLoadFinished},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"checkoutId",{get:function(){var t;return null===(t=this.cart)||void 0===t?void 0:t.id},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"checkoutUrl",{get:function(){if(this.checkoutId)return"/checkout?id=".concat(this.checkoutId,"&step=info")},enumerable:!1,configurable:!0}),c.prototype.getAcceptedOffers=function(t){var e=(null==t?void 0:t.filter((function(t){return t.isSelected&&!t.isAccepted})).map((function(t){return{campaignOfferId:t.campaignOfferId,campaignOfferProductId:t.campaignOfferProductId,productId:t.product.id,quantity:t.quantity,variantId:t.product.selectedVariant.id}})))||[];return e.length?e:void 0},c}();!function(t){t.INSUFFICIENT_STOCK="INSUFFICIENT_STOCK",t.INVALID_PRODUCT_OPTION_VALUES="INVALID_PRODUCT_OPTION_VALUES",t.EMPTY_CART="EMPTY_CART"}(u||(u={}));export{c as CART_LS_KEY,u as IkasCartOperationValidationError,l as IkasCartStore};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import n from"./api.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasProductOptionType as a,IkasCustomerEmailSubscriptionStatus as o}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasStorefrontConfig as s}from"@ikas/storefront-config";import{Analytics as d}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as u}from"@ikas/storefront-api";import{getCookieValue as c}from"../../utils/helper.js";var l,p="cartId",m=function(){function p(p){var m=this;this.cart=null,this._isLoadingCart=!1,this._isCartLoadFinished=!1,this.addItem=function(r,a,o){return void 0===o&&(o=1),t(m,void 0,void 0,(function(){var t,u,p,m,f,v,h,I,g,C,b,S,j,y,x,O,P;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),a.productOptionSetId&&!a.productOptionSet&&this.baseStore.router?(this.baseStore.router.push(a.productHref),[2,{success:!1,validationError:l.INVALID_PRODUCT_OPTION_VALUES}]):a.hasValidProductOptionValues?r.hasStock||r.sellIfOutOfStock?[4,this.beforeCartOperationCheck()]:[2,{success:!1,validationError:l.INSUFFICIENT_STOCK}]:[2,{success:!1,validationError:l.INVALID_PRODUCT_OPTION_VALUES}];case 1:if(e.sent(),t=void 0,this.cart&&(t=this.findExistingItem(r,a))){if(null===(C=a.productOptionSet)||void 0===C||C.initOptionValues(),!r.bundleSettings)return[2,this.changeItemQuantity(t,t.quantity+1,a.offers,a)];if(!this.getEditLineID())return[2,this.changeItemQuantity(t,t.quantity+1,a.offers,a)]}return u=this.getOptionValues(a),p=o,(null==(m=null===(b=a.salesChannels)||void 0===b?void 0:b.find((function(t){return t.id===s.getSalesChannelId()})))?void 0:m.minQuantityPerCart)&&o<m.minQuantityPerCart&&(p=m.minQuantityPerCart),(null==m?void 0:m.maxQuantityPerCart)&&o>m.maxQuantityPerCart&&(p=m.maxQuantityPerCart),f=(null===(S=this.cart)||void 0===S?void 0:S.id)||localStorage.getItem("cartId"),[4,n.addItemToCart({input:i({cartId:f,item:{id:null!==(j=null==t?void 0:t.id)&&void 0!==j?j:null,quantity:null!==(y=null==t?void 0:t.quantity)&&void 0!==y?y:p,variant:{id:r.id,name:a.name,bundleProducts:null===(x=r.bundleSettings)||void 0===x?void 0:x.products.map((function(t){var e,i,r;return{id:t.id,productId:(null===(e=t.product)||void 0===e?void 0:e.id)||"",variantId:(null===(r=null===(i=t.product)||void 0===i?void 0:i.selectedVariant)||void 0===r?void 0:r.id)||"",quantity:t.quantity}}))}},acceptedOffers:this.getAcceptedOffers(a.offers),options:u.length?u:null,priceListId:s.getPriceListId()||null,salesChannelId:s.getSalesChannelId(),storefrontThemeId:s.getStorefrontThemeId(),metadata:{_fbp:c("_fbp"),_fbc:c("_fbc"),_ga:c("_ga")}},a.selectedVariant.subscriptionPlan&&a.selectedVariant.subscriptionPlan.isSelected?{subscriptionPlanId:a.selectedVariant.subscriptionPlan.subscriptionPlanId,subscriptionPlanPeriodId:null===(O=a.selectedVariant.subscriptionPlan.periods.find((function(t){return t.isSelected})))||void 0===O?void 0:O.id}:{})})];case 2:return(v=e.sent()).isSuccess&&v.data?[4,this.setCart(v.data)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(h="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(I=this.cart.items.find((function(t){return t.variant.id===r.id})))&&d.addToCart(I,o,h,this.cart,a)),null===(P=a.productOptionSet)||void 0===P||P.initOptionValues(),[2,{success:v.isSuccess,response:v}];case 5:return g=e.sent(),console.log(g),[2,{success:!1}];case 6:return[2]}}))}))},this.changeItemQuantity=function(r,a,o,u){return t(m,void 0,void 0,(function(){var t,l,p,m,f,v,h,I,g;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.beforeCartOperationCheck()];case 1:return e.sent(),[4,n.addItemToCart({input:i({cartId:(null===(f=this.cart)||void 0===f?void 0:f.id)||null,item:{id:r.id,quantity:a,variant:{id:r.variant.id,name:r.variant.name,bundleProducts:null===(v=r.variant.bundleProducts)||void 0===v?void 0:v.map((function(t){return{id:t.id,productId:t.variant.productId||"",variantId:t.variant.id||"",quantity:t.quantity}}))}},acceptedOffers:this.getAcceptedOffers(o),options:this.createCartLineOptions(r),priceListId:s.getPriceListId()||null,salesChannelId:s.getSalesChannelId(),storefrontThemeId:s.getStorefrontThemeId(),metadata:{_fbp:c("_fbp"),_fbc:c("_fbc"),_ga:c("_ga")}},(null===(h=null==u?void 0:u.selectedVariant)||void 0===h?void 0:h.subscriptionPlan)&&(null===(I=null==u?void 0:u.selectedVariant)||void 0===I?void 0:I.subscriptionPlan.isSelected)?{subscriptionPlanId:null==u?void 0:u.selectedVariant.subscriptionPlan.subscriptionPlanId,subscriptionPlanPeriodId:null===(g=null==u?void 0:u.selectedVariant.subscriptionPlan.periods.find((function(t){return t.isSelected})))||void 0===g?void 0:g.id}:{})})];case 2:return(t=e.sent()).isSuccess&&t.data?[4,this.setCart(t.data)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(l="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(p=r.quantity)>a?d.removeFromCart(r,p-a,this.cart):d.addToCart(r,a-p,l,this.cart,u)),this.removeCardIfEmpty(),[2,{success:t.isSuccess,response:t}];case 5:return m=e.sent(),console.log(m),[2,{success:!1}];case 6:return[2]}}))}))},this.createCart=function(i){return t(m,void 0,void 0,(function(){var t,r=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.createCart({input:{items:i.variantLines.map((function(t){return{variant:{id:t.variantId},quantity:t.quantity}})),couponCode:i.couponCode,salesChannelId:s.getSalesChannelId(),storefrontThemeId:s.getStorefrontThemeId()}})];case 1:return(t=e.sent()).isSuccess&&t.data?[4,this.setCart(t.data)]:[3,3];case 2:e.sent(),e.label=3;case 3:return i.variantLines.forEach((function(t){if(r.cart){var e="".concat(r.cart.id,"-").concat(r.cart.updatedAt),i=r.cart.items.find((function(e){return e.variant.id===t.variantId}));i&&d.addToCart(i,t.quantity,e,r.cart)}})),[2,{success:t.isSuccess,response:t}]}}))}))},this.removeItem=function(i){return t(m,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.changeItemQuantity(i,0)];case 1:return[2,t.sent()]}}))}))},this.removeCart=function(){localStorage.removeItem("cartId"),m.cart=void 0},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){m.isCartLoadFinished&&(clearInterval(e),t(null))}),100)}))},this.getEditLineID=function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("editLineID")||""},this.findExistingItem=function(t,e){var i,r,n,a,o,s;if(!e.productOptionSetId&&!t.bundleSettings)return null===(i=m.cart)||void 0===i?void 0:i.orderLineItems.find((function(e){return e.variant.id===t.id}));if(t.bundleSettings){var d=m.getEditLineID();if(d)if(S=null===(r=m.cart)||void 0===r?void 0:r.orderLineItems.find((function(t){return t.id===d})))return S}var u=(null===(n=m.cart)||void 0===n?void 0:n.orderLineItems.filter((function(e){return e.variant.id===t.id})))||[];if(e.productOptionSetId)for(var c=m.getOptionValues(e),l=u.filter((function(t){var e;return(null===(e=t.options)||void 0===e?void 0:e.length)===c.length}))||[],p=0,f=l;p<f.length;p++){if((S=f[p]).options){for(var v=!0,h=function(t){var i=t.values.map((function(t){return t.value})),r=null===(s=null===(o=null===(a=e.productOptionSet)||void 0===a?void 0:a.options)||void 0===o?void 0:o.find((function(e){return e.id===t.productOptionId})))||void 0===s?void 0:s.values;if(!(v=v&&i.length===(null==r?void 0:r.length)&&i.every((function(t){return null==r?void 0:r.includes(t)}))))return"break"},I=0,g=S.options;I<g.length;I++){if("break"===h(g[I]))break}if(v){if(!t.bundleSettings)return S;if(m.isSameBundleItem(t,S))return S}}}else if(t.bundleSettings)for(var C=0,b=u;C<b.length;C++){var S=b[C];if(m.isSameBundleItem(t,S))return S}},this.isSameBundleItem=function(t,e){var i,r=null===(i=t.bundleSettings)||void 0===i?void 0:i.products,n=e.variant.bundleProducts;return!!r&&((null==r?void 0:r.length)===(null==n?void 0:n.length)&&(null==r?void 0:r.every((function(t){return!!(null==n?void 0:n.find((function(e){var i;return e.id===t.id&&e.quantity===t.quantity&&e.variant.id===(null===(i=t.product)||void 0===i?void 0:i.selectedVariant.id)})))}))))},this.saveCouponCode=function(i){return t(m,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.cart?[4,n.saveCartCouponCode({cartId:this.cart.id,couponCode:i})]:[2,{success:!1,validationError:l.EMPTY_CART}];case 1:return(t=e.sent()).isSuccess&&t.data&&(this.cart=t.data),[2,{success:t.isSuccess,response:t}]}}))}))},this.removeCouponCode=function(){return t(m,void 0,void 0,(function(){return e(this,(function(t){return[2,this.saveCouponCode(null)]}))}))},this.removeGiftCardLine=function(i){return t(m,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.cart?[4,n.removeGiftCardFromCart({cartId:this.cart.id,giftCardId:i})]:[2,{success:!1,validationError:l.EMPTY_CART}];case 1:return(t=e.sent()).isSuccess&&t.data&&(this.cart=t.data),[2,{success:t.isSuccess,response:t}]}}))}))},this.saveCart=function(i){return t(m,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return(t=new u(i)).customer&&this.baseStore.customerStore.customer&&(t.customer.notificationsAccepted=this.baseStore.customerStore.customer.subscriptionStatus===o.SUBSCRIBED),[4,n.saveCart({input:t})];case 1:return[2,{success:(r=e.sent()).isSuccess,response:r}]}}))}))},this.removeCardIfEmpty=function(){var t;0===(null===(t=m.cart)||void 0===t?void 0:t.itemCount)&&m.removeCart()},this.getCart=function(){return t(m,void 0,void 0,(function(){var t,i,r,a,o,s;return e(this,(function(e){switch(e.label){case 0:if(!("undefined"!=typeof localStorage))return[2];e.label=1;case 1:return e.trys.push([1,6,7,8]),this._isLoadingCart=!0,t=null===(o=this.baseStore.customerStore.customer)||void 0===o?void 0:o.id,(i=(null===(s=this.cart)||void 0===s?void 0:s.id)||localStorage.getItem("cartId"))||t?[4,n.getCartById({id:i})]:[2];case 2:return(r=e.sent()).isSuccess&&r.data?[4,this.setCart(r.data)]:[3,4];case 3:return e.sent(),[3,5];case 4:this.removeCart(),e.label=5;case 5:return[3,8];case 6:return a=e.sent(),console.log(a),[3,8];case 7:return this._isLoadingCart=!1,this._isCartLoadFinished=!0,[7];case 8:return[2]}}))}))},this.setCart=function(i){return t(m,void 0,void 0,(function(){return e(this,(function(t){return localStorage.setItem("cartId",i.id),this.cart=i,[2]}))}))},this.beforeCartOperationCheck=function(){return t(m,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t=localStorage.getItem("cartId"),!this.cart||t?[3,1]:(this.removeCart(),[3,3]);case 1:return this.cart||!t?[3,3]:[4,this.getCart()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},this.createCartLineOptions=function(t){if(t&&t.options){for(var e=[],i=0,r=t.options;i<r.length;i++){var n=r[i],a={productOptionId:n.productOptionId,productOptionsSetId:n.productOptionsSetId,values:n.values.map((function(t){return t.value}))};e.push(a)}return e}return null},this.getOptionValues=function(t){var e,i=[];return null===(e=t.productOptionSet)||void 0===e||e.options.forEach((function(t){var e=t.values;t.type===a.DATE_PICKER&&(e=t.values.map((function(t){var e=new Date(t);return isNaN(e.getTime())?t:e.toISOString().split("T")[0]}))),t.values.length&&i.push({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:e})})),i},this._windowAddToCart=function(i){return t(m,void 0,void 0,(function(){var t,r,a,o,u,l,p,m,f,v,h;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.beforeCartOperationCheck()];case 1:return e.sent(),t=i.itemId?null===(f=this.cart)||void 0===f?void 0:f.items.find((function(t){return t.id===i.itemId})):null,[4,n.addItemToCart({input:{cartId:(null===(v=this.cart)||void 0===v?void 0:v.id)||null,item:{id:i.itemId||null,quantity:i.quantity,variant:{id:i.variantId}},priceListId:s.getPriceListId()||null,salesChannelId:s.getSalesChannelId(),storefrontThemeId:s.getStorefrontThemeId(),metadata:{_fbp:c("_fbp"),_fbc:c("_fbc"),_ga:c("_ga")}}})];case 2:return(r=e.sent()).isSuccess&&r.data?(i.itemId||(a=(null===(h=this.cart)||void 0===h?void 0:h.items.map((function(t){return t.id})))||[],o=r.data.items.map((function(t){return t.id})),(u=o.find((function(t){return!a.includes(t)})))&&(t=r.data.items.find((function(t){return t.id===u})))),[4,this.setCart(r.data)]):[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&t&&(l="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(p=i.quantity)>i.quantity?d.removeFromCart(t,p-i.quantity,this.cart):d.addToCart(t,i.quantity-p,l,this.cart)),this.removeCardIfEmpty(),[2,{success:r.isSuccess,response:r}];case 5:return m=e.sent(),console.log(m),[2,{success:!1}];case 6:return[2]}}))}))},this.baseStore=p,r(this)}return Object.defineProperty(p.prototype,"isLoadingCart",{get:function(){return this._isLoadingCart},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isCartLoadFinished",{get:function(){return this._isCartLoadFinished},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"checkoutId",{get:function(){var t;return null===(t=this.cart)||void 0===t?void 0:t.id},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"checkoutUrl",{get:function(){if(this.checkoutId)return"/checkout?id=".concat(this.checkoutId,"&step=info")},enumerable:!1,configurable:!0}),p.prototype.getAcceptedOffers=function(t){var e=(null==t?void 0:t.filter((function(t){return t.isSelected&&!t.isAccepted})).map((function(t){return{campaignOfferId:t.campaignOfferId,campaignOfferProductId:t.campaignOfferProductId,productId:t.product.id,quantity:t.quantity,variantId:t.product.selectedVariant.id}})))||[];return e.length?e:void 0},p}();!function(t){t.INSUFFICIENT_STOCK="INSUFFICIENT_STOCK",t.INVALID_PRODUCT_OPTION_VALUES="INVALID_PRODUCT_OPTION_VALUES",t.EMPTY_CART="EMPTY_CART"}(l||(l={}));export{p as CART_LS_KEY,l as IkasCartOperationValidationError,m as IkasCartStore};
@@ -1,9 +1,10 @@
1
1
  import { APIResponse } from "@ikas/fe-api-client";
2
- import { CheckStocksQueryParams, CreateKlarnaClientTokenParams, CreateSaleTransactionQueryParams, CreateStripePaymentIntentParams, GetAvailableShippingCountriesQueryParams, GetAvailableStockLocationQueryParams, ListCheckoutSettingsQueryParams, ListPaymentGatewayQueryParams, ListProductFileQueryParams, ListStockLocationQueryParams, RetrieveInstallmentInfoQueryParams, GetPayPalClientIdTokenParams, CreatePayPalOrderParams, GetDigitalProductFileDownloadUrlQueryParams, CheckCartStocksQueryParams, CreateAdyenBalancePlatformPaymentParams } from "@ikas/storefront-api";
2
+ import { CheckStocksQueryParams, CreateKlarnaClientTokenParams, CreateSaleTransactionQueryParams, CreateStripePaymentIntentParams, GetAvailableShippingCountriesQueryParams, GetAvailableStockLocationQueryParams, ListCheckoutSettingsQueryParams, ListPaymentGatewayQueryParams, ListProductFileQueryParams, ListStockLocationQueryParams, RetrieveInstallmentInfoQueryParams, GetPayPalClientIdTokenParams, CreatePayPalOrderParams, GetDigitalProductFileDownloadUrlQueryParams, CheckCartStocksQueryParams, CreateAdyenBalancePlatformPaymentParams, UpdatePayPalOrderParams, HepsipayFrameInitParams } from "@ikas/storefront-api";
3
3
  import { IkasAvailableStockLocation, IkasCheckoutSettings, IkasPaymentGateway, IkasStockLocation, IkasProductFile } from "../../models/data";
4
4
  export default class CheckoutStore {
5
5
  static createSaleTransactionWithCart(params: CreateSaleTransactionQueryParams): Promise<APIResponse<import("@ikas/storefront-api").TransactionResponse> | APIResponse<undefined>>;
6
6
  static listPaymentGateway(params: ListPaymentGatewayQueryParams): Promise<APIResponse<IkasPaymentGateway[]>>;
7
+ static getStoreCreditBalance(): Promise<APIResponse<import("@ikas/storefront-models").IkasStoreCreditBalance | null>>;
7
8
  static listProductFile(params: ListProductFileQueryParams): Promise<APIResponse<IkasProductFile[]>>;
8
9
  static getDigitalProductFileDownloadUrl(params: GetDigitalProductFileDownloadUrlQueryParams): Promise<APIResponse<string>>;
9
10
  static retrieveInstallmentInfo(params: RetrieveInstallmentInfoQueryParams): Promise<APIResponse<undefined> | APIResponse<import("@ikas/storefront-api").RetrieveInstallmentInfoResponse>>;
@@ -18,4 +19,6 @@ export default class CheckoutStore {
18
19
  static createAdyenBalancePlatformPaymentSession(params: CreateAdyenBalancePlatformPaymentParams): Promise<APIResponse<import("@ikas/storefront-api").CreateAdyenPlatformSessionResponse>>;
19
20
  static getPayPalClientId(params: GetPayPalClientIdTokenParams): Promise<APIResponse<import("@ikas/storefront-api").GetPaypalClientIdResponse>>;
20
21
  static createPayPalOrder(params: CreatePayPalOrderParams): Promise<APIResponse<import("@ikas/storefront-api").CreatePaypalOrderResponse>>;
22
+ static updatePaypalOrder(params: UpdatePayPalOrderParams): Promise<APIResponse<boolean>>;
23
+ static hepsipayFrameInit(params: HepsipayFrameInitParams): Promise<APIResponse<import("@ikas/storefront-api").HepsipayFrameInitResponse>>;
21
24
  }
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.js';import{APIResponse as r}from'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{createSaleTransactionWithCart as o,listPaymentGateway as i,listProductFile as n,getDigitalProductFileDownloadUrl as a,retrieveInstallmentInfo as s,checkStocks as d,checkCartStocks as m,listCheckoutSettings as u,getAvailableShippingCountries as l,listStockLocations as c,getAvailableStockLocations as p,createStripePaymentIntent as f,createKlarnaClientToken as h,createAdyenBalancePlatformPaymentSession as v,getPayPalClientId as j,createPayPalOrder as x}from"@ikas/storefront-api";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import{IkasCheckoutSettings as g}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import{IkasPaymentGateway as w}from"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import{IkasProductFile as b}from"../../models/data/product-file/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import{IkasAvailableStockLocation as k}from"../../models/data/stock-location/available/index.js";import{IkasStockLocation as y}from"../../models/data/stock-location/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";var L=function(){function L(){}return L.createSaleTransactionWithCart=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,o(r)];case 1:return[2,t.sent()]}}))}))},L.listPaymentGateway=function(o){var n;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,i(o)];case 1:return t=e.sent(),[2,new r(null===(n=t.data)||void 0===n?void 0:n.map((function(t){return new w(t)})),t.graphQLErrors)]}}))}))},L.listProductFile=function(o){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,n(o)];case 1:return t=e.sent(),[2,new r(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new b(t)})),t.graphQLErrors)]}}))}))},L.getDigitalProductFileDownloadUrl=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a(o)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},L.retrieveInstallmentInfo=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,s(r)];case 1:return[2,t.sent()]}}))}))},L.checkStocks=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,d(r)];case 1:return[2,t.sent()]}}))}))},L.checkCartStocks=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,m(r)];case 1:return[2,t.sent()]}}))}))},L.listCheckoutSettings=function(o){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u(o)];case 1:return t=e.sent(),[2,new r(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new g(t)})),t.graphQLErrors)]}}))}))},L.getAvailableShippingCountries=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,l(r)];case 1:return[2,t.sent()]}}))}))},L.listStockLocation=function(o){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,c(o)];case 1:return t=e.sent(),[2,new r(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new y(t)})),t.graphQLErrors)]}}))}))},L.getAvailableStockLocations=function(o){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p(o)];case 1:return t=e.sent(),[2,new r(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new k(t)})),t.graphQLErrors)]}}))}))},L.createStripePaymentIntent=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f(o)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},L.createKlarnaClientToken=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,h(o)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},L.createAdyenBalancePlatformPaymentSession=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,v(o)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},L.getPayPalClientId=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,j(o)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},L.createPayPalOrder=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,x(o)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},L}();export{L as default};
1
+ import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.js';import{APIResponse as r}from'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{createSaleTransactionWithCart as i,listPaymentGateway as o,getStoreCreditBalance as n,listProductFile as a,getDigitalProductFileDownloadUrl as s,retrieveInstallmentInfo as d,checkStocks as u,checkCartStocks as c,listCheckoutSettings as m,getAvailableShippingCountries as l,listStockLocations as p,getAvailableStockLocations as f,createStripePaymentIntent as h,createKlarnaClientToken as v,createAdyenBalancePlatformPaymentSession as j,getPayPalClientId as x,createPayPalOrder as g,updatePaypalOrder as w,hepsipayFrameInit as b}from"@ikas/storefront-api";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import{IkasCheckoutSettings as y}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import{IkasPaymentGateway as k}from"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import{IkasProductFile as L}from"../../models/data/product-file/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import{IkasAvailableStockLocation as E}from"../../models/data/stock-location/available/index.js";import{IkasStockLocation as P}from"../../models/data/stock-location/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";var Q=function(){function Q(){}return Q.createSaleTransactionWithCart=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,i(r)];case 1:return[2,t.sent()]}}))}))},Q.listPaymentGateway=function(i){var n;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,o(i)];case 1:return t=e.sent(),[2,new r(null===(n=t.data)||void 0===n?void 0:n.map((function(t){return new k(t)})),t.graphQLErrors)]}}))}))},Q.getStoreCreditBalance=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,n()];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.listProductFile=function(i){var o;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a(i)];case 1:return t=e.sent(),[2,new r(null===(o=t.data)||void 0===o?void 0:o.map((function(t){return new L(t)})),t.graphQLErrors)]}}))}))},Q.getDigitalProductFileDownloadUrl=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,s(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.retrieveInstallmentInfo=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,d(r)];case 1:return[2,t.sent()]}}))}))},Q.checkStocks=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u(r)];case 1:return[2,t.sent()]}}))}))},Q.checkCartStocks=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,c(r)];case 1:return[2,t.sent()]}}))}))},Q.listCheckoutSettings=function(i){var o;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,m(i)];case 1:return t=e.sent(),[2,new r(null===(o=t.data)||void 0===o?void 0:o.map((function(t){return new y(t)})),t.graphQLErrors)]}}))}))},Q.getAvailableShippingCountries=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,l(r)];case 1:return[2,t.sent()]}}))}))},Q.listStockLocation=function(i){var o;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p(i)];case 1:return t=e.sent(),[2,new r(null===(o=t.data)||void 0===o?void 0:o.map((function(t){return new P(t)})),t.graphQLErrors)]}}))}))},Q.getAvailableStockLocations=function(i){var o;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f(i)];case 1:return t=e.sent(),[2,new r(null===(o=t.data)||void 0===o?void 0:o.map((function(t){return new E(t)})),t.graphQLErrors)]}}))}))},Q.createStripePaymentIntent=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,h(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.createKlarnaClientToken=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,v(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.createAdyenBalancePlatformPaymentSession=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,j(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.getPayPalClientId=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,x(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.createPayPalOrder=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,g(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.updatePaypalOrder=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,w(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q.hepsipayFrameInit=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,b(i)];case 1:return t=e.sent(),[2,new r(t.data,t.graphQLErrors)]}}))}))},Q}();export{Q as default};
@@ -1,19 +1,25 @@
1
1
  import { APIResponse } from "@ikas/fe-api-client";
2
- import { CheckCustomerEmailQueryParams, SubscribeToMarketingNotificationsQueryParams, CreateCustomerReviewQueryParams, CreateOrderRefundRequestQueryParams, CustomerForgotPasswordQueryParams, CustomerLoginQueryParams, CustomerRecoverPasswordQueryParams, CustomerRefreshTokenQueryParams, CustomerSocialLoginQueryParams, GetCustomerOrdersQueryParams, GetLastViewedProductsQueryParams, GetOrderByEmailQueryParams, IsFavoriteProductQueryParams, ListCustomerReviewsQueryParams, ListCustomerReviewSummaryQueryParams, ListOrderRefundSettingsQueryParams, ListOrderTransactionsQueryParams, ListOrderTransactionsWithPricesQueryParams, RegisterCustomerQueryParams, SaveFavoriteProductQueryParams, SaveLastViewedProductsQueryParams, SaveMyCustomerQueryParams, SendContactFormToMerchantQueryParams, ActivateCustomerQueryParams, ResendCustomerActivationMailQueryParams, ValidateCustomerPhoneVerificationCodeQueryParams, ResendCustomerPhoneVerificationCodeQueryParams, SaveCustomerFormDataQueryParams, CustomerDeactiveQueryParams } from "@ikas/storefront-api";
2
+ import { CheckCustomerEmailQueryParams, SubscribeToMarketingNotificationsQueryParams, CreateCustomerReviewQueryParams, CreateOrderRefundRequestQueryParams, CustomerForgotPasswordQueryParams, CustomerLoginQueryParams, CustomerRecoverPasswordQueryParams, CustomerRefreshTokenQueryParams, CustomerSocialLoginQueryParams, GetCustomerOrdersQueryParams, GetLastViewedProductsQueryParams, GetOrderByEmailQueryParams, IsFavoriteProductQueryParams, ListCustomerReviewsQueryParams, ListCustomerReviewSummaryQueryParams, ListOrderRefundSettingsQueryParams, ListOrderTransactionsQueryParams, ListOrderTransactionsWithPricesQueryParams, RegisterCustomerQueryParams, SaveFavoriteProductQueryParams, SaveLastViewedProductsQueryParams, SaveMyCustomerQueryParams, SendContactFormToMerchantQueryParams, ActivateCustomerQueryParams, ResendCustomerActivationMailQueryParams, ValidateCustomerPhoneVerificationCodeQueryParams, SaveCustomerFormDataQueryParams, CustomerDeactiveQueryParams, ValidateOTPCodeQueryParams } from "@ikas/storefront-api";
3
3
  import { IkasCustomer, IkasCustomerAttribute, IkasCustomerReview, IkasCustomerReviewSummary, IkasFavoriteProduct, IkasLastViewedProduct, IkasOrder, IkasOrderRefundSettings, IkasOrderTransaction, IkasOrderTransactionWithPrices } from "../../models/data";
4
4
  export default class CustomerStoreAPI {
5
5
  static login(params: CustomerLoginQueryParams): Promise<APIResponse<{
6
6
  customer: IkasCustomer | null;
7
+ flowId: string | null;
8
+ otpSend: boolean | null;
7
9
  token: string;
8
10
  tokenExpiry: number;
9
11
  } | null>>;
10
12
  static socialLogin(params: CustomerSocialLoginQueryParams): Promise<APIResponse<{
11
13
  customer: IkasCustomer | null;
14
+ flowId: string | null;
15
+ otpSend: boolean | null;
12
16
  token: string;
13
17
  tokenExpiry: number;
14
18
  } | null>>;
15
19
  static register(params: RegisterCustomerQueryParams): Promise<APIResponse<{
16
20
  customer: IkasCustomer | null;
21
+ flowId: string | null;
22
+ otpSend: boolean | null;
17
23
  token: string;
18
24
  tokenExpiry: number;
19
25
  } | null>>;
@@ -54,8 +60,15 @@ export default class CustomerStoreAPI {
54
60
  static listCustomerAttribute(): Promise<APIResponse<IkasCustomerAttribute[]>>;
55
61
  static activateCustomer(params: ActivateCustomerQueryParams): Promise<APIResponse<undefined> | APIResponse<string>>;
56
62
  static resendCustomerActivationMail(params: ResendCustomerActivationMailQueryParams): Promise<APIResponse<undefined> | APIResponse<boolean>>;
57
- static resendCustomerPhoneVerificationCode(params: ResendCustomerPhoneVerificationCodeQueryParams): Promise<APIResponse<undefined> | APIResponse<boolean>>;
63
+ static resendCustomerPhoneVerificationCode(): Promise<APIResponse<undefined> | APIResponse<boolean>>;
58
64
  static validateCustomerPhoneVerificationCode(params: ValidateCustomerPhoneVerificationCodeQueryParams): Promise<APIResponse<undefined> | APIResponse<boolean>>;
65
+ static validateOTPCode(params: ValidateOTPCodeQueryParams): Promise<APIResponse<{
66
+ customer: IkasCustomer | null;
67
+ flowId: string | null;
68
+ otpSend: boolean | null;
69
+ token: string;
70
+ tokenExpiry: number;
71
+ } | null>>;
59
72
  static saveCustomerFormData(params: SaveCustomerFormDataQueryParams): Promise<APIResponse<undefined> | APIResponse<boolean>>;
60
73
  static exportCustomerPersonelData(): Promise<APIResponse<undefined> | APIResponse<string>>;
61
74
  static deactivateCustomer(params: CustomerDeactiveQueryParams): Promise<APIResponse<undefined> | APIResponse<boolean>>;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import{APIResponse as n}from'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{login as i,socialLogin as o,register as s,refreshToken as a,forgotPassword as d,recoverPassword as u,checkEmail as c,getCustomer as l,saveCustomer as m,getOrders as p,getOrderByEmail as f,listOrderTransactions as h,listOrderTransactionsWithPrices as v,createOrderRefundRequest as w,subscribeToMarketingNotifications as j,getLastViewedProducts as x,saveLastViewedProducts as b,listOrderRefundSettings as g,sendContactFormToMerchant as L,listFavoriteProducts as E,saveFavoriteProduct as y,isFavoriteProduct as Q,createCustomerReview as k,listCustomerReviews as C,listCustomerReviewSummary as P,listCustomerAttribute as _,activateCustomer as T,resendCustomerActivationMail as R,resendCustomerPhoneVerificationCode as O,validateCustomerPhoneVerificationCode as F,saveCustomerFormData as V,exportCustomerPersonelData as z,deactivateCustomer as A}from"@ikas/storefront-api";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import{IkasCustomerAttribute as I}from"../../models/data/customer/attribute/index.js";import{IkasCustomerReviewSummary as M}from"../../models/data/customer/review/summary/index.js";import{IkasCustomerReview as S}from"../../models/data/customer/review/index.js";import{IkasCustomer as D}from"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import{IkasFavoriteProduct as q}from"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasLastViewedProduct as B}from"../../models/data/last-viewed-product/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import{IkasOrderTransactionWithPrices as G}from"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import{IkasOrderRefundSettings as N}from"../../models/data/order/refund/settings/index.js";import{IkasOrderTransaction as W}from"../../models/data/order/transaction/index.js";import{IkasOrder as H}from"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";var J=function(){function J(){}return J.login=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,i(o)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new D(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},J.socialLogin=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,o(i)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new D(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},J.register=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,s(i)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new D(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},J.refreshToken=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a(r)];case 1:return[2,t.sent()]}}))}))},J.forgotPassword=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,d(r)];case 1:return[2,t.sent()]}}))}))},J.recoverPassword=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u(r)];case 1:return[2,t.sent()]}}))}))},J.checkEmail=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,c(r)];case 1:return[2,t.sent()]}}))}))},J.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,l()];case 1:return t=e.sent(),[2,new n(t.data?new D(t.data):null,t.graphQLErrors)]}}))}))},J.saveCustomer=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,m(r)];case 1:return t=e.sent(),[2,new n(t.data?new D(t.data):null,t.graphQLErrors)]}}))}))},J.getOrders=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new H(t)})),t.graphQLErrors)]}}))}))},J.getOrderByEmail=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f(r)];case 1:return t=e.sent(),[2,new n(t.data?new H(t.data):null,t.graphQLErrors)]}}))}))},J.listOrderTransactions=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,h(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new W(t)})),t.graphQLErrors)]}}))}))},J.listOrderTransactionsWithPrices=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,v(r)];case 1:return t=e.sent(),[2,new n(t.data?new G(t.data):null,t.graphQLErrors)]}}))}))},J.createOrderRefundRequest=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,w(r)];case 1:return t=e.sent(),[2,new n(t.data?new H(t.data):null,t.graphQLErrors)]}}))}))},J.subscribeToMarketingNotifications=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,j(r)];case 1:return[2,t.sent()]}}))}))},J.getLastViewedProducts=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,x(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new B(t)})),t.graphQLErrors)]}}))}))},J.saveLastViewedProducts=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,b(r)];case 1:return[2,t.sent()]}}))}))},J.listOrderRefundSettings=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,g(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new N(t)})),t.graphQLErrors)]}}))}))},J.sendContactFormToMerchant=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,L(r)];case 1:return[2,t.sent()]}}))}))},J.listFavoriteProducts=function(){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,E()];case 1:return t=e.sent(),[2,new n(null===(r=t.data)||void 0===r?void 0:r.map((function(t){return new q(t)})),t.graphQLErrors)]}}))}))},J.saveFavoriteProduct=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,y(r)];case 1:return[2,t.sent()]}}))}))},J.isFavoriteProduct=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,Q({productId:r.productId})];case 1:return[2,t.sent()]}}))}))},J.createCustomerReview=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,k(r)];case 1:return t=e.sent(),[2,new n(t.data?new S(t.data):null,t.graphQLErrors)]}}))}))},J.listCustomerReviews=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,C(r({},i))];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{data:t.data.data.map((function(t){return new S(t)}))}):null,t.graphQLErrors)]}}))}))},J.listCustomerReviewSummary=function(i){var o;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,P(i)];case 1:return t=e.sent(),[2,new n(r(r({},t.data),{data:null===(o=t.data)||void 0===o?void 0:o.data.map((function(t){return new M(t)}))}),t.graphQLErrors)]}}))}))},J.listCustomerAttribute=function(){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,_()];case 1:return t=e.sent(),[2,new n(null===(r=t.data)||void 0===r?void 0:r.sort((function(t,e){return t.order&&e.order?t.order-e.order:-1})).map((function(t){return new I(t)}),t.graphQLErrors))]}}))}))},J.activateCustomer=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,T(r)];case 1:return[2,t.sent()]}}))}))},J.resendCustomerActivationMail=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,R(r)];case 1:return[2,t.sent()]}}))}))},J.resendCustomerPhoneVerificationCode=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,O(r)];case 1:return[2,t.sent()]}}))}))},J.validateCustomerPhoneVerificationCode=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,F(r)];case 1:return[2,t.sent()]}}))}))},J.saveCustomerFormData=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,V(r)];case 1:return[2,t.sent()]}}))}))},J.exportCustomerPersonelData=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,z()];case 1:return[2,t.sent()]}}))}))},J.deactivateCustomer=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,A(r)];case 1:return[2,t.sent()]}}))}))},J}();export{J as default};
1
+ import{__awaiter as t,__generator as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import{APIResponse as n}from'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{login as i,socialLogin as o,register as s,refreshToken as a,forgotPassword as d,recoverPassword as u,checkEmail as c,getCustomer as l,saveCustomer as m,getOrders as p,getOrderByEmail as f,listOrderTransactions as h,listOrderTransactionsWithPrices as v,createOrderRefundRequest as w,subscribeToMarketingNotifications as j,getLastViewedProducts as x,saveLastViewedProducts as b,listOrderRefundSettings as g,sendContactFormToMerchant as L,listFavoriteProducts as E,saveFavoriteProduct as Q,isFavoriteProduct as y,createCustomerReview as C,listCustomerReviews as k,listCustomerReviewSummary as P,listCustomerAttribute as _,activateCustomer as T,resendCustomerActivationMail as O,resendCustomerPhoneVerificationCode as R,validateCustomerPhoneVerificationCode as F,validateOTPCode as V,saveCustomerFormData as z,exportCustomerPersonelData as A,deactivateCustomer as I}from"@ikas/storefront-api";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import{IkasCustomerAttribute as M}from"../../models/data/customer/attribute/index.js";import{IkasCustomerReviewSummary as S}from"../../models/data/customer/review/summary/index.js";import{IkasCustomerReview as D}from"../../models/data/customer/review/index.js";import{IkasCustomer as q}from"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import{IkasFavoriteProduct as B}from"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasLastViewedProduct as G}from"../../models/data/last-viewed-product/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import{IkasOrderTransactionWithPrices as N}from"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import{IkasOrderRefundSettings as W}from"../../models/data/order/refund/settings/index.js";import{IkasOrderTransaction as H}from"../../models/data/order/transaction/index.js";import{IkasOrder as J}from"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";var K=function(){function K(){}return K.login=function(o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,i(o)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new q(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},K.socialLogin=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,o(i)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new q(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},K.register=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,s(i)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new q(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},K.refreshToken=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a(r)];case 1:return[2,t.sent()]}}))}))},K.forgotPassword=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,d(r)];case 1:return[2,t.sent()]}}))}))},K.recoverPassword=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u(r)];case 1:return[2,t.sent()]}}))}))},K.checkEmail=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,c(r)];case 1:return[2,t.sent()]}}))}))},K.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,l()];case 1:return t=e.sent(),[2,new n(t.data?new q(t.data):null,t.graphQLErrors)]}}))}))},K.saveCustomer=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,m(r)];case 1:return t=e.sent(),[2,new n(t.data?new q(t.data):null,t.graphQLErrors)]}}))}))},K.getOrders=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,p(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new J(t)})),t.graphQLErrors)]}}))}))},K.getOrderByEmail=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f(r)];case 1:return t=e.sent(),[2,new n(t.data?new J(t.data):null,t.graphQLErrors)]}}))}))},K.listOrderTransactions=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,h(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new H(t)})),t.graphQLErrors)]}}))}))},K.listOrderTransactionsWithPrices=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,v(r)];case 1:return t=e.sent(),[2,new n(t.data?new N(t.data):null,t.graphQLErrors)]}}))}))},K.createOrderRefundRequest=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,w(r)];case 1:return t=e.sent(),[2,new n(t.data?new J(t.data):null,t.graphQLErrors)]}}))}))},K.subscribeToMarketingNotifications=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,j(r)];case 1:return[2,t.sent()]}}))}))},K.getLastViewedProducts=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,x(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new G(t)})),t.graphQLErrors)]}}))}))},K.saveLastViewedProducts=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,b(r)];case 1:return[2,t.sent()]}}))}))},K.listOrderRefundSettings=function(r){var i;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,g(r)];case 1:return t=e.sent(),[2,new n(null===(i=t.data)||void 0===i?void 0:i.map((function(t){return new W(t)})),t.graphQLErrors)]}}))}))},K.sendContactFormToMerchant=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,L(r)];case 1:return[2,t.sent()]}}))}))},K.listFavoriteProducts=function(){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,E()];case 1:return t=e.sent(),[2,new n(null===(r=t.data)||void 0===r?void 0:r.map((function(t){return new B(t)})),t.graphQLErrors)]}}))}))},K.saveFavoriteProduct=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,Q(r)];case 1:return[2,t.sent()]}}))}))},K.isFavoriteProduct=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,y({productId:r.productId})];case 1:return[2,t.sent()]}}))}))},K.createCustomerReview=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,C(r)];case 1:return t=e.sent(),[2,new n(t.data?new D(t.data):null,t.graphQLErrors)]}}))}))},K.listCustomerReviews=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,k(r({},i))];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{data:t.data.data.map((function(t){return new D(t)}))}):null,t.graphQLErrors)]}}))}))},K.listCustomerReviewSummary=function(i){var o;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,P(i)];case 1:return t=e.sent(),[2,new n(r(r({},t.data),{data:null===(o=t.data)||void 0===o?void 0:o.data.map((function(t){return new S(t)}))}),t.graphQLErrors)]}}))}))},K.listCustomerAttribute=function(){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,_()];case 1:return t=e.sent(),[2,new n(null===(r=t.data)||void 0===r?void 0:r.sort((function(t,e){return t.order&&e.order?t.order-e.order:-1})).map((function(t){return new M(t)}),t.graphQLErrors))]}}))}))},K.activateCustomer=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,T(r)];case 1:return[2,t.sent()]}}))}))},K.resendCustomerActivationMail=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,O(r)];case 1:return[2,t.sent()]}}))}))},K.resendCustomerPhoneVerificationCode=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,R()];case 1:return[2,t.sent()]}}))}))},K.validateCustomerPhoneVerificationCode=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,F(r)];case 1:return[2,t.sent()]}}))}))},K.validateOTPCode=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,V(i)];case 1:return t=e.sent(),[2,new n(t.data?r(r({},t.data),{customer:t.data.customer?new q(t.data.customer):null}):null,t.graphQLErrors)]}}))}))},K.saveCustomerFormData=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,z(r)];case 1:return[2,t.sent()]}}))}))},K.exportCustomerPersonelData=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,A()];case 1:return[2,t.sent()]}}))}))},K.deactivateCustomer=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,I(r)];case 1:return[2,t.sent()]}}))}))},K}();export{K as default};
@@ -3,7 +3,7 @@ import { APIResponse } from "@ikas/fe-api-client";
3
3
  import { IkasLoginError, IkasRegisterError } from "@ikas/storefront-api";
4
4
  import { IkasBaseStore } from "../base";
5
5
  import { SaveCustomerFormDataInput } from "@ikas/storefront-api/src/__api/types";
6
- export declare type SocialLoginProvider = "facebook" | "google" | "twitch";
6
+ export declare type SocialLoginProvider = "facebook" | "google" | "twitch" | "apple";
7
7
  export declare class IkasCustomerStore {
8
8
  customer?: IkasCustomer | null;
9
9
  private token?;
@@ -31,19 +31,50 @@ export declare class IkasCustomerStore {
31
31
  * @deprecated Use customerLogin instead.
32
32
  */
33
33
  login: (email: string, password: string) => Promise<boolean>;
34
- customerLogin: (email: string, password: string) => Promise<{
34
+ customerLogin: (email?: string, password?: string, phone?: string | null) => Promise<{
35
35
  isSuccess: boolean;
36
36
  errorCodes: IkasLoginError[];
37
+ otpSend?: undefined;
38
+ flowId?: undefined;
39
+ } | {
40
+ isSuccess: boolean;
41
+ otpSend: boolean;
42
+ flowId: string | null;
43
+ errorCodes: IkasLoginError[];
37
44
  }>;
38
45
  logout: () => void;
39
- register: (firstName: string, lastName: string, email: string, password: string, isMarketingAccepted?: boolean, attributes?: IkasCustomerAttributeValue[], phone?: string | null) => Promise<{
46
+ register: (firstName?: string, lastName?: string, email?: string, password?: string, isMarketingAccepted?: boolean, attributes?: IkasCustomerAttributeValue[], phone?: string | null, flowId?: string | null) => Promise<{
47
+ isSuccess: boolean;
48
+ errorCodes: IkasRegisterError[];
49
+ flowId?: undefined;
50
+ otpSend?: undefined;
51
+ } | {
40
52
  isSuccess: boolean;
53
+ flowId: string | null;
54
+ otpSend: boolean;
41
55
  errorCodes: IkasRegisterError[];
42
56
  }>;
43
57
  activateCustomer: () => Promise<boolean>;
44
58
  resendCustomerActivationMail: (email: string) => Promise<boolean>;
45
- validateCustomerPhoneVerificationCode: (verificationCode: string) => Promise<boolean>;
46
- resendCustomerPhoneVerificationCode: (email: string) => Promise<boolean>;
59
+ validateCustomerPhoneVerificationCode: (verificationCode: string, otpInfo?: string | null) => Promise<{
60
+ isSuccess: boolean;
61
+ errorCodes: IkasRegisterError[];
62
+ }>;
63
+ validateOTPCode: (verificationCode: string, otpInfo?: string | null) => Promise<{
64
+ isSuccess: boolean;
65
+ errorCodes: IkasRegisterError[];
66
+ otpSend?: undefined;
67
+ flowId?: undefined;
68
+ } | {
69
+ isSuccess: boolean;
70
+ otpSend: boolean;
71
+ flowId: string | null;
72
+ errorCodes: IkasRegisterError[];
73
+ }>;
74
+ resendCustomerPhoneVerificationCode: () => Promise<{
75
+ isSuccess: boolean;
76
+ errorCodes: IkasRegisterError[];
77
+ }>;
47
78
  saveContactForm: (input: IkasContactForm) => Promise<boolean>;
48
79
  checkEmail: (email: string) => Promise<boolean>;
49
80
  forgotPassword: (email: string) => Promise<boolean | undefined>;
@@ -77,6 +108,10 @@ export declare class IkasCustomerStore {
77
108
  getCustomerAttributes: () => Promise<import("../../models/data").IkasCustomerAttribute[]>;
78
109
  getOrderProductFiles: (fileIds: string[]) => Promise<IkasProductFile[]>;
79
110
  getDigitalProductFileDownloadUrl: (order: IkasOrder, productFile: IkasProductFile) => Promise<void>;
111
+ getStoreCreditBalance: () => Promise<{
112
+ amount: number;
113
+ formattedAmount: string;
114
+ }>;
80
115
  private init;
81
116
  private getOrderRefundSettings;
82
117
  private routeChangeInit;