@eifi1/ui-kit 0.41.0 → 0.43.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/README.md +26 -7
- package/dist/admin/admin-area-labels.d.ts +59 -0
- package/dist/admin/admin-area-labels.js +35 -0
- package/dist/admin/admin-area-labels.js.map +1 -0
- package/dist/admin/admin-forbidden.d.ts +35 -0
- package/dist/admin/admin-forbidden.js +36 -0
- package/dist/admin/admin-forbidden.js.map +1 -0
- package/dist/admin/admin-overview.d.ts +110 -0
- package/dist/admin/admin-overview.js +92 -0
- package/dist/admin/admin-overview.js.map +1 -0
- package/dist/admin/admin-sections.d.ts +94 -0
- package/dist/admin/admin-sections.js +81 -0
- package/dist/admin/admin-sections.js.map +1 -0
- package/dist/admin/admin-tool-links.d.ts +48 -0
- package/dist/admin/admin-tool-links.js +31 -0
- package/dist/admin/admin-tool-links.js.map +1 -0
- package/dist/billing/billing-banner.d.ts +33 -2
- package/dist/billing/billing-banner.js +29 -3
- package/dist/billing/billing-banner.js.map +1 -1
- package/dist/billing/billing-labels.d.ts +36 -0
- package/dist/billing/billing-labels.js +10 -0
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/billing-overview.d.ts +33 -0
- package/dist/billing/billing-overview.js +6 -0
- package/dist/billing/billing-overview.js.map +1 -1
- package/dist/billing/billing-standing.d.ts +8 -0
- package/dist/billing/billing-standing.js.map +1 -1
- package/dist/billing/cancel-request.d.ts +53 -0
- package/dist/billing/cancel-request.js +21 -0
- package/dist/billing/cancel-request.js.map +1 -0
- package/dist/billing/cancel-subscription.d.ts +46 -0
- package/dist/billing/cancel-subscription.js +57 -0
- package/dist/billing/cancel-subscription.js.map +1 -0
- package/dist/billing/plan-card.d.ts +45 -1
- package/dist/billing/plan-card.js +53 -2
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-switch.d.ts +10 -1
- package/dist/billing/plan-switch.js +22 -13
- package/dist/billing/plan-switch.js.map +1 -1
- package/dist/billing/provider-page.d.ts +40 -0
- package/dist/billing/provider-page.js +33 -0
- package/dist/billing/provider-page.js.map +1 -0
- package/dist/billing/subscription-actions.d.ts +68 -4
- package/dist/billing/subscription-actions.js +65 -5
- package/dist/billing/subscription-actions.js.map +1 -1
- package/dist/components/account-chips.d.ts +50 -2
- package/dist/components/account-chips.js +33 -0
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/empty-state.d.ts +2 -1
- package/dist/components/empty-state.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-menu.d.ts +7 -4
- package/dist/feedback/feedback-menu.js +4 -2
- package/dist/feedback/feedback-menu.js.map +1 -1
- package/dist/hooks/use-search-param-state.js +4 -1
- package/dist/hooks/use-search-param-state.js.map +1 -1
- package/dist/i18n/defaults.js +7 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +113 -0
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +12 -0
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +142 -1
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +110 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +109 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +110 -0
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +110 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +109 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +34 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +24 -2
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/search/global-search.d.ts +3 -0
- package/dist/search/global-search.js +3 -1
- package/dist/search/global-search.js.map +1 -1
- package/dist/settings/settings-catalogue.d.ts +9 -1
- package/dist/settings/settings-catalogue.js +1 -1
- package/dist/settings/settings-catalogue.js.map +1 -1
- package/dist/settings/settings-layout.d.ts +7 -1
- package/dist/settings/settings-layout.js +35 -27
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/shell/account-menu-language.d.ts +46 -0
- package/dist/shell/account-menu-language.js +64 -0
- package/dist/shell/account-menu-language.js.map +1 -0
- package/dist/shell/admin-menu.d.ts +69 -0
- package/dist/shell/admin-menu.js +64 -0
- package/dist/shell/admin-menu.js.map +1 -0
- package/dist/shell/app-shell.d.ts +10 -0
- package/dist/shell/app-shell.js +22 -4
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/dev-switchers.d.ts +53 -0
- package/dist/shell/dev-switchers.js +107 -0
- package/dist/shell/dev-switchers.js.map +1 -0
- package/dist/shell/sync-status-indicator.d.ts +86 -0
- package/dist/shell/sync-status-indicator.js +170 -0
- package/dist/shell/sync-status-indicator.js.map +1 -0
- package/dist/shell/top-bar-actions.d.ts +49 -0
- package/dist/shell/top-bar-actions.js +31 -0
- package/dist/shell/top-bar-actions.js.map +1 -0
- package/dist/shell/top-bar-parts-labels.d.ts +90 -0
- package/dist/shell/top-bar-parts-labels.js +51 -0
- package/dist/shell/top-bar-parts-labels.js.map +1 -0
- package/dist/shell/topbar-action-menu.d.ts +13 -1
- package/dist/shell/topbar-action-menu.js +5 -2
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.d.ts +16 -3
- package/dist/shell/topbar-controls.js +5 -1
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell/tour-menu.d.ts +67 -0
- package/dist/shell/tour-menu.js +87 -0
- package/dist/shell/tour-menu.js.map +1 -0
- package/dist/shell.d.ts +16 -0
- package/dist/shell.js +21 -0
- package/dist/shell.js.map +1 -1
- package/dist/tour/tour-catalogue-labels.d.ts +44 -0
- package/dist/tour/tour-catalogue-labels.js +32 -0
- package/dist/tour/tour-catalogue-labels.js.map +1 -0
- package/dist/tour/tour-catalogue.d.ts +68 -0
- package/dist/tour/tour-catalogue.js +189 -0
- package/dist/tour/tour-catalogue.js.map +1 -0
- package/dist/tour/tour-info.d.ts +112 -0
- package/dist/tour/tour-info.js +36 -0
- package/dist/tour/tour-info.js.map +1 -0
- package/dist/tour/use-tour-progress.d.ts +61 -0
- package/dist/tour/use-tour-progress.js +116 -0
- package/dist/tour/use-tour-progress.js.map +1 -0
- package/dist/tour/use-tour-url-sync.d.ts +58 -0
- package/dist/tour/use-tour-url-sync.js +110 -0
- package/dist/tour/use-tour-url-sync.js.map +1 -0
- package/dist/tour.d.ts +8 -0
- package/dist/tour.js +18 -0
- package/dist/tour.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/admin-area-labels.ts +91 -0
- package/src/admin/admin-forbidden.tsx +75 -0
- package/src/admin/admin-overview.tsx +217 -0
- package/src/admin/admin-sections.tsx +198 -0
- package/src/admin/admin-tool-links.tsx +84 -0
- package/src/billing/billing-banner.tsx +57 -6
- package/src/billing/billing-labels.ts +59 -0
- package/src/billing/billing-overview.ts +37 -0
- package/src/billing/billing-standing.ts +8 -0
- package/src/billing/cancel-request.ts +75 -0
- package/src/billing/cancel-subscription.tsx +102 -0
- package/src/billing/plan-card.tsx +97 -1
- package/src/billing/plan-switch.tsx +16 -0
- package/src/billing/provider-page.ts +75 -0
- package/src/billing/subscription-actions.tsx +155 -20
- package/src/components/account-chips.tsx +89 -2
- package/src/components/empty-state.tsx +2 -1
- package/src/feedback/feedback-menu.tsx +8 -3
- package/src/hooks/use-search-param-state.ts +6 -1
- package/src/i18n/defaults.ts +6 -0
- package/src/i18n/german.ts +127 -0
- package/src/i18n/kit-labels.tsx +12 -0
- package/src/i18n/locales/en.ts +32 -0
- package/src/i18n/locales/es.ts +121 -0
- package/src/i18n/locales/fr.ts +121 -0
- package/src/i18n/locales/hu.ts +119 -0
- package/src/i18n/locales/it.ts +122 -0
- package/src/i18n/locales/zh.ts +114 -0
- package/src/i18n/review.ts +33 -0
- package/src/index.ts +38 -2
- package/src/search/global-search.tsx +5 -0
- package/src/settings/settings-catalogue.ts +10 -2
- package/src/settings/settings-layout.tsx +58 -34
- package/src/shell/account-menu-language.tsx +116 -0
- package/src/shell/admin-menu.tsx +146 -0
- package/src/shell/app-shell.tsx +44 -3
- package/src/shell/dev-switchers.tsx +179 -0
- package/src/shell/sync-status-indicator.tsx +301 -0
- package/src/shell/top-bar-actions.tsx +79 -0
- package/src/shell/top-bar-parts-labels.ts +142 -0
- package/src/shell/topbar-action-menu.tsx +15 -2
- package/src/shell/topbar-controls.tsx +20 -3
- package/src/shell/tour-menu.tsx +179 -0
- package/src/shell.ts +27 -0
- package/src/tour/tour-catalogue-labels.ts +75 -0
- package/src/tour/tour-catalogue.tsx +316 -0
- package/src/tour/tour-info.ts +144 -0
- package/src/tour/use-tour-progress.ts +198 -0
- package/src/tour/use-tour-url-sync.ts +221 -0
- package/src/tour.ts +11 -0
package/README.md
CHANGED
|
@@ -556,19 +556,19 @@ columns, strings and permissions (see the note at the top of `src/feedback/feedb
|
|
|
556
556
|
|
|
557
557
|
<!-- BEGIN GENERATED: exports — node scripts/gen-export-inventory.mjs -->
|
|
558
558
|
|
|
559
|
-
**
|
|
559
|
+
**2079 names from 341 modules** — 958 values and 1121 types. _Italic_ is a type-only export.
|
|
560
560
|
|
|
561
561
|
Generated from `dist/index.d.ts` by `node scripts/gen-export-inventory.mjs`; the count
|
|
562
562
|
is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the markers.
|
|
563
563
|
|
|
564
564
|
| Entry point | Names |
|
|
565
565
|
|---|---|
|
|
566
|
-
| `@eifi1/ui-kit` |
|
|
566
|
+
| `@eifi1/ui-kit` | 2079 |
|
|
567
567
|
| `@eifi1/ui-kit/chart` | 92 |
|
|
568
|
-
| `@eifi1/ui-kit/shell` |
|
|
568
|
+
| `@eifi1/ui-kit/shell` | 110 |
|
|
569
569
|
| `@eifi1/ui-kit/data-table` | 51 |
|
|
570
570
|
| `@eifi1/ui-kit/wizard` | 24 |
|
|
571
|
-
| `@eifi1/ui-kit/tour` |
|
|
571
|
+
| `@eifi1/ui-kit/tour` | 31 |
|
|
572
572
|
| `@eifi1/ui-kit/feedback` | 205 |
|
|
573
573
|
| `@eifi1/ui-kit/search` | 23 |
|
|
574
574
|
| `@eifi1/ui-kit/dates` | 22 |
|
|
@@ -746,7 +746,7 @@ re-slicing of it, never a second API.
|
|
|
746
746
|
| `components/description-list` | `DEFAULT_DESCRIPTION_LIST_LABELS`, `DescriptionItem`, `DescriptionList`, _`DescriptionItemProps`_, _`DescriptionListColumns`_, _`DescriptionListDensity`_, _`DescriptionListLabels`_, _`DescriptionListLayout`_, _`DescriptionListProps`_ |
|
|
747
747
|
| `components/form-actions` | `DEFAULT_FORM_ACTIONS_LABELS`, `FormActions`, _`FormActionsAlign`_, _`FormActionsDestructive`_, _`FormActionsLabels`_, _`FormActionsPlacement`_, _`FormActionsProps`_, _`FormActionsStack`_, _`FormActionsStickyWithin`_, _`FormActionsSubmitProps`_, _`FormActionsSubmitShortcut`_, _`ResponsiveFormActionsPlacement`_ |
|
|
748
748
|
| `components/write-lock` | `COMMIT_EXCEPT_BILLING`, `DEFAULT_WRITE_LOCK_LABELS`, `useWriteLock`, `writeLockFor`, `WriteLockProvider`, _`CommitScope`_, _`WriteLock`_, _`WriteLockHold`_, _`WriteLockKind`_, _`WriteLockLabels`_, _`WriteLockProviderProps`_ |
|
|
749
|
-
| `components/account-chips` | `ACCOUNT_STATE_TONES`, `AccountStateChip`, `dateColumn`, `DateMark`, `DEFAULT_ACCOUNT_STATE_LABELS`, `RoleChip`, _`AccountState`_, _`AccountStateChipProps`_, _`AccountStateLabels`_, _`DateColumnOptions`_, _`DateMarkProps`_, _`RoleChipProps`_, _`RoleDefinition`_, _`RoleVocabulary`_ |
|
|
749
|
+
| `components/account-chips` | `ACCOUNT_STATE_TONES`, `AccountRoleChip`, `AccountStateChip`, `dateColumn`, `DateMark`, `DEFAULT_ACCOUNT_STATE_LABELS`, `RoleChip`, _`AccountRoleChipProps`_, _`AccountState`_, _`AccountStateChipProps`_, _`AccountStateLabels`_, _`DateColumnOptions`_, _`DateMarkProps`_, _`RoleChipProps`_, _`RoleDefinition`_, _`RoleVocabulary`_ |
|
|
750
750
|
| `components/server-wake` | `DEFAULT_SERVER_WAKE_LABELS`, `ServerWakeNotice`, `useServerWakeStage`, _`ServerWakeLabels`_, _`ServerWakeNoticeProps`_ |
|
|
751
751
|
| `components/share-card` | `DEFAULT_SHARE_CARD_LABELS`, `ShareCard`, `ShareDialog`, `SharePanel`, _`ShareAddRequest`_, _`ShareCandidate`_, _`ShareCardLabels`_, _`ShareCardProps`_, _`ShareDialogProps`_, _`ShareGrantee`_, _`SharePanelProps`_, _`SharePendingGrant`_, _`ShareRole`_ |
|
|
752
752
|
| `components/line-items` | `DEFAULT_LINE_ITEMS_LABELS`, `LineItems`, _`LineItemCellContext`_, _`LineItemsColumn`_, _`LineItemsFieldLabels`_, _`LineItemsLabels`_, _`LineItemsProps`_, _`LineItemsRemoveAlign`_, _`LineItemsRemovePlacement`_, _`LineItemsRowProps`_, _`LineItemsSummary`_, _`LineItemsSummaryTone`_ |
|
|
@@ -819,6 +819,13 @@ re-slicing of it, never a second API.
|
|
|
819
819
|
| `shell/top-bar-brand` | `TopBarBrand`, _`TopBarBrandProps`_ |
|
|
820
820
|
| `shell/auth-layout` | `AuthLayout`, _`AuthLayoutProps`_ |
|
|
821
821
|
| `shell/fill-height` | `FILL_HEIGHT_CLASS`, `FillHeight`, _`FillHeightProps`_ |
|
|
822
|
+
| `shell/admin-menu` | `adminMenuEntry`, `AdminMenuRow`, `useAdminMenuEntry`, _`AdminMenuEntryOptions`_, _`AdminMenuRowProps`_, _`UseAdminMenuEntryOptions`_ |
|
|
823
|
+
| `shell/top-bar-actions` | `TOP_BAR_ACTION_ORDER`, `TopBarActions`, _`TopBarActionsProps`_ |
|
|
824
|
+
| `shell/account-menu-language` | `AccountMenuLanguage`, _`AccountMenuLanguageOption`_, _`AccountMenuLanguageProps`_ |
|
|
825
|
+
| `shell/tour-menu` | `TourMenu`, _`TourMenuProps`_, _`TourMenuTour`_ |
|
|
826
|
+
| `shell/sync-status-indicator` | `syncState`, `SyncStatusIndicator`, _`SyncState`_, _`SyncStatus`_, _`SyncStatusIndicatorProps`_, _`SyncStatusScope`_ |
|
|
827
|
+
| `shell/dev-switchers` | `DEV_ORIGINAL_ROLE_KEY`, `DevSwitchers`, _`DevSwitchersProps`_ |
|
|
828
|
+
| `shell/top-bar-parts-labels` | `DEFAULT_TOP_BAR_PARTS_LABELS`, `useTopBarPartsLabels`, _`DevSwitchersLabels`_, _`SyncStatusLabels`_, _`TopBarPartsLabels`_, _`TourMenuLabels`_ |
|
|
822
829
|
| `shell/company-switcher` | `CompanySwitcher`, `DEFAULT_COMPANY_SWITCHER_LABELS`, _`CompanySwitcherCompany`_, _`CompanySwitcherLabels`_, _`CompanySwitcherProps`_ |
|
|
823
830
|
|
|
824
831
|
### settings
|
|
@@ -893,6 +900,10 @@ re-slicing of it, never a second API.
|
|
|
893
900
|
| Module | Exports |
|
|
894
901
|
|---|---|
|
|
895
902
|
| `tour/tour` | `DEFAULT_TOUR_LABELS`, `TourProvider`, `useTour`, `useTourOptional`, _`TourLabels`_, _`TourPlacement`_, _`TourStep`_ |
|
|
903
|
+
| `tour/tour-catalogue` | `DEFAULT_TOUR_CATALOGUE_LABELS`, `TourCatalogue`, `TourCatalogueCard`, _`TourCatalogueCardProps`_, _`TourCatalogueLabels`_, _`TourCatalogueProps`_ |
|
|
904
|
+
| `tour/tour-info` | `doneCount`, `earnedPoints`, `isTourDone`, `isTourNew`, `isTourReset`, _`TourCompletions`_, _`TourGroup`_, _`TourInfo`_, _`TourUpdate`_ |
|
|
905
|
+
| `tour/use-tour-progress` | `resetTourProgress`, `useTourProgress`, _`TourProgress`_, _`UseTourProgressOptions`_ |
|
|
906
|
+
| `tour/use-tour-url-sync` | `useTourCatalogueUrlState`, `useTourUrlSync`, _`TourCatalogueFilter`_, _`TourStateFilter`_, _`UseTourUrlSyncOptions`_ |
|
|
896
907
|
|
|
897
908
|
### search
|
|
898
909
|
|
|
@@ -943,6 +954,11 @@ re-slicing of it, never a second API.
|
|
|
943
954
|
| `admin/transfer-ownership-dialog` | `DEFAULT_TRANSFER_OWNERSHIP_LABELS`, `TransferOwnershipDialog`, _`TransferCandidate`_, _`TransferOwnershipDialogProps`_, _`TransferOwnershipLabels`_, _`TransferUnavailable`_, _`TransferValues`_ |
|
|
944
955
|
| `admin/invitations-panel` | `DEFAULT_INVITATIONS_LABELS`, `InvitationsPanel`, _`InvitationDraft`_, _`InvitationRow`_, _`InvitationScope`_, _`InvitationSentAnswer`_, _`InvitationsLabels`_, _`InvitationsPanelProps`_, _`InvitationStatus`_ |
|
|
945
956
|
| `admin/admin-parts` | _`AdminPerson`_ |
|
|
957
|
+
| `admin/admin-area-labels` | `DEFAULT_ADMIN_AREA_LABELS`, `useAdminAreaLabels`, _`AdminAreaLabels`_, _`AdminSharedSection`_, _`AdminTileLabels`_ |
|
|
958
|
+
| `admin/admin-sections` | `ADMIN_SECTIONS`, `adminSectionOrder`, `adminSections`, _`AdminKeptSection`_, _`AdminOwnSection`_, _`AdminSectionDefinition`_, _`AdminSectionOrderOptions`_, _`AdminSectionPlace`_, _`AdminSectionsOptions`_ |
|
|
959
|
+
| `admin/admin-forbidden` | `AdminForbidden`, _`AdminForbiddenProps`_ |
|
|
960
|
+
| `admin/admin-overview` | `AdminOverview`, `adminWaitingCount`, `AttentionTile`, `DEFAULT_ADMIN_ATTENTION_HREFS`, _`AdminAttention`_, _`AdminAttentionTile`_, _`AdminExtraTile`_, _`AdminOverviewProps`_, _`AttentionTileProps`_ |
|
|
961
|
+
| `admin/admin-tool-links` | `AdminToolLinks`, _`AdminToolLink`_, _`AdminToolLinksProps`_ |
|
|
946
962
|
| `admin/plan-change` | `DEFAULT_PLAN_CHANGE_LABELS`, `PlanChangeConfirm`, `planColumn`, `usePlanChangeResult`, `usePlanColumn`, _`PlanChange`_, _`PlanChangeConfirmProps`_, _`PlanChangeLabels`_, _`PlanChangeLine`_, _`PlanChangeOutcome`_, _`PlanChangeResultOptions`_, _`PlanChangeTone`_, _`PlanColumnOptions`_, _`PlanColumnUsage`_ |
|
|
947
963
|
|
|
948
964
|
### billing
|
|
@@ -951,7 +967,7 @@ re-slicing of it, never a second API.
|
|
|
951
967
|
|---|---|
|
|
952
968
|
| `billing/billing-labels` | `DEFAULT_BILLING_LABELS`, `SUBSCRIPTION_STATUSES`, `useBillingLabels`, _`BillingLabels`_, _`SubscriptionStatus`_ |
|
|
953
969
|
| `billing/plan-price` | `BILLING_INTERVALS`, `billingCurrencyFor`, `formatPlanPrice`, `minorToMajor`, `planPrice`, _`BillingCurrency`_, _`BillingInterval`_, _`PlanIntervalPrices`_, _`PlanPriceAnswer`_, _`PlanPrices`_ |
|
|
954
|
-
| `billing/plan-card` | `PlanCard`, `PlanPicker`, `planRelation`, _`BillingPlan`_, _`PlanCardProps`_, _`PlanChoice`_, _`PlanPickerProps`_, _`PlanRelation`_ |
|
|
970
|
+
| `billing/plan-card` | `GrantWarningConfirm`, `PlanCard`, `PlanPicker`, `planRelation`, _`BillingPlan`_, _`GrantWarningConfirmProps`_, _`PlanCardProps`_, _`PlanChoice`_, _`PlanPickerProps`_, _`PlanRelation`_ |
|
|
955
971
|
| `billing/subscription-status-chip` | `SUBSCRIPTION_STATUS_TONES`, `SubscriptionStatusChip`, _`SubscriptionStatusChipProps`_ |
|
|
956
972
|
| `billing/billing-banner` | `BillingBanner`, _`BillingBannerKind`_, _`BillingBannerProps`_ |
|
|
957
973
|
| `billing/plan-limit-notice` | `planLimitMailto`, `PlanLimitNotice`, _`PlanLimitNoticeProps`_ |
|
|
@@ -962,9 +978,12 @@ re-slicing of it, never a second API.
|
|
|
962
978
|
| `billing/checkout-return` | `CHECKOUT_RETURN_PARAM`, `CHECKOUT_RETURN_VALUE`, `checkoutReturnUrl`, `isCheckoutReturn`, `withoutCheckoutReturn` |
|
|
963
979
|
| `billing/checkout-processing` | `checkoutFingerprint`, `checkoutLanded`, `noteCheckoutStarted`, `useCheckoutProcessing`, _`CheckoutOverview`_, _`CheckoutProcessingOptions`_ |
|
|
964
980
|
| `billing/pay-page` | `paddleLocale`, `PAY_PAGE_APPS`, `PAY_PAGE_LANG_PARAM`, `payPageUrl`, _`PaddleEnvironment`_, _`PayPageApp`_ |
|
|
965
|
-
| `billing/billing-overview` | _`BillingOverview`_, _`PaidPrice`_, _`PlanSwitchPreview`_, _`PlanSwitchRequest`_, _`PortalRequest`_, _`PortalTarget`_, _`SubscriptionSource`_ |
|
|
981
|
+
| `billing/billing-overview` | `isPermanentGrant`, _`BillingOverview`_, _`BillingPortalAccess`_, _`PaidPrice`_, _`PlanSwitchPreview`_, _`PlanSwitchRequest`_, _`PortalRequest`_, _`PortalTarget`_, _`SubscriptionSource`_ |
|
|
966
982
|
| `billing/plan-limit-toast` | `usePlanLimitToast`, _`PlanLimitToastOptions`_ |
|
|
967
983
|
| `billing/plan-switch` | `PlanSwitchConfirm`, _`PlanSwitchConfirmProps`_, _`PlanSwitchSide`_ |
|
|
984
|
+
| `billing/cancel-subscription` | `CancelSubscriptionConfirm`, _`CancelSubscriptionConfirmProps`_ |
|
|
985
|
+
| `billing/provider-page` | `openProviderPage`, _`OpenProviderPageOptions`_, _`ProviderPageWay`_ |
|
|
986
|
+
| `billing/cancel-request` | `useCancelRequest`, _`CancelRequest`_, _`CancelRequested`_, _`CancelRequestView`_ |
|
|
968
987
|
|
|
969
988
|
### notifications
|
|
970
989
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type LabelOverride } from "../i18n/kit-labels.js";
|
|
2
|
+
import type { SettingsGroupLabels } from "../settings/settings-labels.js";
|
|
3
|
+
/**
|
|
4
|
+
* The `adminArea` namespace (0.42, docs/admin-harmonization.md §3.1): the kit's words of
|
|
5
|
+
* the admin area every app shares — the account menu's "Administration" row, the 403
|
|
6
|
+
* page, the shared sections' names and help lines, the overview's tiles and the Tools
|
|
7
|
+
* list. A module of words with no component code, like every `*-labels.ts` (0.34, KS U8).
|
|
8
|
+
* An app's own sections and tiles bring their own words.
|
|
9
|
+
*/
|
|
10
|
+
/** The sections every app's admin area shares, in the template's order (§2.3). */
|
|
11
|
+
export type AdminSharedSection = "overview" | "users" | "invitations" | "billing" | "activity";
|
|
12
|
+
/** The overview's shared tiles (§2.4, §6.1). */
|
|
13
|
+
export interface AdminTileLabels {
|
|
14
|
+
/** `feedback_waiting`: OPEN reports, crash reports included (§6.1). */
|
|
15
|
+
feedbackWaiting: string;
|
|
16
|
+
/** `deletion_requests`. */
|
|
17
|
+
deletionRequests: string;
|
|
18
|
+
/** `invitations_pending`. */
|
|
19
|
+
invitationsPending: string;
|
|
20
|
+
/** `users_total`. */
|
|
21
|
+
users: string;
|
|
22
|
+
/** `users_new_7d`, the line under the users tile. */
|
|
23
|
+
usersNew: (count: number) => string;
|
|
24
|
+
}
|
|
25
|
+
export interface AdminAreaLabels {
|
|
26
|
+
/** "Administration": the account menu's row, and the admin page's heading. */
|
|
27
|
+
title: string;
|
|
28
|
+
/** The row's waiting count, for a reader ("Administration, 3 waiting"); the eye sees
|
|
29
|
+
* the number in the badge. */
|
|
30
|
+
waiting: (count: number) => string;
|
|
31
|
+
/** The 403 page's heading (§2.2 decision 8). */
|
|
32
|
+
forbiddenTitle: string;
|
|
33
|
+
/**
|
|
34
|
+
* Under it. Says only that THIS area is closed to the account — never that the person
|
|
35
|
+
* administers nothing anywhere (§6.7: a kastlan superuser who isn't ADMIN in the acting
|
|
36
|
+
* company gets this page).
|
|
37
|
+
*/
|
|
38
|
+
forbiddenBody: (appName: string) => string;
|
|
39
|
+
/** The button back to the app's start, unless the app names its own (`homeLabel`). */
|
|
40
|
+
forbiddenHome: string;
|
|
41
|
+
/** A reviewer's second way out, to the translations review. */
|
|
42
|
+
forbiddenReviewer: string;
|
|
43
|
+
/** The shared sections' names and help lines (§2.3 decision 11). */
|
|
44
|
+
sections: Record<AdminSharedSection, SettingsGroupLabels>;
|
|
45
|
+
/** The overview's tiles. */
|
|
46
|
+
tiles: AdminTileLabels;
|
|
47
|
+
/** 0.43: `AdminOverview`'s `error` — the counts could not be loaded. */
|
|
48
|
+
overviewError: string;
|
|
49
|
+
/** 0.43: its button, which calls `onRetry`. */
|
|
50
|
+
retry: string;
|
|
51
|
+
/** The Tools list's heading and name (§2.5 decision 16). */
|
|
52
|
+
tools: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const DEFAULT_ADMIN_AREA_LABELS: AdminAreaLabels;
|
|
55
|
+
/**
|
|
56
|
+
* The `adminArea` namespace, resolved — English, then the provider, then `labels`. What
|
|
57
|
+
* an app reads to hand {@link adminSections} its words from inside a component.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useAdminAreaLabels(labels?: LabelOverride<AdminAreaLabels>): AdminAreaLabels;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useKitLabels } from "../i18n/kit-labels.js";
|
|
3
|
+
const DEFAULT_ADMIN_AREA_LABELS = {
|
|
4
|
+
title: "Administration",
|
|
5
|
+
waiting: (count) => `${count} waiting`,
|
|
6
|
+
forbiddenTitle: "Only for administrators",
|
|
7
|
+
forbiddenBody: (appName) => `This is where administrators run ${appName}. Your account cannot open this page.`,
|
|
8
|
+
forbiddenHome: "Go to the start page",
|
|
9
|
+
forbiddenReviewer: "Review translations",
|
|
10
|
+
sections: {
|
|
11
|
+
overview: { title: "Overview", help: "What is waiting, at a glance." },
|
|
12
|
+
users: { title: "Users", help: "Who has an account, and what each may do." },
|
|
13
|
+
invitations: { title: "Invitations", help: "Invite people by e-mail in their language; resend or revoke what\u2019s still open." },
|
|
14
|
+
billing: { title: "Billing", help: "The plan, the payment and the invoices." },
|
|
15
|
+
activity: { title: "Activity", help: "What the admins did, newest first." }
|
|
16
|
+
},
|
|
17
|
+
tiles: {
|
|
18
|
+
feedbackWaiting: "To triage",
|
|
19
|
+
deletionRequests: "Deletion requests",
|
|
20
|
+
invitationsPending: "Pending invitations",
|
|
21
|
+
users: "Users",
|
|
22
|
+
usersNew: (count) => `${count} new in 7 days`
|
|
23
|
+
},
|
|
24
|
+
overviewError: "The overview couldn\u2019t be loaded.",
|
|
25
|
+
retry: "Try again",
|
|
26
|
+
tools: "Tools"
|
|
27
|
+
};
|
|
28
|
+
function useAdminAreaLabels(labels) {
|
|
29
|
+
return useKitLabels("adminArea", DEFAULT_ADMIN_AREA_LABELS, labels);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
DEFAULT_ADMIN_AREA_LABELS,
|
|
33
|
+
useAdminAreaLabels
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=admin-area-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/admin/admin-area-labels.ts"],"sourcesContent":["import { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport type { SettingsGroupLabels } from \"../settings/settings-labels\";\n\n/**\n * The `adminArea` namespace (0.42, docs/admin-harmonization.md §3.1): the kit's words of\n * the admin area every app shares — the account menu's \"Administration\" row, the 403\n * page, the shared sections' names and help lines, the overview's tiles and the Tools\n * list. A module of words with no component code, like every `*-labels.ts` (0.34, KS U8).\n * An app's own sections and tiles bring their own words.\n */\n\n/** The sections every app's admin area shares, in the template's order (§2.3). */\nexport type AdminSharedSection = \"overview\" | \"users\" | \"invitations\" | \"billing\" | \"activity\";\n\n/** The overview's shared tiles (§2.4, §6.1). */\nexport interface AdminTileLabels {\n /** `feedback_waiting`: OPEN reports, crash reports included (§6.1). */\n feedbackWaiting: string;\n /** `deletion_requests`. */\n deletionRequests: string;\n /** `invitations_pending`. */\n invitationsPending: string;\n /** `users_total`. */\n users: string;\n /** `users_new_7d`, the line under the users tile. */\n usersNew: (count: number) => string;\n}\n\nexport interface AdminAreaLabels {\n /** \"Administration\": the account menu's row, and the admin page's heading. */\n title: string;\n /** The row's waiting count, for a reader (\"Administration, 3 waiting\"); the eye sees\n * the number in the badge. */\n waiting: (count: number) => string;\n /** The 403 page's heading (§2.2 decision 8). */\n forbiddenTitle: string;\n /**\n * Under it. Says only that THIS area is closed to the account — never that the person\n * administers nothing anywhere (§6.7: a kastlan superuser who isn't ADMIN in the acting\n * company gets this page).\n */\n forbiddenBody: (appName: string) => string;\n /** The button back to the app's start, unless the app names its own (`homeLabel`). */\n forbiddenHome: string;\n /** A reviewer's second way out, to the translations review. */\n forbiddenReviewer: string;\n /** The shared sections' names and help lines (§2.3 decision 11). */\n sections: Record<AdminSharedSection, SettingsGroupLabels>;\n /** The overview's tiles. */\n tiles: AdminTileLabels;\n /** 0.43: `AdminOverview`'s `error` — the counts could not be loaded. */\n overviewError: string;\n /** 0.43: its button, which calls `onRetry`. */\n retry: string;\n /** The Tools list's heading and name (§2.5 decision 16). */\n tools: string;\n}\n\nexport const DEFAULT_ADMIN_AREA_LABELS: AdminAreaLabels = {\n title: \"Administration\",\n waiting: (count) => `${count} waiting`,\n forbiddenTitle: \"Only for administrators\",\n forbiddenBody: (appName) => `This is where administrators run ${appName}. Your account cannot open this page.`,\n forbiddenHome: \"Go to the start page\",\n forbiddenReviewer: \"Review translations\",\n sections: {\n overview: { title: \"Overview\", help: \"What is waiting, at a glance.\" },\n users: { title: \"Users\", help: \"Who has an account, and what each may do.\" },\n invitations: { title: \"Invitations\", help: \"Invite people by e-mail in their language; resend or revoke what’s still open.\" },\n billing: { title: \"Billing\", help: \"The plan, the payment and the invoices.\" },\n activity: { title: \"Activity\", help: \"What the admins did, newest first.\" },\n },\n tiles: {\n feedbackWaiting: \"To triage\",\n deletionRequests: \"Deletion requests\",\n invitationsPending: \"Pending invitations\",\n users: \"Users\",\n usersNew: (count) => `${count} new in 7 days`,\n },\n overviewError: \"The overview couldn’t be loaded.\",\n retry: \"Try again\",\n tools: \"Tools\",\n};\n\n/**\n * The `adminArea` namespace, resolved — English, then the provider, then `labels`. What\n * an app reads to hand {@link adminSections} its words from inside a component.\n */\nexport function useAdminAreaLabels(labels?: LabelOverride<AdminAreaLabels>): AdminAreaLabels {\n return useKitLabels(\"adminArea\", DEFAULT_ADMIN_AREA_LABELS, labels);\n}\n"],"mappings":";AAAA,SAAS,oBAAwC;AA0D1C,MAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,SAAS,CAAC,UAAU,GAAG,KAAK;AAAA,EAC5B,gBAAgB;AAAA,EAChB,eAAe,CAAC,YAAY,oCAAoC,OAAO;AAAA,EACvE,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,YAAY,MAAM,gCAAgC;AAAA,IACrE,OAAO,EAAE,OAAO,SAAS,MAAM,4CAA4C;AAAA,IAC3E,aAAa,EAAE,OAAO,eAAe,MAAM,sFAAiF;AAAA,IAC5H,SAAS,EAAE,OAAO,WAAW,MAAM,0CAA0C;AAAA,IAC7E,UAAU,EAAE,OAAO,YAAY,MAAM,qCAAqC;AAAA,EAC5E;AAAA,EACA,OAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,OAAO;AAAA,IACP,UAAU,CAAC,UAAU,GAAG,KAAK;AAAA,EAC/B;AAAA,EACA,eAAe;AAAA,EACf,OAAO;AAAA,EACP,OAAO;AACT;AAMO,SAAS,mBAAmB,QAA0D;AAC3F,SAAO,aAAa,aAAa,2BAA2B,MAAM;AACpE;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from "react";
|
|
2
|
+
import type { LabelOverride } from "../i18n/kit-labels.js";
|
|
3
|
+
import type { AdminAreaLabels } from "./admin-area-labels.js";
|
|
4
|
+
export interface AdminForbiddenProps extends Omit<ComponentPropsWithRef<"div">, "children" | "title"> {
|
|
5
|
+
/** The app's name, in the sentence: "This is where administrators run Kastlan." */
|
|
6
|
+
appName: string;
|
|
7
|
+
/** The button's target: the app's start page (keksdose `/budget`, kastlan `/dashboard`). */
|
|
8
|
+
homeHref: string;
|
|
9
|
+
/** The button's words, where the app names its start ("Back to the budget"). Default
|
|
10
|
+
* `adminArea.forbiddenHome`, "Go to the start page". */
|
|
11
|
+
homeLabel?: string;
|
|
12
|
+
/** Pass it to a translation reviewer: a second button, "Review translations", to the
|
|
13
|
+
* tool their role does have (§2.2 decision 8). */
|
|
14
|
+
reviewerHref?: string;
|
|
15
|
+
/** The heading's level. Default `h1`: the page stands alone inside the app shell. */
|
|
16
|
+
headingAs?: "h1" | "h2" | "h3";
|
|
17
|
+
/** Prop > `<UiKitProvider labels={{ adminArea }}>` > English. */
|
|
18
|
+
labels?: LabelOverride<AdminAreaLabels>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The admin area's 403 page (0.42.0, docs/admin-harmonization.md §2.2 decision 8, §6.7),
|
|
22
|
+
* keksdose's `AdminForbidden`: "Only for administrators" / "This is where administrators
|
|
23
|
+
* run {app}. Your account cannot open this page.", and a button back to the app's start.
|
|
24
|
+
*
|
|
25
|
+
* It RENDERS, it does not redirect: the app's client gate shows it in place of the admin
|
|
26
|
+
* page, on the same admin check the account menu uses, inside the lazy route — so a
|
|
27
|
+
* bookmark keeps its address, and signing in as an admin opens the page that was asked
|
|
28
|
+
* for. The server's gate stays the rule. kastlan shows it on its admin tools (`/admin`,
|
|
29
|
+
* `/import`, `/feedback`); its work pages keep their generic 403.
|
|
30
|
+
*
|
|
31
|
+
* The words say only that this area is closed to this account, never that the person
|
|
32
|
+
* administers nothing anywhere: a kastlan superuser who isn't ADMIN in the acting company
|
|
33
|
+
* gets this page too.
|
|
34
|
+
*/
|
|
35
|
+
export declare function AdminForbidden({ appName, homeHref, homeLabel, reviewerHref, headingAs, labels: labelsProp, className, ...rest }: AdminForbiddenProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ShieldAlert } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { Button } from "../components/button.js";
|
|
6
|
+
import { EmptyState } from "../components/empty-state.js";
|
|
7
|
+
import { useAdminAreaLabels } from "./admin-area-labels.js";
|
|
8
|
+
function AdminForbidden({
|
|
9
|
+
appName,
|
|
10
|
+
homeHref,
|
|
11
|
+
homeLabel,
|
|
12
|
+
reviewerHref,
|
|
13
|
+
headingAs = "h1",
|
|
14
|
+
labels: labelsProp,
|
|
15
|
+
className,
|
|
16
|
+
...rest
|
|
17
|
+
}) {
|
|
18
|
+
const labels = useAdminAreaLabels(labelsProp);
|
|
19
|
+
return /* @__PURE__ */ jsx("div", { ...rest, "data-slot": "admin-forbidden", className: cn("mx-auto w-full max-w-xl p-4 md:p-6", className), children: /* @__PURE__ */ jsx(
|
|
20
|
+
EmptyState,
|
|
21
|
+
{
|
|
22
|
+
icon: /* @__PURE__ */ jsx(ShieldAlert, {}),
|
|
23
|
+
headingAs,
|
|
24
|
+
title: labels.forbiddenTitle,
|
|
25
|
+
hint: labels.forbiddenBody(appName),
|
|
26
|
+
action: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(Button, { href: homeHref, variant: "secondary", children: homeLabel ?? labels.forbiddenHome }),
|
|
28
|
+
reviewerHref !== void 0 && /* @__PURE__ */ jsx(Button, { href: reviewerHref, variant: "secondary", children: labels.forbiddenReviewer })
|
|
29
|
+
] })
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
AdminForbidden
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=admin-forbidden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/admin/admin-forbidden.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from \"react\";\nimport { ShieldAlert } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { Button } from \"../components/button\";\nimport { EmptyState } from \"../components/empty-state\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { useAdminAreaLabels } from \"./admin-area-labels\";\nimport type { AdminAreaLabels } from \"./admin-area-labels\";\n\nexport interface AdminForbiddenProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\" | \"title\"> {\n /** The app's name, in the sentence: \"This is where administrators run Kastlan.\" */\n appName: string;\n /** The button's target: the app's start page (keksdose `/budget`, kastlan `/dashboard`). */\n homeHref: string;\n /** The button's words, where the app names its start (\"Back to the budget\"). Default\n * `adminArea.forbiddenHome`, \"Go to the start page\". */\n homeLabel?: string;\n /** Pass it to a translation reviewer: a second button, \"Review translations\", to the\n * tool their role does have (§2.2 decision 8). */\n reviewerHref?: string;\n /** The heading's level. Default `h1`: the page stands alone inside the app shell. */\n headingAs?: \"h1\" | \"h2\" | \"h3\";\n /** Prop > `<UiKitProvider labels={{ adminArea }}>` > English. */\n labels?: LabelOverride<AdminAreaLabels>;\n}\n\n/**\n * The admin area's 403 page (0.42.0, docs/admin-harmonization.md §2.2 decision 8, §6.7),\n * keksdose's `AdminForbidden`: \"Only for administrators\" / \"This is where administrators\n * run {app}. Your account cannot open this page.\", and a button back to the app's start.\n *\n * It RENDERS, it does not redirect: the app's client gate shows it in place of the admin\n * page, on the same admin check the account menu uses, inside the lazy route — so a\n * bookmark keeps its address, and signing in as an admin opens the page that was asked\n * for. The server's gate stays the rule. kastlan shows it on its admin tools (`/admin`,\n * `/import`, `/feedback`); its work pages keep their generic 403.\n *\n * The words say only that this area is closed to this account, never that the person\n * administers nothing anywhere: a kastlan superuser who isn't ADMIN in the acting company\n * gets this page too.\n */\nexport function AdminForbidden({\n appName,\n homeHref,\n homeLabel,\n reviewerHref,\n headingAs = \"h1\",\n labels: labelsProp,\n className,\n ...rest\n}: AdminForbiddenProps) {\n const labels = useAdminAreaLabels(labelsProp);\n return (\n <div {...rest} data-slot=\"admin-forbidden\" className={cn(\"mx-auto w-full max-w-xl p-4 md:p-6\", className)}>\n <EmptyState\n icon={<ShieldAlert />}\n headingAs={headingAs}\n title={labels.forbiddenTitle}\n hint={labels.forbiddenBody(appName)}\n action={\n <>\n <Button href={homeHref} variant=\"secondary\">\n {homeLabel ?? labels.forbiddenHome}\n </Button>\n {reviewerHref !== undefined && (\n <Button href={reviewerHref} variant=\"secondary\">\n {labels.forbiddenReviewer}\n </Button>\n )}\n </>\n }\n />\n </div>\n );\n}\n"],"mappings":";AAuDc,SAKJ,UALI,KAKJ,YALI;AAtDd,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAE3B,SAAS,0BAA0B;AAmC5B,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,QAAM,SAAS,mBAAmB,UAAU;AAC5C,SACE,oBAAC,SAAK,GAAG,MAAM,aAAU,mBAAkB,WAAW,GAAG,sCAAsC,SAAS,GACtG;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,oBAAC,eAAY;AAAA,MACnB;AAAA,MACA,OAAO,OAAO;AAAA,MACd,MAAM,OAAO,cAAc,OAAO;AAAA,MAClC,QACE,iCACE;AAAA,4BAAC,UAAO,MAAM,UAAU,SAAQ,aAC7B,uBAAa,OAAO,eACvB;AAAA,QACC,iBAAiB,UAChB,oBAAC,UAAO,MAAM,cAAc,SAAQ,aACjC,iBAAO,mBACV;AAAA,SAEJ;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StatTileProps } from "../components/stat-tile.js";
|
|
3
|
+
import type { LabelOverride } from "../i18n/kit-labels.js";
|
|
4
|
+
import type { AdminAreaLabels } from "./admin-area-labels.js";
|
|
5
|
+
/**
|
|
6
|
+
* The admin's start page (0.42.0, docs/admin-harmonization.md §2.4, §6.1–§6.5): a grid
|
|
7
|
+
* of tiles, each a count of what is waiting and a link to where the work is, fed by one
|
|
8
|
+
* server answer.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* `GET /admin/attention` (§2.4 decision 14, §6.4) — server-kit's `AdminAttention`
|
|
12
|
+
* (`eifi1_server_kit.user_admin.attention`), as the API sends it.
|
|
13
|
+
*
|
|
14
|
+
* Each count is `null` where the app has no such thing or this viewer cannot act on it,
|
|
15
|
+
* and every count is `null` in a demo session. Demo accounts never count. `extra` holds
|
|
16
|
+
* the app's own counts, keyed as its overview names them (keksdose `support_waiting`,
|
|
17
|
+
* Kurvenschmiede `released_for_work`).
|
|
18
|
+
*/
|
|
19
|
+
export interface AdminAttention {
|
|
20
|
+
/** "To triage": OPEN reports, crash reports included (§6.1). */
|
|
21
|
+
feedback_waiting: number | null;
|
|
22
|
+
/** Accounts that asked to be deleted — only where this viewer acts on them (§6.2). */
|
|
23
|
+
deletion_requests: number | null;
|
|
24
|
+
invitations_pending: number | null;
|
|
25
|
+
users_total: number | null;
|
|
26
|
+
/** Accounts made in the last seven days. */
|
|
27
|
+
users_new_7d: number | null;
|
|
28
|
+
extra: Record<string, number | null>;
|
|
29
|
+
}
|
|
30
|
+
/** The shared counts that are a tile of their own (`users_new_7d` is the users tile's line). */
|
|
31
|
+
export type AdminAttentionTile = "feedback_waiting" | "deletion_requests" | "invitations_pending" | "users_total";
|
|
32
|
+
/** Where each shared tile links when the app names nothing else (§2.4 decision 13). */
|
|
33
|
+
export declare const DEFAULT_ADMIN_ATTENTION_HREFS: Readonly<Record<AdminAttentionTile, string>>;
|
|
34
|
+
/**
|
|
35
|
+
* The account menu's badge (§2.4 decision 15, §6.3): the sum of the counts that are work
|
|
36
|
+
* waiting on THIS admin — each app names its own (keksdose `["feedback_waiting",
|
|
37
|
+
* "support_waiting", "awaiting_verdict"]`, kastlan `["feedback_waiting"]`, Kurvenschmiede
|
|
38
|
+
* `["feedback_waiting", "deletion_requests"]`). A name is a shared count or an `extra`
|
|
39
|
+
* key; a `null` or missing count adds nothing. Invitations and users never belong in it.
|
|
40
|
+
* `null` while there is no answer yet, so the badge shows nothing rather than a 0.
|
|
41
|
+
*/
|
|
42
|
+
export declare function adminWaitingCount(attention: AdminAttention | null | undefined, counts: readonly (AdminAttentionTile | (string & {}))[]): number | null;
|
|
43
|
+
export interface AttentionTileProps extends Omit<StatTileProps, "href" | "onClick" | "value"> {
|
|
44
|
+
/** The count. `null` shows the tile's dash; {@link AdminOverview} leaves such a tile out. */
|
|
45
|
+
count: number | null | undefined;
|
|
46
|
+
/** Where the work is — the tile is a link to it. Since 0.43 it may be left out: a
|
|
47
|
+
* quiet count, no link (Kurvenschmiede). */
|
|
48
|
+
href?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* One tile of the overview: a {@link StatTile} that is a LINK to where the work is, its
|
|
52
|
+
* count the headline. The whole tile is the link, named by its label; route it through
|
|
53
|
+
* `renderLink` or the provider's link component, as any StatTile. Without `href` (0.43) it
|
|
54
|
+
* is a quiet count, no link.
|
|
55
|
+
*/
|
|
56
|
+
export declare function AttentionTile({ count, href, ...tile }: AttentionTileProps): import("react").JSX.Element;
|
|
57
|
+
/** One of the app's own tiles (§2.4 decision 13: keksdose's "Support waiting"). */
|
|
58
|
+
export interface AdminExtraTile {
|
|
59
|
+
/** Unique among the tiles; usually the `extra` key it shows. */
|
|
60
|
+
key: string;
|
|
61
|
+
label: ReactNode;
|
|
62
|
+
/** `null` or `undefined` leaves the tile out, as for a shared one. */
|
|
63
|
+
count: number | null | undefined;
|
|
64
|
+
/** Where the work is. Left out (0.43, Kurvenschmiede): a quiet count with no link —
|
|
65
|
+
* a number worth seeing that has no page of its own. */
|
|
66
|
+
href?: string;
|
|
67
|
+
/** A line under the count. */
|
|
68
|
+
description?: ReactNode;
|
|
69
|
+
}
|
|
70
|
+
export interface AdminOverviewProps {
|
|
71
|
+
/** The server's answer; `undefined` while it loads (the grid shows its skeletons). */
|
|
72
|
+
attention: AdminAttention | null | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Where the shared tiles link, over {@link DEFAULT_ADMIN_ATTENTION_HREFS} — the
|
|
75
|
+
* inbox's address filtered to OPEN (§6.1) is the app's own:
|
|
76
|
+
* `{ feedback_waiting: "/feedback?status=OPEN" }`.
|
|
77
|
+
*/
|
|
78
|
+
hrefs?: Partial<Record<AdminAttentionTile, string>>;
|
|
79
|
+
/** The app's own tiles, after the shared ones, in this order. */
|
|
80
|
+
extraTiles?: readonly AdminExtraTile[];
|
|
81
|
+
/** Passed to every tile — `renderLink` for the router, `size`, `variant`. */
|
|
82
|
+
tileProps?: Pick<StatTileProps, "renderLink" | "size" | "variant" | "locale">;
|
|
83
|
+
/**
|
|
84
|
+
* 0.43 (keksdose): the answer failed — the query's `error`, or `true`. Anything truthy
|
|
85
|
+
* shows `adminArea.overviewError` in a danger box, with "Try again" when
|
|
86
|
+
* {@link onRetry} is given. A failed poll keeps the last good tiles: with `attention`
|
|
87
|
+
* still there (a query keeps its last data), the box shows ALONGSIDE them, above, not
|
|
88
|
+
* instead (build review 0.43, keksdose N7) — pass `attention.data` as it is. Without
|
|
89
|
+
* an answer yet, the box alone. Without `error`: `undefined` is the skeletons and
|
|
90
|
+
* `null` nothing, as before.
|
|
91
|
+
*/
|
|
92
|
+
error?: unknown;
|
|
93
|
+
/** "Try again" in the error box — the query's `refetch`. */
|
|
94
|
+
onRetry?: () => void;
|
|
95
|
+
/** Prop > `<UiKitProvider labels={{ adminArea }}>` > English. */
|
|
96
|
+
labels?: LabelOverride<AdminAreaLabels>;
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The overview section (§2.4): the shared tiles in their order — To triage, Deletion
|
|
101
|
+
* requests, Pending invitations, Users (with the new accounts of the last 7 days under
|
|
102
|
+
* the total) — then the app's `extraTiles`. A tile whose count is `null` is left out,
|
|
103
|
+
* so each app shows only what it has; a `0` is a quiet tile, "nothing waiting".
|
|
104
|
+
*
|
|
105
|
+
* The overview is the admin area's landing page, standalone: it is NOT wrapped in a
|
|
106
|
+
* `SettingsSection` (`adminSections` gives it no entry; render it as the page's body, as
|
|
107
|
+
* Kurvenschmiede's `OverviewPanel` does). keksdose links its metrics from here with at
|
|
108
|
+
* most two tiles (§6.5).
|
|
109
|
+
*/
|
|
110
|
+
export declare function AdminOverview({ attention, hrefs, extraTiles, tileProps, error, onRetry, labels: labelsProp, className, }: AdminOverviewProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertBanner } from "../components/alert-banner.js";
|
|
4
|
+
import { Button } from "../components/button.js";
|
|
5
|
+
import { StatTile, StatTileGrid } from "../components/stat-tile.js";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { useAdminAreaLabels } from "./admin-area-labels.js";
|
|
8
|
+
const DEFAULT_ADMIN_ATTENTION_HREFS = Object.freeze({
|
|
9
|
+
feedback_waiting: "/feedback",
|
|
10
|
+
deletion_requests: "/admin/users?state=deletion_requested",
|
|
11
|
+
invitations_pending: "/admin/invitations",
|
|
12
|
+
users_total: "/admin/users"
|
|
13
|
+
});
|
|
14
|
+
function adminWaitingCount(attention, counts) {
|
|
15
|
+
if (!attention) return null;
|
|
16
|
+
let sum = 0;
|
|
17
|
+
for (const key of counts) {
|
|
18
|
+
const shared = attention[key];
|
|
19
|
+
const value = typeof shared === "number" ? shared : attention.extra?.[key];
|
|
20
|
+
if (typeof value === "number" && value > 0) sum += value;
|
|
21
|
+
}
|
|
22
|
+
return sum;
|
|
23
|
+
}
|
|
24
|
+
function AttentionTile({ count, href, ...tile }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(StatTile, { "data-slot": "attention-tile", ...tile, value: count ?? null, href });
|
|
26
|
+
}
|
|
27
|
+
function AdminOverview({
|
|
28
|
+
attention,
|
|
29
|
+
hrefs,
|
|
30
|
+
extraTiles = [],
|
|
31
|
+
tileProps,
|
|
32
|
+
error,
|
|
33
|
+
onRetry,
|
|
34
|
+
labels: labelsProp,
|
|
35
|
+
className
|
|
36
|
+
}) {
|
|
37
|
+
const labels = useAdminAreaLabels(labelsProp);
|
|
38
|
+
const errorBox = (alone) => /* @__PURE__ */ jsx(
|
|
39
|
+
AlertBanner,
|
|
40
|
+
{
|
|
41
|
+
"data-slot": alone ? "admin-overview" : void 0,
|
|
42
|
+
"data-state": alone ? "error" : void 0,
|
|
43
|
+
variant: "box",
|
|
44
|
+
tone: "danger",
|
|
45
|
+
className: alone ? className : void 0,
|
|
46
|
+
action: onRetry ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", size: "sm", onClick: () => onRetry(), children: labels.retry }) : void 0,
|
|
47
|
+
children: labels.overviewError
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
if (error && !attention) return errorBox(true);
|
|
51
|
+
const href = { ...DEFAULT_ADMIN_ATTENTION_HREFS, ...hrefs };
|
|
52
|
+
const loading = attention === void 0;
|
|
53
|
+
const shared = [
|
|
54
|
+
{ key: "feedback_waiting", label: labels.tiles.feedbackWaiting },
|
|
55
|
+
{ key: "deletion_requests", label: labels.tiles.deletionRequests },
|
|
56
|
+
{ key: "invitations_pending", label: labels.tiles.invitationsPending },
|
|
57
|
+
{
|
|
58
|
+
key: "users_total",
|
|
59
|
+
label: labels.tiles.users,
|
|
60
|
+
description: attention && typeof attention.users_new_7d === "number" ? labels.tiles.usersNew(attention.users_new_7d) : void 0
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
const tiles = [
|
|
64
|
+
...shared.map((t) => ({ ...t, count: attention ? attention[t.key] : void 0, href: href[t.key] })),
|
|
65
|
+
...extraTiles
|
|
66
|
+
].filter((t) => loading || t.count !== null && t.count !== void 0);
|
|
67
|
+
if (!loading && tiles.length === 0) return error ? errorBox(true) : null;
|
|
68
|
+
const grid = /* @__PURE__ */ jsx(StatTileGrid, { "data-slot": error ? void 0 : "admin-overview", loading, className: error ? void 0 : className, children: tiles.map((t) => /* @__PURE__ */ jsx(
|
|
69
|
+
AttentionTile,
|
|
70
|
+
{
|
|
71
|
+
...tileProps,
|
|
72
|
+
"data-attention": t.key,
|
|
73
|
+
label: t.label,
|
|
74
|
+
count: t.count,
|
|
75
|
+
href: t.href,
|
|
76
|
+
description: t.description
|
|
77
|
+
},
|
|
78
|
+
t.key
|
|
79
|
+
)) });
|
|
80
|
+
if (!error) return grid;
|
|
81
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "admin-overview", "data-state": "error", className: cn("space-y-4", className), children: [
|
|
82
|
+
errorBox(false),
|
|
83
|
+
grid
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
AdminOverview,
|
|
88
|
+
AttentionTile,
|
|
89
|
+
DEFAULT_ADMIN_ATTENTION_HREFS,
|
|
90
|
+
adminWaitingCount
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=admin-overview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/admin/admin-overview.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Button } from \"../components/button\";\nimport { StatTile, StatTileGrid } from \"../components/stat-tile\";\nimport type { StatTileProps } from \"../components/stat-tile\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { useAdminAreaLabels } from \"./admin-area-labels\";\nimport type { AdminAreaLabels } from \"./admin-area-labels\";\n\n/**\n * The admin's start page (0.42.0, docs/admin-harmonization.md §2.4, §6.1–§6.5): a grid\n * of tiles, each a count of what is waiting and a link to where the work is, fed by one\n * server answer.\n */\n\n/**\n * `GET /admin/attention` (§2.4 decision 14, §6.4) — server-kit's `AdminAttention`\n * (`eifi1_server_kit.user_admin.attention`), as the API sends it.\n *\n * Each count is `null` where the app has no such thing or this viewer cannot act on it,\n * and every count is `null` in a demo session. Demo accounts never count. `extra` holds\n * the app's own counts, keyed as its overview names them (keksdose `support_waiting`,\n * Kurvenschmiede `released_for_work`).\n */\nexport interface AdminAttention {\n /** \"To triage\": OPEN reports, crash reports included (§6.1). */\n feedback_waiting: number | null;\n /** Accounts that asked to be deleted — only where this viewer acts on them (§6.2). */\n deletion_requests: number | null;\n invitations_pending: number | null;\n users_total: number | null;\n /** Accounts made in the last seven days. */\n users_new_7d: number | null;\n extra: Record<string, number | null>;\n}\n\n/** The shared counts that are a tile of their own (`users_new_7d` is the users tile's line). */\nexport type AdminAttentionTile = \"feedback_waiting\" | \"deletion_requests\" | \"invitations_pending\" | \"users_total\";\n\n/** Where each shared tile links when the app names nothing else (§2.4 decision 13). */\nexport const DEFAULT_ADMIN_ATTENTION_HREFS: Readonly<Record<AdminAttentionTile, string>> = Object.freeze({\n feedback_waiting: \"/feedback\",\n deletion_requests: \"/admin/users?state=deletion_requested\",\n invitations_pending: \"/admin/invitations\",\n users_total: \"/admin/users\",\n});\n\n/**\n * The account menu's badge (§2.4 decision 15, §6.3): the sum of the counts that are work\n * waiting on THIS admin — each app names its own (keksdose `[\"feedback_waiting\",\n * \"support_waiting\", \"awaiting_verdict\"]`, kastlan `[\"feedback_waiting\"]`, Kurvenschmiede\n * `[\"feedback_waiting\", \"deletion_requests\"]`). A name is a shared count or an `extra`\n * key; a `null` or missing count adds nothing. Invitations and users never belong in it.\n * `null` while there is no answer yet, so the badge shows nothing rather than a 0.\n */\nexport function adminWaitingCount(\n attention: AdminAttention | null | undefined,\n counts: readonly (AdminAttentionTile | (string & {}))[],\n): number | null {\n if (!attention) return null;\n let sum = 0;\n for (const key of counts) {\n const shared = (attention as unknown as Record<string, unknown>)[key];\n const value = typeof shared === \"number\" ? shared : attention.extra?.[key];\n if (typeof value === \"number\" && value > 0) sum += value;\n }\n return sum;\n}\n\nexport interface AttentionTileProps extends Omit<StatTileProps, \"href\" | \"onClick\" | \"value\"> {\n /** The count. `null` shows the tile's dash; {@link AdminOverview} leaves such a tile out. */\n count: number | null | undefined;\n /** Where the work is — the tile is a link to it. Since 0.43 it may be left out: a\n * quiet count, no link (Kurvenschmiede). */\n href?: string;\n}\n\n/**\n * One tile of the overview: a {@link StatTile} that is a LINK to where the work is, its\n * count the headline. The whole tile is the link, named by its label; route it through\n * `renderLink` or the provider's link component, as any StatTile. Without `href` (0.43) it\n * is a quiet count, no link.\n */\nexport function AttentionTile({ count, href, ...tile }: AttentionTileProps) {\n return <StatTile data-slot=\"attention-tile\" {...tile} value={count ?? null} href={href} />;\n}\n\n/** One of the app's own tiles (§2.4 decision 13: keksdose's \"Support waiting\"). */\nexport interface AdminExtraTile {\n /** Unique among the tiles; usually the `extra` key it shows. */\n key: string;\n label: ReactNode;\n /** `null` or `undefined` leaves the tile out, as for a shared one. */\n count: number | null | undefined;\n /** Where the work is. Left out (0.43, Kurvenschmiede): a quiet count with no link —\n * a number worth seeing that has no page of its own. */\n href?: string;\n /** A line under the count. */\n description?: ReactNode;\n}\n\nexport interface AdminOverviewProps {\n /** The server's answer; `undefined` while it loads (the grid shows its skeletons). */\n attention: AdminAttention | null | undefined;\n /**\n * Where the shared tiles link, over {@link DEFAULT_ADMIN_ATTENTION_HREFS} — the\n * inbox's address filtered to OPEN (§6.1) is the app's own:\n * `{ feedback_waiting: \"/feedback?status=OPEN\" }`.\n */\n hrefs?: Partial<Record<AdminAttentionTile, string>>;\n /** The app's own tiles, after the shared ones, in this order. */\n extraTiles?: readonly AdminExtraTile[];\n /** Passed to every tile — `renderLink` for the router, `size`, `variant`. */\n tileProps?: Pick<StatTileProps, \"renderLink\" | \"size\" | \"variant\" | \"locale\">;\n /**\n * 0.43 (keksdose): the answer failed — the query's `error`, or `true`. Anything truthy\n * shows `adminArea.overviewError` in a danger box, with \"Try again\" when\n * {@link onRetry} is given. A failed poll keeps the last good tiles: with `attention`\n * still there (a query keeps its last data), the box shows ALONGSIDE them, above, not\n * instead (build review 0.43, keksdose N7) — pass `attention.data` as it is. Without\n * an answer yet, the box alone. Without `error`: `undefined` is the skeletons and\n * `null` nothing, as before.\n */\n error?: unknown;\n /** \"Try again\" in the error box — the query's `refetch`. */\n onRetry?: () => void;\n /** Prop > `<UiKitProvider labels={{ adminArea }}>` > English. */\n labels?: LabelOverride<AdminAreaLabels>;\n className?: string;\n}\n\n/**\n * The overview section (§2.4): the shared tiles in their order — To triage, Deletion\n * requests, Pending invitations, Users (with the new accounts of the last 7 days under\n * the total) — then the app's `extraTiles`. A tile whose count is `null` is left out,\n * so each app shows only what it has; a `0` is a quiet tile, \"nothing waiting\".\n *\n * The overview is the admin area's landing page, standalone: it is NOT wrapped in a\n * `SettingsSection` (`adminSections` gives it no entry; render it as the page's body, as\n * Kurvenschmiede's `OverviewPanel` does). keksdose links its metrics from here with at\n * most two tiles (§6.5).\n */\nexport function AdminOverview({\n attention,\n hrefs,\n extraTiles = [],\n tileProps,\n error,\n onRetry,\n labels: labelsProp,\n className,\n}: AdminOverviewProps) {\n const labels = useAdminAreaLabels(labelsProp);\n /** The error box: on its own (`alone`) it is the overview's root. */\n const errorBox = (alone: boolean) => (\n <AlertBanner\n data-slot={alone ? \"admin-overview\" : undefined}\n data-state={alone ? \"error\" : undefined}\n variant=\"box\"\n tone=\"danger\"\n className={alone ? className : undefined}\n action={\n onRetry ? (\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={() => onRetry()}>\n {labels.retry}\n </Button>\n ) : undefined\n }\n >\n {labels.overviewError}\n </AlertBanner>\n );\n // Nothing good to keep: the box alone.\n if (error && !attention) return errorBox(true);\n const href = { ...DEFAULT_ADMIN_ATTENTION_HREFS, ...hrefs };\n const loading = attention === undefined;\n const shared: { key: AdminAttentionTile; label: string; description?: ReactNode }[] = [\n { key: \"feedback_waiting\", label: labels.tiles.feedbackWaiting },\n { key: \"deletion_requests\", label: labels.tiles.deletionRequests },\n { key: \"invitations_pending\", label: labels.tiles.invitationsPending },\n {\n key: \"users_total\",\n label: labels.tiles.users,\n description:\n attention && typeof attention.users_new_7d === \"number\" ? labels.tiles.usersNew(attention.users_new_7d) : undefined,\n },\n ];\n const tiles = [\n ...shared.map((t) => ({ ...t, count: attention ? attention[t.key] : undefined, href: href[t.key] })),\n ...extraTiles,\n ].filter((t) => loading || (t.count !== null && t.count !== undefined));\n if (!loading && tiles.length === 0) return error ? errorBox(true) : null;\n const grid = (\n <StatTileGrid data-slot={error ? undefined : \"admin-overview\"} loading={loading} className={error ? undefined : className}>\n {tiles.map((t) => (\n <AttentionTile\n key={t.key}\n {...tileProps}\n data-attention={t.key}\n label={t.label}\n count={t.count}\n href={t.href}\n description={t.description}\n />\n ))}\n </StatTileGrid>\n );\n if (!error) return grid;\n // A failed poll: the error above the last good tiles.\n return (\n <div data-slot=\"admin-overview\" data-state=\"error\" className={cn(\"space-y-4\", className)}>\n {errorBox(false)}\n {grid}\n </div>\n );\n}\n"],"mappings":";AAqFS,cA8HL,YA9HK;AApFT,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,UAAU,oBAAoB;AAGvC,SAAS,UAAU;AACnB,SAAS,0BAA0B;AAkC5B,MAAM,gCAA8E,OAAO,OAAO;AAAA,EACvG,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,aAAa;AACf,CAAC;AAUM,SAAS,kBACd,WACA,QACe;AACf,MAAI,CAAC,UAAW,QAAO;AACvB,MAAI,MAAM;AACV,aAAW,OAAO,QAAQ;AACxB,UAAM,SAAU,UAAiD,GAAG;AACpE,UAAM,QAAQ,OAAO,WAAW,WAAW,SAAS,UAAU,QAAQ,GAAG;AACzE,QAAI,OAAO,UAAU,YAAY,QAAQ,EAAG,QAAO;AAAA,EACrD;AACA,SAAO;AACT;AAgBO,SAAS,cAAc,EAAE,OAAO,MAAM,GAAG,KAAK,GAAuB;AAC1E,SAAO,oBAAC,YAAS,aAAU,kBAAkB,GAAG,MAAM,OAAO,SAAS,MAAM,MAAY;AAC1F;AAyDO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,aAAa,CAAC;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAAuB;AACrB,QAAM,SAAS,mBAAmB,UAAU;AAE5C,QAAM,WAAW,CAAC,UAChB;AAAA,IAAC;AAAA;AAAA,MACC,aAAW,QAAQ,mBAAmB;AAAA,MACtC,cAAY,QAAQ,UAAU;AAAA,MAC9B,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAW,QAAQ,YAAY;AAAA,MAC/B,QACE,UACE,oBAAC,UAAO,MAAK,UAAS,SAAQ,aAAY,MAAK,MAAK,SAAS,MAAM,QAAQ,GACxE,iBAAO,OACV,IACE;AAAA,MAGL,iBAAO;AAAA;AAAA,EACV;AAGF,MAAI,SAAS,CAAC,UAAW,QAAO,SAAS,IAAI;AAC7C,QAAM,OAAO,EAAE,GAAG,+BAA+B,GAAG,MAAM;AAC1D,QAAM,UAAU,cAAc;AAC9B,QAAM,SAAgF;AAAA,IACpF,EAAE,KAAK,oBAAoB,OAAO,OAAO,MAAM,gBAAgB;AAAA,IAC/D,EAAE,KAAK,qBAAqB,OAAO,OAAO,MAAM,iBAAiB;AAAA,IACjE,EAAE,KAAK,uBAAuB,OAAO,OAAO,MAAM,mBAAmB;AAAA,IACrE;AAAA,MACE,KAAK;AAAA,MACL,OAAO,OAAO,MAAM;AAAA,MACpB,aACE,aAAa,OAAO,UAAU,iBAAiB,WAAW,OAAO,MAAM,SAAS,UAAU,YAAY,IAAI;AAAA,IAC9G;AAAA,EACF;AACA,QAAM,QAAQ;AAAA,IACZ,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,YAAY,UAAU,EAAE,GAAG,IAAI,QAAW,MAAM,KAAK,EAAE,GAAG,EAAE,EAAE;AAAA,IACnG,GAAG;AAAA,EACL,EAAE,OAAO,CAAC,MAAM,WAAY,EAAE,UAAU,QAAQ,EAAE,UAAU,MAAU;AACtE,MAAI,CAAC,WAAW,MAAM,WAAW,EAAG,QAAO,QAAQ,SAAS,IAAI,IAAI;AACpE,QAAM,OACJ,oBAAC,gBAAa,aAAW,QAAQ,SAAY,kBAAkB,SAAkB,WAAW,QAAQ,SAAY,WAC7G,gBAAM,IAAI,CAAC,MACV;AAAA,IAAC;AAAA;AAAA,MAEE,GAAG;AAAA,MACJ,kBAAgB,EAAE;AAAA,MAClB,OAAO,EAAE;AAAA,MACT,OAAO,EAAE;AAAA,MACT,MAAM,EAAE;AAAA,MACR,aAAa,EAAE;AAAA;AAAA,IANV,EAAE;AAAA,EAOT,CACD,GACH;AAEF,MAAI,CAAC,MAAO,QAAO;AAEnB,SACE,qBAAC,SAAI,aAAU,kBAAiB,cAAW,SAAQ,WAAW,GAAG,aAAa,SAAS,GACpF;AAAA,aAAS,KAAK;AAAA,IACd;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import type { SettingsGroup } from "../settings/settings-catalogue.js";
|
|
3
|
+
import type { AdminAreaLabels, AdminSharedSection } from "./admin-area-labels.js";
|
|
4
|
+
/**
|
|
5
|
+
* The admin area's sections (0.42.0, docs/admin-harmonization.md §2.3, §6.8): the five
|
|
6
|
+
* every app shares, in the template's order, and the helper that builds an app's
|
|
7
|
+
* `SettingsLayout` catalogue groups from them and the app's own.
|
|
8
|
+
*/
|
|
9
|
+
/** One shared section: its path segment and its icon. The words are `adminArea.sections`. */
|
|
10
|
+
export interface AdminSectionDefinition {
|
|
11
|
+
id: AdminSharedSection;
|
|
12
|
+
icon: LucideIcon;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The shared sections in the template's order (§2.3 decision 10, §6.13): Overview, Users,
|
|
16
|
+
* Invitations, Billing, Activity. An app's own sections go between them
|
|
17
|
+
* ({@link adminSections}).
|
|
18
|
+
*/
|
|
19
|
+
export declare const ADMIN_SECTIONS: readonly AdminSectionDefinition[];
|
|
20
|
+
/**
|
|
21
|
+
* One of the app's own sections: a catalogue group with its words, plus where it goes.
|
|
22
|
+
* `after` names the section it follows — a shared one or another of the app's own. Left
|
|
23
|
+
* out, it goes where the template puts an app's sections, after Invitations and before
|
|
24
|
+
* Billing, in the order given.
|
|
25
|
+
*/
|
|
26
|
+
export interface AdminOwnSection<G extends string = string> extends SettingsGroup<G> {
|
|
27
|
+
after?: AdminSharedSection | G;
|
|
28
|
+
}
|
|
29
|
+
/** Where one section goes, without its words — what {@link adminSectionOrder} takes. An
|
|
30
|
+
* {@link AdminOwnSection} is one. */
|
|
31
|
+
export interface AdminSectionPlace<G extends string = string> {
|
|
32
|
+
id: G;
|
|
33
|
+
after?: AdminSharedSection | G;
|
|
34
|
+
}
|
|
35
|
+
/** The order's options: the shared sections an app does not have. */
|
|
36
|
+
export interface AdminSectionOrderOptions<L extends AdminSharedSection = AdminSharedSection> {
|
|
37
|
+
/**
|
|
38
|
+
* Shared sections this app does not have — keksdose and Kurvenschmiede have no billing
|
|
39
|
+
* view (`["billing"]`). Left out, every shared section is in the catalogue. Since 0.43
|
|
40
|
+
* the result's type leaves them out too, so no cast is needed to drop `"billing"` —
|
|
41
|
+
* when TypeScript infers the type arguments. With them written out, name the left-out
|
|
42
|
+
* ones as the second (`adminSections<Own, "billing">(…)`); `adminSections<Own>(…)`
|
|
43
|
+
* keeps every shared id in the type, as before.
|
|
44
|
+
*/
|
|
45
|
+
leaveOut?: readonly L[];
|
|
46
|
+
}
|
|
47
|
+
export interface AdminSectionsOptions<L extends AdminSharedSection = AdminSharedSection> extends AdminSectionOrderOptions<L> {
|
|
48
|
+
/**
|
|
49
|
+
* A shared section that is in the catalogue but hidden for now, as
|
|
50
|
+
* {@link SettingsGroup.visible}: kastlan's `{ billing: billingEnabled }` (settings §5),
|
|
51
|
+
* whose path then acts as an unknown one.
|
|
52
|
+
*/
|
|
53
|
+
visible?: Partial<Record<AdminSharedSection, boolean>>;
|
|
54
|
+
}
|
|
55
|
+
/** The shared sections an app keeps when it leaves out `L`. A `leaveOut` typed as the
|
|
56
|
+
* whole union (a variable of `AdminSharedSection[]`) says nothing about which, so it
|
|
57
|
+
* narrows nothing. */
|
|
58
|
+
export type AdminKeptSection<L extends AdminSharedSection = AdminSharedSection> = [AdminSharedSection] extends [L] ? AdminSharedSection : Exclude<AdminSharedSection, L>;
|
|
59
|
+
/**
|
|
60
|
+
* The admin area's section ids in the template's order (0.43, keksdose) — what
|
|
61
|
+
* {@link adminSections} builds its groups in, without the words: for an app that needs the
|
|
62
|
+
* ORDER only (a router's list of paths, a test), outside a component, with no labels.
|
|
63
|
+
*
|
|
64
|
+
* adminSectionOrder([{ id: "metrics", after: "overview" }], { leaveOut: ["billing"] })
|
|
65
|
+
* // ["overview", "metrics", "users", "invitations", "activity"]
|
|
66
|
+
*
|
|
67
|
+
* Throws as {@link adminSections} does.
|
|
68
|
+
*/
|
|
69
|
+
export declare function adminSectionOrder<G extends string = never, L extends AdminSharedSection = AdminSharedSection>(own?: readonly AdminSectionPlace<G>[], options?: AdminSectionOrderOptions<L>): (AdminKeptSection<L> | G)[];
|
|
70
|
+
/**
|
|
71
|
+
* An app's admin catalogue groups, in the template's order (§2.3 decision 10, §6.8): the
|
|
72
|
+
* shared sections with the kit's icons and words, and the app's own at the places they
|
|
73
|
+
* name. The result is `SettingsLayout`'s `groups`; the entries stay the app's (a group
|
|
74
|
+
* with no visible entry is hidden, as on any settings page — except, since 0.43, the
|
|
75
|
+
* Overview, a page of tiles that needs no entry: it is `standalone`). Since 0.43 the
|
|
76
|
+
* result's type leaves out the `leaveOut` sections, and {@link adminSectionOrder} gives
|
|
77
|
+
* the same order as ids, without words.
|
|
78
|
+
*
|
|
79
|
+
* const groups = adminSections(useAdminAreaLabels(), [
|
|
80
|
+
* { id: "metrics", icon: <BarChart3 />, title: t("…"), help: t("…"), after: "overview" },
|
|
81
|
+
* { id: "messaging", icon: <MessageSquare />, title: t("…"), help: t("…") },
|
|
82
|
+
* { id: "health", icon: <HeartPulse />, title: t("…"), help: t("…"), after: "billing" },
|
|
83
|
+
* ], { leaveOut: ["billing"] });
|
|
84
|
+
*
|
|
85
|
+
* gives keksdose's overview, metrics, users, invitations, messaging, health, activity.
|
|
86
|
+
* An `after` that names a left-out section takes that section's place. Kurvenschmiede's
|
|
87
|
+
* Teams needs no `after`: between Invitations and Activity is the default.
|
|
88
|
+
*
|
|
89
|
+
* `labels` is the `adminArea` namespace, resolved — {@link useAdminAreaLabels} inside a
|
|
90
|
+
* component, or the app's catalogue for the language; `undefined` is English. Throws for
|
|
91
|
+
* an own section whose id is a shared one, an id given twice, or an `after` that names no
|
|
92
|
+
* section: the catalogue is built once, and a section quietly missing from it is worse.
|
|
93
|
+
*/
|
|
94
|
+
export declare function adminSections<G extends string = never, L extends AdminSharedSection = AdminSharedSection>(labels: AdminAreaLabels | undefined, own?: readonly AdminOwnSection<G>[], options?: AdminSectionsOptions<L>): SettingsGroup<AdminKeptSection<L> | G>[];
|