Skip to content

Commit 8900f51

Browse files
committed
feat: add support for transaction_log event resource type in webhooks
1 parent a826255 commit 8900f51

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

src/elements/public/WebhookCard/WebhookCard.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export class WebhookCard extends TranslatableMixin(InternalCard, 'webhook-card')
5757
const cardStatus = recentStatuses ? lastStatus?.status ?? 'none' : 'loading';
5858
const isActive = !!this.data?.is_active;
5959

60+
// SDK types are incorrect – this is a string, not an array.
61+
// TODO remove this cast when SDK is fixed.
62+
const eventResource = (this.data?.event_resource ?? '') as unknown as string;
63+
6064
return html`
6165
<div class="grid grid-cols-1 leading-s -my-xs">
6266
<p class="flex items-center gap-s justify-between">
@@ -78,7 +82,7 @@ export class WebhookCard extends TranslatableMixin(InternalCard, 'webhook-card')
7882
<p class="text-s truncate text-tertiary">
7983
${this.resourceUri
8084
? ''
81-
: html`<span class="capitalize">${this.data?.event_resource}</span> &bull;`}
85+
: html`<span class="capitalize">${eventResource.replace(/_/g, ' ')}</span> &bull;`}
8286
<foxy-i18n
8387
class=${classMap({ 'text-error': isActive && cardStatus === 'failed' })}
8488
infer=""

src/elements/public/WebhookForm/WebhookForm.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ describe('WebhookForm', () => {
151151
const options = [
152152
{ value: 'subscription', label: 'event_resource_subscription' },
153153
{ value: 'transaction', label: 'event_resource_transaction' },
154+
{ value: 'transaction_log', label: 'event_resource_transaction_log' },
154155
{ value: 'customer', label: 'event_resource_customer' },
155156
];
156157

src/elements/public/WebhookForm/WebhookForm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
5353
private __eventResources = [
5454
{ value: 'subscription', label: 'event_resource_subscription' },
5555
{ value: 'transaction', label: 'event_resource_transaction' },
56+
{ value: 'transaction_log', label: 'event_resource_transaction_log' },
5657
{ value: 'customer', label: 'event_resource_customer' },
5758
];
5859

src/static/translations/webhook-form/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"subtitle_webflow": "Webflow webhook",
77
"subtitle_zapier": "Zapier webhook",
88
"subtitle_transaction": "Transaction webhook",
9+
"subtitle_transaction_log": "Transaction log webhook",
910
"subtitle_subscription": "Subscription webhook",
1011
"subtitle_customer": "Customer webhook",
1112
"copy-id": {
@@ -46,6 +47,7 @@
4647
"label": "Resource",
4748
"helper_text": "",
4849
"placeholder": "Select...",
50+
"event_resource_transaction_log": "Transaction log",
4951
"event_resource_subscription": "Subscription",
5052
"event_resource_transaction": "Transaction",
5153
"event_resource_customer": "Customer"

0 commit comments

Comments
 (0)