Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Feature: Introduce Organizer-Level Webhooks for Event Lifecycle Management ( #1047 ) (#1050)

Matteo Sipione2c1931d36f1b
diff --git a/backend/app/DomainObjects/Generated/WebhookDomainObjectAbstract.php b/backend/app/DomainObjects/Generated/WebhookDomainObjectAbstract.php
index 5527c2881..660f7a66f 100644
--- a/backend/app/DomainObjects/Generated/WebhookDomainObjectAbstract.php
+++ b/backend/app/DomainObjects/Generated/WebhookDomainObjectAbstract.php
@@ -13,6 +13,7 @@ abstract class WebhookDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
final public const ID = 'id';
final public const USER_ID = 'user_id';
final public const EVENT_ID = 'event_id';
+ final public const ORGANIZER_ID = 'organizer_id';
final public const ACCOUNT_ID = 'account_id';
final public const URL = 'url';
final public const EVENT_TYPES = 'event_types';
@@ -27,7 +28,8 @@ abstract class WebhookDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
protected int $id;
protected int $user_id;
- protected int $event_id;
+ protected ?int $event_id = null;
+ protected ?int $organizer_id = null;
protected int $account_id;
protected string $url;
protected array|string $event_types;
@@ -46,6 +48,7 @@ abstract class WebhookDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
'id' => $this->id ?? null,
'user_id' => $this->user_id ?? null,
'event_id' => $this->event_id ?? null,
+ 'organizer_id' => $this->organizer_id ?? null,
'account_id' => $this->account_id ?? null,
'url' => $this->url ?? null,
'event_types' => $this->event_types ?? null,
@@ -82,17 +85,28 @@ abstract class WebhookDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
return $this->user_id;
}
- public function setEventId(int $event_id): self
+ public function setEventId(?int $event_id): self
{
$this->event_id = $event_id;
return $this;
}
- public function getEventId(): int
+ public function getEventId(): ?int
{
return $this->event_id;
}
+ public function setOrganizerId(?int $organizer_id): self
+ {
+ $this->organizer_id = $organizer_id;
+ return $this;
+ }
+
+ public function getOrganizerId(): ?int
+ {
+ return $this->organizer_id;
+ }
+
public function setAccountId(int $account_id): self
{
$this->account_id = $account_id;
diff --git a/backend/app/Http/Actions/Organizers/Webhooks/CreateOrganizerWebhookAction.php b/backend/app/Http/Actions/Organizers/Webhooks/CreateOrganizerWebhookAction.php
new file mode 100644
index 000000000..603bfde2a
--- /dev/null
+++ b/backend/app/Http/Actions/Organizers/Webhooks/CreateOrganizerWebhookAction.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace HiEvents\Http\Actions\Organizers\Webhooks;
+
+use HiEvents\DomainObjects\OrganizerDomainObject;
+use HiEvents\DomainObjects\Status\WebhookStatus;
+use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Http\Request\Webhook\UpsertWebhookRequest;
+use HiEvents\Resources\Webhook\WebhookResource;
+use HiEvents\Services\Application\Handlers\Webhook\CreateWebhookHandler;
+use HiEvents\Services\Application\Handlers\Webhook\DTO\CreateWebhookDTO;
+use Illuminate\Http\JsonResponse;
+
+class CreateOrganizerWebhookAction extends BaseAction
+{
+ public function __construct(
+ private readonly CreateWebhookHandler $createWebhookHandler,
+ )
+ {
+ }
+
+ public function __invoke(int $organizerId, UpsertWebhookRequest $request): JsonResponse
+ {
+ $this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
+
+ $webhook = $this->createWebhookHandler->handle(
+ new CreateWebhookDTO(
+ url: $request->validated('url'),
+ eventTypes: $request->validated('event_types'),
+ eventId: null,
+ organizerId: $organizerId,
+ userId: $this->getAuthenticatedUser()->getId(),
+ accountId: $this->getAuthenticatedAccountId(),
+ status: WebhookStatus::fromName($request->validated('status')),
+ )
+ );
+
+ return $this->resourceResponse(
+ resource: WebhookResource::class,
+ data: $webhook
+ );
+ }
+}
diff --git a/backend/app/Http/Actions/Organizers/Webhooks/DeleteOrganizerWebhookAction.php b/backend/app/Http/Actions/Organizers/Webhooks/DeleteOrganizerWebhookAction.php
new file mode 100644
index 000000000..cd157307f
--- /dev/null
+++ b/backend/app/Http/Actions/Organizers/Webhooks/DeleteOrganizerWebhookAction.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace HiEvents\Http\Actions\Organizers\Webhooks;
+
+use HiEvents\DomainObjects\OrganizerDomainObject;
+use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Services\Application\Handlers\Webhook\DeleteWebhookHandler;
+use Illuminate\Http\Response;
+
+class DeleteOrganizerWebhookAction extends BaseAction
+{
+ public function __construct(
+ private readonly DeleteWebhookHandler $deleteWebhookHandler,
+ )
+ {
+ }
+
+ public function __invoke(int $organizerId, int $webhookId): Response
+ {
+ $this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
+
+ $this->deleteWebhookHandler->handle(
+ webhookId: $webhookId,
+ eventId: null,
+ organizerId: $organizerId,
+ );
+
+ return $this->deletedResponse();
+ }
+}
diff --git a/backend/app/Http/Actions/Organizers/Webhooks/EditOrganizerWebhookAction.php b/backend/app/Http/Actions/Organizers/Webhooks/EditOrganizerWebhookAction.php
new file mode 100644
index 000000000..6bc51334c
--- /dev/null
+++ b/backend/app/Http/Actions/Organizers/Webhooks/EditOrganizerWebhookAction.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace HiEvents\Http\Actions\Organizers\Webhooks;
+
+use HiEvents\DomainObjects\OrganizerDomainObject;
+use HiEvents\DomainObjects\Status\WebhookStatus;
+use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Http\Request\Webhook\UpsertWebhookRequest;
+use HiEvents\Resources\Webhook\WebhookResource;
+use HiEvents\Services\Application\Handlers\Webhook\DTO\EditWebhookDTO;
+use HiEvents\Services\Application\Handlers\Webhook\EditWebhookHandler;
+use Illuminate\Http\JsonResponse;
+
+class EditOrganizerWebhookAction extends BaseAction
+{
+ public function __construct(
+ private readonly EditWebhookHandler $editWebhookHandler,
+ )
+ {
+ }
+
+ public function __invoke(int $organizerId, int $webhookId, UpsertWebhookRequest $request): JsonResponse
+ {
+ $this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
+
+ $webhook = $this->editWebhookHandler->handle(
+ new EditWebhookDTO(
+ webhookId: $webhookId,
+ url: $request->validated('url'),
+ eventTypes: $request->validated('event_types'),
+ eventId: null,
+ organizerId: $organizerId,
+ userId: $this->getAuthenticatedUser()->getId(),
+ accountId: $this->getAuthenticatedAccountId(),
+ status: WebhookStatus::fromName($request->validated('status')),
+ )
+ );
+
+ return $this->resourceResponse(
+ resource: WebhookResource::class,
+ data: $webhook
+ );
+ }
+}
diff --git a/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhookAction.php b/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhookAction.php
new file mode 100644
index 000000000..cb7ea4ad2
--- /dev/null
+++ b/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhookAction.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace HiEvents\Http\Actions\Organizers\Webhooks;
+
+use HiEvents\DomainObjects\OrganizerDomainObject;
+use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Resources\Webhook\WebhookResource;
+use HiEvents\Services\Application\Handlers\Webhook\GetWebhookHandler;
+use Illuminate\Http\JsonResponse;
+
+class GetOrganizerWebhookAction extends BaseAction
+{
+ public function __construct(
+ private readonly GetWebhookHandler $getWebhookHandler,
+ )
+ {
+ }
+
+ public function __invoke(int $organizerId, int $webhookId): JsonResponse
+ {
+ $this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
+
+ $webhook = $this->getWebhookHandler->handle(
+ webhookId: $webhookId,
+ eventId: null,
+ organizerId: $organizerId
+ );
+
+ return $this->resourceResponse(
+ resource: WebhookResource::class,
+ data: $webhook
+ );
+ }
+}
diff --git a/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhookLogsAction.php b/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhookLogsAction.php
new file mode 100644
index 000000000..720728f6b
--- /dev/null
+++ b/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhookLogsAction.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace HiEvents\Http\Actions\Organizers\Webhooks;
+
+use HiEvents\DomainObjects\OrganizerDomainObject;
+use HiEvents\DomainObjects\WebhookLogDomainObject;
+use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Resources\Webhook\WebhookLogResource;
+use HiEvents\Services\Application\Handlers\Webhook\GetWebhookLogsHandler;
+use Illuminate\Http\JsonResponse;
+
+class GetOrganizerWebhookLogsAction extends BaseAction
+{
+ public function __construct(
+ private readonly GetWebhookLogsHandler $getWebhookLogsHandler,
+ )
+ {
+ }
+
+ public function __invoke(int $organizerId, int $webhookId): JsonResponse
+ {
+ $this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
+
+ $webhookLogs = $this->getWebhookLogsHandler->handle(
+ webhookId: $webhookId,
+ eventId: null,
+ organizerId: $organizerId,
+ );
+
+ $webhookLogs = $webhookLogs->sortBy(function (WebhookLogDomainObject $webhookLog) {
+ return $webhookLog->getId();
+ }, SORT_REGULAR, true);
+
+ return $this->resourceResponse(
+ resource: WebhookLogResource::class,
+ data: $webhookLogs
+ );
+ }
+}
diff --git a/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhooksAction.php b/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhooksAction.php
new file mode 100644
index 000000000..f6e7e51ef
--- /dev/null
+++ b/backend/app/Http/Actions/Organizers/Webhooks/GetOrganizerWebhooksAction.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace HiEvents\Http\Actions\Organizers\Webhooks;
+
+use HiEvents\DomainObjects\OrganizerDomainObject;
+use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Resources\Webhook\WebhookResource;
+use HiEvents\Services\Application\Handlers\Webhook\GetWebhooksHandler;
+use Illuminate\Http\JsonResponse;
+
+class GetOrganizerWebhooksAction extends BaseAction
+{
+ public function __construct(
+ private readonly GetWebhooksHandler $getWebhooksHandler,
+ )
+ {
+ }
+
+ public function __invoke(int $organizerId): JsonResponse
+ {
+ $this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
+
+ $webhooks = $this->getWebhooksHandler->handler(
+ accountId: $this->getAuthenticatedAccountId(),
+ eventId: null,
+ organizerId: $organizerId
+ );
+
+ return $this->resourceResponse(
+ resource: WebhookResource::class,
+ data: $webhooks
+ );
+ }
+}
diff --git a/backend/app/Http/Actions/Webhooks/CreateWebhookAction.php b/backend/app/Http/Actions/Webhooks/CreateWebhookAction.php
index 7d0142001..a61d3acf6 100644
--- a/backend/app/Http/Actions/Webhooks/CreateWebhookAction.php
+++ b/backend/app/Http/Actions/Webhooks/CreateWebhookAction.php
@@ -27,10 +27,10 @@ class CreateWebhookAction extends BaseAction
new CreateWebhookDTO(
url: $request->validated('url'),
eventTypes: $request->validated('event_types'),
- eventId: $eventId,
userId: $this->getAuthenticatedUser()->getId(),
accountId: $this->getAuthenticatedAccountId(),
status: WebhookStatus::fromName($request->validated('status')),
+ eventId: $eventId,
)
);
diff --git a/backend/app/Http/Actions/Webhooks/DeleteWebhookAction.php b/backend/app/Http/Actions/Webhooks/DeleteWebhookAction.php
index 508c0fa3d..b807d4719 100644
--- a/backend/app/Http/Actions/Webhooks/DeleteWebhookAction.php
+++ b/backend/app/Http/Actions/Webhooks/DeleteWebhookAction.php
@@ -20,8 +20,8 @@ class DeleteWebhookAction extends BaseAction
$this->isActionAuthorized($eventId, EventDomainObject::class);
$this->deleteWebhookHandler->handle(
- $eventId,
- $webhookId,
+ webhookId: $webhookId,
+ eventId: $eventId,
);
return $this->deletedResponse();
diff --git a/backend/app/Jobs/Event/Webhook/DispatchEventWebhookJob.php b/backend/app/Jobs/Event/Webhook/DispatchEventWebhookJob.php
new file mode 100644
index 000000000..0f73e76e8
--- /dev/null
+++ b/backend/app/Jobs/Event/Webhook/DispatchEventWebhookJob.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace HiEvents\Jobs\Event\Webhook;
+
+use HiEvents\Services\Infrastructure\DomainEvents\Enums\DomainEventType;
+use HiEvents\Services\Infrastructure\Webhook\WebhookDispatchService;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+
+class DispatchEventWebhookJob implements ShouldQueue
+{
+ use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+
+ public function __construct(
+ public int $eventId,
+ public DomainEventType $eventType,
+ )
+ {
+ }
+
+ public function handle(WebhookDispatchService $webhookDispatchService): void
+ {
+ $webhookDispatchService->dispatchEventWebhook(
+ eventType: $this->eventType,
+ eventId: $this->eventId,
+ );
+ }
+}
diff --git a/backend/app/Models/Organizer.php b/backend/app/Models/Organizer.php
index b174f9727..9eb57f2bd 100644
--- a/backend/app/Models/Organizer.php
+++ b/backend/app/Models/Organizer.php
@@ -21,4 +21,9 @@ class Organizer extends BaseModel
{
return $this->hasOne(OrganizerSetting::class);
}
+
+ public function webhooks(): HasMany
+ {
+ return $this->hasMany(Webhook::class);
+ }
}
diff --git a/backend/app/Models/Webhook.php b/backend/app/Models/Webhook.php
index 7d2520b75..1c85c17c4 100644
--- a/backend/app/Models/Webhook.php
+++ b/backend/app/Models/Webhook.php
@@ -32,6 +32,11 @@ class Webhook extends BaseModel
return $this->belongsTo(Event::class);
}
+ public function organizer(): BelongsTo
+ {
+ return $this->belongsTo(Organizer::class);
+ }
+
public function account(): BelongsTo
{
return $this->belongsTo(Account::class);
diff --git a/backend/app/Repository/Eloquent/WebhookRepository.php b/backend/app/Repository/Eloquent/WebhookRepository.php
index ec2778eae..dffca0b3b 100644
--- a/backend/app/Repository/Eloquent/WebhookRepository.php
+++ b/backend/app/Repository/Eloquent/WebhookRepository.php
@@ -2,9 +2,11 @@
namespace HiEvents\Repository\Eloquent;
+use HiEvents\DomainObjects\Status\WebhookStatus;
use HiEvents\DomainObjects\WebhookDomainObject;
use HiEvents\Models\Webhook;
use HiEvents\Repository\Interfaces\WebhookRepositoryInterface;
+use Illuminate\Support\Collection;
/**
* @extends BaseRepository<WebhookDomainObject>
@@ -20,4 +22,24 @@ class WebhookRepository extends BaseRepository implements WebhookRepositoryInter
{
return WebhookDomainObject::class;
}
+
+ public function findEnabledByEventId(int $eventId): Collection
+ {
+ $results = $this->model::query()
+ ->where('status', WebhookStatus::ENABLED->name)
+ ->where(function ($query) use ($eventId) {
+ $query->where('event_id', $eventId)
+ ->orWhere('organizer_id', function ($subquery) use ($eventId) {
+ $subquery->select('organizer_id')
+ ->from('events')
+ ->where('id', $eventId)
+ ->limit(1);
+ });
+ })
+ ->get();
+
+ $this->resetModel();
+
+ return $this->handleResults($results);
+ }
}
diff --git a/backend/app/Repository/Interfaces/WebhookRepositoryInterface.php b/backend/app/Repository/Interfaces/WebhookRepositoryInterface.php
index 49a0dac74..a2fd914f1 100644
--- a/backend/app/Repository/Interfaces/WebhookRepositoryInterface.php
+++ b/backend/app/Repository/Interfaces/WebhookRepositoryInterface.php
@@ -3,10 +3,12 @@
namespace HiEvents\Repository\Interfaces;
use HiEvents\DomainObjects\WebhookDomainObject;
+use Illuminate\Support\Collection;
/**
* @extends RepositoryInterface<WebhookDomainObject>
*/
interface WebhookRepositoryInterface extends RepositoryInterface
{
+ public function findEnabledByEventId(int $eventId): Collection;
}
diff --git a/backend/app/Services/Application/Handlers/Event/CreateEventHandler.php b/backend/app/Services/Application/Handlers/Event/CreateEventHandler.php
index 0ebd327e1..7b86a0001 100644
--- a/backend/app/Services/Application/Handlers/Event/CreateEventHandler.php
+++ b/backend/app/Services/Application/Handlers/Event/CreateEventHandler.php
@@ -9,8 +9,10 @@ use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\Exceptions\OrganizerNotFoundException;
use HiEvents\Services\Application\Handlers\Event\DTO\CreateEventDTO;
use HiEvents\Services\Domain\Event\CreateEventService;
-use HiEvents\Services\Domain\Organizer\OrganizerFetchService;
use HiEvents\Services\Domain\ProductCategory\CreateProductCategoryService;
+use HiEvents\Services\Domain\Organizer\OrganizerFetchService;
+use HiEvents\Jobs\Event\Webhook\DispatchEventWebhookJob;
+use HiEvents\Services\Infrastructure\DomainEvents\Enums\DomainEventType;
use Illuminate\Database\DatabaseManager;
use Throwable;
@@ -65,6 +67,11 @@ class CreateEventHandler
$this->createProductCategoryService->createDefaultProductCategory($newEvent);
+ DispatchEventWebhookJob::dispatch(
+ $newEvent->getId(),
+ DomainEventType::EVENT_CREATED,
+ );
+
return $newEvent;
}
}
diff --git a/backend/app/Services/Application/Handlers/Event/UpdateEventHandler.php b/backend/app/Services/Application/Handlers/Event/UpdateEventHandler.php
index 0ff2ded0b..8f284ff63 100644
--- a/backend/app/Services/Application/Handlers/Event/UpdateEventHandler.php
+++ b/backend/app/Services/Application/Handlers/Event/UpdateEventHandler.php
@@ -12,6 +12,8 @@ use HiEvents\Repository\Interfaces\EventRepositoryInterface;
use HiEvents\Repository\Interfaces\OrderRepositoryInterface;
use HiEvents\Services\Application\Handlers\Event\DTO\UpdateEventDTO;
use HiEvents\Services\Infrastructure\HtmlPurifier\HtmlPurifierService;
+use HiEvents\Jobs\Event\Webhook\DispatchEventWebhookJob;
+use HiEvents\Services\Infrastructure\DomainEvents\Enums\DomainEventType;
use Illuminate\Database\DatabaseManager;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Throwable;
@@ -97,6 +99,11 @@ readonly class UpdateEventHandler
$this->dispatcher->dispatchEvent(new EventUpdateEvent($event));
+ DispatchEventWebhookJob::dispatch(
+ $event->getId(),
+ DomainEventType::EVENT_UPDATED,
+ );
+
return $event;
}
diff --git a/backend/app/Services/Application/Handlers/Event/UpdateEventStatusHandler.php b/backend/app/Services/Application/Handlers/Event/UpdateEventStatusHandler.php
index 175e1e304..4d4387940 100644
--- a/backend/app/Services/Application/Handlers/Event/UpdateEventStatusHandler.php
+++ b/backend/app/Services/Application/Handlers/Event/UpdateEventStatusHandler.php
@@ -7,6 +7,9 @@ use HiEvents\Exceptions\AccountNotVerifiedException;
use HiEvents\Repository\Interfaces\AccountRepositoryInterface;
use HiEvents\Repository\Interfaces\EventRepositoryInterface;
use HiEvents\Services\Application\Handlers\Event\DTO\UpdateEventStatusDTO;
+use HiEvents\DomainObjects\Status\EventStatus;
+use HiEvents\Jobs\Event\Webhook\DispatchEventWebhookJob;
+use HiEvents\Services\Infrastructure\DomainEvents\Enums\DomainEventType;
use Illuminate\Database\DatabaseManager;
use Psr\Log\LoggerInterface;
use Throwable;
@@ -60,9 +63,20 @@ readonly class UpdateEventStatusHandler
'status' => $updateEventStatusDTO->status
]);
- return $this->eventRepository->findFirstWhere([
+ $event = $this->eventRepository->findFirstWhere([
'id' => $updateEventStatusDTO->eventId,
'account_id' => $updateEventStatusDTO->accountId,
]);
+
+ $eventType = $updateEventStatusDTO->status === EventStatus::ARCHIVED->name
+ ? DomainEventType::EVENT_ARCHIVED
+ : DomainEventType::EVENT_UPDATED;
+
+ DispatchEventWebhookJob::dispatch(
+ $event->getId(),
+ $eventType,
+ );
+
+ return $event;
}
}
diff --git a/backend/app/Services/Application/Handlers/Webhook/CreateWebhookHandler.php b/backend/app/Services/Application/Handlers/Webhook/CreateWebhookHandler.php
index 35160fffb..a8f283a16 100644
--- a/backend/app/Services/Application/Handlers/Webhook/CreateWebhookHandler.php
+++ b/backend/app/Services/Application/Handlers/Webhook/CreateWebhookHandler.php
@@ -31,6 +31,7 @@ class CreateWebhookHandler
->setUrl($upsertWebhookDTO->url)
->setEventTypes($upsertWebhookDTO->eventTypes)
->setEventId($upsertWebhookDTO->eventId)
+ ->setOrganizerId($upsertWebhookDTO->organizerId)
->setUserId($upsertWebhookDTO->userId)
->setAccountId($upsertWebhookDTO->accountId)
->setStatus($upsertWebhookDTO->status->value);
diff --git a/backend/app/Services/Application/Handlers/Webhook/DTO/CreateWebhookDTO.php b/backend/app/Services/Application/Handlers/Webhook/DTO/CreateWebhookDTO.php
index 2c834e336..1ee6d9e21 100644
--- a/backend/app/Services/Application/Handlers/Webhook/DTO/CreateWebhookDTO.php
+++ b/backend/app/Services/Application/Handlers/Webhook/DTO/CreateWebhookDTO.php
@@ -10,10 +10,11 @@ class CreateWebhookDTO extends BaseDTO
public function __construct(
public string $url,
public array $eventTypes,
- public int $eventId,
public int $userId,
public int $accountId,
public WebhookStatus $status,
+ public ?int $eventId = null,
+ public ?int $organizerId = null,
)
{
}
diff --git a/backend/app/Services/Application/Handlers/Webhook/DTO/EditWebhookDTO.php b/backend/app/Services/Application/Handlers/Webhook/DTO/EditWebhookDTO.php
index 0c3fdf9e8..5c23e1561 100644
--- a/backend/app/Services/Application/Handlers/Webhook/DTO/EditWebhookDTO.php
+++ b/backend/app/Services/Application/Handlers/Webhook/DTO/EditWebhookDTO.php
@@ -10,19 +10,21 @@ class EditWebhookDTO extends CreateWebhookDTO
public int $webhookId,
string $url,
array $eventTypes,
- int $eventId,
int $userId,
int $accountId,
WebhookStatus $status,
+ ?int $eventId = null,
+ ?int $organizerId = null,
)
{
parent::__construct(
url: $url,
eventTypes: $eventTypes,
- eventId: $eventId,
userId: $userId,
accountId: $accountId,
status: $status,
+ eventId: $eventId,
+ organizerId: $organizerId,
);
}
}
diff --git a/backend/app/Services/Application/Handlers/Webhook/DeleteWebhookHandler.php b/backend/app/Services/Application/Handlers/Webhook/DeleteWebhookHandler.php
index 6fbc127a1..6a8edb909 100644
--- a/backend/app/Services/Application/Handlers/Webhook/DeleteWebhookHandler.php
+++ b/backend/app/Services/Application/Handlers/Webhook/DeleteWebhookHandler.php
@@ -17,28 +17,29 @@ class DeleteWebhookHandler
{
}
- public function handle(int $eventId, int $webhookId): void
+ public function handle(int $webhookId, ?int $eventId = null, ?int $organizerId = null): void
{
- $this->databaseManager->transaction(function () use ($eventId, $webhookId) {
- $webhook = $this->webhookRepository->findFirstWhere([
- 'id' => $webhookId,
- 'event_id' => $eventId,
- ]);
+ $this->databaseManager->transaction(function () use ($eventId, $webhookId, $organizerId) {
+ $where = ['id' => $webhookId];
+ if ($eventId !== null) {
+ $where['event_id'] = $eventId;
+ }
+ if ($organizerId !== null) {
+ $where['organizer_id'] = $organizerId;
+ }
+
+ $webhook = $this->webhookRepository->findFirstWhere($where);
if (!$webhook) {
throw new ResourceNotFoundException(__(
- key: 'Webhook not found for ID: :webhookId and event ID: :eventId',
+ key: 'Webhook not found for ID: :webhookId',
replace: [
'webhookId' => $webhookId,
- 'eventId' => $eventId,
]
));
}
- $this->webhookRepository->deleteWhere([
- 'id' => $webhookId,
- 'event_id' => $eventId,
- ]);
+ $this->webhookRepository->deleteWhere($where);
$this->webhookLogRepository
->deleteOldLogs($webhookId, numberToKeep: 0);
diff --git a/backend/app/Services/Application/Handlers/Webhook/EditWebhookHandler.php b/backend/app/Services/Application/Handlers/Webhook/EditWebhookHandler.php
index 3f3c86efe..9d76c441e 100644
--- a/backend/app/Services/Application/Handlers/Webhook/EditWebhookHandler.php
+++ b/backend/app/Services/Application/Handlers/Webhook/EditWebhookHandler.php
@@ -20,18 +20,22 @@ class EditWebhookHandler
public function handle(EditWebhookDTO $dto): WebhookDomainObject
{
return $this->databaseManager->transaction(function () use ($dto) {
+ $where = ['id' => $dto->webhookId];
+ if ($dto->eventId !== null) {
+ $where['event_id'] = $dto->eventId;
+ }
+ if ($dto->organizerId !== null) {
+ $where['organizer_id'] = $dto->organizerId;
+ }
+
/** @var WebhookDomainObject $webhook */
- $webhook = $this->webhookRepository->findFirstWhere([
- 'id' => $dto->webhookId,
- 'event_id' => $dto->eventId,
- ]);
+ $webhook = $this->webhookRepository->findFirstWhere($where);
if (!$webhook) {
throw new ResourceNotFoundException(__(
- key: 'Webhook not found for ID: :webhookId and event ID: :eventId',
+ key: 'Webhook not found for ID: :webhookId',
replace: [
'webhookId' => $dto->webhookId,
- 'eventId' => $dto->eventId,
]
));
}
diff --git a/backend/app/Services/Application/Handlers/Webhook/GetWebhookHandler.php b/backend/app/Services/Application/Handlers/Webhook/GetWebhookHandler.php
index 8d4eafc0d..2d63ff111 100644
--- a/backend/app/Services/Application/Handlers/Webhook/GetWebhookHandler.php
+++ b/backend/app/Services/Application/Handlers/Webhook/GetWebhookHandler.php
@@ -13,13 +13,18 @@ class GetWebhookHandler
{
}
- public function handle(int $eventId, int $webhookId): WebhookDomainObject
+ public function handle(int $webhookId, ?int $eventId = null, ?int $organizerId = null): WebhookDomainObject
{
+ $where = ['id' => $webhookId];
+ if ($eventId !== null) {
+ $where['event_id'] = $eventId;
+ }
+ if ($organizerId !== null) {
+ $where['organizer_id'] = $organizerId;
+ }
+
return $this->webhookRepository->findFirstWhere(
- where: [
- 'id' => $webhookId,
- 'event_id' => $eventId,
- ]
+ where: $where
);
}
}
diff --git a/backend/app/Services/Application/Handlers/Webhook/GetWebhookLogsHandler.php b/backend/app/Services/Application/Handlers/Webhook/GetWebhookLogsHandler.php
index e3e6a3782..80cd5a319 100644
--- a/backend/app/Services/Application/Handlers/Webhook/GetWebhookLogsHandler.php
+++ b/backend/app/Services/Application/Handlers/Webhook/GetWebhookLogsHandler.php
@@ -16,13 +16,18 @@ class GetWebhookLogsHandler
{
}
- public function handle(int $eventId, int $webhookId): LengthAwarePaginator
+ public function handle(int $webhookId, ?int $eventId = null, ?int $organizerId = null): LengthAwarePaginator
{
+ $where = ['id' => $webhookId];
+ if ($eventId !== null) {
+ $where['event_id'] = $eventId;
+ }
+ if ($organizerId !== null) {
+ $where['organizer_id'] = $organizerId;
+ }
+
$webhook = $this->webhookRepository->findFirstWhere(
- where: [
- 'id' => $webhookId,
- 'event_id' => $eventId,
- ]
+ where: $where
);
if (!$webhook) {
diff --git a/backend/app/Services/Application/Handlers/Webhook/GetWebhooksHandler.php b/backend/app/Services/Application/Handlers/Webhook/GetWebhooksHandler.php
index 1ae708df0..c68b99ffa 100644
--- a/backend/app/Services/Application/Handlers/Webhook/GetWebhooksHandler.php
+++ b/backend/app/Services/Application/Handlers/Webhook/GetWebhooksHandler.php
@@ -14,13 +14,18 @@ class GetWebhooksHandler
{
}
- public function handler(int $accountId, int $eventId): Collection
+ public function handler(int $accountId, ?int $eventId = null, ?int $organizerId = null): Collection
{
+ $where = ['account_id' => $accountId];
+ if ($eventId !== null) {
+ $where['event_id'] = $eventId;
+ }
+ if ($organizerId !== null) {
+ $where['organizer_id'] = $organizerId;
+ }
+
return $this->webhookRepository->findWhere(
- where: [
- 'account_id' => $accountId,
- 'event_id' => $eventId,
- ],
+ where: $where,
orderAndDirections: [
new OrderAndDirection('id', OrderAndDirection::DIRECTION_DESC),
]
diff --git a/backend/app/Services/Domain/CreateWebhookService.php b/backend/app/Services/Domain/CreateWebhookService.php
index 7ea1b663a..8d2701ad0 100644
--- a/backend/app/Services/Domain/CreateWebhookService.php
+++ b/backend/app/Services/Domain/CreateWebhookService.php
@@ -14,9 +14,7 @@ class CreateWebhookService
public function __construct(
private readonly WebhookRepositoryInterface $webhookRepository,
private readonly LoggerInterface $logger,
- )
- {
- }
+ ) {}
public function createWebhook(WebhookDomainObject $webhookDomainObject): WebhookDomainObject
{
@@ -26,6 +24,7 @@ class CreateWebhookService
WebhookDomainObjectAbstract::ACCOUNT_ID => $webhookDomainObject->getAccountId(),
WebhookDomainObjectAbstract::STATUS => $webhookDomainObject->getStatus(),
WebhookDomainObjectAbstract::EVENT_ID => $webhookDomainObject->getEventId(),
+ WebhookDomainObjectAbstract::ORGANIZER_ID => $webhookDomainObject->getOrganizerId(),
WebhookDomainObjectAbstract::USER_ID => $webhookDomainObject->getUserId(),
WebhookDomainObjectAbstract::SECRET => Str::random(32),
]);
diff --git a/backend/app/Services/Infrastructure/DomainEvents/Enums/DomainEventType.php b/backend/app/Services/Infrastructure/DomainEvents/Enums/DomainEventType.php
index dbaf38aec..690dadd39 100644
--- a/backend/app/Services/Infrastructure/DomainEvents/Enums/DomainEventType.php
+++ b/backend/app/Services/Infrastructure/DomainEvents/Enums/DomainEventType.php
@@ -12,6 +12,10 @@ enum DomainEventType: string
case PRODUCT_UPDATED = 'product.updated';
case PRODUCT_DELETED = 'product.deleted';
+ case EVENT_CREATED = 'event.created';
+ case EVENT_UPDATED = 'event.updated';
+ case EVENT_ARCHIVED = 'event.archived';
+
case ORDER_CREATED = 'order.created';
case ORDER_UPDATED = 'order.updated';
case ORDER_MARKED_AS_PAID = 'order.marked_as_paid';
diff --git a/backend/app/Services/Infrastructure/Webhook/WebhookDispatchService.php b/backend/app/Services/Infrastructure/Webhook/WebhookDispatchService.php
index 5790c015c..25fe3369e 100644
--- a/backend/app/Services/Infrastructure/Webhook/WebhookDispatchService.php
+++ b/backend/app/Services/Infrastructure/Webhook/WebhookDispatchService.php
@@ -6,7 +6,6 @@ use HiEvents\DomainObjects\AttendeeDomainObject;
use HiEvents\DomainObjects\OrderItemDomainObject;
use HiEvents\DomainObjects\ProductPriceDomainObject;
use HiEvents\DomainObjects\QuestionAndAnswerViewDomainObject;
-use HiEvents\DomainObjects\Status\WebhookStatus;
use HiEvents\DomainObjects\TaxAndFeesDomainObject;
use HiEvents\DomainObjects\WebhookDomainObject;
use HiEvents\Repository\Eloquent\Value\Relationship;
@@ -15,13 +14,14 @@ use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
use HiEvents\Repository\Interfaces\OrderRepositoryInterface;
use HiEvents\Repository\Interfaces\ProductRepositoryInterface;
use HiEvents\Repository\Interfaces\WebhookRepositoryInterface;
+use HiEvents\Repository\Interfaces\EventRepositoryInterface;
use HiEvents\Resources\Attendee\AttendeeResource;
+use HiEvents\Resources\Event\EventResource;
use HiEvents\Resources\CheckInList\AttendeeCheckInResource;
use HiEvents\Resources\Order\OrderResource;
use HiEvents\Resources\Product\ProductResource;
use HiEvents\Services\Infrastructure\DomainEvents\Enums\DomainEventType;
use Illuminate\Http\Resources\Json\JsonResource;
-use Illuminate\Support\Collection;
use Psr\Log\LoggerInterface;
use Spatie\WebhookServer\WebhookCall;
@@ -34,10 +34,22 @@ class WebhookDispatchService
private readonly ProductRepositoryInterface $productRepository,
private readonly AttendeeRepositoryInterface $attendeeRepository,
private readonly AttendeeCheckInRepositoryInterface $attendeeCheckInRepository,
+ private readonly EventRepositoryInterface $eventRepository,
)
{
}
+ public function dispatchEventWebhook(DomainEventType $eventType, int $eventId): void
+ {
+ $event = $this->eventRepository->findById($eventId);
+
+ $this->dispatchWebhook(
+ eventType: $eventType,
+ payload: new EventResource($event),
+ eventId: $eventId,
+ );
+ }
+
public function dispatchAttendeeWebhook(DomainEventType $eventType, int $attendeeId): void
{
$attendee = $this->attendeeRepository
@@ -132,11 +144,7 @@ class WebhookDispatchService
private function dispatchWebhook(DomainEventType $eventType, JsonResource $payload, int $eventId): void
{
- /** @var Collection<WebhookDomainObject> $webhooks */
- $webhooks = $this->webhookRepository->findWhere([
- 'event_id' => $eventId,
- 'status' => WebhookStatus::ENABLED->name,
- ])
+ $webhooks = $this->webhookRepository->findEnabledByEventId($eventId)
->filter(fn(WebhookDomainObject $webhook) => in_array($eventType->value, $webhook->getEventTypes(), true));
foreach ($webhooks as $webhook) {
diff --git a/backend/app/Services/Infrastructure/Webhook/WebhookResponseHandlerService.php b/backend/app/Services/Infrastructure/Webhook/WebhookResponseHandlerService.php
index 1f1bd332c..5c2ccfd56 100644
--- a/backend/app/Services/Infrastructure/Webhook/WebhookResponseHandlerService.php
+++ b/backend/app/Services/Infrastructure/Webhook/WebhookResponseHandlerService.php
@@ -15,9 +15,7 @@ class WebhookResponseHandlerService
private readonly LoggerInterface $logger,
private readonly WebhookLogRepositoryInterface $webhookLogRepository,
private readonly DatabaseManager $databaseManager,
- )
- {
- }
+ ) {}
public function handleResponse(
int $eventId,
@@ -25,12 +23,10 @@ class WebhookResponseHandlerService
string $eventType,
array $payload,
?Response $response
- ): void
- {
+ ): void {
$this->databaseManager->transaction(function () use ($payload, $eventType, $eventId, $webhookId, $response) {
$webhook = $this->webhookRepository->findFirstWhere([
'id' => $webhookId,
- 'event_id' => $eventId,
]);
if (!$webhook) {
@@ -49,8 +45,8 @@ class WebhookResponseHandlerService
],
where: [
'id' => $webhookId,
- 'event_id' => $eventId,
- ]);
+ ]
+ );
$this->webhookLogRepository->create([
'webhook_id' => $webhook->getId(),
diff --git a/backend/database/migrations/2026_02_22_115000_add_organizer_id_to_webhooks_table.php b/backend/database/migrations/2026_02_22_115000_add_organizer_id_to_webhooks_table.php
new file mode 100644
index 000000000..fba97e757
--- /dev/null
+++ b/backend/database/migrations/2026_02_22_115000_add_organizer_id_to_webhooks_table.php
@@ -0,0 +1,24 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration {
+ public function up(): void
+ {
+ Schema::table('webhooks', static function (Blueprint $table) {
+ $table->foreignId('organizer_id')->nullable()->constrained()->onDelete('cascade');
+ $table->foreignId('event_id')->nullable()->change();
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('webhooks', static function (Blueprint $table) {
+ $table->dropForeign(['organizer_id']);
+ $table->dropColumn('organizer_id');
+ $table->foreignId('event_id')->nullable(false)->change();
+ });
+ }
+};
diff --git a/backend/routes/api.php b/backend/routes/api.php
index 61c631ef3..09ca424e4 100644
--- a/backend/routes/api.php
+++ b/backend/routes/api.php
@@ -115,6 +115,12 @@ use HiEvents\Http\Actions\Organizers\Settings\GetOrganizerSettingsAction;
use HiEvents\Http\Actions\Organizers\Settings\PartialUpdateOrganizerSettingsAction;
use HiEvents\Http\Actions\Organizers\Stats\GetOrganizerStatsAction;
use HiEvents\Http\Actions\Organizers\UpdateOrganizerStatusAction;
+use HiEvents\Http\Actions\Organizers\Webhooks\CreateOrganizerWebhookAction;
+use HiEvents\Http\Actions\Organizers\Webhooks\DeleteOrganizerWebhookAction;
+use HiEvents\Http\Actions\Organizers\Webhooks\EditOrganizerWebhookAction;
+use HiEvents\Http\Actions\Organizers\Webhooks\GetOrganizerWebhookAction;
+use HiEvents\Http\Actions\Organizers\Webhooks\GetOrganizerWebhookLogsAction;
+use HiEvents\Http\Actions\Organizers\Webhooks\GetOrganizerWebhooksAction;
use HiEvents\Http\Actions\ProductCategories\CreateProductCategoryAction;
use HiEvents\Http\Actions\ProductCategories\DeleteProductCategoryAction;
use HiEvents\Http\Actions\ProductCategories\EditProductCategoryAction;
@@ -275,6 +281,12 @@ $router->middleware(['auth:api'])->group(
$router->patch('/organizers/{organizer_id}/settings', PartialUpdateOrganizerSettingsAction::class);
$router->get('/organizers/{organizer_id}/reports/{report_type}', GetOrganizerReportAction::class);
$router->get('/organizers/{organizer_id}/reports/{report_type}/export', ExportOrganizerReportAction::class);
+ $router->post('/organizers/{organizer_id}/webhooks', CreateOrganizerWebhookAction::class);
+ $router->get('/organizers/{organizer_id}/webhooks', GetOrganizerWebhooksAction::class);
+ $router->put('/organizers/{organizer_id}/webhooks/{webhook_id}', EditOrganizerWebhookAction::class);
+ $router->get('/organizers/{organizer_id}/webhooks/{webhook_id}', GetOrganizerWebhookAction::class);
+ $router->delete('/organizers/{organizer_id}/webhooks/{webhook_id}', DeleteOrganizerWebhookAction::class);
+ $router->get('/organizers/{organizer_id}/webhooks/{webhook_id}/logs', GetOrganizerWebhookLogsAction::class);
// Email Templates - Organizer level
$router->get('/organizers/{organizerId}/email-templates', GetOrganizerEmailTemplatesAction::class);
diff --git a/frontend/src/api/organizer-webhook.client.ts b/frontend/src/api/organizer-webhook.client.ts
new file mode 100644
index 000000000..574f2e511
--- /dev/null
+++ b/frontend/src/api/organizer-webhook.client.ts
@@ -0,0 +1,34 @@
+import {GenericDataResponse, IdParam, Webhook, WebhookLog} from "../types";
+import {api} from "./client";
+
+export interface OrganizerWebhookRequest {
+ url: string;
+ event_types: string[];
+ status: 'ENABLED' | 'PAUSED';
+}
+
+export const organizerWebhookClient = {
+ get: async (organizerId: IdParam, webhookId: IdParam) => {
+ return await api.get<GenericDataResponse<Webhook>>(`organizers/${organizerId}/webhooks/${webhookId}`);
+ },
+
+ create: async (organizerId: IdParam, webhook: OrganizerWebhookRequest) => {
+ return await api.post<GenericDataResponse<Webhook>>(`organizers/${organizerId}/webhooks`, webhook);
+ },
+
+ all: async (organizerId: IdParam) => {
+ return await api.get<GenericDataResponse<Webhook[]>>(`organizers/${organizerId}/webhooks`);
+ },
+
+ logs: async (organizerId: IdParam, webhookId: IdParam) => {
+ return await api.get<GenericDataResponse<WebhookLog[]>>(`organizers/${organizerId}/webhooks/${webhookId}/logs`);
+ },
+
+ delete: async (organizerId: IdParam, webhookId: IdParam) => {
+ return await api.delete(`organizers/${organizerId}/webhooks/${webhookId}`);
+ },
+
+ update: async (organizerId: IdParam, webhookId: IdParam, webhook: OrganizerWebhookRequest) => {
+ return await api.put<GenericDataResponse<Webhook>>(`organizers/${organizerId}/webhooks/${webhookId}`, webhook);
+ },
+}
diff --git a/frontend/src/components/common/OrganizerWebhookTable/index.tsx b/frontend/src/components/common/OrganizerWebhookTable/index.tsx
new file mode 100644
index 000000000..a34f1ca8a
--- /dev/null
+++ b/frontend/src/components/common/OrganizerWebhookTable/index.tsx
@@ -0,0 +1,291 @@
+import {
+ Anchor,
+ Badge,
+ Button,
+ Group,
+ Menu,
+ Paper,
+ Popover,
+ Stack,
+ Table as MantineTable,
+ Text,
+ Tooltip
+} from '@mantine/core';
+import {
+ IconBolt,
+ IconClipboardList,
+ IconClockHour4,
+ IconDotsVertical,
+ IconPencil,
+ IconPlus,
+ IconTrash
+} from '@tabler/icons-react';
+import { Table, TableHead } from '../Table';
+import classes from '../WebhookTable/WebhookTable.module.scss';
+import { IdParam, Webhook } from '../../../types';
+import { confirmationDialog } from '../../../utilites/confirmationDialog';
+import Truncate from '../Truncate';
+import { relativeDate } from "../../../utilites/dates.ts";
+import { useDisclosure } from "@mantine/hooks";
+import { useState } from "react";
+import { t, Trans } from "@lingui/macro";
+import { EditOrganizerWebhookModal } from "../../modals/EditOrganizerWebhookModal";
+import { useDeleteOrganizerWebhook } from "../../../mutations/useDeleteOrganizerWebhook.ts";
+import { useParams } from "react-router";
+import { showError, showSuccess } from "../../../utilites/notifications.tsx";
+import { NoResultsSplash } from "../NoResultsSplash";
+import { OrganizerWebhookLogsModal } from "../../modals/OrganizerWebhookLogsModal";
+
+interface OrganizerWebhookTableProps {
+ webhooks: Webhook[];
+ openCreateModal: () => void;
+}
+
+export const OrganizerWebhookTable = ({ webhooks, openCreateModal }: OrganizerWebhookTableProps) => {
+ const { organizerId } = useParams();
+ const [editModalOpen, { open: openEditModal, close: closeEditModal }] = useDisclosure(false);
+ const [logsModalOpen, { open: openLogsModal, close: closeLogsModal }] = useDisclosure(false);
+ const [selectedWebhookId, setSelectedWebhookId] = useState<IdParam>();
+ const deleteMutation = useDeleteOrganizerWebhook();
+
+ const handleDelete = (webhookId: IdParam) => {
+ deleteMutation.mutate({ organizerId: organizerId as IdParam, webhookId }, {
+ onSuccess: () => showSuccess(t`Webhook deleted successfully`),
+ onError: (error) => showError(error.message)
+ });
+ }
+
+ const EventTypeDisplay = ({ webhook }: { webhook: Webhook }) => {
+ const eventTypes = webhook.event_types;
+
+ if (!eventTypes || eventTypes.length === 0) {
+ return <>-</>;
+ }
+
+ const eventCount = eventTypes.length;
+
+ return (
+ <div style={{ cursor: 'pointer' }}>
+ <Tooltip
+ label={
+ <div className={classes.tooltipContent}>
+ {eventTypes.map((type) => (
+ <div key={type}>{type}</div>
+ ))}
+ </div>
+ }
+ >
+ <Badge variant="light" size="sm">
+ {eventCount > 1 ? <Trans>{eventCount} events</Trans> : eventTypes[0]}
+ </Badge>
+ </Tooltip>
+ </div>
+ );
+ };
+
+ const ActionMenu = ({ webhook }: { webhook: Webhook }) => (
+ <Group wrap="nowrap" gap={0} justify="flex-end">
+ <Menu shadow="md" width={200}>
+ <Menu.Target>
+ <Button size="xs" variant="transparent">
+ <IconDotsVertical />
+ </Button>
+ </Menu.Target>
+
+ <Menu.Dropdown>
+ <Menu.Label>{t`Manage`}</Menu.Label>
+ <Menu.Item
+ leftSection={<IconPencil size={14} />}
+ onClick={() => {
+ setSelectedWebhookId(webhook.id as IdParam);
+ openEditModal();
+ }}
+ >
+ {t`Edit webhook`}
+ </Menu.Item>
+ <Menu.Item
+ leftSection={<IconClipboardList size={14} />}
+ onClick={() => {
+ setSelectedWebhookId(webhook.id as IdParam);
+ openLogsModal();
+ }}
+ >
+ {t`View logs`}
+ </Menu.Item>
+ <Menu.Divider />
+ <Menu.Label>{t`Danger zone`}</Menu.Label>
+ <Menu.Item
+ color="red"
+ leftSection={<IconTrash size={14} />}
+ onClick={() => {
+ confirmationDialog(
+ t`Are you sure you want to delete this webhook?`,
+ () => handleDelete(webhook.id as IdParam)
+ );
+ }}
+ >
+ {t`Delete webhook`}
+ </Menu.Item>
+ </Menu.Dropdown>
+ </Menu>
+ </Group>
+ );
+
+
+ const ResponseDisplay = ({ webhook }: { webhook: Webhook }) => {
+ if (webhook.last_response_code === null || webhook.last_response_code === undefined) {
+ return (
+ <Text c="dimmed" size="sm">
+ <Group gap={6} wrap="nowrap">
+ <IconClockHour4 size={14} />
+ <span>{t`No responses yet`}</span>
+ </Group>
+ </Text>
+ );
+ }
+
+ const isSuccess = (webhook.last_response_code >= 200 && webhook.last_response_code < 300) && webhook.last_response_code !== 0;
+ const statusColor = isSuccess ? 'green' : 'red';
+ const statusText = isSuccess ? t`Success` : t`Error`;
+
+ return (
+ <Popover width={400} position="bottom" withArrow>
+ <Popover.Target>
+ <Group gap="xs" wrap="nowrap">
+ <Badge
+ variant="light"
+ color={statusColor}
+ leftSection={<IconBolt size={12} />}
+ >
+ {statusText} {webhook.last_response_code > 0 ? `- ${webhook.last_response_code}` : ''}
+ </Badge>
+ </Group>
+ </Popover.Target>
+
+ <Popover.Dropdown>
+ <Stack gap="md">
+ <Group justify="space-between" align="center">
+ <Text fw={500} size="sm">{t`Response Details`}</Text>
+ <Badge
+ variant="light"
+ color={statusColor}
+ size="sm"
+ >
+ {webhook.last_response_code > 0 ? webhook.last_response_code : t`No response`}
+ </Badge>
+ </Group>
+
+ {webhook.last_response_body && (
+ <Paper className={classes.responseBody} withBorder p="xs">
+ <Text
+ component="pre"
+ style={{
+ margin: 0,
+ whiteSpace: 'pre-wrap',
+ wordBreak: 'break-word'
+ }}
+ >
+ {webhook.last_response_body}
+ </Text>
+ </Paper>
+ )}
+ </Stack>
+ </Popover.Dropdown>
+ </Popover>
+ );
+ };
+
+ if (webhooks.length === 0) {
+ return (
+ <NoResultsSplash
+ heading={t`No Webhooks`}
+ imageHref={'/blank-slate/webhooks.svg'}
+ subHeading={(
+ <>
+ <Trans>
+ <p>
+ Webhooks instantly notify external services when events happen, like adding a new attendee
+ to your CRM or mailing list upon registration, ensuring seamless automation.
+ </p>
+ <p>
+ Use third-party services like <Anchor underline={'always'} target={'_blank'}
+ href="https://zapier.com/features/webhooks">Zapier</Anchor>,{' '}
+ <Anchor underline={'always'} target={'_blank'} href="https://ifttt.com/maker_webhooks">IFTTT</Anchor> or <Anchor underline={'always'}
+ target={'_blank'} href="https://www.make.com/en/help/tools/webhooks">Make</Anchor> to
+ create custom workflows and automate tasks.
+ </p>
+ </Trans>
+ <Button
+ loading={deleteMutation.isPending}
+ size={'xs'}
+ leftSection={<IconPlus />}
+ color={'green'}
+ onClick={() => openCreateModal()}>{t`Add Webhook`}
+ </Button>
+ </>
+ )}
+ />
+ );
+ }
+
+ return (
+ <>
+ <Table>
+ <TableHead>
+ <MantineTable.Tr>
+ <MantineTable.Th>{t`URL`}</MantineTable.Th>
+ <MantineTable.Th>{t`Event Types`}</MantineTable.Th>
+ <MantineTable.Th miw={120}>{t`Status`}</MantineTable.Th>
+ <MantineTable.Th miw={140}>{t`Last Response`}</MantineTable.Th>
+ <MantineTable.Th>{t`Last Triggered`}</MantineTable.Th>
+ <MantineTable.Th></MantineTable.Th>
+ </MantineTable.Tr>
+ </TableHead>
+ <MantineTable.Tbody>
+ {webhooks.map((webhook) => (
+ <MantineTable.Tr key={webhook.id}>
+ <MantineTable.Td>
+ <Truncate text={webhook.url} length={35} />
+ </MantineTable.Td>
+ <MantineTable.Td>
+ <EventTypeDisplay webhook={webhook} />
+ </MantineTable.Td>
+ <MantineTable.Td>
+ <Badge
+ variant="light"
+ color={webhook.status === 'ENABLED' ? 'green' : 'gray'}
+ >
+ {webhook.status}
+ </Badge>
+ </MantineTable.Td>
+ <MantineTable.Td>
+ <ResponseDisplay webhook={webhook} />
+ </MantineTable.Td>
+ <MantineTable.Td>
+ <Text size="sm" c="dimmed" title={webhook.last_triggered_at as string}>
+ {webhook.last_triggered_at ? relativeDate(webhook.last_triggered_at as string) : t`Never`}
+ </Text>
+ </MantineTable.Td>
+ <MantineTable.Td>
+ <ActionMenu webhook={webhook} />
+ </MantineTable.Td>
+ </MantineTable.Tr>
+ ))}
+ </MantineTable.Tbody>
+ </Table>
+ {logsModalOpen && selectedWebhookId && (
+ <OrganizerWebhookLogsModal
+ onClose={closeLogsModal}
+ webhookId={selectedWebhookId as IdParam}
+ />
+ )}
+
+ {(editModalOpen && selectedWebhookId) && (
+ <EditOrganizerWebhookModal
+ onClose={closeEditModal}
+ webhookId={selectedWebhookId as IdParam}
+ />
+ )}
+ </>
+ );
+};
diff --git a/frontend/src/components/forms/WebhookForm/index.tsx b/frontend/src/components/forms/WebhookForm/index.tsx
index cb9162961..878240a52 100644
--- a/frontend/src/components/forms/WebhookForm/index.tsx
+++ b/frontend/src/components/forms/WebhookForm/index.tsx
@@ -1,8 +1,8 @@
-import {TextInput} from "@mantine/core";
-import {t} from "@lingui/macro";
-import {UseFormReturnType} from "@mantine/form";
-import {CustomSelect, ItemProps} from "../../common/CustomSelect";
-import {IconBolt, IconWebhook, IconWebhookOff} from "@tabler/icons-react";
+import { TextInput } from "@mantine/core";
+import { t } from "@lingui/macro";
+import { UseFormReturnType } from "@mantine/form";
+import { CustomSelect, ItemProps } from "../../common/CustomSelect";
+import { IconBolt, IconWebhook, IconWebhookOff } from "@tabler/icons-react";
interface WebhookFormProps {
form: UseFormReturnType<{
@@ -12,16 +12,16 @@ interface WebhookFormProps {
}>;
}
-export const WebhookForm = ({form}: WebhookFormProps) => {
+export const WebhookForm = ({ form }: WebhookFormProps) => {
const statusOptions: ItemProps[] = [
{
- icon: <IconWebhook/>,
+ icon: <IconWebhook />,
label: t`Enabled`,
value: 'ENABLED',
description: t`Webhook will send notifications`,
},
{
- icon: <IconWebhookOff/>,
+ icon: <IconWebhookOff />,
label: t`Paused`,
value: 'PAUSED',
description: t`Webhook will not send notifications`,
@@ -30,79 +30,97 @@ export const WebhookForm = ({form}: WebhookFormProps) => {
const eventTypeOptions: ItemProps[] = [
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Product Created`,
value: 'product.created',
description: t`When a new product is created`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
+ label: t`Event Created`,
+ value: 'event.created',
+ description: t`When a new event is created`,
+ },
+ {
+ icon: <IconBolt size={14} />,
+ label: t`Event Updated`,
+ value: 'event.updated',
+ description: t`When an event is updated`,
+ },
+ {
+ icon: <IconBolt size={14} />,
+ label: t`Event Archived`,
+ value: 'event.archived',
+ description: t`When an event is archived`,
+ },
+ {
+ icon: <IconBolt size={14} />,
label: t`Product Updated`,
value: 'product.updated',
description: t`When a product is updated`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Product Deleted`,
value: 'product.deleted',
description: t`When a product is deleted`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Order Created`,
value: 'order.created',
description: t`When a new order is created`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Order Updated`,
value: 'order.updated',
description: t`When an order is updated`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Order Marked as Paid`,
value: 'order.marked_as_paid',
description: t`When an order is marked as paid`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Order Refunded`,
value: 'order.refunded',
description: t`When an order is refunded`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Order Cancelled`,
value: 'order.cancelled',
description: t`When an order is cancelled`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Attendee Created`,
value: 'attendee.created',
description: t`When a new attendee is created`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Attendee Updated`,
value: 'attendee.updated',
description: t`When an attendee is updated`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Attendee Cancelled`,
value: 'attendee.cancelled',
description: t`When an attendee is cancelled`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Check-in Created`,
value: 'checkin.created',
description: t`When an attendee is checked in`,
},
{
- icon: <IconBolt size={14}/>,
+ icon: <IconBolt size={14} />,
label: t`Check-in Deleted`,
value: 'checkin.deleted',
description: t`When a check-in is deleted`,
diff --git a/frontend/src/components/layouts/OrganizerLayout/index.tsx b/frontend/src/components/layouts/OrganizerLayout/index.tsx
index 3e66cb94e..92dba3a63 100644
--- a/frontend/src/components/layouts/OrganizerLayout/index.tsx
+++ b/frontend/src/components/layouts/OrganizerLayout/index.tsx
@@ -13,51 +13,52 @@ import {
IconPaint,
IconSettings,
IconShare,
- IconUsersGroup
+ IconUsersGroup,
+ IconWebhook
} from "@tabler/icons-react";
-import {t} from "@lingui/macro";
-import {BreadcrumbItem, NavItem} from "../AppLayout/types.ts";
+import { t } from "@lingui/macro";
+import { BreadcrumbItem, NavItem } from "../AppLayout/types.ts";
import AppLayout from "../AppLayout";
-import {NavLink, useLocation, useParams} from "react-router";
-import {Button, Modal, Stack, Text} from "@mantine/core";
-import {useGetOrganizer} from "../../../queries/useGetOrganizer.ts";
-import {useState} from "react";
-import {CreateEventModal} from "../../modals/CreateEventModal";
-import {TopBarButton} from "../../common/TopBarButton";
+import { NavLink, useLocation, useParams } from "react-router";
+import { Button, Modal, Stack, Text } from "@mantine/core";
+import { useGetOrganizer } from "../../../queries/useGetOrganizer.ts";
+import { useState } from "react";
+import { CreateEventModal } from "../../modals/CreateEventModal";
+import { TopBarButton } from "../../common/TopBarButton";
import classes from "./OrganizerLayout.module.scss";
-import {CalloutConfig, SidebarCalloutQueue} from "../../common/SidebarCallout/SidebarCalloutQueue";
-import {InviteUserModal} from "../../modals/InviteUserModal";
-import {useDisclosure, useMediaQuery} from "@mantine/hooks";
-import {SwitchOrganizerModal} from "../../modals/SwitchOrganizerModal";
-import {useGetOrganizers} from "../../../queries/useGetOrganizers.ts";
-import {useGetAccount} from "../../../queries/useGetAccount.ts";
-import {StripeConnectButton} from "../../common/StripeConnectButton";
-import {ShareModal} from "../../modals/ShareModal";
-import {organizerHomepageUrl} from "../../../utilites/urlHelper";
-import {useUpdateOrganizerStatus} from "../../../mutations/useUpdateOrganizerStatus.ts";
-import {confirmationDialog} from "../../../utilites/confirmationDialog.tsx";
-import {showError, showSuccess} from "../../../utilites/notifications.tsx";
-import {useResendEmailConfirmation} from "../../../mutations/useResendEmailConfirmation.ts";
-import {useGetMe} from "../../../queries/useGetMe.ts";
+import { CalloutConfig, SidebarCalloutQueue } from "../../common/SidebarCallout/SidebarCalloutQueue";
+import { InviteUserModal } from "../../modals/InviteUserModal";
+import { useDisclosure, useMediaQuery } from "@mantine/hooks";
+import { SwitchOrganizerModal } from "../../modals/SwitchOrganizerModal";
+import { useGetOrganizers } from "../../../queries/useGetOrganizers.ts";
+import { useGetAccount } from "../../../queries/useGetAccount.ts";
+import { StripeConnectButton } from "../../common/StripeConnectButton";
+import { ShareModal } from "../../modals/ShareModal";
+import { organizerHomepageUrl } from "../../../utilites/urlHelper";
+import { useUpdateOrganizerStatus } from "../../../mutations/useUpdateOrganizerStatus.ts";
+import { confirmationDialog } from "../../../utilites/confirmationDialog.tsx";
+import { showError, showSuccess } from "../../../utilites/notifications.tsx";
+import { useResendEmailConfirmation } from "../../../mutations/useResendEmailConfirmation.ts";
+import { useGetMe } from "../../../queries/useGetMe.ts";
const OrganizerLayout = () => {
- const {organizerId} = useParams();
+ const { organizerId } = useParams();
const location = useLocation();
- const {data: organizer} = useGetOrganizer(organizerId);
+ const { data: organizer } = useGetOrganizer(organizerId);
const [showCreateEventModal, setShowCreateEventModal] = useState(false);
- const [createModalOpen, {open: openCreateModal, close: closeCreateModal}] = useDisclosure(false);
- const [switchOrganizerModalOpen, {open: openSwitchModal, close: closeSwitchModal}] = useDisclosure(false);
- const [shareModalOpen, {open: openShareModal, close: closeShareModal}] = useDisclosure(false);
+ const [createModalOpen, { open: openCreateModal, close: closeCreateModal }] = useDisclosure(false);
+ const [switchOrganizerModalOpen, { open: openSwitchModal, close: closeSwitchModal }] = useDisclosure(false);
+ const [shareModalOpen, { open: openShareModal, close: closeShareModal }] = useDisclosure(false);
const [emailVerificationModalOpen, {
open: openEmailVerificationModal,
close: closeEmailVerificationModal
}] = useDisclosure(false);
- const {data: organizerResposne} = useGetOrganizers();
+ const { data: organizerResposne } = useGetOrganizers();
const organizers = organizerResposne?.data;
- const {data: account} = useGetAccount();
+ const { data: account } = useGetAccount();
const resendEmailConfirmationMutation = useResendEmailConfirmation();
const [emailConfirmationResent, setEmailConfirmationResent] = useState(false);
- const {data: me} = useGetMe();
+ const { data: me } = useGetMe();
const isUserEmailVerfied = me?.is_email_verified;
const isMobile = useMediaQuery('(max-width: 768px)');
@@ -71,8 +72,8 @@ const OrganizerLayout = () => {
isActive: () => false,
showWhen: () => organizers && organizers.length > 1,
},
- {label: 'Overview'},
- {link: 'dashboard', label: t`Organizer Dashboard`, icon: IconDashboard},
+ { label: 'Overview' },
+ { link: 'dashboard', label: t`Organizer Dashboard`, icon: IconDashboard },
{
link: 'reports',
label: t`Reports`,
@@ -80,12 +81,15 @@ const OrganizerLayout = () => {
isActive: (isActive) => isActive || location.pathname.includes('/report/')
},
- {label: t`Manage`},
- {link: 'events', label: t`Events`, icon: IconCalendar},
- {link: 'settings', label: t`Settings`, icon: IconSettings},
+ { label: t`Manage` },
+ { link: 'events', label: t`Events`, icon: IconCalendar },
+ { link: 'settings', label: t`Settings`, icon: IconSettings },
- {label: t`Tools`},
- {link: 'organizer-homepage-designer', label: t`Homepage Designer`, icon: IconPaint},
+ { label: t`Tools` },
+ { link: 'organizer-homepage-designer', label: t`Homepage Designer`, icon: IconPaint },
+
+ { label: t`Integrations` },
+ { link: 'webhooks', label: t`Webhooks`, icon: IconWebhook },
];
const handleEmailConfirmationResend = () => {
@@ -149,7 +153,7 @@ const OrganizerLayout = () => {
className={classes.createEventBreadcrumb}
onClick={() => setShowCreateEventModal(true)}
>
- <IconCalendarPlus size={16}/> {t`Create Event`}
+ <IconCalendarPlus size={16} /> {t`Create Event`}
</span>
),
}
@@ -157,10 +161,10 @@ const OrganizerLayout = () => {
const callouts: CalloutConfig[] = [
{
- icon: <IconUsersGroup size={20}/>,
+ icon: <IconUsersGroup size={20} />,
heading: t`Invite Your Team`,
description: t`Collaborate with your team to create amazing events together.`,
- buttonIcon: <IconUsersGroup size={16}/>,
+ buttonIcon: <IconUsersGroup size={16} />,
buttonText: t`Invite Team Members`,
onClick: () => {
openCreateModal();
@@ -171,7 +175,7 @@ const OrganizerLayout = () => {
if (account && !account?.stripe_connect_setup_complete) {
callouts.unshift({
- icon: <IconBrandStripe size={20}/>,
+ icon: <IconBrandStripe size={20} />,
heading: t`Connect Stripe`,
description: t`Connect your Stripe account to accept payments for tickets and products.`,
storageKey: `stripe-callout-dismissed`,
@@ -179,7 +183,7 @@ const OrganizerLayout = () => {
<StripeConnectButton
fullWidth
variant="white"
- buttonIcon={<IconCreditCard size={16}/>}
+ buttonIcon={<IconCreditCard size={16} />}
buttonText={t`Connect Stripe`}
className={classes.calloutButton}
/>
@@ -198,9 +202,9 @@ const OrganizerLayout = () => {
<TopBarButton
onClick={handleStatusToggle}
size="sm"
- leftSection={organizer?.status === 'DRAFT' ? <IconEyeOff size={16}/> :
- <IconEye size={16}/>}
- rightSection={<IconChevronRight size={14}/>}
+ leftSection={organizer?.status === 'DRAFT' ? <IconEyeOff size={16} /> :
+ <IconEye size={16} />}
+ rightSection={<IconChevronRight size={14} />}
>
{organizer?.status === 'DRAFT'
? <span>{t`Draft`} <span
@@ -219,7 +223,7 @@ const OrganizerLayout = () => {
<Button
onClick={openShareModal}
variant="transparent"
- leftSection={<IconShare size={16}/>}
+ leftSection={<IconShare size={16} />}
>
<span className={classes.shareButtonTextDesktop}>
{t`Share Organizer Page`}
@@ -239,7 +243,7 @@ const OrganizerLayout = () => {
target={'_blank'}
variant={'transparent'}
className={classes.viewHomepageButton}
- leftSection={<IconExternalLink size={17}/>}
+ leftSection={<IconExternalLink size={17} />}
title={t`View Organizer Homepage`}
>
<span className={classes.viewHomepageButtonTextDesktop}>
@@ -247,12 +251,12 @@ const OrganizerLayout = () => {
</span>
</Button>
)}
- sidebarFooter={<SidebarCalloutQueue callouts={callouts}/>}
+ sidebarFooter={<SidebarCalloutQueue callouts={callouts} />}
/>
- {createModalOpen && <InviteUserModal onClose={closeCreateModal}/>}
+ {createModalOpen && <InviteUserModal onClose={closeCreateModal} />}
{switchOrganizerModalOpen &&
- <SwitchOrganizerModal opened={switchOrganizerModalOpen} onClose={closeSwitchModal}/>}
+ <SwitchOrganizerModal opened={switchOrganizerModalOpen} onClose={closeSwitchModal} />}
{organizer && shareModalOpen && (
<ShareModal
url={organizerHomepageUrl(organizer)}
diff --git a/frontend/src/components/modals/CreateOrganizerWebhookModal/index.tsx b/frontend/src/components/modals/CreateOrganizerWebhookModal/index.tsx
new file mode 100644
index 000000000..4c39183d1
--- /dev/null
+++ b/frontend/src/components/modals/CreateOrganizerWebhookModal/index.tsx
@@ -0,0 +1,71 @@
+import { GenericModalProps, IdParam } from "../../../types";
+import { Modal } from "../../common/Modal";
+import { t } from "@lingui/macro";
+import { WebhookForm } from "../../forms/WebhookForm";
+import { useForm } from "@mantine/form";
+import { Button } from "@mantine/core";
+import { useCreateOrganizerWebhook } from "../../../mutations/useCreateOrganizerWebhook";
+import { showSuccess } from "../../../utilites/notifications";
+import { useParams } from "react-router";
+import { useFormErrorResponseHandler } from "../../../hooks/useFormErrorResponseHandler";
+import { OrganizerWebhookRequest } from "../../../api/organizer-webhook.client.ts";
+
+export const CreateOrganizerWebhookModal = ({ onClose }: GenericModalProps) => {
+ const { organizerId } = useParams();
+ const errorHandler = useFormErrorResponseHandler();
+
+ const form = useForm<OrganizerWebhookRequest>({
+ initialValues: {
+ url: '',
+ event_types: [],
+ status: 'ENABLED'
+ },
+ validate: {
+ url: (value) => {
+ if (!value) return t`URL is required`;
+ try {
+ new URL(value);
+ return null;
+ } catch {
+ return t`Please enter a valid URL`;
+ }
+ },
+ event_types: (value) => value.length === 0 ? t`At least one event type must be selected` : null,
+ }
+ });
+
+ const createMutation = useCreateOrganizerWebhook();
+
+ const handleSubmit = (requestData: OrganizerWebhookRequest) => {
+ createMutation.mutate({
+ organizerId: organizerId as IdParam,
+ webhook: requestData
+ }, {
+ onSuccess: () => {
+ showSuccess(t`Webhook created successfully`);
+ onClose();
+ },
+ onError: (error) => errorHandler(form, error),
+ });
+ }
+
+ return (
+ <Modal
+ opened
+ onClose={onClose}
+ heading={t`Create Webhook`}
+ >
+ <form onSubmit={form.onSubmit(handleSubmit)}>
+ <WebhookForm form={form as any} />
+ <Button
+ type="submit"
+ fullWidth
+ mt="xl"
+ loading={createMutation.isPending}
+ >
+ {t`Create Webhook`}
+ </Button>
+ </form>
+ </Modal>
+ );
+}
diff --git a/frontend/src/components/modals/EditOrganizerWebhookModal/index.tsx b/frontend/src/components/modals/EditOrganizerWebhookModal/index.tsx
new file mode 100644
index 000000000..778af26c5
--- /dev/null
+++ b/frontend/src/components/modals/EditOrganizerWebhookModal/index.tsx
@@ -0,0 +1,92 @@
+import { GenericModalProps, IdParam } from "../../../types.ts";
+import { Modal } from "../../common/Modal";
+import { t } from "@lingui/macro";
+import { WebhookForm } from "../../forms/WebhookForm";
+import { useForm } from "@mantine/form";
+import { Alert, Button, Center, Loader } from "@mantine/core";
+import { showSuccess } from "../../../utilites/notifications.tsx";
+import { useParams } from "react-router";
+import { useFormErrorResponseHandler } from "../../../hooks/useFormErrorResponseHandler.tsx";
+import { useGetOrganizerWebhook } from "../../../queries/useGetOrganizerWebhook.ts";
+import { useEditOrganizerWebhook } from "../../../mutations/useEditOrganizerWebhook.ts";
+import { useEffect } from "react";
+import { OrganizerWebhookRequest } from "../../../api/organizer-webhook.client.ts";
+
+interface EditWebhookModalProps {
+ webhookId: IdParam;
+}
+
+export const EditOrganizerWebhookModal = ({
+ onClose,
+ webhookId
+}: GenericModalProps & EditWebhookModalProps) => {
+ const { organizerId } = useParams();
+ const errorHandler = useFormErrorResponseHandler();
+ const { data: webhook, error: webhookError, isLoading: webhookLoading } = useGetOrganizerWebhook(organizerId as IdParam, webhookId);
+ const form = useForm<OrganizerWebhookRequest>({
+ initialValues: {
+ url: '',
+ event_types: [],
+ status: 'ENABLED',
+ }
+ });
+ const editMutation = useEditOrganizerWebhook();
+
+ const handleSubmit = (requestData: OrganizerWebhookRequest) => {
+ editMutation.mutate(
+ {
+ organizerId: organizerId as IdParam,
+ webhook: requestData,
+ webhookId: webhookId,
+ },
+ {
+ onSuccess: () => {
+ showSuccess(t`Successfully updated Webhook`);
+ onClose();
+ },
+ onError: (error) => {
+ errorHandler(form, error);
+ },
+ }
+ );
+ };
+
+ useEffect(() => {
+ if (webhook && webhook.data && webhook.data.data) {
+ form.setValues({
+ url: webhook.data.data.url,
+ event_types: webhook.data.data.event_types,
+ status: webhook.data.data.status,
+ });
+ }
+ }, [webhook]);
+
+ return (
+ <Modal opened onClose={onClose} heading={t`Edit Webhook`}>
+ {webhookLoading && (
+ <Center>
+ <Loader />
+ </Center>
+ )}
+
+ {!!webhookError && (
+ <Alert color={'red'}>
+ {t`Failed to load Webhook`}
+ </Alert>
+ )}
+
+ {webhook && (
+ <form onSubmit={form.onSubmit(handleSubmit)}>
+ <WebhookForm form={form as any} />
+ <Button
+ type={'submit'}
+ fullWidth
+ loading={editMutation.isPending}
+ >
+ {t`Edit Webhook`}
+ </Button>
+ </form>
+ )}
+ </Modal>
+ );
+};
diff --git a/frontend/src/components/modals/OrganizerWebhookLogsModal/OrganizerWebhookLogsModal.module.scss b/frontend/src/components/modals/OrganizerWebhookLogsModal/OrganizerWebhookLogsModal.module.scss
new file mode 100644
index 000000000..0643d6c79
--- /dev/null
+++ b/frontend/src/components/modals/OrganizerWebhookLogsModal/OrganizerWebhookLogsModal.module.scss
@@ -0,0 +1,37 @@
+.logEntry {
+ cursor: pointer;
+ transition: all 0.2s ease;
+ border-radius: 8px;
+}
+
+.logEntryExpanded {
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+}
+
+.chevronIcon {
+ transition: transform 0.2s ease;
+}
+
+.chevronIconExpanded {
+ transform: rotate(90deg);
+}
+
+.statusIcon {
+ border-radius: 50%;
+ width: 28px;
+ height: 28px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.codeBlock {
+ border-radius: 6px;
+ max-height: 300px;
+ overflow: auto;
+ background-color: var(--mantine-color-gray-0);
+}
+
+.noLogsAlert {
+ text-align: center;
+}
diff --git a/frontend/src/components/modals/OrganizerWebhookLogsModal/index.tsx b/frontend/src/components/modals/OrganizerWebhookLogsModal/index.tsx
new file mode 100644
index 000000000..ad21f551f
--- /dev/null
+++ b/frontend/src/components/modals/OrganizerWebhookLogsModal/index.tsx
@@ -0,0 +1,180 @@
+import { useParams } from "react-router";
+import { useGetOrganizerWebhookLogs } from "../../../queries/useGetOrganizerWebhookLogs";
+import { Modal } from "../../common/Modal";
+import { t } from "@lingui/macro";
+import { Center } from "../../common/Center";
+import { Alert, Badge, Code, Collapse, Group, Loader, Paper, Stack, Text } from "@mantine/core";
+import { IconCheck, IconChevronRight, IconX } from '@tabler/icons-react';
+import { GenericModalProps, IdParam } from "../../../types.ts";
+import { useState } from "react";
+import { relativeDate } from "../../../utilites/dates.ts";
+import classes from "./OrganizerWebhookLogsModal.module.scss";
+
+interface WebhookLog {
+ id: IdParam;
+ webhook_id: IdParam;
+ payload?: string;
+ response_code?: number;
+ response_body?: string;
+ event_type: string;
+ created_at: string;
+}
+
+interface WebhookLogsModalProps extends GenericModalProps {
+ webhookId: IdParam;
+}
+
+const LogEntry = ({ log }: { log: WebhookLog }) => {
+ const [detailsOpen, setDetailsOpen] = useState(false);
+
+ const getStatusColor = (code?: number) => {
+ if (!code) return 'gray';
+ if (code >= 200 && code < 300) return 'green';
+ if (code >= 300 && code < 400) return 'blue';
+ return 'red';
+ };
+
+ const formatContent = (content?: string) => {
+ if (!content) return '';
+
+ try {
+ return JSON.stringify(JSON.parse(content), null, 2);
+ } catch (e) {
+ return content;
+ }
+ };
+
+ const statusColor = getStatusColor(log.response_code);
+
+ return (
+ <Paper
+ withBorder
+ p="md"
+ mb="md"
+ onClick={() => setDetailsOpen(!detailsOpen)}
+ className={`${classes.logEntry} ${detailsOpen ? classes.logEntryExpanded : ''}`}
+ style={{
+ borderLeft: `4px solid var(--mantine-color-${statusColor}-6)`
+ }}
+ >
+ <Group justify="space-between" wrap="nowrap">
+ <Group wrap="nowrap" gap="md">
+ <div
+ className={`${classes.chevronIcon} ${detailsOpen ? classes.chevronIconExpanded : ''}`}
+ style={{ color: `var(--mantine-color-${statusColor}-6)` }}
+ >
+ <IconChevronRight size={20} />
+ </div>
+ <div>
+ <Group wrap="nowrap" mb={6} gap="xs">
+ <Text fw={600} size="sm">
+ {log.event_type}
+ </Text>
+ <Badge
+ color={statusColor}
+ variant="filled"
+ size="sm"
+ radius="sm"
+ >
+ {log.response_code || t`No Response`}
+ </Badge>
+ </Group>
+ <Text size="xs" c="dimmed">
+ {relativeDate(log.created_at)}
+ </Text>
+ </div>
+ </Group>
+ {log.response_code && (
+ <div
+ className={classes.statusIcon}
+ style={{
+ background: `var(--mantine-color-${statusColor}-0)`,
+ color: `var(--mantine-color-${statusColor}-6)`,
+ }}
+ >
+ {log.response_code >= 200 && log.response_code < 300 ?
+ <IconCheck size={18} /> :
+ <IconX size={18} />
+ }
+ </div>
+ )}
+ </Group>
+
+ <Collapse in={detailsOpen} transitionDuration={300}>
+ <Stack mt="lg" gap="md">
+ {log.payload && (
+ <div>
+ <Text size="sm" fw={500} mb={8} c="dimmed">{t`Payload`}:</Text>
+ <Code block p="md" className={classes.codeBlock}>
+ {formatContent(log.payload)}
+ </Code>
+ </div>
+ )}
+
+ {log.response_body && (
+ <div>
+ <Text size="sm" fw={500} mb={8} c="dimmed">{t`Response`}:</Text>
+ <Code block p="md" className={classes.codeBlock}>
+ {formatContent(log.response_body)}
+ </Code>
+ </div>
+ )}
+ </Stack>
+ </Collapse>
+ </Paper>
+ );
+};
+
+export const OrganizerWebhookLogsModal = ({ onClose, webhookId }: WebhookLogsModalProps) => {
+ const { organizerId } = useParams();
+ const logsQuery = useGetOrganizerWebhookLogs(organizerId as IdParam, webhookId);
+ const logs = logsQuery.data?.data?.data;
+
+ return (
+ <Modal
+ opened
+ onClose={onClose}
+ heading={t`Webhook Logs`}
+ size="xl"
+ >
+ {logsQuery.isLoading && (
+ <Center>
+ <Stack align="center" gap="xs">
+ <Loader size="md" />
+ <Text size="sm" c="dimmed">{t`Loading webhook logs...`}</Text>
+ </Stack>
+ </Center>
+ )}
+
+ {!!logsQuery.error && (
+ <Alert
+ color="red"
+ title={t`Error loading logs`}
+ icon={<IconX size={18} />}
+ radius="md"
+ >
+ {logsQuery.error.message}
+ </Alert>
+ )}
+
+ {logs && logs.length === 0 && !logsQuery.isLoading && (
+ <Alert className={classes.noLogsAlert} radius="md">
+ <h2>
+ {t`No logs found`}
+ </h2>
+ <p>
+ {t`No webhook events have been recorded for this endpoint yet. Events will appear here once they are triggered.`}
+ </p>
+ </Alert>
+ )}
+
+ {logs && logs.length > 0 && (
+ <>
+ {logs.map((log: WebhookLog) => (
+ <LogEntry key={log.id} log={log} />
+ ))}
+ </>
+ )}
+ </Modal>
+ );
+};
diff --git a/frontend/src/components/routes/organizer/Settings/index.tsx b/frontend/src/components/routes/organizer/Settings/index.tsx
index c423b7ec1..6db5f17f7 100644
--- a/frontend/src/components/routes/organizer/Settings/index.tsx
+++ b/frontend/src/components/routes/organizer/Settings/index.tsx
@@ -1,24 +1,24 @@
-import {SeoSettings} from "./Sections/SeoSettings";
+import { SeoSettings } from "./Sections/SeoSettings";
import BasicSettings from "./Sections/BasicSettings";
-import {SocialLinks} from "./Sections/SocialLinks";
-import {AddressSettings} from "./Sections/AddressSettings";
+import { SocialLinks } from "./Sections/SocialLinks";
+import { AddressSettings } from "./Sections/AddressSettings";
import EmailTemplateSettings from "./Sections/EmailTemplateSettings";
-import {EventDefaults} from "./Sections/EventDefaults";
-import {PlatformFeesSettings} from "./Sections/PlatformFeesSettings";
-import {PageBody} from "../../../common/PageBody";
-import {PageTitle} from "../../../common/PageTitle";
-import {t} from "@lingui/macro";
-import {Box, Group, NavLink as MantineNavLink, Stack} from "@mantine/core";
-import {IconBrandGoogleAnalytics, IconInfoCircle, IconMapPin, IconShare, IconMail, IconCalendarEvent, IconPercentage} from "@tabler/icons-react";
-import {useMediaQuery} from "@mantine/hooks";
-import {useMemo, useState} from "react";
-import {Card} from "../../../common/Card";
-import {useParams} from "react-router";
-import {useGetAccount} from "../../../../queries/useGetAccount.ts";
+import { EventDefaults } from "./Sections/EventDefaults";
+import { PlatformFeesSettings } from "./Sections/PlatformFeesSettings";
+import { PageBody } from "../../../common/PageBody";
+import { PageTitle } from "../../../common/PageTitle";
+import { t } from "@lingui/macro";
+import { Box, Group, NavLink as MantineNavLink, Stack } from "@mantine/core";
+import { IconBrandGoogleAnalytics, IconInfoCircle, IconMapPin, IconShare, IconMail, IconCalendarEvent, IconPercentage } from "@tabler/icons-react";
+import { useMediaQuery } from "@mantine/hooks";
+import { useMemo, useState } from "react";
+import { Card } from "../../../common/Card";
+import { useParams } from "react-router";
+import { useGetAccount } from "../../../../queries/useGetAccount.ts";
const Settings = () => {
const { organizerId } = useParams();
- const {data: account} = useGetAccount();
+ const { data: account } = useGetAccount();
const isSaasMode = account?.is_saas_mode_enabled;
const SECTIONS = useMemo(() => {
@@ -84,19 +84,19 @@ const Settings = () => {
const handleClick = (sectionId: string) => {
setActiveSection(sectionId);
- document.getElementById(sectionId)?.scrollIntoView({behavior: 'smooth'});
+ document.getElementById(sectionId)?.scrollIntoView({ behavior: 'smooth' });
};
const sideMenu = (
- <Card style={{padding: '15px', marginBottom: 0}}>
+ <Card style={{ padding: '15px', marginBottom: 0 }}>
<Stack gap="xs">
{SECTIONS.map((section) => (
<MantineNavLink
- style={{borderRadius: '5px'}}
+ style={{ borderRadius: '5px' }}
key={section.id}
active={activeSection === section.id}
label={section.label}
- leftSection={<section.icon size={16} stroke={1.5}/>}
+ leftSection={<section.icon size={16} stroke={1.5} />}
onClick={() => handleClick(section.id)}
/>
))}
@@ -104,9 +104,9 @@ const Settings = () => {
</Card>
);
- const content = SECTIONS.map(({id, component: Component}) => (
- <div key={id} id={id} style={{scrollMarginTop: '20px'}}>
- <Component/>
+ const content = SECTIONS.map(({ id, component: Component }) => (
+ <div key={id} id={id} style={{ scrollMarginTop: '20px' }}>
+ <Component />
</div>
));
@@ -116,10 +116,10 @@ const Settings = () => {
{isLargeScreen ? (
<Group align="flex-start" gap="md">
- <Box w={240} style={{position: 'sticky', top: 20}}>
+ <Box w={240} style={{ position: 'sticky', top: 20 }}>
{sideMenu}
</Box>
- <Box style={{flex: 1}}>{content}</Box>
+ <Box style={{ flex: 1 }}>{content}</Box>
</Group>
) : (
<Stack>
diff --git a/frontend/src/components/routes/organizer/Webhooks/index.tsx b/frontend/src/components/routes/organizer/Webhooks/index.tsx
new file mode 100644
index 000000000..c773455d1
--- /dev/null
+++ b/frontend/src/components/routes/organizer/Webhooks/index.tsx
@@ -0,0 +1,62 @@
+import { t } from "@lingui/macro";
+import { Badge, Button, Group, Box } from "@mantine/core"
+import { IconPlus } from "@tabler/icons-react";
+import { Card } from "../../../common/Card";
+import { useDisclosure } from "@mantine/hooks";
+import { OrganizerWebhookTable } from "../../../common/OrganizerWebhookTable";
+import { useGetOrganizerWebhooks } from "../../../../queries/useGetOrganizerWebhooks";
+import { useParams } from "react-router";
+import { CreateOrganizerWebhookModal } from "../../../modals/CreateOrganizerWebhookModal";
+import { TableSkeleton } from "../../../common/TableSkeleton";
+import { IdParam } from "../../../../types";
+import { PageBody } from "../../../common/PageBody";
+import { PageTitle } from "../../../common/PageTitle";
+
+export default function Webhooks() {
+ const { organizerId } = useParams();
+ const [createModalOpen, { open: openCreateModal, close: closeCreateModal }] = useDisclosure(false);
+ const webhooksQuery = useGetOrganizerWebhooks(organizerId as IdParam);
+ const webhooks = webhooksQuery.data?.data?.data;
+
+ const getWebhookCountText = () => {
+ if (!webhooks) return t`Loading Webhooks`;
+ if (webhooks.length === 0) return t`No Active Webhooks`;
+ if (webhooks.length === 1) return t`1 Active Webhook`;
+ return t`${webhooks.length} Active Webhooks`;
+ };
+
+ return (
+ <PageBody>
+ <PageTitle>{t`Webhooks`}</PageTitle>
+ <Box>
+ <Card>
+ <Group justify="space-between">
+ <Button color={'green'} rightSection={<IconPlus />} onClick={openCreateModal}>
+ {t`Add Webhook`}
+ </Button>
+ <Badge
+ variant="transparent"
+ size="lg"
+ >
+ {getWebhookCountText()}
+ </Badge>
+ </Group>
+ </Card>
+ <div>
+ <TableSkeleton isVisible={!webhooks} />
+
+ {webhooks && (<OrganizerWebhookTable
+ webhooks={webhooks}
+ openCreateModal={openCreateModal}
+ />)}
+ </div>
+
+ {createModalOpen && (
+ <CreateOrganizerWebhookModal
+ onClose={closeCreateModal}
+ />
+ )}
+ </Box>
+ </PageBody>
+ );
+}
diff --git a/frontend/src/mutations/useCreateOrganizerWebhook.ts b/frontend/src/mutations/useCreateOrganizerWebhook.ts
new file mode 100644
index 000000000..cc922bdd3
--- /dev/null
+++ b/frontend/src/mutations/useCreateOrganizerWebhook.ts
@@ -0,0 +1,17 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { organizerWebhookClient, OrganizerWebhookRequest } from "../api/organizer-webhook.client.ts";
+import { IdParam } from "../types.ts";
+import { GET_ORGANIZER_WEBHOOKS_QUERY_KEY } from "../queries/useGetOrganizerWebhooks.ts";
+
+export const useCreateOrganizerWebhook = () => {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({ organizerId, webhook }: {
+ organizerId: IdParam,
+ webhook: OrganizerWebhookRequest
+ }) => organizerWebhookClient.create(organizerId, webhook),
+
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: [GET_ORGANIZER_WEBHOOKS_QUERY_KEY] })
+ });
+}
diff --git a/frontend/src/mutations/useDeleteOrganizerWebhook.ts b/frontend/src/mutations/useDeleteOrganizerWebhook.ts
new file mode 100644
index 000000000..4aacd1291
--- /dev/null
+++ b/frontend/src/mutations/useDeleteOrganizerWebhook.ts
@@ -0,0 +1,17 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { IdParam } from "../types";
+import { organizerWebhookClient } from "../api/organizer-webhook.client";
+import { GET_ORGANIZER_WEBHOOKS_QUERY_KEY } from "../queries/useGetOrganizerWebhooks";
+
+export const useDeleteOrganizerWebhook = () => {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({ organizerId, webhookId }: {
+ organizerId: IdParam,
+ webhookId: IdParam
+ }) => organizerWebhookClient.delete(organizerId, webhookId),
+
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: [GET_ORGANIZER_WEBHOOKS_QUERY_KEY] })
+ });
+}
diff --git a/frontend/src/mutations/useEditOrganizerWebhook.ts b/frontend/src/mutations/useEditOrganizerWebhook.ts
new file mode 100644
index 000000000..e45caa717
--- /dev/null
+++ b/frontend/src/mutations/useEditOrganizerWebhook.ts
@@ -0,0 +1,18 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { organizerWebhookClient, OrganizerWebhookRequest } from "../api/organizer-webhook.client.ts";
+import { IdParam } from "../types.ts";
+import { GET_ORGANIZER_WEBHOOKS_QUERY_KEY } from "../queries/useGetOrganizerWebhooks.ts";
+
+export const useEditOrganizerWebhook = () => {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({ organizerId, webhookId, webhook }: {
+ organizerId: IdParam,
+ webhookId: IdParam,
+ webhook: OrganizerWebhookRequest
+ }) => organizerWebhookClient.update(organizerId, webhookId, webhook),
+
+ onSuccess: () => queryClient.invalidateQueries({ queryKey: [GET_ORGANIZER_WEBHOOKS_QUERY_KEY] })
+ });
+}
diff --git a/frontend/src/queries/useGetOrganizerWebhook.ts b/frontend/src/queries/useGetOrganizerWebhook.ts
new file mode 100644
index 000000000..b4eb56a0b
--- /dev/null
+++ b/frontend/src/queries/useGetOrganizerWebhook.ts
@@ -0,0 +1,13 @@
+import { organizerWebhookClient } from "../api/organizer-webhook.client.ts";
+import { useQuery } from "@tanstack/react-query";
+import { IdParam } from "../types.ts";
+
+export const GET_ORGANIZER_WEBHOOK_QUERY_KEY = 'getOrganizerWebhook';
+
+export const useGetOrganizerWebhook = (organizerId: IdParam, webhookId: IdParam) => {
+ return useQuery({
+ queryKey: [GET_ORGANIZER_WEBHOOK_QUERY_KEY, organizerId, webhookId],
+ queryFn: async () => await organizerWebhookClient.get(organizerId, webhookId),
+ enabled: !!webhookId
+ });
+}
diff --git a/frontend/src/queries/useGetOrganizerWebhookLogs.ts b/frontend/src/queries/useGetOrganizerWebhookLogs.ts
new file mode 100644
index 000000000..45aa645aa
--- /dev/null
+++ b/frontend/src/queries/useGetOrganizerWebhookLogs.ts
@@ -0,0 +1,13 @@
+import { organizerWebhookClient } from "../api/organizer-webhook.client.ts";
+import { useQuery } from "@tanstack/react-query";
+import { IdParam } from "../types.ts";
+
+export const GET_ORGANIZER_WEBHOOK_LOGS_QUERY_KEY = 'getOrganizerWebhookLogs';
+
+export const useGetOrganizerWebhookLogs = (organizerId: IdParam, webhookId: IdParam) => {
+ return useQuery({
+ queryKey: [GET_ORGANIZER_WEBHOOK_LOGS_QUERY_KEY, organizerId, webhookId],
+ queryFn: async () => await organizerWebhookClient.logs(organizerId, webhookId),
+ enabled: !!webhookId
+ });
+}
diff --git a/frontend/src/queries/useGetOrganizerWebhooks.ts b/frontend/src/queries/useGetOrganizerWebhooks.ts
new file mode 100644
index 000000000..ec8cef8c7
--- /dev/null
+++ b/frontend/src/queries/useGetOrganizerWebhooks.ts
@@ -0,0 +1,12 @@
+import { organizerWebhookClient } from "../api/organizer-webhook.client.ts";
+import { useQuery } from "@tanstack/react-query";
+import { IdParam } from "../types.ts";
+
+export const GET_ORGANIZER_WEBHOOKS_QUERY_KEY = 'getOrganizerWebhooks';
+
+export const useGetOrganizerWebhooks = (organizerId: IdParam) => {
+ return useQuery({
+ queryKey: [GET_ORGANIZER_WEBHOOKS_QUERY_KEY, organizerId],
+ queryFn: async () => await organizerWebhookClient.all(organizerId),
+ });
+}
diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx
index 34df49744..5eaa8aa13 100644
--- a/frontend/src/router.tsx
+++ b/frontend/src/router.tsx
@@ -1,10 +1,10 @@
-import {Navigate, RouteObject} from "react-router";
+import { Navigate, RouteObject } from "react-router";
import ErrorPage from "./error-page.tsx";
-import {useEffect, useState} from "react";
-import {useGetMe} from "./queries/useGetMe.ts";
-import {publicEventRouteLoader} from "./routeLoaders/publicEventRouteLoader.ts";
-import {publicOrganizerRouteLoader} from "./routeLoaders/publicOrganizerRouteLoader.ts";
-import {organizerPreviewRouteLoader} from "./routeLoaders/organizerPreviewRouteLoader.ts";
+import { useEffect, useState } from "react";
+import { useGetMe } from "./queries/useGetMe.ts";
+import { publicEventRouteLoader } from "./routeLoaders/publicEventRouteLoader.ts";
+import { publicOrganizerRouteLoader } from "./routeLoaders/publicOrganizerRouteLoader.ts";
+import { organizerPreviewRouteLoader } from "./routeLoaders/organizerPreviewRouteLoader.ts";
const Root = () => {
const [redirectPath, setRedirectPath] = useState<string | null>(null);
@@ -19,102 +19,102 @@ const Root = () => {
}, [me.isFetched]);
if (redirectPath) {
- return <Navigate to={redirectPath} replace={true}/>;
+ return <Navigate to={redirectPath} replace={true} />;
}
};
export const router: RouteObject[] = [
{
path: "",
- element: <Root/>,
- errorElement: <ErrorPage/>
+ element: <Root />,
+ errorElement: <ErrorPage />
},
{
path: "auth",
async lazy() {
const AuthLayout = await import("./components/layouts/AuthLayout");
- return {Component: AuthLayout.default};
+ return { Component: AuthLayout.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
children: [
{
path: "login",
async lazy() {
const Login = await import("./components/routes/auth/Login");
- return {Component: Login.default};
+ return { Component: Login.default };
},
},
{
path: "register",
async lazy() {
const Register = await import("./components/routes/auth/Register");
- return {Component: Register.default};
+ return { Component: Register.default };
}
},
{
path: "forgot-password",
async lazy() {
const ForgotPassword = await import("./components/routes/auth/ForgotPassword");
- return {Component: ForgotPassword.default};
+ return { Component: ForgotPassword.default };
}
},
{
path: "reset-password/:token",
async lazy() {
const ResetPassword = await import("./components/routes/auth/ResetPassword");
- return {Component: ResetPassword.default};
+ return { Component: ResetPassword.default };
}
},
{
path: "accept-invitation/:token",
async lazy() {
const AcceptInvitation = await import("./components/routes/auth/AcceptInvitation");
- return {Component: AcceptInvitation.default};
+ return { Component: AcceptInvitation.default };
}
}
]
},
{
path: "manage",
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
async lazy() {
const DefaultLayout = await import("./components/layouts/DefaultLayout");
- return {Component: DefaultLayout.default};
+ return { Component: DefaultLayout.default };
},
children: [
{
path: "events/:eventsState?",
async lazy() {
const Dashboard = await import("./components/routes/events/Dashboard");
- return {Component: Dashboard.default};
+ return { Component: Dashboard.default };
},
},
{
path: "account",
async lazy() {
const ManageAccount = await import("./components/routes/account/ManageAccount");
- return {Component: ManageAccount.default};
+ return { Component: ManageAccount.default };
}
},
{
path: "profile",
async lazy() {
const ManageProfile = await import("./components/routes/profile/ManageProfile");
- return {Component: ManageProfile.default};
+ return { Component: ManageProfile.default };
}
},
{
path: "profile/confirm-email-change/:token",
async lazy() {
const ConfirmEmailChange = await import("./components/routes/profile/ConfirmEmailChange");
- return {Component: ConfirmEmailChange.default};
+ return { Component: ConfirmEmailChange.default };
}
},
{
path: "profile/confirm-email-address/:token",
async lazy() {
const ConfirmEmailAddress = await import("./components/routes/profile/ConfirmEmailAddress");
- return {Component: ConfirmEmailAddress.default};
+ return { Component: ConfirmEmailAddress.default };
}
},
]
@@ -123,147 +123,147 @@ export const router: RouteObject[] = [
path: "welcome",
async lazy() {
const WelcomeLayout = await import("./components/layouts/WelcomeLayout");
- return {Component: WelcomeLayout.default};
+ return { Component: WelcomeLayout.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
children: [
{
path: "",
async lazy() {
const Welcome = await import("./components/routes/welcome");
- return {Component: Welcome.default};
+ return { Component: Welcome.default };
}
},
]
},
{
path: "admin",
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
async lazy() {
const AdminLayout = await import("./components/layouts/Admin");
- return {Component: AdminLayout.default};
+ return { Component: AdminLayout.default };
},
children: [
{
path: "",
async lazy() {
const Dashboard = await import("./components/routes/admin/Dashboard");
- return {Component: Dashboard.default};
+ return { Component: Dashboard.default };
}
},
{
path: "accounts",
async lazy() {
const Accounts = await import("./components/routes/admin/Accounts");
- return {Component: Accounts.default};
+ return { Component: Accounts.default };
}
},
{
path: "accounts/:accountId",
async lazy() {
const AccountDetail = await import("./components/routes/admin/Accounts/AccountDetail");
- return {Component: AccountDetail.default};
+ return { Component: AccountDetail.default };
}
},
{
path: "users",
async lazy() {
const Users = await import("./components/routes/admin/Users");
- return {Component: Users.default};
+ return { Component: Users.default };
}
},
{
path: "events",
async lazy() {
const Events = await import("./components/routes/admin/Events");
- return {Component: Events.default};
+ return { Component: Events.default };
}
},
{
path: "orders",
async lazy() {
const Orders = await import("./components/routes/admin/Orders");
- return {Component: Orders.default};
+ return { Component: Orders.default };
}
},
{
path: "attribution",
async lazy() {
const Attribution = await import("./components/routes/admin/Attribution");
- return {Component: Attribution.default};
+ return { Component: Attribution.default };
}
},
{
path: "configurations",
async lazy() {
const Configurations = await import("./components/routes/admin/Configurations");
- return {Component: Configurations.default};
+ return { Component: Configurations.default };
}
},
{
path: "failed-jobs",
async lazy() {
const FailedJobs = await import("./components/routes/admin/FailedJobs");
- return {Component: FailedJobs.default};
+ return { Component: FailedJobs.default };
}
},
{
path: "messages",
async lazy() {
const Messages = await import("./components/routes/admin/Messages");
- return {Component: Messages.default};
+ return { Component: Messages.default };
}
}
]
},
{
path: "account",
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
async lazy() {
const DefaultLayout = await import("./components/layouts/DefaultLayout");
- return {Component: DefaultLayout.default};
+ return { Component: DefaultLayout.default };
},
children: [
{
path: "",
async lazy() {
const ManageAccount = await import("./components/routes/account/ManageAccount");
- return {Component: ManageAccount.default};
+ return { Component: ManageAccount.default };
},
children: [
{
path: "settings",
async lazy() {
const AccountSettings = await import("./components/routes/account/ManageAccount/sections/AccountSettings");
- return {Component: AccountSettings.default};
+ return { Component: AccountSettings.default };
}
},
{
path: "taxes-and-fees",
async lazy() {
const TaxSettings = await import("./components/routes/account/ManageAccount/sections/TaxSettings");
- return {Component: TaxSettings.default};
+ return { Component: TaxSettings.default };
}
},
{
path: "event-defaults",
async lazy() {
const EventDefaultsSettings = await import("./components/routes/account/ManageAccount/sections/EventDefaultsSettings");
- return {Component: EventDefaultsSettings.default};
+ return { Component: EventDefaultsSettings.default };
}
},
{
path: "users",
async lazy() {
const Users = await import("./components/routes/account/ManageAccount/sections/Users");
- return {Component: Users.default};
+ return { Component: Users.default };
}
},
{
path: "payment",
async lazy() {
const PaymentSettings = await import("./components/routes/account/ManageAccount/sections/PaymentSettings");
- return {Component: PaymentSettings.default};
+ return { Component: PaymentSettings.default };
}
},
]
@@ -274,50 +274,57 @@ export const router: RouteObject[] = [
path: "/manage/organizer/:organizerId?",
async lazy() {
const Dashboard = await import("./components/layouts/OrganizerLayout");
- return {Component: Dashboard.default};
+ return { Component: Dashboard.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
children: [
{
path: "dashboard?",
async lazy() {
const OrganizerDashboard = await import("./components/routes/organizer/OrganizerDashboard");
- return {Component: OrganizerDashboard.default};
+ return { Component: OrganizerDashboard.default };
}
},
{
path: "events/:eventsState?",
async lazy() {
const Events = await import("./components/routes/organizer/Events");
- return {Component: Events.default};
+ return { Component: Events.default };
}
},
{
path: "settings",
async lazy() {
const Settings = await import("./components/routes/organizer/Settings");
- return {Component: Settings.default};
+ return { Component: Settings.default };
}
},
{
path: "organizer-homepage-designer",
async lazy() {
const OrganizerHomepageDesigner = await import("./components/routes/organizer/OrganizerHomepageDesigner");
- return {Component: OrganizerHomepageDesigner.default};
+ return { Component: OrganizerHomepageDesigner.default };
+ }
+ },
+ {
+ path: "webhooks",
+ async lazy() {
+ const Webhooks = await import("./components/routes/organizer/Webhooks");
+ return { Component: Webhooks.default };
}
},
{
path: "reports",
async lazy() {
const OrganizerReports = await import("./components/routes/organizer/Reports");
- return {Component: OrganizerReports.default};
+ return { Component: OrganizerReports.default };
}
},
{
path: "report/:reportType",
async lazy() {
const OrganizerReportLayout = await import("./components/routes/organizer/Reports/ReportLayout");
- return {Component: OrganizerReportLayout.default};
+ return { Component: OrganizerReportLayout.default };
}
}
],
@@ -326,148 +333,148 @@ export const router: RouteObject[] = [
path: "/manage/event/:eventId",
async lazy() {
const EventLayout = await import("./components/layouts/Event");
- return {Component: EventLayout.default};
+ return { Component: EventLayout.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
children: [
{
path: "",
async lazy() {
const EventDashboard = await import("./components/routes/event/EventDashboard");
- return {Component: EventDashboard.default};
+ return { Component: EventDashboard.default };
}
},
{
path: "dashboard",
async lazy() {
const EventDashboard = await import("./components/routes/event/EventDashboard");
- return {Component: EventDashboard.default};
+ return { Component: EventDashboard.default };
}
},
{
path: "reports",
async lazy() {
const Reports = await import("./components/routes/event/Reports");
- return {Component: Reports.default};
+ return { Component: Reports.default };
},
},
{
path: "report/:reportType",
async lazy() {
const ReportLayout = await import("./components/routes/event/Reports/ReportLayout");
- return {Component: ReportLayout.default};
+ return { Component: ReportLayout.default };
},
},
{
path: "products",
async lazy() {
const Products = await import("./components/routes/event/products");
- return {Component: Products.default};
+ return { Component: Products.default };
}
},
{
path: "attendees",
async lazy() {
const Attendees = await import("./components/routes/event/attendees");
- return {Component: Attendees.default};
+ return { Component: Attendees.default };
}
},
{
path: "questions",
async lazy() {
const Questions = await import("./components/routes/event/questions");
- return {Component: Questions.default};
+ return { Component: Questions.default };
}
},
{
path: "orders",
async lazy() {
const Orders = await import("./components/routes/event/orders");
- return {Component: Orders.default};
+ return { Component: Orders.default };
}
},
{
path: "promo-codes",
async lazy() {
const PromoCodes = await import("./components/routes/event/promo-codes");
- return {Component: PromoCodes.default};
+ return { Component: PromoCodes.default };
}
},
{
path: "affiliates",
async lazy() {
const Affiliates = await import("./components/routes/event/Affiliates");
- return {Component: Affiliates.default};
+ return { Component: Affiliates.default };
}
},
{
path: "check-in",
async lazy() {
const CheckIn = await import("./components/routes/event/CheckInLists");
- return {Component: CheckIn.default};
+ return { Component: CheckIn.default };
}
},
{
path: "messages",
async lazy() {
const Messages = await import("./components/routes/event/messages");
- return {Component: Messages.default};
+ return { Component: Messages.default };
}
},
{
path: "settings",
async lazy() {
const Settings = await import("./components/routes/event/Settings");
- return {Component: Settings.default};
+ return { Component: Settings.default };
}
},
{
path: "widget",
async lazy() {
const Widget = await import("./components/routes/event/widget");
- return {Component: Widget.default};
+ return { Component: Widget.default };
}
},
{
path: "homepage-designer",
async lazy() {
const HomepageDesigner = await import("./components/routes/event/HomepageDesigner");
- return {Component: HomepageDesigner.default};
+ return { Component: HomepageDesigner.default };
}
},
{
path: "ticket-designer",
async lazy() {
const TicketDesigner = await import("./components/routes/event/TicketDesigner");
- return {Component: TicketDesigner.default};
+ return { Component: TicketDesigner.default };
}
},
{
path: "getting-started",
async lazy() {
const GettingStarted = await import("./components/routes/event/GettingStarted");
- return {Component: GettingStarted.default};
+ return { Component: GettingStarted.default };
}
},
{
path: "sold-out-waitlist",
async lazy() {
const SoldOutWaitlist = await import("./components/routes/event/SoldOutWaitlist");
- return {Component: SoldOutWaitlist.default};
+ return { Component: SoldOutWaitlist.default };
}
},
{
path: "capacity-assignments",
async lazy() {
const CapacityAssignments = await import("./components/routes/event/CapacityAssignments");
- return {Component: CapacityAssignments.default};
+ return { Component: CapacityAssignments.default };
}
},
{
path: "webhooks",
async lazy() {
const Webhooks = await import("./components/routes/event/Webhooks");
- return {Component: Webhooks.default};
+ return { Component: Webhooks.default };
}
}
]
@@ -477,32 +484,32 @@ export const router: RouteObject[] = [
loader: publicOrganizerRouteLoader,
async lazy() {
const PublicOrganizer = await import("./components/layouts/PublicOrganizer");
- return {Component: PublicOrganizer.default};
+ return { Component: PublicOrganizer.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
},
{
path: "/events/:organizerId/:organizerSlug/past-events",
loader: publicOrganizerRouteLoader,
async lazy() {
const PublicOrganizer = await import("./components/layouts/PublicOrganizer");
- return {Component: PublicOrganizer.default};
+ return { Component: PublicOrganizer.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
},
{
path: "/e/:eventId/:eventSlug",
async lazy() {
const EventHomepage = await import("./components/layouts/EventHomepage");
- return {Component: EventHomepage.default};
+ return { Component: EventHomepage.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
},
{
path: "/event/:eventId/preview",
async lazy() {
const EventHomepagePreview = await import("./components/layouts/EventHomepagePreview");
- return {Component: EventHomepagePreview.default};
+ return { Component: EventHomepagePreview.default };
},
},
{
@@ -510,7 +517,7 @@ export const router: RouteObject[] = [
loader: organizerPreviewRouteLoader,
async lazy() {
const OrganizerHomepagePreview = await import("./components/layouts/OrganizerHomepagePreview");
- return {Component: OrganizerHomepagePreview.default};
+ return { Component: OrganizerHomepagePreview.default };
},
},
{
@@ -518,52 +525,52 @@ export const router: RouteObject[] = [
loader: publicEventRouteLoader,
async lazy() {
const PublicEvent = await import("./components/layouts/PublicEvent");
- return {Component: PublicEvent.default};
+ return { Component: PublicEvent.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
},
{
path: "/widget/:eventId",
async lazy() {
const ProductWidget = await import("./components/layouts/ProductWidget");
- return {Component: ProductWidget.default};
+ return { Component: ProductWidget.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
},
{
path: "/checkout/:eventId",
async lazy() {
const Checkout = await import("./components/layouts/Checkout");
- return {Component: Checkout.default};
+ return { Component: Checkout.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
children: [
{
path: ":orderShortId/details",
async lazy() {
const CollectInformation = await import("./components/routes/product-widget/CollectInformation");
- return {Component: CollectInformation.default};
+ return { Component: CollectInformation.default };
}
},
{
path: ":orderShortId/payment",
async lazy() {
const Payment = await import("./components/routes/product-widget/Payment");
- return {Component: Payment.default};
+ return { Component: Payment.default };
}
},
{
path: ":orderShortId/summary",
async lazy() {
const OrderSummaryAndProducts = await import("./components/routes/product-widget/OrderSummaryAndProducts");
- return {Component: OrderSummaryAndProducts.default};
+ return { Component: OrderSummaryAndProducts.default };
}
},
{
path: ":orderShortId/payment_return",
async lazy() {
const PaymentReturn = await import("./components/routes/product-widget/PaymentReturn");
- return {Component: PaymentReturn.default};
+ return { Component: PaymentReturn.default };
}
},
]
@@ -572,49 +579,49 @@ export const router: RouteObject[] = [
path: "/order/:eventId/:orderShortId/print",
async lazy() {
const PrintOrder = await import("./components/routes/product-widget/PrintOrder");
- return {Component: PrintOrder.default};
+ return { Component: PrintOrder.default };
},
- errorElement: <ErrorPage/>
+ errorElement: <ErrorPage />
},
{
path: "/product/:eventId/:attendeeShortId/print",
async lazy() {
const PrintProduct = await import("./components/routes/product-widget/PrintProduct");
- return {Component: PrintProduct.default};
+ return { Component: PrintProduct.default };
},
- errorElement: <ErrorPage/>
+ errorElement: <ErrorPage />
},
{
path: "/manage/event/:eventId/ticket-designer/print",
async lazy() {
const TicketDesignerPrint = await import("./components/routes/event/TicketDesigner/TicketDesignerPrint");
- return {Component: TicketDesignerPrint.default};
+ return { Component: TicketDesignerPrint.default };
},
- errorElement: <ErrorPage/>
+ errorElement: <ErrorPage />
},
{
path: "/product/:eventId/:attendeeShortId",
async lazy() {
const AttendeeProductAndInformation = await import("./components/routes/product-widget/AttendeeProductAndInformation");
- return {Component: AttendeeProductAndInformation.default};
+ return { Component: AttendeeProductAndInformation.default };
},
- errorElement: <ErrorPage/>
+ errorElement: <ErrorPage />
},
{
path: "/check-in/:checkInListShortId",
async lazy() {
const CheckIn = await import("./components/layouts/CheckIn");
- return {Component: CheckIn.default};
+ return { Component: CheckIn.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
},
{
path: "/my-tickets/:token",
async lazy() {
const MyTickets = await import("./components/routes/my-tickets");
- return {Component: MyTickets.default};
+ return { Component: MyTickets.default };
},
- errorElement: <ErrorPage/>,
+ errorElement: <ErrorPage />,
}
];