@useinsider/guido 3.11.0-beta.6341fe2 → 3.11.0-beta.735d590
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 +105 -84
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/HeaderWrapper.vue.js +3 -3
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +2 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.js +1 -1
- package/dist/composables/useModuleDynamicContentRepair.js +37 -0
- package/dist/composables/useStripo.js +70 -67
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +148 -112
- package/dist/src/@types/config/schemas.d.ts +32 -0
- package/dist/src/@types/generic.d.ts +18 -0
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +18 -0
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/config.d.ts +54 -0
- package/dist/src/utils/dynamicContentConverter.d.ts +27 -0
- package/dist/src/utils/genericUtil.d.ts +16 -1
- package/dist/utils/dynamicContentConverter.js +31 -0
- package/dist/utils/genericUtil.js +40 -19
- package/package.json +5 -1
- package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleFolderDefaults as
|
|
2
|
-
import { object as a, number 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 l, pipe as p, minLength as b, custom as f, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as h, 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,12 +25,12 @@ 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") */
|
|
32
32
|
family: t()
|
|
33
|
-
}),
|
|
33
|
+
}), L = a({
|
|
34
34
|
/** Partner/organization name (required) */
|
|
35
35
|
name: p(
|
|
36
36
|
t(),
|
|
@@ -53,8 +53,8 @@ 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(
|
|
57
|
-
}),
|
|
56
|
+
fallbackFont: e(I)
|
|
57
|
+
}), v = a({
|
|
58
58
|
/** Display text for the dynamic content */
|
|
59
59
|
text: t(),
|
|
60
60
|
/** Template variable value (e.g., {{username}}) */
|
|
@@ -68,35 +68,46 @@ const d = {
|
|
|
68
68
|
value: t()
|
|
69
69
|
})
|
|
70
70
|
)
|
|
71
|
-
}),
|
|
71
|
+
}), S = T(() => g({
|
|
72
|
+
text: e(t()),
|
|
73
|
+
// eslint-disable-next-line camelcase -- backend field name
|
|
74
|
+
tag_text: e(t()),
|
|
75
|
+
value: e(t()),
|
|
76
|
+
children: e(c(S)),
|
|
77
|
+
// eslint-disable-next-line camelcase -- backend field name
|
|
78
|
+
select_items: e(c(S))
|
|
79
|
+
})), P = k(
|
|
80
|
+
t(),
|
|
81
|
+
C(c(S), [])
|
|
82
|
+
), D = g({
|
|
72
83
|
/** Block ID (matches the dictionary key and the legacy HTML element id) */
|
|
73
|
-
id: e(
|
|
84
|
+
id: e(n()),
|
|
74
85
|
/** Decimal places for price display (legacy data may use string or number) */
|
|
75
|
-
decimalCount: e(
|
|
86
|
+
decimalCount: e(h([t(), n()])),
|
|
76
87
|
/** Pinned product IDs (empty array when filter-driven) */
|
|
77
|
-
productIds: e(c(
|
|
88
|
+
productIds: e(c(s())),
|
|
78
89
|
/** Whether the block requested live products at send time */
|
|
79
90
|
sendProductRequestFlag: e(o()),
|
|
80
91
|
/** Whether to randomize product order */
|
|
81
92
|
shuffleProducts: e(o()),
|
|
82
93
|
/** Filter rules driving product selection */
|
|
83
|
-
filters: e(c(
|
|
94
|
+
filters: e(c(s())),
|
|
84
95
|
/** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
|
|
85
96
|
currency: e(t()),
|
|
86
97
|
/** Currency display settings (separators, alignment, decimals) */
|
|
87
|
-
currencySettings: e(
|
|
98
|
+
currencySettings: e(s()),
|
|
88
99
|
/** Locale (e.g. 'nl_NL') */
|
|
89
100
|
language: e(t()),
|
|
90
101
|
/** Recommendation strategy key (e.g. 'newArrivals') */
|
|
91
102
|
strategy: e(t()),
|
|
92
103
|
/** Snapshot of products as rendered by the legacy block */
|
|
93
|
-
recommendedProducts: e(c(
|
|
104
|
+
recommendedProducts: e(c(s())),
|
|
94
105
|
/** Number of product cards per row */
|
|
95
|
-
cardsInRow: e(
|
|
106
|
+
cardsInRow: e(n()),
|
|
96
107
|
/** Mobile-only padding (right) */
|
|
97
|
-
mobileRightPadding: e(
|
|
108
|
+
mobileRightPadding: e(n()),
|
|
98
109
|
/** Mobile-only padding (left) */
|
|
99
|
-
mobileLeftPadding: e(
|
|
110
|
+
mobileLeftPadding: e(n()),
|
|
100
111
|
/** Disable responsive scaling */
|
|
101
112
|
unresponsive: e(o()),
|
|
102
113
|
/** Layout orientation ('vertical' | 'horizontal') */
|
|
@@ -106,14 +117,14 @@ const d = {
|
|
|
106
117
|
/** Block type marker used by some legacy variants */
|
|
107
118
|
blockType: e(t()),
|
|
108
119
|
/** Size variant marker (legacy data may use string or number) */
|
|
109
|
-
size: e(
|
|
120
|
+
size: e(h([t(), n()])),
|
|
110
121
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
111
122
|
verticalResponsiveness: e(o()),
|
|
112
123
|
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
113
124
|
isPriceMovedToNextLine: e(o()),
|
|
114
125
|
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
115
126
|
isPriceDeletedForZeroSale: e(o())
|
|
116
|
-
}),
|
|
127
|
+
}), E = a({
|
|
117
128
|
/**
|
|
118
129
|
* Legacy recommendation block configs keyed by block ID.
|
|
119
130
|
* Pass this when loading a template authored with the v1
|
|
@@ -121,51 +132,59 @@ const d = {
|
|
|
121
132
|
* strategy, currency, locale, and layout data.
|
|
122
133
|
*/
|
|
123
134
|
recommendationConfigs: e(
|
|
124
|
-
k(t(),
|
|
135
|
+
k(t(), D),
|
|
125
136
|
{}
|
|
126
137
|
)
|
|
127
|
-
}),
|
|
138
|
+
}), M = a({
|
|
128
139
|
/** Initial HTML content */
|
|
129
140
|
html: e(t(), ""),
|
|
130
141
|
/** Initial CSS content */
|
|
131
142
|
css: e(t(), ""),
|
|
132
143
|
/** Preselected dynamic content items */
|
|
133
144
|
preselectedDynamicContent: e(
|
|
134
|
-
c(
|
|
145
|
+
c(v),
|
|
135
146
|
[]
|
|
136
147
|
),
|
|
148
|
+
/**
|
|
149
|
+
* Partner-keyed set of dynamic-content items the account offers, e.g.
|
|
150
|
+
* `{ [partnerName]: [{ text, value, children }] }`. Guido flattens it
|
|
151
|
+
* (union across partners, leaf attributes only) into the label→token map
|
|
152
|
+
* that repairs label-form placeholders (`{{ Phone Number }}`) in dropped
|
|
153
|
+
* saved modules.
|
|
154
|
+
*/
|
|
155
|
+
dynamicContentList: e(P, {}),
|
|
137
156
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
138
157
|
customFieldAttributes: e(c(t()), []),
|
|
139
158
|
/** Selected unsubscribe page IDs */
|
|
140
|
-
selectedUnsubscribePages: e(c(
|
|
159
|
+
selectedUnsubscribePages: e(c(n()), []),
|
|
141
160
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
142
161
|
forceRecreate: e(o(), !1),
|
|
143
162
|
/** Migration-only inputs (legacy block configs) */
|
|
144
|
-
migration: e(
|
|
145
|
-
}),
|
|
163
|
+
migration: e(E, {})
|
|
164
|
+
}), N = a({
|
|
146
165
|
/** Sender display name */
|
|
147
166
|
senderName: e(t(), ""),
|
|
148
167
|
/** Email subject line */
|
|
149
168
|
subject: e(t(), "")
|
|
150
|
-
}),
|
|
169
|
+
}), O = a({
|
|
151
170
|
/** Locale for the editor UI */
|
|
152
171
|
locale: e(t(), "en"),
|
|
153
172
|
/** Path to translations object */
|
|
154
173
|
translationsPath: e(t(), "window.trans[Object.keys(window.trans)[0]]"),
|
|
155
174
|
/** Migration date for template compatibility */
|
|
156
|
-
migrationDate: e(
|
|
175
|
+
migrationDate: e(n(), 1759696858),
|
|
157
176
|
/** Email header settings */
|
|
158
|
-
emailHeader: e(
|
|
177
|
+
emailHeader: e(N, { senderName: "", subject: "" }),
|
|
159
178
|
/** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
|
|
160
|
-
savedModulesFolderName: e(t(),
|
|
179
|
+
savedModulesFolderName: e(t(), y.SAVED_MODULES),
|
|
161
180
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
162
|
-
defaultModulesFolderName: e(t(),
|
|
163
|
-
}),
|
|
181
|
+
defaultModulesFolderName: e(t(), y.DEFAULT_MODULES)
|
|
182
|
+
}), x = a({
|
|
164
183
|
/** Whether to show the header bar */
|
|
165
184
|
showHeader: e(o(), !0),
|
|
166
185
|
/** Custom label for back button (if shown) */
|
|
167
186
|
backButtonLabel: e(t())
|
|
168
|
-
}),
|
|
187
|
+
}), F = a({
|
|
169
188
|
/** Enable dynamic content insertion */
|
|
170
189
|
dynamicContent: e(o(), !0),
|
|
171
190
|
/** Enable save as template functionality */
|
|
@@ -184,7 +203,7 @@ const d = {
|
|
|
184
203
|
liquidSyntax: e(o(), !1),
|
|
185
204
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
186
205
|
autosave: e(o(), !1)
|
|
187
|
-
}),
|
|
206
|
+
}), U = l([
|
|
188
207
|
"amp-accordion",
|
|
189
208
|
"amp-carousel",
|
|
190
209
|
"amp-form-controls",
|
|
@@ -198,7 +217,7 @@ const d = {
|
|
|
198
217
|
"text-block",
|
|
199
218
|
"timer-block",
|
|
200
219
|
"video-block"
|
|
201
|
-
]),
|
|
220
|
+
]), B = l([
|
|
202
221
|
"dynamic-content",
|
|
203
222
|
"checkbox-block",
|
|
204
223
|
"radio-button-block",
|
|
@@ -206,15 +225,15 @@ const d = {
|
|
|
206
225
|
"unsubscribe-block",
|
|
207
226
|
"coupon-block",
|
|
208
227
|
"items-block"
|
|
209
|
-
]),
|
|
228
|
+
]), w = a({
|
|
210
229
|
/** Default blocks to exclude from the editor */
|
|
211
230
|
excludeDefaults: e(
|
|
212
|
-
c(
|
|
231
|
+
c(U),
|
|
213
232
|
[]
|
|
214
233
|
),
|
|
215
234
|
/** Custom blocks to include in the editor */
|
|
216
235
|
includeCustoms: e(
|
|
217
|
-
c(
|
|
236
|
+
c(B),
|
|
218
237
|
[]
|
|
219
238
|
)
|
|
220
239
|
}), m = a({
|
|
@@ -223,8 +242,8 @@ const d = {
|
|
|
223
242
|
/** Human-readable description */
|
|
224
243
|
description: e(t()),
|
|
225
244
|
/** Priority for rule ordering (lower = earlier) */
|
|
226
|
-
priority:
|
|
227
|
-
}),
|
|
245
|
+
priority: n()
|
|
246
|
+
}), H = a({
|
|
228
247
|
...m.entries,
|
|
229
248
|
type: i("replace"),
|
|
230
249
|
/** String to search for */
|
|
@@ -233,7 +252,7 @@ const d = {
|
|
|
233
252
|
replacement: t(),
|
|
234
253
|
/** Replace all occurrences (default: false) */
|
|
235
254
|
replaceAll: e(o())
|
|
236
|
-
}),
|
|
255
|
+
}), _ = a({
|
|
237
256
|
...m.entries,
|
|
238
257
|
type: i("regex"),
|
|
239
258
|
/** Regex pattern string */
|
|
@@ -242,85 +261,87 @@ const d = {
|
|
|
242
261
|
replacement: t(),
|
|
243
262
|
/** Regex flags (e.g., 'gi') */
|
|
244
263
|
flags: e(t())
|
|
245
|
-
}),
|
|
264
|
+
}), j = a({
|
|
246
265
|
...m.entries,
|
|
247
266
|
type: i("remove"),
|
|
248
267
|
/** Strings or patterns to remove */
|
|
249
268
|
targets: c(t())
|
|
250
|
-
}),
|
|
269
|
+
}), q = a({
|
|
251
270
|
...m.entries,
|
|
252
271
|
type: i("custom"),
|
|
253
272
|
/** Custom processor function */
|
|
254
|
-
processor:
|
|
273
|
+
processor: f(
|
|
255
274
|
(u) => typeof u == "function",
|
|
256
275
|
"processor must be a function"
|
|
257
276
|
)
|
|
258
|
-
}),
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
]),
|
|
277
|
+
}), G = R("type", [
|
|
278
|
+
H,
|
|
279
|
+
_,
|
|
280
|
+
j,
|
|
281
|
+
q
|
|
282
|
+
]), V = a({
|
|
264
283
|
/** Custom compiler rules to apply */
|
|
265
|
-
customRules: e(c(
|
|
284
|
+
customRules: e(c(G), []),
|
|
266
285
|
/** Skip default compiler rules */
|
|
267
286
|
ignoreDefaultRules: e(o(), !1)
|
|
268
|
-
}),
|
|
287
|
+
}), z = a({
|
|
269
288
|
/**
|
|
270
289
|
* External validation handler called before save completes.
|
|
271
290
|
* Return false to cancel the save operation.
|
|
272
291
|
*/
|
|
273
292
|
externalValidation: e(
|
|
274
|
-
|
|
293
|
+
f(
|
|
275
294
|
(u) => typeof u == "function",
|
|
276
295
|
"externalValidation must be a function"
|
|
277
296
|
)
|
|
278
297
|
)
|
|
279
|
-
}),
|
|
298
|
+
}), K = a({
|
|
280
299
|
// Required sections
|
|
281
300
|
/** Identity configuration (required) */
|
|
282
|
-
identity:
|
|
301
|
+
identity: A,
|
|
283
302
|
/** Partner configuration (required) */
|
|
284
|
-
partner:
|
|
303
|
+
partner: L,
|
|
285
304
|
// Optional sections (with defaults)
|
|
286
305
|
/** Template content and presets */
|
|
287
|
-
template: e(
|
|
306
|
+
template: e(M, {}),
|
|
288
307
|
/** Editor settings */
|
|
289
|
-
editor: e(
|
|
308
|
+
editor: e(O, {}),
|
|
290
309
|
/** UI configuration */
|
|
291
|
-
ui: e(
|
|
310
|
+
ui: e(x, {}),
|
|
292
311
|
/** Feature toggles */
|
|
293
|
-
features: e(
|
|
312
|
+
features: e(F, {}),
|
|
294
313
|
/** Block configuration */
|
|
295
|
-
blocks: e(
|
|
314
|
+
blocks: e(w, {}),
|
|
296
315
|
/** Compiler configuration */
|
|
297
|
-
compiler: e(
|
|
316
|
+
compiler: e(V, {}),
|
|
298
317
|
/** Callbacks and event handlers */
|
|
299
|
-
callbacks: e(
|
|
318
|
+
callbacks: e(z, {})
|
|
300
319
|
});
|
|
301
320
|
export {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
v as
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
321
|
+
w as BlocksSchema,
|
|
322
|
+
z as CallbacksSchema,
|
|
323
|
+
G as CompilerRuleSchema,
|
|
324
|
+
V as CompilerSchema,
|
|
325
|
+
B as CustomBlockTypeSchema,
|
|
326
|
+
q as CustomRuleSchema,
|
|
327
|
+
U as DefaultBlockTypeSchema,
|
|
328
|
+
P as DynamicContentListSchema,
|
|
329
|
+
S as DynamicContentNodeSchema,
|
|
330
|
+
v as DynamicContentSchema,
|
|
331
|
+
O as EditorSchema,
|
|
332
|
+
N as EmailHeaderSchema,
|
|
333
|
+
I as FallbackFontSchema,
|
|
334
|
+
F as FeaturesSchema,
|
|
335
|
+
K as GuidoConfigSchema,
|
|
336
|
+
A as IdentitySchema,
|
|
337
|
+
D as LegacyRecommendationConfigSchema,
|
|
317
338
|
d as MessageType,
|
|
318
|
-
|
|
339
|
+
L as PartnerSchema,
|
|
319
340
|
r as ProductType,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
341
|
+
_ as RegexRuleSchema,
|
|
342
|
+
j as RemoveRuleSchema,
|
|
343
|
+
H as ReplaceRuleSchema,
|
|
344
|
+
E as TemplateMigrationSchema,
|
|
345
|
+
M as TemplateSchema,
|
|
346
|
+
x as UISchema
|
|
326
347
|
};
|
|
@@ -8,6 +8,8 @@ const c = /* @__PURE__ */ n({
|
|
|
8
8
|
setup(l, { expose: r }) {
|
|
9
9
|
const e = m(null);
|
|
10
10
|
return r({
|
|
11
|
+
// Stryker disable next-line OptionalChaining: RightSlot is always rendered (no
|
|
12
|
+
// v-if), so rightSlotRef.value is never null and `?.` cannot short-circuit.
|
|
11
13
|
handleSave: (t) => {
|
|
12
14
|
var o;
|
|
13
15
|
return (o = e.value) == null ? void 0 : o.handleSave(t);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useConfig as C } from "./useConfig.js";
|
|
2
|
+
import { useToaster as D } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as T } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
|
+
import { buildDynamicContentLookup as h, convertModuleDynamicContent as O } from "../utils/dynamicContentConverter.js";
|
|
6
|
+
import { flattenDynamicContentList as f } from "../utils/genericUtil.js";
|
|
7
|
+
const M = "dynamic-content.unresolved-attributes-on-drop", b = () => {
|
|
8
|
+
const { template: i, isFeatureEnabled: p } = C(), { showToaster: m } = D(), a = T();
|
|
9
|
+
return { handleModuleAdd: (n, o) => {
|
|
10
|
+
var s, c, l;
|
|
11
|
+
try {
|
|
12
|
+
if ((n == null ? void 0 : n.action) !== "ADD" && (n == null ? void 0 : n.action) !== "COPY")
|
|
13
|
+
return;
|
|
14
|
+
const e = h(f((s = i.value) == null ? void 0 : s.dynamicContentList));
|
|
15
|
+
if (e.size === 0)
|
|
16
|
+
return;
|
|
17
|
+
const t = (c = o == null ? void 0 : o.getTargetNode) == null ? void 0 : c.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
|
|
18
|
+
if (!t || typeof r != "string")
|
|
19
|
+
return;
|
|
20
|
+
const { html: u, unresolved: y } = O(
|
|
21
|
+
r,
|
|
22
|
+
e,
|
|
23
|
+
p("liquidSyntax")
|
|
24
|
+
);
|
|
25
|
+
u !== r && o.modifyHtml(t).replaceWith(u), y.length > 0 && m({
|
|
26
|
+
type: g.Warning,
|
|
27
|
+
message: a(M)
|
|
28
|
+
});
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error("Failed to repair dynamic content on module add:", e);
|
|
31
|
+
}
|
|
32
|
+
} };
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
M as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
36
|
+
b as useModuleDynamicContentRepair
|
|
37
|
+
};
|
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as O } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as q } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as L } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useModuleDynamicContentRepair as N } from "./useModuleDynamicContentRepair.js";
|
|
7
|
+
import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
|
|
8
|
+
import { useStripoNotifications as $ } from "./useStripoNotifications.js";
|
|
9
|
+
import { useToaster as G } from "./useToaster.js";
|
|
10
|
+
import { localePatch as J } from "../config/i18n/index.js";
|
|
11
|
+
import { en as E } from "../config/i18n/en/index.js";
|
|
12
|
+
import { ToasterTypeOptions as X } from "../enums/toaster.js";
|
|
13
|
+
import { useStripoApi as j } from "../services/stripoApi.js";
|
|
14
|
+
import K from "../static/styles/customEditorStyle.css.js";
|
|
15
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
16
|
+
import { buildMergeTagEntries as Q, flattenDynamicContentList as W } from "../utils/genericUtil.js";
|
|
17
|
+
import Y from "../package.json.js";
|
|
18
|
+
const he = (b, l) => {
|
|
19
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: T, getCustomFonts: v, getSyncModulesStatus: B } = j(), { handleEvent: F } = z(), { handleModuleAdd: M } = N(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), _ = async (n, i = [], r = !1) => {
|
|
20
|
+
var S, y, h, C;
|
|
21
|
+
const e = w(), { html: f, css: a } = n, { baseBlocks: o, extensions: d } = await A(), g = ((S = c.value) == null ? void 0 : S.displayConditions) ?? !0, P = ((y = c.value) == null ? void 0 : y.modulesDisabled) ?? !1, I = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
|
|
21
22
|
await window.UIEditor.initEditor(
|
|
22
23
|
document.querySelector("#guido-editor"),
|
|
23
24
|
{
|
|
24
|
-
metadata:
|
|
25
|
-
html:
|
|
25
|
+
metadata: b,
|
|
26
|
+
html: f,
|
|
26
27
|
css: a,
|
|
27
|
-
forceRecreate:
|
|
28
|
+
forceRecreate: I,
|
|
28
29
|
locale: "en",
|
|
29
30
|
undoButtonSelector: "#guido__undo-button",
|
|
30
31
|
redoButtonSelector: "#guido__redo-button",
|
|
31
32
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
32
33
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
33
34
|
codeEditorButtonSelector: "#guido__code-button",
|
|
34
|
-
customAppearanceMergetags: !
|
|
35
|
+
customAppearanceMergetags: !m("liquidSyntax"),
|
|
35
36
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
36
37
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
37
|
-
customViewStyles:
|
|
38
|
-
conditionsEnabled:
|
|
39
|
-
customConditionsEnabled:
|
|
38
|
+
customViewStyles: K,
|
|
39
|
+
conditionsEnabled: g,
|
|
40
|
+
customConditionsEnabled: g,
|
|
40
41
|
enableXSSSecurity: !0,
|
|
41
|
-
modulesDisabled:
|
|
42
|
+
modulesDisabled: P,
|
|
42
43
|
syncModulesEnabled: r,
|
|
43
44
|
messageSettingsEnabled: !0,
|
|
44
45
|
displayGmailAnnotations: !0,
|
|
@@ -48,7 +49,7 @@ const fo = (C, l) => {
|
|
|
48
49
|
selectElementAfterDrop: !0,
|
|
49
50
|
sameFontSizeForOutlook: !0,
|
|
50
51
|
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
51
|
-
...
|
|
52
|
+
...o ? { baseBlocks: o } : {},
|
|
52
53
|
editorFonts: {
|
|
53
54
|
showDefaultStandardFonts: !0,
|
|
54
55
|
showDefaultNotStandardFonts: !0,
|
|
@@ -56,43 +57,45 @@ const fo = (C, l) => {
|
|
|
56
57
|
},
|
|
57
58
|
mergeTags: [
|
|
58
59
|
{
|
|
59
|
-
entries:
|
|
60
|
+
entries: Q(
|
|
60
61
|
l.preselectedDynamicContentList,
|
|
61
|
-
u
|
|
62
|
+
W((C = u.value) == null ? void 0 : C.dynamicContentList),
|
|
63
|
+
m("liquidSyntax")
|
|
62
64
|
)
|
|
63
65
|
}
|
|
64
66
|
],
|
|
65
|
-
async onTokenRefreshRequest(
|
|
67
|
+
async onTokenRefreshRequest(t) {
|
|
66
68
|
try {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
} catch (
|
|
70
|
-
|
|
69
|
+
const s = await T();
|
|
70
|
+
t(s);
|
|
71
|
+
} catch (s) {
|
|
72
|
+
p(s, "Failed to refresh token");
|
|
71
73
|
}
|
|
72
74
|
},
|
|
73
75
|
onTemplateLoaded() {
|
|
74
76
|
try {
|
|
75
|
-
const { importCss:
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
const { importCss: t } = H(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: R } = x(), { injectFullStory: U } = L();
|
|
78
|
+
t(), s(), U(), R(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
79
|
+
e.hasChanges = !1;
|
|
78
80
|
}, 1e3);
|
|
79
|
-
} catch (
|
|
80
|
-
|
|
81
|
+
} catch (t) {
|
|
82
|
+
p(t, "Failed to load custom interface appearance");
|
|
81
83
|
}
|
|
82
84
|
},
|
|
83
|
-
onCodeEditorVisibilityChanged(
|
|
84
|
-
|
|
85
|
+
onCodeEditorVisibilityChanged(t) {
|
|
86
|
+
e.isCodeEditorOpen = t;
|
|
85
87
|
},
|
|
86
|
-
onEditorVisualModeChanged(
|
|
87
|
-
|
|
88
|
+
onEditorVisualModeChanged(t) {
|
|
89
|
+
e.editorVisualMode = t.toLowerCase();
|
|
88
90
|
},
|
|
89
|
-
onVersionHistoryVisibilityChanged(
|
|
90
|
-
|
|
91
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
92
|
+
e.isVersionHistoryOpen = t;
|
|
91
93
|
},
|
|
92
94
|
onDataChanged() {
|
|
93
|
-
|
|
95
|
+
e.hasChanges = !0;
|
|
94
96
|
},
|
|
95
97
|
onEvent: F,
|
|
98
|
+
onModuleAdd: M,
|
|
96
99
|
notifications: V(),
|
|
97
100
|
ignoreClickOutsideSelectors: [
|
|
98
101
|
"#guido-dynamic-content-modal",
|
|
@@ -100,38 +103,38 @@ const fo = (C, l) => {
|
|
|
100
103
|
".in-drawer__container"
|
|
101
104
|
],
|
|
102
105
|
extensions: d,
|
|
103
|
-
localePatch:
|
|
106
|
+
localePatch: J
|
|
104
107
|
}
|
|
105
108
|
);
|
|
106
|
-
},
|
|
109
|
+
}, D = (n) => new Promise((i, r) => {
|
|
107
110
|
var d;
|
|
108
111
|
if (document.getElementById("UiEditorScript")) {
|
|
109
|
-
Promise.resolve(
|
|
112
|
+
Promise.resolve(n()).then(i, r);
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
Promise.resolve(
|
|
115
|
-
},
|
|
115
|
+
const e = Y.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
116
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
117
|
+
Promise.resolve(n()).then(i, r);
|
|
118
|
+
}, o.onerror = () => {
|
|
116
119
|
r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
117
|
-
}, document.body.appendChild(
|
|
120
|
+
}, document.body.appendChild(o);
|
|
118
121
|
});
|
|
119
|
-
return { initPlugin: async (
|
|
120
|
-
const i =
|
|
122
|
+
return { initPlugin: async (n) => {
|
|
123
|
+
const i = w();
|
|
121
124
|
try {
|
|
122
|
-
await
|
|
123
|
-
const [r,
|
|
124
|
-
|
|
125
|
+
await D(async () => {
|
|
126
|
+
const [r, e] = await Promise.all([
|
|
127
|
+
v(),
|
|
125
128
|
B()
|
|
126
129
|
]);
|
|
127
|
-
i.syncModulesEnabled =
|
|
130
|
+
i.syncModulesEnabled = e, await _(n, r, e);
|
|
128
131
|
});
|
|
129
132
|
} catch {
|
|
130
|
-
i.loadingStatus = !1,
|
|
131
|
-
type:
|
|
132
|
-
message:
|
|
133
|
+
i.loadingStatus = !1, k({
|
|
134
|
+
type: X.Error,
|
|
135
|
+
message: E["An error has occurred. Please report the error code to support."],
|
|
133
136
|
actionButton: {
|
|
134
|
-
text:
|
|
137
|
+
text: E["Reload page"],
|
|
135
138
|
onClick: () => window.location.reload()
|
|
136
139
|
}
|
|
137
140
|
});
|
|
@@ -139,5 +142,5 @@ const fo = (C, l) => {
|
|
|
139
142
|
} };
|
|
140
143
|
};
|
|
141
144
|
export {
|
|
142
|
-
|
|
145
|
+
he as useStripo
|
|
143
146
|
};
|