@useinsider/guido 2.1.0-beta.bc229b1 → 2.1.0-beta.bcfc012

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 (27) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +12 -10
  2. package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
  3. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +21 -0
  4. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +38 -0
  5. package/dist/config/i18n/en/labels.json.js +8 -3
  6. package/dist/config/migrator/itemsBlockMigrator.js +136 -134
  7. package/dist/config/migrator/recommendationMigrator.js +42 -40
  8. package/dist/extensions/Blocks/Items/block.js +45 -25
  9. package/dist/extensions/Blocks/Items/iconsRegistry.js +40 -5
  10. package/dist/extensions/Blocks/Items/items.css.js +48 -0
  11. package/dist/extensions/Blocks/Recommendation/block.js +49 -29
  12. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +37 -2
  13. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +48 -0
  14. package/dist/extensions/Blocks/common-control.js +12 -4
  15. package/dist/guido.css +1 -1
  16. package/dist/src/components/Guido.vue.d.ts +1 -1
  17. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  18. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  19. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +5 -0
  20. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  21. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  22. package/dist/src/extensions/Blocks/Items/block.d.ts +1 -0
  23. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  24. package/dist/src/extensions/Blocks/common-control.d.ts +5 -0
  25. package/dist/src/stores/template.d.ts +3 -0
  26. package/dist/stores/template.js +9 -0
  27. package/package.json +1 -1
@@ -1,21 +1,23 @@
1
- import l from "./EditorActions.vue2.js";
1
+ import r from "./EditorActions.vue2.js";
2
2
  /* empty css */
3
- import r from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var d = function() {
3
+ import d from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var u = function() {
5
5
  var s, i, n, a;
6
6
  var e = this, o = e._self._c, t = e._self._setupProxy;
7
- return o("div", { staticClass: "d-f editor-actions" }, [t.isVersionHistoryButtonVisible ? o(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }) : e._e(), o(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isExportButtonDisabled, "label-text-status": !1, "loading-status": t.isExporting, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.handleExport } }), (i = (s = t.config) == null ? void 0 : s.features) != null && i.saveAsTemplate ? o(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isSaveAsButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") }, on: { click: t.handleSaveAs } }) : e._e(), (a = (n = t.config) == null ? void 0 : n.features) != null && a.testMessage ? o(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { staticPosition: "bottom right" }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.testEmailClick } }) : e._e(), t.editorStore.isPreviewModeOpen ? e._e() : o(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "loading-status": t.isSaving }, on: { click: function(_) {
7
+ return o("div", { staticClass: "d-f editor-actions" }, [t.isVersionHistoryButtonVisible ? o(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }) : e._e(), o(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isExportButtonDisabled, "label-text-status": !1, "loading-status": t.isExporting, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.handleExport } }), (i = (s = t.config) == null ? void 0 : s.features) != null && i.saveAsTemplate ? o(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isSaveAsButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") }, on: { click: t.handleSaveAs } }) : e._e(), (a = (n = t.config) == null ? void 0 : n.features) != null && a.testMessage ? o(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { staticPosition: "bottom right" }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.testEmailClick } }) : e._e(), t.editorStore.isPreviewModeOpen ? e._e() : o(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "loading-status": t.isSaving }, on: { click: function(l) {
8
8
  return t.handleSave(!1);
9
- } } })], 1);
10
- }, u = [], p = /* @__PURE__ */ r(
11
- l,
12
- d,
9
+ } } }), t.isMigrationModalVisible ? o(t.MigrationConfirmModal, { on: { close: function(l) {
10
+ t.isMigrationModalVisible = !1;
11
+ }, confirm: t.handleMigrationConfirm } }) : e._e()], 1);
12
+ }, p = [], c = /* @__PURE__ */ d(
13
+ r,
13
14
  u,
15
+ p,
14
16
  !1,
15
17
  null,
16
- "17dd4d8b"
18
+ "92b1be6c"
17
19
  );
18
- const v = p.exports;
20
+ const v = c.exports;
19
21
  export {
20
22
  v as default
21
23
  };
