@abyss-project/commons-front-core 17.2.0 → 18.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.
- package/CHANGELOG.md +26 -1
- package/README.md +2 -1
- package/catalog/captures-plan.ts +120 -116
- package/catalog/catalog-entries.ts +149 -148
- package/catalog/pages/AppShell.tsx +18 -9
- package/catalog/pages/CookieConsent.tsx +54 -31
- package/catalog/pages/DeliveryHistory.tsx +66 -66
- package/catalog/pages/DeliverySubscriptions.tsx +110 -110
- package/catalog/pages/ScheduledTasks.tsx +117 -117
- package/catalog/pages/index.ts +166 -165
- package/catalog/playwright.ci.config.ts +4 -3
- package/catalog/specs/captures.spec.ts +145 -145
- package/catalog/specs/cookie-consent-modal.spec.ts +187 -0
- package/catalog/specs/responsive.spec.ts +106 -0
- package/catalog/specs/write-capture-index.ts +81 -81
- package/dist/CookieConsentSettings-B7HIIzyI.js +595 -0
- package/dist/{Surface-BUxzLLhb.js → Surface-dziv23sf.js} +60 -53
- package/dist/{Tabs-D7TDtprO.js → Tabs-_onUZBA-.js} +613 -591
- package/dist/components/business/CookieConsent/AbyssCookieConsentProvider.d.ts +11 -3
- package/dist/components/business/CookieConsent/CookieConsentBanner.d.ts +4 -3
- package/dist/components/business/CookieConsent/CookieConsentPreferences.d.ts +12 -0
- package/dist/components/business/CookieConsent/index.d.ts +2 -0
- package/dist/components/business/CookieConsent/use-banner-portal.d.ts +36 -0
- package/dist/components/inputs/NumberField/NumberField.d.ts +18 -2
- package/dist/components/layers/Toast/toast-clearance.d.ts +5 -0
- package/dist/components/structure/AccountMenu/AccountMenu.d.ts +2 -1
- package/dist/components/structure/AppShell/SpaceSwitcher.d.ts +4 -2
- package/dist/components/structure/AppShell/app-shell.types.d.ts +5 -1
- package/dist/components/structure/FilterBar/FilterBar.d.ts +7 -2
- package/dist/cookie-consent.js +26 -17
- package/dist/{design-theme-Bc2sMuUP.js → design-theme-B3C3z1gE.js} +1 -1
- package/dist/{editors-CGj-vsZu.js → editors-BhQlONOy.js} +27 -27
- package/dist/editors.js +1 -1
- package/dist/hooks/use-cookie-consent.hook.spec.d.ts +1 -0
- package/dist/hooks/use-rich-intl.hook.d.ts +4 -0
- package/dist/{index-DOrEPYZN.js → index-B6LMTOKG.js} +3 -3
- package/dist/{index-853Jaoqw.js → index-B6w5_TeJ.js} +3 -3
- package/dist/{index-BVsU-XEb.js → index-BBF-FvT6.js} +2 -2
- package/dist/{index-5lpeThh7.js → index-BGAZK8Vk.js} +2 -2
- package/dist/{index-DKMFAW5f.js → index-BGJobvxw.js} +1 -1
- package/dist/{index-DvrKcy8f.js → index-BTDlbjWW.js} +2 -2
- package/dist/{index-DrgdyC6J.js → index-BcjlG5TB.js} +2 -2
- package/dist/{index-CNfYiPB9.js → index-BeMiREqf.js} +2 -2
- package/dist/{index-YX_yu3BN.js → index-ByN6DcaL.js} +2 -2
- package/dist/{index-_3uQ1KPn.js → index-CJI1dJrw.js} +3 -3
- package/dist/{index-BISOeVc7.js → index-D1mQgWN3.js} +2 -2
- package/dist/{index-DykCZUJc.js → index-DLlWMDxB.js} +4 -4
- package/dist/{index-BS3QPrVM.js → index-DNd8NZnu.js} +4 -4
- package/dist/{index-CTsQY6zW.js → index-Dakpr4C1.js} +3 -3
- package/dist/{index-B4PJ4K6l.js → index-DkZAsKob.js} +2 -2
- package/dist/{index-CYmjv9TK.js → index-DprTO7yi.js} +4 -4
- package/dist/{index-a62vDo6s.js → index-N4BwXTyk.js} +2 -2
- package/dist/{index-DfnEQYyW.js → index-V4F4Sk7y.js} +2 -2
- package/dist/{index-DxZ1bG6u.js → index-y-TnfE6Z.js} +2 -2
- package/dist/{index-CONaN903.js → index-yFJTDKIX.js} +2 -2
- package/dist/{index-Bxpp4VC9.js → index-ytgNPz5f.js} +2 -2
- package/dist/index.js +3482 -3419
- package/dist/legacy.js +1728 -1707
- package/dist/translations/en.d.ts +2 -0
- package/dist/translations/fr.d.ts +2 -0
- package/dist/utils/cookie-consent-contract.d.ts +55 -0
- package/dist/utils/cookie-consent-contract.spec.d.ts +1 -0
- package/dist/utils/cookie-storage.utils.d.ts +1 -8
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/CookieConsentSettings-DHpcYTa2.js +0 -505
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { AccountCard, SHELL_FOOTER, TopbarActions } from '../parts';
|
|
21
21
|
|
|
22
22
|
/** The shell alone, with the Banking navigation and a saved filter named by one unbroken word. */
|
|
23
|
-
|
|
23
|
+
const AppShellDemo = ({ withSpace }: { withSpace: boolean }) => {
|
|
24
24
|
const { log } = useEventLog();
|
|
25
25
|
const [spaceId, setSpaceId] = useState(SPACES[0].id);
|
|
26
26
|
const current = SPACES.find((space) => space.id === spaceId) ?? SPACES[0];
|
|
@@ -33,14 +33,18 @@ export const AppShellPage = () => {
|
|
|
33
33
|
name: 'Banking',
|
|
34
34
|
icon: <ToolIcon tool={ToolKind.Banking} size={24} />,
|
|
35
35
|
}}
|
|
36
|
-
space={
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
space={
|
|
37
|
+
withSpace
|
|
38
|
+
? {
|
|
39
|
+
current,
|
|
40
|
+
spaces: SPACES,
|
|
41
|
+
onChange: (id) => {
|
|
42
|
+
setSpaceId(id);
|
|
43
|
+
log(`espace ${id}`);
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
: undefined
|
|
47
|
+
}
|
|
44
48
|
nav={BANKING_NAV_WITH_LONG_LABEL}
|
|
45
49
|
activeItemId="home"
|
|
46
50
|
mainSpaceLink={{ href: '#abyss', label: 'Mon espace Abyss' }}
|
|
@@ -93,3 +97,8 @@ export const AppShellPage = () => {
|
|
|
93
97
|
</AppShell>
|
|
94
98
|
);
|
|
95
99
|
};
|
|
100
|
+
|
|
101
|
+
export const AppShellPage = () => <AppShellDemo withSpace />;
|
|
102
|
+
|
|
103
|
+
/** The same shell without `space` (the back-office): the product mark, no selector. */
|
|
104
|
+
export const AppShellNoSpacePage = () => <AppShellDemo withSpace={false} />;
|
|
@@ -1,38 +1,61 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
1
3
|
import Button from '@mui/material/Button';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
4
|
+
import { AbyssCookieConsentProvider } from '../../src/components/business/CookieConsent/AbyssCookieConsentProvider';
|
|
5
|
+
import { Drawer } from '../../src/components/layers/Drawer/Drawer';
|
|
6
|
+
import { Modal } from '../../src/components/layers/Modal/Modal';
|
|
7
|
+
import { clearCookie } from '../../src/utils/cookie-storage.utils';
|
|
8
|
+
import { CONSENT_VERSION } from '../../src/utils/cookie-consent-contract';
|
|
9
|
+
import { Example, Showcase } from '../frame';
|
|
5
10
|
|
|
6
|
-
const
|
|
11
|
+
const queryClient = new QueryClient();
|
|
7
12
|
|
|
13
|
+
/** The real provider and banner, on the page: a visitor who has not chosen yet sees the banner. */
|
|
8
14
|
export const CookieConsentPage = () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
acceptAll: () => log('tout accepter'),
|
|
14
|
-
rejectAll: () => log('tout refuser'),
|
|
15
|
-
save: (choices) =>
|
|
16
|
-
log(
|
|
17
|
-
`enregistrer · audience ${yesNo(choices.analytics)}, marketing ${yesNo(
|
|
18
|
-
choices.marketing,
|
|
19
|
-
)}`,
|
|
20
|
-
),
|
|
21
|
-
reset: () => log('réinitialiser'),
|
|
22
|
-
};
|
|
15
|
+
// A choice made in an earlier visit of the catalog would hide the banner this page shows.
|
|
16
|
+
useState(() => clearCookie({}));
|
|
17
|
+
const [wizardOpen, setWizardOpen] = useState(false);
|
|
18
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
23
19
|
return (
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
<QueryClientProvider client={queryClient}>
|
|
21
|
+
<AbyssCookieConsentProvider
|
|
22
|
+
consentVersion={CONSENT_VERSION}
|
|
23
|
+
isAuthenticated={false}
|
|
24
|
+
>
|
|
25
|
+
<Showcase
|
|
26
|
+
family="Métier"
|
|
27
|
+
name="CookieConsent"
|
|
28
|
+
description="Bandeau de consentement en bas à droite (pleine largeur sous 768 px) : accepter et refuser pèsent autant ; « Personnaliser » ouvre la fenêtre de réglages, et le bandeau s'efface tant qu'elle est ouverte. Quand une modale est ouverte, le bandeau la suit : il reste atteignable au clavier et par un lecteur d'écran, et la modale s'arrête au-dessus de lui."
|
|
29
|
+
>
|
|
30
|
+
<Example title="Bandeau, réglages et modale ouverte">
|
|
31
|
+
<Button variant="outlined" onClick={() => setWizardOpen(true)}>
|
|
32
|
+
Ouvrir l'assistant
|
|
33
|
+
</Button>
|
|
34
|
+
<Button variant="outlined" onClick={() => setDrawerOpen(true)}>
|
|
35
|
+
Ouvrir l'aperçu
|
|
36
|
+
</Button>
|
|
37
|
+
</Example>
|
|
38
|
+
</Showcase>
|
|
39
|
+
<Modal
|
|
40
|
+
open={wizardOpen}
|
|
41
|
+
onClose={() => setWizardOpen(false)}
|
|
42
|
+
title="Assistant de démarrage"
|
|
43
|
+
actions={
|
|
44
|
+
<Button variant="contained" onClick={() => setWizardOpen(false)}>
|
|
45
|
+
Suivant
|
|
46
|
+
</Button>
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
<p>Étape 1 sur 3</p>
|
|
50
|
+
</Modal>
|
|
51
|
+
<Drawer
|
|
52
|
+
open={drawerOpen}
|
|
53
|
+
onClose={() => setDrawerOpen(false)}
|
|
54
|
+
title="Aperçu"
|
|
55
|
+
>
|
|
56
|
+
<p>Contenu de l'aperçu</p>
|
|
57
|
+
</Drawer>
|
|
58
|
+
</AbyssCookieConsentProvider>
|
|
59
|
+
</QueryClientProvider>
|
|
37
60
|
);
|
|
38
61
|
};
|
|
@@ -1,66 +1,66 @@
|
|
|
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
|
-
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
9
|
-
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
10
|
-
|
|
11
|
-
const POPULATED = [
|
|
12
|
-
delivery(),
|
|
13
|
-
failedDelivery(),
|
|
14
|
-
delivery({
|
|
15
|
-
id: 'delivery-3',
|
|
16
|
-
eventKey: 'event-3',
|
|
17
|
-
deliveryId: 'sub-1:event-3',
|
|
18
|
-
status: deliveryStatus('RETRYING'),
|
|
19
|
-
attemptCount: 2,
|
|
20
|
-
lastResponseCode: 502,
|
|
21
|
-
lastResponseBody: null,
|
|
22
|
-
lastError: 'HTTP 502',
|
|
23
|
-
deliveredAt: null,
|
|
24
|
-
nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
|
|
25
|
-
}),
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
export const DeliveryHistoryPage = () => {
|
|
29
|
-
const { log } = useEventLog();
|
|
30
|
-
const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
|
|
31
|
-
list,
|
|
32
|
-
get: async (id) => POPULATED.find((row) => row.id === id) ?? delivery(),
|
|
33
|
-
replayDelivery: async (id) => log(`rejouer ${id}`),
|
|
34
|
-
canReplay: true,
|
|
35
|
-
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
36
|
-
});
|
|
37
|
-
return (
|
|
38
|
-
<Showcase
|
|
39
|
-
family="Métier"
|
|
40
|
-
name="DeliveryHistory"
|
|
41
|
-
description="L'historique des livraisons : filtre de statut, détail en panneau (corps, en-têtes envoyés, réponse, déroulé) et rejeu d'une livraison terminée."
|
|
42
|
-
>
|
|
43
|
-
<Example title="Peuplé" maxWidth={1100}>
|
|
44
|
-
<DeliveryHistory {...base(async () => page(POPULATED))} />
|
|
45
|
-
</Example>
|
|
46
|
-
<Example title="Vide" maxWidth={1100}>
|
|
47
|
-
<DeliveryHistory {...base(async () => page([]))} />
|
|
48
|
-
</Example>
|
|
49
|
-
<Example title="En cours de chargement" maxWidth={1100}>
|
|
50
|
-
<DeliveryHistory {...base(() => new Promise(() => undefined))} />
|
|
51
|
-
</Example>
|
|
52
|
-
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
53
|
-
<DeliveryHistory
|
|
54
|
-
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
55
|
-
/>
|
|
56
|
-
</Example>
|
|
57
|
-
<Example title="Sans droit de rejeu" maxWidth={1100}>
|
|
58
|
-
<DeliveryHistory
|
|
59
|
-
{...base(async () => page(POPULATED))}
|
|
60
|
-
canReplay={false}
|
|
61
|
-
/>
|
|
62
|
-
</Example>
|
|
63
|
-
<LastEvent />
|
|
64
|
-
</Showcase>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
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
|
+
} from '../../src/components/business/Deliveries/test-support/deliveries.fixtures';
|
|
9
|
+
import { Example, LastEvent, Showcase, useEventLog } from '../frame';
|
|
10
|
+
|
|
11
|
+
const POPULATED = [
|
|
12
|
+
delivery(),
|
|
13
|
+
failedDelivery(),
|
|
14
|
+
delivery({
|
|
15
|
+
id: 'delivery-3',
|
|
16
|
+
eventKey: 'event-3',
|
|
17
|
+
deliveryId: 'sub-1:event-3',
|
|
18
|
+
status: deliveryStatus('RETRYING'),
|
|
19
|
+
attemptCount: 2,
|
|
20
|
+
lastResponseCode: 502,
|
|
21
|
+
lastResponseBody: null,
|
|
22
|
+
lastError: 'HTTP 502',
|
|
23
|
+
deliveredAt: null,
|
|
24
|
+
nextAttemptAt: new Date('2026-11-03T10:15:00Z'),
|
|
25
|
+
}),
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export const DeliveryHistoryPage = () => {
|
|
29
|
+
const { log } = useEventLog();
|
|
30
|
+
const base = (list: DeliveryHistoryProps['list']): DeliveryHistoryProps => ({
|
|
31
|
+
list,
|
|
32
|
+
get: async (id) => POPULATED.find((row) => row.id === id) ?? delivery(),
|
|
33
|
+
replayDelivery: async (id) => log(`rejouer ${id}`),
|
|
34
|
+
canReplay: true,
|
|
35
|
+
flowUrl: 'https://flow.abyss.example/deliveries',
|
|
36
|
+
});
|
|
37
|
+
return (
|
|
38
|
+
<Showcase
|
|
39
|
+
family="Métier"
|
|
40
|
+
name="DeliveryHistory"
|
|
41
|
+
description="L'historique des livraisons : filtre de statut, détail en panneau (corps, en-têtes envoyés, réponse, déroulé) et rejeu d'une livraison terminée."
|
|
42
|
+
>
|
|
43
|
+
<Example title="Peuplé" maxWidth={1100}>
|
|
44
|
+
<DeliveryHistory {...base(async () => page(POPULATED))} />
|
|
45
|
+
</Example>
|
|
46
|
+
<Example title="Vide" maxWidth={1100}>
|
|
47
|
+
<DeliveryHistory {...base(async () => page([]))} />
|
|
48
|
+
</Example>
|
|
49
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
50
|
+
<DeliveryHistory {...base(() => new Promise(() => undefined))} />
|
|
51
|
+
</Example>
|
|
52
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
53
|
+
<DeliveryHistory
|
|
54
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
55
|
+
/>
|
|
56
|
+
</Example>
|
|
57
|
+
<Example title="Sans droit de rejeu" maxWidth={1100}>
|
|
58
|
+
<DeliveryHistory
|
|
59
|
+
{...base(async () => page(POPULATED))}
|
|
60
|
+
canReplay={false}
|
|
61
|
+
/>
|
|
62
|
+
</Example>
|
|
63
|
+
<LastEvent />
|
|
64
|
+
</Showcase>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -1,110 +1,110 @@
|
|
|
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="Vide" maxWidth={1100}>
|
|
85
|
-
<DeliverySubscriptions {...base(async () => page([]))} />
|
|
86
|
-
</Example>
|
|
87
|
-
<Example title="En cours de chargement" maxWidth={1100}>
|
|
88
|
-
<DeliverySubscriptions {...base(() => new Promise(() => undefined))} />
|
|
89
|
-
</Example>
|
|
90
|
-
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
91
|
-
<DeliverySubscriptions
|
|
92
|
-
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
93
|
-
/>
|
|
94
|
-
</Example>
|
|
95
|
-
<Example title="Lecture seule" maxWidth={1100}>
|
|
96
|
-
<DeliverySubscriptions
|
|
97
|
-
{...base(async () => page(POPULATED))}
|
|
98
|
-
permissions={{
|
|
99
|
-
canCreate: false,
|
|
100
|
-
canUpdate: false,
|
|
101
|
-
canDelete: false,
|
|
102
|
-
canResetSecret: false,
|
|
103
|
-
canReadHistory: true,
|
|
104
|
-
}}
|
|
105
|
-
/>
|
|
106
|
-
</Example>
|
|
107
|
-
<LastEvent />
|
|
108
|
-
</Showcase>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
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="Vide" maxWidth={1100}>
|
|
85
|
+
<DeliverySubscriptions {...base(async () => page([]))} />
|
|
86
|
+
</Example>
|
|
87
|
+
<Example title="En cours de chargement" maxWidth={1100}>
|
|
88
|
+
<DeliverySubscriptions {...base(() => new Promise(() => undefined))} />
|
|
89
|
+
</Example>
|
|
90
|
+
<Example title="Le chargement a échoué" maxWidth={1100}>
|
|
91
|
+
<DeliverySubscriptions
|
|
92
|
+
{...base(() => Promise.reject(new Error('Flow indisponible')))}
|
|
93
|
+
/>
|
|
94
|
+
</Example>
|
|
95
|
+
<Example title="Lecture seule" maxWidth={1100}>
|
|
96
|
+
<DeliverySubscriptions
|
|
97
|
+
{...base(async () => page(POPULATED))}
|
|
98
|
+
permissions={{
|
|
99
|
+
canCreate: false,
|
|
100
|
+
canUpdate: false,
|
|
101
|
+
canDelete: false,
|
|
102
|
+
canResetSecret: false,
|
|
103
|
+
canReadHistory: true,
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
</Example>
|
|
107
|
+
<LastEvent />
|
|
108
|
+
</Showcase>
|
|
109
|
+
);
|
|
110
|
+
};
|