@useinsider/guido 2.0.0-beta.5ccd854 → 2.0.0-beta.689d09e

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 (77) 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/header/LeftSlot.vue.js +12 -12
  6. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  7. package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
  8. package/dist/composables/useConfig.js +29 -27
  9. package/dist/composables/useSave.js +13 -11
  10. package/dist/composables/useStripo.js +42 -40
  11. package/dist/config/migrator/itemsBlockMigrator.js +184 -125
  12. package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
  13. package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
  14. package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
  15. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
  16. package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
  17. package/dist/extensions/Blocks/Items/block.js +1 -1
  18. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  19. package/dist/extensions/Blocks/Items/controls/cardComposition.js +59 -36
  20. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  21. package/dist/extensions/Blocks/Items/controls/name/trimming.js +25 -25
  22. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +19 -17
  23. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +31 -29
  24. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +44 -38
  25. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +21 -19
  26. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +1 -1
  27. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +93 -0
  28. package/dist/extensions/Blocks/Items/controls/settingsControl.js +99 -95
  29. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  30. package/dist/extensions/Blocks/Items/enums/productEnums.js +43 -45
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -1
  32. package/dist/extensions/Blocks/Items/extension.js +7 -6
  33. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +0 -1
  34. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +0 -1
  35. package/dist/extensions/Blocks/Items/settingsPanel.js +27 -26
  36. package/dist/extensions/Blocks/Items/store/items-block.js +9 -5
  37. package/dist/extensions/Blocks/Items/template.js +285 -221
  38. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +94 -82
  39. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  40. package/dist/extensions/Blocks/common-control.js +45 -57
  41. package/dist/extensions/Blocks/controlFactories.js +139 -118
  42. package/dist/guido.css +1 -1
  43. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +53 -48
  44. package/dist/package.json.js +7 -0
  45. package/dist/services/stripoApi.js +6 -10
  46. package/dist/src/@types/config/index.d.ts +2 -2
  47. package/dist/src/@types/config/schemas.d.ts +30 -0
  48. package/dist/src/@types/config/types.d.ts +7 -1
  49. package/dist/src/composables/useConfig.d.ts +8 -0
  50. package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
  51. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
  52. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
  53. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  54. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +9 -0
  55. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  56. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +18 -0
  57. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  58. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +24 -26
  59. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +1 -0
  60. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  61. package/dist/src/extensions/Blocks/Items/template.d.ts +3 -1
  62. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +4 -2
  63. package/dist/src/extensions/Blocks/common-control.d.ts +1 -7
  64. package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
  65. package/dist/src/stores/config.d.ts +164 -1
  66. package/dist/static/styles/components/button.css.js +1 -1
  67. package/dist/stores/config.js +7 -0
  68. package/dist/utils/pairProductVariables.js +61 -58
  69. package/package.json +1 -1
  70. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  71. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  72. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -67
  73. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  74. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  75. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  76. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  77. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
@@ -1,25 +1,26 @@
1
1
  import { useActionsApi as _ } from "./useActionsApi.js";
