@useinsider/guido 1.0.3-beta.9b9f41a → 1.0.3-beta.9d0ef3f

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 (109) hide show
  1. package/README.md +3 -32
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +49 -48
  4. package/dist/composables/useActionsApi.js +33 -24
  5. package/dist/composables/useHtmlCompiler.js +15 -13
  6. package/dist/composables/useHtmlValidator.js +36 -35
  7. package/dist/composables/useStripo.js +58 -52
  8. package/dist/composables/useTimerClone.js +52 -0
  9. package/dist/config/compiler/itemsCompilerRules.js +14 -0
  10. package/dist/enums/unsubscribe.js +27 -26
  11. package/dist/extensions/Blocks/Checkbox/control.js +15 -14
  12. package/dist/extensions/Blocks/Checkbox/template.js +14 -9
  13. package/dist/extensions/Blocks/Items/block.js +26 -26
  14. package/dist/extensions/Blocks/Items/controls/cardComposition.js +151 -57
  15. package/dist/extensions/Blocks/Items/controls/name/trimming.js +2 -2
  16. package/dist/extensions/Blocks/Items/controls/settingsControl.js +149 -117
  17. package/dist/extensions/Blocks/Items/enums/productEnums.js +83 -5
  18. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -1
  19. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +57 -56
  20. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +54 -55
  21. package/dist/extensions/Blocks/Items/settingsPanel.js +56 -31
  22. package/dist/extensions/Blocks/Items/template.js +138 -59
  23. package/dist/extensions/Blocks/RadioButton/control.js +18 -17
  24. package/dist/extensions/Blocks/RadioButton/template.js +18 -9
  25. package/dist/extensions/Blocks/Unsubscribe/block.js +27 -27
  26. package/dist/guido.css +1 -1
  27. package/dist/node_modules/lodash-es/_DataView.js +6 -0
  28. package/dist/node_modules/lodash-es/_Promise.js +6 -0
  29. package/dist/node_modules/lodash-es/_Set.js +6 -0
  30. package/dist/node_modules/lodash-es/_SetCache.js +13 -0
  31. package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
  32. package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
  33. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +13 -12
  34. package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
  35. package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
  36. package/dist/node_modules/lodash-es/_arraySome.js +9 -0
  37. package/dist/node_modules/lodash-es/_baseEach.js +6 -0
  38. package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
  39. package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
  40. package/dist/node_modules/lodash-es/_baseGet.js +11 -0
  41. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  42. package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
  43. package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
  44. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
  45. package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
  46. package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
  47. package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
  48. package/dist/node_modules/lodash-es/_baseMap.js +11 -0
  49. package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
  50. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
  51. package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
  52. package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
  53. package/dist/node_modules/lodash-es/_baseRange.js +9 -0
  54. package/dist/node_modules/lodash-es/_baseToString.js +18 -0
  55. package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
  56. package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
  57. package/dist/node_modules/lodash-es/_castPath.js +10 -0
  58. package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
  59. package/dist/node_modules/lodash-es/_createRange.js +11 -0
  60. package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
  61. package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
  62. package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
  63. package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
  64. package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
  65. package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
  66. package/dist/node_modules/lodash-es/_getTag.js +28 -0
  67. package/dist/node_modules/lodash-es/_hasPath.js +19 -0
  68. package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
  69. package/dist/node_modules/lodash-es/_isKey.js +12 -0
  70. package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
  71. package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
  72. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
  73. package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
  74. package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
  75. package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
  76. package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
  77. package/dist/node_modules/lodash-es/_setToArray.js +9 -0
  78. package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
  79. package/dist/node_modules/lodash-es/_toKey.js +10 -0
  80. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
  81. package/dist/node_modules/lodash-es/flatMap.js +8 -0
  82. package/dist/node_modules/lodash-es/get.js +8 -0
  83. package/dist/node_modules/lodash-es/hasIn.js +8 -0
  84. package/dist/node_modules/lodash-es/isSymbol.js +9 -0
  85. package/dist/node_modules/lodash-es/keys.js +9 -0
  86. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  87. package/dist/node_modules/lodash-es/map.js +11 -0
  88. package/dist/node_modules/lodash-es/property.js +10 -0
  89. package/dist/node_modules/lodash-es/range.js +5 -0
  90. package/dist/node_modules/lodash-es/stubArray.js +6 -0
  91. package/dist/node_modules/lodash-es/toFinite.js +14 -0
  92. package/dist/node_modules/lodash-es/toNumber.js +22 -0
  93. package/dist/node_modules/lodash-es/toString.js +7 -0
  94. package/dist/src/composables/useActionsApi.d.ts +1 -0
  95. package/dist/src/composables/useTimerClone.d.ts +6 -0
  96. package/dist/src/config/compiler/itemsCompilerRules.d.ts +2 -0
  97. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  98. package/dist/src/extensions/Blocks/Items/block.d.ts +14 -0
  99. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +20 -7
  100. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +8 -2
  101. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +8 -0
  102. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +6 -0
  103. package/dist/src/extensions/Blocks/Items/template.d.ts +9 -1
  104. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  105. package/dist/src/utils/environmentUtil.d.ts +5 -0
  106. package/dist/src/utils/pairProductVariables.d.ts +7 -0
  107. package/dist/utils/environmentUtil.js +4 -0
  108. package/dist/utils/pairProductVariables.js +136 -0
  109. package/package.json +3 -10
