@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/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>
@@ -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),
package/src/webhooks.ts CHANGED
@@ -28,6 +28,7 @@ export const webhookEventNameSchema = z.enum([
28
28
  'subscription.reactivated',
29
29
  'refund.created',
30
30
  'refund.completed',
31
+ 'refund.failed',
31
32
  'invoice.created',
32
33
  'invoice.paid',
33
34
  'invoice.overdue',