@ikas/storefront 5.0.15 → 5.0.16
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/components/popup/index.js +1 -1
- package/build/components/popup/renderer/index.js +1 -1
- package/build/components/popup/renderer/model.d.ts +1 -1
- package/build/components/popup/renderer/model.js +1 -1
- package/build/components/popup/utils/index.d.ts +1 -0
- package/build/components/popup/utils/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as r}from"mobx-react-lite";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import n from"../../hooks/useDimension.js";import o from"./renderer/index.js";import{checkSavedSessionForPopups as s}from"./utils/index.js";import{IkasStorefrontPopupDeviceTypeEnum as
|
|
1
|
+
import{__spreadArray as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as r}from"mobx-react-lite";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import n from"../../hooks/useDimension.js";import o from"./renderer/index.js";import{checkSavedSessionForPopups as s,checkIsPopupSavedToLocalStorage as m}from"./utils/index.js";import{IkasStorefrontPopupDeviceTypeEnum as l}from"@ikas/storefront-models";var p=r((function(){var r=n().isMobile,p=t.useState([]),c=p[0],d=p[1];return t.useEffect((function(){s();var t=i.getStorefrontPopups().filter((function(e){return!m(e.id)&&(r?[l.ALL,l.MOBILE].includes(e.visibleDevice):[l.ALL,l.DESKTOP].includes(e.visibleDevice))})),n=document.head.querySelector('link[href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"]');if(t.length&&!n){var o=document.createElement("link");o.type="text/css",o.rel="stylesheet",o.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",document.head.appendChild(o)}d(e([],t,!0))}),[r]),t.createElement(t.Fragment,null,c.map((function(e,r){return t.createElement(o,{storefrontPopup:e,key:e.id})})))}));export{p as PopupListRendererForPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as p}from"mobx-react-lite";import d from"../../../hooks/useDimension.js";import{IkasBaseStore as s}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import{IkasStorefrontPopupDisplayTriggerTypeEnum as n}from"../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import{exitIntent as t}from"../utils/index.js";import{IkasStorefrontPopupRendererViewModel as i}from"./model.js";import"react-date-picker/dist/DatePicker.css";import u from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import'./../../../ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';var m=p((function(p){var m=p.storefrontPopup,l=r.useState((function(){return new i({},m)}))[0],a=d().isMobile;r.useEffect((function(){e(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return[4,l.init()];case 1:if(o.sent(),!l.storefrontPopupData)return[2];if(!l.isModalClosedByUser){if((e=l.storefrontPopupData.displaySettings.triggerType)===n.SCROLL_DOWN)return window.addEventListener("scroll",l.handleScroll),[2,function(){window.removeEventListener("scroll",l.handleScroll)}];if(e===n.EXIT_INTENT)return r=t({onExitIntent:function(){l.openModal()}}),[2,function(){r()}]}return[2]}}))}))}),[]);var b=r.useCallback((function(r){return e(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,l.addProductToCart(r)];case 1:return
|
|
1
|
+
import{__awaiter as e,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as p}from"mobx-react-lite";import d from"../../../hooks/useDimension.js";import{IkasBaseStore as s}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import{IkasStorefrontPopupDisplayTriggerTypeEnum as n}from"../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import{exitIntent as t}from"../utils/index.js";import{IkasStorefrontPopupRendererViewModel as i}from"./model.js";import"react-date-picker/dist/DatePicker.css";import u from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import'./../../../ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';var m=p((function(p){var m=p.storefrontPopup,l=r.useState((function(){return new i({},m)}))[0],a=d().isMobile;r.useEffect((function(){e(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return[4,l.init()];case 1:if(o.sent(),!l.storefrontPopupData)return[2];if(!l.isModalClosedByUser){if((e=l.storefrontPopupData.displaySettings.triggerType)===n.SCROLL_DOWN)return window.addEventListener("scroll",l.handleScroll),[2,function(){window.removeEventListener("scroll",l.handleScroll)}];if(e===n.EXIT_INTENT)return r=t({onExitIntent:function(){l.openModal()}}),[2,function(){r()}]}return[2]}}))}))}),[]);var b=r.useCallback((function(r){return e(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,l.addProductToCart(r)];case 1:return[2,e.sent()]}}))}))}),[]);return l.storefrontPopupData&&l.storefrontPopupData.contentJson&&!l.isLoading?r.createElement(u,{key:l.storefrontPopupData.id,popup:l.storefrontPopupData.contentJson,dynamicData:{products:l.popupProducts},sfProps:{onModalClose:l.onModalClose,onCustomerSave:l.onCustomerFormDataSave,isCustomerLoggedIn:l.isCustomerLoggedIn,currentCountryCode:s.getInstance().currentCountryCode||void 0,addProductToCart:b},isMobile:a}):null}));export{m as default};
|
|
@@ -12,7 +12,7 @@ export declare class IkasStorefrontPopupRendererViewModel {
|
|
|
12
12
|
init(): Promise<void>;
|
|
13
13
|
getStorefrontPopup(): Promise<void>;
|
|
14
14
|
getStorefrontPopupProducts(): Promise<void>;
|
|
15
|
-
addProductToCart(popupProduct: PopupProduct): Promise<
|
|
15
|
+
addProductToCart(popupProduct: PopupProduct): Promise<boolean>;
|
|
16
16
|
openModal(): void;
|
|
17
17
|
onModalClose(addToLocalStorage?: boolean): void;
|
|
18
18
|
onCustomerFormDataSave(customer: PopupRendererSaveCustomerInput): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as e}from"@ikas/storefront-config";import{makeObservable as r,observable as s,action as i,computed as n}from"mobx";import a from"../../../store/storefront-popup/index.js";import{IkasStorefrontPopup as p}from"../../../models/data/storefront-popup/index.js";import{addPopupToLocalStorage as u,getPopupsFromLocalStorage as d,getPopupProducts as l}from"../utils/index.js";import{IkasStorefrontPopupDisplayFrequencyEnum as c,IkasStorefrontPopupDisplayTriggerTypeEnum as f}from"../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import{IkasBaseStore as h}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import{Analytics as m}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";var P=function(){function P(t,o){this.isLoading=t.isLoading||!0,this.storefrontPopup=o,this.storefrontPopupData=t.storefrontPopupData||null,this.popupProducts=t.popupProducts||{},this.isModalClosedByUser=t.isModalClosedByUser||!1,this.ikasProducts=t.ikasProducts||[],r(this,{isLoading:s,storefrontPopup:s,storefrontPopupData:s,popupProducts:s,isModalClosedByUser:s,ikasProducts:s,getStorefrontPopup:i.bound,getStorefrontPopupProducts:i.bound,openModal:i.bound,onModalClose:i.bound,init:i.bound,initTeaser:i.bound,checkDeviceType:i.bound,initTriggerType:i.bound,handleScroll:i.bound,onCustomerFormDataSave:i.bound,isCustomerLoggedIn:n})}return P.prototype.init=function(){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getStorefrontPopup()];case 1:return t.sent(),[4,this.getStorefrontPopupProducts()];case 2:return t.sent(),this.initTeaser(),this.checkDeviceType(),this.initTriggerType(),this.isLoading=!1,[2]}}))}))},P.prototype.getStorefrontPopup=function(){var r,s;return t(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(o){switch(o.label){case 0:return[4,a.listStorefrontPopup({idList:[this.storefrontPopup.id]})];case 1:return t=o.sent(),(null===(s=null===(r=t.data)||void 0===r?void 0:r.data)||void 0===s?void 0:s.length)&&(this.storefrontPopupData=new p(t.data.data[0]),i=d(),n=e.getSessionId(),i&&n&&i[n]&&this.storefrontPopupData.displaySettings.frequency===c.ONCE_PER_SESSION&&i[n].includes(this.storefrontPopup.id)&&(this.isModalClosedByUser=!0)),[2]}}))}))},P.prototype.getStorefrontPopupProducts=function(){var r,s;return t(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(o){switch(o.label){case 0:return(null===(r=this.storefrontPopupData)||void 0===r?void 0:r.contentJson)?[4,l(this.storefrontPopupData.contentJson,e.getCdnUrl()||"",(null===(s=e.getMerchantSettings())||void 0===s?void 0:s.merchantId)||"",e.getPriceListId())]:[2];case 1:return t=o.sent(),i=t.totalProducts,n=t.ikasProducts,this.popupProducts=i,this.ikasProducts=n,[2]}}))}))},P.prototype.addProductToCart=function(e){return t(this,void 0,void 0,(function(){var t,r;return o(this,(function(o){switch(o.label){case 0:return t=this.ikasProducts.find((function(t){return t.id===e.productId})),r=null==t?void 0:t.variants.find((function(t){return t.id===e.variantId})),t&&r?[4,h.getInstance().cartStore.addItem(r,t)]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}}))}))},P.prototype.openModal=function(){var t;(null===(t=this.storefrontPopupData)||void 0===t?void 0:t.contentJson)&&(this.isModalClosedByUser||(this.storefrontPopupData.contentJson.modal.isVisible=!0,m.viewStorefrontPopup(this.storefrontPopup)))},P.prototype.onModalClose=function(t){(this.isModalClosedByUser=!0,this.storefrontPopupData)&&((this.storefrontPopupData.displaySettings.frequency===c.ONCE_PER_SESSION||t)&&u(this.storefrontPopup.id))},P.prototype.onCustomerFormDataSave=function(e){return t(this,void 0,void 0,(function(){var t,r,s,i;return o(this,(function(o){switch(o.label){case 0:return t=h.getInstance(),r=t.customerStore,s=r.customer,i="",i=s&&s.email?s.email:e.email?e.email:e.firstName+e.lastName,[4,r.saveCustomerFormData({email:i,firstName:e.firstName||(null==s?void 0:s.firstName)||"",lastName:e.lastName||(null==s?void 0:s.lastName)||"",birthDate:e.birthday||(null==s?void 0:s.birthDate)||"",phone:e.phone||(null==s?void 0:s.phone)||"",storefrontPopupId:this.storefrontPopup.id,subscriptions:{email:!!e.hasPermission,phone:!!e.hasPermission,sms:!!e.hasPermission}})];case 1:return o.sent(),[2]}}))}))},P.prototype.initTeaser=function(){var t;(null===(t=this.storefrontPopupData)||void 0===t?void 0:t.contentJson)&&this.storefrontPopupData.contentJson.modal.teaser.isActive&&(this.storefrontPopupData.contentJson.modal.selectedStep=this.storefrontPopupData.contentJson.modal.teaser.step)},P.prototype.checkDeviceType=function(){this.storefrontPopupData&&this.storefrontPopupData.visibleDevice},P.prototype.initTriggerType=function(){var t=this;if(this.storefrontPopupData){var o=this.storefrontPopupData.displaySettings.triggerType,e=this.storefrontPopupData.displaySettings.triggerValue||0;if(o===f.ON_PAGE_LOAD)setTimeout((function(){t.openModal()}),1e3*e)}},P.prototype.handleScroll=function(){if(this.storefrontPopupData){var t=this.storefrontPopupData.displaySettings.triggerType,o=this.storefrontPopupData.displaySettings.triggerValue||0;if(f.SCROLL_DOWN===t&&this.storefrontPopupData&&!this.isModalClosedByUser){var e=o,r=window.innerHeight,s=document.documentElement.scrollHeight;window.scrollY/(s-r)*100>=e&&this.openModal()}}},Object.defineProperty(P.prototype,"isCustomerLoggedIn",{get:function(){return!!h.getInstance().customerStore.customer},enumerable:!1,configurable:!0}),P}();export{P as IkasStorefrontPopupRendererViewModel};
|
|
1
|
+
import{__awaiter as t,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as e}from"@ikas/storefront-config";import{makeObservable as r,observable as s,action as i,computed as n}from"mobx";import a from"../../../store/storefront-popup/index.js";import{IkasStorefrontPopup as p}from"../../../models/data/storefront-popup/index.js";import{addPopupToLocalStorage as u,getPopupsFromLocalStorage as d,getPopupProducts as l}from"../utils/index.js";import{IkasStorefrontPopupDisplayFrequencyEnum as c,IkasStorefrontPopupDisplayTriggerTypeEnum as f}from"../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import{IkasBaseStore as h}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import{Analytics as m}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";var P=function(){function P(t,o){this.isLoading=t.isLoading||!0,this.storefrontPopup=o,this.storefrontPopupData=t.storefrontPopupData||null,this.popupProducts=t.popupProducts||{},this.isModalClosedByUser=t.isModalClosedByUser||!1,this.ikasProducts=t.ikasProducts||[],r(this,{isLoading:s,storefrontPopup:s,storefrontPopupData:s,popupProducts:s,isModalClosedByUser:s,ikasProducts:s,getStorefrontPopup:i.bound,getStorefrontPopupProducts:i.bound,openModal:i.bound,onModalClose:i.bound,init:i.bound,initTeaser:i.bound,checkDeviceType:i.bound,initTriggerType:i.bound,handleScroll:i.bound,onCustomerFormDataSave:i.bound,isCustomerLoggedIn:n})}return P.prototype.init=function(){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getStorefrontPopup()];case 1:return t.sent(),[4,this.getStorefrontPopupProducts()];case 2:return t.sent(),this.initTeaser(),this.checkDeviceType(),this.initTriggerType(),this.isLoading=!1,[2]}}))}))},P.prototype.getStorefrontPopup=function(){var r,s;return t(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(o){switch(o.label){case 0:return[4,a.listStorefrontPopup({idList:[this.storefrontPopup.id]})];case 1:return t=o.sent(),(null===(s=null===(r=t.data)||void 0===r?void 0:r.data)||void 0===s?void 0:s.length)&&(this.storefrontPopupData=new p(t.data.data[0]),i=d(),n=e.getSessionId(),i&&n&&i[n]&&this.storefrontPopupData.displaySettings.frequency===c.ONCE_PER_SESSION&&i[n].includes(this.storefrontPopup.id)&&(this.isModalClosedByUser=!0)),[2]}}))}))},P.prototype.getStorefrontPopupProducts=function(){var r,s;return t(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(o){switch(o.label){case 0:return(null===(r=this.storefrontPopupData)||void 0===r?void 0:r.contentJson)?[4,l(this.storefrontPopupData.contentJson,e.getCdnUrl()||"",(null===(s=e.getMerchantSettings())||void 0===s?void 0:s.merchantId)||"",e.getPriceListId())]:[2];case 1:return t=o.sent(),i=t.totalProducts,n=t.ikasProducts,this.popupProducts=i,this.ikasProducts=n,[2]}}))}))},P.prototype.addProductToCart=function(e){return t(this,void 0,void 0,(function(){var t,r,s,i;return o(this,(function(o){switch(o.label){case 0:return t=this.ikasProducts.find((function(t){return t.id===e.productId})),r=null==t?void 0:t.variants.find((function(t){return t.id===e.variantId})),s=void 0,((null==t?void 0:t.hasVariant)||(null==t?void 0:t.productOptionSetId))&&e.url&&((i=document.createElement("a")).href=e.url,i.target="_self",i.click()),t&&r?[4,h.getInstance().cartStore.addItem(r,t)]:[3,2];case 1:s=o.sent(),o.label=2;case 2:return[2,!!(null==s?void 0:s.success)]}}))}))},P.prototype.openModal=function(){var t;(null===(t=this.storefrontPopupData)||void 0===t?void 0:t.contentJson)&&!this.storefrontPopupData.contentJson.modal.isVisible&&(this.isModalClosedByUser||(this.storefrontPopupData.contentJson.modal.isVisible=!0,m.viewStorefrontPopup(this.storefrontPopup)))},P.prototype.onModalClose=function(t){(this.isModalClosedByUser=!0,this.storefrontPopupData)&&((this.storefrontPopupData.displaySettings.frequency===c.ONCE_PER_SESSION||t)&&u(this.storefrontPopup.id))},P.prototype.onCustomerFormDataSave=function(e){return t(this,void 0,void 0,(function(){var t,r,s,i;return o(this,(function(o){switch(o.label){case 0:return t=h.getInstance(),r=t.customerStore,s=r.customer,i="",i=s&&s.email?s.email:e.email?e.email:e.firstName+e.lastName,[4,r.saveCustomerFormData({email:i,firstName:e.firstName||(null==s?void 0:s.firstName)||"",lastName:e.lastName||(null==s?void 0:s.lastName)||"",birthDate:e.birthday||(null==s?void 0:s.birthDate)||"",phone:e.phone||(null==s?void 0:s.phone)||"",storefrontPopupId:this.storefrontPopup.id,subscriptions:{email:!!e.hasPermission,phone:!!e.hasPermission,sms:!!e.hasPermission}})];case 1:return o.sent(),[2]}}))}))},P.prototype.initTeaser=function(){var t;(null===(t=this.storefrontPopupData)||void 0===t?void 0:t.contentJson)&&this.storefrontPopupData.contentJson.modal.teaser.isActive&&(this.storefrontPopupData.contentJson.modal.selectedStep=this.storefrontPopupData.contentJson.modal.teaser.step)},P.prototype.checkDeviceType=function(){this.storefrontPopupData&&this.storefrontPopupData.visibleDevice},P.prototype.initTriggerType=function(){var t=this;if(this.storefrontPopupData){var o=this.storefrontPopupData.displaySettings.triggerType,e=this.storefrontPopupData.displaySettings.triggerValue||0;if(o===f.ON_PAGE_LOAD)setTimeout((function(){t.openModal()}),1e3*e)}},P.prototype.handleScroll=function(){if(this.storefrontPopupData){var t=this.storefrontPopupData.displaySettings.triggerType,o=this.storefrontPopupData.displaySettings.triggerValue||0;if(f.SCROLL_DOWN===t&&this.storefrontPopupData&&!this.isModalClosedByUser){var e=o,r=window.innerHeight,s=document.documentElement.scrollHeight;window.scrollY/(s-r)*100>=e&&this.openModal()}}},Object.defineProperty(P.prototype,"isCustomerLoggedIn",{get:function(){return!!h.getInstance().customerStore.customer},enumerable:!1,configurable:!0}),P}();export{P as IkasStorefrontPopupRendererViewModel};
|
|
@@ -5,6 +5,7 @@ export declare const SESSION_POPUPS_KEY = "ikas-storefront-popups";
|
|
|
5
5
|
export declare const getPopupsFromLocalStorage: () => SessionStorefrontPopups | null;
|
|
6
6
|
export declare const addPopupToLocalStorage: (popupId: string) => void;
|
|
7
7
|
export declare const checkSavedSessionForPopups: () => void;
|
|
8
|
+
export declare const checkIsPopupSavedToLocalStorage: (popupId: string) => boolean;
|
|
8
9
|
export declare function getPopupProducts(model: Popup, cdnURL: string, merchantId: string, priceListId?: string): Promise<{
|
|
9
10
|
totalProducts: Record<string, PopupProduct[]>;
|
|
10
11
|
ikasProducts: IkasProduct[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as e,__awaiter as r,__generator as o,__assign as n}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as
|
|
1
|
+
import{__spreadArray as e,__awaiter as r,__generator as o,__assign as n}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as t}from"@ikas/storefront-config";import d from"lodash/throttle";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import{getPopupDynamicData as s}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import{PopupElementTypeEnum as i}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import{ProductListTypeEnum as p,PopupProduct as u,MAX_PRODUCT_COUNT as a}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';import{SortByDirectionEnum as l}from"@ikas/storefront-api";import m from"../../../store/product/index.js";var c="ikas-storefront-popups",f=function(){var e=localStorage.getItem("ikas-storefront-popups");return e?JSON.parse(e):null},v=function(r){var o=f()||{},n=t.getSessionId();if(n){var d=o[n]?o[n]:[],s=r;o[n]=e(e([],d,!0),[s],!1),localStorage.setItem("ikas-storefront-popups",JSON.stringify(o))}},g=function(){var e=t.getSessionId(),r=f();r&&e&&!Object.keys(r).includes(e)&&localStorage.removeItem("ikas-storefront-popups")},b=function(e){var r=f();if(!r)return!1;var o=!1;return Object.keys(r).forEach((function(n){r[n].includes(e)&&(o=!0)})),o};function k(e,d,c,f){var v,g,b;return r(this,void 0,void 0,(function(){var r,f,k,h,x,_,j,I;return o(this,(function(P){switch(P.label){case 0:r={},f=[],k=[],e.modal.steps.forEach((function(e){e.elements.forEach((function(e){e.type===i.PRODUCT_LIST&&k.push(e)}))})),h=s(e),x=function(s){var i,k,x,_,j,I,P,E,y,S;return o(this,(function(o){switch(o.label){case 0:switch(i={input:{}},k=s.sortType.includes("ASC")?l.ASC:l.DESC,x=s.sortType.replace("ASC_","").replace("DESC_",""),_={direction:k,type:x},s.listType){case p.ALL:case p.LAST_VIEWED:i.input={page:1,perPage:a,order:_?[_]:void 0};break;case p.SPECIFIC:(j=s.variantPairs||[]).length&&(I=j.map((function(e){return e.productId})),i.input={productIdList:I,page:1,perPage:a,order:_?[_]:void 0});break;case p.CATEGORY:P=s.categoryId,i.input={categoryIdList:P?[P]:void 0,page:1,perPage:a,order:_?[_]:void 0}}return s.listType!==p.CATEGORY||i.input.categoryIdList?[4,m.searchProducts({input:n(n({},i.input),{priceListId:t.getPriceListId(),salesChannelId:t.getSalesChannelId()})})]:[2,"continue"];case 1:return(E=o.sent())&&E.isSuccess&&(null===(g=null===(v=E.data)||void 0===v?void 0:v.data)||void 0===g?void 0:g.length)&&(null==(y=null===(b=E.data)||void 0===b?void 0:b.data)?void 0:y.length)&&(S=[],y.forEach((function(r){var o,n,t;if(s.listType===p.SPECIFIC){var i=h.variantPairs.filter((function(e){return e.productListElementId===s.id}));(m=r.variants.find((function(e){return i.some((function(o){return o.productId===r.id&&o.variantId===e.id}))})))&&(t=[m])}else t=(null==r?void 0:r.variants[0])?[r.variants[0]]:[];for(var a=0,l=t||[];a<l.length;a++){var m;if((m=l[a])&&r){var v=(null===(o=m.images)||void 0===o?void 0:o.length)?m.images[0]:null;S.push(new u({productId:r.id,variantId:m.id,name:r.name,price:m.formattedSellPrice,discountPrice:m.hasDiscount?m.formattedDiscountPrice:null,discountRatio:m.discountPercentage?m.discountPercentage:null,imageURL:v?"".concat(d,"images/").concat(c,"/").concat(v.imageId):null,url:"".concat(e.storeUrl,"/").concat(null===(n=r.metaData)||void 0===n?void 0:n.slug)})),f.find((function(e){return e.id===r.id}))||f.push(r)}}})),r[s.id]=S),[2]}}))},_=0,j=k,P.label=1;case 1:return _<j.length?(I=j[_],[5,x(I)]):[3,4];case 2:P.sent(),P.label=3;case 3:return _++,[3,1];case 4:return[2,{totalProducts:r,ikasProducts:f}]}}))}))}var h=function(e){var r,o,t,s,i,p;return void 0===e&&(e={}),t=n(n({},{threshold:20,maxDisplays:1,eventThrottle:200,onExitIntent:function(){}}),e),s=new Map,i=0,p=function(){s.forEach((function(e,r,o){return function(e){var r=s.get(e),o=r.eventName,n=r.callback;document.removeEventListener(o,n),s.delete(e)}(r)}))},r="mousemove",o=d((function(e){e.clientY<=t.threshold&&i<t.maxDisplays&&(i++,1)&&(t.onExitIntent(),i>=t.maxDisplays&&p())}),t.eventThrottle),document.addEventListener(r,o,!1),s.set("document:".concat(r),{eventName:r,callback:o}),p};export{c as SESSION_POPUPS_KEY,v as addPopupToLocalStorage,b as checkIsPopupSavedToLocalStorage,g as checkSavedSessionForPopups,h as exitIntent,k as getPopupProducts,f as getPopupsFromLocalStorage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=t.checkboxItem;e.useEffect((function(){r.showInCheckedStatus?r.isChecked=!0:r.isChecked=!1}),[r.showInCheckedStatus]);var
|
|
1
|
+
import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=t.checkboxItem;e.useEffect((function(){r.showInCheckedStatus?r.isChecked=!0:r.isChecked=!1}),[r.showInCheckedStatus]);var i=r.requiredToBeChecked,o=e.useCallback((function(){var e=/<pre[^>]*>([\s\S]*?)<\/pre>/.exec(r.text);return e?e[1]:r.text}),[]);return e.createElement("div",{style:{width:"100%",display:"flex",gap:6,flexDirection:"column"}},e.createElement("div",{style:{width:"100%",display:"flex",gap:8,flexDirection:"row",alignItems:"baseline",wordBreak:"break-word"}},e.createElement("input",{style:{width:"16px",height:"16px",cursor:"pointer",position:"relative",top:3},type:"checkbox",checked:r.isChecked,onChange:function(){r.isChecked=!r.isChecked,i&&i.hasError&&r.isChecked&&(i.hasError=!1)}}),e.createElement("div",{dangerouslySetInnerHTML:{__html:o()}})),!!i&&i.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},i.validationErrorMessage))}));export{r as CheckboxItemView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=e.useState(!1),o=r[0],n=r[1];e.useRef(null);var l=t.placeholder,a=t.isRequired,i=t.inputLabel;t.updateCurrentInfo;var c=t.validationErrorMessage,d=t.formInputSettings,u=t.value,s=t.onValueChange,p={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(o?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"
|
|
1
|
+
import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=e.useState(!1),o=r[0],n=r[1];e.useRef(null);var l=t.placeholder,a=t.isRequired,i=t.inputLabel;t.updateCurrentInfo;var c=t.validationErrorMessage,d=t.formInputSettings,u=t.value,s=t.onValueChange,p={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(o?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},x=a?((null==l?void 0:l.text)||"")+" *":(null==l?void 0:l.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(i||a)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},i&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},i.text)),a&&a.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},a.validationErrorMessage),!!c&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},c)),e.createElement("input",{type:"text",placeholder:x,value:u||"",onChange:function(e){return function(e){s(e),a&&a.hasError&&e.length>0&&(a.hasError=!1)}(e.target.value)},style:p,onFocus:function(){return n(!0)},onBlur:function(){return n(!1)}}))}));export{r 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 l,CloseButtonDisplayTypeEnum as s}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 g from"./form-element-renderer/index.js";import{ImageColumnPositionEnum as v,MobileImageColumnPositionEnum as T}from"../models/modal/step/elements/image-column/index.js";var y=t((function(t){var y,b,O,C,I=t.popup,_=t.dynamicData,h=t.dashboardComponents,M=t.previewMode,w=t.sfProps,A=t.isMobile,D=I.modal,R=D.teaser,S=!!D.selectedStep.isTeaser,k=D.selectedStep.elements.find((function(e){return e.type===a.IMAGE_COLUMN})),N=S?R.backgroundSettings:D.backgroundSettings,j=S?R.windowSettings:D.windowSettings,L=S?R.closeSettings:D.closeSettings,B=N.allowScrollingWhenPopupOpen,U=I.isPreviewMode||M,H=!!U||D.isVisible;document.body.style.overflow=H&&!B?"hidden":"auto";var W=N.overlay,F=N.border,V="center",G="center";switch(S?o.POPUP:D.type){case o.POPUP:var z=S?R.position:D.position;z===n.POPUP_TOP_LEFT?(V="flex-start",G="flex-start"):z===n.POPUP_TOP_CENTER?(V="center",G="flex-start"):z===n.POPUP_TOP_RIGHT?(V="flex-end",G="flex-start"):z===n.POPUP_MIDDLE_LEFT?(V="flex-start",G="center"):z===n.POPUP_MIDDLE_CENTER?(V="center",G="center"):z===n.POPUP_MIDDLE_RIGHT?(V="flex-end",G="center"):z===n.POPUP_BOTTOM_LEFT?(V="flex-start",G="flex-end"):z===n.POPUP_BOTTOM_CENTER?(V="center",G="flex-end"):z===n.POPUP_BOTTOM_RIGHT&&(V="flex-end",G="flex-end");break;case o.DRAWER:D.position===n.DRAWER_LEFT?(V="flex-start",G="center"):D.position===n.DRAWER_RIGHT&&(V="flex-end",G="center");break;case o.NOTIFICATION_BAR:D.position===n.NOTIFICATION_BAR_UP?(V="center",G="flex-start"):D.position===n.NOTIFICATION_BAR_DOWN&&(V="center",G="flex-end")}var K=e.useMemo((function(){return 2147483644}),[]),X=e.useMemo((function(){return K+1}),[]),Y=e.useMemo((function(){return X+1}),[]),q=e.useMemo((function(){return Y+1}),[]),J={position:"fixed",display:"flex",justifyContent:V,alignItems:G,top:0,left:0,right:0,bottom:0,zIndex:K,overflow:"hidden",padding:"".concat(j.outerVerticalPadding,"px ").concat(j.outerHorizontalPadding,"px"),opacity:H?1:0,visibility:H?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},Q={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:X,backgroundColor:W?W.bgColor:"",opacity:W?(W.bgOpacity||100)/100:void 0},Z={position:"relative",zIndex:Y,backgroundColor:N.bgColor,border:F?"".concat(F.borderWidth,"px ").concat(F.borderStyle," ").concat(F.borderColor):"",borderRadius:"".concat(j.borderRadius,"px"),maxWidth:"100%",maxHeight:"100%",width:j.takeFullWidth?"100%":void 0,minHeight:j.minHeight,height:j.takeFullHeight?"100%":void 0,boxShadow:N.shadow?"0 0 10px ".concat(N.shadow.color):"",overflow:"auto",opacity:H?1:0,visibility:H?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},$="";switch(null==k?void 0:k.verticalAlignment){case d.BOTTOM:$="flex-end";break;case d.MIDDLE:$="center";break;case d.TOP:$="flex-start"}var ee=k?k.imagePosition===v.LEFT_ALIGN?"row-reverse":"row":"",te=k?k.mobilePosition===T.TOP?"column-reverse":"column":"",oe={display:"flex",flexDirection:k?A?te:ee:"column",overflow:"hidden"},ne={width:j.takeFullWidth?"100%":j.maxWidth,maxWidth:"100%",overflow:"auto",display:"flex",flexDirection:"column",justifyContent:$,padding:"".concat(j.innerVerticalPadding,"px ").concat(j.innerHorizontalPadding,"px")},ie={position:L.closeButtonPositionType===r.TAKE_SPACE?"relative":"absolute",float:L.closeButtonPositionType===r.TAKE_SPACE?"right":"none",top:8,right:8,zIndex:q},re={position:"sticky",padding:"6px",marginLeft:L.closeButtonPositionType===r.TAKE_SPACE?"14px":void 0,display:"flex",justifyContent:"center",alignItems:"center",border:(null===(y=L.iconSettings)||void 0===y?void 0:y.type)===l.WITH_BORDER?"1px solid ".concat(null===(b=L.iconSettings)||void 0===b?void 0:b.color):"",borderRadius:"50%",backgroundColor:null===(O=L.iconSettings)||void 0===O?void 0:O.backgroundColor},le={color:null===(C=L.iconSettings)||void 0===C?void 0:C.color,cursor:"pointer"},se=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 A&&k.mobilePosition===T.HIDE?null:e.createElement(E,{element:t,popup:I,editModeChildren:i,isMobile:A});case a.BUTTON:return e.createElement(m,{element:t});case a.DIVIDER:return e.createElement(u,{element:t});case a.FORM:return e.createElement(g,{element:t,popup:I,isPreviewMode:!!U,sfProps:w});case a.PRODUCT_LIST:return e.createElement(x,{element:t,products:_.products[t.id],popup:I,editModeChildren:i,isPreviewMode:!!U,sfProps:w,onClose:ae});case a.SOCIAL_MEDIA:return e.createElement(f,{element:t,popup:I,editModeChildren:i});case a.SPACE:return e.createElement(p,{element:t})}},ae=function(e){U||D.isVisible&&(D.isVisible=!1,w&&w.onModalClose(e))};return e.createElement("div",{className:"ikas-popup-default-styles",id:"ikas-popup-container",style:J},e.createElement("div",{style:Z},L.closeButtonDisplayType!==s.ALWAYS_HIDDEN&&e.createElement("div",{style:ie,onClick:function(){return ae()}},e.createElement("div",{style:re,className:L.closeButtonDisplayType===s.VISIBLE_ON_HOVER?"visible-on-hover":""},e.createElement(i,{style:le}))),e.createElement("div",{style:oe,onClick:function(e){S&&(D.selectedStep=D.steps[0])}},e.createElement("div",{style:ne},D.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 se(e)}))),k&&se(k))),e.createElement("div",{style:Q,onClick:function(){return ae()}}))}));export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as t,__assign as e,__awaiter as o,__generator as n}from"../../../ext/tslib/tslib.es6.mjs.js";import i from"react";import{observer as l}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as r,injectFontScript as d}from"../../helpers/index.js";import{ProductListTypeEnum as a,ProductListLayoutEnum as c}from"../../models/modal/step/elements/product/index.js";import s from"../button-element-renderer/index.js";import u from"../../../../../../swiper/modules/navigation.mjs.js";import m from"../../../../../../swiper/modules/scrollbar.mjs.js";import{Swiper as v,SwiperSlide as
|
|
1
|
+
import{__spreadArray as t,__assign as e,__awaiter as o,__generator as n}from"../../../ext/tslib/tslib.es6.mjs.js";import i from"react";import{observer as l}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as r,injectFontScript as d}from"../../helpers/index.js";import{ProductListTypeEnum as a,ProductListLayoutEnum as c}from"../../models/modal/step/elements/product/index.js";import s from"../button-element-renderer/index.js";import u from"../../../../../../swiper/modules/navigation.mjs.js";import m from"../../../../../../swiper/modules/scrollbar.mjs.js";import{Swiper as v,SwiperSlide as p}from"../../../../../../swiper/swiper-react.mjs.js";import g from"../../assets/left-arrow.js";import f from"../../assets/right-arrow.js";import{ProductActionTypeEnum as b}from"../../models/modal/step/elements/product/detail-settings/index.js";var h=l((function(l){var h,x=l.element,y=l.products,E=l.popup,C=l.editModeChildren,w=l.isPreviewMode,P=l.sfProps,S=l.onClose,j=i.useState(null),R=j[0],z=j[1],W=i.useState(!1),_=W[0],A=W[1],I=i.useState(!1),D=I[0],F=I[1],k=x,T=[];if(y&&(T=k.listType===a.SPECIFIC?(null===(h=k.variantPairs)||void 0===h?void 0:h.length)?y.slice().sort((function(t,e){return k.variantPairs.findIndex((function(e){return e.variantId===t.variantId}))-k.variantPairs.findIndex((function(t){return t.variantId===e.variantId}))})):[]:t([],y,!0)),T.length>k.maxProductsToShow&&(T.length=k.maxProductsToShow),!(T&&T.length||!E.isPreviewMode)&&C)return C;if(!T||!T.length)return null;k.gapBetweenProductElements;var L=k.productDetailSettings.image,N=k.productDetailSettings.button,B=k.buttonSettings,M=k.productDetailSettings.discountRatio,O=k.productDetailSettings.finalPrice,U=k.productDetailSettings.originalPrice,H=k.productDetailSettings.name,V=r(k.horizontalAlignment),$=1;k.layout===c.ONE_COLUMN?$=1:k.layout===c.TWO_COLUMN?$=2:k.layout===c.THREE_COLUMN&&($=3);var q={padding:"".concat(k.outerVerticalPadding,"px ").concat(k.outerHorizontalPadding,"px"),backgroundColor:k.productBgColor,width:"100%",height:"max-content"},G={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%"},J={display:"flex",justifyContent:V,alignItems:"center",width:"100%",backgroundColor:null==L?void 0:L.bgColor,borderRadius:(null==L?void 0:L.borderRadius)?"".concat(L.borderRadius,"px"):void 0},K={width:"".concat(null==L?void 0:L.maxWidth,"%"),objectFit:"contain",borderRadius:(null==L?void 0:L.borderRadius)?"".concat(L.borderRadius,"px"):void 0},Q={display:"flex",flexDirection:"column",width:"100%"},X={display:"flex",flexDirection:"column"},Y={backgroundColor:null==H?void 0:H.bgColor,color:null==H?void 0:H.color,fontFamily:H?d(H.fontFamily):void 0,fontSize:null==H?void 0:H.fontSize,fontWeight:null==H?void 0:H.fontWeight,padding:"".concat(null==H?void 0:H.verticalPadding,"px ").concat(null==H?void 0:H.horizontalPadding,"px"),width:"100%",textAlign:null==H?void 0:H.horizontalAlignment,border:"".concat(null==H?void 0:H.borderWidth,"px ").concat(null==H?void 0:H.borderStyle," ").concat(null==H?void 0:H.borderColor),borderRadius:null==H?void 0:H.borderRadius},Z={backgroundColor:null==M?void 0:M.bgColor,color:null==M?void 0:M.color,fontFamily:M?d(M.fontFamily):void 0,fontSize:null==M?void 0:M.fontSize,fontWeight:null==M?void 0:M.fontWeight,padding:"".concat(null==M?void 0:M.verticalPadding,"px ").concat(null==M?void 0:M.horizontalPadding,"px"),width:"100%",textAlign:null==M?void 0:M.horizontalAlignment,border:"".concat(null==M?void 0:M.borderWidth,"px ").concat(null==M?void 0:M.borderStyle," ").concat(null==M?void 0:M.borderColor),borderRadius:null==M?void 0:M.borderRadius},tt={textDecoration:"line-through",backgroundColor:null==U?void 0:U.bgColor,color:null==U?void 0:U.color,fontFamily:U?d(U.fontFamily):void 0,fontSize:null==U?void 0:U.fontSize,fontWeight:null==U?void 0:U.fontWeight,padding:"".concat(null==U?void 0:U.verticalPadding,"px ").concat(null==U?void 0:U.horizontalPadding,"px"),width:"100%",textAlign:null==U?void 0:U.horizontalAlignment,border:"".concat(null==U?void 0:U.borderWidth,"px ").concat(null==U?void 0:U.borderStyle," ").concat(null==U?void 0:U.borderColor),borderRadius:null==U?void 0:U.borderRadius},et={backgroundColor:null==O?void 0:O.bgColor,color:null==O?void 0:O.color,fontFamily:O?d(O.fontFamily):void 0,fontSize:null==O?void 0:O.fontSize,fontWeight:null==O?void 0:O.fontWeight,padding:"".concat(null==O?void 0:O.verticalPadding,"px ").concat(null==O?void 0:O.horizontalPadding,"px"),width:"100%",textAlign:null==O?void 0:O.horizontalAlignment,border:"".concat(null==O?void 0:O.borderWidth,"px ").concat(null==O?void 0:O.borderStyle," ").concat(null==O?void 0:O.borderColor),borderRadius:null==O?void 0:O.borderRadius},ot={width:"".concat(B.width,"%"),minWidth:"fit-content"},nt=e({display:"flex",justifyContent:"center",width:"100%",gap:"10px"},1===$?{position:"absolute",top:"calc(50% - 25px)",alignItems:"center",justifyContent:"space-between",zIndex:10}:void 0),it={padding:10,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",border:"1px solid #EEF2F6",cursor:"pointer"};return i.createElement("div",{style:q},i.createElement(v,{onSwiper:z,modules:[u,m],spaceBetween:k.gapBetweenProducts,slidesPerView:$,navigation:{nextEl:".custom-next-button",prevEl:".custom-prev-button"},scrollbar:void 0},T.map((function(t,e){return i.createElement(p,{style:{height:"auto"},key:t.variantId},i.createElement("div",{style:G,onClick:function(){return function(t){return o(void 0,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return w||!t.url?[3,4]:(null===(o=k.productDetailSettings.button)||void 0===o?void 0:o.action)===b.ADD_TO_CART&&P?[4,P.addProductToCart(t)]:[3,2];case 1:return n.sent()&&((e=document.createElement("a")).href="".concat(E.storeUrl,"/cart"),e.target="_self",e.click()),[3,3];case 2:(e=document.createElement("a")).href=t.url,e.target="_self",e.click(),n.label=3;case 3:S(!0),n.label=4;case 4:return[2]}}))}))}(t)}},i.createElement("div",{style:Q},!!L&&t.imageURL&&i.createElement("div",{style:J},i.createElement("img",{src:t.imageURL||void 0,alt:t.name||void 0,style:K})),(!!H||!!M)&&i.createElement("div",{style:X},!!H&&i.createElement("div",{style:Y},t.name),!!M&&!!t.discountPrice&&i.createElement("div",{style:Z},t.$discountRatio)),(!!U||!!O)&&i.createElement("div",null,!!U&&!!t.discountPrice&&i.createElement("div",{style:tt},t.price),!!O&&i.createElement("div",{style:et},t.discountPrice||t.price))),!!N&&i.createElement("div",{style:ot}," ",i.createElement(s,{element:B})," ")))})),i.createElement("div",{style:nt},i.createElement("div",{className:"custom-prev-button",style:e(e({},it),_?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){R&&(R.slidePrev(),F(R.isEnd),A(R.isBeginning))}},i.createElement(g,null)),i.createElement("div",{className:"custom-next-button",style:e(e({},it),D?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){R&&(R.slideNext(),F(R.isEnd),A(R.isBeginning))}},i.createElement(f,null)))))}));export{h as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.16",
|
|
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.162",
|
|
21
21
|
"swiper": "11.0.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@ikas/storefront-api": "^5.0.
|
|
25
|
-
"@ikas/storefront-config": "^5.0.
|
|
26
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
27
|
-
"@ikas/storefront-models": "^5.0.
|
|
28
|
-
"@ikas/storefront-providers": "^5.0.
|
|
24
|
+
"@ikas/storefront-api": "^5.0.16",
|
|
25
|
+
"@ikas/storefront-config": "^5.0.16",
|
|
26
|
+
"@ikas/storefront-model-functions": "^5.0.16",
|
|
27
|
+
"@ikas/storefront-models": "^5.0.16",
|
|
28
|
+
"@ikas/storefront-providers": "^5.0.16",
|
|
29
29
|
"@ikas/localized-address": "1.0.0-beta.3",
|
|
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.3",
|
|
63
|
-
"@ikas/storefront-api": "^5.0.
|
|
64
|
-
"@ikas/storefront-config": "^5.0.
|
|
65
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
66
|
-
"@ikas/storefront-models": "^5.0.
|
|
67
|
-
"@ikas/storefront-providers": "^5.0.
|
|
63
|
+
"@ikas/storefront-api": "^5.0.16",
|
|
64
|
+
"@ikas/storefront-config": "^5.0.16",
|
|
65
|
+
"@ikas/storefront-model-functions": "^5.0.16",
|
|
66
|
+
"@ikas/storefront-models": "^5.0.16",
|
|
67
|
+
"@ikas/storefront-providers": "^5.0.16",
|
|
68
68
|
"mobx": "^6.1.3",
|
|
69
69
|
"mobx-react-lite": "^3.1.5",
|
|
70
70
|
"next": "12.2.0",
|