@useinsider/guido 3.9.1-beta.6e7cd3e → 3.9.1-beta.8a96896

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,84 +1,85 @@
1
- import { productPairs as q } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- import { DefaultConfigValues as N } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
- function W(M) {
4
- const S = M.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), g = new DOMParser().parseFromString(S, "text/html"), m = q.PAIRS_FOR_EXTENSION;
5
- Object.entries(m).forEach(([r, f]) => {
6
- g.querySelectorAll(".ins-product-td").forEach((c) => {
7
- const A = c.getAttribute("data-number") || "1", C = c.getAttribute("data-type") || "CART_ITEMS";
8
- c.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
9
- var F, I, w;
10
- const $ = e.getAttribute("data-type") || C, u = e.getAttribute("data-number") || A, d = f[$];
11
- if (d)
1
+ import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ function q(w) {
3
+ const y = w.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), T = new DOMParser().parseFromString(y, "text/html"), C = L.PAIRS_FOR_EXTENSION;
4
+ Object.entries(C).forEach(([r, f]) => {
5
+ T.querySelectorAll(".ins-product-td").forEach((o) => {
6
+ const A = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
7
+ o.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
8
+ var k, F, I;
9
+ const $ = e.getAttribute("data-type") || b, d = e.getAttribute("data-number") || A, u = f[$];
10
+ if (u)
12
11
  switch (r) {
13
12
  case "imageSrc": {
14
13
  let t = null, i = null;
15
14
  if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
16
15
  break;
17
- const a = d.DEFAULT, s = d.ATTR;
16
+ const a = u.DEFAULT, s = u.ATTR;
18
17
  if (a && t.src) {
19
- const o = t.src;
18
+ const c = t.src;
20
19
  a.some((h) => {
21
- const l = h.split("/").pop() || "", b = o.split("/").pop() || "";
22
- return o.includes(h) || o.includes(l) || b === l;
23
- }) && (t.src = `{{${s}_${u}}}`);
20
+ const l = h.split("/").pop() || "", g = c.split("/").pop() || "";
21
+ return c.includes(h) || c.includes(l) || g === l;
22
+ }) && (t.src = `{{${s}_${d}}}`);
24
23
  }
25
- const n = (I = (F = m.name) == null ? void 0 : F[$]) == null ? void 0 : I.ATTR;
26
- if (n && t.setAttribute("alt", `{{${n}_${u}}}`), i) {
27
- const o = (w = m.itemLink) == null ? void 0 : w[$];
28
- if (o) {
29
- const E = o.HREF, h = o.DEFAULT_HREF || "#!", l = i.href;
30
- (l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${u}}}`);
24
+ const n = (F = (k = C.name) == null ? void 0 : k[$]) == null ? void 0 : F.ATTR;
25
+ if (n && t.setAttribute("alt", `{{${n}_${d}}}`), i) {
26
+ const c = (I = C.itemLink) == null ? void 0 : I[$];
27
+ if (c) {
28
+ const E = c.HREF, h = c.DEFAULT_HREF || "#!", l = i.href;
29
+ (l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${d}}}`);
31
30
  }
32
31
  }
33
32
  break;
34
33
  }
35
34
  case "name": {
36
- const t = d, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
37
- e.textContent && (e.textContent = `{{${i}_${u}}}`);
35
+ const t = u, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
36
+ e.textContent && (e.textContent = `{{${i}_${d}}}`);
38
37
  const n = e.closest("a") || (e.tagName === "A" ? e : null);
39
38
  if (n && s) {
40
- const o = n.href, E = `${window.location.href}${a}`;
41
- (o === E || o.endsWith(a)) && (n.href = `{{${s}_${u}}}`);
39
+ const c = n.href, E = `${window.location.href}${a}`;
40
+ (c === E || c.endsWith(a)) && (n.href = `{{${s}_${d}}}`);
42
41
  }
43
42
  break;
44
43
  }
45
44
  case "price":
46
45
  case "originalPrice": {
47
- const t = d, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", o = e.getAttribute("data-curency") || "before";
46
+ const t = u, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", c = e.getAttribute("data-curency") || "before";
48
47
  let E;
49
48
  n ? E = s ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : E = s ? t.PRICE_FORMATTED : t.PRICE;
50
49
  const h = t.CURRENCY;
51
- let l = `{{${E}_${u}}}`;
52
- const b = (e.getAttribute("data-currency_symbol") || "").trim(), x = b !== "" && b !== N.productPriceCurrencySymbolControlValue;
53
- let T = "";
54
- x ? T = b : h && (T = `{{${h}_${u}}}`), T && (l = o === "after" ? `${l} ${T}` : `${T} ${l}`), e.textContent = l;
50
+ let l = `{{${E}_${d}}}`;
51
+ if (h) {
52
+ const g = `{{${h}_${d}}}`;
53
+ l = c === "after" ? `${l} ${g}` : `${g} ${l}`;
54
+ }
55
+ e.textContent = l;
55
56
  break;
56
57
  }
57
58
  case "quantity": {
58
- const t = d, i = t.ATTR, a = t.DEFAULT;
59
- e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${u}}}`);
59
+ const t = u, i = t.ATTR, a = t.DEFAULT;
60
+ e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${d}}}`);
60
61
  break;
61
62
  }
62
63
  case "button": {
63
- const t = d, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
64
+ const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
64
65
  if (s) {
65
- const n = s.href || "", o = `${window.location.href}${a}`;
66
- (n === "" || n === "#" || n === o || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${u}}}`);
66
+ const n = s.href || "", c = `${window.location.href}${a}`;
67
+ (n === "" || n === "#" || n === c || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${d}}}`);
67
68
  }
68
69
  break;
69
70
  }
