@kittycad/react-shared 0.1.3 → 0.1.5
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.d.ts +103 -9
- package/dist/index.esm.js +3554 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3558 -48
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { SVGProps } from 'react';
|
|
2
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
+
import { AccountProvider, Client } from '@kittycad/lib';
|
|
5
|
+
import { DeepPartial } from '@/lib/types';
|
|
4
6
|
import { ClassValue } from 'clsx';
|
|
5
7
|
|
|
6
|
-
interface ButtonProps extends
|
|
8
|
+
interface ButtonProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
9
|
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
8
10
|
size?: 'sm' | 'md' | 'lg';
|
|
9
|
-
children:
|
|
11
|
+
children: React__default.ReactNode;
|
|
10
12
|
}
|
|
11
|
-
declare const Button:
|
|
13
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
12
14
|
|
|
13
15
|
interface SignInPageContentProps {
|
|
14
16
|
shouldTrackConversions?: boolean;
|
|
15
17
|
trackingClasses?: (provider?: string) => string;
|
|
16
18
|
buttonClasses?: (provider?: string) => string;
|
|
17
19
|
callbackUrl?: string;
|
|
18
|
-
onOAuthClick?: (provider:
|
|
20
|
+
onOAuthClick?: (provider: AccountProvider) => void;
|
|
19
21
|
onEmailSubmit?: () => void;
|
|
20
22
|
baseUrl?: string;
|
|
21
23
|
className?: string;
|
|
@@ -25,7 +27,7 @@ interface SignInPageContentProps {
|
|
|
25
27
|
declare function SignInPageContent({ shouldTrackConversions, trackingClasses, buttonClasses, callbackUrl, onOAuthClick, onEmailSubmit, baseUrl, className, titleColor, getAPIBase, }: SignInPageContentProps): react_jsx_runtime.JSX.Element;
|
|
26
28
|
|
|
27
29
|
type BrandTheme = 'default' | 'yellow' | 'blue' | 'green' | 'magenta' | 'hue-shift' | 'hue-shift-on-white';
|
|
28
|
-
interface EmailLoginFormProps extends
|
|
30
|
+
interface EmailLoginFormProps extends React__default.HTMLProps<HTMLFormElement> {
|
|
29
31
|
theme?: BrandTheme;
|
|
30
32
|
buttonClassName?: string;
|
|
31
33
|
idSuffix?: string;
|
|
@@ -41,7 +43,99 @@ interface LoginTitleProps {
|
|
|
41
43
|
}
|
|
42
44
|
declare function LoginTitle({ color }: LoginTitleProps): react_jsx_runtime.JSX.Element;
|
|
43
45
|
|
|
46
|
+
declare const Spinner: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
declare const CustomIconMap: {
|
|
49
|
+
readonly exclamationMark: react_jsx_runtime.JSX.Element;
|
|
50
|
+
readonly infinity: react_jsx_runtime.JSX.Element;
|
|
51
|
+
readonly star: react_jsx_runtime.JSX.Element;
|
|
52
|
+
};
|
|
53
|
+
type CustomIconName = keyof typeof CustomIconMap;
|
|
54
|
+
declare const CustomIcon: ({ name, ...props }: {
|
|
55
|
+
name: CustomIconName;
|
|
56
|
+
} & React.SVGProps<SVGSVGElement>) => React$1.FunctionComponentElement<any>;
|
|
57
|
+
|
|
58
|
+
type TextProps = {
|
|
59
|
+
heading: {
|
|
60
|
+
unlimited: string;
|
|
61
|
+
limited: string;
|
|
62
|
+
};
|
|
63
|
+
paragraph: {
|
|
64
|
+
unlimited: string;
|
|
65
|
+
limited: string;
|
|
66
|
+
};
|
|
67
|
+
button: {
|
|
68
|
+
limited: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
type BillingDialogProps = {
|
|
72
|
+
error?: Error;
|
|
73
|
+
credits?: number;
|
|
74
|
+
allowance?: number;
|
|
75
|
+
upgradeHref: string;
|
|
76
|
+
text?: DeepPartial<TextProps>;
|
|
77
|
+
upgradeClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
78
|
+
className?: string;
|
|
79
|
+
};
|
|
80
|
+
declare const BillingDialog: (props: BillingDialogProps) => react_jsx_runtime.JSX.Element;
|
|
81
|
+
|
|
82
|
+
declare enum BillingRemainingMode {
|
|
83
|
+
ProgressBarFixed = 0,
|
|
84
|
+
ProgressBarStretch = 1
|
|
85
|
+
}
|
|
86
|
+
interface BillingRemainingProps {
|
|
87
|
+
mode: BillingRemainingMode;
|
|
88
|
+
error?: Error;
|
|
89
|
+
credits?: number;
|
|
90
|
+
allowance?: number;
|
|
91
|
+
}
|
|
92
|
+
declare const BillingRemaining: (props: BillingRemainingProps) => react_jsx_runtime.JSX.Element;
|
|
93
|
+
|
|
44
94
|
declare function cn(...inputs: ClassValue[]): string;
|
|
45
95
|
|
|
46
|
-
|
|
47
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Adapted from https://github.com/KittyCAD/text-to-cad-ui/blob/309a2e756732b7b9a2b095d6a0f99bc23872d542/src/lib/billing.ts
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
declare enum EBillingError {
|
|
101
|
+
NotOk = 0,
|
|
102
|
+
UnexpectedStatus = 1,
|
|
103
|
+
CatastrophicRequest = 2,
|
|
104
|
+
JSONParse = 3
|
|
105
|
+
}
|
|
106
|
+
interface IBillingErrorNotOk {
|
|
107
|
+
type: EBillingError.NotOk;
|
|
108
|
+
data: string;
|
|
109
|
+
response: object;
|
|
110
|
+
message: string;
|
|
111
|
+
}
|
|
112
|
+
interface IBillingErrorUnexpectedStatus {
|
|
113
|
+
type: EBillingError.UnexpectedStatus;
|
|
114
|
+
code: number;
|
|
115
|
+
}
|
|
116
|
+
interface IBillingErrorCatastrophicRequest {
|
|
117
|
+
type: EBillingError.CatastrophicRequest;
|
|
118
|
+
url?: string;
|
|
119
|
+
}
|
|
120
|
+
interface IBillingErrorJSONParse {
|
|
121
|
+
type: EBillingError.JSONParse;
|
|
122
|
+
error: Error;
|
|
123
|
+
}
|
|
124
|
+
type _IBillingError = IBillingErrorNotOk | IBillingErrorUnexpectedStatus | IBillingErrorCatastrophicRequest | IBillingErrorJSONParse;
|
|
125
|
+
type IBillingError = _IBillingError extends {
|
|
126
|
+
type: EBillingError;
|
|
127
|
+
} ? _IBillingError : never;
|
|
128
|
+
declare class BillingError {
|
|
129
|
+
error: IBillingError;
|
|
130
|
+
constructor(error: IBillingError);
|
|
131
|
+
static from(v: any): v is BillingError;
|
|
132
|
+
}
|
|
133
|
+
declare function getBillingInfo(client: Client): Promise<BillingError | {
|
|
134
|
+
credits: number;
|
|
135
|
+
allowance?: number;
|
|
136
|
+
isOrg: boolean;
|
|
137
|
+
hasSubscription: boolean;
|
|
138
|
+
}>;
|
|
139
|
+
|
|
140
|
+
export { BillingDialog, BillingError, BillingRemaining, BillingRemainingMode, Button, CustomIcon, EmailLoginForm, LoginTitle, SignInPageContent, Spinner, cn, getBillingInfo };
|
|
141
|
+
export type { BillingDialogProps, BrandTheme, ButtonProps, EmailLoginFormProps, LoginTitleProps, SignInPageContentProps };
|