@useinsider/guido 3.13.1-beta.a1e3c5f → 3.13.1-beta.bf25eb9
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 +13 -15
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +66 -67
- package/dist/composables/useHtmlValidator.js +50 -50
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/index.js +10 -11
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +346 -314
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -43
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/guido.css +1 -1
- package/dist/library.js +9 -14
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/index.d.ts +1 -4
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +22 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +52 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- package/dist/src/library.d.ts +0 -2
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/src/stores/editor.d.ts +0 -25
- package/dist/stores/editor.js +1 -4
- package/dist/utils/templatePreparation.js +59 -70
- package/package.json +1 -1
- package/dist/config/migrator/trackIdMigrator.js +0 -11
- package/dist/src/config/migrator/trackIdMigrator.d.ts +0 -6
- package/dist/src/utils/linkTrackingIds.d.ts +0 -25
- package/dist/utils/linkTrackingIds.js +0 -44
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleFolderDefaults as
|
|
2
|
-
import { object as a, number as n, optional as e, string as t, picklist as r, pipe as p, minLength as b, custom as h, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as
|
|
1
|
+
import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
|
|
2
|
+
import { object as a, number as n, optional as e, string as t, picklist as r, pipe as p, minLength as b, custom as h, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as f, unknown as s, lazy as T } from "../../node_modules/valibot/dist/index.js";
|
|
3
3
|
const d = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
@@ -12,7 +12,7 @@ const d = {
|
|
|
12
12
|
ARCHITECT: 49,
|
|
13
13
|
/** Unsubscribe page builder */
|
|
14
14
|
UNSUBSCRIBE_PAGES: 97
|
|
15
|
-
},
|
|
15
|
+
}, A = a({
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
17
|
templateId: p(
|
|
18
18
|
t(),
|
|
@@ -25,7 +25,7 @@ const d = {
|
|
|
25
25
|
),
|
|
26
26
|
/** Optional variation ID for A/B testing */
|
|
27
27
|
variationId: e(t())
|
|
28
|
-
}),
|
|
28
|
+
}), I = a({
|
|
29
29
|
/** Fallback font name (e.g., "Georgia") */
|
|
30
30
|
name: t(),
|
|
31
31
|
/** Fallback font family (e.g., "serif" or "sans-serif") */
|
|
@@ -53,7 +53,7 @@ const d = {
|
|
|
53
53
|
/** Display name for the current user */
|
|
54
54
|
username: e(t(), "Guido User"),
|
|
55
55
|
/** Fallback font settings from partner settings — used to match backend size calculation */
|
|
56
|
-
fallbackFont: e(
|
|
56
|
+
fallbackFont: e(I)
|
|
57
57
|
}), v = a({
|
|
58
58
|
/** Display text for the dynamic content */
|
|
59
59
|
text: t(),
|
|
@@ -83,7 +83,7 @@ const d = {
|
|
|
83
83
|
/** Block ID (matches the dictionary key and the legacy HTML element id) */
|
|
84
84
|
id: e(n()),
|
|
85
85
|
/** Decimal places for price display (legacy data may use string or number) */
|
|
86
|
-
decimalCount: e(
|
|
86
|
+
decimalCount: e(f([t(), n()])),
|
|
87
87
|
/** Pinned product IDs (empty array when filter-driven) */
|
|
88
88
|
productIds: e(c(s())),
|
|
89
89
|
/** Whether the block requested live products at send time */
|
|
@@ -117,7 +117,7 @@ const d = {
|
|
|
117
117
|
/** Block type marker used by some legacy variants */
|
|
118
118
|
blockType: e(t()),
|
|
119
119
|
/** Size variant marker (legacy data may use string or number) */
|
|
120
|
-
size: e(
|
|
120
|
+
size: e(f([t(), n()])),
|
|
121
121
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
122
122
|
verticalResponsiveness: e(o()),
|
|
123
123
|
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
@@ -175,9 +175,9 @@ const d = {
|
|
|
175
175
|
/** Email header settings */
|
|
176
176
|
emailHeader: e(N, { senderName: "", subject: "" }),
|
|
177
177
|
/** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
|
|
178
|
-
savedModulesFolderName: e(t(),
|
|
178
|
+
savedModulesFolderName: e(t(), y.SAVED_MODULES),
|
|
179
179
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
180
|
-
defaultModulesFolderName: e(t(),
|
|
180
|
+
defaultModulesFolderName: e(t(), y.DEFAULT_MODULES)
|
|
181
181
|
}), x = a({
|
|
182
182
|
/** Whether to show the header bar */
|
|
183
183
|
showHeader: e(o(), !0),
|
|
@@ -203,9 +203,7 @@ const d = {
|
|
|
203
203
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
204
204
|
autosave: e(o(), !1),
|
|
205
205
|
/** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
|
|
206
|
-
allowlistEnabled: e(o(), !1)
|
|
207
|
-
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
208
|
-
linkTrackingIds: e(o(), !1)
|
|
206
|
+
allowlistEnabled: e(o(), !1)
|
|
209
207
|
}), U = r([
|
|
210
208
|
"amp-accordion",
|
|
211
209
|
"amp-carousel",
|
|
@@ -301,7 +299,7 @@ const d = {
|
|
|
301
299
|
}), K = a({
|
|
302
300
|
// Required sections
|
|
303
301
|
/** Identity configuration (required) */
|
|
304
|
-
identity:
|
|
302
|
+
identity: A,
|
|
305
303
|
/** Partner configuration (required) */
|
|
306
304
|
partner: L,
|
|
307
305
|
// Optional sections (with defaults)
|
|
@@ -333,10 +331,10 @@ export {
|
|
|
333
331
|
v as DynamicContentSchema,
|
|
334
332
|
O as EditorSchema,
|
|
335
333
|
N as EmailHeaderSchema,
|
|
336
|
-
|
|
334
|
+
I as FallbackFontSchema,
|
|
337
335
|
F as FeaturesSchema,
|
|
338
336
|
K as GuidoConfigSchema,
|
|
339
|
-
|
|
337
|
+
A as IdentitySchema,
|
|
340
338
|
P as LegacyRecommendationConfigSchema,
|
|
341
339
|
d as MessageType,
|
|
342
340
|
L as PartnerSchema,
|
|
@@ -1,50 +1,49 @@
|
|
|
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
|
|
8
|
-
import { migrate as
|
|
1
|
+
import { defineComponent as q, defineAsyncComponent as M, ref as U, computed as _, watch as B, onMounted as K, onUnmounted as V } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as j } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { provideGuidoActions as J } from "../composables/useGuidoActions.js";
|
|
4
|
+
import { useGuidoStateBridge as Q } from "../composables/useGuidoStateBridge.js";
|
|
5
|
+
import { usePartner as X } from "../composables/usePartner.js";
|
|
6
|
+
import { useStripo as Y } from "../composables/useStripo.js";
|
|
7
|
+
import { useTimerClone as Z } from "../composables/useTimerClone.js";
|
|
8
|
+
import { migrate as I } from "../config/migrator/index.js";
|
|
9
9
|
import { ModuleFolderDefaults as N } from "../enums/defaults.js";
|
|
10
|
-
import { RIBBON_SELECTOR as
|
|
11
|
-
import { useRecommendationExtensionStore as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useStripoApi as
|
|
20
|
-
import { useConfigStore as
|
|
21
|
-
import { useDynamicContentStore as
|
|
22
|
-
import { useEditorStore as
|
|
23
|
-
import { usePreviewStore as
|
|
24
|
-
import { useTemplateStore as
|
|
25
|
-
import { useUnsubscribeStore as
|
|
26
|
-
|
|
27
|
-
const $e = /* @__PURE__ */ K({
|
|
10
|
+
import { RIBBON_SELECTOR as ee } from "../enums/onboarding.js";
|
|
11
|
+
import { useRecommendationExtensionStore as te } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
12
|
+
import oe from "./organisms/AutoSaveController.vue.js";
|
|
13
|
+
import ne from "./organisms/base/Toaster.vue.js";
|
|
14
|
+
import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
15
|
+
import se from "./organisms/header/HeaderWrapper.vue.js";
|
|
16
|
+
import ie from "./organisms/LoadingWrapper.vue.js";
|
|
17
|
+
import ae from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
18
|
+
import ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
19
|
+
import { useStripoApi as de } from "../services/stripoApi.js";
|
|
20
|
+
import { useConfigStore as me } from "../stores/config.js";
|
|
21
|
+
import { useDynamicContentStore as le } from "../stores/dynamic-content.js";
|
|
22
|
+
import { useEditorStore as O } from "../stores/editor.js";
|
|
23
|
+
import { usePreviewStore as ue } from "../stores/preview.js";
|
|
24
|
+
import { useTemplateStore as pe } from "../stores/template.js";
|
|
25
|
+
import { useUnsubscribeStore as fe } from "../stores/unsubscribe.js";
|
|
26
|
+
const xe = /* @__PURE__ */ q({
|
|
28
27
|
__name: "Guido",
|
|
29
28
|
props: {
|
|
30
29
|
config: null,
|
|
31
30
|
ready: { type: Boolean, default: !0 }
|
|
32
31
|
},
|
|
33
32
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
34
|
-
setup(
|
|
35
|
-
const i =
|
|
33
|
+
setup(P, { expose: A, emit: n }) {
|
|
34
|
+
const i = P, W = M(
|
|
36
35
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
37
|
-
),
|
|
36
|
+
), x = M(
|
|
38
37
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
39
|
-
), g =
|
|
38
|
+
), g = U(), l = U(), u = le(), S = fe(), o = me();
|
|
40
39
|
i.ready && o.init(i.config);
|
|
41
|
-
const
|
|
40
|
+
const d = O(), G = ue(), m = _(() => d.hasChanges), { isTestPartner: H } = X(), h = () => {
|
|
42
41
|
var t;
|
|
43
42
|
return (t = g.value) == null ? void 0 : t.handleSave(!0);
|
|
44
43
|
}, b = (t) => {
|
|
45
|
-
|
|
44
|
+
d.loadingStatus = t;
|
|
46
45
|
};
|
|
47
|
-
|
|
46
|
+
j(), Q();
|
|
48
47
|
const p = () => {
|
|
49
48
|
var t, e;
|
|
50
49
|
return {
|
|
@@ -55,78 +54,78 @@ const $e = /* @__PURE__ */ K({
|
|
|
55
54
|
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
|
|
56
55
|
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
|
|
57
56
|
};
|
|
58
|
-
}, { initPlugin: E, preloadRuntime: w } =
|
|
57
|
+
}, { initPlugin: E, preloadRuntime: w } = Y(), { getDefaultTemplate: C } = de(), { cloneTimersOnSave: D, hasTimerBlocks: T } = Z(), $ = _(() => {
|
|
59
58
|
var t;
|
|
60
59
|
return !((t = o.ui) != null && t.showHeader);
|
|
61
60
|
});
|
|
62
|
-
|
|
61
|
+
J({
|
|
63
62
|
onBack: () => {
|
|
64
|
-
console.debug("guido:back"),
|
|
63
|
+
console.debug("guido:back"), n("back");
|
|
65
64
|
},
|
|
66
65
|
onSaveStart: () => {
|
|
67
|
-
console.debug("guido:save:start"),
|
|
66
|
+
console.debug("guido:save:start"), n("save:start");
|
|
68
67
|
},
|
|
69
68
|
onSaveComplete: (t) => {
|
|
70
69
|
const e = { ...t, metadata: p() };
|
|
71
|
-
console.debug("guido:save:complete", e),
|
|
70
|
+
console.debug("guido:save:complete", e), n("save:complete", e);
|
|
72
71
|
},
|
|
73
72
|
onTestEmailClick: () => {
|
|
74
|
-
console.debug("guido:test-email:click"),
|
|
73
|
+
console.debug("guido:test-email:click"), n("test-email:click");
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
|
-
const
|
|
76
|
+
const L = (t) => {
|
|
78
77
|
console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
79
|
-
},
|
|
78
|
+
}, R = () => {
|
|
80
79
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
81
80
|
};
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
B(() => m.value, () => {
|
|
82
|
+
n("on-change", m.value);
|
|
84
83
|
});
|
|
85
84
|
const f = (t) => {
|
|
86
|
-
const e = t, { attribute: s, position:
|
|
87
|
-
console.debug("dynamic-content:open", e.detail),
|
|
85
|
+
const e = t, { attribute: s, position: c } = e.detail;
|
|
86
|
+
console.debug("dynamic-content:open", e.detail), n("dynamic-content:open", s, c);
|
|
88
87
|
};
|
|
89
88
|
let a = null;
|
|
90
89
|
const y = () => {
|
|
91
90
|
var e;
|
|
92
|
-
const t = document.querySelector(
|
|
91
|
+
const t = document.querySelector(ee);
|
|
93
92
|
(e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
94
93
|
}, v = async () => {
|
|
95
94
|
var t;
|
|
96
95
|
try {
|
|
97
|
-
o.initialized || o.init(i.config),
|
|
98
|
-
const e = o.template, s = (e == null ? void 0 : e.html) || "",
|
|
96
|
+
o.initialized || o.init(i.config), d.templateId = o.templateId;
|
|
97
|
+
const e = o.template, s = (e == null ? void 0 : e.html) || "", c = (e == null ? void 0 : e.css) || "", k = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
99
98
|
S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
html: s && await
|
|
103
|
-
css:
|
|
99
|
+
const F = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {};
|
|
100
|
+
let r = {
|
|
101
|
+
html: s && await I(s, F),
|
|
102
|
+
css: c
|
|
104
103
|
};
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
preselectedDynamicContentList:
|
|
104
|
+
r.html || (r = await C(), r.html = await I(r.html, F)), T(r.html) && (r.html = await D(r.html));
|
|
105
|
+
const z = {
|
|
106
|
+
preselectedDynamicContentList: k,
|
|
108
107
|
onReady: () => {
|
|
109
|
-
console.debug("guido:ready"),
|
|
108
|
+
console.debug("guido:ready"), n("ready");
|
|
110
109
|
}
|
|
111
110
|
};
|
|
112
|
-
await E(
|
|
111
|
+
await E(r, p(), z), u.selectedDynamicContentList = k;
|
|
113
112
|
} catch (e) {
|
|
114
113
|
console.error("Failed to initialize Stripo editor:", e);
|
|
115
114
|
}
|
|
116
115
|
};
|
|
117
|
-
return
|
|
116
|
+
return K(async () => {
|
|
118
117
|
var e;
|
|
119
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
118
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), te().$reset(), O().$reset(), pe().$reset(), y();
|
|
120
119
|
const t = (e = l.value) == null ? void 0 : e.parentElement;
|
|
121
120
|
if (t && (a = new ResizeObserver(y), a.observe(t)), w(), i.ready)
|
|
122
121
|
await v();
|
|
123
122
|
else {
|
|
124
|
-
const s =
|
|
125
|
-
|
|
123
|
+
const s = B(() => i.ready, (c) => {
|
|
124
|
+
c && (s(), v());
|
|
126
125
|
});
|
|
127
126
|
}
|
|
128
127
|
document.addEventListener("dynamic-content:open", f);
|
|
129
|
-
}),
|
|
128
|
+
}), V(() => {
|
|
130
129
|
a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", f);
|
|
131
130
|
try {
|
|
132
131
|
window.UIEditor.removeEditor();
|
|
@@ -134,17 +133,17 @@ const $e = /* @__PURE__ */ K({
|
|
|
134
133
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
135
134
|
}
|
|
136
135
|
o.reset();
|
|
137
|
-
}),
|
|
136
|
+
}), A({
|
|
138
137
|
dynamicContent: {
|
|
139
|
-
insert:
|
|
140
|
-
close:
|
|
138
|
+
insert: L,
|
|
139
|
+
close: R
|
|
141
140
|
},
|
|
142
141
|
hasChanges: m,
|
|
143
142
|
saveSilent: h,
|
|
144
143
|
setLoading: b
|
|
145
|
-
}), { __sfc: !0, PreviewContainer:
|
|
144
|
+
}), { __sfc: !0, PreviewContainer: W, OnboardingWrapper: x, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: i, configStore: o, editorStore: d, previewStore: G, hasChanges: m, isTestPartner: H, saveSilent: h, setLoading: b, emit: n, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: C, cloneTimersOnSave: D, hasTimerBlocks: T, noHeader: $, insertDynamicContent: L, closeDynamicContent: R, handleDynamicContentOpen: f, ribbonObserver: a, updateRibbonOffset: y, startEditor: v, AutoSaveController: oe, Toaster: ne, FilterSelectionDrawer: re, HeaderWrapper: se, LoadingWrapper: ie, SaveAsTemplateDrawer: ae, UnsubscribeWrapper: ce };
|
|
146
145
|
}
|
|
147
146
|
});
|
|
148
147
|
export {
|
|
149
|
-
|
|
148
|
+
xe as default
|
|
150
149
|
};
|
|
@@ -6,7 +6,7 @@ import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
|
6
6
|
import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
7
|
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
8
8
|
import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
-
import {
|
|
9
|
+
import { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
10
10
|
import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
11
11
|
import { useRecommendationStore as te } from "../stores/recommendation.js";
|
|
12
12
|
import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
|
|
@@ -14,25 +14,25 @@ import { useHttp as se } from "./useHttp.js";
|
|
|
14
14
|
import { useToaster as re } from "./useToaster.js";
|
|
15
15
|
import { useTranslations as oe } from "./useTranslations.js";
|
|
16
16
|
const ie = /recommendation-id="(\d+)"/g;
|
|
17
|
-
function ae(
|
|
18
|
-
return [...
|
|
17
|
+
function ae(n) {
|
|
18
|
+
return [...n.matchAll(ie)].map((m) => m[1]);
|
|
19
19
|
}
|
|
20
|
-
function ce(
|
|
21
|
-
return m.some((f) =>
|
|
20
|
+
function ce(n, m) {
|
|
21
|
+
return m.some((f) => n.startsWith(`${f}_`));
|
|
22
22
|
}
|
|
23
23
|
const le = /^(\d+)_\d+_(.+)$/;
|
|
24
|
-
function me(
|
|
25
|
-
const m =
|
|
24
|
+
function me(n) {
|
|
25
|
+
const m = n.match(le);
|
|
26
26
|
return m ? { recoId: m[1], attribute: m[2] } : null;
|
|
27
27
|
}
|
|
28
|
-
function ue(
|
|
28
|
+
function ue(n) {
|
|
29
29
|
const m = new Set(Z);
|
|
30
|
-
return Object.values(
|
|
31
|
-
m.add(Q(f
|
|
30
|
+
return Object.values(n).forEach((f) => {
|
|
31
|
+
m.add(Q(f).toLowerCase());
|
|
32
32
|
}), m;
|
|
33
33
|
}
|
|
34
|
-
function de(
|
|
35
|
-
const u =
|
|
34
|
+
function de(n, m, f, o, d) {
|
|
35
|
+
const u = n.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
36
36
|
if (!u)
|
|
37
37
|
return [];
|
|
38
38
|
const p = new Set(m.map((h) => h.toLowerCase())), E = [];
|
|
@@ -50,15 +50,15 @@ function de(t, m, f, o, d) {
|
|
|
50
50
|
ce(g, f) || g.includes(".") || E.push(g);
|
|
51
51
|
}), E;
|
|
52
52
|
}
|
|
53
|
-
function fe(
|
|
54
|
-
return (
|
|
53
|
+
function fe(n) {
|
|
54
|
+
return (n.replace(U, "$1").match(j) ?? []).filter((o) => {
|
|
55
55
|
const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
|
|
56
56
|
return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
const xe = () => {
|
|
60
60
|
var b, S;
|
|
61
|
-
const { showToaster:
|
|
61
|
+
const { showToaster: n } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
|
|
62
62
|
if (e.size === 0)
|
|
63
63
|
return /* @__PURE__ */ new Set();
|
|
64
64
|
try {
|
|
@@ -68,59 +68,59 @@ const xe = () => {
|
|
|
68
68
|
}
|
|
69
69
|
return ue(u.filterList);
|
|
70
70
|
}, h = async (e) => {
|
|
71
|
-
const
|
|
71
|
+
const t = await m(
|
|
72
72
|
"/newsletter/template-library/check-template-html-body",
|
|
73
73
|
{ html: ne(e) }
|
|
74
|
-
), { status: r, message: a } =
|
|
75
|
-
return r ||
|
|
74
|
+
), { status: r, message: a } = t.data;
|
|
75
|
+
return r || n({
|
|
76
76
|
type: c.Error,
|
|
77
77
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
78
|
-
}), o($), a === o(Y) &&
|
|
78
|
+
}), o($), a === o(Y) && n({
|
|
79
79
|
type: c.Error,
|
|
80
80
|
message: o("newsletter.already-in-progress")
|
|
81
81
|
}), r;
|
|
82
82
|
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
|
|
83
|
-
const
|
|
83
|
+
const t = e.match(/({%(.*?)%})/g);
|
|
84
84
|
let r = !0;
|
|
85
|
-
return
|
|
85
|
+
return t !== null && !p && t.forEach((a) => {
|
|
86
86
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
87
87
|
if (i && i.length > 0) {
|
|
88
88
|
const [l] = i;
|
|
89
|
-
g(l) && !s.includes(l) && (
|
|
89
|
+
g(l) && !s.includes(l) && (n({
|
|
90
90
|
type: c.Warning,
|
|
91
91
|
message: o("custom-fields.invalid-custom-fields")
|
|
92
92
|
}), r = !1);
|
|
93
93
|
}
|
|
94
94
|
}), r;
|
|
95
|
-
}, w = async (e, s,
|
|
96
|
-
const r =
|
|
95
|
+
}, w = async (e, s, t) => {
|
|
96
|
+
const r = t ? await h(e) : !0;
|
|
97
97
|
return T(e, s) && r;
|
|
98
|
-
}, R = (e) => e.length > 0 ? !0 : (
|
|
98
|
+
}, R = (e) => e.length > 0 ? !0 : (n({
|
|
99
99
|
type: c.Warning,
|
|
100
100
|
message: o("newsletter.html-content-is-empty")
|
|
101
101
|
}), !1), _ = (e) => {
|
|
102
|
-
const s = (e.match(/{/gm) || []).length,
|
|
103
|
-
return s >
|
|
102
|
+
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
103
|
+
return s > t && n({
|
|
104
104
|
type: c.Warning,
|
|
105
105
|
message: o("custom-fields.missing-closing-braces")
|
|
106
|
-
}), s <
|
|
106
|
+
}), s < t && n({
|
|
107
107
|
type: c.Warning,
|
|
108
108
|
message: o("custom-fields.missing-opening-braces")
|
|
109
|
-
}), s ===
|
|
109
|
+
}), s === t;
|
|
110
110
|
}, N = (e) => {
|
|
111
111
|
const s = fe(e).length === 0;
|
|
112
|
-
return s ||
|
|
112
|
+
return s || n({
|
|
113
113
|
type: c.Warning,
|
|
114
114
|
message: o("custom-fields.invalid-custom-fields")
|
|
115
115
|
}), s;
|
|
116
|
-
}, x = (e, s,
|
|
116
|
+
}, x = (e, s, t, r) => {
|
|
117
117
|
if (p)
|
|
118
118
|
return !0;
|
|
119
119
|
const a = de(
|
|
120
120
|
e,
|
|
121
121
|
s,
|
|
122
122
|
ae(e),
|
|
123
|
-
|
|
123
|
+
t,
|
|
124
124
|
r
|
|
125
125
|
);
|
|
126
126
|
if (a.length > 0) {
|
|
@@ -129,56 +129,56 @@ const xe = () => {
|
|
|
129
129
|
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
130
130
|
</ul>
|
|
131
131
|
`;
|
|
132
|
-
return
|
|
132
|
+
return n({
|
|
133
133
|
type: c.Error,
|
|
134
134
|
message: o("custom-fields.invalid-custom-fields") + i
|
|
135
135
|
}), !1;
|
|
136
136
|
}
|
|
137
137
|
return !0;
|
|
138
138
|
}, O = (e) => {
|
|
139
|
-
const s = e.match(/{%(.*?)%}/g),
|
|
139
|
+
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
140
140
|
let r = !0;
|
|
141
141
|
if (s && s.forEach((a) => {
|
|
142
142
|
const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
|
|
143
|
-
(!i || a !== v) && !l && (
|
|
143
|
+
(!i || a !== v) && !l && (n({
|
|
144
144
|
type: c.Error,
|
|
145
145
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
146
146
|
}), r = !1), i && i.forEach((C) => {
|
|
147
|
-
C.trim() === "=" && (
|
|
147
|
+
C.trim() === "=" && (n({
|
|
148
148
|
type: c.Error,
|
|
149
149
|
message: o("custom-conditions.wrong-equality-operators")
|
|
150
150
|
}), r = !1);
|
|
151
151
|
const I = C.match(/^[a-zA-Z]*$/g);
|
|
152
152
|
I && I.forEach((A) => {
|
|
153
|
-
y(A) &&
|
|
153
|
+
y(A) && t.push(A);
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
|
-
}),
|
|
157
|
-
const a =
|
|
158
|
-
a.length !== i.length && (
|
|
156
|
+
}), t.length) {
|
|
157
|
+
const a = t.filter((l) => l === "if"), i = t.filter((l) => l === "endif");
|
|
158
|
+
a.length !== i.length && (n({
|
|
159
159
|
type: c.Error,
|
|
160
160
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
161
161
|
}), r = !1);
|
|
162
162
|
}
|
|
163
163
|
return r;
|
|
164
164
|
}, k = (e) => {
|
|
165
|
-
const s = (e.match(/{% /gm) || []).length,
|
|
166
|
-
return r ||
|
|
165
|
+
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, r = s === t;
|
|
166
|
+
return r || n({
|
|
167
167
|
type: c.Warning,
|
|
168
168
|
message: o("custom-conditions.no-space-after-braces")
|
|
169
169
|
}), r;
|
|
170
|
-
}, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((
|
|
170
|
+
}, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, r) => t + r, 0) > 0 ? (n({
|
|
171
171
|
type: c.Warning,
|
|
172
172
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
173
|
-
}), !1) : !0, D = () => u.hasInvalidBlock() ? (
|
|
173
|
+
}), !1) : !0, D = () => u.hasInvalidBlock() ? (n({
|
|
174
174
|
type: c.Error,
|
|
175
175
|
message: o(ee)
|
|
176
|
-
}), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((
|
|
176
|
+
}), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (n({
|
|
177
177
|
type: c.Error,
|
|
178
178
|
message: o("newsletter.fill-all-necessary-fields")
|
|
179
179
|
}), !1) : !0, L = (e) => {
|
|
180
180
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
181
|
-
return e.match(s) === null ? !0 : (
|
|
181
|
+
return e.match(s) === null ? !0 : (n({
|
|
182
182
|
type: c.Error,
|
|
183
183
|
message: o("newsletter.invalid-image-type")
|
|
184
184
|
}), !1);
|
|
@@ -187,7 +187,7 @@ const xe = () => {
|
|
|
187
187
|
return Array.from(r).find((i) => {
|
|
188
188
|
var l;
|
|
189
189
|
return !((l = i.id) != null && l.trim());
|
|
190
|
-
}) ? (
|
|
190
|
+
}) ? (n({
|
|
191
191
|
type: c.Error,
|
|
192
192
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
193
193
|
}), !1) : !0;
|
|
@@ -196,19 +196,19 @@ const xe = () => {
|
|
|
196
196
|
return Array.from(r).find((i) => {
|
|
197
197
|
var l;
|
|
198
198
|
return !((l = i.id) != null && l.trim());
|
|
199
|
-
}) ? (
|
|
199
|
+
}) ? (n({
|
|
200
200
|
type: c.Error,
|
|
201
201
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
202
202
|
}), !1) : !0;
|
|
203
203
|
};
|
|
204
|
-
return { validateHtml: async (e, s,
|
|
204
|
+
return { validateHtml: async (e, s, t = !1) => {
|
|
205
205
|
var v, C;
|
|
206
206
|
const r = [
|
|
207
207
|
...s.map((I) => I.value),
|
|
208
208
|
...z,
|
|
209
209
|
...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
|
|
210
210
|
], a = G(e), i = await E(a);
|
|
211
|
-
return await w(e, r,
|
|
211
|
+
return await w(e, r, t) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
|
|
212
212
|
} };
|
|
213
213
|
};
|
|
214
214
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = "Items", o = {
|
|
1
|
+
const e = "Items", o = "Default", t = "Custom", s = {
|
|
2
2
|
"Global Styles & Layout": "Global Styles and Layout",
|
|
3
3
|
"Structures & Modules": "Structures and Modules",
|
|
4
4
|
"Recommendation Block": "Recommendation",
|
|
@@ -7,9 +7,13 @@ const e = "Items", o = {
|
|
|
7
7
|
"This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
|
|
8
8
|
"Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
|
|
9
9
|
"OPT-IN SELECTION": "OPT-IN SELECTION",
|
|
10
|
-
"UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
|
|
10
|
+
"UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
|
|
11
|
+
Default: o,
|
|
12
|
+
Custom: t
|
|
11
13
|
};
|
|
12
14
|
export {
|
|
15
|
+
t as Custom,
|
|
16
|
+
o as Default,
|
|
13
17
|
e as Items,
|
|
14
|
-
|
|
18
|
+
s as default
|
|
15
19
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
1
|
+
import { migrateCheckbox as t } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
|
-
import { migrateRadioButton as
|
|
5
|
-
import { migrateRecommendation as
|
|
6
|
-
import { migrateSocialIcons as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return r = i(r), r = c(r), r = await f(r), r = a(r), r = g(r, o), r = e(r), r = n(r), t.linkTrackingIds && (r = p(r)), r;
|
|
4
|
+
import { migrateRadioButton as a } from "./radioButtonMigrator.js";
|
|
5
|
+
import { migrateRecommendation as c } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateSocialIcons as g } from "./socialIconMigrator.js";
|
|
7
|
+
import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
|
|
8
|
+
const k = async (o, r = {}) => {
|
|
9
|
+
let m = o;
|
|
10
|
+
return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
|
|
12
11
|
};
|
|
13
12
|
export {
|
|
14
|
-
|
|
13
|
+
k as migrate
|
|
15
14
|
};
|