70
71
  case "itemLink": {
71
- const t = d, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
72
+ const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
72
73
  if (s.href) {
73
- const n = s.href, o = `${window.location.href}${a}`;
74
- (n === o || n.endsWith(a)) && (s.href = `{{${i}_${u}}}`);
74
+ const n = s.href, c = `${window.location.href}${a}`;
75
+ (n === c || n.endsWith(a)) && (s.href = `{{${i}_${d}}}`);
75
76
  }
76
77
  break;
77
78
  }
78
79
  default: {
79
- if ("ATTR" in d) {
80
- const t = d.ATTR;
81
- e.textContent && (e.textContent = `{{${t}_${u}}}`);
80
+ if ("ATTR" in u) {
81
+ const t = u.ATTR;
82
+ e.textContent && (e.textContent = `{{${t}_${d}}}`);
82
83
  }
83
84
  break;
84
85
  }
@@ -86,48 +87,48 @@ function W(M) {
86
87
  });
87
88
  });
88
89
  });
89
- const H = S.match(/<!DOCTYPE[^>]*>/i), P = H ? `${H[0]}
90
- ` : "", D = g.querySelectorAll(".ins-product-td"), k = [];
91
- D.forEach((r) => {
92
- const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", c = r.getAttribute("data-nodup"), A = r.outerHTML;
93
- k.push({
90
+ const S = y.match(/<!DOCTYPE[^>]*>/i), M = S ? `${S[0]}
91
+ ` : "", P = T.querySelectorAll(".ins-product-td"), H = [];
92
+ P.forEach((r) => {
93
+ const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", o = r.getAttribute("data-nodup"), A = r.outerHTML;
94
+ H.push({
94
95
  element: r,
95
96
  outerHtml: A,
96
97
  type: f,
97
98
  number: p,
98
- nodup: c || void 0
99
+ nodup: o || void 0
99
100
  });
100
101
  });
101
- let _ = P + g.documentElement.outerHTML;
102
- k.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
103
- let c = "";
102
+ let _ = M + T.documentElement.outerHTML;
103
+ H.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
104
+ let o = "";
104
105
  switch (f) {
105
106
  case "CART_ITEMS":
106
- c = "ins_apr_total_product_kind";
107
+ o = "ins_apr_total_product_kind";
107
108
  break;
108
109
  case "BROWSED_ITEMS":
109
- c = "browsed_item_total_product_kind";
110
+ o = "browsed_item_total_product_kind";
110
111
  break;
111
112
  case "PURCHASED_ITEMS":
112
- c = "purchased_item_total_product_kind";
113
+ o = "purchased_item_total_product_kind";
113
114
  break;
114
115
  }
115
- if (c) {
116
- const C = parseInt(p) - 1, $ = `${`{% if ${c} > ${C} %}`}${r}{% endif %}`;
116
+ if (o) {
117
+ const b = parseInt(p) - 1, $ = `${`{% if ${o} > ${b} %}`}${r}{% endif %}`;
117
118
  _ = _.replace(r, $);
118
119
  }
119
120
  });
120
- const L = g.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), y = [];
121
- return L.forEach((r) => {
121
+ const D = T.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
122
+ return D.forEach((r) => {
122
123
  const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
123
124
  if (!f || p !== "CART_ITEMS")
124
125
  return;
125
- const c = r.closest(".product-original-price-class");
126
- if (c) {
127
- const A = c.outerHTML;
128
- y.some((R) => R.tdOuterHtml === A) || y.push({ tdOuterHtml: A, number: f });
126
+ const o = r.closest(".product-original-price-class");
127
+ if (o) {
128
+ const A = o.outerHTML;
129
+ R.some((m) => m.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
129
130
  }
130
- }), y.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
131
+ }), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
131
132
  const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
132
133
  if (!_.includes(p) && !r.includes("{% if")) {
133
134
  const A = `${p}${r}{% endif %}`;
@@ -136,5 +137,5 @@ function W(M) {
136
137
  }), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
137
138
  }
138
139
  export {
139
- W as pairProductVariables
140
+ q as pairProductVariables
140
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.9.1-beta.6e7cd3e",
3
+ "version": "3.9.1-beta.8a96896",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -1,74 +0,0 @@
1
- const t = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html>
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta content="width=device-width, initial-scale=1" name="viewport">
7
- <meta name="x-apple-disable-message-reformatting">
8
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
- <meta content="telephone=no" name="format-detection">
10
- <title></title>
11
- <!--[if (mso 16)]><style type="text/css">a{text-decoration:none}</style><![endif]-->
12
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
13
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
14
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
15
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
16
- <!--[if gte mso 9]><style>sup { font-size: 100% !important; }</style><![endif]-->
17
- </head>
18
-
19
- <body>
20
- <div class="es-wrapper-color">
21
- <!--[if gte mso 9]>
22
- <v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
23
- <v:fill type="tile" color="#f6f6f6"></v:fill>
24
- </v:background>
25
- <![endif]-->
26
- <table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0">
27
- <tbody>
28
- <tr>
29
- <td class="esd-email-paddings" valign="top">
30
- <table class="es-content esd-footer-popover" cellspacing="0" cellpadding="0" align="center">
31
- <tbody>
32
- <tr>
33
- <td class="esd-stripe" align="center">
34
- <table class="es-content-body" width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center">
35
- <tbody>
36
- <tr>
37
- <td class="esd-structure es-p20" align="left">
38
- <table cellpadding="0" cellspacing="0" width="100%">
39
- <tbody>
40
- <tr>
41
- <td width="560" class="esd-container-frame" align="center" valign="top">
42
- <table cellpadding="0" cellspacing="0" width="100%">
43
- <tbody>
44
- <tr>
45
- <td align="center" class="esd-empty-container" style="display: none;"></td>
46
- </tr>
47
- </tbody>
48
- </table>
49
- </td>
50
- </tr>
51
- </tbody>
52
- </table>
53
- </td>
54
- </tr>
55
- </tbody>
56
- </table>
57
- </td>
58
- </tr>
59
- </tbody>
60
- </table>
61
- </td>
62
- </tr>
63
- </tbody>
64
- </table>
65
- </div>
66
- <div style="position: absolute; left: -9999px; top: -9999px; margin: 0px;"></div>
67
- <div style="position: absolute; left: -9999px; top: -9999px; margin: 0px; padding: 0px; border: 0px none; width: 1px;"></div>
68
- </body>
69
-
70
- </html>
71
- `;
72
- export {
73
- t as default
74
- };