@buildbase/sdk 0.0.24 → 0.0.26
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 +82 -0
- package/dist/index.d.ts +26 -1
- package/dist/index.esm.js +5 -6
- package/dist/index.js +5 -6
- package/package.json +3 -2
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/api/currency-utils.d.ts +0 -44
- package/dist/types/api/index.d.ts +0 -12
- package/dist/types/api/pricing-variant-utils.d.ts +0 -66
- package/dist/types/api/quota-utils.d.ts +0 -24
- package/dist/types/api/types.d.ts +0 -495
- package/dist/types/components/ErrorBoundary.d.ts +0 -81
- package/dist/types/components/beta/BetaForm.d.ts +0 -24
- package/dist/types/components/beta/api.d.ts +0 -48
- package/dist/types/components/beta/hooks.d.ts +0 -11
- package/dist/types/components/beta/schema.d.ts +0 -6
- package/dist/types/components/beta/types.d.ts +0 -8
- package/dist/types/components/dropdowns/country/countries.d.ts +0 -7
- package/dist/types/components/dropdowns/country/selectCountry.d.ts +0 -6
- package/dist/types/components/dropdowns/currency/currencies.d.ts +0 -6
- package/dist/types/components/dropdowns/currency/selectCurrency.d.ts +0 -6
- package/dist/types/components/dropdowns/language/languages.d.ts +0 -6
- package/dist/types/components/dropdowns/language/selectLanguage.d.ts +0 -6
- package/dist/types/components/dropdowns/timezone/selectTimeZone.d.ts +0 -6
- package/dist/types/components/dropdowns/timezone/timezones.d.ts +0 -8
- package/dist/types/components/features/index.d.ts +0 -130
- package/dist/types/components/pricing/PricingPage.d.ts +0 -49
- package/dist/types/components/pricing/index.d.ts +0 -2
- package/dist/types/components/quota/index.d.ts +0 -121
- package/dist/types/components/subscription/index.d.ts +0 -182
- package/dist/types/components/ui/alert-dialog.d.ts +0 -20
- package/dist/types/components/ui/avatar.d.ts +0 -6
- package/dist/types/components/ui/button.d.ts +0 -18
- package/dist/types/components/ui/command-select.d.ts +0 -13
- package/dist/types/components/ui/command.d.ts +0 -82
- package/dist/types/components/ui/dialog.d.ts +0 -19
- package/dist/types/components/ui/form.d.ts +0 -23
- package/dist/types/components/ui/input.d.ts +0 -5
- package/dist/types/components/ui/label.d.ts +0 -5
- package/dist/types/components/ui/popover.d.ts +0 -6
- package/dist/types/components/ui/radio-group.d.ts +0 -5
- package/dist/types/components/ui/scroll-area.d.ts +0 -5
- package/dist/types/components/ui/select.d.ts +0 -11
- package/dist/types/components/ui/separator.d.ts +0 -4
- package/dist/types/components/ui/skeleton.d.ts +0 -3
- package/dist/types/components/ui/switch.d.ts +0 -4
- package/dist/types/components/user/auth.d.ts +0 -76
- package/dist/types/components/user/role.d.ts +0 -84
- package/dist/types/contexts/AuthContext/AuthContext.d.ts +0 -9
- package/dist/types/contexts/AuthContext/actions.d.ts +0 -12
- package/dist/types/contexts/AuthContext/index.d.ts +0 -4
- package/dist/types/contexts/AuthContext/reducer.d.ts +0 -19
- package/dist/types/contexts/AuthContext/types.d.ts +0 -18
- package/dist/types/contexts/OSContext/OSContext.d.ts +0 -9
- package/dist/types/contexts/OSContext/actions.d.ts +0 -11
- package/dist/types/contexts/OSContext/index.d.ts +0 -4
- package/dist/types/contexts/OSContext/reducer.d.ts +0 -11
- package/dist/types/contexts/OSContext/types.d.ts +0 -16
- package/dist/types/contexts/QuotaUsageContext/QuotaUsageContext.d.ts +0 -22
- package/dist/types/contexts/QuotaUsageContext/index.d.ts +0 -2
- package/dist/types/contexts/QuotaUsageContext/quotaUsageInvalidation.d.ts +0 -21
- package/dist/types/contexts/QuotaUsageContext/types.d.ts +0 -14
- package/dist/types/contexts/SDKContext/SDKContextProvider.d.ts +0 -18
- package/dist/types/contexts/SDKContext/index.d.ts +0 -2
- package/dist/types/contexts/SDKContext/types.d.ts +0 -12
- package/dist/types/contexts/SubscriptionContext/SubscriptionContext.d.ts +0 -22
- package/dist/types/contexts/SubscriptionContext/index.d.ts +0 -2
- package/dist/types/contexts/SubscriptionContext/subscriptionInvalidation.d.ts +0 -21
- package/dist/types/contexts/SubscriptionContext/types.d.ts +0 -14
- package/dist/types/contexts/WorkspaceContext/WorkspaceContext.d.ts +0 -8
- package/dist/types/contexts/WorkspaceContext/actions.d.ts +0 -19
- package/dist/types/contexts/WorkspaceContext/index.d.ts +0 -4
- package/dist/types/contexts/WorkspaceContext/reducer.d.ts +0 -10
- package/dist/types/contexts/WorkspaceContext/types.d.ts +0 -52
- package/dist/types/contexts/index.d.ts +0 -14
- package/dist/types/contexts/shared/createContext.d.ts +0 -27
- package/dist/types/contexts/shared/types.d.ts +0 -21
- package/dist/types/contexts/shared/useAppDispatch.d.ts +0 -20
- package/dist/types/contexts/shared/useAppSelector.d.ts +0 -26
- package/dist/types/contexts/shared/useSelectWithEquality.d.ts +0 -10
- package/dist/types/contexts/shared/utils/reducerHelpers.d.ts +0 -11
- package/dist/types/contexts/shared/utils/storage.d.ts +0 -25
- package/dist/types/hooks/use-seat-status.d.ts +0 -42
- package/dist/types/hooks/use-trial-status.d.ts +0 -28
- package/dist/types/index.d.ts +0 -39
- package/dist/types/lib/api-base.d.ts +0 -49
- package/dist/types/lib/api-client.d.ts +0 -25
- package/dist/types/lib/api-utils.d.ts +0 -182
- package/dist/types/lib/error-handler.d.ts +0 -118
- package/dist/types/lib/logger.d.ts +0 -27
- package/dist/types/lib/useAsyncEffect.d.ts +0 -29
- package/dist/types/lib/utils.d.ts +0 -7
- package/dist/types/providers/ContextConfigProvider.d.ts +0 -15
- package/dist/types/providers/PortalContainer.d.ts +0 -9
- package/dist/types/providers/SaaSOSProvider.d.ts +0 -7
- package/dist/types/providers/auth/api.d.ts +0 -12
- package/dist/types/providers/auth/hooks.d.ts +0 -75
- package/dist/types/providers/auth/provider.d.ts +0 -13
- package/dist/types/providers/auth/types.d.ts +0 -62
- package/dist/types/providers/auth/utils.d.ts +0 -40
- package/dist/types/providers/constants.d.ts +0 -3
- package/dist/types/providers/events/EventEmitter.d.ts +0 -81
- package/dist/types/providers/events/index.d.ts +0 -2
- package/dist/types/providers/events/types.d.ts +0 -61
- package/dist/types/providers/os/api.d.ts +0 -11
- package/dist/types/providers/os/hooks.d.ts +0 -50
- package/dist/types/providers/os/types.d.ts +0 -19
- package/dist/types/providers/types.d.ts +0 -9
- package/dist/types/providers/user/api.d.ts +0 -16
- package/dist/types/providers/user/hooks.d.ts +0 -80
- package/dist/types/providers/user/provider.d.ts +0 -17
- package/dist/types/providers/workspace/WorkspaceSettingsProvider.d.ts +0 -9
- package/dist/types/providers/workspace/api.d.ts +0 -155
- package/dist/types/providers/workspace/hooks.d.ts +0 -161
- package/dist/types/providers/workspace/provider.d.ts +0 -8
- package/dist/types/providers/workspace/settings-manager.d.ts +0 -36
- package/dist/types/providers/workspace/subscription-hooks.d.ts +0 -741
- package/dist/types/providers/workspace/types.d.ts +0 -61
- package/dist/types/providers/workspace/ui/SettingsDanger.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsDialog.d.ts +0 -17
- package/dist/types/providers/workspace/ui/SettingsFeatures.d.ts +0 -5
- package/dist/types/providers/workspace/ui/SettingsGeneral.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsInvoices.d.ts +0 -12
- package/dist/types/providers/workspace/ui/SettingsProfile.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsSubscription.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsUsage.d.ts +0 -3
- package/dist/types/providers/workspace/ui/SettingsUsers.d.ts +0 -6
- package/dist/types/providers/workspace/ui/Sidebar.d.ts +0 -10
- package/dist/types/providers/workspace/ui/Skeleton.d.ts +0 -1
- package/dist/types/providers/workspace/ui/SubscriptionDialog.d.ts +0 -21
- package/dist/types/providers/workspace/ui/utils.d.ts +0 -2
- package/dist/types/providers/workspace/utils.d.ts +0 -28
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
interface IWhenSubscriptionProps {
|
|
2
|
-
/** Content to render when the condition is met (workspace has an active subscription). */
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
/** Optional component/element to show while subscription is loading (e.g. <Skeleton />). */
|
|
5
|
-
loadingComponent?: React.ReactNode;
|
|
6
|
-
/** Optional component/element to show when condition is not met (e.g. <UpgradePrompt />). */
|
|
7
|
-
fallbackComponent?: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Renders children only when the current workspace has an active subscription (any plan).
|
|
11
|
-
* Optionally pass loadingComponent (while loading) or fallbackComponent (when not subscribed).
|
|
12
|
-
* Must be used within SubscriptionContextProvider.
|
|
13
|
-
*
|
|
14
|
-
* @param props - Component props
|
|
15
|
-
* @param props.children - Content to render when subscribed
|
|
16
|
-
* @param props.loadingComponent - Optional component/element to show while loading
|
|
17
|
-
* @param props.fallbackComponent - Optional component/element to show when not subscribed
|
|
18
|
-
* @returns ReactNode - children when subscribed, loadingComponent when loading, fallbackComponent when not subscribed, or null
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```tsx
|
|
22
|
-
* <WhenSubscription>
|
|
23
|
-
* <BillingSettings />
|
|
24
|
-
* </WhenSubscription>
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* <WhenSubscription
|
|
30
|
-
* loadingComponent={<Skeleton />}
|
|
31
|
-
* fallbackComponent={<UpgradePrompt />}
|
|
32
|
-
* >
|
|
33
|
-
* <BillingSettings />
|
|
34
|
-
* </WhenSubscription>
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare const WhenSubscription: {
|
|
38
|
-
(props: IWhenSubscriptionProps): import("react").ReactNode;
|
|
39
|
-
displayName: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Renders children only when the current workspace has no subscription (or no current workspace).
|
|
43
|
-
* Optionally pass loadingComponent (while loading) or fallbackComponent (when already subscribed).
|
|
44
|
-
* Must be used within SubscriptionContextProvider.
|
|
45
|
-
*
|
|
46
|
-
* @param props - Component props
|
|
47
|
-
* @param props.children - Content to render when not subscribed
|
|
48
|
-
* @param props.loadingComponent - Optional component/element to show while loading
|
|
49
|
-
* @param props.fallbackComponent - Optional component/element to show when already subscribed
|
|
50
|
-
* @returns ReactNode - children when not subscribed, loadingComponent when loading, fallbackComponent when subscribed, or null
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* <WhenNoSubscription>
|
|
55
|
-
* <UpgradePrompt />
|
|
56
|
-
* </WhenNoSubscription>
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```tsx
|
|
61
|
-
* <WhenNoSubscription
|
|
62
|
-
* loadingComponent={<Spinner />}
|
|
63
|
-
* fallbackComponent={null}
|
|
64
|
-
* >
|
|
65
|
-
* <UpgradePrompt />
|
|
66
|
-
* </WhenNoSubscription>
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export declare const WhenNoSubscription: {
|
|
70
|
-
(props: IWhenSubscriptionProps): import("react").ReactNode;
|
|
71
|
-
displayName: string;
|
|
72
|
-
};
|
|
73
|
-
interface IWhenSubscriptionToPlansProps {
|
|
74
|
-
/** Plan slugs to match (e.g. ['pro', 'enterprise']). Matching is case-insensitive. */
|
|
75
|
-
plans: string[];
|
|
76
|
-
/** Content to render when the workspace is on one of the given plans. */
|
|
77
|
-
children: React.ReactNode;
|
|
78
|
-
/** Optional component/element to show while subscription is loading (e.g. <Skeleton />). */
|
|
79
|
-
loadingComponent?: React.ReactNode;
|
|
80
|
-
/** Optional component/element to show when not on a matching plan (e.g. <UpgradeToPro />). */
|
|
81
|
-
fallbackComponent?: React.ReactNode;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Renders children only when the current workspace is subscribed to one of the given plans.
|
|
85
|
-
* Matches by plan slug only. Optionally pass loadingComponent (while loading) or fallbackComponent (when not on a matching plan).
|
|
86
|
-
* Must be used within SubscriptionContextProvider.
|
|
87
|
-
*
|
|
88
|
-
* @param props - Component props
|
|
89
|
-
* @param props.plans - Plan slugs to match (e.g. ['pro', 'enterprise'])
|
|
90
|
-
* @param props.children - Content to render when on a matching plan
|
|
91
|
-
* @param props.loadingComponent - Optional component/element to show while loading
|
|
92
|
-
* @param props.fallbackComponent - Optional component/element to show when not on a matching plan
|
|
93
|
-
* @returns ReactNode - children when on a matching plan, loadingComponent when loading, fallbackComponent when not matching, or null
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```tsx
|
|
97
|
-
* <WhenSubscriptionToPlans plans={['pro', 'enterprise']}>
|
|
98
|
-
* <AdvancedAnalytics />
|
|
99
|
-
* </WhenSubscriptionToPlans>
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```tsx
|
|
104
|
-
* <WhenSubscriptionToPlans
|
|
105
|
-
* plans={['pro', 'enterprise']}
|
|
106
|
-
* loadingComponent={<Skeleton />}
|
|
107
|
-
* fallbackComponent={<UpgradeToPro />}
|
|
108
|
-
* >
|
|
109
|
-
* <AdvancedAnalytics />
|
|
110
|
-
* </WhenSubscriptionToPlans>
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
export declare const WhenSubscriptionToPlans: {
|
|
114
|
-
(props: IWhenSubscriptionToPlansProps): import("react").ReactNode;
|
|
115
|
-
displayName: string;
|
|
116
|
-
};
|
|
117
|
-
interface IWhenTrialingProps {
|
|
118
|
-
/** Content to render when the condition is met. */
|
|
119
|
-
children: React.ReactNode;
|
|
120
|
-
/** Optional component/element to show while subscription is loading. */
|
|
121
|
-
loadingComponent?: React.ReactNode;
|
|
122
|
-
/** Optional component/element to show when condition is not met. */
|
|
123
|
-
fallbackComponent?: React.ReactNode;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Renders children only when the current workspace subscription is in trial (status === 'trialing').
|
|
127
|
-
* Must be used within SubscriptionContextProvider.
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```tsx
|
|
131
|
-
* <WhenTrialing fallbackComponent={<NormalContent />}>
|
|
132
|
-
* <TrialBanner />
|
|
133
|
-
* </WhenTrialing>
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
export declare const WhenTrialing: {
|
|
137
|
-
(props: IWhenTrialingProps): import("react").ReactNode;
|
|
138
|
-
displayName: string;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Renders children only when the current workspace subscription is NOT in trial.
|
|
142
|
-
* This includes: no subscription, active, canceled, past_due, etc.
|
|
143
|
-
* Must be used within SubscriptionContextProvider.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```tsx
|
|
147
|
-
* <WhenNotTrialing>
|
|
148
|
-
* <RegularPricingPage />
|
|
149
|
-
* </WhenNotTrialing>
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
export declare const WhenNotTrialing: {
|
|
153
|
-
(props: IWhenTrialingProps): import("react").ReactNode;
|
|
154
|
-
displayName: string;
|
|
155
|
-
};
|
|
156
|
-
interface IWhenTrialEndingProps {
|
|
157
|
-
/** Content to render when trial is ending soon. */
|
|
158
|
-
children: React.ReactNode;
|
|
159
|
-
/** Optional component/element to show while subscription is loading. */
|
|
160
|
-
loadingComponent?: React.ReactNode;
|
|
161
|
-
/** Optional component/element to show when trial is not ending soon. */
|
|
162
|
-
fallbackComponent?: React.ReactNode;
|
|
163
|
-
/** Number of days threshold to consider "ending soon". Defaults to 3. */
|
|
164
|
-
daysThreshold?: number;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Renders children only when the subscription is trialing AND the trial ends within
|
|
168
|
-
* the given threshold (default 3 days). Useful for showing urgent upgrade prompts.
|
|
169
|
-
* Must be used within SubscriptionContextProvider.
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```tsx
|
|
173
|
-
* <WhenTrialEnding daysThreshold={5}>
|
|
174
|
-
* <UpgradeBanner />
|
|
175
|
-
* </WhenTrialEnding>
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
export declare const WhenTrialEnding: {
|
|
179
|
-
(props: IWhenTrialEndingProps): import("react").ReactNode;
|
|
180
|
-
displayName: string;
|
|
181
|
-
};
|
|
182
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
|
|
4
|
-
declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
|
|
6
|
-
declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
-
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const AlertDialogHeader: {
|
|
9
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
displayName: string;
|
|
11
|
-
};
|
|
12
|
-
declare const AlertDialogFooter: {
|
|
13
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
17
|
-
declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
18
|
-
declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
19
|
-
declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
20
|
-
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
|
-
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
5
|
-
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
-
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { LucideIcon } from 'lucide-react';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
6
|
-
withIcon?: boolean | null | undefined;
|
|
7
|
-
fullWidth?: boolean | null | undefined;
|
|
8
|
-
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
9
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
-
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
11
|
-
asChild?: boolean;
|
|
12
|
-
startIcon?: React.ReactElement<LucideIcon>;
|
|
13
|
-
endIcon?: React.ReactElement<LucideIcon>;
|
|
14
|
-
fullWidth?: boolean;
|
|
15
|
-
progress?: boolean;
|
|
16
|
-
}
|
|
17
|
-
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
-
export { Button, buttonVariants };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface CommandSelectOption {
|
|
2
|
-
value: string;
|
|
3
|
-
label: string;
|
|
4
|
-
icon?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface CommandSelectProps {
|
|
7
|
-
options: CommandSelectOption[];
|
|
8
|
-
value?: string;
|
|
9
|
-
onChange?: (value: string) => void;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
emptyLabel?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function CommandSelect({ options, value: valueProp, onChange, placeholder, emptyLabel, }: CommandSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { DialogProps } from '@radix-ui/react-dialog';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
6
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
7
|
-
} & {
|
|
8
|
-
asChild?: boolean;
|
|
9
|
-
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
-
label?: string;
|
|
11
|
-
shouldFilter?: boolean;
|
|
12
|
-
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
13
|
-
defaultValue?: string;
|
|
14
|
-
value?: string;
|
|
15
|
-
onValueChange?: (value: string) => void;
|
|
16
|
-
loop?: boolean;
|
|
17
|
-
disablePointerSelection?: boolean;
|
|
18
|
-
vimBindings?: boolean;
|
|
19
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
interface CommandDialogProps extends DialogProps {
|
|
21
|
-
}
|
|
22
|
-
declare const CommandDialog: ({ children, ...props }: CommandDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
24
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
25
|
-
} & {
|
|
26
|
-
asChild?: boolean;
|
|
27
|
-
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
|
|
28
|
-
value?: string;
|
|
29
|
-
onValueChange?: (search: string) => void;
|
|
30
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
-
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
32
|
-
children?: React.ReactNode;
|
|
33
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
35
|
-
} & {
|
|
36
|
-
asChild?: boolean;
|
|
37
|
-
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
38
|
-
label?: string;
|
|
39
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
-
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
41
|
-
children?: React.ReactNode;
|
|
42
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
43
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
44
|
-
} & {
|
|
45
|
-
asChild?: boolean;
|
|
46
|
-
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
-
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
48
|
-
children?: React.ReactNode;
|
|
49
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
50
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
51
|
-
} & {
|
|
52
|
-
asChild?: boolean;
|
|
53
|
-
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
54
|
-
heading?: React.ReactNode;
|
|
55
|
-
value?: string;
|
|
56
|
-
forceMount?: boolean;
|
|
57
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
-
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
59
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
60
|
-
} & {
|
|
61
|
-
asChild?: boolean;
|
|
62
|
-
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
63
|
-
alwaysRender?: boolean;
|
|
64
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
65
|
-
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
66
|
-
children?: React.ReactNode;
|
|
67
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
68
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
69
|
-
} & {
|
|
70
|
-
asChild?: boolean;
|
|
71
|
-
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
|
|
72
|
-
disabled?: boolean;
|
|
73
|
-
onSelect?: (value: string) => void;
|
|
74
|
-
value?: string;
|
|
75
|
-
keywords?: string[];
|
|
76
|
-
forceMount?: boolean;
|
|
77
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
78
|
-
declare const CommandShortcut: {
|
|
79
|
-
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
|
|
80
|
-
displayName: string;
|
|
81
|
-
};
|
|
82
|
-
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
|
-
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
6
|
-
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
-
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
declare const DialogHeader: {
|
|
10
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
13
|
-
declare const DialogFooter: {
|
|
14
|
-
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
displayName: string;
|
|
16
|
-
};
|
|
17
|
-
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
18
|
-
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
4
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
|
-
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare const useFormField: () => {
|
|
7
|
-
invalid: boolean;
|
|
8
|
-
isDirty: boolean;
|
|
9
|
-
isTouched: boolean;
|
|
10
|
-
isValidating: boolean;
|
|
11
|
-
error?: import("react-hook-form").FieldError;
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
formItemId: string;
|
|
15
|
-
formDescriptionId: string;
|
|
16
|
-
formMessageId: string;
|
|
17
|
-
};
|
|
18
|
-
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
-
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
20
|
-
declare const FormControl: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
21
|
-
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
22
|
-
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
23
|
-
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
5
|
-
export { Label };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
|
-
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
-
export { Popover, PopoverContent, PopoverTrigger };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
-
declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
-
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
export { ScrollArea, ScrollBar };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
-
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
-
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
-
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
-
export { Separator };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
|
-
export { Switch };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
interface IProps {
|
|
2
|
-
children: React.ReactNode;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Conditional component that renders children only when user is authenticated.
|
|
6
|
-
* Returns null if user is not authenticated or authentication status is still loading.
|
|
7
|
-
*
|
|
8
|
-
* @param props - Component props
|
|
9
|
-
* @param props.children - Content to render when authenticated
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* function App() {
|
|
14
|
-
* return (
|
|
15
|
-
* <SaaSOSProvider {...config}>
|
|
16
|
-
* <WhenAuthenticated>
|
|
17
|
-
* <Dashboard />
|
|
18
|
-
* </WhenAuthenticated>
|
|
19
|
-
* <WhenUnauthenticated>
|
|
20
|
-
* <LoginPage />
|
|
21
|
-
* </WhenUnauthenticated>
|
|
22
|
-
* </SaaSOSProvider>
|
|
23
|
-
* );
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const WhenAuthenticated: {
|
|
28
|
-
(props: IProps): import("react").ReactNode;
|
|
29
|
-
displayName: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Conditional component that renders children only when user is NOT authenticated.
|
|
33
|
-
* Returns null if user is authenticated.
|
|
34
|
-
* Note: Also renders during loading/redirecting states (when not yet authenticated).
|
|
35
|
-
*
|
|
36
|
-
* @param props - Component props
|
|
37
|
-
* @param props.children - Content to render when unauthenticated
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* function App() {
|
|
42
|
-
* return (
|
|
43
|
-
* <SaaSOSProvider {...config}>
|
|
44
|
-
* <WhenUnauthenticated>
|
|
45
|
-
* <LoginPage />
|
|
46
|
-
* </WhenUnauthenticated>
|
|
47
|
-
* <WhenAuthenticated>
|
|
48
|
-
* <Dashboard />
|
|
49
|
-
* </WhenAuthenticated>
|
|
50
|
-
* </SaaSOSProvider>
|
|
51
|
-
* );
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```tsx
|
|
57
|
-
* // Handle loading state separately
|
|
58
|
-
* function App() {
|
|
59
|
-
* const { isLoading } = useSaaSAuth();
|
|
60
|
-
*
|
|
61
|
-
* if (isLoading) return <LoadingSpinner />;
|
|
62
|
-
*
|
|
63
|
-
* return (
|
|
64
|
-
* <>
|
|
65
|
-
* <WhenUnauthenticated><LoginPage /></WhenUnauthenticated>
|
|
66
|
-
* <WhenAuthenticated><Dashboard /></WhenAuthenticated>
|
|
67
|
-
* </>
|
|
68
|
-
* );
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare const WhenUnauthenticated: {
|
|
73
|
-
(props: IProps): import("react").ReactNode;
|
|
74
|
-
displayName: string;
|
|
75
|
-
};
|
|
76
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
interface IProps {
|
|
2
|
-
roles: string[];
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
fallback?: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Conditional component that renders children only when user has one of the specified roles.
|
|
8
|
-
* Checks the user's global role (not workspace-specific).
|
|
9
|
-
*
|
|
10
|
-
* @param props - Component props
|
|
11
|
-
* @param props.roles - Array of role strings to check against user's role
|
|
12
|
-
* @param props.children - Content to render when user has matching role
|
|
13
|
-
* @param props.fallback - Optional content to render when user doesn't have matching role (default: null)
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* function AdminPanel() {
|
|
18
|
-
* return (
|
|
19
|
-
* <WhenRoles roles={['admin', 'super-admin']}>
|
|
20
|
-
* <AdminContent />
|
|
21
|
-
* </WhenRoles>
|
|
22
|
-
* );
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* // With fallback
|
|
29
|
-
* function SettingsPage() {
|
|
30
|
-
* return (
|
|
31
|
-
* <WhenRoles
|
|
32
|
-
* roles={['admin']}
|
|
33
|
-
* fallback={<p>You don't have permission to access this page.</p>}
|
|
34
|
-
* >
|
|
35
|
-
* <AdminSettings />
|
|
36
|
-
* </WhenRoles>
|
|
37
|
-
* );
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare const WhenRoles: {
|
|
42
|
-
(props: IProps): import("react").ReactNode;
|
|
43
|
-
displayName: string;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Conditional component that renders children only when user has one of the specified roles
|
|
47
|
-
* in the current workspace. Checks workspace-specific role, not global role.
|
|
48
|
-
*
|
|
49
|
-
* @param props - Component props
|
|
50
|
-
* @param props.roles - Array of role strings to check against user's workspace role
|
|
51
|
-
* @param props.children - Content to render when user has matching workspace role
|
|
52
|
-
* @param props.fallback - Optional content to render when user doesn't have matching role (default: null)
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```tsx
|
|
56
|
-
* function WorkspaceSettings() {
|
|
57
|
-
* return (
|
|
58
|
-
* <WhenWorkspaceRoles roles={['owner', 'admin']}>
|
|
59
|
-
* <SettingsContent />
|
|
60
|
-
* </WhenWorkspaceRoles>
|
|
61
|
-
* );
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```tsx
|
|
67
|
-
* // Edge case: User not in current workspace
|
|
68
|
-
* function WorkspaceContent() {
|
|
69
|
-
* return (
|
|
70
|
-
* <WhenWorkspaceRoles
|
|
71
|
-
* roles={['member']}
|
|
72
|
-
* fallback={<p>You are not a member of this workspace.</p>}
|
|
73
|
-
* >
|
|
74
|
-
* <WorkspaceDashboard />
|
|
75
|
-
* </WhenWorkspaceRoles>
|
|
76
|
-
* );
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
export declare const WhenWorkspaceRoles: {
|
|
81
|
-
(props: IProps): import("react").ReactNode;
|
|
82
|
-
displayName: string;
|
|
83
|
-
};
|
|
84
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IAuthState } from '../../providers/auth/types';
|
|
2
|
-
import type { AuthAction, AuthContextValue } from './types';
|
|
3
|
-
export declare const AuthContextProvider: import("react").FC<{
|
|
4
|
-
children: import("react").ReactNode;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const useAuthContext: () => AuthContextValue;
|
|
7
|
-
export declare const useAuthState: () => IAuthState;
|
|
8
|
-
export declare const useAuthDispatch: () => import("react").Dispatch<AuthAction>;
|
|
9
|
-
export declare const useAuthSelector: <Selected = IAuthState>(selector?: ((state: IAuthState) => Selected) | undefined, equalityFn?: ((a: Selected, b: Selected) => boolean) | undefined) => Selected;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth action creators
|
|
3
|
-
*/
|
|
4
|
-
import type { AuthSession } from '../../providers/auth/types';
|
|
5
|
-
import type { AuthAction } from './types';
|
|
6
|
-
export declare const authActions: {
|
|
7
|
-
authenticationStarted: () => AuthAction;
|
|
8
|
-
authenticationProcessing: () => AuthAction;
|
|
9
|
-
authenticationFailed: () => AuthAction;
|
|
10
|
-
setSession: (session: AuthSession) => AuthAction;
|
|
11
|
-
removeSession: () => AuthAction;
|
|
12
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { authActions } from './actions';
|
|
2
|
-
export { AuthContextProvider, useAuthContext, useAuthDispatch, useAuthSelector, useAuthState, } from './AuthContext';
|
|
3
|
-
export { authReducer, getInitialAuthState } from './reducer';
|
|
4
|
-
export type { AuthAction, AuthContextValue } from './types';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IAuthState } from '../../providers/auth/types';
|
|
2
|
-
import type { AuthAction } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Initial state for auth context.
|
|
5
|
-
*
|
|
6
|
-
* UX flow:
|
|
7
|
-
* 1. App loads → status: loading (user sees loading state).
|
|
8
|
-
* 2. AuthProviderWrapper checks session in localStorage.
|
|
9
|
-
* 3. No session → status: unauthenticated (show login).
|
|
10
|
-
* 4. Has session → fetch profile; success → authenticated, failure → unauthenticated.
|
|
11
|
-
*
|
|
12
|
-
* Flags (isLoading, isAuthenticated, isRedirecting) are derived from status via getAuthFlags().
|
|
13
|
-
*/
|
|
14
|
-
export declare const getInitialAuthState: () => IAuthState;
|
|
15
|
-
/**
|
|
16
|
-
* Auth reducer for Context API
|
|
17
|
-
* Handles all auth state updates with proper immutability
|
|
18
|
-
*/
|
|
19
|
-
export declare const authReducer: (state: IAuthState, action: AuthAction) => IAuthState;
|