2
- import { useBlocksConfig as k } from "./useBlocksConfig.js";
3
- import { useConfig as B } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as A } from "./useStripoEventHandler.js";
6
- import { useToaster as v } 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
- const $ = (a) => {
13
- const { features: d } = B(), { handleError: c } = v(), { getToken: g, getCustomFonts: f } = D(), { handleEvent: y } = A(), { getStripoBlocksConfig: C } = k(), S = async (i, n = []) => {
14
- var p, m;
15
- const o = M(), { html: s, css: t, forceRecreate: h } = i, { baseBlocks: l, extensions: w } = await C(), u = ((p = d.value) == null ? void 0 : p.displayConditions) ?? !0, b = ((m = d.value) == null ? void 0 : m.modulesDisabled) ?? !1;
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;
16
17
  window.UIEditor.initEditor(
17
18
  document.querySelector("#guido-editor"),
18
19
  {
19
- metadata: a,
20
- html: s,
21
- css: t,
22
- forceRecreate: h,
20
+ metadata: c,
21
+ html: r,
22
+ css: p,
23
+ forceRecreate: T,
23
24
  locale: "en",
24
25
  undoButtonSelector: "#guido__undo-button",
25
26
  redoButtonSelector: "#guido__redo-button",
@@ -29,19 +30,19 @@ const $ = (a) => {
29
30
  customAppearanceMergetags: !0,
30
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
31
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
32
- customViewStyles: I,
33
- conditionsEnabled: u,
34
- customConditionsEnabled: u,
35
- conditionCategories: F,
33
+ customViewStyles: U,
34
+ conditionsEnabled: a,
35
+ customConditionsEnabled: a,
36
+ conditionCategories: I,
36
37
  enableXSSSecurity: !0,
37
- modulesDisabled: b,
38
+ modulesDisabled: k,
38
39
  messageSettingsEnabled: !0,
39
40
  displayGmailAnnotations: !0,
40
41
  displayHiddenPreheader: !1,
41
42
  displayTitle: !1,
42
43
  displayUTM: !1,
43
44
  selectElementAfterDrop: !0,
44
- ...l ? { baseBlocks: l } : {},
45
+ ...s ? { baseBlocks: s } : {},
45
46
  editorFonts: {
46
47
  showDefaultStandardFonts: !0,
47
48
  showDefaultNotStandardFonts: !0,
@@ -49,25 +50,25 @@ const $ = (a) => {
49
50
  },
50
51
  mergeTags: [
51
52
  {
52
- entries: U(a.preselectedDynamicContentList)
53
+ entries: R(c.preselectedDynamicContentList)
53
54
  }
54
55
  ],
55
56
  async onTokenRefreshRequest(e) {
56
57
  try {
57
- const r = await g();
58
- e(r);
59
- } catch (r) {
60
- c(r, "Failed to refresh token");
58
+ const d = await C();
59
+ e(d);
60
+ } catch (d) {
61
+ u(d, "Failed to refresh token");
61
62
  }
62
63
  },
63
64
  onTemplateLoaded() {
64
65
  try {
65
- const { importCss: e } = V(), { activateCustomViewStyles: r, updateTimerInClonedTemplate: T } = _();
66
- e(), r(), T(), a.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(() => {
67
68
  o.hasChanges = !1;
68
69
  }, 1e3);
69
70
  } catch (e) {
70
- c(e, "Failed to load custom interface appearance");
71
+ u(e, "Failed to load custom interface appearance");
71
72
  }
72
73
  },
73
74
  onCodeEditorVisibilityChanged(e) {
@@ -82,21 +83,22 @@ const $ = (a) => {
82
83
  onDataChanged() {
83
84
  o.hasChanges = !0;
84
85
  },
85
- onEvent: y,
86
+ onEvent: E,
86
87
  ignoreClickOutsideSelectors: [
87
88
  "#guido-dynamic-content-modal",
88
89
  ".in-on-board-wrapper",
89
90
  ".in-drawer__container"
90
91
  ],
91
- extensions: w
92
+ extensions: t
92
93
  }
93
94
  );
94
- }, E = (i) => new Promise((n, o) => {
95
+ }, b = (i) => new Promise((n, o) => {
96
+ var a;
95
97
  if (document.getElementById("UiEditorScript")) {
96
98
  i(), n();
97
99
  return;
98
100
  }
99
- const s = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", t = document.createElement("script");
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");
100
102
  t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
101
103
  i(), n();
102
104
  }, t.onerror = () => {
@@ -104,12 +106,12 @@ const $ = (a) => {
104
106
  }, document.body.appendChild(t);
105
107
  });
106
108
  return { initPlugin: async (i) => {
107
- await E(async () => {
108
- const n = await f();
109
- await S(i, n);
109
+ await b(async () => {
110
+ const n = await S();
111
+ await w(i, n);
110
112
  });
111
113
  } };
112
114
  };
113
115
  export {
114
- $ as useStripo
116
+ W as useStripo
115
117
  };
@@ -1,122 +1,150 @@
1
- var B = Object.defineProperty;
2
- var q = (o, t, r) => t in o ? B(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r;
3
- var A = (o, t, r) => q(o, typeof t != "symbol" ? t + "" : t, r);
4
- import { productPairs as L } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
- import { ItemInCartOptions as I, DefaultConfigValues as m, SETTINGS_ENUMS as l } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
- import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
7
- const V = {
8
- ins_apr_img: {
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
9
  pairsKey: "imageSrc",
10
10
  defaultKey: "DEFAULT",
11
11
  isArray: !0
12
12
  },
13
- ins_apr_name: {
13
+ name: {
14
14
  pairsKey: "name",
15
15
  defaultKey: "DEFAULT",
16
16
  isArray: !0
17
17
  },
18
- ins_apr_url: {
18
+ url: {
19
19
  pairsKey: "button",
20
20
  defaultKey: "DEFAULT_HREF",
21
21
  isArray: !1
22
22
  },
23
- ins_apr_formattedprice: {
23
+ formattedprice: {
24
24
  pairsKey: "price",
25
25
  defaultKey: "DEFAULT_PRICE_FORMATTED",
26
26
  isArray: !1
27
27
  },
28
- ins_apr_productcurrency: {
28
+ productcurrency: {
29
29
  pairsKey: "price",
30
30
  defaultKey: "DEFAULT_CURRENCY",
31
31
  isArray: !1
32
32
  },
33
- ins_apr_quantity: {
33
+ quantity: {
34
34
  pairsKey: "quantity",
35
35
  defaultKey: "DEFAULT",
36
36
  isArray: !1
37
37
  },
38
- ins_apr_price: {
38
+ price: {
39
39
  pairsKey: "price",
40
40
  defaultKey: "DEFAULT_PRICE",
41
41
  isArray: !1
42
42
  },
43
- ins_apr_originalprice: {
43
+ originalprice: {
44
44
  pairsKey: "originalPrice",
45
45
  defaultKey: "DEFAULT_PRICE",
46
46
  isArray: !1
47
47
  },
48
- ins_apr_originalformattedprice: {
48
+ originalformattedprice: {
49
49
  pairsKey: "originalPrice",
50
50
  defaultKey: "DEFAULT_PRICE_FORMATTED",
51
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
52
72
  }
53
73
  };
54
- function U() {
74
+ function w() {
55
75
  return String(Date.now() + Math.floor(Math.random() * 1e3));
56
76
  }
57
- function F(o) {
58
- return o ? {
59
- CartItems: l.ITEMS_TYPE.CART_ITEMS,
60
- BrowsedItems: l.ITEMS_TYPE.BROWSED_ITEMS,
61
- PurchasedItems: l.ITEMS_TYPE.PURCHASED_ITEMS,
62
- CART_ITEMS: l.ITEMS_TYPE.CART_ITEMS,
63
- BROWSED_ITEMS: l.ITEMS_TYPE.BROWSED_ITEMS,
64
- PURCHASED_ITEMS: l.ITEMS_TYPE.PURCHASED_ITEMS
65
- }[o] || l.ITEMS_TYPE.CART_ITEMS : l.ITEMS_TYPE.CART_ITEMS;
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;
66
86
  }
67
- function D(o) {
68
- const t = (e, a) => e == null ? a : e === "1" || e === "true", r = (e, a) => e || a, c = o["data-type"] || o["data-source"], n = F(c);
69
- let i = o["data-cart_items_select_control_value"] || m.cartItemsSelectControlValue;
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;
70
90
  if (i && !i.includes("{{") && /^\d+$/.test(i)) {
71
- const e = parseInt(i) - 1, a = I[n];
91
+ const e = parseInt(i) - 1, a = E[n];
72
92
  a && a[e] && (i = a[e].value);
73
93
  }
74
94
  return {
75
95
  initialized: !0,
76
- blockInstanceId: r(o["data-block-instance-id"], U()),
96
+ blockInstanceId: o(r["data-block-instance-id"], w()),
77
97
  source: n,
78
98
  type: n,
79
99
  itemsSelectValue: i,
80
- orientation: o["data-card_orientation_control_value"] || l.ORIENTATION.VERTICAL,
81
- nameTrimming: t(o["data-product_name_trimming"], !0),
82
- nameControlEnabled: t(o["data-product_name_control_enabled"], !0),
83
- priceHideDiscount: t(o["data-product_price_hide_discount"], !1),
84
- priceFormatted: t(o["data-product_price_formatted"], !0),
85
- priceCurrencySymbol: r(
86
- o["data-product_price_currency_symbol"],
87
- m.productPriceCurrencySymbolControlValue
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
88
109
  ),
89
- priceCurrencyLocation: r(
90
- o["data-product_price_currency_location"],
91
- m.productPriceCurrencyLocationControlValue
110
+ priceCurrencyLocation: o(
111
+ r["data-product_price_currency_location"],
112
+ g.productPriceCurrencyLocationControlValue
92
113
  ),
93
- priceControlOpened: t(o["data-product_price_control_opened"], !0),
94
- priceOrientation: o["data-product_original_price_control_orientation"] || "horizontal",
95
- quantityControlEnabled: t(o["data-product_quantity_control_enabled"], !0),
96
- buttonLink: r(o["data-product_button_link"], m.productButtonLinkControlValue),
97
- imageLink: r(o["data-product_image_link"], m.productImageLinkControlValue),
98
- buttonLabel: r(o["data-product_button_control_label"], "Buy"),
99
- imageVisible: t(o["data-product_image_visible"], !0),
100
- nameVisible: t(o["data-product_name_visible"], !0),
101
- quantityVisible: t(o["data-product_quantity_visible"], !0),
102
- priceVisible: t(o["data-product_price_visible"], !0),
103
- originalPriceVisible: t(o["data-product_original_price_control_enabled"], !0),
104
- buttonVisible: t(o["data-product_button_visible"], !0)
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)
105
127
  };
106
128
  }
107
- class w {
129
+ const x = {
130
+ ins_apr: "CART_ITEMS",
131
+ browsed_item: "BROWSED_ITEMS",
132
+ purchased_item: "PURCHASED_ITEMS"
133
+ };
134
+ class N {
108
135
  constructor() {
109
- A(this, "parser");
110
- A(this, "DATA_TYPE", "CART_ITEMS");
136
+ v(this, "parser");
111
137
  this.parser = new DOMParser();
112
138
  }
113
139
  migrate(t) {
114
140
  try {
115
- let r = this.removeJinjaConditionals(t);
116
- r = this.replaceTemplateVariables(r);
117
- const c = this.parser.parseFromString(r, "text/html"), n = c.querySelectorAll("td.esd-cart-items-block");
118
- return n.length === 0 ? (console.warn('ItemsBlockMigrator: No blocks found with selector "td.esd-cart-items-block"'), r) : (n.forEach((i) => {
119
- const e = this.extractConfiguration(i), a = K({
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({
120
148
  orientation: e.orientation,
121
149
  itemsType: e.itemsType,
122
150
  itemId: e.itemId,
@@ -130,20 +158,20 @@ class w {
130
158
  priceStyles: e.priceStyles,
131
159
  originalPriceStyles: e.originalPriceStyles,
132
160
  quantityStyles: e.quantityStyles,
133
- nodeConfig: D(e.configBlockAttributes)
134
- }), u = this.parser.parseFromString(
161
+ nodeConfig: R(e.configBlockAttributes)
162
+ }), l = this.parser.parseFromString(
135
163
  `<table><tbody><tr>${a}</tr></tbody></table>`,
136
164
  "text/html"
137
165
  ).querySelector("td");
138
- if (u && i.parentNode) {
139
- const s = D(e.configBlockAttributes);
140
- u.setAttribute("esd-ext-config", JSON.stringify(s));
141
- const p = u.querySelector("esd-config-block");
142
- p && p.remove(), i.parentNode.replaceChild(u, i);
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);
143
171
  }
144
172
  }), c.documentElement.outerHTML);
145
- } catch (r) {
146
- return console.error("ItemsBlockMigrator failed:", r), t;
173
+ } catch (o) {
174
+ return console.error("ItemsBlockMigrator failed:", o), t;
147
175
  }
148
176
  }
149
177
  /**
@@ -153,20 +181,23 @@ class w {
153
181
  * - UI styles from product elements (name, price, button, quantity, etc.)
154
182
  */
155
183
  extractConfiguration(t) {
156
- var E, C, P;
157
- const r = ((E = t.querySelector("[data-type]")) == null ? void 0 : E.getAttribute("data-type")) || "CART_ITEMS", c = ((C = t.querySelector("[data-number]")) == null ? void 0 : C.getAttribute("data-number")) || "1", n = parseInt(c) - 1, i = I[r], e = ((P = i == null ? void 0 : i[n]) == null ? void 0 : P.value) || i[0].value, a = t.querySelector('[product-attr="price"]'), _ = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || void 0, s = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", p = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", y = this.extractConfigBlockAttributes(t, r), f = y["data-product_original_price_control_orientation"] === "vertical" ? "vertical" : "horizontal", d = t.querySelector('a[product-attr="name"]'), v = (d == null ? void 0 : d.getAttribute("style")) || void 0, b = t.querySelector('a[product-attr="button"]'), M = (b == null ? void 0 : b.getAttribute("style")) || void 0, h = (a == null ? void 0 : a.getAttribute("style")) || void 0, S = t.querySelector('[product-attr="originalPrice"]'), R = (S == null ? void 0 : S.getAttribute("style")) || void 0, T = t.querySelector('[product-attr="quantity"]'), k = (T == null ? void 0 : T.getAttribute("style")) || void 0;
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;
158
189
  return {
159
- orientation: f,
160
- itemsType: r,
190
+ orientation: S,
191
+ itemsType: o,
161
192
  itemId: e,
162
- currencySymbol: _,
163
- currencyLocation: s,
164
- formattedPrice: p,
165
- configBlockAttributes: y,
166
- nameStyles: v,
167
- buttonStyles: M,
168
- priceStyles: h,
169
- originalPriceStyles: R,
193
+ currencySymbol: d,
194
+ currencyLocation: f,
195
+ formattedPrice: u,
196
+ configBlockAttributes: s,
197
+ nameStyles: T,
198
+ buttonStyles: m,
199
+ priceStyles: M,
200
+ originalPriceStyles: h,
170
201
  quantityStyles: k
171
202
  };
172
203
  }
@@ -176,7 +207,7 @@ class w {
176
207
  * @param block - The block element containing the esd-config-block
177
208
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
178
209
  */
179
- extractConfigBlockAttributes(t, r) {
210
+ extractConfigBlockAttributes(t, o) {
180
211
  const c = t.querySelector("esd-config-block"), n = {};
181
212
  if (!c)
182
213
  return this.getDefaultConfigBlockAttributes();
@@ -185,17 +216,18 @@ class w {
185
216
  }), n["data-cart_items_select_control_value"]) {
186
217
  const e = n["data-cart_items_select_control_value"];
187
218
  if (/^\d+$/.test(e)) {
188
- const a = parseInt(e) - 1, _ = I[r];
189
- _ && _[a] && (n["data-cart_items_select_control_value"] = _[a].value);
219
+ const a = parseInt(e) - 1, d = E[o];
220
+ d && d[a] && (n["data-cart_items_select_control_value"] = d[a].value);
190
221
  }
191
222
  }
192
223
  if (n["data-product_price_control_curency"]) {
193
224
  const e = n["data-product_price_control_curency"];
194
- e === "before" ? n["data-product_price_control_curency"] = "0" : e === "after" && (n["data-product_price_control_curency"] = "1");
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;
195
227
  }
196
228
  (!n["data-product_price_currency_symbol"] || n["data-product_price_currency_symbol"].trim() === "") && (n["data-product_price_currency_symbol"] = "USD");
197
229
  const i = { ...this.getDefaultConfigBlockAttributes(), ...n };
198
- return i["data-type"] = r, i["data-source"] = r, i;
230
+ return i["data-type"] = o, i["data-source"] = o, i;
199
231
  }
200
232
  /**
201
233
  * Returns default esd-config-block attributes based on the old template structure
@@ -203,81 +235,108 @@ class w {
203
235
  */
204
236
  getDefaultConfigBlockAttributes() {
205
237
  return {
238
+ // Core settings
206
239
  "data-type": "CART_ITEMS",
240
+ "data-card_orientation_control_value": "vertical",
241
+ // Image settings
207
242
  "data-product_image_control_opened": "false",
208
- "data-product_image_control_image-width": "250",
209
- "data-product_image_control_image-height": "250",
243
+ "data-product_image_control_image-width": "70",
244
+ "data-product_image_control_image-height": "70",
210
245
  "data-product_image_control_align_button": "true",
211
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
212
250
  "data-product_name_control_opened": "false",
213
- "data-product_quantity_control_opened": "true",
214
- // DONE
215
- "data-product_quantity_control_enabled": "false",
251
+ "data-product_name_control_enabled": "1",
216
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
217
259
  "data-product_price_control_opened": "false",
218
260
  "data-product_price_control_font_font_size": "20",
219
261
  "data-product_price_control_color": "#060606",
220
262
  "data-product_price_control_curency": "0",
263
+ "data-product_price_currency_location": "0",
221
264
  "data-product_price_currency_symbol": "USD",
222
- "data-product_original_price_control_opened": "false",
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
223
270
  "data-product_original_price_control_font_font_size": "19",
224
271
  "data-product_original_price_control_align_align_desktop": "center",
225
- "data-product_original_price_control_orientation": "vertical",
272
+ "data-product_original_price_control_orientation": "horizontal",
273
+ "data-product_original_price_control_enabled": "true",
274
+ // Button settings
226
275
  "data-product_button_control_opened": "true",
227
- "data-product_button_control_label": "Comprar",
228
- // DONE
276
+ "data-product_button_control_label": "Buy",
229
277
  "data-product_button_control_font_font_size": "17",
230
278
  "data-product_button_control_color": "#ffffff",
231
279
  "data-product_button_control_background": "#010101",
232
- "data-product_button_control_atw": "false",
233
- "data-product_original_price_control_enabled": "false"
280
+ "data-product_button_control_atw": "true",
281
+ "data-product_button_link": "{{Abandoned Cart Item (1) Url}}",
282
+ "data-product_button_visible": "1"
234
283
  };
235
284
  }
236
285
  /**
237
286
  * Removes Jinja2 conditional statements from HTML
238
- * - Removes {% if ins_apr_total_product_kind > N %}
239
- * - Removes {% if ins_apr_price_N != ins_apr_originalprice_N %}
240
- * - Removes {% endif %}
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
241
291
  */
242
292
  removeJinjaConditionals(t) {
243
- let r = t.replace(/\{%\s*if\s+ins_apr_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g, "");
244
- return r = r.replace(/\{%\s*if\s+ins_apr_price_\d+\s*(!&#61;|!=)\s*ins_apr_originalprice_\d+\s*%\}/g, ""), r = r.replace(/\{%\s*endif\s*%\}/g, ""), r = r.replace(/\n\s*\n\s*\n/g, `
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, `
245
301
 
246
- `), r;
302
+ `), o;
247
303
  }
248
304
  /**
249
305
  * Replaces template variables with default values from productPairs
306
+ * Supports all block types by detecting prefix and using appropriate type:
250
307
  *
251
308
  * Examples:
252
- * - {{ins_apr_img_1}} → https://s3.../ins_apr_img_1.jpeg (array-based, uses index 0)
253
- * - {{ins_apr_name_2}} → 'Set of Sprite Yoga Straps' (array-based, uses index 1)
254
- * - {{ins_apr_formattedprice_1}} → '1,100.00' (single value, ignores index)
255
- * - {{ins_apr_url_3}} → '#!' (single value, ignores index)
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)
256
312
  */
257
313
  replaceTemplateVariables(t) {
258
- const { PAIRS_FOR_EXTENSION: r } = L;
314
+ const { PAIRS_FOR_EXTENSION: o } = B;
259
315
  return t.replace(/{{([^}]+)}}/g, (c, n) => {
260
- const i = n.match(/^(ins_apr_[a-z]+)_(\d+)$/);
316
+ const i = n.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
261
317
  if (!i)
262
318
  return c;
263
- const [, e, a] = i, _ = V[e];
264
- if (!_)
265
- return console.warn(`Unknown variable mapping for: ${e}`), c;
266
- const { pairsKey: u, defaultKey: s, isArray: p } = _, y = r[u][this.DATA_TYPE];
267
- if (!y)
268
- return console.warn(`No data found for: ${u}.${this.DATA_TYPE}`), c;
269
- if (p) {
270
- const f = parseInt(a) - 1, d = y[s];
271
- return Array.isArray(d) && d[f] ? d[f] : (console.warn(`Array value not found: ${u}.${this.DATA_TYPE}.${s}[${f}]`), 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);
272
331
  }
273
- const g = y[s];
274
- return g !== void 0 ? String(g) : (console.warn(`Default value not found: ${u}.${this.DATA_TYPE}.${s}`), c);
332
+ const T = p[s];
333
+ return T !== void 0 ? String(T) : (console.warn(`Default value not found: ${u}.${l}.${s}`), c);
275
334
  });
276
335
  }
277
336
  }
278
- function $(o) {
279
- return new w().migrate(o);
337
+ function Y(r) {
338
+ return new N().migrate(r);
280
339
  }
281
340
  export {
282
- $ as migrateItemsBlock
341
+ Y as migrateItemsBlock
283
342
  };
@@ -0,0 +1,4 @@
1
+ var t = /* @__PURE__ */ ((c) => (c.TEXT_ALIGN = "coupon-block-text-align-control", c.TEXT_COLOR = "coupon-block-text-color-control", c.TEXT_SIZE = "coupon-block-text-size-control", c.TEXT_STYLE = "coupon-block-text-style-control", c.TEXT_FONT_FAMILY = "coupon-block-text-font-family-control", c.TEXT_BACKGROUND = "coupon-block-text-background-control", c.TEXT_PADDINGS = "coupon-block-text-paddings-control", c.TEXT_LINE_SPACING = "coupon-block-text-line-spacing-control", c))(t || {});
2
+ export {
3
+ t as CouponControlId
4
+ };
@@ -0,0 +1,29 @@
1
+ import { createTextAlignControl as t, createTextColorControl as e, createTextSizeControl as n, createTextStyleControl as r, createTextFontFamilyControl as T, createTextBackgroundColorControl as l, createPaddingsControl as C, createTextLineSpacingControl as c } from "../../controlFactories.js";
2
+ import { CouponControlId as o } from "../constants.js";
3
+ const i = t(
4
+ o.TEXT_ALIGN
5
+ ), E = e(
6
+ o.TEXT_COLOR
7
+ ), s = n(
8
+ o.TEXT_SIZE
9
+ ), S = r(
10
+ o.TEXT_STYLE
11
+ ), _ = T(
12
+ o.TEXT_FONT_FAMILY
13
+ ), g = l(
14
+ o.TEXT_BACKGROUND
15
+ ), X = C(
16
+ o.TEXT_PADDINGS
17
+ ), d = c(
18
+ o.TEXT_LINE_SPACING
19
+ );
20
+ export {
21
+ i as TextAlignControl,
22
+ g as TextBackgroundControl,
23
+ E as TextColorControl,
24
+ _ as TextFontFamilyControl,
25
+ d as TextLineSpacingControl,
26
+ X as TextPaddingsControl,
27
+ s as TextSizeControl,
28
+ S as TextStyleControl
29
+ };