@useinsider/guido 3.1.1-beta.c728f08 → 3.1.1-beta.cdcd41d
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/@types/config/schemas.js +9 -7
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +81 -91
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +55 -53
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +79 -81
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/static/styles/base.css.js +2 -7
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/dist/utils/templatePreparation.js +16 -14
- package/package.json +3 -3
|
@@ -114,7 +114,9 @@ const m = {
|
|
|
114
114
|
/** Enable unsubscribe block */
|
|
115
115
|
unsubscribe: e(a(), !0),
|
|
116
116
|
/** Disable modules panel in the editor */
|
|
117
|
-
modulesDisabled: e(a(), !1)
|
|
117
|
+
modulesDisabled: e(a(), !1),
|
|
118
|
+
/** Enable Liquid template syntax */
|
|
119
|
+
liquidSyntax: e(a(), !1)
|
|
118
120
|
}), E = n([
|
|
119
121
|
"amp-accordion",
|
|
120
122
|
"amp-carousel",
|
|
@@ -191,12 +193,12 @@ const m = {
|
|
|
191
193
|
M,
|
|
192
194
|
N,
|
|
193
195
|
D
|
|
194
|
-
]),
|
|
196
|
+
]), x = o({
|
|
195
197
|
/** Custom compiler rules to apply */
|
|
196
198
|
customRules: e(c(v), []),
|
|
197
199
|
/** Skip default compiler rules */
|
|
198
200
|
ignoreDefaultRules: e(a(), !1)
|
|
199
|
-
}),
|
|
201
|
+
}), U = o({
|
|
200
202
|
/**
|
|
201
203
|
* External validation handler called before save completes.
|
|
202
204
|
* Return false to cancel the save operation.
|
|
@@ -225,15 +227,15 @@ const m = {
|
|
|
225
227
|
/** Block configuration */
|
|
226
228
|
blocks: e(O, {}),
|
|
227
229
|
/** Compiler configuration */
|
|
228
|
-
compiler: e(
|
|
230
|
+
compiler: e(x, {}),
|
|
229
231
|
/** Callbacks and event handlers */
|
|
230
|
-
callbacks: e(
|
|
232
|
+
callbacks: e(U, {})
|
|
231
233
|
});
|
|
232
234
|
export {
|
|
233
235
|
O as BlocksSchema,
|
|
234
|
-
|
|
236
|
+
U as CallbacksSchema,
|
|
235
237
|
v as CompilerRuleSchema,
|
|
236
|
-
|
|
238
|
+
x as CompilerSchema,
|
|
237
239
|
g as CustomBlockTypeSchema,
|
|
238
240
|
D as CustomRuleSchema,
|
|
239
241
|
E as DefaultBlockTypeSchema,
|
|
@@ -3,7 +3,7 @@ import i from "./Guido.vue2.js";
|
|
|
3
3
|
import a from "../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var t = function() {
|
|
5
5
|
var o = this, r = o._self._c, e = o._self._setupProxy;
|
|
6
|
-
return r("div", {
|
|
6
|
+
return r("div", { staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : o._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.FilterSelectionDrawer), r(e.SaveAsTemplateDrawer), e.isTestPartner() ? o._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
|
|
7
7
|
return e.emit("onboarding:finished");
|
|
8
8
|
} } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
|
|
9
9
|
}, n = [], s = /* @__PURE__ */ a(
|
|
@@ -12,9 +12,9 @@ var t = function() {
|
|
|
12
12
|
n,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"a26d7792"
|
|
16
16
|
);
|
|
17
|
-
const
|
|
17
|
+
const v = s.exports;
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
v as default
|
|
20
20
|
};
|
|
@@ -1,131 +1,121 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import { useTimerClone as
|
|
6
|
-
import { migrate as
|
|
7
|
-
import { ModuleFolderDefaults as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
const Re = /* @__PURE__ */ j({
|
|
1
|
+
import { defineComponent as K, defineAsyncComponent as _, ref as V, computed as P, watch as j, onMounted as q, onUnmounted as J } from "vue";
|
|
2
|
+
import { provideGuidoActions as Q } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as X } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as Y } from "../composables/useStripo.js";
|
|
5
|
+
import { useTimerClone as Z } from "../composables/useTimerClone.js";
|
|
6
|
+
import { migrate as A } from "../config/migrator/index.js";
|
|
7
|
+
import { ModuleFolderDefaults as N } from "../enums/defaults.js";
|
|
8
|
+
import $ from "./organisms/base/Toaster.vue.js";
|
|
9
|
+
import ee from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
10
|
+
import oe from "./organisms/header/HeaderWrapper.vue.js";
|
|
11
|
+
import te from "./organisms/LoadingWrapper.vue.js";
|
|
12
|
+
import ne from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
13
|
+
import se from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
14
|
+
import { useStripoApi as re } from "../services/stripoApi.js";
|
|
15
|
+
import { useConfigStore as ce } from "../stores/config.js";
|
|
16
|
+
import { useDynamicContentStore as ae } from "../stores/dynamic-content.js";
|
|
17
|
+
import { useEditorStore as ie } from "../stores/editor.js";
|
|
18
|
+
import { usePreviewStore as me } from "../stores/preview.js";
|
|
19
|
+
import { useUnsubscribeStore as de } from "../stores/unsubscribe.js";
|
|
20
|
+
const Me = /* @__PURE__ */ K({
|
|
22
21
|
__name: "Guido",
|
|
23
22
|
props: {
|
|
24
23
|
config: null
|
|
25
24
|
},
|
|
26
25
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
26
|
+
setup(W, { expose: I, emit: t }) {
|
|
27
|
+
const v = W, O = _(
|
|
29
28
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
30
|
-
),
|
|
29
|
+
), G = _(
|
|
31
30
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
const
|
|
31
|
+
), h = V(), i = ae(), y = de(), s = ce();
|
|
32
|
+
s.init(v.config);
|
|
33
|
+
const m = ie(), H = me(), c = P(() => m.hasChanges), { isTestPartner: x } = X(), f = () => {
|
|
35
34
|
var e;
|
|
36
|
-
return (e =
|
|
35
|
+
return (e = h.value) == null ? void 0 : e.handleSave(!0);
|
|
37
36
|
}, {
|
|
38
|
-
templateId:
|
|
39
|
-
userId:
|
|
40
|
-
partnerName:
|
|
41
|
-
username:
|
|
42
|
-
template:
|
|
43
|
-
editor:
|
|
44
|
-
} =
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
emailId:
|
|
48
|
-
userId:
|
|
49
|
-
username:
|
|
50
|
-
partnerName:
|
|
51
|
-
savedModulesFolderName:
|
|
52
|
-
defaultModulesFolderName:
|
|
53
|
-
},
|
|
54
|
-
preselectedDynamicContentList:
|
|
37
|
+
templateId: d,
|
|
38
|
+
userId: b,
|
|
39
|
+
partnerName: S,
|
|
40
|
+
username: g,
|
|
41
|
+
template: o,
|
|
42
|
+
editor: n
|
|
43
|
+
} = s, a = (o == null ? void 0 : o.html) || "", D = (o == null ? void 0 : o.css) || "", l = (o == null ? void 0 : o.preselectedDynamicContent) || [], w = (n == null ? void 0 : n.savedModulesFolderName) || N.SAVED_MODULES, E = (n == null ? void 0 : n.defaultModulesFolderName) || N.DEFAULT_MODULES;
|
|
44
|
+
m.templateId = d;
|
|
45
|
+
const u = {
|
|
46
|
+
emailId: d,
|
|
47
|
+
userId: b,
|
|
48
|
+
username: g,
|
|
49
|
+
partnerName: S,
|
|
50
|
+
savedModulesFolderName: w,
|
|
51
|
+
defaultModulesFolderName: E
|
|
52
|
+
}, C = {
|
|
53
|
+
preselectedDynamicContentList: l,
|
|
55
54
|
onReady: () => {
|
|
56
|
-
console.debug("guido:ready"),
|
|
55
|
+
console.debug("guido:ready"), t("ready");
|
|
57
56
|
}
|
|
58
|
-
}, { initPlugin:
|
|
57
|
+
}, { initPlugin: T } = Y(u, C), { getDefaultTemplate: k } = re(), { cloneTimersOnSave: F, hasTimerBlocks: U } = Z(), B = P(() => {
|
|
59
58
|
var e;
|
|
60
|
-
return !((e =
|
|
59
|
+
return !((e = s.ui) != null && e.showHeader);
|
|
61
60
|
});
|
|
62
|
-
|
|
61
|
+
Q({
|
|
63
62
|
onBack: () => {
|
|
64
|
-
console.debug("guido:back"),
|
|
63
|
+
console.debug("guido:back"), t("back");
|
|
65
64
|
},
|
|
66
65
|
onSaveStart: () => {
|
|
67
|
-
console.debug("guido:save:start"),
|
|
66
|
+
console.debug("guido:save:start"), t("save:start");
|
|
68
67
|
},
|
|
69
68
|
onSaveComplete: (e) => {
|
|
70
|
-
const
|
|
71
|
-
console.debug("guido:save:complete",
|
|
69
|
+
const r = { ...e, metadata: u };
|
|
70
|
+
console.debug("guido:save:complete", r), t("save:complete", r);
|
|
72
71
|
},
|
|
73
72
|
onTestEmailClick: () => {
|
|
74
|
-
console.debug("guido:test-email:click"),
|
|
73
|
+
console.debug("guido:test-email:click"), t("test-email:click");
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
|
-
const
|
|
78
|
-
console.debug("dynamic-content:close", e),
|
|
79
|
-
},
|
|
76
|
+
const L = (e) => {
|
|
77
|
+
console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
78
|
+
}, M = () => {
|
|
80
79
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
81
80
|
};
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
j(() => c.value, () => {
|
|
82
|
+
t("on-change", c.value);
|
|
84
83
|
});
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
console.debug("dynamic-content:open",
|
|
84
|
+
const p = (e) => {
|
|
85
|
+
const r = e, { attribute: R, position: z } = r.detail;
|
|
86
|
+
console.debug("dynamic-content:open", r.detail), t("dynamic-content:open", R, z);
|
|
88
87
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var n;
|
|
92
|
-
const e = document.querySelector(oe);
|
|
93
|
-
(n = d.value) == null || n.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
94
|
-
};
|
|
95
|
-
return Q(async () => {
|
|
96
|
-
var n;
|
|
97
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h();
|
|
98
|
-
const e = (n = d.value) == null ? void 0 : n.parentElement;
|
|
99
|
-
e && (c = new ResizeObserver(h), c.observe(e));
|
|
88
|
+
return q(async () => {
|
|
89
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
100
90
|
try {
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
html:
|
|
104
|
-
css:
|
|
91
|
+
y.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
92
|
+
let e = {
|
|
93
|
+
html: a && await A(a),
|
|
94
|
+
css: D
|
|
105
95
|
};
|
|
106
|
-
|
|
107
|
-
} catch (
|
|
108
|
-
console.error("Failed to initialize Stripo editor:",
|
|
96
|
+
e.html || (e = await k(), e.html = await A(e.html)), U(e.html) && (e.html = await F(e.html)), await T(e), i.selectedDynamicContentList = l;
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.error("Failed to initialize Stripo editor:", e);
|
|
109
99
|
}
|
|
110
|
-
document.addEventListener("dynamic-content:open",
|
|
111
|
-
}),
|
|
112
|
-
|
|
100
|
+
document.addEventListener("dynamic-content:open", p);
|
|
101
|
+
}), J(() => {
|
|
102
|
+
document.removeEventListener("dynamic-content:open", p);
|
|
113
103
|
try {
|
|
114
104
|
window.UIEditor.removeEditor();
|
|
115
105
|
} catch {
|
|
116
106
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
117
107
|
}
|
|
118
|
-
|
|
119
|
-
}),
|
|
108
|
+
s.reset();
|
|
109
|
+
}), I({
|
|
120
110
|
dynamicContent: {
|
|
121
|
-
insert:
|
|
122
|
-
close:
|
|
111
|
+
insert: L,
|
|
112
|
+
close: M
|
|
123
113
|
},
|
|
124
|
-
hasChanges:
|
|
125
|
-
saveSilent:
|
|
126
|
-
}), { __sfc: !0, PreviewContainer:
|
|
114
|
+
hasChanges: c,
|
|
115
|
+
saveSilent: f
|
|
116
|
+
}), { __sfc: !0, PreviewContainer: O, OnboardingWrapper: G, headerWrapperRef: h, dynamicContentStore: i, unsubscribeStore: y, props: v, configStore: s, editorStore: m, previewStore: H, hasChanges: c, isTestPartner: x, saveSilent: f, templateId: d, userId: b, partnerName: S, username: g, templateConfig: o, editorConfig: n, html: a, css: D, preselectedDynamicContentList: l, savedModulesFolderName: w, defaultModulesFolderName: E, emit: t, metadata: u, options: C, initPlugin: T, getDefaultTemplate: k, cloneTimersOnSave: F, hasTimerBlocks: U, noHeader: B, insertDynamicContent: L, closeDynamicContent: M, handleDynamicContentOpen: p, Toaster: $, FilterSelectionDrawer: ee, HeaderWrapper: oe, LoadingWrapper: te, SaveAsTemplateDrawer: ne, UnsubscribeWrapper: se };
|
|
127
117
|
}
|
|
128
118
|
});
|
|
129
119
|
export {
|
|
130
|
-
|
|
120
|
+
Me as default
|
|
131
121
|
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import { useDynamicContentStore as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
const
|
|
1
|
+
import { usePartner as y } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as p, LINK_TYPES as S, INSIDER_ID as m, URLS as R } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as I } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as N } from "../../stores/config.js";
|
|
5
|
+
import { useDynamicContentStore as U } from "../../stores/dynamic-content.js";
|
|
6
|
+
import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
|
|
7
|
+
const G = [
|
|
8
8
|
{
|
|
9
9
|
id: "add-unsubscribe-link-values",
|
|
10
10
|
description: "Adding unsubscribe link values",
|
|
11
11
|
type: "custom",
|
|
12
12
|
processor: (t) => {
|
|
13
|
-
const { getPartnerName: i } =
|
|
13
|
+
const { getPartnerName: i } = y(), o = N(), s = U(), d = C(), a = o.variationId;
|
|
14
14
|
if (!a)
|
|
15
15
|
return t;
|
|
16
16
|
let e = t;
|
|
17
|
-
const r = `/${i()}/email/${a}?user={{iid}}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const r = `/${i()}/email/${a}?user={{iid}}`, E = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
|
|
18
|
+
let c = !1, l = !1;
|
|
19
|
+
return E.forEach((f) => {
|
|
20
|
+
var b;
|
|
21
|
+
const u = f.getAttribute("data-unsubscribe-page-list");
|
|
22
|
+
if (!u)
|
|
22
23
|
return;
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
)) ?? []
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), e;
|
|
24
|
+
const _ = I(u), g = ((b = d.templates) == null ? void 0 : b.filter(
|
|
25
|
+
(n) => _.includes(n.id)
|
|
26
|
+
)) ?? [];
|
|
27
|
+
c = c || g.some((n) => n.type === S.UNSUBSCRIBE_LINK_TYPE), l = l || g.some((n) => n.type === S.PREFERENCES_LINK_TYPE);
|
|
28
|
+
}), (c || l) && (s.selectedDynamicContentList.some((u) => u.value === m) || s.selectedDynamicContentList.push({
|
|
29
|
+
text: m,
|
|
30
|
+
value: m,
|
|
31
|
+
fallback: ""
|
|
32
|
+
})), c && (e = e.replace(
|
|
33
|
+
p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
34
|
+
R.UNSUBSCRIBE_URL + r
|
|
35
|
+
)), l && (e = e.replace(
|
|
36
|
+
p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
37
|
+
R.PREFERENCES_URL + r
|
|
38
|
+
)), E.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
|
|
39
39
|
},
|
|
40
40
|
priority: 60
|
|
41
41
|
},
|
|
@@ -43,7 +43,7 @@ const D = [
|
|
|
43
43
|
id: "remove-data-ogsb-button-styles",
|
|
44
44
|
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
45
45
|
type: "regex",
|
|
46
|
-
pattern:
|
|
46
|
+
pattern: p.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
47
47
|
replacement: "",
|
|
48
48
|
flags: "g",
|
|
49
49
|
priority: 61
|
|
@@ -61,16 +61,16 @@ const D = [
|
|
|
61
61
|
type: "custom",
|
|
62
62
|
processor: (t) => {
|
|
63
63
|
let i = t;
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
if (
|
|
64
|
+
const o = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
65
|
+
return o && o.forEach((s) => {
|
|
66
|
+
if (s.includes("insEmail=1"))
|
|
67
67
|
return;
|
|
68
|
-
if (
|
|
69
|
-
const a =
|
|
68
|
+
if (s.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
69
|
+
const a = s.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
|
|
70
70
|
const r = e.slice(6, e.length - 1).trim();
|
|
71
71
|
return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
|
|
72
72
|
});
|
|
73
|
-
i = i.replace(
|
|
73
|
+
i = i.replace(s, a);
|
|
74
74
|
}
|
|
75
75
|
}), i;
|
|
76
76
|
},
|
|
@@ -78,5 +78,5 @@ const D = [
|
|
|
78
78
|
}
|
|
79
79
|
];
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
G as unsubscribeCompilerRules
|
|
82
82
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useConfig as S } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
|
+
function y(e, n, r, o, s = "") {
|
|
4
|
+
const u = `{{${s}${e}_${n}_${r}}}`, t = `{{${s}${e}_${n}_currency}}`;
|
|
5
|
+
return o === "before" ? `${t} ${u}` : `${u} ${t}`;
|
|
5
6
|
}
|
|
6
|
-
function p(e,
|
|
7
|
-
switch (
|
|
7
|
+
function p(e, n, r, o, s, u) {
|
|
8
|
+
switch (n) {
|
|
8
9
|
case "productImage": {
|
|
9
10
|
const t = e.querySelector("img");
|
|
10
|
-
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
11
|
+
t && (t.setAttribute("src", `{{${u}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${u}${r}_${o}_name}}`));
|
|
11
12
|
const c = e.querySelector("a");
|
|
12
|
-
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
13
|
+
c && c.setAttribute("href", `{{${u}${r}_${o}_url}}`);
|
|
13
14
|
break;
|
|
14
15
|
}
|
|
15
16
|
case "productName": {
|
|
16
17
|
const t = e.querySelector("p");
|
|
17
18
|
if (t) {
|
|
18
19
|
const c = t.querySelector("strong") || t;
|
|
19
|
-
c.textContent = `{{${r}_${o}_name}}`;
|
|
20
|
+
c.textContent = `{{${u}${r}_${o}_name}}`;
|
|
20
21
|
}
|
|
21
22
|
break;
|
|
22
23
|
}
|
|
@@ -24,7 +25,7 @@ function p(e, u, r, o, n) {
|
|
|
24
25
|
const t = e.querySelector("p");
|
|
25
26
|
if (t) {
|
|
26
27
|
const c = t.querySelector("strong") || t;
|
|
27
|
-
c.textContent =
|
|
28
|
+
c.textContent = y(r, o, "price", s, u);
|
|
28
29
|
}
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
@@ -32,24 +33,25 @@ function p(e, u, r, o, n) {
|
|
|
32
33
|
const t = e.querySelector("p");
|
|
33
34
|
if (t) {
|
|
34
35
|
const c = t.querySelector("strong") || t;
|
|
35
|
-
c.textContent =
|
|
36
|
+
c.textContent = y(
|
|
36
37
|
r,
|
|
37
38
|
o,
|
|
38
39
|
"original_price",
|
|
39
|
-
|
|
40
|
+
s,
|
|
41
|
+
u
|
|
40
42
|
), t.setAttribute("product-attr", "discount");
|
|
41
43
|
}
|
|
42
44
|
break;
|
|
43
45
|
}
|
|
44
46
|
case "productButton": {
|
|
45
47
|
const t = e.querySelector("a");
|
|
46
|
-
t && t.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
48
|
+
t && t.setAttribute("href", `{{${u}${r}_${o}_url}}`);
|
|
47
49
|
break;
|
|
48
50
|
}
|
|
49
51
|
case "productOmnibusPrice": {
|
|
50
52
|
const t = e.querySelector(".omnibus-price-value");
|
|
51
53
|
if (t) {
|
|
52
|
-
t.textContent = `{{${r}_${o}_omnibus_price}}`;
|
|
54
|
+
t.textContent = `{{${u}${r}_${o}_omnibus_price}}`;
|
|
53
55
|
const c = t.closest("p");
|
|
54
56
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
55
57
|
}
|
|
@@ -58,7 +60,7 @@ function p(e, u, r, o, n) {
|
|
|
58
60
|
case "productOmnibusDiscount": {
|
|
59
61
|
const t = e.querySelector(".omnibus-discount-value");
|
|
60
62
|
if (t) {
|
|
61
|
-
t.textContent = `{{${r}_${o}_omnibus_discount}}`;
|
|
63
|
+
t.textContent = `{{${u}${r}_${o}_omnibus_discount}}`;
|
|
62
64
|
const c = t.closest("p");
|
|
63
65
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
64
66
|
}
|
|
@@ -67,66 +69,66 @@ function p(e, u, r, o, n) {
|
|
|
67
69
|
default: {
|
|
68
70
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
69
71
|
if (t) {
|
|
70
|
-
const c = t.getAttribute("product-attr"),
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
73
|
-
|
|
72
|
+
const c = t.getAttribute("product-attr"), i = t.querySelector("p");
|
|
73
|
+
if (i) {
|
|
74
|
+
const a = i.querySelector("strong") || i;
|
|
75
|
+
a.textContent = `{{${u}${r}_${o}_${c}}}`;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
break;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
function
|
|
81
|
-
e.querySelectorAll(".recommendation-product-row").forEach((
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
p(
|
|
86
|
-
}) : p(
|
|
82
|
+
function q(e, n, r, o) {
|
|
83
|
+
e.querySelectorAll(".recommendation-product-row").forEach((u, t) => {
|
|
84
|
+
u.querySelectorAll("[data-attribute-type]").forEach((i) => {
|
|
85
|
+
const a = i.getAttribute("data-attribute-type") || "", b = i.querySelectorAll(".attribute-cell");
|
|
86
|
+
b.length > 0 ? b.forEach((l) => {
|
|
87
|
+
p(l, a, n, t, r, o);
|
|
88
|
+
}) : p(i, a, n, t, r, o);
|
|
87
89
|
});
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
92
|
+
function d(e, n, r, o) {
|
|
93
|
+
const s = e.querySelectorAll(".recommendation-product-row");
|
|
94
|
+
if (!s.length)
|
|
93
95
|
return;
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const m =
|
|
100
|
-
p(
|
|
96
|
+
const [u] = s, t = u.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
97
|
+
s.forEach((i, a) => {
|
|
98
|
+
i.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
99
|
+
const $ = l.getAttribute("data-attribute-type") || "";
|
|
100
|
+
l.querySelectorAll(".attribute-cell").forEach((A, f) => {
|
|
101
|
+
const m = a * c + f;
|
|
102
|
+
p(A, $, n, m, r, o);
|
|
101
103
|
});
|
|
102
104
|
});
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
|
-
function
|
|
106
|
-
e.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
107
|
-
|
|
107
|
+
function g(e, n, r, o) {
|
|
108
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((u) => {
|
|
109
|
+
d(u, n, r, o);
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
112
|
+
function h(e, n, r) {
|
|
113
|
+
const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
|
|
114
|
+
o === "list" ? q(e, n, s, r) : g(e, n, s, r);
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function C(e, n) {
|
|
115
117
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
116
118
|
return (r ? `${r[0]}
|
|
117
|
-
` : "") +
|
|
119
|
+
` : "") + n.documentElement.outerHTML;
|
|
118
120
|
}
|
|
119
|
-
function
|
|
120
|
-
const
|
|
121
|
+
function P(e) {
|
|
122
|
+
const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(n, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
121
123
|
if (!o.length)
|
|
122
124
|
return e;
|
|
123
|
-
const { buildCampaignUrl:
|
|
124
|
-
return o.forEach((
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
}),
|
|
125
|
+
const { buildCampaignUrl: s } = _(), { isFeatureEnabled: u } = S(), t = u("liquidSyntax") ? "reco_" : "";
|
|
126
|
+
return o.forEach((i) => {
|
|
127
|
+
const a = i.getAttribute("recommendation-id");
|
|
128
|
+
a && (s(a), h(i, a, t));
|
|
129
|
+
}), C(n, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
128
130
|
}
|
|
129
131
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
y as formatPriceVariable,
|
|
133
|
+
P as prepareRecommendationBlocks
|
|
132
134
|
};
|
|
@@ -28,8 +28,8 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
28
28
|
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
|
|
29
29
|
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
|
|
30
30
|
COMPOSITION: /composition="true"/gm,
|
|
31
|
-
CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
-
CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
|
|
31
|
+
CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
+
CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
|
|
33
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
34
|
}, n = {
|
|
35
35
|
PARAGRAPH_END_TAG: "</p>"
|
|
@@ -169,7 +169,7 @@ class q extends b {
|
|
|
169
169
|
if (e && e.includes(a))
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${a}`)
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) : null;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Migrate configuration from legacy format
|