@useinsider/guido 3.14.0-beta.38ec3aa → 3.14.0-beta.5d003b0
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/dist/composables/useEmailTemplateApplier.js +32 -46
- package/dist/src/stores/dynamic-content.d.ts +0 -8
- package/dist/stores/dynamic-content.js +2 -12
- package/package.json +1 -1
- package/dist/src/utils/registerUsedDynamicContent.d.ts +0 -8
- package/dist/utils/registerUsedDynamicContent.js +0 -23
|
@@ -1,57 +1,43 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { updateHtmlAndCss: c } = d(), { showToaster: m } = h(), y = E(), { template: T } = D(), v = A(), g = (e, t) => {
|
|
12
|
-
const a = y(e);
|
|
13
|
-
return a === e ? t : a;
|
|
14
|
-
}, C = (e) => {
|
|
15
|
-
o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
|
|
16
|
-
}, l = (e, t, a) => {
|
|
17
|
-
var n;
|
|
18
|
-
o.value = { ...o.value, [e]: "applying" };
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useToaster as f } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as y } from "./useTranslations.js";
|
|
4
|
+
import { ToasterTypeOptions as n } from "../enums/toaster.js";
|
|
5
|
+
import { ref as v } from "vue";
|
|
6
|
+
const E = 250, s = v({}), o = {}, j = () => {
|
|
7
|
+
const { updateHtmlAndCss: l } = T(), { showToaster: p } = f(), i = y(), u = (e) => {
|
|
8
|
+
s.value[e] === void 0 && (s.value = { ...s.value, [e]: "pending" });
|
|
9
|
+
}, c = (e, t, r) => {
|
|
10
|
+
s.value = { ...s.value, [e]: "applying" };
|
|
19
11
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
message: g("newsletter.ai-template-applied", "Template applied to the editor")
|
|
29
|
-
}));
|
|
30
|
-
} catch (r) {
|
|
31
|
-
o.value = { ...o.value, [e]: "failed" }, m({
|
|
32
|
-
type: f.Error,
|
|
33
|
-
message: r instanceof Error ? r.message : "Failed to apply template"
|
|
12
|
+
l(t, r), s.value = { ...s.value, [e]: "applied" }, p({
|
|
13
|
+
type: n.Success,
|
|
14
|
+
message: i("newsletter.ai-template-applied")
|
|
15
|
+
});
|
|
16
|
+
} catch (a) {
|
|
17
|
+
s.value = { ...s.value, [e]: "failed" }, p({
|
|
18
|
+
type: n.Error,
|
|
19
|
+
message: a instanceof Error ? a.message : "Failed to apply template"
|
|
34
20
|
});
|
|
35
21
|
}
|
|
36
|
-
},
|
|
37
|
-
const t =
|
|
38
|
-
t && (clearTimeout(t), delete
|
|
22
|
+
}, m = (e) => {
|
|
23
|
+
const t = o[e];
|
|
24
|
+
t && (clearTimeout(t), delete o[e]);
|
|
39
25
|
};
|
|
40
|
-
return { applyStatus:
|
|
41
|
-
t.html && (
|
|
26
|
+
return { applyStatus: s, markPending: u, applyTemplate: (e, t) => {
|
|
27
|
+
t.html && (m(e), c(e, t.html, t.css ?? ""));
|
|
42
28
|
}, applyTemplateDebounced: (e, t) => {
|
|
43
29
|
if (!t.html)
|
|
44
30
|
return;
|
|
45
|
-
|
|
46
|
-
const { html:
|
|
47
|
-
|
|
48
|
-
delete
|
|
49
|
-
},
|
|
31
|
+
m(e);
|
|
32
|
+
const { html: r } = t, a = t.css ?? "";
|
|
33
|
+
o[e] = setTimeout(() => {
|
|
34
|
+
delete o[e], c(e, r, a);
|
|
35
|
+
}, E);
|
|
50
36
|
} };
|
|
51
|
-
},
|
|
52
|
-
Object.values(
|
|
37
|
+
}, k = () => {
|
|
38
|
+
Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
|
|
53
39
|
};
|
|
54
40
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
k as resetEmailTemplateApplier,
|
|
42
|
+
j as useEmailTemplateApplier
|
|
57
43
|
};
|
|
@@ -36,12 +36,4 @@ export declare const useDynamicContentStore: import("pinia").StoreDefinition<"gu
|
|
|
36
36
|
}[];
|
|
37
37
|
}, {
|
|
38
38
|
setSelectedDynamicContent(dynamicContent: DynamicContent): void;
|
|
39
|
-
/**
|
|
40
|
-
* Append-only bulk registration for dynamic content used by an
|
|
41
|
-
* AI-applied template. Unlike `setSelectedDynamicContent` it doesn't
|
|
42
|
-
* touch `selectedDynamicContent`; the getter removes duplicates, so
|
|
43
|
-
* re-registering the same entries is harmless. Items are shallow-copied so Pinia
|
|
44
|
-
* reactivity can't write a later mutation back into the host's catalog.
|
|
45
|
-
*/
|
|
46
|
-
registerDynamicContent(items: DynamicContent[]): void;
|
|
47
39
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { removeDuplicatesFromArray as n } from "../utils/arrayUtil.js";
|
|
2
2
|
import { defineStore as a } from "pinia";
|
|
3
|
-
const
|
|
3
|
+
const s = a("guidoDynamicContent", {
|
|
4
4
|
state: () => ({
|
|
5
5
|
selectedDynamicContent: { text: "", value: "" },
|
|
6
6
|
selectedDynamicContentList: []
|
|
@@ -8,16 +8,6 @@ const c = a("guidoDynamicContent", {
|
|
|
8
8
|
actions: {
|
|
9
9
|
setSelectedDynamicContent(t) {
|
|
10
10
|
this.selectedDynamicContent = t, this.selectedDynamicContentList.push(t);
|
|
11
|
-
},
|
|
12
|
-
/**
|
|
13
|
-
* Append-only bulk registration for dynamic content used by an
|
|
14
|
-
* AI-applied template. Unlike `setSelectedDynamicContent` it doesn't
|
|
15
|
-
* touch `selectedDynamicContent`; the getter removes duplicates, so
|
|
16
|
-
* re-registering the same entries is harmless. Items are shallow-copied so Pinia
|
|
17
|
-
* reactivity can't write a later mutation back into the host's catalog.
|
|
18
|
-
*/
|
|
19
|
-
registerDynamicContent(t) {
|
|
20
|
-
this.selectedDynamicContentList.push(...t.map((e) => ({ ...e })));
|
|
21
11
|
}
|
|
22
12
|
},
|
|
23
13
|
getters: {
|
|
@@ -30,5 +20,5 @@ const c = a("guidoDynamicContent", {
|
|
|
30
20
|
}
|
|
31
21
|
});
|
|
32
22
|
export {
|
|
33
|
-
|
|
23
|
+
s as useDynamicContentStore
|
|
34
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.14.0-beta.
|
|
3
|
+
"version": "3.14.0-beta.5d003b0",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DynamicContent } from '@@/Types/generic';
|
|
2
|
-
export declare const extractUsedDynamicContent: (html: string, flattenedCatalog: DynamicContent[] | undefined | null) => DynamicContent[];
|
|
3
|
-
/**
|
|
4
|
-
* Dev-diagnostic sibling of `extractUsedDynamicContent`: the used token names
|
|
5
|
-
* with NO catalog match (so intentionally not registered). Surfaced via a
|
|
6
|
-
* dev-gated `console.debug` to spot a neo↔guido vocabulary mismatch. Never throws.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getUnmatchedDynamicContentTokens: (html: string, flattenedCatalog: DynamicContent[] | undefined | null) => string[];
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DATA_ATTRIBUTE_REGEX as T } from "../enums/html-validator.js";
|
|
2
|
-
const d = /{{([a-zA-Z0-9_.\s]*)}}/gm, h = (n, e) => {
|
|
3
|
-
if (!e || e.length === 0)
|
|
4
|
-
return { matched: [], unmatchedTokens: [] };
|
|
5
|
-
const s = n.replace(T, "$1").match(d);
|
|
6
|
-
if (!s)
|
|
7
|
-
return { matched: [], unmatchedTokens: [] };
|
|
8
|
-
const u = new Map(
|
|
9
|
-
e.map((c) => [c.value.trim().toLowerCase(), c])
|
|
10
|
-
), a = /* @__PURE__ */ new Set(), o = [], m = [];
|
|
11
|
-
return s.forEach((c) => {
|
|
12
|
-
const t = c.slice(2, -2).trim().toLowerCase();
|
|
13
|
-
if (t === "" || a.has(t))
|
|
14
|
-
return;
|
|
15
|
-
a.add(t);
|
|
16
|
-
const r = u.get(t);
|
|
17
|
-
r ? o.push(r) : m.push(t);
|
|
18
|
-
}), { matched: o, unmatchedTokens: m };
|
|
19
|
-
}, E = (n, e) => h(n, e).matched, k = (n, e) => h(n, e).unmatchedTokens;
|
|
20
|
-
export {
|
|
21
|
-
E as extractUsedDynamicContent,
|
|
22
|
-
k as getUnmatchedDynamicContentTokens
|
|
23
|
-
};
|