@useinsider/guido 1.0.3-beta.45db97c → 1.0.3-beta.46b1cdf

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.
Files changed (62) hide show
  1. package/README.md +3 -140
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +73 -79
  4. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/LeftSlot.vue2.js +15 -16
  6. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  7. package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
  8. package/dist/composables/useGuidoActions.js +9 -19
  9. package/dist/composables/useStripo.js +58 -49
  10. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  11. package/dist/config/migrator/radioButtonMigrator.js +5 -5
  12. package/dist/enums/defaults.js +9 -16
  13. package/dist/enums/unsubscribe.js +25 -27
  14. package/dist/extensions/Blocks/Checkbox/control.js +14 -15
  15. package/dist/extensions/Blocks/Checkbox/extension.js +2 -2
  16. package/dist/extensions/Blocks/CouponBlock/extension.js +2 -2
  17. package/dist/extensions/Blocks/RadioButton/control.js +17 -18
  18. package/dist/extensions/Blocks/RadioButton/template.js +4 -4
  19. package/dist/extensions/Blocks/Recommendation/extension.js +4 -4
  20. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +4 -4
  22. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  23. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  24. package/dist/guido.css +1 -1
  25. package/dist/package.json.js +1 -1
  26. package/dist/services/stripoApi.js +1 -1
  27. package/dist/src/@types/generic.d.ts +6 -36
  28. package/dist/src/components/Guido.vue.d.ts +2 -3
  29. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  30. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  31. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  32. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  33. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  34. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  35. package/dist/src/stores/config.d.ts +2 -9
  36. package/dist/src/stores/dynamic-content.d.ts +3 -3
  37. package/dist/src/stores/editor.d.ts +1 -1
  38. package/dist/src/stores/onboarding.d.ts +1 -1
  39. package/dist/src/stores/preview.d.ts +1 -1
  40. package/dist/src/stores/recommendation.d.ts +1 -1
  41. package/dist/src/stores/save-as-template.d.ts +1 -1
  42. package/dist/src/stores/toaster.d.ts +1 -1
  43. package/dist/src/stores/unsubscribe.d.ts +1 -1
  44. package/dist/src/stores/version-history.d.ts +1 -1
  45. package/dist/src/utils/genericUtil.d.ts +0 -1
  46. package/dist/static/styles/components/narrow-panel.css.js +0 -10
  47. package/dist/stores/config.js +5 -5
  48. package/dist/stores/dynamic-content.js +2 -2
  49. package/dist/stores/editor.js +1 -1
  50. package/dist/stores/onboarding.js +27 -27
  51. package/dist/stores/preview.js +1 -1
  52. package/dist/stores/recommendation.js +3 -3
  53. package/dist/stores/save-as-template.js +2 -2
  54. package/dist/stores/toaster.js +1 -1
  55. package/dist/stores/unsubscribe.js +1 -1
  56. package/dist/stores/version-history.js +4 -4
  57. package/dist/utils/genericUtil.js +9 -20
  58. package/package.json +2 -2
  59. package/dist/composables/useBlocksConfig.js +0 -49
  60. package/dist/src/composables/useBlocksConfig.d.ts +0 -11
  61. package/dist/src/utils/environmentUtil.d.ts +0 -5
  62. package/dist/utils/environmentUtil.js +0 -4
