@useinsider/guido 3.10.0-beta.54ff6d3 → 3.10.0-beta.9a9d2fc

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 (29) hide show
  1. package/dist/composables/useCortexBlueprintBridge.js +7 -7
  2. package/dist/composables/useCustomInterfaceAppearance.js +16 -18
  3. package/dist/composables/useEmailTemplateApplier.js +9 -9
  4. package/dist/composables/useExport.js +18 -18
  5. package/dist/composables/useHtmlValidator.js +90 -90
  6. package/dist/composables/useStripo.js +43 -40
  7. package/dist/composables/useStripoNotifications.js +26 -0
  8. package/dist/composables/useToaster.js +11 -11
  9. package/dist/composables/useVersionHistoryApi.js +2 -2
  10. package/dist/composables/validators/useLiquidValidator.js +1 -1
  11. package/dist/composables/validators/useUnsubscribeBlockValidator.js +10 -10
  12. package/dist/config/i18n/en/labels.json.js +4 -1
  13. package/dist/enums/toaster.js +2 -2
  14. package/dist/enums/unsubscribe.js +41 -36
  15. package/dist/extensions/Blocks/Checkbox/block.js +5 -3
  16. package/dist/extensions/Blocks/Checkbox/control.js +42 -28
  17. package/dist/extensions/Blocks/RadioButton/block.js +9 -7
  18. package/dist/extensions/Blocks/RadioButton/control.js +64 -50
  19. package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
  20. package/dist/services/blankTemplate.js +1 -1
  21. package/dist/services/templateLibraryApi.js +8 -7
  22. package/dist/src/composables/useStripoNotifications.d.ts +10 -0
  23. package/dist/src/enums/toaster.d.ts +2 -2
  24. package/dist/src/enums/unsubscribe.d.ts +2 -0
  25. package/dist/src/stores/toaster.d.ts +2 -3
  26. package/dist/static/styles/components/dropdown-menu.css.js +12 -0
  27. package/dist/stores/toaster.js +10 -10
  28. package/package.json +2 -2
  29. package/dist/static/styles/components/notification.css.js +0 -74
@@ -1,29 +1,30 @@
1
- import { useActionsApi as I } from "./useActionsApi.js";
2
- import { useBlocksConfig as U } from "./useBlocksConfig.js";
3
- import { useConfig as R } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as x } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as O } from "./useFullStoryBridge.js";
6
- import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
7
- import { useToaster as H } from "./useToaster.js";
8
- import { localePatch as z } from "../config/i18n/index.js";
1
+ import { useActionsApi as U } from "./useActionsApi.js";
2
+ import { useBlocksConfig as R } from "./useBlocksConfig.js";
3
+ import { useConfig as x } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as O } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as q } from "./useFullStoryBridge.js";
6
+ import { useStripoEventHandler as H } from "./useStripoEventHandler.js";
7
+ import { useStripoNotifications as N } from "./useStripoNotifications.js";
8
+ import { useToaster as z } from "./useToaster.js";
9
+ import { localePatch as L } from "../config/i18n/index.js";
9
10
  import { en as h } from "../config/i18n/en/index.js";
