@ikas/popup-renderer 0.0.14 → 0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as t,__assign as e}from'./../../../ext/tslib/tslib.es6.mjs.js';import o from"react";import'./../../../ext/mobx-react-lite/es/index.js';import{getHorizontalAlignment as n}from"../../helpers/index.js";import{ProductListTypeEnum as i,ProductListLayoutEnum as l}from"../../models/modal/step/elements/product/index.js";import r from"../button-element-renderer/index.js";import{Navigation as d,Scrollbar as a}from"swiper/modules";import{Swiper as c,SwiperSlide as u}from"swiper/react";import s from"../../assets/left-arrow.js";import v from"../../assets/right-arrow.js";import{observer as m}from'./../../../ext/mobx-react-lite/es/observer.js';var g=m((function(m){var g,p=m.element,f=m.products,b=m.popup,h=m.editModeChildren,x=o.useState(null),y=x[0],E=x[1],C=o.useState(!1),w=C[0],P=C[1],S=o.useState(!1),R=S[0],z=S[1],j=p,W=[];if(f&&(W=j.listType===i.SPECIFIC?(null===(g=j.variantPairs)||void 0===g?void 0:g.length)?f.slice().sort((function(t,e){return j.variantPairs.findIndex((function(e){return e.variantId===t.variantId}))-j.variantPairs.findIndex((function(t){return t.variantId===e.variantId}))})):[]:t([],f,!0)),W.length>j.maxProductsToShow&&(W.length=j.maxProductsToShow),!(W&&W.length||!b.isPreviewMode)&&h)return h;if(!W||!W.length)return null;j.gapBetweenProductElements;var I=j.productDetailSettings.image,F=j.productDetailSettings.button,k=j.buttonSettings,D=j.productDetailSettings.discountRatio,A=j.productDetailSettings.finalPrice,N=j.productDetailSettings.originalPrice,B=j.productDetailSettings.name,_=n(j.horizontalAlignment),L=1;j.layout===l.ONE_COLUMN?L=1:j.layout===l.TWO_COLUMN?L=2:j.layout===l.THREE_COLUMN&&(L=3);var M={padding:"".concat(j.verticalPadding,"px ").concat(j.horizontalPadding,"px"),backgroundColor:j.productBgColor,width:"100%",height:"max-content"},O={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%"},T={display:"flex",justifyContent:_,alignItems:"center",width:"100%",backgroundColor:null==I?void 0:I.bgColor,borderRadius:(null==I?void 0:I.borderRadius)?"".concat(I.borderRadius,"px"):void 0},U={width:"".concat(null==I?void 0:I.maxWidth,"%"),objectFit:"contain",borderRadius:(null==I?void 0:I.borderRadius)?"".concat(I.borderRadius,"px"):void 0}
|
|
1
|
+
import{__spreadArray as t,__assign as e}from'./../../../ext/tslib/tslib.es6.mjs.js';import o from"react";import'./../../../ext/mobx-react-lite/es/index.js';import{getHorizontalAlignment as n}from"../../helpers/index.js";import{ProductListTypeEnum as i,ProductListLayoutEnum as l}from"../../models/modal/step/elements/product/index.js";import r from"../button-element-renderer/index.js";import{Navigation as d,Scrollbar as a}from"swiper/modules";import{Swiper as c,SwiperSlide as u}from"swiper/react";import s from"../../assets/left-arrow.js";import v from"../../assets/right-arrow.js";import{observer as m}from'./../../../ext/mobx-react-lite/es/observer.js';var g=m((function(m){var g,p=m.element,f=m.products,b=m.popup,h=m.editModeChildren,x=o.useState(null),y=x[0],E=x[1],C=o.useState(!1),w=C[0],P=C[1],S=o.useState(!1),R=S[0],z=S[1],j=p,W=[];if(f&&(W=j.listType===i.SPECIFIC?(null===(g=j.variantPairs)||void 0===g?void 0:g.length)?f.slice().sort((function(t,e){return j.variantPairs.findIndex((function(e){return e.variantId===t.variantId}))-j.variantPairs.findIndex((function(t){return t.variantId===e.variantId}))})):[]:t([],f,!0)),W.length>j.maxProductsToShow&&(W.length=j.maxProductsToShow),!(W&&W.length||!b.isPreviewMode)&&h)return h;if(!W||!W.length)return null;j.gapBetweenProductElements;var I=j.productDetailSettings.image,F=j.productDetailSettings.button,k=j.buttonSettings,D=j.productDetailSettings.discountRatio,A=j.productDetailSettings.finalPrice,N=j.productDetailSettings.originalPrice,B=j.productDetailSettings.name,_=n(j.horizontalAlignment),L=1;j.layout===l.ONE_COLUMN?L=1:j.layout===l.TWO_COLUMN?L=2:j.layout===l.THREE_COLUMN&&(L=3);var M={padding:"".concat(j.verticalPadding,"px ").concat(j.horizontalPadding,"px"),backgroundColor:j.productBgColor,width:"100%",height:"max-content"},O={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%"},T={display:"flex",justifyContent:_,alignItems:"center",width:"100%",backgroundColor:null==I?void 0:I.bgColor,borderRadius:(null==I?void 0:I.borderRadius)?"".concat(I.borderRadius,"px"):void 0},U={width:"".concat(null==I?void 0:I.maxWidth,"%"),objectFit:"contain",borderRadius:(null==I?void 0:I.borderRadius)?"".concat(I.borderRadius,"px"):void 0},H={display:"flex",flexDirection:"column",width:"100%"},V={display:"flex",flexDirection:"column"},$={backgroundColor:null==B?void 0:B.bgColor,color:null==B?void 0:B.color,fontFamily:null==B?void 0:B.fontFamily,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},q={backgroundColor:null==D?void 0:D.bgColor,color:null==D?void 0:D.color,fontFamily:null==D?void 0:D.fontFamily,fontSize:null==D?void 0:D.fontSize,fontWeight:null==D?void 0:D.fontWeight,padding:"".concat(null==D?void 0:D.verticalPadding,"px ").concat(null==D?void 0:D.horizontalPadding,"px"),width:"100%",textAlign:null==D?void 0:D.horizontalAlignment,border:"".concat(null==D?void 0:D.borderWidth,"px ").concat(null==D?void 0:D.borderStyle," ").concat(null==D?void 0:D.borderColor),borderRadius:null==D?void 0:D.borderRadius},G={textDecoration:"line-through",backgroundColor:null==N?void 0:N.bgColor,color:null==N?void 0:N.color,fontFamily:null==N?void 0:N.fontFamily,fontSize:null==N?void 0:N.fontSize,fontWeight:null==N?void 0:N.fontWeight,padding:"".concat(null==N?void 0:N.verticalPadding,"px ").concat(null==N?void 0:N.horizontalPadding,"px"),width:"100%",textAlign:null==N?void 0:N.horizontalAlignment,border:"".concat(null==N?void 0:N.borderWidth,"px ").concat(null==N?void 0:N.borderStyle," ").concat(null==N?void 0:N.borderColor),borderRadius:null==N?void 0:N.borderRadius},J={backgroundColor:null==A?void 0:A.bgColor,color:null==A?void 0:A.color,fontFamily:null==A?void 0:A.fontFamily,fontSize:null==A?void 0:A.fontSize,fontWeight:null==A?void 0:A.fontWeight,padding:"".concat(null==A?void 0:A.verticalPadding,"px ").concat(null==A?void 0:A.horizontalPadding,"px"),width:"100%",textAlign:null==A?void 0:A.horizontalAlignment,border:"".concat(null==A?void 0:A.borderWidth,"px ").concat(null==A?void 0:A.borderStyle," ").concat(null==A?void 0:A.borderColor),borderRadius:null==A?void 0:A.borderRadius},K={width:"".concat(k.width,"%"),minWidth:"fit-content"},Q=e({display:"flex",justifyContent:"center",width:"100%",gap:"10px"},1===L?{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"space-between",zIndex:10}:void 0),X={padding:10,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",border:"1px solid #EEF2F6",cursor:"pointer"};return o.createElement("div",{style:M},o.createElement(c,{onSwiper:E,modules:[d,a],spaceBetween:j.gapBetweenProducts,slidesPerView:L,navigation:{nextEl:".custom-next-button",prevEl:".custom-prev-button"},scrollbar:void 0},W.map((function(t,e){return o.createElement(u,{style:{height:"auto"},key:t.variantId},o.createElement("div",{style:O},o.createElement("div",{style:H},!!I&&t.imageURL&&o.createElement("div",{style:T},o.createElement("img",{src:t.imageURL||void 0,alt:t.name||void 0,style:U})),(!!B||!!D)&&o.createElement("div",{style:V},!!B&&o.createElement("div",{style:$},t.name),!!D&&!!t.discountPrice&&o.createElement("div",{style:q},t.$discountRatio)),(!!N||!!A)&&o.createElement("div",null,!!N&&!!t.discountPrice&&o.createElement("div",{style:G},t.price),!!A&&o.createElement("div",{style:J},t.discountPrice||t.price))),!!F&&o.createElement("div",{style:K,onClick:function(){}}," ",o.createElement(r,{element:k})," ")))})),o.createElement("div",{style:Q},o.createElement("div",{className:"custom-prev-button",style:e(e({},X),w?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){y&&(y.slidePrev(),z(y.isEnd),P(y.isBeginning))}},o.createElement(s,null)),o.createElement("div",{className:"custom-next-button",style:e(e({},X),R?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){y&&(y.slideNext(),z(y.isEnd),P(y.isBeginning))}},o.createElement(v,null)))))}));export{g as default};
|
|
@@ -55,13 +55,11 @@ export declare class PopupProduct {
|
|
|
55
55
|
productId: string;
|
|
56
56
|
variantId: string;
|
|
57
57
|
name: string;
|
|
58
|
-
price:
|
|
59
|
-
discountPrice:
|
|
58
|
+
price: string;
|
|
59
|
+
discountPrice: string | null;
|
|
60
|
+
discountRatio: number | null;
|
|
60
61
|
imageURL: string | null;
|
|
61
|
-
currencySymbol: string | null;
|
|
62
62
|
url: string | null;
|
|
63
63
|
constructor(data?: Partial<PopupProduct>);
|
|
64
|
-
get $price(): string;
|
|
65
|
-
get $discountPrice(): string | null;
|
|
66
64
|
get $discountRatio(): string | null;
|
|
67
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../../../../ext/tslib/tslib.es6.mjs.js';import{makeObservable as i,observable as
|
|
1
|
+
import{__extends as t}from'./../../../../../../ext/tslib/tslib.es6.mjs.js';import{makeObservable as i,observable as o}from"mobx";import{PopupElementTypeEnum as n,BaseElement as e}from"../base/index.js";import{ProductDetailSettings as r}from"./detail-settings/index.js";import{ButtonElement as d}from"../button/index.js";var u,a,E;!function(t){t.ASC_AVERAGE_RATING="ASC_AVERAGE_RATING",t.DESC_AVERAGE_RATING="DESC_AVERAGE_RATING",t.ASC_CREATED_AT="ASC_CREATED_AT",t.DESC_CREATED_AT="DESC_CREATED_AT",t.ASC_DISCOUNT_RATIO="ASC_DISCOUNT_RATIO",t.DESC_DISCOUNT_RATIO="DESC_DISCOUNT_RATIO",t.ASC_NAME="ASC_NAME",t.DESC_NAME="DESC_NAME",t.ASC_PRICE="ASC_PRICE",t.DESC_PRICE="DESC_PRICE",t.ASC_REVIEW_COUNT="ASC_REVIEW_COUNT",t.DESC_REVIEW_COUNT="DESC_REVIEW_COUNT",t.ASC_SALE_COUNT="ASC_SALE_COUNT",t.DESC_SALE_COUNT="DESC_SALE_COUNT"}(u||(u={})),function(t){t.ALL="ALL",t.SPECIFIC="SPECIFIC",t.CATEGORY="CATEGORY",t.LAST_VIEWED="LAST_VIEWED"}(a||(a={})),function(t){t.ONE_COLUMN="ONE_COLUMN",t.TWO_COLUMN="TWO_COLUMN",t.THREE_COLUMN="THREE_COLUMN"}(E||(E={}));var s=10,l=function(e){function s(t){void 0===t&&(t={});var s,l,C,_,c,A,S,T,I=this;return(I=e.call(this,t)||this).type=n.PRODUCT_LIST,I.listType=t.listType||a.ALL,I.sortType=t.sortType||u.ASC_CREATED_AT,I.maxProductsToShow=null!==(s=t.maxProductsToShow)&&void 0!==s?s:10,I.categoryId=null!==(l=t.categoryId)&&void 0!==l?l:null,I.variantPairs=null!==(C=t.variantPairs)&&void 0!==C?C:null,I.layout=null!==(_=t.layout)&&void 0!==_?_:E.TWO_COLUMN,I.productDetailSettings=t.productDetailSettings?new r(t.productDetailSettings):new r,I.buttonSettings=t.buttonSettings?new d(t.buttonSettings):new d({outerHorizontalPadding:0}),I.productBgColor=t.productBgColor||"#FFFFFF",I.gapBetweenProductElements=null!==(c=t.gapBetweenProductElements)&&void 0!==c?c:12,I.gapBetweenProducts=null!==(A=t.gapBetweenProducts)&&void 0!==A?A:12,I.verticalPadding=null!==(S=t.verticalPadding)&&void 0!==S?S:12,I.horizontalPadding=null!==(T=t.horizontalPadding)&&void 0!==T?T:12,i(I,{type:o,listType:o,sortType:o,maxProductsToShow:o,categoryId:o,variantPairs:o,layout:o,productDetailSettings:o,buttonSettings:o,productBgColor:o,gapBetweenProductElements:o,gapBetweenProducts:o}),I}return t(s,e),s}(e),C=function(t){var n;this.productId=t.productId,this.variantId=t.variantId,this.order=null!==(n=t.order)&&void 0!==n?n:0,this.productListElementId=t.productListElementId,i(this,{productId:o,variantId:o,order:o,productListElementId:o})},_=function(){function t(t){void 0===t&&(t={}),this.productId=t.productId||Date.now().toString(),this.variantId=t.variantId||Date.now().toString(),this.name=t.name||"",this.price=t.price||"",this.discountPrice=t.discountPrice||null,this.discountRatio=t.discountRatio||null,this.imageURL=t.imageURL?"".concat(t.imageURL,"/image_").concat(1080,".jpeg"):null,this.url=t.url||null,i(this,{productId:o,variantId:o,name:o,price:o,discountPrice:o,discountRatio:o,imageURL:o,url:o})}return Object.defineProperty(t.prototype,"$discountRatio",{get:function(){return this.discountRatio?"%"+this.discountRatio:null},enumerable:!1,configurable:!0}),t}();export{s as MAX_PRODUCT_COUNT,_ as PopupProduct,C as PopupVariantPair,l as ProductListElement,E as ProductListLayoutEnum,u as ProductListSortTypeEnum,a as ProductListTypeEnum};
|