@abyss-project/commons-front-core 18.1.5 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/catalog/pages/DeliveryHistory.tsx +142 -79
  3. package/catalog/pages/DeliverySubscriptions.tsx +127 -127
  4. package/catalog/pages/ScheduledTasks.tsx +117 -117
  5. package/catalog/specs/captures.spec.ts +145 -145
  6. package/catalog/specs/write-capture-index.ts +81 -81
  7. package/dist/{CookieConsentSettings-D97TY138.js → CookieConsentSettings-iQ9XTosT.js} +1 -1
  8. package/dist/{Surface-CN1zQYLJ.js → Surface-DmHRzUtQ.js} +437 -169
  9. package/dist/{Tabs-CxD9y18t.js → Tabs-CxBeR0D-.js} +672 -665
  10. package/dist/components/business/Deliveries/ArchiveBodyNotes.d.ts +14 -0
  11. package/dist/components/business/Deliveries/ArchiveDialogs.d.ts +42 -0
  12. package/dist/components/business/Deliveries/DeliveryArchive.component.d.ts +19 -0
  13. package/dist/components/business/Deliveries/DeliveryArchive.component.spec.d.ts +1 -0
  14. package/dist/components/business/Deliveries/archive.logic.d.ts +122 -0
  15. package/dist/components/business/Deliveries/archive.logic.spec.d.ts +1 -0
  16. package/dist/components/business/Deliveries/deliveries.types.d.ts +30 -1
  17. package/dist/components/business/Deliveries/test-support/archive-actions.d.ts +3 -0
  18. package/dist/components/business/Deliveries/test-support/deliveries.fixtures.d.ts +18 -1
  19. package/dist/components/business/Deliveries/use-loaded.hook.d.ts +20 -0
  20. package/dist/components/data/DataTable/DataTableDesktop.d.ts +1 -1
  21. package/dist/components/data/DataTable/data-table.types.d.ts +5 -0
  22. package/dist/components/data/FacetPanel/FacetPanel.d.ts +3 -0
  23. package/dist/components/inputs/SegmentedControl/SegmentedControl.d.ts +8 -2
  24. package/dist/cookie-consent.js +2 -2
  25. package/dist/{design-theme-GGVSCauN.js → design-theme--v6CDR8w.js} +1 -1
  26. package/dist/{editors-BRtoE-Cn.js → editors-BmRsTu0H.js} +27 -27
  27. package/dist/editors.js +1 -1
  28. package/dist/hooks/use-rich-intl.hook.d.ts +284 -16
  29. package/dist/{index-CgkFRcYO.js → index-BAH9H4GE.js} +3 -3
  30. package/dist/{index-55MhbV8A.js → index-BGAmhhJZ.js} +2 -2
  31. package/dist/{index-BgAY2Bpn.js → index-BTwuilx5.js} +3 -3
  32. package/dist/{index-lORwPFbG.js → index-Buo7Iim6.js} +4 -4
  33. package/dist/{index-JUTxkZGl.js → index-BwugEq4x.js} +2 -2
  34. package/dist/{index-Dq2PY8Hf.js → index-CI0SMeOa.js} +2 -2
  35. package/dist/{index-CVroXVVA.js → index-CJjWI7qL.js} +3 -3
  36. package/dist/{index-BcqlvUH-.js → index-CSl9Kc0V.js} +2 -2
  37. package/dist/{index-q5HxJPvO.js → index-ChCpWPzk.js} +4 -4
  38. package/dist/{index-BnrtBuyz.js → index-ClEFydIA.js} +2 -2
  39. package/dist/{index-VycSBSHm.js → index-CsZJyqSF.js} +2 -2
  40. package/dist/{index-f3rEzQD4.js → index-Cv8TWKKk.js} +2 -2
  41. package/dist/{index-4vozr_pR.js → index-DLIvsZA_.js} +2 -2
  42. package/dist/{index-m8hFXXte.js → index-DVyE9B4I.js} +2 -2
  43. package/dist/{index-BYjWj9Ll.js → index-DYdLhNjl.js} +3 -3
  44. package/dist/{index-0DnqWmbq.js → index-Dco3zEwV.js} +2 -2
  45. package/dist/{index-CoXRWuEB.js → index-DnweGlM_.js} +2 -2
  46. package/dist/{index-7GZ8XIqj.js → index-DsxBk5OJ.js} +1 -1
  47. package/dist/{index-BAt93dsR.js → index-DuLb3GSj.js} +4 -4
  48. package/dist/{index-zQdz10Oj.js → index-RjzeFVe-.js} +2 -2
  49. package/dist/{index-oZ7WObJR.js → index-ZL-d1iKb.js} +2 -2
  50. package/dist/index.js +10375 -9460
  51. package/dist/legacy/components/Chips/index.d.ts +0 -2
  52. package/dist/legacy.js +1235 -1258
  53. package/dist/translations/en.d.ts +134 -0
  54. package/dist/translations/fr.d.ts +134 -0
  55. package/package.json +6 -6
  56. package/dist/legacy/components/Chips/ApplicationWebhookTypeChip/ApplicationWebhookTypeChip.component.d.ts +0 -7
  57. package/dist/legacy/components/Chips/ApplicationWebhookTypeChip/index.d.ts +0 -1
  58. package/dist/legacy/components/Chips/WebhookTypeChip/WebhookTypeChip.component.d.ts +0 -7
  59. package/dist/legacy/components/Chips/WebhookTypeChip/index.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog — @abyss-project/commons-front-core
