@ikas/storefront 6.1.0-beta.23 → 6.1.0-beta.231

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 (197) hide show
  1. package/build/analytics/analytics.d.ts +6 -3
  2. package/build/analytics/analytics.js +1 -1
  3. package/build/analytics/events.d.ts +4 -1
  4. package/build/analytics/events.js +1 -1
  5. package/build/analytics/googleAnalytics.d.ts +2 -2
  6. package/build/analytics/googleAnalytics.js +1 -1
  7. package/build/analytics/googleTagManager.d.ts +3 -2
  8. package/build/analytics/googleTagManager.js +1 -1
  9. package/build/analytics/ikasV3.d.ts +6 -0
  10. package/build/analytics/ikasV3.js +1 -1
  11. package/build/components/checkout/components/address-form/index.js +1 -1
  12. package/build/components/checkout/components/address-form/model.d.ts +5 -0
  13. package/build/components/checkout/components/address-form/model.js +1 -1
  14. package/build/components/checkout/components/adyen/index.js +1 -1
  15. package/build/components/checkout/components/button/index.d.ts +1 -0
  16. package/build/components/checkout/components/button/index.js +1 -1
  17. package/build/components/checkout/components/button/style.module.scss.js +1 -1
  18. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  19. package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
  20. package/build/components/checkout/components/cart-summary/index.d.ts +2 -1
  21. package/build/components/checkout/components/cart-summary/index.js +1 -1
  22. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
  23. package/build/components/checkout/components/customer-addresses/index.d.ts +1 -0
  24. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  25. package/build/components/checkout/components/error/stock-error/index.js +1 -1
  26. package/build/components/checkout/components/form-item/index.js +1 -1
  27. package/build/components/checkout/components/form-item/model.d.ts +5 -3
  28. package/build/components/checkout/components/form-item/model.js +1 -1
  29. package/build/components/checkout/components/form-item/style.module.scss.js +1 -1
  30. package/build/components/checkout/components/hepsipay/index.d.ts +9 -0
  31. package/build/components/checkout/components/hepsipay/index.js +1 -0
  32. package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -1
  33. package/build/components/checkout/components/modal/index.d.ts +1 -0
  34. package/build/components/checkout/components/modal/index.js +1 -1
  35. package/build/components/checkout/components/modal/style.module.scss.js +1 -1
  36. package/build/components/checkout/components/offer-product/index.js +1 -1
  37. package/build/components/checkout/components/offer-product/style.module.scss.js +1 -1
  38. package/build/components/checkout/components/phone-number-input/index.d.ts +1 -1
  39. package/build/components/checkout/components/phone-number-input/index.js +1 -1
  40. package/build/components/checkout/components/quick-registration/completed.js +1 -1
  41. package/build/components/checkout/components/quick-registration/index.js +1 -1
  42. package/build/components/checkout/components/stripe/checkout-form.js +1 -1
  43. package/build/components/checkout/components/svg/coupon-code-tag.d.ts +6 -0
  44. package/build/components/checkout/components/svg/coupon-code-tag.js +1 -0
  45. package/build/components/checkout/components/svg/credit-balance.d.ts +6 -0
  46. package/build/components/checkout/components/svg/credit-balance.js +1 -0
  47. package/build/components/checkout/components/svg/gift-cart-tag.d.ts +6 -0
  48. package/build/components/checkout/components/svg/gift-cart-tag.js +1 -0
  49. package/build/components/checkout/components/svg/store-credit-tag.d.ts +6 -0
  50. package/build/components/checkout/components/svg/store-credit-tag.js +1 -0
  51. package/build/components/checkout/components/svg/subscription.d.ts +6 -0
  52. package/build/components/checkout/components/svg/subscription.js +1 -0
  53. package/build/components/checkout/index.js +1 -1
  54. package/build/components/checkout/model.d.ts +29 -7
  55. package/build/components/checkout/model.js +1 -1
  56. package/build/components/checkout/steps/step-info/index.js +1 -1
  57. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  58. package/build/components/checkout/steps/step-payment/index.js +1 -1
  59. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  60. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.d.ts +7 -0
  61. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.js +1 -0
  62. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/style.module.scss.js +1 -0
  63. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  64. package/build/components/checkout/steps/step-success/index.js +1 -1
  65. package/build/components/image/index.d.ts +1 -0
  66. package/build/components/image/index.js +1 -1
  67. package/build/components/index.d.ts +3 -0
  68. package/build/components/page/head.js +1 -1
  69. package/build/components/page/index.d.ts +1 -1
  70. package/build/components/page/index.js +1 -1
  71. package/build/components/page/widgets/common.d.ts +2 -0
  72. package/build/components/page/widgets/common.js +1 -0
  73. package/build/components/page/widgets/loyaltyWidget.d.ts +8 -0
  74. package/build/components/page/widgets/loyaltyWidget.js +1 -0
  75. package/build/components/page/widgets/popupWidget.d.ts +13 -0
  76. package/build/components/page/widgets/popupWidget.js +1 -0
  77. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  78. package/build/components/page-editor/model.js +1 -1
  79. package/build/components/pay-with-ikas/index.d.ts +8 -0
  80. package/build/components/pay-with-ikas/index.js +1 -0
  81. package/build/components/paypal-express-checkout/index.d.ts +9 -0
  82. package/build/components/paypal-express-checkout/index.js +1 -0
  83. package/build/components/plain-image/index.d.ts +13 -0
  84. package/build/components/plain-image/index.js +1 -0
  85. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
  86. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/getCountries.js +1 -0
  87. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
  88. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountries.js +1 -0
  89. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
  90. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
  91. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
  92. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/ObserverComponent.js +1 -0
  93. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/index.js +1 -0
  94. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/observer.js +1 -0
  95. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/useObserver.js +1 -0
  96. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -0
  97. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/assertEnvironment.js +1 -0
  98. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerBatching.js +1 -0
  99. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -0
  100. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/printDebugValue.js +1 -0
  101. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -1
  102. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
  103. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -1
  104. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
  105. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -0
  106. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -0
  107. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -1
  108. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -1
  109. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
  110. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -1
  111. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -1
  112. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
  113. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -1
  114. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +1 -1
  115. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +1 -1
  116. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +1 -1
  117. package/build/hooks/useCustomerReviews.d.ts +2 -0
  118. package/build/hooks/useCustomerReviews.js +1 -1
  119. package/build/hooks/useStore.js +1 -1
  120. package/build/index.js +1 -1
  121. package/build/models/data/checkout-settings/index.d.ts +1 -0
  122. package/build/models/data/checkout-settings/index.js +1 -1
  123. package/build/models/data/customer/review/index.d.ts +4 -1
  124. package/build/models/data/customer/review/index.js +1 -1
  125. package/build/models/data/index.d.ts +1 -0
  126. package/build/models/data/order/adjustment/index.d.ts +3 -1
  127. package/build/models/data/order/adjustment/index.js +1 -1
  128. package/build/models/data/order/gift-card-line/index.d.ts +2 -1
  129. package/build/models/data/order/gift-card-line/index.js +1 -1
  130. package/build/models/data/order/index.d.ts +4 -0
  131. package/build/models/data/order/index.js +1 -1
  132. package/build/models/data/order/line-item/bundle-product-settings/index.d.ts +7 -0
  133. package/build/models/data/order/line-item/bundle-product-settings/index.js +1 -0
  134. package/build/models/data/order/line-item/index.d.ts +4 -0
  135. package/build/models/data/order/line-item/index.js +1 -1
  136. package/build/models/data/order/line-item/order-line-item-subscription-plan/index.d.ts +8 -0
  137. package/build/models/data/order/line-item/order-line-item-subscription-plan/index.js +1 -0
  138. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.d.ts +6 -0
  139. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.js +1 -0
  140. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.d.ts +14 -0
  141. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.js +1 -0
  142. package/build/models/data/order/loyalty-line/index.d.ts +9 -0
  143. package/build/models/data/order/loyalty-line/index.js +1 -0
  144. package/build/models/data/order/order-transaction-with-prices/index.d.ts +1 -0
  145. package/build/models/data/order/order-transaction-with-prices/index.js +1 -1
  146. package/build/models/data/product/campaign-offer/index.d.ts +2 -0
  147. package/build/models/data/product/campaign-offer/index.js +1 -1
  148. package/build/models/data/product/filter/index.d.ts +2 -0
  149. package/build/models/data/product/filter/index.js +1 -1
  150. package/build/models/data/product/index.d.ts +8 -0
  151. package/build/models/data/product/index.js +1 -1
  152. package/build/models/data/product/translations/index.d.ts +7 -0
  153. package/build/models/data/product/translations/index.js +1 -0
  154. package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -1
  155. package/build/models/data/product/variant/index.d.ts +3 -0
  156. package/build/models/data/product/variant/index.js +1 -1
  157. package/build/models/data/product/variant/subscription-plan/index.d.ts +12 -0
  158. package/build/models/data/product/variant/subscription-plan/index.js +1 -0
  159. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-discount/index.d.ts +6 -0
  160. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.d.ts +23 -0
  161. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.js +1 -0
  162. package/build/models/data/store-credit-balance/index.d.ts +26 -0
  163. package/build/models/data/store-credit-balance/index.js +1 -0
  164. package/build/models/data/theme-json/component/prop/index.d.ts +1 -0
  165. package/build/models/data/theme-json/component/prop/index.js +1 -1
  166. package/build/models/data/theme-json/custom-data/index.d.ts +1 -0
  167. package/build/models/data/theme-json/custom-data/index.js +1 -1
  168. package/build/models/ui/customer-review-list/index.d.ts +8 -0
  169. package/build/models/ui/customer-review-list/index.js +1 -1
  170. package/build/models/ui/product-list/index.d.ts +17 -0
  171. package/build/models/ui/product-list/index.js +1 -1
  172. package/build/models/ui/validator/form/login.d.ts +20 -6
  173. package/build/models/ui/validator/form/login.js +1 -1
  174. package/build/models/ui/validator/form/register.d.ts +15 -6
  175. package/build/models/ui/validator/form/register.js +1 -1
  176. package/build/pages/checkout.js +1 -1
  177. package/build/store/cart/api.d.ts +3 -1
  178. package/build/store/cart/api.js +1 -1
  179. package/build/store/cart/index.d.ts +25 -1
  180. package/build/store/cart/index.js +1 -1
  181. package/build/store/checkout/index.d.ts +4 -1
  182. package/build/store/checkout/index.js +1 -1
  183. package/build/store/customer/api.d.ts +16 -3
  184. package/build/store/customer/api.js +1 -1
  185. package/build/store/customer/index.d.ts +40 -5
  186. package/build/store/customer/index.js +1 -1
  187. package/build/store/index.d.ts +1 -0
  188. package/build/store/product/index.d.ts +2 -1
  189. package/build/store/product/index.js +1 -1
  190. package/build/utils/helper.d.ts +1 -0
  191. package/build/utils/helper.js +1 -1
  192. package/package.json +14 -12
  193. package/build/components/popup/index.js +0 -1
  194. package/build/components/popup/renderer/index.js +0 -1
  195. package/build/components/popup/renderer/model.js +0 -1
  196. package/build/components/popup/utils/index.js +0 -1
  197. package/build/store/storefront-popup/index.js +0 -1
