@useinsider/guido 3.12.0-beta.00cbb4c → 3.12.0-beta.1b68f97
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 +4 -0
- package/dist/@types/config/schemas.js +63 -50
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
- package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
- package/dist/composables/usePreviewInteractionGuard.js +36 -11
- package/dist/composables/useRecommendationPreview.js +61 -60
- package/dist/composables/useSave.js +43 -24
- package/dist/composables/validators/useAllowlistValidator.js +31 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +29 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
- package/dist/src/composables/validators/useAllowlistValidator.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/utils/urlSchemes.d.ts +6 -0
- package/dist/utils/urlSchemes.js +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -161,11 +161,15 @@ const config: GuidoConfigInput = {
|
|
|
161
161
|
modulesDisabled?: boolean, // Default: false - Disable modules panel
|
|
162
162
|
liquidSyntax?: boolean, // Default: false - Enable Liquid template syntax
|
|
163
163
|
autosave?: boolean, // Default: false - Show the Auto Save toggle in the header. See wiki/AUTOSAVE.md.
|
|
164
|
+
allowlistEnabled?: boolean, // Default: false - Pre-save domain-allowlist check (opt-in). Pair with callbacks.resolveAllowlistToast.
|
|
164
165
|
},
|
|
165
166
|
|
|
166
167
|
// Optional: Callbacks
|
|
167
168
|
callbacks?: {
|
|
168
169
|
externalValidation?: (data: SavedTemplateDetails) => Promise<boolean>, // Return false to cancel save
|
|
170
|
+
// Supplies the block toaster when features.allowlistEnabled blocks a save on a non-allowlisted domain.
|
|
171
|
+
// The host owns role-gating, the settings deep-link, and copy; Guido renders the result. Return null/void to block silently.
|
|
172
|
+
resolveAllowlistToast?: (blockedDomains: string[]) => { message: string, actionButton?: { text: string, onClick: () => void } } | null | void,
|
|
169
173
|
},
|
|
170
174
|
|
|
171
175
|
// Optional: Block configuration
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
|
2
|
+
import { object as a, number as n, optional as e, string as t, picklist as i, pipe as p, minLength as b, custom as S, boolean as o, array as c, record as k, fallback as C, literal as m, looseObject as g, variant as R, union as h, unknown as l, lazy as T } from "../../node_modules/valibot/dist/index.js";
|
|
3
3
|
const d = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
@@ -30,7 +30,7 @@ const d = {
|
|
|
30
30
|
name: t(),
|
|
31
31
|
/** Fallback font family (e.g., "serif" or "sans-serif") */
|
|
32
32
|
family: t()
|
|
33
|
-
}),
|
|
33
|
+
}), v = a({
|
|
34
34
|
/** Partner/organization name (required) */
|
|
35
35
|
name: p(
|
|
36
36
|
t(),
|
|
@@ -38,7 +38,7 @@ const d = {
|
|
|
38
38
|
),
|
|
39
39
|
/** Product type identifier */
|
|
40
40
|
productType: e(
|
|
41
|
-
|
|
41
|
+
i([
|
|
42
42
|
r.EMAIL,
|
|
43
43
|
r.ARCHITECT,
|
|
44
44
|
r.UNSUBSCRIBE_PAGES
|
|
@@ -47,14 +47,14 @@ const d = {
|
|
|
47
47
|
),
|
|
48
48
|
/** Message type (promotional or transactional) */
|
|
49
49
|
messageType: e(
|
|
50
|
-
|
|
50
|
+
i([d.PROMOTIONAL, d.TRANSACTIONAL]),
|
|
51
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
56
|
fallbackFont: e(I)
|
|
57
|
-
}),
|
|
57
|
+
}), L = a({
|
|
58
58
|
/** Display text for the dynamic content */
|
|
59
59
|
text: t(),
|
|
60
60
|
/** Template variable value (e.g., {{username}}) */
|
|
@@ -68,40 +68,40 @@ const d = {
|
|
|
68
68
|
value: t()
|
|
69
69
|
})
|
|
70
70
|
)
|
|
71
|
-
}),
|
|
71
|
+
}), f = T(() => g({
|
|
72
72
|
text: e(t()),
|
|
73
73
|
// eslint-disable-next-line camelcase -- backend field name
|
|
74
74
|
tag_text: e(t()),
|
|
75
75
|
value: e(t()),
|
|
76
|
-
children: e(c(
|
|
76
|
+
children: e(c(f)),
|
|
77
77
|
// eslint-disable-next-line camelcase -- backend field name
|
|
78
|
-
select_items: e(c(
|
|
79
|
-
})),
|
|
78
|
+
select_items: e(c(f))
|
|
79
|
+
})), E = k(
|
|
80
80
|
t(),
|
|
81
|
-
C(c(
|
|
82
|
-
),
|
|
81
|
+
C(c(f), [])
|
|
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
86
|
decimalCount: e(h([t(), n()])),
|
|
87
87
|
/** Pinned product IDs (empty array when filter-driven) */
|
|
88
|
-
productIds: e(c(
|
|
88
|
+
productIds: e(c(l())),
|
|
89
89
|
/** Whether the block requested live products at send time */
|
|
90
90
|
sendProductRequestFlag: e(o()),
|
|
91
91
|
/** Whether to randomize product order */
|
|
92
92
|
shuffleProducts: e(o()),
|
|
93
93
|
/** Filter rules driving product selection */
|
|
94
|
-
filters: e(c(
|
|
94
|
+
filters: e(c(l())),
|
|
95
95
|
/** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
|
|
96
96
|
currency: e(t()),
|
|
97
97
|
/** Currency display settings (separators, alignment, decimals) */
|
|
98
|
-
currencySettings: e(
|
|
98
|
+
currencySettings: e(l()),
|
|
99
99
|
/** Locale (e.g. 'nl_NL') */
|
|
100
100
|
language: e(t()),
|
|
101
101
|
/** Recommendation strategy key (e.g. 'newArrivals') */
|
|
102
102
|
strategy: e(t()),
|
|
103
103
|
/** Snapshot of products as rendered by the legacy block */
|
|
104
|
-
recommendedProducts: e(c(
|
|
104
|
+
recommendedProducts: e(c(l())),
|
|
105
105
|
/** Number of product cards per row */
|
|
106
106
|
cardsInRow: e(n()),
|
|
107
107
|
/** Mobile-only padding (right) */
|
|
@@ -124,7 +124,7 @@ const d = {
|
|
|
124
124
|
isPriceMovedToNextLine: e(o()),
|
|
125
125
|
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
126
126
|
isPriceDeletedForZeroSale: e(o())
|
|
127
|
-
}),
|
|
127
|
+
}), D = a({
|
|
128
128
|
/**
|
|
129
129
|
* Legacy recommendation block configs keyed by block ID.
|
|
130
130
|
* Pass this when loading a template authored with the v1
|
|
@@ -132,7 +132,7 @@ const d = {
|
|
|
132
132
|
* strategy, currency, locale, and layout data.
|
|
133
133
|
*/
|
|
134
134
|
recommendationConfigs: e(
|
|
135
|
-
k(t(),
|
|
135
|
+
k(t(), P),
|
|
136
136
|
{}
|
|
137
137
|
)
|
|
138
138
|
}), M = a({
|
|
@@ -142,7 +142,7 @@ const d = {
|
|
|
142
142
|
css: e(t(), ""),
|
|
143
143
|
/** Preselected dynamic content items */
|
|
144
144
|
preselectedDynamicContent: e(
|
|
145
|
-
c(
|
|
145
|
+
c(L),
|
|
146
146
|
[]
|
|
147
147
|
),
|
|
148
148
|
/**
|
|
@@ -151,7 +151,7 @@ const d = {
|
|
|
151
151
|
* (first) partner's leaf attributes into the label→token map that repairs
|
|
152
152
|
* label-form placeholders (`{{ Phone Number }}`) in dropped saved modules.
|
|
153
153
|
*/
|
|
154
|
-
dynamicContentList: e(
|
|
154
|
+
dynamicContentList: e(E, {}),
|
|
155
155
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
156
156
|
customFieldAttributes: e(c(t()), []),
|
|
157
157
|
/** Selected unsubscribe page IDs */
|
|
@@ -159,7 +159,7 @@ const d = {
|
|
|
159
159
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
160
160
|
forceRecreate: e(o(), !1),
|
|
161
161
|
/** Migration-only inputs (legacy block configs) */
|
|
162
|
-
migration: e(
|
|
162
|
+
migration: e(D, {})
|
|
163
163
|
}), N = a({
|
|
164
164
|
/** Sender display name */
|
|
165
165
|
senderName: e(t(), ""),
|
|
@@ -201,8 +201,10 @@ const d = {
|
|
|
201
201
|
/** Enable Liquid template syntax */
|
|
202
202
|
liquidSyntax: e(o(), !1),
|
|
203
203
|
/** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
|
|
204
|
-
autosave: e(o(), !1)
|
|
205
|
-
|
|
204
|
+
autosave: e(o(), !1),
|
|
205
|
+
/** Enable pre-save domain-allowlist validation (opt-in; host supplies the block toaster via callbacks.resolveAllowlistToast) */
|
|
206
|
+
allowlistEnabled: e(o(), !1)
|
|
207
|
+
}), w = i([
|
|
206
208
|
"amp-accordion",
|
|
207
209
|
"amp-carousel",
|
|
208
210
|
"amp-form-controls",
|
|
@@ -216,7 +218,7 @@ const d = {
|
|
|
216
218
|
"text-block",
|
|
217
219
|
"timer-block",
|
|
218
220
|
"video-block"
|
|
219
|
-
]),
|
|
221
|
+
]), U = i([
|
|
220
222
|
"dynamic-content",
|
|
221
223
|
"checkbox-block",
|
|
222
224
|
"radio-button-block",
|
|
@@ -224,18 +226,18 @@ const d = {
|
|
|
224
226
|
"unsubscribe-block",
|
|
225
227
|
"coupon-block",
|
|
226
228
|
"items-block"
|
|
227
|
-
]),
|
|
229
|
+
]), B = a({
|
|
228
230
|
/** Default blocks to exclude from the editor */
|
|
229
231
|
excludeDefaults: e(
|
|
230
|
-
c(
|
|
232
|
+
c(w),
|
|
231
233
|
[]
|
|
232
234
|
),
|
|
233
235
|
/** Custom blocks to include in the editor */
|
|
234
236
|
includeCustoms: e(
|
|
235
|
-
c(
|
|
237
|
+
c(U),
|
|
236
238
|
[]
|
|
237
239
|
)
|
|
238
|
-
}),
|
|
240
|
+
}), u = a({
|
|
239
241
|
/** Unique identifier for the rule */
|
|
240
242
|
id: t(),
|
|
241
243
|
/** Human-readable description */
|
|
@@ -243,8 +245,8 @@ const d = {
|
|
|
243
245
|
/** Priority for rule ordering (lower = earlier) */
|
|
244
246
|
priority: n()
|
|
245
247
|
}), H = a({
|
|
246
|
-
...
|
|
247
|
-
type:
|
|
248
|
+
...u.entries,
|
|
249
|
+
type: m("replace"),
|
|
248
250
|
/** String to search for */
|
|
249
251
|
search: t(),
|
|
250
252
|
/** Replacement string */
|
|
@@ -252,8 +254,8 @@ const d = {
|
|
|
252
254
|
/** Replace all occurrences (default: false) */
|
|
253
255
|
replaceAll: e(o())
|
|
254
256
|
}), _ = a({
|
|
255
|
-
...
|
|
256
|
-
type:
|
|
257
|
+
...u.entries,
|
|
258
|
+
type: m("regex"),
|
|
257
259
|
/** Regex pattern string */
|
|
258
260
|
pattern: t(),
|
|
259
261
|
/** Replacement string (supports $1, $2, etc.) */
|
|
@@ -261,16 +263,16 @@ const d = {
|
|
|
261
263
|
/** Regex flags (e.g., 'gi') */
|
|
262
264
|
flags: e(t())
|
|
263
265
|
}), j = a({
|
|
264
|
-
...
|
|
265
|
-
type:
|
|
266
|
+
...u.entries,
|
|
267
|
+
type: m("remove"),
|
|
266
268
|
/** Strings or patterns to remove */
|
|
267
269
|
targets: c(t())
|
|
268
270
|
}), q = a({
|
|
269
|
-
...
|
|
270
|
-
type:
|
|
271
|
+
...u.entries,
|
|
272
|
+
type: m("custom"),
|
|
271
273
|
/** Custom processor function */
|
|
272
|
-
processor:
|
|
273
|
-
(
|
|
274
|
+
processor: S(
|
|
275
|
+
(s) => typeof s == "function",
|
|
274
276
|
"processor must be a function"
|
|
275
277
|
)
|
|
276
278
|
}), G = R("type", [
|
|
@@ -289,17 +291,28 @@ const d = {
|
|
|
289
291
|
* Return false to cancel the save operation.
|
|
290
292
|
*/
|
|
291
293
|
externalValidation: e(
|
|
292
|
-
|
|
293
|
-
(
|
|
294
|
+
S(
|
|
295
|
+
(s) => typeof s == "function",
|
|
294
296
|
"externalValidation must be a function"
|
|
295
297
|
)
|
|
298
|
+
),
|
|
299
|
+
/**
|
|
300
|
+
* Resolves the block toaster's content when the domain-allowlist check (features.allowlistEnabled)
|
|
301
|
+
* blocks a save. Host-supplied so role-gating, the settings deep-link, and copy stay host-side.
|
|
302
|
+
* Returning null/void blocks the save with no toaster.
|
|
303
|
+
*/
|
|
304
|
+
resolveAllowlistToast: e(
|
|
305
|
+
S(
|
|
306
|
+
(s) => typeof s == "function",
|
|
307
|
+
"resolveAllowlistToast must be a function"
|
|
308
|
+
)
|
|
296
309
|
)
|
|
297
310
|
}), K = a({
|
|
298
311
|
// Required sections
|
|
299
312
|
/** Identity configuration (required) */
|
|
300
313
|
identity: A,
|
|
301
314
|
/** Partner configuration (required) */
|
|
302
|
-
partner:
|
|
315
|
+
partner: v,
|
|
303
316
|
// Optional sections (with defaults)
|
|
304
317
|
/** Template content and presets */
|
|
305
318
|
template: e(M, {}),
|
|
@@ -310,37 +323,37 @@ const d = {
|
|
|
310
323
|
/** Feature toggles */
|
|
311
324
|
features: e(F, {}),
|
|
312
325
|
/** Block configuration */
|
|
313
|
-
blocks: e(
|
|
326
|
+
blocks: e(B, {}),
|
|
314
327
|
/** Compiler configuration */
|
|
315
328
|
compiler: e(V, {}),
|
|
316
329
|
/** Callbacks and event handlers */
|
|
317
330
|
callbacks: e(z, {})
|
|
318
331
|
});
|
|
319
332
|
export {
|
|
320
|
-
|
|
333
|
+
B as BlocksSchema,
|
|
321
334
|
z as CallbacksSchema,
|
|
322
335
|
G as CompilerRuleSchema,
|
|
323
336
|
V as CompilerSchema,
|
|
324
|
-
|
|
337
|
+
U as CustomBlockTypeSchema,
|
|
325
338
|
q as CustomRuleSchema,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
339
|
+
w as DefaultBlockTypeSchema,
|
|
340
|
+
E as DynamicContentListSchema,
|
|
341
|
+
f as DynamicContentNodeSchema,
|
|
342
|
+
L as DynamicContentSchema,
|
|
330
343
|
O as EditorSchema,
|
|
331
344
|
N as EmailHeaderSchema,
|
|
332
345
|
I as FallbackFontSchema,
|
|
333
346
|
F as FeaturesSchema,
|
|
334
347
|
K as GuidoConfigSchema,
|
|
335
348
|
A as IdentitySchema,
|
|
336
|
-
|
|
349
|
+
P as LegacyRecommendationConfigSchema,
|
|
337
350
|
d as MessageType,
|
|
338
|
-
|
|
351
|
+
v as PartnerSchema,
|
|
339
352
|
r as ProductType,
|
|
340
353
|
_ as RegexRuleSchema,
|
|
341
354
|
j as RemoveRuleSchema,
|
|
342
355
|
H as ReplaceRuleSchema,
|
|
343
|
-
|
|
356
|
+
D as TemplateMigrationSchema,
|
|
344
357
|
M as TemplateSchema,
|
|
345
358
|
x as UISchema
|
|
346
359
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as u, ref as a, onMounted as p, onBeforeUnmount as l, nextTick as
|
|
2
|
-
import { usePreviewInteractionGuard as
|
|
1
|
+
import { defineComponent as u, ref as a, onMounted as p, onBeforeUnmount as l, nextTick as d } from "vue";
|
|
2
|
+
import { usePreviewInteractionGuard as v } from "../../../../composables/usePreviewInteractionGuard.js";
|
|
3
3
|
import { useTranslations as _ } from "../../../../composables/useTranslations.js";
|
|
4
4
|
import { usePreviewStore as w } from "../../../../stores/preview.js";
|
|
5
5
|
import I from "./DesktopBrowserHeader.vue.js";
|
|
6
6
|
const C = /* @__PURE__ */ u({
|
|
7
7
|
__name: "DesktopPreview",
|
|
8
|
-
setup(
|
|
9
|
-
const i = _(), {
|
|
8
|
+
setup(P) {
|
|
9
|
+
const i = _(), { guardPreviewInteractions: t } = v(), o = a(), r = a(!1), c = w();
|
|
10
10
|
let e = null;
|
|
11
11
|
const f = (m) => {
|
|
12
12
|
t(m.target);
|
|
13
|
-
},
|
|
13
|
+
}, n = () => {
|
|
14
14
|
o.value && (e = new ResizeObserver(() => {
|
|
15
|
-
}), e.observe(o.value),
|
|
16
|
-
|
|
15
|
+
}), e.observe(o.value), d(() => {
|
|
16
|
+
r.value = !0;
|
|
17
17
|
}));
|
|
18
18
|
}, s = () => {
|
|
19
19
|
e == null || e.disconnect();
|
|
20
20
|
};
|
|
21
|
-
return p(
|
|
21
|
+
return p(n), l(s), { __sfc: !0, trans: i, guardPreviewInteractions: t, containerRef: o, isContainerReady: r, previewStore: c, resizeObserver: e, onIframeLoad: f, initIframe: n, cleanIframe: s, DesktopBrowserHeader: I };
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
export {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import e from "./ContentView.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var
|
|
4
|
+
var o = function() {
|
|
5
5
|
var t = this, s = t._self._c, a = t._self._setupProxy;
|
|
6
6
|
return s("div", { staticClass: "w-1 h-1 b-c-4 d-f f-d-c" }, [s("div", { staticClass: "d-f j-c-s-b a-i-c p-2 h-6-s" }, [s("div", { staticClass: "d-f a-i-c cur-p", on: { click: function(l) {
|
|
7
7
|
return t.$emit("back-to-inbox");
|
|
8
8
|
} } }, [s(a.InIcons, { staticClass: "f-s-3 i-c-7", attrs: { name: "line-chevron-left" } }), s("span", { staticClass: "ml-2 f-s-1 f-w-400 l-h-1 t-c-7" }, [t._v(t._s(a.trans("newsletter.inbox")))])], 1), s("div", { staticClass: "d-f a-i-c" }, [s(a.InIcons, { staticClass: "i-c-52", attrs: { name: "line-chevron-down" } }), s(a.InIcons, { staticClass: "ml-1 i-c-52", attrs: { name: "line-chevron-up" } })], 1)]), s("div", { staticClass: "iframe-wrapper f-g-1 o-h" }, [s("iframe", { ref: "iframeRef", staticClass: "iframe-scaled d-b b-c-4 bor-s-n", attrs: { sandbox: "allow-same-origin allow-popups allow-forms allow-scripts allow-popups-to-escape-sandbox", srcdoc: a.previewStore.previewHtml }, on: { load: a.onLoad } })])]);
|
|
9
|
-
},
|
|
9
|
+
}, i = [], r = /* @__PURE__ */ n(
|
|
10
10
|
e,
|
|
11
|
-
c,
|
|
12
11
|
o,
|
|
12
|
+
i,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"f255b2bb"
|
|
16
16
|
);
|
|
17
|
-
const d =
|
|
17
|
+
const d = r.exports;
|
|
18
18
|
export {
|
|
19
19
|
d as default
|
|
20
20
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as c, ref as a } from "vue";
|
|
2
2
|
import { usePreviewInteractionGuard as f } from "../../../../composables/usePreviewInteractionGuard.js";
|
|
3
3
|
import { useResponsivePreview as p } from "../../../../composables/useResponsivePreview.js";
|
|
4
4
|
import { useTranslations as u } from "../../../../composables/useTranslations.js";
|
|
5
5
|
import { usePreviewStore as v } from "../../../../stores/preview.js";
|
|
6
|
-
import { InIcons as
|
|
7
|
-
const
|
|
6
|
+
import { InIcons as d } from "@useinsider/design-system-vue";
|
|
7
|
+
const b = /* @__PURE__ */ c({
|
|
8
8
|
__name: "ContentView",
|
|
9
9
|
emits: ["back-to-inbox"],
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
10
|
+
setup(P) {
|
|
11
|
+
const m = u(), r = v(), t = a(), { setupResponsivePreview: n } = p(), { guardPreviewInteractions: s } = f(), i = (e) => {
|
|
12
12
|
["transform", "transform-origin", "height"].forEach((o) => {
|
|
13
13
|
e.documentElement.style.removeProperty(o);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
return { __sfc: !0, trans:
|
|
17
|
-
const e =
|
|
18
|
-
o && (n(e), s(e),
|
|
19
|
-
}, InIcons:
|
|
16
|
+
return { __sfc: !0, trans: m, previewStore: r, iframeRef: t, setupResponsivePreview: n, guardPreviewInteractions: s, clearAMPTransforms: i, onLoad: () => {
|
|
17
|
+
const e = t.value, o = e == null ? void 0 : e.contentDocument;
|
|
18
|
+
o && (n(e), s(e), r.isAMPResponsive && i(o));
|
|
19
|
+
}, InIcons: d };
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
b as default
|
|
24
24
|
};
|
|
@@ -1,17 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { URLS as o, MERGE_TAGS as a } from "../enums/unsubscribe.js";
|
|
2
|
+
import { UNSUBSCRIBE_LINK_SELECTOR as i } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
+
import { BASE_SAFE_URL_SCHEMES as u } from "../utils/urlSchemes.js";
|
|
4
|
+
const E = ["click", "auxclick"], d = [
|
|
5
|
+
...Object.values(a),
|
|
6
|
+
o.UNSUBSCRIBE_URL,
|
|
7
|
+
o.PREFERENCES_URL
|
|
8
|
+
], l = (e) => {
|
|
9
|
+
if (e.matches(i))
|
|
10
|
+
return !0;
|
|
11
|
+
const r = e.getAttribute("href") ?? "";
|
|
12
|
+
return d.some((t) => r.includes(t));
|
|
13
|
+
}, S = [...u, "tel:", "sms:"], f = (e) => {
|
|
14
|
+
const r = (e.getAttribute("href") ?? "").trim();
|
|
15
|
+
return r === "" || r.startsWith("#") || r.startsWith("{{") ? !1 : S.includes(e.protocol);
|
|
16
|
+
}, m = (e) => {
|
|
17
|
+
var t, n;
|
|
18
|
+
const r = (n = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : n.call(t, "a");
|
|
19
|
+
if (r) {
|
|
20
|
+
if (l(r) || !f(r)) {
|
|
21
|
+
e.preventDefault(), e.stopPropagation();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer");
|
|
25
|
+
}
|
|
26
|
+
}, R = (e) => {
|
|
27
|
+
e.preventDefault(), e.stopPropagation();
|
|
28
|
+
}, s = /* @__PURE__ */ new WeakSet(), c = "guidoPreviewGuarded", g = () => ({ guardPreviewInteractions: (r) => {
|
|
4
29
|
try {
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
30
|
+
const t = r.contentDocument;
|
|
31
|
+
if (!t || s.has(t))
|
|
7
32
|
return;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
} catch (
|
|
12
|
-
console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:",
|
|
33
|
+
delete t.documentElement.dataset[c], E.forEach((n) => {
|
|
34
|
+
t.addEventListener(n, m, !0);
|
|
35
|
+
}), t.addEventListener("submit", R, !0), s.add(t), t.documentElement.dataset[c] = "true";
|
|
36
|
+
} catch (t) {
|
|
37
|
+
console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", t);
|
|
13
38
|
}
|
|
14
39
|
} });
|
|
15
40
|
export {
|
|
16
|
-
|
|
41
|
+
g as usePreviewInteractionGuard
|
|
17
42
|
};
|