easy-email-pro-core 1.0.0 → 1.0.2

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 CHANGED
@@ -114,4 +114,4 @@ PERFORMANCE OF THIS SOFTWARE.
114
114
  <!-- htmlmin:ignore -->
115
115
  {% endif %}
116
116
  <!-- htmlmin:ignore -->
117
- `))}generateVariable(e,r){return r?`{{ ${e}| default: "${rt.encode(r)}" }}`:`{{ ${e} }}`}isVariable(e){return Cs.test(e)}renderWithData(e,r){const i=new wi;i.plugin(function(){this.registerFilter("chunk",(a,u=1)=>j.chunk(a,u)),this.registerFilter("arr_filter",(a,u,...o)=>a?a.filter(l=>o.includes(l[u])):null),this.registerFilter("arr_filter_sort",(a,u,...o)=>!a||!o?null:o.map(l=>a.find(c=>j.get(c,u)===l)).filter(Boolean)),this.registerFilter("arr_slice",(a,u,o)=>a?a.slice(u,o):null),this.registerFilter("date",a=>ti(a).format("MMM DD, YY")),this.registerFilter("money",a=>{const u=j.get(r,"shop.money_in_emails_format","");return u?this.parseAndRenderSync(u,{amount:Number(a).toFixed(2)}):a}),this.registerFilter("money_with_currency",a=>{const u=j.get(r,"shop.money_with_currency_in_emails_format","");return u?this.parseAndRenderSync(u,{amount:Number(a).toFixed(2)}):a}),this.registerFilter("money_without_currency",a=>Number(a).toFixed(2)),this.registerFilter("money_without_trailing_zeros",a=>{const u=j.get(r,"shop.money_in_emails_format","");return u?this.parseAndRenderSync(u,{amount:Number(a)}):a}),this.registerFilter("img_url",a=>j.get(a,"image")||j.get(a,"src")||""),this.registerFilter("format_address",a=>a),this.registerFilter("payment_type_img_url",a=>a)});const n=i.parse(e);return i.renderSync(n,r)}}function Dh(t){const{desktop:e,mobile:r}=t,i=ci(),{displayMode:n="desktop-mobile"}=i;return n==="only-desktop"?R.createElement(Je,G(M({},i),{displayMode:"only-desktop"}),R.createElement(R.Fragment,null,R.createElement(e,null))):n==="only-mobile"?R.createElement(R.Fragment,null,R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"),R.createElement(Je,G(M({},i),{displayMode:"only-mobile"}),R.createElement(R.Fragment,null,R.createElement(r,null))),R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->")):R.createElement(R.Fragment,null,R.createElement(Je,G(M({},i),{displayMode:"only-desktop"}),R.createElement(R.Fragment,null,R.createElement(e,null))),R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"),R.createElement(Je,G(M({},i),{displayMode:"only-mobile"}),R.createElement(R.Fragment,null,R.createElement(r,null))),R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->"))}const Ts="hide-desktop-block",ks="hide-mobile-block",Ss="hide-desktop-inline-block",Rs="hide-mobile-inline-block",ba=[Y.GROUP,Y.COLUMN,Y.NAVBAR_LINK];class Fs extends Er{constructor(){super(...arguments);ne(this,"generateResponsive",r=>{var x;const{mode:i,displayMode:n,node:a,keepEmptyAttributes:u,mergetagsData:o={},children:l,context:c,idx:h}=r,g=oe.getBlockByType(a.type);if(!g)throw new Error(`${a.type} block is not registered`);const d=a.mobileAttributes&&Object.keys(a.mobileAttributes).some(k=>a.mobileAttributes[k]!==a.attributes[k]),v=ba.includes(g.type)?Ss:Ts,m=ba.includes(g.type)?Rs:ks,E=j.get(a,"attributes.css-class")||"";if(n==="only-desktop"){if(a.visible==="mobile"||E.includes(v))return null;E.includes(m)||j.set(a,"attributes.css-class",ht(E,m))}else if(n==="only-mobile"){if(E.includes(m))return null;E.includes(v)||j.set(a,"attributes.css-class",ht(E,v))}if(n==="only-mobile"){if(a.visible==="desktop")return null;a.attributes=W(W(g.defaultData.attributes,g.defaultData.mobileAttributes),a.attributes)}else a.attributes=W(((x=g.defaultData)==null?void 0:x.attributes)||{},a.attributes);a.visible==="desktop"?j.set(a,"attributes.css-class",ht(E,m)):a.visible==="mobile"&&j.set(a,"attributes.css-class",ht(E,v)),a.visible;const p=a.visible==="desktop"?null:g.render({mode:i,children:l,context:c,idx:h,node:G(M({},a),{attributes:W(a.attributes,a.mobileAttributes),mobileAttributes:void 0}),keepEmptyAttributes:u,mergetagsData:o}),f=g.render(G(M({},r),{mode:i,children:l,context:c,idx:h,node:a,keepEmptyAttributes:u,mergetagsData:o}));let y=f;return d&&(y=R.createElement(R.Fragment,null,R.createElement(Dh,{desktop:()=>R.createElement(R.Fragment,null,f),mobile:()=>R.createElement(R.Fragment,null,p)}))),y})}}function Os(t,e){var l,c;const{node:r}=t,i=(l=e==null?void 0:e.keepEmptyAttributes)!=null?l:!1,n=(c=e==null?void 0:e.removeDefaultAttributes)!=null?c:!1,a=M({},r.attributes),u=oe.getBlockByType(r.type).defaultData.attributes;let o="";for(const h in a){const g=h;let d=a[g];if(!(n&&u[g]===d)&&j.isString(d)&&(d=d.trim(),i||d)){const v=" ";o+=`${h}="${d.replace(/"/gm,"").trim()}"`+v}}return o}me.registerPlugins([Bs,Fs]);exports.BasicType=$;exports.BlockManager=oe;exports.CONTENT_EDITABLE_CLASSNAME=ii;exports.ConditionOperator=mr;exports.ConditionOperatorSymbol=os;exports.EditorCore=He;exports.ElementCategory=z;exports.ElementPlugin=Fa;exports.ElementType=Y;exports.EmailRenderProvider=Je;exports.HIDE_DESKTOP_BLOCK_CLASS_NAME=Ts;exports.HIDE_DESKTOP_INLINE_BLOCK_CLASS_NAME=Ss;exports.HIDE_MOBILE_BLOCK_CLASS_NAME=ks;exports.HIDE_MOBILE_INLINE_BLOCK_CLASS_NAME=Rs;exports.I18nManager=Lt;exports.LogicType=Da;exports.MERGE_TAG_PATTERN=Cs;exports.MERGE_TAG_PATTERN_GLOBAL=bh;exports.NodeUtils=re;exports.PageTestingCss=$o;exports.PluginManager=me;exports.PluginType=Ra;exports.Responsive=Fs;exports.ResponsivePlugin=Er;exports.StandardType=ae;exports.TemplateEngine=Bs;exports.TemplateEnginePlugin=wr;exports.blockMap=us;exports.classnames=ht;exports.components=Mo;exports.createBlock=Qs;exports.createCustomBlock=Zs;exports.getAdapterAttributesString=Os;exports.keyGenerate=il;exports.mergeBlock=W;exports.mergeTagGenerate=tl;exports.t=K;exports.useEmailRenderContext=ci;exports.variableGenerate=rl;
117
+ `))}generateVariable(e,r){return r?`{{ ${e}| default: "${rt.encode(r)}" }}`:`{{ ${e} }}`}isVariable(e){return Cs.test(e)}renderWithData(e,r){const i=new wi;i.plugin(function(){this.registerFilter("chunk",(a,u=1)=>j.chunk(a,u)),this.registerFilter("arr_filter",(a,u,...o)=>a?a.filter(l=>o.includes(l[u])):null),this.registerFilter("arr_filter_sort",(a,u,...o)=>!a||!o?null:o.map(l=>a.find(c=>j.get(c,u)===l)).filter(Boolean)),this.registerFilter("arr_slice",(a,u,o)=>a?a.slice(u,o):null),this.registerFilter("date",a=>ti(a).format("MMM DD, YY")),this.registerFilter("money",a=>{const u=j.get(r,"shop.money_in_emails_format","");return u?this.parseAndRenderSync(u,{amount:Number(a).toFixed(2)}):a}),this.registerFilter("money_with_currency",a=>{const u=j.get(r,"shop.money_with_currency_in_emails_format","");return u?this.parseAndRenderSync(u,{amount:Number(a).toFixed(2)}):a}),this.registerFilter("money_without_currency",a=>Number(a).toFixed(2)),this.registerFilter("money_without_trailing_zeros",a=>{const u=j.get(r,"shop.money_in_emails_format","");return u?this.parseAndRenderSync(u,{amount:Number(a)}):a}),this.registerFilter("img_url",a=>j.get(a,"image")||j.get(a,"src")||""),this.registerFilter("format_address",a=>a),this.registerFilter("payment_type_img_url",a=>a)});const n=i.parse(e);return i.renderSync(n,r)}}function Dh(t){const{desktop:e,mobile:r}=t,i=ci(),{displayMode:n="desktop-mobile"}=i;return n==="only-desktop"?R.createElement(Je,G(M({},i),{displayMode:"only-desktop"}),R.createElement(R.Fragment,null,R.createElement(e,null))):n==="only-mobile"?R.createElement(R.Fragment,null,i.mode==="production"&&R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"),R.createElement(Je,G(M({},i),{displayMode:"only-mobile"}),R.createElement(R.Fragment,null,R.createElement(r,null))),i.mode==="production"&&R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->")):R.createElement(R.Fragment,null,R.createElement(Je,G(M({},i),{displayMode:"only-desktop"}),R.createElement(R.Fragment,null,R.createElement(e,null))),i.mode==="production"&&R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"),R.createElement(Je,G(M({},i),{displayMode:"only-mobile"}),R.createElement(R.Fragment,null,R.createElement(r,null))),i.mode==="production"&&R.createElement(Oe,null,"<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->"))}const Ts="hide-desktop-block",ks="hide-mobile-block",Ss="hide-desktop-inline-block",Rs="hide-mobile-inline-block",ba=[Y.GROUP,Y.COLUMN,Y.NAVBAR_LINK];class Fs extends Er{constructor(){super(...arguments);ne(this,"generateResponsive",r=>{var x;const{mode:i,displayMode:n,node:a,keepEmptyAttributes:u,mergetagsData:o={},children:l,context:c,idx:h}=r,g=oe.getBlockByType(a.type);if(!g)throw new Error(`${a.type} block is not registered`);const d=a.mobileAttributes&&Object.keys(a.mobileAttributes).some(k=>a.mobileAttributes[k]===void 0?!1:a.mobileAttributes[k]!==a.attributes[k]),v=ba.includes(g.type)?Ss:Ts,m=ba.includes(g.type)?Rs:ks,E=j.get(a,"attributes.css-class")||"";if(n==="only-desktop"){if(a.visible==="mobile"||E.includes(v))return null;E.includes(m)||j.set(a,"attributes.css-class",ht(E,m))}else if(n==="only-mobile"){if(E.includes(m))return null;E.includes(v)||j.set(a,"attributes.css-class",ht(E,v))}if(n==="only-mobile"){if(a.visible==="desktop")return null;a.attributes=W(W(g.defaultData.attributes,g.defaultData.mobileAttributes),a.attributes)}else a.attributes=W(((x=g.defaultData)==null?void 0:x.attributes)||{},a.attributes);a.visible==="desktop"?j.set(a,"attributes.css-class",ht(E,m)):a.visible==="mobile"&&j.set(a,"attributes.css-class",ht(E,v)),a.visible;const p=a.visible==="desktop"?null:g.render({mode:i,children:l,context:c,idx:h,node:G(M({},a),{attributes:W(a.attributes,a.mobileAttributes),mobileAttributes:void 0}),keepEmptyAttributes:u,mergetagsData:o}),f=g.render(G(M({},r),{mode:i,children:l,context:c,idx:h,node:a,keepEmptyAttributes:u,mergetagsData:o}));let y=f;return d&&(y=R.createElement(R.Fragment,null,R.createElement(Dh,{desktop:()=>R.createElement(R.Fragment,null,f),mobile:()=>R.createElement(R.Fragment,null,p)}))),y})}}function Os(t,e){var l,c;const{node:r}=t,i=(l=e==null?void 0:e.keepEmptyAttributes)!=null?l:!1,n=(c=e==null?void 0:e.removeDefaultAttributes)!=null?c:!1,a=M({},r.attributes),u=oe.getBlockByType(r.type).defaultData.attributes;let o="";for(const h in a){const g=h;let d=a[g];if(!(n&&u[g]===d)&&j.isString(d)&&(d=d.trim(),i||d)){const v=" ";o+=`${h}="${d.replace(/"/gm,"").trim()}"`+v}}return o}me.registerPlugins([Bs,Fs]);exports.BasicType=$;exports.BlockManager=oe;exports.CONTENT_EDITABLE_CLASSNAME=ii;exports.ConditionOperator=mr;exports.ConditionOperatorSymbol=os;exports.EditorCore=He;exports.ElementCategory=z;exports.ElementPlugin=Fa;exports.ElementType=Y;exports.EmailRenderProvider=Je;exports.HIDE_DESKTOP_BLOCK_CLASS_NAME=Ts;exports.HIDE_DESKTOP_INLINE_BLOCK_CLASS_NAME=Ss;exports.HIDE_MOBILE_BLOCK_CLASS_NAME=ks;exports.HIDE_MOBILE_INLINE_BLOCK_CLASS_NAME=Rs;exports.I18nManager=Lt;exports.LogicType=Da;exports.MERGE_TAG_PATTERN=Cs;exports.MERGE_TAG_PATTERN_GLOBAL=bh;exports.NodeUtils=re;exports.PageTestingCss=$o;exports.PluginManager=me;exports.PluginType=Ra;exports.Responsive=Fs;exports.ResponsivePlugin=Er;exports.StandardType=ae;exports.TemplateEngine=Bs;exports.TemplateEnginePlugin=wr;exports.blockMap=us;exports.classnames=ht;exports.components=Mo;exports.createBlock=Qs;exports.createCustomBlock=Zs;exports.getAdapterAttributesString=Os;exports.keyGenerate=il;exports.mergeBlock=W;exports.mergeTagGenerate=tl;exports.t=K;exports.useEmailRenderContext=ci;exports.variableGenerate=rl;
package/lib/index.es.js CHANGED
@@ -11640,7 +11640,7 @@ class Dh extends hi {
11640
11640
  }
