@ikas/storefront 5.0.0-beta.8 → 5.0.0
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.
- package/build/analytics/analytics.d.ts +4 -0
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/facebookPixel.d.ts +1 -0
- package/build/analytics/facebookPixel.js +1 -1
- package/build/analytics/googleAnalytics.d.ts +1 -0
- package/build/analytics/googleAnalytics.js +1 -1
- package/build/analytics/googleTagManager.d.ts +12 -21
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/head/index.js +1 -1
- package/build/analytics/ikas.d.ts +2 -1
- package/build/analytics/ikas.js +1 -1
- package/build/analytics/tiktokPixel.d.ts +1 -0
- package/build/analytics/tiktokPixel.js +1 -1
- package/build/components/checkout/components/address-form/index.js +1 -1
- package/build/components/checkout/components/address-form/model.d.ts +13 -2
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/bundle-product-item/index.d.ts +7 -0
- package/build/components/checkout/components/cart-summary/cart-item/bundle-product-item/index.js +1 -0
- package/build/components/checkout/components/cart-summary/cart-item/bundle-product-item/style.module.scss.js +1 -0
- package/build/components/checkout/components/cart-summary/cart-item/index.d.ts +1 -0
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/svg/arrow-down.d.ts +2 -0
- package/build/components/checkout/components/cart-summary/cart-item/svg/arrow-down.js +1 -0
- package/build/components/checkout/components/cart-summary/index.d.ts +11 -0
- package/build/components/checkout/components/cart-summary/index.js +1 -1
- package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
- package/build/components/checkout/components/credit-card-form/model.js +1 -1
- package/build/components/checkout/components/customer-addresses/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/components/customer-addresses/style.module.scss.js +1 -1
- package/build/components/checkout/components/epaykolay-button/index.d.ts +5 -0
- package/build/components/checkout/components/epaykolay-button/index.js +1 -0
- package/build/components/checkout/components/epaykolay-button/style.module.scss.js +1 -0
- package/build/components/checkout/components/error/customer-account-disabled-error/index.d.ts +8 -0
- package/build/components/checkout/components/error/customer-account-disabled-error/index.js +1 -0
- package/build/components/checkout/components/error/customer-login-required-error/index.js +1 -1
- package/build/components/checkout/components/error/index.js +1 -1
- package/build/components/checkout/components/form-item/index.js +1 -1
- package/build/components/checkout/components/form-item/model.js +1 -1
- package/build/components/checkout/components/notification-box/index.d.ts +2 -0
- package/build/components/checkout/components/notification-box/index.js +1 -1
- package/build/components/checkout/components/offer-product/index.js +1 -1
- package/build/components/checkout/components/paypal/index.d.ts +7 -0
- package/build/components/checkout/components/paypal/index.js +1 -0
- package/build/components/checkout/components/paypal/style.module.scss.js +1 -0
- package/build/components/checkout/components/product-files/index.d.ts +7 -0
- package/build/components/checkout/components/product-files/index.js +1 -0
- package/build/components/checkout/components/product-files/style.module.scss.js +1 -0
- package/build/components/checkout/components/quick-registration/model.js +1 -1
- package/build/components/checkout/components/select-box/index.d.ts +1 -0
- package/build/components/checkout/components/select-box/index.js +1 -1
- package/build/components/checkout/components/stripe/index.js +1 -1
- package/build/components/checkout/components/svg/epaykolay.d.ts +6 -0
- package/build/components/checkout/components/svg/epaykolay.js +1 -0
- package/build/components/checkout/components/toggle/index.d.ts +1 -0
- package/build/components/checkout/components/toggle/index.js +1 -1
- package/build/components/checkout/components/toggle/style.module.scss.js +1 -1
- package/build/components/checkout/index.d.ts +2 -0
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +44 -17
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-payment/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-shipping/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/checkout/steps/step-success/style.module.scss.js +1 -1
- package/build/components/checkout/style.module.scss.js +1 -1
- package/build/components/google-captcha/index.js +1 -1
- package/build/components/link/index.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.d.ts +1 -0
- package/build/components/page-editor/model.js +1 -1
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/hooks/useStore.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/cart/available-shipping-method/estimated-delivery-time/index.d.ts +6 -0
- package/build/models/data/cart/available-shipping-method/estimated-delivery-time/index.js +1 -0
- package/build/models/data/cart/available-shipping-method/index.d.ts +2 -0
- package/build/models/data/cart/available-shipping-method/index.js +1 -1
- package/build/models/data/category/conditions/index.d.ts +21 -0
- package/build/models/data/category/conditions/index.js +1 -0
- package/build/models/data/category/index.d.ts +3 -0
- package/build/models/data/category/index.js +1 -1
- package/build/models/data/checkout/index.d.ts +2 -2
- package/build/models/data/checkout-settings/index.d.ts +2 -1
- package/build/models/data/checkout-settings/index.js +1 -1
- package/build/models/data/checkout-settings/price/index.d.ts +2 -1
- package/build/models/data/checkout-settings/price/index.js +1 -1
- package/build/models/data/contact-form/index.d.ts +1 -0
- package/build/models/data/contact-form/index.js +1 -1
- package/build/models/data/customer/address/ikas-localized-customer-address.d.ts +26 -12
- package/build/models/data/customer/address/ikas-localized-customer-address.js +1 -1
- package/build/models/data/customer/address/index.d.ts +5 -0
- package/build/models/data/customer/address/index.js +1 -1
- package/build/models/data/customer/address/region/index.d.ts +6 -0
- package/build/models/data/customer/address/region/index.js +1 -0
- package/build/models/data/customer/index.d.ts +7 -0
- package/build/models/data/customer/index.js +1 -1
- package/build/models/data/customer/price-list-rule/filter/index.d.ts +7 -0
- package/build/models/data/customer/price-list-rule/filter/index.js +1 -0
- package/build/models/data/customer/price-list-rule/index.d.ts +10 -0
- package/build/models/data/customer/price-list-rule/index.js +1 -0
- package/build/models/data/customer/review/index.d.ts +1 -0
- package/build/models/data/customer/review/index.js +1 -1
- package/build/models/data/favorite-product/index.d.ts +2 -0
- package/build/models/data/favorite-product/index.js +1 -1
- package/build/models/data/filter-category/index.d.ts +4 -0
- package/build/models/data/filter-category/index.js +1 -1
- package/build/models/data/html-meta-data/translations/index.d.ts +1 -0
- package/build/models/data/html-meta-data/translations/index.js +1 -1
- package/build/models/data/image/index.d.ts +1 -0
- package/build/models/data/image/index.js +1 -1
- package/build/models/data/index.d.ts +15 -1
- package/build/models/data/order/address/ikas-localized-order-address.d.ts +48 -18
- package/build/models/data/order/address/ikas-localized-order-address.js +1 -1
- package/build/models/data/order/address/index.d.ts +5 -0
- package/build/models/data/order/address/index.js +1 -1
- package/build/models/data/order/address/region/index.d.ts +6 -0
- package/build/models/data/order/address/region/index.js +1 -0
- package/build/models/data/order/index.d.ts +3 -0
- package/build/models/data/order/index.js +1 -1
- package/build/models/data/order/line-item/index.d.ts +5 -0
- package/build/models/data/order/line-item/index.js +1 -1
- package/build/models/data/order/line-item/variant/bundle-product/bundle-variant/index.d.ts +33 -0
- package/build/models/data/order/line-item/variant/bundle-product/bundle-variant/index.js +1 -0
- package/build/models/data/order/line-item/variant/bundle-product/index.d.ts +15 -0
- package/build/models/data/order/line-item/variant/bundle-product/index.js +1 -0
- package/build/models/data/order/line-item/variant/index.d.ts +4 -0
- package/build/models/data/order/line-item/variant/index.js +1 -1
- package/build/models/data/order/transaction/index.d.ts +1 -0
- package/build/models/data/order/transaction/index.js +1 -1
- package/build/models/data/order/transaction/payment-method-detail/index.d.ts +1 -0
- package/build/models/data/order/transaction/payment-method-detail/index.js +1 -1
- package/build/models/data/product/campaign-offer/index.d.ts +15 -0
- package/build/models/data/product/campaign-offer/index.js +1 -0
- package/build/models/data/product/filter/index.d.ts +2 -0
- package/build/models/data/product/filter/index.js +1 -1
- package/build/models/data/product/group/index.d.ts +11 -0
- package/build/models/data/product/group/index.js +1 -0
- package/build/models/data/product/group/translation/index.d.ts +13 -0
- package/build/models/data/product/group/translation/index.js +1 -0
- package/build/models/data/product/group/value/index.d.ts +7 -0
- package/build/models/data/product/group/value/index.js +1 -0
- package/build/models/data/product/image/index.d.ts +1 -0
- package/build/models/data/product/image/index.js +1 -1
- package/build/models/data/product/index.d.ts +34 -1
- package/build/models/data/product/index.js +1 -1
- package/build/models/data/product/variant/bundle-settings/bundle-product/index.d.ts +28 -0
- package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -0
- package/build/models/data/product/variant/bundle-settings/index.d.ts +8 -0
- package/build/models/data/product/variant/bundle-settings/index.js +1 -0
- package/build/models/data/product/variant/index.d.ts +35 -3
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/data/product/variant/price/index.d.ts +26 -0
- package/build/models/data/product/variant/price/index.js +1 -1
- package/build/models/data/product/variant/price/product-campaign-price/index.d.ts +6 -0
- package/build/models/data/product/variant/price/product-campaign-price/index.js +1 -0
- package/build/models/data/product-file/index.d.ts +8 -0
- package/build/models/data/product-file/index.js +1 -0
- package/build/models/data/shipping-zone/index.d.ts +9 -0
- package/build/models/data/shipping-zone/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/district/index.d.ts +7 -0
- package/build/models/data/shipping-zone/state/city/district/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/district/region/index.d.ts +6 -0
- package/build/models/data/shipping-zone/state/city/district/region/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/index.d.ts +8 -0
- package/build/models/data/shipping-zone/state/city/index.js +1 -0
- package/build/models/data/shipping-zone/state/index.d.ts +9 -0
- package/build/models/data/shipping-zone/state/index.js +1 -0
- package/build/models/data/storefront/b2b-settings/index.d.ts +8 -0
- package/build/models/data/storefront/b2b-settings/index.js +1 -0
- package/build/models/data/storefront/index-page-seo-setting/index.d.ts +17 -0
- package/build/models/data/storefront/index-page-seo-setting/index.js +1 -0
- package/build/models/data/storefront/index.d.ts +6 -1
- package/build/models/data/storefront/index.js +1 -1
- package/build/models/data/theme-json/component/index.d.ts +2 -0
- package/build/models/data/theme-json/component/index.js +1 -1
- package/build/models/data/theme-json/component/prop/index.d.ts +2 -0
- package/build/models/data/theme-json/component/prop/index.js +1 -1
- package/build/models/data/theme-json/custom-data/index.d.ts +2 -0
- package/build/models/data/theme-json/custom-data/index.js +1 -1
- package/build/models/data/theme-json/index.js +1 -1
- package/build/models/data/video/index.d.ts +11 -0
- package/build/models/data/video/index.js +1 -0
- package/build/models/ui/blog-category-list/index.js +1 -1
- package/build/models/ui/brand-list/index.js +1 -1
- package/build/models/ui/category-list/index.js +1 -1
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/customer-review-summary-list/index.js +1 -1
- package/build/models/ui/index.d.ts +1 -1
- package/build/models/ui/product-attribute-list/index.js +1 -1
- package/build/models/ui/product-list/index.d.ts +25 -3
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/raffle-list/index.js +1 -1
- package/build/models/ui/validator/form/account-info.js +1 -1
- package/build/models/ui/validator/form/address.js +1 -1
- package/build/models/ui/validator/form/contact-form.d.ts +6 -0
- package/build/models/ui/validator/form/contact-form.js +1 -1
- package/build/models/ui/validator/form/ikas-address.d.ts +46 -20
- package/build/models/ui/validator/form/ikas-address.js +1 -1
- package/build/models/ui/validator/form/login.d.ts +7 -4
- package/build/models/ui/validator/form/login.js +1 -1
- package/build/models/ui/validator/form/register.d.ts +10 -1
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/page-data-init/index.d.ts +9 -1
- package/build/page-data-init/index.js +1 -1
- package/build/pages/account/activate.d.ts +4 -0
- package/build/pages/account/activate.js +1 -0
- package/build/pages/checkout.js +1 -1
- package/build/pages/home.js +1 -1
- package/build/pages/index.d.ts +1 -0
- package/build/store/base.d.ts +1 -0
- package/build/store/base.js +1 -1
- package/build/store/blog/index.js +1 -1
- package/build/store/brand/index.js +1 -1
- package/build/store/cart/index.d.ts +6 -2
- package/build/store/cart/index.js +1 -1
- package/build/store/category/index.js +1 -1
- package/build/store/checkout/index.d.ts +7 -2
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.d.ts +5 -1
- package/build/store/customer/api.js +1 -1
- package/build/store/customer/index.d.ts +25 -5
- package/build/store/customer/index.js +1 -1
- package/build/store/html-meta-data/index.js +1 -1
- package/build/store/index.d.ts +1 -1
- package/build/store/location/index.d.ts +2 -1
- package/build/store/location/index.js +1 -1
- package/build/store/product/index.d.ts +4 -1
- package/build/store/product/index.js +1 -1
- package/build/utils/constants.js +1 -1
- package/build/utils/helper.d.ts +1 -0
- package/build/utils/helper.js +1 -1
- package/package.json +18 -14
- package/build/analytics/googleUniversal.d.ts +0 -9
- package/build/analytics/googleUniversal.js +0 -1
- package/build/ext/@builder.io/partytown/integration/index.mjs.js +0 -1
- package/build/ext/@builder.io/partytown/react/index.mjs.js +0 -1
- package/build/models/data/checkout/country-settings-model.d.ts +0 -141
- package/build/models/data/checkout/country-settings-model.js +0 -1
|
@@ -12,6 +12,10 @@ export declare class Analytics {
|
|
|
12
12
|
lastName: string | null;
|
|
13
13
|
email: string | null;
|
|
14
14
|
phone: string | null;
|
|
15
|
+
isEmailVerified: boolean | null;
|
|
16
|
+
isPhoneVerified: boolean | null;
|
|
17
|
+
orderCount: number | null;
|
|
18
|
+
subscriptionStatus: import("@ikas/storefront-models/build-cjs/models/customer").IkasCustomerEmailSubscriptionStatus | null;
|
|
15
19
|
} | null>;
|
|
16
20
|
static pageView(pageType: IkasThemeJsonPageType): Promise<void>;
|
|
17
21
|
static productView(productDetail: IkasProduct): void;
|
|
@@ -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 c}from"../models/data/checkout/index.js";import"../models/data/checkout/country-settings-model.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/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/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/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/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/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 n}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";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 d}from"./facebookPixel.js";import{GoogleTagManager as m}from"./googleTagManager.js";import{IkasEventType as l}from"./events.js";import u from"lodash/cloneDeep";import{tryForEach as p}from"../utils/helper.js";import b from"./ikas.js";import{GoogleAnalytics as f}from"./googleAnalytics.js";import{GoogleUniversal as h}from"./googleUniversal.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,i;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(),m.pageView(t),h.pageView(window.location.pathname),b.pageView(r),p(v.subscribers,(function(e){e.callback({type:l.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,3];case 2:return i=e.sent(),console.error(i),[3,3];case 3:return[2]}}))}))},v.productView=function(t){try{if(d.productView(t),m.productView(t),b.productView(t),f.productView(t),h.productView(t),g.productView(t),v.subscribers.length){var e=new n(u(t));p(v.subscribers,(function(t){t.callback({type:l.PRODUCT_VIEW,data:{productDetail:e}})}))}}catch(t){console.error(t)}},v.addToCart=function(t,e,r,o){try{if(d.addToCart(t,e,r),m.addToCart(t,e),b.addToCart(t,e,o),f.addToCart(t,e),h.addToCart(t,e),g.addToCart(t,e),v.subscribers.length){var i=u(t),a=new s(u(o));p(v.subscribers,(function(t){t.callback({type:l.ADD_TO_CART,data:{item:i,quantity:e,cart:a}})}))}}catch(t){console.error(t)}},v.removeFromCart=function(t,e,r){try{if(m.removeFromCart(t,e),f.removeFromCart(t,e),h.removeFromCart(t,e),v.subscribers.length){var o=u(t),i=new s(u(r));p(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;if(localStorage.setItem("gtmBeginCheckout",t.id),d.beginCheckout(t),m.beginCheckout(t),b.beginCheckout(t),f.beginCheckout(t),g.beginCheckout(),v.subscribers.length){var r=new c(u(t));p(v.subscribers,(function(t){t.callback({type:l.BEGIN_CHECKOUT,data:{checkout:r}})}))}}catch(t){console.error(t)}},v.purchase=function(t,e){try{if(localStorage.removeItem("gtmBeginCheckout"),d.purchase(t,e.id||""),m.purchase(t,t.orderNumber||""),b.orderSuccess(t),f.purchase(t,t.orderNumber||""),h.purchase(t,t.orderNumber||""),g.purchase(t),v.subscribers.length){var r=new c(u(t)),o=u(e);p(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(m.checkoutStep(t,e),b.checkoutStep(t,e),f.checkoutStep(t,e),v.subscribers.length){var r=new c(u(t));p(v.subscribers,(function(t){t.callback({type:l.CHECKOUT_STEP,data:{checkout:r,step:e}})}))}}catch(t){console.error(t)}},v.disableHTML=function(){try{m.disableHTML()}catch(t){console.error(t)}},v.addToWishlist=function(t){try{d.addToWishlist(t),g.addToWishlist(t),v.subscribers.length&&p(v.subscribers,(function(e){e.callback({type:l.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},v.search=function(t){try{d.search(t),m.search(t),g.search(t),v.subscribers.length&&p(v.subscribers,(function(e){e.callback({type:l.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},v.completeRegistration=function(t){try{d.completeRegistration(),m.completeRegistration(),g.completeRegistration(),b.customerRegister(),v.subscribers.length&&p(v.subscribers,(function(e){e.callback({type:l.CUSTOMER_REGISTER,data:{email:t.email,firstName:t.firstName,lastName:t.lastName}})}))}catch(t){console.error(t)}},v.createEmailSubscripition=function(t){try{v.subscribers.length&&p(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?(m.customerLogin(t.email),b.customerLogin(),v.subscribers.length&&p(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{v.subscribers.length&&p(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?(m.customerVisit(t.email),b.customerVisit(),v.subscribers.length&&p(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&&(d.viewCart(t),b.viewCart(t),f.viewCart(t),m.viewCart(t),v.subscribers.length)){var e=new s(u(t));p(v.subscribers,(function(t){t.callback({type:l.VIEW_CART,data:{cart:e}})}))}}catch(t){console.error(t)}},v.viewCategory=function(t,e){try{if(d.viewCategory(t),m.viewCategory(e,t),b.viewCategory(e),g.viewCategory(e),v.subscribers.length){var r=new a(u(e));p(v.subscribers,(function(e){e.callback({type:l.VIEW_CATEGORY,data:{categoryPath:t,category:r}})}))}}catch(t){console.error(t)}},v.viewBrand=function(t){try{if(b.viewBrand(t),v.subscribers.length){var e=new i(u(t));p(v.subscribers,(function(t){t.callback({type:l.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},v.viewSearchResults=function(t,e){try{if(v.subscribers.length){var r=u(e).map((function(t){return new n(t)}));p(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=u(t).map((function(t){return new n(t)}));p(v.subscribers,(function(t){t.callback({type:l.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},v.contactForm=function(t){try{if(d.contactForm(),g.contactForm(),v.subscribers.length){var e=u(t);p(v.subscribers,(function(t){t.callback({type:l.CONTACT_FORM,data:{form:e}})}))}}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 c}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/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/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 n}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/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 d}from"./facebookPixel.js";import{GoogleTagManager as m}from"./googleTagManager.js";import{IkasEventType as l}from"./events.js";import u from"lodash/cloneDeep";import{tryForEach as p}from"../utils/helper.js";import b from"./ikas.js";import{GoogleAnalytics as f}from"./googleAnalytics.js";import{TiktokPixel as h}from"./tiktokPixel.js";import{IkasBaseStore as g}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var j=function(){function j(){o(this)}return j.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=g.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),(o=t.customerStore.customer)?[2,r(r({},o.basicInfo),{consentGranted:t.customerStore.customerConsentGranted})]:[2,null]}}))}))},j.pageView=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=window.location.href,[4,j.getCustomerInfo()];case 1:return o=e.sent(),m.pageView(t),b.pageView(r),p(j.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]}}))}))},j.productView=function(t){try{if(d.productView(t),m.productView(t),b.productView(t),f.productView(t),h.productView(t),j.subscribers.length){var e=new n(u(t));p(j.subscribers,(function(t){t.callback({type:l.PRODUCT_VIEW,data:{productDetail:e}})}))}}catch(t){console.error(t)}},j.addToCart=function(t,e,r,o){try{if(d.addToCart(t,e,r),m.addToCart(t,e),b.addToCart(t,e,o),f.addToCart(t,e),h.addToCart(t,e),j.subscribers.length){var s=u(t),a=new i(u(o));p(j.subscribers,(function(t){t.callback({type:l.ADD_TO_CART,data:{item:s,quantity:e,cart:a}})}))}}catch(t){console.error(t)}},j.removeFromCart=function(t,e,r){try{if(m.removeFromCart(t,e),f.removeFromCart(t,e),j.subscribers.length){var o=u(t),s=new i(u(r));p(j.subscribers,(function(t){t.callback({type:l.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:s}})}))}}catch(t){console.error(t)}},j.beginCheckout=function(t){try{var e=localStorage.getItem("gtmBeginCheckout");if(e&&t.id===e)return;if(localStorage.setItem("gtmBeginCheckout",t.id),d.beginCheckout(t),m.beginCheckout(t),b.beginCheckout(t),f.beginCheckout(t),h.beginCheckout(),j.subscribers.length){var r=new c(u(t));p(j.subscribers,(function(t){t.callback({type:l.BEGIN_CHECKOUT,data:{checkout:r}})}))}}catch(t){console.error(t)}},j.purchase=function(t,e){try{if(localStorage.removeItem("gtmBeginCheckout"),d.purchase(t,e.id||""),m.purchase(t,t.orderNumber||""),b.orderSuccess(t),f.purchase(t,t.orderNumber||""),h.purchase(t),j.subscribers.length){var r=new c(u(t)),o=u(e);p(j.subscribers,(function(t){t.callback({type:l.COMPLETE_CHECKOUT,data:{checkout:r,transaction:o}})}))}}catch(t){console.error(t)}},j.checkoutStep=function(t,e){try{if(m.checkoutStep(t,e),b.checkoutStep(t,e),f.checkoutStep(t,e),j.subscribers.length){var r=new c(u(t));p(j.subscribers,(function(t){t.callback({type:l.CHECKOUT_STEP,data:{checkout:r,step:e}})}))}}catch(t){console.error(t)}},j.disableHTML=function(){try{m.disableHTML()}catch(t){console.error(t)}},j.addToWishlist=function(t){try{d.addToWishlist(t),h.addToWishlist(t),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},j.search=function(t){try{d.search(t),m.search(t),h.search(t),f.search(t),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},j.completeRegistration=function(t){try{d.completeRegistration(),m.completeRegistration(t),h.completeRegistration(),b.customerRegister(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_REGISTER,data:{email:t.email,firstName:t.firstName,lastName:t.lastName}})}))}catch(t){console.error(t)}},j.createEmailSubscripition=function(t){try{j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.EMAIL_SUBSCRIPTION,data:{email:t}})}))}catch(t){console.error(t)}},j.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,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerLogin(t),b.customerLogin(),j.subscribers.length&&p(j.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]}}))}))},j.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{m.customerLogout(),j.subscribers.length&&p(j.subscribers,(function(t){t.callback({type:l.CUSTOMER_LOGOUT,data:{}})}))}catch(t){console.error(t)}return[2]}))}))},j.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,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerVisit(t),b.customerVisit(),j.subscribers.length&&p(j.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]}}))}))},j.viewCart=function(t){try{if(t&&(d.viewCart(t),b.viewCart(t),f.viewCart(t),m.viewCart(t),j.subscribers.length)){var e=new i(u(t));p(j.subscribers,(function(t){t.callback({type:l.VIEW_CART,data:{cart:e}})}))}}catch(t){console.error(t)}},j.viewCategory=function(t,e){try{if(d.viewCategory(t),m.viewCategory(e,t),b.viewCategory(e),h.viewCategory(e),j.subscribers.length){var r=new a(u(e));p(j.subscribers,(function(e){e.callback({type:l.VIEW_CATEGORY,data:{categoryPath:t,category:r}})}))}}catch(t){console.error(t)}},j.viewBrand=function(t){try{if(b.viewBrand(t),j.subscribers.length){var e=new s(u(t));p(j.subscribers,(function(t){t.callback({type:l.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},j.viewSearchResults=function(t,e){try{if(j.subscribers.length){var r=u(e).map((function(t){return new n(t)}));p(j.subscribers,(function(e){e.callback({type:l.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},j.viewListing=function(t){try{if(j.subscribers.length){var e=u(t).map((function(t){return new n(t)}));p(j.subscribers,(function(t){t.callback({type:l.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},j.contactForm=function(t){try{if(d.contactForm(),h.contactForm(),j.subscribers.length){var e=u(t);p(j.subscribers,(function(t){t.callback({type:l.CONTACT_FORM,data:{form:e}})}))}}catch(t){console.error(t)}},j.subscribers=[],j}();export{j as Analytics};
|
|
@@ -2,6 +2,7 @@ import { IkasCheckout, IkasProduct, IkasOrderLineItem } from "../models";
|
|
|
2
2
|
import { IkasCart } from "../models/data/cart";
|
|
3
3
|
export declare class FacebookPixel {
|
|
4
4
|
constructor();
|
|
5
|
+
private static get fbpId();
|
|
5
6
|
static productView(productDetail: IkasProduct): void;
|
|
6
7
|
static addToCart(item: IkasOrderLineItem, quantity: number, eventId: string): void;
|
|
7
8
|
static beginCheckout(checkout: IkasCheckout): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as t}from"mobx";var
|
|
1
|
+
import{makeAutoObservable as t}from"mobx";import{IkasStorefrontConfig as n}from"@ikas/storefront-config";var e="undefined"==typeof window,r=function(){function r(){t(this)}return Object.defineProperty(r,"fbpId",{get:function(){return n.getFbpId()},enumerable:!1,configurable:!0}),r.productView=function(t){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","ViewContent",(n=t,{content_name:n.name,content_category:n.categories.length>0?n.categories[0].path.map((function(t){return t.name})).join(" > "):"",content_ids:[n.selectedVariant.id],content_type:"product",value:n.selectedVariant.price.finalPrice,currency:""===n.selectedVariant.price.currency?"TRY":n.selectedVariant.price.currency})))}catch(t){console.error(t)}var n},r.addToCart=function(t,n,r){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","AddToCart",function(t,n){var e,r,o=[];(null===(e=t.variant.categories)||void 0===e?void 0:e.length)&&(null===(r=t.variant.categories[0].categoryPath)||void 0===r||r.map((function(t){return o.push(t.name)}))),t.variant.categories&&t.variant.categories.length>0&&o.push(t.variant.categories[0].name);var i=o.length>0?o.join(" > "):"";return{content_name:t.variant.name,content_category:i,content_ids:[t.variant.id],content_type:"product",value:t.finalPrice,currency:t.currencyCode}}(t),{eventID:r}))}catch(t){console.error(t)}},r.beginCheckout=function(t){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","InitiateCheckout",o(t)))}catch(t){console.error(t)}},r.purchase=function(t,n){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","Purchase",o(t),{eventID:n}))}catch(t){console.error(t)}},r.addToWishlist=function(t){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","AddToWishlist",{content_ids:[t]}))}catch(t){console.error(t)}},r.search=function(t){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","Search",{search_string:t}))}catch(t){console.error(t)}},r.completeRegistration=function(){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","CompleteRegistration",{status:!0,value:0,currency:"TRY"}))}catch(t){console.error(t)}},r.viewCart=function(t){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","ViewCart",function(t){var n=[],e=[];return t.items.map((function(t){n.push(t.variant.id||""),e.push({id:t.variant.id,quantity:t.quantity})})),{contents:e,content_type:"product",content_ids:n,currency:t.items[0].currencyCode,value:t.totalPrice,num_items:t.items.length}}(t)))}catch(t){console.error(t)}},r.viewCategory=function(t){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","ViewCategory",{content_name:t}))}catch(t){console.error(t)}},r.contactForm=function(){try{return void(!e&&this.fbpId&&window.fbq&&window.fbq("track","ContactForm",{}))}catch(t){console.error(t)}},r}();function o(t){var n=[],e=[];return t.items.map((function(t){n.push(t.variant.id||""),e.push({id:t.variant.id,quantity:t.quantity})})),{contents:e,content_category:"",content_type:"product",content_ids:n,currency:t.items[0].currencyCode,value:t.totalFinalPrice,num_items:t.items.length}}export{r as FacebookPixel};
|
|
@@ -10,4 +10,5 @@ export declare class GoogleAnalytics {
|
|
|
10
10
|
static beginCheckout(checkout: IkasCheckout): void;
|
|
11
11
|
static purchase(checkout: IkasCheckout, orderId: string): void;
|
|
12
12
|
static checkoutStep(checkout: IkasCheckout, step: CheckoutStep): void;
|
|
13
|
+
static search(searchKeyword: string): void;
|
|
13
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
|
|
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/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/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/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.price.finalPrice:e.finalPrice,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_category_2:o.length>1?o[1]:"",item_category_3:o.length>2?o[2]:"",item_category_4: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_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: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 } from "../models";
|
|
1
|
+
import { IkasCheckout, IkasProduct, IkasOrderLineItem, IkasCategory, IkasCart, IkasCustomer } from "../models";
|
|
2
2
|
import { CheckoutStep } from "../components/checkout/model";
|
|
3
3
|
export declare class GoogleTagManager {
|
|
4
4
|
constructor();
|
|
@@ -29,6 +29,7 @@ export declare class GoogleTagManager {
|
|
|
29
29
|
currency: string | null;
|
|
30
30
|
url: string;
|
|
31
31
|
item_image: string;
|
|
32
|
+
barcode: string;
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
} | undefined;
|
|
@@ -154,26 +155,13 @@ export declare class GoogleTagManager {
|
|
|
154
155
|
static checkoutStep(checkout: IkasCheckout, step: CheckoutStep): {
|
|
155
156
|
event: string;
|
|
156
157
|
ecommerce: {
|
|
157
|
-
|
|
158
|
-
item_name: string;
|
|
159
|
-
item_id: string | null;
|
|
160
|
-
price: string;
|
|
161
|
-
item_brand: string;
|
|
162
|
-
item_category: string;
|
|
163
|
-
item_category_2: string;
|
|
164
|
-
item_category_3: string;
|
|
165
|
-
item_category_4: string;
|
|
166
|
-
item_variant: string | undefined;
|
|
167
|
-
item_list_name: string;
|
|
168
|
-
item_list_id: string;
|
|
169
|
-
index: number;
|
|
170
|
-
quantity: number;
|
|
171
|
-
}[];
|
|
158
|
+
cart: Partial<IkasCheckout>;
|
|
172
159
|
};
|
|
173
160
|
} | undefined;
|
|
174
161
|
static disableHTML(): void;
|
|
175
|
-
static completeRegistration(): {
|
|
162
|
+
static completeRegistration(customer: IkasCustomer): {
|
|
176
163
|
event: string;
|
|
164
|
+
customer: IkasCustomer;
|
|
177
165
|
} | undefined;
|
|
178
166
|
static search(searchKeyword: string): {
|
|
179
167
|
event: string;
|
|
@@ -192,13 +180,16 @@ export declare class GoogleTagManager {
|
|
|
192
180
|
}[];
|
|
193
181
|
};
|
|
194
182
|
} | undefined;
|
|
195
|
-
static customerLogin(
|
|
183
|
+
static customerLogin(customer: any): {
|
|
184
|
+
event: string;
|
|
185
|
+
customer: any;
|
|
186
|
+
} | undefined;
|
|
187
|
+
static customerLogout(): {
|
|
196
188
|
event: string;
|
|
197
|
-
email: string;
|
|
198
189
|
} | undefined;
|
|
199
|
-
static customerVisit(
|
|
190
|
+
static customerVisit(customer: any): {
|
|
200
191
|
event: string;
|
|
201
|
-
|
|
192
|
+
customer: any;
|
|
202
193
|
} | undefined;
|
|
203
194
|
static viewCart(cart: IkasCart): {
|
|
204
195
|
event: string;
|
|
@@ -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
|
|
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/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/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/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 o}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 r}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"@ikas/storefront-config";import"lodash/get";import a from"lodash/cloneDeep";var i="undefined"==typeof window,s=function(){function s(){e(this)}return s.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[d(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]:""}}};return!i&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},s.addToCart=function(e,o){var a=r.getInstance().cartStore.cart;try{var s={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof t?d(e,o):n(e,o)],cart:a}};return!i&&window.dataLayer&&window.dataLayer.push(s),s}catch(e){console.error(e)}},s.removeFromCart=function(e,o){var a=r.getInstance().cartStore.cart;try{var s={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof t?d(e,o):n(e,o)],cart:0===(null==a?void 0:a.itemCount)?null:a}};return!i&&window.dataLayer&&window.dataLayer.push(s),s}catch(e){console.error(e)}},s.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return n(e,e.quantity)}))}};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s.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 n(e,e.quantity)}))}}};return!i&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},s.checkoutStep=function(e,t){var r,s,d=a(e);null===(r=d.shippingAddress)||void 0===r||delete r.checkoutSettings,null===(s=d.billingAddress)||void 0===s||delete s.checkoutSettings;var n="";t===o.INFO?n="checkout_info-GTM":t===o.SHIPPING?n="checkout_shipping-GTM":t===o.PAYMENT?n="checkout_payment-GTM":t===o.SUCCESS&&(n="checkout_success-GTM");try{var m={event:n,ecommerce:{cart:d}};return!i&&window.dataLayer&&window.dataLayer.push(m),m}catch(e){console.error(e)}},s.disableHTML=function(){try{!i&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},s.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s.search=function(e){try{var t={event:"search-GTM",search_string:e};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s.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!i&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},s.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!i&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},s.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!i&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},s}();function d(e,t){var o;return void 0===t&&(t=1),{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:e.categories.length?e.categories[0].name:"",item_category_2:e.categories.length>1?e.categories[1].name:"",item_category_3:e.categories.length>2?e.categories[2].name:"",item_category_4:e.categories.length>3?e.categories[3].name:"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function n(e,t){var o;return void 0===t&&(t=1),{item_name:e.variant.name,item_id:e.variant.id,price:""+e.finalPrice,item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:"",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{s as GoogleTagManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";import e from"html-react-parser";import{getIkasEventsScript as n}from"../events.js";import{observer as
|
|
1
|
+
import*as t from"react";import e from"html-react-parser";import{getIkasEventsScript as n}from"../events.js";import{observer as r}from"mobx-react-lite";import{IkasStorefrontConfig as a}from"@ikas/storefront-config";var o=r((function(){var r=a.getGtmId(),o=a.getFbpId(),i=a.getAnalytics4Id(),s=a.getTiktokPixelId(),c=a.getIsEditor(),l=a.getStorefrontJSScripts(),m=a.getHighPriorityStorefrontJSScripts();return t.createElement(t.Fragment,null,m.map((function(t){return e(t)})),r&&!c&&t.createElement("script",{defer:!0,dangerouslySetInnerHTML:{__html:"(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(r,"');")}}),!!o&&!c&&t.createElement("script",{defer:!0,dangerouslySetInnerHTML:{__html:"!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '".concat(o,"');\n fbq('track', 'PageView');")}}),i&&!c&&t.createElement(t.Fragment,null,t.createElement("script",{async:!0,src:"https://www.googletagmanager.com/gtag/js?id=".concat(i)}),t.createElement("script",{defer:!0,dangerouslySetInnerHTML:{__html:"window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '".concat(i,"');")}})),!!s&&!c&&t.createElement("script",{defer:!0,dangerouslySetInnerHTML:{__html:'!function (w, d, t) {\n w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};\n ttq.load(\''.concat(s,"');\n ttq.page();\n }(window, document, 'ttq');")}}),e(n()),l.map((function(t){return e(t)})))})),i=function(){var e=a.getGtmId(),n=a.getFbpId(),r=a.getIsEditor();return t.createElement(t.Fragment,null,e&&!r&&t.createElement("noscript",{dangerouslySetInnerHTML:{__html:'<iframe src="https://www.googletagmanager.com/ns.html?id='.concat(e,'" height="0" width="0" style="display:none;visibility:hidden"></iframe>')}}),n&&!r&&t.createElement("noscript",{dangerouslySetInnerHTML:{__html:'<img height="1" width="1" style="display:none" \n src="https://www.facebook.com/tr?id='.concat(n,'&ev=PageView&noscript=1"/>')}}))};export{i as AnalyticsBody,o as AnalyticsHead};
|
package/build/analytics/ikas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as s}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as r}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/country-settings-model.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/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/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/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/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/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/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";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";var n,a;!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"}(n||(n={})),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"}(a||(a={}));var d=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",c=function(){function c(){}return c.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]]}}))}))},c.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,s,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 s=e.sent(),console.error(s),[3,4];case 4:return[2]}}))}))},c.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,s,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(s=JSON.parse(t)).expiry<Date.now()||s.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=s.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 r=e.sent(),console.error(r),[3,8];case 8:return[2]}}))}))},c.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,s,r;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 s=this,[4,this.createUUID()];case 2:s.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 r=e.sent(),console.error(r),[3,5];case 5:return[2]}}))}))},c.getPageType=function(t){switch(t){case o.INDEX:return a.INDEX;case o.CATEGORY:return a.CATEGORY;case o.BRAND:return a.BRAND;case o.PRODUCT:return a.PRODUCT;case o.CUSTOM:return a.CUSTOM;case o.ACCOUNT:return a.ACCOUNT;case o.ADDRESSES:return a.ADDRESSES;case o.ORDERS:return a.ORDERS;case o.ORDER_DETAIL:return a.ORDER_DETAIL;case o.LOGIN:return a.LOGIN;case o.REGISTER:return a.REGISTER;case o.FORGOT_PASSWORD:return a.FORGOT_PASSWORD;case o.RECOVER_PASSWORD:return a.RECOVER_PASSWORD;case o.CART:return a.CART;case o.FAVORITE_PRODUCTS:return a.FAVORITE_PRODUCTS;case o.SEARCH:return a.SEARCH;case o.NOT_FOUND:return a.NOT_FOUND;case o.BLOG:return a.BLOG;case o.BLOG_INDEX:return a.BLOG_INDEX;case o.BLOG_CATEGORY:return a.BLOG_CATEGORY;case o.CHECKOUT:return a.CHECKOUT}},c.getCustomerData=function(){var t=r.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}},c.getCommonEventData=function(){var t=r.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0}},c.sendEvents=function(s){var o;return t(this,void 0,void 0,(function(){var t,n,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),[4,this.checkSessionId()];case 1:return e.sent(),[4,this.checkVisitorId()];case 2:return e.sent(),t=r.getInstance(),n={e:s,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,vid:this.visitorId,cid:null===(o=t.customerStore.customer)||void 0===o?void 0:o.id},[4,fetch(d,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 3:return e.sent(),[3,5];case 4:return a=e.sent(),console.error(a),[3,5];case 5:return[2]}}))}))},c.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:n.SESSION_START,ts:Date.now(),d:s({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.pageView=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:n.PAGE_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.productView=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:n.PRODUCT_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{pr:{id:i.id,vid:i.selectedVariant.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.addToCart=function(i,r,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:n.ADD_TO_CART,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{crt:{id:o.id,c:o.itemCount},crtItm:{id:i.id,c:r}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.viewCart=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:n.VIEW_CART,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.itemCount}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.orderSuccess=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:n.ORDER_SUCCESS,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success"}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[4,this.createSessionId()];case 2:return e.sent(),[2]}}))}))},c.beginCheckout=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:n.BEGIN_CHECKOUT,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{chk:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.checkoutStep=function(i,r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:n.CHECKOUT_STEP,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{chk:{id:i.id,s:r}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.customerRegister=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:n.CUSTOMER_REGISTER,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.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:n.CUSTOMER_LOGIN,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.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:n.CUSTOMER_VISIT,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.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:n.BRAND_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.viewCategory=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:n.CATEGORY_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.SESSION_ID_KEY="ikas_session_id",c.VISITOR_ID_KEY="ikas_visitor_id",c.EXPIRY_LENGTH=18e5,c}();export{c as default};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as s}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as r}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/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/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/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";var n,a;!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"}(n||(n={})),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"}(a||(a={}));var d=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",c=function(){function c(){}return c.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]]}}))}))},c.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,s,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 s=e.sent(),console.error(s),[3,4];case 4:return[2]}}))}))},c.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,s,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(s=JSON.parse(t)).expiry<Date.now()||s.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=s.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 r=e.sent(),console.error(r),[3,8];case 8:return[2]}}))}))},c.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,s,r;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 s=this,[4,this.createUUID()];case 2:s.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 r=e.sent(),console.error(r),[3,5];case 5:return[2]}}))}))},c.getPageType=function(t){switch(t){case o.INDEX:return a.INDEX;case o.CATEGORY:return a.CATEGORY;case o.BRAND:return a.BRAND;case o.PRODUCT:return a.PRODUCT;case o.CUSTOM:return a.CUSTOM;case o.ACCOUNT:return a.ACCOUNT;case o.ADDRESSES:return a.ADDRESSES;case o.ORDERS:return a.ORDERS;case o.ORDER_DETAIL:return a.ORDER_DETAIL;case o.LOGIN:return a.LOGIN;case o.REGISTER:return a.REGISTER;case o.FORGOT_PASSWORD:return a.FORGOT_PASSWORD;case o.RECOVER_PASSWORD:return a.RECOVER_PASSWORD;case o.ACTIVATE_CUSTOMER:return a.ACTIVATE_CUSTOMER;case o.CART:return a.CART;case o.FAVORITE_PRODUCTS:return a.FAVORITE_PRODUCTS;case o.SEARCH:return a.SEARCH;case o.NOT_FOUND:return a.NOT_FOUND;case o.BLOG:return a.BLOG;case o.BLOG_INDEX:return a.BLOG_INDEX;case o.BLOG_CATEGORY:return a.BLOG_CATEGORY;case o.CHECKOUT:return a.CHECKOUT}},c.getCustomerData=function(){var t=r.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}},c.getCommonEventData=function(){var t=r.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0}},c.sendEvents=function(s){var o;return t(this,void 0,void 0,(function(){var t,n,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,(t=r.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),n={e:s,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,vid:this.visitorId,cid:null===(o=t.customerStore.customer)||void 0===o?void 0:o.id},[4,fetch(d,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 4:return e.sent(),[3,6];case 5:return a=e.sent(),console.error(a),[3,6];case 6:return[2]}}))}))},c.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:n.SESSION_START,ts:Date.now(),d:s({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.pageView=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:n.PAGE_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.productView=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:n.PRODUCT_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{pr:{id:i.id,vid:i.selectedVariant.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.addToCart=function(i,r,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:n.ADD_TO_CART,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{crt:{id:o.id,c:o.itemCount},crtItm:{id:i.id,c:r}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.viewCart=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:n.VIEW_CART,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.itemCount}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.orderSuccess=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:n.ORDER_SUCCESS,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success"}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[4,this.createSessionId()];case 2:return e.sent(),[2]}}))}))},c.beginCheckout=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:n.BEGIN_CHECKOUT,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{chk:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.checkoutStep=function(i,r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:n.CHECKOUT_STEP,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{chk:{id:i.id,s:r}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.customerRegister=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:n.CUSTOMER_REGISTER,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.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:n.CUSTOMER_LOGIN,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.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:n.CUSTOMER_VISIT,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.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:n.BRAND_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.viewCategory=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:n.CATEGORY_VIEW,ts:Date.now(),d:s(s({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},c.SESSION_ID_KEY="ikas_session_id",c.VISITOR_ID_KEY="ikas_visitor_id",c.EXPIRY_LENGTH=18e5,c}();export{c as default};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IkasCheckout, IkasProduct, IkasOrderLineItem, IkasCategory } from "../models";
|
|
2
2
|
export declare class TiktokPixel {
|
|
3
3
|
constructor();
|
|
4
|
+
private static get tiktokPixelId();
|
|
4
5
|
static productView(productDetail: IkasProduct): void;
|
|
5
6
|
static addToCart(item: IkasOrderLineItem, quantity: number): void;
|
|
6
7
|
static beginCheckout(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as t}from"mobx";import{IkasBaseStore as
|
|
1
|
+
import{makeAutoObservable as t}from"mobx";import{IkasBaseStore as e}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import{IkasStorefrontConfig as n}from"@ikas/storefront-config";var o="undefined"==typeof window,r=function(){function e(){t(this)}return Object.defineProperty(e,"tiktokPixelId",{get:function(){return n.getTiktokPixelId()},enumerable:!1,configurable:!0}),e.productView=function(t){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("ViewContent",function(t,e){void 0===e&&(e=1);return{content_type:"product",quantity:e,content_id:t.selectedVariant.id,value:t.selectedVariant.price.finalPrice,currency:""===t.selectedVariant.price.currency?"TRY":t.selectedVariant.price.currency}}(t)))}catch(t){console.error(t)}},e.addToCart=function(t,e){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("AddToCart",function(t,e){void 0===e&&(e=1);return{content_id:t.variant.id,content_type:"product",content_name:t.variant.name,quantity:e,value:t.finalPrice,currency:t.currencyCode}}(t,e)))}catch(t){console.error(t)}},e.beginCheckout=function(){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("InitiateCheckout"))}catch(t){console.error(t)}},e.purchase=function(t){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("CompletePayment",function(t){var e=[];return null==t||t.items.map((function(t){e.push({content_id:t.variant.id,content_type:"product",content_name:t.variant.name,price:t.finalPrice,quantity:t.quantity})})),{contents:e,content_type:"product_group",currency:t.items[0].currencyCode,value:t.totalPrice}}(t)))}catch(t){console.error(t)}},e.addToWishlist=function(t){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("AddToWishlist",{content_id:t}))}catch(t){console.error(t)}},e.search=function(t){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("Search",{query:t,content_id:"Search"}))}catch(t){console.error(t)}},e.completeRegistration=function(){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("CompleteRegistration"))}catch(t){console.error(t)}},e.viewCategory=function(t){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("ViewContent",{content_id:t.id,content_type:"product_group",content_category:t.name}))}catch(t){console.error(t)}},e.contactForm=function(){try{return i(),void(!o&&this.tiktokPixelId&&window.ttq&&window.ttq.track("Contact"))}catch(t){console.error(t)}},e}();function i(){try{var t=e.getInstance().customerStore.customer;if(!t)return;return void(!o&&n.getTiktokPixelId()&&window.ttq&&window.ttq.identify({external_id:t.id,email:t.email,phone_number:t.phone||""}))}catch(t){console.error(t)}}export{r as TiktokPixel};
|
|
@@ -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,BillingAddressFormItem as c}from"../../../../models/data/checkout/country-settings-model.js";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(S,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(L,e({},n,{vm:i}));case u.STATE:return r.createElement(k,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(O,e({},n,{vm:i})):r.createElement(I,e({},n,{vm:i}));case u.PHONE:return r.createElement(S,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=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.postalCode)||void 0===o?void 0:o.label)||s("checkout-page:postalCode"),autocomplete:"postal-code",value:i.address.postalCode||"",onChange:i.onAddressPostalCodeChange,hasError:i.isErrorsVisible&&(null===(n=i.address.validationResults)||void 0===n?void 0:n.postalCode.hasError),errorText:s("checkout-page:postalCodeError")})})),L=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")})})),k=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")})})),I=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")})})),O=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,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=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.taxOffice)||void 0===o?void 0:o.label)||s("checkout-page:taxOffice"),value:(null===(n=i.address)||void 0===n?void 0:n.taxOffice)||"",onChange:i.onTaxOfficeChange})})),X=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.taxNumber)||void 0===o?void 0:o.label)||s("checkout-page:taxNumber"),value:(null===(n=i.address)||void 0===n?void 0:n.taxNumber)||"",onChange:i.onTaxNumberChange})}));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 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(g,e({},a,{vm:l})),r.createElement(f,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(j,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(g,e({},n,{vm:i}));case u.LASTNAME:return r.createElement(f,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(j,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(A,e({},n,{vm:i}));case c.TAX_NUMBER:return r.createElement(X,e({},n,{vm:i}));case c.TAX_OFFICE: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)," "))};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)}))))})),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.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")})})),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.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=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.postalCode)||void 0===o?void 0:o.label)||s("checkout-page:postalCode"),autocomplete:"postal-code",value:i.address.postalCode||"",onChange:i.onAddressPostalCodeChange,hasError:i.isErrorsVisible&&(null===(n=i.address.validationResults)||void 0===n?void 0:n.postalCode.hasError),errorText:s("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")})})),j=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")})})),A=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})})),V=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.taxOffice)||void 0===o?void 0:o.label)||s("checkout-page:taxOffice"),value:(null===(n=i.address)||void 0===n?void 0:n.taxOffice)||"",onChange:i.onTaxOfficeChange})})),X=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.taxNumber)||void 0===o?void 0:o.label)||s("checkout-page:taxNumber"),value:(null===(n=i.address)||void 0===n?void 0:n.taxNumber)||"",onChange:i.onTaxNumberChange})}));export{E as AddressForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IkasCountry, IkasState, IkasCity, IkasDistrict, IkasOrderAddressCountry, IkasOrderAddressCity, IkasOrderAddressDistrict, IkasLocalizedCustomerAddress } from "../../../../models";
|
|
1
|
+
import { IkasCountry, IkasState, IkasCity, IkasDistrict, IkasOrderAddressCountry, IkasOrderAddressCity, IkasOrderAddressDistrict, IkasLocalizedCustomerAddress, IkasShippingZoneRegion, IkasOrderAddressRegion } from "../../../../models";
|
|
2
2
|
import IkasLocalizedOrderAddress from "../../../../models/data/order/address/ikas-localized-order-address";
|
|
3
3
|
declare type Callback = ((value: string) => void) | null | undefined;
|
|
4
4
|
export interface AddressFormViewModelParams {
|
|
@@ -33,10 +33,16 @@ export default class AddressFormViewModel {
|
|
|
33
33
|
get lastName(): string;
|
|
34
34
|
get phone(): string | null;
|
|
35
35
|
get identityNumber(): string | null;
|
|
36
|
+
get shippingZone(): import("../../../../models").IkasShippingZone | undefined;
|
|
37
|
+
get shippingZoneState(): import("../../../../models").IkasShippingZoneState | undefined;
|
|
38
|
+
get shippingZoneCity(): import("../../../../models").IkasShippingZoneCity | undefined;
|
|
39
|
+
get shippingZoneDistrict(): import("../../../../models").IkasShippingZoneDistrict | undefined;
|
|
40
|
+
get shippingZoneRegions(): IkasShippingZoneRegion | undefined;
|
|
36
41
|
get country(): IkasOrderAddressCountry | import("../../../../models").IkasCustomerAddressCountry | null;
|
|
37
42
|
get state(): import("../../../../models").IkasOrderAddressState | import("../../../../models").IkasCustomerAddressState | null;
|
|
38
43
|
get city(): IkasOrderAddressCity | import("../../../../models").IkasCustomerAddressCity | null;
|
|
39
44
|
get district(): IkasOrderAddressDistrict | import("../../../../models").IkasCustomerAddressDistrict | null;
|
|
45
|
+
get region(): IkasOrderAddressRegion | import("../../../../models").IkasCustomerAddressRegion | null;
|
|
40
46
|
get countryOptions(): {
|
|
41
47
|
label: string;
|
|
42
48
|
value: string;
|
|
@@ -53,6 +59,10 @@ export default class AddressFormViewModel {
|
|
|
53
59
|
label: string;
|
|
54
60
|
value: string;
|
|
55
61
|
}[];
|
|
62
|
+
get regionOptions(): {
|
|
63
|
+
label: string;
|
|
64
|
+
value: string;
|
|
65
|
+
}[];
|
|
56
66
|
get hasState(): boolean;
|
|
57
67
|
get isFreeTextCity(): boolean;
|
|
58
68
|
get isDistrictHidden(): boolean;
|
|
@@ -61,7 +71,7 @@ export default class AddressFormViewModel {
|
|
|
61
71
|
listStates: () => Promise<void>;
|
|
62
72
|
listCities: () => Promise<void>;
|
|
63
73
|
listDistricts: () => Promise<void>;
|
|
64
|
-
modelToOption: (model: IkasCountry | IkasState | IkasCity | IkasDistrict) => {
|
|
74
|
+
modelToOption: (model: IkasCountry | IkasState | IkasCity | IkasDistrict | IkasShippingZoneRegion) => {
|
|
65
75
|
label: string;
|
|
66
76
|
value: string;
|
|
67
77
|
};
|
|
@@ -79,6 +89,7 @@ export default class AddressFormViewModel {
|
|
|
79
89
|
onCityInputChange: (value: string) => void;
|
|
80
90
|
onDistrictChange: (districtId: string) => void;
|
|
81
91
|
onDistrictInputChange: (value: string) => void;
|
|
92
|
+
onRegionChange: (regionId: string) => void;
|
|
82
93
|
onCorporateChange: (value: boolean) => void;
|
|
83
94
|
onCompanyChange: (value: string) => void;
|
|
84
95
|
onTaxNumberChange: (value: string) => void;
|