@strimz/shared-types 0.16.0 → 0.18.0
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/events.cjs +4 -0
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +196 -1
- package/dist/events.d.ts +196 -1
- package/dist/events.js +4 -1
- package/dist/events.js.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/webhooks.cjs +1 -0
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +18 -18
- package/dist/webhooks.d.ts +18 -18
- package/dist/webhooks.js +1 -0
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
- package/src/events.ts +4 -0
- package/src/notifications.ts +9 -0
- package/src/webhooks.ts +1 -0
package/src/events.ts
CHANGED
|
@@ -80,6 +80,8 @@ export const refundCompletedEventSchema = envelope(
|
|
|
80
80
|
'refund.completed',
|
|
81
81
|
z.object({ refund: refundSchema, transaction: transactionSchema }),
|
|
82
82
|
)
|
|
83
|
+
/** The refund's transfer reverted, paid the wrong thing, or can never be mined. */
|
|
84
|
+
export const refundFailedEventSchema = envelope('refund.failed', refundSchema)
|
|
83
85
|
|
|
84
86
|
// ---------- Invoice ----------
|
|
85
87
|
|
|
@@ -122,6 +124,7 @@ export const webhookEventSchema = z.discriminatedUnion('type', [
|
|
|
122
124
|
subscriptionReactivatedEventSchema,
|
|
123
125
|
refundCreatedEventSchema,
|
|
124
126
|
refundCompletedEventSchema,
|
|
127
|
+
refundFailedEventSchema,
|
|
125
128
|
invoiceCreatedEventSchema,
|
|
126
129
|
invoicePaidEventSchema,
|
|
127
130
|
invoiceOverdueEventSchema,
|
|
@@ -148,6 +151,7 @@ export type SubscriptionLapsedEvent = z.infer<typeof subscriptionLapsedEventSche
|
|
|
148
151
|
export type SubscriptionReactivatedEvent = z.infer<typeof subscriptionReactivatedEventSchema>
|
|
149
152
|
export type RefundCreatedEvent = z.infer<typeof refundCreatedEventSchema>
|
|
150
153
|
export type RefundCompletedEvent = z.infer<typeof refundCompletedEventSchema>
|
|
154
|
+
export type RefundFailedEvent = z.infer<typeof refundFailedEventSchema>
|
|
151
155
|
export type InvoiceCreatedEvent = z.infer<typeof invoiceCreatedEventSchema>
|
|
152
156
|
export type InvoicePaidEvent = z.infer<typeof invoicePaidEventSchema>
|
|
153
157
|
export type InvoiceOverdueEvent = z.infer<typeof invoiceOverdueEventSchema>
|
package/src/notifications.ts
CHANGED
|
@@ -59,6 +59,15 @@ export const broadcastListResponseSchema = z.object({
|
|
|
59
59
|
})
|
|
60
60
|
export type BroadcastListResponse = z.infer<typeof broadcastListResponseSchema>
|
|
61
61
|
|
|
62
|
+
/** One broadcast as a merchant reads it. `html` is already sanitized by the API. */
|
|
63
|
+
export const notificationBroadcastSchema = z.object({
|
|
64
|
+
id: idSchema,
|
|
65
|
+
title: z.string(),
|
|
66
|
+
html: z.string(),
|
|
67
|
+
createdAt: isoTimestampSchema,
|
|
68
|
+
})
|
|
69
|
+
export type NotificationBroadcast = z.infer<typeof notificationBroadcastSchema>
|
|
70
|
+
|
|
62
71
|
export const notificationSchema = z.object({
|
|
63
72
|
/** Deterministic client id — `{kind}:{sourceId}`. Safe for React keys. */
|
|
64
73
|
id: z.string().min(1),
|