@taxbit/react-sdk 1.0.0-beta.6 → 1.0.0-beta.7

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 CHANGED
@@ -125,6 +125,7 @@ The `useTaxbit` hook can be used to get the data from the server or the account
125
125
  const {
126
126
  statusData,
127
127
  serverData,
128
+ error,
128
129
  canGetDocumentUrl,
129
130
  generateDocumentUrl,
130
131
  isGeneratingDocumentUrl,
@@ -200,6 +201,10 @@ or for W-Form status
200
201
  }
201
202
  ```
202
203
 
204
+ #### useTaxbit hook `error` object
205
+
206
+ The useTaxbit hook also contains an `error` object which can be `undefined`, or an `Error`. If there is an error fetching or with the bearer token, the error property will be populated, and also logged to the console. If an `onError` callback is provided to the hook, the error will _not_ be logged to the console.
207
+
203
208
  ### CSS and Style Customization
204
209
 
205
210
  The Taxbit React SDK renders a form for collecting user data. The form is structured with fairly semantic HTML and CSS classes and can be easily customized to closely match your client's style.
@@ -306,6 +311,11 @@ type QuestionnaireType = 'DPS' | 'W-FORM';
306
311
 
307
312
  ## Changelog
308
313
 
314
+ ### Version 1.0.0-beta.7
315
+
316
+ 1. BearerToken and Fetch errors are now sent only to the console, no longer thrown and bubbled up.
317
+ 2. 2Added an `error` object to the 'useTaxbit' hook.
318
+
309
319
  ### Version 1.0.0-beta.6
310
320
 
311
321
  1. Bugs fixed related to the country drop-downs.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const ErrorAlert: ({ message }: {
3
+ message?: string | undefined;
4
+ }) => React.JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './ErrorAlert';
@@ -1,4 +1,5 @@
1
1
  export * from './Address';
2
+ export * from './ErrorAlert';
2
3
  export * from './ErrorBoundary';
3
4
  export * from './ErrorMessage';
4
5
  export * from './Form';
@@ -1,3 +1,4 @@
1
- export declare const useHandleError: (onError?: ((error: Error) => void | Promise<void>) | undefined) => {
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ export declare const useHandleError: (onError: ((error: Error) => void | Promise<void>) | undefined, setError?: Dispatch<SetStateAction<Error | undefined>>) => {
2
3
  handleError: (error: Error) => void;
3
4
  };
@@ -12,5 +12,6 @@ export declare const useTaxbit: ({ bearerToken, questionnaire, staging, onError,
12
12
  generateDocumentUrl: () => void;
13
13
  isGeneratingDocumentUrl: boolean;
14
14
  documentUrl: string | undefined;
15
+ error: Error | undefined;
15
16
  };
16
17
  export {};
@@ -11,5 +11,6 @@ export declare const useTaxbitStatus: ({ bearerToken, questionnaire, staging, on
11
11
  serverData: SignedClientTaxDocumentation | undefined;
12
12
  statusData: ClientTaxDocumentationStatus | undefined;
13
13
  isLoading: boolean;
14
+ error: Error | undefined;
14
15
  };
15
16
  export {};
@@ -11,10 +11,11 @@ export type UseTaxbitPersistProps = {
11
11
  onError?: (error: Error) => void | Promise<void>;
12
12
  onSubmit?: (data: ClientTaxDocumentation) => void | Promise<void>;
13
13
  };
14
- export declare const useTaxbitPersist: ({ bearerToken, data, onSubmit, onSuccess, onSettled, onError, staging, questionnaire, }: UseTaxbitPersistProps) => {
14
+ export declare const useTaxbitPersist: ({ bearerToken, data, onError, onSettled, onSubmit, onSuccess, questionnaire, staging, }: UseTaxbitPersistProps) => {
15
15
  handleOnSubmit: (data: SignedClientTaxDocumentation) => Promise<void>;
16
16
  externalValidations: ExternalValidations;
17
17
  formData: ClientTaxDocumentation;
18
18
  isComplete: boolean;
19
19
  isLoading: boolean;
20
+ error: Error | undefined;
20
21
  };