2
2
 
3
+ ## 20.0.0
4
+
5
+ Major: `DeliveryHistory` gets required props and a new required action (card #792, P5 L2b: the archive of the delivery history). A host that mounts it must pass them; peer `@abyss-project/flow` ^1.5.0.
6
+
7
+ - `DeliveryHistory`: new required props `canManageArchive` and `canPurgeArchive`, and a new required action `archive` (list of the archived days, rehydrations, estimate, rehydrate, extend, release, purge). The toolbar opens an « Archive » section, a delivery whose body is archived says so with « Remettre en ligne », and a rehydrated row carries a chip with the end of its lease.
8
+ - `DeliveryHistory`: « Rejouer » stays visible and disabled, with its reason, on a delivery of 30 days or more, whose body is archived or comes from a rehydration. A disabled outlined `ActionButton` is drawn apart (dashed border, lowered opacity) because the theme keeps the border and the background of an enabled one.
9
+ - `DeliverySubscriptions` and `ScheduledTasks`: deleting one says its deliveries and archive are erased for good; a 502 of the deletion says part of the archive is already deleted and to repeat the deletion.
10
+ - Archive section: the archived days and their range are written in the viewer's language, read in UTC. The refusal of a purge that lost the archive midway (502) says the deletion is partial and to repeat it. Skipped days read « encore en ligne (30 derniers jours) » or « rien d'archivé ce jour-là ».
11
+
12
+ ## 19.0.0
13
+
14
+ Major: `WebhookTypeChip` and `ApplicationWebhookTypeChip` leave `./legacy` (card #792). No satellite imports them. 18.1.6 was never published.
15
+
16
+ Card #286 (global review of AbyssMain, lot 1, lot A).
17
+
18
+ - `DataTable`: from 768 px, a table wider than its frame fades the end of the frame (mask, 32 px) while columns are left beyond its right edge, and the frame carries `data-overflowing`; it used to cut a column at the edge with no sign that the table scrolls. A table that fits is unchanged.
19
+ - `DateRangeField`: below 768 px, a preset keeps its 24 px drawing but its tap target is 44 px high (an invisible extension above and below it); the rows of presets are spaced so the targets do not overlap.
20
+
21
+ Card #286 (global review, lot 1, lot B).
22
+
23
+ - `SegmentedControl`: new optional `wrap`, the band wraps onto more rows at every width, as it does below 768 px, instead of scrolling sideways under a fade. Without it, nothing changes.
24
+ - `Section`: its `actions` can shrink to the width of the section, so a row of actions that wraps no longer runs past the edge of a phone (a header with three buttons at 390 px). Actions that fit are unchanged.
25
+
26
+ Card #286 (global review, lot 1, lot C).
27
+
28
+ - `FacetPanel`: new optional `label` on a facet value, what the reader sees (`Ouvert` for `OPEN`); the checkbox, its title and « Exclure » use it, while the expression still gets `value`. Without it, the value is shown as before.
29
+
30
+ Card #691.
31
+
32
+ - Translations: « Sonde Monitor » / « Monitor probe » for the billed metric's label.
33
+
34
+ Card #792 (P5, L2) and card #692.
35
+
36
+ - **Removed exports** `WebhookTypeChip` and `ApplicationWebhookTypeChip` (legacy chips): the webhook screens now live in `DeliverySubscriptions`. A host that imports them must drop the import.
37
+ - Dependencies: `@abyss-project/storage` goes to `^5.1.0` and the dev dependency `@abyss-project/flow` to `^1.4.0`.
38
+ - `DeliverySubscriptions`: the note « Les événements proposés dépendent de la source » is no longer drawn when the host offers a single source (Probe, Extract): there is nothing to depend on.
39
+ - `DataTable`: new optional `renderExpanded(row)`, what unfolds directly under a row from 768 px up, across all its columns. Without it, a table renders as before.
40
+
3
41
  ## 18.1.5
4
42
 
5
43
  Card #286. 18.1.4 made a consumer's main bundle heavier: 970 KB gzipped on Spotlight.
@@ -1,79 +1,142 @@
1
- import { DeliveryHistory } from '../../src/components/business/Deliveries/DeliveryHistory.component';
2
- import type { DeliveryHistoryProps } from '../../src/components/business/Deliveries/deliveries.types';
3
- import {
4
- delivery,
5
- deliveryStatus,
6
- failedDelivery,
7
- page,
8
- subscription,
9
- } from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
10
- import { Example, LastEvent, Showcase, useEventLog } from '../frame';
11
-
12
- const POPULATED = [
13
- delivery(),
14
- failedDelivery(),
15
- delivery({
16
- id: 'delivery-3',
17
- eventKey: 'event-3',
18
- deliveryId: 'sub-1:event-3',
19
- status: deliveryStatus('RETRYING'),
20
- attemptCount: 2,
21
- lastResponseCode: 502,
22
- lastResponseBody: null,
23
- lastError: 'HTTP 502',
24
- deliveredAt: null,
25
- nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
26
- }),
27
- ];
28
-
29
- export const DeliveryHistoryPage = () => {
30
- const { log } = useEventLog();
31
- const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
32
- list,
33
- get: async (id) => POPULATED.find((row) => row.id === id) ?? delivery(),
34
- replayDelivery: async (id) => log(`rejouer ${id}`),
35
- canReplay: true,
36
- getSubscription: async () =>
37
- subscription({
38
- url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
39
- eventTypes: ['MONITOR_EVENT', 'MONITOR_SENTINEL'],
40
- }),
41
- flowUrl: 'https://flow.abyss.example/deliveries',
42
- });
43
- return (
44
- <Showcase
45
- family="Métier"
46
- name="DeliveryHistory"
47
- description="L'historique des livraisons d'un abonnement (URL et événements sous le titre) : filtre de statut, détail en panneau (données de l'événement, en-têtes envoyés, réponse, déroulé) et rejeu d'une livraison terminée."
48
- >
49
- <Example title="Peuplé" maxWidth={1100}>
50
- <DeliveryHistory {...base(async () => page(POPULATED))} />
51
- </Example>
52
- <Example title="Vide" maxWidth={1100}>
53
- <DeliveryHistory {...base(async () => page([]))} />
54
- </Example>
55
- <Example title="En cours de chargement" maxWidth={1100}>
56
- <DeliveryHistory {...base(() => new Promise(() => undefined))} />
57
- </Example>
58
- <Example title="Le chargement a échoué" maxWidth={1100}>
59
- <DeliveryHistory
60
- {...base(() => Promise.reject(new Error('Flow indisponible')))}
61
- />
62
- </Example>
63
- <Example title="Sans abonnement ni lien vers Flow" maxWidth={1100}>
64
- <DeliveryHistory
65
- {...base(async () => page(POPULATED))}
66
- getSubscription={undefined}
67
- flowUrl={undefined}
68
- />
69
- </Example>
70
- <Example title="Sans droit de rejeu" maxWidth={1100}>
71
- <DeliveryHistory
72
- {...base(async () => page(POPULATED))}
73
- canReplay={false}
74
- />
75
- </Example>
76
- <LastEvent />
77
- </Showcase>
78
- );
79
- };
1
+ import { DeliveryHistory } from '../../src/components/business/Deliveries/DeliveryHistory.component';
2
+ import type {
3
+ DeliveryArchiveActions,
4
+ DeliveryHistoryProps,
5
+ } from '../../src/components/business/Deliveries/deliveries.types';
6
+ import {
7
+ archivedDay,
8
+ archivedDelivery,
9
+ daysAgo,
10
+ delivery,
11
+ deliveryStatus,
12
+ failedDelivery,
13
+ page,
14
+ rehydratedDelivery,
15
+ rehydrationJob,
16
+ subscription,
17
+ } from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
18
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
19
+
20
+ const POPULATED = [
21
+ delivery(),
22
+ failedDelivery(),
23
+ delivery({
24
+ id: 'delivery-3',
25
+ eventKey: 'event-3',
26
+ deliveryId: 'sub-1:event-3',
27
+ status: deliveryStatus('RETRYING'),
28
+ attemptCount: 2,
29
+ lastResponseCode: 502,
30
+ lastResponseBody: null,
31
+ lastError: 'HTTP 502',
32
+ deliveredAt: null,
33
+ nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
34
+ }),
35
+ ];
36
+
37
+ /** Past 30 days: one row archived, one brought back online. */
38
+ const WITH_ARCHIVE = [...POPULATED, archivedDelivery(), rehydratedDelivery()];
39
+
40
+ const ARCHIVE_JOB = rehydrationJob({
41
+ rangeStart: daysAgo(41),
42
+ rangeEnd: daysAgo(39),
43
+ effectiveExpiresAt: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
44
+ });
45
+
46
+ export const DeliveryHistoryPage = () => {
47
+ const { log } = useEventLog();
48
+ const archive: DeliveryArchiveActions = {
49
+ listDays: async () => [
50
+ archivedDay({ dayValue: '2026-09-20' }),
51
+ archivedDay({ dayValue: '2026-09-21', rowCount: 42 }),
52
+ ],
53
+ listRehydrations: async () => ({ jobs: [ARCHIVE_JOB], truncated: false }),
54
+ estimate: async () => ({
55
+ admittedDays: ['2026-09-20'],
56
+ archiveBytes: 3 * 1024 * 1024,
57
+ expectedRows: 128,
58
+ skippedDays: [],
59
+ maxLeaseDays: 30,
60
+ }),
61
+ rehydrate: async (body) => {
62
+ log(`remettre en ligne ${body.rangeStart} - ${body.rangeEnd}`);
63
+ return { job: ARCHIVE_JOB, skippedDays: [] };
64
+ },
65
+ extend: async (jobId) => {
66
+ log(`prolonger ${jobId}`);
67
+ return ARCHIVE_JOB;
68
+ },
69
+ release: async (jobId) => {
70
+ log(`libérer ${jobId}`);
71
+ return ARCHIVE_JOB;
72
+ },
73
+ purge: async (body) => {
74
+ log(`supprimer de l'archive ${body.from} - ${body.to}`);
75
+ return { purgedDays: [body.from], deletedRows: 0, releasedJobs: 0 };
76
+ },
77
+ };
78
+ const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
79
+ list,
80
+ get: async (id) => WITH_ARCHIVE.find((row) => row.id === id) ?? delivery(),
81
+ replayDelivery: async (id) => log(`rejouer ${id}`),
82
+ canReplay: true,
83
+ archive,
84
+ canManageArchive: true,
85
+ canPurgeArchive: true,
86
+ getSubscription: async () =>
87
+ subscription({
88
+ url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
89
+ eventTypes: ['MONITOR_EVENT', 'MONITOR_SENTINEL'],
90
+ }),
91
+ flowUrl: 'https://flow.abyss.example/deliveries',
92
+ });
93
+ return (
94
+ <Showcase
95
+ family="Métier"
96
+ name="DeliveryHistory"
97
+ description="L'historique des livraisons d'un abonnement (URL et événements sous le titre) : filtre de statut, détail en panneau (données de l'événement, en-têtes envoyés, réponse, déroulé), rejeu d'une livraison terminée (refusé au-delà de 30 jours) et section Archive : jours archivés, remises en ligne, suppression."
98
+ >
99
+ <Example title="Peuplé" maxWidth={1100}>
100
+ <DeliveryHistory {...base(async () => page(POPULATED))} />
101
+ </Example>
102
+ <Example
103
+ title="Avec une livraison archivée et une remise en ligne"
104
+ maxWidth={1100}
105
+ >
106
+ <DeliveryHistory {...base(async () => page(WITH_ARCHIVE))} />
107
+ </Example>
108
+ <Example title="Archive en lecture seule" maxWidth={1100}>
109
+ <DeliveryHistory
110
+ {...base(async () => page(WITH_ARCHIVE))}
111
+ canManageArchive={false}
112
+ canPurgeArchive={false}
113
+ />
114
+ </Example>
115
+ <Example title="Vide" maxWidth={1100}>
116
+ <DeliveryHistory {...base(async () => page([]))} />
117
+ </Example>
118
+ <Example title="En cours de chargement" maxWidth={1100}>
119
+ <DeliveryHistory {...base(() => new Promise(() => undefined))} />
120
+ </Example>
121
+ <Example title="Le chargement a échoué" maxWidth={1100}>
122
+ <DeliveryHistory
123
+ {...base(() => Promise.reject(new Error('Flow indisponible')))}
124
+ />
125
+ </Example>
126
+ <Example title="Sans abonnement ni lien vers Flow" maxWidth={1100}>
127
+ <DeliveryHistory
128
+ {...base(async () => page(POPULATED))}
129
+ getSubscription={undefined}
130
+ flowUrl={undefined}
131
+ />
132
+ </Example>
133
+ <Example title="Sans droit de rejeu" maxWidth={1100}>
134
+ <DeliveryHistory
135
+ {...base(async () => page(POPULATED))}
136
+ canReplay={false}
137
+ />
138
+ </Example>
139
+ <LastEvent />
140
+ </Showcase>
141
+ );
142
+ };
@@ -1,127 +1,127 @@
1
- import { DeliverySubscriptions } from '../../src/components/business/Deliveries/DeliverySubscriptions.component';
2
- import type { DeliverySubscriptionsProps } from '../../src/components/business/Deliveries/deliveries.types';
3
- import {
4
- EVENT_TYPES_BY_SOURCE,
5
- SOURCES,
6
- deliveryFormat,
7
- page,
8
- source,
9
- subscription,
10
- } from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
11
- import { Example, LastEvent, Showcase, useEventLog } from '../frame';
12
-
13
- const PERMISSIONS = {
14
- canCreate: true,
15
- canUpdate: true,
16
- canDelete: true,
17
- canResetSecret: true,
18
- canReadHistory: true,
19
- };
20
-
21
- const POPULATED = [
22
- subscription(),
23
- subscription({
24
- id: 'sub-2',
25
- source: source('FORM'),
26
- eventTypes: ['FORM_SUBMISSION'],
27
- url: 'https://discord.com/api/webhooks/1234/abcd',
28
- format: deliveryFormat('DISCORD'),
29
- consecutiveFailures: 3,
30
- }),
31
- subscription({
32
- id: 'sub-3',
33
- source: source('STORAGE'),
34
- eventTypes: ['STORAGE_UPLOAD', 'STORAGE_DELETE'],
35
- url: 'https://files.example.com/hooks/storage',
36
- isEnabled: false,
37
- disabledAt: new Date('2026-11-02T08:00:00Z'),
38
- consecutiveFailures: 10,
39
- }),
40
- ];
41
-
42
- const secretFor = (id: string) => `whsec_catalog_${id}_do-not-use`;
43
-
44
- export const DeliverySubscriptionsPage = () => {
45
- const { log } = useEventLog();
46
- const base = (
47
- list: DeliverySubscriptionsProps['list'],
48
- ): DeliverySubscriptionsProps => ({
49
- sources: SOURCES,
50
- eventTypesBySource: EVENT_TYPES_BY_SOURCE,
51
- list,
52
- create: async (body) => {
53
- log(`créer ${body.url}`);
54
- return {
55
- deliverySubscription: subscription({ id: 'sub-new', url: body.url }),
56
- secret: secretFor('new'),
57
- };
58
- },
59
- update: async (id, body) => {
60
- log(`modifier ${id}`);
61
- return subscription({ id, ...body });
62
- },
63
- remove: async (id) => log(`supprimer ${id}`),
64
- resetSecret: async (id) => {
65
- log(`secret ${id}`);
66
- return {
67
- deliverySubscription: subscription({ id }),
68
- secret: secretFor(id),
69
- };
70
- },
71
- onOpenHistory: (row) => log(`historique ${row.id}`),
72
- flowUrl: 'https://flow.abyss.example/deliveries',
73
- permissions: PERMISSIONS,
74
- });
75
- return (
76
- <Showcase
77
- family="Métier"
78
- name="DeliverySubscriptions"
79
- description="Les abonnements de livraison d'un périmètre : liste, création et édition en panneau, secret affiché une seule fois, activation, suppression confirmée. Les données et les actions passent par des props."
80
- >
81
- <Example title="Peuplé" maxWidth={1100}>
82
- <DeliverySubscriptions {...base(async () => page(POPULATED))} />
83
- </Example>
84
- <Example title="Une seule source, sans lien vers Flow" maxWidth={1100}>
85
- <DeliverySubscriptions
86
- {...base(async () =>
87
- page([
88
- subscription({
89
- url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
90
- }),
91
- subscription({
92
- id: 'sub-4',
93
- url: 'https://ops.example.com/webhooks/abyss/monitor-events/staging',
94
- }),
95
- ]),
96
- )}
97
- sources={[source('MONITOR')]}
98
- flowUrl={undefined}
99
- />
100
- </Example>
101
- <Example title="Vide" maxWidth={1100}>
102
- <DeliverySubscriptions {...base(async () => page([]))} />
103
- </Example>
104
- <Example title="En cours de chargement" maxWidth={1100}>
105
- <DeliverySubscriptions {...base(() => new Promise(() => undefined))} />
106
- </Example>
107
- <Example title="Le chargement a échoué" maxWidth={1100}>
108
- <DeliverySubscriptions
109
- {...base(() => Promise.reject(new Error('Flow indisponible')))}
110
- />
111
- </Example>
112
- <Example title="Lecture seule" maxWidth={1100}>
113
- <DeliverySubscriptions
114
- {...base(async () => page(POPULATED))}
115
- permissions={{
116
- canCreate: false,
117
- canUpdate: false,
118
- canDelete: false,
119
- canResetSecret: false,
120
- canReadHistory: true,
121
- }}
122
- />
123
- </Example>
124
- <LastEvent />
125
- </Showcase>
126
- );
127
- };
1
+ import { DeliverySubscriptions } from '../../src/components/business/Deliveries/DeliverySubscriptions.component';
2
+ import type { DeliverySubscriptionsProps } from '../../src/components/business/Deliveries/deliveries.types';
3
+ import {
4
+ EVENT_TYPES_BY_SOURCE,
5
+ SOURCES,
6
+ deliveryFormat,
7
+ page,
8
+ source,
9
+ subscription,
10
+ } from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
11
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
12
+
13
+ const PERMISSIONS = {
14
+ canCreate: true,
15
+ canUpdate: true,
16
+ canDelete: true,
17
+ canResetSecret: true,
18
+ canReadHistory: true,
19
+ };
20
+
21
+ const POPULATED = [
22
+ subscription(),
23
+ subscription({
24
+ id: 'sub-2',
25
+ source: source('FORM'),
26
+ eventTypes: ['FORM_SUBMISSION'],
27
+ url: 'https://discord.com/api/webhooks/1234/abcd',
28
+ format: deliveryFormat('DISCORD'),
29
+ consecutiveFailures: 3,
30
+ }),
31
+ subscription({
32
+ id: 'sub-3',
33
+ source: source('STORAGE'),
34
+ eventTypes: ['STORAGE_UPLOAD', 'STORAGE_DELETE'],
35
+ url: 'https://files.example.com/hooks/storage',
36
+ isEnabled: false,
37
+ disabledAt: new Date('2026-11-02T08:00:00Z'),
38
+ consecutiveFailures: 10,
39
+ }),
40
+ ];
41
+
42
+ const secretFor = (id: string) => `whsec_catalog_${id}_do-not-use`;
43
+
44
+ export const DeliverySubscriptionsPage = () => {
45
+ const { log } = useEventLog();
46
+ const base = (
47
+ list: DeliverySubscriptionsProps['list'],
48
+ ): DeliverySubscriptionsProps => ({
49
+ sources: SOURCES,
50
+ eventTypesBySource: EVENT_TYPES_BY_SOURCE,
51
+ list,
52
+ create: async (body) => {
53
+ log(`créer ${body.url}`);
54
+ return {
55
+ deliverySubscription: subscription({ id: 'sub-new', url: body.url }),
56
+ secret: secretFor('new'),
57
+ };
58
+ },
59
+ update: async (id, body) => {
60
+ log(`modifier ${id}`);
61
+ return subscription({ id, ...body });
62
+ },
63
+ remove: async (id) => log(`supprimer ${id}`),
64
+ resetSecret: async (id) => {
65
+ log(`secret ${id}`);
66
+ return {
67
+ deliverySubscription: subscription({ id }),
68
+ secret: secretFor(id),
69
+ };
70
+ },
71
+ onOpenHistory: (row) => log(`historique ${row.id}`),
72
+ flowUrl: 'https://flow.abyss.example/deliveries',
73
+ permissions: PERMISSIONS,
74
+ });
75
+ return (
76
+ <Showcase
77
+ family="Métier"
78
+ name="DeliverySubscriptions"
79
+ description="Les abonnements de livraison d'un périmètre : liste, création et édition en panneau, secret affiché une seule fois, activation, suppression confirmée. Les données et les actions passent par des props."
80
+ >
81
+ <Example title="Peuplé" maxWidth={1100}>
82
+ <DeliverySubscriptions {...base(async () => page(POPULATED))} />
83
+ </Example>
84
+ <Example title="Une seule source, sans lien vers Flow" maxWidth={1100}>
85
+ <DeliverySubscriptions
86
+ {...base(async () =>
87
+ page([
88
+ subscription({
89
+ url: 'https://ops.example.com/webhooks/abyss/monitor-events/production',
90
+ }),
91
+ subscription({
92
+ id: 'sub-4',
93
+ url: 'https://ops.example.com/webhooks/abyss/monitor-events/staging',
94
+ }),
95
+ ]),
96
+ )}
97
+ sources={[source('MONITOR')]}
98
+ flowUrl={undefined}
99
+ />
100
+ </Example>
101
+ <Example title="Vide" maxWidth={1100}>
102
+ <DeliverySubscriptions {...base(async () => page([]))} />
103
+ </Example>
104
+ <Example title="En cours de chargement" maxWidth={1100}>
105
+ <DeliverySubscriptions {...base(() => new Promise(() => undefined))} />
106
+ </Example>
107
+ <Example title="Le chargement a échoué" maxWidth={1100}>
108
+ <DeliverySubscriptions
109
+ {...base(() => Promise.reject(new Error('Flow indisponible')))}
110
+ />
111
+ </Example>
112
+ <Example title="Lecture seule" maxWidth={1100}>
113
+ <DeliverySubscriptions
114
+ {...base(async () => page(POPULATED))}
115
+ permissions={{
116
+ canCreate: false,
117
+ canUpdate: false,
118
+ canDelete: false,
119
+ canResetSecret: false,
120
+ canReadHistory: true,
121
+ }}
122
+ />
123
+ </Example>
124
+ <LastEvent />
125
+ </Showcase>
126
+ );
127
+ };