@useinsider/guido 3.13.0 → 3.13.1-beta.88c2f20
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/README.md +1 -1
- package/dist/@types/config/defaults.js +6 -2
- package/dist/@types/config/schemas.js +24 -17
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +78 -72
- package/dist/composables/useActionsApi.js +24 -18
- package/dist/composables/useEmailTemplateApplier.js +26 -24
- package/dist/composables/useTimerClone.js +1 -1
- package/dist/composables/useTranslations.js +7 -5
- package/dist/config/compiler/outlookCompilerRules.js +21 -8
- package/dist/config/migrator/index.js +11 -10
- package/dist/config/migrator/trackIdMigrator.js +11 -0
- package/dist/guido.css +1 -1
- package/dist/library.js +14 -9
- package/dist/src/@types/config/schemas.d.ts +14 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +0 -5
- package/dist/src/config/migrator/index.d.ts +6 -1
- package/dist/src/config/migrator/trackIdMigrator.d.ts +6 -0
- package/dist/src/library.d.ts +2 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/utils/linkTrackingIds.d.ts +25 -0
- package/dist/stores/editor.js +4 -1
- package/dist/utils/linkTrackingIds.js +44 -0
- package/dist/utils/templatePreparation.js +70 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ const config: GuidoConfigInput = {
|
|
|
134
134
|
// Optional: Editor settings
|
|
135
135
|
editor?: {
|
|
136
136
|
locale?: string, // Default: 'en'
|
|
137
|
-
translationsPath?: string, // Default:
|
|
137
|
+
translationsPath?: string, // Default: first locale registered on window.trans
|
|
138
138
|
migrationDate?: number, // Stripo migration timestamp
|
|
139
139
|
emailHeader?: {
|
|
140
140
|
senderName?: string,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ProductType as a, MessageType as o } from "./schemas.js";
|
|
2
|
+
const i = {
|
|
3
|
+
translationsPath: "window.trans[Object.keys(window.trans)[0]]"
|
|
4
|
+
};
|
|
2
5
|
a.EMAIL;
|
|
3
6
|
o.PROMOTIONAL;
|
|
4
7
|
const e = [
|
|
@@ -33,12 +36,13 @@ const e = [
|
|
|
33
36
|
"vikingsankara",
|
|
34
37
|
"stripoeditorlivetest"
|
|
35
38
|
];
|
|
36
|
-
function
|
|
39
|
+
function s(t) {
|
|
37
40
|
return e.includes(t);
|
|
38
41
|
}
|
|
39
42
|
export {
|
|
43
|
+
i as DEFAULT_EDITOR,
|
|
40
44
|
o as MessageType,
|
|
41
45
|
a as ProductType,
|
|
42
46
|
e as TEST_PARTNERS,
|
|
43
|
-
|
|
47
|
+
s as isTestPartner
|
|
44
48
|
};
|
|
@@ -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
|
|
1
|
+
import { ModuleFolderDefaults as f } 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 y, boolean as o, array as c, record as h, fallback as C, literal as i, looseObject as g, variant as R, union as k, 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
|
+
}, I = 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
|
+
}), A = 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(A)
|
|
57
57
|
}), v = a({
|
|
58
58
|
/** Display text for the dynamic content */
|
|
59
59
|
text: t(),
|
|
@@ -76,14 +76,14 @@ const d = {
|
|
|
76
76
|
children: e(c(S)),
|
|
77
77
|
// eslint-disable-next-line camelcase -- backend field name
|
|
78
78
|
select_items: e(c(S))
|
|
79
|
-
})), E =
|
|
79
|
+
})), E = h(
|
|
80
80
|
t(),
|
|
81
81
|
C(c(S), [])
|
|
82
82
|
), P = g({
|
|
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(k([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(k([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) */
|
|
@@ -132,7 +132,7 @@ const d = {
|
|
|
132
132
|
* strategy, currency, locale, and layout data.
|
|
133
133
|
*/
|
|
134
134
|
recommendationConfigs: e(
|
|
135
|
-
|
|
135
|
+
h(t(), P),
|
|
136
136
|
{}
|
|
137
137
|
)
|
|
138
138
|
}), M = a({
|
|
@@ -158,6 +158,11 @@ const d = {
|
|
|
158
158
|
selectedUnsubscribePages: e(c(n()), []),
|
|
159
159
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
160
160
|
forceRecreate: e(o(), !1),
|
|
161
|
+
/**
|
|
162
|
+
* Consumer-persisted tracking-id high-water mark (SD-141414). Used as the id floor
|
|
163
|
+
* during migration so a rolled-back document never re-mints retired tracking ids.
|
|
164
|
+
*/
|
|
165
|
+
trackIdCounter: e(n(), 0),
|
|
161
166
|
/** Migration-only inputs (legacy block configs) */
|
|
162
167
|
migration: e(D, {})
|
|
163
168
|
}), N = a({
|
|
@@ -175,9 +180,9 @@ const d = {
|
|
|
175
180
|
/** Email header settings */
|
|
176
181
|
emailHeader: e(N, { senderName: "", subject: "" }),
|
|
177
182
|
/** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
|
|
178
|
-
savedModulesFolderName: e(t(),
|
|
183
|
+
savedModulesFolderName: e(t(), f.SAVED_MODULES),
|
|
179
184
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
180
|
-
defaultModulesFolderName: e(t(),
|
|
185
|
+
defaultModulesFolderName: e(t(), f.DEFAULT_MODULES)
|
|
181
186
|
}), x = a({
|
|
182
187
|
/** Whether to show the header bar */
|
|
183
188
|
showHeader: e(o(), !0),
|
|
@@ -203,7 +208,9 @@ const d = {
|
|
|
203
208
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
204
209
|
autosave: e(o(), !1),
|
|
205
210
|
/** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
|
|
206
|
-
allowlistEnabled: e(o(), !1)
|
|
211
|
+
allowlistEnabled: e(o(), !1),
|
|
212
|
+
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
213
|
+
linkTrackingIds: e(o(), !1)
|
|
207
214
|
}), U = r([
|
|
208
215
|
"amp-accordion",
|
|
209
216
|
"amp-carousel",
|
|
@@ -271,7 +278,7 @@ const d = {
|
|
|
271
278
|
...m.entries,
|
|
272
279
|
type: i("custom"),
|
|
273
280
|
/** Custom processor function */
|
|
274
|
-
processor:
|
|
281
|
+
processor: y(
|
|
275
282
|
(u) => typeof u == "function",
|
|
276
283
|
"processor must be a function"
|
|
277
284
|
)
|
|
@@ -291,7 +298,7 @@ const d = {
|
|
|
291
298
|
* Return false to cancel the save operation.
|
|
292
299
|
*/
|
|
293
300
|
externalValidation: e(
|
|
294
|
-
|
|
301
|
+
y(
|
|
295
302
|
(u) => typeof u == "function",
|
|
296
303
|
"externalValidation must be a function"
|
|
297
304
|
)
|
|
@@ -299,7 +306,7 @@ const d = {
|
|
|
299
306
|
}), K = a({
|
|
300
307
|
// Required sections
|
|
301
308
|
/** Identity configuration (required) */
|
|
302
|
-
identity:
|
|
309
|
+
identity: I,
|
|
303
310
|
/** Partner configuration (required) */
|
|
304
311
|
partner: L,
|
|
305
312
|
// Optional sections (with defaults)
|
|
@@ -331,10 +338,10 @@ export {
|
|
|
331
338
|
v as DynamicContentSchema,
|
|
332
339
|
O as EditorSchema,
|
|
333
340
|
N as EmailHeaderSchema,
|
|
334
|
-
|
|
341
|
+
A as FallbackFontSchema,
|
|
335
342
|
F as FeaturesSchema,
|
|
336
343
|
K as GuidoConfigSchema,
|
|
337
|
-
|
|
344
|
+
I as IdentitySchema,
|
|
338
345
|
P as LegacyRecommendationConfigSchema,
|
|
339
346
|
d as MessageType,
|
|
340
347
|
L as PartnerSchema,
|
|
@@ -1,49 +1,50 @@
|
|
|
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 j, defineAsyncComponent as R, ref as B, computed as O, watch as U, onMounted as J, onUnmounted as Q } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as X } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { provideGuidoActions as Y } from "../composables/useGuidoActions.js";
|
|
4
|
+
import { useGuidoStateBridge as Z } from "../composables/useGuidoStateBridge.js";
|
|
5
|
+
import { usePartner as ee } from "../composables/usePartner.js";
|
|
6
|
+
import { useStripo as te } from "../composables/useStripo.js";
|
|
7
|
+
import { useTimerClone as oe } from "../composables/useTimerClone.js";
|
|
8
|
+
import { migrate as _ } 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
|
-
|
|
10
|
+
import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
|
|
11
|
+
import { useRecommendationExtensionStore as re } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
12
|
+
import se from "./organisms/AutoSaveController.vue.js";
|
|
13
|
+
import ae from "./organisms/base/Toaster.vue.js";
|
|
14
|
+
import ie from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
15
|
+
import ce from "./organisms/header/HeaderWrapper.vue.js";
|
|
16
|
+
import de from "./organisms/LoadingWrapper.vue.js";
|
|
17
|
+
import me from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
18
|
+
import le from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
19
|
+
import { useStripoApi as ue } from "../services/stripoApi.js";
|
|
20
|
+
import { useConfigStore as pe } from "../stores/config.js";
|
|
21
|
+
import { useDynamicContentStore as fe } from "../stores/dynamic-content.js";
|
|
22
|
+
import { useEditorStore as P } from "../stores/editor.js";
|
|
23
|
+
import { usePreviewStore as ye } from "../stores/preview.js";
|
|
24
|
+
import { useTemplateStore as ve } from "../stores/template.js";
|
|
25
|
+
import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
|
|
26
|
+
import { readTrackSeq as A } from "../utils/linkTrackingIds.js";
|
|
27
|
+
const ze = /* @__PURE__ */ j({
|
|
27
28
|
__name: "Guido",
|
|
28
29
|
props: {
|
|
29
30
|
config: null,
|
|
30
31
|
ready: { type: Boolean, default: !0 }
|
|
31
32
|
},
|
|
32
33
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
33
|
-
setup(
|
|
34
|
-
const
|
|
34
|
+
setup(W, { expose: x, emit: r }) {
|
|
35
|
+
const a = W, G = R(
|
|
35
36
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
36
|
-
),
|
|
37
|
+
), H = R(
|
|
37
38
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
38
|
-
),
|
|
39
|
-
|
|
40
|
-
const
|
|
39
|
+
), S = B(), l = B(), u = fe(), g = Se(), o = pe();
|
|
40
|
+
a.ready && o.init(a.config);
|
|
41
|
+
const c = P(), $ = ye(), m = O(() => c.hasChanges), { isTestPartner: z } = ee(), h = () => {
|
|
41
42
|
var t;
|
|
42
|
-
return (t =
|
|
43
|
+
return (t = S.value) == null ? void 0 : t.handleSave(!0);
|
|
43
44
|
}, b = (t) => {
|
|
44
|
-
|
|
45
|
+
c.loadingStatus = t;
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
+
X(), Z();
|
|
47
48
|
const p = () => {
|
|
48
49
|
var t, e;
|
|
49
50
|
return {
|
|
@@ -54,96 +55,101 @@ const xe = /* @__PURE__ */ q({
|
|
|
54
55
|
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
|
|
55
56
|
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
|
|
56
57
|
};
|
|
57
|
-
}, { initPlugin: E, preloadRuntime: w } =
|
|
58
|
+
}, { initPlugin: E, preloadRuntime: w } = te(), { getDefaultTemplate: k } = ue(), { cloneTimersOnSave: C, hasTimerBlocks: D } = oe(), q = O(() => {
|
|
58
59
|
var t;
|
|
59
60
|
return !((t = o.ui) != null && t.showHeader);
|
|
60
61
|
});
|
|
61
|
-
|
|
62
|
+
Y({
|
|
62
63
|
onBack: () => {
|
|
63
|
-
console.debug("guido:back"),
|
|
64
|
+
console.debug("guido:back"), r("back");
|
|
64
65
|
},
|
|
65
66
|
onSaveStart: () => {
|
|
66
|
-
console.debug("guido:save:start"),
|
|
67
|
+
console.debug("guido:save:start"), r("save:start");
|
|
67
68
|
},
|
|
68
69
|
onSaveComplete: (t) => {
|
|
69
70
|
const e = { ...t, metadata: p() };
|
|
70
|
-
console.debug("guido:save:complete", e),
|
|
71
|
+
console.debug("guido:save:complete", e), r("save:complete", e);
|
|
71
72
|
},
|
|
72
73
|
onTestEmailClick: () => {
|
|
73
|
-
console.debug("guido:test-email:click"),
|
|
74
|
+
console.debug("guido:test-email:click"), r("test-email:click");
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
|
-
const
|
|
77
|
+
const T = (t) => {
|
|
77
78
|
console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
78
|
-
},
|
|
79
|
+
}, I = () => {
|
|
79
80
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
80
81
|
};
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
U(() => m.value, () => {
|
|
83
|
+
r("on-change", m.value);
|
|
83
84
|
});
|
|
84
85
|
const f = (t) => {
|
|
85
|
-
const e = t, { attribute: s, position:
|
|
86
|
-
console.debug("dynamic-content:open", e.detail),
|
|
86
|
+
const e = t, { attribute: s, position: d } = e.detail;
|
|
87
|
+
console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
|
|
87
88
|
};
|
|
88
|
-
let
|
|
89
|
+
let i = null;
|
|
89
90
|
const y = () => {
|
|
90
91
|
var e;
|
|
91
|
-
const t = document.querySelector(
|
|
92
|
+
const t = document.querySelector(ne);
|
|
92
93
|
(e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
93
94
|
}, v = async () => {
|
|
94
95
|
var t;
|
|
95
96
|
try {
|
|
96
|
-
o.initialized || o.init(
|
|
97
|
-
const e = o.template, s = (e == null ? void 0 : e.html) || "",
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
css: c
|
|
97
|
+
o.initialized || o.init(a.config), c.templateId = o.templateId;
|
|
98
|
+
const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", F = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
99
|
+
g.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
100
|
+
const L = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, M = {
|
|
101
|
+
linkTrackingIds: o.isFeatureEnabled("linkTrackingIds"),
|
|
102
|
+
trackIdFloor: (e == null ? void 0 : e.trackIdCounter) || 0
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
let n = {
|
|
105
|
+
html: s && await _(s, L, M),
|
|
106
|
+
css: d
|
|
107
|
+
};
|
|
108
|
+
n.html || (n = await k(), n.html = await _(n.html, L, M));
|
|
109
|
+
const K = A(n.html);
|
|
110
|
+
D(n.html) && (n.html = await C(n.html)), c.trackIdSessionFloor = Math.max(K, A(n.html));
|
|
111
|
+
const V = {
|
|
112
|
+
preselectedDynamicContentList: F,
|
|
107
113
|
onReady: () => {
|
|
108
|
-
console.debug("guido:ready"),
|
|
114
|
+
console.debug("guido:ready"), r("ready");
|
|
109
115
|
}
|
|
110
116
|
};
|
|
111
|
-
await E(
|
|
117
|
+
await E(n, p(), V), u.selectedDynamicContentList = F;
|
|
112
118
|
} catch (e) {
|
|
113
119
|
console.error("Failed to initialize Stripo editor:", e);
|
|
114
120
|
}
|
|
115
121
|
};
|
|
116
|
-
return
|
|
122
|
+
return J(async () => {
|
|
117
123
|
var e;
|
|
118
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
124
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), re().$reset(), P().$reset(), ve().$reset(), y();
|
|
119
125
|
const t = (e = l.value) == null ? void 0 : e.parentElement;
|
|
120
|
-
if (t && (
|
|
126
|
+
if (t && (i = new ResizeObserver(y), i.observe(t)), w(), a.ready)
|
|
121
127
|
await v();
|
|
122
128
|
else {
|
|
123
|
-
const s =
|
|
124
|
-
|
|
129
|
+
const s = U(() => a.ready, (d) => {
|
|
130
|
+
d && (s(), v());
|
|
125
131
|
});
|
|
126
132
|
}
|
|
127
133
|
document.addEventListener("dynamic-content:open", f);
|
|
128
|
-
}),
|
|
129
|
-
|
|
134
|
+
}), Q(() => {
|
|
135
|
+
i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", f);
|
|
130
136
|
try {
|
|
131
137
|
window.UIEditor.removeEditor();
|
|
132
138
|
} catch {
|
|
133
139
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
134
140
|
}
|
|
135
141
|
o.reset();
|
|
136
|
-
}),
|
|
142
|
+
}), x({
|
|
137
143
|
dynamicContent: {
|
|
138
|
-
insert:
|
|
139
|
-
close:
|
|
144
|
+
insert: T,
|
|
145
|
+
close: I
|
|
140
146
|
},
|
|
141
147
|
hasChanges: m,
|
|
142
148
|
saveSilent: h,
|
|
143
149
|
setLoading: b
|
|
144
|
-
}), { __sfc: !0, PreviewContainer:
|
|
150
|
+
}), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: H, headerWrapperRef: S, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: g, props: a, configStore: o, editorStore: c, previewStore: $, hasChanges: m, isTestPartner: z, saveSilent: h, setLoading: b, emit: r, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: k, cloneTimersOnSave: C, hasTimerBlocks: D, noHeader: q, insertDynamicContent: T, closeDynamicContent: I, handleDynamicContentOpen: f, ribbonObserver: i, updateRibbonOffset: y, startEditor: v, AutoSaveController: se, Toaster: ae, FilterSelectionDrawer: ie, HeaderWrapper: ce, LoadingWrapper: de, SaveAsTemplateDrawer: me, UnsubscribeWrapper: le };
|
|
145
151
|
}
|
|
146
152
|
});
|
|
147
153
|
export {
|
|
148
|
-
|
|
154
|
+
ze as default
|
|
149
155
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
1
|
+
import { filterAmpErrors as T } from "../utils/ampErrorFilter.js";
|
|
2
2
|
import { useToaster as A } from "./useToaster.js";
|
|
3
|
-
const D = () => {
|
|
4
|
-
const { handleError: n } = A(),
|
|
3
|
+
const p = 1e4, D = () => {
|
|
4
|
+
const { handleError: n } = A(), m = (t = {}) => new Promise((e, a) => {
|
|
5
5
|
const o = { ...{
|
|
6
6
|
minimize: !0,
|
|
7
7
|
utmEntity: {
|
|
@@ -21,28 +21,28 @@ const D = () => {
|
|
|
21
21
|
forceAmp: !1,
|
|
22
22
|
resetDataSavedFlag: !1,
|
|
23
23
|
disableLineHeightsReplace: !0
|
|
24
|
-
}, ...t },
|
|
25
|
-
callback: (r,
|
|
24
|
+
}, ...t }, s = {
|
|
25
|
+
callback: (r, d, c, u, w) => {
|
|
26
26
|
r ? a(r) : e({
|
|
27
|
-
html:
|
|
28
|
-
ampHtml:
|
|
29
|
-
ampErrors:
|
|
30
|
-
displayConditions:
|
|
27
|
+
html: d,
|
|
28
|
+
ampHtml: c,
|
|
29
|
+
ampErrors: T(u ?? []),
|
|
30
|
+
displayConditions: w
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
33
|
...o
|
|
34
34
|
};
|
|
35
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
35
|
+
window.StripoEditorApi.actionsApi.compileEmail(s);
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
|
-
getCompiledEmail:
|
|
38
|
+
getCompiledEmail: m,
|
|
39
39
|
getTemplateData: () => new Promise((t) => {
|
|
40
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
40
|
+
const e = ({ html: a, css: i, width: o, height: l, utmParams: s, syncModulesIds: r }) => t({
|
|
41
41
|
html: a,
|
|
42
42
|
css: i,
|
|
43
43
|
width: o,
|
|
44
|
-
height:
|
|
45
|
-
utmParams:
|
|
44
|
+
height: l,
|
|
45
|
+
utmParams: s,
|
|
46
46
|
syncModulesIds: r
|
|
47
47
|
});
|
|
48
48
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
@@ -57,7 +57,7 @@ const D = () => {
|
|
|
57
57
|
displayConditions: a,
|
|
58
58
|
ampHtml: i = "",
|
|
59
59
|
ampErrors: o = []
|
|
60
|
-
} = await
|
|
60
|
+
} = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
61
61
|
return {
|
|
62
62
|
html: e,
|
|
63
63
|
ampHtml: i,
|
|
@@ -87,9 +87,15 @@ const D = () => {
|
|
|
87
87
|
n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
88
88
|
}
|
|
89
89
|
}),
|
|
90
|
-
updateHtmlAndCss: (t, e) => {
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
updateHtmlAndCss: (t, e) => new Promise((a, i) => {
|
|
91
|
+
const o = setTimeout(
|
|
92
|
+
() => i(new Error(`updateHtmlAndCss did not report completion within ${p}ms`)),
|
|
93
|
+
p
|
|
94
|
+
);
|
|
95
|
+
window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e, () => {
|
|
96
|
+
clearTimeout(o), a();
|
|
97
|
+
});
|
|
98
|
+
}),
|
|
93
99
|
editorSave: () => new Promise((t) => {
|
|
94
100
|
window.StripoEditorApi.actionsApi.save((e) => {
|
|
95
101
|
if (e) {
|
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
4
|
-
import { ToasterTypeOptions as
|
|
5
|
-
import { ref as
|
|
6
|
-
const E = 250, s =
|
|
7
|
-
const { updateHtmlAndCss: l } =
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useToaster as y } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as v } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as i } from "../enums/toaster.js";
|
|
5
|
+
import { ref as h } from "vue";
|
|
6
|
+
const E = 250, s = h({}), o = {}, k = () => {
|
|
7
|
+
const { updateHtmlAndCss: l } = f(), { showToaster: r } = y(), u = v(), T = (e) => {
|
|
8
8
|
s.value[e] === void 0 && (s.value = { ...s.value, [e]: "pending" });
|
|
9
|
-
}, c = (e, t
|
|
9
|
+
}, c = (e, t) => {
|
|
10
|
+
s.value = { ...s.value, [e]: "failed" }, r({
|
|
11
|
+
type: i.Error,
|
|
12
|
+
message: t instanceof Error ? t.message : "Failed to apply template"
|
|
13
|
+
});
|
|
14
|
+
}, m = (e, t, p) => {
|
|
10
15
|
s.value = { ...s.value, [e]: "applying" };
|
|
11
16
|
try {
|
|
12
|
-
l(t,
|
|
13
|
-
type:
|
|
14
|
-
message:
|
|
17
|
+
l(t, p).catch((a) => c(e, a)), s.value = { ...s.value, [e]: "applied" }, r({
|
|
18
|
+
type: i.Success,
|
|
19
|
+
message: u("newsletter.ai-template-applied")
|
|
15
20
|
});
|
|
16
21
|
} catch (a) {
|
|
17
|
-
|
|
18
|
-
type: n.Error,
|
|
19
|
-
message: a instanceof Error ? a.message : "Failed to apply template"
|
|
20
|
-
});
|
|
22
|
+
c(e, a);
|
|
21
23
|
}
|
|
22
|
-
},
|
|
24
|
+
}, n = (e) => {
|
|
23
25
|
const t = o[e];
|
|
24
26
|
t && (clearTimeout(t), delete o[e]);
|
|
25
27
|
};
|
|
26
|
-
return { applyStatus: s, markPending:
|
|
27
|
-
t.html && (
|
|
28
|
+
return { applyStatus: s, markPending: T, applyTemplate: (e, t) => {
|
|
29
|
+
t.html && (n(e), m(e, t.html, t.css ?? ""));
|
|
28
30
|
}, applyTemplateDebounced: (e, t) => {
|
|
29
31
|
if (!t.html)
|
|
30
32
|
return;
|
|
31
|
-
|
|
32
|
-
const { html:
|
|
33
|
+
n(e);
|
|
34
|
+
const { html: p } = t, a = t.css ?? "";
|
|
33
35
|
o[e] = setTimeout(() => {
|
|
34
|
-
delete o[e],
|
|
36
|
+
delete o[e], m(e, p, a);
|
|
35
37
|
}, E);
|
|
36
38
|
} };
|
|
37
|
-
},
|
|
39
|
+
}, w = () => {
|
|
38
40
|
Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
|
|
39
41
|
};
|
|
40
42
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
w as resetEmailTemplateApplier,
|
|
44
|
+
k as useEmailTemplateApplier
|
|
43
45
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import "../@types/config/schemas.js";
|
|
2
|
+
import { DEFAULT_EDITOR } from "../@types/config/defaults.js";
|
|
1
3
|
import memoize from "../node_modules/lodash-es/memoize.js";
|
|
2
4
|
import { ref } from "vue";
|
|
3
5
|
import { useConfig } from "./useConfig.js";
|
|
4
6
|
const useTranslations = () => {
|
|
5
7
|
var o, e;
|
|
6
|
-
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) ||
|
|
7
|
-
const r = translations.value[
|
|
8
|
-
return r ?
|
|
8
|
+
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
+
const r = translations.value[t];
|
|
10
|
+
return r ? n ? Object.entries(n).reduce(
|
|
9
11
|
(s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
|
|
10
12
|
r
|
|
11
|
-
) : r : (console.warn(`Translation key not found: ${
|
|
13
|
+
) : r : (console.warn(`Translation key not found: ${t}`), t);
|
|
12
14
|
};
|
|
13
15
|
return memoize(
|
|
14
16
|
trans,
|
|
15
|
-
(
|
|
17
|
+
(t, n) => !n || Object.keys(n).length === 0 ? t : JSON.stringify({ key: t, params: n })
|
|
16
18
|
);
|
|
17
19
|
};
|
|
18
20
|
export {
|