@ikas/popup-renderer 1.0.142 → 1.0.144

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.
@@ -6,7 +6,7 @@ import { PopupProduct } from "popup-renderer/models/modal/step/elements/product"
6
6
  export type SFProps = {
7
7
  isCustomerLoggedIn: boolean;
8
8
  currentCountryCode?: string;
9
- addProductToCart: (popupProduct: PopupProduct) => void;
9
+ addProductToCart: (popupProduct: PopupProduct) => Promise<void>;
10
10
  onModalClose: () => void;
11
11
  onCustomerSave: (customer: PopupRendererSaveCustomerInput) => Promise<void>;
12
12
  };
@@ -1 +1 @@
1
- import{__spreadArray as t,__assign as e}from'./../../../ext/tslib/tslib.es6.mjs.js';import o from"react";import{observer as i}from"mobx-react";import{getHorizontalAlignment as n,injectFontScript as l}from"../../helpers/index.js";import{ProductListTypeEnum as r,ProductListLayoutEnum as d}from"../../models/modal/step/elements/product/index.js";import a from"../button-element-renderer/index.js";import{Navigation as c,Scrollbar as u}from"swiper/modules";import{Swiper as s,SwiperSlide as v}from"swiper/react";import m from"../../assets/left-arrow.js";import g from"../../assets/right-arrow.js";import{ProductActionTypeEnum as p}from"../../models/modal/step/elements/product/detail-settings/index.js";var f=i((function(i){var f,b=i.element,h=i.products,x=i.popup,y=i.editModeChildren,C=i.isPreviewMode,E=i.sfProps,P=o.useState(null),w=P[0],S=P[1],R=o.useState(!1),z=R[0],W=R[1],j=o.useState(!1),I=j[0],D=j[1],k=b,F=[];if(h&&(F=k.listType===r.SPECIFIC?(null===(f=k.variantPairs)||void 0===f?void 0:f.length)?h.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([],h,!0)),F.length>k.maxProductsToShow&&(F.length=k.maxProductsToShow),!(F&&F.length||!x.isPreviewMode)&&y)return y;if(!F||!F.length)return null;k.gapBetweenProductElements;var A=k.productDetailSettings.image,T=k.productDetailSettings.button,N=k.buttonSettings,_=k.productDetailSettings.discountRatio,B=k.productDetailSettings.finalPrice,M=k.productDetailSettings.originalPrice,O=k.productDetailSettings.name,L=n(k.horizontalAlignment),U=1;k.layout===d.ONE_COLUMN?U=1:k.layout===d.TWO_COLUMN?U=2:k.layout===d.THREE_COLUMN&&(U=3);var H={padding:"".concat(k.outerVerticalPadding,"px ").concat(k.outerHorizontalPadding,"px"),backgroundColor:k.productBgColor,width:"100%",height:"max-content"},V={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%"},$={display:"flex",justifyContent:L,alignItems:"center",width:"100%",backgroundColor:null==A?void 0:A.bgColor,borderRadius:(null==A?void 0:A.borderRadius)?"".concat(A.borderRadius,"px"):void 0},q={width:"".concat(null==A?void 0:A.maxWidth,"%"),objectFit:"contain",borderRadius:(null==A?void 0:A.borderRadius)?"".concat(A.borderRadius,"px"):void 0},G={display:"flex",flexDirection:"column",width:"100%"},J={display:"flex",flexDirection:"column"},K={backgroundColor:null==O?void 0:O.bgColor,color:null==O?void 0:O.color,fontFamily:O?l(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},Q={backgroundColor:null==_?void 0:_.bgColor,color:null==_?void 0:_.color,fontFamily:_?l(_.fontFamily):void 0,fontSize:null==_?void 0:_.fontSize,fontWeight:null==_?void 0:_.fontWeight,padding:"".concat(null==_?void 0:_.verticalPadding,"px ").concat(null==_?void 0:_.horizontalPadding,"px"),width:"100%",textAlign:null==_?void 0:_.horizontalAlignment,border:"".concat(null==_?void 0:_.borderWidth,"px ").concat(null==_?void 0:_.borderStyle," ").concat(null==_?void 0:_.borderColor),borderRadius:null==_?void 0:_.borderRadius},X={textDecoration:"line-through",backgroundColor:null==M?void 0:M.bgColor,color:null==M?void 0:M.color,fontFamily:M?l(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},Y={backgroundColor:null==B?void 0:B.bgColor,color:null==B?void 0:B.color,fontFamily:B?l(B.fontFamily):void 0,fontSize:null==B?void 0:B.fontSize,fontWeight:null==B?void 0:B.fontWeight,padding:"".concat(null==B?void 0:B.verticalPadding,"px ").concat(null==B?void 0:B.horizontalPadding,"px"),width:"100%",textAlign:null==B?void 0:B.horizontalAlignment,border:"".concat(null==B?void 0:B.borderWidth,"px ").concat(null==B?void 0:B.borderStyle," ").concat(null==B?void 0:B.borderColor),borderRadius:null==B?void 0:B.borderRadius},Z={width:"".concat(N.width,"%"),minWidth:"fit-content"},tt=e({display:"flex",justifyContent:"center",width:"100%",gap:"10px"},1===U?{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"space-between",zIndex:10}:void 0),et={padding:10,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",border:"1px solid #EEF2F6",cursor:"pointer"};return o.createElement("div",{style:H},o.createElement(s,{onSwiper:S,modules:[c,u],spaceBetween:k.gapBetweenProducts,slidesPerView:U,navigation:{nextEl:".custom-next-button",prevEl:".custom-prev-button"},scrollbar:void 0},F.map((function(t,e){return o.createElement(v,{style:{height:"auto"},key:t.variantId},o.createElement("div",{style:V,onClick:function(){return function(t){var e;if(!C&&t.url)if((null===(e=k.productDetailSettings.button)||void 0===e?void 0:e.action)===p.ADD_TO_CART&&E)E.addProductToCart(t);else{var o=document.createElement("a");o.href=t.url,o.target="_blank",o.click()}}(t)}},o.createElement("div",{style:G},!!A&&t.imageURL&&o.createElement("div",{style:$},o.createElement("img",{src:t.imageURL||void 0,alt:t.name||void 0,style:q})),(!!O||!!_)&&o.createElement("div",{style:J},!!O&&o.createElement("div",{style:K},t.name),!!_&&!!t.discountPrice&&o.createElement("div",{style:Q},t.$discountRatio)),(!!M||!!B)&&o.createElement("div",null,!!M&&!!t.discountPrice&&o.createElement("div",{style:X},t.price),!!B&&o.createElement("div",{style:Y},t.discountPrice||t.price))),!!T&&o.createElement("div",{style:Z}," ",o.createElement(a,{element:N})," ")))})),o.createElement("div",{style:tt},o.createElement("div",{className:"custom-prev-button",style:e(e({},et),z?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){w&&(w.slidePrev(),D(w.isEnd),W(w.isBeginning))}},o.createElement(m,null)),o.createElement("div",{className:"custom-next-button",style:e(e({},et),I?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){w&&(w.slideNext(),D(w.isEnd),W(w.isBeginning))}},o.createElement(g,null)))))}));export{f as default};
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";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 u from"../button-element-renderer/index.js";import{Navigation as s,Scrollbar as v}from"swiper/modules";import{Swiper as m,SwiperSlide as g}from"swiper/react";import p 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,C=l.popup,E=l.editModeChildren,w=l.isPreviewMode,P=l.sfProps,S=i.useState(null),R=S[0],z=S[1],W=i.useState(!1),j=W[0],D=W[1],I=i.useState(!1),k=I[0],F=I[1],A=x,T=[];if(y&&(T=A.listType===a.SPECIFIC?(null===(h=A.variantPairs)||void 0===h?void 0:h.length)?y.slice().sort((function(t,e){return A.variantPairs.findIndex((function(e){return e.variantId===t.variantId}))-A.variantPairs.findIndex((function(t){return t.variantId===e.variantId}))})):[]:t([],y,!0)),T.length>A.maxProductsToShow&&(T.length=A.maxProductsToShow),!(T&&T.length||!C.isPreviewMode)&&E)return E;if(!T||!T.length)return null;A.gapBetweenProductElements;var N=A.productDetailSettings.image,_=A.productDetailSettings.button,B=A.buttonSettings,M=A.productDetailSettings.discountRatio,O=A.productDetailSettings.finalPrice,L=A.productDetailSettings.originalPrice,U=A.productDetailSettings.name,H=r(A.horizontalAlignment),V=1;A.layout===c.ONE_COLUMN?V=1:A.layout===c.TWO_COLUMN?V=2:A.layout===c.THREE_COLUMN&&(V=3);var $={padding:"".concat(A.outerVerticalPadding,"px ").concat(A.outerHorizontalPadding,"px"),backgroundColor:A.productBgColor,width:"100%",height:"max-content"},q={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%"},G={display:"flex",justifyContent:H,alignItems:"center",width:"100%",backgroundColor:null==N?void 0:N.bgColor,borderRadius:(null==N?void 0:N.borderRadius)?"".concat(N.borderRadius,"px"):void 0},J={width:"".concat(null==N?void 0:N.maxWidth,"%"),objectFit:"contain",borderRadius:(null==N?void 0:N.borderRadius)?"".concat(N.borderRadius,"px"):void 0},K={display:"flex",flexDirection:"column",width:"100%"},Q={display:"flex",flexDirection:"column"},X={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},Y={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},Z={textDecoration:"line-through",backgroundColor:null==L?void 0:L.bgColor,color:null==L?void 0:L.color,fontFamily:L?d(L.fontFamily):void 0,fontSize:null==L?void 0:L.fontSize,fontWeight:null==L?void 0:L.fontWeight,padding:"".concat(null==L?void 0:L.verticalPadding,"px ").concat(null==L?void 0:L.horizontalPadding,"px"),width:"100%",textAlign:null==L?void 0:L.horizontalAlignment,border:"".concat(null==L?void 0:L.borderWidth,"px ").concat(null==L?void 0:L.borderStyle," ").concat(null==L?void 0:L.borderColor),borderRadius:null==L?void 0:L.borderRadius},tt={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},et={width:"".concat(B.width,"%"),minWidth:"fit-content"},ot=e({display:"flex",justifyContent:"center",width:"100%",gap:"10px"},1===V?{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"space-between",zIndex:10}:void 0),nt={padding:10,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",border:"1px solid #EEF2F6",cursor:"pointer"};return i.createElement("div",{style:$},i.createElement(m,{onSwiper:z,modules:[s,v],spaceBetween:A.gapBetweenProducts,slidesPerView:V,navigation:{nextEl:".custom-next-button",prevEl:".custom-prev-button"},scrollbar:void 0},T.map((function(t,e){return i.createElement(g,{style:{height:"auto"},key:t.variantId},i.createElement("div",{style:q,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,3]:(console.log("onClick",A.productDetailSettings.button),(null===(o=A.productDetailSettings.button)||void 0===o?void 0:o.action)===b.ADD_TO_CART&&P?(console.log("add to cart"),[4,P.addProductToCart(t)]):[3,2]);case 1:return n.sent(),[3,3];case 2:console.log("open url"),(e=document.createElement("a")).href=t.url,e.target="_blank",e.click(),n.label=3;case 3:return[2]}}))}))}(t)}},i.createElement("div",{style:K},!!N&&t.imageURL&&i.createElement("div",{style:G},i.createElement("img",{src:t.imageURL||void 0,alt:t.name||void 0,style:J})),(!!U||!!M)&&i.createElement("div",{style:Q},!!U&&i.createElement("div",{style:X},t.name),!!M&&!!t.discountPrice&&i.createElement("div",{style:Y},t.$discountRatio)),(!!L||!!O)&&i.createElement("div",null,!!L&&!!t.discountPrice&&i.createElement("div",{style:Z},t.price),!!O&&i.createElement("div",{style:tt},t.discountPrice||t.price))),!!_&&i.createElement("div",{style:et}," ",i.createElement(u,{element:B})," ")))})),i.createElement("div",{style:ot},i.createElement("div",{className:"custom-prev-button",style:e(e({},nt),j?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){R&&(R.slidePrev(),F(R.isEnd),D(R.isBeginning))}},i.createElement(p,null)),i.createElement("div",{className:"custom-next-button",style:e(e({},nt),k?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){R&&(R.slideNext(),F(R.isEnd),D(R.isBeginning))}},i.createElement(f,null)))))}));export{h as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/popup-renderer",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
4
4
  "description": "",
5
5
  "author": "ucy",
6
6
  "license": "ISC",