@tesouro/embedded-components-react 0.5.144 → 0.5.146
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/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index10.js +53 -45
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js +50 -87
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index12.js +102 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index3.js +8 -12
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index4.js +11 -16
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js +17 -92
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js +91 -24
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js +18 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js +49 -86
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js +122 -53
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index2.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index3.js +38 -35
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index4.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +6 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import { SettingsWidgetAnalyticsEvent as l, WIDGET_NAME as u } from "./index2.js
|
|
|
18
18
|
import { ExpenseSettingsTabs as d } from "./index5.js";
|
|
19
19
|
import { InvoiceSettings as f } from "../../invoice-settings/feature/dist/index10.js";
|
|
20
20
|
import "../../invoice-settings/feature/dist/index.js";
|
|
21
|
-
import { TagsWidget as p } from "../../tags/feature/dist/
|
|
21
|
+
import { TagsWidget as p } from "../../tags/feature/dist/index12.js";
|
|
22
22
|
import "../../tags/feature/dist/index.js";
|
|
23
23
|
import { BankDisclosuresWidget as m } from "../../../shared/bank-disclosures/feature/dist/lib/BankDisclosuresWidget/BankDisclosuresWidget.js";
|
|
24
24
|
import "../../../shared/bank-disclosures/feature/dist/index.js";
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TagsWidget as e } from "./
|
|
1
|
+
import { TagsWidget as e } from "./index12.js";
|
|
2
2
|
export { e as TagsWidget };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index10.js
CHANGED
|
@@ -2,53 +2,61 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { useTagForm as i } from "./index8.js";
|
|
10
|
-
import { useTagsTable as a } from "./index9.js";
|
|
11
|
-
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
5
|
+
import { buildTagRows as e, sortFieldForColumn as t } from "./index6.js";
|
|
6
|
+
import { useTagsQuery as n } from "../../data-access/dist/index2.js";
|
|
7
|
+
import "../../data-access/dist/index.js";
|
|
8
|
+
import { useCallback as r, useMemo as i, useState as a } from "react";
|
|
12
9
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index10.js
|
|
13
|
-
function
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}), [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
function o({ keywordsByTagId: o, userNamesById: s }) {
|
|
11
|
+
let [c, l] = a([{
|
|
12
|
+
id: "createdAtLabel",
|
|
13
|
+
desc: !0
|
|
14
|
+
}]), [u, d] = a(10), [f, p] = a(), m = t(c[0]?.id), h = c[0]?.desc ? "desc" : "asc", g = n({
|
|
15
|
+
sort: m,
|
|
16
|
+
order: h,
|
|
17
|
+
limit: u,
|
|
18
|
+
pagination_token: f
|
|
19
|
+
}), _ = i(() => e({
|
|
20
|
+
tags: g.data?.data ?? [],
|
|
21
|
+
keywordsByTagId: o,
|
|
22
|
+
userNamesById: s
|
|
23
|
+
}), [
|
|
24
|
+
g.data,
|
|
25
|
+
o,
|
|
26
|
+
s
|
|
27
|
+
]), v = r((e) => (g.data?.data ?? []).find((t) => t.id === e), [g.data]), y = r((e) => {
|
|
28
|
+
let n = typeof e == "function" ? e(c) : e;
|
|
29
|
+
l(n);
|
|
30
|
+
let r = t(n[0]?.id), i = n[0]?.desc ? "desc" : "asc";
|
|
31
|
+
(r !== m || i !== h) && p(void 0);
|
|
32
|
+
}, [
|
|
33
|
+
c,
|
|
34
|
+
m,
|
|
35
|
+
h
|
|
36
|
+
]), b = r((e) => {
|
|
37
|
+
d(e), p(void 0);
|
|
38
|
+
}, []), x = r(() => {
|
|
39
|
+
p(g.data?.next_pagination_token ?? void 0);
|
|
40
|
+
}, [g.data?.next_pagination_token]), S = r(() => {
|
|
41
|
+
p(g.data?.prev_pagination_token ?? void 0);
|
|
42
|
+
}, [g.data?.prev_pagination_token]), C = r(() => {
|
|
43
|
+
g.refetch();
|
|
44
|
+
}, [g]);
|
|
30
45
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
handleFormDelete: o(() => {
|
|
45
|
-
h.close(), d && g.requestDelete(d);
|
|
46
|
-
}, [
|
|
47
|
-
h,
|
|
48
|
-
d,
|
|
49
|
-
g
|
|
50
|
-
])
|
|
46
|
+
rows: _,
|
|
47
|
+
isLoading: g.isLoading,
|
|
48
|
+
isError: g.isError,
|
|
49
|
+
sorting: c,
|
|
50
|
+
onSortingChange: y,
|
|
51
|
+
pageSize: u,
|
|
52
|
+
onPageSizeChange: b,
|
|
53
|
+
hasNextPage: !!g.data?.next_pagination_token,
|
|
54
|
+
hasPrevPage: !!g.data?.prev_pagination_token,
|
|
55
|
+
onNextPage: x,
|
|
56
|
+
onPrevPage: S,
|
|
57
|
+
onRetry: C,
|
|
58
|
+
findTag: v
|
|
51
59
|
};
|
|
52
60
|
}
|
|
53
61
|
//#endregion
|
|
54
|
-
export {
|
|
62
|
+
export { o as useTagsTable };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js
CHANGED
|
@@ -2,94 +2,57 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { TagDeleteDialog as s } from "../../ui/dist/index4.js";
|
|
13
|
-
import { TagFormSheet as c } from "../../ui/dist/index5.js";
|
|
14
|
-
import "../../ui/dist/index.js";
|
|
15
|
-
import { useEffect as l } from "react";
|
|
16
|
-
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
5
|
+
import { TAG_MESSAGE_LABELS_EN as e } from "./index5.js";
|
|
6
|
+
import { hasSelectedText as t } from "./index6.js";
|
|
7
|
+
import { useEntitySettings as n } from "./index7.js";
|
|
8
|
+
import { useTagDelete as r } from "./index8.js";
|
|
9
|
+
import { useTagForm as i } from "./index9.js";
|
|
10
|
+
import { useTagsTable as a } from "./index10.js";
|
|
11
|
+
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
17
12
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
onCreateClick: y.openCreate,
|
|
39
|
-
onRowClick: x,
|
|
40
|
-
onDeleteClick: S,
|
|
41
|
-
onRetry: v.onRetry,
|
|
42
|
-
labels: r,
|
|
43
|
-
emptyStateTestId: "tags-widget-empty-state"
|
|
44
|
-
}),
|
|
45
|
-
/* @__PURE__ */ d(c, {
|
|
46
|
-
open: y.open,
|
|
47
|
-
onOpenChange: y.onOpenChange,
|
|
48
|
-
mode: y.mode,
|
|
49
|
-
values: y.values,
|
|
50
|
-
errors: y.errors,
|
|
51
|
-
categoryOptions: y.categoryOptions,
|
|
52
|
-
tagName: _?.name,
|
|
53
|
-
inProgress: y.isSubmitting,
|
|
54
|
-
showDelete: !0,
|
|
55
|
-
onNameChange: y.onNameChange,
|
|
56
|
-
onCategoryChange: y.onCategoryChange,
|
|
57
|
-
onKeywordsChange: y.onKeywordsChange,
|
|
58
|
-
onKeywordsInputChange: y.onKeywordsInputChange,
|
|
59
|
-
onSubmit: y.submit,
|
|
60
|
-
onCancel: y.close,
|
|
61
|
-
onDelete: C,
|
|
62
|
-
labels: p
|
|
63
|
-
}),
|
|
64
|
-
/* @__PURE__ */ d(s, {
|
|
65
|
-
open: b.open,
|
|
66
|
-
onOpenChange: b.onOpenChange,
|
|
67
|
-
tagName: _?.name ?? "",
|
|
68
|
-
isDeleting: b.isDeleting,
|
|
69
|
-
onConfirm: b.confirm,
|
|
70
|
-
onCancel: b.cancel,
|
|
71
|
-
labels: m
|
|
72
|
-
})
|
|
73
|
-
] });
|
|
74
|
-
}
|
|
75
|
-
function m({ baseUrl: e, widgetToken: n, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: f, analytics: m, disclosuresAcceptance: h, providerLabels: g, ..._ }) {
|
|
76
|
-
return /* @__PURE__ */ d(t, {
|
|
77
|
-
widgetName: r,
|
|
78
|
-
baseUrl: e,
|
|
79
|
-
widgetToken: n,
|
|
80
|
-
organizationId: i,
|
|
81
|
-
configClient: a,
|
|
82
|
-
gatewayRouting: o,
|
|
83
|
-
linkComponent: s,
|
|
84
|
-
implementation: c,
|
|
85
|
-
uiFramework: l,
|
|
86
|
-
errorFallback: u,
|
|
87
|
-
onError: f,
|
|
88
|
-
analytics: m,
|
|
89
|
-
disclosuresAcceptance: h,
|
|
90
|
-
providerLabels: g,
|
|
91
|
-
children: /* @__PURE__ */ d(p, { ..._ })
|
|
13
|
+
function l({ messageLabels: l, canWrite: u, canMutate: d }) {
|
|
14
|
+
let f = s(() => ({
|
|
15
|
+
...e,
|
|
16
|
+
...l
|
|
17
|
+
}), [l]), [p, m] = c(), h = n({ messages: f }), g = a({
|
|
18
|
+
keywordsByTagId: h.keywordsByTagId,
|
|
19
|
+
userNamesById: h.userNamesById
|
|
20
|
+
}), _ = i({
|
|
21
|
+
selectedTag: p,
|
|
22
|
+
setSelectedTag: m,
|
|
23
|
+
settings: h,
|
|
24
|
+
messages: f,
|
|
25
|
+
canWrite: u,
|
|
26
|
+
canMutate: d
|
|
27
|
+
}), v = r({
|
|
28
|
+
selectedTag: p,
|
|
29
|
+
setSelectedTag: m,
|
|
30
|
+
settings: h,
|
|
31
|
+
canWrite: u,
|
|
32
|
+
canMutate: d
|
|
92
33
|
});
|
|
34
|
+
return {
|
|
35
|
+
selectedTag: p,
|
|
36
|
+
table: g,
|
|
37
|
+
form: _,
|
|
38
|
+
del: v,
|
|
39
|
+
handleRowClick: o((e) => {
|
|
40
|
+
if (t()) return;
|
|
41
|
+
let n = g.findTag(e.id);
|
|
42
|
+
n && _.openEdit(n);
|
|
43
|
+
}, [g, _]),
|
|
44
|
+
handleDeleteClick: o((e) => {
|
|
45
|
+
let t = g.findTag(e.id);
|
|
46
|
+
t && v.requestDelete(t);
|
|
47
|
+
}, [g, v]),
|
|
48
|
+
handleFormDelete: o(() => {
|
|
49
|
+
_.close(), p && v.requestDelete(p);
|
|
50
|
+
}, [
|
|
51
|
+
_,
|
|
52
|
+
p,
|
|
53
|
+
v
|
|
54
|
+
])
|
|
55
|
+
};
|
|
93
56
|
}
|
|
94
57
|
//#endregion
|
|
95
|
-
export {
|
|
58
|
+
export { l as useTagsWidget };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index12.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useAnalyticsTrack as e } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
6
|
+
import { WidgetProvider as t } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
7
|
+
import { useWidgetConfig as n, useWidgetInitStaleForToken as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
8
|
+
import "../../../../shared/feature/dist/index.js";
|
|
9
|
+
import { TagsWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
|
|
10
|
+
import { getTagsPermissions as o } from "./index3.js";
|
|
11
|
+
import { PAGE_SIZE_OPTIONS as s } from "./index4.js";
|
|
12
|
+
import { useTagsWidget as c } from "./index11.js";
|
|
13
|
+
import { TagsScreen as l } from "../../ui/dist/index3.js";
|
|
14
|
+
import { TagDeleteDialog as u } from "../../ui/dist/index4.js";
|
|
15
|
+
import { TagFormSheet as d } from "../../ui/dist/index5.js";
|
|
16
|
+
import "../../ui/dist/index.js";
|
|
17
|
+
import { useEffect as f, useMemo as p } from "react";
|
|
18
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
19
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index12.js
|
|
20
|
+
function _({ pageSizeOptions: t = s, screenLabels: a, formLabels: _, deleteLabels: v, messageLabels: y }) {
|
|
21
|
+
let b = e();
|
|
22
|
+
f(() => {
|
|
23
|
+
b(i.Mounted);
|
|
24
|
+
}, [b]);
|
|
25
|
+
let { initResponse: x } = n(), S = r(), { canWrite: C } = p(() => o(x?.scopes), [x?.scopes]), { selectedTag: w, table: T, form: E, del: D, handleRowClick: O, handleDeleteClick: k, handleFormDelete: A } = c({
|
|
26
|
+
messageLabels: y,
|
|
27
|
+
canWrite: C,
|
|
28
|
+
canMutate: C && !S
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ g(m, { children: [
|
|
31
|
+
/* @__PURE__ */ h(l, {
|
|
32
|
+
tags: T.rows,
|
|
33
|
+
isLoading: T.isLoading,
|
|
34
|
+
isError: T.isError,
|
|
35
|
+
sorting: T.sorting,
|
|
36
|
+
onSortingChange: T.onSortingChange,
|
|
37
|
+
pageSize: T.pageSize,
|
|
38
|
+
onPageSizeChange: T.onPageSizeChange,
|
|
39
|
+
pageSizeOptions: t,
|
|
40
|
+
hasNextPage: T.hasNextPage,
|
|
41
|
+
hasPrevPage: T.hasPrevPage,
|
|
42
|
+
onNextPage: T.onNextPage,
|
|
43
|
+
onPrevPage: T.onPrevPage,
|
|
44
|
+
onCreateClick: C ? E.openCreate : void 0,
|
|
45
|
+
onRowClick: C ? O : void 0,
|
|
46
|
+
onDeleteClick: C ? k : void 0,
|
|
47
|
+
onRetry: T.onRetry,
|
|
48
|
+
labels: a,
|
|
49
|
+
emptyStateTestId: "tags-widget-empty-state"
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ h(d, {
|
|
52
|
+
open: E.open,
|
|
53
|
+
onOpenChange: E.onOpenChange,
|
|
54
|
+
mode: E.mode,
|
|
55
|
+
values: E.values,
|
|
56
|
+
errors: E.errors,
|
|
57
|
+
categoryOptions: E.categoryOptions,
|
|
58
|
+
tagName: w?.name,
|
|
59
|
+
inProgress: E.isSubmitting || S,
|
|
60
|
+
showDelete: C,
|
|
61
|
+
onNameChange: E.onNameChange,
|
|
62
|
+
onCategoryChange: E.onCategoryChange,
|
|
63
|
+
onKeywordsChange: E.onKeywordsChange,
|
|
64
|
+
onKeywordsInputChange: E.onKeywordsInputChange,
|
|
65
|
+
onSubmit: E.submit,
|
|
66
|
+
onCancel: E.close,
|
|
67
|
+
onDelete: A,
|
|
68
|
+
labels: _
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ h(u, {
|
|
71
|
+
open: D.open,
|
|
72
|
+
onOpenChange: D.onOpenChange,
|
|
73
|
+
tagName: w?.name ?? "",
|
|
74
|
+
isDeleting: D.isDeleting,
|
|
75
|
+
confirmDisabled: S,
|
|
76
|
+
onConfirm: D.confirm,
|
|
77
|
+
onCancel: D.cancel,
|
|
78
|
+
labels: v
|
|
79
|
+
})
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
function v({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...g }) {
|
|
83
|
+
return /* @__PURE__ */ h(t, {
|
|
84
|
+
widgetName: a,
|
|
85
|
+
baseUrl: e,
|
|
86
|
+
widgetToken: n,
|
|
87
|
+
organizationId: r,
|
|
88
|
+
configClient: i,
|
|
89
|
+
gatewayRouting: o,
|
|
90
|
+
linkComponent: s,
|
|
91
|
+
implementation: c,
|
|
92
|
+
uiFramework: l,
|
|
93
|
+
errorFallback: u,
|
|
94
|
+
onError: d,
|
|
95
|
+
analytics: f,
|
|
96
|
+
disclosuresAcceptance: p,
|
|
97
|
+
providerLabels: m,
|
|
98
|
+
children: /* @__PURE__ */ h(_, { ...g })
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { v as TagsWidget, v as default };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index3.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
import { hasAnyScope as e } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
2
|
+
import { Scope as t } from "../../../../shared/data-access/dist/lib/scopes.js";
|
|
3
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
1
4
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index3.js
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
100
|
|
7
|
-
], t = {
|
|
8
|
-
name: "",
|
|
9
|
-
category: "",
|
|
10
|
-
keywords: [],
|
|
11
|
-
keywordsInput: ""
|
|
12
|
-
};
|
|
5
|
+
var n = [t.AccountingConfigWriteOrg];
|
|
6
|
+
function r(t) {
|
|
7
|
+
return { canWrite: e(new Set(t ?? []), n) };
|
|
8
|
+
}
|
|
13
9
|
//#endregion
|
|
14
|
-
export {
|
|
10
|
+
export { r as getTagsPermissions };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index4.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index4.js
|
|
2
|
-
var e =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
project: "Project",
|
|
13
|
-
cost_center: "Cost Center",
|
|
14
|
-
vendor_type: "Vendor Type",
|
|
15
|
-
payment_method: "Payment Method",
|
|
16
|
-
approval_status: "Approval Status"
|
|
2
|
+
var e = [
|
|
3
|
+
10,
|
|
4
|
+
25,
|
|
5
|
+
50,
|
|
6
|
+
100
|
|
7
|
+
], t = {
|
|
8
|
+
name: "",
|
|
9
|
+
category: "",
|
|
10
|
+
keywords: [],
|
|
11
|
+
keywordsInput: ""
|
|
17
12
|
};
|
|
18
13
|
//#endregion
|
|
19
|
-
export { t as
|
|
14
|
+
export { t as EMPTY_FORM_VALUES, e as PAGE_SIZE_OPTIONS };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js
CHANGED
|
@@ -1,95 +1,20 @@
|
|
|
1
|
-
import { extractApiErrorMessage as e } from "../../../../shared/util/dist/lib/apiErrors.js";
|
|
2
|
-
import { TAG_CATEGORY_LABELS_EN as t, TAG_MESSAGE_LABELS_EN as n } from "./index4.js";
|
|
3
1
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
keywordsNotSaved: "The tag was saved, but its keywords were not. Save again to finish."
|
|
10
|
+
}, t = {
|
|
11
|
+
document_type: "Document Type",
|
|
12
|
+
department: "Department",
|
|
13
|
+
project: "Project",
|
|
14
|
+
cost_center: "Cost Center",
|
|
15
|
+
vendor_type: "Vendor Type",
|
|
16
|
+
payment_method: "Payment Method",
|
|
17
|
+
approval_status: "Approval Status"
|
|
7
18
|
};
|
|
8
|
-
function i(e) {
|
|
9
|
-
return e && r[e] || "created_at";
|
|
10
|
-
}
|
|
11
|
-
var a = new Intl.DateTimeFormat(void 0, {
|
|
12
|
-
year: "numeric",
|
|
13
|
-
month: "short",
|
|
14
|
-
day: "numeric"
|
|
15
|
-
});
|
|
16
|
-
function o(e) {
|
|
17
|
-
if (!e) return "";
|
|
18
|
-
let t = new Date(e);
|
|
19
|
-
return Number.isNaN(t.getTime()) ? "" : a.format(t);
|
|
20
|
-
}
|
|
21
|
-
function s() {
|
|
22
|
-
let e = globalThis.getSelection?.();
|
|
23
|
-
return !!(e && e.toString().length > 0);
|
|
24
|
-
}
|
|
25
|
-
function c(e) {
|
|
26
|
-
let t = {};
|
|
27
|
-
for (let n of e ?? []) t[n.tag_id] = n.keywords;
|
|
28
|
-
return t;
|
|
29
|
-
}
|
|
30
|
-
function l(e) {
|
|
31
|
-
let t = {};
|
|
32
|
-
for (let n of e ?? []) t[n.id] = `${n.first_name ?? ""} ${n.last_name ?? ""}`.trim();
|
|
33
|
-
return t;
|
|
34
|
-
}
|
|
35
|
-
function u({ tags: e, keywordsByTagId: t, userNamesById: n }) {
|
|
36
|
-
return e.map((e) => ({
|
|
37
|
-
id: e.id,
|
|
38
|
-
name: e.name,
|
|
39
|
-
categoryLabel: p(e.category),
|
|
40
|
-
keywords: (t[e.id] ?? []).join(", "),
|
|
41
|
-
createdAtLabel: o(e.created_at),
|
|
42
|
-
updatedAtLabel: o(e.updated_at),
|
|
43
|
-
createdByLabel: e.created_by_entity_user_id ? n[e.created_by_entity_user_id] ?? "" : ""
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
function d(e, t, n) {
|
|
47
|
-
let r = e ?? [], i = r.filter((e) => e.tag_id !== t), a = Array.from(new Set(n));
|
|
48
|
-
return i.length === r.length && a.length === 0 ? {
|
|
49
|
-
changed: !1,
|
|
50
|
-
next: r
|
|
51
|
-
} : {
|
|
52
|
-
changed: !0,
|
|
53
|
-
next: a.length ? [...i, {
|
|
54
|
-
tag_id: t,
|
|
55
|
-
keywords: a,
|
|
56
|
-
enabled: !0
|
|
57
|
-
}] : i
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
var f = [
|
|
61
|
-
"document_type",
|
|
62
|
-
"department",
|
|
63
|
-
"project",
|
|
64
|
-
"cost_center",
|
|
65
|
-
"vendor_type",
|
|
66
|
-
"payment_method",
|
|
67
|
-
"approval_status"
|
|
68
|
-
];
|
|
69
|
-
function p(e, n) {
|
|
70
|
-
return e ? n?.[e] ?? t[e] ?? "" : "";
|
|
71
|
-
}
|
|
72
|
-
function m(e) {
|
|
73
|
-
return f.map((t) => ({
|
|
74
|
-
value: t,
|
|
75
|
-
label: p(t, e)
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
function h(e, t = n) {
|
|
79
|
-
let r = {}, i = e.name.trim();
|
|
80
|
-
i.length === 0 ? r.name = t.nameRequired : i.length > 255 && (r.name = t.nameTooLong);
|
|
81
|
-
let a = e.keywords.some((e) => e.length < 2), o = e.keywords.some((e) => e.length > 25);
|
|
82
|
-
return a ? r.keywords = t.keywordTooShort : o && (r.keywords = t.keywordTooLong), r;
|
|
83
|
-
}
|
|
84
|
-
function g(e) {
|
|
85
|
-
return !!(e.name || e.keywords);
|
|
86
|
-
}
|
|
87
|
-
function _(e) {
|
|
88
|
-
return e === "This tag already exists.";
|
|
89
|
-
}
|
|
90
|
-
function v(t, r = n, { preferApiMessage: i = !1 } = {}) {
|
|
91
|
-
let a = e(t);
|
|
92
|
-
return _(a) ? { name: r.duplicateName } : { form: (i ? a : void 0) ?? r.genericError };
|
|
93
|
-
}
|
|
94
19
|
//#endregion
|
|
95
|
-
export {
|
|
20
|
+
export { t as TAG_CATEGORY_LABELS_EN, e as TAG_MESSAGE_LABELS_EN };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js
CHANGED
|
@@ -1,28 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { buildKeywordsByTagId as e, buildUserNamesById as t } from "./index5.js";
|
|
6
|
-
import { useMyEntityQuery as n } from "../../data-access/dist/index7.js";
|
|
7
|
-
import { useEntitySettingsQuery as r } from "../../data-access/dist/index8.js";
|
|
8
|
-
import { useEntityUsersQuery as i } from "../../data-access/dist/index10.js";
|
|
9
|
-
import "../../data-access/dist/index.js";
|
|
10
|
-
import { useCallback as a, useMemo as o } from "react";
|
|
1
|
+
import { extractApiErrorMessage as e } from "../../../../shared/util/dist/lib/apiErrors.js";
|
|
2
|
+
import { TAG_CATEGORY_LABELS_EN as t, TAG_MESSAGE_LABELS_EN as n } from "./index5.js";
|
|
11
3
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
var r = {
|
|
5
|
+
createdAtLabel: "created_at",
|
|
6
|
+
updatedAtLabel: "updated_at"
|
|
7
|
+
};
|
|
8
|
+
function i(e) {
|
|
9
|
+
return e && r[e] || "created_at";
|
|
10
|
+
}
|
|
11
|
+
var a = new Intl.DateTimeFormat(void 0, {
|
|
12
|
+
year: "numeric",
|
|
13
|
+
month: "short",
|
|
14
|
+
day: "numeric"
|
|
15
|
+
});
|
|
16
|
+
function o(e) {
|
|
17
|
+
if (!e) return "";
|
|
18
|
+
let t = new Date(e);
|
|
19
|
+
return Number.isNaN(t.getTime()) ? "" : a.format(t);
|
|
20
|
+
}
|
|
21
|
+
function s() {
|
|
22
|
+
let e = globalThis.getSelection?.();
|
|
23
|
+
return !!(e && e.toString().length > 0);
|
|
24
|
+
}
|
|
25
|
+
function c(e) {
|
|
26
|
+
let t = {};
|
|
27
|
+
for (let n of e ?? []) t[n.tag_id] = n.keywords;
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
function l(e) {
|
|
31
|
+
let t = {};
|
|
32
|
+
for (let n of e ?? []) t[n.id] = `${n.first_name ?? ""} ${n.last_name ?? ""}`.trim();
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
function u({ tags: e, keywordsByTagId: t, userNamesById: n }) {
|
|
36
|
+
return e.map((e) => ({
|
|
37
|
+
id: e.id,
|
|
38
|
+
name: e.name,
|
|
39
|
+
categoryLabel: p(e.category),
|
|
40
|
+
keywords: (t[e.id] ?? []).join(", "),
|
|
41
|
+
createdAtLabel: o(e.created_at),
|
|
42
|
+
updatedAtLabel: o(e.updated_at),
|
|
43
|
+
createdByLabel: e.created_by_entity_user_id ? n[e.created_by_entity_user_id] ?? "" : ""
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function d(e, t, n) {
|
|
47
|
+
let r = e ?? [], i = r.filter((e) => e.tag_id !== t), a = Array.from(new Set(n));
|
|
48
|
+
return i.length === r.length && a.length === 0 ? {
|
|
49
|
+
changed: !1,
|
|
50
|
+
next: r
|
|
51
|
+
} : {
|
|
52
|
+
changed: !0,
|
|
53
|
+
next: a.length ? [...i, {
|
|
54
|
+
tag_id: t,
|
|
55
|
+
keywords: a,
|
|
56
|
+
enabled: !0
|
|
57
|
+
}] : i
|
|
25
58
|
};
|
|
26
59
|
}
|
|
60
|
+
var f = [
|
|
61
|
+
"document_type",
|
|
62
|
+
"department",
|
|
63
|
+
"project",
|
|
64
|
+
"cost_center",
|
|
65
|
+
"vendor_type",
|
|
66
|
+
"payment_method",
|
|
67
|
+
"approval_status"
|
|
68
|
+
];
|
|
69
|
+
function p(e, n) {
|
|
70
|
+
return e ? n?.[e] ?? t[e] ?? "" : "";
|
|
71
|
+
}
|
|
72
|
+
function m(e) {
|
|
73
|
+
return f.map((t) => ({
|
|
74
|
+
value: t,
|
|
75
|
+
label: p(t, e)
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
function h(e, t = n) {
|
|
79
|
+
let r = {}, i = e.name.trim();
|
|
80
|
+
i.length === 0 ? r.name = t.nameRequired : i.length > 255 && (r.name = t.nameTooLong);
|
|
81
|
+
let a = e.keywords.some((e) => e.length < 2), o = e.keywords.some((e) => e.length > 25);
|
|
82
|
+
return a ? r.keywords = t.keywordTooShort : o && (r.keywords = t.keywordTooLong), r;
|
|
83
|
+
}
|
|
84
|
+
function g(e) {
|
|
85
|
+
return !!(e.name || e.keywords);
|
|
86
|
+
}
|
|
87
|
+
function _(e) {
|
|
88
|
+
return e === "This tag already exists.";
|
|
89
|
+
}
|
|
90
|
+
function v(t, r = n, { preferApiMessage: i = !1 } = {}) {
|
|
91
|
+
let a = e(t);
|
|
92
|
+
return _(a) ? { name: r.duplicateName } : { form: (i ? a : void 0) ?? r.genericError };
|
|
93
|
+
}
|
|
27
94
|
//#endregion
|
|
28
|
-
export { s as
|
|
95
|
+
export { f as TAG_CATEGORIES, c as buildKeywordsByTagId, u as buildTagRows, l as buildUserNamesById, d as computeNextOcrAutoTagging, o as formatTagDate, m as getCategoryOptions, p as getTagCategoryLabel, g as hasFormErrors, s as hasSelectedText, _ as isDuplicateTagNameError, v as resolveTagSubmitError, i as sortFieldForColumn, h as validateTagForm };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js
CHANGED
|
@@ -2,45 +2,27 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { buildKeywordsByTagId as e, buildUserNamesById as t } from "./index6.js";
|
|
6
|
+
import { useMyEntityQuery as n } from "../../data-access/dist/index7.js";
|
|
7
|
+
import { useEntitySettingsQuery as r } from "../../data-access/dist/index8.js";
|
|
8
|
+
import { useEntityUsersQuery as i } from "../../data-access/dist/index10.js";
|
|
8
9
|
import "../../data-access/dist/index.js";
|
|
9
|
-
import { useCallback as
|
|
10
|
+
import { useCallback as a, useMemo as o } from "react";
|
|
10
11
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
e
|
|
16
|
-
}, [
|
|
12
|
+
function s({ messages: s }) {
|
|
13
|
+
let c = n().data?.id, l = r(c), u = i(), d = o(() => e(l.data?.payables_ocr_auto_tagging), [l.data]), f = o(() => t(u.data?.data), [u.data]), p = a(async () => (await l.refetch()).data ?? l.data, [l]), m = a(async () => {
|
|
14
|
+
let e = await p();
|
|
15
|
+
if (!e) throw Error(s.genericError);
|
|
16
|
+
return e;
|
|
17
|
+
}, [s.genericError, p]);
|
|
17
18
|
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (await u.mutateAsync({ path: { tag_id: a.id } }), c && t) {
|
|
25
|
-
let { changed: n, next: r } = e(t.payables_ocr_auto_tagging, a.id, []);
|
|
26
|
-
n && await d.mutateAsync({
|
|
27
|
-
path: { entity_id: c },
|
|
28
|
-
body: { payables_ocr_auto_tagging: r }
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
p(!1), o(void 0);
|
|
32
|
-
} catch {}
|
|
33
|
-
}, [
|
|
34
|
-
a,
|
|
35
|
-
c,
|
|
36
|
-
l,
|
|
37
|
-
u,
|
|
38
|
-
d,
|
|
39
|
-
o
|
|
40
|
-
]),
|
|
41
|
-
cancel: g,
|
|
42
|
-
isDeleting: u.isPending
|
|
19
|
+
entityId: c,
|
|
20
|
+
keywordsByTagId: d,
|
|
21
|
+
userNamesById: f,
|
|
22
|
+
settingsData: l.data,
|
|
23
|
+
refetchSettings: p,
|
|
24
|
+
requireFreshSettings: m
|
|
43
25
|
};
|
|
44
26
|
}
|
|
45
27
|
//#endregion
|
|
46
|
-
export {
|
|
28
|
+
export { s as useEntitySettings };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js
CHANGED
|
@@ -2,100 +2,63 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useUpdateTagMutation as c } from "../../data-access/dist/index5.js";
|
|
9
|
-
import { useUpdateEntitySettingsMutation as l } from "../../data-access/dist/index9.js";
|
|
5
|
+
import { computeNextOcrAutoTagging as e } from "./index6.js";
|
|
6
|
+
import { useDeleteTagMutation as t } from "../../data-access/dist/index6.js";
|
|
7
|
+
import { useUpdateEntitySettingsMutation as n } from "../../data-access/dist/index9.js";
|
|
10
8
|
import "../../data-access/dist/index.js";
|
|
11
|
-
import { useCallback as
|
|
9
|
+
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
12
10
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js
|
|
13
|
-
function
|
|
14
|
-
let { entityId:
|
|
11
|
+
function s({ selectedTag: s, setSelectedTag: c, settings: l, canWrite: u, canMutate: d }) {
|
|
12
|
+
let { entityId: f, requireFreshSettings: p } = l, m = t(), h = n(), [g, _] = o(!1), v = a(0), y = r(() => {
|
|
13
|
+
v.current += 1;
|
|
14
|
+
}, []);
|
|
15
|
+
i(() => {
|
|
16
|
+
u || (y(), _(!1));
|
|
17
|
+
}, [u, y]);
|
|
18
|
+
let b = a(d);
|
|
19
|
+
b.current = d;
|
|
20
|
+
let x = r((e) => {
|
|
21
|
+
u && (y(), c(e), _(!0));
|
|
22
|
+
}, [
|
|
23
|
+
u,
|
|
24
|
+
y,
|
|
25
|
+
c
|
|
26
|
+
]), S = r((e) => {
|
|
27
|
+
e || (y(), _(!1));
|
|
28
|
+
}, [y]), C = r(() => {
|
|
29
|
+
y(), _(!1);
|
|
30
|
+
}, [y]);
|
|
15
31
|
return {
|
|
16
|
-
open:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
openCreate: u(() => {
|
|
23
|
-
D("create"), m(void 0), k(e), j({}), T(!0);
|
|
24
|
-
}, [m]),
|
|
25
|
-
openEdit: u((e) => {
|
|
26
|
-
(async () => {
|
|
27
|
-
let n = v ?? await y(), r = t(n?.payables_ocr_auto_tagging);
|
|
28
|
-
m(e), D("edit"), k({
|
|
29
|
-
name: e.name,
|
|
30
|
-
category: e.category ?? "",
|
|
31
|
-
keywords: r[e.id] ?? [],
|
|
32
|
-
keywordsInput: ""
|
|
33
|
-
}), j({}), T(!0);
|
|
34
|
-
})();
|
|
35
|
-
}, [
|
|
36
|
-
v,
|
|
37
|
-
y,
|
|
38
|
-
m
|
|
39
|
-
]),
|
|
40
|
-
onOpenChange: u((e) => {
|
|
41
|
-
e || T(!1);
|
|
42
|
-
}, []),
|
|
43
|
-
close: u(() => T(!1), []),
|
|
44
|
-
onNameChange: u((e) => k((t) => ({
|
|
45
|
-
...t,
|
|
46
|
-
name: e
|
|
47
|
-
})), []),
|
|
48
|
-
onCategoryChange: u((e) => k((t) => ({
|
|
49
|
-
...t,
|
|
50
|
-
category: e
|
|
51
|
-
})), []),
|
|
52
|
-
onKeywordsChange: u((e) => k((t) => ({
|
|
53
|
-
...t,
|
|
54
|
-
keywords: e
|
|
55
|
-
})), []),
|
|
56
|
-
onKeywordsInputChange: u((e) => k((t) => ({
|
|
57
|
-
...t,
|
|
58
|
-
keywordsInput: e
|
|
59
|
-
})), []),
|
|
60
|
-
submit: u(async () => {
|
|
61
|
-
let e = o(O, g);
|
|
62
|
-
if (i(e)) {
|
|
63
|
-
j(e);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
j({});
|
|
67
|
-
let t = O.name.trim(), r = O.category === "" ? void 0 : O.category, s = {
|
|
68
|
-
name: t,
|
|
69
|
-
...r ? { category: r } : {}
|
|
70
|
-
};
|
|
32
|
+
open: g,
|
|
33
|
+
requestDelete: x,
|
|
34
|
+
onOpenChange: S,
|
|
35
|
+
confirm: r(async () => {
|
|
36
|
+
if (!d || !s) return;
|
|
37
|
+
let t = v.current, n = () => v.current === t;
|
|
71
38
|
try {
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
path: { entity_id: _ },
|
|
80
|
-
body: { payables_ocr_auto_tagging: i }
|
|
39
|
+
let t = f ? await p() : void 0;
|
|
40
|
+
if (!b.current) return;
|
|
41
|
+
if (await m.mutateAsync({ path: { tag_id: s.id } }), f && t) {
|
|
42
|
+
let { changed: n, next: r } = e(t.payables_ocr_auto_tagging, s.id, []);
|
|
43
|
+
n && b.current && await h.mutateAsync({
|
|
44
|
+
path: { entity_id: f },
|
|
45
|
+
body: { payables_ocr_auto_tagging: r }
|
|
81
46
|
});
|
|
82
47
|
}
|
|
83
|
-
|
|
84
|
-
} catch
|
|
85
|
-
j(a(e, g, { preferApiMessage: !0 }));
|
|
86
|
-
}
|
|
48
|
+
n() && (_(!1), c(void 0));
|
|
49
|
+
} catch {}
|
|
87
50
|
}, [
|
|
88
|
-
|
|
89
|
-
|
|
51
|
+
d,
|
|
52
|
+
s,
|
|
53
|
+
f,
|
|
90
54
|
p,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
])
|
|
55
|
+
m,
|
|
56
|
+
h,
|
|
57
|
+
c
|
|
58
|
+
]),
|
|
59
|
+
cancel: C,
|
|
60
|
+
isDeleting: m.isPending
|
|
98
61
|
};
|
|
99
62
|
}
|
|
100
63
|
//#endregion
|
|
101
|
-
export {
|
|
64
|
+
export { s as useTagDelete };
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js
CHANGED
|
@@ -2,61 +2,130 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { EMPTY_FORM_VALUES as e } from "./index4.js";
|
|
6
|
+
import { buildKeywordsByTagId as t, computeNextOcrAutoTagging as n, getCategoryOptions as r, hasFormErrors as i, resolveTagSubmitError as a, validateTagForm as o } from "./index6.js";
|
|
7
|
+
import { useCreateTagMutation as s } from "../../data-access/dist/index4.js";
|
|
8
|
+
import { useUpdateTagMutation as c } from "../../data-access/dist/index5.js";
|
|
9
|
+
import { useUpdateEntitySettingsMutation as l } from "../../data-access/dist/index9.js";
|
|
7
10
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import { useCallback as
|
|
11
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
9
12
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
13
|
+
function h({ selectedTag: h, setSelectedTag: g, settings: _, messages: v, canWrite: y, canMutate: b }) {
|
|
14
|
+
let { entityId: x, settingsData: S, refetchSettings: C, requireFreshSettings: w } = _, T = s(), E = c(), D = l(), [O, k] = m(!1), [A, j] = m("create"), [M, N] = m(e), [P, F] = m({}), I = f(() => r(), []), L = p(0), R = T.isPending || E.isPending || D.isPending, z = u(() => {
|
|
15
|
+
L.current += 1;
|
|
16
|
+
}, []);
|
|
17
|
+
d(() => {
|
|
18
|
+
y || k(!1);
|
|
19
|
+
}, [y]);
|
|
20
|
+
let B = p(y);
|
|
21
|
+
B.current = y;
|
|
22
|
+
let V = p(b);
|
|
23
|
+
return V.current = b, {
|
|
24
|
+
open: O,
|
|
25
|
+
mode: A,
|
|
26
|
+
values: M,
|
|
27
|
+
errors: P,
|
|
28
|
+
categoryOptions: I,
|
|
29
|
+
isSubmitting: R,
|
|
30
|
+
openCreate: u(() => {
|
|
31
|
+
y && (z(), j("create"), g(void 0), N(e), F({}), k(!0));
|
|
32
|
+
}, [
|
|
33
|
+
y,
|
|
34
|
+
z,
|
|
35
|
+
g
|
|
36
|
+
]),
|
|
37
|
+
openEdit: u((e) => {
|
|
38
|
+
y && (z(), (async () => {
|
|
39
|
+
let n = S ?? await C();
|
|
40
|
+
if (!B.current) return;
|
|
41
|
+
let r = t(n?.payables_ocr_auto_tagging);
|
|
42
|
+
g(e), j("edit"), N({
|
|
43
|
+
name: e.name,
|
|
44
|
+
category: e.category ?? "",
|
|
45
|
+
keywords: r[e.id] ?? [],
|
|
46
|
+
keywordsInput: ""
|
|
47
|
+
}), F({}), k(!0);
|
|
48
|
+
})());
|
|
49
|
+
}, [
|
|
50
|
+
y,
|
|
51
|
+
z,
|
|
52
|
+
S,
|
|
53
|
+
C,
|
|
54
|
+
g
|
|
55
|
+
]),
|
|
56
|
+
onOpenChange: u((e) => {
|
|
57
|
+
e || (z(), k(!1));
|
|
58
|
+
}, [z]),
|
|
59
|
+
close: u(() => {
|
|
60
|
+
z(), k(!1);
|
|
61
|
+
}, [z]),
|
|
62
|
+
onNameChange: u((e) => N((t) => ({
|
|
63
|
+
...t,
|
|
64
|
+
name: e
|
|
65
|
+
})), []),
|
|
66
|
+
onCategoryChange: u((e) => N((t) => ({
|
|
67
|
+
...t,
|
|
68
|
+
category: e
|
|
69
|
+
})), []),
|
|
70
|
+
onKeywordsChange: u((e) => N((t) => ({
|
|
71
|
+
...t,
|
|
72
|
+
keywords: e
|
|
73
|
+
})), []),
|
|
74
|
+
onKeywordsInputChange: u((e) => N((t) => ({
|
|
75
|
+
...t,
|
|
76
|
+
keywordsInput: e
|
|
77
|
+
})), []),
|
|
78
|
+
submit: u(async () => {
|
|
79
|
+
if (!b) return;
|
|
80
|
+
let e = o(M, v);
|
|
81
|
+
if (i(e)) {
|
|
82
|
+
F(e);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
F({});
|
|
86
|
+
let t = M.name.trim(), r = M.category === "" ? void 0 : M.category, s = {
|
|
87
|
+
name: t,
|
|
88
|
+
...r ? { category: r } : {}
|
|
89
|
+
}, c = L.current, l = () => L.current === c;
|
|
90
|
+
try {
|
|
91
|
+
let e = M.keywords.length > 0 || A === "edit", t = x && e ? await w() : void 0;
|
|
92
|
+
if (!V.current) return;
|
|
93
|
+
let r = A === "edit" && h ? await E.mutateAsync({
|
|
94
|
+
path: { tag_id: h.id },
|
|
95
|
+
body: s
|
|
96
|
+
}) : await T.mutateAsync({ body: s });
|
|
97
|
+
if (x && t) {
|
|
98
|
+
let { changed: e, next: i } = n(t.payables_ocr_auto_tagging, r.id, M.keywords);
|
|
99
|
+
if (e) {
|
|
100
|
+
if (!V.current) {
|
|
101
|
+
l() && (g(r), j("edit"), F({ form: v.keywordsNotSaved }));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
await D.mutateAsync({
|
|
105
|
+
path: { entity_id: x },
|
|
106
|
+
body: { payables_ocr_auto_tagging: i }
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
l() && k(!1);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
l() && F(a(e, v, { preferApiMessage: !0 }));
|
|
113
|
+
}
|
|
114
|
+
}, [
|
|
115
|
+
b,
|
|
116
|
+
M,
|
|
117
|
+
A,
|
|
118
|
+
j,
|
|
119
|
+
g,
|
|
120
|
+
h,
|
|
121
|
+
x,
|
|
122
|
+
T,
|
|
123
|
+
E,
|
|
124
|
+
D,
|
|
125
|
+
v,
|
|
126
|
+
w
|
|
127
|
+
])
|
|
59
128
|
};
|
|
60
129
|
}
|
|
61
130
|
//#endregion
|
|
62
|
-
export {
|
|
131
|
+
export { h as useTagForm };
|
|
@@ -13,6 +13,7 @@ var e = {
|
|
|
13
13
|
openActionsMenu: "Open actions menu",
|
|
14
14
|
emptyTitle: "No tags",
|
|
15
15
|
emptyDescription: "You don't have any tags yet. You can create your first tag.",
|
|
16
|
+
emptyDescriptionNoAction: "You don't have any tags yet.",
|
|
16
17
|
emptyAction: "Create new tag",
|
|
17
18
|
errorTitle: "Failed to load tags",
|
|
18
19
|
errorDescription: "Something went wrong while fetching your tags. Please try again.",
|
|
@@ -61,42 +61,46 @@ function y({ tags: d, isLoading: f, isError: p, sorting: y, onSortingChange: b,
|
|
|
61
61
|
{
|
|
62
62
|
accessorKey: "createdByLabel",
|
|
63
63
|
header: P.columnCreatedBy
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: "actions",
|
|
67
|
-
header: () => /* @__PURE__ */ l("div", {
|
|
68
|
-
className: "ttw:text-right",
|
|
69
|
-
children: P.columnActions
|
|
70
|
-
}),
|
|
71
|
-
cell: ({ row: t }) => /* @__PURE__ */ l("div", {
|
|
72
|
-
className: "ttw:flex ttw:justify-end",
|
|
73
|
-
children: /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
|
|
74
|
-
asChild: !0,
|
|
75
|
-
children: /* @__PURE__ */ u(e, {
|
|
76
|
-
variant: "ghost",
|
|
77
|
-
size: "icon-sm",
|
|
78
|
-
onClick: (e) => e.stopPropagation(),
|
|
79
|
-
children: [/* @__PURE__ */ l("span", {
|
|
80
|
-
className: "ttw:sr-only",
|
|
81
|
-
children: P.openActionsMenu
|
|
82
|
-
}), /* @__PURE__ */ l(m, { className: "ttw:size-4" })]
|
|
83
|
-
})
|
|
84
|
-
}), /* @__PURE__ */ l(r, {
|
|
85
|
-
align: "end",
|
|
86
|
-
children: /* @__PURE__ */ u(i, {
|
|
87
|
-
variant: "destructive",
|
|
88
|
-
onClick: (e) => {
|
|
89
|
-
e.stopPropagation(), A(t.original);
|
|
90
|
-
},
|
|
91
|
-
children: [/* @__PURE__ */ l(g, { className: "ttw:size-4" }), P.actionDelete]
|
|
92
|
-
})
|
|
93
|
-
})] })
|
|
94
|
-
})
|
|
95
64
|
}
|
|
96
65
|
];
|
|
66
|
+
A && F.push({
|
|
67
|
+
id: "actions",
|
|
68
|
+
header: () => /* @__PURE__ */ l("div", {
|
|
69
|
+
className: "ttw:text-right",
|
|
70
|
+
children: P.columnActions
|
|
71
|
+
}),
|
|
72
|
+
cell: ({ row: t }) => /* @__PURE__ */ l("div", {
|
|
73
|
+
className: "ttw:flex ttw:justify-end",
|
|
74
|
+
children: /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
|
|
75
|
+
asChild: !0,
|
|
76
|
+
children: /* @__PURE__ */ u(e, {
|
|
77
|
+
variant: "ghost",
|
|
78
|
+
size: "icon-sm",
|
|
79
|
+
onClick: (e) => e.stopPropagation(),
|
|
80
|
+
children: [/* @__PURE__ */ l("span", {
|
|
81
|
+
className: "ttw:sr-only",
|
|
82
|
+
children: P.openActionsMenu
|
|
83
|
+
}), /* @__PURE__ */ l(m, { className: "ttw:size-4" })]
|
|
84
|
+
})
|
|
85
|
+
}), /* @__PURE__ */ l(r, {
|
|
86
|
+
align: "end",
|
|
87
|
+
children: /* @__PURE__ */ u(i, {
|
|
88
|
+
variant: "destructive",
|
|
89
|
+
onClick: (e) => {
|
|
90
|
+
e.stopPropagation(), A(t.original);
|
|
91
|
+
},
|
|
92
|
+
children: [/* @__PURE__ */ l(g, { className: "ttw:size-4" }), P.actionDelete]
|
|
93
|
+
})
|
|
94
|
+
})] })
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
let I = k ? {
|
|
98
|
+
onRowClick: k,
|
|
99
|
+
rowAriaLabel: (e) => P.openRow(e.name)
|
|
100
|
+
} : {};
|
|
97
101
|
return /* @__PURE__ */ u("div", {
|
|
98
102
|
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
99
|
-
children: [/* @__PURE__ */ l("div", {
|
|
103
|
+
children: [O && /* @__PURE__ */ l("div", {
|
|
100
104
|
className: "ttw:flex ttw:items-center ttw:justify-end",
|
|
101
105
|
children: /* @__PURE__ */ u(e, {
|
|
102
106
|
size: "sm",
|
|
@@ -124,12 +128,11 @@ function y({ tags: d, isLoading: f, isError: p, sorting: y, onSortingChange: b,
|
|
|
124
128
|
hasPrevPage: T,
|
|
125
129
|
onNextPage: E,
|
|
126
130
|
onPrevPage: D,
|
|
127
|
-
|
|
128
|
-
rowAriaLabel: (e) => P.openRow(e.name),
|
|
131
|
+
...I,
|
|
129
132
|
children: /* @__PURE__ */ l(o, {
|
|
130
133
|
testId: N,
|
|
131
134
|
title: P.emptyTitle,
|
|
132
|
-
description: P.emptyDescription,
|
|
135
|
+
description: O ? P.emptyDescription : P.emptyDescriptionNoAction,
|
|
133
136
|
actionLabel: P.emptyAction,
|
|
134
137
|
onAction: O
|
|
135
138
|
})
|
|
@@ -2,25 +2,25 @@ import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n,
|
|
|
2
2
|
import { TAG_DELETE_DIALOG_LABELS_EN as s } from "./index2.js";
|
|
3
3
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
4
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index4.js
|
|
5
|
-
function u({ open: u, onOpenChange: d, tagName: f, isDeleting: p,
|
|
6
|
-
let
|
|
5
|
+
function u({ open: u, onOpenChange: d, tagName: f, isDeleting: p, confirmDisabled: m, onConfirm: h, onCancel: g, labels: _ }) {
|
|
6
|
+
let v = {
|
|
7
7
|
...s,
|
|
8
|
-
...
|
|
8
|
+
..._
|
|
9
9
|
};
|
|
10
10
|
return /* @__PURE__ */ c(e, {
|
|
11
11
|
open: u,
|
|
12
12
|
onOpenChange: d,
|
|
13
|
-
children: /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ l(i, { children: [/* @__PURE__ */ c(a, { children:
|
|
13
|
+
children: /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ l(i, { children: [/* @__PURE__ */ c(a, { children: v.title.replace("{name}", f) }), /* @__PURE__ */ c(n, { children: v.message })] }), /* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(o, {
|
|
14
14
|
variant: "ghost",
|
|
15
|
-
onClick:
|
|
15
|
+
onClick: g,
|
|
16
16
|
disabled: p,
|
|
17
|
-
children:
|
|
17
|
+
children: v.cancelButton
|
|
18
18
|
}), /* @__PURE__ */ c(o, {
|
|
19
19
|
variant: "destructive",
|
|
20
|
-
onClick:
|
|
21
|
-
disabled: p,
|
|
20
|
+
onClick: h,
|
|
21
|
+
disabled: p || m,
|
|
22
22
|
loading: p,
|
|
23
|
-
children:
|
|
23
|
+
children: v.confirmButton
|
|
24
24
|
})] })] })
|
|
25
25
|
});
|
|
26
26
|
}
|
package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js
CHANGED
|
@@ -7609,7 +7609,12 @@ e.object({
|
|
|
7609
7609
|
pagination_token: e.string().optional()
|
|
7610
7610
|
}), e.object({ "X-Organization-ID": e.uuid().optional() }), e.object({ "X-Organization-ID": e.uuid().optional() }), e.object({ id: e.string() }), e.object({ "X-Organization-ID": e.uuid().optional() }), e.object({ id: e.string() }), e.object({
|
|
7611
7611
|
limit: e.union([e.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }), e.string().regex(/^-?(?:0|[1-9]\d*)$/)]).optional().default(25),
|
|
7612
|
-
pagination_token: e.string().optional()
|
|
7612
|
+
pagination_token: e.string().optional(),
|
|
7613
|
+
status: e.array(Re).optional(),
|
|
7614
|
+
startDate: e.iso.date().optional(),
|
|
7615
|
+
endDate: e.iso.date().optional(),
|
|
7616
|
+
businessName: e.string().optional(),
|
|
7617
|
+
sortOrder: nd.optional().default("DESC")
|
|
7613
7618
|
}), e.object({ "X-Organization-ID": e.uuid().optional() }), e.object({ id: e.uuid() }), e.object({ id: e.uuid() }), e.object({ id: e.uuid() }), e.object({ id: e.uuid() }), e.object({ id: e.uuid() }), e.object({ id: e.uuid() }), e.object({ "X-Organization-ID": e.uuid().optional() }), e.object({
|
|
7614
7619
|
limit: e.union([e.int().min(-2147483648, { error: "Invalid value: Expected int32 to be >= -2147483648" }).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }), e.string().regex(/^-?(?:0|[1-9]\d*)$/)]).optional().default(25),
|
|
7615
7620
|
pagination_token: e.string().optional(),
|
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.146", n = "ddd6753f7399ae94ce634c7dcad020711a0b3097", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|