@useinsider/guido 3.9.1-beta.c64c39e → 3.9.1-beta.de8e72f

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,9 +1,9 @@
1
1
  import { RecommendationBlockId as c } from "../constants/blockIds.js";
2
- import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as x } from "../constants/selectors.js";
2
+ import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as E, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as x, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
3
3
  import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
4
- import { toCustomCompositionKey as v } from "../templates/utils.js";
5
- import { extractWrapperTags as R } from "./preserveTextStyles.js";
6
- import { hasQuerySelectorAll as _, hasGetAttribute as l, hasGetStyle as I, hasGetComputedStyle as U } from "./tagName.js";
4
+ import { toCustomCompositionKey as U } from "../templates/utils.js";
5
+ import { extractWrapperTags as C } from "./preserveTextStyles.js";
6
+ import { hasQuerySelectorAll as A, hasGetAttribute as l, hasGetStyle as R, hasGetComputedStyle as q } from "./tagName.js";
7
7
  const s = [
8
8
  "font-size",
9
9
  "font-family",
@@ -39,94 +39,94 @@ const s = [
39
39
  "border-radius",
40
40
  "margin"
41
41
  ], b = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), G = [
42
- { attrKey: E, blockId: c.NAME, kind: "text" },
43
- { attrKey: p, blockId: c.PRICE, kind: "text" },
44
- { attrKey: y, blockId: c.OLD_PRICE, kind: "text" },
45
- { attrKey: C, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
- { attrKey: A, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
42
+ { attrKey: k, blockId: c.NAME, kind: "text" },
43
+ { attrKey: E, blockId: c.PRICE, kind: "text" },
44
+ { attrKey: h, blockId: c.OLD_PRICE, kind: "text" },
45
+ { attrKey: y, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
+ { attrKey: m, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
47
47
  { attrKey: P, blockId: c.BUTTON, kind: "button" },
48
- { attrKey: q, blockId: c.IMAGE, kind: "image" }
48
+ { attrKey: x, blockId: c.IMAGE, kind: "image" }
49
49
  ];
50
- function O(t) {
50
+ function _(t) {
51
51
  return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
52
52
  }
53
53
  function L(t) {
54
54
  return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
55
55
  }
56
56
  function a(t, e, r) {
57
- !e || !I(e) || r.forEach((n) => {
58
- const o = e.getStyle(n);
59
- o && o !== "inherit" && o !== "initial" && (t[n] = o);
57
+ !e || !R(e) || r.forEach((n) => {
58
+ const i = e.getStyle(n);
59
+ i && i !== "inherit" && i !== "initial" && (t[n] = i);
60
60
  });
61
61
  }
62
- function h(t) {
62
+ function I(t) {
63
63
  return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
64
64
  }
65
- function k(t) {
66
- if (!t || !I(t))
65
+ function O(t) {
66
+ if (!t || !R(t))
67
67
  return;
68
68
  const e = t.getStyle("background-color") || t.getStyle("background");
69
69
  return e && !b.has(e) ? e : void 0;
70
70
  }
71
71
  function g(t, e) {
72
72
  const r = {};
73
- return a(r, t, e), h(r);
73
+ return a(r, t, e), I(r);
74
74
  }
75
75
  function w(t) {
76
76
  const e = t.querySelector("p"), r = {};
77
77
  a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
78
- const n = h(r), { openTags: o, closeTags: i } = R(O(e));
79
- return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
78
+ const n = I(r), { openTags: i, closeTags: o } = C(_(e));
79
+ return !n && !i ? null : { pStyle: n || void 0, openTags: i, closeTags: o };
80
80
  }
81
- function $(t) {
82
- const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), o = g(r, M), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = R(O(r)), m = L(r);
83
- return !n && !o && !u && !T && !m ? null : {
81
+ function K(t) {
82
+ const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), i = g(r, M), o = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(o), { openTags: T, closeTags: d } = C(_(r)), p = L(r);
83
+ return !n && !i && !u && !T && !p ? null : {
84
84
  buttonBorderStyle: n || void 0,
85
- buttonAnchorStyle: o || void 0,
85
+ buttonAnchorStyle: i || void 0,
86
86
  buttonFitToContainer: u || void 0,
87
- buttonText: m || void 0,
87
+ buttonText: p || void 0,
88
88
  openTags: T,
89
89
  closeTags: d
90
90
  };
91
91
  }
92
- function K(t) {
92
+ function H(t) {
93
93
  const e = g(t.querySelector("img"), D);
94
94
  return e ? { imgStyle: e } : null;
95
95
  }
96
- function H(t, e) {
97
- return e === "button" ? $(t) : e === "image" ? K(t) : w(t);
96
+ function $(t, e) {
97
+ return e === "button" ? K(t) : e === "image" ? H(t) : w(t);
98
98
  }
99
99
  function f(t, e) {
100
100
  if (!t || !("querySelector" in t))
101
101
  return;
102
102
  const r = t.querySelector(S) ?? t;
103
- if (G.forEach(({ attrKey: i, blockId: u, kind: T }) => {
103
+ if (G.forEach(({ attrKey: o, blockId: u, kind: T }) => {
104
104
  const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
105
- d && e(d, i, T);
106
- }), !_(r))
105
+ d && e(d, o, T);
106
+ }), !A(r))
107
107
  return;
108
108
  const n = /* @__PURE__ */ new Set();
109
109
  r.querySelectorAll(
110
110
  `[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
111
- ).forEach((i) => {
112
- const u = l(i) ? i.getAttribute(x) : null;
113
- !u || n.has(u) || (n.add(u), e(i, v(u), "text"));
111
+ ).forEach((o) => {
112
+ const u = l(o) ? o.getAttribute(v) : null;
113
+ !u || n.has(u) || (n.add(u), e(o, U(u), "text"));
114
114
  });
115
115
  }
116
116
  function F(t) {
117
117
  const e = {};
118
- return f(t, (r, n, o) => {
118
+ return f(t, (r, n, i) => {
119
119
  if (!("querySelector" in r))
120
120
  return;
121
- const i = H(r, o);
122
- i && (e[n] = i);
121
+ const o = $(r, i);
122
+ o && (e[n] = o);
123
123
  }), e;
124
124
  }
125
125
  function j(t) {
126
126
  if (!t || !("querySelector" in t))
127
127
  return;
128
128
  const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
129
- return k(r);
129
+ return O(r);
130
130
  }
131
131
  function X(t) {
132
132
  if (!t)
@@ -134,28 +134,28 @@ function X(t) {
134
134
  const e = l(t) ? t.getAttribute("bgcolor") : null;
135
135
  if (e && !b.has(e))
136
136
  return e;
137
- const r = k(t);
137
+ const r = O(t);
138
138
  if (r)
139
139
  return r;
140
- const n = U(t) ? t.getComputedStyle("background-color") : void 0;
140
+ const n = q(t) ? t.getComputedStyle("background-color") : void 0;
141
141
  return n && !b.has(n) ? n : void 0;
142
142
  }
143
143
  function z(t) {
144
144
  const e = {};
145
- return f(t, (r, n, o) => {
146
- if (o !== "text")
145
+ return f(t, (r, n, i) => {
146
+ if (i !== "text")
147
147
  return;
148
- const i = X(r);
149
- i && (e[n] = i);
148
+ const o = X(r);
149
+ o && (e[n] = o);
150
150
  }), e;
151
151
  }
152
152
  function Q(t) {
153
153
  const e = {};
154
- return f(t, (r, n, o) => {
155
- if (o === "image")
154
+ return f(t, (r, n, i) => {
155
+ if (i === "image")
156
156
  return;
157
- const i = l(r) ? r.getAttribute("align") : null;
158
- i && (e[n] = i);
157
+ const o = l(r) ? r.getAttribute("align") : null;
158
+ o && (e[n] = o);
159
159
  }), e;
160
160
  }
161
161
  const V = /^es-[pm]\d+[trbl]?$/;
@@ -167,50 +167,44 @@ function W(t) {
167
167
  return r.length ? r.join(" ") : void 0;
168
168
  }
169
169
  function Y(t) {
170
- if (!t || !("querySelector" in t))
171
- return !1;
172
- const e = t.querySelector(S) ?? t, r = (n) => !!(n && "querySelector" in n && n.querySelector(".product-price") && n.querySelector(".product-old-price"));
173
- return r(e.querySelector(`[data-attribute-type="${p}"]`)) || r(e.querySelector(`[data-attribute-type="${y}"]`));
174
- }
175
- function J(t) {
176
- const e = {}, r = Y(t);
177
- return f(t, (n, o, i) => {
178
- if (i === "image" || r && (o === p || o === y))
170
+ const e = {};
171
+ return f(t, (r, n, i) => {
172
+ if (i === "image")
179
173
  return;
180
- const u = W(n);
181
- u && (e[o] = u);
174
+ const o = W(r);
175
+ o && (e[n] = o);
182
176
  }), e;
183
177
  }
184
- function Z(t) {
178
+ function J(t) {
185
179
  const e = {};
186
180
  return f(t, (r, n) => {
187
- if (n !== C && n !== A || !l(r))
181
+ if (n !== y && n !== m || !l(r))
188
182
  return;
189
- const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
190
- (o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
183
+ const i = r.getAttribute("data-text-before"), o = r.getAttribute("data-text-after");
184
+ (i != null || o != null) && (e[n] = { before: i ?? void 0, after: o ?? void 0 });
191
185
  }), e;
192
186
  }
193
- function tt(t) {
187
+ function Z(t) {
194
188
  const e = {};
195
189
  if (!t || !("querySelector" in t))
196
190
  return e;
197
191
  const r = t.querySelector(S) ?? t;
198
- return _(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
192
+ return A(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
199
193
  if (!l(n))
200
194
  return;
201
- const o = n.getAttribute("data-attribute-type"), i = n.getAttribute("data-visibility");
202
- o && i != null && (e[o] = i !== "0");
195
+ const i = n.getAttribute("data-attribute-type"), o = n.getAttribute("data-visibility");
196
+ i && o != null && (e[i] = o !== "0");
203
197
  }), e;
204
198
  }
205
- function ct(t) {
199
+ function ut(t) {
206
200
  return {
207
201
  styleTemplates: F(t),
208
202
  cardBackgroundColor: j(t),
209
203
  cellBackgroundColors: z(t),
210
204
  cellAlignments: Q(t),
211
- cellClasses: J(t),
212
- omnibusTexts: Z(t),
213
- visibility: tt(t)
205
+ cellClasses: Y(t),
206
+ omnibusTexts: J(t),
207
+ visibility: Z(t)
214
208
  };
215
209
  }
216
210
  export {
@@ -218,8 +212,8 @@ export {
218
212
  j as captureCardBackgroundColor,
219
213
  Q as captureCellAlignments,
220
214
  z as captureCellBackgroundColors,
221
- J as captureCellClasses,
222
- Z as captureOmnibusTexts,
223
- ct as captureStyles,
224
- tt as captureVisibility
215
+ Y as captureCellClasses,
216
+ J as captureOmnibusTexts,
217
+ ut as captureStyles,
218
+ Z as captureVisibility
225
219
  };
@@ -1,9 +1,10 @@
1
1
  import { useHttp as d } from "../composables/useHttp.js";
2
2
  import { useToaster as m } from "../composables/useToaster.js";
3
3
  import { MAX_DEFAULT_TEMPLATE_ID as y } from "../enums/defaults.js";
4
- import { useBlankTemplate as f } from "./blankTemplate.js";
5
- const D = () => {
6
- const { get: s, post: u } = d(), { handleError: r } = m(), { getBlankTemplate: o } = f();
4
+ import f from "../static/templates/empty/index.html.js";
5
+ import g from "../static/templates/empty/style.css.js";
6
+ const E = () => {
7
+ const { get: s, post: c } = d(), { handleError: r } = m();
7
8
  return {
8
9
  getToken: async () => {
9
10
  try {
@@ -25,14 +26,18 @@ const D = () => {
25
26
  }
26
27
  },
27
28
  getDefaultTemplate: async () => {
29
+ const t = {
30
+ html: f,
31
+ css: g
32
+ };
28
33
  try {
29
- const t = new URLSearchParams(window.location.search), e = t.get("default-template"), l = t.get("master"), n = e ? parseInt(e) : 0, i = n >= 1 && n <= y ? n : 0;
30
- if (!i && !l)
31
- return await o();
32
- const p = `/stripo/default-template/${i}`, { data: c } = await s(p), a = typeof c == "string" ? JSON.parse(c) : c;
33
- return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? await o() : a;
34
- } catch (t) {
35
- return r(t, "Failed to fetch default template"), o();
34
+ const e = new URLSearchParams(window.location.search), u = e.get("default-template"), p = e.get("master"), a = u ? parseInt(u) : 0, i = a >= 1 && a <= y ? a : 0;
35
+ if (!i && !p)
36
+ return t;
37
+ const l = `/stripo/default-template/${i}`, { data: n } = await s(l), o = typeof n == "string" ? JSON.parse(n) : n;
38
+ return !o || typeof o != "object" || !("html" in o) || !("css" in o) ? t : o;
39
+ } catch (e) {
40
+ return r(e, "Failed to fetch default template"), t;
36
41
  }
37
42
  },
38
43
  getSyncModulesStatus: async () => {
@@ -45,7 +50,7 @@ const D = () => {
45
50
  },
46
51
  updateSyncModule: async (t) => {
47
52
  try {
48
- return await u(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
53
+ return await c(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
49
54
  } catch (e) {
50
55
  return r(e, "Failed to update sync module"), !1;
51
56
  }
@@ -66,7 +71,7 @@ const D = () => {
66
71
  if (t.length === 0)
67
72
  return !0;
68
73
  try {
69
- return await u("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
74
+ return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
70
75
  } catch (e) {
71
76
  return r(e, "Failed to set unsubscription preference pages"), !1;
72
77
  }
@@ -74,5 +79,5 @@ const D = () => {
74
79
  };
75
80
  };
76
81
  export {
77
- D as useStripoApi
82
+ E as useStripoApi
78
83
  };
@@ -8,9 +8,6 @@ export declare const TemplateTypes: {
8
8
  };
9
9
  export declare const EditorType: number;
10
10
  export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
11
- export declare const EMAIL_STATIC_BASE_URL = "https://email-static.useinsider.com";
12
- export declare const BLANK_TEMPLATE_HTML_URL = "https://email-static.useinsider.com/templates/campaign/default.html";
13
- export declare const BLANK_TEMPLATE_CSS_URL = "https://email-static.useinsider.com/templates/campaign/default.css";
14
11
  export declare const ProductIds: Record<string, number>;
15
12
  export declare const ModuleFolderDefaults: {
16
13
  readonly SAVED_MODULES: "savedModules";
@@ -51,12 +51,6 @@ export declare function captureCellAlignments(node: ImmutableHtmlNode | null | u
51
51
  * text-trim) keyed by composition key, so a regeneration can re-bake them
52
52
  * instead of resetting to the renderer's hardcoded spacing classes. Stripo stores padding
53
53
  * and margin as these classes (NOT inline style), so an inline-style capture misses them.
54
- *
55
- * Inline price mode: the merged columns carry POSITIONAL spacing classes
56
- * (`es-p15l es-p5r` / `es-p5l es-p15r`) that build the side-by-side gap — layout
57
- * mechanics, not user padding. Skip the price cells then, so toggling back to
58
- * stacked resets them to the renderer defaults instead of baking the lopsided
59
- * inline paddings (SD-145161).
60
54
  */
61
55
  export declare function captureCellClasses(node: ImmutableHtmlNode | null | undefined): Record<string, string>;
62
56
  /**
@@ -0,0 +1,74 @@
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
+ };