@kittycad/react-shared 0.1.4 → 0.1.6
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 +50 -5
- package/dist/index.esm.js +3460 -48
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3461 -47
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { SVGProps } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
4
|
+
import { AccountProvider, Client } from '@kittycad/lib';
|
|
5
|
+
import { BillingError as BillingError$1 } from '@/lib/billing';
|
|
5
6
|
import { DeepPartial } from '@/lib/types';
|
|
6
7
|
import { ClassValue } from 'clsx';
|
|
7
8
|
|
|
@@ -17,7 +18,7 @@ interface SignInPageContentProps {
|
|
|
17
18
|
trackingClasses?: (provider?: string) => string;
|
|
18
19
|
buttonClasses?: (provider?: string) => string;
|
|
19
20
|
callbackUrl?: string;
|
|
20
|
-
onOAuthClick?: (provider:
|
|
21
|
+
onOAuthClick?: (provider: AccountProvider) => void;
|
|
21
22
|
onEmailSubmit?: () => void;
|
|
22
23
|
baseUrl?: string;
|
|
23
24
|
className?: string;
|
|
@@ -69,7 +70,7 @@ type TextProps = {
|
|
|
69
70
|
};
|
|
70
71
|
};
|
|
71
72
|
type BillingDialogProps = {
|
|
72
|
-
error?:
|
|
73
|
+
error?: BillingError$1;
|
|
73
74
|
credits?: number;
|
|
74
75
|
allowance?: number;
|
|
75
76
|
upgradeHref: string;
|
|
@@ -85,7 +86,7 @@ declare enum BillingRemainingMode {
|
|
|
85
86
|
}
|
|
86
87
|
interface BillingRemainingProps {
|
|
87
88
|
mode: BillingRemainingMode;
|
|
88
|
-
error?:
|
|
89
|
+
error?: BillingError$1;
|
|
89
90
|
credits?: number;
|
|
90
91
|
allowance?: number;
|
|
91
92
|
}
|
|
@@ -93,5 +94,49 @@ declare const BillingRemaining: (props: BillingRemainingProps) => react_jsx_runt
|
|
|
93
94
|
|
|
94
95
|
declare function cn(...inputs: ClassValue[]): string;
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Adapted from https://github.com/KittyCAD/text-to-cad-ui/blob/309a2e756732b7b9a2b095d6a0f99bc23872d542/src/lib/billing.ts
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
declare enum EBillingError {
|
|
102
|
+
NotOk = "NotOk",
|
|
103
|
+
UnexpectedStatus = "UnexpectedStatus",
|
|
104
|
+
CatastrophicRequest = "CatastrophicRequest",
|
|
105
|
+
JSONParse = "JSONParse"
|
|
106
|
+
}
|
|
107
|
+
interface IBillingErrorNotOk {
|
|
108
|
+
type: EBillingError.NotOk;
|
|
109
|
+
data: string;
|
|
110
|
+
response: object;
|
|
111
|
+
message: string;
|
|
112
|
+
}
|
|
113
|
+
interface IBillingErrorUnexpectedStatus {
|
|
114
|
+
type: EBillingError.UnexpectedStatus;
|
|
115
|
+
code: number;
|
|
116
|
+
}
|
|
117
|
+
interface IBillingErrorCatastrophicRequest {
|
|
118
|
+
type: EBillingError.CatastrophicRequest;
|
|
119
|
+
url?: string;
|
|
120
|
+
}
|
|
121
|
+
interface IBillingErrorJSONParse {
|
|
122
|
+
type: EBillingError.JSONParse;
|
|
123
|
+
error: Error;
|
|
124
|
+
}
|
|
125
|
+
type _IBillingError = IBillingErrorNotOk | IBillingErrorUnexpectedStatus | IBillingErrorCatastrophicRequest | IBillingErrorJSONParse;
|
|
126
|
+
type IBillingError = _IBillingError extends {
|
|
127
|
+
type: EBillingError;
|
|
128
|
+
} ? _IBillingError : never;
|
|
129
|
+
declare class BillingError {
|
|
130
|
+
error: IBillingError;
|
|
131
|
+
constructor(error: IBillingError);
|
|
132
|
+
static from(v: any): v is BillingError;
|
|
133
|
+
}
|
|
134
|
+
declare function getBillingInfo(client: Client): Promise<BillingError | {
|
|
135
|
+
credits: number;
|
|
136
|
+
allowance?: number;
|
|
137
|
+
isOrg: boolean;
|
|
138
|
+
hasSubscription: boolean;
|
|
139
|
+
}>;
|
|
140
|
+
|
|
141
|
+
export { BillingDialog, BillingError, BillingRemaining, BillingRemainingMode, Button, CustomIcon, EmailLoginForm, LoginTitle, SignInPageContent, Spinner, cn, getBillingInfo };
|
|
97
142
|
export type { BillingDialogProps, BrandTheme, ButtonProps, EmailLoginFormProps, LoginTitleProps, SignInPageContentProps };
|