@tesouro/embedded-components-react 0.5.125 → 0.5.128
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/index.css +6 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index8.js +91 -91
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index10.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index4.js +58 -7
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js +3 -98
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js +62 -62
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index3.js +5 -9
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index4.js +7 -31
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index5.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index6.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index7.js +33 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/index.js +5 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/TagSelectorField.js +11 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/helpers.js +38 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/labels.js +19 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/permissions.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/useTagCreateForm.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index3.js +30 -30
- package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index4.js +4 -0
- package/dist/packages/shared-ui-shadcn/dist/index.js +1196 -1190
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js
CHANGED
|
@@ -2,103 +2,103 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "../../data-access/dist/index.js";
|
|
10
|
-
import { useCreateTagMutation as l } from "../../../../shared/tag-selection/data-access/dist/index4.js";
|
|
11
|
-
import { useUpdateTagMutation as u } from "../../../../shared/tag-selection/data-access/dist/index5.js";
|
|
5
|
+
import { EMPTY_FORM_VALUES as e } from "./index3.js";
|
|
6
|
+
import { getCategoryOptions as t, hasFormErrors as n, resolveTagSubmitError as r, validateTagForm as i } from "../../../../shared/tag-selection/feature/dist/lib/helpers.js";
|
|
7
|
+
import { useCreateTagMutation as a } from "../../../../shared/tag-selection/data-access/dist/index5.js";
|
|
8
|
+
import { useUpdateTagMutation as o } from "../../../../shared/tag-selection/data-access/dist/index6.js";
|
|
12
9
|
import "../../../../shared/tag-selection/data-access/dist/index.js";
|
|
13
|
-
import
|
|
10
|
+
import "../../../../shared/tag-selection/feature/dist/index.js";
|
|
11
|
+
import { buildKeywordsByTagId as s, computeNextOcrAutoTagging as c } from "./index4.js";
|
|
12
|
+
import { useUpdateEntitySettingsMutation as l } from "../../data-access/dist/index5.js";
|
|
13
|
+
import "../../data-access/dist/index.js";
|
|
14
|
+
import { useCallback as u, useMemo as d, useState as f } from "react";
|
|
14
15
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js
|
|
15
|
-
function
|
|
16
|
-
let { entityId:
|
|
16
|
+
function p({ selectedTag: p, setSelectedTag: m, settings: h, messages: g }) {
|
|
17
|
+
let { entityId: _, settingsData: v, refetchSettings: y, requireFreshSettings: b } = h, x = a(), S = o(), C = l(), [w, T] = f(!1), [E, D] = f("create"), [O, k] = f(e), [A, j] = f({});
|
|
17
18
|
return {
|
|
18
|
-
open:
|
|
19
|
-
mode:
|
|
20
|
-
values:
|
|
21
|
-
errors:
|
|
22
|
-
categoryOptions:
|
|
23
|
-
isSubmitting:
|
|
24
|
-
openCreate:
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
openEdit:
|
|
19
|
+
open: w,
|
|
20
|
+
mode: E,
|
|
21
|
+
values: O,
|
|
22
|
+
errors: A,
|
|
23
|
+
categoryOptions: d(() => t(), []),
|
|
24
|
+
isSubmitting: x.isPending || S.isPending || C.isPending,
|
|
25
|
+
openCreate: u(() => {
|
|
26
|
+
D("create"), m(void 0), k(e), j({}), T(!0);
|
|
27
|
+
}, [m]),
|
|
28
|
+
openEdit: u((e) => {
|
|
28
29
|
(async () => {
|
|
29
|
-
let t =
|
|
30
|
-
|
|
30
|
+
let t = v ?? await y(), n = s(t?.payables_ocr_auto_tagging);
|
|
31
|
+
m(e), D("edit"), k({
|
|
31
32
|
name: e.name,
|
|
32
33
|
category: e.category ?? "",
|
|
33
|
-
keywords:
|
|
34
|
+
keywords: n[e.id] ?? [],
|
|
34
35
|
keywordsInput: ""
|
|
35
|
-
}),
|
|
36
|
+
}), j({}), T(!0);
|
|
36
37
|
})();
|
|
37
38
|
}, [
|
|
39
|
+
v,
|
|
38
40
|
y,
|
|
39
|
-
|
|
40
|
-
h
|
|
41
|
+
m
|
|
41
42
|
]),
|
|
42
|
-
onOpenChange:
|
|
43
|
-
e ||
|
|
43
|
+
onOpenChange: u((e) => {
|
|
44
|
+
e || T(!1);
|
|
44
45
|
}, []),
|
|
45
|
-
close:
|
|
46
|
-
onNameChange:
|
|
46
|
+
close: u(() => T(!1), []),
|
|
47
|
+
onNameChange: u((e) => k((t) => ({
|
|
47
48
|
...t,
|
|
48
49
|
name: e
|
|
49
50
|
})), []),
|
|
50
|
-
onCategoryChange:
|
|
51
|
+
onCategoryChange: u((e) => k((t) => ({
|
|
51
52
|
...t,
|
|
52
53
|
category: e
|
|
53
54
|
})), []),
|
|
54
|
-
onKeywordsChange:
|
|
55
|
+
onKeywordsChange: u((e) => k((t) => ({
|
|
55
56
|
...t,
|
|
56
57
|
keywords: e
|
|
57
58
|
})), []),
|
|
58
|
-
onKeywordsInputChange:
|
|
59
|
+
onKeywordsInputChange: u((e) => k((t) => ({
|
|
59
60
|
...t,
|
|
60
61
|
keywordsInput: e
|
|
61
62
|
})), []),
|
|
62
|
-
submit:
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
|
|
63
|
+
submit: u(async () => {
|
|
64
|
+
let e = i(O, g);
|
|
65
|
+
if (n(e)) {
|
|
66
|
+
j(e);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
name:
|
|
71
|
-
...
|
|
69
|
+
j({});
|
|
70
|
+
let t = O.name.trim(), a = O.category === "" ? void 0 : O.category, o = {
|
|
71
|
+
name: t,
|
|
72
|
+
...a ? { category: a } : {}
|
|
72
73
|
};
|
|
73
74
|
try {
|
|
74
|
-
let e =
|
|
75
|
-
path: { tag_id:
|
|
76
|
-
body:
|
|
77
|
-
}) : await
|
|
78
|
-
if (
|
|
79
|
-
let { changed: e, next:
|
|
80
|
-
e && await
|
|
81
|
-
path: { entity_id:
|
|
82
|
-
body: { payables_ocr_auto_tagging:
|
|
75
|
+
let e = O.keywords.length > 0 || E === "edit", t = _ && e ? await b() : void 0, n = E === "edit" && p ? await S.mutateAsync({
|
|
76
|
+
path: { tag_id: p.id },
|
|
77
|
+
body: o
|
|
78
|
+
}) : await x.mutateAsync({ body: o });
|
|
79
|
+
if (_ && t) {
|
|
80
|
+
let { changed: e, next: r } = c(t.payables_ocr_auto_tagging, n.id, O.keywords);
|
|
81
|
+
e && await C.mutateAsync({
|
|
82
|
+
path: { entity_id: _ },
|
|
83
|
+
body: { payables_ocr_auto_tagging: r }
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
} catch (
|
|
87
|
-
|
|
88
|
-
o(n) ? M({ name: n }) : M({ form: n ?? _.genericError });
|
|
86
|
+
T(!1);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
j(r(e, g));
|
|
89
89
|
}
|
|
90
90
|
}, [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
O,
|
|
92
|
+
E,
|
|
93
|
+
p,
|
|
94
|
+
_,
|
|
95
|
+
x,
|
|
95
96
|
S,
|
|
96
97
|
C,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
x
|
|
98
|
+
g,
|
|
99
|
+
b
|
|
100
100
|
])
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
|
-
export {
|
|
104
|
+
export { p as useTagForm };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { useTagsQuery as n } from "../../../../shared/tag-selection/data-access/dist/index2.js";
|
|
5
|
+
import { useTagsQuery as e } from "../../../../shared/tag-selection/data-access/dist/index2.js";
|
|
7
6
|
import "../../../../shared/tag-selection/data-access/dist/index.js";
|
|
7
|
+
import { buildTagRows as t, sortFieldForColumn as n } from "./index4.js";
|
|
8
8
|
import { useCallback as r, useMemo as i, useState as a } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js
|
|
10
10
|
function o({ keywordsByTagId: o, userNamesById: s }) {
|
|
11
11
|
let [c, l] = a([{
|
|
12
12
|
id: "createdAtLabel",
|
|
13
13
|
desc: !0
|
|
14
|
-
}]), [u, d] = a(10), [f, p] = a(), m =
|
|
14
|
+
}]), [u, d] = a(10), [f, p] = a(), m = n(c[0]?.id), h = c[0]?.desc ? "desc" : "asc", g = e({
|
|
15
15
|
sort: m,
|
|
16
16
|
order: h,
|
|
17
17
|
limit: u,
|
|
18
18
|
pagination_token: f
|
|
19
|
-
}), _ = i(() =>
|
|
19
|
+
}), _ = i(() => t({
|
|
20
20
|
tags: g.data?.data ?? [],
|
|
21
21
|
keywordsByTagId: o,
|
|
22
22
|
userNamesById: s
|
|
@@ -25,9 +25,9 @@ function o({ keywordsByTagId: o, userNamesById: s }) {
|
|
|
25
25
|
o,
|
|
26
26
|
s
|
|
27
27
|
]), v = r((e) => (g.data?.data ?? []).find((t) => t.id === e), [g.data]), y = r((e) => {
|
|
28
|
-
let
|
|
29
|
-
l(
|
|
30
|
-
let r = t
|
|
28
|
+
let t = typeof e == "function" ? e(c) : e;
|
|
29
|
+
l(t);
|
|
30
|
+
let r = n(t[0]?.id), i = t[0]?.desc ? "desc" : "asc";
|
|
31
31
|
(r !== m || i !== h) && p(void 0);
|
|
32
32
|
}, [
|
|
33
33
|
c,
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.5.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.5.128", n = "6c38915889a61343c6db7abd8a772c5eb25831fe", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTagsQuery as e } from "./index2.js";
|
|
2
2
|
import "./index3.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import "./index4.js";
|
|
4
|
+
import { useCreateTagMutation as t } from "./index5.js";
|
|
5
|
+
import { useUpdateTagMutation as n } from "./index6.js";
|
|
6
|
+
import { useDeleteTagMutation as r } from "./index7.js";
|
|
6
7
|
export { t as useCreateTagMutation, r as useDeleteTagMutation, e as useTagsQuery, n as useUpdateTagMutation };
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index3.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
3
5
|
import "../../../data-access/dist/index.js";
|
|
4
|
-
|
|
5
|
-
var n = ({ client: n, organizationId: r }) => e({
|
|
6
|
-
client: n,
|
|
7
|
-
headers: t(r)
|
|
8
|
-
});
|
|
9
|
-
//#endregion
|
|
10
|
-
export { n as tagsInvalidationKey };
|
|
6
|
+
import "@tanstack/react-query";
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index4.js
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { postTags as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
-
import { invalidateAllClients as t } from "../../../data-access/dist/lib/clientRegistry.js";
|
|
7
|
-
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
-
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
1
|
+
import { getTagsQueryKey as e } from "../../../data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
2
|
+
import { organizationHeaders as t } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
3
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import { tagsInvalidationKey as i } from "./index3.js";
|
|
11
|
-
import { useMutation as a } from "@tanstack/react-query";
|
|
12
4
|
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index4.js
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let { data: n } = await e({
|
|
18
|
-
client: o,
|
|
19
|
-
headers: r(s),
|
|
20
|
-
body: t,
|
|
21
|
-
throwOnError: !0
|
|
22
|
-
});
|
|
23
|
-
return n;
|
|
24
|
-
},
|
|
25
|
-
onSuccess: async () => {
|
|
26
|
-
await t(i({
|
|
27
|
-
client: o,
|
|
28
|
-
organizationId: s
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
5
|
+
var n = ({ client: n, organizationId: r }) => e({
|
|
6
|
+
client: n,
|
|
7
|
+
headers: t(r)
|
|
8
|
+
});
|
|
33
9
|
//#endregion
|
|
34
|
-
export {
|
|
10
|
+
export { n as tagsInvalidationKey };
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index5.js
CHANGED
|
@@ -2,26 +2,25 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { postTags as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
|
|
6
6
|
import { invalidateAllClients as t } from "../../../data-access/dist/lib/clientRegistry.js";
|
|
7
7
|
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import { tagsInvalidationKey as i } from "./
|
|
10
|
+
import { tagsInvalidationKey as i } from "./index4.js";
|
|
11
11
|
import { useMutation as a } from "@tanstack/react-query";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index5.js
|
|
13
13
|
function o() {
|
|
14
14
|
let { client: o, organizationId: s } = n();
|
|
15
15
|
return a({
|
|
16
|
-
mutationFn: async ({
|
|
17
|
-
let { data:
|
|
16
|
+
mutationFn: async ({ body: t }) => {
|
|
17
|
+
let { data: n } = await e({
|
|
18
18
|
client: o,
|
|
19
19
|
headers: r(s),
|
|
20
|
-
|
|
21
|
-
body: n,
|
|
20
|
+
body: t,
|
|
22
21
|
throwOnError: !0
|
|
23
22
|
});
|
|
24
|
-
return
|
|
23
|
+
return n;
|
|
25
24
|
},
|
|
26
25
|
onSuccess: async () => {
|
|
27
26
|
await t(i({
|
|
@@ -32,4 +31,4 @@ function o() {
|
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
//#endregion
|
|
35
|
-
export { o as
|
|
34
|
+
export { o as useCreateTagMutation };
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index6.js
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { patchTagsId as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
|
|
6
6
|
import { invalidateAllClients as t } from "../../../data-access/dist/lib/clientRegistry.js";
|
|
7
7
|
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import { tagsInvalidationKey as i } from "./
|
|
10
|
+
import { tagsInvalidationKey as i } from "./index4.js";
|
|
11
11
|
import { useMutation as a } from "@tanstack/react-query";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index6.js
|
|
13
13
|
function o() {
|
|
14
14
|
let { client: o, organizationId: s } = n();
|
|
15
15
|
return a({
|
|
16
|
-
mutationFn: async ({ path: t }) => {
|
|
17
|
-
await e({
|
|
16
|
+
mutationFn: async ({ path: t, body: n }) => {
|
|
17
|
+
let { data: i } = await e({
|
|
18
18
|
client: o,
|
|
19
19
|
headers: r(s),
|
|
20
20
|
path: t,
|
|
21
|
+
body: n,
|
|
21
22
|
throwOnError: !0
|
|
22
23
|
});
|
|
24
|
+
return i;
|
|
23
25
|
},
|
|
24
26
|
onSuccess: async () => {
|
|
25
27
|
await t(i({
|
|
@@ -30,4 +32,4 @@ function o() {
|
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
//#endregion
|
|
33
|
-
export { o as
|
|
35
|
+
export { o as useUpdateTagMutation };
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index7.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { deleteTagsId as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
+
import { invalidateAllClients as t } from "../../../data-access/dist/lib/clientRegistry.js";
|
|
7
|
+
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
+
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
|
+
import "../../../data-access/dist/index.js";
|
|
10
|
+
import { tagsInvalidationKey as i } from "./index4.js";
|
|
11
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index7.js
|
|
13
|
+
function o() {
|
|
14
|
+
let { client: o, organizationId: s } = n();
|
|
15
|
+
return a({
|
|
16
|
+
mutationFn: async ({ path: t }) => {
|
|
17
|
+
await e({
|
|
18
|
+
client: o,
|
|
19
|
+
headers: r(s),
|
|
20
|
+
path: t,
|
|
21
|
+
throwOnError: !0
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onSuccess: async () => {
|
|
25
|
+
await t(i({
|
|
26
|
+
client: o,
|
|
27
|
+
organizationId: s
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { o as useDeleteTagMutation };
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./lib/permissions.js";
|
|
2
|
+
import { TAG_MESSAGE_LABELS_EN as e } from "./lib/labels.js";
|
|
3
|
+
import { getCategoryOptions as t, getTagCategoryLabel as n, hasFormErrors as r, resolveTagSubmitError as i, validateTagForm as a } from "./lib/helpers.js";
|
|
4
|
+
import "./lib/TagSelectorField.js";
|
|
5
|
+
export { e as TAG_MESSAGE_LABELS_EN, t as getCategoryOptions, n as getTagCategoryLabel, r as hasFormErrors, i as resolveTagSubmitError, a as validateTagForm };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import "../../../../feature/dist/index.js";
|
|
6
|
+
import "./permissions.js";
|
|
7
|
+
import "../../../data-access/dist/index.js";
|
|
8
|
+
import "./useTagCreateForm.js";
|
|
9
|
+
import "../../../ui/dist/index.js";
|
|
10
|
+
import "react";
|
|
11
|
+
import "react/jsx-runtime";
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/helpers.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
|
|
2
|
+
import { TAG_CATEGORY_LABELS_EN as t, TAG_MESSAGE_LABELS_EN as n } from "./labels.js";
|
|
3
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/helpers.js
|
|
4
|
+
var r = [
|
|
5
|
+
"document_type",
|
|
6
|
+
"department",
|
|
7
|
+
"project",
|
|
8
|
+
"cost_center",
|
|
9
|
+
"vendor_type",
|
|
10
|
+
"payment_method",
|
|
11
|
+
"approval_status"
|
|
12
|
+
];
|
|
13
|
+
function i(e, n) {
|
|
14
|
+
return e ? n?.[e] ?? t[e] ?? "" : "";
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
return r.map((t) => ({
|
|
18
|
+
value: t,
|
|
19
|
+
label: i(t, e)
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
function o(e, t = n) {
|
|
23
|
+
let r = {}, i = e.name.trim();
|
|
24
|
+
i.length === 0 ? r.name = t.nameRequired : i.length > 255 && (r.name = t.nameTooLong);
|
|
25
|
+
let a = e.keywords.some((e) => e.length < 2), o = e.keywords.some((e) => e.length > 25);
|
|
26
|
+
return a ? r.keywords = t.keywordTooShort : o && (r.keywords = t.keywordTooLong), r;
|
|
27
|
+
}
|
|
28
|
+
function s(e) {
|
|
29
|
+
return !!(e.name || e.keywords);
|
|
30
|
+
}
|
|
31
|
+
function c(e) {
|
|
32
|
+
return e === "This tag already exists.";
|
|
33
|
+
}
|
|
34
|
+
function l(t, r = n) {
|
|
35
|
+
return c(e(t)) ? { name: r.duplicateName } : { form: r.genericError };
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { r as TAG_CATEGORIES, a as getCategoryOptions, i as getTagCategoryLabel, s as hasFormErrors, c as isDuplicateTagNameError, l as resolveTagSubmitError, o as validateTagForm };
|
package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/labels.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/labels.js
|
|
2
|
+
var e = {
|
|
3
|
+
nameRequired: "Required",
|
|
4
|
+
nameTooLong: "Value must be at most '255' characters",
|
|
5
|
+
keywordTooShort: "Keyword should be at least 2 characters long",
|
|
6
|
+
keywordTooLong: "Keyword should be at most 25 characters long",
|
|
7
|
+
genericError: "Something went wrong. Please try again.",
|
|
8
|
+
duplicateName: "A tag with this name already exists."
|
|
9
|
+
}, t = {
|
|
10
|
+
document_type: "Document Type",
|
|
11
|
+
department: "Department",
|
|
12
|
+
project: "Project",
|
|
13
|
+
cost_center: "Cost Center",
|
|
14
|
+
vendor_type: "Vendor Type",
|
|
15
|
+
payment_method: "Payment Method",
|
|
16
|
+
approval_status: "Approval Status"
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as TAG_CATEGORY_LABELS_EN, e as TAG_MESSAGE_LABELS_EN };
|
|
@@ -3,25 +3,25 @@ import { TAG_FORM_SHEET_LABELS_EN as h } from "./index2.js";
|
|
|
3
3
|
import { useId as g } from "react";
|
|
4
4
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index3.js
|
|
6
|
-
function y({ open: y, onOpenChange: b, mode: x, values: S, errors: C, categoryOptions: w, tagName: T, inProgress: E, showDelete: D,
|
|
7
|
-
let
|
|
6
|
+
function y({ open: y, onOpenChange: b, mode: x, values: S, errors: C, categoryOptions: w, tagName: T, inProgress: E, showDelete: D, showKeywords: O = !0, onNameChange: k, onCategoryChange: A, onKeywordsChange: j, onKeywordsInputChange: M, onSubmit: N, onCancel: P, onDelete: F, labels: I }) {
|
|
7
|
+
let L = {
|
|
8
8
|
...h,
|
|
9
|
-
...
|
|
10
|
-
},
|
|
9
|
+
...I
|
|
10
|
+
}, R = g(), z = x === "edit" ? L.editTitle.replace("{name}", T ?? "") : L.createTitle;
|
|
11
11
|
return /* @__PURE__ */ _(l, {
|
|
12
12
|
open: y,
|
|
13
13
|
onOpenChange: b,
|
|
14
14
|
children: /* @__PURE__ */ v(u, {
|
|
15
15
|
className: "ttw:w-[600px] ttw:sm:max-w-[600px]",
|
|
16
16
|
children: [
|
|
17
|
-
/* @__PURE__ */ v(p, { children: [/* @__PURE__ */ _(m, { children:
|
|
17
|
+
/* @__PURE__ */ v(p, { children: [/* @__PURE__ */ _(m, { children: z }), /* @__PURE__ */ _(d, {
|
|
18
18
|
className: "ttw:sr-only",
|
|
19
|
-
children:
|
|
19
|
+
children: z
|
|
20
20
|
})] }),
|
|
21
21
|
/* @__PURE__ */ _("form", {
|
|
22
|
-
id:
|
|
22
|
+
id: R,
|
|
23
23
|
onSubmit: (e) => {
|
|
24
|
-
e.preventDefault(), e.stopPropagation(),
|
|
24
|
+
e.preventDefault(), e.stopPropagation(), N();
|
|
25
25
|
},
|
|
26
26
|
children: /* @__PURE__ */ v("div", {
|
|
27
27
|
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:px-6 ttw:pt-8 ttw:pb-6",
|
|
@@ -35,15 +35,15 @@ function y({ open: y, onOpenChange: b, mode: x, values: S, errors: C, categoryOp
|
|
|
35
35
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
36
36
|
children: [
|
|
37
37
|
/* @__PURE__ */ _(r, {
|
|
38
|
-
htmlFor: `${
|
|
39
|
-
children:
|
|
38
|
+
htmlFor: `${R}-name`,
|
|
39
|
+
children: L.nameLabel
|
|
40
40
|
}),
|
|
41
41
|
/* @__PURE__ */ _(t, {
|
|
42
|
-
id: `${
|
|
42
|
+
id: `${R}-name`,
|
|
43
43
|
autoFocus: !0,
|
|
44
44
|
value: S.name,
|
|
45
45
|
"aria-invalid": !!C?.name,
|
|
46
|
-
onChange: (e) =>
|
|
46
|
+
onChange: (e) => k(e.target.value)
|
|
47
47
|
}),
|
|
48
48
|
C?.name && /* @__PURE__ */ _("p", {
|
|
49
49
|
className: "ttw:text-sm ttw:text-destructive",
|
|
@@ -54,33 +54,33 @@ function y({ open: y, onOpenChange: b, mode: x, values: S, errors: C, categoryOp
|
|
|
54
54
|
/* @__PURE__ */ v("div", {
|
|
55
55
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
56
56
|
children: [/* @__PURE__ */ _(r, {
|
|
57
|
-
htmlFor: `${
|
|
58
|
-
children:
|
|
57
|
+
htmlFor: `${R}-category`,
|
|
58
|
+
children: L.categoryLabel
|
|
59
59
|
}), /* @__PURE__ */ v(i, {
|
|
60
60
|
value: S.category === "" ? void 0 : S.category,
|
|
61
|
-
onValueChange:
|
|
61
|
+
onValueChange: A,
|
|
62
62
|
children: [/* @__PURE__ */ _(s, {
|
|
63
|
-
id: `${
|
|
63
|
+
id: `${R}-category`,
|
|
64
64
|
className: "ttw:w-full",
|
|
65
|
-
children: /* @__PURE__ */ _(c, { placeholder:
|
|
65
|
+
children: /* @__PURE__ */ _(c, { placeholder: L.categoryPlaceholder })
|
|
66
66
|
}), /* @__PURE__ */ _(a, { children: w.map((e) => /* @__PURE__ */ _(o, {
|
|
67
67
|
value: e.value,
|
|
68
68
|
children: e.label
|
|
69
69
|
}, e.value)) })]
|
|
70
70
|
})]
|
|
71
71
|
}),
|
|
72
|
-
/* @__PURE__ */ v("div", {
|
|
72
|
+
O && /* @__PURE__ */ v("div", {
|
|
73
73
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */ _(r, { children:
|
|
75
|
+
/* @__PURE__ */ _(r, { children: L.keywordsLabel }),
|
|
76
76
|
/* @__PURE__ */ _(n, {
|
|
77
77
|
value: S.keywords,
|
|
78
|
-
onChange:
|
|
78
|
+
onChange: j,
|
|
79
79
|
inputValue: S.keywordsInput,
|
|
80
|
-
onInputValueChange:
|
|
81
|
-
placeholder:
|
|
80
|
+
onInputValueChange: M,
|
|
81
|
+
placeholder: L.keywordsPlaceholder,
|
|
82
82
|
"aria-invalid": !!C?.keywords,
|
|
83
|
-
removeTagLabel: (e) =>
|
|
83
|
+
removeTagLabel: (e) => L.removeKeyword.replace("{keyword}", e)
|
|
84
84
|
}),
|
|
85
85
|
C?.keywords && /* @__PURE__ */ _("p", {
|
|
86
86
|
className: "ttw:text-sm ttw:text-destructive",
|
|
@@ -94,27 +94,27 @@ function y({ open: y, onOpenChange: b, mode: x, values: S, errors: C, categoryOp
|
|
|
94
94
|
/* @__PURE__ */ v(f, {
|
|
95
95
|
className: "ttw:flex ttw:flex-row ttw:justify-end ttw:gap-2",
|
|
96
96
|
children: [
|
|
97
|
-
x === "edit" && D &&
|
|
97
|
+
x === "edit" && D && F && /* @__PURE__ */ _(e, {
|
|
98
98
|
type: "button",
|
|
99
99
|
className: "ttw:mr-auto",
|
|
100
100
|
variant: "destructive",
|
|
101
101
|
size: "lg",
|
|
102
|
-
onClick:
|
|
103
|
-
children:
|
|
102
|
+
onClick: F,
|
|
103
|
+
children: L.deleteButton
|
|
104
104
|
}),
|
|
105
105
|
/* @__PURE__ */ _(e, {
|
|
106
106
|
type: "button",
|
|
107
107
|
variant: "ghost",
|
|
108
108
|
size: "lg",
|
|
109
|
-
onClick:
|
|
110
|
-
children:
|
|
109
|
+
onClick: P,
|
|
110
|
+
children: L.cancelButton
|
|
111
111
|
}),
|
|
112
112
|
/* @__PURE__ */ _(e, {
|
|
113
113
|
type: "submit",
|
|
114
|
-
form:
|
|
114
|
+
form: R,
|
|
115
115
|
size: "lg",
|
|
116
116
|
disabled: E,
|
|
117
|
-
children: x === "edit" ?
|
|
117
|
+
children: x === "edit" ? L.saveButton : L.createButton
|
|
118
118
|
})
|
|
119
119
|
]
|
|
120
120
|
})
|