@useinsider/guido 3.2.0-beta.da93bda → 3.2.0-beta.dc55d68
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 +150 -94
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +88 -87
- package/dist/composables/useRecommendation.js +16 -12
- package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +78 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -290
- package/dist/enums/extensions/recommendationBlock.js +2 -1
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/Recommendation/block.js +35 -32
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +228 -181
- package/dist/extensions/Blocks/Recommendation/services/configService.js +65 -29
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +21 -19
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +213 -0
- package/dist/src/@types/config/types.d.ts +9 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +56 -0
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/stores/config.d.ts +504 -0
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/utils/htmlEscape.js +13 -0
- package/package.json +7 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { ModuleFolderDefaults as
|
|
2
|
-
import { object as o, number as
|
|
3
|
-
const
|
|
1
|
+
import { ModuleFolderDefaults as S } from "../../enums/defaults.js";
|
|
2
|
+
import { object as o, number as n, optional as e, string as t, pipe as p, picklist as l, minLength as b, custom as h, boolean as a, array as c, record as k, looseObject as y, literal as i, variant as g, union as f, unknown as s } from "../../node_modules/valibot/dist/index.js";
|
|
3
|
+
const d = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
6
6
|
/** Transactional/system emails */
|
|
7
7
|
TRANSACTIONAL: 2
|
|
8
|
-
},
|
|
8
|
+
}, r = {
|
|
9
9
|
/** Standard email campaigns */
|
|
10
10
|
EMAIL: 60,
|
|
11
11
|
/** Architect journey builder */
|
|
12
12
|
ARCHITECT: 49,
|
|
13
13
|
/** Unsubscribe page builder */
|
|
14
14
|
UNSUBSCRIBE_PAGES: 97
|
|
15
|
-
},
|
|
15
|
+
}, R = o({
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
|
-
templateId:
|
|
17
|
+
templateId: p(
|
|
18
18
|
t(),
|
|
19
|
-
|
|
19
|
+
b(1, "templateId is required")
|
|
20
20
|
),
|
|
21
21
|
/** Unique identifier for the user editing the template */
|
|
22
|
-
userId:
|
|
22
|
+
userId: p(
|
|
23
23
|
t(),
|
|
24
|
-
|
|
24
|
+
b(1, "userId is required")
|
|
25
25
|
),
|
|
26
26
|
/** Optional variation ID for A/B testing */
|
|
27
27
|
variationId: e(t())
|
|
28
|
-
}),
|
|
28
|
+
}), C = o({
|
|
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
|
+
}), T = o({
|
|
34
34
|
/** Partner/organization name (required) */
|
|
35
|
-
name:
|
|
35
|
+
name: p(
|
|
36
36
|
t(),
|
|
37
|
-
|
|
37
|
+
b(1, "partner.name is required")
|
|
38
38
|
),
|
|
39
39
|
/** Product type identifier */
|
|
40
40
|
productType: e(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
l([
|
|
42
|
+
r.EMAIL,
|
|
43
|
+
r.ARCHITECT,
|
|
44
|
+
r.UNSUBSCRIBE_PAGES
|
|
45
45
|
]),
|
|
46
|
-
|
|
46
|
+
r.EMAIL
|
|
47
47
|
),
|
|
48
48
|
/** Message type (promotional or transactional) */
|
|
49
49
|
messageType: e(
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
l([d.PROMOTIONAL, d.TRANSACTIONAL]),
|
|
51
|
+
d.PROMOTIONAL
|
|
52
52
|
),
|
|
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(C)
|
|
57
57
|
}), A = o({
|
|
58
58
|
/** Display text for the dynamic content */
|
|
59
59
|
text: t(),
|
|
@@ -68,7 +68,59 @@ const m = {
|
|
|
68
68
|
value: t()
|
|
69
69
|
})
|
|
70
70
|
)
|
|
71
|
-
}),
|
|
71
|
+
}), I = y({
|
|
72
|
+
/** Block ID (matches the dictionary key and the legacy HTML element id) */
|
|
73
|
+
id: e(n()),
|
|
74
|
+
/** Decimal places for price display (legacy data may use string or number) */
|
|
75
|
+
decimalCount: e(f([t(), n()])),
|
|
76
|
+
/** Pinned product IDs (empty array when filter-driven) */
|
|
77
|
+
productIds: e(c(s())),
|
|
78
|
+
/** Whether the block requested live products at send time */
|
|
79
|
+
sendProductRequestFlag: e(a()),
|
|
80
|
+
/** Whether to randomize product order */
|
|
81
|
+
shuffleProducts: e(a()),
|
|
82
|
+
/** Filter rules driving product selection */
|
|
83
|
+
filters: e(c(s())),
|
|
84
|
+
/** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
|
|
85
|
+
currency: e(t()),
|
|
86
|
+
/** Currency display settings (separators, alignment, decimals) */
|
|
87
|
+
currencySettings: e(s()),
|
|
88
|
+
/** Locale (e.g. 'nl_NL') */
|
|
89
|
+
language: e(t()),
|
|
90
|
+
/** Recommendation strategy key (e.g. 'newArrivals') */
|
|
91
|
+
strategy: e(t()),
|
|
92
|
+
/** Snapshot of products as rendered by the legacy block */
|
|
93
|
+
recommendedProducts: e(c(s())),
|
|
94
|
+
/** Number of product cards per row */
|
|
95
|
+
cardsInRow: e(n()),
|
|
96
|
+
/** Mobile-only padding (right) */
|
|
97
|
+
mobileRightPadding: e(n()),
|
|
98
|
+
/** Mobile-only padding (left) */
|
|
99
|
+
mobileLeftPadding: e(n()),
|
|
100
|
+
/** Disable responsive scaling */
|
|
101
|
+
unresponsive: e(a()),
|
|
102
|
+
/** Layout orientation ('vertical' | 'horizontal') */
|
|
103
|
+
orientation: e(t()),
|
|
104
|
+
/** Whether long text is trimmed */
|
|
105
|
+
textTrimming: e(a()),
|
|
106
|
+
/** Block type marker used by some legacy variants */
|
|
107
|
+
blockType: e(t()),
|
|
108
|
+
/** Size variant marker (legacy data may use string or number) */
|
|
109
|
+
size: e(f([t(), n()])),
|
|
110
|
+
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
111
|
+
verticalResponsiveness: e(a())
|
|
112
|
+
}), E = o({
|
|
113
|
+
/**
|
|
114
|
+
* Legacy recommendation block configs keyed by block ID.
|
|
115
|
+
* Pass this when loading a template authored with the v1
|
|
116
|
+
* recommendation block so the migrator can preserve filters,
|
|
117
|
+
* strategy, currency, locale, and layout data.
|
|
118
|
+
*/
|
|
119
|
+
recommendationConfigs: e(
|
|
120
|
+
k(t(), I),
|
|
121
|
+
{}
|
|
122
|
+
)
|
|
123
|
+
}), L = o({
|
|
72
124
|
/** Initial HTML content */
|
|
73
125
|
html: e(t(), ""),
|
|
74
126
|
/** Initial CSS content */
|
|
@@ -81,33 +133,35 @@ const m = {
|
|
|
81
133
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
82
134
|
customFieldAttributes: e(c(t()), []),
|
|
83
135
|
/** Selected unsubscribe page IDs */
|
|
84
|
-
selectedUnsubscribePages: e(c(
|
|
136
|
+
selectedUnsubscribePages: e(c(n()), []),
|
|
85
137
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
86
|
-
forceRecreate: e(a(), !1)
|
|
87
|
-
|
|
138
|
+
forceRecreate: e(a(), !1),
|
|
139
|
+
/** Migration-only inputs (legacy block configs) */
|
|
140
|
+
migration: e(E, {})
|
|
141
|
+
}), O = o({
|
|
88
142
|
/** Sender display name */
|
|
89
143
|
senderName: e(t(), ""),
|
|
90
144
|
/** Email subject line */
|
|
91
145
|
subject: e(t(), "")
|
|
92
|
-
}),
|
|
146
|
+
}), M = o({
|
|
93
147
|
/** Locale for the editor UI */
|
|
94
148
|
locale: e(t(), "en"),
|
|
95
149
|
/** Path to translations object */
|
|
96
150
|
translationsPath: e(t(), "window.trans[Object.keys(window.trans)[0]]"),
|
|
97
151
|
/** Migration date for template compatibility */
|
|
98
|
-
migrationDate: e(
|
|
152
|
+
migrationDate: e(n(), 1759696858),
|
|
99
153
|
/** Email header settings */
|
|
100
|
-
emailHeader: e(
|
|
154
|
+
emailHeader: e(O, { senderName: "", subject: "" }),
|
|
101
155
|
/** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
|
|
102
|
-
savedModulesFolderName: e(t(),
|
|
156
|
+
savedModulesFolderName: e(t(), S.SAVED_MODULES),
|
|
103
157
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
104
|
-
defaultModulesFolderName: e(t(),
|
|
105
|
-
}),
|
|
158
|
+
defaultModulesFolderName: e(t(), S.DEFAULT_MODULES)
|
|
159
|
+
}), P = o({
|
|
106
160
|
/** Whether to show the header bar */
|
|
107
161
|
showHeader: e(a(), !0),
|
|
108
162
|
/** Custom label for back button (if shown) */
|
|
109
163
|
backButtonLabel: e(t())
|
|
110
|
-
}),
|
|
164
|
+
}), v = o({
|
|
111
165
|
/** Enable dynamic content insertion */
|
|
112
166
|
dynamicContent: e(a(), !0),
|
|
113
167
|
/** Enable save as template functionality */
|
|
@@ -124,7 +178,7 @@ const m = {
|
|
|
124
178
|
modulesDisabled: e(a(), !1),
|
|
125
179
|
/** Enable Liquid template syntax */
|
|
126
180
|
liquidSyntax: e(a(), !1)
|
|
127
|
-
}),
|
|
181
|
+
}), N = l([
|
|
128
182
|
"amp-accordion",
|
|
129
183
|
"amp-carousel",
|
|
130
184
|
"amp-form-controls",
|
|
@@ -138,7 +192,7 @@ const m = {
|
|
|
138
192
|
"text-block",
|
|
139
193
|
"timer-block",
|
|
140
194
|
"video-block"
|
|
141
|
-
]),
|
|
195
|
+
]), D = l([
|
|
142
196
|
"dynamic-content",
|
|
143
197
|
"checkbox-block",
|
|
144
198
|
"radio-button-block",
|
|
@@ -146,119 +200,121 @@ const m = {
|
|
|
146
200
|
"unsubscribe-block",
|
|
147
201
|
"coupon-block",
|
|
148
202
|
"items-block"
|
|
149
|
-
]),
|
|
203
|
+
]), x = o({
|
|
150
204
|
/** Default blocks to exclude from the editor */
|
|
151
205
|
excludeDefaults: e(
|
|
152
|
-
c(
|
|
206
|
+
c(N),
|
|
153
207
|
[]
|
|
154
208
|
),
|
|
155
209
|
/** Custom blocks to include in the editor */
|
|
156
210
|
includeCustoms: e(
|
|
157
|
-
c(
|
|
211
|
+
c(D),
|
|
158
212
|
[]
|
|
159
213
|
)
|
|
160
|
-
}),
|
|
214
|
+
}), m = o({
|
|
161
215
|
/** Unique identifier for the rule */
|
|
162
216
|
id: t(),
|
|
163
217
|
/** Human-readable description */
|
|
164
218
|
description: e(t()),
|
|
165
219
|
/** Priority for rule ordering (lower = earlier) */
|
|
166
|
-
priority:
|
|
167
|
-
}),
|
|
168
|
-
...
|
|
169
|
-
type:
|
|
220
|
+
priority: n()
|
|
221
|
+
}), F = o({
|
|
222
|
+
...m.entries,
|
|
223
|
+
type: i("replace"),
|
|
170
224
|
/** String to search for */
|
|
171
225
|
search: t(),
|
|
172
226
|
/** Replacement string */
|
|
173
227
|
replacement: t(),
|
|
174
228
|
/** Replace all occurrences (default: false) */
|
|
175
229
|
replaceAll: e(a())
|
|
176
|
-
}),
|
|
177
|
-
...
|
|
178
|
-
type:
|
|
230
|
+
}), U = o({
|
|
231
|
+
...m.entries,
|
|
232
|
+
type: i("regex"),
|
|
179
233
|
/** Regex pattern string */
|
|
180
234
|
pattern: t(),
|
|
181
235
|
/** Replacement string (supports $1, $2, etc.) */
|
|
182
236
|
replacement: t(),
|
|
183
237
|
/** Regex flags (e.g., 'gi') */
|
|
184
238
|
flags: e(t())
|
|
185
|
-
}),
|
|
186
|
-
...
|
|
187
|
-
type:
|
|
239
|
+
}), B = o({
|
|
240
|
+
...m.entries,
|
|
241
|
+
type: i("remove"),
|
|
188
242
|
/** Strings or patterns to remove */
|
|
189
243
|
targets: c(t())
|
|
190
|
-
}),
|
|
191
|
-
...
|
|
192
|
-
type:
|
|
244
|
+
}), w = o({
|
|
245
|
+
...m.entries,
|
|
246
|
+
type: i("custom"),
|
|
193
247
|
/** Custom processor function */
|
|
194
|
-
processor:
|
|
195
|
-
(
|
|
248
|
+
processor: h(
|
|
249
|
+
(u) => typeof u == "function",
|
|
196
250
|
"processor must be a function"
|
|
197
251
|
)
|
|
198
|
-
}),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
]),
|
|
252
|
+
}), H = g("type", [
|
|
253
|
+
F,
|
|
254
|
+
U,
|
|
255
|
+
B,
|
|
256
|
+
w
|
|
257
|
+
]), j = o({
|
|
204
258
|
/** Custom compiler rules to apply */
|
|
205
|
-
customRules: e(c(
|
|
259
|
+
customRules: e(c(H), []),
|
|
206
260
|
/** Skip default compiler rules */
|
|
207
261
|
ignoreDefaultRules: e(a(), !1)
|
|
208
|
-
}),
|
|
262
|
+
}), q = o({
|
|
209
263
|
/**
|
|
210
264
|
* External validation handler called before save completes.
|
|
211
265
|
* Return false to cancel the save operation.
|
|
212
266
|
*/
|
|
213
267
|
externalValidation: e(
|
|
214
|
-
|
|
215
|
-
(
|
|
268
|
+
h(
|
|
269
|
+
(u) => typeof u == "function",
|
|
216
270
|
"externalValidation must be a function"
|
|
217
271
|
)
|
|
218
272
|
)
|
|
219
|
-
}),
|
|
273
|
+
}), V = o({
|
|
220
274
|
// Required sections
|
|
221
275
|
/** Identity configuration (required) */
|
|
222
|
-
identity:
|
|
276
|
+
identity: R,
|
|
223
277
|
/** Partner configuration (required) */
|
|
224
|
-
partner:
|
|
278
|
+
partner: T,
|
|
225
279
|
// Optional sections (with defaults)
|
|
226
280
|
/** Template content and presets */
|
|
227
|
-
template: e(
|
|
281
|
+
template: e(L, {}),
|
|
228
282
|
/** Editor settings */
|
|
229
|
-
editor: e(
|
|
283
|
+
editor: e(M, {}),
|
|
230
284
|
/** UI configuration */
|
|
231
|
-
ui: e(
|
|
285
|
+
ui: e(P, {}),
|
|
232
286
|
/** Feature toggles */
|
|
233
|
-
features: e(
|
|
287
|
+
features: e(v, {}),
|
|
234
288
|
/** Block configuration */
|
|
235
|
-
blocks: e(
|
|
289
|
+
blocks: e(x, {}),
|
|
236
290
|
/** Compiler configuration */
|
|
237
|
-
compiler: e(
|
|
291
|
+
compiler: e(j, {}),
|
|
238
292
|
/** Callbacks and event handlers */
|
|
239
|
-
callbacks: e(
|
|
293
|
+
callbacks: e(q, {})
|
|
240
294
|
});
|
|
241
295
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
296
|
+
x as BlocksSchema,
|
|
297
|
+
q as CallbacksSchema,
|
|
298
|
+
H as CompilerRuleSchema,
|
|
299
|
+
j as CompilerSchema,
|
|
300
|
+
D as CustomBlockTypeSchema,
|
|
301
|
+
w as CustomRuleSchema,
|
|
302
|
+
N as DefaultBlockTypeSchema,
|
|
249
303
|
A as DynamicContentSchema,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
304
|
+
M as EditorSchema,
|
|
305
|
+
O as EmailHeaderSchema,
|
|
306
|
+
C as FallbackFontSchema,
|
|
307
|
+
v as FeaturesSchema,
|
|
308
|
+
V as GuidoConfigSchema,
|
|
309
|
+
R as IdentitySchema,
|
|
310
|
+
I as LegacyRecommendationConfigSchema,
|
|
311
|
+
d as MessageType,
|
|
312
|
+
T as PartnerSchema,
|
|
313
|
+
r as ProductType,
|
|
314
|
+
U as RegexRuleSchema,
|
|
315
|
+
B as RemoveRuleSchema,
|
|
316
|
+
F as ReplaceRuleSchema,
|
|
317
|
+
E as TemplateMigrationSchema,
|
|
318
|
+
L as TemplateSchema,
|
|
319
|
+
P as UISchema
|
|
264
320
|
};
|
|
@@ -1,131 +1,132 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
1
|
+
import { defineComponent as J, defineAsyncComponent as I, ref as W, computed as B, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
|
|
2
|
+
import { provideGuidoActions as Z } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as ee } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as oe } from "../composables/useStripo.js";
|
|
5
5
|
import { useTimerClone as te } from "../composables/useTimerClone.js";
|
|
6
|
-
import { migrate as
|
|
7
|
-
import { ModuleFolderDefaults as
|
|
8
|
-
import { RIBBON_SELECTOR as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { useStripoApi as
|
|
16
|
-
import { useConfigStore as
|
|
17
|
-
import { useDynamicContentStore as
|
|
18
|
-
import { useEditorStore as
|
|
19
|
-
import { usePreviewStore as
|
|
20
|
-
import { useUnsubscribeStore as
|
|
21
|
-
const
|
|
6
|
+
import { migrate as H } from "../config/migrator/index.js";
|
|
7
|
+
import { ModuleFolderDefaults as x } from "../enums/defaults.js";
|
|
8
|
+
import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
|
|
9
|
+
import se from "./organisms/base/Toaster.vue.js";
|
|
10
|
+
import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
11
|
+
import ce from "./organisms/header/HeaderWrapper.vue.js";
|
|
12
|
+
import ae from "./organisms/LoadingWrapper.vue.js";
|
|
13
|
+
import ie from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
14
|
+
import me from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
15
|
+
import { useStripoApi as de } from "../services/stripoApi.js";
|
|
16
|
+
import { useConfigStore as le } from "../stores/config.js";
|
|
17
|
+
import { useDynamicContentStore as ue } from "../stores/dynamic-content.js";
|
|
18
|
+
import { useEditorStore as pe } from "../stores/editor.js";
|
|
19
|
+
import { usePreviewStore as fe } from "../stores/preview.js";
|
|
20
|
+
import { useUnsubscribeStore as ve } from "../stores/unsubscribe.js";
|
|
21
|
+
const Ae = /* @__PURE__ */ J({
|
|
22
22
|
__name: "Guido",
|
|
23
23
|
props: {
|
|
24
24
|
config: null
|
|
25
25
|
},
|
|
26
26
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
27
|
+
setup(G, { expose: z, emit: n }) {
|
|
28
|
+
const g = G, q = I(
|
|
29
29
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
30
|
-
),
|
|
30
|
+
), K = I(
|
|
31
31
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
const
|
|
32
|
+
), w = W(), u = W(), p = ue(), E = ve(), i = le();
|
|
33
|
+
i.init(g.config);
|
|
34
|
+
const f = pe(), V = fe(), m = B(() => f.hasChanges), { isTestPartner: $ } = ee(), D = () => {
|
|
35
35
|
var e;
|
|
36
|
-
return (e =
|
|
36
|
+
return (e = w.value) == null ? void 0 : e.handleSave(!0);
|
|
37
37
|
}, {
|
|
38
|
-
templateId:
|
|
39
|
-
userId:
|
|
40
|
-
partnerName:
|
|
41
|
-
username:
|
|
42
|
-
template:
|
|
38
|
+
templateId: v,
|
|
39
|
+
userId: C,
|
|
40
|
+
partnerName: T,
|
|
41
|
+
username: k,
|
|
42
|
+
template: o,
|
|
43
43
|
editor: r
|
|
44
|
-
} =
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
emailId:
|
|
48
|
-
userId:
|
|
49
|
-
username:
|
|
50
|
-
partnerName:
|
|
51
|
-
savedModulesFolderName:
|
|
52
|
-
defaultModulesFolderName:
|
|
53
|
-
},
|
|
54
|
-
preselectedDynamicContentList:
|
|
44
|
+
} = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (r == null ? void 0 : r.savedModulesFolderName) || x.SAVED_MODULES, U = (r == null ? void 0 : r.defaultModulesFolderName) || x.DEFAULT_MODULES;
|
|
45
|
+
f.templateId = v;
|
|
46
|
+
const h = {
|
|
47
|
+
emailId: v,
|
|
48
|
+
userId: C,
|
|
49
|
+
username: k,
|
|
50
|
+
partnerName: T,
|
|
51
|
+
savedModulesFolderName: L,
|
|
52
|
+
defaultModulesFolderName: U
|
|
53
|
+
}, _ = {
|
|
54
|
+
preselectedDynamicContentList: y,
|
|
55
55
|
onReady: () => {
|
|
56
|
-
console.debug("guido:ready"),
|
|
56
|
+
console.debug("guido:ready"), n("ready");
|
|
57
57
|
}
|
|
58
|
-
}, { initPlugin:
|
|
58
|
+
}, { initPlugin: M } = oe(h, _), { getDefaultTemplate: O } = de(), { cloneTimersOnSave: P, hasTimerBlocks: N } = te(), j = B(() => {
|
|
59
59
|
var e;
|
|
60
|
-
return !((e =
|
|
60
|
+
return !((e = i.ui) != null && e.showHeader);
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
Z({
|
|
63
63
|
onBack: () => {
|
|
64
|
-
console.debug("guido:back"),
|
|
64
|
+
console.debug("guido:back"), n("back");
|
|
65
65
|
},
|
|
66
66
|
onSaveStart: () => {
|
|
67
|
-
console.debug("guido:save:start"),
|
|
67
|
+
console.debug("guido:save:start"), n("save:start");
|
|
68
68
|
},
|
|
69
69
|
onSaveComplete: (e) => {
|
|
70
|
-
const
|
|
71
|
-
console.debug("guido:save:complete",
|
|
70
|
+
const t = { ...e, metadata: h };
|
|
71
|
+
console.debug("guido:save:complete", t), n("save:complete", t);
|
|
72
72
|
},
|
|
73
73
|
onTestEmailClick: () => {
|
|
74
|
-
console.debug("guido:test-email:click"),
|
|
74
|
+
console.debug("guido:test-email:click"), n("test-email:click");
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
const
|
|
78
|
-
console.debug("dynamic-content:close", e),
|
|
79
|
-
},
|
|
77
|
+
const R = (e) => {
|
|
78
|
+
console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
79
|
+
}, A = () => {
|
|
80
80
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
Q(() => m.value, () => {
|
|
83
|
+
n("on-change", m.value);
|
|
84
84
|
});
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
console.debug("dynamic-content:open",
|
|
85
|
+
const b = (e) => {
|
|
86
|
+
const t = e, { attribute: l, position: a } = t.detail;
|
|
87
|
+
console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
|
|
88
88
|
};
|
|
89
89
|
let c = null;
|
|
90
|
-
const
|
|
91
|
-
var
|
|
92
|
-
const e = document.querySelector(
|
|
93
|
-
(
|
|
90
|
+
const S = () => {
|
|
91
|
+
var t;
|
|
92
|
+
const e = document.querySelector(ne);
|
|
93
|
+
(t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
94
94
|
};
|
|
95
|
-
return
|
|
96
|
-
var
|
|
97
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
98
|
-
const e = (
|
|
99
|
-
e && (c = new ResizeObserver(
|
|
95
|
+
return X(async () => {
|
|
96
|
+
var t, l;
|
|
97
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), S();
|
|
98
|
+
const e = (t = u.value) == null ? void 0 : t.parentElement;
|
|
99
|
+
e && (c = new ResizeObserver(S), c.observe(e));
|
|
100
100
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
102
|
+
const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
|
|
103
|
+
let s = {
|
|
104
|
+
html: d && await H(d, a),
|
|
105
|
+
css: F
|
|
105
106
|
};
|
|
106
|
-
|
|
107
|
-
} catch (
|
|
108
|
-
console.error("Failed to initialize Stripo editor:",
|
|
107
|
+
s.html || (s = await O(), s.html = await H(s.html, a)), N(s.html) && (s.html = await P(s.html)), await M(s), p.selectedDynamicContentList = y;
|
|
108
|
+
} catch (a) {
|
|
109
|
+
console.error("Failed to initialize Stripo editor:", a);
|
|
109
110
|
}
|
|
110
|
-
document.addEventListener("dynamic-content:open",
|
|
111
|
-
}),
|
|
112
|
-
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
111
|
+
document.addEventListener("dynamic-content:open", b);
|
|
112
|
+
}), Y(() => {
|
|
113
|
+
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b);
|
|
113
114
|
try {
|
|
114
115
|
window.UIEditor.removeEditor();
|
|
115
116
|
} catch {
|
|
116
117
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
}),
|
|
119
|
+
i.reset();
|
|
120
|
+
}), z({
|
|
120
121
|
dynamicContent: {
|
|
121
|
-
insert:
|
|
122
|
-
close:
|
|
122
|
+
insert: R,
|
|
123
|
+
close: A
|
|
123
124
|
},
|
|
124
|
-
hasChanges:
|
|
125
|
-
saveSilent:
|
|
126
|
-
}), { __sfc: !0, PreviewContainer:
|
|
125
|
+
hasChanges: m,
|
|
126
|
+
saveSilent: D
|
|
127
|
+
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: w, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: E, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: $, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: r, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: N, noHeader: j, insertDynamicContent: R, closeDynamicContent: A, handleDynamicContentOpen: b, ribbonObserver: c, updateRibbonOffset: S, Toaster: se, FilterSelectionDrawer: re, HeaderWrapper: ce, LoadingWrapper: ae, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: me };
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
130
|
export {
|
|
130
|
-
|
|
131
|
+
Ae as default
|
|
131
132
|
};
|