@kittycad/react-shared 0.1.4 → 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 CHANGED
@@ -1,7 +1,7 @@
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 { Models } from '@kittycad/lib';
4
+ import { AccountProvider, Client } from '@kittycad/lib';
5
5
  import { DeepPartial } from '@/lib/types';
6
6
  import { ClassValue } from 'clsx';
7
7
 
@@ -17,7 +17,7 @@ interface SignInPageContentProps {
17
17
  trackingClasses?: (provider?: string) => string;
18
18
  buttonClasses?: (provider?: string) => string;
19
19
  callbackUrl?: string;
20
- onOAuthClick?: (provider: Models['AccountProvider_type']) => void;
20
+ onOAuthClick?: (provider: AccountProvider) => void;
21
21
  onEmailSubmit?: () => void;
22
22
  baseUrl?: string;
23
23
  className?: string;
@@ -93,5 +93,49 @@ declare const BillingRemaining: (props: BillingRemainingProps) => react_jsx_runt
93
93
 
94
94
  declare function cn(...inputs: ClassValue[]): string;
95
95
 
96
- export { BillingDialog, BillingRemaining, BillingRemainingMode, Button, CustomIcon, EmailLoginForm, LoginTitle, SignInPageContent, Spinner, cn };
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 };
97
141
  export type { BillingDialogProps, BrandTheme, ButtonProps, EmailLoginFormProps, LoginTitleProps, SignInPageContentProps };