@useinsider/guido 1.0.3-beta.03ebd23 → 1.0.3-beta.0434c5a

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 (51) hide show
  1. package/README.md +0 -3
  2. package/dist/components/Guido.vue.js +3 -3
  3. package/dist/components/Guido.vue2.js +68 -70
  4. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue2.js +22 -23
  6. package/dist/composables/useGuidoActions.js +9 -19
  7. package/dist/composables/useStripo.js +35 -37
  8. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  9. package/dist/enums/defaults.js +1 -2
  10. package/dist/enums/unsubscribe.js +25 -27
  11. package/dist/extensions/Blocks/Checkbox/control.js +14 -15
  12. package/dist/extensions/Blocks/Checkbox/template.js +9 -14
  13. package/dist/extensions/Blocks/RadioButton/control.js +17 -18
  14. package/dist/extensions/Blocks/RadioButton/template.js +9 -18
  15. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  16. package/dist/extensions/DynamicContent/dynamic-content-modal.js +6 -6
  17. package/dist/extensions/DynamicContent/dynamic-content.js +62 -46
  18. package/dist/guido.css +1 -1
  19. package/dist/package.json.js +1 -1
  20. package/dist/src/@types/generic.d.ts +1 -2
  21. package/dist/src/components/Guido.vue.d.ts +0 -1
  22. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  23. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  24. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  25. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  26. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +5 -7
  27. package/dist/src/stores/config.d.ts +1 -2
  28. package/dist/src/stores/dynamic-content.d.ts +1 -1
  29. package/dist/src/stores/editor.d.ts +1 -1
  30. package/dist/src/stores/onboarding.d.ts +1 -1
  31. package/dist/src/stores/preview.d.ts +1 -1
  32. package/dist/src/stores/recommendation.d.ts +1 -1
  33. package/dist/src/stores/save-as-template.d.ts +1 -1
  34. package/dist/src/stores/toaster.d.ts +1 -1
  35. package/dist/src/stores/unsubscribe.d.ts +1 -1
  36. package/dist/src/stores/version-history.d.ts +1 -1
  37. package/dist/src/utils/genericUtil.d.ts +0 -1
  38. package/dist/stores/config.js +5 -5
  39. package/dist/stores/dynamic-content.js +1 -1
  40. package/dist/stores/editor.js +1 -1
  41. package/dist/stores/onboarding.js +27 -27
  42. package/dist/stores/preview.js +1 -1
  43. package/dist/stores/recommendation.js +3 -3
  44. package/dist/stores/save-as-template.js +2 -2
  45. package/dist/stores/toaster.js +1 -1
  46. package/dist/stores/unsubscribe.js +1 -1
  47. package/dist/stores/version-history.js +4 -4
  48. package/dist/utils/genericUtil.js +9 -20
  49. package/package.json +2 -2
  50. package/dist/src/utils/environmentUtil.d.ts +0 -5
  51. package/dist/utils/environmentUtil.js +0 -4
@@ -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,16 +16,15 @@ 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
27
  }
26
- this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
28
- });
29
28
  }
