@tesouro/embedded-components-react 0.5.203 → 0.5.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -14
- package/dist/index.css +9 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +2 -2
- package/dist/lib/ProductsWidget.d.ts +4 -0
- package/dist/lib/ProductsWidget.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +40 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +26 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +79 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +53 -42
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +81 -283
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +47 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +303 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +68 -230
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +253 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +34 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +18 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +0 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +0 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +259 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +61 -412
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +407 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +73 -60
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +80 -331
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +183 -137
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +157 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js +136 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js +5 -30
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js +9 -19
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index6.js +22 -54
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index7.js +14 -40
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +57 -118
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index9.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +97 -93
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +35 -32
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +38 -38
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +213 -202
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +136 -116
- 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/product-catalog/data-access/dist/index10.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +79 -70
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnits.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +109 -107
- package/dist/packages/shared-ui-shadcn/dist/index.js +1763 -1749
- package/package.json +1 -1
|
@@ -1,24 +1,161 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { jsxs as
|
|
1
|
+
import { Button as e, Checkbox as t, Separator as n, Typography as r, cn as i } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { RECEIVABLE_FORM_SHEET_LABELS_EN as a } from "./index2.js";
|
|
3
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
import { FileText as l, ImageIcon as u, Loader2 as d, Trash2 as f, X as p } from "lucide-react";
|
|
4
5
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
function m({ view: m, isDragging: h, disabled: g, inputRef: _, onBrowseClick: v, onDragOver: y, onDragLeave: b, onDrop: x, onFilesSelect: S, onIncludeInEmailChange: C, onRemove: w, labels: T }) {
|
|
7
|
+
let E = {
|
|
8
|
+
...a,
|
|
9
|
+
...T
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ c("div", {
|
|
12
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ c("div", {
|
|
15
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
|
|
16
|
+
children: [/* @__PURE__ */ s(r, {
|
|
17
|
+
variant: "h4",
|
|
18
|
+
children: E.attachmentsHeading
|
|
19
|
+
}), /* @__PURE__ */ s(r, {
|
|
20
|
+
variant: "body2",
|
|
21
|
+
color: "muted",
|
|
22
|
+
className: "ttw:font-medium",
|
|
23
|
+
children: E.attachmentsDescription
|
|
24
|
+
})]
|
|
25
|
+
}),
|
|
26
|
+
m.showRows && /* @__PURE__ */ c("div", {
|
|
27
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
28
|
+
children: [m.emailCaption && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(r, {
|
|
29
|
+
variant: "caption",
|
|
30
|
+
color: "muted",
|
|
31
|
+
children: m.emailCaption
|
|
32
|
+
}), /* @__PURE__ */ s(n, {})] }), /* @__PURE__ */ c("ul", {
|
|
33
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
34
|
+
children: [m.attachedRows.map((n) => /* @__PURE__ */ c("li", {
|
|
35
|
+
className: "ttw:flex ttw:items-center ttw:gap-2",
|
|
36
|
+
children: [/* @__PURE__ */ s(t, {
|
|
37
|
+
checked: n.includeInEmail,
|
|
38
|
+
disabled: g,
|
|
39
|
+
"aria-label": n.includeInEmailLabel,
|
|
40
|
+
onCheckedChange: (e) => C(n.id, e === !0)
|
|
41
|
+
}), /* @__PURE__ */ c("div", {
|
|
42
|
+
className: "ttw:flex ttw:w-full ttw:items-center ttw:gap-3 ttw:rounded-lg ttw:bg-muted ttw:px-2 ttw:py-1",
|
|
43
|
+
children: [/* @__PURE__ */ c("div", {
|
|
44
|
+
className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:gap-1",
|
|
45
|
+
children: [/* @__PURE__ */ s(r, {
|
|
46
|
+
variant: "body2",
|
|
47
|
+
className: "ttw:truncate",
|
|
48
|
+
children: n.name
|
|
49
|
+
}), /* @__PURE__ */ c(r, {
|
|
50
|
+
variant: "body2",
|
|
51
|
+
color: "muted",
|
|
52
|
+
className: "ttw:shrink-0",
|
|
53
|
+
children: [
|
|
54
|
+
"(",
|
|
55
|
+
n.sizeLabel,
|
|
56
|
+
")"
|
|
57
|
+
]
|
|
58
|
+
})]
|
|
59
|
+
}), /* @__PURE__ */ s(e, {
|
|
60
|
+
type: "button",
|
|
61
|
+
variant: "ghost",
|
|
62
|
+
size: "icon",
|
|
63
|
+
className: "ttw:size-4",
|
|
64
|
+
disabled: g,
|
|
65
|
+
"aria-label": n.removeLabel,
|
|
66
|
+
onClick: () => w(n.id),
|
|
67
|
+
children: /* @__PURE__ */ s(f, { className: "ttw:size-4" })
|
|
68
|
+
})]
|
|
69
|
+
})]
|
|
70
|
+
}, n.id)), m.pendingRows.map((t) => /* @__PURE__ */ c("li", {
|
|
71
|
+
className: "ttw:flex ttw:w-full ttw:items-center ttw:gap-3 ttw:rounded-lg ttw:bg-muted ttw:px-2 ttw:py-1",
|
|
72
|
+
children: [
|
|
73
|
+
t.state === "uploading" ? /* @__PURE__ */ s(d, { className: "ttw:size-5 ttw:shrink-0 ttw:animate-spin ttw:text-muted-foreground" }) : /* @__PURE__ */ s(l, { className: "ttw:size-5 ttw:shrink-0 ttw:text-destructive" }),
|
|
74
|
+
/* @__PURE__ */ c("div", {
|
|
75
|
+
className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:flex-col",
|
|
76
|
+
children: [/* @__PURE__ */ s(r, {
|
|
77
|
+
variant: "body2",
|
|
78
|
+
className: "ttw:truncate",
|
|
79
|
+
children: t.name
|
|
80
|
+
}), t.state === "uploading" ? /* @__PURE__ */ s(r, {
|
|
81
|
+
variant: "caption",
|
|
82
|
+
color: "muted",
|
|
83
|
+
children: t.message
|
|
84
|
+
}) : /* @__PURE__ */ s(r, {
|
|
85
|
+
variant: "caption",
|
|
86
|
+
role: "alert",
|
|
87
|
+
className: "ttw:text-destructive",
|
|
88
|
+
children: t.message
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ s(e, {
|
|
92
|
+
type: "button",
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
size: "icon",
|
|
95
|
+
disabled: g,
|
|
96
|
+
"aria-label": t.removeLabel,
|
|
97
|
+
onClick: () => w(t.id),
|
|
98
|
+
children: /* @__PURE__ */ s(p, { className: "ttw:size-4" })
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}, t.id))]
|
|
102
|
+
})]
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ c("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
disabled: g,
|
|
107
|
+
onClick: v,
|
|
108
|
+
onDragOver: (e) => {
|
|
109
|
+
e.preventDefault(), y();
|
|
110
|
+
},
|
|
111
|
+
onDragLeave: (e) => {
|
|
112
|
+
e.preventDefault(), b();
|
|
113
|
+
},
|
|
114
|
+
onDrop: (e) => {
|
|
115
|
+
e.preventDefault(), x(e.dataTransfer.files);
|
|
116
|
+
},
|
|
117
|
+
className: i("ttw:flex ttw:w-full ttw:flex-col ttw:items-center ttw:gap-2 ttw:rounded-xl ttw:border ttw:border-dashed ttw:p-6 ttw:text-center ttw:disabled:cursor-not-allowed ttw:disabled:opacity-50", h ? "ttw:border-primary ttw:bg-primary/5" : "ttw:border-border ttw:bg-muted"),
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ s("span", {
|
|
120
|
+
className: "ttw:flex ttw:size-10 ttw:items-center ttw:justify-center ttw:rounded-full ttw:border ttw:border-border",
|
|
121
|
+
children: /* @__PURE__ */ s(u, { className: "ttw:size-5 ttw:text-muted-foreground" })
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ c(r, {
|
|
124
|
+
variant: "body2",
|
|
125
|
+
children: [
|
|
126
|
+
E.attachmentsDropPrompt,
|
|
127
|
+
" ",
|
|
128
|
+
/* @__PURE__ */ s("span", {
|
|
129
|
+
className: "ttw:text-primary ttw:underline",
|
|
130
|
+
children: E.attachmentsBrowseLink
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ s(r, {
|
|
135
|
+
variant: "caption",
|
|
136
|
+
color: "muted",
|
|
137
|
+
children: E.attachmentsFormatsHint
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
}),
|
|
141
|
+
m.countLimitMessage && /* @__PURE__ */ s(r, {
|
|
142
|
+
variant: "body2",
|
|
143
|
+
role: "alert",
|
|
144
|
+
className: "ttw:text-destructive",
|
|
145
|
+
children: m.countLimitMessage
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ s("input", {
|
|
148
|
+
ref: _,
|
|
149
|
+
type: "file",
|
|
150
|
+
multiple: !0,
|
|
151
|
+
tabIndex: -1,
|
|
152
|
+
"aria-hidden": !0,
|
|
153
|
+
className: "ttw:sr-only",
|
|
154
|
+
accept: m.accept,
|
|
155
|
+
onChange: (e) => S(e.target.files)
|
|
156
|
+
})
|
|
157
|
+
]
|
|
21
158
|
});
|
|
22
159
|
}
|
|
23
160
|
//#endregion
|
|
24
|
-
export {
|
|
161
|
+
export { m as ReceivableAttachmentsSection };
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import { Badge as e, cn as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { RECEIVABLE_STATUS_BADGE_LABELS_EN as n } from "./index2.js";
|
|
3
|
+
import { jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js
|
|
5
|
+
var i = {
|
|
6
|
+
danger: "ttw:border-red-200 ttw:bg-red-50 ttw:text-red-700 ttw:hover:bg-red-50",
|
|
7
|
+
info: "ttw:border-blue-200 ttw:bg-blue-50 ttw:text-blue-700 ttw:hover:bg-blue-50",
|
|
8
|
+
neutral: "ttw:border-border ttw:bg-muted ttw:text-foreground ttw:hover:bg-muted",
|
|
9
|
+
success: "ttw:border-emerald-200 ttw:bg-emerald-50 ttw:text-emerald-700 ttw:hover:bg-emerald-50",
|
|
10
|
+
warning: "ttw:border-amber-200 ttw:bg-amber-50 ttw:text-amber-800 ttw:hover:bg-amber-50"
|
|
11
|
+
};
|
|
12
|
+
function a({ status: a, tone: o, labels: s, icon: c }) {
|
|
13
|
+
let l = {
|
|
14
|
+
...n,
|
|
15
|
+
...s
|
|
16
|
+
}, u = l[a] ?? l.unknown;
|
|
17
|
+
return /* @__PURE__ */ r(e, {
|
|
18
|
+
variant: "outline",
|
|
19
|
+
className: t(c && "ttw:gap-1", i[o]),
|
|
20
|
+
children: [c, u]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as ReceivableStatusBadge, a as default };
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { XIcon as r } from "lucide-react";
|
|
5
|
-
t(function({ label: t, onClose: i, variant: a = "ghost", size: o = "icon", onClick: s, ...c }, l) {
|
|
6
|
-
return /* @__PURE__ */ n(e, {
|
|
7
|
-
ref: l,
|
|
8
|
-
variant: a,
|
|
9
|
-
size: o,
|
|
10
|
-
...c,
|
|
11
|
-
"aria-label": t,
|
|
12
|
-
onClick: (e) => {
|
|
13
|
-
s?.(e), i();
|
|
14
|
-
},
|
|
15
|
-
children: /* @__PURE__ */ n(r, { className: "ttw:size-4" })
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//#endregion
|
|
1
|
+
import "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "lucide-react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ProductsWidget as e } from "./
|
|
1
|
+
import { ProductsWidget as e } from "./index10.js";
|
|
2
2
|
export { e as ProductsWidget };
|
|
@@ -0,0 +1,136 @@
|
|
|
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 "../../../shared/feature/dist/index.js";
|
|
8
|
+
import { ProductFormSheet as n } from "../../../shared/product-catalog/ui/dist/index3.js";
|
|
9
|
+
import { MeasureUnitsManagerContainer as r } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
10
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
11
|
+
import { ProductsWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
|
|
12
|
+
import { PAGE_SIZE_OPTIONS as o } from "./index3.js";
|
|
13
|
+
import { productsWidgetTestIds as s } from "./index4.js";
|
|
14
|
+
import { useProductsWidget as c } from "./index9.js";
|
|
15
|
+
import { ProductsScreen as l } from "../../ui/dist/index4.js";
|
|
16
|
+
import { ProductDetailsSheet as u } from "../../ui/dist/index5.js";
|
|
17
|
+
import { ProductDeleteDialog as d } from "../../ui/dist/index6.js";
|
|
18
|
+
import "../../ui/dist/index.js";
|
|
19
|
+
import { useEffect as f } from "react";
|
|
20
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
21
|
+
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index10.js
|
|
22
|
+
function g({ pageSizeOptions: t = o, screenLabels: a, formLabels: g, detailsLabels: _, deleteLabels: v, measureUnitsLabels: y, measureUnitDeleteLabels: b, messageLabels: x }) {
|
|
23
|
+
let S = e();
|
|
24
|
+
f(() => {
|
|
25
|
+
S(i.Mounted);
|
|
26
|
+
}, [S]);
|
|
27
|
+
let { view: C, units: w, table: T, details: E, form: D, del: O, permissions: k, isPermissionLoading: A, isTableLoading: j, hasInitError: M, refetchWidgetInit: N, measureUnitsOpen: P, actionsSuspended: F, handleRowClick: I, openMeasureUnits: L, closeMeasureUnits: R, submitForm: z, confirmDelete: B } = c({ messageLabels: x });
|
|
28
|
+
return /* @__PURE__ */ h(p, { children: [
|
|
29
|
+
/* @__PURE__ */ m(l, {
|
|
30
|
+
products: T.rows,
|
|
31
|
+
isLoading: j,
|
|
32
|
+
isError: M || T.isError,
|
|
33
|
+
sorting: T.sorting,
|
|
34
|
+
onSortingChange: T.onSortingChange,
|
|
35
|
+
pageSize: T.pageSize,
|
|
36
|
+
onPageSizeChange: T.onPageSizeChange,
|
|
37
|
+
pageSizeOptions: t,
|
|
38
|
+
hasNextPage: T.hasNextPage,
|
|
39
|
+
hasPrevPage: T.hasPrevPage,
|
|
40
|
+
onNextPage: T.onNextPage,
|
|
41
|
+
onPrevPage: T.onPrevPage,
|
|
42
|
+
searchValue: T.searchValue,
|
|
43
|
+
onSearchChange: T.onSearchChange,
|
|
44
|
+
typeFilter: T.typeFilter,
|
|
45
|
+
onTypeFilterChange: T.onTypeFilterChange,
|
|
46
|
+
unitFilter: T.unitFilter,
|
|
47
|
+
onUnitFilterChange: T.onUnitFilterChange,
|
|
48
|
+
unitOptions: w.unitOptions,
|
|
49
|
+
isFiltering: T.isFiltering,
|
|
50
|
+
canCreate: k.canCreate,
|
|
51
|
+
canManageUnits: k.canCreate,
|
|
52
|
+
isAccessRestricted: !A && !M && !k.canRead,
|
|
53
|
+
onCreateClick: D.openCreate,
|
|
54
|
+
onManageUnitsClick: L,
|
|
55
|
+
onRowClick: I,
|
|
56
|
+
onRetry: M ? N : T.onRetry,
|
|
57
|
+
labels: a,
|
|
58
|
+
testIds: {
|
|
59
|
+
empty: s.empty,
|
|
60
|
+
accessRestricted: s.accessRestricted
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ m(n, {
|
|
64
|
+
open: C === "create" || C === "edit",
|
|
65
|
+
onOpenChange: (e) => {
|
|
66
|
+
e || D.close();
|
|
67
|
+
},
|
|
68
|
+
mode: C === "edit" ? "edit" : "create",
|
|
69
|
+
values: D.values,
|
|
70
|
+
errors: D.errors,
|
|
71
|
+
unitOptions: w.unitOptions,
|
|
72
|
+
currencyOptions: D.currencyOptions,
|
|
73
|
+
inProgress: D.isSubmitting || F,
|
|
74
|
+
onChange: (e) => D.setValues((t) => ({
|
|
75
|
+
...t,
|
|
76
|
+
...e
|
|
77
|
+
})),
|
|
78
|
+
onManageUnits: L,
|
|
79
|
+
onSubmit: z,
|
|
80
|
+
onCancel: D.close,
|
|
81
|
+
labels: g
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ m(u, {
|
|
84
|
+
open: C === "details",
|
|
85
|
+
onOpenChange: (e) => {
|
|
86
|
+
e || D.close();
|
|
87
|
+
},
|
|
88
|
+
product: E.detailsView,
|
|
89
|
+
isLoading: E.isLoading,
|
|
90
|
+
isError: E.isError,
|
|
91
|
+
onEdit: D.openEdit,
|
|
92
|
+
onDelete: O.requestDelete,
|
|
93
|
+
canEdit: k.canUpdate,
|
|
94
|
+
canDelete: k.canDelete,
|
|
95
|
+
labels: _
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ m(d, {
|
|
98
|
+
open: O.open,
|
|
99
|
+
onOpenChange: O.onOpenChange,
|
|
100
|
+
productName: E.productName,
|
|
101
|
+
isDeleting: O.isDeleting || F,
|
|
102
|
+
onConfirm: B,
|
|
103
|
+
onCancel: O.cancel,
|
|
104
|
+
labels: v
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ m(r, {
|
|
107
|
+
open: P,
|
|
108
|
+
onClose: R,
|
|
109
|
+
suspended: F,
|
|
110
|
+
managerLabels: y,
|
|
111
|
+
deleteLabels: b,
|
|
112
|
+
messageLabels: x
|
|
113
|
+
})
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
function _({ 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: h, ..._ }) {
|
|
117
|
+
return /* @__PURE__ */ m(t, {
|
|
118
|
+
widgetName: a,
|
|
119
|
+
baseUrl: e,
|
|
120
|
+
widgetToken: n,
|
|
121
|
+
organizationId: r,
|
|
122
|
+
configClient: i,
|
|
123
|
+
gatewayRouting: o,
|
|
124
|
+
linkComponent: s,
|
|
125
|
+
implementation: c,
|
|
126
|
+
uiFramework: l,
|
|
127
|
+
errorFallback: u,
|
|
128
|
+
onError: d,
|
|
129
|
+
analytics: f,
|
|
130
|
+
disclosuresAcceptance: p,
|
|
131
|
+
providerLabels: h,
|
|
132
|
+
children: /* @__PURE__ */ m(g, { ..._ })
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { _ as ProductsWidget, _ as default };
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { useDeleteProductMutation as e } from "../../../shared/product-catalog/data-access/dist/index8.js";
|
|
6
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
7
|
-
import { useCallback as t, useState as n } from "react";
|
|
8
1
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
open: s,
|
|
15
|
-
requestDelete: l,
|
|
16
|
-
onOpenChange: u,
|
|
17
|
-
confirm: t(async () => {
|
|
18
|
-
if (r) try {
|
|
19
|
-
await o.mutateAsync({ path: { product_id: r } }), c(!1), a("none"), i(void 0);
|
|
20
|
-
} catch {}
|
|
21
|
-
}, [
|
|
22
|
-
r,
|
|
23
|
-
o,
|
|
24
|
-
a,
|
|
25
|
-
i
|
|
26
|
-
]),
|
|
27
|
-
cancel: d,
|
|
28
|
-
isDeleting: o.isPending
|
|
29
|
-
};
|
|
30
|
-
}
|
|
2
|
+
var e = {
|
|
3
|
+
empty: "products-widget-empty-state",
|
|
4
|
+
accessRestricted: "products-widget-access-restricted"
|
|
5
|
+
};
|
|
31
6
|
//#endregion
|
|
32
|
-
export {
|
|
7
|
+
export { e as productsWidgetTestIds };
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { buildProductDetailsView as e } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
6
|
-
import { useProductQuery as t } from "../../../shared/product-catalog/data-access/dist/index4.js";
|
|
7
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
8
|
-
import { useMemo as n } from "react";
|
|
1
|
+
import { Scope as e } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
2
|
+
import "../../../shared/data-access/dist/index.js";
|
|
9
3
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
product: a.data,
|
|
13
|
-
unitNamesById: i
|
|
14
|
-
}) : void 0, [a.data, i]);
|
|
4
|
+
function t(t) {
|
|
5
|
+
let n = new Set(t ?? []), r = n.has(e.InvoiceReadOrg), i = n.has(e.InvoiceWriteOrg);
|
|
15
6
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
productName: a.data?.name ?? ""
|
|
7
|
+
canRead: r,
|
|
8
|
+
canCreate: i,
|
|
9
|
+
canUpdate: i,
|
|
10
|
+
canDelete: i
|
|
21
11
|
};
|
|
22
12
|
}
|
|
23
13
|
//#endregion
|
|
24
|
-
export {
|
|
14
|
+
export { t as getProductPermissions };
|
|
@@ -2,63 +2,31 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { useProductsQuery as t } from "../../../shared/product-catalog/data-access/dist/index2.js";
|
|
5
|
+
import { useDeleteProductMutation as e } from "../../../shared/product-catalog/data-access/dist/index8.js";
|
|
7
6
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
8
|
-
import { useCallback as
|
|
7
|
+
import { useCallback as t, useState as n } from "react";
|
|
9
8
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index6.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g(p), f(void 0);
|
|
15
|
-
}, 400);
|
|
16
|
-
return () => clearTimeout(e);
|
|
17
|
-
}, [p]);
|
|
18
|
-
let x = s[0]?.id === "name" ? "name" : void 0, S = s[0] ? s[0].desc ? "desc" : "asc" : void 0, C = t({
|
|
19
|
-
...x ? {
|
|
20
|
-
sort: x,
|
|
21
|
-
order: S
|
|
22
|
-
} : {},
|
|
23
|
-
limit: l,
|
|
24
|
-
pagination_token: d,
|
|
25
|
-
name__icontains: h || void 0,
|
|
26
|
-
type: _ === "all" ? void 0 : _,
|
|
27
|
-
measure_unit_id: y === "all" ? void 0 : y
|
|
28
|
-
}), w = i(() => e({
|
|
29
|
-
products: C.data?.data ?? [],
|
|
30
|
-
unitNamesById: o
|
|
31
|
-
}), [C.data, o]), T = !!h || _ !== "all" || y !== "all", E = n((e) => {
|
|
32
|
-
let t = typeof e == "function" ? e(s) : e;
|
|
33
|
-
c(t), f(void 0);
|
|
34
|
-
}, [s]), D = n((e) => {
|
|
35
|
-
u(e), f(void 0);
|
|
36
|
-
}, []), O = n(() => f(C.data?.next_pagination_token ?? void 0), [C.data?.next_pagination_token]), k = n(() => f(C.data?.prev_pagination_token ?? void 0), [C.data?.prev_pagination_token]), A = n(() => {
|
|
37
|
-
C.refetch();
|
|
38
|
-
}, [C]), j = n((e) => (t) => {
|
|
39
|
-
e(t), f(void 0);
|
|
40
|
-
}, []);
|
|
9
|
+
function r({ selectedProductId: r, setSelectedProductId: i, setView: a }) {
|
|
10
|
+
let o = e(), [s, c] = n(!1), l = t(() => c(!0), []), u = t((e) => {
|
|
11
|
+
e || c(!1);
|
|
12
|
+
}, []), d = t(() => c(!1), []);
|
|
41
13
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
unitFilter: y,
|
|
58
|
-
onUnitFilterChange: j(b),
|
|
59
|
-
isFiltering: T,
|
|
60
|
-
onRetry: A
|
|
14
|
+
open: s,
|
|
15
|
+
requestDelete: l,
|
|
16
|
+
onOpenChange: u,
|
|
17
|
+
confirm: t(async () => {
|
|
18
|
+
if (r) try {
|
|
19
|
+
await o.mutateAsync({ path: { product_id: r } }), c(!1), a("none"), i(void 0);
|
|
20
|
+
} catch {}
|
|
21
|
+
}, [
|
|
22
|
+
r,
|
|
23
|
+
o,
|
|
24
|
+
a,
|
|
25
|
+
i
|
|
26
|
+
]),
|
|
27
|
+
cancel: d,
|
|
28
|
+
isDeleting: o.isPending
|
|
61
29
|
};
|
|
62
30
|
}
|
|
63
31
|
//#endregion
|
|
64
|
-
export {
|
|
32
|
+
export { r as useProductDelete };
|
|
@@ -2,49 +2,23 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useMeasureUnits as n } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
8
|
-
import { useProductForm as r } from "../../../shared/product-catalog/feature/dist/lib/useProductForm.js";
|
|
5
|
+
import { buildProductDetailsView as e } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
6
|
+
import { useProductQuery as t } from "../../../shared/product-catalog/data-access/dist/index4.js";
|
|
9
7
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { useProductDetails as a } from "./index5.js";
|
|
12
|
-
import { useProductsTable as o } from "./index6.js";
|
|
13
|
-
import { useCallback as s, useMemo as c, useState as l } from "react";
|
|
8
|
+
import { useMemo as n } from "react";
|
|
14
9
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/index7.js
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
selectedProductId: m,
|
|
21
|
-
unitNamesById: v.unitNamesById
|
|
22
|
-
});
|
|
10
|
+
function r({ selectedProductId: r, unitNamesById: i, enabled: a = !0 }) {
|
|
11
|
+
let o = t(r, { enabled: a }), s = n(() => o.data ? e({
|
|
12
|
+
product: o.data,
|
|
13
|
+
unitNamesById: i
|
|
14
|
+
}) : void 0, [o.data, i]);
|
|
23
15
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
view: f,
|
|
30
|
-
setView: p,
|
|
31
|
-
selectedProductId: m,
|
|
32
|
-
setSelectedProductId: h,
|
|
33
|
-
product: b.product,
|
|
34
|
-
messages: d
|
|
35
|
-
}),
|
|
36
|
-
del: i({
|
|
37
|
-
selectedProductId: m,
|
|
38
|
-
setSelectedProductId: h,
|
|
39
|
-
setView: p
|
|
40
|
-
}),
|
|
41
|
-
measureUnitsOpen: g,
|
|
42
|
-
handleRowClick: s((e) => {
|
|
43
|
-
t() || (h(e.id), p("details"));
|
|
44
|
-
}, []),
|
|
45
|
-
openMeasureUnits: s(() => _(!0), []),
|
|
46
|
-
closeMeasureUnits: s(() => _(!1), [])
|
|
16
|
+
product: o.data,
|
|
17
|
+
detailsView: s,
|
|
18
|
+
isLoading: o.isLoading,
|
|
19
|
+
isError: o.isError,
|
|
20
|
+
productName: o.data?.name ?? ""
|
|
47
21
|
};
|
|
48
22
|
}
|
|
49
23
|
//#endregion
|
|
50
|
-
export {
|
|
24
|
+
export { r as useProductDetails };
|