@buildbase/sdk 0.0.24 → 0.0.25
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/dist/index.esm.js +0 -1
- package/dist/index.js +0 -1
- 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,81 +0,0 @@
|
|
|
1
|
-
import React, { Component, type ReactNode } from 'react';
|
|
2
|
-
export interface ErrorBoundaryProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
/**
|
|
5
|
-
* Fallback UI to render when an error occurs
|
|
6
|
-
*/
|
|
7
|
-
fallback?: ReactNode | ((error: Error, resetError: () => void) => ReactNode);
|
|
8
|
-
/**
|
|
9
|
-
* Called when an error is caught
|
|
10
|
-
*/
|
|
11
|
-
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
12
|
-
/**
|
|
13
|
-
* Whether to reset error state when children change
|
|
14
|
-
* @default true
|
|
15
|
-
*/
|
|
16
|
-
resetOnPropsChange?: boolean;
|
|
17
|
-
}
|
|
18
|
-
interface ErrorBoundaryState {
|
|
19
|
-
hasError: boolean;
|
|
20
|
-
error: Error | null;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Error Boundary component for catching React component errors.
|
|
24
|
-
* Wraps SDK components to prevent crashes from propagating to the entire app.
|
|
25
|
-
* Automatically logs errors using the SDK error handler.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* function App() {
|
|
30
|
-
* return (
|
|
31
|
-
* <SDKErrorBoundary
|
|
32
|
-
* fallback={(error, reset) => (
|
|
33
|
-
* <div>
|
|
34
|
-
* <p>Error: {error.message}</p>
|
|
35
|
-
* <button onClick={reset}>Try Again</button>
|
|
36
|
-
* </div>
|
|
37
|
-
* )}
|
|
38
|
-
* onError={(error, errorInfo) => {
|
|
39
|
-
* // Custom error reporting
|
|
40
|
-
* reportError(error, errorInfo);
|
|
41
|
-
* }}
|
|
42
|
-
* >
|
|
43
|
-
* <YourApp />
|
|
44
|
-
* </SDKErrorBoundary>
|
|
45
|
-
* );
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* // Simple usage with default fallback
|
|
52
|
-
* function App() {
|
|
53
|
-
* return (
|
|
54
|
-
* <SDKErrorBoundary>
|
|
55
|
-
* <YourApp />
|
|
56
|
-
* </SDKErrorBoundary>
|
|
57
|
-
* );
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```tsx
|
|
63
|
-
* // Disable auto-reset on props change
|
|
64
|
-
* function App() {
|
|
65
|
-
* return (
|
|
66
|
-
* <SDKErrorBoundary resetOnPropsChange={false}>
|
|
67
|
-
* <YourApp />
|
|
68
|
-
* </SDKErrorBoundary>
|
|
69
|
-
* );
|
|
70
|
-
* }
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare class SDKErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
74
|
-
constructor(props: ErrorBoundaryProps);
|
|
75
|
-
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
76
|
-
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
77
|
-
componentDidUpdate(prevProps: ErrorBoundaryProps): void;
|
|
78
|
-
resetError: () => void;
|
|
79
|
-
render(): ReactNode;
|
|
80
|
-
}
|
|
81
|
-
export default SDKErrorBoundary;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type Language = 'en' | 'es' | 'fr' | 'de' | 'zh' | 'ja' | 'ko';
|
|
3
|
-
interface FormText {
|
|
4
|
-
nameLabel: string;
|
|
5
|
-
emailLabel: string;
|
|
6
|
-
submitText: string;
|
|
7
|
-
submittingText: string;
|
|
8
|
-
errorMessage: string;
|
|
9
|
-
}
|
|
10
|
-
interface BetaFormProps {
|
|
11
|
-
onSuccess?: () => void;
|
|
12
|
-
onError?: (error: string) => void;
|
|
13
|
-
className?: string;
|
|
14
|
-
fieldClassName?: string;
|
|
15
|
-
language?: Language;
|
|
16
|
-
customTexts?: Partial<FormText>;
|
|
17
|
-
autoFocus?: boolean;
|
|
18
|
-
showSuccessMessage?: boolean;
|
|
19
|
-
successMessageDuration?: number;
|
|
20
|
-
hideLogo?: boolean;
|
|
21
|
-
hideTitles?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare const BetaForm: React.FC<BetaFormProps>;
|
|
24
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { IAsset, IDocument } from '../../api/types';
|
|
2
|
-
import { IOsConfig } from '../../providers/os/types';
|
|
3
|
-
interface IScreenDetail {
|
|
4
|
-
title: string;
|
|
5
|
-
description: string;
|
|
6
|
-
}
|
|
7
|
-
export interface IBetaConfig extends IDocument {
|
|
8
|
-
name: string;
|
|
9
|
-
smallName: string;
|
|
10
|
-
description: string;
|
|
11
|
-
logoFallBack: string;
|
|
12
|
-
logo: string | IAsset;
|
|
13
|
-
privacyPolicy: string;
|
|
14
|
-
termsOfService: string;
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
screen: {
|
|
17
|
-
register: IScreenDetail;
|
|
18
|
-
thankYou: IScreenDetail;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
interface ApiResponse {
|
|
22
|
-
status: string;
|
|
23
|
-
message: string;
|
|
24
|
-
data?: {
|
|
25
|
-
submissionId: string;
|
|
26
|
-
status: string;
|
|
27
|
-
};
|
|
28
|
-
code: string;
|
|
29
|
-
config?: IBetaConfig;
|
|
30
|
-
submissionId?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare class BetaForm {
|
|
33
|
-
private api;
|
|
34
|
-
private orgId;
|
|
35
|
-
constructor(config: IOsConfig);
|
|
36
|
-
fetchConfig(): Promise<IBetaConfig>;
|
|
37
|
-
submitBetaUser(formData: {
|
|
38
|
-
name: string;
|
|
39
|
-
email: string;
|
|
40
|
-
context?: {
|
|
41
|
-
country?: string;
|
|
42
|
-
language?: string;
|
|
43
|
-
timezone?: string;
|
|
44
|
-
currency?: string;
|
|
45
|
-
};
|
|
46
|
-
}): Promise<ApiResponse>;
|
|
47
|
-
}
|
|
48
|
-
export default BetaForm;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IBetaConfig } from '../../api';
|
|
2
|
-
import { BetaFormData, BetaFormResponse } from './types';
|
|
3
|
-
export declare const useBetaForm: () => {
|
|
4
|
-
isLoading: boolean;
|
|
5
|
-
isSubmitting: boolean;
|
|
6
|
-
config: IBetaConfig | null;
|
|
7
|
-
error: string | null;
|
|
8
|
-
success: boolean;
|
|
9
|
-
message: string | null;
|
|
10
|
-
submitBetaForm: (data: BetaFormData) => Promise<BetaFormResponse>;
|
|
11
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
interface IProps {
|
|
2
|
-
slug: string;
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Conditional component that renders children only when the specified workspace feature is enabled.
|
|
7
|
-
* Checks feature flags at the workspace level.
|
|
8
|
-
*
|
|
9
|
-
* @param props - Component props
|
|
10
|
-
* @param props.slug - Feature flag slug/key to check
|
|
11
|
-
* @param props.children - Content to render when feature is enabled
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* function PremiumFeature() {
|
|
16
|
-
* return (
|
|
17
|
-
* <WhenWorkspaceFeatureEnabled slug="premium-analytics">
|
|
18
|
-
* <AnalyticsDashboard />
|
|
19
|
-
* </WhenWorkspaceFeatureEnabled>
|
|
20
|
-
* );
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* // Multiple features
|
|
27
|
-
* function FeatureContent() {
|
|
28
|
-
* return (
|
|
29
|
-
* <>
|
|
30
|
-
* <WhenWorkspaceFeatureEnabled slug="feature-a">
|
|
31
|
-
* <FeatureA />
|
|
32
|
-
* </WhenWorkspaceFeatureEnabled>
|
|
33
|
-
* <WhenWorkspaceFeatureEnabled slug="feature-b">
|
|
34
|
-
* <FeatureB />
|
|
35
|
-
* </WhenWorkspaceFeatureEnabled>
|
|
36
|
-
* </>
|
|
37
|
-
* );
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare const WhenWorkspaceFeatureEnabled: {
|
|
42
|
-
(props: IProps): import("react").ReactNode;
|
|
43
|
-
displayName: string;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Conditional component that renders children only when the specified workspace feature is disabled.
|
|
47
|
-
* Checks feature flags at the workspace level.
|
|
48
|
-
*
|
|
49
|
-
* @param props - Component props
|
|
50
|
-
* @param props.slug - Feature flag slug/key to check
|
|
51
|
-
* @param props.children - Content to render when feature is disabled
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```tsx
|
|
55
|
-
* function UpgradePrompt() {
|
|
56
|
-
* return (
|
|
57
|
-
* <WhenWorkspaceFeatureDisabled slug="premium-feature">
|
|
58
|
-
* <UpgradeButton />
|
|
59
|
-
* </WhenWorkspaceFeatureDisabled>
|
|
60
|
-
* );
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export declare const WhenWorkspaceFeatureDisabled: {
|
|
65
|
-
(props: IProps): import("react").ReactNode;
|
|
66
|
-
displayName: string;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Conditional component that renders children only when the specified user feature is enabled.
|
|
70
|
-
* Checks feature flags at the user level (from UserProvider).
|
|
71
|
-
*
|
|
72
|
-
* @param props - Component props
|
|
73
|
-
* @param props.slug - Feature flag slug/key to check
|
|
74
|
-
* @param props.children - Content to render when feature is enabled
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```tsx
|
|
78
|
-
* function BetaFeature() {
|
|
79
|
-
* return (
|
|
80
|
-
* <WhenUserFeatureEnabled slug="beta-access">
|
|
81
|
-
* <BetaContent />
|
|
82
|
-
* </WhenUserFeatureEnabled>
|
|
83
|
-
* );
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```tsx
|
|
89
|
-
* // Edge case: Feature not loaded yet
|
|
90
|
-
* function FeatureContent() {
|
|
91
|
-
* const { isLoading } = useUserFeatures();
|
|
92
|
-
*
|
|
93
|
-
* if (isLoading) return <Loading />;
|
|
94
|
-
*
|
|
95
|
-
* return (
|
|
96
|
-
* <WhenUserFeatureEnabled slug="feature-x">
|
|
97
|
-
* <FeatureX />
|
|
98
|
-
* </WhenUserFeatureEnabled>
|
|
99
|
-
* );
|
|
100
|
-
* }
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare const WhenUserFeatureEnabled: {
|
|
104
|
-
(props: IProps): import("react").ReactNode;
|
|
105
|
-
displayName: string;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Conditional component that renders children only when the specified user feature is disabled.
|
|
109
|
-
* Checks feature flags at the user level (from UserProvider).
|
|
110
|
-
*
|
|
111
|
-
* @param props - Component props
|
|
112
|
-
* @param props.slug - Feature flag slug/key to check
|
|
113
|
-
* @param props.children - Content to render when feature is disabled
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```tsx
|
|
117
|
-
* function UpgradePrompt() {
|
|
118
|
-
* return (
|
|
119
|
-
* <WhenUserFeatureDisabled slug="premium-access">
|
|
120
|
-
* <UpgradeButton />
|
|
121
|
-
* </WhenUserFeatureDisabled>
|
|
122
|
-
* );
|
|
123
|
-
* }
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare const WhenUserFeatureDisabled: {
|
|
127
|
-
(props: IProps): import("react").ReactNode;
|
|
128
|
-
displayName: string;
|
|
129
|
-
};
|
|
130
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { IPublicPlanItem, IPublicPlanVersion } from '../../api/types';
|
|
3
|
-
export interface PricingPageDetails {
|
|
4
|
-
/** Whether plan data is being fetched */
|
|
5
|
-
loading: boolean;
|
|
6
|
-
/** Error message if fetch failed */
|
|
7
|
-
error: string | null;
|
|
8
|
-
/** Subscription items (features, limits, quotas) */
|
|
9
|
-
items: IPublicPlanItem[];
|
|
10
|
-
/** Plan versions with pricing, features, limits, quotas */
|
|
11
|
-
plans: IPublicPlanVersion[];
|
|
12
|
-
/** Optional note from API (e.g. "Pricing is in cents. Please convert to dollars for display.") */
|
|
13
|
-
notes?: string;
|
|
14
|
-
/** Refetch plan data */
|
|
15
|
-
refetch: () => Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export interface PricingPageProps {
|
|
18
|
-
/** Plan group slug (e.g. 'main-pricing', 'enterprise') */
|
|
19
|
-
slug: string;
|
|
20
|
-
/** Render prop receiving plan details - construct layout from items and plans */
|
|
21
|
-
children: (details: PricingPageDetails) => ReactNode;
|
|
22
|
-
/** Custom loading UI. Defaults to skeleton. */
|
|
23
|
-
loadingFallback?: ReactNode;
|
|
24
|
-
/** Custom error UI. Receives error message. */
|
|
25
|
-
errorFallback?: (error: string) => ReactNode;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Fetches and provides plan/pricing details for public pricing pages (no login required).
|
|
29
|
-
* Returns items (features, limits, quotas) and plans (with pricing) - user constructs layout.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```tsx
|
|
33
|
-
* <PricingPage slug="main-pricing">
|
|
34
|
-
* {({ loading, error, items, plans, refetch }) => {
|
|
35
|
-
* if (loading) return <Loading />;
|
|
36
|
-
* if (error) return <Error message={error} />;
|
|
37
|
-
*
|
|
38
|
-
* return (
|
|
39
|
-
* <div>
|
|
40
|
-
* {plans.map(plan => (
|
|
41
|
-
* <PlanCard key={plan._id} plan={plan} items={items} />
|
|
42
|
-
* ))}
|
|
43
|
-
* </div>
|
|
44
|
-
* );
|
|
45
|
-
* }}
|
|
46
|
-
* </PricingPage>
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function PricingPage({ slug, children, loadingFallback, errorFallback }: PricingPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
interface IWhenQuotaProps {
|
|
2
|
-
/** Quota slug to check (e.g. 'api_calls', 'emails', 'storage'). */
|
|
3
|
-
slug: string;
|
|
4
|
-
/** Content to render when the condition is met. */
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/** Optional component/element to show while quota usage is loading (e.g. <Skeleton />). */
|
|
7
|
-
loadingComponent?: React.ReactNode;
|
|
8
|
-
/** Optional component/element to show when condition is not met (e.g. <UpgradePrompt />). */
|
|
9
|
-
fallbackComponent?: React.ReactNode;
|
|
10
|
-
}
|
|
11
|
-
interface IWhenQuotaThresholdProps extends IWhenQuotaProps {
|
|
12
|
-
/** Usage percentage threshold (0-100). Children render when usage >= this percentage. */
|
|
13
|
-
threshold: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Renders children only when the specified quota has remaining units (available > 0).
|
|
17
|
-
* Must be used within QuotaUsageContextProvider (included in SaaSOSProvider by default).
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* <WhenQuotaAvailable slug="api_calls">
|
|
22
|
-
* <MakeApiCallButton />
|
|
23
|
-
* </WhenQuotaAvailable>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* <WhenQuotaAvailable
|
|
29
|
-
* slug="emails"
|
|
30
|
-
* loadingComponent={<Skeleton />}
|
|
31
|
-
* fallbackComponent={<p>Email quota exhausted. <UpgradeLink /></p>}
|
|
32
|
-
* >
|
|
33
|
-
* <SendEmailButton />
|
|
34
|
-
* </WhenQuotaAvailable>
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare const WhenQuotaAvailable: {
|
|
38
|
-
(props: IWhenQuotaProps): import("react").ReactNode;
|
|
39
|
-
displayName: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Renders children only when the specified quota is fully consumed (available <= 0).
|
|
43
|
-
* Must be used within QuotaUsageContextProvider (included in SaaSOSProvider by default).
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* <WhenQuotaExhausted slug="api_calls">
|
|
48
|
-
* <UpgradePrompt message="You've used all your API calls this month." />
|
|
49
|
-
* </WhenQuotaExhausted>
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* <WhenQuotaExhausted
|
|
55
|
-
* slug="storage"
|
|
56
|
-
* loadingComponent={<Spinner />}
|
|
57
|
-
* fallbackComponent={null}
|
|
58
|
-
* >
|
|
59
|
-
* <StorageFullBanner />
|
|
60
|
-
* </WhenQuotaExhausted>
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare const WhenQuotaExhausted: {
|
|
64
|
-
(props: IWhenQuotaProps): import("react").ReactNode;
|
|
65
|
-
displayName: string;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Renders children only when the specified quota is in overage (consumed > included).
|
|
69
|
-
* Must be used within QuotaUsageContextProvider (included in SaaSOSProvider by default).
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```tsx
|
|
73
|
-
* <WhenQuotaOverage slug="api_calls">
|
|
74
|
-
* <OverageBillingWarning />
|
|
75
|
-
* </WhenQuotaOverage>
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```tsx
|
|
80
|
-
* <WhenQuotaOverage
|
|
81
|
-
* slug="emails"
|
|
82
|
-
* loadingComponent={<Skeleton />}
|
|
83
|
-
* fallbackComponent={null}
|
|
84
|
-
* >
|
|
85
|
-
* <p>You are being billed for overage usage.</p>
|
|
86
|
-
* </WhenQuotaOverage>
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
export declare const WhenQuotaOverage: {
|
|
90
|
-
(props: IWhenQuotaProps): import("react").ReactNode;
|
|
91
|
-
displayName: string;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Renders children when the specified quota's usage percentage reaches or exceeds the threshold.
|
|
95
|
-
* Usage percentage = (consumed / included) * 100. If included is 0 and consumed > 0, treats as 100%.
|
|
96
|
-
* Must be used within QuotaUsageContextProvider (included in SaaSOSProvider by default).
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```tsx
|
|
100
|
-
* <WhenQuotaThreshold slug="api_calls" threshold={80}>
|
|
101
|
-
* <p>Warning: You've used over 80% of your API calls.</p>
|
|
102
|
-
* </WhenQuotaThreshold>
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```tsx
|
|
107
|
-
* <WhenQuotaThreshold
|
|
108
|
-
* slug="storage"
|
|
109
|
-
* threshold={90}
|
|
110
|
-
* loadingComponent={<Spinner />}
|
|
111
|
-
* fallbackComponent={null}
|
|
112
|
-
* >
|
|
113
|
-
* <StorageWarningBanner />
|
|
114
|
-
* </WhenQuotaThreshold>
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
export declare const WhenQuotaThreshold: {
|
|
118
|
-
(props: IWhenQuotaThresholdProps): import("react").ReactNode;
|
|
119
|
-
displayName: string;
|
|
120
|
-
};
|
|
121
|
-
export {};
|