@taxbit/react-sdk 1.0.0-beta.3 → 1.0.0-beta.4
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 +33 -4
- package/dist/src/contexts/TaxDocumentation/useTaxDocumentation.d.ts +1 -1
- package/dist/src/entry/TaxbitQuestionnaire/TaxbitQuestionnaire.d.ts +21 -7
- package/dist/src/hooks/useTaxbit/useTaxbitConnect.d.ts +1 -1
- package/dist/src/hooks/useTaxbit/useTaxbitStatus.d.ts +2 -2
- package/dist/src/widgets/TaxbitQuestionnairePersist/TaxbitQuestionnairePersist.d.ts +2 -2
- package/dist/src/widgets/TaxbitQuestionnairePersist/useTaxbitPersist.d.ts +3 -4
- package/dist/taxbit-react-sdk.js +38 -3
- package/dist/taxbit-react-sdk.umd.cjs +2 -2
- package/package.json +1 -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
|
+
getNewDocumentUrl,
|
|
130
|
+
isGettingDocumentUrl,
|
|
131
|
+
documentUrl,
|
|
132
|
+
} = useTaxbit(bearerToken, questionnaire);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
It can also be used to get the document URL for the user's tax documentation. The `getNewDocumentUrl` function will trigger a temporary URL generation. The `documentUrl` will be the URL of the document if it is available. `isGettingDocumentUrl` 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:
|
|
@@ -265,6 +290,10 @@ type QuestionnaireType = 'DPS' | 'W-FORM';
|
|
|
265
290
|
|
|
266
291
|
## Changelog
|
|
267
292
|
|
|
293
|
+
### Version 1.0.0-beta.4
|
|
294
|
+
|
|
295
|
+
1. More explicit typing for TaxbitQuestionnaire component props
|
|
296
|
+
|
|
268
297
|
### Version 1.0.0-beta.3
|
|
269
298
|
|
|
270
299
|
1. Transforming deprecated tax documentation data types for import to SDK
|
|
@@ -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;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import type { SignedClientTaxDocumentation } from '@taxbit/utilities';
|
|
2
2
|
import { Questionnaire } from 'types';
|
|
3
3
|
export declare const useTaxbitConnect: (bearerToken: string, questionnaire: Questionnaire, staging?: boolean) => {
|
|
4
|
-
doPostData: (data
|
|
4
|
+
doPostData: (data?: SignedClientTaxDocumentation) => Promise<Response>;
|
|
5
5
|
formStatus: "COMPLETE" | "INCOMPLETE" | undefined;
|
|
6
6
|
serverData: SignedClientTaxDocumentation | undefined;
|
|
7
7
|
statusData: import("../../entry").ClientTaxDocumentationStatus | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SignedClientTaxDocumentation } from '@taxbit/utilities';
|
|
2
|
-
import { Questionnaire } from 'types';
|
|
3
|
-
import type { ClientTaxDocumentationStatus } from 'types/client';
|
|
2
|
+
import { Questionnaire } from '../../types';
|
|
3
|
+
import type { ClientTaxDocumentationStatus } from '../../types/client';
|
|
4
4
|
export declare const useTaxbitStatus: (bearerToken: string, questionnaire: Questionnaire, staging?: boolean) => {
|
|
5
5
|
formStatus: "COMPLETE" | "INCOMPLETE" | undefined;
|
|
6
6
|
serverData: SignedClientTaxDocumentation | undefined;
|
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ClientTaxDocumentation
|
|
1
|
+
import { ClientTaxDocumentation } from '@taxbit/utilities';
|
|
2
2
|
import { Questionnaire } from 'types';
|
|
3
3
|
import { ExternalValidations } from 'types/client';
|
|
4
|
-
type TaxbitResponseError = {
|
|
4
|
+
export type TaxbitResponseError = {
|
|
5
5
|
message: string;
|
|
6
6
|
response: Response;
|
|
7
7
|
};
|
|
@@ -16,10 +16,9 @@ export type UseTaxbitPersistProps = {
|
|
|
16
16
|
onSubmit?: (data?: ClientTaxDocumentation) => void | Promise<void>;
|
|
17
17
|
};
|
|
18
18
|
export declare const useTaxbitPersist: ({ bearerToken, data, onSubmit, onSuccess, onSettled, onError, staging, questionnaire, }: UseTaxbitPersistProps) => {
|
|
19
|
-
handleOnSubmit: (data
|
|
19
|
+
handleOnSubmit: (data?: ClientTaxDocumentation) => Promise<void>;
|
|
20
20
|
externalValidations: ExternalValidations;
|
|
21
21
|
formData: ClientTaxDocumentation;
|
|
22
22
|
isComplete: boolean;
|
|
23
23
|
isLoading: boolean;
|
|
24
24
|
};
|
|
25
|
-
export {};
|
package/dist/taxbit-react-sdk.js
CHANGED
|
@@ -1882,7 +1882,7 @@ const Y = (e) => e === void 0 || e === "" || e === null, ie = (e) => !Y(e), Ne =
|
|
|
1882
1882
|
At(t)
|
|
1883
1883
|
]
|
|
1884
1884
|
)
|
|
1885
|
-
), Od = "1.0.0-beta.
|
|
1885
|
+
), Od = "1.0.0-beta.4", Pe = (e) => e === "yes", be = (e) => e === void 0 ? void 0 : e === "yes", Ad = (e) => {
|
|
1886
1886
|
const n = {
|
|
1887
1887
|
city: e.accountHolderAddressCity,
|
|
1888
1888
|
country: e.accountHolderAddressCountry,
|
|
@@ -8017,7 +8017,7 @@ A 2553 election is for an eligible entity to be treated as an S-Corporation for
|
|
|
8017
8017
|
y && o && o(y);
|
|
8018
8018
|
}, [o, y]);
|
|
8019
8019
|
const H = async (V) => {
|
|
8020
|
-
od(V), G(!0), await a(V), G(!1);
|
|
8020
|
+
od(V), a && (G(!0), await a(V), G(!1));
|
|
8021
8021
|
}, N = (V) => {
|
|
8022
8022
|
const Z = F(V);
|
|
8023
8023
|
E(V), H(Ed(V, c)).then(() => {
|
|
@@ -10529,7 +10529,42 @@ A 2553 election is for an eligible entity to be treated as an S-Corporation for
|
|
|
10529
10529
|
},
|
|
10530
10530
|
JSON.stringify(I) + e + a + o
|
|
10531
10531
|
);
|
|
10532
|
-
}, Wu = ({
|
|
10532
|
+
}, Wu = ({
|
|
10533
|
+
questionnaire: e,
|
|
10534
|
+
data: n,
|
|
10535
|
+
onSubmit: t,
|
|
10536
|
+
onSuccess: a,
|
|
10537
|
+
onSettled: o,
|
|
10538
|
+
onError: d,
|
|
10539
|
+
language: c,
|
|
10540
|
+
onProgress: u,
|
|
10541
|
+
bearerToken: l,
|
|
10542
|
+
demoMode: m,
|
|
10543
|
+
staging: f
|
|
10544
|
+
}) => m === !0 ? /* @__PURE__ */ i.jsx(
|
|
10545
|
+
qa,
|
|
10546
|
+
{
|
|
10547
|
+
questionnaire: e,
|
|
10548
|
+
data: n,
|
|
10549
|
+
onSubmit: t,
|
|
10550
|
+
onProgress: u,
|
|
10551
|
+
language: c
|
|
10552
|
+
}
|
|
10553
|
+
) : /* @__PURE__ */ i.jsx(
|
|
10554
|
+
Gu,
|
|
10555
|
+
{
|
|
10556
|
+
questionnaire: e,
|
|
10557
|
+
data: n,
|
|
10558
|
+
language: c,
|
|
10559
|
+
bearerToken: l,
|
|
10560
|
+
onSubmit: t,
|
|
10561
|
+
onProgress: u,
|
|
10562
|
+
onSuccess: a,
|
|
10563
|
+
onSettled: o,
|
|
10564
|
+
onError: d,
|
|
10565
|
+
staging: f
|
|
10566
|
+
}
|
|
10567
|
+
);
|
|
10533
10568
|
export {
|
|
10534
10569
|
Wu as TaxbitQuestionnaire,
|
|
10535
10570
|
$u as useTaxbit
|