@useinsider/guido 3.12.0-beta.ea5b317 → 3.12.0-beta.eb4ca1c

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.
Files changed (38) hide show
  1. package/README.md +5 -0
  2. package/dist/@types/config/schemas.js +64 -50
  3. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
  4. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
  5. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  6. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
  7. package/dist/composables/useAllowlistToast.js +21 -0
  8. package/dist/composables/usePreviewInteractionGuard.js +36 -11
  9. package/dist/composables/useRecommendationPreview.js +61 -60
  10. package/dist/composables/useSave.js +44 -24
  11. package/dist/composables/useUserRole.js +13 -0
  12. package/dist/composables/validators/useAllowlistValidator.js +31 -0
  13. package/dist/enums/roles.js +4 -0
  14. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  15. package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
  16. package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
  17. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
  18. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
  19. package/dist/extensions/Blocks/controlFactories.js +125 -75
  20. package/dist/guido.css +1 -1
  21. package/dist/services/stripoApi.js +18 -18
  22. package/dist/src/@types/config/schemas.d.ts +32 -0
  23. package/dist/src/composables/useAllowlistToast.d.ts +17 -0
  24. package/dist/src/composables/useConfig.d.ts +4 -0
  25. package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
  26. package/dist/src/composables/useUserRole.d.ts +8 -0
  27. package/dist/src/composables/validators/useAllowlistValidator.d.ts +9 -0
  28. package/dist/src/enums/roles.d.ts +9 -0
  29. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
  31. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  32. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
  33. package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
  34. package/dist/src/stores/config.d.ts +36 -0
  35. package/dist/src/utils/urlSchemes.d.ts +6 -0
  36. package/dist/static/styles/components/base-input.css.js +6 -7
  37. package/dist/utils/urlSchemes.js +4 -0
  38. package/package.json +1 -1
package/README.md CHANGED
@@ -161,11 +161,16 @@ 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). Guido self-serves the block toaster (see below).
164
165
  },
165
166
 
166
167
  // Optional: Callbacks
167
168
  callbacks?: {
168
169
  externalValidation?: (data: SavedTemplateDetails) => Promise<boolean>, // Return false to cancel save
170
+ // OPTIONAL override for the allowlist block toaster. By default Guido self-serves it: it resolves the user
171
+ // role via /get-user-role-and-email, builds the settings deep-link, and reads copy from window.trans — so
172
+ // consumers only set features.allowlistEnabled. Supply this only to replace that content; null/void keeps the default.
173
+ resolveAllowlistToast?: (blockedDomains: string[]) => { message: string, actionButton?: { text: string, onClick: () => void } } | null | void,
169
174
  },
170
175
 
