@voyantjs/plugin-smartbill 0.64.1 → 0.66.6

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 CHANGED
@@ -79,6 +79,47 @@ Use `retrySmartbillInvoiceArtifact({ runtime, client, externalRef, documentType
79
79
  })` to re-download and re-attach a SmartBill PDF from an existing external ref
80
80
  without issuing a new document.
81
81
 
82
+ ## Invoice UI
83
+
84
+ The optional `./invoice-ui` entry ships React helpers for invoice detail pages.
85
+ It reads SmartBill refs from `/v1/finance/invoices/:id/external-refs` using the
86
+ `@voyantjs/finance-react` provider context and can be mounted in
87
+ `InvoiceDetailPage`'s integration slot.
88
+
89
+ ```tsx
90
+ import { InvoiceDetailPage } from "@voyantjs/finance-ui"
91
+ import { SmartbillInvoicePanel } from "@voyantjs/plugin-smartbill/invoice-ui"
92
+
93
+ export function InvoicePage({ invoiceId }: { invoiceId: string }) {
94
+ return (
95
+ <InvoiceDetailPage
96
+ id={invoiceId}
97
+ slots={{
98
+ integrationsContent: ({ invoice }) => (
99
+ <SmartbillInvoicePanel
100
+ invoiceId={invoice.id}
101
+ sendAction={{
102
+ onClick: () => requestSmartbillSend(invoice.id),
103
+ }}
104
+ retryAction={{
105
+ onClick: () => requestSmartbillRetry(invoice.id),
106
+ }}
107
+ />
108
+ ),
109
+ }}
110
+ />
111
+ )
112
+ }
113
+ ```
114
+
115
+ `SmartbillInvoicePanel` displays the SmartBill series, number, document type,
116
+ sync status, sync errors, and document/PDF links when the external ref contains
117
+ them. Hosts provide action callbacks such as send, retry, or proforma
118
+ conversion because route shape and permissions remain app-owned. For custom
119
+ layouts, use `useSmartbillInvoiceRef(invoiceId)` together with
120
+ `resolveSmartbillInvoiceReferenceParts(ref)` and
121
+ `getSmartbillInvoiceDocumentLinks(ref)`.
122
+
82
123
  ## Workflow Factories
83
124
 
84
125
  The package also ships scheduler-agnostic workflow factories for recurring
@@ -126,6 +167,7 @@ finance records.
126
167
  | `.` | Barrel re-exports |
127
168
  | `./plugin` | `smartbillPlugin(options)` — packaged adapter/subscriber bundle |
128
169
  | `./client` | `createSmartbillClient` — `createInvoice`, `cancelInvoice`, `viewPdf`, `getPaymentStatus`, etc. |
170
+ | `./invoice-ui` | Optional React hooks, display helpers, and `SmartbillInvoicePanel` for invoice detail integrations |
129
171
  | `./mock` | `createSmartbillMockServer` — stateful local SmartBill-compatible mock for tests |
130
172
  | `./workflows` | Proforma conversion polling and drift reconciliation factories |
