@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.
- package/dist/components/organisms/header/EditorActions.vue.js +12 -10
- package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
- package/dist/components/organisms/header/MigrationConfirmModal.vue.js +21 -0
- package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +38 -0
- package/dist/config/i18n/en/labels.json.js +8 -3
- package/dist/config/migrator/itemsBlockMigrator.js +136 -134
- package/dist/config/migrator/recommendationMigrator.js +42 -40
- package/dist/extensions/Blocks/Items/block.js +45 -25
- package/dist/extensions/Blocks/Items/iconsRegistry.js +40 -5
- package/dist/extensions/Blocks/Items/items.css.js +48 -0
- package/dist/extensions/Blocks/Recommendation/block.js +49 -29
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +37 -2
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +48 -0
- package/dist/extensions/Blocks/common-control.js +12 -4
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +5 -0
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/extensions/Blocks/Items/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +5 -0
- package/dist/src/stores/template.d.ts +3 -0
- package/dist/stores/template.js +9 -0
- package/package.json +1 -1
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from "./EditorActions.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
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
|
-
} } })
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
"
|
|
18
|
+
"92b1be6c"
|
|
17
19
|
);
|
|
18
|
-
const v =
|
|
20
|
+
const v = c.exports;
|
|
19
21
|
export {
|
|
20
22
|
v as default
|
|
21
23
|
};
|
|
@@ -1,41 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useExport as
|
|
4
|
-
import { useTestEmailClick as
|
|
5
|
-
import { useSave as
|
|
6
|
-
import { useTranslations as
|
|
7
|
-
import { useVersionHistoryApi as
|
|
8
|
-
import { useEditorStore as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
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(
|
|
14
|
-
const { config:
|
|
15
|
-
if (
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
},
|
|
21
|
-
r.value = !0, await
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
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
|
|
27
|
-
return ((e = (
|
|
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
|
-
),
|
|
30
|
-
i.value = !0,
|
|
31
|
-
const e = await
|
|
32
|
-
return i.value = !1, (
|
|
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
|
|
35
|
-
handleSave:
|
|
36
|
-
}), { __sfc: !0, config:
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
10
|
+
e as Items,
|
|
11
|
+
o as default
|
|
7
12
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
var B = Object.defineProperty;
|
|
2
|
-
var U = (
|
|
3
|
-
var M = (
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
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
|
|
76
|
+
function q() {
|
|
75
77
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
76
78
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
79
|
-
CartItems:
|
|
80
|
-
BrowsedItems:
|
|
81
|
-
PurchasedItems:
|
|
82
|
-
CART_ITEMS:
|
|
83
|
-
BROWSED_ITEMS:
|
|
84
|
-
PURCHASED_ITEMS:
|
|
85
|
-
}[
|
|
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(
|
|
88
|
-
const t = (
|
|
89
|
-
let
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
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
|
|
97
|
-
source:
|
|
98
|
-
type:
|
|
99
|
-
itemsSelectValue:
|
|
100
|
-
orientation:
|
|
101
|
-
nameTrimming: t(
|
|
102
|
-
priceHideDiscount: t(
|
|
103
|
-
priceFormatted: t(
|
|
104
|
-
priceSinglePrice: t(
|
|
105
|
-
priceCurrencySymbol:
|
|
106
|
-
|
|
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:
|
|
110
|
-
|
|
111
|
+
priceCurrencyLocation: o(
|
|
112
|
+
r["data-product_price_currency_location"],
|
|
111
113
|
g.productPriceCurrencyLocationControlValue
|
|
112
114
|
),
|
|
113
|
-
priceOrientation:
|
|
114
|
-
quantityControlEnabled: t(
|
|
115
|
-
buttonLink: r
|
|
116
|
-
imageLink: r
|
|
117
|
-
buttonLabel: r
|
|
118
|
-
buttonFullWidth: t(
|
|
119
|
-
imageVisible: t(
|
|
120
|
-
nameVisible: t(
|
|
121
|
-
quantityVisible: t(
|
|
122
|
-
priceVisible: t(
|
|
123
|
-
originalPriceVisible: t(
|
|
124
|
-
buttonVisible: t(
|
|
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
|
|
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
|
|
133
|
-
const
|
|
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
|
|
140
|
+
return o[r] || o.CART_ITEMS;
|
|
139
141
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
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
|
|
148
|
+
return o[r] || o.CART_ITEMS;
|
|
147
149
|
}
|
|
148
|
-
class
|
|
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
|
|
156
|
-
|
|
157
|
-
const c = this.parser.parseFromString(
|
|
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
|
|
161
|
-
const
|
|
162
|
-
orientation:
|
|
163
|
-
itemsType:
|
|
164
|
-
itemId:
|
|
165
|
-
currencySymbol:
|
|
166
|
-
currencyLocation:
|
|
167
|
-
formattedPrice:
|
|
168
|
-
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:
|
|
171
|
-
buttonStyles:
|
|
172
|
-
priceStyles:
|
|
173
|
-
originalPriceStyles:
|
|
174
|
-
quantityStyles:
|
|
175
|
-
nodeConfig: R(
|
|
176
|
-
}),
|
|
177
|
-
`<table><tbody><tr>${
|
|
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 (
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
const d =
|
|
184
|
-
d && d.remove(),
|
|
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 (
|
|
188
|
-
return console.error("ItemsBlockMigrator failed:",
|
|
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
|
|
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
|
|
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:
|
|
206
|
-
itemId:
|
|
207
|
-
currencySymbol:
|
|
208
|
-
currencyLocation:
|
|
209
|
-
formattedPrice:
|
|
210
|
-
configBlockAttributes:
|
|
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,
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
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(
|
|
230
|
-
|
|
231
|
-
}),
|
|
232
|
-
const
|
|
233
|
-
if (/^\d+$/.test(
|
|
234
|
-
const
|
|
235
|
-
|
|
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 (
|
|
239
|
-
const
|
|
240
|
-
let
|
|
241
|
-
|
|
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
|
-
(!
|
|
244
|
-
const
|
|
245
|
-
return
|
|
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
|
|
306
|
-
let
|
|
307
|
-
return
|
|
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*(>|>)\s*\d+\s*%\}/g,
|
|
309
311
|
""
|
|
310
|
-
),
|
|
312
|
+
), n = n.replace(
|
|
311
313
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!=|!=)\s*\1_originalprice_\d+\s*%\}/g,
|
|
312
314
|
""
|
|
313
|
-
),
|
|
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
|
-
`),
|
|
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:
|
|
328
|
-
return t.replace(/{{([^}]+)}}/g, (c,
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
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 [,
|
|
333
|
-
if (!
|
|
334
|
-
return console.warn(`Unknown variable prefix: ${
|
|
335
|
-
const
|
|
336
|
-
if (!
|
|
337
|
-
return console.warn(`Unknown variable suffix mapping for: ${
|
|
338
|
-
const { pairsKey:
|
|
339
|
-
if (!
|
|
340
|
-
return console.warn(`No data found for: ${
|
|
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
|
|
343
|
-
return Array.isArray(m) && m[
|
|
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 =
|
|
346
|
-
return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${
|
|
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
|
|
351
|
-
return new
|
|
352
|
+
function Q(r) {
|
|
353
|
+
return new z().migrate(r);
|
|
352
354
|
}
|
|
353
355
|
export {
|
|
354
|
-
|
|
356
|
+
Q as migrateItemsBlock
|
|
355
357
|
};
|