Skip to content

Commit 935b3b4

Browse files
[Dashboard] Add webhook version support to Universal Bridge
1 parent bf81dee commit 935b3b4

File tree

1 file changed

+13
-10
lines changed
  • apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/universal-bridge/webhooks/components

1 file changed

+13
-10
lines changed

apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/universal-bridge/webhooks/components/webhooks.client.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type Webhook = {
5757
createdAt: string;
5858
id: string;
5959
secret: string;
60+
version?: string; // TODO (UB) make this mandatory after migration
6061
};
6162

6263
type PayWebhooksPageProps = {
@@ -75,7 +76,7 @@ export function PayWebhooksPage(props: PayWebhooksPageProps) {
7576
queryFn: async () => {
7677
const res = await payServerProxy({
7778
method: "GET",
78-
pathname: "/webhooks/get-all",
79+
pathname: "/webhooks/get-all", // TODO (UB) switch to UB endpoint after migration
7980
searchParams: {
8081
/**
8182
* @deprecated - remove after migration
@@ -147,6 +148,7 @@ export function PayWebhooksPage(props: PayWebhooksPageProps) {
147148
<TableHead>Url</TableHead>
148149
<TableHead>Secret</TableHead>
149150
<TableHead>Created</TableHead>
151+
<TableHead>Webhook Version</TableHead>
150152
<TableHead>Delete</TableHead>
151153
</TableRow>
152154
</TableHeader>
@@ -166,6 +168,7 @@ export function PayWebhooksPage(props: PayWebhooksPageProps) {
166168
<TableCell>
167169
{formatDistanceToNow(webhook.createdAt, { addSuffix: true })}
168170
</TableCell>
171+
<TableCell>{webhook.version || "v1"}</TableCell>
169172
<TableCell className="text-right">
170173
<DeleteWebhookButton
171174
clientId={props.clientId}
@@ -263,7 +266,8 @@ function CreateWebhookButton(props: PropsWithChildren<PayWebhooksPageProps>) {
263266
<DialogHeader>
264267
<DialogTitle>Create Webhook</DialogTitle>
265268
<DialogDescription>
266-
Receive a webhook notification when a pay event occurs.
269+
Receive a webhook notification when a bridge, swap or onramp
270+
event occurs.
267271
</DialogDescription>
268272
</DialogHeader>
269273

@@ -294,21 +298,20 @@ function CreateWebhookButton(props: PropsWithChildren<PayWebhooksPageProps>) {
294298
)}
295299
/>
296300

297-
{/* Note: this is a "fake" form field since there is nothing to select yet */}
298301
<FormItem>
299-
<FormLabel>Event Type</FormLabel>
300-
<Select disabled defaultValue="purchase_complete">
302+
<FormLabel>Webhook Version</FormLabel>
303+
<Select defaultValue="v2">
301304
<SelectTrigger className="w-full">
302-
<SelectValue placeholder="Purchase Complete" />
305+
<SelectValue placeholder="v2" />
303306
</SelectTrigger>
304307
<SelectContent>
305-
<SelectItem value="purchase_complete">
306-
Purchase Complete
307-
</SelectItem>
308+
<SelectItem value="v2">v2</SelectItem>
309+
<SelectItem value="v1">v1</SelectItem>
308310
</SelectContent>
309311
</Select>
310312
<FormDescription>
311-
Which event should trigger this webhook?
313+
Select the data format of the webhook payload (v2 recommended,
314+
v1 for legacy users).
312315
</FormDescription>
313316
<FormMessage />
314317
</FormItem>

0 commit comments

Comments
 (0)