@ikas/storefront 3.0.0-alpha.26 → 3.0.0-alpha.27

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 (178) hide show
  1. package/build/__api/models/BlogMetadata.d.ts +2 -0
  2. package/build/__api/models/BlogMetadata.js +1 -1
  3. package/build/__api/models/BlogMetadataTargetTypeEnumFilter.d.ts +1 -1
  4. package/build/__api/models/CreateCustomerReviewInput.d.ts +3 -0
  5. package/build/__api/models/CreateSaleTransactionMasterPassPaymentMethodDetail.d.ts +10 -0
  6. package/build/__api/models/CreateSaleTransactionWithCartInput.d.ts +2 -0
  7. package/build/__api/models/CreateSaleTransactionWithCheckoutInput.d.ts +2 -0
  8. package/build/__api/models/CustomerReview.d.ts +3 -0
  9. package/build/__api/models/CustomerReview.js +1 -1
  10. package/build/__api/models/DateFilterInput.d.ts +1 -1
  11. package/build/__api/models/GetProductOptionFileUrl.d.ts +11 -0
  12. package/build/__api/models/HTMLMetaData.d.ts +2 -0
  13. package/build/__api/models/HTMLMetaData.js +1 -1
  14. package/build/__api/models/HTMLMetaDataTargetTypeEnumFilter.d.ts +1 -1
  15. package/build/__api/models/MasterpassTokenResponse.d.ts +7 -5
  16. package/build/__api/models/MerchantSettings.d.ts +2 -0
  17. package/build/__api/models/MerchantSettings.js +1 -1
  18. package/build/__api/models/MerchantSettingsCurrencyFormat.d.ts +15 -0
  19. package/build/__api/models/MerchantSettingsCurrencyFormat.js +1 -0
  20. package/build/__api/models/OrderShippingLine.d.ts +1 -0
  21. package/build/__api/models/OrderShippingLine.js +1 -1
  22. package/build/__api/models/PaymentGateway.d.ts +1 -1
  23. package/build/__api/models/PaymentGateway.js +1 -1
  24. package/build/__api/models/RaffleMetadata.d.ts +2 -0
  25. package/build/__api/models/RaffleMetadataTargetTypeEnumFilter.d.ts +1 -1
  26. package/build/__api/models/SearchHTMLMetaData.d.ts +2 -0
  27. package/build/__api/models/Storefront.d.ts +1 -0
  28. package/build/__api/mutations/addCouponCodeToCheckout.d.ts +1 -0
  29. package/build/__api/mutations/addItemToCart.d.ts +1 -0
  30. package/build/__api/mutations/addItemToCart.js +1 -1
  31. package/build/__api/mutations/createCustomerReview.d.ts +3 -0
  32. package/build/__api/mutations/createCustomerReview.js +1 -1
  33. package/build/__api/mutations/createOrderRefundRequest.d.ts +1 -0
  34. package/build/__api/mutations/createOrderRefundRequest.js +1 -1
  35. package/build/__api/mutations/saveCart.d.ts +1 -0
  36. package/build/__api/mutations/saveCart.js +1 -1
  37. package/build/__api/mutations/saveCartCouponCode.d.ts +1 -0
  38. package/build/__api/mutations/saveCartCouponCode.js +1 -1
  39. package/build/__api/mutations/saveCheckout.d.ts +1 -0
  40. package/build/__api/queries/getCartById.d.ts +1 -0
  41. package/build/__api/queries/getCartById.js +1 -1
  42. package/build/__api/queries/getCheckoutByCartId.d.ts +1 -0
  43. package/build/__api/queries/getCheckoutById.d.ts +1 -0
  44. package/build/__api/queries/getCustomerOrders.d.ts +1 -0
  45. package/build/__api/queries/getCustomerOrders.js +1 -1
  46. package/build/__api/queries/getMasterpassRequestToken.d.ts +6 -3
  47. package/build/__api/queries/getOrder.d.ts +1 -0
  48. package/build/__api/queries/getOrderByEmail.d.ts +1 -0
  49. package/build/__api/queries/getOrderByEmail.js +1 -1
  50. package/build/__api/queries/getProductFilterData.d.ts +8 -0
  51. package/build/__api/queries/getProductFilterData.js +1 -1
  52. package/build/__api/queries/getProductOptionFileUrl.d.ts +14 -0
  53. package/build/__api/queries/getRafflesByCustomerId.d.ts +2 -0
  54. package/build/__api/queries/getRafflesByCustomerId.js +1 -1
  55. package/build/__api/queries/getStorefront.d.ts +1 -0
  56. package/build/__api/queries/getStorefront.js +1 -1
  57. package/build/__api/queries/listBlog.d.ts +4 -0
  58. package/build/__api/queries/listBlog.js +1 -1
  59. package/build/__api/queries/listBlogCategory.d.ts +2 -0
  60. package/build/__api/queries/listBlogCategory.js +1 -1
  61. package/build/__api/queries/listBlogMetadata.d.ts +2 -0
  62. package/build/__api/queries/listBlogMetadata.js +1 -1
  63. package/build/__api/queries/listCategory.d.ts +4 -0
  64. package/build/__api/queries/listCategory.js +1 -1
  65. package/build/__api/queries/listCustomerReviews.d.ts +3 -0
  66. package/build/__api/queries/listCustomerReviews.js +1 -1
  67. package/build/__api/queries/listHTMLMetaData.d.ts +2 -0
  68. package/build/__api/queries/listHTMLMetaData.js +1 -1
  69. package/build/__api/queries/listMerchantSettings.d.ts +6 -0
  70. package/build/__api/queries/listMerchantSettings.js +1 -1
  71. package/build/__api/queries/listPaymentGateway.d.ts +1 -1
  72. package/build/__api/queries/listPaymentGateway.js +1 -1
  73. package/build/__api/queries/listProduct.d.ts +2 -0
  74. package/build/__api/queries/listProductBrand.d.ts +2 -0
  75. package/build/__api/queries/listProductBrand.js +1 -1
  76. package/build/__api/queries/listRaffle.d.ts +2 -0
  77. package/build/__api/queries/listRaffle.js +1 -1
  78. package/build/__api/queries/listRaffleMetadata.d.ts +2 -0
  79. package/build/__api/queries/listRaffleMetadata.js +1 -1
  80. package/build/__api/queries/searchProducts.d.ts +2 -0
  81. package/build/__api/queries/searchProducts.js +1 -1
  82. package/build/__api/types/index.d.ts +57 -6
  83. package/build/__api/types/index.js +1 -1
  84. package/build/_virtual/index.js_commonjs-proxy13.js +1 -1
  85. package/build/_virtual/index.js_commonjs-proxy14.js +1 -1
  86. package/build/_virtual/index.js_commonjs-proxy2.js +1 -1
  87. package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
  88. package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
  89. package/build/analytics/analytics.d.ts +3 -2
  90. package/build/analytics/analytics.js +1 -1
  91. package/build/analytics/events.d.ts +2 -1
  92. package/build/analytics/events.js +1 -1
  93. package/build/analytics/googleTagManager.js +1 -1
  94. package/build/analytics/head/index.js +1 -1
  95. package/build/analytics/tiktokPixel.d.ts +14 -0
  96. package/build/analytics/tiktokPixel.js +1 -0
  97. package/build/assets/translations/checkout/en.js +1 -1
  98. package/build/assets/translations/checkout/tr.js +1 -1
  99. package/build/components/checkout/components/address-form/index.js +1 -1
  100. package/build/components/checkout/components/address-form/model.d.ts +1 -0
  101. package/build/components/checkout/components/address-form/model.js +1 -1
  102. package/build/components/checkout/components/cart-summary/index.js +1 -1
  103. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
  104. package/build/components/checkout/index.d.ts +1 -0
  105. package/build/components/checkout/index.js +1 -1
  106. package/build/components/checkout/model.d.ts +6 -4
  107. package/build/components/checkout/model.js +1 -1
  108. package/build/components/checkout/steps/step-success/index.js +1 -1
  109. package/build/components/index.d.ts +1 -0
  110. package/build/components/link/index.d.ts +4 -0
  111. package/build/components/link/index.js +1 -0
  112. package/build/components/page/head.d.ts +2 -0
  113. package/build/components/page/head.js +1 -1
  114. package/build/components/page/index.d.ts +2 -0
  115. package/build/components/page/index.js +1 -1
  116. package/build/ikas.cjs +1 -1
  117. package/build/index.d.ts +1 -0
  118. package/build/index.js +1 -1
  119. package/build/models/data/merchant-settings/index.js +1 -1
  120. package/build/models/data/order/line-item/variant/index.d.ts +8 -0
  121. package/build/models/data/order/line-item/variant/index.js +1 -1
  122. package/build/models/data/product/index.d.ts +1 -1
  123. package/build/models/data/product/index.js +1 -1
  124. package/build/models/data/product/variant/index.d.ts +1 -0
  125. package/build/models/data/product/variant/index.js +1 -1
  126. package/build/models/data/raffle/index.d.ts +2 -0
  127. package/build/models/data/raffle/index.js +1 -1
  128. package/build/models/data/storefront/index.d.ts +1 -0
  129. package/build/models/data/storefront/index.js +1 -1
  130. package/build/models/theme/page/index.d.ts +2 -0
  131. package/build/models/theme/page/index.js +1 -1
  132. package/build/models/theme/theme.js +1 -1
  133. package/build/models/ui/product-detail/index.d.ts +2 -0
  134. package/build/models/ui/product-detail/index.js +1 -1
  135. package/build/models/ui/product-list/index.js +1 -1
  136. package/build/models/ui/validator/form/account-info.d.ts +2 -0
  137. package/build/models/ui/validator/form/account-info.js +1 -1
  138. package/build/models/ui/validator/form/register.js +1 -1
  139. package/build/pages/404.js +1 -1
  140. package/build/pages/_slug_/index.js +1 -1
  141. package/build/pages/account/addresses.js +1 -1
  142. package/build/pages/account/favorite-products.js +1 -1
  143. package/build/pages/account/forgot-password.js +1 -1
  144. package/build/pages/account/index.js +1 -1
  145. package/build/pages/account/login.js +1 -1
  146. package/build/pages/account/orders/_id_.js +1 -1
  147. package/build/pages/account/orders/index.js +1 -1
  148. package/build/pages/account/raffles.js +1 -1
  149. package/build/pages/account/recover-password.js +1 -1
  150. package/build/pages/account/register.js +1 -1
  151. package/build/pages/blog/_slug_.js +1 -1
  152. package/build/pages/blog/index.js +1 -1
  153. package/build/pages/cart.js +1 -1
  154. package/build/pages/checkout.js +1 -1
  155. package/build/pages/editor.js +1 -1
  156. package/build/pages/home.js +1 -1
  157. package/build/pages/pages/_slug_.js +1 -1
  158. package/build/pages/raffle/_slug_.js +1 -1
  159. package/build/pages/raffle/index.js +1 -1
  160. package/build/pages/search.js +1 -1
  161. package/build/providers/page-data-get.d.ts +3 -0
  162. package/build/providers/page-data-get.js +1 -1
  163. package/build/providers/page-data-next.d.ts +18 -0
  164. package/build/providers/page-data-next.js +1 -1
  165. package/build/scripts/generators/config/content.js +1 -1
  166. package/build/scripts/generators/config/index.js +1 -1
  167. package/build/store/base.d.ts +1 -0
  168. package/build/store/base.js +1 -1
  169. package/build/store/cart/index.js +1 -1
  170. package/build/store/customer/index.js +1 -1
  171. package/build/storefront/index.d.ts +6 -2
  172. package/build/storefront/index.js +1 -1
  173. package/build/utils/constants.d.ts +1 -0
  174. package/build/utils/constants.js +1 -1
  175. package/build/utils/currency.d.ts +2 -2
  176. package/build/utils/currency.js +1 -1
  177. package/build/utils/helper.js +1 -1
  178. package/package.json +1 -1