@@ -1,26 +1,29 @@
1
- import { useActionsApi as h } from "./useActionsApi.js";
2
- import { useBlocksConfig as b } from "./useBlocksConfig.js";
3
- import { useConfig as k } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as V } from "./useStripoEventHandler.js";
6
- import { useToaster as _ } from "./useToaster.js";
7
- import { displayConditions as F } from "../enums/displayConditions.js";
8
- import { useStripoApi as A } from "../services/stripoApi.js";
9
- import T from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as v } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as I } from "../utils/genericUtil.js";
12
- import M from "../package.json.js";
13
- const N = (d) => {
14
- const { config: u } = k(), { handleError: l } = _(), { getToken: f, getCustomFonts: S } = A(), { handleEvent: C } = V(), { getStripoBlocksConfig: y } = b(), E = async (i, r = []) => {
15
- var m, g;
16
- const t = v(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: e, extensions: c } = await y();
1
+ import { useActionsApi as f } from "./useActionsApi.js";
2
+ import { useCustomInterfaceAppearance as E } from "./useCustomInterfaceAppearance.js";
3
+ import { useStripoEventHandler as S } from "./useStripoEventHandler.js";
4
+ import { useToaster as C } from "./useToaster.js";
5
+ import { displayConditions as y } from "../enums/displayConditions.js";
6
+ import h from "../extensions/Blocks/Checkbox/extension.js";
7
+ import w from "../extensions/Blocks/CouponBlock/extension.js";
8
+ import b from "../extensions/Blocks/RadioButton/extension.js";
9
+ import V from "../extensions/Blocks/Recommendation/extension.js";
10
+ import _ from "../extensions/Blocks/Unsubscribe/extension.js";
11
+ import k from "../extensions/DynamicContent/extension.js";
12
+ import { useStripoApi as B } from "../services/stripoApi.js";
13
+ import x from "../static/styles/customEditorStyle.css.js";
14
+ import { useEditorStore as F } from "../stores/editor.js";
15
+ import { dynamicContentToMergeTags as A } from "../utils/genericUtil.js";
16
+ import T from "../package.json.js";
17
+ const G = (a) => {
18
+ const { handleError: d } = C(), { getToken: u, getCustomFonts: m } = B(), { handleEvent: p } = S(), l = (r, i = []) => {
19
+ const t = F(), { html: n, css: c, forceRecreate: s } = r;
17
20
  window.UIEditor.initEditor(
18
21
  document.querySelector("#guido-editor"),
19
22
  {
20
- metadata: d,
23
+ metadata: a,
21
24
  html: n,
22
- css: p,
23
- forceRecreate: a,
25
+ css: c,
26
+ forceRecreate: s,
24
27
  locale: "en",
25
28
  undoButtonSelector: "#guido__undo-button",
26
29
  redoButtonSelector: "#guido__redo-button",
@@ -30,40 +33,39 @@ const N = (d) => {
30
33
  customAppearanceMergetags: !0,
31
34
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
35
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: T,
34
- conditionsEnabled: ((m = u.features) == null ? void 0 : m.displayConditions) ?? !0,
35
- customConditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
36
- conditionCategories: F,
36
+ customViewStyles: x,
37
+ conditionsEnabled: !0,
38
+ customConditionsEnabled: !0,
39
+ conditionCategories: y,
37
40
  enableXSSSecurity: !0,
38
41
  messageSettingsEnabled: !1,
39
42
  selectBlockAfterDropFromSettingsPanel: !0,
40
- ...e ? { baseBlocks: e } : {},
41
43
  editorFonts: {
42
44
  showDefaultStandardFonts: !0,
43
45
  showDefaultNotStandardFonts: !0,
44
- customFonts: r
46
+ customFonts: i
45
47
  },
46
48
  mergeTags: [
47
49
  {
48
- entries: I(d.preselectedDynamicContentList)
50
+ entries: A(a.preselectedDynamicContentList)
49
51
  }
50
52
  ],
51
53
  async onTokenRefreshRequest(o) {
52
54
  try {
53
- const s = await f();
54
- o(s);
55
- } catch (s) {
56
- l(s, "Failed to refresh token");
55
+ const e = await u();
56
+ o(e);
57
+ } catch (e) {
58
+ d(e, "Failed to refresh token");
57
59
  }
58
60
  },
59
61
  onTemplateLoaded() {
60
62
  try {
61
- const { importCss: o } = B(), { activateCustomViewStyles: s } = h();
62
- o(), s(), d.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
63
+ const { importCss: o } = E(), { activateCustomViewStyles: e } = f();
64
+ o(), e(), a.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
63
65
  t.hasChanges = !1;
64
66
  }, 1e3);
65
67
  } catch (o) {
66
- l(o, "Failed to load custom interface appearance");
68
+ d(o, "Failed to load custom interface appearance");
67
69
  }
68
70
  },
69
71
  onCodeEditorVisibilityChanged(o) {
@@ -78,35 +80,42 @@ const N = (d) => {
78
80
  onDataChanged() {
79
81
  t.hasChanges = !0;
80
82
  },
81
- onEvent: C,
83
+ onEvent: p,
82
84
  ignoreClickOutsideSelectors: [
83
85
  "#guido-dynamic-content-modal",
84
86
  ".in-on-board-wrapper",
85
87
  ".in-drawer__container"
86
88
  ],
87
- extensions: c
89
+ extensions: [
90
+ k,
91
+ h,
92
+ b,
93
+ V,
94
+ _,
95
+ w
96
+ ]
88
97
  }
89
98
  );
90
- }, w = (i) => new Promise((r, t) => {
91
- var c;
99
+ }, g = (r) => new Promise((i, t) => {
100
+ var e;
92
101
  if (document.getElementById("UiEditorScript")) {
93
- i(), r();
102
+ r(), i();
94
103
  return;
95
104
  }
96
- const n = M.guido, a = `https://email-static.useinsider.com/guido/${(c = n == null ? void 0 : n.stripo) == null ? void 0 : c.version}/UIEditor.js`, e = document.createElement("script");
97
- e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
98
- i(), r();
99
- }, e.onerror = () => {
100
- t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
101
- }, document.body.appendChild(e);
105
+ const n = T.guido, s = `https://email-static.useinsider.com/guido/${(e = n == null ? void 0 : n.stripo) == null ? void 0 : e.version}/UIEditor.js`, o = document.createElement("script");
106
+ o.id = "UiEditorScript", o.type = "module", o.src = s, o.onload = () => {
107
+ r(), i();
108
+ }, o.onerror = () => {
109
+ t(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
110
+ }, document.body.appendChild(o);
102
111
  });
103
- return { initPlugin: async (i) => {
104
- await w(async () => {
105
- const r = await S();
106
- await E(i, r);
112
+ return { initPlugin: async (r) => {
113
+ await g(async () => {
114
+ const i = await m();
115
+ l(r, i);
107
116
  });
108
117
  } };
109
118
  };
110
119
  export {
111
- N as useStripo
120
+ G as useStripo
112
121
  };
@@ -1,41 +1,36 @@
1
- import { usePartner as N } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as l, LINK_TYPES as g, INSIDER_ID as f, URLS as S } from "../../enums/unsubscribe.js";
3
- import { parsePageList as U } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
- import { useConfigStore as B } from "../../stores/config.js";
5
- import { useDynamicContentStore as y } from "../../stores/dynamic-content.js";
6
- import { useUnsubscribeStore as L } from "../../stores/unsubscribe.js";
7
- const D = [
1
+ import { usePartner as U } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as l, LINK_TYPES as b, URLS as f } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as B } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as N } from "../../stores/config.js";
5
+ import { useUnsubscribeStore as I } from "../../stores/unsubscribe.js";
6
+ const T = [
8
7
  {
9
8
  id: "add-unsubscribe-link-values",
10
9
  description: "Adding unsubscribe link values",
11
10
  type: "custom",
12
11
  processor: (t) => {
13
- const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.getVariationId;
14
- if (!a)
12
+ const { getPartnerName: i } = U(), a = N(), n = I(), u = a.getVariationId;
13
+ if (!u)
15
14
  return t;
16
- let e = t;
17
- const r = `/${i()}/email/${a}?user={{iid}}`;
18
- return new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
19
- var b;
20
- const m = p.getAttribute("data-unsubscribe-page-list");
21
- if (!m)
15
+ let o = t;
16
+ const e = `/${i()}/email/${u}?user={{iid}}`;
17
+ return new DOMParser().parseFromString(o, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
18
+ var g;
19
+ const d = p.getAttribute("data-unsubscribe-page-list");
20
+ if (!d)
22
21
  return;
23
- const R = U(m), d = ((b = u.templates) == null ? void 0 : b.filter(
24
- (o) => R.includes(o.id)
25
- )) ?? [], _ = d.some((o) => o.type === g.UNSUBSCRIBE_LINK_TYPE), I = d.some((o) => o.type === g.PREFERENCES_LINK_TYPE), E = p.outerHTML;
22
+ const S = B(d), m = ((g = n.templates) == null ? void 0 : g.filter(
23
+ (c) => S.includes(c.id)
24
+ )) ?? [], R = m.some((c) => c.type === b.UNSUBSCRIBE_LINK_TYPE), _ = m.some((c) => c.type === b.PREFERENCES_LINK_TYPE), E = p.outerHTML;
26
25
  let s = E;
27
- _ && (n.selectedDynamicContentList.push({
28
- text: f,
29
- value: f,
30
- fallback: ""
31
- }), s = s.replace(
26
+ R && (s = s.replace(
32
27
  l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
33
- S.UNSUBSCRIBE_URL + r
34
- )), I && (s = s.replace(
28
+ f.UNSUBSCRIBE_URL + e
29
+ )), _ && (s = s.replace(
35
30
  l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
36
- S.PREFERENCES_URL + r
37
- )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), e = e.replace(E, s);
38
- }), e;
31
+ f.PREFERENCES_URL + e
32
+ )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), o = o.replace(E, s);
33
+ }), o;
39
34
  },
40
35
  priority: 60
41
36
  },
@@ -61,16 +56,16 @@ const D = [
61
56
  type: "custom",
62
57
  processor: (t) => {
63
58
  let i = t;
64
- const c = i.match(/<a[^>]+>(.*?)<\/a>/gm);
65
- return c && c.forEach((n) => {
59
+ const a = i.match(/<a[^>]+>(.*?)<\/a>/gm);
60
+ return a && a.forEach((n) => {
66
61
  if (n.includes("insEmail=1"))
67
62
  return;
68
63
  if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
69
- const a = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
64
+ const o = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
70
65
  const r = e.slice(6, e.length - 1).trim();
71
66
  return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
72
67
  });
73
- i = i.replace(n, a);
68
+ i = i.replace(n, o);
74
69
  }
75
70
  }), i;
76
71
  },
@@ -78,5 +73,5 @@ const D = [
78
73
  }
79
74
  ];
80
75
  export {
81
- D as unsubscribeCompilerRules
76
+ T as unsubscribeCompilerRules
82
77
  };
@@ -11,7 +11,7 @@ class T {
11
11
  try {
12
12
  const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
13
13
  return i.length === 0 ? t : (i.forEach((s) => {
14
- const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), g = this.buildTextBlock(l), d = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", g).replace("{-{-DESCRIPTION-}-}", d).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n).replace(/{BLOCK_ID}/g, o || ""), y = this.parser.parseFromString(
14
+ const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n), y = this.parser.parseFromString(
15
15
  `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
16
16
  "text/html"
17
17
  ).querySelector(".radio-button-v2");
@@ -43,13 +43,13 @@ class T {
43
43
  styles: "",
44
44
  classList: ""
45
45
  };
46
- const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g), m = i.getAttribute("class") || "";
46
+ const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
47
47
  return {
48
48
  text: o,
49
49
  isBold: p,
50
50
  isItalic: u,
51
51
  align: a,
52
- styles: d,
52
+ styles: g,
53
53
  classList: m
54
54
  };
55
55
  }
@@ -78,9 +78,9 @@ class T {
78
78
  return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
79
79
  }
80
80
  }
81
- function I(r) {
81
+ function A(r) {
82
82
  return new T().migrate(r);
83
83
  }
84
84
  export {
85
- I as migrateRadioButton
85
+ A as migrateRadioButton
86
86
  };
@@ -1,4 +1,4 @@
1
- const e = {
1
+ const a = {
2
2
  translationsPath: "window.trans.en",
3
3
  migrationDate: 1759696858,
4
4
  emailHeader: {
@@ -8,25 +8,18 @@ const e = {
8
8
  extensions: {
9
9
  unsubscribe: !0
10
10
  },
11
- blocks: {
12
- excludeDefaults: [],
13
- includeCustoms: []
14
- },
15
11
  features: {
16
12
  dynamicContent: !0,
17
13
  saveAsTemplate: !0,
18
- versionHistory: !0,
19
- testMessage: !0,
20
- displayConditions: !0
14
+ versionHistory: !0
21
15
  },
22
16
  useHeader: !0
23
17
  }, t = {
24
18
  promotional: 1,
25
19
  transactional: 2
26
- }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = {
20
+ }, e = "email", o = "Guido User", n = t.promotional, i = 2, s = {
27
21
  email: 60,
28
- architect: 49,
29
- unsubscribePages: 97
22
+ architect: 49
30
23
  }, u = [
31
24
  "alfredtesting",
32
25
  "electio",
@@ -60,12 +53,12 @@ const e = {
60
53
  "stripoeditorlivetest"
61
54
  ];
62
55
  export {
63
- e as DefaultGuidoConfig,
64
- s as DefaultMessageType,
65
- a as DefaultProductType,
56
+ a as DefaultGuidoConfig,
57
+ n as DefaultMessageType,
58
+ e as DefaultProductType,
66
59
  o as DefaultUsername,
67
- n as EditorType,
68
- i as ProductIds,
60
+ i as EditorType,
61
+ s as ProductIds,
69
62
  u as TEST_PARTNER_LIST,
70
63
  t as TemplateTypes
71
64
  };
@@ -1,26 +1,25 @@
1
- import { useTranslations as n } from "../composables/useTranslations.js";
2
- import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const e = n(), I = {
1
+ import { useTranslations as e } from "../composables/useTranslations.js";
2
+ const s = e(), R = {
4
3
  UNSUBSCRIBE_LINK_TYPE: 1,
5
4
  PREFERENCES_LINK_TYPE: 3
6
- }, r = {
5
+ }, S = {
7
6
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
7
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
8
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
9
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), _ = {
12
- UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
- PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, i = "iid", B = {
10
+ }, N = {
11
+ UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
12
+ PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
13
+ }, _ = {
15
14
  name: "Global Unsubscribe",
16
15
  sendGridId: "G"
17
- }, C = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", c = "/email/unsubscribe-pages", E = {
16
+ }, I = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
18
17
  GLOBAL_UNSUBSCRIBE: 1,
19
18
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
20
19
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
20
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
21
  RESUBSCRIBE: 5
23
- }, t = {
22
+ }, i = {
24
23
  [E.GLOBAL_UNSUBSCRIBE]: [
25
24
  E.GLOBAL_UNSUBSCRIBE,
26
25
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -30,27 +29,26 @@ const e = n(), I = {
30
29
  E.SUBSCRIPTION_PREFERENCE_CENTER,
31
30
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
31
  ]
33
- }, U = {
34
- [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
35
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
36
- [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
37
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
38
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
39
- }, o = {
32
+ }, B = {
33
+ [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
34
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
35
+ [E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
36
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
37
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
38
+ }, C = {
40
39
  default: "{{ins-unsubscribe-link}}",
41
40
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
42
41
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
43
42
  };
44
43
  export {
45
- C as ACADEMY_LINK,
46
- B as DEFAULT_UNSUBSCRIBE_GROUP,
47
- i as INSIDER_ID,
48
- r as LINK_REGEXES,
49
- I as LINK_TYPES,
50
- o as MERGE_TAGS,
44
+ I as ACADEMY_LINK,
45
+ _ as DEFAULT_UNSUBSCRIBE_GROUP,
46
+ S as LINK_REGEXES,
47
+ R as LINK_TYPES,
48
+ C as MERGE_TAGS,
51
49
  E as PAGE_TYPES,
52
- t as TYPE_COLLECTIONS,
53
- U as TYPE_TRANSLATIONS,
54
- c as UNSUBSCRIBE_PAGES_LINK,
55
- _ as URLS
50
+ i as TYPE_COLLECTIONS,
51
+ B as TYPE_TRANSLATIONS,
52
+ r as UNSUBSCRIBE_PAGES_LINK,
53
+ N as URLS
56
54
  };
@@ -2,9 +2,9 @@ var d = Object.defineProperty;
2
2
  var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
3
3
  var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { useHttp as L } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as u } from "../../../enums/unsubscribe.js";
6
6
  import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-checkbox", u = "select", { get: C } = L();
7
+ const m = "ui-elements-checkbox", a = "select", { get: C } = L();
8
8
  class S extends h {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -16,15 +16,14 @@ class S extends h {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
19
+ if (this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === c.sendGridId ? e : Number(e);
23
- s && (this.selectedUnsubGroup = s);
22
+ const s = e === u.sendGridId ? e : Number(e);
23
+ s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
+ [a]: this.selectedUnsubGroup
25
+ }));
24
26
  }
25
- this.api.updateValues({
26
- [u]: this.selectedUnsubGroup
27
- });
28
27
  }
29
28
  }
30
29
  _getLabel(e, s = `${Math.random()}`) {
@@ -55,7 +54,7 @@ class S extends h {
55
54
  </${i.LABEL}>
56
55
 
57
56
  <${i.SELECTPICKER}
58
- ${t.SELECTPICKER.name}="${u}"
57
+ ${t.SELECTPICKER.name}="${a}"
59
58
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
60
59
  ${this._getSelect()}
61
60
  </${i.SELECTPICKER}>
@@ -67,21 +66,21 @@ class S extends h {
67
66
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
68
67
  }
69
68
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (e) => this._onSelectChange(e));
69
+ this.api.onValueChanged(a, (e) => this._onSelectChange(e));
71
70
  }
72
71
  onTemplateNodeUpdated(e) {
73
- this.currentNode = e, this._setFormValues();
72
+ this.currentNode = e;
74
73
  }
75
74
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
75
  async onRender() {
77
76
  const e = await C(
78
77
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...e.data], E = s.map((a) => ({
80
- [t.SELECT_ITEM.text]: a.name,
81
- [t.SELECT_ITEM.value]: a.sendGridId
78
+ ), s = [u, ...e.data], E = s.map((c) => ({
79
+ [t.SELECT_ITEM.text]: c.name,
80
+ [t.SELECT_ITEM.value]: c.sendGridId
82
81
  }));
83
82
  this.unsubList = s, this.api.setUIEAttribute(
84
- u,
83
+ a,
85
84
  t.SELECTPICKER.items,
86
85
  E
87
86
  ), this._setFormValues(), this._listenToFormUpdates();
@@ -3,7 +3,7 @@ import { CheckboxBlock as t } from "./block.js";
3
3
  import { CheckboxControl as e } from "./control.js";
4
4
  import { CheckboxIconsRegistry as r } from "./iconsRegistry.js";
5
5
  import { CheckboxBlockSettings as i } from "./settingsPanel.js";
6
- const d = new o().addBlock(t).withSettingsPanelRegistry(i).addControl(e).withIconsRegistry(r).build();
6
+ const k = new o().addBlock(t).withSettingsPanelRegistry(i).addControl(e).withIconsRegistry(r).build();
7
7
  export {
8
- d as default
8
+ k as default
9
9
  };
@@ -2,7 +2,7 @@ import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-edito
2
2
  import { CouponBlock as t } from "./block.js";
3
3
  import { CouponIconsRegistry as i } from "./iconsRegistry.js";
4
4
  import { CouponBlockSettings as n } from "./settingsPanel.js";
5
- const p = new o().addBlock(t).withSettingsPanelRegistry(n).withIconsRegistry(i).build();
5
+ const m = new o().addBlock(t).withSettingsPanelRegistry(n).withIconsRegistry(i).build();
6
6
  export {
7
- p as default
7
+ m as default
8
8
  };
@@ -2,10 +2,10 @@ var d = Object.defineProperty;
2
2
  var l = (r, n, t) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
3
  var o = (r, n, t) => l(r, typeof n != "symbol" ? n + "" : n, t);
4
4
  import { useHttp as L } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as E } from "../../../enums/unsubscribe.js";
6
6
  import { Control as p, UIElementType as i, UEAttr as e, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-radio-button", u = "select", { get: $ } = L();
8
- class S extends p {
7
+ const m = "ui-elements-radio-button", a = "select", { get: $ } = L();
8
+ class _ extends p {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  o(this, "currentNode");
@@ -16,16 +16,15 @@ class S extends p {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
19
+ if (this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const t = this.currentNode.getAttribute("id");
21
21
  if (t) {
22
- const s = t === c.sendGridId ? t : Number(t);
23
- s && (this.selectedUnsubGroup = s);
22
+ const s = t === E.sendGridId ? t : Number(t);
23
+ s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
+ [a]: this.selectedUnsubGroup
25
+ }));
24
26
  }
25
27
  }
26
- this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
28
- });
29
28
  }
30
29
  _getLabel(t, s = `${Math.random()}`) {
31
30
  return `
@@ -55,7 +54,7 @@ class S extends p {
55
54
  </${i.LABEL}>
56
55
 
57
56
  <${i.SELECTPICKER}
58
- ${e.SELECTPICKER.name}="${u}"
57
+ ${e.SELECTPICKER.name}="${a}"
59
58
  ${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
60
59
  ${this._getSelect()}
61
60
  </${i.SELECTPICKER}>
@@ -67,27 +66,27 @@ class S extends p {
67
66
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
68
67
  }
69
68
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (t) => this._onSelectChange(t));
69
+ this.api.onValueChanged(a, (t) => this._onSelectChange(t));
71
70
  }
72
71
  onTemplateNodeUpdated(t) {
73
- this.currentNode = t, this._setFormValues();
72
+ this.currentNode = t;
74
73
  }
75
74
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
75
  async onRender() {
77
76
  const t = await $(
78
77
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...t.data], E = s.map((a) => ({
80
- [e.SELECT_ITEM.text]: a.name,
81
- [e.SELECT_ITEM.value]: a.sendGridId
78
+ ), s = [E, ...t.data], c = s.map((u) => ({
79
+ [e.SELECT_ITEM.text]: u.name,
80
+ [e.SELECT_ITEM.value]: u.sendGridId
82
81
  }));
83
82
  this.unsubList = s, this.api.setUIEAttribute(
84
- u,
83
+ a,
85
84
  e.SELECTPICKER.items,
86
- E
85
+ c
87
86
  ), this._setFormValues(), this._listenToFormUpdates();
88
87
  }
89
88
  }
90
89
  export {
91
90
  m as CONTROL_BLOCK_ID,
92
- S as RadioButtonControl
91
+ _ as RadioButtonControl
93
92
  };
@@ -32,7 +32,7 @@ const e = {
32
32
  <input
33
33
  type="radio"
34
34
  id="radioYes"
35
- name="unsubscribe-{BLOCK_ID}"
35
+ name="unsubscribe"
36
36
  data-cke-editable="1"
37
37
  style="margin: 0px; vertical-align: middle;">
38
38
  </td>
@@ -53,7 +53,7 @@ const e = {
53
53
  <input
54
54
  type="radio"
55
55
  id="radioNo"
56
- name="unsubscribe-{BLOCK_ID}"
56
+ name="unsubscribe"
57
57
  data-cke-editable="1"
58
58
  style="margin: 0px; vertical-align: middle;">
59
59
  </td>
@@ -108,7 +108,7 @@ const e = {
108
108
  <input
109
109
  type="radio"
110
110
  id="radioYes"
111
- name="unsubscribe-{BLOCK_ID}"
111
+ name="unsubscribe"
112
112
  data-cke-editable="1"
113
113
  style="margin: 0px; vertical-align: middle;>
114
114
  </td>
@@ -123,7 +123,7 @@ const e = {
123
123
  <input
124
124
  type="radio"
125
125
  id="radioNo"
126
- name="unsubscribe-{BLOCK_ID}"
126
+ name="unsubscribe"
127
127
  data-cke-editable="1"
128
128
  style="margin: 0px; vertical-align: middle;">
129
129
  </td>