@useinsider/guido 3.12.0-beta.4e0547f → 3.12.0-beta.66af948
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 +1 -0
- package/dist/@types/config/schemas.js +27 -25
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +101 -110
- package/dist/composables/useAllowlist.js +50 -0
- package/dist/composables/useSave.js +42 -23
- package/dist/composables/useStripo.js +69 -72
- package/dist/composables/useUserRole.js +12 -0
- package/dist/enums/roles.js +4 -0
- 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 +15 -0
- package/dist/src/components/Guido.vue.d.ts +2 -18
- package/dist/src/composables/useAllowlist.d.ts +18 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useStripo.d.ts +2 -3
- package/dist/src/composables/useUserRole.d.ts +9 -0
- package/dist/src/enums/roles.d.ts +9 -0
- package/dist/src/services/allowlistApi.d.ts +10 -0
- package/dist/src/stores/config.d.ts +19 -3
- package/dist/static/styles/components/base-input.css.js +6 -7
- package/dist/stores/config.js +19 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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
|
|
@@ -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,149 +1,140 @@
|
|
|
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 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({
|
|
27
27
|
__name: "Guido",
|
|
28
28
|
props: {
|
|
29
|
-
config: null
|
|
30
|
-
ready: { type: Boolean, default: !0 }
|
|
29
|
+
config: null
|
|
31
30
|
},
|
|
32
31
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
33
|
-
setup(
|
|
34
|
-
const
|
|
32
|
+
setup(z, { expose: q, emit: n }) {
|
|
33
|
+
const b = z, K = I(
|
|
35
34
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
36
|
-
),
|
|
35
|
+
), V = I(
|
|
37
36
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
38
|
-
),
|
|
39
|
-
i.
|
|
40
|
-
const
|
|
41
|
-
var
|
|
42
|
-
return (
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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);
|
|
60
68
|
});
|
|
61
|
-
|
|
69
|
+
te({
|
|
62
70
|
onBack: () => {
|
|
63
71
|
console.debug("guido:back"), n("back");
|
|
64
72
|
},
|
|
65
73
|
onSaveStart: () => {
|
|
66
74
|
console.debug("guido:save:start"), n("save:start");
|
|
67
75
|
},
|
|
68
|
-
onSaveComplete: (
|
|
69
|
-
const
|
|
70
|
-
console.debug("guido:save:complete",
|
|
76
|
+
onSaveComplete: (e) => {
|
|
77
|
+
const t = { ...e, metadata: y };
|
|
78
|
+
console.debug("guido:save:complete", t), n("save:complete", t);
|
|
71
79
|
},
|
|
72
80
|
onTestEmailClick: () => {
|
|
73
81
|
console.debug("guido:test-email:click"), n("test-email:click");
|
|
74
82
|
}
|
|
75
83
|
});
|
|
76
|
-
const
|
|
77
|
-
console.debug("dynamic-content:close",
|
|
78
|
-
},
|
|
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 = () => {
|
|
79
87
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
80
88
|
};
|
|
81
|
-
|
|
82
|
-
n("on-change",
|
|
89
|
+
Y(() => d.value, () => {
|
|
90
|
+
n("on-change", d.value);
|
|
83
91
|
});
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
console.debug("dynamic-content:open",
|
|
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);
|
|
87
95
|
};
|
|
88
96
|
let a = null;
|
|
89
|
-
const
|
|
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 () => {
|
|
97
|
+
const g = () => {
|
|
94
98
|
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));
|
|
95
107
|
try {
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
99
|
-
const F = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {};
|
|
108
|
+
w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
109
|
+
const c = ((u = o == null ? void 0 : o.migration) == null ? void 0 : u.recommendationConfigs) ?? {};
|
|
100
110
|
let r = {
|
|
101
|
-
html:
|
|
102
|
-
css:
|
|
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
|
-
}
|
|
111
|
+
html: l && await G(l, c),
|
|
112
|
+
css: F
|
|
110
113
|
};
|
|
111
|
-
await
|
|
112
|
-
} catch (
|
|
113
|
-
console.error("Failed to initialize Stripo editor:",
|
|
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
|
-
});
|
|
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);
|
|
126
117
|
}
|
|
127
|
-
document.addEventListener("dynamic-content:open",
|
|
128
|
-
}),
|
|
129
|
-
a == null || a.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
118
|
+
document.addEventListener("dynamic-content:open", h);
|
|
119
|
+
}), ee(() => {
|
|
120
|
+
a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", h);
|
|
130
121
|
try {
|
|
131
122
|
window.UIEditor.removeEditor();
|
|
132
123
|
} catch {
|
|
133
124
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
134
125
|
}
|
|
135
|
-
|
|
136
|
-
}),
|
|
126
|
+
i.reset();
|
|
127
|
+
}), q({
|
|
137
128
|
dynamicContent: {
|
|
138
|
-
insert:
|
|
139
|
-
close:
|
|
129
|
+
insert: B,
|
|
130
|
+
close: N
|
|
140
131
|
},
|
|
141
|
-
hasChanges:
|
|
142
|
-
saveSilent:
|
|
143
|
-
setLoading:
|
|
144
|
-
}), { __sfc: !0, PreviewContainer:
|
|
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 };
|
|
145
136
|
}
|
|
146
137
|
});
|
|
147
138
|
export {
|
|
148
|
-
|
|
139
|
+
Ve as default
|
|
149
140
|
};
|
|
@@ -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
|
};
|