@ikas/popup-renderer 0.0.4 → 0.0.6
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/popup-renderer/components/product-list-renderer/index.d.ts +0 -4
- package/build/popup-renderer/components/product-list-renderer/index.js +1 -1
- package/build-cjs/popup-renderer/components/product-list-renderer/index.d.ts +0 -4
- package/build-cjs/popup-renderer/components/product-list-renderer/index.js +1 -1
- package/package.json +7 -13
|
@@ -2,10 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { ElementType } from "../../models/modal/step";
|
|
3
3
|
import { PopupProduct } from "../../models/modal/step/elements/product";
|
|
4
4
|
import { Popup } from "../../models";
|
|
5
|
-
import "swiper/css";
|
|
6
|
-
import "swiper/css/navigation";
|
|
7
|
-
import "swiper/css/pagination";
|
|
8
|
-
import "swiper/css/scrollbar";
|
|
9
5
|
type Props = {
|
|
10
6
|
element: ElementType;
|
|
11
7
|
products: PopupProduct[];
|
|
@@ -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
|
|
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},$={display:"flex",flexDirection:"column",width:"100%"},H={display:"flex",flexDirection:"column"},V={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:$},!!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:H},!!B&&o.createElement("div",{style:V},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};
|
|
@@ -2,10 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { ElementType } from "../../models/modal/step";
|
|
3
3
|
import { PopupProduct } from "../../models/modal/step/elements/product";
|
|
4
4
|
import { Popup } from "../../models";
|
|
5
|
-
import "swiper/css";
|
|
6
|
-
import "swiper/css/navigation";
|
|
7
|
-
import "swiper/css/pagination";
|
|
8
|
-
import "swiper/css/scrollbar";
|
|
9
5
|
type Props = {
|
|
10
6
|
element: ElementType;
|
|
11
7
|
products: PopupProduct[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require('./../../../ext/tslib/tslib.es6.mjs.js'),t=require("react");require('./../../../ext/mobx-react-lite/es/index.js');var o=require("../../helpers/index.js"),
|
|
1
|
+
"use strict";var e=require('./../../../ext/tslib/tslib.es6.mjs.js'),t=require("react");require('./../../../ext/mobx-react-lite/es/index.js');var o=require("../../helpers/index.js"),n=require("../../models/modal/step/elements/product/index.js"),i=require("../button-element-renderer/index.js"),l=require("swiper/modules"),d=require("swiper/react"),r=require("../../assets/left-arrow.js"),a=require("../../assets/right-arrow.js"),u=require('./../../../ext/mobx-react-lite/es/observer.js');function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=c(t),v=u.observer((function(t){var u,c=t.element,v=t.products,g=t.popup,f=t.editModeChildren,m=s.default.useState(null),p=m[0],b=m[1],h=s.default.useState(!1),y=h[0],x=h[1],E=s.default.useState(!1),C=E[0],P=E[1],S=c,w=[];if(v&&(w=S.listType===n.ProductListTypeEnum.SPECIFIC?(null===(u=S.variantPairs)||void 0===u?void 0:u.length)?v.slice().sort((function(e,t){return S.variantPairs.findIndex((function(t){return t.variantId===e.variantId}))-S.variantPairs.findIndex((function(e){return e.variantId===t.variantId}))})):[]:e.__spreadArray([],v,!0)),w.length>S.maxProductsToShow&&(w.length=S.maxProductsToShow),!(w&&w.length||!g.isPreviewMode)&&f)return f;if(!w||!w.length)return null;S.gapBetweenProductElements;var z=S.productDetailSettings.image,R=S.productDetailSettings.button,_=S.buttonSettings,j=S.productDetailSettings.discountRatio,W=S.productDetailSettings.finalPrice,I=S.productDetailSettings.originalPrice,F=S.productDetailSettings.name,L=o.getHorizontalAlignment(S.horizontalAlignment),q=1;S.layout===n.ProductListLayoutEnum.ONE_COLUMN?q=1:S.layout===n.ProductListLayoutEnum.TWO_COLUMN?q=2:S.layout===n.ProductListLayoutEnum.THREE_COLUMN&&(q=3);var A={padding:"".concat(S.verticalPadding,"px ").concat(S.horizontalPadding,"px"),backgroundColor:S.productBgColor,width:"100%",height:"max-content"},k={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%"},D={display:"flex",justifyContent:L,alignItems:"center",width:"100%",backgroundColor:null==z?void 0:z.bgColor,borderRadius:(null==z?void 0:z.borderRadius)?"".concat(z.borderRadius,"px"):void 0},N={width:"".concat(null==z?void 0:z.maxWidth,"%"),objectFit:"contain",borderRadius:(null==z?void 0:z.borderRadius)?"".concat(z.borderRadius,"px"):void 0},B={display:"flex",flexDirection:"column",width:"100%"},T={display:"flex",flexDirection:"column"},M={backgroundColor:null==F?void 0:F.bgColor,color:null==F?void 0:F.color,fontFamily:null==F?void 0:F.fontFamily,fontSize:null==F?void 0:F.fontSize,fontWeight:null==F?void 0:F.fontWeight,padding:"".concat(null==F?void 0:F.verticalPadding,"px ").concat(null==F?void 0:F.horizontalPadding,"px"),width:"100%",textAlign:null==F?void 0:F.horizontalAlignment,border:"".concat(null==F?void 0:F.borderWidth,"px ").concat(null==F?void 0:F.borderStyle," ").concat(null==F?void 0:F.borderColor),borderRadius:null==F?void 0:F.borderRadius},O={backgroundColor:null==j?void 0:j.bgColor,color:null==j?void 0:j.color,fontFamily:null==j?void 0:j.fontFamily,fontSize:null==j?void 0:j.fontSize,fontWeight:null==j?void 0:j.fontWeight,padding:"".concat(null==j?void 0:j.verticalPadding,"px ").concat(null==j?void 0:j.horizontalPadding,"px"),width:"100%",textAlign:null==j?void 0:j.horizontalAlignment,border:"".concat(null==j?void 0:j.borderWidth,"px ").concat(null==j?void 0:j.borderStyle," ").concat(null==j?void 0:j.borderColor),borderRadius:null==j?void 0:j.borderRadius},U={textDecoration:"line-through",backgroundColor:null==I?void 0:I.bgColor,color:null==I?void 0:I.color,fontFamily:null==I?void 0:I.fontFamily,fontSize:null==I?void 0:I.fontSize,fontWeight:null==I?void 0:I.fontWeight,padding:"".concat(null==I?void 0:I.verticalPadding,"px ").concat(null==I?void 0:I.horizontalPadding,"px"),width:"100%",textAlign:null==I?void 0:I.horizontalAlignment,border:"".concat(null==I?void 0:I.borderWidth,"px ").concat(null==I?void 0:I.borderStyle," ").concat(null==I?void 0:I.borderColor),borderRadius:null==I?void 0:I.borderRadius},$={backgroundColor:null==W?void 0:W.bgColor,color:null==W?void 0:W.color,fontFamily:null==W?void 0:W.fontFamily,fontSize:null==W?void 0:W.fontSize,fontWeight:null==W?void 0:W.fontWeight,padding:"".concat(null==W?void 0:W.verticalPadding,"px ").concat(null==W?void 0:W.horizontalPadding,"px"),width:"100%",textAlign:null==W?void 0:W.horizontalAlignment,border:"".concat(null==W?void 0:W.borderWidth,"px ").concat(null==W?void 0:W.borderStyle," ").concat(null==W?void 0:W.borderColor),borderRadius:null==W?void 0:W.borderRadius},H={width:"".concat(_.width,"%"),minWidth:"fit-content"},V=e.__assign({display:"flex",justifyContent:"center",width:"100%",gap:"10px"},1===q?{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"space-between",zIndex:10}:void 0),G={padding:10,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",border:"1px solid #EEF2F6",cursor:"pointer"};return s.default.createElement("div",{style:A},s.default.createElement(d.Swiper,{onSwiper:b,modules:[l.Navigation,l.Scrollbar],spaceBetween:S.gapBetweenProducts,slidesPerView:q,navigation:{nextEl:".custom-next-button",prevEl:".custom-prev-button"},scrollbar:void 0},w.map((function(e,t){return s.default.createElement(d.SwiperSlide,{style:{height:"auto"},key:e.variantId},s.default.createElement("div",{style:k},s.default.createElement("div",{style:B},!!z&&e.imageURL&&s.default.createElement("div",{style:D},s.default.createElement("img",{src:e.imageURL||void 0,alt:e.name||void 0,style:N})),(!!F||!!j)&&s.default.createElement("div",{style:T},!!F&&s.default.createElement("div",{style:M},e.name),!!j&&!!e.discountPrice&&s.default.createElement("div",{style:O},e.$discountRatio)),(!!I||!!W)&&s.default.createElement("div",null,!!I&&!!e.discountPrice&&s.default.createElement("div",{style:U},e.$price),!!W&&s.default.createElement("div",{style:$},e.$discountPrice||e.$price))),!!R&&s.default.createElement("div",{style:H,onClick:function(){}}," ",s.default.createElement(i,{element:_})," ")))})),s.default.createElement("div",{style:V},s.default.createElement("div",{className:"custom-prev-button",style:e.__assign(e.__assign({},G),y?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){p&&(p.slidePrev(),P(p.isEnd),x(p.isBeginning))}},s.default.createElement(r,null)),s.default.createElement("div",{className:"custom-next-button",style:e.__assign(e.__assign({},G),C?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){p&&(p.slideNext(),P(p.isEnd),x(p.isBeginning))}},s.default.createElement(a,null)))))}));module.exports=v;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/popup-renderer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "ucy",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,25 +17,19 @@
|
|
|
17
17
|
"release": "npm publish",
|
|
18
18
|
"build": "rm -rf build && rollup -c"
|
|
19
19
|
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@react-email/button": "0.0.7",
|
|
22
|
-
"@react-email/components": "^0.0.4",
|
|
23
|
-
"@react-email/head": "0.0.5",
|
|
24
|
-
"@react-email/html": "0.0.4"
|
|
25
|
-
},
|
|
26
20
|
"devDependencies": {
|
|
27
21
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
28
22
|
"@rollup/plugin-json": "^4.1.0",
|
|
29
23
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
30
24
|
"@types/lodash": "^4.14.191",
|
|
31
25
|
"@types/node": "^12.0.0",
|
|
32
|
-
"@types/react": "^18
|
|
33
|
-
"@types/react-dom": "^18
|
|
26
|
+
"@types/react": "^17 || ^18",
|
|
27
|
+
"@types/react-dom": "^17 || ^18",
|
|
34
28
|
"@types/uuid": "^9.0.0",
|
|
35
29
|
"mobx": "^6.1.3",
|
|
36
30
|
"mobx-react": "^7.6.0",
|
|
37
|
-
"react": "^18
|
|
38
|
-
"react-dom": "^18
|
|
31
|
+
"react": "^17 || ^18",
|
|
32
|
+
"react-dom": "^17 || ^18",
|
|
39
33
|
"rollup": "^2.75.6",
|
|
40
34
|
"rollup-plugin-import-css": "^3.5.0",
|
|
41
35
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
@@ -51,8 +45,8 @@
|
|
|
51
45
|
"peerDependencies": {
|
|
52
46
|
"mobx": "^6.1.3",
|
|
53
47
|
"mobx-react": "^7.6.0",
|
|
54
|
-
"react": "^18
|
|
55
|
-
"react-dom": "^18
|
|
48
|
+
"react": "^17 || ^18",
|
|
49
|
+
"react-dom": "^17 || ^18",
|
|
56
50
|
"swiper": "^11.0.6"
|
|
57
51
|
}
|
|
58
52
|
}
|