@abyss-project/commons-front-core 20.1.0 → 20.3.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog — @abyss-project/commons-front-core
2
2
 
3
+ ## 20.3.0
4
+
5
+ Card #788 (toasts above the fixed bottom bars).
6
+
7
+ - New hooks, exported from the root with the other hooks: `useToastClearance(px)` claims `px` pixels from the bottom edge for the toast region while mounted and positive; `useElementToastClearance(active = true)` returns a callback ref: the element it is put on is measured (top to the bottom of the viewport, safe area included) as soon as it is attached, remounts included, its resize and the window's are followed, and that distance is claimed while active. The toast sits above the largest claim of the page; releasing one never erases another.
8
+ - `CookieConsentBanner` goes through the same registry: leaving no longer erases the claim of a screen's bar.
9
+
10
+ ## 20.2.0
11
+
12
+ Card #286 (satellites, S1).
13
+
14
+ - `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.
15
+
3
16
  ## 20.1.0
4
17
 
5
18
  Card #286 (global review, lot 2).
@@ -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
  }),
@@ -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
+ };
@@ -59,6 +59,7 @@ import { PageStatePage } from './PageState';
59
59
  import { PreviewDrawerPage } from './PreviewDrawer';
60
60
  import { ProductTourPage } from './ProductTour';
61
61
  import { QRCodeModalPage } from './QRCodeModal';
62
+ import { QuotaReachedDialogPage } from './QuotaReachedDialog';
62
63
  import { RichSelectPage } from './RichSelect';
63
64
  import { RoleBadgePage } from './RoleBadge';
64
65
  import { ScanBadgePage } from './ScanBadge';
@@ -145,6 +146,7 @@ export const CATALOG_PAGES: Record<string, ComponentType> = {
145
146
  PreviewDrawer: PreviewDrawerPage,
146
147
  ProductTour: ProductTourPage,
147
148
  QRCodeModal: QRCodeModalPage,
149
+ QuotaReachedDialog: QuotaReachedDialogPage,
148
150
  RichSelect: RichSelectPage,
149
151
  RoleBadge: RoleBadgePage,
150
152
  ScanBadge: ScanBadgePage,