@useinsider/guido 3.7.1-beta.4622f87 → 3.7.1-beta.794b3fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +2 -2
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +24 -22
- package/dist/composables/useHtmlValidator.js +79 -73
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/enums/html-validator.js +13 -5
- package/dist/enums/toaster.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +35 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +35 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +62 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +208 -193
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +21 -20
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +16 -0
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +9 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +122 -72
- package/dist/extensions/Blocks/Unsubscribe/control.js +33 -26
- package/dist/extensions/Blocks/Unsubscribe/template.js +4 -4
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +31 -19
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
- package/dist/src/enums/html-validator.d.ts +4 -0
- package/dist/src/enums/toaster.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/block.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/useRecommendationBlockWarning.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +28 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/static/styles/components/base-input.css.js +5 -0
- package/dist/stores/autosave.js +6 -6
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import a from "./UnsubscribePageSelection.vue2.js";
|
|
|
3
3
|
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var o = function() {
|
|
5
5
|
var r = this, e = r._self._c, t = r._self._setupProxy;
|
|
6
|
-
return e(t.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", size: "large", "footer-button-group-options": t.footerButtonGroupOptions, status: t.unsubscribeStore.pageSelectionDrawerStatus, "title-text": t.trans("newsletter.select-a-template") }, on: { cancelOrBackButtonEvent: t.handleBack, onCloseEvent: t.
|
|
6
|
+
return e(t.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", size: "large", "footer-button-group-options": t.footerButtonGroupOptions, status: t.unsubscribeStore.pageSelectionDrawerStatus, "title-text": t.trans("newsletter.select-a-template") }, on: { cancelOrBackButtonEvent: t.handleBack, onCloseEvent: t.handleClose, primaryButtonEvent: t.handleSave }, scopedSlots: r._u([{ key: "headerBottomSlot", fn: function() {
|
|
7
7
|
return [e(t.UnsubscribeBreadcrumb, { staticClass: "px-5 py-3" })];
|
|
8
8
|
}, proxy: !0 }]) }, [e("div", { staticClass: "d-g templates-wrapper" }, r._l(t.unsubscribeStore.getTemplatesByActiveType, function(s) {
|
|
9
9
|
return e("div", { key: s.id, staticClass: "template-wrapper", on: { click: function(u) {
|
|
@@ -16,7 +16,7 @@ var o = function() {
|
|
|
16
16
|
i,
|
|
17
17
|
!1,
|
|
18
18
|
null,
|
|
19
|
-
"
|
|
19
|
+
"f6a8cb4c"
|
|
20
20
|
);
|
|
21
21
|
const _ = c.exports;
|
|
22
22
|
export {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useToaster as
|
|
1
|
+
import { defineComponent as y, ref as S, computed as a, watch as T } from "vue";
|
|
2
|
+
import v from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useToaster as C } from "../../../composables/useToaster.js";
|
|
4
4
|
import { useTranslations as B } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { ToasterTypeOptions as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
import { InContainer as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
5
|
+
import { ToasterTypeOptions as w } from "../../../enums/toaster.js";
|
|
6
|
+
import { useUnsubscribeStore as h } from "../../../stores/unsubscribe.js";
|
|
7
|
+
import { InContainer as U } from "@useinsider/design-system-vue";
|
|
8
|
+
import P from "./UnsubscribeBreadcrumb.vue.js";
|
|
9
|
+
const L = /* @__PURE__ */ y({
|
|
10
10
|
__name: "UnsubscribePageSelection",
|
|
11
|
-
setup(
|
|
12
|
-
const s = B(), e =
|
|
11
|
+
setup(_) {
|
|
12
|
+
const s = B(), e = h(), { showToaster: r } = C(), o = S(!1), c = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), u = a(() => ({
|
|
13
13
|
primaryButton: {
|
|
14
14
|
styling: "solid",
|
|
15
15
|
type: "primary",
|
|
@@ -23,42 +23,44 @@ const F = /* @__PURE__ */ g({
|
|
|
23
23
|
labelText: i.value,
|
|
24
24
|
disabledStatus: o.value
|
|
25
25
|
}
|
|
26
|
-
})), p = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6",
|
|
26
|
+
})), p = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", n = (t) => {
|
|
27
27
|
e.pageSelectionDrawerStatus = !1, t && setTimeout(() => {
|
|
28
28
|
t();
|
|
29
29
|
}, 500);
|
|
30
30
|
}, d = () => {
|
|
31
|
+
n(), e.pageSelectionUpdateStatus || document.dispatchEvent(new CustomEvent("unsubscribe:cancel"));
|
|
32
|
+
}, m = () => {
|
|
31
33
|
if (e.isActiveTypeFirstInCollection) {
|
|
32
|
-
|
|
34
|
+
n(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
37
|
e.setPreviousType();
|
|
36
|
-
},
|
|
38
|
+
}, b = () => {
|
|
37
39
|
if (e.isActiveTypeLastInCollection) {
|
|
38
40
|
o.value = !0;
|
|
39
|
-
const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t),
|
|
40
|
-
e.removeUnsubscribePages(
|
|
41
|
+
const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t), g = e.getSelectedUnsubscribePagesByCollection(t);
|
|
42
|
+
e.removeUnsubscribePages(g), e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
|
|
41
43
|
detail: {
|
|
42
44
|
collectionType: t,
|
|
43
45
|
selectedPages: l
|
|
44
46
|
}
|
|
45
|
-
})),
|
|
46
|
-
o.value = !1,
|
|
47
|
-
type:
|
|
47
|
+
})), n(() => {
|
|
48
|
+
o.value = !1, r({
|
|
49
|
+
type: w.Success,
|
|
48
50
|
message: s("global-unsubscribe.pages-were-attached")
|
|
49
51
|
});
|
|
50
52
|
});
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
e.setNextType();
|
|
54
|
-
},
|
|
56
|
+
}, f = (t) => {
|
|
55
57
|
e.setSelectedTemplate(t);
|
|
56
58
|
};
|
|
57
|
-
return
|
|
59
|
+
return T(() => e.pageSelectionDrawerStatus, (t) => {
|
|
58
60
|
t && e.pageSelectionUpdateStatus && e.fetchTemplates();
|
|
59
|
-
}), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster:
|
|
61
|
+
}), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: r, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: u, getBorderClass: p, closeModal: n, handleClose: d, handleBack: m, handleSave: b, selectTemplate: f, WpDrawer: v, InContainer: U, UnsubscribeBreadcrumb: P };
|
|
60
62
|
}
|
|
61
63
|
});
|
|
62
64
|
export {
|
|
63
|
-
|
|
65
|
+
L as default
|
|
64
66
|
};
|
|
@@ -1,86 +1,92 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { TemplateTypes as
|
|
3
|
-
import { DISPLAY_CONDITIONS_REGEX as
|
|
1
|
+
import { useConfig as V } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as G } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as M, CampaignCouldNotBeSavedKey as X, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as $, ALLOWED_DYNAMIC_SYSTEM_TOKENS as q, VALID_DYNAMIC_VARIABLE_REGEX as K } from "../enums/html-validator.js";
|
|
4
4
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
5
|
-
import { itemsBlockDynamicVariables as
|
|
6
|
-
import { useRecommendationExtensionStore as
|
|
7
|
-
import { RecommendationRequiredFieldsKey as
|
|
8
|
-
import { useRecommendationStore as
|
|
9
|
-
import { base64EncodeWithSpecialChars as
|
|
10
|
-
import { useHttp as
|
|
11
|
-
import { useToaster as
|
|
12
|
-
import { useTranslations as
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
return [...
|
|
5
|
+
import { itemsBlockDynamicVariables as j } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
6
|
+
import { useRecommendationExtensionStore as U } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
7
|
+
import { RecommendationRequiredFieldsKey as z } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
8
|
+
import { useRecommendationStore as Z } from "../stores/recommendation.js";
|
|
9
|
+
import { base64EncodeWithSpecialChars as J } from "../utils/base64.js";
|
|
10
|
+
import { useHttp as Q } from "./useHttp.js";
|
|
11
|
+
import { useToaster as ee } from "./useToaster.js";
|
|
12
|
+
import { useTranslations as te } from "./useTranslations.js";
|
|
13
|
+
const se = /recommendation-id="(\d+)"/g;
|
|
14
|
+
function ne(i) {
|
|
15
|
+
return [...i.matchAll(se)].map((d) => d[1]);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function ie(i, d) {
|
|
18
|
+
return d.some((g) => i.startsWith(`${g}_`));
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
function oe(i) {
|
|
21
|
+
return (i.replace(Y, "$1").match($) ?? []).filter((r) => {
|
|
22
|
+
const u = r.slice(2, -2), f = u.indexOf("|"), p = (f === -1 ? u : u.slice(0, f)).trim();
|
|
23
|
+
return q.includes(p) ? !1 : K.test(p) ? f !== -1 && u.slice(f + 1).trim() === "" : !0;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const Ce = () => {
|
|
27
|
+
var h, v;
|
|
28
|
+
const { showToaster: i } = ee(), { post: d } = Q(), { config: g } = V(), r = te(), u = Z(), f = U(), p = ((v = (h = g.value) == null ? void 0 : h.partner) == null ? void 0 : v.messageType) === G.transactional, A = async (e) => {
|
|
29
|
+
const t = await d(
|
|
24
30
|
"/newsletter/template-library/check-template-html-body",
|
|
25
|
-
{ html:
|
|
31
|
+
{ html: J(e) }
|
|
26
32
|
), { status: n, message: l } = t.data;
|
|
27
|
-
return n ||
|
|
33
|
+
return n || i({
|
|
28
34
|
type: c.Alert,
|
|
29
35
|
message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
|
|
30
|
-
}), r(
|
|
36
|
+
}), r(X), l === r(P) && i({
|
|
31
37
|
type: c.Alert,
|
|
32
38
|
message: r("newsletter.already-in-progress")
|
|
33
39
|
}), n;
|
|
34
|
-
},
|
|
40
|
+
}, S = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), b = (e) => ["if", "endif"].includes(e.toLowerCase()), I = (e, s) => {
|
|
35
41
|
const t = e.match(/({%(.*?)%})/g);
|
|
36
42
|
let n = !0;
|
|
37
43
|
return t !== null && !p && t.forEach((l) => {
|
|
38
44
|
const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
39
45
|
if (o && o.length > 0) {
|
|
40
|
-
const [
|
|
41
|
-
|
|
46
|
+
const [a] = o;
|
|
47
|
+
S(a) && !s.includes(a) && (i({
|
|
42
48
|
type: c.Warning,
|
|
43
49
|
message: r("custom-fields.invalid-custom-fields")
|
|
44
50
|
}), n = !1);
|
|
45
51
|
}
|
|
46
52
|
}), n;
|
|
47
|
-
},
|
|
48
|
-
const n = t ? await
|
|
49
|
-
return
|
|
50
|
-
},
|
|
53
|
+
}, T = async (e, s, t) => {
|
|
54
|
+
const n = t ? await A(e) : !0;
|
|
55
|
+
return I(e, s) && n;
|
|
56
|
+
}, w = (e) => e.length > 0 ? !0 : (i({
|
|
51
57
|
type: c.Warning,
|
|
52
58
|
message: r("newsletter.html-content-is-empty")
|
|
53
|
-
}), !1),
|
|
59
|
+
}), !1), x = (e) => {
|
|
54
60
|
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
55
|
-
return s > t &&
|
|
61
|
+
return s > t && i({
|
|
56
62
|
type: c.Warning,
|
|
57
63
|
message: r("custom-fields.missing-closing-braces")
|
|
58
|
-
}), s < t &&
|
|
64
|
+
}), s < t && i({
|
|
59
65
|
type: c.Warning,
|
|
60
66
|
message: r("custom-fields.missing-opening-braces")
|
|
61
67
|
}), s === t;
|
|
62
|
-
},
|
|
63
|
-
const s = e.
|
|
64
|
-
return s ||
|
|
68
|
+
}, _ = (e) => {
|
|
69
|
+
const s = oe(e).length === 0;
|
|
70
|
+
return s || i({
|
|
65
71
|
type: c.Warning,
|
|
66
72
|
message: r("custom-fields.invalid-custom-fields")
|
|
67
73
|
}), s;
|
|
68
|
-
},
|
|
74
|
+
}, k = (e, s) => {
|
|
69
75
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
70
76
|
if (t && !p) {
|
|
71
|
-
const n = new Set(s.map((
|
|
72
|
-
if (t.forEach((
|
|
73
|
-
const m =
|
|
74
|
-
(!n.has(m) || m === "") && !
|
|
77
|
+
const n = new Set(s.map((a) => a.toLowerCase())), l = ne(e), o = [];
|
|
78
|
+
if (t.forEach((a) => {
|
|
79
|
+
const m = a.slice(2, -2).trim().toLowerCase();
|
|
80
|
+
(!n.has(m) || m === "") && !ie(m, l) && o.push(m);
|
|
75
81
|
}), o.length > 0) {
|
|
76
|
-
const
|
|
82
|
+
const a = `
|
|
77
83
|
<ul>
|
|
78
84
|
${o.map((m) => `<li>${m}</li>`).join("")}
|
|
79
85
|
</ul>
|
|
80
86
|
`;
|
|
81
|
-
return
|
|
87
|
+
return i({
|
|
82
88
|
type: c.Alert,
|
|
83
|
-
message: r("custom-fields.invalid-custom-fields") +
|
|
89
|
+
message: r("custom-fields.invalid-custom-fields") + a
|
|
84
90
|
}), !1;
|
|
85
91
|
}
|
|
86
92
|
}
|
|
@@ -89,78 +95,78 @@ const ge = () => {
|
|
|
89
95
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
90
96
|
let n = !0;
|
|
91
97
|
if (s && s.forEach((l) => {
|
|
92
|
-
const o = l.match(
|
|
93
|
-
(!o || l !== m) && !
|
|
98
|
+
const o = l.match(H), a = l.match(M), m = (o == null ? void 0 : o.join("")) || "";
|
|
99
|
+
(!o || l !== m) && !a && (i({
|
|
94
100
|
type: c.Alert,
|
|
95
101
|
message: r("newsletter.display-conditions-invalid-syntax")
|
|
96
|
-
}), n = !1), o && o.forEach((
|
|
97
|
-
|
|
102
|
+
}), n = !1), o && o.forEach((y) => {
|
|
103
|
+
y.trim() === "=" && (i({
|
|
98
104
|
type: c.Alert,
|
|
99
105
|
message: r("custom-conditions.wrong-equality-operators")
|
|
100
106
|
}), n = !1);
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
E
|
|
107
|
+
const C = y.match(/^[a-zA-Z]*$/g);
|
|
108
|
+
C && C.forEach((E) => {
|
|
109
|
+
b(E) && t.push(E);
|
|
104
110
|
});
|
|
105
111
|
});
|
|
106
112
|
}), t.length) {
|
|
107
|
-
const l = t.filter((
|
|
108
|
-
l.length !== o.length && (
|
|
113
|
+
const l = t.filter((a) => a === "if"), o = t.filter((a) => a === "endif");
|
|
114
|
+
l.length !== o.length && (i({
|
|
109
115
|
type: c.Alert,
|
|
110
116
|
message: r("custom-conditions.missing-if-endif-tag")
|
|
111
117
|
}), n = !1);
|
|
112
118
|
}
|
|
113
119
|
return n;
|
|
114
|
-
},
|
|
120
|
+
}, N = (e) => {
|
|
115
121
|
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
116
|
-
return n ||
|
|
122
|
+
return n || i({
|
|
117
123
|
type: c.Warning,
|
|
118
124
|
message: r("custom-conditions.no-space-after-braces")
|
|
119
125
|
}), n;
|
|
120
|
-
},
|
|
126
|
+
}, D = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (i({
|
|
121
127
|
type: c.Warning,
|
|
122
128
|
message: r("custom-conditions.no-braces-inside-if-tag")
|
|
123
|
-
}), !1) : !0,
|
|
129
|
+
}), !1) : !0, F = () => f.hasInvalidBlock() ? (i({
|
|
124
130
|
type: c.Alert,
|
|
125
|
-
message: r(
|
|
126
|
-
}), !1) : !0, O = () =>
|
|
131
|
+
message: r(z)
|
|
132
|
+
}), !1) : !0, O = () => u.recommendationConfigs && Object.values(u.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (i({
|
|
127
133
|
type: c.Alert,
|
|
128
134
|
message: r("newsletter.fill-all-necessary-fields")
|
|
129
|
-
}), !1) : !0,
|
|
135
|
+
}), !1) : !0, B = (e) => {
|
|
130
136
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
131
|
-
return e.match(s) === null ? !0 : (
|
|
137
|
+
return e.match(s) === null ? !0 : (i({
|
|
132
138
|
type: c.Alert,
|
|
133
139
|
message: r("newsletter.invalid-image-type")
|
|
134
140
|
}), !1);
|
|
135
141
|
}, L = (e) => {
|
|
136
142
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
137
143
|
return Array.from(n).find((o) => {
|
|
138
|
-
var
|
|
139
|
-
return !((
|
|
140
|
-
}) ? (
|
|
144
|
+
var a;
|
|
145
|
+
return !((a = o.id) != null && a.trim());
|
|
146
|
+
}) ? (i({
|
|
141
147
|
type: c.Alert,
|
|
142
148
|
message: r("unsubscribe-templates.select-checkbox-groups")
|
|
143
149
|
}), !1) : !0;
|
|
144
|
-
},
|
|
150
|
+
}, W = (e) => {
|
|
145
151
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
146
152
|
return Array.from(n).find((o) => {
|
|
147
|
-
var
|
|
148
|
-
return !((
|
|
149
|
-
}) ? (
|
|
153
|
+
var a;
|
|
154
|
+
return !((a = o.id) != null && a.trim());
|
|
155
|
+
}) ? (i({
|
|
150
156
|
type: c.Alert,
|
|
151
157
|
message: r("unsubscribe-templates.select-radio-button-groups")
|
|
152
158
|
}), !1) : !0;
|
|
153
159
|
};
|
|
154
160
|
return { validateHtml: async (e, s, t = !1) => {
|
|
155
|
-
var o,
|
|
161
|
+
var o, a;
|
|
156
162
|
const n = [
|
|
157
163
|
...s.map((m) => m.value),
|
|
158
|
-
...
|
|
159
|
-
...((
|
|
164
|
+
...j,
|
|
165
|
+
...((a = (o = g.value) == null ? void 0 : o.template) == null ? void 0 : a.customFieldAttributes) ?? []
|
|
160
166
|
];
|
|
161
|
-
return await
|
|
167
|
+
return await T(e, n, t) && w(e) && x(e) && _(e) && k(e, n) && R(e) && N(e) && D(e) && F() && O() && B(e) && L(e) && W(e);
|
|
162
168
|
} };
|
|
163
169
|
};
|
|
164
170
|
export {
|
|
165
|
-
|
|
171
|
+
Ce as useHtmlValidator
|
|
166
172
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useTranslations as r } from "../../composables/useTranslations.js";
|
|
2
2
|
const l = {
|
|
3
|
-
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
|
|
3
|
+
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
|
|
4
|
+
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
|
+
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes"
|
|
4
6
|
}, c = {
|
|
5
7
|
CLIENT_ID: "clientId"
|
|
6
8
|
}, d = () => {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n = "newsletter.already-in-progress", e = "newsletter.campaign-could-not-be-saved", s = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, o = /{%( )*now( )(".*")( )*%}/gm, E = /\{\{[^{}]+\}\}/g, i = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, t = /^[A-Za-z0-9_.]+$/, _ = [
|
|
2
|
+
"ins-unsubscribe-link",
|
|
3
|
+
"ins-global-unsubscribe-link",
|
|
4
|
+
"ins-preferences-unsubscribe-link"
|
|
5
|
+
];
|
|
2
6
|
export {
|
|
3
|
-
|
|
4
|
-
e as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
_ as ALLOWED_DYNAMIC_SYSTEM_TOKENS,
|
|
8
|
+
e as CampaignCouldNotBeSavedKey,
|
|
9
|
+
n as CanNotMakeAnyChangesForRunningKey,
|
|
10
|
+
i as DATA_ATTRIBUTE_REGEX,
|
|
11
|
+
o as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
|
|
12
|
+
s as DISPLAY_CONDITIONS_REGEX,
|
|
13
|
+
E as DYNAMIC_CONTENT_TAG_REGEX,
|
|
14
|
+
t as VALID_DYNAMIC_VARIABLE_REGEX
|
|
7
15
|
};
|
package/dist/enums/toaster.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r))(c || {});
|
|
1
|
+
var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r.Dark = "dark", r))(c || {});
|
|
2
2
|
export {
|
|
3
3
|
c as ToasterTypeOptions
|
|
4
4
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
var k = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var d = (a, r, t) =>
|
|
4
|
-
import { BlockId as
|
|
5
|
-
import { getMigrationBannerHtml as
|
|
6
|
-
import { Block as
|
|
2
|
+
var B = (a, r, t) => r in a ? k(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
|
|
3
|
+
var d = (a, r, t) => B(a, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { BlockId as R } from "../../../enums/block.js";
|
|
5
|
+
import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
+
import { Block as D, BlockCompositionType as C, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
7
|
import { regenerateMobileProductRows as b } from "./controls/main/utils.js";
|
|
8
8
|
import { ensureMobileCssRulesExist as p, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
|
|
9
9
|
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
|
|
11
11
|
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import { useRecommendationBlockWarning as M } from "./useRecommendationBlockWarning.js";
|
|
13
|
+
const I = R.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
|
|
14
|
+
let _ = !1;
|
|
15
|
+
class H extends D {
|
|
15
16
|
constructor() {
|
|
16
17
|
super();
|
|
17
18
|
/**
|
|
@@ -21,7 +22,7 @@ class q extends R {
|
|
|
21
22
|
d(this, "_pendingBlockId", null);
|
|
22
23
|
}
|
|
23
24
|
getId() {
|
|
24
|
-
return
|
|
25
|
+
return I;
|
|
25
26
|
}
|
|
26
27
|
getIcon() {
|
|
27
28
|
return "recommendation-icon";
|
|
@@ -38,8 +39,8 @@ class q extends R {
|
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
41
|
getSettingsPanelTitleHtml() {
|
|
41
|
-
return
|
|
42
|
-
|
|
42
|
+
return y(
|
|
43
|
+
I,
|
|
43
44
|
this.api.translate("Recommendation Block"),
|
|
44
45
|
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
46
|
);
|
|
@@ -95,7 +96,7 @@ class q extends R {
|
|
|
95
96
|
documentModifier: this.api.getDocumentModifier()
|
|
96
97
|
}));
|
|
97
98
|
}
|
|
98
|
-
s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
99
|
+
s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
|
|
99
100
|
}
|
|
100
101
|
/**
|
|
101
102
|
* Called when the document changes or template is loaded
|
|
@@ -117,7 +118,7 @@ class q extends R {
|
|
|
117
118
|
}
|
|
118
119
|
this._healLingeringDuplicate(t), c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
119
120
|
try {
|
|
120
|
-
|
|
121
|
+
_ || (p(this.api), _ = !0);
|
|
121
122
|
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
122
123
|
if (i) {
|
|
123
124
|
const n = !e.mobileLayoutEnabled;
|
|
@@ -137,6 +138,24 @@ class q extends R {
|
|
|
137
138
|
const e = this._getRecommendationId(t);
|
|
138
139
|
e && g().removeBlockState(e);
|
|
139
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Warns (dark advisory toaster) when the design holds more than one live
|
|
143
|
+
* recommendation block. Triggered from the user-add paths only (fresh drop
|
|
144
|
+
* and duplicate) — never from document-load/migration, so opening a template
|
|
145
|
+
* that already has multiple blocks does not fire it. `onCreated` also runs
|
|
146
|
+
* for a reco block that arrives inside a saved structure (SD-143028), so this
|
|
147
|
+
* covers that case too — no separate `module_dropped` handling is needed.
|
|
148
|
+
*
|
|
149
|
+
* Counting lives in `useRecommendationBlockWarning`, whose DOM-based logic
|
|
150
|
+
* ignores the empty shells deletions leave behind (SD-143028). Wrapped in
|
|
151
|
+
* try/catch because the document root may be unavailable during initial load.
|
|
152
|
+
*/
|
|
153
|
+
_warnIfMultipleBlocks() {
|
|
154
|
+
try {
|
|
155
|
+
M().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
}
|
|
140
159
|
/**
|
|
141
160
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
142
161
|
* in the document and finding the maximum existing ID + 1.
|
|
@@ -209,7 +228,7 @@ class q extends R {
|
|
|
209
228
|
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
210
229
|
_handleDuplicate(t, e) {
|
|
211
230
|
const i = this._reassignDuplicateId(t, e), n = g();
|
|
212
|
-
n.cloneBlockState(e, i), n.setCurrentBlock(i);
|
|
231
|
+
n.cloneBlockState(e, i), n.setCurrentBlock(i), this._warnIfMultipleBlocks();
|
|
213
232
|
}
|
|
214
233
|
/**
|
|
215
234
|
* Core id-reassignment for a duplicated block: rewrites the DOM
|
|
@@ -291,6 +310,6 @@ class q extends R {
|
|
|
291
310
|
}
|
|
292
311
|
}
|
|
293
312
|
export {
|
|
294
|
-
|
|
295
|
-
|
|
313
|
+
I as BLOCK_ID,
|
|
314
|
+
H as RecommendationBlock
|
|
296
315
|
};
|