@@ -1,4 +1,4 @@
1
- import { IkasProduct, IkasOrderLineItem, IkasCategory, IkasThemeJsonPageType, IkasOrderTransaction, IkasBrand, IkasCustomer, IkasCheckout, IkasContactForm, IkasStorefrontPopup } from "../models";
1
+ import { IkasProduct, IkasOrderLineItem, IkasCategory, IkasThemeJsonPageType, IkasOrderTransaction, IkasBrand, IkasCustomer, IkasCheckout, IkasContactForm, IkasStorefrontPopup, IkasCheckoutSettings } from "../models";
2
2
  import { CheckoutStep } from "../components/checkout/model";
3
3
  import { IkasCart } from "../models/data/cart";
4
4
  import { IkasEventSubscriber } from "./events";
@@ -23,11 +23,11 @@ export declare class Analytics {
23
23
  static removeFromCart(item: IkasProduct | IkasOrderLineItem, quantity: number, cart: IkasCart): void;
24
24
  static beginCheckout(checkout: IkasCheckout): void;
25
25
  static purchase(checkout: IkasCheckout, transaction: IkasOrderTransaction): void;
26
- static checkoutStep(checkout: IkasCheckout, step: CheckoutStep): void;
26
+ static checkoutStep(checkout: IkasCheckout, step: CheckoutStep, checkoutSettings?: IkasCheckoutSettings): void;
27
27
  static disableHTML(): void;
28
28
  static addToWishlist(productId: string, isRemove?: boolean): void;
29
29
  static search(searchKeyword: string, resultCount?: number): void;
30
- static completeRegistration(customer: IkasCustomer): void;
30
+ static completeRegistration(customer: IkasCustomer, isOnlyIkasEvent?: boolean): void;
31
31
  static createEmailSubscripition(email: string): void;
32
32
  static customerLogin(): Promise<void>;
33
33
  static customerLogout(): Promise<void>;
@@ -39,4 +39,7 @@ export declare class Analytics {
39
39
  static viewSearchResults(searchKeyword: string, productDetails: IkasProduct[]): void;
40
40
  static viewListing(productDetails: IkasProduct[]): void;
41
41
  static contactForm(form: IkasContactForm): void;
42
+ static addCouponCode(cart: IkasCart): void;
43
+ static removeCouponCode(cart: IkasCart): void;
44
+ static removeLoyaltyPoints(cart: IkasCart): void;
42
45
  }
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import{IkasBrand as i}from"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as s}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as a}from"../models/data/category/index.js";import{IkasCheckout as n}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as c}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import{IkasStorefrontPopup as d}from"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{FacebookPixel as m}from"./facebookPixel.js";import{GoogleTagManager as u}from"./googleTagManager.js";import{IkasEventType as l}from"./events.js";import p from"lodash/cloneDeep";import{tryForEach as f}from"../utils/helper.js";import b from"./ikasV3.js";import{GoogleAnalytics as g}from"./googleAnalytics.js";import{TiktokPixel as h}from"./tiktokPixel.js";import{IkasBaseStore as j}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var v=function(){function v(){o(this)}return v.getCustomerInfo=function(){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,(t=j.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),(o=t.customerStore.customer)?[2,r(r({},o.basicInfo),{consentGranted:t.customerStore.customerConsentGranted})]:[2,null]}}))}))},v.pageView=function(r){return t(this,void 0,void 0,(function(){var t,o,i,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=window.location.href,[4,v.getCustomerInfo()];case 1:return o=e.sent(),i=Date.now().toString(),u.pageView(t),m.pageView(t,i),b.pageView(r,i),h.pageView(t),f(v.subscribers,(function(e){e.callback({type:l.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,3];case 2:return s=e.sent(),console.error(s),[3,3];case 3:return[2]}}))}))},v.productView=function(r){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){try{t=Date.now().toString(),m.productView(r,t),u.productView(r),b.productView(r,t),g.productView(r),h.productView(r),v.subscribers.length&&(o=new c(p(r)),f(v.subscribers,(function(t){t.callback({type:l.PRODUCT_VIEW,data:{productDetail:o}})})))}catch(t){console.error(t)}return[2]}))}))},v.addToCart=function(t,e,r,o,i){try{if(m.addToCart(t,e,r),u.addToCart(t,e,i),b.addToCart(t,e,o,r),g.addToCart(t,e),h.addToCart(t,e),v.subscribers.length){var a=p(t),n=new s(p(o));f(v.subscribers,(function(t){t.callback({type:l.ADD_TO_CART,data:{item:a,quantity:e,cart:n}})}))}}catch(t){console.error(t)}},v.removeFromCart=function(t,e,r){try{if(u.removeFromCart(t,e),g.removeFromCart(t,e),v.subscribers.length){var o=p(t),i=new s(p(r));f(v.subscribers,(function(t){t.callback({type:l.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:i}})}))}}catch(t){console.error(t)}},v.beginCheckout=function(t){try{var e=localStorage.getItem("gtmBeginCheckout");if(e&&t.id===e)return;localStorage.setItem("gtmBeginCheckout",t.id);var r=Date.now().toString();if(m.beginCheckout(t,r),u.beginCheckout(t),b.beginCheckout(t,r),g.beginCheckout(t),h.beginCheckout(t),v.subscribers.length){var o=new n(p(t));f(v.subscribers,(function(t){t.callback({type:l.BEGIN_CHECKOUT,data:{checkout:o}})}))}}catch(t){console.error(t)}},v.purchase=function(t,e){try{if(localStorage.removeItem("gtmBeginCheckout"),m.purchase(t,e.id||""),u.purchase(t,t.orderNumber||""),b.orderSuccess(t,e.id||""),g.purchase(t,t.orderNumber||""),h.purchase(t),v.subscribers.length){var r=new n(p(t)),o=p(e);f(v.subscribers,(function(t){t.callback({type:l.COMPLETE_CHECKOUT,data:{checkout:r,transaction:o}})}))}}catch(t){console.error(t)}},v.checkoutStep=function(t,e){try{if(u.checkoutStep(t,e),b.checkoutStep(t,e),g.checkoutStep(t,e),v.subscribers.length){var r=new n(p(t));f(v.subscribers,(function(t){t.callback({type:l.CHECKOUT_STEP,data:{checkout:r,step:e}})}))}}catch(t){console.error(t)}},v.disableHTML=function(){try{u.disableHTML()}catch(t){console.error(t)}},v.addToWishlist=function(t,e){try{var r=Date.now().toString();m.addToWishlist(t,r),h.addToWishlist(t),b.addToWishlist(t,r),v.subscribers.length&&f(v.subscribers,(function(r){r.callback({type:e?l.REMOVE_FROM_WISHLIST:l.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},v.search=function(t,e){try{var r=Date.now().toString();m.search(t,r),u.search(t),h.search(t),g.search(t),b.search(t,r,e),v.subscribers.length&&f(v.subscribers,(function(e){e.callback({type:l.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},v.completeRegistration=function(t){try{var e=Date.now().toString();m.completeRegistration(e),u.completeRegistration(t),h.completeRegistration(),b.customerRegister(e),v.subscribers.length&&f(v.subscribers,(function(e){e.callback({type:l.CUSTOMER_REGISTER,data:{email:t.email,firstName:t.firstName,lastName:t.lastName,notificationsAccepted:t.subscriptionStatus}})}))}catch(t){console.error(t)}},v.createEmailSubscripition=function(t){try{v.subscribers.length&&f(v.subscribers,(function(e){e.callback({type:l.EMAIL_SUBSCRIPTION,data:{email:t}})}))}catch(t){console.error(t)}},v.customerLogin=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,v.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(u.customerLogin(t),b.customerLogin(),v.subscribers.length&&f(v.subscribers,(function(e){e.callback({type:l.CUSTOMER_LOGIN,data:{customer:t}})})),[3,3]):[2];case 2:return r=e.sent(),console.error(r),[3,3];case 3:return[2]}}))}))},v.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{u.customerLogout(),v.subscribers.length&&f(v.subscribers,(function(t){t.callback({type:l.CUSTOMER_LOGOUT,data:{}})}))}catch(t){console.error(t)}return[2]}))}))},v.customerVisit=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,v.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(u.customerVisit(t),b.customerVisit(),v.subscribers.length&&f(v.subscribers,(function(e){e.callback({type:l.CUSTOMER_VISIT,data:{customer:t}})})),[3,3]):[2];case 2:return r=e.sent(),console.error(r),[3,3];case 3:return[2]}}))}))},v.viewCart=function(t){try{if(t){var e=Date.now().toString();if(m.viewCart(t,e),b.viewCart(t,e),g.viewCart(t),u.viewCart(t),v.subscribers.length){var r=new s(p(t));f(v.subscribers,(function(t){t.callback({type:l.VIEW_CART,data:{cart:r}})}))}}}catch(t){console.error(t)}},v.viewCategory=function(t,e){try{var r=Date.now().toString();if(m.viewCategory(t,r),u.viewCategory(e,t),b.viewCategory(e,t,r),h.viewCategory(e),v.subscribers.length){var o=new a(p(e));f(v.subscribers,(function(e){e.callback({type:l.VIEW_CATEGORY,data:{categoryPath:t,category:o}})}))}}catch(t){console.error(t)}},v.viewBrand=function(t){try{if(b.viewBrand(t),v.subscribers.length){var e=new i(p(t));f(v.subscribers,(function(t){t.callback({type:l.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},v.viewStorefrontPopup=function(t){try{if(b.viewPopup(t.id),v.subscribers.length){var e=new d(p(t));f(v.subscribers,(function(t){t.callback({type:l.POPUP_VIEW,data:{popup:e}})}))}}catch(t){console.error(t)}},v.viewSearchResults=function(t,e){try{if(v.subscribers.length){var r=p(e).map((function(t){return new c(t)}));f(v.subscribers,(function(e){e.callback({type:l.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},v.viewListing=function(t){try{if(v.subscribers.length){var e=p(t).map((function(t){return new c(t)}));f(v.subscribers,(function(t){t.callback({type:l.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},v.contactForm=function(t){try{var e=Date.now().toString();if(m.contactForm(e),h.contactForm(),b.contactForm(e),v.subscribers.length){var r=p(t);f(v.subscribers,(function(t){t.callback({type:l.CONTACT_FORM,data:{form:r}})}))}}catch(t){console.error(t)}},v.subscribers=[],v}();export{v as Analytics};
1
+ import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import{IkasBrand as s}from"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as i}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as a}from"../models/data/category/index.js";import{IkasCheckout as n}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as c}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import{IkasStorefrontPopup as d}from"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{FacebookPixel as m}from"./facebookPixel.js";import{GoogleTagManager as u}from"./googleTagManager.js";import{IkasEventType as l}from"./events.js";import p from"lodash/cloneDeep";import{tryForEach as b}from"../utils/helper.js";import f from"./ikasV3.js";import{GoogleAnalytics as h}from"./googleAnalytics.js";import{TiktokPixel as g}from"./tiktokPixel.js";import{IkasBaseStore as j}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var v=function(){function v(){o(this)}return v.getCustomerInfo=function(){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,(t=j.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),(o=t.customerStore.customer)?[2,r(r({},o.basicInfo),{consentGranted:t.customerStore.customerConsentGranted})]:[2,null]}}))}))},v.pageView=function(r){return t(this,void 0,void 0,(function(){var t,o,s,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),[4,f.checkJourneyId()];case 1:return e.sent(),t=window.location.href,[4,v.getCustomerInfo()];case 2:return o=e.sent(),s=Date.now().toString(),u.pageView(t),m.pageView(t,s),[4,f.pageView(r,s)];case 3:return e.sent(),g.pageView(t),b(v.subscribers,(function(e){e.callback({type:l.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,5];case 4:return i=e.sent(),console.error(i),[3,5];case 5:return[2]}}))}))},v.productView=function(r){return t(this,void 0,void 0,(function(){var t,o,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=Date.now().toString(),m.productView(r,t),u.productView(r),[4,f.productView(r,t)];case 1:return e.sent(),h.productView(r),g.productView(r),v.subscribers.length&&(o=new c(p(r)),b(v.subscribers,(function(t){t.callback({type:l.PRODUCT_VIEW,data:{productDetail:o}})}))),[3,3];case 2:return s=e.sent(),console.error(s),[3,3];case 3:return[2]}}))}))},v.addToCart=function(t,e,r,o,s){try{if(m.addToCart(t,e,r),u.addToCart(t,e,s),f.addToCart(t,e,o,r),h.addToCart(t,e),g.addToCart(t,e),v.subscribers.length){var a=p(t),n=new i(p(o));b(v.subscribers,(function(t){t.callback({type:l.ADD_TO_CART,data:{item:a,quantity:e,cart:n}})}))}}catch(t){console.error(t)}},v.removeFromCart=function(t,e,r){try{if(u.removeFromCart(t,e),h.removeFromCart(t,e),v.subscribers.length){var o=p(t),s=new i(p(r));b(v.subscribers,(function(t){t.callback({type:l.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:s}})}))}}catch(t){console.error(t)}},v.beginCheckout=function(t){try{var e=localStorage.getItem("gtmBeginCheckout");if(e&&t.id===e)return;localStorage.setItem("gtmBeginCheckout",t.id);var r=Date.now().toString();if(m.beginCheckout(t,r),u.beginCheckout(t),f.beginCheckout(t,r),h.beginCheckout(t),g.beginCheckout(t),v.subscribers.length){var o=new n(p(t));b(v.subscribers,(function(t){t.callback({type:l.BEGIN_CHECKOUT,data:{checkout:o}})}))}}catch(t){console.error(t)}},v.purchase=function(t,e){try{if(localStorage.removeItem("gtmBeginCheckout"),m.purchase(t,e.id||""),u.purchase(t,t.orderNumber||""),f.orderSuccess(t,e.id||""),h.purchase(t,t.orderNumber||""),g.purchase(t),v.subscribers.length){var r=new n(p(t)),o=p(e);b(v.subscribers,(function(t){t.callback({type:l.COMPLETE_CHECKOUT,data:{checkout:r,transaction:o}})}))}}catch(t){console.error(t)}},v.checkoutStep=function(t,e,r){try{if(u.checkoutStep(t,e,r),f.checkoutStep(t,e),h.checkoutStep(t,e,r),v.subscribers.length){var o=new n(p(t));b(v.subscribers,(function(t){t.callback({type:l.CHECKOUT_STEP,data:{checkout:o,step:e}})}))}}catch(t){console.error(t)}},v.disableHTML=function(){try{u.disableHTML()}catch(t){console.error(t)}},v.addToWishlist=function(t,e){try{var r=Date.now().toString();m.addToWishlist(t,r),g.addToWishlist(t),f.addToWishlist(t,r),v.subscribers.length&&b(v.subscribers,(function(r){r.callback({type:e?l.REMOVE_FROM_WISHLIST:l.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},v.search=function(t,e){try{var r=Date.now().toString();m.search(t,r),u.search(t),g.search(t),h.search(t),f.search(t,r,e),v.subscribers.length&&b(v.subscribers,(function(e){e.callback({type:l.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},v.completeRegistration=function(t,e){try{var o=Date.now().toString();e||(m.completeRegistration(o),u.completeRegistration(t),g.completeRegistration()),f.customerRegister(o),v.subscribers.length&&b(v.subscribers,(function(o){o.callback({type:l.CUSTOMER_REGISTER,data:r({email:t.email,firstName:t.firstName,lastName:t.lastName,notificationsAccepted:t.subscriptionStatus},e?{attributes:t.attributes}:{})})}))}catch(t){console.error(t)}},v.createEmailSubscripition=function(t){try{v.subscribers.length&&b(v.subscribers,(function(e){e.callback({type:l.EMAIL_SUBSCRIPTION,data:{email:t}})}))}catch(t){console.error(t)}},v.customerLogin=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,v.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(u.customerLogin(t),[4,f.customerLogin()]):[2];case 2:return e.sent(),v.subscribers.length&&b(v.subscribers,(function(e){e.callback({type:l.CUSTOMER_LOGIN,data:{customer:t}})})),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},v.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{u.customerLogout(),v.subscribers.length&&b(v.subscribers,(function(t){t.callback({type:l.CUSTOMER_LOGOUT,data:{}})}))}catch(t){console.error(t)}return[2]}))}))},v.customerVisit=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,v.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(u.customerVisit(t),[4,f.customerVisit()]):[2];case 2:return e.sent(),v.subscribers.length&&b(v.subscribers,(function(e){e.callback({type:l.CUSTOMER_VISIT,data:{customer:t}})})),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},v.viewCart=function(t){try{if(t){var e=Date.now().toString();if(m.viewCart(t,e),f.viewCart(t,e),h.viewCart(t),u.viewCart(t),v.subscribers.length){var r=new i(p(t));b(v.subscribers,(function(t){t.callback({type:l.VIEW_CART,data:{cart:r}})}))}}}catch(t){console.error(t)}},v.viewCategory=function(t,e){try{var r=Date.now().toString();if(m.viewCategory(t,r),u.viewCategory(e,t),f.viewCategory(e,t,r),g.viewCategory(e),v.subscribers.length){var o=new a(p(e));b(v.subscribers,(function(e){e.callback({type:l.VIEW_CATEGORY,data:{categoryPath:t,category:o}})}))}}catch(t){console.error(t)}},v.viewBrand=function(t){try{if(f.viewBrand(t),v.subscribers.length){var e=new s(p(t));b(v.subscribers,(function(t){t.callback({type:l.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},v.viewStorefrontPopup=function(t){try{if(f.viewPopup(t.id),v.subscribers.length){var e=new d(p(t));b(v.subscribers,(function(t){t.callback({type:l.POPUP_VIEW,data:{popup:e}})}))}}catch(t){console.error(t)}},v.viewSearchResults=function(t,e){try{if(v.subscribers.length){var r=p(e).map((function(t){return new c(t)}));b(v.subscribers,(function(e){e.callback({type:l.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},v.viewListing=function(t){try{if(v.subscribers.length){var e=p(t).map((function(t){return new c(t)}));b(v.subscribers,(function(t){t.callback({type:l.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},v.contactForm=function(t){try{var e=Date.now().toString();if(m.contactForm(e),g.contactForm(),f.contactForm(e),v.subscribers.length){var r=p(t);b(v.subscribers,(function(t){t.callback({type:l.CONTACT_FORM,data:{form:r}})}))}}catch(t){console.error(t)}},v.addCouponCode=function(t){try{if(t&&v.subscribers.length){var e=new i(p(t));b(v.subscribers,(function(t){t.callback({type:l.ADD_COUPON_CODE,data:{cart:e}})}))}}catch(t){console.error(t)}},v.removeCouponCode=function(t){try{if(t&&v.subscribers.length){var e=new i(p(t));b(v.subscribers,(function(t){t.callback({type:l.REMOVE_COUPON_CODE,data:{cart:e}})}))}}catch(t){console.error(t)}},v.removeLoyaltyPoints=function(t){try{if(t&&v.subscribers.length){var e=new i(p(t));b(v.subscribers,(function(t){t.callback({type:l.REMOVE_LOYALTY_POINTS,data:{cart:e}})}))}}catch(t){console.error(t)}},v.subscribers=[],v}();export{v as Analytics};
@@ -27,7 +27,10 @@ export declare enum IkasEventType {
27
27
  VIEW_LISTING = "VIEW_LISTING",
28
28
  CONTACT_FORM = "CONTACT_FORM",
29
29
  EMAIL_SUBSCRIPTION = "EMAIL_SUBSCRIPTION",
30
- POPUP_VIEW = "POPUP_VIEW"
30
+ POPUP_VIEW = "POPUP_VIEW",
31
+ ADD_COUPON_CODE = "ADD_COUPON_CODE",
32
+ REMOVE_COUPON_CODE = "REMOVE_COUPON_CODE",
33
+ REMOVE_LOYALTY_POINTS = "REMOVE_LOYALTY_POINTS"
31
34
  }
32
35
  export declare type IkasEventSubscriber = {
33
36
  id: string;
@@ -1 +1 @@
1
- import{Analytics as E}from"./analytics.js";function s(s){var r=function(s){if(T(s)){var r=E.subscribers.findIndex((function(E){return E.id===s.id}));-1!==r?E.subscribers[r]=s:E.subscribers.push(s)}};return s.forEach(r),{subscribe:r,unsubscribe:function(s){var r=E.subscribers.findIndex((function(E){return E.id===s}));-1!==r&&E.subscribers.splice(r,1)}}}function r(){if("undefined"!=typeof window){var E=[];try{var r=window.IkasEvents;r&&r.subscribers&&r.subscribers.length&&(E=r.subscribers)}catch(E){}window.IkasEvents=s(E)}}function n(){return"<script>\n var subscribers = [];\n var subscribe = (subscriber) => { subscribers.push(subscriber); }; \n var unsubscribe = () => {};\n \n window.IkasEvents = {\n subscribers,\n subscribe,\n unsubscribe\n };\n <\/script>"}function T(E){return!!(E&&E.id&&"string"==typeof E.id&&E.callback&&"function"==typeof E.callback)}var _;!function(E){E.PAGE_VIEW="PAGE_VIEW",E.PRODUCT_VIEW="PRODUCT_VIEW",E.ADD_TO_CART="ADD_TO_CART",E.REMOVE_FROM_CART="REMOVE_FROM_CART",E.BEGIN_CHECKOUT="BEGIN_CHECKOUT",E.CHECKOUT_STEP="CHECKOUT_STEP",E.COMPLETE_CHECKOUT="COMPLETE_CHECKOUT",E.ADD_TO_WISHLIST="ADD_TO_WISHLIST",E.REMOVE_FROM_WISHLIST="REMOVE_FROM_WISHLIST",E.SEARCH="SEARCH",E.CUSTOMER_REGISTER="CUSTOMER_REGISTER",E.CUSTOMER_LOGIN="CUSTOMER_LOGIN",E.CUSTOMER_LOGOUT="CUSTOMER_LOGOUT",E.CUSTOMER_VISIT="CUSTOMER_VISIT",E.VIEW_CART="VIEW_CART",E.VIEW_CATEGORY="VIEW_CATEGORY",E.VIEW_BRAND="VIEW_BRAND",E.VIEW_SEARCH_RESULTS="VIEW_SEARCH_RESULTS",E.VIEW_LISTING="VIEW_LISTING",E.CONTACT_FORM="CONTACT_FORM",E.EMAIL_SUBSCRIPTION="EMAIL_SUBSCRIPTION",E.POPUP_VIEW="POPUP_VIEW"}(_||(_={}));export{_ as IkasEventType,s as IkasEvents,n as getIkasEventsScript,r as initIkasEvents,T as isValidIkasEventSubscriber};
1
+ import{Analytics as E}from"./analytics.js";function O(O){var _=function(O){if(r(O)){var _=E.subscribers.findIndex((function(E){return E.id===O.id}));-1!==_?E.subscribers[_]=O:E.subscribers.push(O)}};return O.forEach(_),{subscribe:_,unsubscribe:function(O){var _=E.subscribers.findIndex((function(E){return E.id===O}));-1!==_&&E.subscribers.splice(_,1)}}}function _(){if("undefined"!=typeof window){var E=[];try{var _=window.IkasEvents;_&&_.subscribers&&_.subscribers.length&&(E=_.subscribers)}catch(E){}window.IkasEvents=O(E)}}function s(){return"<script>\n var subscribers = [];\n var subscribe = (subscriber) => { subscribers.push(subscriber); }; \n var unsubscribe = () => {};\n \n window.IkasEvents = {\n subscribers,\n subscribe,\n unsubscribe\n };\n <\/script>"}function r(E){return!!(E&&E.id&&"string"==typeof E.id&&E.callback&&"function"==typeof E.callback)}var T;!function(E){E.PAGE_VIEW="PAGE_VIEW",E.PRODUCT_VIEW="PRODUCT_VIEW",E.ADD_TO_CART="ADD_TO_CART",E.REMOVE_FROM_CART="REMOVE_FROM_CART",E.BEGIN_CHECKOUT="BEGIN_CHECKOUT",E.CHECKOUT_STEP="CHECKOUT_STEP",E.COMPLETE_CHECKOUT="COMPLETE_CHECKOUT",E.ADD_TO_WISHLIST="ADD_TO_WISHLIST",E.REMOVE_FROM_WISHLIST="REMOVE_FROM_WISHLIST",E.SEARCH="SEARCH",E.CUSTOMER_REGISTER="CUSTOMER_REGISTER",E.CUSTOMER_LOGIN="CUSTOMER_LOGIN",E.CUSTOMER_LOGOUT="CUSTOMER_LOGOUT",E.CUSTOMER_VISIT="CUSTOMER_VISIT",E.VIEW_CART="VIEW_CART",E.VIEW_CATEGORY="VIEW_CATEGORY",E.VIEW_BRAND="VIEW_BRAND",E.VIEW_SEARCH_RESULTS="VIEW_SEARCH_RESULTS",E.VIEW_LISTING="VIEW_LISTING",E.CONTACT_FORM="CONTACT_FORM",E.EMAIL_SUBSCRIPTION="EMAIL_SUBSCRIPTION",E.POPUP_VIEW="POPUP_VIEW",E.ADD_COUPON_CODE="ADD_COUPON_CODE",E.REMOVE_COUPON_CODE="REMOVE_COUPON_CODE",E.REMOVE_LOYALTY_POINTS="REMOVE_LOYALTY_POINTS"}(T||(T={}));export{T as IkasEventType,O as IkasEvents,s as getIkasEventsScript,_ as initIkasEvents,r as isValidIkasEventSubscriber};
@@ -1,4 +1,4 @@
1
- import { IkasCheckout, IkasProduct, IkasOrderLineItem } from "../models";
1
+ import { IkasCheckout, IkasProduct, IkasOrderLineItem, IkasCheckoutSettings } from "../models";
2
2
  import { IkasCart } from "../models/data/cart";
3
3
  import { CheckoutStep } from "../components/checkout/model";
4
4
  export declare class GoogleAnalytics {
@@ -9,6 +9,6 @@ export declare class GoogleAnalytics {
9
9
  static viewCart(cart: IkasCart): void;
10
10
  static beginCheckout(checkout: IkasCheckout): void;
11
11
  static purchase(checkout: IkasCheckout, orderId: string): void;
12
- static checkoutStep(checkout: IkasCheckout, step: CheckoutStep): void;
12
+ static checkoutStep(checkout: IkasCheckout, step: CheckoutStep, checkoutSettings?: IkasCheckoutSettings): void;
13
13
  static search(searchKeyword: string): void;
14
14
  }
@@ -1 +1 @@
1
- import{makeAutoObservable as e}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as t}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as i}from"../components/checkout/model.js";var o="undefined"==typeof window,r=function(){function r(){e(this)}return r.productView=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_item",{currency:""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency,value:e.selectedVariant.price.finalPrice,items:[a(e)]}))}catch(e){console.error(e)}},r.addToCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","add_to_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.finalPrice*i:e.finalPrice?e.finalPrice*i:null,items:[e instanceof t?a(e,i):d(e,i)]}))}catch(e){console.error(e)}},r.removeFromCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","remove_from_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.price.finalPrice:e.finalPrice,items:[e instanceof t?a(e,i):d(e,i)]}))}catch(e){console.error(e)}},r.viewCart=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_cart",{currency:e.currencyCode,value:e.totalPrice,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.beginCheckout=function(e){try{return void(!o&&window.gtag&&window.gtag("event","begin_checkout",{currency:e.currencyCode,value:e.totalFinalPrice,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.purchase=function(e,t){try{return void(!o&&window.gtag&&window.gtag("event","purchase",{transaction_id:t,affiliation:window.location.hostname,value:e.totalFinalPrice,tax:e.totalTax,shipping:e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.checkoutStep=function(e,t){var r;if(t===i.SHIPPING)try{return void(!o&&window.gtag&&window.gtag("event","add_shipping_info",{currency:e.currencyCode,value:e.totalFinalPrice,shipping_tier:"Ground",coupon:e.couponCode,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}if(t===i.PAYMENT)try{return void(!o&&window.gtag&&window.gtag("event","add_payment_info",{currency:e.currencyCode,value:e.totalFinalPrice,coupon:e.couponCode,payment_type:null===(r=e.selectedPaymentGateway)||void 0===r?void 0:r.paymentMethodType,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.search=function(e){try{return void(!o&&window.gtag&&window.gtag("event","search",{search_term:e}))}catch(e){console.error(e)}},r}();function a(e,t){var i;void 0===t&&(t=1);var o=[],r=e.categories;return r&&r.length&&(r[0].categoryPath&&r[0].categoryPath.map((function(e){return o.push(e)})),o.push(r[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(i=e.brand)||void 0===i?void 0:i.name)||"",item_category:o.length?o[0]:"",item_category2:o.length>1?o[1]:"",item_category3:o.length>2?o[2]:"",item_category4:o.length>3?o.slice(3,o.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function d(e,t){var i,o;void 0===t&&(t=1);var r=[],a=e.variant.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e.name)})),r.push(a[0].name)),{item_name:e.variant.name,item_id:e.variant.id,price:e.finalPrice||"",item_brand:(null===(i=e.variant.brand)||void 0===i?void 0:i.name)||"",item_category:r.length?r[0]:"",item_category2:r.length>1?r[1]:"",item_category3:r.length>2?r[2]:"",item_category4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:null===(o=e.variant.variantValues)||void 0===o?void 0:o.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}export{r as GoogleAnalytics};
1
+ import{makeAutoObservable as e}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as t}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as i}from"../components/checkout/model.js";var o="undefined"==typeof window,r=function(){function r(){e(this)}return r.productView=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_item",{currency:""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency,value:e.selectedVariant.price.finalPrice,items:[a(e)]}))}catch(e){console.error(e)}},r.addToCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","add_to_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.finalPrice*i:e.finalPrice?e.finalPrice*i:null,items:[e instanceof t?a(e,i):d(e,i)]}))}catch(e){console.error(e)}},r.removeFromCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","remove_from_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.price.finalPrice:e.finalPrice,items:[e instanceof t?a(e,i):d(e,i)]}))}catch(e){console.error(e)}},r.viewCart=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_cart",{currency:e.currencyCode,value:e.totalPrice,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.beginCheckout=function(e){try{return void(!o&&window.gtag&&window.gtag("event","begin_checkout",{currency:e.currencyCode,value:e.totalFinalPrice,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.purchase=function(e,t){try{return void(!o&&window.gtag&&window.gtag("event","purchase",{transaction_id:t,affiliation:window.location.hostname,value:e.totalFinalPrice,tax:e.totalTax,shipping:e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return d(e,e.quantity)}))}))}catch(e){console.error(e)}},r.checkoutStep=function(e,t,r){var a,n,s;if(t===i.SHIPPING&&1!==(null===(a=e.availableShippingMethods)||void 0===a?void 0:a.length)||1===(null===(n=e.availableShippingMethods)||void 0===n?void 0:n.length)&&t===i.PAYMENT)try{!o&&window.gtag&&window.gtag("event","add_shipping_info",{currency:e.currencyCode,value:e.totalFinalPrice,shipping_tier:"Ground",coupon:e.couponCode,items:e.items.map((function(e){return d(e,e.quantity)}))})}catch(e){console.error(e)}if(t===i.PAYMENT)try{!o&&window.gtag&&window.gtag("event","add_payment_info",{currency:e.currencyCode,value:e.totalFinalPrice,coupon:e.couponCode,payment_type:null===(s=e.selectedPaymentGateway)||void 0===s?void 0:s.paymentMethodType,items:e.items.map((function(e){return d(e,e.quantity)}))})}catch(e){console.error(e)}},r.search=function(e){try{return void(!o&&window.gtag&&window.gtag("event","search",{search_term:e}))}catch(e){console.error(e)}},r}();function a(e,t){var i;void 0===t&&(t=1);var o=[],r=e.categories;return r&&r.length&&(r[0].categoryPath&&r[0].categoryPath.map((function(e){return o.push(e)})),o.push(r[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(i=e.brand)||void 0===i?void 0:i.name)||"",item_category:o.length?o[0]:"",item_category2:o.length>1?o[1]:"",item_category3:o.length>2?o[2]:"",item_category4:o.length>3?o.slice(3,o.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function d(e,t){var i,o;void 0===t&&(t=1);var r=[],a=e.variant.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e.name)})),r.push(a[0].name)),{item_name:e.variant.name,item_id:e.variant.id,price:e.finalPrice||"",item_brand:(null===(i=e.variant.brand)||void 0===i?void 0:i.name)||"",item_category:r.length?r[0]:"",item_category2:r.length>1?r[1]:"",item_category3:r.length>2?r[2]:"",item_category4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:null===(o=e.variant.variantValues)||void 0===o?void 0:o.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}export{r as GoogleAnalytics};
@@ -1,4 +1,4 @@
1
- import { IkasCheckout, IkasProduct, IkasOrderLineItem, IkasCategory, IkasCart, IkasCustomer } from "../models";
1
+ import { IkasCheckout, IkasProduct, IkasOrderLineItem, IkasCategory, IkasCart, IkasCustomer, IkasCheckoutSettings } from "../models";
2
2
  import { CheckoutStep } from "../components/checkout/model";
3
3
  export declare class GoogleTagManager {
4
4
  constructor();
@@ -123,10 +123,11 @@ export declare class GoogleTagManager {
123
123
  item_id: string | null;
124
124
  price: string | number;
125
125
  }[];
126
+ customer: import("..").IkasOrderCustomer | null;
126
127
  };
127
128
  };
128
129
  } | undefined;
129
- static checkoutStep(checkout: IkasCheckout, step: CheckoutStep): {
130
+ static checkoutStep(checkout: IkasCheckout, step: CheckoutStep, checkoutSettings?: IkasCheckoutSettings): {
130
131
  event: string;
131
132
  ecommerce: {
132
133
  cart: Partial<IkasCheckout>;
@@ -1 +1 @@
1
- import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as o}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as a}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"@ikas/storefront-config";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",sellPrice:e.selectedVariant.sellPrice,discountPrice:e.selectedVariant.discountPrice||0}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)}))}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t){var o,a,d=i(e);null===(o=d.shippingAddress)||void 0===o||delete o.checkoutSettings,null===(a=d.billingAddress)||void 0===a||delete a.checkoutSettings;var n="";t===r.INFO?n="checkout_info-GTM":t===r.SHIPPING?n="checkout_shipping-GTM":t===r.PAYMENT?n="checkout_payment-GTM":t===r.SUCCESS&&(n="checkout_success-GTM");try{var m={event:n,ecommerce:{cart:d}};return!s&&window.dataLayer&&window.dataLayer.push(m),m}catch(e){console.error(e)}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
1
+ import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as o}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"@ikas/storefront-config";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import{IkasBaseStore as a}from"../store/base.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",sellPrice:e.selectedVariant.sellPrice,discountPrice:e.selectedVariant.discountPrice||0}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)})),customer:e.customer}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t,o){var a,d,n;if(!(o&&t===r.INFO&&o.isAccountRequired&&(null===(a=e.customer)||void 0===a?void 0:a.isGuestCheckout))){var m=i(e);null===(d=m.shippingAddress)||void 0===d||delete d.checkoutSettings,null===(n=m.billingAddress)||void 0===n||delete n.checkoutSettings;var c="";t===r.INFO?c="checkout_info-GTM":t===r.SHIPPING?c="checkout_shipping-GTM":t===r.PAYMENT?c="checkout_payment-GTM":t===r.SUCCESS&&(c="checkout_success-GTM");try{var p={event:c,ecommerce:{cart:m}};return!s&&window.dataLayer&&window.dataLayer.push(p),p}catch(e){console.error(e)}}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
@@ -91,6 +91,7 @@ interface ProductDetail {
91
91
  id: string;
92
92
  vid?: string;
93
93
  cp?: string[];
94
+ cid?: string[];
94
95
  n?: string;
95
96
  pr?: number;
96
97
  c?: string;
@@ -124,13 +125,18 @@ interface CustomerDetail {
124
125
  export default class IkasAnalytics {
125
126
  static SESSION_ID_KEY: string;
126
127
  static VISITOR_ID_KEY: string;
128
+ static JOURNEY_ID_KEY: string;
127
129
  static EXPIRY_LENGTH: number;
128
130
  static sessionId?: string | null;
129
131
  static visitorId?: string | null;
132
+ static journeyId?: string | null;
130
133
  static createUUID(): Promise<string>;
131
134
  static createSessionId(): Promise<void>;
135
+ static createJourneyId(): Promise<void>;
132
136
  static checkSessionId(): Promise<void>;
137
+ static checkJourneyId(): Promise<void>;
133
138
  static checkVisitorId(): Promise<void>;
139
+ static refreshJourneyId(): void;
134
140
  static getPageType(pageType: IkasThemeJsonPageType): StorefrontEventPageType | undefined;
135
141
  static getCustomerData(): {
136
142
  id: string | undefined;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as s}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{getCookieValue as n}from"../utils/helper.js";var a,d;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(a||(a={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT",t[t.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));var c=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",u=function(){function u(){}return u.createUUID=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/generate-id/1"))];case 1:return[4,t.sent().json()];case 2:return[2,t.sent().data[0]]}}))}))},u.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),i={},[4,this.createUUID()];case 1:return i.id=e.sent(),i.expiry=Date.now()+this.EXPIRY_LENGTH,t=i,localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(t)),this.sessionId=t.id,[4,this.sessionStart()];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},u.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(r=JSON.parse(t)).expiry<Date.now()||r.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=r.id,e.label=3;case 3:return[3,6];case 4:return[4,this.createSessionId()];case 5:e.sent(),e.label=6;case 6:return i.init({sessionId:this.sessionId||""}),[3,8];case 7:return s=e.sent(),console.error(s),[3,8];case 8:return[2]}}))}))},u.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.VISITOR_ID_KEY))&&t.length>13?(this.visitorId=t,[3,3]):[3,1];case 1:return r=this,[4,this.createUUID()];case 2:r.visitorId=e.sent(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId),e.label=3;case 3:return i.init({visitorId:this.visitorId}),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},u.getPageType=function(t){switch(t){case o.INDEX:return d.INDEX;case o.CATEGORY:return d.CATEGORY;case o.BRAND:return d.BRAND;case o.PRODUCT:return d.PRODUCT;case o.CUSTOM:return d.CUSTOM;case o.ACCOUNT:return d.ACCOUNT;case o.ADDRESSES:return d.ADDRESSES;case o.ORDERS:return d.ORDERS;case o.ORDER_DETAIL:return d.ORDER_DETAIL;case o.LOGIN:return d.LOGIN;case o.REGISTER:return d.REGISTER;case o.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case o.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case o.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case o.CART:return d.CART;case o.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case o.SEARCH:return d.SEARCH;case o.NOT_FOUND:return d.NOT_FOUND;case o.BLOG:return d.BLOG;case o.BLOG_INDEX:return d.BLOG_INDEX;case o.BLOG_CATEGORY:return d.BLOG_CATEGORY;case o.CHECKOUT:return d.CHECKOUT}},u.getCustomerData=function(){var t=s.getInstance(),e=t.customerStore.customer;return{id:(null==e?void 0:e.id)||void 0,e:(null==e?void 0:e.email)||void 0,c:t.customerStore.customerConsentGranted}},u.getCommonEventData=function(){var t=s.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0,m:{fbp:n("_fbp"),fbc:n("_fbc")}}},u.getOrderLineItem=function(t){return t.orderLineItems.map((function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}))},u.getCartItem=function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})},u.sendEvents=function(o){var n,a,d,u,m,l,p,E,v;return t(this,void 0,void 0,(function(){var t,h,C;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,(t=s.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),h={e:o,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,vid:this.visitorId,sfrid:i.getStorefrontRoutingId()||"",ud:r(r(r(r({id:null===(n=t.customerStore.customer)||void 0===n?void 0:n.id},(null===(a=t.customerStore.customer)||void 0===a?void 0:a.email)?{em:null===(d=t.customerStore.customer)||void 0===d?void 0:d.email}:{}),(null===(u=t.customerStore.customer)||void 0===u?void 0:u.phone)?{ph:null===(m=t.customerStore.customer)||void 0===m?void 0:m.phone}:{}),(null===(l=t.customerStore.customer)||void 0===l?void 0:l.lastName)?{ln:null===(p=t.customerStore.customer)||void 0===p?void 0:p.lastName}:{}),(null===(E=t.customerStore.customer)||void 0===E?void 0:E.firstName)?{fn:null===(v=t.customerStore.customer)||void 0===v?void 0:v.firstName}:{}),v:3},[4,fetch(c,{method:"POST",body:JSON.stringify(h),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 4:return e.sent(),[3,6];case 5:return C=e.sent(),console.error(C),[3,6];case 6:return[2]}}))}))},u.sessionStart=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.SESSION_START,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.pageView=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.PAGE_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.productView=function(i,s){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return t=i.categories&&i.categories.length>0?i.categories[0].path.map((function(t){return t.name})):[],o={id:s,t:a.PRODUCT_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:r({id:i.id,vid:i.selectedVariant.id,cp:t,n:i.name,pr:i.selectedVariant.finalPrice},i.selectedVariant.price.currency?{c:i.selectedVariant.price.currency}:{})}})},[4,this.sendEvents([o])];case 1:return e.sent(),[2]}}))}))},u.addToCart=function(i,s,o,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:n,t:a.ADD_TO_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:o.id,c:o.currencyCode,pr:o.totalFinalPrice,il:this.getOrderLineItem(o)},crtItm:this.getCartItem(i)}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCart=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.VIEW_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.orderSuccess=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.ORDER_SUCCESS,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success",p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[4,this.createSessionId()];case 2:return e.sent(),[2]}}))}))},u.beginCheckout=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.BEGIN_CHECKOUT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.checkoutStep=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CHECKOUT_STEP,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:s,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerRegister=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CUSTOMER_REGISTER,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerLogin=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_LOGIN,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerVisit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_VISIT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewBrand=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.BRAND_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCategory=function(i,s,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:o,t:a.CATEGORY_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id,cp:s}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewPopup=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.POPUP_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()},m:{sfpid:i}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.search=function(i,s,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.SEARCH,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{src:r({s:i},o?{r:o}:{})}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.contactForm=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CONTACT_FORM,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.addToWishlist=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.FAVORITE_PRODUCT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:{id:i}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.SESSION_ID_KEY="ikas_session_id",u.VISITOR_ID_KEY="ikas_visitor_id",u.EXPIRY_LENGTH=18e5,u}();export{u as default};
1
+ import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as s}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{getCookieValue as n}from"../utils/helper.js";var a,d;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(a||(a={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT",t[t.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));var c=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",u=function(){function u(){}return u.createUUID=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))]}))}))},u.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),i={},[4,this.createUUID()];case 1:return i.id=e.sent(),i.expiry=Date.now()+this.EXPIRY_LENGTH,t=i,localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(t)),this.sessionId=t.id,[4,this.sessionStart()];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},u.createJourneyId=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.createUUID()];case 1:return t=e.sent(),localStorage.setItem(this.JOURNEY_ID_KEY,t),this.journeyId=t,[2]}}))}))},u.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(r=JSON.parse(t)).expiry<Date.now()||r.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=r.id,e.label=3;case 3:return[3,6];case 4:return[4,this.createSessionId()];case 5:e.sent(),e.label=6;case 6:return i.init({sessionId:this.sessionId||""}),[3,8];case 7:return s=e.sent(),console.error(s),[3,8];case 8:return[2]}}))}))},u.checkJourneyId=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.JOURNEY_ID_KEY))?(this.journeyId=t,[3,3]):[3,1];case 1:return[4,this.createJourneyId()];case 2:e.sent(),e.label=3;case 3:return i.init({journeyId:this.journeyId||""}),[3,5];case 4:return r=e.sent(),console.error(r),[3,5];case 5:return[2]}}))}))},u.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.VISITOR_ID_KEY))&&t.length>13?(this.visitorId=t,[3,3]):[3,1];case 1:return r=this,[4,this.createUUID()];case 2:r.visitorId=e.sent(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId),e.label=3;case 3:return i.init({visitorId:this.visitorId}),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},u.refreshJourneyId=function(){localStorage.removeItem(this.JOURNEY_ID_KEY),this.journeyId=void 0,this.checkJourneyId()},u.getPageType=function(t){switch(t){case o.INDEX:return d.INDEX;case o.CATEGORY:return d.CATEGORY;case o.BRAND:return d.BRAND;case o.PRODUCT:return d.PRODUCT;case o.CUSTOM:return d.CUSTOM;case o.ACCOUNT:return d.ACCOUNT;case o.ADDRESSES:return d.ADDRESSES;case o.ORDERS:return d.ORDERS;case o.ORDER_DETAIL:return d.ORDER_DETAIL;case o.LOGIN:return d.LOGIN;case o.REGISTER:return d.REGISTER;case o.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case o.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case o.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case o.CART:return d.CART;case o.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case o.SEARCH:return d.SEARCH;case o.NOT_FOUND:return d.NOT_FOUND;case o.BLOG:return d.BLOG;case o.BLOG_INDEX:return d.BLOG_INDEX;case o.BLOG_CATEGORY:return d.BLOG_CATEGORY;case o.CHECKOUT:return d.CHECKOUT}},u.getCustomerData=function(){var t=s.getInstance(),e=t.customerStore.customer;return{id:(null==e?void 0:e.id)||void 0,e:(null==e?void 0:e.email)||void 0,c:t.customerStore.customerConsentGranted}},u.getCommonEventData=function(){var t=s.getInstance();return{u:window.location.href.includes("checkout")&&document.referrer||window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0,m:{fbp:n("_fbp"),fbc:n("_fbc")}}},u.getOrderLineItem=function(t){return t.orderLineItems.map((function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}))},u.getCartItem=function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})},u.sendEvents=function(o){var n,a,d,u,m,l,p,h,E;return t(this,void 0,void 0,(function(){var t,v,O;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,(t=s.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),[4,this.checkJourneyId()];case 4:return e.sent(),v={e:o,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,jid:this.journeyId,vid:this.visitorId,sfrid:i.getStorefrontRoutingId()||"",ud:r(r(r(r({id:null===(n=t.customerStore.customer)||void 0===n?void 0:n.id},(null===(a=t.customerStore.customer)||void 0===a?void 0:a.email)?{em:null===(d=t.customerStore.customer)||void 0===d?void 0:d.email}:{}),(null===(u=t.customerStore.customer)||void 0===u?void 0:u.phone)?{ph:null===(m=t.customerStore.customer)||void 0===m?void 0:m.phone}:{}),(null===(l=t.customerStore.customer)||void 0===l?void 0:l.lastName)?{ln:null===(p=t.customerStore.customer)||void 0===p?void 0:p.lastName}:{}),(null===(h=t.customerStore.customer)||void 0===h?void 0:h.firstName)?{fn:null===(E=t.customerStore.customer)||void 0===E?void 0:E.firstName}:{}),v:3},[4,fetch(c,{method:"POST",body:JSON.stringify(v),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 5:return e.sent(),[3,7];case 6:return O=e.sent(),console.error(O),[3,7];case 7:return[2]}}))}))},u.sessionStart=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.SESSION_START,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.pageView=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.PAGE_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.productView=function(i,s){var o;return t(this,void 0,void 0,(function(){var t,n,d;return e(this,(function(e){switch(e.label){case 0:return t=[],n=[],(null===(o=i.categories)||void 0===o?void 0:o.length)&&i.categories[0].path.forEach((function(e){t.push(e.name),n.push(e.id)})),d={id:s,t:a.PRODUCT_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:r({pr:r({id:i.id,vid:i.selectedVariant.id,cp:t,cid:n,n:i.name,pr:i.selectedVariant.finalPrice},i.selectedVariant.price.currency?{c:i.selectedVariant.price.currency}:{})},i.brand?{br:{id:i.brand.id}}:{})})},[4,this.sendEvents([d])];case 1:return e.sent(),[2]}}))}))},u.addToCart=function(i,s,o,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:n,t:a.ADD_TO_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:o.id,c:o.currencyCode,pr:o.totalFinalPrice,il:this.getOrderLineItem(o)},crtItm:this.getCartItem(i)}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCart=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.VIEW_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.orderSuccess=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.ORDER_SUCCESS,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success",p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.beginCheckout=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.BEGIN_CHECKOUT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.checkoutStep=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CHECKOUT_STEP,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:s,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerRegister=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CUSTOMER_REGISTER,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerLogin=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_LOGIN,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerVisit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_VISIT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewBrand=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.BRAND_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCategory=function(i,s,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:o,t:a.CATEGORY_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id,cp:s}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewPopup=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.POPUP_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()},m:{sfpid:i}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.search=function(i,s,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.SEARCH,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{src:r({s:i},o?{r:o}:{})}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.contactForm=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CONTACT_FORM,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.addToWishlist=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.FAVORITE_PRODUCT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:{id:i}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.SESSION_ID_KEY="ikas_session_id",u.VISITOR_ID_KEY="ikas_visitor_id",u.JOURNEY_ID_KEY="ikas_journey_id",u.EXPIRY_LENGTH=18e5,u}();export{u as default};
@@ -1 +1 @@
1
- import{__assign as e}from'./../../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as t}from"mobx-react-lite";import{IkasCheckoutRequirement as o}from"@ikas/storefront-models";import{FormItem as a}from"../form-item/index.js";import{FormItemType as l,FormItemInputMode as n}from"../form-item/model.js";import i from"./model.js";import{Checkbox as s}from"../checkbox/index.js";import"@ikas/storefront-config";import{useTranslation as d}from"../../../../utils/i18n.js";import{AddressFormItem as u,BillingFormItem as c}from"@ikas/localized-address";import v from"../../styles/common.module.scss.js";import m from"../../style.module.scss.js";var E=t((function(t){var o=r.useMemo((function(){return new i(e({},t))}),[]);return r.useEffect((function(){Object.entries(t).forEach((function(e){o[e[0]]=e[1]}))}),Object.values(t)),"in-store"===t.deliveryMethod?r.createElement(p,{props:t,vm:o}):r.createElement(h,{props:t,vm:o})})),p=t((function(t){var a=t.props,l=t.vm;return d().t,r.createElement("div",null,r.createElement("div",{className:[v.Grid,v.Grid2].join(" ")},r.createElement(f,e({},a,{vm:l})),r.createElement(g,e({},a,{vm:l})),r.createElement("div",null)," "),!!l.address.checkoutSettings&&l.address.checkoutSettings.phoneRequirement!==o.INVISIBLE&&r.createElement("div",{className:m.RowPB},r.createElement(V,e({},a,{vm:l})),r.createElement("div",null)," "))})),h=t((function(t){var o,a,l,n=t.props,i=t.vm,E=d().t,p=function(t){var o=t.map((function(t){return function(t){switch(t){case u.FIRSTNAME:return r.createElement(f,e({},n,{vm:i}));case u.LASTNAME:return r.createElement(g,e({},n,{vm:i}));case u.IDENTITY_NUMBER:return r.createElement(b,e({},n,{vm:i}));case u.ADDRESS_LINE_1:return r.createElement(T,e({},n,{vm:i}));case u.ADDRESS_LINE_2:return r.createElement(y,e({},n,{vm:i}));case u.POSTAL_CODE:return r.createElement(N,e({},n,{vm:i}));case u.COUNTRY:return r.createElement(k,e({},n,{vm:i}));case u.STATE:return r.createElement(L,e({},n,{vm:i}));case u.CITY:return i.address.isFreeTextCity?r.createElement(R,e({},n,{vm:i})):r.createElement(x,e({},n,{vm:i}));case u.DISTRICT:return i.address.isFreeTextDistrict?r.createElement(I,e({},n,{vm:i})):r.createElement(O,e({},n,{vm:i}));case u.REGION:return r.createElement(S,e({},n,{vm:i}));case u.PHONE:return r.createElement(V,e({},n,{vm:i}));default:return null}}(t)}));return r.createElement(r.Fragment,null,1===t.length&&r.createElement("div",{className:m.RowPB},o),2===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2].join(" ")},o,r.createElement("div",null)," "),3===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2,v.Grid3].join(" ")},o,r.createElement("div",null)," "))},h=function(t){var o=t.map((function(t){return function(t){switch(t){case c.COMPANY:return r.createElement(j,e({},n,{vm:i}));case c.TAX_NUMBER:return r.createElement(X,e({},n,{vm:i}));case c.TAX_OFFICE:return r.createElement(A,e({},n,{vm:i}));default:return null}}(t)}));return r.createElement(r.Fragment,null,1===t.length&&r.createElement("div",{className:m.RowPB},o),2===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2].join(" ")},o,r.createElement("div",null)," "),3===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2,v.Grid3].join(" ")},o,r.createElement("div",null)," "))};return r.createElement("div",null,i.allowTitleChange&&r.createElement("div",{className:m.RowPB},r.createElement(C,e({},n,{vm:i}))),i.countryOptions.length<=1?null===(o=i.address.addressFormatIgnoreCountry)||void 0===o?void 0:o.map((function(e){return p(e)})):null===(a=i.address.addressFormat)||void 0===a?void 0:a.map((function(e){return p(e)})),!!i.allowCorporateInfo&&r.createElement("div",{style:{marginTop:"12px"}},r.createElement(s,{value:i.isCorporate,label:E("checkout-page:corporateInvoice"),onChange:i.onCorporateChange})),!!i.isCorporate&&(null===(l=i.address.billingFormat)||void 0===l?void 0:l.map((function(e){return h(e)}))))})),f=t((function(e){var t,o,n,i=e.vm,s=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.firstName)||void 0===o?void 0:o.label)||s("checkout-page:firstName"),autocomplete:"given-name",value:i.firstName||"",onChange:i.onFirstNameChange,hasError:i.isErrorsVisible&&(null===(n=i.address.validationResults)||void 0===n?void 0:n.firstName.hasError),errorText:s("checkout-page:firstNameError")})})),g=t((function(e){var t,o,n,i=e.vm,s=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.lastName)||void 0===o?void 0:o.label)||s("checkout-page:lastName"),autocomplete:"family-name",value:i.lastName||"",onChange:i.onLastNameChange,hasError:i.isErrorsVisible&&(null===(n=i.address.validationResults)||void 0===n?void 0:n.lastName.hasError),errorText:s("checkout-page:lastNameError")})})),b=t((function(e){var t,o,n,i=e.vm,s=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.identityNumber)||void 0===o?void 0:o.label)||s("checkout-page:identityNumber"),value:i.identityNumber||"",onChange:i.onIdentityNumberChange,hasError:i.isErrorsVisible&&(null===(n=i.address.validationResults)||void 0===n?void 0:n.identityNumber.hasError),errorText:s("checkout-page:identityNumberError")})})),C=t((function(e){var t=e.vm,o=d().t,n=t.address;return r.createElement(a,{type:l.TEXT,label:o("checkout-page:addressTitle"),value:n.title||"",onChange:t.onAddressTitleChange,hasError:t.isErrorsVisible&&!n.title,errorText:o("checkout-page:addressTitleError")})})),T=t((function(e){var t,o,n,i=e.vm,s=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.addressLine1)||void 0===o?void 0:o.label)||s("checkout-page:addressLine1"),autocomplete:"address-line1",value:i.address.addressLine1||"",onChange:i.onAddressLine1Change,hasError:i.isErrorsVisible&&(null===(n=i.address.validationResults)||void 0===n?void 0:n.addressLine1.hasError),errorText:s("checkout-page:addressError")})})),y=t((function(e){var t,o,n=e.vm,i=d().t;return r.createElement(a,{type:l.TEXT,autocomplete:"address-line2",label:(null===(o=null===(t=n.address.fieldLabels)||void 0===t?void 0:t.addressLine2)||void 0===o?void 0:o.label)||i("checkout-page:addressLine2"),value:n.address.addressLine2||"",onChange:n.onAddressLine2Change})})),N=t((function(e){var t,o,n,i,s,u=e.vm,c=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=u.address.fieldLabels)||void 0===t?void 0:t.postalCode)||void 0===o?void 0:o.label)||c("checkout-page:postalCode"),placeholder:null===(i=null===(n=u.address.fieldLabels)||void 0===n?void 0:n.postalCode)||void 0===i?void 0:i.placeholder,autocomplete:"postal-code",value:u.address.postalCode||"",onChange:u.onAddressPostalCodeChange,hasError:u.isErrorsVisible&&(null===(s=u.address.validationResults)||void 0===s?void 0:s.postalCode.hasError),errorText:c("checkout-page:postalCodeError")})})),k=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return s.countryOptions.length<=1?null:r.createElement(a,{type:l.SELECT,label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.country)||void 0===o?void 0:o.label)||u("checkout-page:country"),autocomplete:"country-name",value:(null===(n=s.country)||void 0===n?void 0:n.id)||"",onChange:s.onCountryChange,options:s.countryOptions,hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.country.hasError),errorText:u("checkout-page:countryError")})})),L=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return r.createElement(a,{type:l.SELECT,label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.state)||void 0===o?void 0:o.label)||u("checkout-page:state"),value:(null===(n=s.state)||void 0===n?void 0:n.id)||"",onChange:s.onStateChange,options:s.stateOptions,hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.state.hasError),errorText:u("checkout-page:stateError")})})),x=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return r.createElement(a,{type:l.SELECT,label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.city)||void 0===o?void 0:o.label)||u("checkout-page:city"),autocomplete:"off",value:(null===(n=s.city)||void 0===n?void 0:n.id)||"",onChange:s.onCityChange,options:s.cityOptions,hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.city.hasError),errorText:u("checkout-page:cityError")})})),R=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return r.createElement(a,{type:l.TEXT,autocomplete:"address-level2",label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.city)||void 0===o?void 0:o.label)||u("checkout-page:city"),value:(null===(n=s.city)||void 0===n?void 0:n.name)||"",hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.city.hasError),onChange:s.onCityInputChange,errorText:u("checkout-page:cityError")})})),O=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return r.createElement(a,{type:l.SELECT,label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.district)||void 0===o?void 0:o.label)||u("checkout-page:district"),autocomplete:"off",value:(null===(n=s.district)||void 0===n?void 0:n.id)||"",onChange:s.onDistrictChange,options:s.districtOptions,hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.district.hasError),errorText:u("checkout-page:districtError")})})),I=t((function(e){var t,o,n,i=e.vm,s=d().t;return r.createElement(a,{type:l.TEXT,autocomplete:"address-level3",label:(null===(o=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.district)||void 0===o?void 0:o.label)||s("checkout-page:district"),value:(null===(n=i.district)||void 0===n?void 0:n.name)||"",onChange:i.onDistrictInputChange})})),S=t((function(e){var t,o,n=e.vm,i=d().t;return r.createElement(a,{type:l.SELECT,label:i("checkout-page:region"),autocomplete:"off",value:(null===(t=n.region)||void 0===t?void 0:t.id)||"",onChange:n.onRegionChange,options:n.regionOptions,hasError:n.isErrorsVisible&&(null===(o=n.address.validationResults)||void 0===o?void 0:o.region.hasError),errorText:i("checkout-page:regionError")})})),V=t((function(e){var t,o,i,s,u=e.vm,c=d().t;return r.createElement(a,{type:l.TEL,inputMode:n.TEL,label:(null===(o=null===(t=u.address.fieldLabels)||void 0===t?void 0:t.phone)||void 0===o?void 0:o.label)||c("checkout-page:phone"),autocomplete:"tel",value:u.phone||"",onChange:u.onPhoneChange,hasError:u.isErrorsVisible&&(null===(i=u.address.validationResults)||void 0===i?void 0:i.phone.hasError),currentCountryCode:(null===(s=u.address.country)||void 0===s?void 0:s.iso2)||u.myCountryCode,errorText:c("checkout-page:phoneError")})})),j=t((function(e){var t,o,n=e.vm,i=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=n.address.fieldLabels)||void 0===t?void 0:t.company)||void 0===o?void 0:o.label)||i("checkout-page:companyName"),value:n.address.company||"",onChange:n.onCompanyChange})})),A=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.taxOffice)||void 0===o?void 0:o.label)||u("checkout-page:taxOffice"),value:(null===(n=s.address)||void 0===n?void 0:n.taxOffice)||"",onChange:s.onTaxOfficeChange,hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.taxOffice.hasError),errorText:u("checkout-page:taxOfficeError")})})),X=t((function(e){var t,o,n,i,s=e.vm,u=d().t;return r.createElement(a,{type:l.TEXT,label:(null===(o=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.taxNumber)||void 0===o?void 0:o.label)||u("checkout-page:taxNumber"),value:(null===(n=s.address)||void 0===n?void 0:n.taxNumber)||"",onChange:s.onTaxNumberChange,hasError:s.isErrorsVisible&&(null===(i=s.address.validationResults)||void 0===i?void 0:i.taxNumber.hasError),errorText:u("checkout-page:taxNumberError")})}));export{E as AddressForm};
1
+ import{__assign as e}from'./../../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as t}from"mobx-react-lite";import{IkasCheckoutRequirement as a}from"@ikas/storefront-models";import{FormItem as o}from"../form-item/index.js";import{FormItemType as n,FormItemInputMode as i}from"../form-item/model.js";import l from"./model.js";import{Checkbox as s}from"../checkbox/index.js";import"@ikas/storefront-config";import{useTranslation as d}from"../../../../utils/i18n.js";import{AddressFormItem as c,BillingFormItem as u}from"@ikas/localized-address";import v from"../../styles/common.module.scss.js";import m from"../../style.module.scss.js";var E=t((function(t){var a=r.useMemo((function(){return new l(e({},t))}),[]);return r.useEffect((function(){Object.entries(t).forEach((function(e){a[e[0]]=e[1]}))}),Object.values(t)),"in-store"===t.deliveryMethod?r.createElement(p,{props:t,vm:a}):r.createElement(h,{props:t,vm:a})})),p=t((function(t){var o=t.props,n=t.vm;return d().t,r.createElement("div",null,r.createElement("div",{className:[v.Grid,v.Grid2].join(" ")},r.createElement(g,e({},o,{vm:n})),r.createElement(f,e({},o,{vm:n})),r.createElement("div",null)," "),!!n.address.checkoutSettings&&n.address.checkoutSettings.phoneRequirement!==a.INVISIBLE&&r.createElement("div",{className:m.RowPB},r.createElement(I,e({},o,{vm:n})),r.createElement("div",null)," "))})),h=t((function(t){var a,o,n,i=t.props,l=t.vm,E=d().t,p=function(t){var a=t.map((function(t){return function(t){switch(t){case c.FIRSTNAME:return r.createElement(g,e({},i,{vm:l}));case c.LASTNAME:return r.createElement(f,e({},i,{vm:l}));case c.IDENTITY_NUMBER:return r.createElement(b,e({},i,{vm:l}));case c.ADDRESS_LINE_1:return r.createElement(y,e({},i,{vm:l}));case c.ADDRESS_LINE_2:return r.createElement(T,e({},i,{vm:l}));case c.POSTAL_CODE:return r.createElement(N,e({},i,{vm:l}));case c.COUNTRY:return r.createElement(L,e({},i,{vm:l}));case c.STATE:return r.createElement(k,e({},i,{vm:l}));case c.CITY:return l.address.isFreeTextCity?r.createElement(R,e({},i,{vm:l})):r.createElement(x,e({},i,{vm:l}));case c.DISTRICT:return l.address.isFreeTextDistrict?r.createElement(S,e({},i,{vm:l})):r.createElement(O,e({},i,{vm:l}));case c.REGION:return r.createElement(A,e({},i,{vm:l}));case c.PHONE:return r.createElement(I,e({},i,{vm:l}));default:return null}}(t)}));return r.createElement(r.Fragment,null,1===t.length&&r.createElement("div",{className:m.RowPB},a),2===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2].join(" ")},a,r.createElement("div",null)," "),3===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2,v.Grid3].join(" ")},a,r.createElement("div",null)," "))},h=function(t){var a=t.map((function(t){return function(t){switch(t){case u.COMPANY:return r.createElement(V,e({},i,{vm:l}));case u.TAX_NUMBER:return r.createElement(X,e({},i,{vm:l}));case u.TAX_OFFICE:return r.createElement(j,e({},i,{vm:l}));default:return null}}(t)}));return r.createElement(r.Fragment,null,1===t.length&&r.createElement("div",{className:m.RowPB},a),2===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2].join(" ")},a,r.createElement("div",null)," "),3===t.length&&r.createElement("div",{className:[v.Grid,v.Grid2,v.Grid3].join(" ")},a,r.createElement("div",null)," "))};return r.createElement("div",null,l.allowTitleChange&&r.createElement("div",{className:m.RowPB},r.createElement(C,e({},i,{vm:l}))),l.countryOptions.length<=1?null===(a=l.address.addressFormatIgnoreCountry)||void 0===a?void 0:a.map((function(e){return p(e)})):null===(o=l.address.addressFormat)||void 0===o?void 0:o.map((function(e){return p(e)})),!!l.allowCorporateInfo&&r.createElement("div",{style:{marginTop:"12px"}},r.createElement(s,{value:l.isCorporate,label:E("checkout-page:corporateInvoice"),onChange:l.onCorporateChange})),!!l.isCorporate&&(null===(n=l.address.billingFormat)||void 0===n?void 0:n.map((function(e){return h(e)}))))})),g=t((function(e){var t,a,i,l=e.vm,s=d().t,c=l.isShippingAddress?"shipping given-name":"given-name";return r.createElement(o,{name:"firstName",type:n.TEXT,label:(null===(a=null===(t=l.address.fieldLabels)||void 0===t?void 0:t.firstName)||void 0===a?void 0:a.label)||s("checkout-page:firstName"),autocomplete:c,value:l.firstName||"",onChange:l.onFirstNameChange,hasError:l.isErrorsVisible&&(null===(i=l.address.validationResults)||void 0===i?void 0:i.firstName.hasError),errorText:s("checkout-page:firstNameError")})})),f=t((function(e){var t,a,i,l=e.vm,s=d().t,c=l.isShippingAddress?"shipping family-name":"family-name";return r.createElement(o,{name:"lastName",type:n.TEXT,label:(null===(a=null===(t=l.address.fieldLabels)||void 0===t?void 0:t.lastName)||void 0===a?void 0:a.label)||s("checkout-page:lastName"),autocomplete:c,value:l.lastName||"",onChange:l.onLastNameChange,hasError:l.isErrorsVisible&&(null===(i=l.address.validationResults)||void 0===i?void 0:i.lastName.hasError),errorText:s("checkout-page:lastNameError")})})),b=t((function(e){var t,a,i,l=e.vm,s=d().t;return r.createElement(o,{name:"identityNumber",type:n.TEXT,label:(null===(a=null===(t=l.address.fieldLabels)||void 0===t?void 0:t.identityNumber)||void 0===a?void 0:a.label)||s("checkout-page:identityNumber"),value:l.identityNumber||"",onChange:l.onIdentityNumberChange,hasError:l.isErrorsVisible&&(null===(i=l.address.validationResults)||void 0===i?void 0:i.identityNumber.hasError),errorText:s("checkout-page:identityNumberError")})})),C=t((function(e){var t=e.vm,a=d().t,i=t.address;return r.createElement(o,{type:n.TEXT,label:a("checkout-page:addressTitle"),value:i.title||"",onChange:t.onAddressTitleChange,hasError:t.isErrorsVisible&&!i.title,errorText:a("checkout-page:addressTitleError")})})),y=t((function(e){var t,a,i,l=e.vm,s=d().t,c=l.isShippingAddress?"shipping address-line1":"address-line1";return r.createElement(o,{name:"addressLine1",type:n.TEXT,label:(null===(a=null===(t=l.address.fieldLabels)||void 0===t?void 0:t.addressLine1)||void 0===a?void 0:a.label)||s("checkout-page:addressLine1"),autocomplete:c,value:l.address.addressLine1||"",onChange:l.onAddressLine1Change,hasError:l.isErrorsVisible&&(null===(i=l.address.validationResults)||void 0===i?void 0:i.addressLine1.hasError),errorText:s("checkout-page:addressError")})})),T=t((function(e){var t,a,i=e.vm,l=d().t,s=i.isShippingAddress?"shipping address-line2":"address-line2";return r.createElement(o,{name:"addressLine2",type:n.TEXT,autocomplete:s,label:(null===(a=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.addressLine2)||void 0===a?void 0:a.label)||l("checkout-page:addressLine2"),value:i.address.addressLine2||"",onChange:i.onAddressLine2Change})})),N=t((function(e){var t,a,i,l=e.vm,s=d().t,c=l.isShippingAddress?"shipping postal-code":"postal-code";return r.createElement(o,{name:"postalCode",type:n.TEXT,label:(null===(a=null===(t=l.address.fieldLabels)||void 0===t?void 0:t.postalCode)||void 0===a?void 0:a.label)||s("checkout-page:postalCode"),autocomplete:c,value:l.address.postalCode||"",onChange:l.onAddressPostalCodeChange,hasError:l.isErrorsVisible&&(null===(i=l.address.validationResults)||void 0===i?void 0:i.postalCode.hasError),errorText:s("checkout-page:postalCodeError")})})),L=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return s.countryOptions.length<=1?null:r.createElement(o,{name:"country",type:n.SELECT,label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.country)||void 0===a?void 0:a.label)||c("checkout-page:country"),autocomplete:"country-name",value:(null===(i=s.country)||void 0===i?void 0:i.id)||"",onChange:s.onCountryChange,options:s.countryOptions,hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.country.hasError),errorText:c("checkout-page:countryError")})})),k=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return r.createElement(o,{name:"state",type:n.SELECT,label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.state)||void 0===a?void 0:a.label)||c("checkout-page:state"),value:(null===(i=s.state)||void 0===i?void 0:i.id)||"",onChange:s.onStateChange,options:s.stateOptions,hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.state.hasError),errorText:c("checkout-page:stateError")})})),x=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return r.createElement(o,{name:"city",type:n.SELECT,label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.city)||void 0===a?void 0:a.label)||c("checkout-page:city"),autocomplete:"off",value:(null===(i=s.city)||void 0===i?void 0:i.id)||"",onChange:s.onCityChange,options:s.cityOptions,disabled:!s.cityOptions.length,isLoading:s.isLoadingCities,hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.city.hasError),errorText:c("checkout-page:cityError")})})),R=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return r.createElement(o,{name:"city",type:n.TEXT,autocomplete:"address-level2",label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.city)||void 0===a?void 0:a.label)||c("checkout-page:city"),value:(null===(i=s.city)||void 0===i?void 0:i.name)||"",hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.city.hasError),onChange:s.onCityInputChange,errorText:c("checkout-page:cityError")})})),O=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return r.createElement(o,{name:"district",type:n.SELECT,label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.district)||void 0===a?void 0:a.label)||c("checkout-page:district"),autocomplete:"off",value:(null===(i=s.district)||void 0===i?void 0:i.id)||"",onChange:s.onDistrictChange,options:s.districtOptions,disabled:!s.districtOptions.length,isLoading:s.isLoadingDistricts,hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.district.hasError),errorText:c("checkout-page:districtError")})})),S=t((function(e){var t,a,i,l=e.vm,s=d().t;return r.createElement(o,{name:"district",type:n.TEXT,autocomplete:"address-level3",label:(null===(a=null===(t=l.address.fieldLabels)||void 0===t?void 0:t.district)||void 0===a?void 0:a.label)||s("checkout-page:district"),value:(null===(i=l.district)||void 0===i?void 0:i.name)||"",onChange:l.onDistrictInputChange})})),A=t((function(e){var t,a,i=e.vm,l=d().t;return r.createElement(o,{name:"region",type:n.SELECT,label:l("checkout-page:region"),autocomplete:"off",value:(null===(t=i.region)||void 0===t?void 0:t.id)||"",onChange:i.onRegionChange,options:i.regionOptions,hasError:i.isErrorsVisible&&(null===(a=i.address.validationResults)||void 0===a?void 0:a.region.hasError),errorText:l("checkout-page:regionError")})})),I=t((function(e){var t,a,l,s,c=e.vm,u=d().t,v=c.isShippingAddress?"shipping tel":"tel";return r.createElement(o,{name:"phone",type:n.TEL,inputMode:i.TEL,label:(null===(a=null===(t=c.address.fieldLabels)||void 0===t?void 0:t.phone)||void 0===a?void 0:a.label)||u("checkout-page:phone"),autocomplete:v,value:c.phone||"",onChange:c.onPhoneChange,hasError:c.isErrorsVisible&&(null===(l=c.address.validationResults)||void 0===l?void 0:l.phone.hasError),currentCountryCode:(null===(s=c.address.country)||void 0===s?void 0:s.iso2)||c.myCountryCode,errorText:u("checkout-page:phoneError")})})),V=t((function(e){var t,a,i=e.vm,l=d().t;return r.createElement(o,{name:"company",type:n.TEXT,label:(null===(a=null===(t=i.address.fieldLabels)||void 0===t?void 0:t.company)||void 0===a?void 0:a.label)||l("checkout-page:companyName"),value:i.address.company||"",onChange:i.onCompanyChange})})),j=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return r.createElement(o,{name:"taxOffice",type:n.TEXT,label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.taxOffice)||void 0===a?void 0:a.label)||c("checkout-page:taxOffice"),value:(null===(i=s.address)||void 0===i?void 0:i.taxOffice)||"",onChange:s.onTaxOfficeChange,hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.taxOffice.hasError),errorText:c("checkout-page:taxOfficeError")})})),X=t((function(e){var t,a,i,l,s=e.vm,c=d().t;return r.createElement(o,{name:"taxNumber",type:n.TEXT,label:(null===(a=null===(t=s.address.fieldLabels)||void 0===t?void 0:t.taxNumber)||void 0===a?void 0:a.label)||c("checkout-page:taxNumber"),value:(null===(i=s.address)||void 0===i?void 0:i.taxNumber)||"",onChange:s.onTaxNumberChange,hasError:s.isErrorsVisible&&(null===(l=s.address.validationResults)||void 0===l?void 0:l.taxNumber.hasError),errorText:c("checkout-page:taxNumberError")})}));export{E as AddressForm};
@@ -12,6 +12,7 @@ export interface AddressFormViewModelParams {
12
12
  firstNameChangeCallback?: Callback;
13
13
  lastNameChangeCallback?: Callback;
14
14
  deliveryMethod?: "address" | "in-store";
15
+ isShippingAddress?: boolean;
15
16
  }
16
17
  export default class AddressFormViewModel {
17
18
  address: IkasLocalizedOrderAddress | IkasLocalizedCustomerAddress;
@@ -23,10 +24,13 @@ export default class AddressFormViewModel {
23
24
  allowTitleChange?: boolean;
24
25
  firstNameChangeCallback?: Callback;
25
26
  lastNameChangeCallback?: Callback;
27
+ isShippingAddress: boolean;
26
28
  countries: IkasCountry[];
27
29
  states: IkasState[];
28
30
  cities: IkasCity[];
29
31
  districts: IkasDistrict[];
32
+ isLoadingCities: boolean;
33
+ isLoadingDistricts: boolean;
30
34
  myCountryCode?: string | null;
31
35
  constructor(data: AddressFormViewModelParams);
32
36
  get firstName(): string;
@@ -67,6 +71,7 @@ export default class AddressFormViewModel {
67
71
  get isFreeTextCity(): boolean;
68
72
  get isDistrictHidden(): boolean;
69
73
  fillDropdownOptions: () => Promise<void>;
74
+ checkIsCorporate: () => Promise<void>;
70
75
  listCountries: () => Promise<void>;
71
76
  listStates: () => Promise<void>;
72
77
  listCities: () => Promise<void>;