@@ -9,6 +9,7 @@ export declare class IkasBaseStore {
9
9
  localeOptions: IkasLocaleOption[];
10
10
  showLocaleOptions: boolean;
11
11
  currentCountryCode?: string | null;
12
+ spaLinksDisabled: boolean;
12
13
  private localeChecked;
13
14
  private settingsSet;
14
15
  constructor();
@@ -1 +1 @@
1
- import{__awaiter as o,__generator as t}from'../ext/tslib/tslib.es6.js';import{configure as e,makeObservable as i,observable as r}from"mobx";import d from'../ext/lodash/sortBy.js';import s from'../ext/lodash/flatten.js';import{IkasCartStore as n}from"./cart/index.js";import{IkasCustomerStore as a}from"./customer/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/attribute-value/index.js";import"../models/data/customer/index.js";import"../models/data/customer-attribute/customer-attribute-option/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-review/index.js";import"../models/data/customer-review-summary/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/merchant-settings/index.js";import"../models/data/order/address/index.js";import"../models/data/order/adjustment/index.js";import"../models/data/order/gift-line/index.js";import"../models/data/order/invoice/index.js";import"../models/data/order/line-item/discount/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/option/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/tracking-info/index.js";import"../models/data/order/package/index.js";import"../models/data/order/payment-method/index.js";import"../models/data/order/refund/line-item/index.js";import"../models/data/order/shipping-line/index.js";import"../models/data/order/tax-line/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/product/attribute-value/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/product-attribute/index.js";import"../models/data/product-filter/index.js";import"../models/data/product-campaign/campaign/index.js";import"../models/data/product-campaign/filter/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/data/state/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/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/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{IkasThemeSettings as m}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasStorefrontConfig as l}from"../storefront/index.js";import u from"./location/index.js";import p from'../ext/uuid/dist/esm-node/v4.js';e({enforceActions:"never"});var c=function(){function e(){this.currentPageType=null,this.localeOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.localeChecked=!1,this.settingsSet=!1,this.customerStore=new a(this),this.cartStore=new n(this),i(this,{currentPageType:r,localeOptions:r,showLocaleOptions:r,currentCountryCode:r})}return e.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,e,i,r,n,a,m,c,j,x;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:void 0===typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,u.getMyCountry()];case 1:return(o=t.sent()).isSuccess?(e=o.data,i=l.routings.find((function(o){return o.id===l.storefrontRoutingId})),this.currentCountryCode=e,i&&e?(r=!0,n=l.routings.find((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(e)})),a=l.routings.find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),n?i.id!==n.id&&(r=!1):a&&i.id!==a.id&&(r=!1),m=[],c=s(l.routings.map((function(o){return o.countryCodes||[]}))),[4,u.listCountry({iso2:{in:c}})]):[3,3]):[2];case 2:if(!(j=t.sent()).isSuccess)return[2];x=j.data||[],l.routings.map((function(o){var t;(null===(t=o.countryCodes)||void 0===t?void 0:t.length)?o.countryCodes.forEach((function(t){var i=x.find((function(o){return o.iso2===t}));m.push({id:p(),countryName:(null==i?void 0:i.native)||(null==i?void 0:i.name)||"",iso2:(null==i?void 0:i.iso2)||void 0,iso3:(null==i?void 0:i.iso3)||void 0,routing:o,isRecommended:t===e})})):m.push({id:p(),routing:o,isRecommended:!l.routings.some((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(e)}))})})),this.localeOptions=d(m,"countryName"),r||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},e.prototype.setLocalization=function(o){o.routing.domain?window.location.replace("https://"+o.routing.domain):window.location.replace(window.location.origin+(o.routing.path?"/"+o.routing.path:""))},e.prototype.setSettings=function(o){this.settingsSet||new m(JSON.parse(o)).colors.map((function(o){return document.documentElement.style.setProperty(o.key,o.color)}))},e.prototype.init=function(){this.customerStore.init()},e}();export{c as IkasBaseStore};
1
+ import{__awaiter as t,__generator as o}from'../ext/tslib/tslib.es6.js';import{configure as e,makeObservable as i,observable as d}from"mobx";import r from'../ext/lodash/sortBy.js';import s from'../ext/lodash/flatten.js';import{IkasCartStore as n}from"./cart/index.js";import{IkasCustomerStore as a}from"./customer/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/attribute-value/index.js";import"../models/data/customer/index.js";import"../models/data/customer-attribute/customer-attribute-option/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-review/index.js";import"../models/data/customer-review-summary/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/merchant-settings/index.js";import"../models/data/order/address/index.js";import"../models/data/order/adjustment/index.js";import"../models/data/order/gift-line/index.js";import"../models/data/order/invoice/index.js";import"../models/data/order/line-item/discount/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/option/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/tracking-info/index.js";import"../models/data/order/package/index.js";import"../models/data/order/payment-method/index.js";import"../models/data/order/refund/line-item/index.js";import"../models/data/order/shipping-line/index.js";import"../models/data/order/tax-line/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/product/attribute-value/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/product-attribute/index.js";import"../models/data/product-filter/index.js";import"../models/data/product-campaign/campaign/index.js";import"../models/data/product-campaign/filter/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/data/state/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/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/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{IkasThemeSettings as m}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasStorefrontConfig as l}from"../storefront/index.js";import u from"./location/index.js";import p from'../ext/uuid/dist/esm-node/v4.js';e({enforceActions:"never"});var c=function(){function e(){this.currentPageType=null,this.localeOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.spaLinksDisabled=!1,this.localeChecked=!1,this.settingsSet=!1,this.customerStore=new a(this),this.cartStore=new n(this),"undefined"!=typeof window&&(this.spaLinksDisabled=navigator.userAgent.includes("Instagram")),i(this,{currentPageType:d,localeOptions:d,showLocaleOptions:d,currentCountryCode:d,spaLinksDisabled:d})}return e.prototype.checkLocalization=function(){return t(this,void 0,void 0,(function(){var t,e,i,d,n,a,m,c,j,x;return o(this,(function(o){switch(o.label){case 0:return this.localeChecked?[2]:"undefined"==typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,u.getMyCountry()];case 1:return(t=o.sent()).isSuccess?(e=t.data,i=l.routings.find((function(t){return t.id===l.storefrontRoutingId})),this.currentCountryCode=e,i&&e?(d=!0,n=l.routings.find((function(t){var o;return null===(o=t.countryCodes)||void 0===o?void 0:o.includes(e)})),a=l.routings.find((function(t){var o;return!(null===(o=t.countryCodes)||void 0===o?void 0:o.length)})),n?i.id!==n.id&&(d=!1):a&&i.id!==a.id&&(d=!1),m=[],c=s(l.routings.map((function(t){return t.countryCodes||[]}))),[4,u.listCountry({iso2:{in:c}})]):[3,3]):[2];case 2:if(!(j=o.sent()).isSuccess)return[2];x=j.data||[],l.routings.map((function(t){var o;(null===(o=t.countryCodes)||void 0===o?void 0:o.length)?t.countryCodes.forEach((function(o){var i=x.find((function(t){return t.iso2===o}));m.push({id:p(),countryName:(null==i?void 0:i.native)||(null==i?void 0:i.name)||"",iso2:(null==i?void 0:i.iso2)||void 0,iso3:(null==i?void 0:i.iso3)||void 0,routing:t,isRecommended:o===e})})):m.push({id:p(),routing:t,isRecommended:!l.routings.some((function(t){var o;return null===(o=t.countryCodes)||void 0===o?void 0:o.includes(e)}))})})),this.localeOptions=r(m,"countryName"),d||(this.showLocaleOptions=!0),this.localeChecked=!0,o.label=3;case 3:return[2]}}))}))},e.prototype.setLocalization=function(t){t.routing.domain?window.location.replace("https://"+t.routing.domain):window.location.replace(window.location.origin+(t.routing.path?"/"+t.routing.path:""))},e.prototype.setSettings=function(t){this.settingsSet||new m(JSON.parse(t)).colors.map((function(t){return document.documentElement.style.setProperty(t.key,t.color)}))},e.prototype.init=function(){this.customerStore.init()},e}();export{c as IkasBaseStore};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{Analytics as n}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasStorefrontConfig as r}from"../../storefront/index.js";import a from"./api.js";var o="cartId",s=function(){function o(o){var s=this;this.cart=null,this._isLoadingCart=!1,this._isCartLoadFinished=!1,this.addItem=function(i,o,u){return void 0===u&&(u=1),t(s,void 0,void 0,(function(){var t,s,c,d,l,h,v,f,p,m;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),o.canAddToCart?[4,this.beforeCartOperationCheck()]:[2,!1];case 1:return e.sent(),this.cart&&(t=this.findExistingItem(i,o))?(null===(f=o.productOptionSet)||void 0===f||f.initOptionValues(),[2,this.changeItemQuantity(t,t.quantity+1)]):(s=this.getOptionValues(o),c=(null===(p=this.cart)||void 0===p?void 0:p.id)||localStorage.getItem("cartId"),[4,a.addItemToCart({input:{cartId:c,item:{id:null,quantity:u,variant:{id:i.id,name:o.name}},options:s.length?s:null,priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId}})]);case 2:return(d=e.sent()).isSuccess&&d.data?[4,this.setCart(d.data)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(l="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(h=this.cart.orderLineItems.find((function(t){return t.variant.id})))&&n.addToCart(h,u,l,this.cart)),null===(m=o.productOptionSet)||void 0===m||m.initOptionValues(),[2,!0];case 5:return v=e.sent(),console.log(v),[2,!1];case 6:return[2]}}))}))},this.changeItemQuantity=function(i,o){return t(s,void 0,void 0,(function(){var t,s,u,c,d;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,a.addItemToCart({input:{cartId:(null===(d=this.cart)||void 0===d?void 0:d.id)||null,item:{id:i.id,quantity:o,variant:{id:i.variant.id,name:i.variant.name}},options:this.createCartLineOptions(i),priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId}})];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.removeCardIfEmpty(),this.cart&&(s="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(u=i.quantity)>o?n.removeFromCart(i,u-o,this.cart):n.addToCart(i,o-u,s,this.cart)),[2,!0];case 5:return c=e.sent(),console.log(c),[2,!1];case 6:return[2]}}))}))},this.removeItem=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.changeItemQuantity(i,0)];case 1:return t.sent(),[2]}}))}))},this.removeCart=function(){localStorage.removeItem("cartId"),s.cart=void 0},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.isCartLoadFinished&&(clearInterval(e),t(null))}),100)}))},this.findExistingItem=function(t,e){var i,n,r,a,o;if(!e.productOptionSetId)return null===(i=s.cart)||void 0===i?void 0:i.orderLineItems.find((function(e){return e.variant.id===t.id}));for(var u=s.getOptionValues(e),c=(null===(n=s.cart)||void 0===n?void 0:n.orderLineItems.filter((function(e){var i;return e.variant.id===t.id&&(null===(i=e.options)||void 0===i?void 0:i.length)===u.length})))||[],d=0,l=c;d<l.length;d++){var h=l[d];if(h.options){for(var v=!0,f=function(t){var i=t.values.map((function(t){return t.value})),n=null===(o=null===(a=null===(r=e.productOptionSet)||void 0===r?void 0:r.options)||void 0===a?void 0:a.find((function(e){return e.id===t.productOptionId})))||void 0===o?void 0:o.values;if(!(v=v&&i.length===(null==n?void 0:n.length)&&i.every((function(t){return null==n?void 0:n.includes(t)}))))return"break"},p=0,m=h.options;p<m.length;p++){if("break"===f(m[p]))break}if(v)return h}}},this.saveCouponCode=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.cart?[4,a.saveCartCouponCode({cartId:this.cart.id,couponCode:i})]:[2,!1];case 1:return(t=e.sent()).isSuccess&&t.data&&(this.cart=t.data),[2,t.isSuccess]}}))}))},this.removeCardIfEmpty=function(){var t;0===(null===(t=s.cart)||void 0===t?void 0:t.itemCount)&&s.removeCart()},this.getCart=function(){return t(s,void 0,void 0,(function(){var t,i,n,r,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,a.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 r=e.sent(),console.log(r),[3,8];case 7:return this._isLoadingCart=!1,this._isCartLoadFinished=!0,[7];case 8:return[2]}}))}))},this.setCart=function(i){return t(s,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(s,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,n=t.options;i<n.length;i++){var r=n[i],a={productOptionId:r.productOptionId,productOptionsSetId:r.productOptionsSetId,values:r.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.baseStore=o,i(this)}return Object.defineProperty(o.prototype,"isLoadingCart",{get:function(){return this._isLoadingCart},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isCartLoadFinished",{get:function(){return this._isCartLoadFinished},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"checkoutId",{get:function(){var t;return null===(t=this.cart)||void 0===t?void 0:t.id},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"checkoutUrl",{get:function(){if(this.checkoutId)return"/checkout?id=".concat(this.checkoutId,"&step=info")},enumerable:!1,configurable:!0}),o}();export{o as CART_LS_KEY,s as IkasCartStore};
1
+ import{__awaiter as t,__generator as e}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{Analytics as n}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasStorefrontConfig as r}from"../../storefront/index.js";import a from"./api.js";var o="cartId",s=function(){function o(o){var s=this;this.cart=null,this._isLoadingCart=!1,this._isCartLoadFinished=!1,this.addItem=function(i,o,u){return void 0===u&&(u=1),t(s,void 0,void 0,(function(){var t,s,c,d,l,h,v,f,p,m;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),o.hasValidProductOptionValues&&(i.hasStock||i.sellIfOutOfStock)?[4,this.beforeCartOperationCheck()]:[2,!1];case 1:return e.sent(),this.cart&&(t=this.findExistingItem(i,o))?(null===(f=o.productOptionSet)||void 0===f||f.initOptionValues(),[2,this.changeItemQuantity(t,t.quantity+1)]):(s=this.getOptionValues(o),c=(null===(p=this.cart)||void 0===p?void 0:p.id)||localStorage.getItem("cartId"),[4,a.addItemToCart({input:{cartId:c,item:{id:null,quantity:u,variant:{id:i.id,name:o.name}},options:s.length?s:null,priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId}})]);case 2:return(d=e.sent()).isSuccess&&d.data?[4,this.setCart(d.data)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(l="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(h=this.cart.items.find((function(t){return t.variant.id===i.id})))&&n.addToCart(h,u,l,this.cart)),null===(m=o.productOptionSet)||void 0===m||m.initOptionValues(),[2,!0];case 5:return v=e.sent(),console.log(v),[2,!1];case 6:return[2]}}))}))},this.changeItemQuantity=function(i,o){return t(s,void 0,void 0,(function(){var t,s,u,c,d;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,a.addItemToCart({input:{cartId:(null===(d=this.cart)||void 0===d?void 0:d.id)||null,item:{id:i.id,quantity:o,variant:{id:i.variant.id,name:i.variant.name}},options:this.createCartLineOptions(i),priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId}})];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.removeCardIfEmpty(),this.cart&&(s="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(u=i.quantity)>o?n.removeFromCart(i,u-o,this.cart):n.addToCart(i,o-u,s,this.cart)),[2,!0];case 5:return c=e.sent(),console.log(c),[2,!1];case 6:return[2]}}))}))},this.removeItem=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.changeItemQuantity(i,0)];case 1:return t.sent(),[2]}}))}))},this.removeCart=function(){localStorage.removeItem("cartId"),s.cart=void 0},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.isCartLoadFinished&&(clearInterval(e),t(null))}),100)}))},this.findExistingItem=function(t,e){var i,n,r,a,o;if(!e.productOptionSetId)return null===(i=s.cart)||void 0===i?void 0:i.orderLineItems.find((function(e){return e.variant.id===t.id}));for(var u=s.getOptionValues(e),c=(null===(n=s.cart)||void 0===n?void 0:n.orderLineItems.filter((function(e){var i;return e.variant.id===t.id&&(null===(i=e.options)||void 0===i?void 0:i.length)===u.length})))||[],d=0,l=c;d<l.length;d++){var h=l[d];if(h.options){for(var v=!0,f=function(t){var i=t.values.map((function(t){return t.value})),n=null===(o=null===(a=null===(r=e.productOptionSet)||void 0===r?void 0:r.options)||void 0===a?void 0:a.find((function(e){return e.id===t.productOptionId})))||void 0===o?void 0:o.values;if(!(v=v&&i.length===(null==n?void 0:n.length)&&i.every((function(t){return null==n?void 0:n.includes(t)}))))return"break"},p=0,m=h.options;p<m.length;p++){if("break"===f(m[p]))break}if(v)return h}}},this.saveCouponCode=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.cart?[4,a.saveCartCouponCode({cartId:this.cart.id,couponCode:i})]:[2,!1];case 1:return(t=e.sent()).isSuccess&&t.data&&(this.cart=t.data),[2,t.isSuccess]}}))}))},this.removeCardIfEmpty=function(){var t;0===(null===(t=s.cart)||void 0===t?void 0:t.itemCount)&&s.removeCart()},this.getCart=function(){return t(s,void 0,void 0,(function(){var t,i,n,r,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,a.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 r=e.sent(),console.log(r),[3,8];case 7:return this._isLoadingCart=!1,this._isCartLoadFinished=!0,[7];case 8:return[2]}}))}))},this.setCart=function(i){return t(s,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(s,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,n=t.options;i<n.length;i++){var r=n[i],a={productOptionId:r.productOptionId,productOptionsSetId:r.productOptionsSetId,values:r.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.baseStore=o,i(this)}return Object.defineProperty(o.prototype,"isLoadingCart",{get:function(){return this._isLoadingCart},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isCartLoadFinished",{get:function(){return this._isCartLoadFinished},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"checkoutId",{get:function(){var t;return null===(t=this.cart)||void 0===t?void 0:t.id},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"checkoutUrl",{get:function(){if(this.checkoutId)return"/checkout?id=".concat(this.checkoutId,"&step=info")},enumerable:!1,configurable:!0}),o}();export{o as CART_LS_KEY,s as IkasCartStore};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as i}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import o from'../../ext/lodash/uniqBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import{IkasCustomer as s}from"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/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/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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/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"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{Analytics as n}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasStorefrontConfig as a}from"../../storefront/index.js";import{populateRaffleProducts as d}from"../../providers/helpers/raffles.js";import u from"./api.js";import{SaveMyCustomerInput as c}from"../../__api/models/SaveMyCustomerInput.js";import l from"../raffle/index.js";import'../../ext/@ikas/fe-api-client/build/utils/api.js';import'../../ext/axios/lib/axios.js';import m from'../../ext/@ikas/fe-api-client/build/config/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 p from"../product/index.js";import{CustomerEmailSubscriptionStatusesEnum as h}from"../../__api/types/index.js";var f="undefined"==typeof localStorage,v=function(){function v(o){var s=this;this.customer=null,this.token=null,this.tokenExpiry=null,this.baseStore=null,this._initialized=!1,this._visitorSubscribedEmail=!1,this._lastViewedProducts=[],this._customerConsentGranted=!1,this._refundSettings=null,this.login=function(i,r){return t(s,void 0,void 0,(function(){var t,o,s,a;return e(this,(function(e){switch(e.label){case 0:return[4,u.login({email:i,password:r})];case 1:return(t=e.sent())&&t.isSuccess&&t.data?(o=t.data,this.setToken(o.token,o.tokenExpiry),o.customer&&this.setCustomer(o.customer),this.customer&&n.customerLogin(),(s=null===(a=this.baseStore)||void 0===a?void 0:a.cartStore.cart)?[4,this.baseStore.cartStore.changeItemQuantity(s.orderLineItems[0],s.orderLineItems[0].quantity)]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:return this.saveLocalLastViewedProducts(),[2,!0];case 4:return[2,!1]}}))}))},this.register=function(i,r,o,n,a,d){return t(s,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return[4,u.register({email:o,password:n,firstName:i,lastName:r,isAcceptMarketing:a,attributes:d})];case 1:return(t=e.sent())&&t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(this.setToken(t.data.token,t.data.tokenExpiry),this.setCustomer(t.data.customer),this.saveLocalLastViewedProducts(),[2,!0]):[2,!1]}}))}))},this.saveContactForm=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return n.contactForm(i),[4,u.sendContactFormToMerchant(i)];case 1:return[2,t.sent().isSuccess]}}))}))},this.checkEmail=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.checkEmail({email:i})];case 1:return[2,t.sent().isSuccess]}}))}))},this.forgotPassword=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.forgotPassword({email:i})];case 1:return[2,t.sent().isSuccess]}}))}))},this.recoverPassword=function(i,r,o){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.recoverPassword({password:i,passwordAgain:r,token:o})];case 1:return[2,t.sent().isSuccess]}}))}))},this.logout=function(){var t;s.clearLocalData(),null===(t=s.baseStore)||void 0===t||t.cartStore.removeCart(),n.customerLogout()},this.saveCustomer=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u.saveCustomer({input:new c(i)})];case 1:return(t=e.sent()).isSuccess&&t.data?(this.setCustomer(t.data),[2,!0]):[2,!1]}}))}))},this.getOrders=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.getOrders({})];case 1:return[2,t.sent().data||[]]}}))}))},this.getOrder=function(i){return t(s,void 0,void 0,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,u.getOrders({orderId:i})];case 1:return(t=e.sent()).isSuccess&&(null===(o=t.data)||void 0===o?void 0:o.length)?((r=t.data[0])._refundSettings=this._refundSettings,[2,r]):[2,null]}}))}))},this.getOrderTransactions=function(i){return void 0===i&&(i={}),t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.listOrderTransactions({checkoutId:{eq:i.checkoutId},id:{eq:i.checkoutId},orderId:{eq:i.orderId}})];case 1:return[2,t.sent().data||[]]}}))}))},this.getFavoriteProductsIds=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.listFavoriteProducts()];case 1:return[2,t.sent().data||[]]}}))}))},this.getFavoriteProducts=function(){return t(s,void 0,void 0,(function(){var t,i,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,u.listFavoriteProducts()];case 1:return(t=e.sent()).isSuccess||!(null===(r=t.data)||void 0===r?void 0:r.length)?[2,[]]:[4,p.searchProducts({input:{productIdList:t.data.map((function(t){return t.productId})),priceListId:a.priceListId,salesChannelId:a.salesChannelId}})];case 2:return i=e.sent(),[2,(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.data)||[]]}}))}))},this.addProductToFavorites=function(i){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:if(!(null===(r=this.customer)||void 0===r?void 0:r.id))throw Error("Unauthorized");return[4,u.saveFavoriteProduct({isFavorite:!0,productId:i})];case 1:return t=e.sent(),n.addToWishlist(i),[2,t.data||!1]}}))}))},this.removeProductFromFavorites=function(i){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:if(!(null===(r=this.customer)||void 0===r?void 0:r.id))throw Error("Unauthorized");return[4,u.saveFavoriteProduct({isFavorite:!1,productId:i})];case 1:return t=e.sent(),n.addToWishlist(i),[2,t.data||!1]}}))}))},this.isProductFavorite=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");return[4,u.isFavoriteProduct({productId:i})];case 1:return[2,e.sent().data||!1]}}))}))},this.createEmailSubscription=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u.createCustomerEmailSubscription({input:{email:i}})];case 1:return(t=e.sent()).isSuccess&&(window.localStorage.setItem("customerEmailSubscription","true"),this.customer?(this.customer.subscriptionStatus,h.SUBSCRIBED):this._visitorSubscribedEmail=!0),[2,t.isSuccess]}}))}))},this.sendReview=function(r){return t(s,void 0,void 0,(function(){var t,o,s,n;return e(this,(function(e){switch(e.label){case 0:if(t=a.customerReviewSettings,o=a.salesChannelId,!t)return[2];if(!(s=null===(n=this.customer)||void 0===n?void 0:n.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,u.createCustomerReview({input:i(i({},r),{customerId:t.customerLoginRequired?s:void 0,salesChannelId:o||""})})];case 1:return[2,e.sent().data]}}))}))},this.onCustomerConsentGrant=function(){s.saveCustomerConsent()},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.initialized&&(clearInterval(e),t(null))}),100)}))},this.getRaffles=function(){return t(s,void 0,void 0,(function(){var t,i,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,l.getRafflesByCustomerId({winnerFilter:!1})];case 1:return t=e.sent(),[4,l.getRafflesByCustomerId({winnerFilter:!0})];case 2:return i=e.sent(),r=t.data,o=i.data,null==r||r.forEach((function(t){(null==o?void 0:o.find((function(e){return e.id===t.id})))&&(t.isCustomerWinner=!0)})),r?[4,d(r)]:[3,4];case 3:e.sent(),e.label=4;case 4:return[2,r||[]]}}))}))},this.getCustomerAttributes=function(){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,u.listCustomerAttribute()];case 1:return t=e.sent(),this.customer&&(null===(i=this.customer.attributes)||void 0===i||i.forEach((function(e){var i,r,o;e.customerAttribute=(null===(i=t.data)||void 0===i?void 0:i.find((function(t){return t.id===e.customerAttributeId})))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(o=null===(r=e.customerAttribute)||void 0===r?void 0:r.options)||void 0===o?void 0:o.find((function(t){return t.id===e.customerAttributeOptionId})))||null)}))),[2,t.data||[]]}}))}))},this.getOrderByEmail=function(i,r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.getOrderByEmail({email:i,orderNumber:r})];case 1:return[2,t.sent().data||null]}}))}))},this.getOrderRefundSettings=function(){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this._refundSettings?[3,2]:[4,u.listOrderRefundSettings({})];case 1:(t=e.sent()).isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)&&(this._refundSettings=t.data[0]),e.label=2;case 2:return[2]}}))}))},this.baseStore=o,r(this)}return Object.defineProperty(v.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"canCreateEmailSubscription",{get:function(){var t;return!((null===(t=this.customer)||void 0===t?void 0:t.isSubscribed)||f||this._visitorSubscribedEmail)&&!window.localStorage.getItem("customerEmailSubscription")},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"customerConsentGranted",{get:function(){return this._customerConsentGranted},enumerable:!1,configurable:!0}),v.prototype.socialLogin=function(i){return t(this,void 0,void 0,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",r="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/ms/").concat(i,"/login/authenticate?redirect=").concat(t),[4,fetch(r,{headers:{"x-api-key":a.config.apiKey||"","x-sfid":a.storefrontId||"","x-sfrid":a.storefrontRoutingId||""}})]);case 1:return[4,e.sent().json()];case 2:return o=e.sent(),a.router?a.router.replace(o.redirectUrl):window.location.href=o.redirectUrl,[2]}}))}))},v.prototype.socialLoginToken=function(i){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u.socialLogin({code:i})];case 1:return(null==(t=e.sent())?void 0:t.isSuccess)&&(null===(r=t.data)||void 0===r?void 0:r.customer)?(this.setToken(t.data.token,t.data.tokenExpiry),this.setCustomer(t.data.customer),this.customer&&n.customerLogin(),[2,!0]):[2,!1]}}))}))},v.prototype.init=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.loadToken(),this.loadLastViewedProducts(),this.loadCustomerConsent(),[4,this.refreshToken()];case 1:return t.sent(),[4,this.getCustomer()];case 2:return t.sent(),[4,this.getOrderRefundSettings()];case 3:return t.sent(),this._initialized=!0,this.customer&&n.customerVisit(),[2]}}))}))},v.prototype.routeChangeInit=function(){this.customer||(this.loadToken(),this.getCustomer())},v.prototype.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return f||!this.token?[2]:[4,u.getCustomer()];case 1:return(t=e.sent()).data&&this.setCustomer(t.data),[2]}}))}))},v.prototype.refreshToken=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.token?[4,u.refreshToken({token:this.token})]:[2];case 1:return(t=e.sent()).isSuccess&&t.data?this.setToken(t.data.token,t.data.tokenExpiry):(this.token=null,this.tokenExpiry=null,this.clearLocalData()),[2]}}))}))},v.prototype.setCustomer=function(t){this.customer=new s(t)},v.prototype.getLastViewedProducts=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.customer?[4,u.getLastViewedProducts({customerId:this.customer.id})]:[3,2];case 1:return t=e.sent(),this._lastViewedProducts=t.data||[],[3,3];case 2:this.loadLastViewedProducts(),e.label=3;case 3:return[2,this._lastViewedProducts]}}))}))},v.prototype.saveLastViewedProducts=function(){f||window.localStorage.setItem("lastViewedProducts",JSON.stringify(this._lastViewedProducts))},v.prototype.loadLastViewedProducts=function(){if(!f)try{var t=window.localStorage.getItem("lastViewedProducts");t&&(this._lastViewedProducts=JSON.parse(t),this._lastViewedProducts=this._lastViewedProducts.reverse(),this._lastViewedProducts=o(this._lastViewedProducts,"variantId"))}catch(t){}},v.prototype.removeLastViewedProducts=function(){f||window.localStorage.removeItem("lastViewedProducts")},v.prototype.onProductView=function(i,r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.customer?this._lastViewedProducts.find((function(t){return t.productId===i}))?[2]:[4,u.saveLastViewedProducts({input:{customerId:this.customer.id,products:[{productId:i,variantId:r}]}})]:[3,2];case 1:return t.sent()&&this._lastViewedProducts.push({productId:i,variantId:r}),[3,3];case 2:this._lastViewedProducts.push({productId:i,variantId:r}),this._lastViewedProducts=this._lastViewedProducts.slice(0,20),this._lastViewedProducts=o(this._lastViewedProducts,"variantId"),this.saveLastViewedProducts(),t.label=3;case 3:return[2]}}))}))},v.prototype.saveLocalLastViewedProducts=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:if(f)return[2];t.label=1;case 1:return t.trys.push([1,4,,5]),this.loadLastViewedProducts(),this._lastViewedProducts.length?[4,u.saveLastViewedProducts({input:{customerId:this.customer.id,products:this._lastViewedProducts}})]:[3,3];case 2:t.sent()&&this.removeLastViewedProducts(),t.label=3;case 3:return[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},v.prototype.saveCustomerConsent=function(){f||(this._customerConsentGranted=!0,window.localStorage.setItem("customerConsent","true"))},v.prototype.loadCustomerConsent=function(){f||(this._customerConsentGranted=!!window.localStorage.getItem("customerConsent"))},v.prototype.removeCustomerConsent=function(){f||window.localStorage.removeItem("customerConsent")},v.prototype.setToken=function(t,e){f||(this.token=t,this.tokenExpiry=e,localStorage.setItem("customerToken",t),localStorage.setItem("customerTokenExpiry",e+""),m.TOKEN=t)},v.prototype.loadToken=function(){if(!f){var t=localStorage.getItem("customerToken"),e=localStorage.getItem("customerTokenExpiry");t&&e&&this.setToken(t,parseInt(e))}},v.prototype.clearLocalTokenData=function(){localStorage.removeItem("customerToken"),localStorage.removeItem("customerTokenExpiry"),this.token=void 0,this.tokenExpiry=void 0},v.prototype.clearLocalData=function(){this.clearLocalTokenData(),this.customer=void 0,m.TOKEN=""},v}();export{v as IkasCustomerStore};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import o from'../../ext/lodash/uniqBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import{IkasCustomer as s}from"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/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/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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/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"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{Analytics as n}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasStorefrontConfig as a}from"../../storefront/index.js";import{populateRaffleProducts as d}from"../../providers/helpers/raffles.js";import u from"./api.js";import{SaveMyCustomerInput as c}from"../../__api/models/SaveMyCustomerInput.js";import l from"../raffle/index.js";import'../../ext/@ikas/fe-api-client/build/utils/api.js';import'../../ext/axios/lib/axios.js';import m from'../../ext/@ikas/fe-api-client/build/config/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 p from"../product/index.js";import{CustomerEmailSubscriptionStatusesEnum as h}from"../../__api/types/index.js";var f="undefined"==typeof localStorage,v=function(){function v(o){var s=this;this.customer=null,this.token=null,this.tokenExpiry=null,this.baseStore=null,this._initialized=!1,this._visitorSubscribedEmail=!1,this._lastViewedProducts=[],this._customerConsentGranted=!1,this._refundSettings=null,this.login=function(i,r){return t(s,void 0,void 0,(function(){var t,o,s,a;return e(this,(function(e){switch(e.label){case 0:return[4,u.login({email:i,password:r})];case 1:return(t=e.sent())&&t.isSuccess&&t.data?(o=t.data,this.setToken(o.token,o.tokenExpiry),o.customer&&this.setCustomer(o.customer),this.customer&&n.customerLogin(),(s=null===(a=this.baseStore)||void 0===a?void 0:a.cartStore.cart)?[4,this.baseStore.cartStore.changeItemQuantity(s.orderLineItems[0],s.orderLineItems[0].quantity)]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:return this.saveLocalLastViewedProducts(),[2,!0];case 4:return[2,!1]}}))}))},this.register=function(i,r,o,n,a,d){return t(s,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return[4,u.register({email:o,password:n,firstName:i,lastName:r,isAcceptMarketing:a,attributes:d})];case 1:return(t=e.sent())&&t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(this.setToken(t.data.token,t.data.tokenExpiry),this.setCustomer(t.data.customer),this.saveLocalLastViewedProducts(),[2,!0]):[2,!1]}}))}))},this.saveContactForm=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return n.contactForm(i),[4,u.sendContactFormToMerchant(i)];case 1:return[2,t.sent().isSuccess]}}))}))},this.checkEmail=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.checkEmail({email:i})];case 1:return[2,t.sent().isSuccess]}}))}))},this.forgotPassword=function(i){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.forgotPassword({email:i})];case 1:return[2,t.sent().isSuccess]}}))}))},this.recoverPassword=function(i,r,o){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.recoverPassword({password:i,passwordAgain:r,token:o})];case 1:return[2,t.sent().isSuccess]}}))}))},this.logout=function(){var t;s.clearLocalData(),null===(t=s.baseStore)||void 0===t||t.cartStore.removeCart(),n.customerLogout()},this.saveCustomer=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u.saveCustomer({input:new c(i)})];case 1:return(t=e.sent()).isSuccess&&t.data?(this.setCustomer(t.data),[2,!0]):[2,!1]}}))}))},this.getOrders=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.getOrders({})];case 1:return[2,t.sent().data||[]]}}))}))},this.getOrder=function(i){return t(s,void 0,void 0,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,u.getOrders({orderId:i})];case 1:return(t=e.sent()).isSuccess&&(null===(o=t.data)||void 0===o?void 0:o.length)?((r=t.data[0])._refundSettings=this._refundSettings,[2,r]):[2,null]}}))}))},this.getOrderTransactions=function(i){return void 0===i&&(i={}),t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.listOrderTransactions({checkoutId:{eq:i.checkoutId},id:{eq:i.checkoutId},orderId:{eq:i.orderId}})];case 1:return[2,t.sent().data||[]]}}))}))},this.getFavoriteProductsIds=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.listFavoriteProducts()];case 1:return[2,t.sent().data||[]]}}))}))},this.getFavoriteProducts=function(){return t(s,void 0,void 0,(function(){var t,i,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,u.listFavoriteProducts()];case 1:return(t=e.sent()).isSuccess||!(null===(r=t.data)||void 0===r?void 0:r.length)?[2,[]]:[4,p.searchProducts({input:{productIdList:t.data.map((function(t){return t.productId})),priceListId:a.priceListId,salesChannelId:a.salesChannelId}})];case 2:return i=e.sent(),[2,(null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.data)||[]]}}))}))},this.addProductToFavorites=function(i){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:if(!(null===(r=this.customer)||void 0===r?void 0:r.id))throw Error("Unauthorized");return[4,u.saveFavoriteProduct({isFavorite:!0,productId:i})];case 1:return t=e.sent(),n.addToWishlist(i),[2,t.data||!1]}}))}))},this.removeProductFromFavorites=function(i){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:if(!(null===(r=this.customer)||void 0===r?void 0:r.id))throw Error("Unauthorized");return[4,u.saveFavoriteProduct({isFavorite:!1,productId:i})];case 1:return t=e.sent(),n.addToWishlist(i),[2,t.data||!1]}}))}))},this.isProductFavorite=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");return[4,u.isFavoriteProduct({productId:i})];case 1:return[2,e.sent().data||!1]}}))}))},this.createEmailSubscription=function(i){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u.createCustomerEmailSubscription({input:{email:i}})];case 1:return(t=e.sent()).isSuccess&&(window.localStorage.setItem("customerEmailSubscription","true"),this.customer?(this.customer.subscriptionStatus,h.SUBSCRIBED):this._visitorSubscribedEmail=!0,n.createEmailSubscripition(i)),[2,t.isSuccess]}}))}))},this.sendReview=function(r){return t(s,void 0,void 0,(function(){var t,o,s,n;return e(this,(function(e){switch(e.label){case 0:if(t=a.customerReviewSettings,o=a.salesChannelId,!t)return[2];if(!(s=null===(n=this.customer)||void 0===n?void 0:n.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,u.createCustomerReview({input:i(i({},r),{customerId:t.customerLoginRequired?s:void 0,salesChannelId:o||""})})];case 1:return[2,e.sent().data]}}))}))},this.onCustomerConsentGrant=function(){s.saveCustomerConsent()},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.initialized&&(clearInterval(e),t(null))}),100)}))},this.getRaffles=function(){return t(s,void 0,void 0,(function(){var t,i,r,o;return e(this,(function(e){switch(e.label){case 0:return[4,l.getRafflesByCustomerId({winnerFilter:!1})];case 1:return t=e.sent(),[4,l.getRafflesByCustomerId({winnerFilter:!0})];case 2:return i=e.sent(),r=t.data,o=i.data,null==r||r.forEach((function(t){(null==o?void 0:o.find((function(e){return e.id===t.id})))&&(t.isCustomerWinner=!0)})),r?[4,d(r)]:[3,4];case 3:e.sent(),e.label=4;case 4:return[2,r||[]]}}))}))},this.getCustomerAttributes=function(){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,u.listCustomerAttribute()];case 1:return t=e.sent(),this.customer&&(null===(i=this.customer.attributes)||void 0===i||i.forEach((function(e){var i,r,o;e.customerAttribute=(null===(i=t.data)||void 0===i?void 0:i.find((function(t){return t.id===e.customerAttributeId})))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(o=null===(r=e.customerAttribute)||void 0===r?void 0:r.options)||void 0===o?void 0:o.find((function(t){return t.id===e.customerAttributeOptionId})))||null)}))),[2,t.data||[]]}}))}))},this.getOrderByEmail=function(i,r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,u.getOrderByEmail({email:i,orderNumber:r})];case 1:return[2,t.sent().data||null]}}))}))},this.getOrderRefundSettings=function(){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this._refundSettings?[3,2]:[4,u.listOrderRefundSettings({})];case 1:(t=e.sent()).isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)&&(this._refundSettings=t.data[0]),e.label=2;case 2:return[2]}}))}))},this.baseStore=o,r(this)}return Object.defineProperty(v.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"canCreateEmailSubscription",{get:function(){var t;return!((null===(t=this.customer)||void 0===t?void 0:t.isSubscribed)||f||this._visitorSubscribedEmail)&&!window.localStorage.getItem("customerEmailSubscription")},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"customerConsentGranted",{get:function(){return this._customerConsentGranted},enumerable:!1,configurable:!0}),v.prototype.socialLogin=function(i){return t(this,void 0,void 0,(function(){var t,r,o;return e(this,(function(e){switch(e.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",r="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/ms/").concat(i,"/login/authenticate?redirect=").concat(t),[4,fetch(r,{headers:{"x-api-key":a.config.apiKey||"","x-sfid":a.storefrontId||"","x-sfrid":a.storefrontRoutingId||""}})]);case 1:return[4,e.sent().json()];case 2:return o=e.sent(),a.router?a.router.replace(o.redirectUrl):window.location.href=o.redirectUrl,[2]}}))}))},v.prototype.socialLoginToken=function(i){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,u.socialLogin({code:i})];case 1:return(null==(t=e.sent())?void 0:t.isSuccess)&&(null===(r=t.data)||void 0===r?void 0:r.customer)?(this.setToken(t.data.token,t.data.tokenExpiry),this.setCustomer(t.data.customer),this.customer&&n.customerLogin(),[2,!0]):[2,!1]}}))}))},v.prototype.init=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.loadToken(),this.loadLastViewedProducts(),this.loadCustomerConsent(),[4,this.refreshToken()];case 1:return t.sent(),[4,this.getCustomer()];case 2:return t.sent(),[4,this.getOrderRefundSettings()];case 3:return t.sent(),this._initialized=!0,this.customer&&n.customerVisit(),[2]}}))}))},v.prototype.routeChangeInit=function(){this.customer||(this.loadToken(),this.getCustomer())},v.prototype.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return f||!this.token?[2]:[4,u.getCustomer()];case 1:return(t=e.sent()).data&&this.setCustomer(t.data),[2]}}))}))},v.prototype.refreshToken=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.token?[4,u.refreshToken({token:this.token})]:[2];case 1:return(t=e.sent()).isSuccess&&t.data?this.setToken(t.data.token,t.data.tokenExpiry):(this.token=null,this.tokenExpiry=null,this.clearLocalData()),[2]}}))}))},v.prototype.setCustomer=function(t){this.customer=new s(t)},v.prototype.getLastViewedProducts=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.customer?[4,u.getLastViewedProducts({customerId:this.customer.id})]:[3,2];case 1:return t=e.sent(),this._lastViewedProducts=t.data||[],[3,3];case 2:this.loadLastViewedProducts(),e.label=3;case 3:return[2,this._lastViewedProducts]}}))}))},v.prototype.saveLastViewedProducts=function(){f||window.localStorage.setItem("lastViewedProducts",JSON.stringify(this._lastViewedProducts))},v.prototype.loadLastViewedProducts=function(){if(!f)try{var t=window.localStorage.getItem("lastViewedProducts");t&&(this._lastViewedProducts=JSON.parse(t),this._lastViewedProducts=this._lastViewedProducts.reverse(),this._lastViewedProducts=o(this._lastViewedProducts,"variantId"))}catch(t){}},v.prototype.removeLastViewedProducts=function(){f||window.localStorage.removeItem("lastViewedProducts")},v.prototype.onProductView=function(i,r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.customer?this._lastViewedProducts.find((function(t){return t.productId===i}))?[2]:[4,u.saveLastViewedProducts({input:{customerId:this.customer.id,products:[{productId:i,variantId:r}]}})]:[3,2];case 1:return t.sent()&&this._lastViewedProducts.push({productId:i,variantId:r}),[3,3];case 2:this._lastViewedProducts.push({productId:i,variantId:r}),this._lastViewedProducts=this._lastViewedProducts.slice(0,20),this._lastViewedProducts=o(this._lastViewedProducts,"variantId"),this.saveLastViewedProducts(),t.label=3;case 3:return[2]}}))}))},v.prototype.saveLocalLastViewedProducts=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:if(f)return[2];t.label=1;case 1:return t.trys.push([1,4,,5]),this.loadLastViewedProducts(),this._lastViewedProducts.length?[4,u.saveLastViewedProducts({input:{customerId:this.customer.id,products:this._lastViewedProducts}})]:[3,3];case 2:t.sent()&&this.removeLastViewedProducts(),t.label=3;case 3:return[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},v.prototype.saveCustomerConsent=function(){f||(this._customerConsentGranted=!0,window.localStorage.setItem("customerConsent","true"))},v.prototype.loadCustomerConsent=function(){f||(this._customerConsentGranted=!!window.localStorage.getItem("customerConsent"))},v.prototype.removeCustomerConsent=function(){f||window.localStorage.removeItem("customerConsent")},v.prototype.setToken=function(t,e){f||(this.token=t,this.tokenExpiry=e,localStorage.setItem("customerToken",t),localStorage.setItem("customerTokenExpiry",e+""),m.TOKEN=t)},v.prototype.loadToken=function(){if(!f){var t=localStorage.getItem("customerToken"),e=localStorage.getItem("customerTokenExpiry");t&&e&&this.setToken(t,parseInt(e))}},v.prototype.clearLocalTokenData=function(){localStorage.removeItem("customerToken"),localStorage.removeItem("customerTokenExpiry"),this.token=void 0,this.tokenExpiry=void 0},v.prototype.clearLocalData=function(){this.clearLocalTokenData(),this.customer=void 0,m.TOKEN=""},v}();export{v as IkasCustomerStore};
@@ -4,8 +4,9 @@ import { IkasStorefrontRouting } from "../models/data/storefront/routing";
4
4
  import { IkasThemeStockPreference } from "../models/theme/settings";
5
5
  import { IkasThemeFavicon } from "../models/theme/settings/favicon";
6
6
  import { IkasBaseStore } from "../store";
7
- import { IkasCustomerReviewSettings } from "../models";
8
7
  import { NextRouter } from "next/router";
8
+ import { IkasCustomerReviewSettings } from "../models/data/customer-review";
9
+ import { IkasMerchantSettings } from "../models/data/merchant-settings";
9
10
  export declare class IkasStorefrontConfig {
10
11
  static store: IkasBaseStore;
11
12
  static config: Record<string, any>;
@@ -25,16 +26,18 @@ export declare class IkasStorefrontConfig {
25
26
  static analytics4Id?: string;
26
27
  static universalAnalyticsId?: string;
27
28
  static pickUpStockLocationIds: string[] | null;
29
+ static tiktokPixelId?: string;
28
30
  static favicon: IkasThemeFavicon;
29
31
  static stockPreference: IkasThemeStockPreference;
30
32
  static translations: Record<string, any>;
31
33
  static storefrontJSScripts: string[];
32
34
  static customerReviewSettings: IkasCustomerReviewSettings | null;
33
35
  static productBackInStockSettings: IkasProductBackInStockSettings | null;
36
+ static merchantSettings?: IkasMerchantSettings | null;
34
37
  static isEditor: boolean;
35
38
  static currentPageComponents?: Record<string, any>;
36
39
  static init(store: IkasBaseStore, config: Record<string, any>, apiUrlOverride?: string): void;
37
- static initWithJson(json: Record<string, any>, router: NextRouter): void;
40
+ static initWithJson(json: Record<string, any>, router: NextRouter, merchantSettingsStr: string | null): void;
38
41
  static getCurrentRouting(): IkasStorefrontRouting | undefined;
39
42
  static getCurrentLocale(): string;
40
43
  static getJson(): {
@@ -52,6 +55,7 @@ export declare class IkasStorefrontConfig {
52
55
  analytics4Id: string | null;
53
56
  universalAnalyticsId: string | null;
54
57
  pickUpStockLocationIds: string[] | null;
58
+ tiktokPixelId: string | null;
55
59
  favicon: any;
56
60
  stockPreference: IkasThemeStockPreference;
57
61
  storefrontJSScripts: string[];
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as n}from'../ext/tslib/tslib.es6.js';import{APIErrorCode as o}from'../ext/@ikas/fe-api-client/build/utils/api.js';import'../ext/axios/lib/axios.js';import e from'../ext/@ikas/fe-api-client/build/config/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';var i=function(){function i(){}return i.init=function(t,n,o){i.store=t,i.config=n,i.apiUrlOverride=o||null,"local"===process.env.NEXT_PUBLIC_ENV&&(this.storefrontId=n.storefrontId),i.setAPIConfig(),t.init()},i.initWithJson=function(t,n){try{Object.entries(t).forEach((function(t){var n=t[0],o=t[1];i[n]=o})),i.router=n,i.setAPIConfig()}catch(t){console.log(t)}},i.getCurrentRouting=function(){return i.routings.find((function(t){return t.id===i.storefrontRoutingId}))},i.getCurrentLocale=function(){var t=i.getCurrentRouting();return(null==t?void 0:t.locale)||"en"},i.getJson=function(){return{domain:i.domain,storefrontId:i.storefrontId||null,storefrontRoutingId:i.storefrontRoutingId||null,storefrontThemeId:i.storefrontThemeId||null,salesChannelId:i.salesChannelId||null,priceListId:i.priceListId||null,stockLocationIds:i.stockLocationIds||null,routings:JSON.parse(JSON.stringify(i.routings))||null,paymentGateways:JSON.parse(JSON.stringify(i.paymentGateways))||null,gtmId:i.gtmId||null,fbpId:i.fbpId||null,analytics4Id:i.analytics4Id||null,universalAnalyticsId:i.universalAnalyticsId||null,pickUpStockLocationIds:i.pickUpStockLocationIds||null,favicon:JSON.parse(JSON.stringify(i.favicon)),stockPreference:i.stockPreference||null,storefrontJSScripts:i.storefrontJSScripts||[],translations:this.translations,customerReviewSettings:i.customerReviewSettings,productBackInStockSettings:i.productBackInStockSettings?JSON.parse(JSON.stringify(i.productBackInStockSettings)):null}},i.setAPIConfig=function(r){var s=this;e.URL=i.apiUrlOverride||process.env.NEXT_PUBLIC_GQL_URL||"",e.HEADERS={"x-api-key":r||i.config.apiKey,"x-sfid":i.storefrontId||"","x-sfrid":i.storefrontRoutingId||""},e.ON_ERROR={errors:[{errorCode:o.LOGIN_REQUIRED,callback:function(o){var e=o.graphQLErrors,i=o.operation;return t(s,void 0,void 0,(function(){return n(this,(function(t){return e&&console.log(e),"undefined"!=typeof window&&"refreshToken"!==i.operationName&&(window.location.href="/account/login?redirect="+encodeURIComponent(window.location.pathname)),[2]}))}))}}]}},i.config={},i.apiUrlOverride=null,i.routings=[],i.paymentGateways=[],i.translations={},i.storefrontJSScripts=[],i.isEditor=!1,i}();export{i as IkasStorefrontConfig};
1
+ import{__awaiter as t,__generator as n}from'../ext/tslib/tslib.es6.js';import{APIErrorCode as o}from'../ext/@ikas/fe-api-client/build/utils/api.js';import'../ext/axios/lib/axios.js';import e from'../ext/@ikas/fe-api-client/build/config/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{IkasMerchantSettings as i}from"../models/data/merchant-settings/index.js";var r=function(){function r(){}return r.init=function(t,n,o){r.store=t,r.config=n,r.apiUrlOverride=o||null,"local"===process.env.NEXT_PUBLIC_ENV&&(this.storefrontId=n.storefrontId),r.setAPIConfig(),t.init()},r.initWithJson=function(t,n,o){try{Object.entries(t).forEach((function(t){var n=t[0],o=t[1];r[n]=o})),r.router=n,r.setAPIConfig(),o&&(r.merchantSettings=new i(JSON.parse(o)))}catch(t){console.log(t)}},r.getCurrentRouting=function(){return r.routings.find((function(t){return t.id===r.storefrontRoutingId}))},r.getCurrentLocale=function(){var t=r.getCurrentRouting();return(null==t?void 0:t.locale)||"en"},r.getJson=function(){return{domain:r.domain,storefrontId:r.storefrontId||null,storefrontRoutingId:r.storefrontRoutingId||null,storefrontThemeId:r.storefrontThemeId||null,salesChannelId:r.salesChannelId||null,priceListId:r.priceListId||null,stockLocationIds:r.stockLocationIds||null,routings:JSON.parse(JSON.stringify(r.routings))||null,paymentGateways:JSON.parse(JSON.stringify(r.paymentGateways))||null,gtmId:r.gtmId||null,fbpId:r.fbpId||null,analytics4Id:r.analytics4Id||null,universalAnalyticsId:r.universalAnalyticsId||null,pickUpStockLocationIds:r.pickUpStockLocationIds||null,tiktokPixelId:r.tiktokPixelId||null,favicon:JSON.parse(JSON.stringify(r.favicon)),stockPreference:r.stockPreference||null,storefrontJSScripts:r.storefrontJSScripts||[],translations:this.translations,customerReviewSettings:r.customerReviewSettings,productBackInStockSettings:r.productBackInStockSettings?JSON.parse(JSON.stringify(r.productBackInStockSettings)):null}},r.setAPIConfig=function(i){var s=this;e.URL=r.apiUrlOverride||process.env.NEXT_PUBLIC_GQL_URL||"",e.HEADERS={"x-api-key":i||r.config.apiKey,"x-sfid":r.storefrontId||"","x-sfrid":r.storefrontRoutingId||""},e.ON_ERROR={errors:[{errorCode:o.LOGIN_REQUIRED,callback:function(o){var e=o.graphQLErrors,i=o.operation;return t(s,void 0,void 0,(function(){return n(this,(function(t){return e&&console.log(e),"undefined"!=typeof window&&"refreshToken"!==i.operationName&&(window.location.href="/account/login?redirect="+encodeURIComponent(window.location.pathname)),[2]}))}))}}]}},r.config={},r.apiUrlOverride=null,r.routings=[],r.paymentGateways=[],r.translations={},r.storefrontJSScripts=[],r.isEditor=!1,r}();export{r as IkasStorefrontConfig};
@@ -1 +1,2 @@
1
1
  export declare const FREE_TEXT_CITY_COUNTRY_LIST: string[];
2
+ export declare const DISTRICT_HIDDEN_COUNTRY_LIST: string[];
@@ -1 +1 @@
1
- var r=["DE"];export{r as FREE_TEXT_CITY_COUNTRY_LIST};
1
+ var r=["DE","US"],S=["US"];export{S as DISTRICT_HIDDEN_COUNTRY_LIST,r as FREE_TEXT_CITY_COUNTRY_LIST};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
3
  * @param price Price to format
4
- * @param currency Code for the currency, USD, EUR, TRY, etc..
4
+ * @param currencyCode Code for the currency, USD, EUR, TRY, etc..
5
5
  */
6
- export declare const formatMoney: (price: number, currency: string) => string;
6
+ export declare const formatMoney: (price: number, currencyCode: string) => string;
7
7
  export declare function getCurrencySymbol(currencyCode: string): string;
@@ -1 +1 @@
1
- import{IkasStorefrontConfig as D}from"../storefront/index.js";var S=function(S,$){try{var r=R($||"");return r+" "+(K=",",B=".",M="\\d(?=(\\d{"+(3||3)+"})+"+((P=2)>0?"\\D":"$")+")",N=S.toFixed(Math.max(0,~~P)),(B?N.replace(".",B):N).replace(new RegExp(M,"g"),"$&"+(K||",")))}catch(R){return console.error(R),new Intl.NumberFormat(D.getCurrentLocale(),{style:"currency",currency:$||"TRY"}).format(S)}var P,K,B,M,N};function R(D){return $[D]||D}var $={TRY:"₺",USD:"$",EUR:"€",AZN:"₼",AED:"د.إ.",AFN:"؋",ALL:"L",AMD:"դր",ANG:"ƒ",AOA:"Kz",ARS:"$",AUD:"$",AWG:"ƒ",BAM:"КМ",BBD:"$",BDT:"৳",BGN:"лв.",BHD:"د.ب.",BIF:"FBu",BMD:"$",BND:"$",BOB:"Bs.",BRL:"R$",BSD:"$",BTN:"Nu.",BWP:"P",BYN:"руб.",BZD:"$",CAD:"$",CDF:"₣",CHF:"₣",CKD:"$",CLP:"$",CNY:"¥元",COP:"$",CRC:"₡",CUC:"$",CUP:"₱",CVE:"$",CZK:"Kč",DJF:"ف.ج.",DKK:"kr.",DOP:"$",DZD:"د.ج.",EGP:"ج.م.",EHP:"Ptas.",ERN:"ناكفا",ETB:"ብር",FJD:"$",FKP:"£",FOK:"kr",GBP:"£",GEL:"₾",GGP:"£",GHS:"₵",GIP:"£",GMD:"D",GNF:"FG",GTQ:"$",GYD:"$",HKD:"$",HNL:"L",HRK:"kn",HTG:"G",HUF:"Ft",IDR:"Rp",ILS:"₪",IMP:"£",INR:"₹",IQD:"د.ع.",IRR:"﷼",ISK:"kr",JEP:"£",JMD:"$",JOD:"د.أ.",JPY:"¥",KES:"KSh",KGS:"с",KHR:"៛",KID:"$",KMF:"CF",KPW:"₩",KRW:"₩",KWD:"د.ك.",KYD:"$",KZT:"₸",LAK:"₭",LBP:"ل.ل.",LKR:"රු or ரூ",LRD:"$",LSL:"L",LYD:"ل.د.",MAD:"د.م.",MDL:"L",MGA:"Ar",MKD:"ден",MMK:"Ks",MNT:"₮",MOP:"MOP$",MRU:"أ.م.",MUR:"रु ",MVR:".ރ",MWK:"MK",MXN:"$",MYR:"RM",MZN:"MT",NAD:"$",NGN:"₦",NIO:"C$",NOK:"kr",NPR:"रू",NZD:"$",OMR:"ر.ع.",PAB:"B/.",PEN:"S/.",PGK:"K",PHP:"₱",PKR:"Rs",PLN:"zł",PND:"$",PRB:"р.",PYG:"₲",QAR:"ر.ق.",RON:"L",RSD:"дин",RUB:"₽",RWF:"R₣",SAR:"ر.س.",SBD:"$",SCR:"Rs",SDG:"ج.س.",SEK:"kr",SGD:"$",SHP:"£",SLL:"Le",SLS:"Sl",SOS:"Ssh",SRD:"$",SSP:"SS£",STN:"Db",SVC:"₡",SYP:"ل.س.",SZL:"L",THB:"฿",TJS:"SM",TMT:"T",TND:"د.ت.",TOP:"PT",TTD:"$",TVD:"$",TWD:"圓",TZS:"TSh",UAH:"грн",UGX:"Sh",UYU:"$",UZS:"сум",VED:"Bs.",VES:"Bs.F",VND:"₫",VUV:"VT",WST:"ST",XAF:"Fr.",XCD:"$",XOF:"₣",XPF:"₣",YER:"ر.ي.",ZAR:"R",ZMW:"ZK",ZWB:"",ZWL:"$",Abkhazia:"",Artsakh:"դր."};export{S as formatMoney,R as getCurrencySymbol};
1
+ import{IkasStorefrontConfig as r}from"../storefront/index.js";var D=function(D,n){var t,o,R,$,e,P,K,B=null===(o=null===(t=r.merchantSettings)||void 0===t?void 0:t.currencyFormats)||void 0===o?void 0:o.find((function(r){return r.currencyCode===n})),L=(null==B?void 0:B.symbol)||S(n),M=(null==B?void 0:B.decimalSeparator)||".",N=(null==B?void 0:B.thousandSeparator)||",",a=(null==B?void 0:B.symbolPosition)||"LEFT";try{var c=($=N,e=M,P="\\d(?=(\\d{"+(3||3)+"})+"+((R=2)>0?"\\D":"$")+")",K=D.toFixed(Math.max(0,~~R)),(e?K.replace(".",e):K).replace(new RegExp(P,"g"),"$&"+($||",")));return(null==B?void 0:B.omitZeroDecimal)&&(c=function(r){var D=r.split(M);return"00"===D[D.length-1]?D[0]:r}(c)),function(r){return"LEFT"===a?"".concat(L," ").concat(r):"".concat(r," ").concat(L)}(c)}catch(S){return console.error(S),new Intl.NumberFormat(r.getCurrentLocale(),{style:"currency",currency:n||"TRY"}).format(D)}};function S(r){return n[r]||r}var n={TRY:"₺",USD:"$",EUR:"€",AZN:"₼",AED:"د.إ.",AFN:"؋",ALL:"L",AMD:"դր",ANG:"ƒ",AOA:"Kz",ARS:"$",AUD:"$",AWG:"ƒ",BAM:"КМ",BBD:"$",BDT:"৳",BGN:"лв.",BHD:"د.ب.",BIF:"FBu",BMD:"$",BND:"$",BOB:"Bs.",BRL:"R$",BSD:"$",BTN:"Nu.",BWP:"P",BYN:"руб.",BZD:"$",CAD:"$",CDF:"₣",CHF:"₣",CKD:"$",CLP:"$",CNY:"¥元",COP:"$",CRC:"₡",CUC:"$",CUP:"₱",CVE:"$",CZK:"Kč",DJF:"ف.ج.",DKK:"kr.",DOP:"$",DZD:"د.ج.",EGP:"ج.م.",EHP:"Ptas.",ERN:"ناكفا",ETB:"ብር",FJD:"$",FKP:"£",FOK:"kr",GBP:"£",GEL:"₾",GGP:"£",GHS:"₵",GIP:"£",GMD:"D",GNF:"FG",GTQ:"$",GYD:"$",HKD:"$",HNL:"L",HRK:"kn",HTG:"G",HUF:"Ft",IDR:"Rp",ILS:"₪",IMP:"£",INR:"₹",IQD:"د.ع.",IRR:"﷼",ISK:"kr",JEP:"£",JMD:"$",JOD:"د.أ.",JPY:"¥",KES:"KSh",KGS:"с",KHR:"៛",KID:"$",KMF:"CF",KPW:"₩",KRW:"₩",KWD:"د.ك.",KYD:"$",KZT:"₸",LAK:"₭",LBP:"ل.ل.",LKR:"රු or ரூ",LRD:"$",LSL:"L",LYD:"ل.د.",MAD:"د.م.",MDL:"L",MGA:"Ar",MKD:"ден",MMK:"Ks",MNT:"₮",MOP:"MOP$",MRU:"أ.م.",MUR:"रु ",MVR:".ރ",MWK:"MK",MXN:"$",MYR:"RM",MZN:"MT",NAD:"$",NGN:"₦",NIO:"C$",NOK:"kr",NPR:"रू",NZD:"$",OMR:"ر.ع.",PAB:"B/.",PEN:"S/.",PGK:"K",PHP:"₱",PKR:"Rs",PLN:"zł",PND:"$",PRB:"р.",PYG:"₲",QAR:"ر.ق.",RON:"L",RSD:"дин",RUB:"₽",RWF:"R₣",SAR:"ر.س.",SBD:"$",SCR:"Rs",SDG:"ج.س.",SEK:"kr",SGD:"$",SHP:"£",SLL:"Le",SLS:"Sl",SOS:"Ssh",SRD:"$",SSP:"SS£",STN:"Db",SVC:"₡",SYP:"ل.س.",SZL:"L",THB:"฿",TJS:"SM",TMT:"T",TND:"د.ت.",TOP:"PT",TTD:"$",TVD:"$",TWD:"圓",TZS:"TSh",UAH:"грн",UGX:"Sh",UYU:"$",UZS:"сум",VED:"Bs.",VES:"Bs.F",VND:"₫",VUV:"VT",WST:"ST",XAF:"Fr.",XCD:"$",XOF:"₣",XPF:"₣",YER:"ر.ي.",ZAR:"R",ZMW:"ZK",ZWB:"",ZWL:"$",Abkhazia:"",Artsakh:"դր."};export{D as formatMoney,S as getCurrencySymbol};
@@ -1 +1 @@
1
- import{IkasStorefrontConfig as e}from"../storefront/index.js";import r from'../ext/lodash/forEach.js';var t=function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLocaleLowerCase("tr-TR");for(var r="àáäâèéëêìíïîıòóöôùúüûñçşğ·/_,:;",t=0,n=r.length;t<n;t++)e=e.replace(new RegExp(r.charAt(t),"g"),"aaaaeeeeiiiiioooouuuuncsg------".charAt(t));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},n=function(e){return/^\+?\d+$/.test(e)},o=function(e){return!(e.length>320)&&/^[a-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/.test(e)},a=function(e){var r=e.toLocaleLowerCase("tr-TR");return r.charAt(0).toLocaleUpperCase("tr-TR")+r.slice(1)},u=function(e){return Buffer.from(e,"base64").toString("ascii")};function c(e,r){var t="0123456789AaBbCcÇçDdEeFfGgĞğHhIıİiJjKkLlMmNnOoÖöPpQqRrSsŞşTtUuÜüVvWwXxYyZz",n=e||"",o=r||"";if(0===n.length||0===o.length)return n.length-o.length;for(var a=0;a<n.length&&a<o.length;a++){var u=t.indexOf(n[a].toUpperCase()),c=t.indexOf(o[a].toUpperCase());if(u!==c)return u-c}return 0}function i(e,r){var t=[];if(!e||!r)return[];for(var n=0;n<e.length;){var o=e.indexOf(r,n);if(-1===o)break;n=o+1,t.push(o)}return t}function f(e){return!!new Intl.DateTimeFormat(e,{hour:"numeric"}).format(0).match(/\s/)}function l(r){var t={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",hour12:!1},n=e.getCurrentLocale();return"undefined"!=typeof navigator?t.hour12=f(navigator.language):t.hour12=f(n),new Intl.DateTimeFormat(n,t).format(r)}function s(e,t,n){void 0===n&&(n=!1),r(e,(function(e,r){try{t(e,r)}catch(e){n&&console.error(e)}}))}function g(e,r){return Object.entries(e||{}).reduce((function(e,t){var n=t[0],o=t[1];return n===r?e.concat(o):"object"==typeof o?e.concat(g(o,r)):e}),[])}function h(e){return Object.keys(e).sort().reduce((function(r,t){return r[t]=e[t],r}),{})}export{u as decodeBase64,g as findAllByKey,i as findAllIndexes,l as formatDate,a as pascalCase,h as sortObject,c as stringSorter,t as stringToSlug,s as tryForEach,o as validateEmail,n as validatePhoneNumber};
1
+ import{IkasStorefrontConfig as r}from"../storefront/index.js";import e from'../ext/lodash/forEach.js';var t=function(r){r=(r=r.replace(/^\s+|\s+$/g,"")).toLocaleLowerCase("tr-TR");for(var e="àáäâèéëêìíïîıòóöôùúüûñçşğ·/_,:;",t=0,n=e.length;t<n;t++)r=r.replace(new RegExp(e.charAt(t),"g"),"aaaaeeeeiiiiioooouuuuncsg------".charAt(t));return r=r.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},n=function(r){return/^\+?\d+$/.test(r)},o=function(r){return!(r.length>320)&&/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(r)},a=function(r){return r.split(" ").map((function(r){var e=r.toLocaleLowerCase("tr-TR");return e.charAt(0).toLocaleUpperCase("tr-TR")+e.slice(1)})).join(" ")},u=function(r){return Buffer.from(r,"base64").toString("ascii")};function c(r,e){var t="0123456789AaBbCcÇçDdEeFfGgĞğHhIıİiJjKkLlMmNnOoÖöPpQqRrSsŞşTtUuÜüVvWwXxYyZz",n=r||"",o=e||"";if(0===n.length||0===o.length)return n.length-o.length;for(var a=0;a<n.length&&a<o.length;a++){var u=t.indexOf(n[a].toUpperCase()),c=t.indexOf(o[a].toUpperCase());if(u!==c)return u-c}return 0}function i(r,e){var t=[];if(!r||!e)return[];for(var n=0;n<r.length;){var o=r.indexOf(e,n);if(-1===o)break;n=o+1,t.push(o)}return t}function f(r){return!!new Intl.DateTimeFormat(r,{hour:"numeric"}).format(0).match(/\s/)}function l(e){var t={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",hour12:!1},n=r.getCurrentLocale();return"undefined"!=typeof navigator?t.hour12=f(navigator.language):t.hour12=f(n),new Intl.DateTimeFormat(n,t).format(e)}function s(r,t,n){void 0===n&&(n=!1),e(r,(function(r,e){try{t(r,e)}catch(r){n&&console.error(r)}}))}function g(r,e){return Object.entries(r||{}).reduce((function(r,t){var n=t[0],o=t[1];return n===e?r.concat(o):"object"==typeof o?r.concat(g(o,e)):r}),[])}function h(r){return Object.keys(r).sort().reduce((function(e,t){return e[t]=r[t],e}),{})}export{u as decodeBase64,g as findAllByKey,i as findAllIndexes,l as formatDate,a as pascalCase,h as sortObject,c as stringSorter,t as stringToSlug,s as tryForEach,o as validateEmail,n as validatePhoneNumber};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "3.0.0-alpha.26",
3
+ "version": "3.0.0-alpha.27",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",