@useinsider/guido 3.12.1-beta.3214ec4 → 3.13.0-beta.ef18f66

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 (43) hide show
  1. package/README.md +16 -1
  2. package/dist/@types/config/schemas.js +27 -25
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +110 -101
  5. package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
  6. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
  7. package/dist/composables/useAllowlist.js +50 -0
  8. package/dist/composables/useSave.js +42 -23
  9. package/dist/composables/useStripo.js +72 -69
  10. package/dist/composables/useUserRole.js +12 -0
  11. package/dist/enums/roles.js +4 -0
  12. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  13. package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
  14. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +12 -12
  15. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +12 -12
  16. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  17. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +12 -12
  18. package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
  19. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
  20. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +7 -7
  21. package/dist/extensions/Blocks/controlFactories.js +125 -75
  22. package/dist/guido.css +1 -1
  23. package/dist/services/allowlistApi.js +15 -0
  24. package/dist/services/stripoApi.js +18 -18
  25. package/dist/src/@types/config/schemas.d.ts +10 -0
  26. package/dist/src/components/Guido.vue.d.ts +18 -2
  27. package/dist/src/composables/useAllowlist.d.ts +6 -0
  28. package/dist/src/composables/useConfig.d.ts +2 -0
  29. package/dist/src/composables/useStripo.d.ts +3 -2
  30. package/dist/src/composables/useUserRole.d.ts +3 -0
  31. package/dist/src/enums/roles.d.ts +9 -0
  32. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  33. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
  34. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  35. package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
  36. package/dist/src/services/allowlistApi.d.ts +4 -0
  37. package/dist/src/stores/config.d.ts +21 -1
  38. package/dist/static/styles/components/base-input.css.js +6 -7
  39. package/dist/stores/config.js +21 -19
  40. package/dist/utils/pairProductVariables.js +44 -43
  41. package/dist/{extensions/Blocks/Recommendation/utils → utils}/preserveTextStyles.js +1 -1
  42. package/package.json +2 -2
  43. /package/dist/src/{extensions/Blocks/Recommendation/utils → utils}/preserveTextStyles.d.ts +0 -0
package/README.md CHANGED
@@ -150,7 +150,7 @@ const config: GuidoConfigInput = {
150
150
  backButtonLabel?: string,
151
151
  },
152
152
 
153
- // Optional: Feature toggles
153
+ // Optional: Feature toggles (defaults apply once initialized — see `ready` prop below)
154
154
  features?: {
155
155
  dynamicContent?: boolean, // Default: true
156
156
  saveAsTemplate?: boolean, // Default: true
@@ -161,6 +161,7 @@ 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 (role lookup, deep-link, copy from window.trans).
164
165
  },
165
166
 
166
167
  // Optional: Callbacks
@@ -182,6 +183,19 @@ const config: GuidoConfigInput = {
182
183
  };
183
184
  ```
184
185
 
186
+ ### `ready` prop
187
+
188
+ ```vue
189
+ <Guido :config="config" :ready="isConfigLoaded" />
190
+ ```
191
+
192
+ Optional, defaults to `true` — existing call sites need no change. Pass `false` to mount
193
+ Guido *before* `config` is fetched: it preloads the ~8 MB editor runtime immediately and
194
+ defers config validation + editor init until `ready` flips to `true`.
195
+
196
+ `config` must be final at that flip (later mutations don't re-initialize), and the flip is
197
+ one-way. While `ready` is `false` every `features` toggle reads as disabled.
198
+
185
199
  ---
186
200
 
187
201
  ## Events
@@ -637,6 +651,7 @@ bun run lint
637
651
  VITE_STRIPO_PLUGIN_ID=your_plugin_id
638
652
  VITE_STRIPO_SECRET_KEY=your_secret_key
639
653
  VITE_STRIPO_ROLE=your_role
654
+ VITE_STRIPO_USER=your_user
640
655
  ```
641
656
 
642
657
  ---
@@ -1,11 +1,11 @@
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 r, pipe as p, minLength as b, custom as h, boolean as o, array as c, record as k, fallback as C, literal as i, looseObject as g, variant as R, union as f, unknown as s, lazy as T } from "../../node_modules/valibot/dist/index.js";
3
3
  const d = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
