@ikas/storefront 5.0.0-beta.33 → 5.0.0-beta.34
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/_virtual/lodash.js +1 -0
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/googleAnalytics.js +1 -1
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/ikas.js +1 -1
- 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.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/components/phone-number-input/get-countries.js +1 -1
- package/build/components/checkout/components/phone-number-input/index.js +1 -1
- package/build/components/checkout/components/quick-registration/model.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/google-captcha/index.js +1 -1
- package/build/components/page/ThemeComponent.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.js +1 -1
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/customer/address/ikas-localized-customer-address.js +1 -1
- package/build/models/data/order/address/ikas-localized-order-address.js +1 -1
- package/build/models/data/product/campaign-offer/index.js +1 -1
- package/build/models/data/product/variant/index.js +1 -1
- 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/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.js +1 -1
- package/build/models/ui/validator/form/customer-review.js +1 -1
- package/build/models/ui/validator/form/forgot-password.js +1 -1
- package/build/models/ui/validator/form/ikas-address.js +1 -1
- package/build/models/ui/validator/form/login.js +1 -1
- package/build/models/ui/validator/form/raffle-form.js +1 -1
- package/build/models/ui/validator/form/recover-password.js +1 -1
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/node_modules/@ikas/localized-address/build/_virtual/_tslib.js +1 -0
- package/build/node_modules/@ikas/localized-address/build/models/address/index.js +1 -0
- package/build/node_modules/@ikas/localized-address/build/models/address/model.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouType.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeParser.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/AsYouTypeState.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/ParseError.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/PhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/constants.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/format.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/getCountries.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/isObject.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/mergeArrays.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/isPossible.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/isValid.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/metadata.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/normalizeArguments.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parse.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +1 -0
- package/build/node_modules/libphonenumber-js/es6/tools/semver-compare.js +1 -0
- package/build/node_modules/libphonenumber-js/metadata.min.json.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/getCountries.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
- package/build/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +1 -0
- package/build/node_modules/lodash/lodash.js +9 -0
- package/build/pages/checkout/index.page.js +1 -1
- package/build/providers/page-data-init.js +1 -1
- package/build/providers/prop-value/blog-category-list.js +1 -1
- package/build/providers/prop-value/blog-list.js +1 -1
- package/build/providers/prop-value/brand-list.js +1 -1
- package/build/providers/prop-value/category-list.js +1 -1
- package/build/providers/prop-value/product-list.js +1 -1
- package/build/providers/prop-value/raffle-list.js +1 -1
- package/build/store/blog/index.js +1 -1
- package/build/store/brand/index.js +1 -1
- package/build/store/cart/index.js +1 -1
- package/build/store/category/index.js +1 -1
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.js +1 -1
- package/build/store/customer/index.js +1 -1
- package/build/store/html-meta-data/index.js +1 -1
- package/build/store/location/index.js +1 -1
- package/build/store/product/index.js +1 -1
- package/package.json +12 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={exports:{}};export{e as __module};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as e}from"mobx";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../node_modules/@ikas/storefront-config/build/index.js";import o from"../node_modules/lodash/cloneDeep.js";import{IkasBrand as s}from"../models/data/brand/index.js";import{IkasCart as t}from"../models/data/cart/index.js";import"../models/data/html-meta-data/index.js";import{IkasCategory as r}from"../models/data/category/index.js";import{IkasCheckout as i}from"../models/data/checkout/index.js";import"@ikas/localized-address";import{IkasProduct as d}from"../models/data/product/index.js";import"../node_modules/@ikas/storefront-api/build/index.js";import{IkasBaseStore as a}from"../store/base.js";import"../node_modules/lodash/xorBy.js";import"./head/index.js";import"../store/cart/index.js";import"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";import{tryForEach as l}from"../utils/helper.js";import{FacebookPixel as m}from"./facebookPixel.js";import{GoogleTagManager as n}from"./googleTagManager.js";import{IkasEventType as c}from"./events.js";import u from"./ikas.js";import{GoogleAnalytics as p}from"./googleAnalytics.js";import{TiktokPixel as b}from"./tiktokPixel.js";const f="gtmBeginCheckout";class h{constructor(){e(this)}static async getCustomerInfo(){const e=a.getInstance();await e.customerStore.waitUntilInitialized();const o=e.customerStore.customer;return o?{...o.basicInfo,consentGranted:e.customerStore.customerConsentGranted}:null}static async pageView(e){try{const o=window.location.href,s=await h.getCustomerInfo();n.pageView(o),u.pageView(e),m.pageView(o),l(h.subscribers,(t=>{t.callback({type:c.PAGE_VIEW,data:{url:o,pageType:e,customer:s}})}))}catch(e){console.error(e)}}static productView(e){try{if(m.productView(e),n.productView(e),u.productView(e),p.productView(e),b.productView(e),h.subscribers.length){const s=new d(o(e));l(h.subscribers,(e=>{e.callback({type:c.PRODUCT_VIEW,data:{productDetail:s}})}))}}catch(e){console.error(e)}}static addToCart(e,s,r,i){try{if(m.addToCart(e,s,r),n.addToCart(e,s),u.addToCart(e,s,i),p.addToCart(e,s),b.addToCart(e,s),h.subscribers.length){const r=o(e),d=new t(o(i));l(h.subscribers,(e=>{e.callback({type:c.ADD_TO_CART,data:{item:r,quantity:s,cart:d}})}))}}catch(e){console.error(e)}}static removeFromCart(e,s,r){try{if(n.removeFromCart(e,s),p.removeFromCart(e,s),h.subscribers.length){const i=o(e),d=new t(o(r));l(h.subscribers,(e=>{e.callback({type:c.REMOVE_FROM_CART,data:{item:i,quantity:s,cart:d}})}))}}catch(e){console.error(e)}}static beginCheckout(e){try{const s=localStorage.getItem(f);if(s&&e.id===s)return;if(localStorage.setItem(f,e.id),m.beginCheckout(e),n.beginCheckout(e),u.beginCheckout(e),p.beginCheckout(e),b.beginCheckout(),h.subscribers.length){const s=new i(o(e));l(h.subscribers,(e=>{e.callback({type:c.BEGIN_CHECKOUT,data:{checkout:s}})}))}}catch(e){console.error(e)}}static purchase(e,s){try{if(localStorage.removeItem(f),m.purchase(e,s.id||""),n.purchase(e,e.orderNumber||""),u.orderSuccess(e),p.purchase(e,e.orderNumber||""),b.purchase(e),h.subscribers.length){const t=new i(o(e)),r=o(s);l(h.subscribers,(e=>{e.callback({type:c.COMPLETE_CHECKOUT,data:{checkout:t,transaction:r}})}))}}catch(e){console.error(e)}}static checkoutStep(e,s){try{if(n.checkoutStep(e,s),u.checkoutStep(e,s),p.checkoutStep(e,s),h.subscribers.length){const t=new i(o(e));l(h.subscribers,(e=>{e.callback({type:c.CHECKOUT_STEP,data:{checkout:t,step:s}})}))}}catch(e){console.error(e)}}static disableHTML(){try{n.disableHTML()}catch(e){console.error(e)}}static addToWishlist(e){try{m.addToWishlist(e),b.addToWishlist(e),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.ADD_TO_WISHLIST,data:{productId:e}})}))}catch(e){console.error(e)}}static search(e){try{m.search(e),n.search(e),b.search(e),p.search(e),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.SEARCH,data:{searchKeyword:e}})}))}catch(e){console.error(e)}}static completeRegistration(e){try{m.completeRegistration(),n.completeRegistration(e),b.completeRegistration(),u.customerRegister(),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.CUSTOMER_REGISTER,data:{email:e.email,firstName:e.firstName,lastName:e.lastName}})}))}catch(e){console.error(e)}}static createEmailSubscripition(e){try{h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.EMAIL_SUBSCRIPTION,data:{email:e}})}))}catch(e){console.error(e)}}static async customerLogin(){try{const e=await h.getCustomerInfo();if(!e||!e.email)return;n.customerLogin(e),u.customerLogin(),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.CUSTOMER_LOGIN,data:{customer:e}})}))}catch(e){console.error(e)}}static async customerLogout(){try{n.customerLogout(),h.subscribers.length&&l(h.subscribers,(e=>{e.callback({type:c.CUSTOMER_LOGOUT,data:{}})}))}catch(e){console.error(e)}}static async customerVisit(){try{const e=await h.getCustomerInfo();if(!e||!e.email)return;n.customerVisit(e),u.customerVisit(),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.CUSTOMER_VISIT,data:{customer:e}})}))}catch(e){console.error(e)}}static viewCart(e){try{if(e&&(m.viewCart(e),u.viewCart(e),p.viewCart(e),n.viewCart(e),h.subscribers.length)){const s=new t(o(e));l(h.subscribers,(e=>{e.callback({type:c.VIEW_CART,data:{cart:s}})}))}}catch(e){console.error(e)}}static viewCategory(e,s){try{if(m.viewCategory(e),n.viewCategory(s,e),u.viewCategory(s),b.viewCategory(s),h.subscribers.length){const t=new r(o(s));l(h.subscribers,(o=>{o.callback({type:c.VIEW_CATEGORY,data:{categoryPath:e,category:t}})}))}}catch(e){console.error(e)}}static viewBrand(e){try{if(u.viewBrand(e),h.subscribers.length){const t=new s(o(e));l(h.subscribers,(e=>{e.callback({type:c.VIEW_BRAND,data:{brand:t}})}))}}catch(e){console.error(e)}}static viewSearchResults(e,s){try{if(h.subscribers.length){const t=o(s).map((e=>new d(e)));l(h.subscribers,(o=>{o.callback({type:c.VIEW_SEARCH_RESULTS,data:{searchKeyword:e,productDetails:t}})}))}}catch(e){console.error(e)}}static viewListing(e){try{if(h.subscribers.length){const s=o(e).map((e=>new d(e)));l(h.subscribers,(e=>{e.callback({type:c.VIEW_LISTING,data:{productDetails:s}})}))}}catch(e){console.error(e)}}static contactForm(e){try{if(m.contactForm(),b.contactForm(),h.subscribers.length){const s=o(e);l(h.subscribers,(e=>{e.callback({type:c.CONTACT_FORM,data:{form:s}})}))}}catch(e){console.error(e)}}}h.subscribers=[];export{h as Analytics};
|
|
1
|
+
import{makeAutoObservable as e}from"mobx";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../node_modules/@ikas/storefront-config/build/index.js";import o from"../node_modules/lodash/cloneDeep.js";import{IkasBrand as s}from"../models/data/brand/index.js";import{IkasCart as t}from"../models/data/cart/index.js";import"../models/data/html-meta-data/index.js";import{IkasCategory as r}from"../models/data/category/index.js";import{IkasCheckout as i}from"../models/data/checkout/index.js";import"../node_modules/@ikas/localized-address/build/models/address/index.js";import"../node_modules/@ikas/localized-address/build/models/address/model.js";import{IkasProduct as d}from"../models/data/product/index.js";import"../node_modules/@ikas/storefront-api/build/index.js";import{IkasBaseStore as a}from"../store/base.js";import"../node_modules/lodash/xorBy.js";import"./head/index.js";import"../store/cart/index.js";import"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";import{tryForEach as l}from"../utils/helper.js";import{FacebookPixel as m}from"./facebookPixel.js";import{GoogleTagManager as n}from"./googleTagManager.js";import{IkasEventType as c}from"./events.js";import u from"./ikas.js";import{GoogleAnalytics as b}from"./googleAnalytics.js";import{TiktokPixel as p}from"./tiktokPixel.js";const f="gtmBeginCheckout";class h{constructor(){e(this)}static async getCustomerInfo(){const e=a.getInstance();await e.customerStore.waitUntilInitialized();const o=e.customerStore.customer;return o?{...o.basicInfo,consentGranted:e.customerStore.customerConsentGranted}:null}static async pageView(e){try{const o=window.location.href,s=await h.getCustomerInfo();n.pageView(o),u.pageView(e),m.pageView(o),l(h.subscribers,(t=>{t.callback({type:c.PAGE_VIEW,data:{url:o,pageType:e,customer:s}})}))}catch(e){console.error(e)}}static productView(e){try{if(m.productView(e),n.productView(e),u.productView(e),b.productView(e),p.productView(e),h.subscribers.length){const s=new d(o(e));l(h.subscribers,(e=>{e.callback({type:c.PRODUCT_VIEW,data:{productDetail:s}})}))}}catch(e){console.error(e)}}static addToCart(e,s,r,i){try{if(m.addToCart(e,s,r),n.addToCart(e,s),u.addToCart(e,s,i),b.addToCart(e,s),p.addToCart(e,s),h.subscribers.length){const r=o(e),d=new t(o(i));l(h.subscribers,(e=>{e.callback({type:c.ADD_TO_CART,data:{item:r,quantity:s,cart:d}})}))}}catch(e){console.error(e)}}static removeFromCart(e,s,r){try{if(n.removeFromCart(e,s),b.removeFromCart(e,s),h.subscribers.length){const i=o(e),d=new t(o(r));l(h.subscribers,(e=>{e.callback({type:c.REMOVE_FROM_CART,data:{item:i,quantity:s,cart:d}})}))}}catch(e){console.error(e)}}static beginCheckout(e){try{const s=localStorage.getItem(f);if(s&&e.id===s)return;if(localStorage.setItem(f,e.id),m.beginCheckout(e),n.beginCheckout(e),u.beginCheckout(e),b.beginCheckout(e),p.beginCheckout(),h.subscribers.length){const s=new i(o(e));l(h.subscribers,(e=>{e.callback({type:c.BEGIN_CHECKOUT,data:{checkout:s}})}))}}catch(e){console.error(e)}}static purchase(e,s){try{if(localStorage.removeItem(f),m.purchase(e,s.id||""),n.purchase(e,e.orderNumber||""),u.orderSuccess(e),b.purchase(e,e.orderNumber||""),p.purchase(e),h.subscribers.length){const t=new i(o(e)),r=o(s);l(h.subscribers,(e=>{e.callback({type:c.COMPLETE_CHECKOUT,data:{checkout:t,transaction:r}})}))}}catch(e){console.error(e)}}static checkoutStep(e,s){try{if(n.checkoutStep(e,s),u.checkoutStep(e,s),b.checkoutStep(e,s),h.subscribers.length){const t=new i(o(e));l(h.subscribers,(e=>{e.callback({type:c.CHECKOUT_STEP,data:{checkout:t,step:s}})}))}}catch(e){console.error(e)}}static disableHTML(){try{n.disableHTML()}catch(e){console.error(e)}}static addToWishlist(e){try{m.addToWishlist(e),p.addToWishlist(e),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.ADD_TO_WISHLIST,data:{productId:e}})}))}catch(e){console.error(e)}}static search(e){try{m.search(e),n.search(e),p.search(e),b.search(e),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.SEARCH,data:{searchKeyword:e}})}))}catch(e){console.error(e)}}static completeRegistration(e){try{m.completeRegistration(),n.completeRegistration(e),p.completeRegistration(),u.customerRegister(),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.CUSTOMER_REGISTER,data:{email:e.email,firstName:e.firstName,lastName:e.lastName}})}))}catch(e){console.error(e)}}static createEmailSubscripition(e){try{h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.EMAIL_SUBSCRIPTION,data:{email:e}})}))}catch(e){console.error(e)}}static async customerLogin(){try{const e=await h.getCustomerInfo();if(!e||!e.email)return;n.customerLogin(e),u.customerLogin(),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.CUSTOMER_LOGIN,data:{customer:e}})}))}catch(e){console.error(e)}}static async customerLogout(){try{n.customerLogout(),h.subscribers.length&&l(h.subscribers,(e=>{e.callback({type:c.CUSTOMER_LOGOUT,data:{}})}))}catch(e){console.error(e)}}static async customerVisit(){try{const e=await h.getCustomerInfo();if(!e||!e.email)return;n.customerVisit(e),u.customerVisit(),h.subscribers.length&&l(h.subscribers,(o=>{o.callback({type:c.CUSTOMER_VISIT,data:{customer:e}})}))}catch(e){console.error(e)}}static viewCart(e){try{if(e&&(m.viewCart(e),u.viewCart(e),b.viewCart(e),n.viewCart(e),h.subscribers.length)){const s=new t(o(e));l(h.subscribers,(e=>{e.callback({type:c.VIEW_CART,data:{cart:s}})}))}}catch(e){console.error(e)}}static viewCategory(e,s){try{if(m.viewCategory(e),n.viewCategory(s,e),u.viewCategory(s),p.viewCategory(s),h.subscribers.length){const t=new r(o(s));l(h.subscribers,(o=>{o.callback({type:c.VIEW_CATEGORY,data:{categoryPath:e,category:t}})}))}}catch(e){console.error(e)}}static viewBrand(e){try{if(u.viewBrand(e),h.subscribers.length){const t=new s(o(e));l(h.subscribers,(e=>{e.callback({type:c.VIEW_BRAND,data:{brand:t}})}))}}catch(e){console.error(e)}}static viewSearchResults(e,s){try{if(h.subscribers.length){const t=o(s).map((e=>new d(e)));l(h.subscribers,(o=>{o.callback({type:c.VIEW_SEARCH_RESULTS,data:{searchKeyword:e,productDetails:t}})}))}}catch(e){console.error(e)}}static viewListing(e){try{if(h.subscribers.length){const s=o(e).map((e=>new d(e)));l(h.subscribers,(e=>{e.callback({type:c.VIEW_LISTING,data:{productDetails:s}})}))}}catch(e){console.error(e)}}static contactForm(e){try{if(m.contactForm(),p.contactForm(),h.subscribers.length){const s=o(e);l(h.subscribers,(e=>{e.callback({type:c.CONTACT_FORM,data:{form:s}})}))}}catch(e){console.error(e)}}}h.subscribers=[];export{h as Analytics};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as e}from"mobx";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../node_modules/@ikas/storefront-config/build/index.js";import"../node_modules/lodash/_baseClone.js";import"../models/data/brand/index.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"
|
|
1
|
+
import{makeAutoObservable as e}from"mobx";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../node_modules/@ikas/storefront-config/build/index.js";import"../node_modules/lodash/_baseClone.js";import"../models/data/brand/index.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"../node_modules/@ikas/localized-address/build/models/address/index.js";import"../node_modules/@ikas/localized-address/build/models/address/model.js";import{IkasProduct as o}from"../models/data/product/index.js";import"../store/base.js";import"../node_modules/lodash/xorBy.js";import"./analytics.js";import"./head/index.js";import"../store/cart/index.js";import"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";const t="undefined"==typeof window;class s{constructor(){e(this)}static productView(e){try{return void(!t&&window.gtag&&window.gtag("event","view_item",{currency:""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency,value:e.selectedVariant.price.finalPrice,items:[i(e)]}))}catch(e){console.error(e)}}static addToCart(e,s){try{return void(!t&&window.gtag&&window.gtag("event","add_to_cart",{currency:e instanceof o?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof o?e.selectedVariant.price.finalPrice:e.finalPrice,items:[e instanceof o?i(e,s):d(e,s)]}))}catch(e){console.error(e)}}static removeFromCart(e,s){try{return void(!t&&window.gtag&&window.gtag("event","remove_from_cart",{currency:e instanceof o?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof o?e.selectedVariant.price.finalPrice:e.finalPrice,items:[e instanceof o?i(e,s):d(e,s)]}))}catch(e){console.error(e)}}static viewCart(e){try{return void(!t&&window.gtag&&window.gtag("event","view_cart",{currency:e.currencyCode,value:e.totalPrice,items:e.items.map((e=>d(e,e.quantity)))}))}catch(e){console.error(e)}}static beginCheckout(e){try{return void(!t&&window.gtag&&window.gtag("event","begin_checkout",{currency:e.currencyCode,value:e.totalFinalPrice,items:e.items.map((e=>d(e,e.quantity)))}))}catch(e){console.error(e)}}static purchase(e,o){try{return void(!t&&window.gtag&&window.gtag("event","purchase",{transaction_id:o,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((e=>d(e,e.quantity)))}))}catch(e){console.error(e)}}static checkoutStep(e,o){if("SHIPPING"===o)try{return void(!t&&window.gtag&&window.gtag("event","add_shipping_info",{currency:e.currencyCode,value:e.totalFinalPrice,shipping_tier:"Ground",coupon:e.couponCode,items:e.items.map((e=>d(e,e.quantity)))}))}catch(e){console.error(e)}if("PAYMENT"===o)try{return void(!t&&window.gtag&&window.gtag("event","add_payment_info",{currency:e.currencyCode,value:e.totalFinalPrice,coupon:e.couponCode,payment_type:e.selectedPaymentGateway?.paymentMethodType,items:e.items.map((e=>d(e,e.quantity)))}))}catch(e){console.error(e)}}static search(e){try{return void(!t&&window.gtag&&window.gtag("event","search",{search_term:e}))}catch(e){console.error(e)}}}function i(e,o=1){const t=[],s=e.categories;return s&&s.length&&(s[0].categoryPath&&s[0].categoryPath.map((e=>t.push(e))),t.push(s[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:e.brand?.name||"",item_category:t.length?t[0]:"",item_category_2:t.length>1?t[1]:"",item_category_3:t.length>2?t[2]:"",item_category_4:t.length>3?t.slice(3,t.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((e=>e.name)).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o}}function d(e,o=1){const t=[],s=e.variant.categories;return s&&s.length&&(s[0].categoryPath&&s[0].categoryPath.map((e=>t.push(e.name))),t.push(s[0].name)),{item_name:e.variant.name,item_id:e.variant.id,price:""+e.finalPrice,item_brand:e.variant.brand?.name||"",item_category:t.length?t[0]:"",item_category_2:t.length>1?t[1]:"",item_category_3:t.length>2?t[2]:"",item_category_4:t.length>3?t.slice(3,t.length).join(" > "):"",item_variant:e.variant.variantValues?.map((e=>e.variantValueName)).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o}}export{s as GoogleAnalytics};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as e}from"mobx";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../node_modules/@ikas/storefront-config/build/index.js";import o from"../node_modules/lodash/cloneDeep.js";import"../models/data/brand/index.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"@ikas/localized-address";import{IkasProduct as t}from"../models/data/product/index.js";import{IkasBaseStore as s}from"../store/base.js";import"../node_modules/lodash/xorBy.js";import"./analytics.js";import"./head/index.js";import"../store/cart/index.js";import"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";import{CheckoutStep as d}from"../components/checkout/model.js";const r="undefined"==typeof window;class i{constructor(){e(this)}static pageView(e){try{const o={event:"page-view-GTM",page:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static productView(e){try{const o={event:"view_item-GTM",ecommerce:{items:[a(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:`https://${window.location.hostname}${e.href}`,item_image:e.selectedVariant.mainImage?.image?.src||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:""}}};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static addToCart(e,o){const d=s.getInstance().cartStore.cart;try{const s={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof t?a(e,o):n(e,o)],cart:d}};return!r&&window.dataLayer&&window.dataLayer.push(s),s}catch(e){console.error(e)}}static removeFromCart(e,o){const d=s.getInstance().cartStore.cart;try{const s={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof t?a(e,o):n(e,o)],cart:0===d?.itemCount?null:d}};return!r&&window.dataLayer&&window.dataLayer.push(s),s}catch(e){console.error(e)}}static beginCheckout(e){try{const o={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((e=>n(e,e.quantity)))}};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static purchase(e,o){try{const t={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:o,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((e=>n(e,e.quantity)))}}};return!r&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}}static checkoutStep(e,t){const s=o(e);delete s.shippingAddress?.checkoutSettings,delete s.billingAddress?.checkoutSettings;let i="";t===d.INFO?i="checkout_info-GTM":t===d.SHIPPING?i="checkout_shipping-GTM":t===d.PAYMENT?i="checkout_payment-GTM":t===d.SUCCESS&&(i="checkout_success-GTM");try{const e={event:i,ecommerce:{cart:s}};return!r&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}}static disableHTML(){try{const e={"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]};!r&&window.dataLayer&&window.dataLayer.push(e)}catch(e){console.error(e)}}static completeRegistration(e){try{const o={event:"customer_register-GTM",customer:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static search(e){try{const o={event:"search-GTM",search_string:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static viewCategory(e,o){try{const t={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:o}]}};return!r&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}}static customerLogin(e){try{const o={event:"customer_login-GTM",customer:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static customerLogout(){try{const e={event:"customer_logout-GTM"};return!r&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}}static customerVisit(e){try{const o={event:"customer_visit-GTM",customer:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static viewCart(e){try{const o={event:"view_cart-GTM",ecommerce:{cart:e}};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}}function a(e,o=1){return{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:e.brand?.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((e=>e.name)).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o}}function n(e,o=1){return{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:e.variant.variantValues?.map((e=>e.variantValueName)).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o}}export{i as GoogleTagManager};
|
|
1
|
+
import{makeAutoObservable as e}from"mobx";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../node_modules/@ikas/storefront-config/build/index.js";import o from"../node_modules/lodash/cloneDeep.js";import"../models/data/brand/index.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"../node_modules/@ikas/localized-address/build/models/address/index.js";import"../node_modules/@ikas/localized-address/build/models/address/model.js";import{IkasProduct as t}from"../models/data/product/index.js";import{IkasBaseStore as s}from"../store/base.js";import"../node_modules/lodash/xorBy.js";import"./analytics.js";import"./head/index.js";import"../store/cart/index.js";import"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";import{CheckoutStep as d}from"../components/checkout/model.js";const r="undefined"==typeof window;class i{constructor(){e(this)}static pageView(e){try{const o={event:"page-view-GTM",page:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static productView(e){try{const o={event:"view_item-GTM",ecommerce:{items:[a(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:`https://${window.location.hostname}${e.href}`,item_image:e.selectedVariant.mainImage?.image?.src||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:""}}};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static addToCart(e,o){const d=s.getInstance().cartStore.cart;try{const s={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof t?a(e,o):n(e,o)],cart:d}};return!r&&window.dataLayer&&window.dataLayer.push(s),s}catch(e){console.error(e)}}static removeFromCart(e,o){const d=s.getInstance().cartStore.cart;try{const s={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof t?a(e,o):n(e,o)],cart:0===d?.itemCount?null:d}};return!r&&window.dataLayer&&window.dataLayer.push(s),s}catch(e){console.error(e)}}static beginCheckout(e){try{const o={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((e=>n(e,e.quantity)))}};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static purchase(e,o){try{const t={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:o,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((e=>n(e,e.quantity)))}}};return!r&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}}static checkoutStep(e,t){const s=o(e);delete s.shippingAddress?.checkoutSettings,delete s.billingAddress?.checkoutSettings;let i="";t===d.INFO?i="checkout_info-GTM":t===d.SHIPPING?i="checkout_shipping-GTM":t===d.PAYMENT?i="checkout_payment-GTM":t===d.SUCCESS&&(i="checkout_success-GTM");try{const e={event:i,ecommerce:{cart:s}};return!r&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}}static disableHTML(){try{const e={"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]};!r&&window.dataLayer&&window.dataLayer.push(e)}catch(e){console.error(e)}}static completeRegistration(e){try{const o={event:"customer_register-GTM",customer:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static search(e){try{const o={event:"search-GTM",search_string:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static viewCategory(e,o){try{const t={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:o}]}};return!r&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}}static customerLogin(e){try{const o={event:"customer_login-GTM",customer:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static customerLogout(){try{const e={event:"customer_logout-GTM"};return!r&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}}static customerVisit(e){try{const o={event:"customer_visit-GTM",customer:e};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}static viewCart(e){try{const o={event:"view_cart-GTM",ecommerce:{cart:e}};return!r&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}}}function a(e,o=1){return{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:e.brand?.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((e=>e.name)).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o}}function n(e,o=1){return{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:e.variant.variantValues?.map((e=>e.variantValueName)).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o}}export{i as GoogleTagManager};
|
package/build/analytics/ikas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasStorefrontConfig as e}from"../node_modules/@ikas/storefront-config/build/index.js";import{IkasBaseStore as t}from"../store/base.js";import"mobx";import"../node_modules/lodash/xorBy.js";import"../node_modules/lodash/_baseClone.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import{IkasThemeJsonPageType as s}from"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../models/data/brand/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/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"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../models/ui/validator/rules/index.js";import"fs";import"path";import"../node_modules/lodash/_isFlattenable.js";import"./analytics.js";import"./head/index.js";import"../store/cart/index.js";var o,i;!function(e){e[e.SESSION_START=1]="SESSION_START",e[e.PAGE_VIEW=2]="PAGE_VIEW",e[e.PRODUCT_VIEW=3]="PRODUCT_VIEW",e[e.ADD_TO_CART=4]="ADD_TO_CART",e[e.VIEW_CART=5]="VIEW_CART",e[e.ORDER_SUCCESS=6]="ORDER_SUCCESS",e[e.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",e[e.CHECKOUT_STEP=8]="CHECKOUT_STEP",e[e.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",e[e.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",e[e.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",e[e.BRAND_VIEW=12]="BRAND_VIEW",e[e.CATEGORY_VIEW=13]="CATEGORY_VIEW"}(o||(o={})),function(e){e[e.INDEX=1]="INDEX",e[e.CATEGORY=2]="CATEGORY",e[e.BRAND=3]="BRAND",e[e.PRODUCT=4]="PRODUCT",e[e.CUSTOM=5]="CUSTOM",e[e.ACCOUNT=6]="ACCOUNT",e[e.ADDRESSES=7]="ADDRESSES",e[e.ORDERS=8]="ORDERS",e[e.ORDER_DETAIL=9]="ORDER_DETAIL",e[e.LOGIN=10]="LOGIN",e[e.REGISTER=11]="REGISTER",e[e.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",e[e.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",e[e.CART=14]="CART",e[e.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",e[e.SEARCH=16]="SEARCH",e[e.NOT_FOUND=17]="NOT_FOUND",e[e.BLOG=18]="BLOG",e[e.BLOG_INDEX=19]="BLOG_INDEX",e[e.BLOG_CATEGORY=20]="BLOG_CATEGORY",e[e.CHECKOUT=21]="CHECKOUT",e[e.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(i||(i={}));const d=process.env.PUBLIC_ENV__ANALYTICS_URL?`${process.env.PUBLIC_ENV__ANALYTICS_URL}/sendEventV2`:"https://0.myikas.com/sendEventV2";class n{static async createUUID(){const e=await fetch(`${process.env.PUBLIC_ENV__BASE_URL}/generate-id/1`);return(await e.json()).data[0]}static async createSessionId(){try{const e={id:await this.createUUID(),expiry:Date.now()+this.EXPIRY_LENGTH};localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(e)),this.sessionId=e.id,await this.sessionStart()}catch(e){console.error(e)}}static async checkSessionId(){try{const t=localStorage.getItem(this.SESSION_ID_KEY);if(t){const e=JSON.parse(t);e.expiry<Date.now()||e.id.length<=13?await this.createSessionId():this.sessionId=e.id}else await this.createSessionId();e.init({sessionId:this.sessionId||""})}catch(e){console.error(e)}}static async checkVisitorId(){try{const t=localStorage.getItem(this.VISITOR_ID_KEY);t&&t.length>13?this.visitorId=t:(this.visitorId=await this.createUUID(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId)),e.init({visitorId:this.visitorId})}catch(e){console.error(e)}}static getPageType(e){switch(e){case s.INDEX:return i.INDEX;case s.CATEGORY:return i.CATEGORY;case s.BRAND:return i.BRAND;case s.PRODUCT:return i.PRODUCT;case s.CUSTOM:return i.CUSTOM;case s.ACCOUNT:return i.ACCOUNT;case s.ADDRESSES:return i.ADDRESSES;case s.ORDERS:return i.ORDERS;case s.ORDER_DETAIL:return i.ORDER_DETAIL;case s.LOGIN:return i.LOGIN;case s.REGISTER:return i.REGISTER;case s.FORGOT_PASSWORD:return i.FORGOT_PASSWORD;case s.RECOVER_PASSWORD:return i.RECOVER_PASSWORD;case s.ACTIVATE_CUSTOMER:return i.ACTIVATE_CUSTOMER;case s.CART:return i.CART;case s.FAVORITE_PRODUCTS:return i.FAVORITE_PRODUCTS;case s.SEARCH:return i.SEARCH;case s.NOT_FOUND:return i.NOT_FOUND;case s.BLOG:return i.BLOG;case s.BLOG_INDEX:return i.BLOG_INDEX;case s.BLOG_CATEGORY:return i.BLOG_CATEGORY;case s.CHECKOUT:return i.CHECKOUT}}static getCustomerData(){const e=t.getInstance(),s=e.customerStore.customer;return{id:s?.id||void 0,e:s?.email||void 0,c:e.customerStore.customerConsentGranted}}static getCommonEventData(){const e=t.getInstance();return{u:window.location.href,r:document.referrer,pt:e.currentPageType?this.getPageType(e.currentPageType):void 0}}static async sendEvents(s){try{const o=t.getInstance();await o.customerStore.waitUntilInitialized(),await this.checkSessionId(),await this.checkVisitorId();const i={e:s,scid:e.getSalesChannelId(),sfid:e.getStorefrontId(),sid:this.sessionId,vid:this.visitorId,cid:o.customerStore.customer?.id};await fetch(d,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json","x-api-key":e.getApiKey()}})}catch(e){console.error(e)}}static async sessionStart(){const e={t:o.SESSION_START,ts:Date.now(),d:{...this.getCommonEventData()}};await this.sendEvents([e])}static async pageView(e){const t={t:o.PAGE_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),pt:this.getPageType(e)}};await this.sendEvents([t])}static async productView(e){const t={t:o.PRODUCT_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),d:{pr:{id:e.id,vid:e.selectedVariant.id}}}};await this.sendEvents([t])}static async addToCart(e,t,s){const i={t:o.ADD_TO_CART,ts:Date.now(),d:{...this.getCommonEventData(),d:{crt:{id:s.id,c:s.itemCount},crtItm:{id:e.id,c:t}}}};await this.sendEvents([i])}static async viewCart(e){const t={t:o.VIEW_CART,ts:Date.now(),d:{...this.getCommonEventData(),d:{crt:{id:e.id,c:e.itemCount}}}};await this.sendEvents([t])}static async orderSuccess(e){const t={t:o.ORDER_SUCCESS,ts:Date.now(),d:{...this.getCommonEventData(),d:{chk:{id:e.id,s:"success"}}}};await this.sendEvents([t]),await this.createSessionId()}static async beginCheckout(e){const t={t:o.BEGIN_CHECKOUT,ts:Date.now(),d:{...this.getCommonEventData(),d:{chk:{id:e.id}}}};await this.sendEvents([t])}static async checkoutStep(e,t){const s={t:o.CHECKOUT_STEP,ts:Date.now(),d:{...this.getCommonEventData(),d:{chk:{id:e.id,s:t}}}};await this.sendEvents([s])}static async customerRegister(){const e={t:o.CUSTOMER_REGISTER,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData()}}};await this.sendEvents([e])}static async customerLogin(){const e={t:o.CUSTOMER_LOGIN,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData()}}};await this.sendEvents([e])}static async customerVisit(){const e={t:o.CUSTOMER_VISIT,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData()}}};await this.sendEvents([e])}static async viewBrand(e){const t={t:o.BRAND_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData(),br:{id:e.id}}}};await this.sendEvents([t])}static async viewCategory(e){const t={t:o.CATEGORY_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData(),ctg:{id:e.id}}}};await this.sendEvents([t])}}n.SESSION_ID_KEY="ikas_session_id",n.VISITOR_ID_KEY="ikas_visitor_id",n.EXPIRY_LENGTH=18e5;export{n as default};
|
|
1
|
+
import{IkasStorefrontConfig as e}from"../node_modules/@ikas/storefront-config/build/index.js";import{IkasBaseStore as s}from"../store/base.js";import"mobx";import"../node_modules/lodash/xorBy.js";import"../node_modules/lodash/_baseClone.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import{IkasThemeJsonPageType as t}from"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import"../models/data/brand/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"../node_modules/@ikas/localized-address/build/models/address/index.js";import"../node_modules/@ikas/localized-address/build/models/address/model.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"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../models/ui/validator/rules/index.js";import"fs";import"path";import"../node_modules/lodash/_isFlattenable.js";import"./analytics.js";import"./head/index.js";import"../store/cart/index.js";var o,d;!function(e){e[e.SESSION_START=1]="SESSION_START",e[e.PAGE_VIEW=2]="PAGE_VIEW",e[e.PRODUCT_VIEW=3]="PRODUCT_VIEW",e[e.ADD_TO_CART=4]="ADD_TO_CART",e[e.VIEW_CART=5]="VIEW_CART",e[e.ORDER_SUCCESS=6]="ORDER_SUCCESS",e[e.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",e[e.CHECKOUT_STEP=8]="CHECKOUT_STEP",e[e.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",e[e.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",e[e.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",e[e.BRAND_VIEW=12]="BRAND_VIEW",e[e.CATEGORY_VIEW=13]="CATEGORY_VIEW"}(o||(o={})),function(e){e[e.INDEX=1]="INDEX",e[e.CATEGORY=2]="CATEGORY",e[e.BRAND=3]="BRAND",e[e.PRODUCT=4]="PRODUCT",e[e.CUSTOM=5]="CUSTOM",e[e.ACCOUNT=6]="ACCOUNT",e[e.ADDRESSES=7]="ADDRESSES",e[e.ORDERS=8]="ORDERS",e[e.ORDER_DETAIL=9]="ORDER_DETAIL",e[e.LOGIN=10]="LOGIN",e[e.REGISTER=11]="REGISTER",e[e.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",e[e.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",e[e.CART=14]="CART",e[e.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",e[e.SEARCH=16]="SEARCH",e[e.NOT_FOUND=17]="NOT_FOUND",e[e.BLOG=18]="BLOG",e[e.BLOG_INDEX=19]="BLOG_INDEX",e[e.BLOG_CATEGORY=20]="BLOG_CATEGORY",e[e.CHECKOUT=21]="CHECKOUT",e[e.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));const i=process.env.PUBLIC_ENV__ANALYTICS_URL?`${process.env.PUBLIC_ENV__ANALYTICS_URL}/sendEventV2`:"https://0.myikas.com/sendEventV2";class n{static async createUUID(){const e=await fetch(`${process.env.PUBLIC_ENV__BASE_URL}/generate-id/1`);return(await e.json()).data[0]}static async createSessionId(){try{const e={id:await this.createUUID(),expiry:Date.now()+this.EXPIRY_LENGTH};localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(e)),this.sessionId=e.id,await this.sessionStart()}catch(e){console.error(e)}}static async checkSessionId(){try{const s=localStorage.getItem(this.SESSION_ID_KEY);if(s){const e=JSON.parse(s);e.expiry<Date.now()||e.id.length<=13?await this.createSessionId():this.sessionId=e.id}else await this.createSessionId();e.init({sessionId:this.sessionId||""})}catch(e){console.error(e)}}static async checkVisitorId(){try{const s=localStorage.getItem(this.VISITOR_ID_KEY);s&&s.length>13?this.visitorId=s:(this.visitorId=await this.createUUID(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId)),e.init({visitorId:this.visitorId})}catch(e){console.error(e)}}static getPageType(e){switch(e){case t.INDEX:return d.INDEX;case t.CATEGORY:return d.CATEGORY;case t.BRAND:return d.BRAND;case t.PRODUCT:return d.PRODUCT;case t.CUSTOM:return d.CUSTOM;case t.ACCOUNT:return d.ACCOUNT;case t.ADDRESSES:return d.ADDRESSES;case t.ORDERS:return d.ORDERS;case t.ORDER_DETAIL:return d.ORDER_DETAIL;case t.LOGIN:return d.LOGIN;case t.REGISTER:return d.REGISTER;case t.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case t.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case t.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case t.CART:return d.CART;case t.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case t.SEARCH:return d.SEARCH;case t.NOT_FOUND:return d.NOT_FOUND;case t.BLOG:return d.BLOG;case t.BLOG_INDEX:return d.BLOG_INDEX;case t.BLOG_CATEGORY:return d.BLOG_CATEGORY;case t.CHECKOUT:return d.CHECKOUT}}static getCustomerData(){const e=s.getInstance(),t=e.customerStore.customer;return{id:t?.id||void 0,e:t?.email||void 0,c:e.customerStore.customerConsentGranted}}static getCommonEventData(){const e=s.getInstance();return{u:window.location.href,r:document.referrer,pt:e.currentPageType?this.getPageType(e.currentPageType):void 0}}static async sendEvents(t){try{const o=s.getInstance();await o.customerStore.waitUntilInitialized(),await this.checkSessionId(),await this.checkVisitorId();const d={e:t,scid:e.getSalesChannelId(),sfid:e.getStorefrontId(),sid:this.sessionId,vid:this.visitorId,cid:o.customerStore.customer?.id};await fetch(i,{method:"POST",body:JSON.stringify(d),headers:{"Content-Type":"application/json","x-api-key":e.getApiKey()}})}catch(e){console.error(e)}}static async sessionStart(){const e={t:o.SESSION_START,ts:Date.now(),d:{...this.getCommonEventData()}};await this.sendEvents([e])}static async pageView(e){const s={t:o.PAGE_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),pt:this.getPageType(e)}};await this.sendEvents([s])}static async productView(e){const s={t:o.PRODUCT_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),d:{pr:{id:e.id,vid:e.selectedVariant.id}}}};await this.sendEvents([s])}static async addToCart(e,s,t){const d={t:o.ADD_TO_CART,ts:Date.now(),d:{...this.getCommonEventData(),d:{crt:{id:t.id,c:t.itemCount},crtItm:{id:e.id,c:s}}}};await this.sendEvents([d])}static async viewCart(e){const s={t:o.VIEW_CART,ts:Date.now(),d:{...this.getCommonEventData(),d:{crt:{id:e.id,c:e.itemCount}}}};await this.sendEvents([s])}static async orderSuccess(e){const s={t:o.ORDER_SUCCESS,ts:Date.now(),d:{...this.getCommonEventData(),d:{chk:{id:e.id,s:"success"}}}};await this.sendEvents([s]),await this.createSessionId()}static async beginCheckout(e){const s={t:o.BEGIN_CHECKOUT,ts:Date.now(),d:{...this.getCommonEventData(),d:{chk:{id:e.id}}}};await this.sendEvents([s])}static async checkoutStep(e,s){const t={t:o.CHECKOUT_STEP,ts:Date.now(),d:{...this.getCommonEventData(),d:{chk:{id:e.id,s:s}}}};await this.sendEvents([t])}static async customerRegister(){const e={t:o.CUSTOMER_REGISTER,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData()}}};await this.sendEvents([e])}static async customerLogin(){const e={t:o.CUSTOMER_LOGIN,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData()}}};await this.sendEvents([e])}static async customerVisit(){const e={t:o.CUSTOMER_VISIT,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData()}}};await this.sendEvents([e])}static async viewBrand(e){const s={t:o.BRAND_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData(),br:{id:e.id}}}};await this.sendEvents([s])}static async viewCategory(e){const s={t:o.CATEGORY_VIEW,ts:Date.now(),d:{...this.getCommonEventData(),d:{cst:this.getCustomerData(),ctg:{id:e.id}}}};await this.sendEvents([s])}}n.SESSION_ID_KEY="ikas_session_id",n.VISITOR_ID_KEY="ikas_visitor_id",n.EXPIRY_LENGTH=18e5;export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as o}from"mobx";import{IkasBaseStore as e}from"../store/base.js";import"../node_modules/lodash/xorBy.js";import"../node_modules/lodash/_baseClone.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import{IkasStorefrontConfig as t}from"../node_modules/@ikas/storefront-config/build/index.js";import"../models/data/brand/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"
|
|
1
|
+
import{makeAutoObservable as o}from"mobx";import{IkasBaseStore as e}from"../store/base.js";import"../node_modules/lodash/xorBy.js";import"../node_modules/lodash/_baseClone.js";import"../node_modules/@ikas/storefront-api/build/index.js";import"../models/data/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../node_modules/lodash/sortBy.js";import"../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import{IkasStorefrontConfig as t}from"../node_modules/@ikas/storefront-config/build/index.js";import"../models/data/brand/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/category/conditions/index.js";import"../node_modules/@ikas/localized-address/build/models/address/index.js";import"../node_modules/@ikas/localized-address/build/models/address/model.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"../node_modules/lodash/_defineProperty.js";import"../node_modules/lodash/isArguments.js";import"../node_modules/lodash/isBuffer.js";import"../node_modules/lodash/isTypedArray.js";import"../node_modules/lodash/_baseGetTag.js";import"../node_modules/lodash/_Stack.js";import"../node_modules/lodash/_SetCache.js";import"../node_modules/lodash/_equalByTag.js";import"../node_modules/lodash/_getTag.js";import"../node_modules/lodash/_stringToPath.js";import"../node_modules/lodash/_baseToString.js";import"../models/ui/validator/rules/index.js";import"fs";import"path";import"../node_modules/lodash/_isFlattenable.js";import"./analytics.js";import"./head/index.js";import"../store/cart/index.js";const d="undefined"==typeof window;class s{constructor(){o(this)}static get tiktokPixelId(){return t.getTiktokPixelId()}static productView(o){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("ViewContent",function(o,e=1){return{content_type:"product",quantity:e,content_id:o.selectedVariant.id,value:o.selectedVariant.price.finalPrice,currency:""===o.selectedVariant.price.currency?"TRY":o.selectedVariant.price.currency}}(o)))}catch(o){console.error(o)}}static addToCart(o,e){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("AddToCart",function(o,e=1){return{content_id:o.variant.id,content_type:"product",content_name:o.variant.name,quantity:e,value:o.finalPrice,currency:o.currencyCode}}(o,e)))}catch(o){console.error(o)}}static beginCheckout(){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("InitiateCheckout"))}catch(o){console.error(o)}}static purchase(o){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("CompletePayment",function(o){const e=[];return o?.items.map((o=>{e.push({content_id:o.variant.id,content_type:"product",content_name:o.variant.name,price:o.finalPrice,quantity:o.quantity})})),{contents:e,content_type:"product_group",currency:o.items[0].currencyCode,value:o.totalPrice}}(o)))}catch(o){console.error(o)}}static addToWishlist(o){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("AddToWishlist",{content_id:o}))}catch(o){console.error(o)}}static search(o){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("Search",{query:o,content_id:"Search"}))}catch(o){console.error(o)}}static completeRegistration(){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("CompleteRegistration"))}catch(o){console.error(o)}}static viewCategory(o){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("ViewContent",{content_id:o.id,content_type:"product_group",content_category:o.name}))}catch(o){console.error(o)}}static contactForm(){try{return i(),void(!d&&this.tiktokPixelId&&window.ttq&&window.ttq.track("Contact"))}catch(o){console.error(o)}}}function i(){try{const o=e.getInstance().customerStore.customer;if(!o)return;return void(!d&&t.getTiktokPixelId()&&window.ttq&&window.ttq.identify({external_id:o.id,email:o.email,phone_number:o.phone||""}))}catch(o){console.error(o)}}export{s as TiktokPixel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as s from"react";import{observer as r}from"mobx-react-lite";import"../../../../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/index.js";import{IkasCheckoutRequirement as t}from"../../../../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../../../../node_modules/lodash/sortBy.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as i,FormItemInputMode as a}from"../form-item/model.js";import l from"./model.js";import{Checkbox as n}from"../checkbox/index.js";import"../../../../node_modules/@ikas/storefront-config/build/index.js";import{useTranslation as m}from"../../../../utils/i18n.js";import{AddressFormItem as u,BillingFormItem as c}from"@ikas/localized-address";import p from"../../styles/common.module.scss.js";import h from"../../style.module.scss.js";const b=r((o=>{const r=s.useMemo((()=>new l({...o})),[]);return s.useEffect((()=>{Object.entries(o).forEach((e=>{r[e[0]]=e[1]}))}),Object.values(o)),"in-store"===o.deliveryMethod?e(f,{props:o,vm:r}):e(g,{props:o,vm:r})})),f=r((({props:s,vm:r})=>o("div",{children:[o("div",{className:[p.Grid,p.Grid2].join(" "),children:[e(v,{...s,vm:r}),e(E,{...s,vm:r}),e("div",{})," "]}),!!r.address.checkoutSettings&&r.address.checkoutSettings.phoneRequirement!==t.INVISIBLE&&o("div",{className:h.RowPB,children:[e(S,{...s,vm:r}),e("div",{})," "]})]}))),g=r((({props:r,vm:t})=>{const{t:d}=m(),i=d=>{const i=d.map((o=>(o=>{switch(o){case u.FIRSTNAME:return e(v,{...r,vm:t});case u.LASTNAME:return e(E,{...r,vm:t});case u.IDENTITY_NUMBER:return e(k,{...r,vm:t});case u.ADDRESS_LINE_1:return e(y,{...r,vm:t});case u.ADDRESS_LINE_2:return e(C,{...r,vm:t});case u.POSTAL_CODE:return e(j,{...r,vm:t});case u.COUNTRY:return e(T,{...r,vm:t});case u.STATE:return e(_,{...r,vm:t});case u.CITY:return t.address.isFreeTextCity?e(L,{...r,vm:t}):e(N,{...r,vm:t});case u.DISTRICT:return t.address.isFreeTextDistrict?e(I,{...r,vm:t}):e(R,{...r,vm:t});case u.REGION:return e(O,{...r,vm:t});case u.PHONE:return e(S,{...r,vm:t});default:return null}})(o)));return o(s.Fragment,{children:[1===d.length&&e("div",{className:h.RowPB,children:i}),2===d.length&&o("div",{className:[p.Grid,p.Grid2].join(" "),children:[i,e("div",{})," "]}),3===d.length&&o("div",{className:[p.Grid,p.Grid2,p.Grid3].join(" "),children:[i,e("div",{})," "]})]})},a=d=>{const i=d.map((o=>(o=>{switch(o){case c.COMPANY:return e(A,{...r,vm:t});case c.TAX_NUMBER:return e(X,{...r,vm:t});case c.TAX_OFFICE:return e(V,{...r,vm:t});default:return null}})(o)));return o(s.Fragment,{children:[1===d.length&&e("div",{className:h.RowPB,children:i}),2===d.length&&o("div",{className:[p.Grid,p.Grid2].join(" "),children:[i,e("div",{})," "]}),3===d.length&&o("div",{className:[p.Grid,p.Grid2,p.Grid3].join(" "),children:[i,e("div",{})," "]})]})};return o("div",{children:[t.allowTitleChange&&e("div",{className:h.RowPB,children:e(x,{...r,vm:t})}),t.countryOptions.length<=1?t.address.addressFormatIgnoreCountry?.map((e=>i(e))):t.address.addressFormat?.map((e=>i(e))),!!t.allowCorporateInfo&&e("div",{style:{marginTop:"12px"},children:e(n,{value:t.isCorporate,label:d("checkout-page:corporateInvoice"),onChange:t.onCorporateChange})}),!!t.isCorporate&&t.address.billingFormat?.map((e=>a(e)))]})})),v=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.firstName?.label||s("checkout-page:firstName"),autocomplete:"given-name",value:o.firstName||"",onChange:o.onFirstNameChange,hasError:o.isErrorsVisible&&o.address.validationResults?.firstName.hasError,errorText:s("checkout-page:firstNameError")})})),E=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.lastName?.label||s("checkout-page:lastName"),autocomplete:"family-name",value:o.lastName||"",onChange:o.onLastNameChange,hasError:o.isErrorsVisible&&o.address.validationResults?.lastName.hasError,errorText:s("checkout-page:lastNameError")})})),k=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.identityNumber?.label||s("checkout-page:identityNumber"),value:o.identityNumber||"",onChange:o.onIdentityNumberChange,hasError:o.isErrorsVisible&&o.address.validationResults?.identityNumber.hasError,errorText:s("checkout-page:identityNumberError")})})),x=r((({vm:o})=>{const{t:s}=m(),r=o.address;return e(d,{type:i.TEXT,label:s("checkout-page:addressTitle"),value:r.title||"",onChange:o.onAddressTitleChange,hasError:o.isErrorsVisible&&!r.title,errorText:s("checkout-page:addressTitleError")})})),y=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.addressLine1?.label||s("checkout-page:addressLine1"),autocomplete:"address-line1",value:o.address.addressLine1||"",onChange:o.onAddressLine1Change,hasError:o.isErrorsVisible&&o.address.validationResults?.addressLine1.hasError,errorText:s("checkout-page:addressError")})})),C=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,autocomplete:"address-line2",label:o.address.fieldLabels?.addressLine2?.label||s("checkout-page:addressLine2"),value:o.address.addressLine2||"",onChange:o.onAddressLine2Change})})),j=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.postalCode?.label||s("checkout-page:postalCode"),autocomplete:"postal-code",value:o.address.postalCode||"",onChange:o.onAddressPostalCodeChange,hasError:o.isErrorsVisible&&o.address.validationResults?.postalCode.hasError,errorText:s("checkout-page:postalCodeError")})})),T=r((({vm:o})=>{const{t:s}=m();return o.countryOptions.length<=1?null:e(d,{type:i.SELECT,label:o.address.fieldLabels?.country?.label||s("checkout-page:country"),autocomplete:"country-name",value:o.country?.id||"",onChange:o.onCountryChange,options:o.countryOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.country.hasError,errorText:s("checkout-page:countryError")})})),_=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:o.address.fieldLabels?.state?.label||s("checkout-page:state"),value:o.state?.id||"",onChange:o.onStateChange,options:o.stateOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.state.hasError,errorText:s("checkout-page:stateError")})})),N=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:o.address.fieldLabels?.city?.label||s("checkout-page:city"),autocomplete:"off",value:o.city?.id||"",onChange:o.onCityChange,options:o.cityOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.city.hasError,errorText:s("checkout-page:cityError")})})),L=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,autocomplete:"address-level2",label:o.address.fieldLabels?.city?.label||s("checkout-page:city"),value:o.city?.name||"",hasError:o.isErrorsVisible&&o.address.validationResults?.city.hasError,onChange:o.onCityInputChange,errorText:s("checkout-page:cityError")})})),R=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:o.address.fieldLabels?.district?.label||s("checkout-page:district"),autocomplete:"off",value:o.district?.id||"",onChange:o.onDistrictChange,options:o.districtOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.district.hasError,errorText:s("checkout-page:districtError")})})),I=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,autocomplete:"address-level3",label:o.address.fieldLabels?.district?.label||s("checkout-page:district"),value:o.district?.name||"",onChange:o.onDistrictInputChange})})),O=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:s("checkout-page:region"),autocomplete:"off",value:o.region?.id||"",onChange:o.onRegionChange,options:o.regionOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.region.hasError,errorText:s("checkout-page:regionError")})})),S=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEL,inputMode:a.TEL,label:o.address.fieldLabels?.phone?.label||s("checkout-page:phone"),autocomplete:"tel",value:o.phone||"",onChange:o.onPhoneChange,hasError:o.isErrorsVisible&&o.address.validationResults?.phone.hasError,currentCountryCode:o.address.country?.iso2||o.myCountryCode,errorText:s("checkout-page:phoneError")})})),A=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.company?.label||s("checkout-page:companyName"),value:o.address.company||"",onChange:o.onCompanyChange})})),V=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.taxOffice?.label||s("checkout-page:taxOffice"),value:o.address?.taxOffice||"",onChange:o.onTaxOfficeChange})})),X=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.taxNumber?.label||s("checkout-page:taxNumber"),value:o.address?.taxNumber||"",onChange:o.onTaxNumberChange})}));export{b as AddressForm};
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as s from"react";import{observer as r}from"mobx-react-lite";import"../../../../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/index.js";import{IkasCheckoutRequirement as t}from"../../../../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../../../../node_modules/lodash/sortBy.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as i,FormItemInputMode as a}from"../form-item/model.js";import l from"./model.js";import{Checkbox as n}from"../checkbox/index.js";import"../../../../node_modules/@ikas/storefront-config/build/index.js";import{useTranslation as m}from"../../../../utils/i18n.js";import"../../../../node_modules/@ikas/localized-address/build/models/address/index.js";import{AddressFormItem as u,BillingFormItem as c}from"../../../../node_modules/@ikas/localized-address/build/models/address/model.js";import p from"../../styles/common.module.scss.js";import h from"../../style.module.scss.js";const b=r((o=>{const r=s.useMemo((()=>new l({...o})),[]);return s.useEffect((()=>{Object.entries(o).forEach((e=>{r[e[0]]=e[1]}))}),Object.values(o)),"in-store"===o.deliveryMethod?e(f,{props:o,vm:r}):e(g,{props:o,vm:r})})),f=r((({props:s,vm:r})=>o("div",{children:[o("div",{className:[p.Grid,p.Grid2].join(" "),children:[e(v,{...s,vm:r}),e(k,{...s,vm:r}),e("div",{})," "]}),!!r.address.checkoutSettings&&r.address.checkoutSettings.phoneRequirement!==t.INVISIBLE&&o("div",{className:h.RowPB,children:[e(S,{...s,vm:r}),e("div",{})," "]})]}))),g=r((({props:r,vm:t})=>{const{t:d}=m(),i=d=>{const i=d.map((o=>(o=>{switch(o){case u.FIRSTNAME:return e(v,{...r,vm:t});case u.LASTNAME:return e(k,{...r,vm:t});case u.IDENTITY_NUMBER:return e(E,{...r,vm:t});case u.ADDRESS_LINE_1:return e(y,{...r,vm:t});case u.ADDRESS_LINE_2:return e(j,{...r,vm:t});case u.POSTAL_CODE:return e(C,{...r,vm:t});case u.COUNTRY:return e(T,{...r,vm:t});case u.STATE:return e(_,{...r,vm:t});case u.CITY:return t.address.isFreeTextCity?e(L,{...r,vm:t}):e(N,{...r,vm:t});case u.DISTRICT:return t.address.isFreeTextDistrict?e(I,{...r,vm:t}):e(R,{...r,vm:t});case u.REGION:return e(O,{...r,vm:t});case u.PHONE:return e(S,{...r,vm:t});default:return null}})(o)));return o(s.Fragment,{children:[1===d.length&&e("div",{className:h.RowPB,children:i}),2===d.length&&o("div",{className:[p.Grid,p.Grid2].join(" "),children:[i,e("div",{})," "]}),3===d.length&&o("div",{className:[p.Grid,p.Grid2,p.Grid3].join(" "),children:[i,e("div",{})," "]})]})},a=d=>{const i=d.map((o=>(o=>{switch(o){case c.COMPANY:return e(A,{...r,vm:t});case c.TAX_NUMBER:return e(X,{...r,vm:t});case c.TAX_OFFICE:return e(V,{...r,vm:t});default:return null}})(o)));return o(s.Fragment,{children:[1===d.length&&e("div",{className:h.RowPB,children:i}),2===d.length&&o("div",{className:[p.Grid,p.Grid2].join(" "),children:[i,e("div",{})," "]}),3===d.length&&o("div",{className:[p.Grid,p.Grid2,p.Grid3].join(" "),children:[i,e("div",{})," "]})]})};return o("div",{children:[t.allowTitleChange&&e("div",{className:h.RowPB,children:e(x,{...r,vm:t})}),t.countryOptions.length<=1?t.address.addressFormatIgnoreCountry?.map((e=>i(e))):t.address.addressFormat?.map((e=>i(e))),!!t.allowCorporateInfo&&e("div",{style:{marginTop:"12px"},children:e(n,{value:t.isCorporate,label:d("checkout-page:corporateInvoice"),onChange:t.onCorporateChange})}),!!t.isCorporate&&t.address.billingFormat?.map((e=>a(e)))]})})),v=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.firstName?.label||s("checkout-page:firstName"),autocomplete:"given-name",value:o.firstName||"",onChange:o.onFirstNameChange,hasError:o.isErrorsVisible&&o.address.validationResults?.firstName.hasError,errorText:s("checkout-page:firstNameError")})})),k=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.lastName?.label||s("checkout-page:lastName"),autocomplete:"family-name",value:o.lastName||"",onChange:o.onLastNameChange,hasError:o.isErrorsVisible&&o.address.validationResults?.lastName.hasError,errorText:s("checkout-page:lastNameError")})})),E=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.identityNumber?.label||s("checkout-page:identityNumber"),value:o.identityNumber||"",onChange:o.onIdentityNumberChange,hasError:o.isErrorsVisible&&o.address.validationResults?.identityNumber.hasError,errorText:s("checkout-page:identityNumberError")})})),x=r((({vm:o})=>{const{t:s}=m(),r=o.address;return e(d,{type:i.TEXT,label:s("checkout-page:addressTitle"),value:r.title||"",onChange:o.onAddressTitleChange,hasError:o.isErrorsVisible&&!r.title,errorText:s("checkout-page:addressTitleError")})})),y=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.addressLine1?.label||s("checkout-page:addressLine1"),autocomplete:"address-line1",value:o.address.addressLine1||"",onChange:o.onAddressLine1Change,hasError:o.isErrorsVisible&&o.address.validationResults?.addressLine1.hasError,errorText:s("checkout-page:addressError")})})),j=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,autocomplete:"address-line2",label:o.address.fieldLabels?.addressLine2?.label||s("checkout-page:addressLine2"),value:o.address.addressLine2||"",onChange:o.onAddressLine2Change})})),C=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.postalCode?.label||s("checkout-page:postalCode"),autocomplete:"postal-code",value:o.address.postalCode||"",onChange:o.onAddressPostalCodeChange,hasError:o.isErrorsVisible&&o.address.validationResults?.postalCode.hasError,errorText:s("checkout-page:postalCodeError")})})),T=r((({vm:o})=>{const{t:s}=m();return o.countryOptions.length<=1?null:e(d,{type:i.SELECT,label:o.address.fieldLabels?.country?.label||s("checkout-page:country"),autocomplete:"country-name",value:o.country?.id||"",onChange:o.onCountryChange,options:o.countryOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.country.hasError,errorText:s("checkout-page:countryError")})})),_=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:o.address.fieldLabels?.state?.label||s("checkout-page:state"),value:o.state?.id||"",onChange:o.onStateChange,options:o.stateOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.state.hasError,errorText:s("checkout-page:stateError")})})),N=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:o.address.fieldLabels?.city?.label||s("checkout-page:city"),autocomplete:"off",value:o.city?.id||"",onChange:o.onCityChange,options:o.cityOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.city.hasError,errorText:s("checkout-page:cityError")})})),L=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,autocomplete:"address-level2",label:o.address.fieldLabels?.city?.label||s("checkout-page:city"),value:o.city?.name||"",hasError:o.isErrorsVisible&&o.address.validationResults?.city.hasError,onChange:o.onCityInputChange,errorText:s("checkout-page:cityError")})})),R=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:o.address.fieldLabels?.district?.label||s("checkout-page:district"),autocomplete:"off",value:o.district?.id||"",onChange:o.onDistrictChange,options:o.districtOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.district.hasError,errorText:s("checkout-page:districtError")})})),I=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,autocomplete:"address-level3",label:o.address.fieldLabels?.district?.label||s("checkout-page:district"),value:o.district?.name||"",onChange:o.onDistrictInputChange})})),O=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.SELECT,label:s("checkout-page:region"),autocomplete:"off",value:o.region?.id||"",onChange:o.onRegionChange,options:o.regionOptions,hasError:o.isErrorsVisible&&o.address.validationResults?.region.hasError,errorText:s("checkout-page:regionError")})})),S=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEL,inputMode:a.TEL,label:o.address.fieldLabels?.phone?.label||s("checkout-page:phone"),autocomplete:"tel",value:o.phone||"",onChange:o.onPhoneChange,hasError:o.isErrorsVisible&&o.address.validationResults?.phone.hasError,currentCountryCode:o.address.country?.iso2||o.myCountryCode,errorText:s("checkout-page:phoneError")})})),A=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.company?.label||s("checkout-page:companyName"),value:o.address.company||"",onChange:o.onCompanyChange})})),V=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.taxOffice?.label||s("checkout-page:taxOffice"),value:o.address?.taxOffice||"",onChange:o.onTaxOfficeChange})})),X=r((({vm:o})=>{const{t:s}=m();return e(d,{type:i.TEXT,label:o.address.fieldLabels?.taxNumber?.label||s("checkout-page:taxNumber"),value:o.address?.taxNumber||"",onChange:o.onTaxNumberChange})}));export{b as AddressForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as s}from"mobx";import t from"../../../../node_modules/lodash/sortBy.js";import"../../../../models/data/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import{IkasStorefrontConfig as e}from"../../../../node_modules/@ikas/storefront-config/build/index.js";import"../../../../node_modules/lodash/_baseClone.js";import"../../../../models/data/brand/index.js";import"../../../../node_modules/@ikas/storefront-api/build/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/category/conditions/index.js";import{stringSorter as i,capitalize as o}from"../../../../utils/helper.js";import"@ikas/localized-address";import"../../../../node_modules/lodash/_defineProperty.js";import"../../../../node_modules/lodash/isArguments.js";import"../../../../node_modules/lodash/isBuffer.js";import"../../../../node_modules/lodash/isTypedArray.js";import"../../../../node_modules/lodash/_baseGetTag.js";import"../../../../node_modules/lodash/_Stack.js";import"../../../../node_modules/lodash/_SetCache.js";import"../../../../node_modules/lodash/_equalByTag.js";import"../../../../node_modules/lodash/_getTag.js";import"../../../../node_modules/lodash/_stringToPath.js";import"../../../../node_modules/lodash/_baseToString.js";import"../../../../store/base.js";import"../../../../node_modules/lodash/xorBy.js";import"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import"../../../../store/cart/index.js";import"fs";import"path";import{IkasOrderAddressCity as d}from"../../../../models/data/order/address/city/index.js";import{IkasOrderAddressCountry as r}from"../../../../models/data/order/address/country/index.js";import{IkasOrderAddressDistrict as n}from"../../../../models/data/order/address/district/index.js";import{IkasOrderAddressRegion as a}from"../../../../models/data/order/address/region/index.js";import"../../../../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";import{FREE_TEXT_CITY_COUNTRY_LIST as l,DISTRICT_HIDDEN_COUNTRY_LIST as m}from"../../../../utils/constants.js";import h from"../../../../store/location/index.js";class u{constructor(t){this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=async()=>{await this.listCountries(),await this.listStates(),await this.listCities(),await this.listDistricts()},this.listCountries=async()=>{try{if(!this.myCountryCode){const s=await h.getMyCountry();this.myCountryCode=s.data}let s=(await h.listCountry({id:this.allowedCountryIds?.length?{in:this.allowedCountryIds}:void 0,locale:e.getCurrentLocale()})).data||[];const t=e.getCurrentRouting();if(t?.countryCodes?.length)s=s.filter((s=>s.iso2&&t.countryCodes?.includes(s.iso2)));else{const t=e.getRoutings().filter((s=>s.id!==e.getStorefrontRoutingId()));s=s.filter((s=>s.iso2&&!t.some((t=>t.countryCodes?.includes(s.iso2)))))}if(this.countries=s,1!==this.countries.length||this.country){if(this.countries.length&&this.myCountryCode&&!this.country){const s=this.countries.find((s=>s.iso2===this.myCountryCode));s?this.onCountryChange(s.id):this.onCountryChange(this.countries[0].id)}}else this.onCountryChange(this.countries[0].id)}catch(s){}},this.listStates=async()=>{if(this.country?.id)try{const s=await h.listState({countryId:{eq:this.country.id},locale:e.getCurrentLocale()});this.states=s.data||[],this.hasState||this.onStateChange(this.states[0].id)}catch(s){}},this.listCities=async()=>{if(this.state?.id&&this.country?.id)try{const s=await h.listCity({stateId:{eq:this.state.id},countryId:{eq:this.country.id}});this.cities=s.data||[]}catch(s){}},this.listDistricts=async()=>{if(this.city?.id&&!this.isDistrictHidden)try{const s=await h.listDistrict({cityId:{eq:this.city.id},stateId:this.state?.id?{eq:this.state?.id}:void 0});this.districts=s.data||[],this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1}catch(s){}},this.modelToOption=s=>({label:s.name,value:s.id+""}),this.onFirstNameChange=s=>{this.firstNameChangeCallback&&this.firstNameChangeCallback(s),this.address.firstName=s},this.onLastNameChange=s=>{this.lastNameChangeCallback&&this.lastNameChangeCallback(s),this.address.lastName=s},this.onPhoneChange=s=>{this.address.phone=s},this.onIdentityNumberChange=s=>{s?s.length<=11&&(this.address.identityNumber=s):this.address.identityNumber=""},this.onAddressTitleChange=s=>{this.address.title=s},this.onAddressLine1Change=s=>{this.address.addressLine1=s},this.onAddressLine2Change=s=>{this.address.addressLine2=s},this.onAddressPostalCodeChange=s=>{this.address.postalCode=s},this.onCountryChange=s=>{if(!(this.country?.id!==s))return;const t=this.countries.find((t=>t.id===s));this.address.country=new r({id:t?.id||null,name:t?.name||"",code:t?.iso3||null,iso2:t?.iso2||null,iso3:t?.iso3||null}),this.address.state=null,this.address.city=null,this.address.district=null,this.address.phone=null,this.states=[],this.cities=[],this.districts=[],this.listStates()},this.onStateChange=s=>{if(!(this.state?.id!==s))return;const t=this.states.find((t=>t.id===s));this.address.state={id:t.id,name:t?.name,code:t?.stateCode},this.address.isFreeTextCity||(this.address.city=null,this.cities=[],this.listCities()),this.address.isFreeTextDistrict||(this.address.district=null,this.districts=[])},this.onCityChange=s=>{if(!(this.city?.id!==s))return;const t=this.cities.find((t=>t.id===s));this.address.city=new d({id:t.id,name:t.name}),this.address.isFreeTextDistrict||(this.address.district=null,this.districts=[],this.listDistricts())},this.onCityInputChange=s=>{this.districts=[],this.address.city=new d({id:void 0,name:s})},this.onDistrictChange=s=>{if(!(this.district?.id!==s))return;const t=this.districts.find((t=>t.id===s));this.address.district=new n({id:t.id,name:t.name}),this.address.region=null},this.onDistrictInputChange=s=>{this.address.district=new n({id:void 0,name:s})},this.onRegionChange=s=>{if(!(this.region?.id!==s))return;const t=this.shippingZoneDistrict?.regions?.find((t=>t.id===s));this.address.region=new a({id:t.id,name:t.name})},this.onCorporateChange=s=>{this.isCorporate=s,s||(this.address.company=null,this.address.taxNumber=null,this.address.taxOffice=null)},this.onCompanyChange=s=>{this.address.company=s},this.onTaxNumberChange=s=>{this.address.taxNumber=s},this.onTaxOfficeChange=s=>{this.address.taxOffice=s},this.address=t.address,this.isCorporate=t.isCorporate||!1,this.isErrorsVisible=t.isErrorsVisible||!1,this.isCustomerAddress=t.isCustomerAddress||!1,this.allowedCountryIds=t.allowedCountryIds,this.allowCorporateInfo=t.allowCorporateInfo||!1,this.allowTitleChange=t.allowTitleChange||!1,this.firstNameChangeCallback=t.firstNameChangeCallback||null,this.lastNameChangeCallback=t.lastNameChangeCallback||null,s(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}get firstName(){return this.address.firstName}get lastName(){return this.address.lastName}get phone(){return this.address.phone}get identityNumber(){return this.address.identityNumber}get shippingZone(){return this.address.shippingZones?.find((s=>s.countryId===this.address.country?.id))}get shippingZoneState(){return this.shippingZone?.states?.find((s=>s.id===this.address.state?.id))}get shippingZoneCity(){return this.shippingZoneState?.cities?.find((s=>s.id===this.address.city?.id))}get shippingZoneDistrict(){return this.shippingZoneCity?.districts?.find((s=>s.id===this.address.district?.id))}get shippingZoneRegions(){return this.shippingZoneDistrict?.regions?.find((s=>s.id===this.address.region?.id))}get country(){return this.address.country}get state(){return this.address.state}get city(){return this.address.city}get district(){return this.address.district}get region(){return this.address.region}get countryOptions(){const s=this.countries.map(this.modelToOption);return s.sort(((s,t)=>i(s.label,t.label))),s}get stateOptions(){let s=this.states.map(this.modelToOption);return this.shippingZone&&!this.shippingZone.showAllStates&&this.shippingZone?.states?.length&&(s=s.filter((s=>this.shippingZone?.states?.some((t=>t.id===s.value))))),s.sort(((s,t)=>i(s.label,t.label))),s}get cityOptions(){let s=t(this.cities,"order").map(this.modelToOption);return this.shippingZone&&!this.shippingZoneState?.showAllCities&&this.shippingZoneState?.cities?.length&&(s=s.filter((s=>this.shippingZoneState?.cities?.some((t=>t.id===s.value))))),s}get districtOptions(){let s=this.districts.map((s=>({...s,name:o(s.name)}))).map(this.modelToOption);return this.shippingZone&&!this.shippingZoneCity?.showAllDistricts&&this.shippingZoneCity?.districts?.length&&(s=s.filter((s=>this.shippingZoneCity?.districts?.some((t=>t.id===s.value))))),s.sort(((s,t)=>i(s.label,t.label))),s}get regionOptions(){let s=this.shippingZoneDistrict?.regions?.map(this.modelToOption)||[];return s.sort(((s,t)=>i(s.label,t.label))),s}get hasState(){return this.states.length>1}get isFreeTextCity(){return l.some((s=>this.address.country?.iso2?.toLowerCase()===s.toLowerCase()))}get isDistrictHidden(){return m.some((s=>this.address.country?.iso2?.toLowerCase()===s.toLowerCase()))}}export{u as default};
|
|
1
|
+
import{makeAutoObservable as s}from"mobx";import t from"../../../../node_modules/lodash/sortBy.js";import"../../../../models/data/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/blog/meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/brand/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/estimated-delivery-time/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/available-shipping-method/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/campaign-offer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/cart/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/conditions/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/category/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/checkout-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/sales-channel/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/price-list-rule/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/review/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/customer/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/html-meta-data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/merchant-settings/address/type/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/adjustment/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/invoice/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/base-unit/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/line-item/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/package/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/payment-method-detail/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/transaction/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/order/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/additional-price/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/payment-gateway/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/attribute/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/data/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/campaign/filter/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/option-set/option/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/product/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/raffle/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/stock-location/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/b2b-settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/theme/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/meta-templates/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/storefront/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/component/prop/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/page/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/theme-json/settings/index.js";import"../../../../node_modules/@ikas/storefront-models/build/models/variant-type/index.js";import{IkasStorefrontConfig as e}from"../../../../node_modules/@ikas/storefront-config/build/index.js";import"../../../../node_modules/lodash/_baseClone.js";import"../../../../models/data/brand/index.js";import"../../../../node_modules/@ikas/storefront-api/build/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/category/conditions/index.js";import{stringSorter as i,capitalize as o}from"../../../../utils/helper.js";import"../../../../node_modules/@ikas/localized-address/build/models/address/index.js";import"../../../../node_modules/@ikas/localized-address/build/models/address/model.js";import"../../../../node_modules/lodash/_defineProperty.js";import"../../../../node_modules/lodash/isArguments.js";import"../../../../node_modules/lodash/isBuffer.js";import"../../../../node_modules/lodash/isTypedArray.js";import"../../../../node_modules/lodash/_baseGetTag.js";import"../../../../node_modules/lodash/_Stack.js";import"../../../../node_modules/lodash/_SetCache.js";import"../../../../node_modules/lodash/_equalByTag.js";import"../../../../node_modules/lodash/_getTag.js";import"../../../../node_modules/lodash/_stringToPath.js";import"../../../../node_modules/lodash/_baseToString.js";import"../../../../store/base.js";import"../../../../node_modules/lodash/xorBy.js";import"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import"../../../../store/cart/index.js";import"fs";import"path";import{IkasOrderAddressCity as d}from"../../../../models/data/order/address/city/index.js";import{IkasOrderAddressCountry as r}from"../../../../models/data/order/address/country/index.js";import{IkasOrderAddressDistrict as n}from"../../../../models/data/order/address/district/index.js";import{IkasOrderAddressRegion as a}from"../../../../models/data/order/address/region/index.js";import"../../../../node_modules/lodash/_isFlattenable.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/validator/rules/index.js";import{FREE_TEXT_CITY_COUNTRY_LIST as l,DISTRICT_HIDDEN_COUNTRY_LIST as m}from"../../../../utils/constants.js";import h from"../../../../store/location/index.js";class u{constructor(t){this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=async()=>{await this.listCountries(),await this.listStates(),await this.listCities(),await this.listDistricts()},this.listCountries=async()=>{try{if(!this.myCountryCode){const s=await h.getMyCountry();this.myCountryCode=s.data}let s=(await h.listCountry({id:this.allowedCountryIds?.length?{in:this.allowedCountryIds}:void 0,locale:e.getCurrentLocale()})).data||[];const t=e.getCurrentRouting();if(t?.countryCodes?.length)s=s.filter((s=>s.iso2&&t.countryCodes?.includes(s.iso2)));else{const t=e.getRoutings().filter((s=>s.id!==e.getStorefrontRoutingId()));s=s.filter((s=>s.iso2&&!t.some((t=>t.countryCodes?.includes(s.iso2)))))}if(this.countries=s,1!==this.countries.length||this.country){if(this.countries.length&&this.myCountryCode&&!this.country){const s=this.countries.find((s=>s.iso2===this.myCountryCode));s?this.onCountryChange(s.id):this.onCountryChange(this.countries[0].id)}}else this.onCountryChange(this.countries[0].id)}catch(s){}},this.listStates=async()=>{if(this.country?.id)try{const s=await h.listState({countryId:{eq:this.country.id},locale:e.getCurrentLocale()});this.states=s.data||[],this.hasState||this.onStateChange(this.states[0].id)}catch(s){}},this.listCities=async()=>{if(this.state?.id&&this.country?.id)try{const s=await h.listCity({stateId:{eq:this.state.id},countryId:{eq:this.country.id}});this.cities=s.data||[]}catch(s){}},this.listDistricts=async()=>{if(this.city?.id&&!this.isDistrictHidden)try{const s=await h.listDistrict({cityId:{eq:this.city.id},stateId:this.state?.id?{eq:this.state?.id}:void 0});this.districts=s.data||[],this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1}catch(s){}},this.modelToOption=s=>({label:s.name,value:s.id+""}),this.onFirstNameChange=s=>{this.firstNameChangeCallback&&this.firstNameChangeCallback(s),this.address.firstName=s},this.onLastNameChange=s=>{this.lastNameChangeCallback&&this.lastNameChangeCallback(s),this.address.lastName=s},this.onPhoneChange=s=>{this.address.phone=s},this.onIdentityNumberChange=s=>{s?s.length<=11&&(this.address.identityNumber=s):this.address.identityNumber=""},this.onAddressTitleChange=s=>{this.address.title=s},this.onAddressLine1Change=s=>{this.address.addressLine1=s},this.onAddressLine2Change=s=>{this.address.addressLine2=s},this.onAddressPostalCodeChange=s=>{this.address.postalCode=s},this.onCountryChange=s=>{if(!(this.country?.id!==s))return;const t=this.countries.find((t=>t.id===s));this.address.country=new r({id:t?.id||null,name:t?.name||"",code:t?.iso3||null,iso2:t?.iso2||null,iso3:t?.iso3||null}),this.address.state=null,this.address.city=null,this.address.district=null,this.address.phone=null,this.states=[],this.cities=[],this.districts=[],this.listStates()},this.onStateChange=s=>{if(!(this.state?.id!==s))return;const t=this.states.find((t=>t.id===s));this.address.state={id:t.id,name:t?.name,code:t?.stateCode},this.address.isFreeTextCity||(this.address.city=null,this.cities=[],this.listCities()),this.address.isFreeTextDistrict||(this.address.district=null,this.districts=[])},this.onCityChange=s=>{if(!(this.city?.id!==s))return;const t=this.cities.find((t=>t.id===s));this.address.city=new d({id:t.id,name:t.name}),this.address.isFreeTextDistrict||(this.address.district=null,this.districts=[],this.listDistricts())},this.onCityInputChange=s=>{this.districts=[],this.address.city=new d({id:void 0,name:s})},this.onDistrictChange=s=>{if(!(this.district?.id!==s))return;const t=this.districts.find((t=>t.id===s));this.address.district=new n({id:t.id,name:t.name}),this.address.region=null},this.onDistrictInputChange=s=>{this.address.district=new n({id:void 0,name:s})},this.onRegionChange=s=>{if(!(this.region?.id!==s))return;const t=this.shippingZoneDistrict?.regions?.find((t=>t.id===s));this.address.region=new a({id:t.id,name:t.name})},this.onCorporateChange=s=>{this.isCorporate=s,s||(this.address.company=null,this.address.taxNumber=null,this.address.taxOffice=null)},this.onCompanyChange=s=>{this.address.company=s},this.onTaxNumberChange=s=>{this.address.taxNumber=s},this.onTaxOfficeChange=s=>{this.address.taxOffice=s},this.address=t.address,this.isCorporate=t.isCorporate||!1,this.isErrorsVisible=t.isErrorsVisible||!1,this.isCustomerAddress=t.isCustomerAddress||!1,this.allowedCountryIds=t.allowedCountryIds,this.allowCorporateInfo=t.allowCorporateInfo||!1,this.allowTitleChange=t.allowTitleChange||!1,this.firstNameChangeCallback=t.firstNameChangeCallback||null,this.lastNameChangeCallback=t.lastNameChangeCallback||null,s(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}get firstName(){return this.address.firstName}get lastName(){return this.address.lastName}get phone(){return this.address.phone}get identityNumber(){return this.address.identityNumber}get shippingZone(){return this.address.shippingZones?.find((s=>s.countryId===this.address.country?.id))}get shippingZoneState(){return this.shippingZone?.states?.find((s=>s.id===this.address.state?.id))}get shippingZoneCity(){return this.shippingZoneState?.cities?.find((s=>s.id===this.address.city?.id))}get shippingZoneDistrict(){return this.shippingZoneCity?.districts?.find((s=>s.id===this.address.district?.id))}get shippingZoneRegions(){return this.shippingZoneDistrict?.regions?.find((s=>s.id===this.address.region?.id))}get country(){return this.address.country}get state(){return this.address.state}get city(){return this.address.city}get district(){return this.address.district}get region(){return this.address.region}get countryOptions(){const s=this.countries.map(this.modelToOption);return s.sort(((s,t)=>i(s.label,t.label))),s}get stateOptions(){let s=this.states.map(this.modelToOption);return this.shippingZone&&!this.shippingZone.showAllStates&&this.shippingZone?.states?.length&&(s=s.filter((s=>this.shippingZone?.states?.some((t=>t.id===s.value))))),s.sort(((s,t)=>i(s.label,t.label))),s}get cityOptions(){let s=t(this.cities,"order").map(this.modelToOption);return this.shippingZone&&!this.shippingZoneState?.showAllCities&&this.shippingZoneState?.cities?.length&&(s=s.filter((s=>this.shippingZoneState?.cities?.some((t=>t.id===s.value))))),s}get districtOptions(){let s=this.districts.map((s=>({...s,name:o(s.name)}))).map(this.modelToOption);return this.shippingZone&&!this.shippingZoneCity?.showAllDistricts&&this.shippingZoneCity?.districts?.length&&(s=s.filter((s=>this.shippingZoneCity?.districts?.some((t=>t.id===s.value))))),s.sort(((s,t)=>i(s.label,t.label))),s}get regionOptions(){let s=this.shippingZoneDistrict?.regions?.map(this.modelToOption)||[];return s.sort(((s,t)=>i(s.label,t.label))),s}get hasState(){return this.states.length>1}get isFreeTextCity(){return l.some((s=>this.address.country?.iso2?.toLowerCase()===s.toLowerCase()))}get isDistrictHidden(){return m.some((s=>this.address.country?.iso2?.toLowerCase()===s.toLowerCase()))}}export{u as default};
|