@tesouro/embedded-components-react 0.5.90 → 0.5.92
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/experimental/InvoiceSettings.d.ts +263 -21
- package/dist/experimental/InvoiceSettings.js +1 -1
- package/dist/experimental/index.d.ts +263 -21
- package/dist/experimental/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +23 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +24 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index4.js +24 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index5.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index6.js +40 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index7.js +35 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index8.js +34 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +145 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index11.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index2.js +8 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index3.js +20 -25
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index4.js +16 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index5.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index6.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +155 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +103 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index9.js +5 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index10.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +41 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index13.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index14.js +12 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index15.js +9 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +21 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index18.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index19.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index2.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index21.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +40 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index4.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index5.js +12 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +131 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index7.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index8.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +74 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +185 -174
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +125 -96
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +831 -826
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +2411 -2354
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEmbedApi as e } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
+
import { organizationHeaders as t } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
7
|
+
import { getEntitiesIdSettingsOptions as n } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
8
|
+
import { withAuthEpoch as r } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
11
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js
|
|
12
|
+
function a(a) {
|
|
13
|
+
let { client: o, organizationId: s, widgetToken: c, authEpoch: l } = e(), u = !!(s && c && a), d = n({
|
|
14
|
+
client: o,
|
|
15
|
+
headers: t(s),
|
|
16
|
+
path: { entity_id: a ?? "" }
|
|
17
|
+
});
|
|
18
|
+
return i({
|
|
19
|
+
...r(d, l),
|
|
20
|
+
enabled: u
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as useEntitySettingsQuery };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEmbedApi as e } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
+
import { organizationHeaders as t } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
7
|
+
import { getDocumentsIdNextNumbersOptions as n } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
8
|
+
import { withAuthEpoch as r } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
11
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index4.js
|
|
12
|
+
function a(a) {
|
|
13
|
+
let { client: o, organizationId: s, widgetToken: c, authEpoch: l } = e(), u = !!(s && c && a), d = n({
|
|
14
|
+
client: o,
|
|
15
|
+
headers: t(s),
|
|
16
|
+
path: { entity_id: a ?? "" }
|
|
17
|
+
});
|
|
18
|
+
return i({
|
|
19
|
+
...r(d, l),
|
|
20
|
+
enabled: u
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as useNextDocumentNumbersQuery };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { organizationHeaders as e } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
2
|
+
import { getDocumentsIdNextNumbersQueryKey as t, getEntitiesIdSettingsQueryKey as n, getEntityUsersMyEntityQueryKey as r } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
3
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index5.js
|
|
5
|
+
var i = ({ client: t, organizationId: n }) => r({
|
|
6
|
+
client: t,
|
|
7
|
+
headers: e(n)
|
|
8
|
+
}), a = ({ client: t, organizationId: r, entityId: i }) => n({
|
|
9
|
+
client: t,
|
|
10
|
+
headers: e(r),
|
|
11
|
+
path: { entity_id: i }
|
|
12
|
+
}), o = ({ client: n, organizationId: r, entityId: i }) => t({
|
|
13
|
+
client: n,
|
|
14
|
+
headers: e(r),
|
|
15
|
+
path: { entity_id: i }
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as entitySettingsInvalidationKey, i as myEntityInvalidationKey, o as nextDocumentNumbersInvalidationKey };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { invalidateAllClients as e } from "../../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
6
|
+
import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
|
+
import { patchEntitiesIdSettings as r } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { entitySettingsInvalidationKey as i, nextDocumentNumbersInvalidationKey as a } from "./index5.js";
|
|
11
|
+
import { useMutation as o } from "@tanstack/react-query";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index6.js
|
|
13
|
+
function s() {
|
|
14
|
+
let { client: s, organizationId: c } = t();
|
|
15
|
+
return o({
|
|
16
|
+
mutationFn: async ({ entityId: e, body: t }) => {
|
|
17
|
+
let { data: i } = await r({
|
|
18
|
+
client: s,
|
|
19
|
+
headers: n(c),
|
|
20
|
+
path: { entity_id: e },
|
|
21
|
+
body: t,
|
|
22
|
+
throwOnError: !0
|
|
23
|
+
});
|
|
24
|
+
return i;
|
|
25
|
+
},
|
|
26
|
+
onSuccess: async (t, { entityId: n }) => {
|
|
27
|
+
await Promise.all([e(i({
|
|
28
|
+
client: s,
|
|
29
|
+
organizationId: c,
|
|
30
|
+
entityId: n
|
|
31
|
+
})), e(a({
|
|
32
|
+
client: s,
|
|
33
|
+
organizationId: c,
|
|
34
|
+
entityId: n
|
|
35
|
+
}))]);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { s as useUpdateEntitySettingsMutation };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { invalidateAllClients as e } from "../../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
6
|
+
import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
|
+
import { putEntitiesIdLogo as r } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { myEntityInvalidationKey as i } from "./index5.js";
|
|
11
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index7.js
|
|
13
|
+
function o() {
|
|
14
|
+
let { client: o, organizationId: s } = t();
|
|
15
|
+
return a({
|
|
16
|
+
mutationFn: async ({ entityId: e, file: t }) => {
|
|
17
|
+
let { data: i } = await r({
|
|
18
|
+
client: o,
|
|
19
|
+
headers: n(s),
|
|
20
|
+
path: { entity_id: e },
|
|
21
|
+
body: { file: t },
|
|
22
|
+
throwOnError: !0
|
|
23
|
+
});
|
|
24
|
+
return i;
|
|
25
|
+
},
|
|
26
|
+
onSuccess: async () => {
|
|
27
|
+
await e(i({
|
|
28
|
+
client: o,
|
|
29
|
+
organizationId: s
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { o as useUploadEntityLogoMutation };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { invalidateAllClients as e } from "../../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
6
|
+
import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
|
+
import { deleteEntitiesIdLogo as r } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { myEntityInvalidationKey as i } from "./index5.js";
|
|
11
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index8.js
|
|
13
|
+
function o() {
|
|
14
|
+
let { client: o, organizationId: s } = t();
|
|
15
|
+
return a({
|
|
16
|
+
mutationFn: async ({ entityId: e }) => {
|
|
17
|
+
let { data: t } = await r({
|
|
18
|
+
client: o,
|
|
19
|
+
headers: n(s),
|
|
20
|
+
path: { entity_id: e },
|
|
21
|
+
throwOnError: !0
|
|
22
|
+
});
|
|
23
|
+
return t;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: async () => {
|
|
26
|
+
await e(i({
|
|
27
|
+
client: o,
|
|
28
|
+
organizationId: s
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { o as useDeleteEntityLogoMutation };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { EmbeddedToaster as e } from "../../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
6
|
+
import "../../../../shared/ui/dist/index.js";
|
|
7
|
+
import { useAnalyticsTrack as t } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
8
|
+
import { WidgetProvider as n } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
9
|
+
import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
|
+
import "../../../../shared/feature/dist/index.js";
|
|
11
|
+
import { InvoiceSettingsAnalyticsEvent as i, WIDGET_NAME as a } from "./index9.js";
|
|
12
|
+
import { getInvoiceSettingsPermissions as o } from "./index2.js";
|
|
13
|
+
import { useMyEntityQuery as s } from "../../data-access/dist/index2.js";
|
|
14
|
+
import { useEntitySettingsQuery as c } from "../../data-access/dist/index3.js";
|
|
15
|
+
import { useNextDocumentNumbersQuery as l } from "../../data-access/dist/index4.js";
|
|
16
|
+
import "../../data-access/dist/index.js";
|
|
17
|
+
import { useInvoiceSettingsForm as u } from "./index7.js";
|
|
18
|
+
import { InvoiceSettingsPanel as d } from "../../ui/dist/index3.js";
|
|
19
|
+
import { InvoiceNumberingSection as f } from "../../ui/dist/index6.js";
|
|
20
|
+
import { PdfSettingsSection as p } from "../../ui/dist/index9.js";
|
|
21
|
+
import { DiscardChangesDialog as m } from "../../ui/dist/index12.js";
|
|
22
|
+
import { LogoSection as h } from "../../ui/dist/index20.js";
|
|
23
|
+
import "../../ui/dist/index.js";
|
|
24
|
+
import { useLogoUpload as g } from "./index8.js";
|
|
25
|
+
import { useEffect as _, useImperativeHandle as v, useMemo as y, useRef as b } from "react";
|
|
26
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
27
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js
|
|
28
|
+
function w({ entityId: e, entitySettings: t, nextNumbers: n, logo: r, confirmLeaveRef: i, panelLabels: a, numberingLabels: o, pdfLabels: s, discardLabels: c, messageLabels: l }) {
|
|
29
|
+
let h = u({
|
|
30
|
+
entityId: e,
|
|
31
|
+
entitySettings: t,
|
|
32
|
+
nextNumbers: n,
|
|
33
|
+
messageLabels: l
|
|
34
|
+
}), { confirmLeave: g } = h;
|
|
35
|
+
return _(() => (i.current = g, () => {
|
|
36
|
+
i.current = null;
|
|
37
|
+
}), [g, i]), /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C(d, {
|
|
38
|
+
logo: r,
|
|
39
|
+
onSubmit: h.submit,
|
|
40
|
+
submitDisabled: !h.isDirty || h.isSaving,
|
|
41
|
+
labels: a,
|
|
42
|
+
children: [/* @__PURE__ */ S(f, {
|
|
43
|
+
previewValue: h.previewValue,
|
|
44
|
+
invoicePrefix: h.invoicePrefix,
|
|
45
|
+
startingNumber: h.startingNumber,
|
|
46
|
+
digitCount: h.digitCount,
|
|
47
|
+
includeDate: h.includeDate,
|
|
48
|
+
errors: h.numberingErrors,
|
|
49
|
+
onInvoicePrefixChange: h.onInvoicePrefixChange,
|
|
50
|
+
onStartingNumberChange: h.onStartingNumberChange,
|
|
51
|
+
onDigitCountChange: h.onDigitCountChange,
|
|
52
|
+
onIncludeDateChange: h.onIncludeDateChange,
|
|
53
|
+
labels: o
|
|
54
|
+
}), /* @__PURE__ */ S(p, {
|
|
55
|
+
displayBankDetails: h.displayBankDetails,
|
|
56
|
+
updatePaidInvoices: h.updatePaidInvoices,
|
|
57
|
+
onDisplayBankDetailsChange: h.onDisplayBankDetailsChange,
|
|
58
|
+
onUpdatePaidInvoicesChange: h.onUpdatePaidInvoicesChange,
|
|
59
|
+
labels: s
|
|
60
|
+
})]
|
|
61
|
+
}), /* @__PURE__ */ S(m, {
|
|
62
|
+
open: h.isDiscardDialogOpen,
|
|
63
|
+
onCancel: h.cancelDiscard,
|
|
64
|
+
onConfirm: h.confirmDiscard,
|
|
65
|
+
labels: c
|
|
66
|
+
})] });
|
|
67
|
+
}
|
|
68
|
+
function T({ handleRef: n, panelLabels: a, logoLabels: u, dropzoneLabels: f, messageLabels: p, ...m }) {
|
|
69
|
+
let T = t(), E = b(null);
|
|
70
|
+
v(n, () => ({ confirmLeave: () => E.current?.() ?? Promise.resolve(!0) }), []), _(() => {
|
|
71
|
+
T(i.Mounted);
|
|
72
|
+
}, [T]);
|
|
73
|
+
let { initResponse: D } = r(), { canEdit: O } = y(() => o(D?.scopes), [D?.scopes]), { data: k, isLoading: A, isError: j, refetch: M } = s(), N = k?.id, P = O ? N : void 0, { data: F, isLoading: I, isError: L, refetch: R } = c(P), { data: z, isLoading: B, isError: V, refetch: H } = l(P), U = g({
|
|
74
|
+
entityId: N ?? "",
|
|
75
|
+
labels: p
|
|
76
|
+
}), W = y(() => ({
|
|
77
|
+
fileTypesHint: U.fileTypesHint,
|
|
78
|
+
...f
|
|
79
|
+
}), [U.fileTypesHint, f]);
|
|
80
|
+
if (!O) return null;
|
|
81
|
+
let G = N || A ? /* @__PURE__ */ C(x, { children: [
|
|
82
|
+
/* @__PURE__ */ S(e, {}),
|
|
83
|
+
/* @__PURE__ */ S(h, {
|
|
84
|
+
logoUrl: U.uploadedLogoUrl ?? k?.logo?.url,
|
|
85
|
+
isLoading: A,
|
|
86
|
+
isDeleting: U.isDeleting,
|
|
87
|
+
status: U.status,
|
|
88
|
+
fileName: U.fileName,
|
|
89
|
+
errorMessage: U.errorMessage,
|
|
90
|
+
isDraggingOver: U.isDraggingOver,
|
|
91
|
+
onBrowse: U.onBrowse,
|
|
92
|
+
onDelete: U.onDelete,
|
|
93
|
+
onDismissError: U.onDismissError,
|
|
94
|
+
onDragOver: U.onDragOver,
|
|
95
|
+
onDragLeave: U.onDragLeave,
|
|
96
|
+
onDrop: U.onDrop,
|
|
97
|
+
labels: u,
|
|
98
|
+
dropzoneLabels: W
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ S("input", { ...U.fileInputProps })
|
|
101
|
+
] }) : void 0;
|
|
102
|
+
return !F || !z ? /* @__PURE__ */ S(d, {
|
|
103
|
+
logo: G,
|
|
104
|
+
isLoading: A || I || B,
|
|
105
|
+
isError: j || L || V,
|
|
106
|
+
onRetry: () => {
|
|
107
|
+
M(), R(), H();
|
|
108
|
+
},
|
|
109
|
+
onSubmit: () => void 0,
|
|
110
|
+
labels: a
|
|
111
|
+
}) : /* @__PURE__ */ S(w, {
|
|
112
|
+
entityId: N ?? "",
|
|
113
|
+
entitySettings: F,
|
|
114
|
+
nextNumbers: z,
|
|
115
|
+
logo: G,
|
|
116
|
+
confirmLeaveRef: E,
|
|
117
|
+
panelLabels: a,
|
|
118
|
+
messageLabels: p,
|
|
119
|
+
...m
|
|
120
|
+
}, N);
|
|
121
|
+
}
|
|
122
|
+
function E({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, analytics: u, disclosuresAcceptance: d, providerLabels: f, errorFallback: p, onError: m, ref: h, ...g }) {
|
|
123
|
+
return /* @__PURE__ */ S(n, {
|
|
124
|
+
widgetName: a,
|
|
125
|
+
baseUrl: e,
|
|
126
|
+
widgetToken: t,
|
|
127
|
+
organizationId: r,
|
|
128
|
+
configClient: i,
|
|
129
|
+
gatewayRouting: o,
|
|
130
|
+
linkComponent: s,
|
|
131
|
+
implementation: c,
|
|
132
|
+
uiFramework: l,
|
|
133
|
+
analytics: u,
|
|
134
|
+
disclosuresAcceptance: d,
|
|
135
|
+
providerLabels: f,
|
|
136
|
+
errorFallback: p,
|
|
137
|
+
onError: m,
|
|
138
|
+
children: /* @__PURE__ */ S(T, {
|
|
139
|
+
handleRef: h,
|
|
140
|
+
...g
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { E as InvoiceSettings, E as default };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
2
4
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index2.js
|
|
3
|
-
var
|
|
5
|
+
var n = [t.OrganizationSettingsWriteOrg];
|
|
6
|
+
function r(t) {
|
|
7
|
+
return { canEdit: e(new Set(t ?? []), n) };
|
|
8
|
+
}
|
|
4
9
|
//#endregion
|
|
5
|
-
export {
|
|
10
|
+
export { r as getInvoiceSettingsPermissions };
|
|
@@ -1,29 +1,24 @@
|
|
|
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 "../../../../shared/feature/dist/index.js";
|
|
7
|
-
import { TemplateSettings as t } from "../../../../monite-sdk/dist/index617.js";
|
|
8
|
-
import "../../../../monite-sdk/dist/index.js";
|
|
9
|
-
import { MoniteRegionProvider as n } from "../../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
|
|
10
|
-
import "../../../../shared/monite-wrapper/feature/dist/index.js";
|
|
11
|
-
import { InvoiceSettingsAnalyticsEvent as r, WIDGET_NAME as i } from "./index2.js";
|
|
12
|
-
import { useEffect as a } from "react";
|
|
13
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
14
1
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index3.js
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
return a(() => {
|
|
18
|
-
n(r.Mounted);
|
|
19
|
-
}, [n]), /* @__PURE__ */ o(t, { showHeader: !1 });
|
|
2
|
+
function e(e) {
|
|
3
|
+
return !!e && typeof e == "object" && "display_organization_bank_account" in e;
|
|
20
4
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
function t(t, n) {
|
|
6
|
+
return e(t) ? !!(t.display_organization_bank_account ?? n) : n;
|
|
7
|
+
}
|
|
8
|
+
function n(t, n) {
|
|
9
|
+
let r = e(t?.invoice);
|
|
10
|
+
return {
|
|
11
|
+
...t,
|
|
12
|
+
display_organization_bank_account: n.invoiceBankDisplay,
|
|
13
|
+
quote: {
|
|
14
|
+
...t?.quote,
|
|
15
|
+
display_signature: n.quoteSignatureDisplay
|
|
16
|
+
},
|
|
17
|
+
...r ? { invoice: {
|
|
18
|
+
...t?.invoice,
|
|
19
|
+
display_organization_bank_account: n.invoiceBankDisplay
|
|
20
|
+
} } : {}
|
|
21
|
+
};
|
|
27
22
|
}
|
|
28
23
|
//#endregion
|
|
29
|
-
export {
|
|
24
|
+
export { n as buildDocumentRendering, t as getBankDisplayValue, e as hasBankDisplay };
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index4.js
|
|
2
|
+
var e = [
|
|
3
|
+
"/",
|
|
4
|
+
"-",
|
|
5
|
+
"|",
|
|
6
|
+
".",
|
|
7
|
+
""
|
|
8
|
+
];
|
|
9
|
+
function t(e, t) {
|
|
10
|
+
return String(e).padStart(Math.min(t, 20), "0");
|
|
11
|
+
}
|
|
12
|
+
function n({ documentPrefix: e, customPrefix: n, separator: r, includeDate: i, startingNumber: a, digitCount: o, year: s = (/* @__PURE__ */ new Date()).getFullYear() }) {
|
|
13
|
+
return `${e}${r}${n ? `${n}${r}` : ""}${i ? `${s}${r}` : ""}${t(a, o)}`;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as DOCUMENT_NUMBER_SEPARATORS, n as formatInvoiceNumberPreview, t as padStartingNumber };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index5.js
|
|
2
|
+
var e = {
|
|
3
|
+
invoicePrefixRequired: "Invoice prefix is required",
|
|
4
|
+
invoicePrefixTooLong: "Invoice prefix should have at most 25 characters",
|
|
5
|
+
customPrefixTooLong: "Prefix should have at most 25 characters",
|
|
6
|
+
digitCountTooLow: "Can't be less than 1",
|
|
7
|
+
digitCountTooHigh: "Can't be greater than 20",
|
|
8
|
+
documentPrefixRequired: "Document prefix is required",
|
|
9
|
+
numberBelowNext: (e) => `Can't be less than ${e}`,
|
|
10
|
+
logoWrongFormat: "Wrong file format. Please, upload the file in JPEG, PNG or GIF format.",
|
|
11
|
+
logoTooLarge: (e) => `File is larger than ${e}MB.`,
|
|
12
|
+
logoUploadFailed: "Couldn't upload the logo. Please try again.",
|
|
13
|
+
logoFileTypesHint: (e) => `PNG, JPG or GIF (max. ${e}MB)`,
|
|
14
|
+
settingsSaved: "Settings updated successfully.",
|
|
15
|
+
settingsSaveFailed: "Failed to update settings.",
|
|
16
|
+
logoDeleted: "Logo was removed.",
|
|
17
|
+
logoDeleteFailed: "Failed to remove logo."
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as INVOICE_SETTINGS_MESSAGE_LABELS_EN };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { INVOICE_SETTINGS_MESSAGE_LABELS_EN as e } from "./index5.js";
|
|
2
|
+
import { DOCUMENT_NUMBER_SEPARATORS as t } from "./index4.js";
|
|
3
|
+
import { z as n } from "zod";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index6.js
|
|
5
|
+
var r = 1;
|
|
6
|
+
function i({ nextNumbers: i, labels: a }) {
|
|
7
|
+
let o = {
|
|
8
|
+
...e,
|
|
9
|
+
...a
|
|
10
|
+
}, s = (e) => {
|
|
11
|
+
let t = e ?? r;
|
|
12
|
+
return n.number().int().min(t, o.numberBelowNext(t));
|
|
13
|
+
}, c = n.string().min(1, o.documentPrefixRequired);
|
|
14
|
+
return n.object({
|
|
15
|
+
invoice: n.string().min(1, o.invoicePrefixRequired).max(25, o.invoicePrefixTooLong),
|
|
16
|
+
invoice_number: s(i.invoice),
|
|
17
|
+
min_digits: n.number().int().min(1, o.digitCountTooLow).max(20, o.digitCountTooHigh),
|
|
18
|
+
include_date: n.boolean(),
|
|
19
|
+
invoice_bank_display: n.boolean(),
|
|
20
|
+
update_paid_invoices: n.boolean(),
|
|
21
|
+
credit_note: c,
|
|
22
|
+
credit_note_number: s(i.credit_note),
|
|
23
|
+
delivery_note: c,
|
|
24
|
+
delivery_note_number: s(i.delivery_note),
|
|
25
|
+
purchase_order: c,
|
|
26
|
+
purchase_order_number: s(i.purchase_order),
|
|
27
|
+
quote: c,
|
|
28
|
+
quote_number: s(i.quote),
|
|
29
|
+
prefix: n.string().max(25, o.customPrefixTooLong),
|
|
30
|
+
separator: n.enum(t),
|
|
31
|
+
quote_signature_display: n.boolean(),
|
|
32
|
+
quote_electronic_signature: n.union([n.boolean(), n.string()])
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as getInvoiceSettingsFormSchema };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import "../../../../shared/ui/dist/index.js";
|
|
7
|
+
import { INVOICE_SETTINGS_MESSAGE_LABELS_EN as t } from "./index5.js";
|
|
8
|
+
import { buildDocumentRendering as n, getBankDisplayValue as r } from "./index3.js";
|
|
9
|
+
import { formatInvoiceNumberPreview as i, padStartingNumber as a } from "./index4.js";
|
|
10
|
+
import { getInvoiceSettingsFormSchema as o } from "./index6.js";
|
|
11
|
+
import { useUpdateEntitySettingsMutation as s } from "../../data-access/dist/index6.js";
|
|
12
|
+
import "../../data-access/dist/index.js";
|
|
13
|
+
import { useCallback as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
14
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js
|
|
15
|
+
var f = {
|
|
16
|
+
invoice: "INV",
|
|
17
|
+
credit_note: "CN",
|
|
18
|
+
delivery_note: "DN",
|
|
19
|
+
purchase_order: "PO",
|
|
20
|
+
quote: "Q"
|
|
21
|
+
}, p = 5, m = "-", h = 1;
|
|
22
|
+
function g({ entityId: r, entitySettings: f, nextNumbers: p, messageLabels: m }) {
|
|
23
|
+
let [h, g] = d(!1), { mutateAsync: v, isPending: y } = s(), b = l(() => ({
|
|
24
|
+
...t,
|
|
25
|
+
...m
|
|
26
|
+
}), [m]), x = l(() => o({
|
|
27
|
+
nextNumbers: p,
|
|
28
|
+
labels: m
|
|
29
|
+
}), [p, m]), S = l(() => _(f, p), [f, p]), [C, w] = d(S), [T, E] = d(S), [D, O] = d(!1), k = l(() => x.safeParse(C), [x, C]), A = l(() => {
|
|
30
|
+
let e = {};
|
|
31
|
+
if (k.success) return e;
|
|
32
|
+
for (let t of k.error.issues) {
|
|
33
|
+
let n = t.path[0];
|
|
34
|
+
n && !(n in e) && (e[n] = t.message);
|
|
35
|
+
}
|
|
36
|
+
return e;
|
|
37
|
+
}, [k]), j = c((e) => C[e] !== T[e], [C, T]), M = l(() => Object.keys(T).some((e) => C[e] !== T[e]), [C, T]), N = c((e) => D || j(e) ? A[e] : void 0, [
|
|
38
|
+
A,
|
|
39
|
+
D,
|
|
40
|
+
j
|
|
41
|
+
]), P = c((e, t) => {
|
|
42
|
+
w((n) => ({
|
|
43
|
+
...n,
|
|
44
|
+
[e]: t
|
|
45
|
+
}));
|
|
46
|
+
}, []), F = c(async () => {
|
|
47
|
+
if (O(!0), !k.success) return;
|
|
48
|
+
let t = k.data, i = j("invoice_number");
|
|
49
|
+
try {
|
|
50
|
+
await v({
|
|
51
|
+
entityId: r,
|
|
52
|
+
body: {
|
|
53
|
+
...f,
|
|
54
|
+
document_ids: {
|
|
55
|
+
document_type_prefix: {
|
|
56
|
+
invoice: t.invoice,
|
|
57
|
+
credit_note: t.credit_note,
|
|
58
|
+
delivery_note: t.delivery_note,
|
|
59
|
+
purchase_order: t.purchase_order,
|
|
60
|
+
quote: t.quote
|
|
61
|
+
},
|
|
62
|
+
...i && { next_number: { invoice: t.invoice_number } },
|
|
63
|
+
min_digits: t.min_digits,
|
|
64
|
+
separator: t.separator,
|
|
65
|
+
include_date: t.include_date,
|
|
66
|
+
prefix: t.prefix || null
|
|
67
|
+
},
|
|
68
|
+
document_rendering: n(f.document_rendering, {
|
|
69
|
+
invoiceBankDisplay: t.invoice_bank_display,
|
|
70
|
+
quoteSignatureDisplay: t.quote_signature_display
|
|
71
|
+
}),
|
|
72
|
+
generate_paid_invoice_pdf: t.update_paid_invoices,
|
|
73
|
+
quote_signature_required: t.quote_electronic_signature === !0 || t.quote_electronic_signature === "true"
|
|
74
|
+
}
|
|
75
|
+
}), e.success(b.settingsSaved), E(t), O(!1);
|
|
76
|
+
} catch {
|
|
77
|
+
e.error(b.settingsSaveFailed);
|
|
78
|
+
}
|
|
79
|
+
}, [
|
|
80
|
+
r,
|
|
81
|
+
f,
|
|
82
|
+
j,
|
|
83
|
+
b.settingsSaveFailed,
|
|
84
|
+
b.settingsSaved,
|
|
85
|
+
v,
|
|
86
|
+
k
|
|
87
|
+
]), I = u(null), L = c((e) => {
|
|
88
|
+
I.current?.(e), I.current = null;
|
|
89
|
+
}, []), R = c(() => M ? (g(!0), new Promise((e) => {
|
|
90
|
+
L(!1), I.current = e;
|
|
91
|
+
})) : Promise.resolve(!0), [M, L]), z = c(() => {
|
|
92
|
+
g(!1), w(T), O(!1), L(!0);
|
|
93
|
+
}, [T, L]), B = l(() => ({
|
|
94
|
+
invoicePrefix: N("invoice"),
|
|
95
|
+
startingNumber: N("invoice_number"),
|
|
96
|
+
digitCount: N("min_digits")
|
|
97
|
+
}), [N]);
|
|
98
|
+
return {
|
|
99
|
+
previewValue: i({
|
|
100
|
+
documentPrefix: C.invoice,
|
|
101
|
+
customPrefix: C.prefix,
|
|
102
|
+
separator: C.separator,
|
|
103
|
+
includeDate: C.include_date,
|
|
104
|
+
startingNumber: C.invoice_number,
|
|
105
|
+
digitCount: C.min_digits
|
|
106
|
+
}),
|
|
107
|
+
invoicePrefix: C.invoice,
|
|
108
|
+
startingNumber: a(C.invoice_number, C.min_digits),
|
|
109
|
+
digitCount: String(C.min_digits),
|
|
110
|
+
includeDate: C.include_date,
|
|
111
|
+
numberingErrors: B,
|
|
112
|
+
onInvoicePrefixChange: c((e) => P("invoice", e), [P]),
|
|
113
|
+
onStartingNumberChange: c((e) => P("invoice_number", Number(e.replace(/^0+(?=\d)/, ""))), [P]),
|
|
114
|
+
onDigitCountChange: c((e) => P("min_digits", Number(e)), [P]),
|
|
115
|
+
onIncludeDateChange: c((e) => P("include_date", e), [P]),
|
|
116
|
+
displayBankDetails: C.invoice_bank_display,
|
|
117
|
+
updatePaidInvoices: C.update_paid_invoices,
|
|
118
|
+
onDisplayBankDetailsChange: c((e) => P("invoice_bank_display", e), [P]),
|
|
119
|
+
onUpdatePaidInvoicesChange: c((e) => P("update_paid_invoices", e), [P]),
|
|
120
|
+
submit: F,
|
|
121
|
+
isSaving: y,
|
|
122
|
+
isDirty: M,
|
|
123
|
+
isDiscardDialogOpen: h,
|
|
124
|
+
confirmLeave: R,
|
|
125
|
+
cancelDiscard: c(() => {
|
|
126
|
+
g(!1), L(!1);
|
|
127
|
+
}, [L]),
|
|
128
|
+
confirmDiscard: z
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function _(e, t) {
|
|
132
|
+
let n = e.document_ids, i = n?.document_type_prefix, a = e.document_rendering, o = !!(a?.display_organization_bank_account ?? !1);
|
|
133
|
+
return {
|
|
134
|
+
invoice: i?.invoice ?? f.invoice,
|
|
135
|
+
invoice_number: t.invoice ?? h,
|
|
136
|
+
min_digits: n?.min_digits ?? p,
|
|
137
|
+
include_date: n?.include_date ?? !1,
|
|
138
|
+
invoice_bank_display: r(a?.invoice, o),
|
|
139
|
+
update_paid_invoices: e.generate_paid_invoice_pdf ?? !1,
|
|
140
|
+
credit_note: i?.credit_note ?? f.credit_note,
|
|
141
|
+
credit_note_number: t.credit_note ?? h,
|
|
142
|
+
delivery_note: i?.delivery_note ?? f.delivery_note,
|
|
143
|
+
delivery_note_number: t.delivery_note ?? h,
|
|
144
|
+
purchase_order: i?.purchase_order ?? f.purchase_order,
|
|
145
|
+
purchase_order_number: t.purchase_order ?? h,
|
|
146
|
+
quote: i?.quote ?? f.quote,
|
|
147
|
+
quote_number: t.quote ?? h,
|
|
148
|
+
prefix: n?.prefix ?? "",
|
|
149
|
+
separator: n?.separator ?? m,
|
|
150
|
+
quote_signature_display: a?.quote?.display_signature ?? !1,
|
|
151
|
+
quote_electronic_signature: e.quote_signature_required ?? !1
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
export { g as useInvoiceSettingsForm };
|