@useinsider/guido 1.0.3-beta.63e6005 → 1.0.3-beta.671eb65

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 (123) hide show
  1. package/dist/@types/generic.d.ts +6 -1
  2. package/dist/components/Guido.vue.js +7 -7
  3. package/dist/components/Guido.vue2.js +69 -67
  4. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +19 -0
  5. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +28 -0
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +38 -0
  7. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.d.ts +2 -0
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +17 -0
  9. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +37 -0
  10. package/dist/components/organisms/extensions/recommendation/Filters.vue.d.ts +2 -0
  11. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +20 -0
  12. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +44 -0
  13. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.d.ts +16 -0
  14. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.js +17 -0
  15. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +27 -0
  16. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
  17. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +12 -13
  18. package/dist/composables/useStripo.js +25 -21
  19. package/dist/config/compiler/unsubscribeCompilerRules.js +39 -26
  20. package/dist/config/migrator/couponBlockMigrator.d.ts +1 -0
  21. package/dist/config/migrator/couponBlockMigrator.js +67 -0
  22. package/dist/config/migrator/index.js +7 -6
  23. package/dist/config/migrator/unsubscribeMigrator.js +61 -49
  24. package/dist/enums/extensions/recommendationBlock.d.ts +16 -0
  25. package/dist/enums/extensions/recommendationBlock.js +80 -0
  26. package/dist/enums/unsubscribe.d.ts +4 -0
  27. package/dist/enums/unsubscribe.js +15 -11
  28. package/dist/extensions/Blocks/Checkbox/block.d.ts +1 -0
  29. package/dist/extensions/Blocks/Checkbox/block.js +15 -24
  30. package/dist/extensions/Blocks/Checkbox/control.js +55 -67
  31. package/dist/extensions/Blocks/Checkbox/extension.js +5 -16
  32. package/dist/extensions/Blocks/Checkbox/iconsRegistry.d.ts +4 -0
  33. package/dist/extensions/Blocks/Checkbox/iconsRegistry.js +18 -0
  34. package/dist/extensions/Blocks/Checkbox/settingsPanel.js +12 -25
  35. package/dist/extensions/Blocks/Checkbox/template.js +5 -16
  36. package/dist/extensions/Blocks/CouponBlock/block.d.ts +12 -0
  37. package/dist/extensions/Blocks/CouponBlock/block.js +33 -0
  38. package/dist/extensions/Blocks/CouponBlock/extension.d.ts +2 -0
  39. package/dist/extensions/Blocks/CouponBlock/extension.js +8 -0
  40. package/dist/extensions/Blocks/CouponBlock/iconsRegistry.d.ts +4 -0
  41. package/dist/extensions/Blocks/CouponBlock/iconsRegistry.js +33 -0
  42. package/dist/extensions/Blocks/CouponBlock/settingsPanel.d.ts +4 -0
  43. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +24 -0
  44. package/dist/extensions/Blocks/CouponBlock/template.d.ts +3 -0
  45. package/dist/extensions/Blocks/CouponBlock/template.js +18 -0
  46. package/dist/extensions/Blocks/RadioButton/block.d.ts +1 -0
  47. package/dist/extensions/Blocks/RadioButton/block.js +13 -22
  48. package/dist/extensions/Blocks/RadioButton/control.js +40 -52
  49. package/dist/extensions/Blocks/RadioButton/extension.js +4 -15
  50. package/dist/extensions/Blocks/RadioButton/iconsRegistry.d.ts +4 -0
  51. package/dist/extensions/Blocks/RadioButton/iconsRegistry.js +14 -0
  52. package/dist/extensions/Blocks/RadioButton/settingsPanel.js +13 -26
  53. package/dist/extensions/Blocks/RadioButton/template.js +13 -24
  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 +1 -0
  72. package/dist/extensions/Blocks/Unsubscribe/block.js +28 -41
  73. package/dist/extensions/Blocks/Unsubscribe/control.js +43 -56
  74. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +12 -24
  75. package/dist/extensions/Blocks/Unsubscribe/extension.js +10 -21
  76. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.d.ts +4 -0
  77. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.js +21 -0
  78. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +27 -24
  79. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.js +6 -18
  80. package/dist/extensions/Blocks/Unsubscribe/template.js +9 -20
  81. package/dist/extensions/Blocks/_Boilerplate/block.d.ts +1 -0
  82. package/dist/extensions/Blocks/_Boilerplate/iconsRegistry.d.ts +4 -0
  83. package/dist/extensions/Blocks/common-control.d.ts +66 -0
  84. package/dist/extensions/Blocks/common-control.js +102 -0
  85. package/dist/extensions/DynamicContent/dynamic-content.js +31 -45
  86. package/dist/extensions/DynamicContent/extension.js +6 -18
  87. package/dist/guido.css +1 -1
  88. package/dist/mock/api/recommendation.d.ts +2 -0
  89. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +659 -0
  90. package/dist/services/recommendationApi.d.ts +6 -0
  91. package/dist/services/recommendationApi.js +43 -0
  92. package/dist/stores/config.d.ts +96 -0
  93. package/dist/stores/config.js +17 -0
  94. package/dist/stores/editor.d.ts +21 -0
  95. package/dist/stores/editor.js +2 -1
  96. package/dist/stores/unsubscribe.d.ts +72 -2
  97. package/dist/stores/unsubscribe.js +43 -42
  98. package/dist/utils/genericUtil.d.ts +1 -0
  99. package/dist/utils/genericUtil.js +8 -7
  100. package/dist/utils/templatePreparation.js +17 -16
  101. package/package.json +3 -3
  102. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +0 -75
  103. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +0 -77
  104. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +0 -123
  105. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +0 -7
  106. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +0 -7
  107. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js +0 -12
  108. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +0 -7
  109. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +0 -119
  110. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +0 -7
  111. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +0 -7
  112. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +0 -7
  113. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js +0 -12
  114. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +0 -7
  115. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +0 -7
  116. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +0 -7
  117. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +0 -25
  118. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +0 -24
  119. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +0 -11
  120. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +0 -33
  121. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +0 -22
  122. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +0 -40
  123. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +0 -5
