@useinsider/guido 3.9.0-beta.8d531eb → 3.9.0-beta.dd55e19
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/composables/useCustomInterfaceAppearance.js +16 -18
- package/dist/composables/useStripo.js +39 -37
- package/dist/composables/useStripoNotifications.js +26 -0
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +110 -118
- package/dist/enums/toaster.js +2 -2
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +15 -15
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
- package/dist/services/templateLibraryApi.js +9 -8
- package/dist/src/composables/useStripoNotifications.d.ts +10 -0
- package/dist/src/enums/toaster.d.ts +2 -2
- package/dist/src/stores/toaster.d.ts +2 -3
- package/dist/stores/toaster.js +10 -10
- package/package.json +2 -2
- package/dist/static/styles/components/notification.css.js +0 -74
|
@@ -4,21 +4,20 @@ import e from "../static/styles/components/amp-block.css.js";
|
|
|
4
4
|
import i from "../static/styles/components/base-input.css.js";
|
|
5
5
|
import p from "../static/styles/components/button-group.css.js";
|
|
6
6
|
import n from "../static/styles/components/button.css.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import s from "../static/styles/components/combobox.css.js";
|
|
8
|
+
import C from "../static/styles/components/counter.css.js";
|
|
9
9
|
import f from "../static/styles/components/dropdown-menu.css.js";
|
|
10
10
|
import a from "../static/styles/components/loader.css.js";
|
|
11
11
|
import u from "../static/styles/components/narrow-panel.css.js";
|
|
12
|
-
import c from "../static/styles/components/
|
|
13
|
-
import d from "../static/styles/components/
|
|
14
|
-
import l from "../static/styles/components/
|
|
15
|
-
import h from "../static/styles/components/
|
|
16
|
-
import w from "../static/styles/components/
|
|
17
|
-
import y from "../static/styles/components/
|
|
18
|
-
import B from "../static/styles/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
b,
|
|
12
|
+
import c from "../static/styles/components/popup.css.js";
|
|
13
|
+
import d from "../static/styles/components/switcher.css.js";
|
|
14
|
+
import l from "../static/styles/components/tabs.css.js";
|
|
15
|
+
import h from "../static/styles/components/tools.css.js";
|
|
16
|
+
import w from "../static/styles/components/version-history.css.js";
|
|
17
|
+
import y from "../static/styles/components/wide-panel.css.js";
|
|
18
|
+
import B from "../static/styles/variables.css.js";
|
|
19
|
+
const b = [
|
|
20
|
+
B,
|
|
22
21
|
// Must be on top
|
|
23
22
|
S,
|
|
24
23
|
// Must be on top
|
|
@@ -27,8 +26,8 @@ const A = [
|
|
|
27
26
|
i,
|
|
28
27
|
p,
|
|
29
28
|
n,
|
|
30
|
-
C,
|
|
31
29
|
s,
|
|
30
|
+
C,
|
|
32
31
|
f,
|
|
33
32
|
a,
|
|
34
33
|
u,
|
|
@@ -37,13 +36,12 @@ const A = [
|
|
|
37
36
|
l,
|
|
38
37
|
h,
|
|
39
38
|
w,
|
|
40
|
-
y
|
|
41
|
-
B
|
|
39
|
+
y
|
|
42
40
|
].join(`
|
|
43
41
|
|
|
44
|
-
`),
|
|
42
|
+
`), v = () => ({ importCss: () => {
|
|
45
43
|
const o = new CSSStyleSheet();
|
|
46
|
-
o.replaceSync(
|
|
44
|
+
o.replaceSync(b);
|
|
47
45
|
const r = document.querySelector("ui-editor");
|
|
48
46
|
if (!r)
|
|
49
47
|
return;
|
|
@@ -51,5 +49,5 @@ const A = [
|
|
|
51
49
|
t && (t.adoptedStyleSheets = [o]);
|
|
52
50
|
} });
|
|
53
51
|
export {
|
|
54
|
-
|
|
52
|
+
v as useCustomInterfaceAppearance
|
|
55
53
|
};
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import { useStripoEventHandler as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { useActionsApi as U } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as R } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as x } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as O } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as q } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useStripoEventHandler as H } from "./useStripoEventHandler.js";
|
|
7
|
+
import { useStripoNotifications as N } from "./useStripoNotifications.js";
|
|
8
|
+
import { useToaster as z } from "./useToaster.js";
|
|
9
|
+
import { localePatch as L } from "../config/i18n/index.js";
|
|
9
10
|
import { en as h } from "../config/i18n/en/index.js";
|
|
10
|
-
import { ToasterTypeOptions as
|
|
11
|
-
import { useStripoApi as
|
|
12
|
-
import
|
|
11
|
+
import { ToasterTypeOptions as $ } from "../enums/toaster.js";
|
|
12
|
+
import { useStripoApi as G } from "../services/stripoApi.js";
|
|
13
|
+
import J from "../static/styles/customEditorStyle.css.js";
|
|
13
14
|
import { useEditorStore as C } from "../stores/editor.js";
|
|
14
|
-
import { dynamicContentToMergeTags as
|
|
15
|
-
import
|
|
16
|
-
const
|
|
17
|
-
const { features: c, template: w, isFeatureEnabled: u } =
|
|
15
|
+
import { dynamicContentToMergeTags as X } from "../utils/genericUtil.js";
|
|
16
|
+
import j from "../package.json.js";
|
|
17
|
+
const pe = (E, l) => {
|
|
18
|
+
const { features: c, template: w, isFeatureEnabled: u } = x(), { handleError: m, showToaster: b } = z(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = G(), { handleEvent: F } = H(), { getStripoBlocksConfig: v } = R(), { getStripoNotifications: V } = N(), _ = async (s, i = [], r = !1) => {
|
|
18
19
|
var g, S, y;
|
|
19
|
-
const e = C(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0,
|
|
20
|
+
const e = C(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, M = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, P = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
20
21
|
await window.UIEditor.initEditor(
|
|
21
22
|
document.querySelector("#guido-editor"),
|
|
22
23
|
{
|
|
23
24
|
metadata: E,
|
|
24
25
|
html: p,
|
|
25
26
|
css: a,
|
|
26
|
-
forceRecreate:
|
|
27
|
+
forceRecreate: P,
|
|
27
28
|
locale: "en",
|
|
28
29
|
undoButtonSelector: "#guido__undo-button",
|
|
29
30
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -33,12 +34,12 @@ const ce = (E, l) => {
|
|
|
33
34
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
34
35
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
35
36
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
36
|
-
customViewStyles:
|
|
37
|
+
customViewStyles: J,
|
|
37
38
|
conditionsEnabled: f,
|
|
38
39
|
customConditionsEnabled: f,
|
|
39
40
|
enableXSSSecurity: !0,
|
|
40
|
-
modulesDisabled:
|
|
41
|
-
syncModulesEnabled:
|
|
41
|
+
modulesDisabled: M,
|
|
42
|
+
syncModulesEnabled: r,
|
|
42
43
|
messageSettingsEnabled: !0,
|
|
43
44
|
displayGmailAnnotations: !0,
|
|
44
45
|
displayHiddenPreheader: !1,
|
|
@@ -51,11 +52,11 @@ const ce = (E, l) => {
|
|
|
51
52
|
editorFonts: {
|
|
52
53
|
showDefaultStandardFonts: !0,
|
|
53
54
|
showDefaultNotStandardFonts: !0,
|
|
54
|
-
customFonts:
|
|
55
|
+
customFonts: i
|
|
55
56
|
},
|
|
56
57
|
mergeTags: [
|
|
57
58
|
{
|
|
58
|
-
entries:
|
|
59
|
+
entries: X(
|
|
59
60
|
l.preselectedDynamicContentList,
|
|
60
61
|
u("liquidSyntax")
|
|
61
62
|
)
|
|
@@ -71,8 +72,8 @@ const ce = (E, l) => {
|
|
|
71
72
|
},
|
|
72
73
|
onTemplateLoaded() {
|
|
73
74
|
try {
|
|
74
|
-
const { importCss: o } =
|
|
75
|
-
o(), n(),
|
|
75
|
+
const { importCss: o } = O(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = U(), { injectFullStory: I } = q();
|
|
76
|
+
o(), n(), I(), D(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
76
77
|
e.hasChanges = !1;
|
|
77
78
|
}, 1e3);
|
|
78
79
|
} catch (o) {
|
|
@@ -92,41 +93,42 @@ const ce = (E, l) => {
|
|
|
92
93
|
e.hasChanges = !0;
|
|
93
94
|
},
|
|
94
95
|
onEvent: F,
|
|
96
|
+
notifications: V(),
|
|
95
97
|
ignoreClickOutsideSelectors: [
|
|
96
98
|
"#guido-dynamic-content-modal",
|
|
97
99
|
".in-on-board-wrapper",
|
|
98
100
|
".in-drawer__container"
|
|
99
101
|
],
|
|
100
102
|
extensions: d,
|
|
101
|
-
localePatch:
|
|
103
|
+
localePatch: L
|
|
102
104
|
}
|
|
103
105
|
);
|
|
104
|
-
},
|
|
106
|
+
}, A = (s) => new Promise((i, r) => {
|
|
105
107
|
var d;
|
|
106
108
|
if (document.getElementById("UiEditorScript")) {
|
|
107
|
-
Promise.resolve(s()).then(
|
|
109
|
+
Promise.resolve(s()).then(i, r);
|
|
108
110
|
return;
|
|
109
111
|
}
|
|
110
|
-
const e =
|
|
112
|
+
const e = j.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
111
113
|
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
112
|
-
Promise.resolve(s()).then(
|
|
114
|
+
Promise.resolve(s()).then(i, r);
|
|
113
115
|
}, t.onerror = () => {
|
|
114
|
-
|
|
116
|
+
r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
115
117
|
}, document.body.appendChild(t);
|
|
116
118
|
});
|
|
117
119
|
return { initPlugin: async (s) => {
|
|
118
|
-
const
|
|
120
|
+
const i = C();
|
|
119
121
|
try {
|
|
120
|
-
await
|
|
121
|
-
const [
|
|
122
|
+
await A(async () => {
|
|
123
|
+
const [r, e] = await Promise.all([
|
|
122
124
|
k(),
|
|
123
125
|
B()
|
|
124
126
|
]);
|
|
125
|
-
|
|
127
|
+
i.syncModulesEnabled = e, await _(s, r, e);
|
|
126
128
|
});
|
|
127
129
|
} catch {
|
|
128
|
-
|
|
129
|
-
type:
|
|
130
|
+
i.loadingStatus = !1, b({
|
|
131
|
+
type: $.Alert,
|
|
130
132
|
message: h["An error has occurred. Please report the error code to support."],
|
|
131
133
|
actionButton: {
|
|
132
134
|
text: h["Reload page"],
|
|
@@ -137,5 +139,5 @@ const ce = (E, l) => {
|
|
|
137
139
|
} };
|
|
138
140
|
};
|
|
139
141
|
export {
|
|
140
|
-
|
|
142
|
+
pe as useStripo
|
|
141
143
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useToaster as d } from "./useToaster.js";
|
|
2
|
+
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
3
|
+
const g = () => {
|
|
4
|
+
const { showToaster: l, hideToaster: u } = d();
|
|
5
|
+
let s = null;
|
|
6
|
+
const n = (o, t, i, e, f = !0) => {
|
|
7
|
+
s = i;
|
|
8
|
+
const r = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
|
|
9
|
+
l({ type: o, message: t, actionButton: r, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
|
|
10
|
+
};
|
|
11
|
+
return { getStripoNotifications: () => ({
|
|
12
|
+
info: (o, t, i) => n(c.Info, o, t, i),
|
|
13
|
+
success: (o, t, i) => n(c.Success, o, t, i),
|
|
14
|
+
warn: (o, t, i) => n(c.Warning, o, t, i),
|
|
15
|
+
error: (o, t, i) => n(c.Alert, o, t, i),
|
|
16
|
+
// A loader marks an in-progress operation; Stripo dismisses it via hide(id)
|
|
17
|
+
// when finished, so it must not auto-hide.
|
|
18
|
+
loader: (o, t, i) => n(c.Info, o, t, i, !1),
|
|
19
|
+
hide: (o) => {
|
|
20
|
+
s === o && (u(), s = null);
|
|
21
|
+
}
|
|
22
|
+
}) };
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
g as useStripoNotifications
|
|
26
|
+
};
|
|
@@ -1,189 +1,181 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useRecommendation as
|
|
3
|
-
import { CSS_CLASS_RECO_BUTTON as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { isIgnoredRecommendationBlock as
|
|
6
|
-
function
|
|
7
|
-
const i = `{{${
|
|
8
|
-
return
|
|
1
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as g } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
|
|
6
|
+
function b(e, n, t, o, c = "") {
|
|
7
|
+
const i = `{{${c}${e}_${n}_${t}}}`, r = `{{${c}${e}_${n}_currency}}`;
|
|
8
|
+
return o === "before" ? `${r} ${i}` : `${i} ${r}`;
|
|
9
9
|
}
|
|
10
|
-
function m(
|
|
11
|
-
let
|
|
12
|
-
for (;
|
|
13
|
-
[
|
|
14
|
-
return
|
|
10
|
+
function m(e) {
|
|
11
|
+
let n = e;
|
|
12
|
+
for (; n.children.length === 1; )
|
|
13
|
+
[n] = n.children;
|
|
14
|
+
return n;
|
|
15
15
|
}
|
|
16
|
-
function h(
|
|
17
|
-
switch (
|
|
16
|
+
function h(e, n, t, o, c, i) {
|
|
17
|
+
switch (n) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const r =
|
|
20
|
-
r && (r.setAttribute("src", `{{${i}${
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
const r = e.querySelector("img");
|
|
20
|
+
r && (r.setAttribute("src", `{{${i}${t}_${o}_image_url}}`), r.setAttribute("alt", `{{${i}${t}_${o}_name}}`));
|
|
21
|
+
const s = e.querySelector("a");
|
|
22
|
+
s && (s.setAttribute("href", `{{${i}${t}_${o}_url}}`), s.classList.add(q));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const r =
|
|
27
|
-
r && (m(r).textContent = `{{${i}${
|
|
26
|
+
const r = e.querySelector("p");
|
|
27
|
+
r && (m(r).textContent = `{{${i}${t}_${o}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "productPrice": {
|
|
31
|
-
const r =
|
|
32
|
-
r && (m(r).textContent =
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const r = e.querySelector(".product-price p") ?? e.querySelector("p");
|
|
32
|
+
r && (m(r).textContent = b(
|
|
33
|
+
t,
|
|
34
|
+
o,
|
|
35
35
|
"price",
|
|
36
|
-
|
|
36
|
+
c,
|
|
37
37
|
i
|
|
38
38
|
));
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const s = e.querySelector(".product-old-price p");
|
|
40
|
+
s && (m(s).textContent = b(
|
|
41
|
+
t,
|
|
42
|
+
o,
|
|
43
43
|
"original_price",
|
|
44
|
-
|
|
44
|
+
c,
|
|
45
45
|
i
|
|
46
46
|
));
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
case "productOldPrice": {
|
|
50
|
-
const r =
|
|
51
|
-
r && (m(r).textContent =
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const r = e.querySelector("p");
|
|
51
|
+
r && (m(r).textContent = b(
|
|
52
|
+
t,
|
|
53
|
+
o,
|
|
54
54
|
"original_price",
|
|
55
|
-
|
|
55
|
+
c,
|
|
56
56
|
i
|
|
57
57
|
));
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
case "productButton": {
|
|
61
|
-
const r =
|
|
62
|
-
r && r.setAttribute("href", `{{${i}${
|
|
61
|
+
const r = e.querySelector("a");
|
|
62
|
+
r && r.setAttribute("href", `{{${i}${t}_${o}_url}}`);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
case "productOmnibusPrice": {
|
|
66
|
-
const r =
|
|
66
|
+
const r = e.querySelector(".omnibus-price-value");
|
|
67
67
|
if (r) {
|
|
68
|
-
r.textContent = `{{${i}${
|
|
69
|
-
const
|
|
70
|
-
|
|
68
|
+
r.textContent = `{{${i}${t}_${o}_omnibus_price}}`;
|
|
69
|
+
const s = r.closest("p");
|
|
70
|
+
s && (s.setAttribute("product-attr", "omnibus_price"), s.setAttribute("composition", "true"));
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
case "productOmnibusDiscount": {
|
|
75
|
-
const r =
|
|
75
|
+
const r = e.querySelector(".omnibus-discount-value");
|
|
76
76
|
if (r) {
|
|
77
|
-
r.textContent = `{{${i}${
|
|
78
|
-
const
|
|
79
|
-
|
|
77
|
+
r.textContent = `{{${i}${t}_${o}_omnibus_discount}}`;
|
|
78
|
+
const s = r.closest("p");
|
|
79
|
+
s && (s.setAttribute("product-attr", "omnibus_discount"), s.setAttribute("composition", "true"));
|
|
80
80
|
}
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
default: {
|
|
84
|
-
const r =
|
|
84
|
+
const r = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
85
85
|
if (r) {
|
|
86
|
-
const
|
|
87
|
-
|
|
86
|
+
const s = r.getAttribute("product-attr"), a = r.querySelector("p");
|
|
87
|
+
a && (m(a).textContent = `{{${i}${t}_${o}_${s}}}`);
|
|
88
88
|
}
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
i.querySelectorAll("[data-attribute-type]").forEach((
|
|
96
|
-
const u =
|
|
97
|
-
p.length > 0 ? p.forEach((
|
|
98
|
-
h(
|
|
99
|
-
}) : h(
|
|
93
|
+
function E(e, n, t, o) {
|
|
94
|
+
e.querySelectorAll(".recommendation-product-row").forEach((i, r) => {
|
|
95
|
+
i.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
96
|
+
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
97
|
+
p.length > 0 ? p.forEach((l) => {
|
|
98
|
+
h(l, u, n, r, t, o);
|
|
99
|
+
}) : h(a, u, n, r, t, o);
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
103
|
+
function P(e, n, t, o) {
|
|
104
|
+
const c = e.querySelectorAll(".recommendation-product-row");
|
|
105
|
+
if (!c.length)
|
|
106
106
|
return;
|
|
107
|
-
const [i] =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const d =
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
h(
|
|
107
|
+
const [i] = c, r = i.querySelector("[data-attribute-type]"), s = r ? r.querySelectorAll(".attribute-cell").length : 1;
|
|
108
|
+
c.forEach((a, u) => {
|
|
109
|
+
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
110
|
+
const d = l.getAttribute("data-attribute-type") || "";
|
|
111
|
+
l.querySelectorAll(".attribute-cell").forEach((A, $) => {
|
|
112
|
+
const S = u * s + $;
|
|
113
|
+
h(A, d, n, S, t, o);
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
function R(e, n, t, o) {
|
|
119
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
120
|
+
P(i, n, t, o);
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
function O(
|
|
124
|
-
const
|
|
125
|
-
|
|
123
|
+
function O(e, n, t) {
|
|
124
|
+
const o = e.getAttribute("data-layout") || "grid", c = e.getAttribute("currency-alignment") || "after";
|
|
125
|
+
o === "list" ? E(e, n, c, t) : R(e, n, c, t);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
const
|
|
129
|
-
return
|
|
127
|
+
function y(e, n, t) {
|
|
128
|
+
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), c = e.match(o);
|
|
129
|
+
return c ? parseInt(c[1]) : t;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return e && A(e[1]) ? e[1] : null;
|
|
141
|
-
}
|
|
142
|
-
function T(t, o) {
|
|
143
|
-
let e = t.parentElement;
|
|
144
|
-
for (; e && e !== o; ) {
|
|
145
|
-
if (e.tagName === "TD" && $(e))
|
|
146
|
-
return e;
|
|
147
|
-
e = e.parentElement;
|
|
131
|
+
function T(e, n) {
|
|
132
|
+
let t = e.parentElement;
|
|
133
|
+
for (; t && t !== n; ) {
|
|
134
|
+
if (t.tagName === "TD") {
|
|
135
|
+
const o = t.getAttribute("width");
|
|
136
|
+
if (o && o.endsWith("%") && parseFloat(o) < 100)
|
|
137
|
+
return t;
|
|
138
|
+
}
|
|
139
|
+
t = t.parentElement;
|
|
148
140
|
}
|
|
149
141
|
return null;
|
|
150
142
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
|
|
143
|
+
function v(e) {
|
|
144
|
+
const n = e.getAttribute("style") || "", t = y(n, "width", 600), o = y(n, "padding", 0) * 2, c = Math.max(0, t - o);
|
|
145
|
+
c !== 0 && e.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
154
146
|
if (i.hasAttribute("width"))
|
|
155
147
|
return;
|
|
156
|
-
const r = T(i,
|
|
148
|
+
const r = T(i, e);
|
|
157
149
|
if (!r)
|
|
158
150
|
return;
|
|
159
|
-
const
|
|
160
|
-
i.setAttribute("width", String(
|
|
161
|
-
const
|
|
162
|
-
if (!/\bwidth\s*:\s*\d/i.test(
|
|
163
|
-
const
|
|
164
|
-
i.setAttribute("style", `${
|
|
151
|
+
const s = r.getAttribute("width"), a = parseFloat(s), u = y(r.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(c * a / 100), l = Math.max(1, p - u);
|
|
152
|
+
i.setAttribute("width", String(l));
|
|
153
|
+
const d = i.getAttribute("style") || "";
|
|
154
|
+
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
155
|
+
const f = d && !d.trim().endsWith(";") ? "; " : "";
|
|
156
|
+
i.setAttribute("style", `${d}${f}width: ${l}px`);
|
|
165
157
|
}
|
|
166
158
|
});
|
|
167
159
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
return (
|
|
171
|
-
` : "") +
|
|
160
|
+
function W(e, n) {
|
|
161
|
+
const t = e.match(/<!DOCTYPE[^>]*>/i);
|
|
162
|
+
return (t ? `${t[0]}
|
|
163
|
+
` : "") + n.documentElement.outerHTML;
|
|
172
164
|
}
|
|
173
|
-
function
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
176
|
-
return
|
|
177
|
-
const { buildCampaignUrl:
|
|
165
|
+
function F(e) {
|
|
166
|
+
const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), t = new DOMParser().parseFromString(n, "text/html"), o = t.querySelectorAll(".recommendation-block-v2");
|
|
167
|
+
if (!o.length)
|
|
168
|
+
return e;
|
|
169
|
+
const { buildCampaignUrl: c } = g(), i = C();
|
|
178
170
|
i.recommendationCampaignUrls = {};
|
|
179
|
-
const { isFeatureEnabled: r } =
|
|
180
|
-
return
|
|
181
|
-
var
|
|
171
|
+
const { isFeatureEnabled: r } = _(), s = r("liquidSyntax") ? "reco_" : "";
|
|
172
|
+
return o.forEach((u) => {
|
|
173
|
+
var l, d;
|
|
182
174
|
const p = u.getAttribute("recommendation-id");
|
|
183
|
-
p && ((
|
|
184
|
-
}),
|
|
175
|
+
p && ((l = u.parentNode) == null || l.insertBefore(t.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(t.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((f) => f.remove()), c(p), w(u) || O(u, p, s), v(u));
|
|
176
|
+
}), W(n, t).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
185
177
|
}
|
|
186
178
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
179
|
+
b as formatPriceVariable,
|
|
180
|
+
F as prepareRecommendationBlocks
|
|
189
181
|
};
|
package/dist/enums/toaster.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "error", r.Info = "information", r))(n || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
n as ToasterTypeOptions
|
|
4
4
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_BUTTON as C, ATTR_PRODUCT_OLD_PRICE as
|
|
2
|
-
import { buildSpacer as I, DEFAULT_CARD_COMPOSITION as g, buildElementRenderer as E, buildCellOptions as
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_BUTTON as C, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as m } from "../../constants/selectors.js";
|
|
2
|
+
import { buildSpacer as I, DEFAULT_CARD_COMPOSITION as g, buildElementRenderer as E, buildCellOptions as a, resolveInlinePriceOrder as w, DEFAULT_CARD_VISIBILITY as y } from "../utils.js";
|
|
3
3
|
import { listElementRenderer as L, renderInlineListPriceRow as O } from "./elementRenderer.js";
|
|
4
4
|
const S = "0 5px";
|
|
5
5
|
function U(l, r, n) {
|
|
@@ -27,40 +27,40 @@ const N = `
|
|
|
27
27
|
</td>
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
30
|
+
function $(l, r = g, n = {}, e = {}) {
|
|
31
31
|
const {
|
|
32
32
|
cellPadding: o = S,
|
|
33
33
|
cardBackgroundColor: d,
|
|
34
34
|
visibility: c,
|
|
35
|
-
priceInline:
|
|
36
|
-
} = e, u = d ? ` style="
|
|
35
|
+
priceInline: i = !1
|
|
36
|
+
} = e, u = d ? ` style="background-color: ${d};"` : "", s = E(L, r, n), P = s[p](l, a(p, e)), R = w(r), T = `
|
|
37
37
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
38
38
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
39
39
|
<tbody>
|
|
40
|
-
${r.filter((t) => t !== p && t !== C).filter((t) => !(
|
|
41
|
-
const b = (c == null ? void 0 : c[t]) ?? y[t] ?? !0,
|
|
40
|
+
${r.filter((t) => t !== p && t !== C).filter((t) => !(i && t === R.skip)).filter((t) => s[t]).map((t) => {
|
|
41
|
+
const b = (c == null ? void 0 : c[t]) ?? y[t] ?? !0, A = i && t === R.anchor ? O(
|
|
42
42
|
l,
|
|
43
43
|
R.originalFirst,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
) : s[t](l,
|
|
47
|
-
return U(
|
|
44
|
+
a(m, e),
|
|
45
|
+
a(f, e)
|
|
46
|
+
) : s[t](l, a(t, e));
|
|
47
|
+
return U(A, t, b);
|
|
48
48
|
}).join(`
|
|
49
49
|
`)}
|
|
50
50
|
</tbody>
|
|
51
51
|
</table>
|
|
52
52
|
</td>
|
|
53
|
-
`, _ = s[C](l,
|
|
53
|
+
`, _ = s[C](l, a(C, e)), D = P + T + _;
|
|
54
54
|
return N.replace("{-{-CARD_PADDING-}-}", o).replace("{-{-WRAPPER_STYLE-}-}", u).replace("{-{-PRODUCT_CONTENT-}-}", D);
|
|
55
55
|
}
|
|
56
56
|
function W(l, r, n = {}, e = {}) {
|
|
57
57
|
const o = I(e.rowSpacingPx);
|
|
58
58
|
return l.map((d, c) => {
|
|
59
|
-
const
|
|
60
|
-
return c > 0 ? o +
|
|
59
|
+
const i = $(d, r, n, e);
|
|
60
|
+
return c > 0 ? o + i : i;
|
|
61
61
|
}).join("");
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
$ as getListProductCard,
|
|
65
65
|
W as prepareProductRows
|
|
66
66
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useToaster as
|
|
1
|
+
import { useToaster as n } from "../../../composables/useToaster.js";
|
|
2
2
|
import { useTranslations as s } from "../../../composables/useTranslations.js";
|
|
3
|
-
import { ToasterTypeOptions as
|
|
3
|
+
import { ToasterTypeOptions as r } from "../../../enums/toaster.js";
|
|
4
4
|
import { countLiveRecommendationBlocks as i } from "./utils/recommendationBlockCount.js";
|
|
5
|
-
const
|
|
6
|
-
const { showToaster: o } =
|
|
5
|
+
const c = "newsletter.multiple-reco-blocks-warning", u = () => {
|
|
6
|
+
const { showToaster: o } = n(), t = s();
|
|
7
7
|
return { warnIfMultipleBlocks: (e) => {
|
|
8
8
|
i(e) > 1 && o({
|
|
9
|
-
type:
|
|
10
|
-
message: t(
|
|
9
|
+
type: r.Info,
|
|
10
|
+
message: t(c)
|
|
11
11
|
});
|
|
12
12
|
} };
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
u as useRecommendationBlockWarning
|
|
16
16
|
};
|
|
@@ -4,11 +4,12 @@ import { useToaster as C } from "../composables/useToaster.js";
|
|
|
4
4
|
import { useTranslations as h } from "../composables/useTranslations.js";
|
|
5
5
|
import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
|
|
6
6
|
import { EditorType as v } from "../enums/defaults.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ToasterTypeOptions as N } from "../enums/toaster.js";
|
|
8
|
+
import { useRecommendationExtensionStore as x } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { useSaveAsTemplateStore as A } from "../stores/save-as-template.js";
|
|
9
10
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
10
|
-
import { useTemplatePreparation as
|
|
11
|
-
const
|
|
11
|
+
import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
|
|
12
|
+
const j = () => {
|
|
12
13
|
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = h();
|
|
13
14
|
return {
|
|
14
15
|
getCategories: async () => {
|
|
@@ -39,7 +40,7 @@ const $ = () => {
|
|
|
39
40
|
createTemplate: async () => {
|
|
40
41
|
var e, t, d, y;
|
|
41
42
|
try {
|
|
42
|
-
const { prepareTemplateDetails: i } =
|
|
43
|
+
const { prepareTemplateDetails: i } = E(), s = A(), a = await i();
|
|
43
44
|
if (p("liquidSyntax") && !await g(a.compiledHtml))
|
|
44
45
|
return !1;
|
|
45
46
|
const f = {
|
|
@@ -53,7 +54,7 @@ const $ = () => {
|
|
|
53
54
|
unsubscriptionPreferencePageStatus: !1,
|
|
54
55
|
unsubscriptionPreferencePages: [],
|
|
55
56
|
recommendationCampaignUrls: r(
|
|
56
|
-
|
|
57
|
+
x().recommendationCampaignUrls
|
|
57
58
|
),
|
|
58
59
|
recommendationConfigs: r({}),
|
|
59
60
|
isGuido: !0,
|
|
@@ -74,7 +75,7 @@ const $ = () => {
|
|
|
74
75
|
"newsletter.template-library-save-alert",
|
|
75
76
|
{ templateName: s.getTemplateName }
|
|
76
77
|
),
|
|
77
|
-
type:
|
|
78
|
+
type: N.Alert
|
|
78
79
|
}), !1) : (l({
|
|
79
80
|
message: u(
|
|
80
81
|
"newsletter.template-library-save-success",
|
|
@@ -89,5 +90,5 @@ const $ = () => {
|
|
|
89
90
|
};
|
|
90
91
|
};
|
|
91
92
|
export {
|
|
92
|
-
|
|
93
|
+
j as useTemplateLibraryApi
|
|
93
94
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StripoNotifications } from '@@/Types/stripo';
|
|
2
|
+
/**
|
|
3
|
+
* Adapter that routes Stripo's in-editor notifications through Guido's own
|
|
4
|
+
* InToasts-based toaster, so the editor only ever shows one toaster style.
|
|
5
|
+
* Passed to `initEditor` as the `notifications` config (Stripo then delegates
|
|
6
|
+
* rendering to us instead of drawing its native <ue-notifications-container>).
|
|
7
|
+
*/
|
|
8
|
+
export declare const useStripoNotifications: () => {
|
|
9
|
+
getStripoNotifications: () => StripoNotifications;
|
|
10
|
+
};
|
|
@@ -4,15 +4,14 @@ export declare const useToasterStore: import("pinia").StoreDefinition<"guidoToas
|
|
|
4
4
|
status: boolean;
|
|
5
5
|
type: import("@@/Types/toaster").ToasterType;
|
|
6
6
|
text: string;
|
|
7
|
-
icon: string;
|
|
8
|
-
withIcon: boolean;
|
|
9
7
|
withoutLeftMargin: boolean;
|
|
8
|
+
autoHide: boolean;
|
|
10
9
|
actionButton?: {
|
|
11
10
|
text: string;
|
|
12
11
|
onClick: () => void;
|
|
13
12
|
} | undefined;
|
|
14
13
|
} & import("pinia").PiniaCustomStateProperties<ToasterState>) => boolean;
|
|
15
14
|
}, {
|
|
16
|
-
showToaster(this: ToasterState, { type, message, actionButton }: ToasterOptions): void;
|
|
15
|
+
showToaster(this: ToasterState, { type, message, actionButton, autoHide }: ToasterOptions): void;
|
|
17
16
|
hideToaster(this: ToasterState): void;
|
|
18
17
|
}>;
|
package/dist/stores/toaster.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { ToasterTypeOptions as e } from "../enums/toaster.js";
|
|
2
|
-
import { defineStore as
|
|
3
|
-
const
|
|
2
|
+
import { defineStore as a } from "pinia";
|
|
3
|
+
const u = () => ({
|
|
4
4
|
status: !1,
|
|
5
5
|
type: e.Success,
|
|
6
6
|
text: "",
|
|
7
|
-
icon: "",
|
|
8
|
-
withIcon: !0,
|
|
9
7
|
withoutLeftMargin: !1,
|
|
8
|
+
autoHide: !0,
|
|
10
9
|
actionButton: void 0
|
|
11
|
-
}),
|
|
12
|
-
state: () =>
|
|
10
|
+
}), h = a("guidoToaster", {
|
|
11
|
+
state: () => u(),
|
|
13
12
|
getters: {
|
|
14
|
-
|
|
13
|
+
// A toast without auto-hide (e.g. Stripo `loader`) stays until hideToaster.
|
|
14
|
+
shouldAutoHide: (t) => t.status && !!t.text && t.autoHide
|
|
15
15
|
},
|
|
16
16
|
actions: {
|
|
17
|
-
showToaster({ type: t = e.Success, message: s, actionButton: o }) {
|
|
18
|
-
this.status = !0, this.text = s, this.type = t, this.actionButton = o;
|
|
17
|
+
showToaster({ type: t = e.Success, message: s, actionButton: o, autoHide: i = !0 }) {
|
|
18
|
+
this.status = !0, this.text = s, this.type = t, this.actionButton = o, this.autoHide = i;
|
|
19
19
|
},
|
|
20
20
|
hideToaster() {
|
|
21
21
|
this.status = !1;
|
|
@@ -23,5 +23,5 @@ const a = () => ({
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
h as useToasterStore
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.9.0-beta.
|
|
3
|
+
"version": "3.9.0-beta.dd55e19",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "ISC",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@stripoinc/ui-editor-extensions": "3.8.0",
|
|
40
|
-
"@useinsider/design-system-vue": "1.
|
|
40
|
+
"@useinsider/design-system-vue": "1.3.0",
|
|
41
41
|
"@vueuse/core": "11.3.0",
|
|
42
42
|
"lodash-es": "4.17.21",
|
|
43
43
|
"pinia": "2.3.1",
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const n = `ue-notifications-container {
|
|
2
|
-
left: 96px;
|
|
3
|
-
margin: 0;
|
|
4
|
-
bottom: 32px;
|
|
5
|
-
top: unset;
|
|
6
|
-
width: unset;
|
|
7
|
-
position: fixed;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
ue-notifications-container ue-message + ue-message {
|
|
11
|
-
margin-bottom: 24px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
ue-notifications-container .alert-message-wrapper {
|
|
15
|
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
16
|
-
border: none;
|
|
17
|
-
padding: 16px 24px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
ue-notifications-container .alert-message-wrapper.info,
|
|
21
|
-
ue-notifications-container .alert-message-wrapper.loader {
|
|
22
|
-
background-color: var(--guido-color-background-toaster-info) !important;
|
|
23
|
-
color: inherit;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.alert-message-wrapper .alert-message-main {
|
|
27
|
-
align-items: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
ue-notifications-container ue-caption .caption {
|
|
31
|
-
color: var(--guido-color-white) !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
ue-block-thumb-hint {
|
|
35
|
-
text-align: left;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
|
|
39
|
-
width: calc(100% - 64px);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-text {
|
|
43
|
-
font-size: 15px;
|
|
44
|
-
font-weight: 600;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
ue-notifications-container .alert-message-text,
|
|
48
|
-
ue-notifications-container .alert-message-wrapper ue-icon-component.icon,
|
|
49
|
-
ue-notifications-container .alert-message-wrapper ue-icon-component.icon-button {
|
|
50
|
-
color: var(--guido-color-white);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
ue-notifications-container ue-message ue-button.close {
|
|
54
|
-
margin: 0 0 0 16px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
ue-notifications-container .alert-message-wrapper.success {
|
|
58
|
-
background: var(--guido-color-background-toaster-success);
|
|
59
|
-
color: inherit;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
ue-notifications-container .alert-message-wrapper.error {
|
|
63
|
-
background: var(--guido-color-background-toaster-error);
|
|
64
|
-
color: inherit;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
ue-notifications-container .alert-message-wrapper.warn {
|
|
68
|
-
background: var(--guido-color-background-toaster-warn);
|
|
69
|
-
color: inherit;
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
export {
|
|
73
|
-
n as default
|
|
74
|
-
};
|