@useinsider/guido 3.12.1-beta.3214ec4 → 3.13.0-beta.b66d46a
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 +16 -1
- package/dist/@types/config/schemas.js +27 -25
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +110 -101
- package/dist/components/organisms/header/ViewOptions.vue.js +1 -1
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
- package/dist/composables/useAllowlist.js +50 -0
- package/dist/composables/useSave.js +42 -23
- package/dist/composables/useStripo.js +72 -69
- package/dist/composables/useUserRole.js +12 -0
- package/dist/enums/roles.js +4 -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/controls/omnibusDiscount/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +12 -12
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +7 -7
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/guido.css +1 -1
- package/dist/services/allowlistApi.js +15 -0
- package/dist/services/stripoApi.js +18 -18
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/Guido.vue.d.ts +18 -2
- package/dist/src/composables/useAllowlist.d.ts +6 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useStripo.d.ts +3 -2
- package/dist/src/composables/useUserRole.d.ts +3 -0
- package/dist/src/enums/roles.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/controlFactories.d.ts +36 -0
- package/dist/src/services/allowlistApi.d.ts +4 -0
- package/dist/src/stores/config.d.ts +21 -1
- package/dist/static/styles/components/base-input.css.js +6 -7
- package/dist/stores/config.js +21 -19
- package/dist/utils/pairProductVariables.js +44 -43
- package/dist/{extensions/Blocks/Recommendation/utils → utils}/preserveTextStyles.js +1 -1
- package/package.json +2 -2
- /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
|
|
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
|
-
},
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
r([
|
|
42
|
+
l.EMAIL,
|
|
43
|
+
l.ARCHITECT,
|
|
44
|
+
l.UNSUBSCRIBE_PAGES
|
|
45
45
|
]),
|
|
46
|
-
|
|
46
|
+
l.EMAIL
|
|
47
47
|
),
|
|
48
48
|
/** Message type (promotional or transactional) */
|
|
49
49
|
messageType: e(
|
|
50
|
-
|
|
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
|
-
})),
|
|
79
|
+
})), E = k(
|
|
80
80
|
t(),
|
|
81
81
|
C(c(S), [])
|
|
82
|
-
),
|
|
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(
|
|
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(
|
|
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
|
-
}),
|
|
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({
|
|
@@ -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; 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 =
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
338
|
+
P as LegacyRecommendationConfigSchema,
|
|
337
339
|
d as MessageType,
|
|
338
340
|
L as PartnerSchema,
|
|
339
|
-
|
|
341
|
+
l as ProductType,
|
|
340
342
|
_ as RegexRuleSchema,
|
|
341
343
|
j as RemoveRuleSchema,
|
|
342
344
|
H as ReplaceRuleSchema,
|
|
343
|
-
|
|
345
|
+
D as TemplateMigrationSchema,
|
|
344
346
|
M as TemplateSchema,
|
|
345
347
|
x as UISchema
|
|
346
348
|
};
|
|
@@ -1,140 +1,149 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { provideGuidoActions as
|
|
4
|
-
import { useGuidoStateBridge as
|
|
5
|
-
import { usePartner as
|
|
6
|
-
import { useStripo as
|
|
7
|
-
import { useTimerClone as
|
|
8
|
-
import { migrate as
|
|
9
|
-
import { ModuleFolderDefaults as
|
|
10
|
-
import { RIBBON_SELECTOR as
|
|
11
|
-
import { useRecommendationExtensionStore as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useStripoApi as
|
|
20
|
-
import { useConfigStore as
|
|
21
|
-
import { useDynamicContentStore as
|
|
22
|
-
import { useEditorStore as
|
|
23
|
-
import { usePreviewStore as
|
|
24
|
-
import { useTemplateStore as
|
|
25
|
-
import { useUnsubscribeStore as
|
|
26
|
-
const
|
|
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(
|
|
33
|
-
const
|
|
33
|
+
setup(P, { expose: A, emit: n }) {
|
|
34
|
+
const i = P, W = M(
|
|
34
35
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
35
|
-
),
|
|
36
|
+
), x = M(
|
|
36
37
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
37
|
-
),
|
|
38
|
-
i.init(
|
|
39
|
-
const
|
|
40
|
-
var
|
|
41
|
-
return (
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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: (
|
|
77
|
-
const
|
|
78
|
-
console.debug("guido:save:complete",
|
|
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
|
|
85
|
-
console.debug("dynamic-content:close",
|
|
86
|
-
},
|
|
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
|
-
|
|
90
|
-
n("on-change",
|
|
81
|
+
B(() => m.value, () => {
|
|
82
|
+
n("on-change", m.value);
|
|
91
83
|
});
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
console.debug("dynamic-content:open",
|
|
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
|
|
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
|
-
|
|
109
|
-
const
|
|
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:
|
|
112
|
-
css:
|
|
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
|
-
|
|
115
|
-
} catch (
|
|
116
|
-
console.error("Failed to initialize Stripo editor:",
|
|
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",
|
|
119
|
-
}),
|
|
120
|
-
a == null || a.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
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
|
-
|
|
127
|
-
}),
|
|
135
|
+
o.reset();
|
|
136
|
+
}), A({
|
|
128
137
|
dynamicContent: {
|
|
129
|
-
insert:
|
|
130
|
-
close:
|
|
138
|
+
insert: L,
|
|
139
|
+
close: R
|
|
131
140
|
},
|
|
132
|
-
hasChanges:
|
|
133
|
-
saveSilent:
|
|
134
|
-
setLoading:
|
|
135
|
-
}), { __sfc: !0, PreviewContainer:
|
|
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
|
-
|
|
148
|
+
xe as default
|
|
140
149
|
};
|
|
@@ -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 = /"\/\//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
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 (
|
|
20
|
-
if (!await
|
|
22
|
+
if (a("liquidSyntax")) {
|
|
23
|
+
if (!await d(t.compiledHtml))
|
|
21
24
|
return;
|
|
22
|
-
} else if (!await
|
|
25
|
+
} else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
|
|
23
26
|
return;
|
|
24
|
-
if ((
|
|
27
|
+
if ((r = e.value) != null && r.externalValidation && !await e.value.externalValidation(t))
|
|
25
28
|
return;
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
50
|
+
$ as useSave
|
|
32
51
|
};
|