@abyss-project/commons-front-core 20.0.0 → 20.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/catalog/catalog-entries.ts +3 -0
- package/catalog/pages/DeliveryHistory.tsx +142 -142
- package/catalog/pages/DeliverySubscriptions.tsx +127 -127
- package/catalog/pages/QuotaReachedDialog.tsx +38 -0
- package/catalog/pages/ScheduledTasks.tsx +117 -117
- package/catalog/pages/Toolbar.tsx +3 -0
- package/catalog/pages/index.ts +2 -0
- package/catalog/specs/captures.spec.ts +145 -145
- package/catalog/specs/write-capture-index.ts +81 -81
- package/dist/components/business/QuotaReachedDialog/QuotaReachedDialog.d.ts +13 -0
- package/dist/components/business/QuotaReachedDialog/QuotaReachedDialog.spec.d.ts +1 -0
- package/dist/components/business/index.d.ts +1 -0
- package/dist/components/inputs/CopyField/CopyField.d.ts +6 -1
- package/dist/{design-theme--v6CDR8w.js → design-theme-HWymeGb7.js} +3396 -3396
- package/dist/index.js +4940 -4830
- package/dist/legacy.js +2 -2
- package/package.json +1 -1
- package/test-results/catalog/.last-run.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog — @abyss-project/commons-front-core
|
|
2
2
|
|
|
3
|
+
## 20.2.0
|
|
4
|
+
|
|
5
|
+
Card #286 (satellites, S1).
|
|
6
|
+
|
|
7
|
+
- `QuotaReachedDialog` at the root (`components/business`): the « Limite atteinte » dialog on `Modal` (`Small`, bottom sheet below 768 px), driven by the root `useQuotaDialogStore` and the `quota-reached.*` keys. The blocked service is a neutral `StatusBadge`, the metric is in the header description, the hint is a warning `Callout`. Same contract as the `/legacy` one: optional `onUpgrade`, called after `hide`; without it there is no upgrade button. The `/legacy` homonym stays: `codemod-legacy-imports.mjs` keeps the name in `LEGACY_NAMES` and sends its imports to `/legacy`, an application moves to the root dialog by hand.
|
|
8
|
+
|
|
9
|
+
## 20.1.0
|
|
10
|
+
|
|
11
|
+
Card #286 (global review, lot 2).
|
|
12
|
+
|
|
13
|
+
- `UsageMeter`: the figures wrap between the value and the ceiling instead of running past a narrow card; each number stays whole.
|
|
14
|
+
- `ComboboxField`: below 768 px, the right padding of the input makes room for the 44 px clear and open buttons (it kept MUI's 26 px per button), so a long value no longer runs under the clear button; from 768 px nothing changes.
|
|
15
|
+
- `SupportTicketList`: the admin view fits its columns in the frame of a 1440 px page, the last one is no longer cut. The category column is 176 px and its pill is bounded to the cell: a label that does not fit (« Demande de fonctionnalité ») ends in an ellipsis and carries its full label as a `title`, so the ticket title keeps at least 176 px there, about 20 characters.
|
|
16
|
+
- `CopyField`: new optional `wrapOnPhone`, below 768 px the shown value wraps onto as many lines as it needs instead of being cut by an ellipsis. Without it, nothing changes.
|
|
17
|
+
- Theme, `Button` `outlined`: a disabled one takes the same raised fill, subtle border and muted text as a disabled `contained` button, in both themes; it used to differ from an active one by its border and text color only.
|
|
18
|
+
|
|
3
19
|
## 20.0.0
|
|
4
20
|
|
|
5
21
|
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.
|
|
@@ -104,6 +104,9 @@ export const CATALOG_ENTRIES: CatalogEntry[] = [
|
|
|
104
104
|
mobileCapture: true,
|
|
105
105
|
}),
|
|
106
106
|
entry('QRCodeModal', 'business', 'qr-code-modal', { mobileCapture: true }),
|
|
107
|
+
entry('QuotaReachedDialog', 'business', 'quota-reached-dialog', {
|
|
108
|
+
mobileCapture: true,
|
|
109
|
+
}),
|
|
107
110
|
entry('CookieConsent', 'business', 'cookie-consent', {
|
|
108
111
|
mobileCapture: true,
|
|
109
112
|
}),
|
|
@@ -1,142 +1,142 @@
|
|
|
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
|
+
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
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import Button from '@mui/material/Button';
|
|
3
|
+
import { BillingMetric, BillingService } from '@abyss-project/main';
|
|
4
|
+
import { QuotaReachedDialog } from '../../src/components/business/QuotaReachedDialog/QuotaReachedDialog';
|
|
5
|
+
import { useQuotaDialogStore } from '../../src/hooks/quota-dialog.store';
|
|
6
|
+
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
7
|
+
|
|
8
|
+
const showCryptQuota = () =>
|
|
9
|
+
useQuotaDialogStore.getState().show({
|
|
10
|
+
metric: BillingMetric.CRYPT_ENCRYPTIONS_MONTH,
|
|
11
|
+
service: BillingService.ABYSS_CRYPT,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const QuotaReachedDialogPage = () => {
|
|
15
|
+
const { log } = useEventLog();
|
|
16
|
+
|
|
17
|
+
// Opened on arrival, as the billing-quota interceptor would, so the captures show the dialog.
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
showCryptQuota();
|
|
20
|
+
return () => useQuotaDialogStore.getState().hide();
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Showcase
|
|
25
|
+
family="Métier"
|
|
26
|
+
name="QuotaReachedDialog"
|
|
27
|
+
description="Ouverte par l'intercepteur de quota : nomme le service et la métrique bloqués ; « Voir les plans » n'existe que si l'hôte passe onUpgrade."
|
|
28
|
+
>
|
|
29
|
+
<Example title="Chiffrements / mois, AbyssCrypt">
|
|
30
|
+
<Button variant="outlined" onClick={showCryptQuota}>
|
|
31
|
+
Chiffrer un fichier
|
|
32
|
+
</Button>
|
|
33
|
+
</Example>
|
|
34
|
+
<LastEvent />
|
|
35
|
+
<QuotaReachedDialog onUpgrade={() => log('voir les plans')} />
|
|
36
|
+
</Showcase>
|
|
37
|
+
);
|
|
38
|
+
};
|