10
- import { ToasterTypeOptions as L } from "../enums/toaster.js";
11
- import { useStripoApi as $ } from "../services/stripoApi.js";
12
- import G from "../static/styles/customEditorStyle.css.js";
13
- import { useEditorStore as C } from "../stores/editor.js";
14
- import { dynamicContentToMergeTags as J } from "../utils/genericUtil.js";
15
- import N from "../package.json.js";
16
- const ce = (E, l) => {
17
- const { features: c, template: w, isFeatureEnabled: u } = R(), { handleError: m, showToaster: b } = H(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = $(), { handleEvent: F } = q(), { getStripoBlocksConfig: v } = U(), V = async (s, r = [], i = !1) => {
11
+ import { ToasterTypeOptions as $ } from "../enums/toaster.js";
12
+ import { useStripoApi as G } from "../services/stripoApi.js";
13
+ import J from "../static/styles/customEditorStyle.css.js";
14
+ import { useEditorStore as E } from "../stores/editor.js";
15
+ import { dynamicContentToMergeTags as X } from "../utils/genericUtil.js";
16
+ import j from "../package.json.js";
17
+ const pe = (C, l) => {
18
+ const { features: c, template: w, isFeatureEnabled: u } = x(), { handleError: m, showToaster: b } = z(), { getToken: k, getCustomFonts: T, getSyncModulesStatus: B } = G(), { handleEvent: F } = H(), { getStripoBlocksConfig: v } = R(), { getStripoNotifications: V } = N(), _ = async (s, i = [], r = !1) => {
18
19
  var g, S, y;
19
- const e = C(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, A = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, M = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
20
+ const e = E(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, A = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, P = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
20
21
  await window.UIEditor.initEditor(
21
22
  document.querySelector("#guido-editor"),
22
23
  {
23
- metadata: E,
24
+ metadata: C,
24
25
  html: p,
25
26
  css: a,
26
- forceRecreate: M,
27
+ forceRecreate: P,
27
28
  locale: "en",
28
29
  undoButtonSelector: "#guido__undo-button",
29
30
  redoButtonSelector: "#guido__redo-button",
@@ -33,15 +34,16 @@ const ce = (E, l) => {
33
34
  customAppearanceMergetags: !u("liquidSyntax"),
34
35
  customAppearanceMergetagsBorderColor: "#f1f3fe",
35
36
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
36
- customViewStyles: G,
37
+ customViewStyles: J,
37
38
  conditionsEnabled: f,
38
39
  customConditionsEnabled: f,
39
40
  enableXSSSecurity: !0,
40
41
  modulesDisabled: A,
41
- syncModulesEnabled: i,
42
+ syncModulesEnabled: r,
42
43
  messageSettingsEnabled: !0,
43
44
  displayGmailAnnotations: !0,
44
45
  displayHiddenPreheader: !1,
46
+ keepModuleStylesEnabled: !0,
45
47
  displayTitle: !1,
46
48
  displayUTM: !1,
47
49
  selectElementAfterDrop: !0,
@@ -51,11 +53,11 @@ const ce = (E, l) => {
51
53
  editorFonts: {
52
54
  showDefaultStandardFonts: !0,
53
55
  showDefaultNotStandardFonts: !0,
54
- customFonts: r
56
+ customFonts: i
55
57
  },
56
58
  mergeTags: [
57
59
  {
58
- entries: J(
60
+ entries: X(
59
61
  l.preselectedDynamicContentList,
60
62
  u("liquidSyntax")
61
63
  )
@@ -63,7 +65,7 @@ const ce = (E, l) => {
63
65
  ],
64
66
  async onTokenRefreshRequest(o) {
65
67
  try {
66
- const n = await T();
68
+ const n = await k();
67
69
  o(n);
68
70
  } catch (n) {
69
71
  m(n, "Failed to refresh token");
@@ -71,8 +73,8 @@ const ce = (E, l) => {
71
73
  },
72
74
  onTemplateLoaded() {
73
75
  try {
74
- const { importCss: o } = x(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: P } = I(), { injectFullStory: D } = O();
75
- o(), n(), D(), P(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
76
+ const { importCss: o } = O(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = U(), { injectFullStory: I } = q();
77
+ o(), n(), I(), D(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
76
78
  e.hasChanges = !1;
77
79
  }, 1e3);
78
80
  } catch (o) {
@@ -92,41 +94,42 @@ const ce = (E, l) => {
92
94
  e.hasChanges = !0;
93
95
  },
94
96
  onEvent: F,
97
+ notifications: V(),
95
98
  ignoreClickOutsideSelectors: [
96
99
  "#guido-dynamic-content-modal",
97
100
  ".in-on-board-wrapper",
98
101
  ".in-drawer__container"
99
102
  ],
100
103
  extensions: d,
101
- localePatch: z
104
+ localePatch: L
102
105
  }
103
106
  );
104
- }, _ = (s) => new Promise((r, i) => {
107
+ }, M = (s) => new Promise((i, r) => {
105
108
  var d;
106
109
  if (document.getElementById("UiEditorScript")) {
107
- Promise.resolve(s()).then(r, i);
110
+ Promise.resolve(s()).then(i, r);
108
111
  return;
109
112
  }
110
- const e = N.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
113
+ const e = j.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
111
114
  t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
112
- Promise.resolve(s()).then(r, i);
115
+ Promise.resolve(s()).then(i, r);
113
116
  }, t.onerror = () => {
114
- i(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
117
+ r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
115
118
  }, document.body.appendChild(t);
116
119
  });
117
120
  return { initPlugin: async (s) => {
118
- const r = C();
121
+ const i = E();
119
122
  try {
120
- await _(async () => {
121
- const [i, e] = await Promise.all([
122
- k(),
123
+ await M(async () => {
124
+ const [r, e] = await Promise.all([
125
+ T(),
123
126
  B()
124
127
  ]);
125
- r.syncModulesEnabled = e, await V(s, i, e);
128
+ i.syncModulesEnabled = e, await _(s, r, e);
126
129
  });
127
130
  } catch {
128
- r.loadingStatus = !1, b({
129
- type: L.Alert,
131
+ i.loadingStatus = !1, b({
132
+ type: $.Error,
130
133
  message: h["An error has occurred. Please report the error code to support."],
131
134
  actionButton: {
132
135
  text: h["Reload page"],
@@ -137,5 +140,5 @@ const ce = (E, l) => {
137
140
  } };
138
141
  };
139
142
  export {
140
- ce as useStripo
143
+ pe as useStripo
141
144
  };
@@ -0,0 +1,26 @@
1
+ import { useToaster as d } from "./useToaster.js";
2
+ import { ToasterTypeOptions as c } from "../enums/toaster.js";
3
+ const g = () => {
4
+ const { showToaster: s, hideToaster: u } = d();
5
+ let r = null;
6
+ const n = (o, t, i, e, f = !0) => {
7
+ r = i;
8
+ const l = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
9
+ s({ type: o, message: t, actionButton: l, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
10
+ };
11
+ return { getStripoNotifications: () => ({
12
+ info: (o, t, i) => n(c.Info, o, t, i),
13
+ success: (o, t, i) => n(c.Success, o, t, i),
14
+ warn: (o, t, i) => n(c.Warning, o, t, i),
15
+ error: (o, t, i) => n(c.Error, o, t, i),
16
+ // A loader marks an in-progress operation; Stripo dismisses it via hide(id)
17
+ // when finished, so it must not auto-hide.
18
+ loader: (o, t, i) => n(c.Info, o, t, i, !1),
19
+ hide: (o) => {
20
+ r === o && (u(), r = null);
21
+ }
22
+ }) };
23
+ };
24
+ export {
25
+ g as useStripoNotifications
26
+ };
@@ -1,29 +1,29 @@
1
1
  import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
2
  import { useToasterStore as c } from "../stores/toaster.js";
3
- import { watch as u, nextTick as l } from "vue";
3
+ import { watch as u, nextTick as f } from "vue";
4
4
  const p = () => {
5
- const t = c();
6
- let o = null;
5
+ const o = c();
6
+ let t = null;
7
7
  const s = () => {
8
- o && (clearTimeout(o), o = null);
8
+ t && (clearTimeout(t), t = null);
9
9
  };
10
10
  function r(e = { message: "" }) {
11
- s(), t.hideToaster(), l(() => {
12
- t.showToaster(e);
11
+ s(), o.hideToaster(), f(() => {
12
+ o.showToaster(e);
13
13
  });
14
14
  }
15
15
  function i() {
16
- s(), t.hideToaster();
16
+ s(), o.hideToaster();
17
17
  }
18
18
  function n(e, a) {
19
19
  const m = e instanceof Error ? e.message : String(e);
20
- r({ type: T.Alert, message: `${a}: ${m}` });
20
+ r({ type: T.Error, message: `${a}: ${m}` });
21
21
  }
22
22
  return u(
23
- () => t.shouldAutoHide,
23
+ () => o.shouldAutoHide,
24
24
  (e) => {
25
- s(), e && (o = setTimeout(() => {
26
- t.hideToaster(), s();
25
+ s(), e && (t = setTimeout(() => {
26
+ o.hideToaster(), s();
27
27
  }, 6e3));
28
28
  }
29
29
  ), { showToaster: r, hideToaster: i, handleError: n };
@@ -24,7 +24,7 @@ const S = () => {
24
24
  window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
25
25
  const r = o instanceof Error ? o.message : String(o);
26
26
  s({
27
- type: t.Alert,
27
+ type: t.Error,
28
28
  message: `Error compiling email: ${r}`
29
29
  });
30
30
  });
@@ -41,7 +41,7 @@ const S = () => {
41
41
  (o) => {
42
42
  const r = o instanceof Error ? o.message : String(o);
43
43
  s({
44
- type: t.Alert,
44
+ type: t.Error,
45
45
  message: `Error compiling email: ${r}`
46
46
  });
47
47
  }
@@ -31,7 +31,7 @@ const v = () => {
31
31
  }), !1) : !0;
32
32
  } catch {
33
33
  return e({
34
- type: a.Alert,
34
+ type: a.Error,
35
35
  message: s("journey-builder.liquid-validation-failed")
36
36
  }), !1;
37
37
  }
@@ -1,8 +1,8 @@
1
1
  import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
2
  import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
3
  import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as m } from "../useToaster.js";
5
- import { useTranslations as E } from "../useTranslations.js";
4
+ import { useToaster as E } from "../useToaster.js";
5
+ import { useTranslations as m } from "../useTranslations.js";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -13,23 +13,23 @@ const T = [
13
13
  messageKey: "unsubscription-preference.duplicate-pref-center"
14
14
  }
15
15
  ], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
- const { showToaster: c } = m(), p = E();
16
+ const { showToaster: c } = E(), p = m();
17
17
  return { validateUnsubscribeBlockUniqueness: (n) => {
18
- const o = new DOMParser().parseFromString(n, "text/html"), s = /* @__PURE__ */ new Map();
18
+ const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
19
19
  o.querySelectorAll(l).forEach((e) => {
20
- const r = Number(e.getAttribute(a.PAGE_TYPE));
21
- s.set(r, (s.get(r) ?? 0) + 1);
20
+ const s = Number(e.getAttribute(a.PAGE_TYPE));
21
+ r.set(s, (r.get(s) ?? 0) + 1);
22
22
  });
23
- const t = T.filter((e) => (s.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
23
+ const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
24
  return t.length ? (c({
25
- type: i.Alert,
25
+ type: i.Error,
26
26
  message: p(t.length > 1 ? g : t[0])
27
27
  }), !1) : !0;
28
28
  }, validateUnsubscribeBlockHasTemplate: (n) => {
29
29
  const o = new DOMParser().parseFromString(n, "text/html");
30
30
  return Array.from(o.querySelectorAll(l)).some((t) => {
31
- const e = t.getAttribute(a.PAGE_TYPE), r = t.getAttribute(a.PAGE_LIST);
32
- return !e || !r;
31
+ const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
32
+ return !e || !s;
33
33
  }) ? (c({
34
34
  type: i.Warning,
35
35
  message: p(b)
@@ -4,7 +4,10 @@ const e = "Items", o = {
4
4
  "Recommendation Block": "Recommendation",
5
5
  Items: e,
6
6
  "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
- "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly."
7
+ "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
+ "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
+ "OPT-IN SELECTION": "OPT-IN SELECTION",
10
+ "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
8
11
  };
9
12
  export {
10
13
  e as Items,
@@ -1,4 +1,4 @@
1
- var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r.Dark = "dark", r))(c || {});
1
+ var n = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Error = "error", r.Info = "information", r))(n || {});
2
2
  export {
3
- c as ToasterTypeOptions
3
+ n as ToasterTypeOptions
4
4
  };
@@ -1,35 +1,38 @@
1
1
  import { useTranslations as R } from "../composables/useTranslations.js";
2
- import { ProductType as n } from "../@types/config/schemas.js";
2
+ import { ProductType as s } from "../@types/config/schemas.js";
3
3
  import "../@types/config/defaults.js";
4
- import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
5
- const i = {
4
+ import { getEnvironmentPrefix as _ } from "../utils/environmentUtil.js";
5
+ const B = {
6
6
  UNSUBSCRIBE_LINK_TYPE: 1,
7
7
  PREFERENCES_LINK_TYPE: 3
8
- }, B = {
8
+ }, C = {
9
9
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
10
10
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
11
11
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
12
12
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
13
- }, s = S(), C = {
14
- UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
15
- PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
16
- }, U = {
17
- [n.EMAIL]: "email",
18
- [n.ARCHITECT]: "journey",
19
- [n.UNSUBSCRIBE_PAGES]: "email"
20
- }, o = "iid", r = "G", c = () => ({
13
+ }, e = _(), U = {
14
+ UNSUBSCRIBE_URL: `https://mail.${e}.com/user/v1/unsub`,
15
+ PREFERENCES_URL: `https://mail.${e}.com/user/v1/prefs`
16
+ }, o = {
17
+ [s.EMAIL]: "email",
18
+ [s.ARCHITECT]: "journey",
19
+ [s.UNSUBSCRIBE_PAGES]: "email"
20
+ }, c = "iid", S = "G", N = "P", u = [
21
+ S,
22
+ N
23
+ ], T = () => ({
21
24
  name: R()("onboarding-center.email-subscribers-global-unsub-card-title"),
22
- sendGridId: r
23
- }), u = "/email/unsubscribe-pages", E = {
25
+ sendGridId: S
26
+ }), b = "/email/unsubscribe-pages", E = {
24
27
  GLOBAL_UNSUBSCRIBE: 1,
25
28
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
26
29
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
27
30
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
28
31
  RESUBSCRIBE: 5
29
- }, b = {
32
+ }, P = {
30
33
  [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
31
34
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
32
- }, T = {
35
+ }, L = {
33
36
  [E.GLOBAL_UNSUBSCRIBE]: [
34
37
  E.GLOBAL_UNSUBSCRIBE,
35
38
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -39,32 +42,34 @@ const i = {
39
42
  E.SUBSCRIPTION_PREFERENCE_CENTER,
40
43
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
41
44
  ]
42
- }, P = () => {
43
- const e = R();
45
+ }, O = () => {
46
+ const n = R();
44
47
  return {
45
- [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
46
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
47
- [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
48
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
49
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
48
+ [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
49
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
50
+ [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
51
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
52
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
50
53
  };
51
- }, O = {
54
+ }, p = {
52
55
  default: "{{ins-unsubscribe-link}}",
53
56
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
54
57
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
55
58
  };
56
59
  export {
57
- r as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
58
- o as INSIDER_ID,
59
- B as LINK_REGEXES,
60
- i as LINK_TYPES,
61
- O as MERGE_TAGS,
60
+ S as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
61
+ c as INSIDER_ID,
62
+ C as LINK_REGEXES,
63
+ B as LINK_TYPES,
64
+ p as MERGE_TAGS,
62
65
  E as PAGE_TYPES,
63
- U as PRODUCT_TYPE_URL_SEGMENTS,
64
- T as TYPE_COLLECTIONS,
65
- u as UNSUBSCRIBE_PAGES_LINK,
66
- b as UNSUBSCRIBE_SYNC_MODULE_TYPES,
67
- C as URLS,
68
- c as getDefaultUnsubscribeGroup,
69
- P as getTypeTranslations
66
+ N as PIXEL_TRACKING_SEND_GRID_ID,
67
+ o as PRODUCT_TYPE_URL_SEGMENTS,
68
+ L as TYPE_COLLECTIONS,
69
+ b as UNSUBSCRIBE_PAGES_LINK,
70
+ u as UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS,
71
+ P as UNSUBSCRIBE_SYNC_MODULE_TYPES,
72
+ U as URLS,
73
+ T as getDefaultUnsubscribeGroup,
74
+ O as getTypeTranslations
70
75
  };
@@ -1,7 +1,7 @@
1
1
  import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { getDefaultTemplate as o } from "./template.js";
3
3
  const r = "checkbox-block";
4
- class s extends e {
4
+ class l extends e {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -18,7 +18,9 @@ class s extends e {
18
18
  return this.api.translate("Checkbox Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate("Checkbox Block Description");
21
+ return this.api.translate(
22
+ "Checkbox lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
+ );
22
24
  }
23
25
  getTemplate() {
24
26
  return o();
@@ -29,5 +31,5 @@ class s extends e {
29
31
  }
30
32
  export {
31
33
  r as CHECKBOX_BLOCK_ID,
32
- s as CheckboxBlock
34
+ l as CheckboxBlock
33
35
  };
@@ -1,16 +1,16 @@
1
- var E = Object.defineProperty;
2
- var d = (i, n, e) => n in i ? E(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var o = (i, n, e) => d(i, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as l } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as h } from "../../../enums/unsubscribe.js";
6
- import { Control as p, UIElementType as r, UEAttr as t, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-checkbox", u = "select", { get: C } = l();
8
- class I extends p {
1
+ var p = Object.defineProperty;
2
+ var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as h } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as T, PIXEL_TRACKING_SEND_GRID_ID as C, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as I } from "../../../enums/unsubscribe.js";
6
+ import { Control as m, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-checkbox", E = "select", { get: _ } = h();
8
+ class G extends m {
9
9
  constructor() {
10
10
  super(...arguments);
11
- o(this, "currentNode");
12
- o(this, "selectedUnsubGroup");
13
- o(this, "unsubList", []);
11
+ a(this, "currentNode");
12
+ a(this, "selectedUnsubGroup");
13
+ a(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
@@ -19,12 +19,12 @@ class I extends p {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === h ? e : Number(e);
22
+ const s = I.includes(e) ? e : Number(e);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
27
+ [E]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
30
  _getLabel(e, s = `${Math.random()}`) {
@@ -46,17 +46,19 @@ class I extends p {
46
46
  return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
+ const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
49
50
  return `
50
51
  <div class="checkbox-controls-container">
51
- <div class="checkbox-select-container container two-columns stretch">
52
+ <div class="checkbox-select-container container one-column stretch">
52
53
  <${r.LABEL}
53
- ${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
54
+ ${t.LABEL.text}="${e}"
54
55
  ${t.LABEL.name}="${Math.random()}">
55
56
  </${r.LABEL}>
56
57
 
57
58
  <${r.SELECTPICKER}
58
- ${t.SELECTPICKER.name}="${u}"
59
- ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
59
+ ${t.SELECTPICKER.name}="${E}"
60
+ ${t.SELECTPICKER.searchable}="true"
61
+ ${t.SELECTPICKER.placeholder}="${s}">
60
62
  ${this._getSelect()}
61
63
  </${r.SELECTPICKER}>
62
64
  </div>
@@ -64,30 +66,42 @@ class I extends p {
64
66
  `;
65
67
  }
66
68
  _onSelectChange(e) {
67
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new m(`Updated text to ${e}`));
69
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
68
70
  }
69
71
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (e) => this._onSelectChange(e));
72
+ this.api.onValueChanged(E, (e) => this._onSelectChange(e));
71
73
  }
72
74
  onTemplateNodeUpdated(e) {
73
75
  this.currentNode = e, this._setFormValues();
74
76
  }
75
77
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
78
  async onRender() {
77
- const e = await C(
79
+ const e = await _(
78
80
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [L(), ...e.data], c = s.map((a) => ({
80
- [t.SELECT_ITEM.text]: a.name,
81
- [t.SELECT_ITEM.value]: a.sendGridId
82
- }));
83
- this.unsubList = s, this.api.setUIEAttribute(
84
- u,
81
+ ), s = {
82
+ name: this.api.translate("Pixel Tracking Opt-in"),
83
+ sendGridId: C
84
+ }, c = [T(), ...e.data], u = (o) => ({
85
+ [t.SELECT_ITEM.text]: o.name,
86
+ [t.SELECT_ITEM.value]: o.sendGridId
87
+ }), l = (o) => ({
88
+ [t.SELECT_ITEM.text]: o,
89
+ [t.SELECT_ITEM.value]: `header:${o}`,
90
+ [t.SELECT_ITEM.disabled]: !0
91
+ }), d = [
92
+ l(this.api.translate("OPT-IN SELECTION")),
93
+ u(s),
94
+ l(this.api.translate("UNSUBSCRIBE GROUPS")),
95
+ ...c.map(u)
96
+ ];
97
+ this.unsubList = [s, ...c], this.api.setUIEAttribute(
98
+ E,
85
99
  t.SELECTPICKER.items,
86
- c
100
+ d
87
101
  ), this._setFormValues(), this._listenToFormUpdates();
88
102
  }
89
103
  }
90
104
  export {
91
105
  b as CHECKBOX_CONTROL_BLOCK_ID,
92
- I as CheckboxControl
106
+ G as CheckboxControl
93
107
  };
@@ -1,7 +1,7 @@
1
- import { Block as t, BlockCompositionType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { getDefaultTemplate as e } from "./template.js";
1
+ import { Block as t, BlockCompositionType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { getDefaultTemplate as o } from "./template.js";
3
3
  const r = "radio-button-block";
4
- class l extends t {
4
+ class i extends t {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -12,16 +12,18 @@ class l extends t {
12
12
  return "radio-button-icon";
13
13
  }
14
14
  getBlockCompositionType() {
15
- return o.CONTAINER;
15
+ return e.CONTAINER;
16
16
  }
17
17
  getName() {
18
18
  return this.api.translate("Radio Button Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate("Radio Button Block Description");
21
+ return this.api.translate(
22
+ "Radio button lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
+ );
22
24
  }
23
25
  getTemplate() {
24
- return e();
26
+ return o();
25
27
  }
26
28
  allowInnerBlocksDND() {
27
29
  return !1;
@@ -29,5 +31,5 @@ class l extends t {
29
31
  }
30
32
  export {
31
33
  r as BLOCK_ID,
32
- l as RadioButtonCustomBlock
34
+ i as RadioButtonCustomBlock
33
35
  };