171
176
  // 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 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";
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
- }), L = a({
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
- l([
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
- l([d.PROMOTIONAL, d.TRANSACTIONAL]),
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
- }), v = a({
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
- }), S = T(() => g({
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(S)),
76
+ children: e(c(f)),
77
77
  // eslint-disable-next-line camelcase -- backend field name
78
- select_items: e(c(S))
79
- })), P = k(
78
+ select_items: e(c(f))
79
+ })), E = k(
80
80
  t(),
81
- C(c(S), [])
82
- ), D = g({
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(s())),
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(s())),
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(s()),
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(s())),
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
- }), E = a({
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(), D),
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(v),
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(P, {}),
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(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
- }), U = l([
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
- ]), B = l([
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
- ]), w = a({
229
+ ]), B = a({
228
230
  /** Default blocks to exclude from the editor */
229
231
  excludeDefaults: e(
230
- c(U),
232
+ c(w),
231
233
  []
232
234
  ),
233
235
  /** Custom blocks to include in the editor */
234
236
  includeCustoms: e(
235
- c(B),
237
+ c(U),
236
238
  []
237
239
  )
238
- }), m = a({
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
- ...m.entries,
247
- type: i("replace"),
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
- ...m.entries,
256
- type: i("regex"),
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
- ...m.entries,
265
- type: i("remove"),
266
+ ...u.entries,
267
+ type: m("remove"),
266
268
  /** Strings or patterns to remove */
267
269
  targets: c(t())
268
270
  }), q = a({
269
- ...m.entries,
270
- type: i("custom"),
271
+ ...u.entries,
272
+ type: m("custom"),
271
273
  /** Custom processor function */
272
- processor: f(
273
- (u) => typeof u == "function",
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,29 @@ const d = {
289
291
  * Return false to cancel the save operation.
290
292
  */
291
293
  externalValidation: e(
292
- f(
293
- (u) => typeof u == "function",
294
+ S(
295
+ (s) => typeof s == "function",
294
296
  "externalValidation must be a function"
295
297
  )
298
+ ),
299
+ /**
300
+ * OPTIONAL override for the domain-allowlist block toaster (features.allowlistEnabled). By
301
+ * default Guido self-serves the toaster — resolves the user role via /get-user-role-and-email,
302
+ * builds the settings deep-link, and reads copy from window.trans — so consumers only flip the
303
+ * flag. Supply this only to replace that content. Returning null/void keeps Guido's default.
304
+ */
305
+ resolveAllowlistToast: e(
306
+ S(
307
+ (s) => typeof s == "function",
308
+ "resolveAllowlistToast must be a function"
309
+ )
296
310
  )
297
311
  }), K = a({
298
312
  // Required sections
299
313
  /** Identity configuration (required) */
300
314
  identity: A,
301
315
  /** Partner configuration (required) */
302
- partner: L,
316
+ partner: v,
303
317
  // Optional sections (with defaults)
304
318
  /** Template content and presets */
305
319
  template: e(M, {}),
@@ -310,37 +324,37 @@ const d = {
310
324
  /** Feature toggles */
311
325
  features: e(F, {}),
312
326
  /** Block configuration */
313
- blocks: e(w, {}),
327
+ blocks: e(B, {}),
314
328
  /** Compiler configuration */
315
329
  compiler: e(V, {}),
316
330
  /** Callbacks and event handlers */
317
331
  callbacks: e(z, {})
318
332
  });
319
333
  export {
320
- w as BlocksSchema,
334
+ B as BlocksSchema,
321
335
  z as CallbacksSchema,
322
336
  G as CompilerRuleSchema,
323
337
  V as CompilerSchema,
324
- B as CustomBlockTypeSchema,
338
+ U as CustomBlockTypeSchema,
325
339
  q as CustomRuleSchema,
326
- U as DefaultBlockTypeSchema,
327
- P as DynamicContentListSchema,
328
- S as DynamicContentNodeSchema,
329
- v as DynamicContentSchema,
340
+ w as DefaultBlockTypeSchema,
341
+ E as DynamicContentListSchema,
342
+ f as DynamicContentNodeSchema,
343
+ L as DynamicContentSchema,
330
344
  O as EditorSchema,
331
345
  N as EmailHeaderSchema,
332
346
  I as FallbackFontSchema,
333
347
  F as FeaturesSchema,
334
348
  K as GuidoConfigSchema,
335
349
  A as IdentitySchema,
336
- D as LegacyRecommendationConfigSchema,
350
+ P as LegacyRecommendationConfigSchema,
337
351
  d as MessageType,
338
- L as PartnerSchema,
352
+ v as PartnerSchema,
339
353
  r as ProductType,
340
354
  _ as RegexRuleSchema,
341
355
  j as RemoveRuleSchema,
342
356
  H as ReplaceRuleSchema,
343
- E as TemplateMigrationSchema,
357
+ D as TemplateMigrationSchema,
344
358
  M as TemplateSchema,
345
359
  x as UISchema
346
360
  };
@@ -15,7 +15,7 @@ var a = function() {
15
15
  i,
16
16
  !1,
17
17
  null,
18
- "06afaecb"
18
+ "cf946232"
19
19
  );
20
20
  const f = n.exports;
21
21
  export {
@@ -1,24 +1,24 @@
1
- import { defineComponent as u, ref as a, onMounted as p, onBeforeUnmount as l, nextTick as v } from "vue";
2
- import { usePreviewInteractionGuard as d } from "../../../../composables/usePreviewInteractionGuard.js";
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(k) {
9
- const i = _(), { blockPreviewInteractions: t } = d(), o = a(), n = a(!1), c = w();
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
- }, r = () => {
13
+ }, n = () => {
14
14
  o.value && (e = new ResizeObserver(() => {
15
- }), e.observe(o.value), v(() => {
16
- n.value = !0;
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(r), l(s), { __sfc: !0, trans: i, blockPreviewInteractions: t, containerRef: o, isContainerReady: n, previewStore: c, resizeObserver: e, onIframeLoad: f, initIframe: r, cleanIframe: s, DesktopBrowserHeader: I };
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 c = function() {
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
- }, o = [], i = /* @__PURE__ */ n(
9
+ }, i = [], r = /* @__PURE__ */ n(
10
10
  e,
11
- c,
12
11
  o,
12
+ i,
13
13
  !1,
14
14
  null,
15
- "cbafc185"
15
+ "f255b2bb"
16
16
  );
17
- const d = i.exports;
17
+ const d = r.exports;
18
18
  export {
19
19
  d as default
20
20
  };
@@ -1,24 +1,24 @@
1
- import { defineComponent as m, ref as a } from "vue";
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 P } from "@useinsider/design-system-vue";
7
- const g = /* @__PURE__ */ m({
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 c = u(), t = v(), r = a(), { setupResponsivePreview: n } = p(), { blockPreviewInteractions: s } = f(), i = (e) => {
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: c, previewStore: t, iframeRef: r, setupResponsivePreview: n, blockPreviewInteractions: s, clearAMPTransforms: i, onLoad: () => {
17
- const e = r.value, o = e == null ? void 0 : e.contentDocument;
18
- o && (n(e), s(e), t.isAMPResponsive && i(o));
19
- }, InIcons: P };
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
- g as default
23
+ b as default
24
24
  };
@@ -0,0 +1,21 @@
1
+ import { base64EncodeWithSpecialChars as o } from "../utils/base64.js";
2
+ import { useTranslations as a } from "./useTranslations.js";
3
+ import { useUserRole as i } from "./useUserRole.js";
4
+ const s = {
5
+ MANAGE: "journey-builder.domain-allowlist-warning",
6
+ NON_MANAGE: "settings.allow-list-warning-not-admin-architect",
7
+ ADD_BUTTON: "settings.allow-list-warning-add-button"
8
+ }, l = (t) => `/settings?openAddModal=true&type=domain&values=${o(t)}#security`, w = () => {
9
+ const t = a(), { getIsManageUser: n } = i();
10
+ return { resolveAllowlistToast: async (e) => await n() ? {
11
+ message: t(s.MANAGE),
12
+ actionButton: {
13
+ text: t(s.ADD_BUTTON),
14
+ onClick: () => window.open(l(e.join(",")), "_blank")
15
+ }
16
+ } : { message: t(s.NON_MANAGE) } };
17
+ };
18
+ export {
19
+ l as buildAllowlistSettingsUrl,
20
+ w as useAllowlistToast
21
+ };
@@ -1,17 +1,42 @@
1
- const o = ["click", "auxclick", "submit"], c = (t) => {
2
- t.preventDefault(), t.stopPropagation();
3
- }, a = () => ({ blockPreviewInteractions: (r) => {
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 e = r.contentDocument;
6
- if (!e)
30
+ const t = r.contentDocument;
31
+ if (!t || s.has(t))
7
32
  return;
8
- o.forEach((n) => {
9
- e.addEventListener(n, c, !0);
10
- });
11
- } catch (e) {
12
- console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", e);
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
- a as usePreviewInteractionGuard
41
+ g as usePreviewInteractionGuard
17
42
  };