@@ -1,41 +1,51 @@
1
- import { defineComponent as g, ref as u, computed as f } from "vue";
2
- import { useConfig as E } from "../../../composables/useConfig.js";
3
- import { useExport as h } from "../../../composables/useExport.js";
4
- import { useTestEmailClick as w } from "../../../composables/useGuidoActions.js";
5
- import { useSave as x } from "../../../composables/useSave.js";
6
- import { useTranslations as T } from "../../../composables/useTranslations.js";
7
- import { useVersionHistoryApi as O } from "../../../composables/useVersionHistoryApi.js";
8
- import { useEditorStore as A } from "../../../stores/editor.js";
9
- import { getTooltipOptions as C } from "../../../utils/tooltipUtils.js";
10
- import { InButtonV2 as k } from "@useinsider/design-system-vue";
11
- const J = /* @__PURE__ */ g({
1
+ import { defineComponent as T, ref as l, computed as m } from "vue";
2
+ import { useConfig as w } from "../../../composables/useConfig.js";
3
+ import { useExport as C } from "../../../composables/useExport.js";
4
+ import { useTestEmailClick as O } from "../../../composables/useGuidoActions.js";
5
+ import { useSave as A } from "../../../composables/useSave.js";
6
+ import { useTranslations as b } from "../../../composables/useTranslations.js";
7
+ import { useVersionHistoryApi as k } from "../../../composables/useVersionHistoryApi.js";
8
+ import { useEditorStore as B } from "../../../stores/editor.js";
9
+ import { useTemplateStore as j } from "../../../stores/template.js";
10
+ import { getTooltipOptions as D } from "../../../utils/tooltipUtils.js";
11
+ import { InButtonV2 as I } from "@useinsider/design-system-vue";
12
+ import P from "./MigrationConfirmModal.vue.js";
13
+ const Y = /* @__PURE__ */ T({
12
14
  __name: "EditorActions",
13
- setup(B, { expose: v }) {
14
- const { config: n } = E(), { exportHtml: a } = h(), { save: l } = x(), { openVersionHistory: p, closeVersionHistory: c } = O(), o = A(), s = T(), r = u(!1), i = u(!1), d = w(), y = () => {
15
- if (o.isVersionHistoryOpen) {
16
- c();
15
+ setup(q, { expose: H }) {
16
+ const { config: u } = w(), { exportHtml: c } = C(), { save: p } = A(), { openVersionHistory: f, closeVersionHistory: v } = k(), t = B(), d = j(), s = b(), r = l(!1), i = l(!1), n = l(!1), S = O(), y = m(() => Object.values(d.migrations).some((o) => o > 0)), V = () => {
17
+ if (t.isVersionHistoryOpen) {
18
+ v();
17
19
  return;
18
20
  }
19
- p();
20
- }, H = async () => {
21
- r.value = !0, await a(), r.value = !1;
22
- }, V = () => {
23
- o.isSaveAsTemplateDrawerOpen = !0;
24
- }, S = f(() => o.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), _ = f(
21
+ f();
22
+ }, h = async () => {
23
+ r.value = !0, await c(), r.value = !1;
24
+ }, _ = () => {
25
+ t.isSaveAsTemplateDrawerOpen = !0;
26
+ }, x = m(() => t.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), E = m(
25
27
  () => {
26
- var t, e;
27
- return ((e = (t = n.value) == null ? void 0 : t.features) == null ? void 0 : e.versionHistory) && !o.isPreviewModeOpen;
28
+ var o, e;
29
+ return ((e = (o = u.value) == null ? void 0 : o.features) == null ? void 0 : e.versionHistory) && !t.isPreviewModeOpen;
28
30
  }
29
- ), m = async (t) => {
30
- i.value = !0, o.loadingStatus = !0;
31
- const e = await l(t);
32
- return i.value = !1, (t || !e) && (o.loadingStatus = !1), e;
31
+ ), a = async (o) => {
32
+ i.value = !0, t.loadingStatus = !0;
33
+ const e = await p(o);
34
+ return i.value = !1, (o || !e) && (t.loadingStatus = !1), e;
35
+ }, g = (o) => {
36
+ if (!o && y.value) {
37
+ n.value = !0;
38
+ return;
39
+ }
40
+ a(o);
41
+ }, M = () => {
42
+ n.value = !1, a(!1);
33
43
  };
34
- return v({
35
- handleSave: m
36
- }), { __sfc: !0, config: n, exportHtml: a, save: l, openVersionHistory: p, closeVersionHistory: c, editorStore: o, trans: s, isExporting: r, isSaving: i, testEmailClick: d, handleVersionHistory: y, handleExport: H, handleSaveAs: V, versionHistoryTooltipText: S, isVersionHistoryButtonVisible: _, handleSave: m, getTooltipOptions: C, InButtonV2: k };
44
+ return H({
45
+ handleSave: g
46
+ }), { __sfc: !0, config: u, exportHtml: c, save: p, openVersionHistory: f, closeVersionHistory: v, editorStore: t, templateStore: d, trans: s, isExporting: r, isSaving: i, isMigrationModalVisible: n, testEmailClick: S, hasMigrations: y, handleVersionHistory: V, handleExport: h, handleSaveAs: _, versionHistoryTooltipText: x, isVersionHistoryButtonVisible: E, executeSave: a, handleSave: g, handleMigrationConfirm: M, getTooltipOptions: D, InButtonV2: I, MigrationConfirmModal: P };
37
47
  }
38
48
  });
39
49
  export {
40
- J as default
50
+ Y as default
41
51
  };
@@ -0,0 +1,21 @@
1
+ import n from "./MigrationConfirmModal.vue2.js";
2
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var i = function() {
4
+ var t = this, e = t._self._c, o = t._self._setupProxy;
5
+ return e(o.WpModal, { attrs: { id: "migration-confirm-modal", size: "X-small", "close-on-outside-click": !1, "footer-button-options": o.footerButtonOptions, title: o.trans("email-editor.migration-confirm-save") }, on: { close: function(r) {
6
+ return o.emit("close");
7
+ }, "primary-action": function(r) {
8
+ return o.emit("confirm");
9
+ } } }, [e("p", [t._v(" " + t._s(o.textParts.before)), e("strong", [t._v(t._s(o.blockNames))]), t._v(t._s(o.textParts.after) + " ")])]);
10
+ }, a = [], _ = /* @__PURE__ */ s(
11
+ n,
12
+ i,
13
+ a,
14
+ !1,
15
+ null,
16
+ null
17
+ );
18
+ const f = _.exports;
19
+ export {
20
+ f as default
21
+ };
@@ -0,0 +1,38 @@
1
+ import { defineComponent as f, ref as d, computed as r } from "vue";
2
+ import u from "../../wrappers/WpModal.vue.js";
3
+ import { useTranslations as g } from "../../../composables/useTranslations.js";
4
+ import { useTemplateStore as b } from "../../../stores/template.js";
5
+ const M = /* @__PURE__ */ f({
6
+ __name: "MigrationConfirmModal",
7
+ emits: ["close", "confirm"],
8
+ setup(_, { emit: i }) {
9
+ const o = b(), t = g(), a = d({
10
+ cancelOrBackButton: {
11
+ type: "secondary",
12
+ labelText: t("campaign-builder.cancel"),
13
+ styling: "ghost"
14
+ },
15
+ primaryButton: {
16
+ type: "primary",
17
+ labelText: t("email-editor.migration-confirm-save")
18
+ }
19
+ }), s = r(() => {
20
+ const e = o.migrations["recommendation-block"] > 0, m = o.migrations["items-block"] > 0;
21
+ if (e && m) {
22
+ const l = t("email-recommendation.recommendation"), p = t("email-items.items");
23
+ return `${l} ${t("campaign-builder.or")} ${p}`;
24
+ }
25
+ return t(m ? "email-items.items" : "email-recommendation.recommendation");
26
+ }), n = "email-editor.migration-confirm-message", c = r(() => {
27
+ const e = t(n).split("{blockNames}");
28
+ return {
29
+ before: e[0] || "",
30
+ after: e[1] || ""
31
+ };
32
+ });
33
+ return { __sfc: !0, emit: i, templateStore: o, trans: t, footerButtonOptions: a, blockNames: s, MESSAGE_KEY: n, textParts: c, WpModal: u };
34
+ }
35
+ });
36
+ export {
37
+ M as default
38
+ };
@@ -1,7 +1,12 @@
1
- const l = {
1
+ const e = "Items", o = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
- "Structures & Modules": "Structures and Modules"
3
+ "Structures & Modules": "Structures and Modules",
4
+ "Recommendation Block": "Recommendation",
5
+ Items: e,
6
+ "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
+ "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly."
4
8
  };
5
9
  export {
6
- l as default
10
+ e as Items,
11
+ o as default
7
12
  };
@@ -1,10 +1,12 @@
1
1
  var B = Object.defineProperty;
2
- var U = (e, t, r) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var M = (e, t, r) => U(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { productPairs as v } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
- import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as u } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
- import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
7
- const w = {
2
+ var U = (r, t, o) => t in r ? B(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o;
3
+ var M = (r, t, o) => U(r, typeof t != "symbol" ? t + "" : t, o);
4
+ import { BLOCK_ID as v } from "../../extensions/Blocks/Items/block.js";
5
+ import { productPairs as K } from "../../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as s } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
7
+ import { getDefaultTemplate as w } from "../../extensions/Blocks/Items/template.js";
8
+ import { useTemplateStore as F } from "../../stores/template.js";
9
+ const O = {
8
10
  img: {
9
11
  pairsKey: "imageSrc",
10
12
  defaultKey: "DEFAULT",
@@ -71,121 +73,121 @@ const w = {
71
73
  isArray: !1
72
74
  }
73
75
  };
74
- function F() {
76
+ function q() {
75
77
  return String(Date.now() + Math.floor(Math.random() * 1e3));
76
78
  }
77
- function q(e) {
78
- return e ? {
79
- CartItems: u.ITEMS_TYPE.CART_ITEMS,
80
- BrowsedItems: u.ITEMS_TYPE.BROWSED_ITEMS,
81
- PurchasedItems: u.ITEMS_TYPE.PURCHASED_ITEMS,
82
- CART_ITEMS: u.ITEMS_TYPE.CART_ITEMS,
83
- BROWSED_ITEMS: u.ITEMS_TYPE.BROWSED_ITEMS,
84
- PURCHASED_ITEMS: u.ITEMS_TYPE.PURCHASED_ITEMS
85
- }[e] || u.ITEMS_TYPE.CART_ITEMS : u.ITEMS_TYPE.CART_ITEMS;
79
+ function $(r) {
80
+ return r ? {
81
+ CartItems: s.ITEMS_TYPE.CART_ITEMS,
82
+ BrowsedItems: s.ITEMS_TYPE.BROWSED_ITEMS,
83
+ PurchasedItems: s.ITEMS_TYPE.PURCHASED_ITEMS,
84
+ CART_ITEMS: s.ITEMS_TYPE.CART_ITEMS,
85
+ BROWSED_ITEMS: s.ITEMS_TYPE.BROWSED_ITEMS,
86
+ PURCHASED_ITEMS: s.ITEMS_TYPE.PURCHASED_ITEMS
87
+ }[r] || s.ITEMS_TYPE.CART_ITEMS : s.ITEMS_TYPE.CART_ITEMS;
86
88
  }
87
- function R(e) {
88
- const t = (a, o) => a == null ? o : a === "1" || a === "true", r = (a, o) => a || o, c = e["data-type"] || e["data-source"], i = q(c);
89
- let n = e["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
90
- if (n && !n.includes("{{") && /^\d+$/.test(n)) {
91
- const a = parseInt(n) - 1, o = E[i];
92
- o && o[a] && (n = o[a].value);
89
+ function R(r) {
90
+ const t = (i, e) => i == null ? e : i === "1" || i === "true", o = (i, e) => i || e, c = r["data-type"] || r["data-source"], n = $(c);
91
+ let a = r["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
92
+ if (a && !a.includes("{{") && /^\d+$/.test(a)) {
93
+ const i = parseInt(a) - 1, e = E[n];
94
+ e && e[i] && (a = e[i].value);
93
95
  }
94
96
  return {
95
97
  initialized: !0,
96
- blockInstanceId: r(e["data-block-instance-id"], F()),
97
- source: i,
98
- type: i,
99
- itemsSelectValue: n,
100
- orientation: e["data-card_orientation_control_value"] || u.ORIENTATION.VERTICAL,
101
- nameTrimming: t(e["data-product_name_control_trim"], !0),
102
- priceHideDiscount: t(e["data-product_price_control_nodup"], !0),
103
- priceFormatted: t(e["data-product_price_control_formated"], !0),
104
- priceSinglePrice: t(e["data-product_price_control_single_price"], !1),
105
- priceCurrencySymbol: r(
106
- e["data-product_price_control_currency_symbol"],
98
+ blockInstanceId: o(r["data-block-instance-id"], q()),
99
+ source: n,
100
+ type: n,
101
+ itemsSelectValue: a,
102
+ orientation: r["data-card_orientation_control_value"] || s.ORIENTATION.VERTICAL,
103
+ nameTrimming: t(r["data-product_name_control_trim"], !0),
104
+ priceHideDiscount: t(r["data-product_price_control_nodup"], !0),
105
+ priceFormatted: t(r["data-product_price_control_formated"], !0),
106
+ priceSinglePrice: t(r["data-product_price_control_single_price"], !1),
107
+ priceCurrencySymbol: o(
108
+ r["data-product_price_control_currency_symbol"],
107
109
  g.productPriceCurrencySymbolControlValue
108
110
  ),
109
- priceCurrencyLocation: r(
110
- e["data-product_price_currency_location"],
111
+ priceCurrencyLocation: o(
112
+ r["data-product_price_currency_location"],
111
113
  g.productPriceCurrencyLocationControlValue
112
114
  ),
113
- priceOrientation: e["data-product_original_price_control_orientation"] || "horizontal",
114
- quantityControlEnabled: t(e["data-product_quantity_control_enabled"], !0),
115
- buttonLink: r(e["data-product_button_link"], g.productButtonLinkControlValue),
116
- imageLink: r(e["data-product_image_link"], g.productImageLinkControlValue),
117
- buttonLabel: r(e["data-product_button_control_label"], "Buy"),
118
- buttonFullWidth: t(e["data-product_button_control_atw"], !0),
119
- imageVisible: t(e["data-product_image_control_enabled"], !0),
120
- nameVisible: t(e["data-product_name_control_enabled"], !0),
121
- quantityVisible: t(e["data-product_quantity_control_enabled"], !0),
122
- priceVisible: t(e["data-product_price_control_enabled"], !0),
123
- originalPriceVisible: t(e["data-product_original_price_control_enabled"], !0),
124
- buttonVisible: t(e["data-product_button_control_enabled"], !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_control_enabled"], !0),
124
+ priceVisible: t(r["data-product_price_control_enabled"], !0),
125
+ originalPriceVisible: t(r["data-product_original_price_control_enabled"], !0),
126
+ buttonVisible: t(r["data-product_button_control_enabled"], !0)
125
127
  };
126
128
  }
127
- const O = {
129
+ const x = {
128
130
  ins_apr: "CART_ITEMS",
129
131
  browsed_item: "BROWSED_ITEMS",
130
132
  purchased_item: "PURCHASED_ITEMS"
131
133
  };
132
- function $(e, t) {
133
- const r = {
134
+ function V(r, t) {
135
+ const o = {
134
136
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
135
137
  BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
136
138
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
137
139
  };
138
- return r[e] || r.CART_ITEMS;
140
+ return o[r] || o.CART_ITEMS;
139
141
  }
140
- function x(e, t) {
141
- const r = {
142
+ function N(r, t) {
143
+ const o = {
142
144
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
143
145
  BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
144
146
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
145
147
  };
146
- return r[e] || r.CART_ITEMS;
148
+ return o[r] || o.CART_ITEMS;
147
149
  }
148
- class V {
150
+ class z {
149
151
  constructor() {
150
152
  M(this, "parser");
151
153
  this.parser = new DOMParser();
152
154
  }
153
155
  migrate(t) {
154
156
  try {
155
- let r = this.removeJinjaConditionals(t);
156
- r = this.replaceTemplateVariables(r);
157
- const c = this.parser.parseFromString(r, "text/html"), i = c.querySelectorAll(
157
+ let o = this.removeJinjaConditionals(t);
158
+ o = this.replaceTemplateVariables(o);
159
+ const c = this.parser.parseFromString(o, "text/html"), n = c.querySelectorAll(
158
160
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
159
- );
160
- return i.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (i.forEach((n) => {
161
- const a = this.extractConfiguration(n), o = K({
162
- orientation: a.orientation,
163
- itemsType: a.itemsType,
164
- itemId: a.itemId,
165
- currencySymbol: a.currencySymbol,
166
- currencyLocation: a.currencyLocation,
167
- formattedPrice: a.formattedPrice,
168
- configBlockAttributes: a.configBlockAttributes,
161
+ ), a = F();
162
+ return a.migrations[v] = n.length, n.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), o) : (n.forEach((i) => {
163
+ const e = this.extractConfiguration(i), l = w({
164
+ orientation: e.orientation,
165
+ itemsType: e.itemsType,
166
+ itemId: e.itemId,
167
+ currencySymbol: e.currencySymbol,
168
+ currencyLocation: e.currencyLocation,
169
+ formattedPrice: e.formattedPrice,
170
+ configBlockAttributes: e.configBlockAttributes,
169
171
  migrate: !0,
170
- nameStyles: a.nameStyles,
171
- buttonStyles: a.buttonStyles,
172
- priceStyles: a.priceStyles,
173
- originalPriceStyles: a.originalPriceStyles,
174
- quantityStyles: a.quantityStyles,
175
- nodeConfig: R(a.configBlockAttributes)
176
- }), l = this.parser.parseFromString(
177
- `<table><tbody><tr>${o}</tr></tbody></table>`,
172
+ nameStyles: e.nameStyles,
173
+ buttonStyles: e.buttonStyles,
174
+ priceStyles: e.priceStyles,
175
+ originalPriceStyles: e.originalPriceStyles,
176
+ quantityStyles: e.quantityStyles,
177
+ nodeConfig: R(e.configBlockAttributes)
178
+ }), u = this.parser.parseFromString(
179
+ `<table><tbody><tr>${l}</tr></tbody></table>`,
178
180
  "text/html"
179
181
  ).querySelector("td");
180
- if (l && n.parentNode) {
181
- const f = R(a.configBlockAttributes);
182
- l.setAttribute("esd-ext-config", JSON.stringify(f));
183
- const d = l.querySelector("esd-config-block");
184
- d && d.remove(), n.parentNode.replaceChild(l, n);
182
+ if (u && i.parentNode) {
183
+ const p = R(e.configBlockAttributes);
184
+ u.setAttribute("esd-ext-config", JSON.stringify(p));
185
+ const d = u.querySelector("esd-config-block");
186
+ d && d.remove(), i.parentNode.replaceChild(u, i);
185
187
  }
186
188
  }), c.documentElement.outerHTML);
187
- } catch (r) {
188
- return console.error("ItemsBlockMigrator failed:", r), t;
189
+ } catch (o) {
190
+ return console.error("ItemsBlockMigrator failed:", o), t;
189
191
  }
190
192
  }
191
193
  /**
@@ -196,18 +198,18 @@ class V {
196
198
  */
197
199
  extractConfiguration(t) {
198
200
  var C, D, P;
199
- const r = ((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", i = parseInt(c) - 1, n = E[r], a = ((P = n == null ? void 0 : n[i]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", d = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r, c), S = s["data-card_orientation_control_value"];
201
+ 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, a = E[o], i = ((P = a == null ? void 0 : a[n]) == null ? void 0 : P.value) || a[0].value, e = t.querySelector('[product-attr="price"]'), l = (e == null ? void 0 : e.getAttribute("data-currency_symbol")) || "USD", u = ((e == null ? void 0 : e.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", p = (e == null ? void 0 : e.getAttribute("data-formated")) !== "false", d = this.extractConfigBlockAttributes(t, o, c), S = d["data-card_orientation_control_value"];
200
202
  let b;
201
203
  S ? b = S === "horizontal" ? "horizontal" : "vertical" : b = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
202
- const p = t.querySelector('a[product-attr="name"]'), I = (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, h = (o == null ? void 0 : o.getAttribute("style")) || void 0, T = t.querySelector("p.original-price"), k = (T == null ? void 0 : T.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
204
+ const y = t.querySelector('a[product-attr="name"]'), I = (y == null ? void 0 : y.getAttribute("style")) || void 0, f = t.querySelector('a[product-attr="button"]'), m = (f == null ? void 0 : f.getAttribute("style")) || void 0, h = (e == null ? void 0 : e.getAttribute("style")) || void 0, T = t.querySelector("p.original-price"), k = (T == null ? void 0 : T.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
203
205
  return {
204
206
  orientation: b,
205
- itemsType: r,
206
- itemId: a,
207
- currencySymbol: _,
208
- currencyLocation: f,
209
- formattedPrice: d,
210
- configBlockAttributes: s,
207
+ itemsType: o,
208
+ itemId: i,
209
+ currencySymbol: l,
210
+ currencyLocation: u,
211
+ formattedPrice: p,
212
+ configBlockAttributes: d,
211
213
  nameStyles: I,
212
214
  buttonStyles: m,
213
215
  priceStyles: h,
@@ -222,27 +224,27 @@ class V {
222
224
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
223
225
  * @param itemNumber - The item number (1-based index)
224
226
  */
225
- extractConfigBlockAttributes(t, r, c) {
226
- const i = t.querySelector("esd-config-block"), n = {};
227
- if (!i)
227
+ extractConfigBlockAttributes(t, o, c) {
228
+ const n = t.querySelector("esd-config-block"), a = {};
229
+ if (!n)
228
230
  return this.getDefaultConfigBlockAttributes();
229
- if (Array.from(i.attributes).forEach((o) => {
230
- o.name.startsWith("data-") && (n[o.name] = o.value);
231
- }), n["data-cart_items_select_control_value"]) {
232
- const o = n["data-cart_items_select_control_value"];
233
- if (/^\d+$/.test(o)) {
234
- const _ = parseInt(o) - 1, l = E[r];
235
- l && l[_] && (n["data-cart_items_select_control_value"] = l[_].value);
231
+ if (Array.from(n.attributes).forEach((e) => {
232
+ e.name.startsWith("data-") && (a[e.name] = e.value);
233
+ }), a["data-cart_items_select_control_value"]) {
234
+ const e = a["data-cart_items_select_control_value"];
235
+ if (/^\d+$/.test(e)) {
236
+ const l = parseInt(e) - 1, _ = E[o];
237
+ _ && _[l] && (a["data-cart_items_select_control_value"] = _[l].value);
236
238
  }
237
239
  }
238
- if (n["data-product_price_control_curency"]) {
239
- const o = n["data-product_price_control_curency"];
240
- let _ = o;
241
- o === "before" ? _ = "0" : o === "after" && (_ = "1"), n["data-product_price_control_curency"] = _, n["data-product_price_currency_location"] = _;
240
+ if (a["data-product_price_control_curency"]) {
241
+ const e = a["data-product_price_control_curency"];
242
+ let l = e;
243
+ e === "before" ? l = "0" : e === "after" && (l = "1"), a["data-product_price_control_curency"] = l, a["data-product_price_currency_location"] = l;
242
244
  }
243
- (!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
244
- const a = { ...this.getDefaultConfigBlockAttributes(), ...n };
245
- return a["data-type"] = r, a["data-source"] = r, a["data-product_image_link"] = $(r, c), a["data-product_button_link"] = x(r, c), a;
245
+ (!a["data-product_price_control_currency_symbol"] || a["data-product_price_control_currency_symbol"].trim() === "") && (a["data-product_price_control_currency_symbol"] = "USD");
246
+ const i = { ...this.getDefaultConfigBlockAttributes(), ...a };
247
+ return i["data-type"] = o, i["data-source"] = o, i["data-product_image_link"] = V(o, c), i["data-product_button_link"] = N(o, c), i;
246
248
  }
247
249
  /**
248
250
  * Returns default esd-config-block attributes based on the old template structure
@@ -302,17 +304,17 @@ class V {
302
304
  * contains display condition Jinja scripts that should NOT be removed.
303
305
  */
304
306
  removeJinjaConditionals(t) {
305
- const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
306
- let i = c ? t.replace(c[0], r) : t;
307
- return i = i.replace(
307
+ const o = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
308
+ let n = c ? t.replace(c[0], o) : t;
309
+ return n = n.replace(
308
310
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
309
311
  ""
310
- ), i = i.replace(
312
+ ), n = n.replace(
311
313
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
312
314
  ""
313
- ), i = i.replace(/\{%\s*endif\s*%\}/g, ""), c && (i = i.replace(r, c[0])), i = i.replace(/\n\s*\n\s*\n/g, `
315
+ ), n = n.replace(/\{%\s*endif\s*%\}/g, ""), c && (n = n.replace(o, c[0])), n = n.replace(/\n\s*\n\s*\n/g, `
314
316
 
315
- `), i;
317
+ `), n;
316
318
  }
317
319
  /**
318
320
  * Replaces template variables with default values from productPairs
@@ -324,32 +326,32 @@ class V {
324
326
  * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
325
327
  */
326
328
  replaceTemplateVariables(t) {
327
- const { PAIRS_FOR_EXTENSION: r } = v;
328
- return t.replace(/{{([^}]+)}}/g, (c, i) => {
329
- const n = i.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
330
- if (!n)
329
+ const { PAIRS_FOR_EXTENSION: o } = K;
330
+ return t.replace(/{{([^}]+)}}/g, (c, n) => {
331
+ const a = n.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
332
+ if (!a)
331
333
  return c;
332
- const [, a, o, _] = n, l = O[a];
333
- if (!l)
334
- return console.warn(`Unknown variable prefix: ${a}`), c;
335
- const f = w[o];
336
- if (!f)
337
- return console.warn(`Unknown variable suffix mapping for: ${o}`), c;
338
- const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][l];
339
- if (!p)
340
- return console.warn(`No data found for: ${d}.${l}`), c;
334
+ const [, i, e, l] = a, _ = x[i];
335
+ if (!_)
336
+ return console.warn(`Unknown variable prefix: ${i}`), c;
337
+ const u = O[e];
338
+ if (!u)
339
+ return console.warn(`Unknown variable suffix mapping for: ${e}`), c;
340
+ const { pairsKey: p, defaultKey: d, isArray: S } = u, y = o[p][_];
341
+ if (!y)
342
+ return console.warn(`No data found for: ${p}.${_}`), c;
341
343
  if (S) {
342
- const y = parseInt(_) - 1, m = p[s];
343
- return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${l}.${s}[${y}]`), c);
344
+ const f = parseInt(l) - 1, m = y[d];
345
+ return Array.isArray(m) && m[f] ? m[f] : (console.warn(`Array value not found: ${p}.${_}.${d}[${f}]`), c);
344
346
  }
345
- const I = p[s];
346
- return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${l}.${s}`), c);
347
+ const I = y[d];
348
+ return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${p}.${_}.${d}`), c);
347
349
  });
348
350
  }
349
351
  }
350
- function G(e) {
351
- return new V().migrate(e);
352
+ function Q(r) {
353
+ return new z().migrate(r);
352
354
  }
353
355
  export {
354
- G as migrateItemsBlock
356
+ Q as migrateItemsBlock
355
357
  };