sinfactura-types 1.5.0 → 1.5.2

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/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from "./maintenance";
15
15
  export * from "./mercadopago";
16
16
  export * from "./notification";
17
17
  export * from "./order";
18
+ export * from "./payment";
18
19
  export * from "./product";
19
20
  export * from "./return";
20
21
  export * from "./stock";
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export * from "./maintenance";
15
15
  export * from "./mercadopago";
16
16
  export * from "./notification";
17
17
  export * from "./order";
18
+ export * from "./payment";
18
19
  export * from "./product";
19
20
  export * from "./return";
20
21
  export * from "./stock";
@@ -0,0 +1,49 @@
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
+ payerName?: string;
37
+ payerEmail?: string;
38
+ payerCuit?: string;
39
+ paidAt: number;
40
+ customerId?: string;
41
+ customerName?: string;
42
+ orderId?: string;
43
+ orderCode?: string;
44
+ invoiceId?: string;
45
+ invoiceCode?: string;
46
+ accountId?: string;
47
+ linkedAt?: number;
48
+ linkSource?: "auto" | "manual";
49
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",