30
29
  _getLabel(e, s = `${Math.random()}`) {
31
30
  return `
@@ -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 @@ 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 checkbox-block-v2 esd-block-checkbox es-p20">
6
+ <td align="left" class="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,16 +26,11 @@ const e = {
26
26
  </tbody>
27
27
  </table>
28
28
  </td>
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"
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"
39
34
  >
40
35
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
41
36
  <tbody>
@@ -60,10 +55,10 @@ const e = {
60
55
  </table>
61
56
  </td>
62
57
  `;
63
- function a() {
58
+ function c() {
64
59
  return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
65
60
  }
66
61
  export {
67
- o as default,
68
- a as getDefaultTemplate
62
+ i as default,
63
+ c as getDefaultTemplate
69
64
  };
@@ -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
  };
@@ -5,7 +5,7 @@ const e = {
5
5
  YES: "Yes",
6
6
  NO: "No"
7
7
  }, d = `
8
- <td align="left" class="radio-button radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
8
+ <td align="left" class="radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
9
9
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
10
10
  <tbody>
11
11
  <tr>
@@ -75,21 +75,12 @@ const e = {
75
75
  </tbody>
76
76
  </table>
77
77
  </td>
78
- `, a = `
79
- <td
80
- align="left"
81
- esd-extension-block-id="radio-button-block"
78
+ `, l = `
79
+ <td
80
+ align="left"
81
+ esd-extension-block-id="radio-button-block"
82
82
  esd-handler-name="esd-extension-RadioButtonBlock"
83
- class="
84
- radio-button
85
- radio-button-v2
86
- esd-block-ra
87
- esd-radio-button-block
88
- esd-extension-block
89
- es-p10t
90
- es-p10b
91
- es-p30r
92
- es-p30l"
83
+ class="radio-button-v2 esd-block-ra esd-radio-button-block esd-extension-block es-p10t es-p10b es-p30r es-p30l"
93
84
  >
94
85
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
95
86
  <tbody>
@@ -149,10 +140,10 @@ const e = {
149
140
  </table>
150
141
  </td>
151
142
  `;
152
- function l() {
143
+ function a() {
153
144
  return d.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`).replace("{-{-YES-}-}", `<p path="1">${e.YES}</p>`).replace("{-{-NO-}-}", `<p path="1">${e.NO}</p>`);
154
145
  }
155
146
  export {
156
- a as default,
157
- l as getDefaultTemplate
147
+ l as default,
148
+ a as getDefaultTemplate
158
149
  };
@@ -133,7 +133,7 @@ const a = c(), d = () => ({
133
133
  filterSelectionDrawerStatus: !1,
134
134
  filterList: {},
135
135
  filterGroup: 1
136
- }), G = p("guidoRecommendationExtension", {
136
+ }), G = p("recommendationExtension", {
137
137
  state: () => d(),
138
138
  getters: {
139
139
  hasFilters: (e) => !!e.recommendationConfigs.filters.length,
@@ -1,12 +1,12 @@
1
1
  var d = Object.defineProperty;
2
2
  var m = (t, e, n) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var c = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
3
+ var a = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  class C {
5
5
  constructor() {
6
- c(this, "selectedDynamicContent", null);
7
- c(this, "dataSelectCallback", () => {
6
+ a(this, "selectedDynamicContent", null);
7
+ a(this, "dataSelectCallback", () => {
8
8
  });
9
- c(this, "closeDynamicContentHandler", null);
9
+ a(this, "closeDynamicContentHandler", null);
10
10
  }
11
11
  /**
12
12
  * Opens the merge tags library modal
@@ -23,8 +23,8 @@ class C {
23
23
  detail: o
24
24
  });
25
25
  document.dispatchEvent(s), this.closeDynamicContentHandler = (i) => {
26
- const a = i.detail;
27
- this.selectedDynamicContent = a, a.text && a.value && this.dataSelectCallback(a);
26
+ const c = i.detail;
27
+ this.selectedDynamicContent = c, c.text && c.value && this.dataSelectCallback(c), this.closeDynamicContentHandler && (document.removeEventListener("dynamic-content:close", this.closeDynamicContentHandler), this.closeDynamicContentHandler = null);
28
28
  }, document.addEventListener("dynamic-content:close", this.closeDynamicContentHandler);
29
29
  }
30
30
  }
@@ -1,27 +1,26 @@
1
- var c = Object.defineProperty;
2
- var g = (o, s, t) => s in o ? c(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
- var r = (o, s, t) => g(o, typeof s != "symbol" ? s + "" : s, t);
4
- import { mergeTagToDynamicContent as d, dynamicContentToMergeTags as m } from "../../utils/genericUtil.js";
5
- import { UIElement as u, UIElementType as a, UEAttr as h, UIElementTagRegistry as T } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { ExternalMergeTagsLibrary as y } from "./dynamic-content-modal.js";
7
- const l = "external-dynamic-content-ui-element", C = "button-add-dynamic-content";
8
- class p extends T {
9
- registerUiElements(s) {
10
- s[a.MERGETAGS] = l;
1
+ var l = Object.defineProperty;
2
+ var g = (r, o, t) => o in r ? l(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
+ var s = (r, o, t) => g(r, typeof o != "symbol" ? o + "" : o, t);
4
+ import { dynamicContentToMergeTags as d } from "../../utils/genericUtil.js";
5
+ import { UIElement as u, UIElementType as a, UEAttr as m, UIElementTagRegistry as h } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { ExternalMergeTagsLibrary as T } from "./dynamic-content-modal.js";
7
+ const c = "external-dynamic-content-ui-element", y = "button-add-dynamic-content";
8
+ class C extends h {
9
+ registerUiElements(o) {
10
+ o[a.MERGETAGS] = c;
11
11
  }
12
12
  }
13
- class b extends u {
13
+ class E extends u {
14
14
  constructor() {
15
15
  super(...arguments);
16
- r(this, "mergeTagsButton", null);
17
- r(this, "mergeTagsLibrary", null);
18
- r(this, "clickListener", null);
19
- r(this, "lastClickedElement", null);
20
- r(this, "lastClickedFrame", null);
21
- r(this, "mousedownListener", null);
16
+ s(this, "mergeTagsButton", null);
17
+ s(this, "mergeTagsLibrary", null);
18
+ s(this, "clickListener", null);
19
+ s(this, "lastClickedPosition");
20
+ s(this, "mousedownListener", null);
22
21
  }
23
22
  getId() {
24
- return l;
23
+ return c;
25
24
  }
26
25
  onRender(t) {
27
26
  var e;
@@ -29,7 +28,7 @@ class b extends u {
29
28
  }
30
29
  onDestroy() {
31
30
  var t;
32
- this.clickListener && ((t = this.mergeTagsButton) == null || t.removeEventListener("click", this.clickListener)), this._cleanupCoordinateTracking(), this.mergeTagsButton = null, this.clickListener = null, this.lastClickedElement = null, this.lastClickedFrame = null;
31
+ this.clickListener && ((t = this.mergeTagsButton) == null || t.removeEventListener("click", this.clickListener)), this._cleanupCoordinateTracking(), this.mergeTagsButton = null, this.clickListener = null, this.lastClickedPosition = void 0;
33
32
  }
34
33
  _onClick() {
35
34
  this.openMergeTagLibrary();
@@ -41,10 +40,13 @@ class b extends u {
41
40
  * @param value - MergeTag object with label, value, selStart, selEnd, etc.
42
41
  */
43
42
  onAttributeUpdated(t, e) {
44
- if (t !== "mergeTag" || !(e != null && e.value))
43
+ if (t !== "mergeTag" || !e)
45
44
  return;
46
- const n = d(e), i = this._getLastClickedPosition();
47
- this.lastClickedElement = null, this.lastClickedFrame = null, this._openDynamicContentLibrary(n, i);
45
+ const n = {
46
+ text: e.label,
47
+ value: e.value
48
+ }, i = this.lastClickedPosition;
49
+ this.lastClickedPosition = void 0, this._openDynamicContentLibrary(n, i);
48
50
  }
49
51
  openMergeTagLibrary() {
50
52
  const t = this._getButtonPosition(), e = { value: "", text: "" };
@@ -55,35 +57,50 @@ class b extends u {
55
57
  * Dispatches event with dynamic content data and position
56
58
  */
57
59
  _openDynamicContentLibrary(t, e) {
58
- this.mergeTagsLibrary || (this.mergeTagsLibrary = new y()), this.mergeTagsLibrary.openMergeTagsLibrary(
60
+ this._ensureMergeTagsLibrary(), this.mergeTagsLibrary.openMergeTagsLibrary(
59
61
  t,
60
62
  (n) => {
61
- n.text && n.value ? this.api.triggerValueChange(m([n])[0]) : this.api.triggerValueChange(null);
63
+ this.api.triggerValueChange(d([n])[0]);
62
64
  },
63
65
  e
64
66
  );
65
67
  }
68
+ /**
69
+ * Ensures merge tags library is initialized
70
+ */
71
+ _ensureMergeTagsLibrary() {
72
+ this.mergeTagsLibrary || (this.mergeTagsLibrary = new T());
73
+ }
66
74
  /**
67
75
  * Gets the button's position on the screen
68
76
  * Used to position the modal or anything else near the button
69
77
  */
70
78
  _getButtonPosition() {
71
- if (!this.mergeTagsButton)
72
- return { x: 0, y: 0, width: 0, height: 0 };
73
- const { x: t, y: e, width: n, height: i } = this.mergeTagsButton.getBoundingClientRect();
74
- return { x: t, y: e, width: n, height: i };
79
+ const t = this.mergeTagsButton.getBoundingClientRect();
80
+ return {
81
+ x: t.left,
82
+ y: t.top,
83
+ width: t.width,
84
+ height: t.height
85
+ };
75
86
  }
76
87
  /**
77
88
  * Sets up coordinate tracking for merge tag clicks in the iframe
78
89
  * Workaround from Stripo intercepting click events - tracks mousedown events instead
79
90
  */
80
91
  _setupCoordinateTracking() {
81
- var e;
82
- const t = this._getEditorFrame();
83
- (e = t == null ? void 0 : t.contentWindow) != null && e.document && (this.mousedownListener = (n) => {
84
- const i = this._findMergeTagElement(n.target);
85
- i && (this.lastClickedElement = i, this.lastClickedFrame = t);
86
- }, t.contentWindow.document.addEventListener("mousedown", this.mousedownListener));
92
+ const t = () => {
93
+ const e = this._getEditorFrame();
94
+ if (!e) {
95
+ setTimeout(t, 100);
96
+ return;
97
+ }
98
+ this.mousedownListener = (n) => {
99
+ const i = this._findMergeTagElement(n.target);
100
+ i && (this.lastClickedPosition = this._calculateAbsolutePosition(e, i));
101
+ }, e.contentWindow.document.addEventListener("mousedown", this.mousedownListener);
102
+ };
103
+ t();
87
104
  }
88
105
  /**
89
106
  * Gets the editor iframe element
@@ -100,15 +117,14 @@ class b extends u {
100
117
  * Finds merge tag element in the element tree
101
118
  */
102
119
  _findMergeTagElement(t) {
103
- return t.closest(".target, .esd-merge-tag");
104
- }
105
- /**
106
- * Gets the position of the last clicked element, calculated on-demand
107
- * This ensures we always use the correct element's position even with rapid clicks
108
- */
109
- _getLastClickedPosition() {
110
- if (!(!this.lastClickedElement || !this.lastClickedFrame))
111
- return this._calculateAbsolutePosition(this.lastClickedFrame, this.lastClickedElement);
120
+ var n, i;
121
+ let e = t;
122
+ for (; e; ) {
123
+ if ((n = e.classList) != null && n.contains("target") || (i = e.classList) != null && i.contains("esd-merge-tag"))
124
+ return e;
125
+ e = e.parentElement;
126
+ }
127
+ return null;
112
128
  }
113
129
  /**
114
130
  * Calculates absolute position of element relative to page
@@ -142,7 +158,7 @@ class b extends u {
142
158
  <${a.BUTTON}
143
159
  id="guido__btn-add-dynamic-content"
144
160
  class="btn btn-primary"
145
- ${h.BUTTON.name}="${C}">
161
+ ${m.BUTTON.name}="${y}">
146
162
  <${a.ICON} src="plus" class="icon icon-button color-primary">
147
163
  </${a.ICON}>
148
164
  ${this.api.translate("Add Dynamic Content")}
@@ -151,6 +167,6 @@ class b extends u {
151
167
  }
152
168
  }
153
169
  export {
154
- p as DynamicContentTagRegistry,
155
- b as DynamicContentUiElementExtension
170
+ C as DynamicContentTagRegistry,
171
+ E as DynamicContentUiElementExtension
156
172
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-dced5582]{height:100%;top:75px}.guido-editor__wrapper[data-v-23c413c9],.guido-editor__container[data-v-23c413c9]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-23c413c9]{height:calc(100vh - 75px)}[data-v-70835920] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-dced5582]{height:100%;top:75px}.guido-editor__wrapper[data-v-b22f3777],.guido-editor__container[data-v-b22f3777]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-b22f3777]{height:calc(100vh - 75px)}[data-v-70835920] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
@@ -1,4 +1,4 @@
1
- const o = { stripo: { version: "2.46.0" } }, s = {
1
+ const o = { stripo: { version: "2.42.0" } }, s = {
2
2
  guido: o
3
3
  };
4
4
  export {
@@ -7,7 +7,6 @@ type Features = {
7
7
  saveAsTemplate?: boolean;
8
8
  versionHistory?: boolean;
9
9
  testMessage?: boolean;
10
- displayConditions?: boolean;
11
10
  };
12
11
  type Partner = {
13
12
  partnerName: string;
@@ -38,7 +37,7 @@ export type TemplateConfig = {
38
37
  selectedUnsubscribePages?: number[];
39
38
  variationId?: string;
40
39
  };
41
- export type BaseDynamicContent = {
40
+ type BaseDynamicContent = {
42
41
  value: string;
43
42
  fallback?: string;
44
43
  format?: {
@@ -27,7 +27,6 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
27
27
  "on-change": (hasChanges: boolean) => void;
28
28
  ready: () => void;
29
29
  "onboarding:finished": () => void;
30
- "test-email:click": () => void;
31
30
  }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
32
31
  export default _default;
33
32
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -3,11 +3,9 @@ import type { InjectionKey } from 'vue';
3
3
  export type BackHandler = () => void;
4
4
  export type SaveStartHandler = () => void;
5
5
  export type SaveCompleteHandler = (template: Omit<SavedTemplateDetails, 'forceRecreate'>) => void;
6
- export type TestEmailClickHandler = () => void;
7
6
  export declare const BACK_KEY: InjectionKey<BackHandler>;
8
7
  export declare const SAVE_START_KEY: InjectionKey<SaveStartHandler>;
9
8
  export declare const SAVE_COMPLETE_KEY: InjectionKey<SaveCompleteHandler>;
10
- export declare const TEST_EMAIL_CLICK_KEY: InjectionKey<TestEmailClickHandler>;
11
9
  /**
12
10
  * Provides Guido action handlers to child components
13
11
  */
@@ -15,7 +13,6 @@ export declare const provideGuidoActions: (actions: {
15
13
  onBack: BackHandler;
16
14
  onSaveStart: SaveStartHandler;
17
15
  onSaveComplete: SaveCompleteHandler;
18
- onTestEmailClick: TestEmailClickHandler;
19
16
  }) => void;
20
17
  /**
21
18
  * Provides individual Guido action handlers
@@ -38,11 +35,6 @@ export declare const useSaveStart: () => SaveStartHandler;
38
35
  * @returns Save complete function
39
36
  */
40
37
  export declare const useSaveComplete: () => SaveCompleteHandler;
41
- /**
42
- * Hook to use the test email click handler
43
- * @returns Test email click function
44
- */
45
- export declare const useTestEmailClick: () => TestEmailClickHandler;
46
38
  /**
47
39
  * Convenience hook to get all Guido actions
48
40
  * @returns Object containing all action handlers
@@ -51,5 +43,4 @@ export declare const useGuidoActions: () => {
51
43
  back: BackHandler;
52
44
  saveStart: SaveStartHandler;
53
45
  saveComplete: SaveCompleteHandler;
54
- testEmailClick: TestEmailClickHandler;
55
46
  };
@@ -1,4 +1,4 @@
1
- declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"checkbox-block\"\n class=\"\n checkbox-block\n checkbox-block-v2\n esd-block-checkbox\n esd-checkbox-block\n esd-extension-block es-p20\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"39\" style=\"vertical-align: top\">\n <input type=\"checkbox\">\n </td>\n <td align=\"left\" width=\"816\" style=\"vertical-align: top\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
1
+ declare const migrationTemplate = "\n <td \n align=\"left\" \n esd-extension-block-id=\"checkbox-block\" \n class=\"checkbox-block-v2 esd-block-checkbox esd-checkbox-block esd-extension-block es-p20\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"39\" style=\"vertical-align: top\">\n <input type=\"checkbox\">\n </td>\n <td align=\"left\" width=\"816\" style=\"vertical-align: top\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
2
2
  /**
3
3
  * @returns The template for the default checkbox block
4
4
  */