@useinsider/guido 1.0.3-beta.ce4cdcb → 1.0.3-beta.cedc8cb

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 (115) hide show
  1. package/dist/@types/generic.d.ts +13 -0
  2. package/dist/components/Guido.vue.d.ts +3 -2
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +99 -70
  5. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +19 -0
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +28 -0
  7. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +38 -0
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.d.ts +2 -0
  9. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +17 -0
  10. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +37 -0
  11. package/dist/components/organisms/extensions/recommendation/Filters.vue.d.ts +2 -0
  12. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +20 -0
  13. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +44 -0
  14. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.d.ts +16 -0
  15. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.js +17 -0
  16. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +27 -0
  17. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +2 -0
  18. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +18 -0
  19. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +16 -0
  20. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +2 -0
  21. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +24 -0
  22. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +64 -0
  23. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
  24. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +18 -0
  25. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +107 -0
  26. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
  27. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +18 -0
  28. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue2.js +12 -0
  29. package/dist/components/wrappers/WpDrawer.vue.d.ts +6 -4
  30. package/dist/components/wrappers/WpDrawer.vue.js +6 -4
  31. package/dist/composables/useApiErrorTracking.d.ts +26 -0
  32. package/dist/composables/useApiErrorTracking.js +120 -0
  33. package/dist/composables/useErrorTracking.d.ts +30 -0
  34. package/dist/composables/useErrorTracking.js +98 -0
  35. package/dist/composables/useHttp.js +89 -52
  36. package/dist/composables/useStripo.js +160 -61
  37. package/dist/composables/useStripoErrorCategory.d.ts +26 -0
  38. package/dist/composables/useStripoErrorCategory.js +86 -0
  39. package/dist/composables/useStripoSlackNotifier.d.ts +8 -0
  40. package/dist/composables/useStripoSlackNotifier.js +47 -0
  41. package/dist/config/compiler/unsubscribeCompilerRules.js +42 -29
  42. package/dist/config/migrator/index.d.ts +1 -1
  43. package/dist/config/migrator/index.js +7 -6
  44. package/dist/config/migrator/unsubscribeMigrator.d.ts +1 -0
  45. package/dist/config/migrator/unsubscribeMigrator.js +124 -0
  46. package/dist/enums/defaults.js +6 -3
  47. package/dist/enums/extensions/recommendationBlock.d.ts +16 -0
  48. package/dist/enums/extensions/recommendationBlock.js +80 -0
  49. package/dist/enums/unsubscribe.d.ts +19 -0
  50. package/dist/enums/unsubscribe.js +39 -6
  51. package/dist/extensions/Blocks/Checkbox/control.js +35 -39
  52. package/dist/extensions/Blocks/RadioButton/control.js +33 -37
  53. package/dist/extensions/Blocks/RadioButton/template.js +6 -6
  54. package/dist/extensions/Blocks/Recommendation/block.d.ts +10 -0
  55. package/dist/extensions/Blocks/Recommendation/block.js +27 -0
  56. package/dist/extensions/Blocks/Recommendation/control.d.ts +29 -0
  57. package/dist/extensions/Blocks/Recommendation/control.js +277 -0
  58. package/dist/extensions/Blocks/Recommendation/extension.d.ts +2 -0
  59. package/dist/extensions/Blocks/Recommendation/extension.js +10 -0
  60. package/dist/extensions/Blocks/Recommendation/iconsRegistry.d.ts +4 -0
  61. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +51 -0
  62. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +19 -0
  63. package/dist/extensions/Blocks/Recommendation/settingsPanel.d.ts +4 -0
  64. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +32 -0
  65. package/dist/extensions/Blocks/Recommendation/store/recommendation.d.ts +555 -0
  66. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +266 -0
  67. package/dist/extensions/Blocks/Recommendation/template.d.ts +6 -0
  68. package/dist/extensions/Blocks/Recommendation/template.js +200 -0
  69. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +7 -0
  70. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +28 -0
  71. package/dist/extensions/Blocks/Unsubscribe/block.d.ts +32 -0
  72. package/dist/extensions/Blocks/Unsubscribe/block.js +131 -0
  73. package/dist/extensions/Blocks/Unsubscribe/control.d.ts +29 -0
  74. package/dist/extensions/Blocks/Unsubscribe/control.js +167 -0
  75. package/dist/extensions/Blocks/Unsubscribe/elements/preview.d.ts +11 -0
  76. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +42 -0
  77. package/dist/extensions/Blocks/Unsubscribe/extension.d.ts +2 -0
  78. package/dist/extensions/Blocks/Unsubscribe/extension.js +21 -0
  79. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.d.ts +4 -0
  80. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.js +21 -0
  81. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.d.ts +4 -0
  82. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +35 -0
  83. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +42 -0
  84. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.d.ts +4 -0
  85. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.js +10 -0
  86. package/dist/extensions/Blocks/Unsubscribe/template.d.ts +12 -0
  87. package/dist/extensions/Blocks/Unsubscribe/template.js +22 -0
  88. package/dist/extensions/Blocks/Unsubscribe/utils/constants.d.ts +9 -0
  89. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +11 -0
  90. package/dist/extensions/Blocks/Unsubscribe/utils/utils.d.ts +7 -0
  91. package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +6 -0
  92. package/dist/extensions/Blocks/common-control.d.ts +66 -0
  93. package/dist/extensions/Blocks/common-control.js +102 -0
  94. package/dist/guido.css +1 -1
  95. package/dist/mock/api/recommendation.d.ts +2 -0
  96. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +83 -71
  97. package/dist/services/recommendationApi.d.ts +6 -0
  98. package/dist/services/recommendationApi.js +43 -0
  99. package/dist/services/slackNotificationService.d.ts +110 -0
  100. package/dist/services/slackNotificationService.js +167 -0
  101. package/dist/services/stripoApi.js +49 -19
  102. package/dist/services/stripoErrorDeduplicationService.d.ts +75 -0
  103. package/dist/services/stripoErrorDeduplicationService.js +91 -0
  104. package/dist/services/unsubscribeApi.d.ts +4 -0
  105. package/dist/services/unsubscribeApi.js +16 -0
  106. package/dist/stores/config.d.ts +96 -0
  107. package/dist/stores/config.js +17 -0
  108. package/dist/stores/editor.d.ts +21 -0
  109. package/dist/stores/editor.js +2 -1
  110. package/dist/stores/unsubscribe.d.ts +253 -5
  111. package/dist/stores/unsubscribe.js +126 -6
  112. package/dist/utils/genericUtil.d.ts +1 -0
  113. package/dist/utils/genericUtil.js +8 -7
  114. package/dist/utils/templatePreparation.js +17 -16
  115. package/package.json +2 -2
