@ikas/storefront 6.1.0-beta.363 → 6.1.0-beta.365
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.
|
@@ -17,6 +17,8 @@ export declare class Analytics {
|
|
|
17
17
|
orderCount: number | null;
|
|
18
18
|
subscriptionStatus: import("@ikas/storefront-models/build-cjs/models/customer").IkasCustomerEmailSubscriptionStatus | null;
|
|
19
19
|
} | null>;
|
|
20
|
+
static saveCustomerOrderCountSnapshot(): void;
|
|
21
|
+
static getNewCustomer(checkout: IkasCheckout): boolean | undefined;
|
|
20
22
|
static pageView(pageType: IkasThemeJsonPageType): Promise<void>;
|
|
21
23
|
static productView(productDetail: IkasProduct): Promise<void>;
|
|
22
24
|
static addToCart(item: IkasOrderLineItem, quantity: number, eventId: string, cart: IkasCart, product?: 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 n}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as d}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import{IkasStorefrontPopup as c}from"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{FacebookPixel as l}from"./facebookPixel.js";import{GoogleTagManager as u}from"./googleTagManager.js";import{IkasEventType as m}from"./events.js";import p from"lodash/cloneDeep";import{tryForEach as v}from"../utils/helper.js";import f from"./ikasV3.js";import{GoogleAnalytics as b}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,i,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),[4,f.checkJourneyId()];case 1:return e.sent(),t=window.location.href,[4,j.getCustomerInfo()];case 2:return o=e.sent(),i=Date.now().toString(),u.pageView(t),l.pageView(t,i),[4,f.pageView(r,i)];case 3:return e.sent(),h.pageView(t),v(j.subscribers,(function(e){e.callback({type:m.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},j.productView=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=Date.now().toString(),l.productView(r,t),u.productView(r),[4,f.productView(r,t)];case 1:return e.sent(),b.productView(r),h.productView(r),j.subscribers.length&&(o=new d(p(r)),v(j.subscribers,(function(t){t.callback({type:m.PRODUCT_VIEW,data:{productDetail:o}})}))),[3,3];case 2:return i=e.sent(),console.error(i),[3,3];case 3:return[2]}}))}))},j.addToCart=function(t,e,r,o,i){try{if(l.addToCart(t,e,r),u.addToCart(t,e,i),f.addToCart(t,e,o,r),b.addToCart(t,e),h.addToCart(t,e),j.subscribers.length){var a=p(t),n=new s(p(o));v(j.subscribers,(function(t){t.callback({type:m.ADD_TO_CART,data:{item:a,quantity:e,cart:n}})}))}}catch(t){console.error(t)}},j.removeFromCart=function(t,e,r){try{if(u.removeFromCart(t,e),b.removeFromCart(t,e),j.subscribers.length){var o=p(t),i=new s(p(r));v(j.subscribers,(function(t){t.callback({type:m.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:i}})}))}}catch(t){console.error(t)}},j.beginCheckout=function(t){var e,r,o,i,s,a,d,c,g,y,x;try{var w=localStorage.getItem("gtmBeginCheckout");if(w&&t.id===w)return;localStorage.setItem("gtmBeginCheckout",t.id),l.initAdvancedMatching({em:null===(e=t.customer)||void 0===e?void 0:e.email,fn:(null===(r=t.customer)||void 0===r?void 0:r.firstName)||(null===(o=t.shippingAddress)||void 0===o?void 0:o.firstName),ln:(null===(i=t.customer)||void 0===i?void 0:i.lastName)||(null===(s=t.shippingAddress)||void 0===s?void 0:s.lastName),ph:null===(a=t.shippingAddress)||void 0===a?void 0:a.phone,external_id:t.customerId,ct:null===(c=null===(d=t.shippingAddress)||void 0===d?void 0:d.city)||void 0===c?void 0:c.name,zp:null===(g=t.shippingAddress)||void 0===g?void 0:g.postalCode,country:null===(x=null===(y=t.shippingAddress)||void 0===y?void 0:y.country)||void 0===x?void 0:x.iso2});var C=Date.now().toString();if(l.beginCheckout(t,C),u.beginCheckout(t),f.beginCheckout(t,C),b.beginCheckout(t),h.beginCheckout(t),j.subscribers.length){var k=new n(p(t));v(j.subscribers,(function(t){t.callback({type:m.BEGIN_CHECKOUT,data:{checkout:k}})}))}}catch(t){console.error(t)}},j.purchase=function(t,e){var r,o,i,s,a,d,c,g,y,x,w;try{if(localStorage.removeItem("gtmBeginCheckout"),l.initAdvancedMatching({em:null===(r=t.customer)||void 0===r?void 0:r.email,fn:(null===(o=t.customer)||void 0===o?void 0:o.firstName)||(null===(i=t.shippingAddress)||void 0===i?void 0:i.firstName),ln:(null===(s=t.customer)||void 0===s?void 0:s.lastName)||(null===(a=t.shippingAddress)||void 0===a?void 0:a.lastName),ph:null===(d=t.shippingAddress)||void 0===d?void 0:d.phone,external_id:t.customerId,ct:null===(g=null===(c=t.shippingAddress)||void 0===c?void 0:c.city)||void 0===g?void 0:g.name,zp:null===(y=t.shippingAddress)||void 0===y?void 0:y.postalCode,country:null===(w=null===(x=t.shippingAddress)||void 0===x?void 0:x.country)||void 0===w?void 0:w.iso2}),l.purchase(t,e.id||""),u.purchase(t,t.orderNumber||""),f.orderSuccess(t,e.id||""),b.purchase(t,t.orderNumber||""),h.purchase(t),j.subscribers.length){var C=new n(p(t)),k=p(e);v(j.subscribers,(function(t){t.callback({type:m.COMPLETE_CHECKOUT,data:{checkout:C,transaction:k}})}))}}catch(t){console.error(t)}},j.checkoutStep=function(t,e,r){var o,i,s,a,d,c,h,g,y,x,w;try{l.initAdvancedMatching({em:null===(o=t.customer)||void 0===o?void 0:o.email,fn:(null===(i=t.customer)||void 0===i?void 0:i.firstName)||(null===(s=t.shippingAddress)||void 0===s?void 0:s.firstName),ln:(null===(a=t.customer)||void 0===a?void 0:a.lastName)||(null===(d=t.shippingAddress)||void 0===d?void 0:d.lastName),ph:null===(c=t.shippingAddress)||void 0===c?void 0:c.phone,external_id:t.customerId,ct:null===(g=null===(h=t.shippingAddress)||void 0===h?void 0:h.city)||void 0===g?void 0:g.name,zp:null===(y=t.shippingAddress)||void 0===y?void 0:y.postalCode,country:null===(w=null===(x=t.shippingAddress)||void 0===x?void 0:x.country)||void 0===w?void 0:w.iso2});var C=Date.now().toString();if(u.checkoutStep(t,e,r),f.checkoutStep(t,e,C),b.checkoutStep(t,e,r),l.checkoutStep(t,e,C),j.subscribers.length){var k=new n(p(t));v(j.subscribers,(function(t){t.callback({type:m.CHECKOUT_STEP,data:{checkout:k,step:e}})}))}}catch(t){console.error(t)}},j.disableHTML=function(){try{u.disableHTML()}catch(t){console.error(t)}},j.addToWishlist=function(t,e){try{var r=Date.now().toString();l.addToWishlist(t,r),h.addToWishlist(t),f.addToWishlist(t,r),b.addToWishlist(t),j.subscribers.length&&v(j.subscribers,(function(r){r.callback({type:e?m.REMOVE_FROM_WISHLIST:m.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},j.search=function(t,e){try{var r=Date.now().toString();l.search(t,r),u.search(t),h.search(t),b.search(t),f.search(t,r,e),j.subscribers.length&&v(j.subscribers,(function(e){e.callback({type:m.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},j.completeRegistration=function(t,e){try{var o=Date.now().toString();l.initAdvancedMatching({em:t.email,fn:t.firstName,ln:t.lastName,ph:t.phone,external_id:t.id}),e||(l.completeRegistration(o),u.completeRegistration(t),h.completeRegistration()),f.customerRegister(o),j.subscribers.length&&v(j.subscribers,(function(o){o.callback({type:m.CUSTOMER_REGISTER,data:r({email:t.email,firstName:t.firstName,lastName:t.lastName,notificationsAccepted:t.subscriptionStatus},e?{attributes:t.attributes}:{})})}))}catch(t){console.error(t)}},j.createEmailSubscripition=function(t){try{l.initAdvancedMatching({em:t}),j.subscribers.length&&v(j.subscribers,(function(e){e.callback({type:m.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,3,,4]),[4,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(l.initAdvancedMatching({em:t.email,fn:t.firstName,ln:t.lastName,ph:t.phone,external_id:t.id}),u.customerLogin(t),[4,f.customerLogin()]):[2];case 2:return e.sent(),j.subscribers.length&&v(j.subscribers,(function(e){e.callback({type:m.CUSTOMER_LOGIN,data:{customer:t}})})),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},j.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{u.customerLogout(),j.subscribers.length&&v(j.subscribers,(function(t){t.callback({type:m.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,3,,4]),[4,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(u.customerVisit(t),[4,f.customerVisit()]):[2];case 2:return e.sent(),j.subscribers.length&&v(j.subscribers,(function(e){e.callback({type:m.CUSTOMER_VISIT,data:{customer:t}})})),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},j.viewCart=function(t){try{if(t){var e=Date.now().toString();if(l.viewCart(t,e),f.viewCart(t,e),b.viewCart(t),u.viewCart(t),j.subscribers.length){var r=new s(p(t));v(j.subscribers,(function(t){t.callback({type:m.VIEW_CART,data:{cart:r}})}))}}}catch(t){console.error(t)}},j.viewCategory=function(t,e){try{var r=Date.now().toString();if(l.viewCategory(t,r),u.viewCategory(e,t),f.viewCategory(e,t,r),h.viewCategory(e),j.subscribers.length){var o=new a(p(e));v(j.subscribers,(function(e){e.callback({type:m.VIEW_CATEGORY,data:{categoryPath:t,category:o}})}))}}catch(t){console.error(t)}},j.viewBrand=function(t){try{if(f.viewBrand(t),j.subscribers.length){var e=new i(p(t));v(j.subscribers,(function(t){t.callback({type:m.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},j.viewStorefrontPopup=function(t){try{if(f.viewPopup(t.id),j.subscribers.length){var e=new c(p(t));v(j.subscribers,(function(t){t.callback({type:m.POPUP_VIEW,data:{popup:e}})}))}}catch(t){console.error(t)}},j.viewSearchResults=function(t,e){try{if(j.subscribers.length){var r=p(e).map((function(t){return new d(t)}));v(j.subscribers,(function(e){e.callback({type:m.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},j.viewListing=function(t){try{if(j.subscribers.length){var e=p(t).map((function(t){return new d(t)}));v(j.subscribers,(function(t){t.callback({type:m.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},j.contactForm=function(t){try{var e=Date.now().toString();if(l.contactForm(e),h.contactForm(),f.contactForm(e),j.subscribers.length){var r=p(t);v(j.subscribers,(function(t){t.callback({type:m.CONTACT_FORM,data:{form:r}})}))}}catch(t){console.error(t)}},j.addCouponCode=function(t){try{if(t&&j.subscribers.length){var e=new s(p(t));v(j.subscribers,(function(t){t.callback({type:m.ADD_COUPON_CODE,data:{cart:e}})}))}}catch(t){console.error(t)}},j.removeCouponCode=function(t){try{if(t&&j.subscribers.length){var e=new s(p(t));v(j.subscribers,(function(t){t.callback({type:m.REMOVE_COUPON_CODE,data:{cart:e}})}))}}catch(t){console.error(t)}},j.removeLoyaltyPoints=function(t){try{if(t&&j.subscribers.length){var e=new s(p(t));v(j.subscribers,(function(t){t.callback({type:m.REMOVE_LOYALTY_POINTS,data:{cart:e}})}))}}catch(t){console.error(t)}},j.subscribers=[],j}();export{j 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 i}from"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as s}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as a}from"../models/data/category/index.js";import{IkasCheckout as n}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as d}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import{IkasStorefrontPopup as c}from"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as u}from"../components/checkout/model.js";import{FacebookPixel as l}from"./facebookPixel.js";import{GoogleTagManager as m}from"./googleTagManager.js";import{IkasEventType as p}from"./events.js";import v from"lodash/cloneDeep";import{tryForEach as f}from"../utils/helper.js";import b from"./ikasV3.js";import{GoogleAnalytics as h}from"./googleAnalytics.js";import{TiktokPixel as g}from"./tiktokPixel.js";import{IkasBaseStore as j}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var y=function(){function y(){o(this)}return y.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]}}))}))},y.saveCustomerOrderCountSnapshot=function(){try{var t=j.getInstance().customerStore.customer;if(!t||!t.id||null===t.orderCount)return;localStorage.setItem("gtmCustomerOrderCount",JSON.stringify({customerId:t.id,orderCount:t.orderCount}))}catch(t){}},y.getNewCustomer=function(t){var e;try{if(!t.customerId||(null===(e=t.customer)||void 0===e?void 0:e.isGuestCheckout))return;var r=localStorage.getItem("gtmCustomerOrderCount");if(!r)return;var o=JSON.parse(r),i=o.customerId,s=o.orderCount;if(i!==t.customerId||"number"!=typeof s)return;return 0===s}catch(t){}},y.pageView=function(r){return t(this,void 0,void 0,(function(){var t,o,i,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),[4,b.checkJourneyId()];case 1:return e.sent(),t=window.location.href,[4,y.getCustomerInfo()];case 2:return o=e.sent(),i=Date.now().toString(),m.pageView(t),l.pageView(t,i),[4,b.pageView(r,i)];case 3:return e.sent(),g.pageView(t),f(y.subscribers,(function(e){e.callback({type:p.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},y.productView=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=Date.now().toString(),l.productView(r,t),m.productView(r),[4,b.productView(r,t)];case 1:return e.sent(),h.productView(r),g.productView(r),y.subscribers.length&&(o=new d(v(r)),f(y.subscribers,(function(t){t.callback({type:p.PRODUCT_VIEW,data:{productDetail:o}})}))),[3,3];case 2:return i=e.sent(),console.error(i),[3,3];case 3:return[2]}}))}))},y.addToCart=function(t,e,r,o,i){try{if(l.addToCart(t,e,r),m.addToCart(t,e,i),b.addToCart(t,e,o,r),h.addToCart(t,e),g.addToCart(t,e),y.subscribers.length){var a=v(t),n=new s(v(o));f(y.subscribers,(function(t){t.callback({type:p.ADD_TO_CART,data:{item:a,quantity:e,cart:n}})}))}}catch(t){console.error(t)}},y.removeFromCart=function(t,e,r){try{if(m.removeFromCart(t,e),h.removeFromCart(t,e),y.subscribers.length){var o=v(t),i=new s(v(r));f(y.subscribers,(function(t){t.callback({type:p.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:i}})}))}}catch(t){console.error(t)}},y.beginCheckout=function(t){var e,r,o,i,s,a,d,c,u,j,C;try{var x=localStorage.getItem("gtmBeginCheckout");if(x&&t.id===x)return;localStorage.setItem("gtmBeginCheckout",t.id),y.saveCustomerOrderCountSnapshot(),l.initAdvancedMatching({em:null===(e=t.customer)||void 0===e?void 0:e.email,fn:(null===(r=t.customer)||void 0===r?void 0:r.firstName)||(null===(o=t.shippingAddress)||void 0===o?void 0:o.firstName),ln:(null===(i=t.customer)||void 0===i?void 0:i.lastName)||(null===(s=t.shippingAddress)||void 0===s?void 0:s.lastName),ph:null===(a=t.shippingAddress)||void 0===a?void 0:a.phone,external_id:t.customerId,ct:null===(c=null===(d=t.shippingAddress)||void 0===d?void 0:d.city)||void 0===c?void 0:c.name,zp:null===(u=t.shippingAddress)||void 0===u?void 0:u.postalCode,country:null===(C=null===(j=t.shippingAddress)||void 0===j?void 0:j.country)||void 0===C?void 0:C.iso2});var w=Date.now().toString();if(l.beginCheckout(t,w),m.beginCheckout(t),b.beginCheckout(t,w),h.beginCheckout(t),g.beginCheckout(t),y.subscribers.length){var S=new n(v(t));f(y.subscribers,(function(t){t.callback({type:p.BEGIN_CHECKOUT,data:{checkout:S}})}))}}catch(t){console.error(t)}},y.purchase=function(t,e){var r,o,i,s,a,d,c,u,j,C,x;try{var w=y.getNewCustomer(t);if(localStorage.removeItem("gtmBeginCheckout"),localStorage.removeItem("gtmCustomerOrderCount"),l.initAdvancedMatching({em:null===(r=t.customer)||void 0===r?void 0:r.email,fn:(null===(o=t.customer)||void 0===o?void 0:o.firstName)||(null===(i=t.shippingAddress)||void 0===i?void 0:i.firstName),ln:(null===(s=t.customer)||void 0===s?void 0:s.lastName)||(null===(a=t.shippingAddress)||void 0===a?void 0:a.lastName),ph:null===(d=t.shippingAddress)||void 0===d?void 0:d.phone,external_id:t.customerId,ct:null===(u=null===(c=t.shippingAddress)||void 0===c?void 0:c.city)||void 0===u?void 0:u.name,zp:null===(j=t.shippingAddress)||void 0===j?void 0:j.postalCode,country:null===(x=null===(C=t.shippingAddress)||void 0===C?void 0:C.country)||void 0===x?void 0:x.iso2}),l.purchase(t,e.id||""),m.purchase(t,t.orderNumber||"",w),b.orderSuccess(t,e.id||""),h.purchase(t,t.orderNumber||""),g.purchase(t),y.subscribers.length){var S=new n(v(t)),k=v(e);f(y.subscribers,(function(t){t.callback({type:p.COMPLETE_CHECKOUT,data:{checkout:S,transaction:k}})}))}}catch(t){console.error(t)}},y.checkoutStep=function(t,e,r){var o,i,s,a,d,c,g,j,C,x,w;try{l.initAdvancedMatching({em:null===(o=t.customer)||void 0===o?void 0:o.email,fn:(null===(i=t.customer)||void 0===i?void 0:i.firstName)||(null===(s=t.shippingAddress)||void 0===s?void 0:s.firstName),ln:(null===(a=t.customer)||void 0===a?void 0:a.lastName)||(null===(d=t.shippingAddress)||void 0===d?void 0:d.lastName),ph:null===(c=t.shippingAddress)||void 0===c?void 0:c.phone,external_id:t.customerId,ct:null===(j=null===(g=t.shippingAddress)||void 0===g?void 0:g.city)||void 0===j?void 0:j.name,zp:null===(C=t.shippingAddress)||void 0===C?void 0:C.postalCode,country:null===(w=null===(x=t.shippingAddress)||void 0===x?void 0:x.country)||void 0===w?void 0:w.iso2}),e!==u.SUCCESS&&y.saveCustomerOrderCountSnapshot();var S=Date.now().toString();if(m.checkoutStep(t,e,r),b.checkoutStep(t,e,S),h.checkoutStep(t,e,r),l.checkoutStep(t,e,S),y.subscribers.length){var k=new n(v(t));f(y.subscribers,(function(t){t.callback({type:p.CHECKOUT_STEP,data:{checkout:k,step:e}})}))}}catch(t){console.error(t)}},y.disableHTML=function(){try{m.disableHTML()}catch(t){console.error(t)}},y.addToWishlist=function(t,e){try{var r=Date.now().toString();l.addToWishlist(t,r),g.addToWishlist(t),b.addToWishlist(t,r),h.addToWishlist(t),y.subscribers.length&&f(y.subscribers,(function(r){r.callback({type:e?p.REMOVE_FROM_WISHLIST:p.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},y.search=function(t,e){try{var r=Date.now().toString();l.search(t,r),m.search(t),g.search(t),h.search(t),b.search(t,r,e),y.subscribers.length&&f(y.subscribers,(function(e){e.callback({type:p.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},y.completeRegistration=function(t,e){try{var o=Date.now().toString();l.initAdvancedMatching({em:t.email,fn:t.firstName,ln:t.lastName,ph:t.phone,external_id:t.id}),e||(l.completeRegistration(o),m.completeRegistration(t),g.completeRegistration()),b.customerRegister(o),y.subscribers.length&&f(y.subscribers,(function(o){o.callback({type:p.CUSTOMER_REGISTER,data:r({email:t.email,firstName:t.firstName,lastName:t.lastName,notificationsAccepted:t.subscriptionStatus},e?{attributes:t.attributes}:{})})}))}catch(t){console.error(t)}},y.createEmailSubscripition=function(t){try{l.initAdvancedMatching({em:t}),y.subscribers.length&&f(y.subscribers,(function(e){e.callback({type:p.EMAIL_SUBSCRIPTION,data:{email:t}})}))}catch(t){console.error(t)}},y.customerLogin=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,y.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(l.initAdvancedMatching({em:t.email,fn:t.firstName,ln:t.lastName,ph:t.phone,external_id:t.id}),m.customerLogin(t),[4,b.customerLogin()]):[2];case 2:return e.sent(),y.subscribers.length&&f(y.subscribers,(function(e){e.callback({type:p.CUSTOMER_LOGIN,data:{customer:t}})})),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},y.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{m.customerLogout(),y.subscribers.length&&f(y.subscribers,(function(t){t.callback({type:p.CUSTOMER_LOGOUT,data:{}})}))}catch(t){console.error(t)}return[2]}))}))},y.customerVisit=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,y.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerVisit(t),[4,b.customerVisit()]):[2];case 2:return e.sent(),y.subscribers.length&&f(y.subscribers,(function(e){e.callback({type:p.CUSTOMER_VISIT,data:{customer:t}})})),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},y.viewCart=function(t){try{if(t){var e=Date.now().toString();if(l.viewCart(t,e),b.viewCart(t,e),h.viewCart(t),m.viewCart(t),y.subscribers.length){var r=new s(v(t));f(y.subscribers,(function(t){t.callback({type:p.VIEW_CART,data:{cart:r}})}))}}}catch(t){console.error(t)}},y.viewCategory=function(t,e){try{var r=Date.now().toString();if(l.viewCategory(t,r),m.viewCategory(e,t),b.viewCategory(e,t,r),g.viewCategory(e),y.subscribers.length){var o=new a(v(e));f(y.subscribers,(function(e){e.callback({type:p.VIEW_CATEGORY,data:{categoryPath:t,category:o}})}))}}catch(t){console.error(t)}},y.viewBrand=function(t){try{if(b.viewBrand(t),y.subscribers.length){var e=new i(v(t));f(y.subscribers,(function(t){t.callback({type:p.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},y.viewStorefrontPopup=function(t){try{if(b.viewPopup(t.id),y.subscribers.length){var e=new c(v(t));f(y.subscribers,(function(t){t.callback({type:p.POPUP_VIEW,data:{popup:e}})}))}}catch(t){console.error(t)}},y.viewSearchResults=function(t,e){try{if(y.subscribers.length){var r=v(e).map((function(t){return new d(t)}));f(y.subscribers,(function(e){e.callback({type:p.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},y.viewListing=function(t){try{if(y.subscribers.length){var e=v(t).map((function(t){return new d(t)}));f(y.subscribers,(function(t){t.callback({type:p.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},y.contactForm=function(t){try{var e=Date.now().toString();if(l.contactForm(e),g.contactForm(),b.contactForm(e),y.subscribers.length){var r=v(t);f(y.subscribers,(function(t){t.callback({type:p.CONTACT_FORM,data:{form:r}})}))}}catch(t){console.error(t)}},y.addCouponCode=function(t){try{if(t&&y.subscribers.length){var e=new s(v(t));f(y.subscribers,(function(t){t.callback({type:p.ADD_COUPON_CODE,data:{cart:e}})}))}}catch(t){console.error(t)}},y.removeCouponCode=function(t){try{if(t&&y.subscribers.length){var e=new s(v(t));f(y.subscribers,(function(t){t.callback({type:p.REMOVE_COUPON_CODE,data:{cart:e}})}))}}catch(t){console.error(t)}},y.removeLoyaltyPoints=function(t){try{if(t&&y.subscribers.length){var e=new s(v(t));f(y.subscribers,(function(t){t.callback({type:p.REMOVE_LOYALTY_POINTS,data:{cart:e}})}))}}catch(t){console.error(t)}},y.subscribers=[],y}();export{y as Analytics};
|
|
@@ -97,10 +97,11 @@ export declare class GoogleTagManager {
|
|
|
97
97
|
}[];
|
|
98
98
|
};
|
|
99
99
|
} | undefined;
|
|
100
|
-
static purchase(checkout: IkasCheckout, orderId: string): {
|
|
100
|
+
static purchase(checkout: IkasCheckout, orderId: string, newCustomer?: boolean): {
|
|
101
101
|
event: string;
|
|
102
102
|
ecommerce: {
|
|
103
103
|
purchase: {
|
|
104
|
+
new_customer?: boolean | undefined;
|
|
104
105
|
transaction_id: string;
|
|
105
106
|
affiliation: string;
|
|
106
107
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as o}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"@ikas/storefront-config";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import{IkasBaseStore as a}from"../store/base.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",sellPrice:e.selectedVariant.sellPrice,discountPrice:e.selectedVariant.discountPrice||0}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)})),customer:e.customer}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t,o){var a,d,n;if(!(o&&t===r.INFO&&o.isAccountRequired&&(null===(a=e.customer)||void 0===a?void 0:a.isGuestCheckout))){var m=i(e);null===(d=m.shippingAddress)||void 0===d||delete d.checkoutSettings,null===(n=m.billingAddress)||void 0===n||delete n.checkoutSettings;var c="";t===r.INFO?c="checkout_info-GTM":t===r.SHIPPING?c="checkout_shipping-GTM":t===r.PAYMENT?c="checkout_payment-GTM":t===r.SUCCESS&&(c="checkout_success-GTM");try{var p={event:c,ecommerce:{cart:m}};return!s&&window.dataLayer&&window.dataLayer.push(p),p}catch(e){console.error(e)}}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
|
|
1
|
+
import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}from"mobx";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as o}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"@ikas/storefront-config";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import{IkasBaseStore as a}from"../store/base.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function d(){t(this)}return d.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",sellPrice:e.selectedVariant.sellPrice,discountPrice:e.selectedVariant.discountPrice||0}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},d.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},d.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},d.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d.purchase=function(t,o,r){try{var a={event:"purchase-GTM",ecommerce:{purchase:e({transaction_id:o,affiliation:window.location.hostname,value:""+t.totalFinalPrice,tax:""+t.totalTax,shipping:""+t.shippingTotal,currency:t.currencyCode,coupon:t.couponCode,items:t.items.map((function(e){return m(e,e.quantity)})),customer:t.customer},void 0!==r?{new_customer:r}:{})}};return!s&&window.dataLayer&&window.dataLayer.push(a),a}catch(e){console.error(e)}},d.checkoutStep=function(e,t,o){var a,d,n;if(!(o&&t===r.INFO&&o.isAccountRequired&&(null===(a=e.customer)||void 0===a?void 0:a.isGuestCheckout))){var m=i(e);null===(d=m.shippingAddress)||void 0===d||delete d.checkoutSettings,null===(n=m.billingAddress)||void 0===n||delete n.checkoutSettings;var c="";t===r.INFO?c="checkout_info-GTM":t===r.SHIPPING?c="checkout_shipping-GTM":t===r.PAYMENT?c="checkout_payment-GTM":t===r.SUCCESS&&(c="checkout_success-GTM");try{var p={event:c,ecommerce:{cart:m}};return!s&&window.dataLayer&&window.dataLayer.push(p),p}catch(e){console.error(e)}}},d.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},d.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},d.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},d.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},d}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.365",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"swiper": "11.0.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
29
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
30
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
26
|
+
"@ikas/storefront-api": "^6.1.0-beta.365",
|
|
27
|
+
"@ikas/storefront-config": "^6.1.0-beta.365",
|
|
28
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.365",
|
|
29
|
+
"@ikas/storefront-models": "^6.1.0-beta.365",
|
|
30
|
+
"@ikas/storefront-providers": "^6.1.0-beta.365",
|
|
31
31
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
32
32
|
"@adyen/adyen-web": "^5.57.0",
|
|
33
33
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
65
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
68
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
69
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
65
|
+
"@ikas/storefront-api": "^6.1.0-beta.365",
|
|
66
|
+
"@ikas/storefront-config": "^6.1.0-beta.365",
|
|
67
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.365",
|
|
68
|
+
"@ikas/storefront-models": "^6.1.0-beta.365",
|
|
69
|
+
"@ikas/storefront-providers": "^6.1.0-beta.365",
|
|
70
70
|
"mobx": "^6.1.3",
|
|
71
71
|
"mobx-react-lite": "^3.1.5",
|
|
72
72
|
"next": "12.2.0",
|