6
6
  /** Transactional/system emails */
7
7
  TRANSACTIONAL: 2
8
- }, r = {
8
+ }, l = {
9
9
  /** Standard email campaigns */
10
10
  EMAIL: 60,
11
11
  /** Architect journey builder */
@@ -38,16 +38,16 @@ const d = {
38
38
  ),
39
39
  /** Product type identifier */
40
40
  productType: e(
41
- l([
42
- r.EMAIL,
43
- r.ARCHITECT,
44
- r.UNSUBSCRIBE_PAGES
41
+ r([
42
+ l.EMAIL,
43
+ l.ARCHITECT,
44
+ l.UNSUBSCRIBE_PAGES
45
45
  ]),
46
- r.EMAIL
46
+ l.EMAIL
47
47
  ),
48
48
  /** Message type (promotional or transactional) */
49
49
  messageType: e(
50
- l([d.PROMOTIONAL, d.TRANSACTIONAL]),
50
+ r([d.PROMOTIONAL, d.TRANSACTIONAL]),
51
51
  d.PROMOTIONAL
52
52
  ),
53
53
  /** Display name for the current user */
@@ -76,14 +76,14 @@ const d = {
76
76
  children: e(c(S)),
77
77
  // eslint-disable-next-line camelcase -- backend field name
78
78
  select_items: e(c(S))
79
- })), P = k(
79
+ })), E = k(
80
80
  t(),
81
81
  C(c(S), [])
82
- ), D = g({
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
- decimalCount: e(h([t(), n()])),
86
+ decimalCount: e(f([t(), n()])),
87
87
  /** Pinned product IDs (empty array when filter-driven) */
88
88
  productIds: e(c(s())),
89
89
  /** Whether the block requested live products at send time */
@@ -117,14 +117,14 @@ const d = {
117
117
  /** Block type marker used by some legacy variants */
118
118
  blockType: e(t()),
119
119
  /** Size variant marker (legacy data may use string or number) */
120
- size: e(h([t(), n()])),
120
+ size: e(f([t(), n()])),
121
121
  /** Vertical responsiveness flag (legacy size=1 variants) */
122
122
  verticalResponsiveness: e(o()),
123
123
  /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
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({
@@ -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; Guido self-serves the block toaster) */
206
+ allowlistEnabled: e(o(), !1)
207
+ }), U = r([
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
+ ]), B = r([
220
222
  "dynamic-content",
221
223
  "checkbox-block",
222
224
  "radio-button-block",
@@ -269,7 +271,7 @@ const d = {
269
271
  ...m.entries,
270
272
  type: i("custom"),
271
273
  /** Custom processor function */
272
- processor: f(
274
+ processor: h(
273
275
  (u) => typeof u == "function",
274
276
  "processor must be a function"
275
277
  )
@@ -289,7 +291,7 @@ const d = {
289
291
  * Return false to cancel the save operation.
290
292
  */
291
293
  externalValidation: e(
292
- f(
294
+ h(
293
295
  (u) => typeof u == "function",
294
296
  "externalValidation must be a function"
295
297
  )
@@ -324,7 +326,7 @@ export {
324
326
  B as CustomBlockTypeSchema,
325
327
  q as CustomRuleSchema,
326
328
  U as DefaultBlockTypeSchema,
327
- P as DynamicContentListSchema,
329
+ E as DynamicContentListSchema,
328
330
  S as DynamicContentNodeSchema,
329
331
  v as DynamicContentSchema,
330
332
  O as EditorSchema,
@@ -333,14 +335,14 @@ export {
333
335
  F as FeaturesSchema,
334
336
  K as GuidoConfigSchema,
335
337
  A as IdentitySchema,
336
- D as LegacyRecommendationConfigSchema,
338
+ P as LegacyRecommendationConfigSchema,
337
339
  d as MessageType,
338
340
  L as PartnerSchema,
339
- r as ProductType,
341
+ l as ProductType,
340
342
  _ as RegexRuleSchema,
341
343
  j as RemoveRuleSchema,
342
344
  H as ReplaceRuleSchema,
343
- E as TemplateMigrationSchema,
345
+ D as TemplateMigrationSchema,
344
346
  M as TemplateSchema,
345
347
  x as UISchema
346
348
  };
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "50dac6de"
15
+ "5079a1c8"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,140 +1,149 @@
1
- import { defineComponent as X, defineAsyncComponent as I, ref as W, computed as x, watch as Y, onMounted as Z, onUnmounted as ee } from "vue";
2
- import { useCortexBlueprintBridge as oe } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as te } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as ne } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as re } from "../composables/usePartner.js";
6
- import { useStripo as se } from "../composables/useStripo.js";
7
- import { useTimerClone as ae } from "../composables/useTimerClone.js";
8
- import { migrate as G } from "../config/migrator/index.js";
9
- import { ModuleFolderDefaults as H } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as ce } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as ie } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import me from "./organisms/AutoSaveController.vue.js";
13
- import de from "./organisms/base/Toaster.vue.js";
14
- import le from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import ue from "./organisms/header/HeaderWrapper.vue.js";
16
- import pe from "./organisms/LoadingWrapper.vue.js";
17
- import fe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import ve from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as Se } from "../services/stripoApi.js";
20
- import { useConfigStore as ye } from "../stores/config.js";
21
- import { useDynamicContentStore as he } from "../stores/dynamic-content.js";
22
- import { useEditorStore as $ } from "../stores/editor.js";
23
- import { usePreviewStore as ge } from "../stores/preview.js";
24
- import { useTemplateStore as be } from "../stores/template.js";
25
- import { useUnsubscribeStore as Ee } from "../stores/unsubscribe.js";
26
- const Ve = /* @__PURE__ */ X({
1
+ import { defineComponent as q, defineAsyncComponent as M, ref as U, computed as _, watch as B, onMounted as K, onUnmounted as V } from "vue";
2
+ import { useCortexBlueprintBridge as j } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as J } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as Q } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as X } from "../composables/usePartner.js";
6
+ import { useStripo as Y } from "../composables/useStripo.js";
7
+ import { useTimerClone as Z } from "../composables/useTimerClone.js";
8
+ import { migrate as I } from "../config/migrator/index.js";
9
+ import { ModuleFolderDefaults as N } from "../enums/defaults.js";
10
+ import { RIBBON_SELECTOR as ee } from "../enums/onboarding.js";
11
+ import { useRecommendationExtensionStore as te } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
+ import oe from "./organisms/AutoSaveController.vue.js";
13
+ import ne from "./organisms/base/Toaster.vue.js";
14
+ import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
+ import se from "./organisms/header/HeaderWrapper.vue.js";
16
+ import ie from "./organisms/LoadingWrapper.vue.js";
17
+ import ae from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
+ import ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
+ import { useStripoApi as de } from "../services/stripoApi.js";
20
+ import { useConfigStore as me } from "../stores/config.js";
21
+ import { useDynamicContentStore as le } from "../stores/dynamic-content.js";
22
+ import { useEditorStore as O } from "../stores/editor.js";
23
+ import { usePreviewStore as ue } from "../stores/preview.js";
24
+ import { useTemplateStore as pe } from "../stores/template.js";
25
+ import { useUnsubscribeStore as fe } from "../stores/unsubscribe.js";
26
+ const xe = /* @__PURE__ */ q({
27
27
  __name: "Guido",
28
28
  props: {
29
- config: null
29
+ config: null,
30
+ ready: { type: Boolean, default: !0 }
30
31
  },
31
32
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
32
- setup(z, { expose: q, emit: n }) {
33
- const b = z, K = I(
33
+ setup(P, { expose: A, emit: n }) {
34
+ const i = P, W = M(
34
35
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
35
- ), V = I(
36
+ ), x = M(
36
37
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
37
- ), E = W(), p = W(), f = he(), w = Ee(), i = ye();
38
- i.init(b.config);
39
- const m = $(), j = ge(), d = x(() => m.hasChanges), { isTestPartner: J } = re(), D = () => {
40
- var e;
41
- return (e = E.value) == null ? void 0 : e.handleSave(!0);
42
- }, C = (e) => {
43
- m.loadingStatus = e;
44
- }, {
45
- templateId: v,
46
- userId: T,
47
- partnerName: L,
48
- username: k,
49
- template: o,
50
- editor: s
51
- } = i, l = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", S = (o == null ? void 0 : o.preselectedDynamicContent) || [], U = (s == null ? void 0 : s.savedModulesFolderName) || H.SAVED_MODULES, _ = (s == null ? void 0 : s.defaultModulesFolderName) || H.DEFAULT_MODULES;
52
- oe(), ne();
53
- const y = {
54
- emailId: v,
55
- userId: T,
56
- username: k,
57
- partnerName: L,
58
- savedModulesFolderName: U,
59
- defaultModulesFolderName: _
60
- }, M = {
61
- preselectedDynamicContentList: S,
62
- onReady: () => {
63
- console.debug("guido:ready"), n("ready");
64
- }
65
- }, { initPlugin: O } = se(y, M), { getDefaultTemplate: P } = Se(), { cloneTimersOnSave: R, hasTimerBlocks: A } = ae(), Q = x(() => {
66
- var e;
67
- return !((e = i.ui) != null && e.showHeader);
38
+ ), g = U(), l = U(), u = le(), S = fe(), o = me();
39
+ i.ready && o.init(i.config);
40
+ const d = O(), G = ue(), m = _(() => d.hasChanges), { isTestPartner: H } = X(), h = () => {
41
+ var t;
42
+ return (t = g.value) == null ? void 0 : t.handleSave(!0);
43
+ }, b = (t) => {
44
+ d.loadingStatus = t;
45
+ };
46
+ j(), Q();
47
+ const p = () => {
48
+ var t, e;
49
+ return {
50
+ emailId: o.templateId,
51
+ userId: o.userId,
52
+ username: o.username,
53
+ partnerName: o.partnerName,
54
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
55
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
56
+ };
57
+ }, { initPlugin: E, preloadRuntime: w } = Y(), { getDefaultTemplate: C } = de(), { cloneTimersOnSave: D, hasTimerBlocks: T } = Z(), $ = _(() => {
58
+ var t;
59
+ return !((t = o.ui) != null && t.showHeader);
68
60
  });
69
- te({
61
+ J({
70
62
  onBack: () => {
71
63
  console.debug("guido:back"), n("back");
72
64
  },
73
65
  onSaveStart: () => {
74
66
  console.debug("guido:save:start"), n("save:start");
75
67
  },
76
- onSaveComplete: (e) => {
77
- const t = { ...e, metadata: y };
78
- console.debug("guido:save:complete", t), n("save:complete", t);
68
+ onSaveComplete: (t) => {
69
+ const e = { ...t, metadata: p() };
70
+ console.debug("guido:save:complete", e), n("save:complete", e);
79
71
  },
80
72
  onTestEmailClick: () => {
81
73
  console.debug("guido:test-email:click"), n("test-email:click");
82
74
  }
83
75
  });
84
- const B = (e) => {
85
- console.debug("dynamic-content:close", e), f.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
86
- }, N = () => {
76
+ const L = (t) => {
77
+ console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
78
+ }, R = () => {
87
79
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
88
80
  };
89
- Y(() => d.value, () => {
90
- n("on-change", d.value);
81
+ B(() => m.value, () => {
82
+ n("on-change", m.value);
91
83
  });
92
- const h = (e) => {
93
- const t = e, { attribute: u, position: c } = t.detail;
94
- console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", u, c);
84
+ const f = (t) => {
85
+ const e = t, { attribute: s, position: c } = e.detail;
86
+ console.debug("dynamic-content:open", e.detail), n("dynamic-content:open", s, c);
95
87
  };
96
88
  let a = null;
97
- const g = () => {
89
+ const y = () => {
90
+ var e;
91
+ const t = document.querySelector(ee);
92
+ (e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
93
+ }, v = async () => {
98
94
  var t;
99
- const e = document.querySelector(ce);
100
- (t = p.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
101
- };
102
- return Z(async () => {
103
- var t, u;
104
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ie().$reset(), $().$reset(), m.templateId = v, be().$reset(), g();
105
- const e = (t = p.value) == null ? void 0 : t.parentElement;
106
- e && (a = new ResizeObserver(g), a.observe(e));
107
95
  try {
108
- w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
109
- const c = ((u = o == null ? void 0 : o.migration) == null ? void 0 : u.recommendationConfigs) ?? {};
96
+ o.initialized || o.init(i.config), d.templateId = o.templateId;
97
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", c = (e == null ? void 0 : e.css) || "", k = (e == null ? void 0 : e.preselectedDynamicContent) || [];
98
+ S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
99
+ const F = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {};
110
100
  let r = {
111
- html: l && await G(l, c),
112
- css: F
101
+ html: s && await I(s, F),
102
+ css: c
103
+ };
104
+ r.html || (r = await C(), r.html = await I(r.html, F)), T(r.html) && (r.html = await D(r.html));
105
+ const z = {
106
+ preselectedDynamicContentList: k,
107
+ onReady: () => {
108
+ console.debug("guido:ready"), n("ready");
109
+ }
113
110
  };
114
- r.html || (r = await P(), r.html = await G(r.html, c)), A(r.html) && (r.html = await R(r.html)), await O(r), f.selectedDynamicContentList = S;
115
- } catch (c) {
116
- console.error("Failed to initialize Stripo editor:", c);
111
+ await E(r, p(), z), u.selectedDynamicContentList = k;
112
+ } catch (e) {
113
+ console.error("Failed to initialize Stripo editor:", e);
114
+ }
115
+ };
116
+ return K(async () => {
117
+ var e;
118
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), te().$reset(), O().$reset(), pe().$reset(), y();
119
+ const t = (e = l.value) == null ? void 0 : e.parentElement;
120
+ if (t && (a = new ResizeObserver(y), a.observe(t)), w(), i.ready)
121
+ await v();
122
+ else {
123
+ const s = B(() => i.ready, (c) => {
124
+ c && (s(), v());
125
+ });
117
126
  }
118
- document.addEventListener("dynamic-content:open", h);
119
- }), ee(() => {
120
- a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", h);
127
+ document.addEventListener("dynamic-content:open", f);
128
+ }), V(() => {
129
+ a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", f);
121
130
  try {
122
131
  window.UIEditor.removeEditor();
123
132
  } catch {
124
133
  console.debug("Failed to remove Stripo editor: No editor found");
125
134
  }
126
- i.reset();
127
- }), q({
135
+ o.reset();
136
+ }), A({
128
137
  dynamicContent: {
129
- insert: B,
130
- close: N
138
+ insert: L,
139
+ close: R
131
140
  },
132
- hasChanges: d,
133
- saveSilent: D,
134
- setLoading: C
135
- }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: b, configStore: i, editorStore: m, previewStore: j, hasChanges: d, isTestPartner: J, saveSilent: D, setLoading: C, templateId: v, userId: T, partnerName: L, username: k, templateConfig: o, editorConfig: s, html: l, css: F, preselectedDynamicContentList: S, savedModulesFolderName: U, defaultModulesFolderName: _, emit: n, metadata: y, options: M, initPlugin: O, getDefaultTemplate: P, cloneTimersOnSave: R, hasTimerBlocks: A, noHeader: Q, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: h, ribbonObserver: a, updateRibbonOffset: g, AutoSaveController: me, Toaster: de, FilterSelectionDrawer: le, HeaderWrapper: ue, LoadingWrapper: pe, SaveAsTemplateDrawer: fe, UnsubscribeWrapper: ve };
141
+ hasChanges: m,
142
+ saveSilent: h,
143
+ setLoading: b
144
+ }), { __sfc: !0, PreviewContainer: W, OnboardingWrapper: x, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: i, configStore: o, editorStore: d, previewStore: G, hasChanges: m, isTestPartner: H, saveSilent: h, setLoading: b, emit: n, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: C, cloneTimersOnSave: D, hasTimerBlocks: T, noHeader: $, insertDynamicContent: L, closeDynamicContent: R, handleDynamicContentOpen: f, ribbonObserver: a, updateRibbonOffset: y, startEditor: v, AutoSaveController: oe, Toaster: ne, FilterSelectionDrawer: re, HeaderWrapper: se, LoadingWrapper: ie, SaveAsTemplateDrawer: ae, UnsubscribeWrapper: ce };
136
145
  }
137
146
  });
138
147
  export {
139
- Ve as default
148
+ xe as default
140
149
  };
@@ -10,9 +10,9 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "195ab6d4"
13
+ "10599c37"
14
14
  );
15
- const c = a.exports;
15
+ const d = a.exports;
16
16
  export {
17
- c as default
17
+ d as default
18
18
  };
@@ -10,7 +10,7 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "d405ca59"
13
+ "38eb0a73"
14
14
  );
15
15
  const d = a.exports;
16
16
  export {
@@ -0,0 +1,50 @@
1
+ import { useAllowlistApi as A } from "../services/allowlistApi.js";
2
+ import { base64EncodeWithSpecialChars as p } from "../utils/base64.js";
3
+ import { useTranslations as h } from "./useTranslations.js";
4
+ import { useUserRole as D } from "./useUserRole.js";
5
+ const f = /(?:https?:\/\/|www\.)[^\s"'<>()]+/gi, E = /&quot;\/\//gi, i = {
6
+ MANAGE: "journey-builder.domain-allowlist-warning",
7
+ NON_MANAGE: "settings.allow-list-warning-not-admin-architect",
8
+ ADD_BUTTON: "settings.allow-list-warning-add-button"
9
+ }, w = /* @__PURE__ */ new Set(), O = (n) => `/settings?openAddModal=true&type=domain&values=${p(n)}#security`, M = () => {
10
+ const { checkDomain: n } = A(), { getIsManageUser: l } = D(), a = h(), d = (t, s) => {
11
+ const c = `${t || ""} ${s || ""}`.replace(E, "https://").match(f) || [], e = /* @__PURE__ */ new Set();
12
+ return c.forEach((r) => {
13
+ const g = /^https?:\/\//i.test(r) ? r : `https://${r}`;
14
+ try {
15
+ const { hostname: u } = new URL(g);
16
+ u && e.add(u.replace(/^www\./i, "").toLowerCase());
17
+ } catch {
18
+ }
19
+ }), [...e];
20
+ }, m = async (t) => {
21
+ if (w.has(t))
22
+ return !0;
23
+ try {
24
+ const s = await n(t);
25
+ return s && w.add(t), s;
26
+ } catch (s) {
27
+ return console.error("[GUIDO_ALLOWLIST] isDomainAllowlisted failed", t, s), !0;
28
+ }
29
+ };
30
+ return { getBlockedDomains: async (t, s) => {
31
+ try {
32
+ const o = d(t, s);
33
+ return o.length ? (await Promise.all(
34
+ o.map(async (e) => ({ domain: e, allowlisted: await m(e) }))
35
+ )).filter((e) => !e.allowlisted).map((e) => e.domain) : [];
36
+ } catch (o) {
37
+ return console.error("[GUIDO_ALLOWLIST] getBlockedDomains failed", o), [];
38
+ }
39
+ }, resolveToast: async (t) => await l() ? {
40
+ message: a(i.MANAGE),
41
+ actionButton: {
42
+ text: a(i.ADD_BUTTON),
43
+ onClick: () => window.open(O(t.join(",")), "_blank")
44
+ }
45
+ } : { message: a(i.NON_MANAGE) } };
46
+ };
47
+ export {
48
+ O as buildAllowlistSettingsUrl,
49
+ M as useAllowlist
50
+ };
@@ -1,32 +1,51 @@
1
- import { useActionsApi as H } from "./useActionsApi.js";
2
- import { useConfig as y } from "./useConfig.js";
3
- import { useSaveStart as w, useSaveComplete as k } from "./useGuidoActions.js";
1
+ import { useActionsApi as T } from "./useActionsApi.js";
2
+ import { useConfig as k } from "./useConfig.js";
3
+ import { useSaveStart as B, useSaveComplete as E } from "./useGuidoActions.js";
4
4
  import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
5
- import { useStripoApi as C } from "../services/stripoApi.js";
6
- import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as B } from "./useHtmlValidator.js";
8
- import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
- import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
- import { useUnsubscribeBlockValidator as U } from "./validators/useUnsubscribeBlockValidator.js";
11
- const K = () => {
12
- const o = w(), s = k(), { validateHtml: r } = B(), { validateLiquidSyntax: l } = P(), { validateCouponBlockTags: n } = L(), { validateUnsubscribeBlockUniqueness: d, validateUnsubscribeBlockHasTemplate: c } = U(), { callbacks: i, isFeatureEnabled: u } = y(), { extractSyncModuleData: m } = q(), { setSyncModuleUnsubscriptionPages: p } = C(), { editorSave: v } = H();
13
- return { save: async (f = !1, S = !1) => {
14
- var a;
15
- o();
16
- const { prepareTemplateDetails: V } = E(), t = await V();
17
- if (!n(t.compiledHtml) || !d(t.compiledHtml) || !c(t.compiledHtml))
5
+ import { ToasterTypeOptions as C } from "../enums/toaster.js";
6
+ import { useStripoApi as D } from "../services/stripoApi.js";
7
+ import { useTemplatePreparation as L } from "../utils/templatePreparation.js";
8
+ import { useAllowlist as P } from "./useAllowlist.js";
9
+ import { useHtmlValidator as U } from "./useHtmlValidator.js";
10
+ import { useToaster as A } from "./useToaster.js";
11
+ import { useCouponBlockValidator as M } from "./validators/useCouponBlockValidator.js";
12
+ import { useLiquidValidator as h } from "./validators/useLiquidValidator.js";
13
+ import { useUnsubscribeBlockValidator as F } from "./validators/useUnsubscribeBlockValidator.js";
14
+ const $ = () => {
15
+ const n = B(), l = E(), { validateHtml: c } = U(), { validateLiquidSyntax: d } = h(), { validateCouponBlockTags: m } = M(), { validateUnsubscribeBlockUniqueness: u, validateUnsubscribeBlockHasTemplate: p } = F(), { callbacks: e, isFeatureEnabled: a } = k(), { extractSyncModuleData: f } = q(), { setSyncModuleUnsubscriptionPages: v } = D(), { editorSave: S } = T(), { showToaster: b } = A(), { getBlockedDomains: w, resolveToast: V } = P();
16
+ return { save: async (y = !1, s = !1) => {
17
+ var r;
18
+ n();
19
+ const { prepareTemplateDetails: H } = L(), t = await H();
20
+ if (!m(t.compiledHtml) || !u(t.compiledHtml) || !p(t.compiledHtml))
18
21
  return;
19
- if (u("liquidSyntax")) {
20
- if (!await l(t.compiledHtml))
22
+ if (a("liquidSyntax")) {
23
+ if (!await d(t.compiledHtml))
21
24
  return;
22
- } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
25
+ } else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
23
26
  return;
24
- if ((a = i.value) != null && a.externalValidation && !await i.value.externalValidation(t) || !await v())
27
+ if ((r = e.value) != null && r.externalValidation && !await e.value.externalValidation(t))
25
28
  return;
26
- const { unsubscribePayload: b, stripoModules: x } = m(t.rawHtml);
27
- return await p(b), t.modules = x, f || s({ ...t, silent: S }), t;
29
+ if (a("allowlistEnabled")) {
30
+ const i = await w(t.compiledHtml, t.css);
31
+ if (i.length) {
32
+ if (!s) {
33
+ const o = await V(i);
34
+ o != null && o.message && b({
35
+ type: C.Warning,
36
+ message: o.message,
37
+ actionButton: o.actionButton
38
+ });
39
+ }
40
+ return;
41
+ }
42
+ }
43
+ if (!await S())
44
+ return;
45
+ const { unsubscribePayload: g, stripoModules: x } = f(t.rawHtml);
46
+ return await v(g), t.modules = x, y || l({ ...t, silent: s }), t;
28
47
  } };
29
48
  };
30
49
  export {
31
- K as useSave
50
+ $ as useSave
32
51
  };