@streamoid/settings 0.3.6 → 0.3.8
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 +27 -1
- package/dist/index.d.mts +67 -22
- package/dist/index.d.ts +67 -22
- package/dist/index.js +1174 -962
- package/dist/index.mjs +1172 -953
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,9 @@ function MySettingsPage() {
|
|
|
58
58
|
revokeToken: (id) => fetch(`/tokens/${id}`, { method: "DELETE" }).then(() => undefined),
|
|
59
59
|
},
|
|
60
60
|
navigation: {
|
|
61
|
-
|
|
61
|
+
// `replace` matters once you wire up `onClose` below — otherwise a
|
|
62
|
+
// history-based close walks back through every tab the user visited.
|
|
63
|
+
navigateToTab: (tab) => router.replace(`/settings/${TAB_TO_URL[tab]}`),
|
|
62
64
|
openExternal: (url) => window.open(url, "_blank", "noopener"),
|
|
63
65
|
},
|
|
64
66
|
toast: {
|
|
@@ -75,11 +77,35 @@ function MySettingsPage() {
|
|
|
75
77
|
<SettingsContent
|
|
76
78
|
activeTab={resolveSettingsTabFromPath(location.pathname)}
|
|
77
79
|
adapters={adapters}
|
|
80
|
+
onClose={() => router.back()}
|
|
78
81
|
/>
|
|
79
82
|
);
|
|
80
83
|
}
|
|
81
84
|
```
|
|
82
85
|
|
|
86
|
+
## Closing settings
|
|
87
|
+
|
|
88
|
+
Settings is a full page in every host, so the package cannot decide what
|
|
89
|
+
"closed" means — pass `onClose` (or `adapters.navigation.close`) and the shell
|
|
90
|
+
renders a × button in the header and dismisses on `Escape`. Pass neither and no
|
|
91
|
+
close affordance appears.
|
|
92
|
+
|
|
93
|
+
Escape defers to anything stacked on top of the panel. `overlay-registry.ts`
|
|
94
|
+
keeps an ordered stack of open modals — only the frontmost one acts on a press,
|
|
95
|
+
and the shell acts only once the stack is empty. The billing **Plans** sub-view
|
|
96
|
+
steps back to billing before the panel itself closes.
|
|
97
|
+
|
|
98
|
+
Modals added to this package should call `useOverlayOpen(open, onClose)` at the
|
|
99
|
+
top of the component. That is what registers them in the stack; skip it and
|
|
100
|
+
Escape will close the whole panel out from under the modal.
|
|
101
|
+
|
|
102
|
+
## Explaining the tabs
|
|
103
|
+
|
|
104
|
+
Every sub-nav destination carries a hover/focus tooltip sourced from the
|
|
105
|
+
exported `TAB_DESCRIPTIONS` map. Override the copy in your host by rendering
|
|
106
|
+
your own nav, or edit the map here so all hosts stay consistent — the latter is
|
|
107
|
+
usually what you want.
|
|
108
|
+
|
|
83
109
|
## Adapter surface
|
|
84
110
|
|
|
85
111
|
| Adapter | Purpose |
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SVGProps, ReactNode } from 'react';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { SVGProps, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Settings tab identifiers and URL mapping helpers.
|
|
@@ -16,6 +16,13 @@ declare const TAB_TO_URL: Record<SettingsTab, string>;
|
|
|
16
16
|
declare const URL_TO_TAB: Record<string, SettingsTab>;
|
|
17
17
|
/** Human-readable label for each tab (used for breadcrumbs etc.). */
|
|
18
18
|
declare const TAB_LABELS: Record<SettingsTab, string>;
|
|
19
|
+
/**
|
|
20
|
+
* One-line explanation of what each destination is for, shown on hover over the
|
|
21
|
+
* settings sub-nav. Kept next to `TAB_LABELS` so a new tab can't get a label
|
|
22
|
+
* without also getting an explanation — `Record<SettingsTab, string>` makes
|
|
23
|
+
* omitting one a type error.
|
|
24
|
+
*/
|
|
25
|
+
declare const TAB_DESCRIPTIONS: Record<SettingsTab, string>;
|
|
19
26
|
/**
|
|
20
27
|
* Resolve a `SettingsTab` from a URL pathname. Looks for the last segment that
|
|
21
28
|
* matches a known slug; falls back to `"profile"` (the default Account tab).
|
|
@@ -196,6 +203,9 @@ interface OrganizationMember {
|
|
|
196
203
|
_id: string;
|
|
197
204
|
role: "admin" | "member";
|
|
198
205
|
inviteAccess: boolean;
|
|
206
|
+
/** Populated user. Rows whose user document was deleted come back from the
|
|
207
|
+
* API with a null `user` — OrganizationContent drops those on fetch, so
|
|
208
|
+
* every render site can treat this as present. */
|
|
199
209
|
user: {
|
|
200
210
|
_id: string;
|
|
201
211
|
email: string;
|
|
@@ -699,6 +709,13 @@ interface SettingsNavigationAdapter {
|
|
|
699
709
|
getCheckoutReturnUrl?: (kind: "success" | "cancel") => string;
|
|
700
710
|
/** Imperative navigate to another settings tab. */
|
|
701
711
|
navigateToTab: (tab: SettingsTab) => void;
|
|
712
|
+
/**
|
|
713
|
+
* Leave settings entirely. Supplying this makes the shell render a close (×)
|
|
714
|
+
* button and dismiss on Escape. Hosts that would rather pass a callback
|
|
715
|
+
* directly can use the `onClose` prop on `<SettingsContent>` instead — it
|
|
716
|
+
* takes precedence over this.
|
|
717
|
+
*/
|
|
718
|
+
close?: () => void;
|
|
702
719
|
/** External-link navigate (e.g. for "What's new" or referral promo links). */
|
|
703
720
|
openExternal: (url: string) => void;
|
|
704
721
|
}
|
|
@@ -726,7 +743,7 @@ type WorkspaceInfo = SettingsWorkspaceListItem & {
|
|
|
726
743
|
plan?: string;
|
|
727
744
|
ownerEmail?: string;
|
|
728
745
|
};
|
|
729
|
-
declare function ProfileTab():
|
|
746
|
+
declare function ProfileTab(): react.JSX.Element;
|
|
730
747
|
declare function WorkspaceTab({ workspaces, loading, onCreateClick: _onCreateClick, onEditClick, onSwitchClick, onLeaveClick, }: {
|
|
731
748
|
workspaces: WorkspaceInfo[];
|
|
732
749
|
loading: boolean;
|
|
@@ -734,21 +751,31 @@ declare function WorkspaceTab({ workspaces, loading, onCreateClick: _onCreateCli
|
|
|
734
751
|
onEditClick: (ws: WorkspaceInfo) => void;
|
|
735
752
|
onSwitchClick: (ws: WorkspaceInfo) => void;
|
|
736
753
|
onLeaveClick: (ws: WorkspaceInfo) => void;
|
|
737
|
-
}):
|
|
738
|
-
declare function ReferralTab():
|
|
754
|
+
}): react.JSX.Element;
|
|
755
|
+
declare function ReferralTab(): react.JSX.Element;
|
|
739
756
|
interface SettingsContentProps {
|
|
740
757
|
adapters: SettingsAdapters;
|
|
741
758
|
/** Currently active tab. The host owns routing and resolves this from the URL. */
|
|
742
759
|
activeTab?: SettingsTab;
|
|
760
|
+
/**
|
|
761
|
+
* Leave settings. When supplied, the shell renders a close (×) button in the
|
|
762
|
+
* header and dismisses on Escape; the host decides where "closed" goes
|
|
763
|
+
* (settings is a full route in most hosts, not an overlay).
|
|
764
|
+
*
|
|
765
|
+
* Falls back to `adapters.navigation.close` so hosts that already build an
|
|
766
|
+
* adapter object don't have to thread a second prop through. Omit both and
|
|
767
|
+
* no close affordance is rendered — that is the pre-0.3.8 behaviour.
|
|
768
|
+
*/
|
|
769
|
+
onClose?: () => void;
|
|
743
770
|
}
|
|
744
|
-
declare function SettingsContent({ adapters, activeTab }: SettingsContentProps):
|
|
771
|
+
declare function SettingsContent({ adapters, activeTab, onClose, }: SettingsContentProps): react.JSX.Element;
|
|
745
772
|
|
|
746
773
|
type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width' | 'height'> & {
|
|
747
774
|
color?: string;
|
|
748
775
|
strokeWidth?: number | string;
|
|
749
776
|
size?: number | string;
|
|
750
777
|
};
|
|
751
|
-
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) =>
|
|
778
|
+
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
752
779
|
|
|
753
780
|
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, }?: {
|
|
754
781
|
embedded?: boolean;
|
|
@@ -756,19 +783,19 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
|
|
|
756
783
|
* wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
|
|
757
784
|
showPlans?: boolean;
|
|
758
785
|
onShowPlansChange?: (open: boolean) => void;
|
|
759
|
-
}):
|
|
786
|
+
}): react__default.JSX.Element;
|
|
760
787
|
|
|
761
788
|
declare function TeamsContent({ embedded, onInviteOpen, onInviteOpenChange, }?: {
|
|
762
789
|
embedded?: boolean;
|
|
763
790
|
onInviteOpen?: boolean;
|
|
764
791
|
onInviteOpenChange?: (open: boolean) => void;
|
|
765
|
-
}):
|
|
792
|
+
}): react.JSX.Element;
|
|
766
793
|
|
|
767
794
|
declare function OrganizationContent({ embedded, onInviteOpen, onInviteOpenChange, }?: {
|
|
768
795
|
embedded?: boolean;
|
|
769
796
|
onInviteOpen?: boolean;
|
|
770
797
|
onInviteOpenChange?: (open: boolean) => void;
|
|
771
|
-
}):
|
|
798
|
+
}): react.JSX.Element;
|
|
772
799
|
|
|
773
800
|
declare function TokensContent({ embedded, showRevokedOverride, onShowRevokedChange: _onShowRevokedChange, createOpenOverride, onCreateOpenChange, }?: {
|
|
774
801
|
embedded?: boolean;
|
|
@@ -776,7 +803,7 @@ declare function TokensContent({ embedded, showRevokedOverride, onShowRevokedCha
|
|
|
776
803
|
onShowRevokedChange?: (v: boolean) => void;
|
|
777
804
|
createOpenOverride?: boolean;
|
|
778
805
|
onCreateOpenChange?: (v: boolean) => void;
|
|
779
|
-
}):
|
|
806
|
+
}): react.JSX.Element;
|
|
780
807
|
|
|
781
808
|
interface ProfileAvatarProps {
|
|
782
809
|
name: string;
|
|
@@ -789,7 +816,25 @@ interface ProfileAvatarProps {
|
|
|
789
816
|
* Renders a profile/workspace avatar using ScDp.
|
|
790
817
|
* Automatically shows image or initials fallback.
|
|
791
818
|
*/
|
|
792
|
-
declare function ProfileAvatar({ name, profileImage, size, initialsClassName, borderRadius, }: ProfileAvatarProps):
|
|
819
|
+
declare function ProfileAvatar({ name, profileImage, size, initialsClassName, borderRadius, }: ProfileAvatarProps): react.JSX.Element;
|
|
820
|
+
|
|
821
|
+
type SettingsTooltipPlacement = "right" | "top" | "bottom";
|
|
822
|
+
interface SettingsTooltipProps {
|
|
823
|
+
/** Explanation shown on hover / keyboard focus. Falsy renders the child bare. */
|
|
824
|
+
content?: ReactNode;
|
|
825
|
+
/** Preferred side. Flips to the opposite side when it would overflow. */
|
|
826
|
+
placement?: SettingsTooltipPlacement;
|
|
827
|
+
/** Milliseconds to hover before the tooltip opens. Closing is immediate. */
|
|
828
|
+
delay?: number;
|
|
829
|
+
children: ReactNode;
|
|
830
|
+
className?: string;
|
|
831
|
+
/**
|
|
832
|
+
* The wrapper defaults to `display: block` so full-width nav rows keep their
|
|
833
|
+
* width. Set this for triggers that sit inside a flex row (buttons, chips).
|
|
834
|
+
*/
|
|
835
|
+
inline?: boolean;
|
|
836
|
+
}
|
|
837
|
+
declare function SettingsTooltip({ content, placement, delay, children, className, inline, }: SettingsTooltipProps): react.JSX.Element;
|
|
793
838
|
|
|
794
839
|
interface WorkspaceData {
|
|
795
840
|
id: string;
|
|
@@ -812,7 +857,7 @@ interface WorkspaceModalProps {
|
|
|
812
857
|
onLeave?: () => void | boolean | Promise<void | boolean>;
|
|
813
858
|
onDelete?: () => void | boolean | Promise<void | boolean>;
|
|
814
859
|
}
|
|
815
|
-
declare function WorkspaceModal({ open, mode, workspace, onClose, onCreate, onUpdate, onLeave, onDelete, }: WorkspaceModalProps):
|
|
860
|
+
declare function WorkspaceModal({ open, mode, workspace, onClose, onCreate, onUpdate, onLeave, onDelete, }: WorkspaceModalProps): react.JSX.Element | null;
|
|
816
861
|
|
|
817
862
|
interface OrganizationData {
|
|
818
863
|
id: string;
|
|
@@ -832,7 +877,7 @@ interface OrganizationModalProps {
|
|
|
832
877
|
onUpdate?: (name: string, imageFile: File | null, imageRemoved: boolean) => void | boolean | Promise<void | boolean>;
|
|
833
878
|
onDelete?: () => void | boolean | Promise<void | boolean>;
|
|
834
879
|
}
|
|
835
|
-
declare function OrganizationModal({ open, mode, organization, onClose, onCreate, onUpdate, onDelete, }: OrganizationModalProps):
|
|
880
|
+
declare function OrganizationModal({ open, mode, organization, onClose, onCreate, onUpdate, onDelete, }: OrganizationModalProps): react.JSX.Element | null;
|
|
836
881
|
|
|
837
882
|
type ModalMode$1 = "invite" | "update";
|
|
838
883
|
interface OrganizationInviteModalProps {
|
|
@@ -861,7 +906,7 @@ interface OrganizationInviteModalProps {
|
|
|
861
906
|
}) => void;
|
|
862
907
|
onRemove?: () => void;
|
|
863
908
|
}
|
|
864
|
-
declare function OrganizationInviteModal({ open, mode, userEmail, initialRole, initialInviteAccess, allowSubmitWithoutChanges, canRemove, onClose, onInviteEmail, onInviteDomain, onUpdate, onRemove, }: OrganizationInviteModalProps):
|
|
909
|
+
declare function OrganizationInviteModal({ open, mode, userEmail, initialRole, initialInviteAccess, allowSubmitWithoutChanges, canRemove, onClose, onInviteEmail, onInviteDomain, onUpdate, onRemove, }: OrganizationInviteModalProps): react.JSX.Element | null;
|
|
865
910
|
|
|
866
911
|
interface ConfirmLeaveModalProps {
|
|
867
912
|
open: boolean;
|
|
@@ -873,7 +918,7 @@ interface ConfirmLeaveModalProps {
|
|
|
873
918
|
/** Called when user clicks "Go to Teams" in the sole admin variant */
|
|
874
919
|
onGoToTeams?: () => void;
|
|
875
920
|
}
|
|
876
|
-
declare function ConfirmLeaveModal({ open, workspaceName, isSoleAdmin, onClose, onConfirm, onGoToTeams, }: ConfirmLeaveModalProps):
|
|
921
|
+
declare function ConfirmLeaveModal({ open, workspaceName, isSoleAdmin, onClose, onConfirm, onGoToTeams, }: ConfirmLeaveModalProps): react.JSX.Element | null;
|
|
877
922
|
|
|
878
923
|
interface ConfirmDeleteModalProps {
|
|
879
924
|
open: boolean;
|
|
@@ -881,7 +926,7 @@ interface ConfirmDeleteModalProps {
|
|
|
881
926
|
onClose: () => void;
|
|
882
927
|
onConfirm: () => void | Promise<void>;
|
|
883
928
|
}
|
|
884
|
-
declare function ConfirmDeleteModal({ open, workspaceName, onClose, onConfirm, }: ConfirmDeleteModalProps):
|
|
929
|
+
declare function ConfirmDeleteModal({ open, workspaceName, onClose, onConfirm, }: ConfirmDeleteModalProps): react.JSX.Element | null;
|
|
885
930
|
|
|
886
931
|
interface BuyCreditsModalProps {
|
|
887
932
|
currencySymbol?: string;
|
|
@@ -889,7 +934,7 @@ interface BuyCreditsModalProps {
|
|
|
889
934
|
onClose: () => void;
|
|
890
935
|
onBuy: (credits: number, price: number) => void;
|
|
891
936
|
}
|
|
892
|
-
declare function BuyCreditsModal({ currencySymbol, country, onClose, onBuy, }: BuyCreditsModalProps):
|
|
937
|
+
declare function BuyCreditsModal({ currencySymbol, country, onClose, onBuy, }: BuyCreditsModalProps): react.JSX.Element;
|
|
893
938
|
|
|
894
939
|
interface UserPermissions {
|
|
895
940
|
artifax: boolean;
|
|
@@ -937,19 +982,19 @@ interface InviteUpdateModalProps {
|
|
|
937
982
|
/** Called only in invite mode; receives (permissions, email) */
|
|
938
983
|
onInvite?: (permissions: UserPermissions, email: string) => void;
|
|
939
984
|
}
|
|
940
|
-
declare function InviteUpdateModal({ open, mode, userEmail, stores, allowSubmitWithoutChanges, initialPermissions, onClose, onSave, onRemove, canRemove, onInvite, }: InviteUpdateModalProps):
|
|
985
|
+
declare function InviteUpdateModal({ open, mode, userEmail, stores, allowSubmitWithoutChanges, initialPermissions, onClose, onSave, onRemove, canRemove, onInvite, }: InviteUpdateModalProps): react.JSX.Element | null;
|
|
941
986
|
|
|
942
987
|
interface ExportDateModalProps {
|
|
943
988
|
title: string;
|
|
944
989
|
onClose: () => void;
|
|
945
990
|
onExport: (startDate: Date, endDate: Date) => void;
|
|
946
991
|
}
|
|
947
|
-
declare function ExportDateModal({ title, onClose, onExport, }: ExportDateModalProps):
|
|
992
|
+
declare function ExportDateModal({ title, onClose, onExport, }: ExportDateModalProps): react.JSX.Element;
|
|
948
993
|
|
|
949
994
|
declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
950
995
|
adapters: SettingsAdapters;
|
|
951
996
|
children: ReactNode;
|
|
952
|
-
}):
|
|
997
|
+
}): react.JSX.Element;
|
|
953
998
|
/**
|
|
954
999
|
* Read the host-provided adapters from anywhere inside <SettingsContent>.
|
|
955
1000
|
* Throws at runtime if used outside the provider — which only happens if a
|
|
@@ -957,4 +1002,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
957
1002
|
*/
|
|
958
1003
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
959
1004
|
|
|
960
|
-
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, OrganizationInviteModal, type OrganizationInviteModalProps, type OrganizationJoinRequest, type OrganizationMember, OrganizationModal, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCurrent, type SettingsOrganizationListItem, type SettingsTab, type SettingsToastAdapter, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|
|
1005
|
+
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, OrganizationInviteModal, type OrganizationInviteModalProps, type OrganizationJoinRequest, type OrganizationMember, OrganizationModal, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCurrent, type SettingsOrganizationListItem, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { SVGProps, ReactNode } from 'react';
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { SVGProps, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Settings tab identifiers and URL mapping helpers.
|
|
@@ -16,6 +16,13 @@ declare const TAB_TO_URL: Record<SettingsTab, string>;
|
|
|
16
16
|
declare const URL_TO_TAB: Record<string, SettingsTab>;
|
|
17
17
|
/** Human-readable label for each tab (used for breadcrumbs etc.). */
|
|
18
18
|
declare const TAB_LABELS: Record<SettingsTab, string>;
|
|
19
|
+
/**
|
|
20
|
+
* One-line explanation of what each destination is for, shown on hover over the
|
|
21
|
+
* settings sub-nav. Kept next to `TAB_LABELS` so a new tab can't get a label
|
|
22
|
+
* without also getting an explanation — `Record<SettingsTab, string>` makes
|
|
23
|
+
* omitting one a type error.
|
|
24
|
+
*/
|
|
25
|
+
declare const TAB_DESCRIPTIONS: Record<SettingsTab, string>;
|
|
19
26
|
/**
|
|
20
27
|
* Resolve a `SettingsTab` from a URL pathname. Looks for the last segment that
|
|
21
28
|
* matches a known slug; falls back to `"profile"` (the default Account tab).
|
|
@@ -196,6 +203,9 @@ interface OrganizationMember {
|
|
|
196
203
|
_id: string;
|
|
197
204
|
role: "admin" | "member";
|
|
198
205
|
inviteAccess: boolean;
|
|
206
|
+
/** Populated user. Rows whose user document was deleted come back from the
|
|
207
|
+
* API with a null `user` — OrganizationContent drops those on fetch, so
|
|
208
|
+
* every render site can treat this as present. */
|
|
199
209
|
user: {
|
|
200
210
|
_id: string;
|
|
201
211
|
email: string;
|
|
@@ -699,6 +709,13 @@ interface SettingsNavigationAdapter {
|
|
|
699
709
|
getCheckoutReturnUrl?: (kind: "success" | "cancel") => string;
|
|
700
710
|
/** Imperative navigate to another settings tab. */
|
|
701
711
|
navigateToTab: (tab: SettingsTab) => void;
|
|
712
|
+
/**
|
|
713
|
+
* Leave settings entirely. Supplying this makes the shell render a close (×)
|
|
714
|
+
* button and dismiss on Escape. Hosts that would rather pass a callback
|
|
715
|
+
* directly can use the `onClose` prop on `<SettingsContent>` instead — it
|
|
716
|
+
* takes precedence over this.
|
|
717
|
+
*/
|
|
718
|
+
close?: () => void;
|
|
702
719
|
/** External-link navigate (e.g. for "What's new" or referral promo links). */
|
|
703
720
|
openExternal: (url: string) => void;
|
|
704
721
|
}
|
|
@@ -726,7 +743,7 @@ type WorkspaceInfo = SettingsWorkspaceListItem & {
|
|
|
726
743
|
plan?: string;
|
|
727
744
|
ownerEmail?: string;
|
|
728
745
|
};
|
|
729
|
-
declare function ProfileTab():
|
|
746
|
+
declare function ProfileTab(): react.JSX.Element;
|
|
730
747
|
declare function WorkspaceTab({ workspaces, loading, onCreateClick: _onCreateClick, onEditClick, onSwitchClick, onLeaveClick, }: {
|
|
731
748
|
workspaces: WorkspaceInfo[];
|
|
732
749
|
loading: boolean;
|
|
@@ -734,21 +751,31 @@ declare function WorkspaceTab({ workspaces, loading, onCreateClick: _onCreateCli
|
|
|
734
751
|
onEditClick: (ws: WorkspaceInfo) => void;
|
|
735
752
|
onSwitchClick: (ws: WorkspaceInfo) => void;
|
|
736
753
|
onLeaveClick: (ws: WorkspaceInfo) => void;
|
|
737
|
-
}):
|
|
738
|
-
declare function ReferralTab():
|
|
754
|
+
}): react.JSX.Element;
|
|
755
|
+
declare function ReferralTab(): react.JSX.Element;
|
|
739
756
|
interface SettingsContentProps {
|
|
740
757
|
adapters: SettingsAdapters;
|
|
741
758
|
/** Currently active tab. The host owns routing and resolves this from the URL. */
|
|
742
759
|
activeTab?: SettingsTab;
|
|
760
|
+
/**
|
|
761
|
+
* Leave settings. When supplied, the shell renders a close (×) button in the
|
|
762
|
+
* header and dismisses on Escape; the host decides where "closed" goes
|
|
763
|
+
* (settings is a full route in most hosts, not an overlay).
|
|
764
|
+
*
|
|
765
|
+
* Falls back to `adapters.navigation.close` so hosts that already build an
|
|
766
|
+
* adapter object don't have to thread a second prop through. Omit both and
|
|
767
|
+
* no close affordance is rendered — that is the pre-0.3.8 behaviour.
|
|
768
|
+
*/
|
|
769
|
+
onClose?: () => void;
|
|
743
770
|
}
|
|
744
|
-
declare function SettingsContent({ adapters, activeTab }: SettingsContentProps):
|
|
771
|
+
declare function SettingsContent({ adapters, activeTab, onClose, }: SettingsContentProps): react.JSX.Element;
|
|
745
772
|
|
|
746
773
|
type IconProps = Omit<SVGProps<SVGSVGElement>, 'color' | 'strokeWidth' | 'width' | 'height'> & {
|
|
747
774
|
color?: string;
|
|
748
775
|
strokeWidth?: number | string;
|
|
749
776
|
size?: number | string;
|
|
750
777
|
};
|
|
751
|
-
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) =>
|
|
778
|
+
declare const SiconKey: ({ color, strokeWidth, size, ...props }: IconProps) => react.JSX.Element;
|
|
752
779
|
|
|
753
780
|
declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlansChange, }?: {
|
|
754
781
|
embedded?: boolean;
|
|
@@ -756,19 +783,19 @@ declare function BillingContent({ embedded, showPlans: showPlansProp, onShowPlan
|
|
|
756
783
|
* wrapper) owns it so it can hide the sub-nav + show the Plans breadcrumb. */
|
|
757
784
|
showPlans?: boolean;
|
|
758
785
|
onShowPlansChange?: (open: boolean) => void;
|
|
759
|
-
}):
|
|
786
|
+
}): react__default.JSX.Element;
|
|
760
787
|
|
|
761
788
|
declare function TeamsContent({ embedded, onInviteOpen, onInviteOpenChange, }?: {
|
|
762
789
|
embedded?: boolean;
|
|
763
790
|
onInviteOpen?: boolean;
|
|
764
791
|
onInviteOpenChange?: (open: boolean) => void;
|
|
765
|
-
}):
|
|
792
|
+
}): react.JSX.Element;
|
|
766
793
|
|
|
767
794
|
declare function OrganizationContent({ embedded, onInviteOpen, onInviteOpenChange, }?: {
|
|
768
795
|
embedded?: boolean;
|
|
769
796
|
onInviteOpen?: boolean;
|
|
770
797
|
onInviteOpenChange?: (open: boolean) => void;
|
|
771
|
-
}):
|
|
798
|
+
}): react.JSX.Element;
|
|
772
799
|
|
|
773
800
|
declare function TokensContent({ embedded, showRevokedOverride, onShowRevokedChange: _onShowRevokedChange, createOpenOverride, onCreateOpenChange, }?: {
|
|
774
801
|
embedded?: boolean;
|
|
@@ -776,7 +803,7 @@ declare function TokensContent({ embedded, showRevokedOverride, onShowRevokedCha
|
|
|
776
803
|
onShowRevokedChange?: (v: boolean) => void;
|
|
777
804
|
createOpenOverride?: boolean;
|
|
778
805
|
onCreateOpenChange?: (v: boolean) => void;
|
|
779
|
-
}):
|
|
806
|
+
}): react.JSX.Element;
|
|
780
807
|
|
|
781
808
|
interface ProfileAvatarProps {
|
|
782
809
|
name: string;
|
|
@@ -789,7 +816,25 @@ interface ProfileAvatarProps {
|
|
|
789
816
|
* Renders a profile/workspace avatar using ScDp.
|
|
790
817
|
* Automatically shows image or initials fallback.
|
|
791
818
|
*/
|
|
792
|
-
declare function ProfileAvatar({ name, profileImage, size, initialsClassName, borderRadius, }: ProfileAvatarProps):
|
|
819
|
+
declare function ProfileAvatar({ name, profileImage, size, initialsClassName, borderRadius, }: ProfileAvatarProps): react.JSX.Element;
|
|
820
|
+
|
|
821
|
+
type SettingsTooltipPlacement = "right" | "top" | "bottom";
|
|
822
|
+
interface SettingsTooltipProps {
|
|
823
|
+
/** Explanation shown on hover / keyboard focus. Falsy renders the child bare. */
|
|
824
|
+
content?: ReactNode;
|
|
825
|
+
/** Preferred side. Flips to the opposite side when it would overflow. */
|
|
826
|
+
placement?: SettingsTooltipPlacement;
|
|
827
|
+
/** Milliseconds to hover before the tooltip opens. Closing is immediate. */
|
|
828
|
+
delay?: number;
|
|
829
|
+
children: ReactNode;
|
|
830
|
+
className?: string;
|
|
831
|
+
/**
|
|
832
|
+
* The wrapper defaults to `display: block` so full-width nav rows keep their
|
|
833
|
+
* width. Set this for triggers that sit inside a flex row (buttons, chips).
|
|
834
|
+
*/
|
|
835
|
+
inline?: boolean;
|
|
836
|
+
}
|
|
837
|
+
declare function SettingsTooltip({ content, placement, delay, children, className, inline, }: SettingsTooltipProps): react.JSX.Element;
|
|
793
838
|
|
|
794
839
|
interface WorkspaceData {
|
|
795
840
|
id: string;
|
|
@@ -812,7 +857,7 @@ interface WorkspaceModalProps {
|
|
|
812
857
|
onLeave?: () => void | boolean | Promise<void | boolean>;
|
|
813
858
|
onDelete?: () => void | boolean | Promise<void | boolean>;
|
|
814
859
|
}
|
|
815
|
-
declare function WorkspaceModal({ open, mode, workspace, onClose, onCreate, onUpdate, onLeave, onDelete, }: WorkspaceModalProps):
|
|
860
|
+
declare function WorkspaceModal({ open, mode, workspace, onClose, onCreate, onUpdate, onLeave, onDelete, }: WorkspaceModalProps): react.JSX.Element | null;
|
|
816
861
|
|
|
817
862
|
interface OrganizationData {
|
|
818
863
|
id: string;
|
|
@@ -832,7 +877,7 @@ interface OrganizationModalProps {
|
|
|
832
877
|
onUpdate?: (name: string, imageFile: File | null, imageRemoved: boolean) => void | boolean | Promise<void | boolean>;
|
|
833
878
|
onDelete?: () => void | boolean | Promise<void | boolean>;
|
|
834
879
|
}
|
|
835
|
-
declare function OrganizationModal({ open, mode, organization, onClose, onCreate, onUpdate, onDelete, }: OrganizationModalProps):
|
|
880
|
+
declare function OrganizationModal({ open, mode, organization, onClose, onCreate, onUpdate, onDelete, }: OrganizationModalProps): react.JSX.Element | null;
|
|
836
881
|
|
|
837
882
|
type ModalMode$1 = "invite" | "update";
|
|
838
883
|
interface OrganizationInviteModalProps {
|
|
@@ -861,7 +906,7 @@ interface OrganizationInviteModalProps {
|
|
|
861
906
|
}) => void;
|
|
862
907
|
onRemove?: () => void;
|
|
863
908
|
}
|
|
864
|
-
declare function OrganizationInviteModal({ open, mode, userEmail, initialRole, initialInviteAccess, allowSubmitWithoutChanges, canRemove, onClose, onInviteEmail, onInviteDomain, onUpdate, onRemove, }: OrganizationInviteModalProps):
|
|
909
|
+
declare function OrganizationInviteModal({ open, mode, userEmail, initialRole, initialInviteAccess, allowSubmitWithoutChanges, canRemove, onClose, onInviteEmail, onInviteDomain, onUpdate, onRemove, }: OrganizationInviteModalProps): react.JSX.Element | null;
|
|
865
910
|
|
|
866
911
|
interface ConfirmLeaveModalProps {
|
|
867
912
|
open: boolean;
|
|
@@ -873,7 +918,7 @@ interface ConfirmLeaveModalProps {
|
|
|
873
918
|
/** Called when user clicks "Go to Teams" in the sole admin variant */
|
|
874
919
|
onGoToTeams?: () => void;
|
|
875
920
|
}
|
|
876
|
-
declare function ConfirmLeaveModal({ open, workspaceName, isSoleAdmin, onClose, onConfirm, onGoToTeams, }: ConfirmLeaveModalProps):
|
|
921
|
+
declare function ConfirmLeaveModal({ open, workspaceName, isSoleAdmin, onClose, onConfirm, onGoToTeams, }: ConfirmLeaveModalProps): react.JSX.Element | null;
|
|
877
922
|
|
|
878
923
|
interface ConfirmDeleteModalProps {
|
|
879
924
|
open: boolean;
|
|
@@ -881,7 +926,7 @@ interface ConfirmDeleteModalProps {
|
|
|
881
926
|
onClose: () => void;
|
|
882
927
|
onConfirm: () => void | Promise<void>;
|
|
883
928
|
}
|
|
884
|
-
declare function ConfirmDeleteModal({ open, workspaceName, onClose, onConfirm, }: ConfirmDeleteModalProps):
|
|
929
|
+
declare function ConfirmDeleteModal({ open, workspaceName, onClose, onConfirm, }: ConfirmDeleteModalProps): react.JSX.Element | null;
|
|
885
930
|
|
|
886
931
|
interface BuyCreditsModalProps {
|
|
887
932
|
currencySymbol?: string;
|
|
@@ -889,7 +934,7 @@ interface BuyCreditsModalProps {
|
|
|
889
934
|
onClose: () => void;
|
|
890
935
|
onBuy: (credits: number, price: number) => void;
|
|
891
936
|
}
|
|
892
|
-
declare function BuyCreditsModal({ currencySymbol, country, onClose, onBuy, }: BuyCreditsModalProps):
|
|
937
|
+
declare function BuyCreditsModal({ currencySymbol, country, onClose, onBuy, }: BuyCreditsModalProps): react.JSX.Element;
|
|
893
938
|
|
|
894
939
|
interface UserPermissions {
|
|
895
940
|
artifax: boolean;
|
|
@@ -937,19 +982,19 @@ interface InviteUpdateModalProps {
|
|
|
937
982
|
/** Called only in invite mode; receives (permissions, email) */
|
|
938
983
|
onInvite?: (permissions: UserPermissions, email: string) => void;
|
|
939
984
|
}
|
|
940
|
-
declare function InviteUpdateModal({ open, mode, userEmail, stores, allowSubmitWithoutChanges, initialPermissions, onClose, onSave, onRemove, canRemove, onInvite, }: InviteUpdateModalProps):
|
|
985
|
+
declare function InviteUpdateModal({ open, mode, userEmail, stores, allowSubmitWithoutChanges, initialPermissions, onClose, onSave, onRemove, canRemove, onInvite, }: InviteUpdateModalProps): react.JSX.Element | null;
|
|
941
986
|
|
|
942
987
|
interface ExportDateModalProps {
|
|
943
988
|
title: string;
|
|
944
989
|
onClose: () => void;
|
|
945
990
|
onExport: (startDate: Date, endDate: Date) => void;
|
|
946
991
|
}
|
|
947
|
-
declare function ExportDateModal({ title, onClose, onExport, }: ExportDateModalProps):
|
|
992
|
+
declare function ExportDateModal({ title, onClose, onExport, }: ExportDateModalProps): react.JSX.Element;
|
|
948
993
|
|
|
949
994
|
declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
950
995
|
adapters: SettingsAdapters;
|
|
951
996
|
children: ReactNode;
|
|
952
|
-
}):
|
|
997
|
+
}): react.JSX.Element;
|
|
953
998
|
/**
|
|
954
999
|
* Read the host-provided adapters from anywhere inside <SettingsContent>.
|
|
955
1000
|
* Throws at runtime if used outside the provider — which only happens if a
|
|
@@ -957,4 +1002,4 @@ declare function SettingsAdaptersProvider({ adapters, children, }: {
|
|
|
957
1002
|
*/
|
|
958
1003
|
declare function useSettingsAdapters(): SettingsAdapters;
|
|
959
1004
|
|
|
960
|
-
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, OrganizationInviteModal, type OrganizationInviteModalProps, type OrganizationJoinRequest, type OrganizationMember, OrganizationModal, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCurrent, type SettingsOrganizationListItem, type SettingsTab, type SettingsToastAdapter, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|
|
1005
|
+
export { type ApiToken, type AvailableCreditsResponse, BillingContent, type BillingEventPayload, type BillingProduct, type BillingSubscription, BuyCreditsModal, type BuyCreditsPayload, type BuyCreditsResponse, ConfirmDeleteModal, ConfirmLeaveModal, type CreatedToken, type CustomCreditInfo, type CustomCreditResponse, DEFAULT_PERMISSIONS, ExportDateModal, InviteUpdateModal, type InvoicePdfResponse, type MemberPermissionsPayload, OrganizationContent, type OrganizationData, type OrganizationInvite, OrganizationInviteModal, type OrganizationInviteModalProps, type OrganizationJoinRequest, type OrganizationMember, OrganizationModal, type OrganizationWorkspaceItem, type Price, type PriceMetadata, type ProductsResponse, ProfileAvatar, ProfileTab, ReferralTab, type ServiceItem, type SettingsAdapters, SettingsAdaptersProvider, type SettingsApiAdapter, type SettingsAuthAdapter, type SettingsAuthUser, SettingsContent, type SettingsContentProps, type SettingsImageUploadAdapter, type SettingsNavigationAdapter, type SettingsOrganizationAdapter, type SettingsOrganizationCurrent, type SettingsOrganizationListItem, type SettingsTab, type SettingsToastAdapter, SettingsTooltip, type SettingsTooltipPlacement, type SettingsTooltipProps, type SettingsWorkspaceAdapter, type SettingsWorkspaceCurrent, type SettingsWorkspaceListItem, SiconKey, type StoreItem, type SubscriptionPlan, type SubscriptionResponse, TAB_DESCRIPTIONS, TAB_LABELS, TAB_TO_URL, type TeamMember, TeamsContent, type TokenExpiry, TokensContent, URL_TO_TAB, type UpdateSubscriptionPayload, type UpdateSubscriptionResponse, type UsageHistoryItem, type UsageHistoryResponse, type UserPermissions, type WorkspaceData, type WorkspaceInvite, type WorkspaceMember, WorkspaceModal, WorkspaceTab, resolveSettingsTabFromPath, useSettingsAdapters };
|