@useinsider/guido 2.0.0-beta.d2098bd → 2.0.0-beta.d5d845a

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 (105) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +55 -39
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +15 -17
  5. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +8 -8
  6. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +11 -12
  7. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +8 -7
  8. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +12 -14
  9. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +14 -10
  10. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +22 -18
  11. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +17 -0
  12. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +20 -0
  13. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +3 -3
  14. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  15. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +10 -10
  16. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +14 -15
  17. package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
  18. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  19. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -5
  20. package/dist/components/organisms/header/MiddleSlot.vue2.js +13 -14
  21. package/dist/components/organisms/header/RightSlot.vue.js +7 -7
  22. package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
  23. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +15 -15
  24. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
  25. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +19 -20
  26. package/dist/components/wrappers/WpModal.vue.js +3 -4
  27. package/dist/composables/useConfig.js +29 -27
  28. package/dist/composables/useSave.js +13 -11
  29. package/dist/composables/useStripo.js +40 -40
  30. package/dist/config/migrator/index.js +9 -8
  31. package/dist/config/migrator/itemsBlockMigrator.js +342 -0
  32. package/dist/enums/onboarding.js +2 -1
  33. package/dist/enums/unsubscribe.js +21 -20
  34. package/dist/extensions/Blocks/Items/block.js +39 -40
  35. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  36. package/dist/extensions/Blocks/Items/controls/cardComposition.js +66 -46
  37. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  38. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  39. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
  40. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
  41. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +36 -36
  42. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
  43. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
  44. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
  45. package/dist/extensions/Blocks/Items/controls/settingsControl.js +159 -144
  46. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  47. package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
  48. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +4 -3
  49. package/dist/extensions/Blocks/Items/extension.js +7 -6
  50. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -49
  51. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -59
  52. package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
  53. package/dist/extensions/Blocks/Items/store/items-block.js +11 -7
  54. package/dist/extensions/Blocks/Items/template.js +366 -129
  55. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +184 -0
  56. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  57. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  58. package/dist/extensions/Blocks/common-control.js +30 -32
  59. package/dist/extensions/Blocks/controlFactories.js +55 -45
  60. package/dist/guido.css +1 -1
  61. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +364 -285
  62. package/dist/package.json.js +1 -1
  63. package/dist/services/stripoApi.js +6 -10
  64. package/dist/src/@types/config/index.d.ts +2 -2
  65. package/dist/src/@types/config/schemas.d.ts +30 -0
  66. package/dist/src/@types/config/types.d.ts +7 -1
  67. package/dist/src/composables/useConfig.d.ts +8 -0
  68. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  69. package/dist/src/enums/onboarding.d.ts +1 -0
  70. package/dist/src/enums/unsubscribe.d.ts +1 -0
  71. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  72. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
  73. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  74. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  75. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
  76. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  77. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  78. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
  79. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
  80. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  81. package/dist/src/extensions/Blocks/Items/template.d.ts +22 -1
  82. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +73 -0
  83. package/dist/src/extensions/Blocks/common-control.d.ts +10 -11
  84. package/dist/src/stores/config.d.ts +164 -1
  85. package/dist/static/assets/inbox-mockup.svg.js +4 -0
  86. package/dist/static/assets/phone-mockup.svg.js +4 -0
  87. package/dist/static/styles/components/button.css.js +1 -1
  88. package/dist/stores/config.js +7 -0
  89. package/dist/utils/pairProductVariables.js +61 -58
  90. package/package.json +3 -3
  91. package/dist/enums/academy.js +0 -8
  92. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  93. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  94. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
  95. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  96. package/dist/src/enums/academy.d.ts +0 -12
  97. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  98. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  99. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  100. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  101. package/dist/static/assets/desktop/desktop-mockup-center.svg.js +0 -4
  102. package/dist/static/assets/desktop/desktop-mockup-left.svg.js +0 -4
  103. package/dist/static/assets/desktop/desktop-mockup-right.svg.js +0 -4
  104. package/dist/static/assets/mobile/email-mockup.svg.js +0 -4
  105. package/dist/static/assets/mobile/inbox-mockup.svg.js +0 -4