11641
11641
  function Ah(t) {
11642
11642
  const { desktop: e, mobile: r } = t, i = Na(), { displayMode: n = "desktop-mobile" } = i;
11643
- return n === "only-desktop" ? /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-desktop" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(e, null))) : n === "only-mobile" ? /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"), /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-mobile" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(r, null))), /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->")) : /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-desktop" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(e, null))), /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"), /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-mobile" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(r, null))), /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->"));
11643
+ return n === "only-desktop" ? /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-desktop" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(e, null))) : n === "only-mobile" ? /* @__PURE__ */ R.createElement(R.Fragment, null, i.mode === "production" && /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"), /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-mobile" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(r, null))), i.mode === "production" && /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->")) : /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-desktop" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(e, null))), i.mode === "production" && /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--[if !mso]><!--><!-- htmlmin:ignore -->"), /* @__PURE__ */ R.createElement(dt, j(U({}, i), { displayMode: "only-mobile" }), /* @__PURE__ */ R.createElement(R.Fragment, null, /* @__PURE__ */ R.createElement(r, null))), i.mode === "production" && /* @__PURE__ */ R.createElement(Ne, null, "<!-- htmlmin:ignore --><!--<![endif]--><!-- htmlmin:ignore -->"));
11644
11644
  }
11645
11645
  const yh = "hide-desktop-block", Eh = "hide-mobile-block", wh = "hide-desktop-inline-block", Ch = "hide-mobile-inline-block", Da = [
11646
11646
  X.GROUP,
@@ -11664,7 +11664,7 @@ class Bh extends pi {
11664
11664
  } = r, g = ue.getBlockByType(a.type);
11665
11665
  if (!g)
11666
11666
  throw new Error(`${a.type} block is not registered`);
11667
- const d = a.mobileAttributes && Object.keys(a.mobileAttributes).some((k) => a.mobileAttributes[k] !== a.attributes[k]), v = Da.includes(g.type) ? wh : yh, m = Da.includes(g.type) ? Ch : Eh, E = ge(a, "attributes.css-class") || "";
11667
+ const d = a.mobileAttributes && Object.keys(a.mobileAttributes).some((k) => a.mobileAttributes[k] === void 0 ? !1 : a.mobileAttributes[k] !== a.attributes[k]), v = Da.includes(g.type) ? wh : yh, m = Da.includes(g.type) ? Ch : Eh, E = ge(a, "attributes.css-class") || "";
11668
11668
  if (n === "only-desktop") {
11669
11669
  if (a.visible === "mobile" || E.includes(v))
11670
11670
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"