@useinsider/guido 3.24.0-beta.89982ef → 3.24.0-beta.9a847f0
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 -1
- package/dist/@types/config/schemas.js +47 -47
- package/dist/components/Guido.vue.js +2 -2
- package/dist/components/Guido.vue2.js +92 -98
- package/dist/composables/useActionsApi.js +2 -2
- package/dist/composables/useBlocksConfig.js +20 -31
- package/dist/composables/useEditorTrackingIds.js +49 -0
- package/dist/composables/useSave.js +57 -52
- package/dist/composables/useSaveValidation.js +118 -110
- package/dist/composables/useTranslations.js +1 -2
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +48 -33
- package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
- package/dist/enums/academy.js +0 -1
- package/dist/enums/save-validation.js +1 -1
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
- package/dist/node_modules/valibot/dist/index.js +261 -297
- package/dist/package.json.js +2 -2
- package/dist/services/templateLibraryApi.js +39 -36
- package/dist/src/@types/config/schemas.d.ts +4 -4
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
- package/dist/src/composables/useSaveValidation.d.ts +1 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +4 -0
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/enums/save-validation.d.ts +2 -1
- package/dist/src/stores/config.d.ts +20 -167
- package/dist/src/utils/linkTrackingIds.d.ts +24 -22
- package/dist/static/styles/variables.css.js +0 -1
- package/dist/stores/config.js +6 -13
- package/dist/utils/linkTrackingIds.js +72 -72
- package/dist/utils/pairProductVariables.js +29 -30
- package/dist/utils/templatePreparation.js +59 -72
- package/package.json +1 -1
- package/dist/@types/display-condition.js +0 -25
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -17
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +0 -17
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +0 -45
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -36
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
- package/dist/composables/useDisplayConditions.js +0 -117
- package/dist/enums/display-condition.js +0 -12
- package/dist/extensions/DisplayConditions/bridge.js +0 -25
- package/dist/extensions/DisplayConditions/constants.js +0 -26
- package/dist/extensions/DisplayConditions/control.js +0 -215
- package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -226
- package/dist/extensions/DisplayConditions/extension.js +0 -28
- package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
- package/dist/extensions/DisplayConditions/library.js +0 -30
- package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
- package/dist/extensions/LinkTracking/extension.js +0 -17
- package/dist/extensions/LinkTracking/writer.js +0 -41
- package/dist/services/displayConditionApi.js +0 -39
- package/dist/src/@types/display-condition.d.ts +0 -61
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
- package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +0 -18
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
- package/dist/src/composables/useDisplayConditions.d.ts +0 -18
- package/dist/src/enums/display-condition.d.ts +0 -15
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
- package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -23
- package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
- package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
- package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
- package/dist/src/extensions/LinkTracking/extension.d.ts +0 -2
- package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
- package/dist/src/mock/api/display-conditions.d.ts +0 -2
- package/dist/src/services/displayConditionApi.d.ts +0 -8
- package/dist/src/stores/display-condition.d.ts +0 -86
- package/dist/src/utils/displayCondition.d.ts +0 -11
- package/dist/src/utils/protectTableText.d.ts +0 -2
- package/dist/stores/display-condition.js +0 -29
- package/dist/utils/displayCondition.js +0 -29
- package/dist/utils/protectTableText.js +0 -22
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import l from "../
|
|
3
|
-
|
|
4
|
-
const c = {
|
|
1
|
+
import r from "../extensions/ModulesTabIcons/extension.js";
|
|
2
|
+
import { useConfigStore as l } from "../stores/config.js";
|
|
3
|
+
const a = {
|
|
5
4
|
"amp-accordion": "ampAccordionEnabled",
|
|
6
5
|
"amp-carousel": "ampCarouselEnabled",
|
|
7
6
|
"amp-form-controls": "ampFormControlsEnabled",
|
|
@@ -15,7 +14,7 @@ const c = {
|
|
|
15
14
|
"text-block": "textEnabled",
|
|
16
15
|
"timer-block": "timerEnabled",
|
|
17
16
|
"video-block": "videoEnabled"
|
|
18
|
-
},
|
|
17
|
+
}, s = {
|
|
19
18
|
"dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
|
|
20
19
|
"checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
|
|
21
20
|
"radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
|
|
@@ -23,50 +22,40 @@ const c = {
|
|
|
23
22
|
"unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
|
|
24
23
|
"coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
|
|
25
24
|
"items-block": () => import("../extensions/Blocks/Items/extension.js")
|
|
26
|
-
},
|
|
25
|
+
}, i = (n) => {
|
|
27
26
|
if (!n || !n.length)
|
|
28
27
|
return {};
|
|
29
28
|
const t = {};
|
|
30
29
|
return n.forEach((o) => {
|
|
31
|
-
const e =
|
|
30
|
+
const e = a[o];
|
|
32
31
|
e && (t[e] = !1);
|
|
33
32
|
}), t;
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
if (n) {
|
|
37
|
-
const e = await import("../extensions/DisplayConditions/extension.js");
|
|
38
|
-
o.push(e.default);
|
|
39
|
-
}
|
|
40
|
-
return t && o.push(s), o;
|
|
41
|
-
}, p = async (n, t = { externalDisplayConditions: !1, linkTrackingIds: !1 }) => {
|
|
42
|
-
const o = await d(t);
|
|
33
|
+
}, b = () => [r], m = async (n) => {
|
|
34
|
+
const t = b();
|
|
43
35
|
if (!n || !n.length)
|
|
44
|
-
return
|
|
45
|
-
const
|
|
46
|
-
n.map(async (
|
|
47
|
-
const
|
|
48
|
-
return
|
|
36
|
+
return t;
|
|
37
|
+
const o = await Promise.all(
|
|
38
|
+
n.map(async (e) => {
|
|
39
|
+
const c = s[e];
|
|
40
|
+
return c ? (await c()).default : null;
|
|
49
41
|
})
|
|
50
42
|
);
|
|
51
43
|
return [
|
|
52
|
-
...
|
|
53
|
-
...
|
|
44
|
+
...t,
|
|
45
|
+
...o.filter((e) => e !== null)
|
|
54
46
|
];
|
|
55
|
-
},
|
|
56
|
-
const n =
|
|
47
|
+
}, E = () => {
|
|
48
|
+
const n = l();
|
|
57
49
|
return {
|
|
58
50
|
getStripoBlocksConfig: async () => {
|
|
59
51
|
const o = n.blocks;
|
|
60
52
|
return {
|
|
61
|
-
baseBlocks:
|
|
62
|
-
extensions: await
|
|
63
|
-
externalDisplayConditions: n.externalDisplayConditions,
|
|
64
|
-
linkTrackingIds: n.isFeatureEnabled("linkTrackingIds")
|
|
65
|
-
})
|
|
53
|
+
baseBlocks: i(o == null ? void 0 : o.excludeDefaults),
|
|
54
|
+
extensions: await m(o == null ? void 0 : o.includeCustoms)
|
|
66
55
|
};
|
|
67
56
|
}
|
|
68
57
|
};
|
|
69
58
|
};
|
|
70
59
|
export {
|
|
71
|
-
|
|
60
|
+
E as useBlocksConfig
|
|
72
61
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TRACK_ID_ATTRIBUTE as u, writeAnchorTrackIds as I, TRACK_SEQ_ATTRIBUTE as f, planTrackingIds as h, parseTrackSeq as w, readAnchorTrackIds as k } from "../utils/linkTrackingIds.js";
|
|
2
|
+
import { getEditorApi as A } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { ModificationDescription as x } from "../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
4
|
+
function T(t, r = []) {
|
|
5
|
+
const o = t.getType();
|
|
6
|
+
if (o === "comment") {
|
|
7
|
+
const e = t.getTextContent() ?? "", i = k(e);
|
|
8
|
+
return i.length && r.push({ kind: "comment", node: t, text: e, rawIds: i }), r;
|
|
9
|
+
}
|
|
10
|
+
if (o === "element") {
|
|
11
|
+
const e = t;
|
|
12
|
+
e.getTagName().toLowerCase() === "a" && r.push({ kind: "element", node: e, rawIds: [e.getAttribute(u) ?? ""] });
|
|
13
|
+
}
|
|
14
|
+
return t.childNodes().forEach((e) => T(e, r)), r;
|
|
15
|
+
}
|
|
16
|
+
function y(t, r) {
|
|
17
|
+
if (!t)
|
|
18
|
+
throw new Error("The editor exposes no editorCopilotApi.");
|
|
19
|
+
const o = t.getDocumentRootHtmlNode(), e = o.querySelector("body");
|
|
20
|
+
if (!e)
|
|
21
|
+
throw new Error("The editor document has no <body> to record tracking ids on.");
|
|
22
|
+
const i = T(o), s = h(
|
|
23
|
+
i.flatMap((d) => d.rawIds),
|
|
24
|
+
w(e.getAttribute(f)),
|
|
25
|
+
r
|
|
26
|
+
);
|
|
27
|
+
return { api: t, seqHost: e, hosts: i, plan: s };
|
|
28
|
+
}
|
|
29
|
+
const H = () => ({ writeTrackingIds: (r) => {
|
|
30
|
+
const { editorCopilotApi: o } = A();
|
|
31
|
+
let e;
|
|
32
|
+
try {
|
|
33
|
+
e = y(o, r);
|
|
34
|
+
} catch (n) {
|
|
35
|
+
return console.warn("Tracking ids skipped for this save:", n), { changed: !1, nextSeq: r };
|
|
36
|
+
}
|
|
37
|
+
const { api: i, seqHost: s, hosts: d, plan: c } = e;
|
|
38
|
+
if (!c.changed)
|
|
39
|
+
return { changed: !1, nextSeq: c.nextSeq };
|
|
40
|
+
const a = i.getTemplateModifier();
|
|
41
|
+
let l = 0;
|
|
42
|
+
return d.forEach((n) => {
|
|
43
|
+
const m = n.rawIds.map((p, g) => c.reassigned[l + g] ? c.ids[l + g] : null);
|
|
44
|
+
l += n.rawIds.length, !m.every((p) => p === null) && (n.kind === "element" ? a.modifyHtml(n.node).setAttribute(u, String(m[0])) : a.modifyHtml(n.node).replaceWith(`<!--${I(n.text, m)}-->`));
|
|
45
|
+
}), a.modifyHtml(s).setAttribute(f, String(c.nextSeq)), a.apply(new x("Updated Insider tracking IDs").asHidden()), { changed: !0, nextSeq: c.nextSeq };
|
|
46
|
+
} });
|
|
47
|
+
export {
|
|
48
|
+
H as useEditorTrackingIds
|
|
49
|
+
};
|
|
@@ -1,91 +1,96 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import { useSaveValidation as
|
|
6
|
-
import { useSaveValidationRollout as
|
|
7
|
-
import { useSyncModuleExtractor as
|
|
1
|
+
import { useActionsApi as O } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as F } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as I, useSaveComplete as N } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as j } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
|
|
8
8
|
import { ToasterTypeOptions as J } from "../enums/toaster.js";
|
|
9
9
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useSaveValidationStore as
|
|
13
|
-
import { useTemplatePreparation as
|
|
14
|
-
import { useAllowlist as
|
|
15
|
-
import { useHtmlValidator as
|
|
16
|
-
import { useToaster as
|
|
17
|
-
import { useCouponBlockValidator as
|
|
18
|
-
import { useHtmlDocumentCountValidator as
|
|
19
|
-
import { useLiquidValidator as
|
|
20
|
-
import { useSyncModuleBlockValidator as
|
|
10
|
+
import { useConfigStore as Q } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as X } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as Y } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Z, getHtmlReferencedUnsubscribePages as _ } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as $ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as tt } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as et } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as ot } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as it } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as st } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as rt } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
21
|
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
22
|
const Pt = () => {
|
|
23
|
-
const n =
|
|
24
|
-
|
|
23
|
+
const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } = st(), { validateCouponBlockTags: H } = ot(), {
|
|
24
|
+
validateUnsubscribeBlockUniqueness: E,
|
|
25
|
+
validateUnsubscribeBlockHasTemplate: g,
|
|
26
|
+
validateNoInsiderUnsubscribeCode: V
|
|
27
|
+
} = at(), { validateSyncModuleBlocks: l } = rt(), { validateSingleHtmlDocument: c } = it(), { callbacks: a, isFeatureEnabled: u } = D(), { extractSyncModuleData: x } = G(), { setSyncModuleUnsubscriptionPages: k } = K(), { editorSave: C, getTemplateData: m } = O(), { showToaster: h } = et(), { getBlockedDomains: B, resolveToast: T } = $(), { prepareTemplateDetails: p } = Z(), { collectSaveValidationErrors: L } = j(), { isEnabled: P } = z(), U = Y(), A = X(), w = Q(), { runExclusive: d } = F(), f = async (t, e, i) => {
|
|
28
|
+
if (!u("allowlistEnabled"))
|
|
25
29
|
return !1;
|
|
26
|
-
const o = await
|
|
30
|
+
const o = await B(t, e);
|
|
27
31
|
if (!o.length)
|
|
28
32
|
return !1;
|
|
29
33
|
if (!i) {
|
|
30
|
-
const s = await
|
|
31
|
-
s != null && s.message &&
|
|
34
|
+
const s = await T(o);
|
|
35
|
+
s != null && s.message && h({
|
|
32
36
|
type: J.Warning,
|
|
33
37
|
message: s.message,
|
|
34
38
|
actionButton: s.actionButton
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
return !0;
|
|
38
|
-
},
|
|
42
|
+
}, M = async (t, e) => !H(t.compiledHtml) || u("blockUnsubscribeLinks") && !V(t.rawHtml, e) || !E(t.compiledHtml) || !g(t.compiledHtml) ? !1 : u("liquidSyntax") ? b(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), v = async (t, e) => {
|
|
39
43
|
if (!await C())
|
|
40
44
|
return;
|
|
41
|
-
const { unsubscribePayload: o, stripoModules: s } =
|
|
42
|
-
if (await
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
+
const { unsubscribePayload: o, stripoModules: s } = x(t.rawHtml);
|
|
46
|
+
if (await k(o), t.modules = s, !e.suppress) {
|
|
47
|
+
const r = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
48
|
+
S({ ...t, ...r, silent: e.silent });
|
|
45
49
|
}
|
|
46
50
|
return t;
|
|
47
|
-
},
|
|
51
|
+
}, W = async (t, e) => {
|
|
48
52
|
var s;
|
|
49
53
|
n();
|
|
50
|
-
const i = await
|
|
54
|
+
const i = await m();
|
|
51
55
|
if (!c(i.html, e))
|
|
52
56
|
return;
|
|
53
57
|
const o = await p(i);
|
|
54
58
|
if (l(o.rawHtml, e)) {
|
|
55
59
|
if (P.value && !e) {
|
|
56
|
-
const
|
|
60
|
+
const r = await L(
|
|
57
61
|
o.compiledHtml,
|
|
58
|
-
o.dynamicContentList
|
|
62
|
+
o.dynamicContentList,
|
|
63
|
+
o.rawHtml
|
|
59
64
|
);
|
|
60
|
-
if (
|
|
61
|
-
|
|
65
|
+
if (r.length) {
|
|
66
|
+
U.open(r, "save");
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
64
|
-
} else if (!await
|
|
69
|
+
} else if (!await M(o, e))
|
|
65
70
|
return;
|
|
66
|
-
if (!((s =
|
|
67
|
-
return
|
|
71
|
+
if (!((s = a.value) != null && s.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, e))
|
|
72
|
+
return v(o, { silent: e, suppress: t });
|
|
68
73
|
}
|
|
69
|
-
},
|
|
74
|
+
}, R = async () => {
|
|
70
75
|
var i;
|
|
71
|
-
if (!
|
|
76
|
+
if (!w.allowSaveWithErrors)
|
|
72
77
|
return;
|
|
73
78
|
n();
|
|
74
|
-
const t = await
|
|
79
|
+
const t = await m();
|
|
75
80
|
if (!c(t.html, !1))
|
|
76
81
|
return;
|
|
77
82
|
const e = await p(t);
|
|
78
|
-
if (l(e.rawHtml, !1) && !((i =
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
if (!
|
|
83
|
+
if (l(e.rawHtml, !1) && !((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(e)) && !await f(e.compiledHtml, e.css, !1))
|
|
84
|
+
return v(e, { silent: !1, blankCompiled: !0 });
|
|
85
|
+
}, q = async () => {
|
|
86
|
+
if (!w.allowSaveWithErrors)
|
|
82
87
|
return;
|
|
83
88
|
n();
|
|
84
|
-
const { html: t, css: e } = await
|
|
85
|
-
if (!c(t, !0) || !l(t, !0) || await
|
|
89
|
+
const { html: t, css: e } = await m();
|
|
90
|
+
if (!c(t, !0) || !l(t, !0) || await f(t, e, !0))
|
|
86
91
|
return;
|
|
87
|
-
const i =
|
|
88
|
-
dynamicContentList:
|
|
92
|
+
const i = _(t), o = {
|
|
93
|
+
dynamicContentList: A.getSelectedDynamicContentList,
|
|
89
94
|
compiledHtml: "",
|
|
90
95
|
rawHtml: t,
|
|
91
96
|
css: e,
|
|
@@ -99,11 +104,11 @@ const Pt = () => {
|
|
|
99
104
|
config: i
|
|
100
105
|
}
|
|
101
106
|
};
|
|
102
|
-
return
|
|
107
|
+
return v(o, { silent: !0 });
|
|
103
108
|
};
|
|
104
|
-
return { save: (t = !1, e = !1) =>
|
|
105
|
-
() =>
|
|
106
|
-
), saveWithErrors: () =>
|
|
109
|
+
return { save: (t = !1, e = !1) => d(
|
|
110
|
+
() => W(t, e)
|
|
111
|
+
), saveWithErrors: () => d(R), saveRawOnly: () => d(q) };
|
|
107
112
|
};
|
|
108
113
|
export {
|
|
109
114
|
Pt as useSave
|