@tesouro/embedded-components-react 0.5.125 → 0.5.126

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.
Files changed (27) hide show
  1. package/dist/index.css +6 -0
  2. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index10.js +3 -2
  3. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js +9 -9
  4. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index4.js +58 -7
  5. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js +3 -98
  6. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js +8 -8
  8. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js +62 -62
  9. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js +7 -7
  10. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  11. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index.js +4 -3
  12. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index3.js +5 -9
  13. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index4.js +7 -31
  14. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index5.js +7 -8
  15. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index6.js +7 -5
  16. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/data-access/dist/index7.js +33 -0
  17. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/index.js +5 -0
  18. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/TagSelectorField.js +11 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/helpers.js +38 -0
  20. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/labels.js +19 -0
  21. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/permissions.js +4 -0
  22. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/feature/dist/lib/useTagCreateForm.js +6 -0
  23. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index.js +1 -0
  24. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index3.js +30 -30
  25. package/dist/libs/tesouro-embedded-components-react/shared/tag-selection/ui/dist/index4.js +4 -0
  26. package/dist/packages/shared-ui-shadcn/dist/index.js +1196 -1190
  27. package/package.json +1 -1
@@ -2,24 +2,26 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { deleteTagsId as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
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 "./index3.js";
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 useDeleteTagMutation };
35
+ export { o as useUpdateTagMutation };
@@ -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 };
@@ -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";
@@ -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 };
@@ -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 };
@@ -0,0 +1,4 @@
1
+ import { Scope as e } from "../../../../data-access/dist/lib/scopes.js";
2
+ import "../../../../data-access/dist/index.js";
3
+ e.AccountingConfigReadOrg, e.AccountingConfigWriteOrg;
4
+ //#endregion
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import "../../../data-access/dist/index.js";
6
+ import "react";
@@ -1,3 +1,4 @@
1
1
  import "./index2.js";
2
2
  import { TagFormSheet as e } from "./index3.js";
3
+ import "./index4.js";
3
4
  export { e as TagFormSheet };
@@ -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, onNameChange: O, onCategoryChange: k, onKeywordsChange: A, onKeywordsInputChange: j, onSubmit: M, onCancel: N, onDelete: P, labels: F }) {
7
- let I = {
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
- ...F
10
- }, L = g(), R = x === "edit" ? I.editTitle.replace("{name}", T ?? "") : I.createTitle;
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: R }), /* @__PURE__ */ _(d, {
17
+ /* @__PURE__ */ v(p, { children: [/* @__PURE__ */ _(m, { children: z }), /* @__PURE__ */ _(d, {
18
18
  className: "ttw:sr-only",
19
- children: R
19
+ children: z
20
20
  })] }),
21
21
  /* @__PURE__ */ _("form", {
22
- id: L,
22
+ id: R,
23
23
  onSubmit: (e) => {
24
- e.preventDefault(), e.stopPropagation(), M();
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: `${L}-name`,
39
- children: I.nameLabel
38
+ htmlFor: `${R}-name`,
39
+ children: L.nameLabel
40
40
  }),
41
41
  /* @__PURE__ */ _(t, {
42
- id: `${L}-name`,
42
+ id: `${R}-name`,
43
43
  autoFocus: !0,
44
44
  value: S.name,
45
45
  "aria-invalid": !!C?.name,
46
- onChange: (e) => O(e.target.value)
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: `${L}-category`,
58
- children: I.categoryLabel
57
+ htmlFor: `${R}-category`,
58
+ children: L.categoryLabel
59
59
  }), /* @__PURE__ */ v(i, {
60
60
  value: S.category === "" ? void 0 : S.category,
61
- onValueChange: k,
61
+ onValueChange: A,
62
62
  children: [/* @__PURE__ */ _(s, {
63
- id: `${L}-category`,
63
+ id: `${R}-category`,
64
64
  className: "ttw:w-full",
65
- children: /* @__PURE__ */ _(c, { placeholder: I.categoryPlaceholder })
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: I.keywordsLabel }),
75
+ /* @__PURE__ */ _(r, { children: L.keywordsLabel }),
76
76
  /* @__PURE__ */ _(n, {
77
77
  value: S.keywords,
78
- onChange: A,
78
+ onChange: j,
79
79
  inputValue: S.keywordsInput,
80
- onInputValueChange: j,
81
- placeholder: I.keywordsPlaceholder,
80
+ onInputValueChange: M,
81
+ placeholder: L.keywordsPlaceholder,
82
82
  "aria-invalid": !!C?.keywords,
83
- removeTagLabel: (e) => I.removeKeyword.replace("{keyword}", 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 && P && /* @__PURE__ */ _(e, {
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: P,
103
- children: I.deleteButton
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: N,
110
- children: I.cancelButton
109
+ onClick: P,
110
+ children: L.cancelButton
111
111
  }),
112
112
  /* @__PURE__ */ _(e, {
113
113
  type: "submit",
114
- form: L,
114
+ form: R,
115
115
  size: "lg",
116
116
  disabled: E,
117
- children: x === "edit" ? I.saveButton : I.createButton
117
+ children: x === "edit" ? L.saveButton : L.createButton
118
118
  })
119
119
  ]
120
120
  })
@@ -0,0 +1,4 @@
1
+ import "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import "react";
3
+ import "react/jsx-runtime";
4
+ import "lucide-react";