@@ -1,23 +1,36 @@
1
- import { usePartner as m } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as c, LINK_TYPES as p, URLS as E } from "../../enums/unsubscribe.js";
3
- import { useUnsubscribeStore as b } from "../../stores/unsubscribe.js";
4
- const S = [
1
+ import { usePartner as U } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as l, LINK_TYPES as b, URLS as f } from "../../enums/unsubscribe.js";
3
+ import { parsePageList as B } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
4
+ import { useConfigStore as N } from "../../stores/config.js";
5
+ import { useUnsubscribeStore as I } from "../../stores/unsubscribe.js";
6
+ const T = [
5
7
  {
6
8
  id: "add-unsubscribe-link-values",
7
9
  description: "Adding unsubscribe link values",
8
10
  type: "custom",
9
- processor: (n) => {
10
- var a, u;
11
- const { getPartnerName: i } = m(), t = b();
12
- let e = n;
13
- const o = `/${i()}/email/0?user={{iid}}`, r = (a = t.selectedUnsubscribePages) == null ? void 0 : a.find((l) => l.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = t.selectedUnsubscribePages) == null ? void 0 : u.find((l) => l.type === p.PREFERENCES_LINK_TYPE);
14
- return r && (e = e.replace(
15
- c.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
16
- E.UNSUBSCRIBE_URL + o
17
- )), s && (e = e.replace(
18
- c.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
19
- E.PREFERENCES_URL + o
20
- )), e.replace(c.UNSUBSCRIBE_LINK_REGEX, "");
11
+ processor: (t) => {
12
+ const { getPartnerName: i } = U(), a = N(), n = I(), u = a.getVariationId;
13
+ if (!u)
14
+ return t;
15
+ let o = t;
16
+ const e = `/${i()}/email/${u}?user={{iid}}`;
17
+ return new DOMParser().parseFromString(o, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]").forEach((p) => {
18
+ var g;
19
+ const d = p.getAttribute("data-unsubscribe-page-list");
20
+ if (!d)
21
+ return;
22
+ const S = B(d), m = ((g = n.templates) == null ? void 0 : g.filter(
23
+ (c) => S.includes(c.id)
24
+ )) ?? [], R = m.some((c) => c.type === b.UNSUBSCRIBE_LINK_TYPE), _ = m.some((c) => c.type === b.PREFERENCES_LINK_TYPE), E = p.outerHTML;
25
+ let s = E;
26
+ R && (s = s.replace(
27
+ l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
28
+ f.UNSUBSCRIBE_URL + e
29
+ )), _ && (s = s.replace(
30
+ l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
31
+ f.PREFERENCES_URL + e
32
+ )), s = s.replace(l.UNSUBSCRIBE_LINK_REGEX, ""), o = o.replace(E, s);
33
+ }), o;
21
34
  },
22
35
  priority: 60
23
36
  },
