sinfactura-types 1.6.2 → 1.6.4

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/cash.d.ts CHANGED
@@ -9,6 +9,11 @@ declare global {
9
9
  outcome?: number;
10
10
  balance?: number;
11
11
  subject?: string;
12
+ currency?: string;
13
+ currencyValue?: number;
14
+ currencyValueAt?: number;
15
+ balanceByCurrency?: Record<string, number>;
16
+ incomeByCurrency?: Record<string, number>;
12
17
  }
13
18
  }
14
19
  export {};
package/dist/payment.d.ts CHANGED
@@ -1,107 +1,110 @@
1
- /**
2
- * WebSocket broadcast payload for the `payment_received` action.
3
- *
4
- * Fired by the API when a "money received" event is persisted across any
5
- * of three sources (MP webhook, Stripe webhook, MP movements poller).
6
- * Receivers (FE) should:
7
- * 1. Render an immediate snackbar toast using `total` + `currency` + `payerName`.
8
- * 2. Invalidate RTK Query tags `PaymentReceived` + `PaymentReceivedUnlinked`
9
- * so the canonical row is refetched from `GET /payments/received`.
10
- */
11
- export type PaymentReceivedSource = "mp" | "stripe" | "mp_movement";
12
- export interface PaymentReceivedWsPayload {
13
- source: PaymentReceivedSource;
14
- paymentId: string;
15
- total: number;
16
- currency: string;
17
- payerName?: string;
18
- paidAt: number;
19
- customerId?: string;
20
- orderId?: string;
21
- invoiceId?: string;
22
- }
23
- /**
24
- * REST shape of a payment row returned by `GET /payments/received` (api#902).
25
- *
26
- * Distinct from `PaymentReceivedWsPayload` (api#880, the WS broadcast):
27
- * - This carries denormalized labels (customerName, orderCode, invoiceCode)
28
- * attached server-side at response time so the FE doesn't N+1 fetch.
29
- * - The WS broadcast is the lean live-tail event; this is the canonical row.
30
- */
31
- export interface PaymentReceived {
32
- paymentId: string;
33
- source: PaymentReceivedSource;
34
- total: number;
35
- currency: string;
36
- currencyValue?: number;
37
- currencyValueAt?: number;
38
- payerName?: string;
39
- payerEmail?: string;
40
- payerCuit?: string;
41
- paidAt: number;
42
- customerId?: string;
43
- customerName?: string;
44
- orderId?: string;
45
- orderCode?: string;
46
- invoiceId?: string;
47
- invoiceCode?: string;
48
- accountId?: string;
49
- linkedAt?: number;
50
- linkSource?: "auto" | "manual";
51
- }
52
- /**
53
- * Confidence tier for a link suggestion (api#904).
54
- *
55
- * Mapped from heuristic match strength:
56
- * - 'Alta': customer CUIT/email exact OR order amount-exact + ±24h
57
- * - 'Media': order amount ±5% within ±7d
58
- * - 'Baja': reserved for future broader heuristics (currently unused)
59
- */
60
- export type LinkSuggestionConfidence = "Alta" | "Media" | "Baja";
61
- /**
62
- * One ranked customer candidate for a payment's link dialog (api#904).
63
- * The FE renders the chip with `fullName`, the confidence badge, and the
64
- * `reason` text verbatim.
65
- */
66
- export interface CustomerCandidate {
67
- customerId: string;
68
- fullName: string;
69
- cuit?: string;
70
- email?: string;
71
- confidence: LinkSuggestionConfidence;
72
- reason: string;
73
- score: number;
74
- }
75
- /**
76
- * One ranked order candidate for a payment's link dialog (api#904).
77
- * `orderCode` is currently identical to `orderId` (no separate short code
78
- * field on Order today); kept as a distinct field for forward-compat with
79
- * a future Order.code rollout.
80
- *
81
- * `currency` is always 'ARS' in v1 (the storage currency for SINFACTURA's
82
- * Argentine tenants); USD-priced orders surface their ARS-equivalent total.
83
- * `total` is therefore in ARS regardless of how the order was originally
84
- * priced; FE may derive USD display from `Order.currency` (the FX rate)
85
- * if needed.
86
- */
87
- export interface OrderCandidate {
88
- orderId: string;
89
- orderCode: string;
90
- customerId: string;
91
- customerName: string;
92
- total: number;
93
- currency: string;
94
- dated: number;
95
- confidence: LinkSuggestionConfidence;
96
- reason: string;
97
- score: number;
98
- }
99
- /**
100
- * Response shape of `GET /payments/{source}/{paymentId}/link-suggestions`.
101
- * Both arrays may be empty when no signal — FE renders "Sin sugerencias
102
- * automáticas" and falls back to manual customer / order search inputs.
103
- */
104
- export interface LinkSuggestionsResponse {
105
- customers: CustomerCandidate[];
106
- orders: OrderCandidate[];
1
+ declare global {
2
+ /**
3
+ * WebSocket broadcast payload for the `payment_received` action.
4
+ *
5
+ * Fired by the API when a "money received" event is persisted across any
6
+ * of three sources (MP webhook, Stripe webhook, MP movements poller).
7
+ * Receivers (FE) should:
8
+ * 1. Render an immediate snackbar toast using `total` + `currency` + `payerName`.
9
+ * 2. Invalidate RTK Query tags `PaymentReceived` + `PaymentReceivedUnlinked`
10
+ * so the canonical row is refetched from `GET /payments/received`.
11
+ */
12
+ type PaymentReceivedSource = "mp" | "stripe" | "mp_movement";
13
+ interface PaymentReceivedWsPayload {
14
+ source: PaymentReceivedSource;
15
+ paymentId: string;
16
+ total: number;
17
+ currency: string;
18
+ payerName?: string;
19
+ paidAt: number;
20
+ customerId?: string;
21
+ orderId?: string;
22
+ invoiceId?: string;
23
+ }
24
+ /**
25
+ * REST shape of a payment row returned by `GET /payments/received` (api#902).
26
+ *
27
+ * Distinct from `PaymentReceivedWsPayload` (api#880, the WS broadcast):
28
+ * - This carries denormalized labels (customerName, orderCode, invoiceCode)
29
+ * attached server-side at response time so the FE doesn't N+1 fetch.
30
+ * - The WS broadcast is the lean live-tail event; this is the canonical row.
31
+ */
32
+ interface PaymentReceived {
33
+ paymentId: string;
34
+ source: PaymentReceivedSource;
35
+ total: number;
36
+ currency: string;
37
+ currencyValue?: number;
38
+ currencyValueAt?: number;
39
+ payerName?: string;
40
+ payerEmail?: string;
41
+ payerCuit?: string;
42
+ paidAt: number;
43
+ customerId?: string;
44
+ customerName?: string;
45
+ orderId?: string;
46
+ orderCode?: string;
47
+ invoiceId?: string;
48
+ invoiceCode?: string;
49
+ accountId?: string;
50
+ linkedAt?: number;
51
+ linkSource?: "auto" | "manual";
52
+ }
53
+ /**
54
+ * Confidence tier for a link suggestion (api#904).
55
+ *
56
+ * Mapped from heuristic match strength:
57
+ * - 'Alta': customer CUIT/email exact OR order amount-exact + ±24h
58
+ * - 'Media': order amount ±5% within ±7d
59
+ * - 'Baja': reserved for future broader heuristics (currently unused)
60
+ */
61
+ export type LinkSuggestionConfidence = "Alta" | "Media" | "Baja";
62
+ /**
63
+ * One ranked customer candidate for a payment's link dialog (api#904).
64
+ * The FE renders the chip with `fullName`, the confidence badge, and the
65
+ * `reason` text verbatim.
66
+ */
67
+ interface CustomerCandidate {
68
+ customerId: string;
69
+ fullName: string;
70
+ cuit?: string;
71
+ email?: string;
72
+ confidence: LinkSuggestionConfidence;
73
+ reason: string;
74
+ score: number;
75
+ }
76
+ /**
77
+ * One ranked order candidate for a payment's link dialog (api#904).
78
+ * `orderCode` is currently identical to `orderId` (no separate short code
79
+ * field on Order today); kept as a distinct field for forward-compat with
80
+ * a future Order.code rollout.
81
+ *
82
+ * `currency` is always 'ARS' in v1 (the storage currency for SINFACTURA's
83
+ * Argentine tenants); USD-priced orders surface their ARS-equivalent total.
84
+ * `total` is therefore in ARS regardless of how the order was originally
85
+ * priced; FE may derive USD display from `Order.currency` (the FX rate)
86
+ * if needed.
87
+ */
88
+ interface OrderCandidate {
89
+ orderId: string;
90
+ orderCode: string;
91
+ customerId: string;
92
+ customerName: string;
93
+ total: number;
94
+ currency: string;
95
+ dated: number;
96
+ confidence: LinkSuggestionConfidence;
97
+ reason: string;
98
+ score: number;
99
+ }
100
+ /**
101
+ * Response shape of `GET /payments/{source}/{paymentId}/link-suggestions`.
102
+ * Both arrays may be empty when no signal FE renders "Sin sugerencias
103
+ * automáticas" and falls back to manual customer / order search inputs.
104
+ */
105
+ interface LinkSuggestionsResponse {
106
+ customers: CustomerCandidate[];
107
+ orders: OrderCandidate[];
108
+ }
107
109
  }
110
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",