@@ -1,26 +1,26 @@
1
- import { useActionsApi as T } from "./useActionsApi.js";
2
- import { useBlocksConfig as V } from "./useBlocksConfig.js";
3
- import { useConfig as _ } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
6
- import { useToaster as A } from "./useToaster.js";
7
- import { displayConditions as F } from "../enums/displayConditions.js";
8
- import { useStripoApi as D } from "../services/stripoApi.js";
9
- import I from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as M } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
12
- import P from "../package.json.js";
13
- const K = (c) => {
14
- const { features: l } = _(), { handleError: u } = A(), { getToken: y, getCustomFonts: S } = D(), { handleEvent: C } = v(), { getStripoBlocksConfig: E } = V(), h = async (i, n = []) => {
15
- var g, f;
16
- const o = M(), { html: r, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, b = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1;
1
+ import { useActionsApi as _ } from "./useActionsApi.js";
2
+ import { useBlocksConfig as B } from "./useBlocksConfig.js";
3
+ import { useConfig as v } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
6
+ import { useToaster as D } from "./useToaster.js";
7
+ import { displayConditions as I } from "../enums/displayConditions.js";
8
+ import { useStripoApi as M } from "../services/stripoApi.js";
9
+ import U from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as P } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
12
+ import H from "../package.json.js";
13
+ const W = (c) => {
14
+ const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
15
+ var m, g, f;
16
+ const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
20
20
  metadata: c,
21
21
  html: r,
22
22
  css: p,
23
- forceRecreate: a,
23
+ forceRecreate: T,
24
24
  locale: "en",
25
25
  undoButtonSelector: "#guido__undo-button",
26
26
  redoButtonSelector: "#guido__redo-button",
@@ -30,19 +30,19 @@ const K = (c) => {
30
30
  customAppearanceMergetags: !0,
31
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: I,
34
- conditionsEnabled: m,
35
- customConditionsEnabled: m,
36
- conditionCategories: F,
33
+ customViewStyles: U,
34
+ conditionsEnabled: a,
35
+ customConditionsEnabled: a,
36
+ conditionCategories: I,
37
37
  enableXSSSecurity: !0,
38
- modulesDisabled: b,
38
+ modulesDisabled: k,
39
39
  messageSettingsEnabled: !0,
40
40
  displayGmailAnnotations: !0,
41
41
  displayHiddenPreheader: !1,
42
42
  displayTitle: !1,
43
43
  displayUTM: !1,
44
44
  selectElementAfterDrop: !0,
45
- ...t ? { baseBlocks: t } : {},
45
+ ...s ? { baseBlocks: s } : {},
46
46
  editorFonts: {
47
47
  showDefaultStandardFonts: !0,
48
48
  showDefaultNotStandardFonts: !0,
@@ -50,21 +50,21 @@ const K = (c) => {
50
50
  },
51
51
  mergeTags: [
52
52
  {
53
- entries: U(c.preselectedDynamicContentList)
53
+ entries: R(c.preselectedDynamicContentList)
54
54
  }
55
55
  ],
56
56
  async onTokenRefreshRequest(e) {
57
57
  try {
58
- const s = await y();
59
- e(s);
60
- } catch (s) {
61
- u(s, "Failed to refresh token");
58
+ const d = await C();
59
+ e(d);
60
+ } catch (d) {
61
+ u(d, "Failed to refresh token");
62
62
  }
63
63
  },
64
64
  onTemplateLoaded() {
65
65
  try {
66
- const { importCss: e } = B(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: k } = T();
67
- e(), s(), k(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
66
+ const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
67
+ e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
68
68
  o.hasChanges = !1;
69
69
  }, 1e3);
70
70
  } catch (e) {
@@ -83,35 +83,35 @@ const K = (c) => {
83
83
  onDataChanged() {
84
84
  o.hasChanges = !0;
85
85
  },
86
- onEvent: C,
86
+ onEvent: E,
87
87
  ignoreClickOutsideSelectors: [
88
88
  "#guido-dynamic-content-modal",
89
89
  ".in-on-board-wrapper",
90
90
  ".in-drawer__container"
91
91
  ],
92
- extensions: d
92
+ extensions: t
93
93
  }
94
94
  );
95
- }, w = (i) => new Promise((n, o) => {
96
- var d;
95
+ }, b = (i) => new Promise((n, o) => {
96
+ var a;
97
97
  if (document.getElementById("UiEditorScript")) {
98
98
  i(), n();
99
99
  return;
100
100
  }
101
- const r = P.guido, a = `https://email-static.useinsider.com/guido/${(d = r == null ? void 0 : r.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
102
- t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
101
+ const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
102
+ t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
103
103
  i(), n();
104
104
  }, t.onerror = () => {
105
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
+ o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
106
106
  }, document.body.appendChild(t);
107
107
  });
108
108
  return { initPlugin: async (i) => {
109
- await w(async () => {
109
+ await b(async () => {
110
110
  const n = await S();
111
- await h(i, n);
111
+ await w(i, n);
112
112
  });
113
113
  } };
114
114
  };
115
115
  export {
116
- K as useStripo
116
+ W as useStripo
117
117
  };
@@ -1,12 +1,13 @@
1
- import { migrateCheckbox as m } from "./checkboxMigrator.js";
1
+ import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as o } from "./couponBlockMigrator.js";
3
- import { migrateRadioButton as i } from "./radioButtonMigrator.js";
4
- import { migrateRecommendation as e } from "./recommendationMigrator.js";
5
- import { migrateUnsubscribe as a } from "./unsubscribeMigrator.js";
6
- const s = async (t) => {
7
- let r = t;
8
- return r = m(r), r = i(r), r = await a(r), r = o(r), r = e(r), r;
3
+ import { migrateItemsBlock as i } from "./itemsBlockMigrator.js";
4
+ import { migrateRadioButton as e } from "./radioButtonMigrator.js";
5
+ import { migrateRecommendation as a } from "./recommendationMigrator.js";
6
+ import { migrateUnsubscribe as g } from "./unsubscribeMigrator.js";
7
+ const u = async (r) => {
8
+ let m = r;
9
+ return m = t(m), m = e(m), m = await g(m), m = o(m), m = a(m), m = i(m), m;
9
10
  };
10
11
  export {
11
- s as migrate
12
+ u as migrate
12
13
  };
@@ -0,0 +1,342 @@
1
+ var L = Object.defineProperty;
2
+ var K = (r, t, o) => t in r ? L(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o;
3
+ var v = (r, t, o) => K(r, typeof t != "symbol" ? t + "" : t, o);
4
+ import { productPairs as B } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
+ import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as _ } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
+ import { getDefaultTemplate as U } from "../../extensions/Blocks/Items/template.js";
7
+ const q = {
8
+ img: {
9
+ pairsKey: "imageSrc",
10
+ defaultKey: "DEFAULT",
11
+ isArray: !0
12
+ },
13
+ name: {
14
+ pairsKey: "name",
15
+ defaultKey: "DEFAULT",
16
+ isArray: !0
17
+ },
18
+ url: {
19
+ pairsKey: "button",
20
+ defaultKey: "DEFAULT_HREF",
21
+ isArray: !1
22
+ },
23
+ formattedprice: {
24
+ pairsKey: "price",
25
+ defaultKey: "DEFAULT_PRICE_FORMATTED",
26
+ isArray: !1
27
+ },
28
+ productcurrency: {
29
+ pairsKey: "price",
30
+ defaultKey: "DEFAULT_CURRENCY",
31
+ isArray: !1
32
+ },
33
+ quantity: {
34
+ pairsKey: "quantity",
35
+ defaultKey: "DEFAULT",
36
+ isArray: !1
37
+ },
38
+ price: {
39
+ pairsKey: "price",
40
+ defaultKey: "DEFAULT_PRICE",
41
+ isArray: !1
42
+ },
43
+ originalprice: {
44
+ pairsKey: "originalPrice",
45
+ defaultKey: "DEFAULT_PRICE",
46
+ isArray: !1
47
+ },
48
+ originalformattedprice: {
49
+ pairsKey: "originalPrice",
50
+ defaultKey: "DEFAULT_PRICE_FORMATTED",
51
+ isArray: !1
52
+ },
53
+ single_price: {
54
+ pairsKey: "price",
55
+ defaultKey: "DEFAULT_SINGLE_PRICE",
56
+ isArray: !1
57
+ },
58
+ single_formattedprice: {
59
+ pairsKey: "price",
60
+ defaultKey: "DEFAULT_SINGLE_PRICE_FORMATTED",
61
+ isArray: !1
62
+ },
63
+ single_originalprice: {
64
+ pairsKey: "originalPrice",
65
+ defaultKey: "DEFAULT_SINGLE_PRICE",
66
+ isArray: !1
67
+ },
68
+ single_originalformattedprice: {
69
+ pairsKey: "originalPrice",
70
+ defaultKey: "DEFAULT_SINGLE_PRICE_FORMATTED",
71
+ isArray: !1
72
+ }
73
+ };
74
+ function w() {
75
+ return String(Date.now() + Math.floor(Math.random() * 1e3));
76
+ }
77
+ function F(r) {
78
+ return r ? {
79
+ CartItems: _.ITEMS_TYPE.CART_ITEMS,
80
+ BrowsedItems: _.ITEMS_TYPE.BROWSED_ITEMS,
81
+ PurchasedItems: _.ITEMS_TYPE.PURCHASED_ITEMS,
82
+ CART_ITEMS: _.ITEMS_TYPE.CART_ITEMS,
83
+ BROWSED_ITEMS: _.ITEMS_TYPE.BROWSED_ITEMS,
84
+ PURCHASED_ITEMS: _.ITEMS_TYPE.PURCHASED_ITEMS
85
+ }[r] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
86
+ }
87
+ function R(r) {
88
+ const t = (e, a) => e == null ? a : e === "1" || e === "true", o = (e, a) => e || a, c = r["data-type"] || r["data-source"], n = F(c);
89
+ let i = r["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
90
+ if (i && !i.includes("{{") && /^\d+$/.test(i)) {
91
+ const e = parseInt(i) - 1, a = E[n];
92
+ a && a[e] && (i = a[e].value);
93
+ }
94
+ return {
95
+ initialized: !0,
96
+ blockInstanceId: o(r["data-block-instance-id"], w()),
97
+ source: n,
98
+ type: n,
99
+ itemsSelectValue: i,
100
+ orientation: r["data-card_orientation_control_value"] || _.ORIENTATION.VERTICAL,
101
+ nameTrimming: t(r["data-product_name_control_trim"], !0),
102
+ nameControlEnabled: t(r["data-product_name_control_enabled"], !0),
103
+ priceHideDiscount: t(r["data-product_price_control_nodup"], !0),
104
+ priceFormatted: t(r["data-product_price_control_formated"], !0),
105
+ priceSinglePrice: t(r["data-product_price_control_single_price"], !1),
106
+ priceCurrencySymbol: o(
107
+ r["data-product_price_currency_symbol"],
108
+ g.productPriceCurrencySymbolControlValue
109
+ ),
110
+ priceCurrencyLocation: o(
111
+ r["data-product_price_currency_location"],
112
+ g.productPriceCurrencyLocationControlValue
113
+ ),
114
+ priceControlOpened: t(r["data-product_price_control_opened"], !0),
115
+ priceOrientation: r["data-product_original_price_control_orientation"] || "horizontal",
116
+ quantityControlEnabled: t(r["data-product_quantity_control_enabled"], !0),
117
+ buttonLink: o(r["data-product_button_link"], g.productButtonLinkControlValue),
118
+ imageLink: o(r["data-product_image_link"], g.productImageLinkControlValue),
119
+ buttonLabel: o(r["data-product_button_control_label"], "Buy"),
120
+ buttonFullWidth: t(r["data-product_button_control_atw"], !0),
121
+ imageVisible: t(r["data-product_image_control_enabled"], !0),
122
+ nameVisible: t(r["data-product_name_control_enabled"], !0),
123
+ quantityVisible: t(r["data-product_quantity_visible"], !0),
124
+ priceVisible: t(r["data-product_price_visible"], !0),
125
+ originalPriceVisible: t(r["data-product_original_price_control_enabled"], !0),
126
+ buttonVisible: t(r["data-product_button_visible"], !0)
127
+ };
128
+ }
129
+ const x = {
130
+ ins_apr: "CART_ITEMS",
131
+ browsed_item: "BROWSED_ITEMS",
132
+ purchased_item: "PURCHASED_ITEMS"
133
+ };
134
+ class N {
135
+ constructor() {
136
+ v(this, "parser");
137
+ this.parser = new DOMParser();
138
+ }
139
+ migrate(t) {
140
+ try {
141
+ let o = this.removeJinjaConditionals(t);
142
+ o = this.replaceTemplateVariables(o);
143
+ const c = this.parser.parseFromString(o, "text/html"), n = c.querySelectorAll(
144
+ "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
145
+ );
146
+ return n.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), o) : (n.forEach((i) => {
147
+ const e = this.extractConfiguration(i), a = U({
148
+ orientation: e.orientation,
149
+ itemsType: e.itemsType,
150
+ itemId: e.itemId,
151
+ currencySymbol: e.currencySymbol,
152
+ currencyLocation: e.currencyLocation,
153
+ formattedPrice: e.formattedPrice,
154
+ configBlockAttributes: e.configBlockAttributes,
155
+ migrate: !0,
156
+ nameStyles: e.nameStyles,
157
+ buttonStyles: e.buttonStyles,
158
+ priceStyles: e.priceStyles,
159
+ originalPriceStyles: e.originalPriceStyles,
160
+ quantityStyles: e.quantityStyles,
161
+ nodeConfig: R(e.configBlockAttributes)
162
+ }), l = this.parser.parseFromString(
163
+ `<table><tbody><tr>${a}</tr></tbody></table>`,
164
+ "text/html"
165
+ ).querySelector("td");
166
+ if (l && i.parentNode) {
167
+ const f = R(e.configBlockAttributes);
168
+ l.setAttribute("esd-ext-config", JSON.stringify(f));
169
+ const u = l.querySelector("esd-config-block");
170
+ u && u.remove(), i.parentNode.replaceChild(l, i);
171
+ }
172
+ }), c.documentElement.outerHTML);
173
+ } catch (o) {
174
+ return console.error("ItemsBlockMigrator failed:", o), t;
175
+ }
176
+ }
177
+ /**
178
+ * Extracts configuration from legacy HTML block
179
+ * Parses data attributes and structure to determine:
180
+ * - orientation, itemsType, itemNumber, currency settings, esd-config-block attributes
181
+ * - UI styles from product elements (name, price, button, quantity, etc.)
182
+ */
183
+ extractConfiguration(t) {
184
+ var C, D, P;
185
+ const o = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", c = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", n = parseInt(c) - 1, i = E[o], e = ((P = i == null ? void 0 : i[n]) == null ? void 0 : P.value) || i[0].value, a = t.querySelector('[product-attr="price"]'), d = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || "USD", f = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, o), b = s["data-card_orientation_control_value"];
186
+ let S;
187
+ b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
188
+ const p = t.querySelector('a[product-attr="name"]'), T = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, M = (a == null ? void 0 : a.getAttribute("style")) || void 0, A = t.querySelector("p.original-price"), h = (A == null ? void 0 : A.getAttribute("style")) || void 0, I = t.querySelector('[product-attr="quantity"]'), k = (I == null ? void 0 : I.getAttribute("style")) || void 0;
189
+ return {
190
+ orientation: S,
191
+ itemsType: o,
192
+ itemId: e,
193
+ currencySymbol: d,
194
+ currencyLocation: f,
195
+ formattedPrice: u,
196
+ configBlockAttributes: s,
197
+ nameStyles: T,
198
+ buttonStyles: m,
199
+ priceStyles: M,
200
+ originalPriceStyles: h,
201
+ quantityStyles: k
202
+ };
203
+ }
204
+ /**
205
+ * Extracts all data-* attributes from the esd-config-block element
206
+ * Returns a key-value mapping of all configuration attributes
207
+ * @param block - The block element containing the esd-config-block
208
+ * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
209
+ */
210
+ extractConfigBlockAttributes(t, o) {
211
+ const c = t.querySelector("esd-config-block"), n = {};
212
+ if (!c)
213
+ return this.getDefaultConfigBlockAttributes();
214
+ if (Array.from(c.attributes).forEach((e) => {
215
+ e.name.startsWith("data-") && (n[e.name] = e.value);
216
+ }), n["data-cart_items_select_control_value"]) {
217
+ const e = n["data-cart_items_select_control_value"];
218
+ if (/^\d+$/.test(e)) {
219
+ const a = parseInt(e) - 1, d = E[o];
220
+ d && d[a] && (n["data-cart_items_select_control_value"] = d[a].value);
221
+ }
222
+ }
223
+ if (n["data-product_price_control_curency"]) {
224
+ const e = n["data-product_price_control_curency"];
225
+ let a = e;
226
+ e === "before" ? a = "0" : e === "after" && (a = "1"), n["data-product_price_control_curency"] = a, n["data-product_price_currency_location"] = a;
227
+ }
228
+ (!n["data-product_price_currency_symbol"] || n["data-product_price_currency_symbol"].trim() === "") && (n["data-product_price_currency_symbol"] = "USD");
229
+ const i = { ...this.getDefaultConfigBlockAttributes(), ...n };
230
+ return i["data-type"] = o, i["data-source"] = o, i;
231
+ }
232
+ /**
233
+ * Returns default esd-config-block attributes based on the old template structure
234
+ * These serve as fallbacks when attributes are missing
235
+ */
236
+ getDefaultConfigBlockAttributes() {
237
+ return {
238
+ // Core settings
239
+ "data-type": "CART_ITEMS",
240
+ "data-card_orientation_control_value": "vertical",
241
+ // Image settings
242
+ "data-product_image_control_opened": "false",
243
+ "data-product_image_control_image-width": "70",
244
+ "data-product_image_control_image-height": "70",
245
+ "data-product_image_control_align_button": "true",
246
+ "data-product_image_control_padding_mobile": "true",
247
+ "data-product_image_link": "{{Abandoned Cart Item (1) Image}}",
248
+ "data-product_image_control_enabled": "1",
249
+ // Name settings
250
+ "data-product_name_control_opened": "false",
251
+ "data-product_name_control_enabled": "1",
252
+ "data-product_name_control_font_font_size": "20",
253
+ "data-product_name_control_trim": "1",
254
+ // Quantity settings
255
+ "data-product_quantity_control_opened": "true",
256
+ "data-product_quantity_control_enabled": "true",
257
+ "data-product_quantity_visible": "1",
258
+ // Price settings
259
+ "data-product_price_control_opened": "false",
260
+ "data-product_price_control_font_font_size": "20",
261
+ "data-product_price_control_color": "#060606",
262
+ "data-product_price_control_curency": "0",
263
+ "data-product_price_currency_location": "0",
264
+ "data-product_price_currency_symbol": "USD",
265
+ "data-product_price_control_formated": "1",
266
+ "data-product_price_control_nodup": "1",
267
+ "data-product_price_control_single_price": "false",
268
+ "data-product_price_visible": "1",
269
+ // Original price settings
270
+ "data-product_original_price_control_font_font_size": "19",
271
+ "data-product_original_price_control_align_align_desktop": "center",
272
+ "data-product_original_price_control_orientation": "horizontal",
273
+ "data-product_original_price_control_enabled": "true",
274
+ // Button settings
275
+ "data-product_button_control_opened": "true",
276
+ "data-product_button_control_label": "Buy",
277
+ "data-product_button_control_font_font_size": "17",
278
+ "data-product_button_control_color": "#ffffff",
279
+ "data-product_button_control_background": "#010101",
280
+ "data-product_button_control_atw": "true",
281
+ "data-product_button_link": "{{Abandoned Cart Item (1) Url}}",
282
+ "data-product_button_visible": "1"
283
+ };
284
+ }
285
+ /**
286
+ * Removes Jinja2 conditional statements from HTML
287
+ * Handles all items block types:
288
+ * - Cart Items: ins_apr_total_product_kind, ins_apr_price_N, ins_apr_originalprice_N
289
+ * - Browsed Items: browsed_item_total_product_kind, browsed_item_price_N, browsed_item_originalprice_N
290
+ * - Purchased Items: purchased_item_total_product_kind, purchased_item_price_N, purchased_item_originalprice_N
291
+ */
292
+ removeJinjaConditionals(t) {
293
+ let o = t.replace(
294
+ /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
295
+ ""
296
+ );
297
+ return o = o.replace(
298
+ /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
299
+ ""
300
+ ), o = o.replace(/\{%\s*endif\s*%\}/g, ""), o = o.replace(/\n\s*\n\s*\n/g, `
301
+
302
+ `), o;
303
+ }
304
+ /**
305
+ * Replaces template variables with default values from productPairs
306
+ * Supports all block types by detecting prefix and using appropriate type:
307
+ *
308
+ * Examples:
309
+ * - {{ins_apr_img_1}} → https://s3.../img_1.jpeg (CART_ITEMS)
310
+ * - {{browsed_item_name_2}} → 'Set of Sprite Yoga Straps' (BROWSED_ITEMS)
311
+ * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
312
+ */
313
+ replaceTemplateVariables(t) {
314
+ const { PAIRS_FOR_EXTENSION: o } = B;
315
+ return t.replace(/{{([^}]+)}}/g, (c, n) => {
316
+ const i = n.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
317
+ if (!i)
318
+ return c;
319
+ const [, e, a, d] = i, l = x[e];
320
+ if (!l)
321
+ return console.warn(`Unknown variable prefix: ${e}`), c;
322
+ const f = q[a];
323
+ if (!f)
324
+ return console.warn(`Unknown variable suffix mapping for: ${a}`), c;
325
+ const { pairsKey: u, defaultKey: s, isArray: b } = f, p = o[u][l];
326
+ if (!p)
327
+ return console.warn(`No data found for: ${u}.${l}`), c;
328
+ if (b) {
329
+ const y = parseInt(d) - 1, m = p[s];
330
+ return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${u}.${l}.${s}[${y}]`), c);
331
+ }
332
+ const T = p[s];
333
+ return T !== void 0 ? String(T) : (console.warn(`Default value not found: ${u}.${l}.${s}`), c);
334
+ });
335
+ }
336
+ }
337
+ function Y(r) {
338
+ return new N().migrate(r);
339
+ }
340
+ export {
341
+ Y as migrateItemsBlock
342
+ };
@@ -2,8 +2,9 @@ const e = [
2
2
  ".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-0.ng-star-inserted",
3
3
  ".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-1.ng-star-inserted",
4
4
  ".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-2.ng-star-inserted"
5
- ], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]', o = ".in-ribbons-wrapper";
5
+ ], t = "ui-editor", n = 'button[role="tab"][aria-label="Card Composition"]', s = 'button[role="tab"][aria-label="Settings"]', o = ".in-ribbons-wrapper", a = "https://academy.useinsider.com/docs/email-drag-drop-editor";
6
6
  export {
7
+ a as ACADEMY_LINK,
7
8
  n as CARD_COMPOSITION_TAB_SELECTOR,
8
9
  o as RIBBON_SELECTOR,
9
10
  e as SERVICE_HOVER_SELECTORS,
@@ -1,26 +1,26 @@
1
- import { useTranslations as e } from "../composables/useTranslations.js";
1
+ import { useTranslations as n } from "../composables/useTranslations.js";
2
2
  import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const I = {
3
+ const N = {
4
4
  UNSUBSCRIBE_LINK_TYPE: 1,
5
5
  PREFERENCES_LINK_TYPE: 3
6
- }, r = {
6
+ }, I = {
7
7
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
8
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
9
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
10
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), _ = {
11
+ }, s = R(), i = {
12
12
  UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
13
  PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, i = "iid", B = {
14
+ }, _ = "iid", B = {
15
15
  name: "Global Unsubscribe",
16
16
  sendGridId: "G"
17
- }, C = "/email/unsubscribe-pages", E = {
17
+ }, t = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", C = "/email/unsubscribe-pages", E = {
18
18
  GLOBAL_UNSUBSCRIBE: 1,
19
19
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
20
20
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
21
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
22
  RESUBSCRIBE: 5
23
- }, t = {
23
+ }, c = {
24
24
  [E.GLOBAL_UNSUBSCRIBE]: [
25
25
  E.GLOBAL_UNSUBSCRIBE,
26
26
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -31,28 +31,29 @@ const I = {
31
31
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
32
  ]
33
33
  }, U = () => {
34
- const n = e();
34
+ const e = n();
35
35
  return {
36
- [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
37
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
38
- [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
39
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
40
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
36
+ [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
37
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
38
+ [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
39
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
40
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
41
41
  };
42
- }, c = {
42
+ }, o = {
43
43
  default: "{{ins-unsubscribe-link}}",
44
44
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
45
45
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
46
46
  };
47
47
  export {
48
+ t as ACADEMY_LINK,
48
49
  B as DEFAULT_UNSUBSCRIBE_GROUP,
49
- i as INSIDER_ID,
50
- r as LINK_REGEXES,
51
- I as LINK_TYPES,
52
- c as MERGE_TAGS,
50
+ _ as INSIDER_ID,
51
+ I as LINK_REGEXES,
52
+ N as LINK_TYPES,
53
+ o as MERGE_TAGS,
53
54
  E as PAGE_TYPES,
54
- t as TYPE_COLLECTIONS,
55
+ c as TYPE_COLLECTIONS,
55
56
  C as UNSUBSCRIBE_PAGES_LINK,
56
- _ as URLS,
57
+ i as URLS,
57
58
  U as getTypeTranslations
58
59
  };