@useinsider/guido 3.1.1-beta.f1817f3 → 3.1.1-beta.f3b45b9
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 +69 -61
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/composables/useHtmlCompiler.js +20 -20
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useSave.js +15 -13
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +94 -92
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +31 -31
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +20 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/composables/useConfig.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/stores/config.d.ts +72 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/dist/stores/preview.js +4 -3
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +20 -20
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleFolderDefaults as b } from "../../enums/defaults.js";
|
|
2
|
-
import { object as o, number as p, optional as e, string as t, pipe as u, picklist as n, minLength as d, custom as S, boolean as a, array as c, literal as
|
|
2
|
+
import { object as o, number as p, optional as e, string as t, pipe as u, picklist as n, minLength as d, custom as S, boolean as a, array as c, literal as l, variant as k } from "../../node_modules/valibot/dist/index.js";
|
|
3
3
|
const m = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
@@ -26,6 +26,11 @@ const m = {
|
|
|
26
26
|
/** Optional variation ID for A/B testing */
|
|
27
27
|
variationId: e(t())
|
|
28
28
|
}), y = o({
|
|
29
|
+
/** Fallback font name (e.g., "Georgia") */
|
|
30
|
+
name: t(),
|
|
31
|
+
/** Fallback font family (e.g., "serif" or "sans-serif") */
|
|
32
|
+
family: t()
|
|
33
|
+
}), f = o({
|
|
29
34
|
/** Partner/organization name (required) */
|
|
30
35
|
name: u(
|
|
31
36
|
t(),
|
|
@@ -46,8 +51,10 @@ const m = {
|
|
|
46
51
|
m.PROMOTIONAL
|
|
47
52
|
),
|
|
48
53
|
/** Display name for the current user */
|
|
49
|
-
username: e(t(), "Guido User")
|
|
50
|
-
|
|
54
|
+
username: e(t(), "Guido User"),
|
|
55
|
+
/** Fallback font settings from partner settings — used to match backend size calculation */
|
|
56
|
+
fallbackFont: e(y)
|
|
57
|
+
}), A = o({
|
|
51
58
|
/** Display text for the dynamic content */
|
|
52
59
|
text: t(),
|
|
53
60
|
/** Template variable value (e.g., {{username}}) */
|
|
@@ -61,14 +68,14 @@ const m = {
|
|
|
61
68
|
value: t()
|
|
62
69
|
})
|
|
63
70
|
)
|
|
64
|
-
}),
|
|
71
|
+
}), R = o({
|
|
65
72
|
/** Initial HTML content */
|
|
66
73
|
html: e(t(), ""),
|
|
67
74
|
/** Initial CSS content */
|
|
68
75
|
css: e(t(), ""),
|
|
69
76
|
/** Preselected dynamic content items */
|
|
70
77
|
preselectedDynamicContent: e(
|
|
71
|
-
c(
|
|
78
|
+
c(A),
|
|
72
79
|
[]
|
|
73
80
|
),
|
|
74
81
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
@@ -77,12 +84,12 @@ const m = {
|
|
|
77
84
|
selectedUnsubscribePages: e(c(p()), []),
|
|
78
85
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
79
86
|
forceRecreate: e(a(), !1)
|
|
80
|
-
}),
|
|
87
|
+
}), C = o({
|
|
81
88
|
/** Sender display name */
|
|
82
89
|
senderName: e(t(), ""),
|
|
83
90
|
/** Email subject line */
|
|
84
91
|
subject: e(t(), "")
|
|
85
|
-
}),
|
|
92
|
+
}), T = o({
|
|
86
93
|
/** Locale for the editor UI */
|
|
87
94
|
locale: e(t(), "en"),
|
|
88
95
|
/** Path to translations object */
|
|
@@ -90,17 +97,17 @@ const m = {
|
|
|
90
97
|
/** Migration date for template compatibility */
|
|
91
98
|
migrationDate: e(p(), 1759696858),
|
|
92
99
|
/** Email header settings */
|
|
93
|
-
emailHeader: e(
|
|
100
|
+
emailHeader: e(C, { senderName: "", subject: "" }),
|
|
94
101
|
/** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
|
|
95
102
|
savedModulesFolderName: e(t(), b.SAVED_MODULES),
|
|
96
103
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
97
104
|
defaultModulesFolderName: e(t(), b.DEFAULT_MODULES)
|
|
98
|
-
}),
|
|
105
|
+
}), I = o({
|
|
99
106
|
/** Whether to show the header bar */
|
|
100
107
|
showHeader: e(a(), !0),
|
|
101
108
|
/** Custom label for back button (if shown) */
|
|
102
109
|
backButtonLabel: e(t())
|
|
103
|
-
}),
|
|
110
|
+
}), E = o({
|
|
104
111
|
/** Enable dynamic content insertion */
|
|
105
112
|
dynamicContent: e(a(), !0),
|
|
106
113
|
/** Enable save as template functionality */
|
|
@@ -115,7 +122,7 @@ const m = {
|
|
|
115
122
|
unsubscribe: e(a(), !0),
|
|
116
123
|
/** Disable modules panel in the editor */
|
|
117
124
|
modulesDisabled: e(a(), !1)
|
|
118
|
-
}),
|
|
125
|
+
}), g = n([
|
|
119
126
|
"amp-accordion",
|
|
120
127
|
"amp-carousel",
|
|
121
128
|
"amp-form-controls",
|
|
@@ -129,7 +136,7 @@ const m = {
|
|
|
129
136
|
"text-block",
|
|
130
137
|
"timer-block",
|
|
131
138
|
"video-block"
|
|
132
|
-
]),
|
|
139
|
+
]), O = n([
|
|
133
140
|
"dynamic-content",
|
|
134
141
|
"checkbox-block",
|
|
135
142
|
"radio-button-block",
|
|
@@ -137,66 +144,66 @@ const m = {
|
|
|
137
144
|
"unsubscribe-block",
|
|
138
145
|
"coupon-block",
|
|
139
146
|
"items-block"
|
|
140
|
-
]),
|
|
147
|
+
]), L = o({
|
|
141
148
|
/** Default blocks to exclude from the editor */
|
|
142
149
|
excludeDefaults: e(
|
|
143
|
-
c(
|
|
150
|
+
c(g),
|
|
144
151
|
[]
|
|
145
152
|
),
|
|
146
153
|
/** Custom blocks to include in the editor */
|
|
147
154
|
includeCustoms: e(
|
|
148
|
-
c(
|
|
155
|
+
c(O),
|
|
149
156
|
[]
|
|
150
157
|
)
|
|
151
|
-
}),
|
|
158
|
+
}), r = o({
|
|
152
159
|
/** Unique identifier for the rule */
|
|
153
160
|
id: t(),
|
|
154
161
|
/** Human-readable description */
|
|
155
162
|
description: e(t()),
|
|
156
163
|
/** Priority for rule ordering (lower = earlier) */
|
|
157
164
|
priority: p()
|
|
158
|
-
}),
|
|
159
|
-
...
|
|
160
|
-
type:
|
|
165
|
+
}), M = o({
|
|
166
|
+
...r.entries,
|
|
167
|
+
type: l("replace"),
|
|
161
168
|
/** String to search for */
|
|
162
169
|
search: t(),
|
|
163
170
|
/** Replacement string */
|
|
164
171
|
replacement: t(),
|
|
165
172
|
/** Replace all occurrences (default: false) */
|
|
166
173
|
replaceAll: e(a())
|
|
167
|
-
}),
|
|
168
|
-
...
|
|
169
|
-
type:
|
|
174
|
+
}), N = o({
|
|
175
|
+
...r.entries,
|
|
176
|
+
type: l("regex"),
|
|
170
177
|
/** Regex pattern string */
|
|
171
178
|
pattern: t(),
|
|
172
179
|
/** Replacement string (supports $1, $2, etc.) */
|
|
173
180
|
replacement: t(),
|
|
174
181
|
/** Regex flags (e.g., 'gi') */
|
|
175
182
|
flags: e(t())
|
|
176
|
-
}),
|
|
177
|
-
...
|
|
178
|
-
type:
|
|
183
|
+
}), D = o({
|
|
184
|
+
...r.entries,
|
|
185
|
+
type: l("remove"),
|
|
179
186
|
/** Strings or patterns to remove */
|
|
180
187
|
targets: c(t())
|
|
181
|
-
}),
|
|
182
|
-
...
|
|
183
|
-
type:
|
|
188
|
+
}), v = o({
|
|
189
|
+
...r.entries,
|
|
190
|
+
type: l("custom"),
|
|
184
191
|
/** Custom processor function */
|
|
185
192
|
processor: S(
|
|
186
193
|
(i) => typeof i == "function",
|
|
187
194
|
"processor must be a function"
|
|
188
195
|
)
|
|
189
|
-
}),
|
|
190
|
-
L,
|
|
196
|
+
}), U = k("type", [
|
|
191
197
|
M,
|
|
192
198
|
N,
|
|
193
|
-
D
|
|
194
|
-
|
|
199
|
+
D,
|
|
200
|
+
v
|
|
201
|
+
]), x = o({
|
|
195
202
|
/** Custom compiler rules to apply */
|
|
196
|
-
customRules: e(c(
|
|
203
|
+
customRules: e(c(U), []),
|
|
197
204
|
/** Skip default compiler rules */
|
|
198
205
|
ignoreDefaultRules: e(a(), !1)
|
|
199
|
-
}),
|
|
206
|
+
}), B = o({
|
|
200
207
|
/**
|
|
201
208
|
* External validation handler called before save completes.
|
|
202
209
|
* Return false to cancel the save operation.
|
|
@@ -207,48 +214,49 @@ const m = {
|
|
|
207
214
|
"externalValidation must be a function"
|
|
208
215
|
)
|
|
209
216
|
)
|
|
210
|
-
}),
|
|
217
|
+
}), H = o({
|
|
211
218
|
// Required sections
|
|
212
219
|
/** Identity configuration (required) */
|
|
213
220
|
identity: h,
|
|
214
221
|
/** Partner configuration (required) */
|
|
215
|
-
partner:
|
|
222
|
+
partner: f,
|
|
216
223
|
// Optional sections (with defaults)
|
|
217
224
|
/** Template content and presets */
|
|
218
|
-
template: e(
|
|
225
|
+
template: e(R, {}),
|
|
219
226
|
/** Editor settings */
|
|
220
|
-
editor: e(
|
|
227
|
+
editor: e(T, {}),
|
|
221
228
|
/** UI configuration */
|
|
222
|
-
ui: e(
|
|
229
|
+
ui: e(I, {}),
|
|
223
230
|
/** Feature toggles */
|
|
224
|
-
features: e(
|
|
231
|
+
features: e(E, {}),
|
|
225
232
|
/** Block configuration */
|
|
226
|
-
blocks: e(
|
|
233
|
+
blocks: e(L, {}),
|
|
227
234
|
/** Compiler configuration */
|
|
228
|
-
compiler: e(
|
|
235
|
+
compiler: e(x, {}),
|
|
229
236
|
/** Callbacks and event handlers */
|
|
230
|
-
callbacks: e(
|
|
237
|
+
callbacks: e(B, {})
|
|
231
238
|
});
|
|
232
239
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
L as BlocksSchema,
|
|
241
|
+
B as CallbacksSchema,
|
|
242
|
+
U as CompilerRuleSchema,
|
|
243
|
+
x as CompilerSchema,
|
|
244
|
+
O as CustomBlockTypeSchema,
|
|
245
|
+
v as CustomRuleSchema,
|
|
246
|
+
g as DefaultBlockTypeSchema,
|
|
247
|
+
A as DynamicContentSchema,
|
|
248
|
+
T as EditorSchema,
|
|
249
|
+
C as EmailHeaderSchema,
|
|
250
|
+
y as FallbackFontSchema,
|
|
251
|
+
E as FeaturesSchema,
|
|
252
|
+
H as GuidoConfigSchema,
|
|
245
253
|
h as IdentitySchema,
|
|
246
254
|
m as MessageType,
|
|
247
|
-
|
|
255
|
+
f as PartnerSchema,
|
|
248
256
|
s as ProductType,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
257
|
+
N as RegexRuleSchema,
|
|
258
|
+
D as RemoveRuleSchema,
|
|
259
|
+
M as ReplaceRuleSchema,
|
|
260
|
+
R as TemplateSchema,
|
|
261
|
+
I as UISchema
|
|
254
262
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import s from "./EmailSizeIndicator.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
return
|
|
7
|
-
}, a = [], n = /* @__PURE__ */
|
|
3
|
+
import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var r = function() {
|
|
5
|
+
var i = this, e = i._self._c, t = i._self._setupProxy;
|
|
6
|
+
return e("div", { staticClass: "d-f a-i-c j-c-c" }, [t.previewStore.isLoaded ? [e(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), e(t.InTooltipV2, { attrs: { id: "email-size-tooltip", "icon-status": "", "static-position": "bottom center", "dynamic-position": !1, text: t.trans("email-editor.preview-design-size-tooltip") } })] : e(t.InSkeleton, { attrs: { sizing: { width: 200, height: 20 } } })], 2);
|
|
7
|
+
}, a = [], n = /* @__PURE__ */ o(
|
|
8
8
|
s,
|
|
9
|
-
|
|
9
|
+
r,
|
|
10
10
|
a,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"2cb418af"
|
|
14
14
|
);
|
|
15
15
|
const m = n.exports;
|
|
16
16
|
export {
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTranslations as
|
|
3
|
-
import { usePreviewStore as
|
|
4
|
-
import { InTooltipV2 as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as i, computed as t } from "vue";
|
|
2
|
+
import { useTranslations as m } from "../../../../composables/useTranslations.js";
|
|
3
|
+
import { usePreviewStore as a } from "../../../../stores/preview.js";
|
|
4
|
+
import { InTooltipV2 as p, InSkeleton as c, InProgress as _ } from "@useinsider/design-system-vue";
|
|
5
|
+
const z = /* @__PURE__ */ i({
|
|
6
6
|
__name: "EmailSizeIndicator",
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
9
|
-
type: "success",
|
|
10
|
-
value:
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
e.value = Math.round(m / 1024), s.value = {
|
|
14
|
-
type: e.value < o ? "success" : "warning",
|
|
15
|
-
value: Math.min(e.value, o)
|
|
16
|
-
};
|
|
17
|
-
}, i = p();
|
|
18
|
-
return u(() => t.previewHtml, () => {
|
|
19
|
-
r();
|
|
20
|
-
}, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltipV2: v };
|
|
7
|
+
setup(l) {
|
|
8
|
+
const e = a(), o = 102, r = t(() => `~${e.emailSizeKB} KB`), n = t(() => ({
|
|
9
|
+
type: e.emailSizeKB < o ? "success" : "warning",
|
|
10
|
+
value: Math.min(e.emailSizeKB, o)
|
|
11
|
+
})), s = m();
|
|
12
|
+
return { __sfc: !0, previewStore: e, MAX_EMAIL_SIZE_IN_KB: o, htmlSize: r, progress: n, trans: s, InProgress: _, InSkeleton: c, InTooltipV2: p };
|
|
21
13
|
}
|
|
22
14
|
});
|
|
23
15
|
export {
|
|
24
|
-
|
|
16
|
+
z as default
|
|
25
17
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { outlookCompilerRules as
|
|
4
|
-
import { recommendationCompilerRules as
|
|
5
|
-
import { socialCompilerRules as
|
|
6
|
-
import { unsubscribeCompilerRules as
|
|
7
|
-
import { createHtmlCompiler as
|
|
8
|
-
import { useConfig as
|
|
9
|
-
const
|
|
10
|
-
var m,
|
|
11
|
-
const { compiler: e } =
|
|
12
|
-
...!!((
|
|
13
|
-
...n,
|
|
1
|
+
import { defaultHtmlCompilerRules as n } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as a } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { outlookCompilerRules as f } from "../config/compiler/outlookCompilerRules.js";
|
|
4
|
+
import { recommendationCompilerRules as R } from "../config/compiler/recommendationCompilerRules.js";
|
|
5
|
+
import { socialCompilerRules as C } from "../config/compiler/socialCompilerRules.js";
|
|
6
|
+
import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
7
|
+
import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
|
|
8
|
+
import { useConfig as b } from "./useConfig.js";
|
|
9
|
+
const q = () => {
|
|
10
|
+
var l, m, r;
|
|
11
|
+
const { compiler: e, partner: t } = b(), i = ((l = e.value) == null ? void 0 : l.customRules) || [], s = [
|
|
12
|
+
...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : n,
|
|
14
13
|
...R,
|
|
15
|
-
...
|
|
16
|
-
...
|
|
14
|
+
...g,
|
|
15
|
+
...a,
|
|
17
16
|
...f,
|
|
18
|
-
...
|
|
17
|
+
...C,
|
|
18
|
+
...i.map((o, c) => ({
|
|
19
19
|
...o,
|
|
20
|
-
priority: o.priority + 1e3 +
|
|
20
|
+
priority: o.priority + 1e3 + c
|
|
21
21
|
// Ensure additional rules run after default rules
|
|
22
22
|
}))
|
|
23
|
-
],
|
|
24
|
-
return { compileHtml: (o) =>
|
|
23
|
+
], p = H(s), u = (r = t.value) == null ? void 0 : r.fallbackFont;
|
|
24
|
+
return { compileHtml: (o) => p.compile(o, void 0, u) };
|
|
25
25
|
};
|
|
26
26
|
export {
|
|
27
|
-
|
|
27
|
+
q as useHtmlCompiler
|
|
28
28
|
};
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { useEditorStore as
|
|
2
|
-
import { usePreviewStore as
|
|
3
|
-
import { useActionsApi as
|
|
4
|
-
import { useCodeEditorApi as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useEditorStore as d } from "../stores/editor.js";
|
|
2
|
+
import { usePreviewStore as n } from "../stores/preview.js";
|
|
3
|
+
import { useActionsApi as p } from "./useActionsApi.js";
|
|
4
|
+
import { useCodeEditorApi as c } from "./useCodeEditorApi.js";
|
|
5
|
+
import { useHtmlCompiler as u } from "./useHtmlCompiler.js";
|
|
6
|
+
const g = () => {
|
|
7
|
+
const t = d(), e = n(), { closeCodeEditor: i } = c(), { getPreviewData: a, getCompiledEmail: s } = p(), { compileHtml: m } = u(), r = () => {
|
|
8
|
+
t.isPreviewModeOpen = !1, e.$reset();
|
|
8
9
|
};
|
|
9
10
|
return {
|
|
10
11
|
closePreviewMode: r,
|
|
11
12
|
openPreviewMode: () => {
|
|
12
|
-
|
|
13
|
+
t.isCodeEditorOpen && i(), t.isPreviewModeOpen = !0;
|
|
13
14
|
},
|
|
14
15
|
loadPreviewData: async () => {
|
|
15
|
-
if (!(
|
|
16
|
-
|
|
16
|
+
if (!(t.loadingStatus || e.isLoaded)) {
|
|
17
|
+
t.loadingStatus = !0;
|
|
17
18
|
try {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const [o, l] = await Promise.all([
|
|
20
|
+
a(),
|
|
21
|
+
s({ minimize: !0, resetDataSavedFlag: !1 })
|
|
22
|
+
]);
|
|
23
|
+
e.templateHtml = o.html || "", e.ampHtml = o.ampHtml || "", e.ampErrors = o.ampErrors || [], e.setEmailFormat(o.ampHtml ? "AMP" : "html"), e.emailSizeKB = m(l.html).estimatedSizeKB, e.isLoaded = !0;
|
|
24
|
+
} catch (o) {
|
|
25
|
+
console.error("Failed to load preview data:", o), r();
|
|
22
26
|
} finally {
|
|
23
|
-
|
|
27
|
+
t.loadingStatus = !1;
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
};
|
|
29
33
|
export {
|
|
30
|
-
|
|
34
|
+
g as usePreviewMode
|
|
31
35
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useActionsApi as d } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as f } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as v, useSaveComplete as S } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as x } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as V } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as y } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as w } from "./useHtmlValidator.js";
|
|
8
|
+
const k = () => {
|
|
9
|
+
const o = v(), s = S(), { validateHtml: i } = w(), { callbacks: a } = f(), { extractSyncModuleData: r } = x(), { setSyncModuleUnsubscriptionPages: n } = V(), { editorSave: l } = d();
|
|
10
|
+
return { save: async (c = !1) => {
|
|
10
11
|
var e;
|
|
11
12
|
o();
|
|
12
|
-
const { prepareTemplateDetails:
|
|
13
|
+
const { prepareTemplateDetails: m } = y(), t = await m();
|
|
13
14
|
if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
|
|
14
15
|
return;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
l();
|
|
17
|
+
const { unsubscribePayload: u, stripoModules: p } = r(t.rawHtml);
|
|
18
|
+
return await n(u), t.modules = p, c || s(t), t;
|
|
17
19
|
} };
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
k as useSave
|
|
21
23
|
};
|
|
@@ -11,6 +11,8 @@ class f {
|
|
|
11
11
|
try {
|
|
12
12
|
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
|
|
13
13
|
return i.length === 0 ? t : (i.forEach((r) => {
|
|
14
|
+
if (r.classList.contains("checkbox-block-v2"))
|
|
15
|
+
return;
|
|
14
16
|
const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
|
|
15
17
|
`<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
|
|
16
18
|
"text/html"
|
|
@@ -22,7 +24,7 @@ class f {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
extractTextFromElement(t, e) {
|
|
25
|
-
var o,
|
|
27
|
+
var o, d;
|
|
26
28
|
const i = t.querySelector(`.${e}`);
|
|
27
29
|
if (!i)
|
|
28
30
|
return {
|
|
@@ -41,13 +43,13 @@ class f {
|
|
|
41
43
|
align: i.getAttribute("align") || "left",
|
|
42
44
|
styles: ""
|
|
43
45
|
};
|
|
44
|
-
const n = ((
|
|
46
|
+
const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
|
|
45
47
|
return {
|
|
46
48
|
text: n,
|
|
47
49
|
isBold: a,
|
|
48
50
|
isItalic: p,
|
|
49
51
|
align: c,
|
|
50
|
-
styles:
|
|
52
|
+
styles: u
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
buildTextBlock(t) {
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var f = (r, t, e) => t in r ?
|
|
3
|
-
var
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var f = (r, t, e) => t in r ? x(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var b = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import h from "../../extensions/Blocks/RadioButton/template.js";
|
|
5
5
|
class T {
|
|
6
6
|
constructor() {
|
|
7
|
-
|
|
7
|
+
b(this, "parser");
|
|
8
8
|
this.parser = new DOMParser();
|
|
9
9
|
}
|
|
10
10
|
migrate(t) {
|
|
11
11
|
try {
|
|
12
12
|
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
|
|
13
13
|
return i.length === 0 ? t : (i.forEach((s) => {
|
|
14
|
-
|
|
14
|
+
if (s.classList.contains("radio-button-v2"))
|
|
15
|
+
return;
|
|
16
|
+
const n = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), o = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", o), y = this.parser.parseFromString(
|
|
15
17
|
`<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
|
|
16
18
|
"text/html"
|
|
17
19
|
).querySelector(".radio-button-v2");
|
|
18
|
-
y && s.parentNode && (y.setAttribute("id",
|
|
20
|
+
y && s.parentNode && (y.setAttribute("id", n || ""), s.parentNode.replaceChild(y, s));
|
|
19
21
|
}), e.documentElement.outerHTML);
|
|
20
22
|
} catch (e) {
|
|
21
23
|
return console.error("RadioButtonMigrator failed:", e), t;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
extractTextFromElement(t, e) {
|
|
25
|
-
var
|
|
27
|
+
var o, c;
|
|
26
28
|
const i = t.querySelector(`.${e}`);
|
|
27
29
|
if (!i)
|
|
28
30
|
return {
|
|
@@ -36,16 +38,16 @@ class T {
|
|
|
36
38
|
const s = i.querySelector("p");
|
|
37
39
|
if (!s)
|
|
38
40
|
return {
|
|
39
|
-
text: ((
|
|
41
|
+
text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
|
|
40
42
|
isBold: !1,
|
|
41
43
|
isItalic: !1,
|
|
42
44
|
align: i.getAttribute("align") || "left",
|
|
43
45
|
styles: "",
|
|
44
46
|
classList: ""
|
|
45
47
|
};
|
|
46
|
-
const
|
|
48
|
+
const n = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
|
|
47
49
|
return {
|
|
48
|
-
text:
|
|
50
|
+
text: n,
|
|
49
51
|
isBold: p,
|
|
50
52
|
isItalic: u,
|
|
51
53
|
align: a,
|
|
@@ -66,8 +68,8 @@ class T {
|
|
|
66
68
|
`;
|
|
67
69
|
}
|
|
68
70
|
removeStyleProperties(t, e) {
|
|
69
|
-
return t ? e.reduce((s,
|
|
70
|
-
const l = new RegExp(`${
|
|
71
|
+
return t ? e.reduce((s, n) => {
|
|
72
|
+
const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
|
|
71
73
|
return s.replace(l, "");
|
|
72
74
|
}, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
73
75
|
}
|
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container",
|
|
1
|
+
const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", n = ".ins-recommendation-mobile-container", t = ".ins-recommendation-mobile-row", r = {
|
|
2
2
|
CURRENCY: "currency",
|
|
3
3
|
SYMBOL: "currency-symbol",
|
|
4
4
|
ALIGNMENT: "currency-alignment",
|
|
5
5
|
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
6
|
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
7
|
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
-
},
|
|
8
|
+
}, R = "productImage", _ = "productName", e = "productPrice", O = "productOldPrice", s = "productOmnibusPrice", i = "productOmnibusDiscount", E = "productButton", A = "customAttr:", C = "data-custom-attributes", u = "product-attr", m = /* @__PURE__ */ new Set([
|
|
9
|
+
"name",
|
|
10
|
+
// productName
|
|
11
|
+
"price",
|
|
12
|
+
// productPrice
|
|
13
|
+
"original_price",
|
|
14
|
+
// productOldPrice
|
|
15
|
+
"image_url",
|
|
16
|
+
// productImage
|
|
17
|
+
"url",
|
|
18
|
+
// productButton
|
|
19
|
+
"omnibus_price",
|
|
20
|
+
// productOmnibusPrice
|
|
21
|
+
"omnibus_discount"
|
|
22
|
+
// productOmnibusDiscount
|
|
23
|
+
]);
|
|
9
24
|
export {
|
|
10
25
|
A as ATTR_CUSTOM_PREFIX,
|
|
11
|
-
|
|
26
|
+
C as ATTR_DATA_CUSTOM_ATTRIBUTES,
|
|
12
27
|
u as ATTR_PRODUCT_ATTR,
|
|
13
28
|
E as ATTR_PRODUCT_BUTTON,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
R as ATTR_PRODUCT_IMAGE,
|
|
30
|
+
_ as ATTR_PRODUCT_NAME,
|
|
31
|
+
O as ATTR_PRODUCT_OLD_PRICE,
|
|
32
|
+
i as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
18
33
|
s as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
19
|
-
|
|
34
|
+
e as ATTR_PRODUCT_PRICE,
|
|
20
35
|
T as BLOCK_ROOT_SELECTOR,
|
|
36
|
+
m as BUILT_IN_DEFAULT_ATTRIBUTES,
|
|
21
37
|
c as CONTAINER_SELECTOR,
|
|
22
|
-
|
|
38
|
+
r as CURRENCY_ATTR,
|
|
23
39
|
o as DESKTOP_CONTAINER_SELECTOR,
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
n as MOBILE_CONTAINER_SELECTOR,
|
|
41
|
+
t as MOBILE_ROW_SELECTOR
|
|
26
42
|
};
|