@ikas/storefront 6.1.0-beta.76 → 6.1.0-beta.77
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as s}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import{IkasThemeJsonPageType as n}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{getCookieValue as o}from"../utils/helper.js";var a,d;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(a||(a={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT",t[t.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));var c=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",u=function(){function u(){}return u.createUUID=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))]}))}))},u.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),i={},[4,this.createUUID()];case 1:return i.id=e.sent(),i.expiry=Date.now()+this.EXPIRY_LENGTH,t=i,localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(t)),this.sessionId=t.id,[4,this.sessionStart()];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},u.createJourneyId=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.createUUID()];case 1:return t=e.sent(),localStorage.setItem(this.JOURNEY_ID_KEY,t),this.journeyId=t,[2]}}))}))},u.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(r=JSON.parse(t)).expiry<Date.now()||r.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=r.id,e.label=3;case 3:return[3,6];case 4:return[4,this.createSessionId()];case 5:e.sent(),e.label=6;case 6:return i.init({sessionId:this.sessionId||""}),[3,8];case 7:return s=e.sent(),console.error(s),[3,8];case 8:return[2]}}))}))},u.checkJourneyId=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.JOURNEY_ID_KEY))?(this.journeyId=t,[3,3]):[3,1];case 1:return[4,this.createJourneyId()];case 2:e.sent(),e.label=3;case 3:return i.init({journeyId:this.journeyId||""}),[3,5];case 4:return r=e.sent(),console.error(r),[3,5];case 5:return[2]}}))}))},u.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.VISITOR_ID_KEY))&&t.length>13?(this.visitorId=t,[3,3]):[3,1];case 1:return r=this,[4,this.createUUID()];case 2:r.visitorId=e.sent(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId),e.label=3;case 3:return i.init({visitorId:this.visitorId}),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},u.refreshJourneyId=function(){localStorage.removeItem(this.JOURNEY_ID_KEY),this.journeyId=void 0,this.checkJourneyId()},u.getPageType=function(t){switch(t){case n.INDEX:return d.INDEX;case n.CATEGORY:return d.CATEGORY;case n.BRAND:return d.BRAND;case n.PRODUCT:return d.PRODUCT;case n.CUSTOM:return d.CUSTOM;case n.ACCOUNT:return d.ACCOUNT;case n.ADDRESSES:return d.ADDRESSES;case n.ORDERS:return d.ORDERS;case n.ORDER_DETAIL:return d.ORDER_DETAIL;case n.LOGIN:return d.LOGIN;case n.REGISTER:return d.REGISTER;case n.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case n.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case n.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case n.CART:return d.CART;case n.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case n.SEARCH:return d.SEARCH;case n.NOT_FOUND:return d.NOT_FOUND;case n.BLOG:return d.BLOG;case n.BLOG_INDEX:return d.BLOG_INDEX;case n.BLOG_CATEGORY:return d.BLOG_CATEGORY;case n.CHECKOUT:return d.CHECKOUT}},u.getCustomerData=function(){var t=s.getInstance(),e=t.customerStore.customer;return{id:(null==e?void 0:e.id)||void 0,e:(null==e?void 0:e.email)||void 0,c:t.customerStore.customerConsentGranted}},u.getCommonEventData=function(){var t=s.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0,m:{fbp:o("_fbp"),fbc:o("_fbc")}}},u.getOrderLineItem=function(t){return t.orderLineItems.map((function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}))},u.getCartItem=function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})},u.sendEvents=function(n){var o,a,d,u,m,l,p,E,h;return t(this,void 0,void 0,(function(){var t,v,O;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,(t=s.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),[4,this.checkJourneyId()];case 4:return e.sent(),v={e:n,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,jid:this.journeyId,vid:this.visitorId,sfrid:i.getStorefrontRoutingId()||"",ud:r(r(r(r({id:null===(o=t.customerStore.customer)||void 0===o?void 0:o.id},(null===(a=t.customerStore.customer)||void 0===a?void 0:a.email)?{em:null===(d=t.customerStore.customer)||void 0===d?void 0:d.email}:{}),(null===(u=t.customerStore.customer)||void 0===u?void 0:u.phone)?{ph:null===(m=t.customerStore.customer)||void 0===m?void 0:m.phone}:{}),(null===(l=t.customerStore.customer)||void 0===l?void 0:l.lastName)?{ln:null===(p=t.customerStore.customer)||void 0===p?void 0:p.lastName}:{}),(null===(E=t.customerStore.customer)||void 0===E?void 0:E.firstName)?{fn:null===(h=t.customerStore.customer)||void 0===h?void 0:h.firstName}:{}),v:3},[4,fetch(c,{method:"POST",body:JSON.stringify(v),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 5:return e.sent(),[3,7];case 6:return O=e.sent(),console.error(O),[3,7];case 7:return[2]}}))}))},u.sessionStart=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.SESSION_START,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.pageView=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.PAGE_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.productView=function(i,s){return t(this,void 0,void 0,(function(){var t,n;return e(this,(function(e){switch(e.label){case 0:return t=i.categories&&i.categories.length>0?i.categories[0].path.map((function(t){return t.name})):[],n={id:s,t:a.PRODUCT_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:r({id:i.id,vid:i.selectedVariant.id,cp:t,n:i.name,pr:i.selectedVariant.finalPrice},i.selectedVariant.price.currency?{c:i.selectedVariant.price.currency}:{})}})},[4,this.sendEvents([n])];case 1:return e.sent(),[2]}}))}))},u.addToCart=function(i,s,n,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:o,t:a.ADD_TO_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:n.id,c:n.currencyCode,pr:n.totalFinalPrice,il:this.getOrderLineItem(n)},crtItm:this.getCartItem(i)}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCart=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.VIEW_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.orderSuccess=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.ORDER_SUCCESS,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success",p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[4,this.createSessionId()];case 2:return e.sent(),[2]}}))}))},u.beginCheckout=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.BEGIN_CHECKOUT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.checkoutStep=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CHECKOUT_STEP,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:s,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerRegister=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CUSTOMER_REGISTER,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerLogin=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_LOGIN,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerVisit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_VISIT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewBrand=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.BRAND_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCategory=function(i,s,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:n,t:a.CATEGORY_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id,cp:s}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewPopup=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.POPUP_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()},m:{sfpid:i}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.search=function(i,s,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.SEARCH,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{src:r({s:i},n?{r:n}:{})}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.contactForm=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CONTACT_FORM,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.addToWishlist=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.FAVORITE_PRODUCT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:{id:i}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.SESSION_ID_KEY="ikas_session_id",u.VISITOR_ID_KEY="ikas_visitor_id",u.JOURNEY_ID_KEY="ikas_journey_id",u.EXPIRY_LENGTH=18e5,u}();export{u as default};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as s}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import{IkasThemeJsonPageType as n}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import{getCookieValue as o}from"../utils/helper.js";var a,d;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(a||(a={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT",t[t.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));var c=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",u=function(){function u(){}return u.createUUID=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))]}))}))},u.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),i={},[4,this.createUUID()];case 1:return i.id=e.sent(),i.expiry=Date.now()+this.EXPIRY_LENGTH,t=i,localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(t)),this.sessionId=t.id,[4,this.sessionStart()];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},u.createJourneyId=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.createUUID()];case 1:return t=e.sent(),localStorage.setItem(this.JOURNEY_ID_KEY,t),this.journeyId=t,[2]}}))}))},u.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(r=JSON.parse(t)).expiry<Date.now()||r.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=r.id,e.label=3;case 3:return[3,6];case 4:return[4,this.createSessionId()];case 5:e.sent(),e.label=6;case 6:return i.init({sessionId:this.sessionId||""}),[3,8];case 7:return s=e.sent(),console.error(s),[3,8];case 8:return[2]}}))}))},u.checkJourneyId=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.JOURNEY_ID_KEY))?(this.journeyId=t,[3,3]):[3,1];case 1:return[4,this.createJourneyId()];case 2:e.sent(),e.label=3;case 3:return i.init({journeyId:this.journeyId||""}),[3,5];case 4:return r=e.sent(),console.error(r),[3,5];case 5:return[2]}}))}))},u.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.VISITOR_ID_KEY))&&t.length>13?(this.visitorId=t,[3,3]):[3,1];case 1:return r=this,[4,this.createUUID()];case 2:r.visitorId=e.sent(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId),e.label=3;case 3:return i.init({visitorId:this.visitorId}),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},u.refreshJourneyId=function(){localStorage.removeItem(this.JOURNEY_ID_KEY),this.journeyId=void 0,this.checkJourneyId()},u.getPageType=function(t){switch(t){case n.INDEX:return d.INDEX;case n.CATEGORY:return d.CATEGORY;case n.BRAND:return d.BRAND;case n.PRODUCT:return d.PRODUCT;case n.CUSTOM:return d.CUSTOM;case n.ACCOUNT:return d.ACCOUNT;case n.ADDRESSES:return d.ADDRESSES;case n.ORDERS:return d.ORDERS;case n.ORDER_DETAIL:return d.ORDER_DETAIL;case n.LOGIN:return d.LOGIN;case n.REGISTER:return d.REGISTER;case n.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case n.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case n.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case n.CART:return d.CART;case n.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case n.SEARCH:return d.SEARCH;case n.NOT_FOUND:return d.NOT_FOUND;case n.BLOG:return d.BLOG;case n.BLOG_INDEX:return d.BLOG_INDEX;case n.BLOG_CATEGORY:return d.BLOG_CATEGORY;case n.CHECKOUT:return d.CHECKOUT}},u.getCustomerData=function(){var t=s.getInstance(),e=t.customerStore.customer;return{id:(null==e?void 0:e.id)||void 0,e:(null==e?void 0:e.email)||void 0,c:t.customerStore.customerConsentGranted}},u.getCommonEventData=function(){var t=s.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0,m:{fbp:o("_fbp"),fbc:o("_fbc")}}},u.getOrderLineItem=function(t){return t.orderLineItems.map((function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}))},u.getCartItem=function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})},u.sendEvents=function(n){var o,a,d,u,m,l,p,E,h;return t(this,void 0,void 0,(function(){var t,v,O;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,(t=s.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),[4,this.checkJourneyId()];case 4:return e.sent(),v={e:n,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,jid:this.journeyId,vid:this.visitorId,sfrid:i.getStorefrontRoutingId()||"",ud:r(r(r(r({id:null===(o=t.customerStore.customer)||void 0===o?void 0:o.id},(null===(a=t.customerStore.customer)||void 0===a?void 0:a.email)?{em:null===(d=t.customerStore.customer)||void 0===d?void 0:d.email}:{}),(null===(u=t.customerStore.customer)||void 0===u?void 0:u.phone)?{ph:null===(m=t.customerStore.customer)||void 0===m?void 0:m.phone}:{}),(null===(l=t.customerStore.customer)||void 0===l?void 0:l.lastName)?{ln:null===(p=t.customerStore.customer)||void 0===p?void 0:p.lastName}:{}),(null===(E=t.customerStore.customer)||void 0===E?void 0:E.firstName)?{fn:null===(h=t.customerStore.customer)||void 0===h?void 0:h.firstName}:{}),v:3},[4,fetch(c,{method:"POST",body:JSON.stringify(v),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 5:return e.sent(),[3,7];case 6:return O=e.sent(),console.error(O),[3,7];case 7:return[2]}}))}))},u.sessionStart=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.SESSION_START,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.pageView=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.PAGE_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.productView=function(i,s){return t(this,void 0,void 0,(function(){var t,n;return e(this,(function(e){switch(e.label){case 0:return t=i.categories&&i.categories.length>0?i.categories[0].path.map((function(t){return t.name})):[],n={id:s,t:a.PRODUCT_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:r({id:i.id,vid:i.selectedVariant.id,cp:t,n:i.name,pr:i.selectedVariant.finalPrice},i.selectedVariant.price.currency?{c:i.selectedVariant.price.currency}:{})}})},[4,this.sendEvents([n])];case 1:return e.sent(),[2]}}))}))},u.addToCart=function(i,s,n,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:o,t:a.ADD_TO_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:n.id,c:n.currencyCode,pr:n.totalFinalPrice,il:this.getOrderLineItem(n)},crtItm:this.getCartItem(i)}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCart=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.VIEW_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.orderSuccess=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.ORDER_SUCCESS,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success",p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.beginCheckout=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.BEGIN_CHECKOUT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.checkoutStep=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CHECKOUT_STEP,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:s,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerRegister=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CUSTOMER_REGISTER,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerLogin=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_LOGIN,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerVisit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_VISIT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewBrand=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.BRAND_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCategory=function(i,s,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:n,t:a.CATEGORY_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id,cp:s}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewPopup=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.POPUP_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()},m:{sfpid:i}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.search=function(i,s,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.SEARCH,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{src:r({s:i},n?{r:n}:{})}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.contactForm=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CONTACT_FORM,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.addToWishlist=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.FAVORITE_PRODUCT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:{id:i}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.SESSION_ID_KEY="ikas_session_id",u.VISITOR_ID_KEY="ikas_visitor_id",u.JOURNEY_ID_KEY="ikas_journey_id",u.EXPIRY_LENGTH=18e5,u}();export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as r}from"../../../ext/tslib/tslib.es6.mjs.js";import t from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as a,injectFontScript as o,validateEmail as i,validatePhoneNumber as
|
|
1
|
+
import{__awaiter as e,__generator as r}from"../../../ext/tslib/tslib.es6.mjs.js";import t from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as a,injectFontScript as o,validateEmail as i,validatePhoneNumber as s}from"../../helpers/index.js";import{FormItemTypeEnum as l}from"../../models/modal/step/elements/form/index.js";import u from"../button-element-renderer/index.js";import m from"./input-item-view/index.js";import{CheckboxItemView as d}from"./checkbox-item-view/index.js";import c from"./date-item-view/index.js";import f from"./gender-item-view/index.js";var E=n((function(n){var E=n.element,p=n.popup,v=n.isPreviewMode,C=n.sfProps,I=t.useState(!1);I[0];var h=I[1],M=E,S=M.rows.slice().sort((function(e,r){return e.order-r.order})),g=M.formSettings,R=M.buttonSettings,O=M.bgColor,_={display:"flex",flexDirection:"column",justifyContent:a(M.horizontalAlignment),gap:"".concat(g.gapBetweenItems,"px"),padding:"".concat(M.outerVerticalPadding,"px ").concat(M.outerHorizontalPadding,"px"),backgroundColor:O,width:"100%"},T={display:"flex",flexDirection:"row",width:"100%",gap:"".concat(g.gapBetweenItems,"px")},b={flex:1,display:"flex",alignItems:"flex-end",fontFamily:o(g.fontFamily),fontSize:g.fontSize},U=function(){return e(void 0,void 0,void 0,(function(){var e,t,a;return r(this,(function(r){switch(r.label){case 0:return e=p.modal.steps.findIndex((function(e){return e.id===p.modal.selectedStep.id})),t=e===p.modal.steps.length-2,!v&&C&&t?(h(!0),o=0,M.rows.forEach((function(e){e.columns.forEach((function(e){switch(e.type){case l.CUSTOMER_BIRTHDAY:var r=e.formItem;r.required&&!r.value&&(r.required.hasError=!0,o++);break;case l.CUSTOMER_EMAIL:case l.CUSTOMER_PHONE:case l.CUSTOMER_NAME:case l.CUSTOMER_SURNAME:var t=e.formItem;if(t.required&&!t.value){if(t.type===l.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn))return;t.required.hasError=!0,o++}else if(e.type===l.CUSTOMER_EMAIL){var n=i(t.value||"");t.validEmailError.hasError=!n,n||o++}else if(e.type===l.CUSTOMER_PHONE&&t.required){var a=s(t.value||"",null==C?void 0:C.currentCountryCode);t.validPhoneError.hasError=!a,a||o++}break;case l.CUSTOMER_GENDER:var u=e.formItem,m=u.genders.find((function(e){return e.isSelected}));u.required&&!m&&(u.required.hasError=!0,o++);break;case l.CHECKBOX_FORM_ITEM:var d=e.formItem;d.requiredToBeChecked&&!d.isChecked&&(d.requiredToBeChecked.hasError=!0,o++)}}))})),o>0?(h(!1),[2]):(a={},M.rows.forEach((function(e){e.columns.forEach((function(e){var r;switch(e.type){case l.CUSTOMER_BIRTHDAY:a.birthday=e.formItem.value;break;case l.CUSTOMER_EMAIL:a.email=e.formItem.value;break;case l.CUSTOMER_GENDER:a.gender=(null===(r=e.formItem.genders.find((function(e){return e.isSelected})))||void 0===r?void 0:r.type)||"";break;case l.CUSTOMER_PHONE:a.phone=e.formItem.value;break;case l.CUSTOMER_NAME:a.firstName=e.formItem.value||"";break;case l.CUSTOMER_SURNAME:a.lastName=e.formItem.value||"";break;case l.CHECKBOX_FORM_ITEM:a.hasPermission=e.formItem.isChecked}}))})),[4,C.onCustomerSave(a)])):[3,2];case 1:r.sent(),n.setIsCustomerSaved(!0),h(!1),r.label=2;case 2:return-1!==e&&e<p.modal.steps.length&&(p.modal.selectedStep=p.modal.steps[e+1]),[2]}var o}))}))};return t.createElement("div",{style:_},S.map((function(e,r){return t.createElement("div",{style:T,key:r},e.columns.slice().sort((function(e,r){return e.order-r.order})).map((function(e,r){return t.createElement("div",{style:b,key:r},function(e){switch(e.type){case l.CUSTOMER_EMAIL:case l.CUSTOMER_PHONE:case l.CUSTOMER_NAME:case l.CUSTOMER_SURNAME:var r=e.formItem;if(r.type===l.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn)&&!v)return null;var n=null;if(e.type===l.CUSTOMER_EMAIL){var a=r;a.validEmailError.hasError&&(n=a.validEmailError.validationErrorMessage)}else if(e.type===l.CUSTOMER_PHONE){var o=r;o.validPhoneError.hasError&&(n=o.validPhoneError.validationErrorMessage)}return t.createElement(m,{formInputSettings:g.formInputSettings,inputLabel:r.inputLabel,isRequired:r.required,onValueChange:function(e){return v?null:r.value=e},placeholder:r.placeholder,updateCurrentInfo:r.updateCurrentInfo,value:r.value||"",validationErrorMessage:n});case l.CUSTOMER_BIRTHDAY:var i=e.formItem;return t.createElement(c,{formInputSettings:g.formInputSettings,inputLabel:i.inputLabel,isRequired:i.required,onValueChange:function(e){return v?null:i.value=e},placeholder:i.placeholder,updateCurrentInfo:i.updateCurrentInfo,value:i.value||""});case l.CUSTOMER_GENDER:var s=e.formItem;return t.createElement(f,{genderFormItem:s,formInputSettings:g.formInputSettings,onValueChange:function(e){return v?null:s.genders.forEach((function(r){r.isSelected=r.label===e}))}});case l.CHECKBOX_FORM_ITEM:return t.createElement(d,{checkboxItem:e.formItem})}}(e))})))})),t.createElement("div",{style:{width:"100%",minWidth:"fit-content"},onClick:function(e){U(),e.preventDefault(),e.stopPropagation()}},t.createElement(u,{element:R})," "))}));export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as t}from"../../../../../mobx-react/dist/mobxreact.esm.js";import{PopupTypeEnum as o,PopupPositonEnum as n}from"../models/modal/index.js";import i from"../assets/x-close.js";import{CloseButtonPositionTypeEnum as r,CloseIconTypeEnum as
|
|
1
|
+
import e from"react";import{observer as t}from"../../../../../mobx-react/dist/mobxreact.esm.js";import{PopupTypeEnum as o,PopupPositonEnum as n}from"../models/modal/index.js";import i from"../assets/x-close.js";import{CloseButtonPositionTypeEnum as r,CloseIconTypeEnum as s,CloseButtonDisplayTypeEnum as l}from"../models/modal/close-settings/index.js";import{PopupElementTypeEnum as a,ComponentVerticalAlignmentEnum as d}from"../models/modal/step/elements/base/index.js";import c from"./text-element-renderer/index.js";import m from"./button-element-renderer/index.js";import p from"./space-element-renderer/index.js";import u from"./divider-element-renderer/index.js";import f from"./social-element-renderer/index.js";import P from"./image-element-renderer/index.js";import E from"./image-column-element-renderer/index.js";import x from"./product-list-renderer/index.js";import v from"./form-element-renderer/index.js";import{ImageColumnPositionEnum as g,MobileImageColumnPositionEnum as T}from"../models/modal/step/elements/image-column/index.js";var y=t((function(t){var y,b,C,O,I=t.popup,_=t.dynamicData,h=t.dashboardComponents,M=t.previewMode,S=t.sfProps,w=t.isMobile,A=e.useState(!1),D=A[0],R=A[1],k=I.modal,N=k.teaser,j=!!k.selectedStep.isTeaser,B=k.selectedStep.elements.find((function(e){return e.type===a.IMAGE_COLUMN})),L=j?N.backgroundSettings:k.backgroundSettings,U=j?N.windowSettings:k.windowSettings,H=j?N.closeSettings:k.closeSettings,W=L.allowScrollingWhenPopupOpen,F=I.isPreviewMode||M,V=!!F||k.isVisible;document.body.style.overflow=V&&!W?"hidden":"auto";var G=L.overlay,z=L.border,K="center",X="center";switch(j?o.POPUP:k.type){case o.POPUP:var Y=j?N.position:k.position;Y===n.POPUP_TOP_LEFT?(K="flex-start",X="flex-start"):Y===n.POPUP_TOP_CENTER?(K="center",X="flex-start"):Y===n.POPUP_TOP_RIGHT?(K="flex-end",X="flex-start"):Y===n.POPUP_MIDDLE_LEFT?(K="flex-start",X="center"):Y===n.POPUP_MIDDLE_CENTER?(K="center",X="center"):Y===n.POPUP_MIDDLE_RIGHT?(K="flex-end",X="center"):Y===n.POPUP_BOTTOM_LEFT?(K="flex-start",X="flex-end"):Y===n.POPUP_BOTTOM_CENTER?(K="center",X="flex-end"):Y===n.POPUP_BOTTOM_RIGHT&&(K="flex-end",X="flex-end");break;case o.DRAWER:k.position===n.DRAWER_LEFT?(K="flex-start",X="center"):k.position===n.DRAWER_RIGHT&&(K="flex-end",X="center");break;case o.NOTIFICATION_BAR:k.position===n.NOTIFICATION_BAR_UP?(K="center",X="flex-start"):k.position===n.NOTIFICATION_BAR_DOWN&&(K="center",X="flex-end")}var q=e.useMemo((function(){return 2147483644}),[]),J=e.useMemo((function(){return q+1}),[]),Q=e.useMemo((function(){return J+1}),[]),Z=e.useMemo((function(){return Q+1}),[]),$={position:"fixed",display:"flex",justifyContent:K,alignItems:X,top:0,left:0,right:0,bottom:0,zIndex:q,overflow:"hidden",padding:"".concat(U.outerVerticalPadding,"px ").concat(U.outerHorizontalPadding,"px"),opacity:V?1:0,visibility:V?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},ee={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:J,backgroundColor:G?G.bgColor:"",opacity:G?(G.bgOpacity||100)/100:void 0},te={position:"relative",zIndex:Q,backgroundColor:L.bgColor,border:z?"".concat(z.borderWidth,"px ").concat(z.borderStyle," ").concat(z.borderColor):"",borderRadius:"".concat(U.borderRadius,"px"),maxWidth:"100%",maxHeight:"100%",width:U.takeFullWidth?"100%":void 0,minHeight:U.minHeight,height:U.takeFullHeight?"100%":void 0,boxShadow:L.shadow?"0 0 10px ".concat(L.shadow.color):"",overflow:"auto",opacity:V?1:0,visibility:V?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},oe="";switch(null==B?void 0:B.verticalAlignment){case d.BOTTOM:oe="flex-end";break;case d.MIDDLE:oe="center";break;case d.TOP:oe="flex-start"}var ne=B?B.imagePosition===g.LEFT_ALIGN?"row-reverse":"row":"",ie=B?B.mobilePosition===T.TOP?"column-reverse":"column":"",re={display:"flex",flexDirection:B?w?ie:ne:"column",overflow:"hidden"},se={width:U.takeFullWidth?"100%":U.maxWidth,maxWidth:"100%",overflow:"auto",display:"flex",flexDirection:"column",justifyContent:oe,padding:"".concat(U.innerVerticalPadding,"px ").concat(U.innerHorizontalPadding,"px")},le={position:H.closeButtonPositionType===r.TAKE_SPACE?"relative":"absolute",float:H.closeButtonPositionType===r.TAKE_SPACE?"right":"none",top:8,right:8,zIndex:Z},ae={position:"sticky",padding:"6px",marginLeft:H.closeButtonPositionType===r.TAKE_SPACE?"14px":void 0,display:"flex",justifyContent:"center",alignItems:"center",border:(null===(y=H.iconSettings)||void 0===y?void 0:y.type)===s.WITH_BORDER?"1px solid ".concat(null===(b=H.iconSettings)||void 0===b?void 0:b.color):"",borderRadius:"50%",backgroundColor:null===(C=H.iconSettings)||void 0===C?void 0:C.backgroundColor},de={color:null===(O=H.iconSettings)||void 0===O?void 0:O.color,cursor:"pointer"},ce=function(t){var o=t.type,n=h&&h[o]&&h[o].length?h[o][0]:null,i=n&&I.marketingPopupViewModel?e.createElement(n,{element:t,marketingPopupViewModel:I.marketingPopupViewModel}):void 0;switch(o){case a.TEXT:return e.createElement(c,{element:t});case a.IMAGE:return e.createElement(P,{element:t,popup:I,editModeChildren:i});case a.IMAGE_COLUMN:return w&&B.mobilePosition===T.HIDE?null:e.createElement(E,{element:t,popup:I,editModeChildren:i,isMobile:w});case a.BUTTON:return e.createElement(m,{element:t,onClose:me,isStandaloneButtonComponent:!0});case a.DIVIDER:return e.createElement(u,{element:t});case a.FORM:return e.createElement(v,{element:t,popup:I,isPreviewMode:!!F,sfProps:S,setIsCustomerSaved:R});case a.PRODUCT_LIST:return e.createElement(x,{element:t,products:_.products[t.id],popup:I,editModeChildren:i,isPreviewMode:!!F,sfProps:S,onClose:me});case a.SOCIAL_MEDIA:return e.createElement(f,{element:t,popup:I,editModeChildren:i});case a.SPACE:return e.createElement(p,{element:t})}},me=function(e){if(!F&&k.isVisible){var t=D||e;k.isVisible=!1,S&&S.onModalClose(t),R(!1)}};return e.createElement("div",{className:"ikas-popup-default-styles",id:"ikas-popup-container",style:$},e.createElement("div",{style:te},H.closeButtonDisplayType!==l.ALWAYS_HIDDEN&&e.createElement("div",{style:le,onClick:function(){return me()}},e.createElement("div",{style:ae,className:H.closeButtonDisplayType===l.VISIBLE_ON_HOVER?"visible-on-hover":""},e.createElement(i,{style:de}))),e.createElement("div",{style:re,onClick:function(e){j&&(k.selectedStep=k.steps[0])}},e.createElement("div",{style:se},k.selectedStep.elements.filter((function(e){return e.type!==a.IMAGE_COLUMN})).slice().sort((function(e,t){return e.order-t.order})).map((function(e){return ce(e)}))),B&&ce(B))),e.createElement("div",{style:ee,onClick:function(){return me()}}))}));export{y as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.77",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"build": "rm -rf build && rollup -c"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ikas/popup-renderer": "^1.0.
|
|
20
|
+
"@ikas/popup-renderer": "^1.0.190",
|
|
21
21
|
"swiper": "11.0.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
25
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
26
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
24
|
+
"@ikas/storefront-api": "^6.1.0-beta.77",
|
|
25
|
+
"@ikas/storefront-config": "^6.1.0-beta.77",
|
|
26
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.77",
|
|
27
|
+
"@ikas/storefront-models": "^6.1.0-beta.77",
|
|
28
|
+
"@ikas/storefront-providers": "^6.1.0-beta.77",
|
|
29
29
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
30
30
|
"@adyen/adyen-web": "^5.57.0",
|
|
31
31
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
63
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
64
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
65
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
63
|
+
"@ikas/storefront-api": "^6.1.0-beta.77",
|
|
64
|
+
"@ikas/storefront-config": "^6.1.0-beta.77",
|
|
65
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.77",
|
|
66
|
+
"@ikas/storefront-models": "^6.1.0-beta.77",
|
|
67
|
+
"@ikas/storefront-providers": "^6.1.0-beta.77",
|
|
68
68
|
"mobx": "^6.1.3",
|
|
69
69
|
"mobx-react-lite": "^3.1.5",
|
|
70
70
|
"next": "12.2.0",
|