@@ -1,25 +1,26 @@
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 V } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as _ } from "./useStripoEventHandler.js";
6
- import { useToaster as B } from "./useToaster.js";
7
- import { displayConditions as A } from "../enums/displayConditions.js";
8
- import { useStripoApi as F } 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 } = B(), { getToken: f, getCustomFonts: S } = F(), { handleEvent: C } = _(), { 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 V } from "./useActionsApi.js";
2
+ import { useBlocksConfig as _ } from "./useBlocksConfig.js";
3
+ import { useConfig as A } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
6
+ import { useTimerClone as F } from "./useTimerClone.js";
7
+ import { useToaster as I } from "./useToaster.js";
8
+ import { displayConditions as M } from "../enums/displayConditions.js";
9
+ import { useStripoApi as U } from "../services/stripoApi.js";
10
+ import D from "../static/styles/customEditorStyle.css.js";
11
+ import { useEditorStore as P } from "../stores/editor.js";
12
+ import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
13
+ import O from "../package.json.js";
14
+ const Y = (c) => {
15
+ const { config: u } = A(), { handleError: p } = I(), { getToken: m, getCustomFonts: C } = U(), { handleEvent: S } = v(), { getStripoBlocksConfig: E } = _(), w = async (i, r = []) => {
16
+ var g, y;
17
+ const e = P(), { html: s, css: f, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E();
17
18
  window.UIEditor.initEditor(
18
19
  document.querySelector("#guido-editor"),
19
20
  {
20
- metadata: d,
21
- html: n,
22
- css: p,
21
+ metadata: c,
22
+ html: s,
23
+ css: f,
23
24
  forceRecreate: a,
24
25
  locale: "en",
25
26
  undoButtonSelector: "#guido__undo-button",
@@ -30,14 +31,18 @@ const N = (d) => {
30
31
  customAppearanceMergetags: !0,
31
32
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
33
  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: A,
34
+ customViewStyles: D,
35
+ conditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
36
+ customConditionsEnabled: ((y = u.features) == null ? void 0 : y.displayConditions) ?? !0,
37
+ conditionCategories: M,
37
38
  enableXSSSecurity: !0,
38
- messageSettingsEnabled: !1,
39
+ messageSettingsEnabled: !0,
40
+ displayGmailAnnotations: !0,
41
+ displayHiddenPreheader: !1,
42
+ displayTitle: !1,
43
+ displayUTM: !1,
39
44
  selectElementAfterDrop: !0,
40
- ...e ? { baseBlocks: e } : {},
45
+ ...t ? { baseBlocks: t } : {},
41
46
  editorFonts: {
42
47
  showDefaultStandardFonts: !0,
43
48
  showDefaultNotStandardFonts: !0,
@@ -45,68 +50,69 @@ const N = (d) => {
45
50
  },
46
51
  mergeTags: [
47
52
  {
48
- entries: I(d.preselectedDynamicContentList)
53
+ entries: H(c.preselectedDynamicContentList)
49
54
  }
50
55
  ],
51
56
  async onTokenRefreshRequest(o) {
52
57
  try {
53
- const s = await f();
54
- o(s);
55
- } catch (s) {
56
- l(s, "Failed to refresh token");
58
+ const n = await m();
59
+ o(n);
60
+ } catch (n) {
61
+ p(n, "Failed to refresh token");
57
62
  }
58
63
  },
59
64
  onTemplateLoaded() {
65
+ var o, n;
60
66
  try {
61
- const { importCss: o } = V(), { activateCustomViewStyles: s } = h();
62
- o(), s(), d.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
63
- t.hasChanges = !1;
67
+ const { importCss: l } = B(), { activateCustomViewStyles: T, updateTimerInClonedTemplate: b } = V(), { updateTimersOnLoad: k } = F();
68
+ l(), T(), typeof ((n = (o = window.StripoEditorApi) == null ? void 0 : o.actionsApi) == null ? void 0 : n.updateTimerInClonedTemplate) == "function" ? b() : k(m), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
69
+ e.hasChanges = !1;
64
70
  }, 1e3);
65
- } catch (o) {
66
- l(o, "Failed to load custom interface appearance");
71
+ } catch (l) {
72
+ p(l, "Failed to load custom interface appearance");
67
73
  }
68
74
  },
69
75
  onCodeEditorVisibilityChanged(o) {
70
- t.isCodeEditorOpen = o;
76
+ e.isCodeEditorOpen = o;
71
77
  },
72
78
  onEditorVisualModeChanged(o) {
73
- t.editorVisualMode = o.toLowerCase();
79
+ e.editorVisualMode = o.toLowerCase();
74
80
  },
75
81
  onVersionHistoryVisibilityChanged(o) {
76
- t.isVersionHistoryOpen = o;
82
+ e.isVersionHistoryOpen = o;
77
83
  },
78
84
  onDataChanged() {
79
- t.hasChanges = !0;
85
+ e.hasChanges = !0;
80
86
  },
81
- onEvent: C,
87
+ onEvent: S,
82
88
  ignoreClickOutsideSelectors: [
83
89
  "#guido-dynamic-content-modal",
84
90
  ".in-on-board-wrapper",
85
91
  ".in-drawer__container"
86
92
  ],
87
- extensions: c
93
+ extensions: d
88
94
  }
89
95
  );
90
- }, w = (i) => new Promise((r, t) => {
91
- var c;
96
+ }, h = (i) => new Promise((r, e) => {
97
+ var d;
92
98
  if (document.getElementById("UiEditorScript")) {
93
99
  i(), r();
94
100
  return;
95
101
  }
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 = () => {
102
+ const s = O.guido, a = `https://email-static.useinsider.com/guido/${(d = s == null ? void 0 : s.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
103
+ t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
98
104
  i(), r();
99
- }, e.onerror = () => {
100
- t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
101
- }, document.body.appendChild(e);
105
+ }, t.onerror = () => {
106
+ e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
107
+ }, document.body.appendChild(t);
102
108
  });
103
109
  return { initPlugin: async (i) => {
104
- await w(async () => {
105
- const r = await S();
106
- await E(i, r);
110
+ await h(async () => {
111
+ const r = await C();
112
+ await w(i, r);
107
113
  });
108
114
  } };
109
115
  };
110
116
  export {
111
- N as useStripo
117
+ Y as useStripo
112
118
  };
@@ -0,0 +1,52 @@
1
+ import { useToaster as T } from "./useToaster.js";
2
+ import { useStripoApi as f } from "../services/stripoApi.js";
3
+ const E = () => {
4
+ const { handleError: c } = T(), { getToken: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
5
+ try {
6
+ const r = await fetch("https://plugins.stripo.email/api/v1/timers/clone", {
7
+ method: "POST",
8
+ headers: {
9
+ "ES-PLUGIN-AUTH": `Bearer ${e}`,
10
+ "Content-Type": "application/json"
11
+ },
12
+ body: JSON.stringify({ html: t })
13
+ });
14
+ if (!r.ok)
15
+ throw new Error(`Stripo API error: ${r.status} ${r.statusText}`);
16
+ return (await r.json()).html;
17
+ } catch (r) {
18
+ return c(r, "Failed to clone timer IDs"), null;
19
+ }
20
+ };
21
+ return {
22
+ hasTimerBlocks: s,
23
+ cloneTimersInHtml: i,
24
+ cloneTimersOnSave: async (t) => {
25
+ if (!s(t))
26
+ return t;
27
+ const e = await l();
28
+ return e && await i(t, e) || t;
29
+ },
30
+ updateTimersOnLoad: async (t) => {
31
+ var e, r, n, d, p, u;
32
+ try {
33
+ const o = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
34
+ if (!o || !s(o))
35
+ return;
36
+ const m = await t();
37
+ if (!m)
38
+ return;
39
+ const a = await i(o, m);
40
+ if (!a || a === o)
41
+ return;
42
+ const w = ((d = (n = window.UIEditor) == null ? void 0 : n.getCss) == null ? void 0 : d.call(n)) || "";
43
+ (u = (p = window.StripoEditorApi) == null ? void 0 : p.actionsApi) != null && u.updateHtmlAndCss && window.StripoEditorApi.actionsApi.updateHtmlAndCss(a, w);
44
+ } catch (o) {
45
+ c(o, "Failed to update timer blocks");
46
+ }
47
+ }
48
+ };
49
+ };
50
+ export {
51
+ E as useTimerClone
52
+ };
@@ -0,0 +1,14 @@
1
+ import { pairProductVariables as r } from "../../utils/pairProductVariables.js";
2
+ const t = [
3
+ {
4
+ id: "pair-product-variables",
5
+ description: "Replace product default values with template variables",
6
+ type: "custom",
7
+ processor: r,
8
+ priority: 60
9
+ // After recommendation rules (priority 50-53)
10
+ }
11
+ ];
12
+ export {
13
+ t as itemsCompilerRules
14
+ };
@@ -1,25 +1,26 @@
1
- import { useTranslations as e } from "../composables/useTranslations.js";
2
- const s = e(), R = {
1
+ import { useTranslations as n } from "../composables/useTranslations.js";
2
+ import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
+ const e = n(), I = {
3
4
  UNSUBSCRIBE_LINK_TYPE: 1,
4
5
  PREFERENCES_LINK_TYPE: 3
5
- }, S = {
6
+ }, r = {
6
7
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
7
8
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
8
9
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
9
10
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
10
- }, N = {
11
- UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
12
- PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
13
- }, I = "iid", _ = {
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 = {
14
15
  name: "Global Unsubscribe",
15
16
  sendGridId: "G"
16
- }, i = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
17
+ }, C = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", c = "/email/unsubscribe-pages", E = {
17
18
  GLOBAL_UNSUBSCRIBE: 1,
18
19
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
19
20
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
20
21
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
21
22
  RESUBSCRIBE: 5
22
- }, B = {
23
+ }, t = {
23
24
  [E.GLOBAL_UNSUBSCRIBE]: [
24
25
  E.GLOBAL_UNSUBSCRIBE,
25
26
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -29,27 +30,27 @@ const s = e(), R = {
29
30
  E.SUBSCRIPTION_PREFERENCE_CENTER,
30
31
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
31
32
  ]
32
- }, C = {
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 = {
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 = {
39
40
  default: "{{ins-unsubscribe-link}}",
40
41
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
41
42
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
42
43
  };
43
44
  export {
44
- i as ACADEMY_LINK,
45
- _ as DEFAULT_UNSUBSCRIBE_GROUP,
46
- I as INSIDER_ID,
47
- S as LINK_REGEXES,
48
- R as LINK_TYPES,
49
- c as MERGE_TAGS,
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,
50
51
  E as PAGE_TYPES,
51
- B as TYPE_COLLECTIONS,
52
- C as TYPE_TRANSLATIONS,
53
- r as UNSUBSCRIBE_PAGES_LINK,
54
- N as URLS
52
+ t as TYPE_COLLECTIONS,
53
+ U as TYPE_TRANSLATIONS,
54
+ c as UNSUBSCRIBE_PAGES_LINK,
55
+ _ as URLS
55
56
  };
@@ -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 u } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as c } 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", a = "select", { get: C } = L();
7
+ const m = "ui-elements-checkbox", u = "select", { get: C } = L();
8
8
  class S extends h {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -16,15 +16,16 @@ class S extends h {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.currentNode && "getAttribute" in this.currentNode) {
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 === u.sendGridId ? e : Number(e);
23
- s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
- [a]: this.selectedUnsubGroup
25
- }));
22
+ const s = e === c.sendGridId ? e : Number(e);
23
+ s && (this.selectedUnsubGroup = s);
26
24
  }
27
25
  }
26
+ this.api.updateValues({
27
+ [u]: this.selectedUnsubGroup
28
+ });
28
29
  }
29
30
  _getLabel(e, s = `${Math.random()}`) {
30
31
  return `
@@ -54,7 +55,7 @@ class S extends h {
54
55
  </${i.LABEL}>
55
56
 
56
57
  <${i.SELECTPICKER}
57
- ${t.SELECTPICKER.name}="${a}"
58
+ ${t.SELECTPICKER.name}="${u}"
58
59
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
59
60
  ${this._getSelect()}
60
61
  </${i.SELECTPICKER}>
@@ -66,21 +67,21 @@ class S extends h {
66
67
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
67
68
  }
68
69
  _listenToFormUpdates() {
69
- this.api.onValueChanged(a, (e) => this._onSelectChange(e));
70
+ this.api.onValueChanged(u, (e) => this._onSelectChange(e));
70
71
  }
71
72
  onTemplateNodeUpdated(e) {
72
- this.currentNode = e;
73
+ this.currentNode = e, this._setFormValues();
73
74
  }
74
75
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
75
76
  async onRender() {
76
77
  const e = await C(
77
78
  "/unsubscribe-groups/unsubscribe-list"
78
- ), s = [u, ...e.data], E = s.map((c) => ({
79
- [t.SELECT_ITEM.text]: c.name,
80
- [t.SELECT_ITEM.value]: c.sendGridId
79
+ ), s = [c, ...e.data], E = s.map((a) => ({
80
+ [t.SELECT_ITEM.text]: a.name,
81
+ [t.SELECT_ITEM.value]: a.sendGridId
81
82
  }));
82
83
  this.unsubList = s, this.api.setUIEAttribute(
83
- a,
84
+ u,
84
85
  t.SELECTPICKER.items,
85
86
  E
86
87
  ), this._setFormValues(), this._listenToFormUpdates();
@@ -3,7 +3,7 @@ const e = {
3
3
  TITLE: "Unsubscribe From All Email Lists",
4
4
  DESCRIPTION: "You will still receive important transactional and billing-related emails."
5
5
  }, l = `
6
- <td align="left" class="checkbox-block-v2 esd-block-checkbox es-p20">
6
+ <td align="left" class="checkbox-block checkbox-block-v2 esd-block-checkbox es-p20">
7
7
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
8
8
  <tbody>
9
9
  <tr>
@@ -26,11 +26,16 @@ const e = {
26
26
  </tbody>
27
27
  </table>
28
28
  </td>
29
- `, i = `
30
- <td
31
- align="left"
32
- esd-extension-block-id="checkbox-block"
33
- class="checkbox-block-v2 esd-block-checkbox esd-checkbox-block esd-extension-block es-p20"
29
+ `, o = `
30
+ <td
31
+ align="left"
32
+ esd-extension-block-id="checkbox-block"
33
+ class="
34
+ checkbox-block
35
+ checkbox-block-v2
36
+ esd-block-checkbox
37
+ esd-checkbox-block
38
+ esd-extension-block es-p20"
34
39
  >
35
40
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
36
41
  <tbody>
@@ -55,10 +60,10 @@ const e = {
55
60
  </table>
56
61
  </td>
57
62
  `;
58
- function c() {
63
+ function a() {
59
64
  return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
60
65
  }
61
66
  export {
62
- i as default,
63
- c as getDefaultTemplate
67
+ o as default,
68
+ a as getDefaultTemplate
64
69
  };
@@ -1,19 +1,20 @@
1
- import { useOnboardingStore as f } from "../../../stores/onboarding.js";
2
- import { Block as _, BlockCompositionType as g, ModificationDescription as u } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { useOnboardingStore as y } from "../../../stores/onboarding.js";
2
+ import { Block as R, BlockCompositionType as L, ModificationDescription as a } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
3
  import { configAttributes as t } from "./enums/productEnums.js";
4
4
  import { DefaultConfigValues as e, SETTINGS_ENUMS as l } from "./enums/settingsEnums.js";
5
- import { useItemsBlockStore as d } from "./store/items-block.js";
6
- import { getDefaultTemplate as D } from "./template.js";
7
- const y = "items-block";
8
- class V extends _ {
5
+ import { useItemsBlockStore as S } from "./store/items-block.js";
6
+ import { getDefaultTemplate as V } from "./template.js";
7
+ import { syncCurrencySymbolFromAttributes as B, syncCurrencyLocationFromAttributes as U, syncFormattedPriceFromAttributes as k } from "./utils/syncAttributesFromConfigBlock.js";
8
+ const M = "items-block";
9
+ class x extends R {
9
10
  getId() {
10
- return y;
11
+ return M;
11
12
  }
12
13
  getIcon() {
13
14
  return "items-icon";
14
15
  }
15
16
  getBlockCompositionType() {
16
- return g.CONTAINER;
17
+ return L.CONTAINER;
17
18
  }
18
19
  getName() {
19
20
  return this.api.translate("Items");
@@ -22,14 +23,13 @@ class V extends _ {
22
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
23
24
  }
24
25
  getTemplate() {
25
- const r = d();
26
- return D({
26
+ return V({
27
27
  orientation: l.ORIENTATION.HORIZONTAL,
28
28
  itemsType: l.ITEMS_TYPE.CART_ITEMS,
29
29
  itemId: "{{Abandoned Cart Item (1) Url}}",
30
- currencySymbol: r.currencySymbol,
31
- currencyLocation: r.currencyLocation,
32
- formattedPrice: r.formattedPrice
30
+ currencySymbol: e.productPriceCurrencySymbolControlValue,
31
+ currencyLocation: e.productPriceCurrencyLocationControlValue,
32
+ formattedPrice: e.productPriceFormattedControlValue === "1"
33
33
  });
34
34
  }
35
35
  allowInnerBlocksDND() {
@@ -39,29 +39,29 @@ class V extends _ {
39
39
  const n = r.querySelector("esd-config-block");
40
40
  if (!n)
41
41
  return;
42
- const o = n, c = o.getAttribute("data-initialized") || "0", a = o.getAttribute(t.BLOCK_INSTANCE_ID), s = () => String(Date.now() + Math.floor(Math.random() * 1e3));
43
- if (Number(c)) {
44
- if (!a) {
45
- const i = s();
46
- this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new u("Assign block instance ID to legacy block"));
42
+ const o = n, s = o.getAttribute("data-initialized") || "0", u = o.getAttribute(t.BLOCK_INSTANCE_ID), c = () => String(Date.now() + Math.floor(Math.random() * 1e3));
43
+ if (Number(s)) {
44
+ if (!u) {
45
+ const i = c();
46
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute(t.BLOCK_INSTANCE_ID, i).apply(new a("Assign block instance ID to legacy block"));
47
47
  }
48
48
  } else {
49
- const i = e.itemsType, m = e.cartItemsSelectControlValue, I = e.cardOrientationControlValue, C = e.productNameTrimmingControlValue, T = e.productPriceHideDiscountControlValue, E = e.productPriceFormattedControlValue, b = e.productPriceCurrencySymbolControlValue, O = e.productPriceCurrencyLocationControlValue, A = e.productButtonLinkControlValue, N = e.productImageLinkControlValue, p = s();
50
- this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, m).setAttribute(t.ORIENTATION, I).setAttribute(t.PRODUCT_NAME_TRIMMING, C).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, T).setAttribute(t.PRODUCT_PRICE_FORMATTED, E).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, O).setAttribute(t.PRODUCT_BUTTON_LINK, A).setAttribute(t.PRODUCT_IMAGE_LINK, N).setAttribute(t.BLOCK_INSTANCE_ID, p).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
49
+ const i = e.itemsType, I = e.cartItemsSelectControlValue, d = e.cardOrientationControlValue, m = e.productNameTrimmingControlValue, C = e.productPriceHideDiscountControlValue, b = e.productPriceFormattedControlValue, T = e.productPriceCurrencySymbolControlValue, A = e.productPriceCurrencyLocationControlValue, E = e.productButtonLinkControlValue, O = e.productImageLinkControlValue, _ = e.productImageVisible, p = e.productNameVisible, N = e.productQuantityVisible, f = e.productPriceVisible, g = e.productOriginalPriceVisible, D = e.productButtonVisible, P = c();
50
+ this.api.getDocumentModifier().modifyHtml(o).setAttribute("data-source", i).setAttribute(t.TYPE, i).setAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE, I).setAttribute(t.ORIENTATION, d).setAttribute(t.PRODUCT_NAME_TRIMMING, m).setAttribute(t.PRODUCT_PRICE_HIDE_DISCOUNT, C).setAttribute(t.PRODUCT_PRICE_FORMATTED, b).setAttribute(t.PRODUCT_PRICE_CURRENCY_SYMBOL, T).setAttribute(t.PRODUCT_PRICE_CURRENCY_LOCATION, A).setAttribute(t.PRODUCT_BUTTON_LINK, E).setAttribute(t.PRODUCT_IMAGE_LINK, O).setAttribute(t.BLOCK_INSTANCE_ID, P).setAttribute("data-initialized", "1").setAttribute(t.NAME_CONTROL_ENABLED, e.productNameControlEnabled).setAttribute(
51
51
  t.QUANTITY_CONTROL_ENABLED,
52
52
  e.productQuantityControlEnabled
53
- ).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).apply(new u("Initialize config block attributes with defaults")), f().startOnboarding("itemsOnboarding");
53
+ ).setAttribute(t.PRICE_CONTROL_OPENED, e.productPriceControlOpened).setAttribute(t.PRODUCT_IMAGE_VISIBLE, _).setAttribute(t.PRODUCT_NAME_VISIBLE, p).setAttribute(t.PRODUCT_QUANTITY_VISIBLE, N).setAttribute(t.PRODUCT_PRICE_VISIBLE, f).setAttribute(t.PRODUCT_ORIGINAL_PRICE_VISIBLE, g).setAttribute(t.PRODUCT_BUTTON_VISIBLE, D).apply(new a("Initialize config block attributes with defaults")), y().startOnboarding("itemsOnboarding");
54
54
  }
55
55
  }
56
56
  onSelect(r) {
57
- const n = r.querySelector("esd-config-block"), o = d();
57
+ const n = r.querySelector("esd-config-block"), o = S();
58
58
  if (!n)
59
59
  return;
60
- const c = n, a = c.getAttribute(t.TYPE) || e.itemsType, s = c.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = c.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
61
- o.setItemsType(a), o.setItemIds(s), o.setOrientation(i);
60
+ const s = n, u = s.getAttribute(t.TYPE) || e.itemsType, c = s.getAttribute(t.ITEMS_INDEX_SELECT_CONTROL_VALUE) || e.cartItemsSelectControlValue, i = s.getAttribute(t.ORIENTATION) || e.cardOrientationControlValue;
61
+ o.setItemsType(u), o.setItemIds(c), o.setOrientation(i), B(r), U(r), k(r);
62
62
  }
63
63
  }
64
64
  export {
65
- y as BLOCK_ID,
66
- V as ItemsBlock
65
+ M as BLOCK_ID,
66
+ x as ItemsBlock
67
67
  };