@@ -25,7 +38,7 @@ const S = [
25
38
  id: "remove-data-ogsb-button-styles",
26
39
  description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
27
40
  type: "regex",
28
- pattern: c.DATA_OGSB_BUTTON_CSS_REGEX,
41
+ pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
29
42
  replacement: "",
30
43
  flags: "g",
31
44
  priority: 61
@@ -34,25 +47,25 @@ const S = [
34
47
  id: "format-comment-braces",
35
48
  description: "Adding spaces around comment braces for proper formatting",
36
49
  type: "custom",
37
- processor: (n) => n.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
50
+ processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
38
51
  priority: 62
39
52
  },
40
53
  {
41
54
  id: "add-universal-link-flags",
42
55
  description: "Adding universal link flags",
43
56
  type: "custom",
44
- processor: (n) => {
45
- let i = n;
46
- const t = i.match(/<a[^>]+>(.*?)<\/a>/gm);
47
- return t && t.forEach((e) => {
48
- if (e.includes("insEmail=1"))
57
+ processor: (t) => {
58
+ let i = t;
59
+ const a = i.match(/<a[^>]+>(.*?)<\/a>/gm);
60
+ return a && a.forEach((n) => {
61
+ if (n.includes("insEmail=1"))
49
62
  return;
50
- if (e.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
51
- const o = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
52
- const s = r.slice(6, r.length - 1).trim();
53
- return r.includes("?") || r.includes("#") ? s.slice(-1) === "&" ? r.replace(s, `${s}insEmail=1`) : r.replace(s, `${s}&insEmail=1`) : r.replace(s, `${s}?insEmail=1`);
63
+ if (n.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
64
+ const o = n.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
65
+ const r = e.slice(6, e.length - 1).trim();
66
+ return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
54
67
  });
55
- i = i.replace(e, o);
68
+ i = i.replace(n, o);
56
69
  }
57
70
  }), i;
58
71
  },
@@ -60,5 +73,5 @@ const S = [
60
73
  }
61
74
  ];
62
75
  export {
63
- S as unsubscribeCompilerRules
76
+ T as unsubscribeCompilerRules
64
77
  };
@@ -1 +1 @@
1
- export declare const migrate: (html: string) => string;
1
+ export declare const migrate: (html: string) => Promise<string>;
@@ -1,10 +1,11 @@
1
- import { migrateCheckbox as r } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as o } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as m } from "./couponBlockMigrator.js";
3
- import { migrateRadioButton as e } from "./radioButtonMigrator.js";
4
- const p = (o) => {
5
- let t = o;
6
- return t = r(t), t = e(t), t = m(t), t;
3
+ import { migrateRadioButton as i } from "./radioButtonMigrator.js";
4
+ import { migrateUnsubscribe as e } from "./unsubscribeMigrator.js";
5
+ const c = async (t) => {
6
+ let r = t;
7
+ return r = o(r), r = i(r), r = await e(r), r = m(r), r;
7
8
  };
8
9
  export {
9
- p as migrate
10
+ c as migrate
10
11
  };
@@ -0,0 +1 @@
1
+ export declare function migrateUnsubscribe(html: string): Promise<string>;
@@ -0,0 +1,124 @@
1
+ var h = Object.defineProperty;
2
+ var x = (l, e, t) => e in l ? h(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var S = (l, e, t) => x(l, typeof e != "symbol" ? e + "" : e, t);
4
+ import { MERGE_TAGS as k, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
5
+ import { DATA_ATTRIBUTES as A } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { useUnsubscribeStore as T } from "../../stores/unsubscribe.js";
7
+ class C {
8
+ constructor() {
9
+ S(this, "parser");
10
+ this.parser = new DOMParser();
11
+ }
12
+ async migrate(e) {
13
+ try {
14
+ const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.unsubscribe-block");
15
+ if (!i.length)
16
+ return e;
17
+ const o = T();
18
+ return await o.fetchTemplates(), i.forEach((r) => {
19
+ const c = r.getAttribute("id"), g = this.extractPaddingClass(r), u = r.getAttribute("bgcolor") || "", n = this.extractUnsubscribeContent(r), s = this.getCollectionTypeFromMergeTag(n.linkHref), b = o.getSelectedUnsubscribePagesByCollection(s);
20
+ console.debug("[UnsubscribeMigrator]", {
21
+ mergeTag: n.linkHref,
22
+ collectionType: s,
23
+ pageIds: b,
24
+ paddingClass: g,
25
+ bgColor: u
26
+ });
27
+ const f = this.buildUnsubscribeBlock(
28
+ n,
29
+ s,
30
+ b,
31
+ g,
32
+ u
33
+ ), a = this.parser.parseFromString(
34
+ `<table id="tempDoc"><tbody><tr>${f}</tr></tbody></table>`,
35
+ "text/html"
36
+ ).querySelector(".unsubscribe-block-v2");
37
+ a && r.parentNode && (a.setAttribute("id", c || ""), r.parentNode.replaceChild(a, r));
38
+ }), t.documentElement.outerHTML;
39
+ } catch (t) {
40
+ return console.error("UnsubscribeMigrator failed:", t), e;
41
+ }
42
+ }
43
+ extractPaddingClass(e) {
44
+ const i = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
45
+ return i ? i[0] : "";
46
+ }
47
+ extractUnsubscribeContent(e) {
48
+ var m;
49
+ const t = e.querySelector("p");
50
+ if (!t)
51
+ return {
52
+ textBefore: "You can ",
53
+ linkText: "unsubscribe",
54
+ linkHref: "{{ins-unsubscribe-link}}",
55
+ linkStyle: "",
56
+ textAfter: " from our emails, if you need to.",
57
+ isBold: !1,
58
+ isItalic: !1,
59
+ align: "center",
60
+ paragraphStyle: ""
61
+ };
62
+ const i = e.getAttribute("align") || t.getAttribute("align") || "center", o = t.getAttribute("style") || "", r = t.querySelector("a.unsubscribe-link") || t.querySelector('a[href*="unsubscribe"]');
63
+ if (!r)
64
+ return {
65
+ textBefore: "You can ",
66
+ linkText: "unsubscribe",
67
+ linkHref: "{{ins-unsubscribe-link}}",
68
+ linkStyle: "",
69
+ textAfter: " from our emails, if you need to.",
70
+ isBold: !1,
71
+ isItalic: !1,
72
+ align: i,
73
+ paragraphStyle: o
74
+ };
75
+ const c = ((m = r.textContent) == null ? void 0 : m.trim()) || "unsubscribe", g = r.getAttribute("href") || "{{ins-unsubscribe-link}}", u = r.getAttribute("style") || "", n = t.textContent || "", s = n.indexOf(c), b = s >= 0 ? n.substring(0, s).trim() : "You can ", f = s >= 0 ? n.substring(s + c.length).trim() : " from our emails, if you need to.", d = !!t.querySelector("b, strong"), a = !!t.querySelector("i, em");
76
+ return {
77
+ textBefore: b,
78
+ linkText: c,
79
+ linkHref: this.normalizeUnsubscribeHref(g),
80
+ linkStyle: u,
81
+ textAfter: f,
82
+ isBold: d,
83
+ isItalic: a,
84
+ align: i,
85
+ paragraphStyle: o
86
+ };
87
+ }
88
+ buildUnsubscribeBlock(e, t, i, o, r) {
89
+ const c = e.linkStyle ? ` style="${e.linkStyle}"` : "", u = `<a ${`href="${e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${c}>${e.linkText}</a>`, n = [];
90
+ e.textBefore && n.push(e.textBefore), n.push(u), e.textAfter && n.push(e.textAfter);
91
+ let s = n.join(" ");
92
+ e.isBold && e.isItalic ? s = `<strong path="1,0"><em path="1,0,0">${s}</em></strong>` : e.isBold ? s = `<strong path="1,0">${s}</strong>` : e.isItalic && (s = `<em path="1,0">${s}</em>`);
93
+ const b = e.align ? ` align="${e.align}"` : "", f = r ? ` bgcolor="${r}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", a = i.length > 0 ? ` ${A.PAGE_LIST}="${i.join(",")}"` : "", m = ` ${A.PAGE_TYPE}="${t}"`, y = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
94
+ return `
95
+ <td
96
+ data-migration="true"
97
+ esd-extension-block-id="unsubscribe-block"
98
+ class="${o ? `${y} ${o}` : y}"
99
+ ${b}${f}${m}${a}
100
+ >
101
+ <p path="1"${d}>
102
+ ${s}
103
+ </p>
104
+ </td>
105
+ `;
106
+ }
107
+ getCollectionTypeFromMergeTag(e) {
108
+ return e === k[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === k[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
109
+ }
110
+ normalizeUnsubscribeHref(e) {
111
+ if (Object.values(k).includes(e))
112
+ return e;
113
+ const i = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
114
+ return i ? i[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
115
+ `[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
116
+ ), "{{ins-unsubscribe-link}}") : e;
117
+ }
118
+ }
119
+ async function M(l) {
120
+ return new C().migrate(l);
121
+ }
122
+ export {
123
+ M as migrateUnsubscribe
124
+ };
@@ -4,6 +4,9 @@ const a = {
4
4
  senderName: "",
5
5
  subject: ""
6
6
  },
7
+ extensions: {
8
+ unsubscribe: !0
9
+ },
7
10
  features: {
8
11
  dynamicContent: !0,
9
12
  saveAsTemplate: !0,
@@ -13,7 +16,7 @@ const a = {
13
16
  }, t = {
14
17
  promotional: 1,
15
18
  transactional: 2
16
- }, e = "email", o = "Guido User", n = t.promotional, i = 2, s = {
19
+ }, e = "email", o = "Guido User", n = t.promotional, s = 2, i = {
17
20
  email: 60,
18
21
  architect: 49
19
22
  }, u = [
@@ -53,8 +56,8 @@ export {
53
56
  n as DefaultMessageType,
54
57
  e as DefaultProductType,
55
58
  o as DefaultUsername,
56
- i as EditorType,
57
- s as ProductIds,
59
+ s as EditorType,
60
+ i as ProductIds,
58
61
  u as TEST_PARTNER_LIST,
59
62
  t as TemplateTypes
60
63
  };
@@ -0,0 +1,16 @@
1
+ import type { TextValueObject } from '@@/Types/generic';
2
+ import type { RecommendationFeedItem } from '@@/Types/recommendation';
3
+ export declare const URLS: {
4
+ RECOMMENDATION_API_URL: string;
5
+ };
6
+ export declare const RecommendationFeedSourceMaps: RecommendationFeedItem[];
7
+ export declare const PriceAttributes: string[];
8
+ export declare const currencyLocationMaps: TextValueObject[];
9
+ export declare const currencyOperators: TextValueObject[];
10
+ export declare const currencyDecimalCounts: TextValueObject[];
11
+ export declare const operatorOptionsForStrings: TextValueObject[];
12
+ export declare const operatorOptionsForArrayOfStrings: TextValueObject[];
13
+ export declare const operatorOptionsForNumbers: TextValueObject[];
14
+ export declare const operatorOptionsForDates: TextValueObject[];
15
+ export declare const operatorOptionsForBooleans: TextValueObject[];
16
+ export declare const getOperatorOptions: (type?: string) => TextValueObject[];
@@ -0,0 +1,80 @@
1
+ const s = {
2
+ RECOMMENDATION_API_URL: "http://recommendationv2.api.useinsider.com"
3
+ }, i = [
4
+ { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
5
+ { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
6
+ { id: 13, key: "userBased", name: "User Based", path: "user-based" },
7
+ { id: 36, key: "highestDiscounted", name: "Highest Discounted Items", path: "highest-discounted" },
8
+ { id: 38, key: "manualMerchandising", name: "Manual Merchandising", path: "manual-merchandising" },
9
+ { id: 39, key: "newArrivals", name: "New Arrivals", path: "new-arrivals" },
10
+ { id: 40, key: "trendingProducts", name: "Trending Products", path: "trending" },
11
+ { id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
12
+ { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
13
+ { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
14
+ ], u = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], l = [
15
+ { text: "after the amount", value: "1" },
16
+ { text: "before the amount", value: "0" }
17
+ ], c = [
18
+ { text: "dot(.)", value: "." },
19
+ { text: "comma(,)", value: "," }
20
+ ], d = [
21
+ { text: "0", value: "0" },
22
+ { text: "1", value: "1" },
23
+ { text: "2", value: "2" },
24
+ { text: "3", value: "3" },
25
+ { text: "4", value: "4" },
26
+ { text: "5", value: "5" }
27
+ ], e = [
28
+ { text: "is exactly", value: "=" },
29
+ { text: "contains", value: "~" },
30
+ { text: "does not contain", value: "!~" },
31
+ { text: "any of", value: "||" }
32
+ ], a = [
33
+ { text: "is exactly", value: "=" },
34
+ { text: "is not exactly", value: "!==" },
35
+ { text: "contains", value: "~" },
36
+ { text: "does not contain", value: "!~" },
37
+ { text: "any of", value: "||" }
38
+ ], r = [
39
+ { text: "is equal to", value: "=" },
40
+ { text: "is greater than", value: ">" },
41
+ { text: "is less than", value: "<" }
42
+ ], o = [
43
+ { text: "is equal to", value: "=" },
44
+ { text: "after", value: ">" },
45
+ { text: "before", value: "<" }
46
+ ], n = [
47
+ { text: "true", value: "==" },
48
+ { text: "false", value: "!=" }
49
+ ], p = (t) => {
50
+ if (!t)
51
+ return e;
52
+ switch (t) {
53
+ case "Boolean":
54
+ return n;
55
+ case "Date":
56
+ return o;
57
+ case "Number":
58
+ return r;
59
+ case "String":
60
+ return e;
61
+ case "Strings":
62
+ return a;
63
+ default:
64
+ return e;
65
+ }
66
+ };
67
+ export {
68
+ u as PriceAttributes,
69
+ i as RecommendationFeedSourceMaps,
70
+ s as URLS,
71
+ d as currencyDecimalCounts,
72
+ l as currencyLocationMaps,
73
+ c as currencyOperators,
74
+ p as getOperatorOptions,
75
+ a as operatorOptionsForArrayOfStrings,
76
+ n as operatorOptionsForBooleans,
77
+ o as operatorOptionsForDates,
78
+ r as operatorOptionsForNumbers,
79
+ e as operatorOptionsForStrings
80
+ };
@@ -17,3 +17,22 @@ export declare const DEFAULT_UNSUBSCRIBE_GROUP: {
17
17
  readonly name: "Global Unsubscribe";
18
18
  readonly sendGridId: "G";
19
19
  };
20
+ export declare const ACADEMY_LINK = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center";
21
+ export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
22
+ export declare const PAGE_TYPES: {
23
+ GLOBAL_UNSUBSCRIBE: number;
24
+ GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: number;
25
+ SUBSCRIPTION_PREFERENCE_CENTER: number;
26
+ SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
27
+ RESUBSCRIBE: number;
28
+ };
29
+ export declare const TYPE_COLLECTIONS: {
30
+ [x: number]: number[];
31
+ };
32
+ export declare const TYPE_TRANSLATIONS: {
33
+ [x: number]: string;
34
+ };
35
+ export declare const MERGE_TAGS: {
36
+ [x: number]: string;
37
+ default: string;
38
+ };
@@ -1,21 +1,54 @@
1
- const E = {
1
+ import { useTranslations as e } from "../composables/useTranslations.js";
2
+ const s = e(), R = {
2
3
  UNSUBSCRIBE_LINK_TYPE: 1,
3
4
  PREFERENCES_LINK_TYPE: 3
4
- }, s = {
5
+ }, S = {
5
6
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
6
7
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
7
8
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
8
9
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
9
- }, n = {
10
+ }, N = {
10
11
  UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
11
12
  PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
12
13
  }, _ = {
13
14
  name: "Global Unsubscribe",
14
15
  sendGridId: "G"
16
+ }, I = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
17
+ GLOBAL_UNSUBSCRIBE: 1,
18
+ GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
19
+ SUBSCRIPTION_PREFERENCE_CENTER: 3,
20
+ SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
21
+ RESUBSCRIBE: 5
22
+ }, i = {
23
+ [E.GLOBAL_UNSUBSCRIBE]: [
24
+ E.GLOBAL_UNSUBSCRIBE,
25
+ E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
26
+ E.RESUBSCRIBE
27
+ ],
28
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: [
29
+ E.SUBSCRIPTION_PREFERENCE_CENTER,
30
+ E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
31
+ ]
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 = {
39
+ default: "{{ins-unsubscribe-link}}",
40
+ [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
41
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
42
  };
16
43
  export {
44
+ I as ACADEMY_LINK,
17
45
  _ as DEFAULT_UNSUBSCRIBE_GROUP,
18
- s as LINK_REGEXES,
19
- E as LINK_TYPES,
20
- n as URLS
46
+ S as LINK_REGEXES,
47
+ R as LINK_TYPES,
48
+ C as MERGE_TAGS,
49
+ E as PAGE_TYPES,
50
+ i as TYPE_COLLECTIONS,
51
+ B as TYPE_TRANSLATIONS,
52
+ r as UNSUBSCRIBE_PAGES_LINK,
53
+ N as URLS
21
54
  };
@@ -1,49 +1,45 @@
1
- var E = Object.defineProperty;
2
- var d = (i, r, e) => r in i ? E(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
3
- var u = (i, r, e) => d(i, typeof r != "symbol" ? r + "" : r, e);
4
- import { useHttp as l } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as p } from "../../../enums/unsubscribe.js";
6
- import { Control as L, UIElementType as n, UEAttr as t, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-checkbox", o = "select", { get: C } = l();
8
- class S extends L {
1
+ var d = Object.defineProperty;
2
+ var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
3
+ var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as L } from "../../../composables/useHttp.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as u } from "../../../enums/unsubscribe.js";
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();
8
+ class S extends h {
9
9
  constructor() {
10
10
  super(...arguments);
11
- u(this, "currentNode");
12
- u(this, "selectedUnsubGroup");
13
- u(this, "unsubList", []);
11
+ o(this, "currentNode");
12
+ o(this, "selectedUnsubGroup");
13
+ o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (!this.currentNode || !("getAttribute" in this.currentNode))
20
- return;
21
- const e = this.currentNode.getAttribute("id");
22
- if (e === "G") {
23
- this.selectedUnsubGroup = "G", this.api.updateValues({
24
- [o]: "G"
25
- });
26
- return;
19
+ if (this.currentNode && "getAttribute" in this.currentNode) {
20
+ const e = this.currentNode.getAttribute("id");
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
+ }));
26
+ }
27
27
  }
28
- const s = Number(e);
29
- s && (this.selectedUnsubGroup = s, this.api.updateValues({
30
- [o]: this.selectedUnsubGroup
31
- }));
32
28
  }
33
29
  _getLabel(e, s = `${Math.random()}`) {
34
30
  return `
35
- <${n.LABEL}
31
+ <${i.LABEL}
36
32
  ${t.LABEL.text}="${e}"
37
33
  ${t.LABEL.name}="${s}">
38
- </${n.LABEL}>
34
+ </${i.LABEL}>
39
35
  `;
40
36
  }
41
37
  _getSelectItem(e, s) {
42
38
  return `
43
- <${n.SELECT_ITEM}
39
+ <${i.SELECT_ITEM}
44
40
  ${t.SELECT_ITEM.text}="${e}"
45
41
  ${t.SELECT_ITEM.value}="${s}">
46
- </${n.SELECT_ITEM}>`;
42
+ </${i.SELECT_ITEM}>`;
47
43
  }
48
44
  _getSelect() {
49
45
  return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
@@ -52,25 +48,25 @@ class S extends L {
52
48
  return `
53
49
  <div class="checkbox-controls-container">
54
50
  <div class="checkbox-select-container container two-columns stretch">
55
- <${n.LABEL}
51
+ <${i.LABEL}
56
52
  ${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
57
53
  ${t.LABEL.name}="${Math.random()}">
58
- </${n.LABEL}>
54
+ </${i.LABEL}>
59
55
 
60
- <${n.SELECTPICKER}
61
- ${t.SELECTPICKER.name}="${o}"
56
+ <${i.SELECTPICKER}
57
+ ${t.SELECTPICKER.name}="${a}"
62
58
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
63
59
  ${this._getSelect()}
64
- </${n.SELECTPICKER}>
60
+ </${i.SELECTPICKER}>
65
61
  </div>
66
62
  </div>
67
63
  `;
68
64
  }
69
65
  _onSelectChange(e) {
70
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new h(`Updated text to ${e}`));
66
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
71
67
  }
72
68
  _listenToFormUpdates() {
73
- this.api.onValueChanged(o, (e) => this._onSelectChange(e));
69
+ this.api.onValueChanged(a, (e) => this._onSelectChange(e));
74
70
  }
75
71
  onTemplateNodeUpdated(e) {
76
72
  this.currentNode = e;
@@ -79,14 +75,14 @@ class S extends L {
79
75
  async onRender() {
80
76
  const e = await C(
81
77
  "/unsubscribe-groups/unsubscribe-list"
82
- ), s = [p, ...e.data], c = s.map((a) => ({
83
- [t.SELECT_ITEM.text]: a.name,
84
- [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
85
81
  }));
86
82
  this.unsubList = s, this.api.setUIEAttribute(
87
- o,
83
+ a,
88
84
  t.SELECTPICKER.items,
89
- c
85
+ E
90
86
  ), this._setFormValues(), this._listenToFormUpdates();
91
87
  }
92
88
  }