@@ -1,19 +1,21 @@
1
1
  import { useActionsApi as f } from "./useActionsApi.js";
2
- import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
3
- import { useStripoEventHandler as E } from "./useStripoEventHandler.js";
2
+ import { useCustomInterfaceAppearance as E } from "./useCustomInterfaceAppearance.js";
3
+ import { useStripoEventHandler as S } from "./useStripoEventHandler.js";
4
4
  import { useToaster as C } from "./useToaster.js";
5
5
  import { displayConditions as y } from "../enums/displayConditions.js";
6
6
  import h from "../extensions/Blocks/Checkbox/extension.js";
7
- import w from "../extensions/Blocks/RadioButton/extension.js";
8
- import b from "../extensions/Blocks/Unsubscribe/extension.js";
9
- import _ from "../extensions/DynamicContent/extension.js";
10
- import { useStripoApi as k } from "../services/stripoApi.js";
11
- import B from "../static/styles/customEditorStyle.css.js";
12
- import { useEditorStore as V } from "../stores/editor.js";
13
- import { dynamicContentToMergeTags as F } from "../utils/genericUtil.js";
14
- const j = (s) => {
15
- const { handleError: d } = C(), { getToken: c, getCustomFonts: u } = k(), { handleEvent: l } = E(), m = (r, i = []) => {
16
- const t = V(), { html: e, css: a, forceRecreate: g } = r;
7
+ import w from "../extensions/Blocks/CouponBlock/extension.js";
8
+ import b from "../extensions/Blocks/RadioButton/extension.js";
9
+ import _ from "../extensions/Blocks/Recommendation/extension.js";
10
+ import k from "../extensions/Blocks/Unsubscribe/extension.js";
11
+ import B from "../extensions/DynamicContent/extension.js";
12
+ import { useStripoApi as V } from "../services/stripoApi.js";
13
+ import x from "../static/styles/customEditorStyle.css.js";
14
+ import { useEditorStore as F } from "../stores/editor.js";
15
+ import { dynamicContentToMergeTags as A } from "../utils/genericUtil.js";
16
+ const G = (s) => {
17
+ const { handleError: d } = C(), { getToken: c, getCustomFonts: u } = V(), { handleEvent: m } = S(), l = (r, i = []) => {
18
+ const t = F(), { html: e, css: a, forceRecreate: g } = r;
17
19
  window.UIEditor.initEditor(
18
20
  document.querySelector("#guido-editor"),
19
21
  {
@@ -30,7 +32,7 @@ const j = (s) => {
30
32
  customAppearanceMergetags: !0,
31
33
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
34
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: B,
35
+ customViewStyles: x,
34
36
  conditionsEnabled: !0,
35
37
  customConditionsEnabled: !0,
36
38
  conditionCategories: y,
@@ -44,7 +46,7 @@ const j = (s) => {
44
46
  },
45
47
  mergeTags: [
46
48
  {
47
- entries: F(s.preselectedDynamicContentList)
49
+ entries: A(s.preselectedDynamicContentList)
48
50
  }
49
51
  ],
50
52
  async onTokenRefreshRequest(o) {
@@ -57,7 +59,7 @@ const j = (s) => {
57
59
  },
58
60
  onTemplateLoaded() {
59
61
  try {
60
- const { importCss: o } = S(), { activateCustomViewStyles: n } = f();
62
+ const { importCss: o } = E(), { activateCustomViewStyles: n } = f();
61
63
  o(), n(), s.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
62
64
  t.hasChanges = !1;
63
65
  }, 1e3);
@@ -77,17 +79,19 @@ const j = (s) => {
77
79
  onDataChanged() {
78
80
  t.hasChanges = !0;
79
81
  },
80
- onEvent: l,
82
+ onEvent: m,
81
83
  ignoreClickOutsideSelectors: [
82
84
  "#guido-dynamic-content-modal",
83
85
  ".in-on-board-wrapper",
84
86
  ".in-drawer__container"
85
87
  ],
86
88
  extensions: [
87
- _,
89
+ B,
88
90
  h,
89
- w,
90
- b
91
+ b,
92
+ _,
93
+ k,
94
+ w
91
95
  ]
92
96
  }
93
97
  );
@@ -107,10 +111,10 @@ const j = (s) => {
107
111
  return { initPlugin: async (r) => {
108
112
  await p(async () => {
109
113
  const i = await u();
110
- m(r, i);
114
+ l(r, i);
111
115
  });
112
116
  } };
113
117
  };
114
118
  export {
115
- j as useStripo
119
+ G as useStripo
116
120
  };
@@ -1,23 +1,36 @@
1
- import { usePartner as m } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as l, LINK_TYPES as p, URLS as d } 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
11
  processor: (t) => {
10
- var a, u;
11
- const { getPartnerName: n } = m(), i = b();
12
- let e = t;
13
- const c = `/${n()}/email/0?user={{iid}}`, r = (a = i.templates) == null ? void 0 : a.find((o) => i.selectedUnsubscribePages.includes(o.id) && o.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = i.templates) == null ? void 0 : u.find((o) => i.selectedUnsubscribePages.includes(o.id) && o.type === p.PREFERENCES_LINK_TYPE);
14
- return r && (e = e.replace(
15
- l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
16
- d.UNSUBSCRIBE_URL + c
17
- )), s && (e = e.replace(
18
- l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
19
- d.PREFERENCES_URL + c
20
- )), e.replace(l.UNSUBSCRIBE_LINK_REGEX, "");
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
  },
@@ -42,23 +55,23 @@ const S = [
42
55
  description: "Adding universal link flags",
43
56
  type: "custom",
44
57
  processor: (t) => {
45
- let n = t;
46
- const i = n.match(/<a[^>]+>(.*?)<\/a>/gm);
47
- return i && i.forEach((e) => {
48
- if (e.includes("insEmail=1"))
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 c = 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
- n = n.replace(e, c);
68
+ i = i.replace(n, o);
56
69
  }
57
- }), n;
70
+ }), i;
58
71
  },
59
72
  priority: 63
60
73
  }
61
74
  ];
62
75
  export {
63
- S as unsubscribeCompilerRules
76
+ T as unsubscribeCompilerRules
64
77
  };
@@ -0,0 +1 @@
1
+ export declare function migrateCouponBlock(html: string): string;
@@ -0,0 +1,67 @@
1
+ var k = Object.defineProperty;
2
+ var m = (o, t, e) => t in o ? k(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var x = (o, t, e) => m(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import h from "../../extensions/Blocks/CouponBlock/template.js";
5
+ class y {
6
+ constructor() {
7
+ x(this, "parser");
8
+ this.parser = new DOMParser();
9
+ }
10
+ migrate(t) {
11
+ try {
12
+ const e = this.parser.parseFromString(t, "text/html"), n = e.querySelectorAll("td.coupon-block.ins-coupon-code:not([esd-extension-block-id])");
13
+ return n.length === 0 ? t : (n.forEach((s) => {
14
+ const i = this.extractText(s), c = this.extractAttributes(s), l = h.replace("{@COUPON_CODE}", i).replace(
15
+ 'class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"',
16
+ c.class
17
+ ).replace(
18
+ 'esd-extension-block-id="coupon-block"',
19
+ `esd-extension-block-id="coupon-block"${c.block}`
20
+ ).replace(
21
+ '<p class="ins-title"',
22
+ `<p class="ins-title"${c.text}`
23
+ );
24
+ s.outerHTML = l;
25
+ }), e.documentElement.outerHTML);
26
+ } catch (e) {
27
+ return console.error("CouponBlockMigrator failed:", e), t;
28
+ }
29
+ }
30
+ extractText(t) {
31
+ var g;
32
+ const e = t.querySelector(".ins-title");
33
+ if (!e)
34
+ return "{@COUPON_CODE}";
35
+ const n = ((g = e.textContent) == null ? void 0 : g.trim()) || "{@COUPON_CODE}", s = e.getAttribute("style") || "", i = /font-weight\s*:\s*bold/i.test(s), c = /font-style\s*:\s*italic/i.test(s), l = /text-decoration[^;]*underline/i.test(s), u = /text-decoration[^;]*line-through/i.test(s), a = /vertical-align\s*:\s*sub/i.test(s), p = /vertical-align\s*:\s*super/i.test(s);
36
+ return [
37
+ [i, "strong"],
38
+ [c, "em"],
39
+ [l, "u"],
40
+ [u, "s"],
41
+ [a, "sub"],
42
+ [p, "sup"]
43
+ ].reduce((b, [f, d]) => f ? `<${d}>${b}</${d}>` : b, n);
44
+ }
45
+ extractAttributes(t) {
46
+ const e = t.querySelector(".ins-title"), n = t.className.split(" ").filter((r) => r.startsWith("es-")), s = t.getAttribute("align"), i = t.getAttribute("bgcolor"), c = t.getAttribute("style"), l = e == null ? void 0 : e.getAttribute("style");
47
+ let u = 'class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block';
48
+ n.length && (u += ` ${n.join(" ")}`), u += '"';
49
+ let a = "";
50
+ if (s && (a += ` align="${s}"`), i && (a += ` bgcolor="${i}"`), c) {
51
+ const r = c.replace(/background-color[^;]+;?/gi, "").replace(/;+/g, ";").trim();
52
+ r && (a += ` style="${r.replace(/"/g, "'")}"`);
53
+ }
54
+ let p = "";
55
+ if (l) {
56
+ const r = l.replace(/&quot;/g, '"').replace(/font-weight\s*:\s*[^;]+;?/gi, "").replace(/font-style\s*:\s*[^;]+;?/gi, "").replace(/text-decoration\s*:\s*[^;]+;?/gi, "").replace(/vertical-align\s*:\s*[^;]+;?/gi, "").replace(/;+/g, ";").replace(/^;|;$/g, "").trim().replace(/"/g, "'");
57
+ r && (p = ` style="${r}"`);
58
+ }
59
+ return { class: u, block: a, text: p };
60
+ }
61
+ }
62
+ function C(o) {
63
+ return new y().migrate(o);
64
+ }
65
+ export {
66
+ C as migrateCouponBlock
67
+ };
@@ -1,10 +1,11 @@
1
- import { migrateCheckbox as m } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as o } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as m } from "./couponBlockMigrator.js";
2
3
  import { migrateRadioButton as i } from "./radioButtonMigrator.js";
3
- import { migrateUnsubscribe as o } from "./unsubscribeMigrator.js";
4
- const n = async (r) => {
5
- let t = r;
6
- return t = m(t), t = i(t), t = await o(t), t;
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
- n as migrate
10
+ c as migrate
10
11
  };
@@ -1,37 +1,49 @@
1
- var A = Object.defineProperty;
2
- var T = (l, e, t) => e in l ? A(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var d = (l, e, t) => T(l, typeof e != "symbol" ? e + "" : e, t);
4
- import { MERGE_TAGS as p, PAGE_TYPES as g } from "../../enums/unsubscribe.js";
5
- import { DATA_ATTRIBUTES as y } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { useUnsubscribeStore as x } from "../../stores/unsubscribe.js";
7
- class h {
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
8
  constructor() {
9
- d(this, "parser");
9
+ S(this, "parser");
10
10
  this.parser = new DOMParser();
11
11
  }
12
12
  async migrate(e) {
13
13
  try {
14
- const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll("td.unsubscribe-block");
15
- if (!s.length)
14
+ const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.unsubscribe-block");
15
+ if (!i.length)
16
16
  return e;
17
- const u = x();
18
- return await u.fetchTemplates(), s.forEach((i) => {
19
- const a = i.getAttribute("id"), n = this.extractUnsubscribeContent(i), r = this.getCollectionTypeFromMergeTag(n.linkHref), o = u.getSelectedUnsubscribePagesByCollection(r);
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
20
  console.debug("[UnsubscribeMigrator]", {
21
21
  mergeTag: n.linkHref,
22
- collectionType: r,
23
- pageIds: o
22
+ collectionType: s,
23
+ pageIds: b,
24
+ paddingClass: g,
25
+ bgColor: u
24
26
  });
25
- const c = this.buildUnsubscribeBlock(n, r, o), b = this.parser.parseFromString(
26
- `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
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>`,
27
35
  "text/html"
28
36
  ).querySelector(".unsubscribe-block-v2");
29
- b && i.parentNode && (b.setAttribute("id", a || ""), i.parentNode.replaceChild(b, i));
37
+ a && r.parentNode && (a.setAttribute("id", c || ""), r.parentNode.replaceChild(a, r));
30
38
  }), t.documentElement.outerHTML;
31
39
  } catch (t) {
32
40
  return console.error("UnsubscribeMigrator failed:", t), e;
33
41
  }
34
42
  }
43
+ extractPaddingClass(e) {
44
+ const i = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
45
+ return i ? i[0] : "";
46
+ }
35
47
  extractUnsubscribeContent(e) {
36
48
  var m;
37
49
  const t = e.querySelector("p");
@@ -47,8 +59,8 @@ class h {
47
59
  align: "center",
48
60
  paragraphStyle: ""
49
61
  };
50
- const s = e.getAttribute("align") || t.getAttribute("align") || "center", u = t.getAttribute("style") || "", i = t.querySelector("a.unsubscribe-link") || t.querySelector('a[href*="unsubscribe"]');
51
- if (!i)
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)
52
64
  return {
53
65
  textBefore: "You can ",
54
66
  linkText: "unsubscribe",
@@ -57,56 +69,56 @@ class h {
57
69
  textAfter: " from our emails, if you need to.",
58
70
  isBold: !1,
59
71
  isItalic: !1,
60
- align: s,
61
- paragraphStyle: u
72
+ align: i,
73
+ paragraphStyle: o
62
74
  };
63
- const a = ((m = i.textContent) == null ? void 0 : m.trim()) || "unsubscribe", n = i.getAttribute("href") || "{{ins-unsubscribe-link}}", r = i.getAttribute("style") || "", o = t.textContent || "", c = o.indexOf(a), f = c >= 0 ? o.substring(0, c).trim() : "You can ", b = c >= 0 ? o.substring(c + a.length).trim() : " from our emails, if you need to.", k = !!t.querySelector("b, strong"), S = !!t.querySelector("i, em");
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");
64
76
  return {
65
- textBefore: f,
66
- linkText: a,
67
- linkHref: this.normalizeUnsubscribeHref(n),
68
- linkStyle: r,
69
- textAfter: b,
70
- isBold: k,
71
- isItalic: S,
72
- align: s,
73
- paragraphStyle: u
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
74
86
  };
75
87
  }
76
- buildUnsubscribeBlock(e, t, s) {
77
- const u = e.linkStyle ? ` style="${e.linkStyle}"` : "", a = `<a ${`href="${e.linkHref}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${u}>${e.linkText}</a>`, n = [];
78
- e.textBefore && n.push(e.textBefore), n.push(a), e.textAfter && n.push(e.textAfter);
79
- let r = n.join(" ");
80
- e.isBold && e.isItalic ? r = `<strong path="1,0"><em path="1,0,0">${r}</em></strong>` : e.isBold ? r = `<strong path="1,0">${r}</strong>` : e.isItalic && (r = `<em path="1,0">${r}</em>`);
81
- const o = e.align ? ` align="${e.align}"` : "", c = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", f = s.length > 0 ? ` ${y.PAGE_LIST}="${s.join(",")}"` : "", b = ` ${y.PAGE_TYPE}="${t}"`;
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";
82
94
  return `
83
95
  <td
84
96
  data-migration="true"
85
97
  esd-extension-block-id="unsubscribe-block"
86
- class="esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block"
87
- ${o}${b}${f}
98
+ class="${o ? `${y} ${o}` : y}"
99
+ ${b}${f}${m}${a}
88
100
  >
89
- <p path="1"${c}>
90
- ${r}
101
+ <p path="1"${d}>
102
+ ${s}
91
103
  </p>
92
104
  </td>
93
105
  `;
94
106
  }
95
107
  getCollectionTypeFromMergeTag(e) {
96
- return e === p[g.SUBSCRIPTION_PREFERENCE_CENTER] ? g.SUBSCRIPTION_PREFERENCE_CENTER : e === p[g.GLOBAL_UNSUBSCRIBE] ? g.GLOBAL_UNSUBSCRIBE : g.GLOBAL_UNSUBSCRIBE;
108
+ return e === k[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === k[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
97
109
  }
98
110
  normalizeUnsubscribeHref(e) {
99
- if (Object.values(p).includes(e))
111
+ if (Object.values(k).includes(e))
100
112
  return e;
101
- const s = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
102
- return s ? s[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
113
+ const i = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
114
+ return i ? i[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
103
115
  `[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
104
116
  ), "{{ins-unsubscribe-link}}") : e;
105
117
  }
106
118
  }
107
- async function $(l) {
108
- return new h().migrate(l);
119
+ async function M(l) {
120
+ return new C().migrate(l);
109
121
  }
110
122
  export {
111
- $ as migrateUnsubscribe
123
+ M as migrateUnsubscribe
112
124
  };
@@ -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
+ };
@@ -13,6 +13,10 @@ export declare const URLS: {
13
13
  PREFERENCES_URL: string;
14
14
  };
15
15
  export declare const INSIDER_ID = "iid";
16
+ export declare const DEFAULT_UNSUBSCRIBE_GROUP: {
17
+ readonly name: "Global Unsubscribe";
18
+ readonly sendGridId: "G";
19
+ };
16
20
  export declare const ACADEMY_LINK = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center";
17
21
  export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
18
22
  export declare const PAGE_TYPES: {
@@ -1,5 +1,5 @@
1
1
  import { useTranslations as e } from "../composables/useTranslations.js";
2
- const s = e(), n = {
2
+ const s = e(), R = {
3
3
  UNSUBSCRIBE_LINK_TYPE: 1,
4
4
  PREFERENCES_LINK_TYPE: 3
5
5
  }, S = {
@@ -10,13 +10,16 @@ const s = e(), n = {
10
10
  }, N = {
11
11
  UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
12
12
  PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
13
- }, _ = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", I = "/email/unsubscribe-pages", E = {
13
+ }, _ = {
14
+ name: "Global Unsubscribe",
15
+ sendGridId: "G"
16
+ }, I = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", r = "/email/unsubscribe-pages", E = {
14
17
  GLOBAL_UNSUBSCRIBE: 1,
15
18
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
16
19
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
17
20
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
18
21
  RESUBSCRIBE: 5
19
- }, r = {
22
+ }, i = {
20
23
  [E.GLOBAL_UNSUBSCRIBE]: [
21
24
  E.GLOBAL_UNSUBSCRIBE,
22
25
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -26,25 +29,26 @@ const s = e(), n = {
26
29
  E.SUBSCRIPTION_PREFERENCE_CENTER,
27
30
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
28
31
  ]
29
- }, i = {
32
+ }, B = {
30
33
  [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
31
34
  [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
32
35
  [E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
33
36
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
34
37
  [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
35
- }, B = {
38
+ }, C = {
36
39
  default: "{{ins-unsubscribe-link}}",
37
40
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
38
41
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
39
42
  };
40
43
  export {
41
- _ as ACADEMY_LINK,
44
+ I as ACADEMY_LINK,
45
+ _ as DEFAULT_UNSUBSCRIBE_GROUP,
42
46
  S as LINK_REGEXES,
43
- n as LINK_TYPES,
44
- B as MERGE_TAGS,
47
+ R as LINK_TYPES,
48
+ C as MERGE_TAGS,
45
49
  E as PAGE_TYPES,
46
- r as TYPE_COLLECTIONS,
47
- i as TYPE_TRANSLATIONS,
48
- I as UNSUBSCRIBE_PAGES_LINK,
50
+ i as TYPE_COLLECTIONS,
51
+ B as TYPE_TRANSLATIONS,
52
+ r as UNSUBSCRIBE_PAGES_LINK,
49
53
  N as URLS
50
54
  };
@@ -1,6 +1,7 @@
1
1
  import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
2
2
  export declare const CHECKBOX_BLOCK_ID = "checkbox-block";
3
3
  export declare class CheckboxBlock extends Block {
4
+ constructor();
4
5
  getId(): string;
5
6
  getIcon(): string;
6
7
  getBlockCompositionType(): BlockCompositionType;