@useinsider/guido 3.4.1-beta.85c49f8 → 3.4.1-beta.87643d5
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/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +50 -48
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +49 -49
- package/dist/extensions/Blocks/Recommendation/block.js +90 -45
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +33 -14
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +16 -24
- package/dist/guido.css +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { provideGuidoActions as
|
|
4
|
-
import { useGuidoStateBridge as
|
|
5
|
-
import { usePartner as
|
|
6
|
-
import { useStripo as
|
|
7
|
-
import { useTimerClone as
|
|
1
|
+
import { defineComponent as Q, defineAsyncComponent as N, ref as I, computed as W, watch as X, onMounted as Y, onUnmounted as Z } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as ee } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { provideGuidoActions as oe } from "../composables/useGuidoActions.js";
|
|
4
|
+
import { useGuidoStateBridge as te } from "../composables/useGuidoStateBridge.js";
|
|
5
|
+
import { usePartner as ne } from "../composables/usePartner.js";
|
|
6
|
+
import { useStripo as re } from "../composables/useStripo.js";
|
|
7
|
+
import { useTimerClone as se } from "../composables/useTimerClone.js";
|
|
8
8
|
import { migrate as x } from "../config/migrator/index.js";
|
|
9
9
|
import { ModuleFolderDefaults as G } from "../enums/defaults.js";
|
|
10
|
-
import { RIBBON_SELECTOR as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
10
|
+
import { RIBBON_SELECTOR as ce } from "../enums/onboarding.js";
|
|
11
|
+
import { useRecommendationExtensionStore as ae } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
12
|
+
import ie from "./organisms/AutoSaveController.vue.js";
|
|
13
|
+
import me from "./organisms/base/Toaster.vue.js";
|
|
14
|
+
import de from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
15
|
+
import le from "./organisms/header/HeaderWrapper.vue.js";
|
|
16
|
+
import ue from "./organisms/LoadingWrapper.vue.js";
|
|
17
|
+
import pe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
18
|
+
import fe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
19
|
+
import { useStripoApi as ve } from "../services/stripoApi.js";
|
|
20
|
+
import { useConfigStore as ye } from "../stores/config.js";
|
|
21
|
+
import { useDynamicContentStore as Se } from "../stores/dynamic-content.js";
|
|
22
|
+
import { useEditorStore as H } from "../stores/editor.js";
|
|
22
23
|
import { usePreviewStore as he } from "../stores/preview.js";
|
|
23
|
-
import {
|
|
24
|
-
|
|
24
|
+
import { useTemplateStore as be } from "../stores/template.js";
|
|
25
|
+
import { useUnsubscribeStore as ge } from "../stores/unsubscribe.js";
|
|
26
|
+
const Ke = /* @__PURE__ */ Q({
|
|
25
27
|
__name: "Guido",
|
|
26
28
|
props: {
|
|
27
29
|
config: null
|
|
28
30
|
},
|
|
29
31
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
30
|
-
setup(
|
|
31
|
-
const g =
|
|
32
|
+
setup($, { expose: z, emit: n }) {
|
|
33
|
+
const g = $, q = N(
|
|
32
34
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
33
|
-
), K =
|
|
35
|
+
), K = N(
|
|
34
36
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
35
|
-
),
|
|
37
|
+
), E = I(), u = I(), p = Se(), w = ge(), i = ye();
|
|
36
38
|
i.init(g.config);
|
|
37
|
-
const f =
|
|
39
|
+
const f = H(), V = he(), m = W(() => f.hasChanges), { isTestPartner: j } = ne(), D = () => {
|
|
38
40
|
var e;
|
|
39
|
-
return (e =
|
|
41
|
+
return (e = E.value) == null ? void 0 : e.handleSave(!0);
|
|
40
42
|
}, {
|
|
41
43
|
templateId: v,
|
|
42
44
|
userId: C,
|
|
@@ -45,8 +47,8 @@ const He = /* @__PURE__ */ J({
|
|
|
45
47
|
template: o,
|
|
46
48
|
editor: s
|
|
47
49
|
} = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || G.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || G.DEFAULT_MODULES;
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
+
ee(), te();
|
|
51
|
+
const S = {
|
|
50
52
|
emailId: v,
|
|
51
53
|
userId: C,
|
|
52
54
|
username: k,
|
|
@@ -58,11 +60,11 @@ const He = /* @__PURE__ */ J({
|
|
|
58
60
|
onReady: () => {
|
|
59
61
|
console.debug("guido:ready"), n("ready");
|
|
60
62
|
}
|
|
61
|
-
}, { initPlugin: M } =
|
|
63
|
+
}, { initPlugin: M } = re(S, _), { getDefaultTemplate: O } = ve(), { cloneTimersOnSave: P, hasTimerBlocks: R } = se(), J = W(() => {
|
|
62
64
|
var e;
|
|
63
65
|
return !((e = i.ui) != null && e.showHeader);
|
|
64
66
|
});
|
|
65
|
-
|
|
67
|
+
oe({
|
|
66
68
|
onBack: () => {
|
|
67
69
|
console.debug("guido:back"), n("back");
|
|
68
70
|
},
|
|
@@ -70,50 +72,50 @@ const He = /* @__PURE__ */ J({
|
|
|
70
72
|
console.debug("guido:save:start"), n("save:start");
|
|
71
73
|
},
|
|
72
74
|
onSaveComplete: (e) => {
|
|
73
|
-
const t = { ...e, metadata:
|
|
75
|
+
const t = { ...e, metadata: S };
|
|
74
76
|
console.debug("guido:save:complete", t), n("save:complete", t);
|
|
75
77
|
},
|
|
76
78
|
onTestEmailClick: () => {
|
|
77
79
|
console.debug("guido:test-email:click"), n("test-email:click");
|
|
78
80
|
}
|
|
79
81
|
});
|
|
80
|
-
const
|
|
82
|
+
const A = (e) => {
|
|
81
83
|
console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
82
|
-
},
|
|
84
|
+
}, B = () => {
|
|
83
85
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
84
86
|
};
|
|
85
|
-
|
|
87
|
+
X(() => m.value, () => {
|
|
86
88
|
n("on-change", m.value);
|
|
87
89
|
});
|
|
88
|
-
const
|
|
90
|
+
const h = (e) => {
|
|
89
91
|
const t = e, { attribute: l, position: a } = t.detail;
|
|
90
92
|
console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
|
|
91
93
|
};
|
|
92
94
|
let c = null;
|
|
93
95
|
const b = () => {
|
|
94
96
|
var t;
|
|
95
|
-
const e = document.querySelector(
|
|
97
|
+
const e = document.querySelector(ce);
|
|
96
98
|
(t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
97
99
|
};
|
|
98
|
-
return
|
|
100
|
+
return Y(async () => {
|
|
99
101
|
var t, l;
|
|
100
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b();
|
|
102
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ae().$reset(), H().$reset(), f.templateId = v, be().$reset(), b();
|
|
101
103
|
const e = (t = u.value) == null ? void 0 : t.parentElement;
|
|
102
104
|
e && (c = new ResizeObserver(b), c.observe(e));
|
|
103
105
|
try {
|
|
104
|
-
|
|
106
|
+
w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
105
107
|
const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
|
|
106
108
|
let r = {
|
|
107
109
|
html: d && await x(d, a),
|
|
108
110
|
css: F
|
|
109
111
|
};
|
|
110
|
-
r.html || (r = await O(), r.html = await x(r.html, a)),
|
|
112
|
+
r.html || (r = await O(), r.html = await x(r.html, a)), R(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
|
|
111
113
|
} catch (a) {
|
|
112
114
|
console.error("Failed to initialize Stripo editor:", a);
|
|
113
115
|
}
|
|
114
|
-
document.addEventListener("dynamic-content:open",
|
|
115
|
-
}),
|
|
116
|
-
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
116
|
+
document.addEventListener("dynamic-content:open", h);
|
|
117
|
+
}), Z(() => {
|
|
118
|
+
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", h);
|
|
117
119
|
try {
|
|
118
120
|
window.UIEditor.removeEditor();
|
|
119
121
|
} catch {
|
|
@@ -122,14 +124,14 @@ const He = /* @__PURE__ */ J({
|
|
|
122
124
|
i.reset();
|
|
123
125
|
}), z({
|
|
124
126
|
dynamicContent: {
|
|
125
|
-
insert:
|
|
126
|
-
close:
|
|
127
|
+
insert: A,
|
|
128
|
+
close: B
|
|
127
129
|
},
|
|
128
130
|
hasChanges: m,
|
|
129
131
|
saveSilent: D
|
|
130
|
-
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef:
|
|
132
|
+
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: E, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: w, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: j, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: S, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: R, noHeader: J, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: h, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ie, Toaster: me, FilterSelectionDrawer: de, HeaderWrapper: le, LoadingWrapper: ue, SaveAsTemplateDrawer: pe, UnsubscribeWrapper: fe };
|
|
131
133
|
}
|
|
132
134
|
});
|
|
133
135
|
export {
|
|
134
|
-
|
|
136
|
+
Ke as default
|
|
135
137
|
};
|
|
@@ -5,7 +5,7 @@ var r = function() {
|
|
|
5
5
|
var a = this, e = a._self._c, t = a._self._setupProxy;
|
|
6
6
|
return e("div", { staticClass: "d-f f-d-c w-1 gap-16", attrs: { "data-filter-group": a.filter.filterGroup, "data-filter-number": a.filter.filterNumber } }, [e("div", { staticClass: "d-f a-i-c j-c-s-b pt-4", class: { "bor-t-s-s bor-t-w-1 bor-t-c-50": a.index === 0 } }, [e("p", [a._v(" " + a._s(t.trans("newsletter.filter")) + " " + a._s(a.index + 1) + " ")]), e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: function(s) {
|
|
7
7
|
return t.emit("delete-filter", t.props.filter);
|
|
8
|
-
} } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "disabled-status": "", "search-status": "", "button-status": !1, "label-text": t.trans("action-builder.filter-type"), options: t.filterTypeOptions, value: [t.filterTypeOptions[0]] } }), e(t.InSelect, { staticClass: "w-2", attrs: { id: "filter-item-input--attribute-type", "search-status": "", "static-position": "bottom right", "button-status": !1, "label-text": t.trans("condition.attribute"), options: t.store.getFilterList, state: t.getFieldState("attribute"), value: [t.selectedAttributeType] }, on: { select: t.handleAttributeChange } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [t.isBooleanAttribute ? e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.booleanValueOptions, state: t.getFieldState("value"), value: [t.selectedBooleanValue] }, on: { select: t.handleBooleanValueChange } }) : [e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.getOperatorOptions(t.selectedAttributeType.type), state: t.getFieldState("operator"), value: [t.selectedOperatorType] }, on: { select: t.handleOperatorChange } }), t.isAnyOfOperator ? e(t.InTags, { staticClass: "w-2", attrs: { "allow-bulk-paste": "", "allow-duplicates": !1, invalid: t.invalidFields.has("value"), "invalid-message": t.valueErrorMessage, label: t.trans("condition.value"), placeholder: t.trans("condition.enter-value-placeholder"),
|
|
8
|
+
} } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "disabled-status": "", "search-status": "", "button-status": !1, "label-text": t.trans("action-builder.filter-type"), options: t.filterTypeOptions, value: [t.filterTypeOptions[0]] } }), e(t.InSelect, { staticClass: "w-2", attrs: { id: "filter-item-input--attribute-type", "search-status": "", "static-position": "bottom right", "button-status": !1, "label-text": t.trans("condition.attribute"), options: t.store.getFilterList, state: t.getFieldState("attribute"), value: [t.selectedAttributeType] }, on: { select: t.handleAttributeChange } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [t.isBooleanAttribute ? e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.booleanValueOptions, state: t.getFieldState("value"), value: [t.selectedBooleanValue] }, on: { select: t.handleBooleanValueChange } }) : [e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.getOperatorOptions(t.selectedAttributeType.type), state: t.getFieldState("operator"), value: [t.selectedOperatorType] }, on: { select: t.handleOperatorChange } }), t.isAnyOfOperator ? e(t.InTags, { staticClass: "w-2", attrs: { "allow-bulk-paste": "", validate: "text", "allow-duplicates": !1, invalid: t.invalidFields.has("value"), "invalid-message": t.valueErrorMessage, label: t.trans("condition.value"), placeholder: t.trans("condition.enter-value-placeholder"), value: t.tagValues }, on: { input: t.onTagsInput } }) : t.isDateAttribute ? e(t.InDatePickerV2, { staticClass: "w-2", attrs: { id: `filter-item-input--value-${a.index}`, "single-date-picker-status": "", "label-text": t.trans("condition.value"), locale: t.datePickerLocale, name: `filter-item-input--value-${a.index}`, "placeholder-text": t.trans("condition.enter-value-placeholder"), state: t.getFieldState("value"), "state-message": t.valueErrorMessage, value: t.datePickerValue }, on: { apply: t.onDatePickerApply } }) : e(t.InBasicTextInput, { staticClass: "w-2", attrs: { id: `filter-item-input--value-${a.index}`, name: "imageUrl", "character-counter-status": !1, "label-text": t.trans("condition.value"), "max-character-length": 25, "placeholder-text": t.trans("condition.enter-value-placeholder"), "state-message": t.valueErrorMessage, states: t.getFieldState("value"), "tooltip-status": !1, type: t.valueInputType, value: t.safeDecodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
|
|
9
9
|
t.updateFilter({ text: "value", value: encodeURIComponent(s) });
|
|
10
10
|
} } })]], 2), t.props.hasLogicAdapter ? e("div", { staticClass: "w-1 d-f a-i-c j-c-c p-r bor-b-s-s bor-b-w-1 bor-b-c-50 mt-4" }, [e(t.LogicAdapter, { staticClass: "p-a", attrs: { logic: t.props.filter.innerGroupOperator }, on: { change: function(s) {
|
|
11
11
|
return t.updateFilter({ text: "innerGroupOperator", value: s });
|
|
@@ -16,7 +16,7 @@ var r = function() {
|
|
|
16
16
|
n,
|
|
17
17
|
!1,
|
|
18
18
|
null,
|
|
19
|
-
"
|
|
19
|
+
"8053a037"
|
|
20
20
|
);
|
|
21
21
|
const f = o.exports;
|
|
22
22
|
export {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTranslations as
|
|
3
|
-
import { getOperatorOptions as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { parseTagList as
|
|
6
|
-
import { getInvalidFilterFields as
|
|
7
|
-
import { locale as
|
|
8
|
-
import { InTags as
|
|
9
|
-
import
|
|
10
|
-
import { useDebounceFn as
|
|
11
|
-
const
|
|
1
|
+
import { defineComponent as N, computed as r } from "vue";
|
|
2
|
+
import { useTranslations as U } from "../../../../composables/useTranslations.js";
|
|
3
|
+
import { getOperatorOptions as f, OP_ANY_OF as d } from "../../../../enums/extensions/recommendationBlock.js";
|
|
4
|
+
import { useRecommendationExtensionStore as E } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { parseTagList as j, safeDecodeURIComponent as g } from "../../../../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
6
|
+
import { getInvalidFilterFields as w } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
|
|
7
|
+
import { locale as M } from "../../../../utils/dateUtil.js";
|
|
8
|
+
import { InTags as Y, InButtonV2 as q, InSelect as z, InDatePickerV2 as G, InBasicTextInput as H } from "@useinsider/design-system-vue";
|
|
9
|
+
import J from "./LogicAdapter.vue.js";
|
|
10
|
+
import { useDebounceFn as K } from "../../../../node_modules/@vueuse/shared/index.js";
|
|
11
|
+
const se = /* @__PURE__ */ N({
|
|
12
12
|
__name: "FilterItem",
|
|
13
13
|
props: {
|
|
14
14
|
filter: null,
|
|
@@ -17,8 +17,8 @@ const pe = /* @__PURE__ */ R({
|
|
|
17
17
|
submitted: { type: Boolean }
|
|
18
18
|
},
|
|
19
19
|
emits: ["delete-filter"],
|
|
20
|
-
setup(
|
|
21
|
-
const t =
|
|
20
|
+
setup(I, { emit: O }) {
|
|
21
|
+
const t = I, s = U(), n = E(), T = [
|
|
22
22
|
{
|
|
23
23
|
text: s("email-editor.standard-filter"),
|
|
24
24
|
value: "standardFilter"
|
|
@@ -26,79 +26,79 @@ const pe = /* @__PURE__ */ R({
|
|
|
26
26
|
], u = [
|
|
27
27
|
{ text: "True", value: "true" },
|
|
28
28
|
{ text: "False", value: "false" }
|
|
29
|
-
], m =
|
|
29
|
+
], m = r(() => t.filter.attribute || ""), i = r(() => n.getFilterList.find((e) => e.value === m.value) || { text: "", value: "", type: "" }), h = r(
|
|
30
30
|
() => {
|
|
31
31
|
var e;
|
|
32
32
|
return ((e = i.value) == null ? void 0 : e.type) === "Boolean";
|
|
33
33
|
}
|
|
34
|
-
), b =
|
|
34
|
+
), b = r(() => {
|
|
35
35
|
var e;
|
|
36
|
-
return
|
|
37
|
-
}), A =
|
|
36
|
+
return f((e = i.value) == null ? void 0 : e.type).find((o) => o.value === t.filter.operator);
|
|
37
|
+
}), A = r(
|
|
38
38
|
() => u.find((e) => e.value === t.filter.value) || u[0]
|
|
39
|
-
), p =
|
|
39
|
+
), p = r(() => t.submitted ? w(t.filter) : /* @__PURE__ */ new Set()), x = (e) => p.value.has(e) ? "error" : "default", B = r(
|
|
40
40
|
() => p.value.has("value") ? s("action-builder.filter-empty-value-error") : ""
|
|
41
|
-
), v =
|
|
41
|
+
), v = r(
|
|
42
42
|
() => {
|
|
43
43
|
var e;
|
|
44
44
|
return ((e = i.value) == null ? void 0 : e.type) === "Number";
|
|
45
45
|
}
|
|
46
|
-
), D =
|
|
46
|
+
), D = r(() => v.value ? "number" : "text"), C = r(
|
|
47
47
|
() => {
|
|
48
48
|
var e;
|
|
49
49
|
return ((e = i.value) == null ? void 0 : e.type) === "Date";
|
|
50
50
|
}
|
|
51
|
-
), _ =
|
|
52
|
-
|
|
51
|
+
), _ = r(() => t.filter.operator === d), k = r(() => j(t.filter.value)), P = K((e) => {
|
|
52
|
+
n.updateFilter({
|
|
53
53
|
...t.filter,
|
|
54
54
|
[e.text]: e.value
|
|
55
55
|
});
|
|
56
|
-
}, 500),
|
|
57
|
-
const
|
|
58
|
-
|
|
56
|
+
}, 500), V = (e) => {
|
|
57
|
+
const o = n.getFilterList.find((c) => c.value === e.value), l = (o == null ? void 0 : o.type) === "Boolean", [a] = f(o == null ? void 0 : o.type);
|
|
58
|
+
n.updateFilter({
|
|
59
59
|
...t.filter,
|
|
60
60
|
attribute: e.value,
|
|
61
|
-
operator:
|
|
62
|
-
value:
|
|
61
|
+
operator: l ? "=" : (a == null ? void 0 : a.value) ?? "",
|
|
62
|
+
value: l ? "true" : ""
|
|
63
63
|
});
|
|
64
|
-
},
|
|
65
|
-
|
|
64
|
+
}, L = (e) => {
|
|
65
|
+
n.updateFilter({
|
|
66
66
|
...t.filter,
|
|
67
67
|
operator: "=",
|
|
68
68
|
value: e.value
|
|
69
69
|
});
|
|
70
70
|
}, S = (e) => {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
71
|
+
const o = e.value;
|
|
72
|
+
if (o === t.filter.operator)
|
|
73
73
|
return;
|
|
74
|
-
const c = t.filter.operator ===
|
|
75
|
-
|
|
74
|
+
const c = t.filter.operator === d !== (o === d);
|
|
75
|
+
n.updateFilter({
|
|
76
76
|
...t.filter,
|
|
77
|
-
operator:
|
|
77
|
+
operator: o,
|
|
78
78
|
value: c ? "" : t.filter.value
|
|
79
79
|
});
|
|
80
|
-
}, $ =
|
|
81
|
-
const [
|
|
82
|
-
return !
|
|
83
|
-
},
|
|
84
|
-
const [
|
|
85
|
-
return !
|
|
86
|
-
},
|
|
87
|
-
() => y(
|
|
80
|
+
}, $ = M(), y = (e) => {
|
|
81
|
+
const [o, l, a] = e.split("-");
|
|
82
|
+
return !o || !l || !a ? "" : `${l}/${a}/${o}`;
|
|
83
|
+
}, F = (e) => {
|
|
84
|
+
const [o, l, a] = e.split("/");
|
|
85
|
+
return !a || !o || !l ? "" : `${a}-${o.padStart(2, "0")}-${l.padStart(2, "0")}`;
|
|
86
|
+
}, R = r(
|
|
87
|
+
() => y(g(t.filter.value))
|
|
88
88
|
);
|
|
89
|
-
return { __sfc: !0, trans: s, store:
|
|
90
|
-
|
|
89
|
+
return { __sfc: !0, trans: s, store: n, props: t, filterTypeOptions: T, booleanValueOptions: u, attributeType: m, selectedAttributeType: i, isBooleanAttribute: h, selectedOperatorType: b, selectedBooleanValue: A, emit: O, invalidFields: p, getFieldState: x, valueErrorMessage: B, isNumericAttribute: v, valueInputType: D, isDateAttribute: C, isAnyOfOperator: _, tagValues: k, updateFilter: P, handleAttributeChange: V, handleBooleanValueChange: L, handleOperatorChange: S, datePickerLocale: $, isoToPickerDate: y, pickerDateToIso: F, datePickerValue: R, onDatePickerApply: (e) => {
|
|
90
|
+
n.updateFilter({
|
|
91
91
|
...t.filter,
|
|
92
|
-
value: encodeURIComponent(
|
|
92
|
+
value: encodeURIComponent(F(e))
|
|
93
93
|
});
|
|
94
94
|
}, onTagsInput: (e) => {
|
|
95
|
-
|
|
95
|
+
n.updateFilter({
|
|
96
96
|
...t.filter,
|
|
97
|
-
value:
|
|
97
|
+
value: e.map(encodeURIComponent).join(",")
|
|
98
98
|
});
|
|
99
|
-
}, getOperatorOptions:
|
|
99
|
+
}, getOperatorOptions: f, safeDecodeURIComponent: g, InBasicTextInput: H, InDatePickerV2: G, InSelect: z, InButtonV2: q, InTags: Y, LogicAdapter: J };
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
export {
|
|
103
|
-
|
|
103
|
+
se as default
|
|
104
104
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BlockId as
|
|
1
|
+
var B = Object.defineProperty;
|
|
2
|
+
var C = (a, s, t) => s in a ? B(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
|
3
|
+
var p = (a, s, t) => C(a, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { BlockId as R } from "../../../enums/block.js";
|
|
5
5
|
import { getMigrationBannerHtml as b } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
-
import { Block as
|
|
7
|
-
import { regenerateMobileProductRows as
|
|
8
|
-
import { ensureMobileCssRulesExist as
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { getDefaultTemplate as
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
class q extends
|
|
6
|
+
import { Block as A, BlockCompositionType as y, ModificationDescription as f } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { regenerateMobileProductRows as D } from "./controls/main/utils.js";
|
|
8
|
+
import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as I, hasMobileLayoutOptOut as E } from "./controls/mobileLayout/cssRules.js";
|
|
9
|
+
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
|
|
11
|
+
import { getDefaultTemplate as N } from "./templates/grid/template.js";
|
|
12
|
+
const k = R.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
|
|
13
|
+
let _ = !1;
|
|
14
|
+
class q extends A {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
/**
|
|
18
18
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
19
19
|
* This avoids generating a new (different) ID in onCreated().
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
p(this, "_pendingBlockId", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return k;
|
|
25
25
|
}
|
|
26
26
|
getIcon() {
|
|
27
27
|
return "recommendation-icon";
|
|
@@ -39,7 +39,7 @@ class q extends R {
|
|
|
39
39
|
}
|
|
40
40
|
getSettingsPanelTitleHtml() {
|
|
41
41
|
return b(
|
|
42
|
-
|
|
42
|
+
k,
|
|
43
43
|
this.api.translate("Recommendation Block"),
|
|
44
44
|
this.api.translate("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.")
|
|
45
45
|
);
|
|
@@ -59,7 +59,7 @@ class q extends R {
|
|
|
59
59
|
*/
|
|
60
60
|
getTemplate() {
|
|
61
61
|
const t = this._generateNextId();
|
|
62
|
-
return this._pendingBlockId = t,
|
|
62
|
+
return this._pendingBlockId = t, N(t);
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Called when a new block is dropped into the template
|
|
@@ -70,24 +70,26 @@ class q extends R {
|
|
|
70
70
|
*/
|
|
71
71
|
onCreated(t) {
|
|
72
72
|
const e = this._getRecommendationId(t);
|
|
73
|
-
if (e !== null && e > 0)
|
|
73
|
+
if (e !== null && e > 0) {
|
|
74
|
+
this._detectDuplicate(e) && this._handleDuplicate(t, e);
|
|
74
75
|
return;
|
|
76
|
+
}
|
|
75
77
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
76
78
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
77
|
-
const { config:
|
|
79
|
+
const { config: n, wasFreshDrop: o } = c.initializeConfig(
|
|
78
80
|
this.api,
|
|
79
81
|
t,
|
|
80
82
|
{ recommendationId: i }
|
|
81
|
-
),
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
83
|
+
), r = g();
|
|
84
|
+
if (r.setCurrentBlock(i), o) {
|
|
85
|
+
h(this.api);
|
|
86
|
+
const l = this._getBlockElement(t);
|
|
87
|
+
l && (I(this.api, l, !0), D({
|
|
86
88
|
currentNode: t,
|
|
87
89
|
documentModifier: this.api.getDocumentModifier()
|
|
88
90
|
}));
|
|
89
91
|
}
|
|
90
|
-
|
|
92
|
+
r.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
95
|
* Called when the document changes or template is loaded
|
|
@@ -100,20 +102,20 @@ class q extends R {
|
|
|
100
102
|
if (!(!t || !("getNodeConfig" in t))) {
|
|
101
103
|
if (!this._getRecommendationId(t)) {
|
|
102
104
|
const e = this._generateNextId();
|
|
103
|
-
this._assignRecommendationId(t, e),
|
|
105
|
+
this._assignRecommendationId(t, e), c.hasConfig(t) && c.updateConfig(
|
|
104
106
|
this.api,
|
|
105
107
|
t,
|
|
106
108
|
{ recommendationId: e },
|
|
107
109
|
"Assign recommendation ID to legacy block"
|
|
108
110
|
);
|
|
109
111
|
}
|
|
110
|
-
|
|
112
|
+
c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
111
113
|
try {
|
|
112
|
-
|
|
113
|
-
const e =
|
|
114
|
+
_ || (h(this.api), _ = !0);
|
|
115
|
+
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
114
116
|
if (i) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
+
const n = !e.mobileLayoutEnabled;
|
|
118
|
+
E(i) !== n && I(this.api, i, n);
|
|
117
119
|
}
|
|
118
120
|
} catch {
|
|
119
121
|
}
|
|
@@ -127,7 +129,7 @@ class q extends R {
|
|
|
127
129
|
*/
|
|
128
130
|
onDelete(t) {
|
|
129
131
|
const e = this._getRecommendationId(t);
|
|
130
|
-
e &&
|
|
132
|
+
e && g().removeBlockState(e);
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -137,16 +139,59 @@ class q extends R {
|
|
|
137
139
|
let t = 0;
|
|
138
140
|
try {
|
|
139
141
|
const e = this.api.getDocumentRoot();
|
|
140
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${
|
|
141
|
-
if ("getAttribute" in
|
|
142
|
-
const
|
|
143
|
-
|
|
142
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${m}`).forEach((n) => {
|
|
143
|
+
if ("getAttribute" in n) {
|
|
144
|
+
const o = n.getAttribute(u), r = o ? parseInt(o) : 0;
|
|
145
|
+
r > t && (t = r);
|
|
144
146
|
}
|
|
145
147
|
});
|
|
146
148
|
} catch {
|
|
147
149
|
}
|
|
148
150
|
return t + 1;
|
|
149
151
|
}
|
|
152
|
+
/** True when another block already holds the same id — Stripo's duplication signal. */
|
|
153
|
+
_detectDuplicate(t) {
|
|
154
|
+
try {
|
|
155
|
+
const e = this.api.getDocumentRoot();
|
|
156
|
+
if (e && "querySelectorAll" in e)
|
|
157
|
+
return e.querySelectorAll(
|
|
158
|
+
`.${m}[${u}="${t}"]`
|
|
159
|
+
).length > 1;
|
|
160
|
+
} catch {
|
|
161
|
+
}
|
|
162
|
+
return !1;
|
|
163
|
+
}
|
|
164
|
+
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
165
|
+
_handleDuplicate(t, e) {
|
|
166
|
+
const i = this._generateNextId(), n = this._getBlockElement(t);
|
|
167
|
+
this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), c.hasConfig(t) && c.updateConfig(
|
|
168
|
+
this.api,
|
|
169
|
+
t,
|
|
170
|
+
{ recommendationId: i },
|
|
171
|
+
`Reassign recommendation ID on duplicate (was ${e})`
|
|
172
|
+
);
|
|
173
|
+
const o = g();
|
|
174
|
+
o.cloneBlockState(e, i), o.setCurrentBlock(i);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
178
|
+
* class scopes per-block CSS rules, so leaving the source's class would
|
|
179
|
+
* make stylistic edits leak between source and clone.
|
|
180
|
+
*/
|
|
181
|
+
_reassignInstanceClass(t, e, i) {
|
|
182
|
+
if (!("getAttribute" in t))
|
|
183
|
+
return;
|
|
184
|
+
const n = t.getAttribute("class");
|
|
185
|
+
if (!n)
|
|
186
|
+
return;
|
|
187
|
+
const o = `ins-recommendation-v3-block-${e}`, r = `ins-recommendation-v3-block-${i}`;
|
|
188
|
+
if (!n.includes(o))
|
|
189
|
+
return;
|
|
190
|
+
const l = n.replace(o, r), d = this.api.getDocumentModifier();
|
|
191
|
+
d.modifyHtml(t).setAttribute("class", l), d.apply(new f(
|
|
192
|
+
`Reassign recommendation instance class ${o} -> ${r}`
|
|
193
|
+
));
|
|
194
|
+
}
|
|
150
195
|
/**
|
|
151
196
|
* Assigns a recommendation-id attribute to the block element.
|
|
152
197
|
* The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
|
|
@@ -157,8 +202,8 @@ class q extends R {
|
|
|
157
202
|
const i = this._getBlockElement(t);
|
|
158
203
|
if (!i)
|
|
159
204
|
return;
|
|
160
|
-
const
|
|
161
|
-
|
|
205
|
+
const n = this.api.getDocumentModifier();
|
|
206
|
+
n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new f(`Assign recommendation ID ${e}`));
|
|
162
207
|
}
|
|
163
208
|
/**
|
|
164
209
|
* Gets the recommendation-id from a block node
|
|
@@ -167,11 +212,11 @@ class q extends R {
|
|
|
167
212
|
const e = this._getBlockElement(t);
|
|
168
213
|
if (!e || !("getAttribute" in e))
|
|
169
214
|
return null;
|
|
170
|
-
const i = e.getAttribute(
|
|
215
|
+
const i = e.getAttribute(u);
|
|
171
216
|
if (!i)
|
|
172
217
|
return null;
|
|
173
|
-
const
|
|
174
|
-
return Number.isNaN(
|
|
218
|
+
const n = parseInt(i);
|
|
219
|
+
return Number.isNaN(n) ? null : n;
|
|
175
220
|
}
|
|
176
221
|
/**
|
|
177
222
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -179,19 +224,19 @@ class q extends R {
|
|
|
179
224
|
_getBlockElement(t) {
|
|
180
225
|
if ("getAttribute" in t) {
|
|
181
226
|
const e = t.getAttribute("class");
|
|
182
|
-
if (e && e.includes(
|
|
227
|
+
if (e && e.includes(m))
|
|
183
228
|
return t;
|
|
184
229
|
}
|
|
185
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
230
|
+
return "querySelector" in t ? t.querySelector(`.${m}`) ?? null : null;
|
|
186
231
|
}
|
|
187
232
|
/**
|
|
188
233
|
* Migrate configuration from legacy format
|
|
189
234
|
*/
|
|
190
235
|
_migrateFromLegacy(t) {
|
|
191
|
-
|
|
236
|
+
c.migrateFromDataAttributes(this.api, t);
|
|
192
237
|
}
|
|
193
238
|
}
|
|
194
239
|
export {
|
|
195
|
-
|
|
240
|
+
k as BLOCK_ID,
|
|
196
241
|
q as RecommendationBlock
|
|
197
242
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as
|
|
2
|
-
import { useRecommendationApi as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as P } from "pinia";
|
|
5
5
|
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import { isFilterValid as
|
|
10
|
-
import { isConfigValid as
|
|
11
|
-
const h =
|
|
9
|
+
import { isFilterValid as v } from "../validation/filterSchema.js";
|
|
10
|
+
import { isConfigValid as w } from "../validation/requiredFields.js";
|
|
11
|
+
const h = y();
|
|
12
12
|
let m = null, u = null, d = null;
|
|
13
|
-
function
|
|
13
|
+
function I() {
|
|
14
14
|
return {
|
|
15
15
|
cardsInRow: F,
|
|
16
16
|
currencySettings: {
|
|
@@ -38,9 +38,9 @@ function k() {
|
|
|
38
38
|
customAttributes: []
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function k() {
|
|
42
42
|
return {
|
|
43
|
-
recommendationConfigs:
|
|
43
|
+
recommendationConfigs: I(),
|
|
44
44
|
recommendationProducts: [],
|
|
45
45
|
filterStatus: !1,
|
|
46
46
|
filterSelectionDrawerStatus: !1,
|
|
@@ -69,7 +69,7 @@ const N = () => ({
|
|
|
69
69
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
70
70
|
*/
|
|
71
71
|
recommendationConfigs(t) {
|
|
72
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
72
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : I();
|
|
73
73
|
},
|
|
74
74
|
/**
|
|
75
75
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -133,7 +133,7 @@ const N = () => ({
|
|
|
133
133
|
getFilterList() {
|
|
134
134
|
return Object.values(this.filterList).map((t) => {
|
|
135
135
|
let e;
|
|
136
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
136
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
137
137
|
text: t.displayName,
|
|
138
138
|
value: e,
|
|
139
139
|
type: t.attributeType
|
|
@@ -155,7 +155,7 @@ const N = () => ({
|
|
|
155
155
|
setCurrentBlock(t) {
|
|
156
156
|
this.blockStates[t] || (this.blockStates = {
|
|
157
157
|
...this.blockStates,
|
|
158
|
-
[t]:
|
|
158
|
+
[t]: k()
|
|
159
159
|
}), this.currentRecommendationId = t;
|
|
160
160
|
},
|
|
161
161
|
/**
|
|
@@ -174,6 +174,25 @@ const N = () => ({
|
|
|
174
174
|
this.currentRecommendationId = n.length > 0 ? n[0] : null;
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
|
+
/**
|
|
178
|
+
* Deep-clones a block's state and mirrors its campaign URL under a new id.
|
|
179
|
+
* Invoked from `onCreated` when a duplicate is detected (SD-142352).
|
|
180
|
+
*/
|
|
181
|
+
cloneBlockState(t, e) {
|
|
182
|
+
const r = this.blockStates[t];
|
|
183
|
+
if (r) {
|
|
184
|
+
const o = structuredClone(r);
|
|
185
|
+
o.recommendationConfigs.id = e, this.blockStates = {
|
|
186
|
+
...this.blockStates,
|
|
187
|
+
[e]: o
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const n = t.toString(), c = e.toString(), i = this.recommendationCampaignUrls[n];
|
|
191
|
+
i && (this.recommendationCampaignUrls = {
|
|
192
|
+
...this.recommendationCampaignUrls,
|
|
193
|
+
[c]: i
|
|
194
|
+
});
|
|
195
|
+
},
|
|
177
196
|
/**
|
|
178
197
|
* Marks a block as initialized (initial API data has been fetched).
|
|
179
198
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -204,7 +223,7 @@ const N = () => ({
|
|
|
204
223
|
decimalCount: String(e.currencyDecimalCount),
|
|
205
224
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
206
225
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
207
|
-
}, c = !this.blockStates[t], i = c ?
|
|
226
|
+
}, c = !this.blockStates[t], i = c ? k() : this.blockStates[t];
|
|
208
227
|
i.recommendationConfigs = {
|
|
209
228
|
...i.recommendationConfigs,
|
|
210
229
|
strategy: e.strategy,
|
|
@@ -359,7 +378,7 @@ const N = () => ({
|
|
|
359
378
|
const n = [...e.recommendationConfigs.filters];
|
|
360
379
|
n[r] = {
|
|
361
380
|
...t,
|
|
362
|
-
isValid:
|
|
381
|
+
isValid: v(t)
|
|
363
382
|
}, e.recommendationConfigs.filters = n;
|
|
364
383
|
}
|
|
365
384
|
},
|
|
@@ -405,7 +424,7 @@ const N = () => ({
|
|
|
405
424
|
* every block's recommendationConfigs across user edits.
|
|
406
425
|
*/
|
|
407
426
|
hasInvalidBlock() {
|
|
408
|
-
return Object.values(this.blockStates).some((t) => !
|
|
427
|
+
return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
|
|
409
428
|
},
|
|
410
429
|
// ====================================================================
|
|
411
430
|
// Per-Block Product Fetching
|
|
@@ -9,44 +9,36 @@ function m(t) {
|
|
|
9
9
|
function f(t) {
|
|
10
10
|
return t.split(",").filter(Boolean).map(m);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return t.map(encodeURIComponent).join(",");
|
|
14
|
-
}
|
|
15
|
-
function Q(t) {
|
|
16
|
-
return t.trim().length > 0;
|
|
17
|
-
}
|
|
18
|
-
function d(t) {
|
|
12
|
+
function y(t) {
|
|
19
13
|
if (t.length === 0)
|
|
20
14
|
return "";
|
|
21
15
|
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), u = o.map((r) => {
|
|
22
|
-
const e = r.operator === l, a = e ? "=" : r.operator,
|
|
23
|
-
return `[${r.attribute}][${encodeURIComponent(a)}][${
|
|
24
|
-
}), [
|
|
25
|
-
let n =
|
|
26
|
-
for (let r = 0; r <
|
|
16
|
+
const e = r.operator === l, a = e ? "=" : r.operator, c = e ? f(r.value).join(l) : r.value;
|
|
17
|
+
return `[${r.attribute}][${encodeURIComponent(a)}][${c}]`;
|
|
18
|
+
}), [i, ...p] = u;
|
|
19
|
+
let n = i;
|
|
20
|
+
for (let r = 0; r < p.length; r++) {
|
|
27
21
|
const e = o[r].innerGroupOperator;
|
|
28
|
-
n += `${e}${
|
|
22
|
+
n += `${e}${p[r]}`;
|
|
29
23
|
}
|
|
30
24
|
return `(${n})`;
|
|
31
25
|
}
|
|
32
|
-
function
|
|
26
|
+
function g(t) {
|
|
33
27
|
if (!t || t.length === 0)
|
|
34
28
|
return "";
|
|
35
|
-
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e),
|
|
29
|
+
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e), i = u.map((r) => {
|
|
36
30
|
const e = o[r];
|
|
37
|
-
return
|
|
38
|
-
}), [
|
|
39
|
-
let
|
|
31
|
+
return y(e);
|
|
32
|
+
}), [p, ...n] = i;
|
|
33
|
+
let s = p;
|
|
40
34
|
for (let r = 0; r < n.length; r++) {
|
|
41
|
-
const e = u[r + 1],
|
|
42
|
-
|
|
35
|
+
const e = u[r + 1], c = o[e][0].outerGroupOperator;
|
|
36
|
+
s += `${c}${n[r]}`;
|
|
43
37
|
}
|
|
44
|
-
return
|
|
38
|
+
return s.trim();
|
|
45
39
|
}
|
|
46
40
|
export {
|
|
47
|
-
|
|
48
|
-
F as generateCompleteFilterQuery,
|
|
49
|
-
Q as isValidFilterTag,
|
|
41
|
+
g as generateCompleteFilterQuery,
|
|
50
42
|
f as parseTagList,
|
|
51
43
|
m as safeDecodeURIComponent
|
|
52
44
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gap-16[data-v-
|
|
1
|
+
.gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-b293a2b0]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-b293a2b0]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-b293a2b0]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
|
|
@@ -60,6 +60,16 @@ export declare class RecommendationBlock extends Block {
|
|
|
60
60
|
* in the document and finding the maximum existing ID + 1.
|
|
61
61
|
*/
|
|
62
62
|
private _generateNextId;
|
|
63
|
+
/** True when another block already holds the same id — Stripo's duplication signal. */
|
|
64
|
+
private _detectDuplicate;
|
|
65
|
+
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
66
|
+
private _handleDuplicate;
|
|
67
|
+
/**
|
|
68
|
+
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
69
|
+
* class scopes per-block CSS rules, so leaving the source's class would
|
|
70
|
+
* make stylistic edits leak between source and clone.
|
|
71
|
+
*/
|
|
72
|
+
private _reassignInstanceClass;
|
|
63
73
|
/**
|
|
64
74
|
* Assigns a recommendation-id attribute to the block element.
|
|
65
75
|
* The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
|
|
@@ -216,6 +216,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
216
216
|
* Resets currentRecommendationId if it was the deleted block.
|
|
217
217
|
*/
|
|
218
218
|
removeBlockState(id: number): void;
|
|
219
|
+
/**
|
|
220
|
+
* Deep-clones a block's state and mirrors its campaign URL under a new id.
|
|
221
|
+
* Invoked from `onCreated` when a duplicate is detected (SD-142352).
|
|
222
|
+
*/
|
|
223
|
+
cloneBlockState(sourceId: number, newId: number): void;
|
|
219
224
|
/**
|
|
220
225
|
* Marks a block as initialized (initial API data has been fetched).
|
|
221
226
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Filter } from '@@/Types/recommendation';
|
|
2
2
|
export declare function safeDecodeURIComponent(value: string): string;
|
|
3
3
|
export declare function parseTagList(value: string): string[];
|
|
4
|
-
export declare function encodeTagList(tags: string[]): string;
|
|
5
|
-
export declare function isValidFilterTag(tag: string): boolean;
|
|
6
4
|
/**
|
|
7
5
|
* Generates the complete query with outer group operators
|
|
8
6
|
* @param filters Array of Filter objects
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.4.1-beta.
|
|
3
|
+
"version": "3.4.1-beta.87643d5",
|
|
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",
|