131
173
  | `./types` | SmartBill adapter and bundle types |
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ export declare const smartbillInvoiceExternalRefSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ invoiceId: z.ZodString;
5
+ provider: z.ZodString;
6
+ externalId: z.ZodNullable<z.ZodString>;
7
+ externalNumber: z.ZodNullable<z.ZodString>;
8
+ externalUrl: z.ZodNullable<z.ZodString>;
9
+ status: z.ZodNullable<z.ZodString>;
10
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
11
+ syncedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
12
+ syncError: z.ZodNullable<z.ZodString>;
13
+ createdAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
14
+ updatedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
15
+ }, z.core.$strip>;
16
+ export declare const smartbillInvoiceExternalRefsResponseSchema: z.ZodObject<{
17
+ data: z.ZodArray<z.ZodObject<{
18
+ id: z.ZodString;
19
+ invoiceId: z.ZodString;
20
+ provider: z.ZodString;
21
+ externalId: z.ZodNullable<z.ZodString>;
22
+ externalNumber: z.ZodNullable<z.ZodString>;
23
+ externalUrl: z.ZodNullable<z.ZodString>;
24
+ status: z.ZodNullable<z.ZodString>;
25
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ syncedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
27
+ syncError: z.ZodNullable<z.ZodString>;
28
+ createdAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
29
+ updatedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>;
32
+ export type SmartbillInvoiceExternalRef = z.infer<typeof smartbillInvoiceExternalRefSchema>;
33
+ export interface SmartbillInvoiceReferenceParts {
34
+ companyVatCode: string | null;
35
+ seriesName: string | null;
36
+ number: string | null;
37
+ documentType: "invoice" | "proforma" | string | null;
38
+ }
39
+ export interface SmartbillInvoiceDocumentLink {
40
+ label: string;
41
+ href: string;
42
+ }
43
+ export declare function selectSmartbillInvoiceRef(refs: ReadonlyArray<SmartbillInvoiceExternalRef>): SmartbillInvoiceExternalRef | null;
44
+ export declare function resolveSmartbillInvoiceReferenceParts(ref: SmartbillInvoiceExternalRef | null | undefined): SmartbillInvoiceReferenceParts;
45
+ export declare function getSmartbillInvoiceDocumentLinks(ref: SmartbillInvoiceExternalRef | null | undefined): SmartbillInvoiceDocumentLink[];
46
+ //# sourceMappingURL=invoice-ui-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ui-data.d.ts","sourceRoot":"","sources":["../src/invoice-ui-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;iBAa5C,CAAA;AAEF,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;iBAErD,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAE3F,MAAM,WAAW,8BAA8B;IAC7C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,YAAY,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,CAAA;CACrD;AAED,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAC/C,2BAA2B,GAAG,IAAI,CAEpC;AAED,wBAAgB,qCAAqC,CACnD,GAAG,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,GAClD,8BAA8B,CAYhC;AAED,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,GAClD,4BAA4B,EAAE,CAchC"}
@@ -0,0 +1,62 @@
1
+ import { z } from "zod";
2
+ export const smartbillInvoiceExternalRefSchema = z.object({
3
+ id: z.string(),
4
+ invoiceId: z.string(),
5
+ provider: z.string(),
6
+ externalId: z.string().nullable(),
7
+ externalNumber: z.string().nullable(),
8
+ externalUrl: z.string().nullable(),
9
+ status: z.string().nullable(),
10
+ metadata: z.record(z.string(), z.unknown()).nullable(),
11
+ syncedAt: z.union([z.string(), z.date()]).nullable(),
12
+ syncError: z.string().nullable(),
13
+ createdAt: z.union([z.string(), z.date()]).nullable(),
14
+ updatedAt: z.union([z.string(), z.date()]).nullable(),
15
+ });
16
+ export const smartbillInvoiceExternalRefsResponseSchema = z.object({
17
+ data: z.array(smartbillInvoiceExternalRefSchema),
18
+ });
19
+ export function selectSmartbillInvoiceRef(refs) {
20
+ return refs.find((ref) => ref.provider === "smartbill") ?? null;
21
+ }
22
+ export function resolveSmartbillInvoiceReferenceParts(ref) {
23
+ const metadata = coerceMetadata(ref?.metadata);
24
+ return {
25
+ companyVatCode: readMetadataString(metadata, "companyVatCode", "vatCode"),
26
+ seriesName: readMetadataString(metadata, "seriesName", "series"),
27
+ number: readMetadataString(metadata, "number", "invoiceNumber") ??
28
+ ref?.externalNumber ??
29
+ ref?.externalId ??
30
+ null,
31
+ documentType: readMetadataString(metadata, "documentType"),
32
+ };
33
+ }
34
+ export function getSmartbillInvoiceDocumentLinks(ref) {
35
+ const metadata = coerceMetadata(ref?.metadata);
36
+ const candidates = [
37
+ { label: "SmartBill document", href: ref?.externalUrl },
38
+ { label: "SmartBill PDF", href: readMetadataString(metadata, "pdfUrl", "downloadUrl") },
39
+ { label: "SmartBill invoice", href: readMetadataString(metadata, "invoiceUrl", "documentUrl") },
40
+ ];
41
+ const seen = new Set();
42
+ return candidates.flatMap((candidate) => {
43
+ const href = candidate.href?.trim();
44
+ if (!href || seen.has(href))
45
+ return [];
46
+ seen.add(href);
47
+ return [{ label: candidate.label, href }];
48
+ });
49
+ }
50
+ function coerceMetadata(value) {
51
+ return value && typeof value === "object" && !Array.isArray(value)
52
+ ? value
53
+ : null;
54
+ }
55
+ function readMetadataString(metadata, ...keys) {
56
+ for (const key of keys) {
57
+ const value = metadata?.[key];
58
+ if (typeof value === "string" && value.trim())
59
+ return value.trim();
60
+ }
61
+ return null;
62
+ }
@@ -0,0 +1,436 @@
1
+ import type { ReactNode } from "react";
2
+ import { type SmartbillInvoiceExternalRef } from "./invoice-ui-data.js";
3
+ export { getSmartbillInvoiceDocumentLinks, resolveSmartbillInvoiceReferenceParts, type SmartbillInvoiceDocumentLink, type SmartbillInvoiceExternalRef, type SmartbillInvoiceReferenceParts, selectSmartbillInvoiceRef, } from "./invoice-ui-data.js";
4
+ export interface UseSmartbillInvoiceRefsOptions {
5
+ enabled?: boolean;
6
+ }
7
+ export interface SmartbillInvoiceAction {
8
+ label?: string;
9
+ pending?: boolean;
10
+ disabled?: boolean;
11
+ onClick: () => void | Promise<void>;
12
+ }
13
+ export interface SmartbillInvoicePanelProps {
14
+ invoiceId: string;
15
+ externalRef?: SmartbillInvoiceExternalRef | null;
16
+ title?: ReactNode;
17
+ className?: string;
18
+ hideWhenEmpty?: boolean;
19
+ sendAction?: SmartbillInvoiceAction;
20
+ retryAction?: SmartbillInvoiceAction;
21
+ convertProformaAction?: SmartbillInvoiceAction;
22
+ extraActions?: ReactNode;
23
+ }
24
+ export declare function useSmartbillInvoiceRefs(invoiceId: string | null | undefined, options?: UseSmartbillInvoiceRefsOptions): import("@tanstack/react-query").UseQueryResult<{
25
+ id: string;
26
+ invoiceId: string;
27
+ provider: string;
28
+ externalId: string | null;
29
+ externalNumber: string | null;
30
+ externalUrl: string | null;
31
+ status: string | null;
32
+ metadata: Record<string, unknown> | null;
33
+ syncedAt: string | Date | null;
34
+ syncError: string | null;
35
+ createdAt: string | Date | null;
36
+ updatedAt: string | Date | null;
37
+ }[], Error>;
38
+ export declare function useSmartbillInvoiceRef(invoiceId: string | null | undefined, options?: UseSmartbillInvoiceRefsOptions): {
39
+ data: {
40
+ id: string;
41
+ invoiceId: string;
42
+ provider: string;
43
+ externalId: string | null;
44
+ externalNumber: string | null;
45
+ externalUrl: string | null;
46
+ status: string | null;
47
+ metadata: Record<string, unknown> | null;
48
+ syncedAt: string | Date | null;
49
+ syncError: string | null;
50
+ createdAt: string | Date | null;
51
+ updatedAt: string | Date | null;
52
+ } | null | undefined;
53
+ error: Error;
54
+ isError: true;
55
+ isPending: false;
56
+ isLoading: false;
57
+ isLoadingError: false;
58
+ isRefetchError: true;
59
+ isSuccess: false;
60
+ isPlaceholderData: false;
61
+ status: "error";
62
+ dataUpdatedAt: number;
63
+ errorUpdatedAt: number;
64
+ failureCount: number;
65
+ failureReason: Error | null;
66
+ errorUpdateCount: number;
67
+ isFetched: boolean;
68
+ isFetchedAfterMount: boolean;
69
+ isFetching: boolean;
70
+ isInitialLoading: boolean;
71
+ isPaused: boolean;
72
+ isRefetching: boolean;
73
+ isStale: boolean;
74
+ isEnabled: boolean;
75
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
76
+ id: string;
77
+ invoiceId: string;
78
+ provider: string;
79
+ externalId: string | null;
80
+ externalNumber: string | null;
81
+ externalUrl: string | null;
82
+ status: string | null;
83
+ metadata: Record<string, unknown> | null;
84
+ syncedAt: string | Date | null;
85
+ syncError: string | null;
86
+ createdAt: string | Date | null;
87
+ updatedAt: string | Date | null;
88
+ }[], Error>>;
89
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
90
+ promise: Promise<{
91
+ id: string;
92
+ invoiceId: string;
93
+ provider: string;
94
+ externalId: string | null;
95
+ externalNumber: string | null;
96
+ externalUrl: string | null;
97
+ status: string | null;
98
+ metadata: Record<string, unknown> | null;
99
+ syncedAt: string | Date | null;
100
+ syncError: string | null;
101
+ createdAt: string | Date | null;
102
+ updatedAt: string | Date | null;
103
+ }[]>;
104
+ } | {
105
+ data: {
106
+ id: string;
107
+ invoiceId: string;
108
+ provider: string;
109
+ externalId: string | null;
110
+ externalNumber: string | null;
111
+ externalUrl: string | null;
112
+ status: string | null;
113
+ metadata: Record<string, unknown> | null;
114
+ syncedAt: string | Date | null;
115
+ syncError: string | null;
116
+ createdAt: string | Date | null;
117
+ updatedAt: string | Date | null;
118
+ } | null | undefined;
119
+ error: null;
120
+ isError: false;
121
+ isPending: false;
122
+ isLoading: false;
123
+ isLoadingError: false;
124
+ isRefetchError: false;
125
+ isSuccess: true;
126
+ isPlaceholderData: false;
127
+ status: "success";
128
+ dataUpdatedAt: number;
129
+ errorUpdatedAt: number;
130
+ failureCount: number;
131
+ failureReason: Error | null;
132
+ errorUpdateCount: number;
133
+ isFetched: boolean;
134
+ isFetchedAfterMount: boolean;
135
+ isFetching: boolean;
136
+ isInitialLoading: boolean;
137
+ isPaused: boolean;
138
+ isRefetching: boolean;
139
+ isStale: boolean;
140
+ isEnabled: boolean;
141
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
142
+ id: string;
143
+ invoiceId: string;
144
+ provider: string;
145
+ externalId: string | null;
146
+ externalNumber: string | null;
147
+ externalUrl: string | null;
148
+ status: string | null;
149
+ metadata: Record<string, unknown> | null;
150
+ syncedAt: string | Date | null;
151
+ syncError: string | null;
152
+ createdAt: string | Date | null;
153
+ updatedAt: string | Date | null;
154
+ }[], Error>>;
155
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
156
+ promise: Promise<{
157
+ id: string;
158
+ invoiceId: string;
159
+ provider: string;
160
+ externalId: string | null;
161
+ externalNumber: string | null;
162
+ externalUrl: string | null;
163
+ status: string | null;
164
+ metadata: Record<string, unknown> | null;
165
+ syncedAt: string | Date | null;
166
+ syncError: string | null;
167
+ createdAt: string | Date | null;
168
+ updatedAt: string | Date | null;
169
+ }[]>;
170
+ } | {
171
+ data: {
172
+ id: string;
173
+ invoiceId: string;
174
+ provider: string;
175
+ externalId: string | null;
176
+ externalNumber: string | null;
177
+ externalUrl: string | null;
178
+ status: string | null;
179
+ metadata: Record<string, unknown> | null;
180
+ syncedAt: string | Date | null;
181
+ syncError: string | null;
182
+ createdAt: string | Date | null;
183
+ updatedAt: string | Date | null;
184
+ } | null | undefined;
185
+ error: Error;
186
+ isError: true;
187
+ isPending: false;
188
+ isLoading: false;
189
+ isLoadingError: true;
190
+ isRefetchError: false;
191
+ isSuccess: false;
192
+ isPlaceholderData: false;
193
+ status: "error";
194
+ dataUpdatedAt: number;
195
+ errorUpdatedAt: number;
196
+ failureCount: number;
197
+ failureReason: Error | null;
198
+ errorUpdateCount: number;
199
+ isFetched: boolean;
200
+ isFetchedAfterMount: boolean;
201
+ isFetching: boolean;
202
+ isInitialLoading: boolean;
203
+ isPaused: boolean;
204
+ isRefetching: boolean;
205
+ isStale: boolean;
206
+ isEnabled: boolean;
207
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
208
+ id: string;
209
+ invoiceId: string;
210
+ provider: string;
211
+ externalId: string | null;
212
+ externalNumber: string | null;
213
+ externalUrl: string | null;
214
+ status: string | null;
215
+ metadata: Record<string, unknown> | null;
216
+ syncedAt: string | Date | null;
217
+ syncError: string | null;
218
+ createdAt: string | Date | null;
219
+ updatedAt: string | Date | null;
220
+ }[], Error>>;
221
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
222
+ promise: Promise<{
223
+ id: string;
224
+ invoiceId: string;
225
+ provider: string;
226
+ externalId: string | null;
227
+ externalNumber: string | null;
228
+ externalUrl: string | null;
229
+ status: string | null;
230
+ metadata: Record<string, unknown> | null;
231
+ syncedAt: string | Date | null;
232
+ syncError: string | null;
233
+ createdAt: string | Date | null;
234
+ updatedAt: string | Date | null;
235
+ }[]>;
236
+ } | {
237
+ data: {
238
+ id: string;
239
+ invoiceId: string;
240
+ provider: string;
241
+ externalId: string | null;
242
+ externalNumber: string | null;
243
+ externalUrl: string | null;
244
+ status: string | null;
245
+ metadata: Record<string, unknown> | null;
246
+ syncedAt: string | Date | null;
247
+ syncError: string | null;
248
+ createdAt: string | Date | null;
249
+ updatedAt: string | Date | null;
250
+ } | null | undefined;
251
+ error: null;
252
+ isError: false;
253
+ isPending: true;
254
+ isLoading: true;
255
+ isLoadingError: false;
256
+ isRefetchError: false;
257
+ isSuccess: false;
258
+ isPlaceholderData: false;
259
+ status: "pending";
260
+ dataUpdatedAt: number;
261
+ errorUpdatedAt: number;
262
+ failureCount: number;
263
+ failureReason: Error | null;
264
+ errorUpdateCount: number;
265
+ isFetched: boolean;
266
+ isFetchedAfterMount: boolean;
267
+ isFetching: boolean;
268
+ isInitialLoading: boolean;
269
+ isPaused: boolean;
270
+ isRefetching: boolean;
271
+ isStale: boolean;
272
+ isEnabled: boolean;
273
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
274
+ id: string;
275
+ invoiceId: string;
276
+ provider: string;
277
+ externalId: string | null;
278
+ externalNumber: string | null;
279
+ externalUrl: string | null;
280
+ status: string | null;
281
+ metadata: Record<string, unknown> | null;
282
+ syncedAt: string | Date | null;
283
+ syncError: string | null;
284
+ createdAt: string | Date | null;
285
+ updatedAt: string | Date | null;
286
+ }[], Error>>;
287
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
288
+ promise: Promise<{
289
+ id: string;
290
+ invoiceId: string;
291
+ provider: string;
292
+ externalId: string | null;
293
+ externalNumber: string | null;
294
+ externalUrl: string | null;
295
+ status: string | null;
296
+ metadata: Record<string, unknown> | null;
297
+ syncedAt: string | Date | null;
298
+ syncError: string | null;
299
+ createdAt: string | Date | null;
300
+ updatedAt: string | Date | null;
301
+ }[]>;
302
+ } | {
303
+ data: {
304
+ id: string;
305
+ invoiceId: string;
306
+ provider: string;
307
+ externalId: string | null;
308
+ externalNumber: string | null;
309
+ externalUrl: string | null;
310
+ status: string | null;
311
+ metadata: Record<string, unknown> | null;
312
+ syncedAt: string | Date | null;
313
+ syncError: string | null;
314
+ createdAt: string | Date | null;
315
+ updatedAt: string | Date | null;
316
+ } | null | undefined;
317
+ error: null;
318
+ isError: false;
319
+ isPending: true;
320
+ isLoadingError: false;
321
+ isRefetchError: false;
322
+ isSuccess: false;
323
+ isPlaceholderData: false;
324
+ status: "pending";
325
+ dataUpdatedAt: number;
326
+ errorUpdatedAt: number;
327
+ failureCount: number;
328
+ failureReason: Error | null;
329
+ errorUpdateCount: number;
330
+ isFetched: boolean;
331
+ isFetchedAfterMount: boolean;
332
+ isFetching: boolean;
333
+ isLoading: boolean;
334
+ isInitialLoading: boolean;
335
+ isPaused: boolean;
336
+ isRefetching: boolean;
337
+ isStale: boolean;
338
+ isEnabled: boolean;
339
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
340
+ id: string;
341
+ invoiceId: string;
342
+ provider: string;
343
+ externalId: string | null;
344
+ externalNumber: string | null;
345
+ externalUrl: string | null;
346
+ status: string | null;
347
+ metadata: Record<string, unknown> | null;
348
+ syncedAt: string | Date | null;
349
+ syncError: string | null;
350
+ createdAt: string | Date | null;
351
+ updatedAt: string | Date | null;
352
+ }[], Error>>;
353
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
354
+ promise: Promise<{
355
+ id: string;
356
+ invoiceId: string;
357
+ provider: string;
358
+ externalId: string | null;
359
+ externalNumber: string | null;
360
+ externalUrl: string | null;
361
+ status: string | null;
362
+ metadata: Record<string, unknown> | null;
363
+ syncedAt: string | Date | null;
364
+ syncError: string | null;
365
+ createdAt: string | Date | null;
366
+ updatedAt: string | Date | null;
367
+ }[]>;
368
+ } | {
369
+ data: {
370
+ id: string;
371
+ invoiceId: string;
372
+ provider: string;
373
+ externalId: string | null;
374
+ externalNumber: string | null;
375
+ externalUrl: string | null;
376
+ status: string | null;
377
+ metadata: Record<string, unknown> | null;
378
+ syncedAt: string | Date | null;
379
+ syncError: string | null;
380
+ createdAt: string | Date | null;
381
+ updatedAt: string | Date | null;
382
+ } | null | undefined;
383
+ isError: false;
384
+ error: null;
385
+ isPending: false;
386
+ isLoading: false;
387
+ isLoadingError: false;
388
+ isRefetchError: false;
389
+ isSuccess: true;
390
+ isPlaceholderData: true;
391
+ status: "success";
392
+ dataUpdatedAt: number;
393
+ errorUpdatedAt: number;
394
+ failureCount: number;
395
+ failureReason: Error | null;
396
+ errorUpdateCount: number;
397
+ isFetched: boolean;
398
+ isFetchedAfterMount: boolean;
399
+ isFetching: boolean;
400
+ isInitialLoading: boolean;
401
+ isPaused: boolean;
402
+ isRefetching: boolean;
403
+ isStale: boolean;
404
+ isEnabled: boolean;
405
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
406
+ id: string;
407
+ invoiceId: string;
408
+ provider: string;
409
+ externalId: string | null;
410
+ externalNumber: string | null;
411
+ externalUrl: string | null;
412
+ status: string | null;
413
+ metadata: Record<string, unknown> | null;
414
+ syncedAt: string | Date | null;
415
+ syncError: string | null;
416
+ createdAt: string | Date | null;
417
+ updatedAt: string | Date | null;
418
+ }[], Error>>;
419
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
420
+ promise: Promise<{
421
+ id: string;
422
+ invoiceId: string;
423
+ provider: string;
424
+ externalId: string | null;
425
+ externalNumber: string | null;
426
+ externalUrl: string | null;
427
+ status: string | null;
428
+ metadata: Record<string, unknown> | null;
429
+ syncedAt: string | Date | null;
430
+ syncError: string | null;
431
+ createdAt: string | Date | null;
432
+ updatedAt: string | Date | null;
433
+ }[]>;
434
+ };
435
+ export declare function SmartbillInvoicePanel({ invoiceId, externalRef, title, className, hideWhenEmpty, sendAction, retryAction, convertProformaAction, extraActions, }: SmartbillInvoicePanelProps): import("react/jsx-runtime").JSX.Element | null;
436
+ //# sourceMappingURL=invoice-ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ui.d.ts","sourceRoot":"","sources":["../src/invoice-ui.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAGL,KAAK,2BAA2B,EAGjC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,gCAAgC,EAChC,qCAAqC,EACrC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,yBAAyB,GAC1B,MAAM,sBAAsB,CAAA;AAE7B,MAAM,WAAW,8BAA8B;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpC;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAA;IAChD,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,sBAAsB,CAAA;IACnC,WAAW,CAAC,EAAE,sBAAsB,CAAA;IACpC,qBAAqB,CAAC,EAAE,sBAAsB,CAAA;IAC9C,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;YAiB7C;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,8BAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO7C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,WAAW,EACX,KAAmB,EACnB,SAAS,EACT,aAAqB,EACrB,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,YAAY,GACb,EAAE,0BAA0B,kDA8F5B"}
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useQuery } from "@tanstack/react-query";
4
+ import { fetchWithValidation, useVoyantFinanceContext } from "@voyantjs/finance-react";
5
+ import { Badge, Button, buttonVariants, Card, CardAction, CardContent, CardHeader, CardTitle, } from "@voyantjs/ui/components";
6
+ import { cn } from "@voyantjs/ui/lib/utils";
7
+ import { ExternalLink, FileText, Loader2, RefreshCw, Send } from "lucide-react";
8
+ import { getSmartbillInvoiceDocumentLinks, resolveSmartbillInvoiceReferenceParts, selectSmartbillInvoiceRef, smartbillInvoiceExternalRefsResponseSchema, } from "./invoice-ui-data.js";
9
+ export { getSmartbillInvoiceDocumentLinks, resolveSmartbillInvoiceReferenceParts, selectSmartbillInvoiceRef, } from "./invoice-ui-data.js";
10
+ export function useSmartbillInvoiceRefs(invoiceId, options = {}) {
11
+ const { baseUrl, fetcher } = useVoyantFinanceContext();
12
+ const { enabled = true } = options;
13
+ return useQuery({
14
+ queryKey: ["voyant", "smartbill", "invoice", invoiceId, "external-refs"],
15
+ queryFn: async () => {
16
+ const response = await fetchWithValidation(`/v1/finance/invoices/${encodeURIComponent(invoiceId ?? "")}/external-refs`, smartbillInvoiceExternalRefsResponseSchema, { baseUrl, fetcher });
17
+ return response.data.filter((ref) => ref.provider === "smartbill");
18
+ },
19
+ enabled: enabled && Boolean(invoiceId),
20
+ });
21
+ }
22
+ export function useSmartbillInvoiceRef(invoiceId, options = {}) {
23
+ const query = useSmartbillInvoiceRefs(invoiceId, options);
24
+ return {
25
+ ...query,
26
+ data: query.data ? selectSmartbillInvoiceRef(query.data) : undefined,
27
+ };
28
+ }
29
+ export function SmartbillInvoicePanel({ invoiceId, externalRef, title = "SmartBill", className, hideWhenEmpty = false, sendAction, retryAction, convertProformaAction, extraActions, }) {
30
+ const query = useSmartbillInvoiceRef(invoiceId, { enabled: externalRef === undefined });
31
+ const ref = externalRef === undefined ? query.data : externalRef;
32
+ const isLoading = externalRef === undefined && query.isPending;
33
+ const isError = externalRef === undefined && query.isError;
34
+ if (hideWhenEmpty && !isLoading && !isError && !ref) {
35
+ return null;
36
+ }
37
+ const reference = resolveSmartbillInvoiceReferenceParts(ref);
38
+ const documentLinks = getSmartbillInvoiceDocumentLinks(ref);
39
+ const status = ref?.syncError ? "error" : (ref?.status ?? null);
40
+ const canConvertProforma = reference.documentType === "proforma" && convertProformaAction;
41
+ return (_jsxs(Card, { "data-slot": "smartbill-invoice-panel", size: "sm", className: className, children: [_jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex min-w-0 items-center gap-2", children: [_jsx(FileText, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }), _jsx("span", { className: "truncate", children: title })] }), _jsx(CardAction, { children: status ? (_jsx(Badge, { variant: status === "error" ? "destructive" : "outline", children: status })) : null })] }), _jsxs(CardContent, { className: "grid gap-4", children: [isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground text-sm", children: [_jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }), "Loading SmartBill state"] })) : isError ? (_jsx("p", { className: "text-destructive text-sm", children: "SmartBill state could not be loaded." })) : ref ? (_jsxs("div", { className: "grid gap-3 text-sm", children: [_jsxs("dl", { className: "grid gap-2 sm:grid-cols-2", children: [_jsx(SmartbillField, { label: "Series", children: reference.seriesName ?? "-" }), _jsx(SmartbillField, { label: "Number", children: reference.number ?? "-" }), _jsx(SmartbillField, { label: "Type", children: reference.documentType ?? "-" }), _jsx(SmartbillField, { label: "Synced", children: formatDateTime(ref.syncedAt) ?? "-" })] }), ref.syncError ? (_jsx("p", { className: "rounded-md border border-destructive/20 bg-destructive/5 p-2 text-destructive", children: ref.syncError })) : null, documentLinks.length > 0 ? (_jsx("div", { className: "flex flex-wrap gap-2", children: documentLinks.map((link) => (_jsxs("a", { href: link.href, target: "_blank", rel: "noreferrer", className: buttonVariants({ variant: "outline", size: "sm" }), children: [_jsx(ExternalLink, { className: "size-4", "aria-hidden": "true" }), link.label] }, link.href))) })) : null] })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: "No SmartBill reference is linked yet." })), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [!ref && sendAction ? (_jsx(SmartbillActionButton, { action: sendAction, icon: _jsx(Send, { className: "size-4" }), children: sendAction.label ?? "Send to SmartBill" })) : null, retryAction ? (_jsx(SmartbillActionButton, { action: retryAction, icon: _jsx(RefreshCw, { className: "size-4" }), children: retryAction.label ?? "Retry sync" })) : null, canConvertProforma ? (_jsx(SmartbillActionButton, { action: convertProformaAction, icon: _jsx(RefreshCw, { className: "size-4" }), children: convertProformaAction.label ?? "Convert proforma" })) : null, extraActions] })] })] }));
42
+ }
43
+ function SmartbillField({ label, children }) {
44
+ return (_jsxs("div", { className: "grid gap-1", children: [_jsx("dt", { className: "text-muted-foreground text-xs uppercase", children: label }), _jsx("dd", { className: "break-words font-medium", children: children })] }));
45
+ }
46
+ function SmartbillActionButton({ action, icon, children, }) {
47
+ return (_jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: action.disabled || action.pending, onClick: () => void action.onClick(), children: [_jsx("span", { className: cn(action.pending && "animate-spin"), children: action.pending ? _jsx(Loader2, { className: "size-4", "aria-hidden": "true" }) : icon }), children] }));
48
+ }
49
+ function formatDateTime(value) {
50
+ if (!value)
51
+ return null;
52
+ const date = value instanceof Date ? value : new Date(value);
53
+ if (Number.isNaN(date.getTime()))
54
+ return null;
55
+ return new Intl.DateTimeFormat(undefined, { dateStyle: "medium", timeStyle: "short" }).format(date);
56
+ }
package/dist/mapping.js CHANGED
@@ -71,6 +71,9 @@ function buildSmartbillInvoiceBody(event, options) {
71
71
  body.issueDate = event.issueDate;
72
72
  if (typeof event.deliveryDate === "string")
73
73
  body.deliveryDate = event.deliveryDate;
74
+ const exchangeRate = asNumberOrUndefined(event.effectiveRate ?? event.fxRate ?? event.exchangeRate);
75
+ if (exchangeRate)
76
+ body.exchangeRate = exchangeRate;
74
77
  const mentions = options.hasMentionsOverride
75
78
  ? options.mentions
76
79
  : asStringOrUndefined(event.mentions);
@@ -81,6 +84,10 @@ function buildSmartbillInvoiceBody(event, options) {
81
84
  : asStringOrUndefined(event.observations);
82
85
  if (observations)
83
86
  body.observations = observations;
87
+ const fxCommissionMention = asStringOrUndefined(event.fxCommissionInvoiceMention);
88
+ if (fxCommissionMention && asNumber(event.fxCommissionBps, 0) > 0) {
89
+ body.mentions = [body.mentions, fxCommissionMention].filter(Boolean).join("\n");
90
+ }
84
91
  if (options.art311SpecialRegime) {
85
92
  body.mentions = [
86
93
  body.mentions,
@@ -171,3 +178,8 @@ function asNumber(value, fallback) {
171
178
  return value;
172
179
  return fallback;
173
180
  }
181
+ function asNumberOrUndefined(value) {
182
+ if (typeof value === "number" && Number.isFinite(value) && value > 0)
183
+ return value;
184
+ return undefined;
185
+ }
package/dist/types.d.ts CHANGED
@@ -57,6 +57,7 @@ export interface SmartbillInvoiceBody {
57
57
  deliveryDate?: string;
58
58
  precision?: number;
59
59
  useEstimateDetails?: boolean;
60
+ exchangeRate?: number;
60
61
  mentions?: string;
61
62
  observations?: string;
62
63
  products: SmartbillProduct[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IAC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AAA;CACpD;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,IAAI,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CACpE;AAED;;;GAGG;AACH,MAAM,WAAW,iCAAkC,SAAQ,iBAAiB;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,EAAE,wBAAwB,EAAE,CAAA;CACtC;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,KACE,OAAO,CAAC;IACX,EAAE,EAAE,OAAO,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAC3B,WAAW,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IACvC,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAC/C,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/plugin-smartbill",
3
- "version": "0.64.1",
3
+ "version": "0.66.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,6 +24,11 @@
24
24
  "import": "./dist/plugin.js",
25
25
  "default": "./dist/plugin.js"
26
26
  },
27
+ "./invoice-ui": {
28
+ "types": "./dist/invoice-ui.d.ts",
29
+ "import": "./dist/invoice-ui.js",
30
+ "default": "./dist/invoice-ui.js"
31
+ },
27
32
  "./settlement": {
28
33
  "types": "./dist/settlement.d.ts",
29
34
  "import": "./dist/settlement.js",
@@ -43,13 +48,49 @@
43
48
  "dependencies": {
44
49
  "drizzle-orm": "^0.45.2",
45
50
  "zod": "^4.3.6",
46
- "@voyantjs/core": "0.64.1",
47
- "@voyantjs/finance": "0.64.1",
48
- "@voyantjs/storage": "0.64.1"
51
+ "@voyantjs/core": "0.66.6",
52
+ "@voyantjs/finance": "0.66.6",
53
+ "@voyantjs/storage": "0.66.6"
54
+ },
55
+ "peerDependencies": {
56
+ "@tanstack/react-query": "^5.0.0",
57
+ "lucide-react": "^0.475.0",
58
+ "react": "^19.0.0",
59
+ "react-dom": "^19.0.0",
60
+ "@voyantjs/finance-react": "0.66.6",
61
+ "@voyantjs/ui": "0.66.6"
62
+ },
63
+ "peerDependenciesMeta": {
64
+ "@tanstack/react-query": {
65
+ "optional": true
66
+ },
67
+ "@voyantjs/finance-react": {
68
+ "optional": true
69
+ },
70
+ "@voyantjs/ui": {
71
+ "optional": true
72
+ },
73
+ "lucide-react": {
74
+ "optional": true
75
+ },
76
+ "react": {
77
+ "optional": true
78
+ },
79
+ "react-dom": {
80
+ "optional": true
81
+ }
49
82
  },
50
83
  "devDependencies": {
84
+ "@tanstack/react-query": "^5.100.11",
85
+ "@types/react": "^19.2.14",
86
+ "@types/react-dom": "^19.2.3",
87
+ "lucide-react": "^0.475.0",
88
+ "react": "^19.2.4",
89
+ "react-dom": "^19.2.4",
51
90
  "typescript": "^6.0.2",
52
91
  "vitest": "^4.1.2",
92
+ "@voyantjs/finance-react": "0.66.6",
93
+ "@voyantjs/ui": "0.66.6",
53
94
  "@voyantjs/voyant-typescript-config": "0.1.0"
54
95
  },
55
96
  "files": [