easy-email-pro-kit 0.2.0
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/lib/index.cjs.js +1 -0
- package/lib/index.es.js +467 -0
- package/lib/typings/Elements/index.d.ts +1 -0
- package/lib/typings/Elements/marketing/Countdown/Countdown.d.ts +6 -0
- package/lib/typings/Elements/marketing/Countdown/Panel.d.ts +5 -0
- package/lib/typings/Elements/marketing/Countdown/element.d.ts +3 -0
- package/lib/typings/Elements/marketing/Countdown/index.d.ts +6 -0
- package/lib/typings/Elements/marketing/Shopwindow/Panel.d.ts +5 -0
- package/lib/typings/Elements/marketing/Shopwindow/element.d.ts +3 -0
- package/lib/typings/Elements/marketing/Shopwindow/index.d.ts +6 -0
- package/lib/typings/Elements/marketing/index.d.ts +2 -0
- package/lib/typings/Responsive/ResponsiveElement.d.ts +10 -0
- package/lib/typings/Responsive/index.d.ts +8 -0
- package/lib/typings/constants/index.d.ts +5 -0
- package/lib/typings/custom-types.d.ts +6 -0
- package/lib/typings/index.d.ts +4 -0
- package/lib/typings/typings/index.d.ts +40 -0
- package/lib/typings/utils/animation2gif/animationToGIF.d.ts +13 -0
- package/lib/typings/utils/animation2gif/dom2Svg.d.ts +20 -0
- package/lib/typings/utils/animation2gif/generateGif.d.ts +8 -0
- package/lib/typings/utils/animation2gif/image2Canvas.d.ts +4 -0
- package/lib/typings/utils/animation2gif/index.d.ts +3 -0
- package/lib/typings/utils/getCountdownTime.d.ts +6 -0
- package/lib/typings/utils/index.d.ts +2 -0
- package/package.json +26 -0
package/lib/index.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var q=Object.defineProperty,z=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var N=(t,n,r)=>n in t?q(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,s=(t,n)=>{for(var r in n||(n={}))B.call(n,r)&&N(t,r,n[r]);if(x)for(var r of x(n))R.call(n,r)&&N(t,r,n[r]);return t},g=(t,n)=>z(t,G(n));var P=(t,n)=>{var r={};for(var o in t)B.call(t,o)&&n.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&x)for(var o of x(t))n.indexOf(o)<0&&R.call(t,o)&&(r[o]=t[o]);return r};var L=(t,n,r)=>(N(t,typeof n!="symbol"?n+"":n,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("easy-email-pro-core"),p=require("lodash"),e=require("react"),V=require("react-dom/server"),W=require("easy-email-pro-theme"),{Raw:v}=i.components;function Y(t){const{desktop:n,mobile:r}=t,o=i.useEmailRenderContext(),{displayMode:a="desktop-mobile"}=o;return a==="only-desktop"?e.createElement(i.EmailRenderProvider,g(s({},o),{displayMode:"only-desktop"}),e.createElement(e.Fragment,null,e.createElement(n,null))):a==="only-mobile"?e.createElement(e.Fragment,null,e.createElement(v,null,"<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"),e.createElement(i.EmailRenderProvider,g(s({},o),{displayMode:"only-mobile"}),e.createElement(e.Fragment,null,e.createElement(r,null))),e.createElement(v,null,"<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->")):e.createElement(e.Fragment,null,e.createElement(i.EmailRenderProvider,g(s({},o),{displayMode:"only-desktop"}),e.createElement(e.Fragment,null,e.createElement(n,null))),e.createElement(v,null,"<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"),e.createElement(i.EmailRenderProvider,g(s({},o),{displayMode:"only-mobile"}),e.createElement(e.Fragment,null,e.createElement(r,null))),e.createElement(v,null,"<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->"))}const J="hide-desktop-block",Q="hide-mobile-block",X="hide-desktop-inline-block",Z="hide-mobile-inline-block",K=[i.ElementType.GROUP,i.ElementType.COLUMN,i.ElementType.NAVBAR_LINK];class ee extends i.ResponsivePlugin{constructor(){super(...arguments);L(this,"generateResponsive",r=>{var _;const{mode:o,displayMode:a,node:l,keepEmptyAttributes:m,mergetagsData:b={},children:c,context:d,idx:f,desktopContent:O}=r;let T=O;const y=i.BlockManager.getBlockByType(l.type);if(!y)throw new Error(`${l.type} block is not registered`);const H=l.mobileAttributes&&Object.keys(l.mobileAttributes).some(D=>l.mobileAttributes[D]!==l.attributes[D]),h=K.includes(y.type)?X:J,k=K.includes(y.type)?Z:Q,u=p.get(l,"attributes.css-class")||"";if(a==="only-desktop"){if(u.includes(h))return null;u.includes(k)||p.set(l,"attributes.css-class",i.classnames(u,k))}else if(a==="only-mobile"){if(u.includes(k))return null;u.includes(h)||p.set(l,"attributes.css-class",i.classnames(u,h))}a==="only-mobile"?l.attributes=i.mergeBlock(i.mergeBlock(y.defaultData.attributes,y.defaultData.mobileAttributes),l.attributes):l.attributes=i.mergeBlock(((_=y.defaultData)==null?void 0:_.attributes)||{},l.attributes),l.visible==="desktop"?p.set(l,"attributes.css-class",i.classnames(u,k)):l.visible==="mobile"&&p.set(l,"attributes.css-class",i.classnames(u,h));const U=y.render({mode:o,children:c,context:d,idx:f,node:g(s({},l),{attributes:i.mergeBlock(l.attributes,l.mobileAttributes),mobileAttributes:void 0}),keepEmptyAttributes:m,mergetagsData:b});return H&&(T=e.createElement(e.Fragment,null,e.createElement(Y,{desktop:()=>e.createElement(e.Fragment,null,O),mobile:()=>e.createElement(e.Fragment,null,U)}))),T})}}const I=60,M=60*I,C=24*M;function te(t){const n=Math.floor(t/C),r=Math.floor((t-n*C)/M),o=Math.floor((t-n*C-r*M)/I),a=Math.floor(t-n*C-r*M-o*I);return{day:n<10?"0"+n:n.toString(),hour:r<10?"0"+r:r.toString(),minute:o<10?"0"+o:o.toString(),second:a<10?"0"+a:a.toString()}}const ne=document.createElement("canvas");ne.getContext("2d");const oe=p.flatMap(["padding","margin","border"].map(t=>[`${t}-top`,`${t}-right`,`${t}-bottom`,`${t}-left`]));[...oe];function re(t){const{attributes:n,data:r}=t;let o=r.remainingTime;switch(r.unit){case"minute":o=60*o;break;case"hour":o=60*60*o;break;case"day":o=60*60*24*o}const{day:a,hour:l,minute:m,second:b}=te(o),c=[{unit:"days",value:a},{unit:"hrs",value:l},{unit:"mins",value:m},{unit:"secs",value:b}];return e.createElement("div",{style:{color:n.color}},e.createElement("div",null,e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",paddingBottom:10}},c.map((d,f)=>e.createElement("div",{key:d.unit,style:{display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{width:50,height:50,lineHeight:"50px",backgroundColor:n["grid-color"],borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:`0px 4px 13px 4px ${n["shadow-color"]}`,fontSize:24}},e.createElement("div",{style:{height:"100%",overflow:"hidden"}},e.createElement("div",{className:d.unit},d.value))),f!==c.length-1&&e.createElement("div",{key:d.unit,style:{margin:"0px 10px",fontWeight:"bold"}},":")))),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",paddingBottom:10}},c.map((d,f)=>e.createElement("div",{key:d.unit,style:{display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{key:d.unit,style:{width:50,display:"flex",alignItems:"center",justifyContent:"center",textTransform:"uppercase",fontSize:14,textAlign:"center"}},d.unit),f!==c.length-1&&e.createElement("div",{style:{margin:"0px 10px",fontWeight:"bold",visibility:"hidden"}},":"))))))}const E={MARKETING_SHOPWINDOW:"marketing-shopwindow",MARKETING_COUNTDOWN:"marketing-countdown"},{Column:$,Image:ie,Raw:le,Section:j,Spacer:ae,ContentEditableBlock:se}=i.components,S={attributes:{color:"#ffffff","padding-top":"20px","padding-bottom":"20px","padding-left":"0px","padding-right":"0px","background-color":"#1A1F25","grid-color":"#12304b","shadow-color":"#000000",src:"http://res.cloudinary.com/dfite2e16/image/upload/v1687491218/easy-email-pro/tfcg6gqhefsasitl4j2u.gif"},data:{remainingTime:24,unit:"hour"}},w=i.createCustomBlock({get name(){return i.t("Countdown")},defaultData:S,void:!0,type:E.MARKETING_COUNTDOWN,create:t=>{const n={type:E.MARKETING_COUNTDOWN,data:s({},S.data),attributes:s({},S.attributes),children:[{type:"text",data:{},attributes:{color:"#ffffff","font-size":"32px",align:"center"},children:[{text:"SUMMER SALE"}]},{type:"text",data:{},attributes:{color:"#ffffff","font-size":"64px",align:"center"},children:[{text:"50% OFF",italic:!0}]}]};return i.mergeBlock(n,t)},category:i.ElementCategory.SECTION,render(t){const{node:n,mode:r}=t,{attributes:o,children:a}=n;if(r==="testing"){const l=V.renderToString(e.createElement(re,{attributes:n.attributes,data:n.data}));return e.createElement(j,{"padding-bottom":o["padding-bottom"],"padding-top":o["padding-top"],"padding-left":o["padding-left"],"padding-right":o["padding-right"],"background-color":o["background-color"]},e.createElement($,null,a.map((m,b)=>i.NodeUtils.isTextElement(m)?e.createElement(se,{key:b,node:m}):null),e.createElement(ae,{height:"20px"}),e.createElement(le,null,l)))}return e.createElement(j,{"padding-bottom":o["padding-bottom"],"padding-top":o["padding-top"],"padding-left":o["padding-left"],"padding-right":o["padding-right"],"background-color":o["background-color"]},e.createElement($,null,e.createElement(ie,g(s({idx:t.idx},t.node.attributes),{children:n.children}))))}});class de extends i.ElementPlugin{generateElement(){i.BlockManager.registerBlocks([w]),p.set(W.ConfigPanelsMap,w.type,w)}}const{Image:ce}=i.components,F={attributes:{align:"center",border:"0",height:"auto","padding-top":"0px","padding-bottom":"0px","padding-left":"0px","padding-right":"0px","border-width":"1px","border-style":"solid","border-color":"#AAAAAA","border-radius":"0px",target:"_blank"},data:{list:[{src:"http://res.cloudinary.com/dwkp0e1yo/image/upload/v1683815911/tceeidvpn9cwtrufgbe3.png"},{src:"http://res.cloudinary.com/dwkp0e1yo/image/upload/v1683815875/mevpkdxft8z6cyjicnd6.png"},{src:"http://res.cloudinary.com/dwkp0e1yo/image/upload/v1683815891/g4qmdcgiyiuyqmdlchuo.png"}]}},A=i.createCustomBlock({get name(){return i.t("Shopwindow")},defaultData:F,void:!0,type:E.MARKETING_SHOPWINDOW,create:t=>{const n={type:E.MARKETING_SHOPWINDOW,data:s({},F.data),attributes:{src:"http://res.cloudinary.com/dwkp0e1yo/image/upload/v1684137604/beacas-test/ypb7jidggmzgscvs5c3t.gif"},children:[]};return i.mergeBlock(n,t)},category:i.ElementCategory.IMAGE,render(t){const{node:n}=t,c=n.attributes,{"border-enabled":r,"border-width":o,"border-style":a,"border-color":l}=c,m=P(c,["border-enabled","border-width","border-style","border-color"]),b=r?`${o||"1px"} ${a||"solid"} ${l||"#AAAAAA"}`:"";return e.createElement(ce,g(s({idx:t.idx},m),{data:n.data,border:b,children:n.children}))}});class me extends i.ElementPlugin{generateElement(){i.BlockManager.registerBlocks([A]),p.set(W.ConfigPanelsMap,A.type,A)}}exports.Countdown=de;exports.MarketingCountdown=w;exports.MarketingShopwindow=A;exports.MarketingType=E;exports.Responsive=ee;exports.Shopwindow=me;
|
package/lib/index.es.js
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
var ee = Object.defineProperty, te = Object.defineProperties;
|
|
2
|
+
var ne = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var x = Object.getOwnPropertySymbols;
|
|
4
|
+
var F = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var N = (t, n, r) => n in t ? ee(t, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[n] = r, a = (t, n) => {
|
|
6
|
+
for (var r in n || (n = {}))
|
|
7
|
+
F.call(n, r) && N(t, r, n[r]);
|
|
8
|
+
if (x)
|
|
9
|
+
for (var r of x(n))
|
|
10
|
+
W.call(n, r) && N(t, r, n[r]);
|
|
11
|
+
return t;
|
|
12
|
+
}, u = (t, n) => te(t, ne(n));
|
|
13
|
+
var j = (t, n) => {
|
|
14
|
+
var r = {};
|
|
15
|
+
for (var o in t)
|
|
16
|
+
F.call(t, o) && n.indexOf(o) < 0 && (r[o] = t[o]);
|
|
17
|
+
if (t != null && x)
|
|
18
|
+
for (var o of x(t))
|
|
19
|
+
n.indexOf(o) < 0 && W.call(t, o) && (r[o] = t[o]);
|
|
20
|
+
return r;
|
|
21
|
+
};
|
|
22
|
+
var P = (t, n, r) => (N(t, typeof n != "symbol" ? n + "" : n, r), r);
|
|
23
|
+
import { useEmailRenderContext as oe, EmailRenderProvider as k, components as T, ElementType as I, ResponsivePlugin as re, BlockManager as R, classnames as v, mergeBlock as b, createCustomBlock as q, t as V, ElementCategory as Y, NodeUtils as ie, ElementPlugin as J } from "easy-email-pro-core";
|
|
24
|
+
import { get as le, set as f, flatMap as ae } from "lodash";
|
|
25
|
+
import e from "react";
|
|
26
|
+
import se from "react-dom/server";
|
|
27
|
+
import { ConfigPanelsMap as Q } from "easy-email-pro-theme";
|
|
28
|
+
const { Raw: A } = T;
|
|
29
|
+
function de(t) {
|
|
30
|
+
const { desktop: n, mobile: r } = t, o = oe(), { displayMode: l = "desktop-mobile" } = o;
|
|
31
|
+
return l === "only-desktop" ? /* @__PURE__ */ e.createElement(k, u(a({}, o), { displayMode: "only-desktop" }), /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(n, null))) : l === "only-mobile" ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(A, null, "<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"), /* @__PURE__ */ e.createElement(k, u(a({}, o), { displayMode: "only-mobile" }), /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(r, null))), /* @__PURE__ */ e.createElement(A, null, "<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->")) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(k, u(a({}, o), { displayMode: "only-desktop" }), /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(n, null))), /* @__PURE__ */ e.createElement(A, null, "<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"), /* @__PURE__ */ e.createElement(k, u(a({}, o), { displayMode: "only-mobile" }), /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(r, null))), /* @__PURE__ */ e.createElement(A, null, "<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->"));
|
|
32
|
+
}
|
|
33
|
+
const ce = "hide-desktop-block", me = "hide-mobile-block", ue = "hide-desktop-inline-block", pe = "hide-mobile-inline-block", H = [
|
|
34
|
+
I.GROUP,
|
|
35
|
+
I.COLUMN,
|
|
36
|
+
I.NAVBAR_LINK
|
|
37
|
+
];
|
|
38
|
+
class Se extends re {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
P(this, "generateResponsive", (r) => {
|
|
42
|
+
var K;
|
|
43
|
+
const {
|
|
44
|
+
mode: o,
|
|
45
|
+
displayMode: l,
|
|
46
|
+
node: i,
|
|
47
|
+
keepEmptyAttributes: c,
|
|
48
|
+
mergetagsData: p = {},
|
|
49
|
+
children: d,
|
|
50
|
+
context: s,
|
|
51
|
+
idx: y,
|
|
52
|
+
desktopContent: B
|
|
53
|
+
} = r;
|
|
54
|
+
let L = B;
|
|
55
|
+
const g = R.getBlockByType(i.type);
|
|
56
|
+
if (!g)
|
|
57
|
+
throw new Error(`${i.type} block is not registered`);
|
|
58
|
+
const X = i.mobileAttributes && Object.keys(i.mobileAttributes).some(($) => i.mobileAttributes[$] !== i.attributes[$]), E = H.includes(g.type) ? ue : ce, h = H.includes(g.type) ? pe : me, m = le(i, "attributes.css-class") || "";
|
|
59
|
+
if (l === "only-desktop") {
|
|
60
|
+
if (m.includes(E))
|
|
61
|
+
return null;
|
|
62
|
+
m.includes(h) || f(
|
|
63
|
+
i,
|
|
64
|
+
"attributes.css-class",
|
|
65
|
+
v(m, h)
|
|
66
|
+
);
|
|
67
|
+
} else if (l === "only-mobile") {
|
|
68
|
+
if (m.includes(h))
|
|
69
|
+
return null;
|
|
70
|
+
m.includes(E) || f(
|
|
71
|
+
i,
|
|
72
|
+
"attributes.css-class",
|
|
73
|
+
v(m, E)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
l === "only-mobile" ? i.attributes = b(
|
|
77
|
+
b(
|
|
78
|
+
g.defaultData.attributes,
|
|
79
|
+
g.defaultData.mobileAttributes
|
|
80
|
+
),
|
|
81
|
+
i.attributes
|
|
82
|
+
) : i.attributes = b(
|
|
83
|
+
((K = g.defaultData) == null ? void 0 : K.attributes) || {},
|
|
84
|
+
i.attributes
|
|
85
|
+
), i.visible === "desktop" ? f(
|
|
86
|
+
i,
|
|
87
|
+
"attributes.css-class",
|
|
88
|
+
v(m, h)
|
|
89
|
+
) : i.visible === "mobile" && f(
|
|
90
|
+
i,
|
|
91
|
+
"attributes.css-class",
|
|
92
|
+
v(m, E)
|
|
93
|
+
);
|
|
94
|
+
const Z = g.render({
|
|
95
|
+
mode: o,
|
|
96
|
+
children: d,
|
|
97
|
+
context: s,
|
|
98
|
+
idx: y,
|
|
99
|
+
node: u(a({}, i), {
|
|
100
|
+
attributes: b(i.attributes, i.mobileAttributes),
|
|
101
|
+
mobileAttributes: void 0
|
|
102
|
+
}),
|
|
103
|
+
keepEmptyAttributes: c,
|
|
104
|
+
mergetagsData: p
|
|
105
|
+
});
|
|
106
|
+
return X && (L = /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
107
|
+
de,
|
|
108
|
+
{
|
|
109
|
+
desktop: () => /* @__PURE__ */ e.createElement(e.Fragment, null, B),
|
|
110
|
+
mobile: () => /* @__PURE__ */ e.createElement(e.Fragment, null, Z)
|
|
111
|
+
}
|
|
112
|
+
))), L;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const D = 60, w = 60 * D, C = 24 * w;
|
|
117
|
+
function ge(t) {
|
|
118
|
+
const n = Math.floor(t / C), r = Math.floor((t - n * C) / w), o = Math.floor((t - n * C - r * w) / D), l = Math.floor(t - n * C - r * w - o * D);
|
|
119
|
+
return {
|
|
120
|
+
day: n < 10 ? "0" + n : n.toString(),
|
|
121
|
+
hour: r < 10 ? "0" + r : r.toString(),
|
|
122
|
+
minute: o < 10 ? "0" + o : o.toString(),
|
|
123
|
+
second: l < 10 ? "0" + l : l.toString()
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const be = document.createElement("canvas");
|
|
127
|
+
be.getContext("2d");
|
|
128
|
+
const fe = ae(
|
|
129
|
+
["padding", "margin", "border"].map((t) => [
|
|
130
|
+
`${t}-top`,
|
|
131
|
+
`${t}-right`,
|
|
132
|
+
`${t}-bottom`,
|
|
133
|
+
`${t}-left`
|
|
134
|
+
])
|
|
135
|
+
);
|
|
136
|
+
[
|
|
137
|
+
...fe
|
|
138
|
+
];
|
|
139
|
+
function ye(t) {
|
|
140
|
+
const { attributes: n, data: r } = t;
|
|
141
|
+
let o = r.remainingTime;
|
|
142
|
+
switch (r.unit) {
|
|
143
|
+
case "minute":
|
|
144
|
+
o = 60 * o;
|
|
145
|
+
break;
|
|
146
|
+
case "hour":
|
|
147
|
+
o = 60 * 60 * o;
|
|
148
|
+
break;
|
|
149
|
+
case "day":
|
|
150
|
+
o = 60 * 60 * 24 * o;
|
|
151
|
+
}
|
|
152
|
+
const { day: l, hour: i, minute: c, second: p } = ge(o), d = [
|
|
153
|
+
{
|
|
154
|
+
unit: "days",
|
|
155
|
+
value: l
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
unit: "hrs",
|
|
159
|
+
value: i
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
unit: "mins",
|
|
163
|
+
value: c
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
unit: "secs",
|
|
167
|
+
value: p
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
return /* @__PURE__ */ e.createElement(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
style: {
|
|
174
|
+
color: n.color
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
/* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
style: {
|
|
181
|
+
display: "flex",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
justifyContent: "center",
|
|
184
|
+
paddingBottom: 10
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
d.map((s, y) => /* @__PURE__ */ e.createElement(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
key: s.unit,
|
|
191
|
+
style: {
|
|
192
|
+
display: "flex",
|
|
193
|
+
alignItems: "center",
|
|
194
|
+
justifyContent: "center"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
/* @__PURE__ */ e.createElement(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
style: {
|
|
201
|
+
width: 50,
|
|
202
|
+
height: 50,
|
|
203
|
+
lineHeight: "50px",
|
|
204
|
+
backgroundColor: n["grid-color"],
|
|
205
|
+
borderRadius: 8,
|
|
206
|
+
display: "flex",
|
|
207
|
+
alignItems: "center",
|
|
208
|
+
justifyContent: "center",
|
|
209
|
+
boxShadow: `0px 4px 13px 4px ${n["shadow-color"]}`,
|
|
210
|
+
fontSize: 24
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
/* @__PURE__ */ e.createElement("div", { style: { height: "100%", overflow: "hidden" } }, /* @__PURE__ */ e.createElement("div", { className: s.unit }, s.value))
|
|
214
|
+
),
|
|
215
|
+
y !== d.length - 1 && /* @__PURE__ */ e.createElement(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
key: s.unit,
|
|
219
|
+
style: { margin: "0px 10px", fontWeight: "bold" }
|
|
220
|
+
},
|
|
221
|
+
":"
|
|
222
|
+
)
|
|
223
|
+
))
|
|
224
|
+
), /* @__PURE__ */ e.createElement(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
style: {
|
|
228
|
+
display: "flex",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
justifyContent: "center",
|
|
231
|
+
paddingBottom: 10
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
d.map((s, y) => /* @__PURE__ */ e.createElement(
|
|
235
|
+
"div",
|
|
236
|
+
{
|
|
237
|
+
key: s.unit,
|
|
238
|
+
style: {
|
|
239
|
+
display: "flex",
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
justifyContent: "center"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
/* @__PURE__ */ e.createElement(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
key: s.unit,
|
|
248
|
+
style: {
|
|
249
|
+
width: 50,
|
|
250
|
+
display: "flex",
|
|
251
|
+
alignItems: "center",
|
|
252
|
+
justifyContent: "center",
|
|
253
|
+
textTransform: "uppercase",
|
|
254
|
+
fontSize: 14,
|
|
255
|
+
textAlign: "center"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
s.unit
|
|
259
|
+
),
|
|
260
|
+
y !== d.length - 1 && /* @__PURE__ */ e.createElement(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
style: {
|
|
264
|
+
margin: "0px 10px",
|
|
265
|
+
fontWeight: "bold",
|
|
266
|
+
visibility: "hidden"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
":"
|
|
270
|
+
)
|
|
271
|
+
))
|
|
272
|
+
))
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
const M = {
|
|
276
|
+
MARKETING_SHOPWINDOW: "marketing-shopwindow",
|
|
277
|
+
MARKETING_COUNTDOWN: "marketing-countdown"
|
|
278
|
+
}, { Column: U, Image: Ee, Raw: he, Section: z, Spacer: xe, ContentEditableBlock: ke } = T, S = {
|
|
279
|
+
attributes: {
|
|
280
|
+
color: "#ffffff",
|
|
281
|
+
"padding-top": "20px",
|
|
282
|
+
"padding-bottom": "20px",
|
|
283
|
+
"padding-left": "0px",
|
|
284
|
+
"padding-right": "0px",
|
|
285
|
+
"background-color": "#1A1F25",
|
|
286
|
+
"grid-color": "#12304b",
|
|
287
|
+
"shadow-color": "#000000",
|
|
288
|
+
src: "http://res.cloudinary.com/dfite2e16/image/upload/v1687491218/easy-email-pro/tfcg6gqhefsasitl4j2u.gif"
|
|
289
|
+
},
|
|
290
|
+
data: {
|
|
291
|
+
remainingTime: 24,
|
|
292
|
+
unit: "hour"
|
|
293
|
+
}
|
|
294
|
+
}, O = q({
|
|
295
|
+
get name() {
|
|
296
|
+
return V("Countdown");
|
|
297
|
+
},
|
|
298
|
+
defaultData: S,
|
|
299
|
+
void: !0,
|
|
300
|
+
type: M.MARKETING_COUNTDOWN,
|
|
301
|
+
create: (t) => {
|
|
302
|
+
const n = {
|
|
303
|
+
type: M.MARKETING_COUNTDOWN,
|
|
304
|
+
data: a({}, S.data),
|
|
305
|
+
attributes: a({}, S.attributes),
|
|
306
|
+
children: [
|
|
307
|
+
{
|
|
308
|
+
type: "text",
|
|
309
|
+
data: {},
|
|
310
|
+
attributes: {
|
|
311
|
+
color: "#ffffff",
|
|
312
|
+
"font-size": "32px",
|
|
313
|
+
align: "center"
|
|
314
|
+
},
|
|
315
|
+
children: [
|
|
316
|
+
{
|
|
317
|
+
text: "SUMMER SALE"
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
type: "text",
|
|
323
|
+
data: {},
|
|
324
|
+
attributes: {
|
|
325
|
+
color: "#ffffff",
|
|
326
|
+
"font-size": "64px",
|
|
327
|
+
align: "center"
|
|
328
|
+
},
|
|
329
|
+
children: [
|
|
330
|
+
{
|
|
331
|
+
text: "50% OFF",
|
|
332
|
+
italic: !0
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
]
|
|
337
|
+
};
|
|
338
|
+
return b(n, t);
|
|
339
|
+
},
|
|
340
|
+
category: Y.SECTION,
|
|
341
|
+
render(t) {
|
|
342
|
+
const { node: n, mode: r } = t, { attributes: o, children: l } = n;
|
|
343
|
+
if (r === "testing") {
|
|
344
|
+
const i = se.renderToString(
|
|
345
|
+
/* @__PURE__ */ e.createElement(ye, { attributes: n.attributes, data: n.data })
|
|
346
|
+
);
|
|
347
|
+
return /* @__PURE__ */ e.createElement(
|
|
348
|
+
z,
|
|
349
|
+
{
|
|
350
|
+
"padding-bottom": o["padding-bottom"],
|
|
351
|
+
"padding-top": o["padding-top"],
|
|
352
|
+
"padding-left": o["padding-left"],
|
|
353
|
+
"padding-right": o["padding-right"],
|
|
354
|
+
"background-color": o["background-color"]
|
|
355
|
+
},
|
|
356
|
+
/* @__PURE__ */ e.createElement(U, null, l.map((c, p) => ie.isTextElement(c) ? /* @__PURE__ */ e.createElement(ke, { key: p, node: c }) : null), /* @__PURE__ */ e.createElement(xe, { height: "20px" }), /* @__PURE__ */ e.createElement(he, null, i))
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
return /* @__PURE__ */ e.createElement(
|
|
360
|
+
z,
|
|
361
|
+
{
|
|
362
|
+
"padding-bottom": o["padding-bottom"],
|
|
363
|
+
"padding-top": o["padding-top"],
|
|
364
|
+
"padding-left": o["padding-left"],
|
|
365
|
+
"padding-right": o["padding-right"],
|
|
366
|
+
"background-color": o["background-color"]
|
|
367
|
+
},
|
|
368
|
+
/* @__PURE__ */ e.createElement(U, null, /* @__PURE__ */ e.createElement(
|
|
369
|
+
Ee,
|
|
370
|
+
u(a({
|
|
371
|
+
idx: t.idx
|
|
372
|
+
}, t.node.attributes), {
|
|
373
|
+
children: n.children
|
|
374
|
+
})
|
|
375
|
+
))
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
class Oe extends J {
|
|
380
|
+
generateElement() {
|
|
381
|
+
R.registerBlocks([O]), f(Q, O.type, O);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const { Image: ve } = T, G = {
|
|
385
|
+
attributes: {
|
|
386
|
+
align: "center",
|
|
387
|
+
border: "0",
|
|
388
|
+
height: "auto",
|
|
389
|
+
"padding-top": "0px",
|
|
390
|
+
"padding-bottom": "0px",
|
|
391
|
+
"padding-left": "0px",
|
|
392
|
+
"padding-right": "0px",
|
|
393
|
+
"border-width": "1px",
|
|
394
|
+
"border-style": "solid",
|
|
395
|
+
"border-color": "#AAAAAA",
|
|
396
|
+
"border-radius": "0px",
|
|
397
|
+
target: "_blank"
|
|
398
|
+
},
|
|
399
|
+
data: {
|
|
400
|
+
list: [
|
|
401
|
+
{
|
|
402
|
+
src: "http://res.cloudinary.com/dwkp0e1yo/image/upload/v1683815911/tceeidvpn9cwtrufgbe3.png"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
src: "http://res.cloudinary.com/dwkp0e1yo/image/upload/v1683815875/mevpkdxft8z6cyjicnd6.png"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
src: "http://res.cloudinary.com/dwkp0e1yo/image/upload/v1683815891/g4qmdcgiyiuyqmdlchuo.png"
|
|
409
|
+
}
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
}, _ = q({
|
|
413
|
+
get name() {
|
|
414
|
+
return V("Shopwindow");
|
|
415
|
+
},
|
|
416
|
+
defaultData: G,
|
|
417
|
+
void: !0,
|
|
418
|
+
type: M.MARKETING_SHOPWINDOW,
|
|
419
|
+
create: (t) => {
|
|
420
|
+
const n = {
|
|
421
|
+
type: M.MARKETING_SHOPWINDOW,
|
|
422
|
+
data: a({}, G.data),
|
|
423
|
+
attributes: {
|
|
424
|
+
src: "http://res.cloudinary.com/dwkp0e1yo/image/upload/v1684137604/beacas-test/ypb7jidggmzgscvs5c3t.gif"
|
|
425
|
+
},
|
|
426
|
+
children: []
|
|
427
|
+
};
|
|
428
|
+
return b(n, t);
|
|
429
|
+
},
|
|
430
|
+
category: Y.IMAGE,
|
|
431
|
+
render(t) {
|
|
432
|
+
const { node: n } = t, d = n.attributes, {
|
|
433
|
+
"border-enabled": r,
|
|
434
|
+
"border-width": o,
|
|
435
|
+
"border-style": l,
|
|
436
|
+
"border-color": i
|
|
437
|
+
} = d, c = j(d, [
|
|
438
|
+
"border-enabled",
|
|
439
|
+
"border-width",
|
|
440
|
+
"border-style",
|
|
441
|
+
"border-color"
|
|
442
|
+
]), p = r ? `${o || "1px"} ${l || "solid"} ${i || "#AAAAAA"}` : "";
|
|
443
|
+
return /* @__PURE__ */ e.createElement(
|
|
444
|
+
ve,
|
|
445
|
+
u(a({
|
|
446
|
+
idx: t.idx
|
|
447
|
+
}, c), {
|
|
448
|
+
data: n.data,
|
|
449
|
+
border: p,
|
|
450
|
+
children: n.children
|
|
451
|
+
})
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
class _e extends J {
|
|
456
|
+
generateElement() {
|
|
457
|
+
R.registerBlocks([_]), f(Q, _.type, _);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
export {
|
|
461
|
+
Oe as Countdown,
|
|
462
|
+
O as MarketingCountdown,
|
|
463
|
+
_ as MarketingShopwindow,
|
|
464
|
+
M as MarketingType,
|
|
465
|
+
Se as Responsive,
|
|
466
|
+
_e as Shopwindow
|
|
467
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./marketing";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ResponsiveElementProps {
|
|
3
|
+
desktop: React.FC<{
|
|
4
|
+
children?: React.ReactElement;
|
|
5
|
+
}>;
|
|
6
|
+
mobile: React.FC<{
|
|
7
|
+
children?: React.ReactElement;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export declare function ResponsiveElement(props: ResponsiveElementProps): JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResponsivePlugin } from "easy-email-pro-core";
|
|
2
|
+
export declare const HIDE_DESKTOP_BLOCK_CLASS_NAME = "hide-desktop-block";
|
|
3
|
+
export declare const HIDE_MOBILE_BLOCK_CLASS_NAME = "hide-mobile-block";
|
|
4
|
+
export declare const HIDE_DESKTOP_INLINE_BLOCK_CLASS_NAME = "hide-desktop-inline-block";
|
|
5
|
+
export declare const HIDE_MOBILE_INLINE_BLOCK_CLASS_NAME = "hide-mobile-inline-block";
|
|
6
|
+
export declare class Responsive extends ResponsivePlugin {
|
|
7
|
+
generateResponsive: ResponsivePlugin["generateResponsive"];
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { KitElementType } from "../constants";
|
|
2
|
+
import { BasicElement, ImageElement } from "easy-email-pro-core";
|
|
3
|
+
export type MarketingCountdownElement = BasicElement<{
|
|
4
|
+
align?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
"grid-color"?: string;
|
|
7
|
+
"shadow-color"?: string;
|
|
8
|
+
"background-color"?: string;
|
|
9
|
+
"font-family"?: string;
|
|
10
|
+
"font-size"?: string;
|
|
11
|
+
"font-style"?: string;
|
|
12
|
+
"font-weight"?: string;
|
|
13
|
+
"line-height"?: string;
|
|
14
|
+
"padding-top"?: string;
|
|
15
|
+
"padding-bottom"?: string;
|
|
16
|
+
"padding-left"?: string;
|
|
17
|
+
"padding-right"?: string;
|
|
18
|
+
src: string;
|
|
19
|
+
}, {
|
|
20
|
+
remainingTime: number;
|
|
21
|
+
unit: "hour" | "day" | "minute" | "second";
|
|
22
|
+
}> & {
|
|
23
|
+
type: KitElementType["MARKETING_COUNTDOWN"];
|
|
24
|
+
};
|
|
25
|
+
export type MarketingShopwindowElement = BasicElement<Omit<ImageElement["attributes"], "inner-padding"> & {
|
|
26
|
+
"inner-padding-top"?: string;
|
|
27
|
+
"inner-padding-bottom"?: string;
|
|
28
|
+
"inner-padding-left"?: string;
|
|
29
|
+
"inner-padding-right"?: string;
|
|
30
|
+
"border-enabled"?: boolean;
|
|
31
|
+
"border-width"?: string;
|
|
32
|
+
"border-style"?: string;
|
|
33
|
+
"border-color"?: string;
|
|
34
|
+
}, {
|
|
35
|
+
list: Array<{
|
|
36
|
+
src: string;
|
|
37
|
+
}>;
|
|
38
|
+
}> & {
|
|
39
|
+
type: KitElementType["MARKETING_SHOPWINDOW"];
|
|
40
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface AnimationToGIFOption {
|
|
2
|
+
totalTime: number;
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
frames?: number;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface AnimationItem {
|
|
8
|
+
keyframes: Keyframe[] | PropertyIndexedKeyframes | null;
|
|
9
|
+
options?: number | KeyframeAnimationOptions;
|
|
10
|
+
selector: Parameters<Document['querySelector']>[0];
|
|
11
|
+
}
|
|
12
|
+
export declare function animationToGIF(list: AnimationItem[], options: AnimationToGIFOption): Promise<Blob>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const urlToImage: (url: string) => Promise<HTMLImageElement>;
|
|
3
|
+
export declare const base64ToBlob: (base64: string) => Promise<string>;
|
|
4
|
+
export declare const img2Base64: (source: InstanceType<typeof Image>) => Promise<string>;
|
|
5
|
+
export declare const img2Blob: (img: HTMLImageElement) => Promise<Blob>;
|
|
6
|
+
interface Dom2SvgOptions {
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
overwrite?: Array<{
|
|
10
|
+
selector: Parameters<Document["querySelector"]>[0] | "";
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
innerText?: string;
|
|
13
|
+
innerHTML?: string;
|
|
14
|
+
attrs?: Record<string, string>;
|
|
15
|
+
}>;
|
|
16
|
+
styleText?: string;
|
|
17
|
+
wrapper?: (content: Element) => Element;
|
|
18
|
+
}
|
|
19
|
+
export declare const dom2Svg: (dom: HTMLElement, option?: Dom2SvgOptions) => Promise<string>;
|
|
20
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "easy-email-pro-kit",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"files": [
|
|
6
|
+
"lib"
|
|
7
|
+
],
|
|
8
|
+
"main": "lib/index.cjs.js",
|
|
9
|
+
"module": "lib/index.es.js",
|
|
10
|
+
"types": "lib/typings/index.d.ts",
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@types/mjml": "^4.7.0",
|
|
15
|
+
"modern-gif": "^1.1.4"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": "^18.2.0",
|
|
19
|
+
"react-dom": "^18.2.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vite build && npm run typings",
|
|
23
|
+
"typings": "tsc --declaration --emitDeclarationOnly --project tsconfig.alias.json && tsc-alias -p tsconfig.alias.json",
|
|
24
|
+
"lint": "eslint --fix --ext .tsx,.ts src/"
|
|
25
|
+
}
|
|
26
|
+
}
|