@taxbit/react-sdk 1.0.0-beta.3 → 1.0.0-beta.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/README.md +43 -5
- package/dist/src/components/ErrorBoundary/ErrorBoundary.d.ts +16 -0
- package/dist/src/components/ErrorBoundary/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/contexts/TaxDocumentation/useTaxDocumentation.d.ts +5 -6
- package/dist/src/contexts/TaxDocumentation/useTaxDocumentationContext.d.ts +12 -14
- package/dist/src/entry/TaxbitQuestionnaire/TaxbitQuestionnaire.d.ts +21 -7
- package/dist/src/entry/index.d.ts +1 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/useHandleError.d.ts +3 -0
- package/dist/src/hooks/useTaxbit/index.d.ts +1 -0
- package/dist/src/hooks/useTaxbit/useTaxbit.d.ts +10 -3
- package/dist/src/hooks/useTaxbit/useTaxbitStatus.d.ts +11 -4
- package/dist/src/types/InputStep.d.ts +2 -2
- package/dist/src/utils/bearerTokenIsRequiredError.d.ts +1 -0
- package/dist/src/utils/getFormStatus.d.ts +2 -0
- package/dist/src/utils/getHeaders.d.ts +3 -0
- package/dist/src/utils/handleFetch.d.ts +7 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/widgets/TaxbitQuestionnairePersist/TaxbitQuestionnairePersist.d.ts +2 -2
- package/dist/src/widgets/TaxbitQuestionnairePersist/__tests__/TaxbitQuestionnairePersist.missingBearerToken.test.d.ts +0 -0
- package/dist/src/widgets/TaxbitQuestionnairePersist/useTaxbitPersist.d.ts +5 -10
- package/dist/src/wizard/TaxbitQuestionnaireUI/steps.d.ts +0 -1
- package/dist/taxbit-react-sdk.js +1854 -1760
- package/dist/taxbit-react-sdk.umd.cjs +10 -10
- package/package.json +3 -3
- package/dist/src/hooks/useTaxbit/useTaxbitConnect.d.ts +0 -8
- package/dist/src/wizard/TaxbitQuestionnaireUI/Confirmation/Confirmation.d.ts +0 -2
- package/dist/src/wizard/TaxbitQuestionnaireUI/Confirmation/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -4,10 +4,14 @@ A React component and hook for gathering Tax Documentation data for US and EU Ta
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
The Taxbit React SDK provides a React component and
|
|
7
|
+
The Taxbit React SDK provides a React component, hook, and Typescript types for gathering tax documentation data from users. The component can be used to collect data for the Taxbit DPS (Digital Platform Sales) or W-Form (W-9, W-8BEN, W-8BEN-E) tax documentation forms. A hook provides more tools to understand the user's tax documentation status and download any pdf versions of the files that are created if eligible.
|
|
8
8
|
|
|
9
9
|
DPS (Digital Platform Sales) is a data standard and UI flow used by Taxbit to gather the information needed to report income as directed by the DAC7 for the European Union, and equivalent reporting requirements in Canada, New Zealand, and the United Kingdom.
|
|
10
10
|
|
|
11
|
+
## Beta Stage
|
|
12
|
+
|
|
13
|
+
During this stage, the Taxbit SDK is fully supported, and can be used in production environments. However, there may be breaking changes without a new major version release. If used in a production environment, Taxbit recommends setting a fixed version, updating regularly, and testing after each update.
|
|
14
|
+
|
|
11
15
|
## Installation
|
|
12
16
|
|
|
13
17
|
```bash
|
|
@@ -22,13 +26,13 @@ import { TaxbitQuestionnaire, ClientTaxDocumentation } from '@taxbit/react-sdk';
|
|
|
22
26
|
### Data
|
|
23
27
|
|
|
24
28
|
```typescript
|
|
25
|
-
exampleData: ClientTaxDocumentation = {
|
|
29
|
+
const exampleData: ClientTaxDocumentation = {
|
|
26
30
|
accountHolder: {
|
|
27
31
|
name: 'John Smith',
|
|
28
32
|
tin: '456456456',
|
|
29
33
|
ftin: '667788991',
|
|
30
|
-
usAccountType: '
|
|
31
|
-
foreignAccountType: '
|
|
34
|
+
usAccountType: 'INDIVIDUAL',
|
|
35
|
+
foreignAccountType: 'INDIVIDUAL',
|
|
32
36
|
address: {
|
|
33
37
|
firstLine: '123 Main St',
|
|
34
38
|
secondLine: 'Unit #2',
|
|
@@ -113,6 +117,27 @@ The WForm component language can be set to 'en', 'fr', or 'es'.
|
|
|
113
117
|
|
|
114
118
|
See the `Locale` type below.
|
|
115
119
|
|
|
120
|
+
## useTaxbit Hook
|
|
121
|
+
|
|
122
|
+
The `useTaxbit` hook can be used to get the data from the server or the account status.
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const {
|
|
126
|
+
statusData,
|
|
127
|
+
serverData,
|
|
128
|
+
canGetDocumentUrl,
|
|
129
|
+
generateDocumentUrl,
|
|
130
|
+
isGeneratingDocumentUrl,
|
|
131
|
+
documentUrl,
|
|
132
|
+
} = useTaxbit({ bearerToken, questionnaire, onError });
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
It can also be used to get the document URL for the user's tax documentation. The `generateDocumentUrl` function will trigger a temporary URL generation. The `documentUrl` will be the URL of the document if it is available. `isGeneratingDocumentUrl` will be true while the URL is being generated. `canGetDocumentUrl` will be true if the user has submitted the questionnaire and a PDF tax document is available to this user. Note, `DPS` data does not generate a PDF document.
|
|
136
|
+
|
|
137
|
+
### Server Data
|
|
138
|
+
|
|
139
|
+
The serverData object contains the currently saved tax documentation data for the user. It is also a `ClientTaxDocumentation` object.
|
|
140
|
+
|
|
116
141
|
### Status
|
|
117
142
|
|
|
118
143
|
The `useTaxbit` hook will return a `status` object that can be used to determine the status of the user's tax documentation. The `status` object will have the following shape:
|
|
@@ -190,9 +215,13 @@ The Taxbit React SDK provides callbacks for the following events on the `TaxbitQ
|
|
|
190
215
|
- `onSettled` - called after `onError` or `onSuccess` is called.
|
|
191
216
|
- `onProgress` - called when the user loads and navigates within the Taxbit UI. The function passed here will be passed a Progress object (see below for the type definition):
|
|
192
217
|
|
|
218
|
+
#### Error Boundary
|
|
219
|
+
|
|
220
|
+
A basic React Error Boundary is in place and when an error is thrown, the TaxbitQuestionnaire component will display errors on screen and throw an error in console. The exceptions that are possible are related to fetching data from the server, such as authentication (401 Unauthorized) or network problems (Failed to fetch). An error is also thrown if the bearer token is missing (Bearer Token is required). If the `onError` callback is provided to the component or the hook, these errors will be caught not and the error boundary will not be displayed.
|
|
221
|
+
|
|
193
222
|
The DPS sequence, for example, can have a total of 3, 4, or 5 steps, each with a localized `stepTitle` and `stepId`. The `stepNumber` is the current step (1 based), and `percentComplete` is the percentage of the steps that have been completed.
|
|
194
223
|
|
|
195
|
-
|
|
224
|
+
## Types
|
|
196
225
|
|
|
197
226
|
The Taxbit React SDK provides a type for the status of the most recent tax documentation submitted by the user, referred to as `ClientTaxDocumentationStatus`. The data passed to the component and returned to the callback is typed as `ClientTaxDocumentation`.
|
|
198
227
|
|
|
@@ -265,6 +294,15 @@ type QuestionnaireType = 'DPS' | 'W-FORM';
|
|
|
265
294
|
|
|
266
295
|
## Changelog
|
|
267
296
|
|
|
297
|
+
### Version 1.0.0-beta.5
|
|
298
|
+
|
|
299
|
+
1. Document Generation modifications. Renamed from "getDocumentUrl" to "generateDocumentUrl".
|
|
300
|
+
2. `onError` callback is now exposed in both the TaxbitQuestionnaire component and the useTaxbit hook.
|
|
301
|
+
|
|
302
|
+
### Version 1.0.0-beta.4
|
|
303
|
+
|
|
304
|
+
1. More explicit typing for TaxbitQuestionnaire component props
|
|
305
|
+
|
|
268
306
|
### Version 1.0.0-beta.3
|
|
269
307
|
|
|
270
308
|
1. Transforming deprecated tax documentation data types for import to SDK
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { Component, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
interface State {
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
errorMessage?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ErrorBoundary extends Component<Props, State> {
|
|
10
|
+
state: State;
|
|
11
|
+
static getDerivedStateFromError(error: Error): State;
|
|
12
|
+
componentDidCatch(error: Error): void;
|
|
13
|
+
componentDidUpdate(): void;
|
|
14
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorBoundary';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ClientTaxDocumentation } from '@taxbit/utilities';
|
|
3
3
|
import type { InputStep, Locale, Progress, Questionnaire, TaxDocumentation } from 'types';
|
|
4
|
-
import { ExternalValidations } from 'types/client';
|
|
5
4
|
import type { StepId } from 'types/StepId';
|
|
5
|
+
import { ExternalValidations } from 'types/client';
|
|
6
6
|
type InterviewConfig = {
|
|
7
7
|
minimumAge: number;
|
|
8
8
|
};
|
|
@@ -10,7 +10,7 @@ export type UseTaxDocumentationProps = {
|
|
|
10
10
|
data?: ClientTaxDocumentation;
|
|
11
11
|
language?: Locale;
|
|
12
12
|
externalValidations?: ExternalValidations;
|
|
13
|
-
onSubmit
|
|
13
|
+
onSubmit?: (data: ClientTaxDocumentation) => void | Promise<void>;
|
|
14
14
|
onProgress?: (progress: Progress) => void | Promise<void>;
|
|
15
15
|
step?: InputStep;
|
|
16
16
|
questionnaire: Questionnaire;
|
|
@@ -20,8 +20,7 @@ export declare const useTaxDocumentation: ({ data: startingData, language: initi
|
|
|
20
20
|
isBuildingW9: boolean;
|
|
21
21
|
isBuildingW8: boolean;
|
|
22
22
|
onPersistCollectedData: (newData: TaxDocumentation) => void;
|
|
23
|
-
onSubmitTaxDocumentation: (data: TaxDocumentation) => void
|
|
24
|
-
error: string | undefined;
|
|
23
|
+
onSubmitTaxDocumentation: (data: TaxDocumentation) => Promise<void>;
|
|
25
24
|
editTo: (form: InputStep) => void;
|
|
26
25
|
onCancel: (() => void) | undefined;
|
|
27
26
|
getStepId: (key: InputStep) => StepId;
|
|
@@ -29,10 +28,10 @@ export declare const useTaxDocumentation: ({ data: startingData, language: initi
|
|
|
29
28
|
goBack: (() => void) | undefined;
|
|
30
29
|
goToNext: (data: TaxDocumentation) => void;
|
|
31
30
|
progress: Progress | undefined;
|
|
32
|
-
stepName: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
31
|
+
stepName: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
33
32
|
data: TaxDocumentation;
|
|
34
33
|
originalClientData: TaxDocumentation;
|
|
35
|
-
initialStep: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
34
|
+
initialStep: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
36
35
|
setLanguage: import("react").Dispatch<import("react").SetStateAction<"bg" | "cs" | "da" | "de" | "de-at" | "el" | "el-cy" | "en" | "en-gb" | "en-nz" | "en-us" | "es" | "et" | "fi" | "fr" | "fr-ca" | "fr-lu" | "ga" | "hr" | "hu" | "it" | "lt" | "lv" | "mt" | "nl" | "nl-be" | "no" | "pl" | "pt" | "ro" | "sk" | "sl" | "sv">>;
|
|
37
36
|
language: "bg" | "cs" | "da" | "de" | "de-at" | "el" | "el-cy" | "en" | "en-gb" | "en-nz" | "en-us" | "es" | "et" | "fi" | "fr" | "fr-ca" | "fr-lu" | "ga" | "hr" | "hu" | "it" | "lt" | "lv" | "mt" | "nl" | "nl-be" | "no" | "pl" | "pt" | "ro" | "sk" | "sl" | "sv";
|
|
38
37
|
questionnaire: Questionnaire;
|
|
@@ -3,19 +3,18 @@ export declare const useTaxDocumentationContext: () => {
|
|
|
3
3
|
isBuildingW9: boolean;
|
|
4
4
|
isBuildingW8: boolean;
|
|
5
5
|
onPersistCollectedData: (newData: import("../../types").TaxDocumentation) => void;
|
|
6
|
-
onSubmitTaxDocumentation: (data: import("../../types").TaxDocumentation) => void
|
|
7
|
-
|
|
8
|
-
editTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
|
|
6
|
+
onSubmitTaxDocumentation: (data: import("../../types").TaxDocumentation) => Promise<void>;
|
|
7
|
+
editTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
|
|
9
8
|
onCancel: (() => void) | undefined;
|
|
10
|
-
getStepId: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
11
|
-
goTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
9
|
+
getStepId: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => import("../../types/StepId").StepId;
|
|
10
|
+
goTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
|
|
12
11
|
goBack: (() => void) | undefined;
|
|
13
12
|
goToNext: (data: import("../../types").TaxDocumentation) => void;
|
|
14
13
|
progress: import("../../types").Progress | undefined;
|
|
15
|
-
stepName: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
14
|
+
stepName: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
16
15
|
data: import("../../types").TaxDocumentation;
|
|
17
16
|
originalClientData: import("../../types").TaxDocumentation;
|
|
18
|
-
initialStep: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
17
|
+
initialStep: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
19
18
|
setLanguage: import("react").Dispatch<import("react").SetStateAction<"bg" | "cs" | "da" | "de" | "de-at" | "el" | "el-cy" | "en" | "en-gb" | "en-nz" | "en-us" | "es" | "et" | "fi" | "fr" | "fr-ca" | "fr-lu" | "ga" | "hr" | "hu" | "it" | "lt" | "lv" | "mt" | "nl" | "nl-be" | "no" | "pl" | "pt" | "ro" | "sk" | "sl" | "sv">>;
|
|
20
19
|
language: "bg" | "cs" | "da" | "de" | "de-at" | "el" | "el-cy" | "en" | "en-gb" | "en-nz" | "en-us" | "es" | "et" | "fi" | "fr" | "fr-ca" | "fr-lu" | "ga" | "hr" | "hu" | "it" | "lt" | "lv" | "mt" | "nl" | "nl-be" | "no" | "pl" | "pt" | "ro" | "sk" | "sl" | "sv";
|
|
21
20
|
questionnaire: import("../../types").Questionnaire;
|
|
@@ -28,19 +27,18 @@ export declare const useTaxDocumentationContext: () => {
|
|
|
28
27
|
isBuildingW9: boolean;
|
|
29
28
|
isBuildingW8: boolean;
|
|
30
29
|
onPersistCollectedData: (newData: import("../../types").TaxDocumentation) => void;
|
|
31
|
-
onSubmitTaxDocumentation: (data: import("../../types").TaxDocumentation) => void
|
|
32
|
-
|
|
33
|
-
editTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
|
|
30
|
+
onSubmitTaxDocumentation: (data: import("../../types").TaxDocumentation) => Promise<void>;
|
|
31
|
+
editTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
|
|
34
32
|
onCancel: (() => void) | undefined;
|
|
35
|
-
getStepId: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
36
|
-
goTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
33
|
+
getStepId: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => import("../../types/StepId").StepId;
|
|
34
|
+
goTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
|
|
37
35
|
goBack: (() => void) | undefined;
|
|
38
36
|
goToNext: (data: import("../../types").TaxDocumentation) => void;
|
|
39
37
|
progress: import("../../types").Progress | undefined;
|
|
40
|
-
stepName: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
38
|
+
stepName: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
41
39
|
data: import("../../types").TaxDocumentation;
|
|
42
40
|
originalClientData: import("../../types").TaxDocumentation;
|
|
43
|
-
initialStep: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
41
|
+
initialStep: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
44
42
|
setLanguage: import("react").Dispatch<import("react").SetStateAction<"bg" | "cs" | "da" | "de" | "de-at" | "el" | "el-cy" | "en" | "en-gb" | "en-nz" | "en-us" | "es" | "et" | "fi" | "fr" | "fr-ca" | "fr-lu" | "ga" | "hr" | "hu" | "it" | "lt" | "lv" | "mt" | "nl" | "nl-be" | "no" | "pl" | "pt" | "ro" | "sk" | "sl" | "sv">>;
|
|
45
43
|
language: "bg" | "cs" | "da" | "de" | "de-at" | "el" | "el-cy" | "en" | "en-gb" | "en-nz" | "en-us" | "es" | "et" | "fi" | "fr" | "fr-ca" | "fr-lu" | "ga" | "hr" | "hu" | "it" | "lt" | "lv" | "mt" | "nl" | "nl-be" | "no" | "pl" | "pt" | "ro" | "sk" | "sl" | "sv";
|
|
46
44
|
questionnaire: import("../../types").Questionnaire;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
import { ClientTaxDocumentation } from '@taxbit/utilities';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Questionnaire } from '../../types';
|
|
3
|
+
import type { Locale, Questionnaire } from '../../types';
|
|
4
|
+
import { TaxbitQuestionnairePersistProps } from '../../widgets';
|
|
5
5
|
export type TaxbitQuestionnaireProps = {
|
|
6
|
+
data?: ClientTaxDocumentation;
|
|
7
|
+
language?: Locale;
|
|
6
8
|
questionnaire: Questionnaire;
|
|
7
|
-
|
|
9
|
+
onProgress?: TaxbitQuestionnairePersistProps['onProgress'];
|
|
10
|
+
onSubmit?: TaxbitQuestionnairePersistProps['onSubmit'];
|
|
11
|
+
} & ({
|
|
8
12
|
demoMode: true;
|
|
9
|
-
|
|
13
|
+
bearerToken?: never;
|
|
14
|
+
onSuccess?: never;
|
|
15
|
+
onSettled?: never;
|
|
16
|
+
onError?: never;
|
|
17
|
+
staging?: never;
|
|
18
|
+
} | {
|
|
10
19
|
demoMode?: false | undefined;
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
bearerToken: TaxbitQuestionnairePersistProps['bearerToken'];
|
|
21
|
+
onSuccess?: TaxbitQuestionnairePersistProps['onSuccess'];
|
|
22
|
+
onSettled?: TaxbitQuestionnairePersistProps['onSettled'];
|
|
23
|
+
onError?: TaxbitQuestionnairePersistProps['onError'];
|
|
24
|
+
staging?: TaxbitQuestionnairePersistProps['staging'];
|
|
25
|
+
});
|
|
26
|
+
export declare const TaxbitQuestionnaire: ({ questionnaire, data, onSubmit, onSuccess, onSettled, onError, language, onProgress, bearerToken, demoMode, staging, }: TaxbitQuestionnaireProps) => React.JSX.Element;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Questionnaire } from 'types';
|
|
2
|
-
|
|
2
|
+
type UseTaxbitProps = {
|
|
3
|
+
bearerToken: string;
|
|
4
|
+
questionnaire: Questionnaire;
|
|
5
|
+
staging?: boolean;
|
|
6
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare const useTaxbit: ({ bearerToken, questionnaire, staging, onError, }: UseTaxbitProps) => {
|
|
3
9
|
serverData: import("@taxbit/utilities").SignedClientTaxDocumentation | undefined;
|
|
4
10
|
statusData: import("../../entry").ClientTaxDocumentationStatus | undefined;
|
|
5
11
|
canGetDocumentUrl: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
generateDocumentUrl: () => void;
|
|
13
|
+
isGeneratingDocumentUrl: boolean;
|
|
8
14
|
documentUrl: string | undefined;
|
|
9
15
|
};
|
|
16
|
+
export {};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { SignedClientTaxDocumentation } from '@taxbit/utilities';
|
|
2
|
-
import { Questionnaire } from 'types';
|
|
3
|
-
import type { ClientTaxDocumentationStatus } from 'types/client';
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { Questionnaire } from '../../types';
|
|
3
|
+
import type { ClientTaxDocumentationStatus } from '../../types/client';
|
|
4
|
+
type UseTaxbitStatusProps = {
|
|
5
|
+
bearerToken?: string;
|
|
6
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
7
|
+
questionnaire: Questionnaire;
|
|
8
|
+
staging?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const useTaxbitStatus: ({ bearerToken, questionnaire, staging, onError, }: UseTaxbitStatusProps) => {
|
|
6
11
|
serverData: SignedClientTaxDocumentation | undefined;
|
|
7
12
|
statusData: ClientTaxDocumentationStatus | undefined;
|
|
13
|
+
isLoading: boolean;
|
|
8
14
|
};
|
|
15
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare const inputSteps: readonly ["AccountHolderClassification", "AccountHolderContact", "AccountHolderTax", "AccountHolderTaxClarification", "
|
|
1
|
+
declare const inputSteps: readonly ["AccountHolderClassification", "AccountHolderContact", "AccountHolderTax", "AccountHolderTaxClarification", "Exemptions", "RegardedOwnerContact", "RegardedOwnerTax", "Summary"];
|
|
2
2
|
export type InputStep = (typeof inputSteps)[number];
|
|
3
|
-
export declare const isInputStep: (step: string) => step is "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "
|
|
3
|
+
export declare const isInputStep: (step: string) => step is "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Exemptions" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary";
|
|
4
4
|
export declare const confirmInputStep: (step: string) => InputStep;
|
|
5
5
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const bearerTokenIsRequiredError: Error;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
export * from './bearerTokenIsRequiredError';
|
|
1
2
|
export * from './camelCaseKeys';
|
|
2
3
|
export * from './cx';
|
|
3
4
|
export * from './formatUsTin';
|
|
4
5
|
export * from './getFieldsState';
|
|
6
|
+
export * from './getFormStatus';
|
|
7
|
+
export * from './getHeaders';
|
|
5
8
|
export * from './getMaskedContent';
|
|
6
9
|
export * from './getMonthlyDayCount';
|
|
7
10
|
export * from './getPromptKeyMap';
|
|
11
|
+
export * from './handleFetch';
|
|
8
12
|
export * from './isBlank';
|
|
9
13
|
export * from './kebabCase';
|
|
10
14
|
export * from './mergeClientTaxDocumentationData';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UseTaxDocumentationProps } from 'contexts';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import type { UseTaxDocumentationProps } from '../../contexts';
|
|
3
3
|
import { UseTaxbitPersistProps } from './useTaxbitPersist';
|
|
4
|
-
export type TaxbitQuestionnairePersistProps =
|
|
4
|
+
export type TaxbitQuestionnairePersistProps = UseTaxDocumentationProps & UseTaxbitPersistProps;
|
|
5
5
|
export declare const TaxbitQuestionnairePersist: ({ staging, data, bearerToken, language, questionnaire, onProgress, onSubmit, onSettled, onSuccess, onError, }: TaxbitQuestionnairePersistProps) => React.JSX.Element;
|
|
File without changes
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { ClientTaxDocumentation, SignedClientTaxDocumentation } from '@taxbit/utilities';
|
|
2
2
|
import { Questionnaire } from 'types';
|
|
3
3
|
import { ExternalValidations } from 'types/client';
|
|
4
|
-
type TaxbitResponseError = {
|
|
5
|
-
message: string;
|
|
6
|
-
response: Response;
|
|
7
|
-
};
|
|
8
4
|
export type UseTaxbitPersistProps = {
|
|
9
5
|
data?: ClientTaxDocumentation;
|
|
10
6
|
staging?: boolean;
|
|
11
7
|
bearerToken: string;
|
|
12
|
-
questionnaire
|
|
13
|
-
onSuccess?: (data
|
|
14
|
-
onSettled?: (data
|
|
15
|
-
onError?: (error
|
|
16
|
-
onSubmit?: (data
|
|
8
|
+
questionnaire: Questionnaire;
|
|
9
|
+
onSuccess?: (data: ClientTaxDocumentation) => void | Promise<void>;
|
|
10
|
+
onSettled?: (data: ClientTaxDocumentation) => void | Promise<void>;
|
|
11
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
12
|
+
onSubmit?: (data: ClientTaxDocumentation) => void | Promise<void>;
|
|
17
13
|
};
|
|
18
14
|
export declare const useTaxbitPersist: ({ bearerToken, data, onSubmit, onSuccess, onSettled, onError, staging, questionnaire, }: UseTaxbitPersistProps) => {
|
|
19
15
|
handleOnSubmit: (data: SignedClientTaxDocumentation) => Promise<void>;
|
|
@@ -22,4 +18,3 @@ export declare const useTaxbitPersist: ({ bearerToken, data, onSubmit, onSuccess
|
|
|
22
18
|
isComplete: boolean;
|
|
23
19
|
isLoading: boolean;
|
|
24
20
|
};
|
|
25
|
-
export {};
|
|
@@ -2,7 +2,6 @@ export * from './AccountHolderClassification';
|
|
|
2
2
|
export * from './AccountHolderContact';
|
|
3
3
|
export * from './AccountHolderTax';
|
|
4
4
|
export * from './AccountHolderTaxClarification';
|
|
5
|
-
export * from './Confirmation';
|
|
6
5
|
export * from './Exemptions';
|
|
7
6
|
export * from './RegardedOwnerContact';
|
|
8
7
|
export * from './RegardedOwnerTax';
|