@taxbit/react-sdk 2.3.0-beta.0 → 2.4.0-beta.0
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 +41 -26
- package/dist/src/contexts/TaxDocumentation/useTaxDocumentation.d.ts +3 -1
- package/dist/src/hooks/useTaxbit/useTaxbit.d.ts +10 -1
- package/dist/src/hooks/useTaxbit/useTaxbitStatus.d.ts +3 -1
- package/dist/src/hooks/useUsTinVerification/useUsTinValidation.d.ts +3 -1
- package/dist/src/services/api.d.ts +9 -6
- package/dist/src/services/msw.d.ts +1 -0
- package/dist/src/widgets/TaxbitQuestionnaire/TaxbitQuestionnaire.d.ts +21 -6
- package/dist/src/widgets/TaxbitQuestionnairePersist/TaxbitQuestionnairePersist.d.ts +1 -1
- package/dist/src/widgets/TaxbitQuestionnairePersist/useTaxbitPersist.d.ts +3 -1
- package/dist/taxbit-react-sdk.js +2675 -2586
- package/dist/taxbit-react-sdk.umd.cjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -130,6 +130,10 @@ If the `realTimeTinValidation` prop is set to `true`, the W-9 form will perform
|
|
|
130
130
|
|
|
131
131
|
The date format can be set to `mdy` (month-day-year), `dmy` (day-month-year), or `ymd` (year-month-day). The default is `mdy`.
|
|
132
132
|
|
|
133
|
+
### Region and Proxy Domain
|
|
134
|
+
|
|
135
|
+
The `region` prop can be set to either `US` or `EU` to determine which regional server the component will connect to. The default is `US`. The `proxyDomain` prop can be set to a custom domain to route requests through a proxy server. This is useful in environments where direct access to the Taxbit servers is restricted. If not provided, the component will connect directly to the Taxbit servers based on the selected region.
|
|
136
|
+
|
|
133
137
|
## useTaxbit Hook
|
|
134
138
|
|
|
135
139
|
The `useTaxbit` hook can be used to get the data from the server or the account status.
|
|
@@ -143,7 +147,14 @@ const {
|
|
|
143
147
|
generateDocumentUrl,
|
|
144
148
|
isGeneratingDocumentUrl,
|
|
145
149
|
documentUrl,
|
|
146
|
-
} = useTaxbit({
|
|
150
|
+
} = useTaxbit({
|
|
151
|
+
bearerToken,
|
|
152
|
+
questionnaire,
|
|
153
|
+
staging,
|
|
154
|
+
region,
|
|
155
|
+
proxyDomain,
|
|
156
|
+
onError,
|
|
157
|
+
});
|
|
147
158
|
```
|
|
148
159
|
|
|
149
160
|
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.
|
|
@@ -346,37 +357,41 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
346
357
|
|
|
347
358
|
## Changelog
|
|
348
359
|
|
|
360
|
+
### Version 2.4.0-beta.0
|
|
361
|
+
|
|
362
|
+
- Adding `region` and `proxyDomain` props to the TaxbitQuestionnaire component for US, EU regional support and proxy domain support.
|
|
363
|
+
|
|
349
364
|
### Version 2.3.0-beta.0
|
|
350
365
|
|
|
351
|
-
|
|
366
|
+
- Simplifying checkbox options on the Certification screen.
|
|
352
367
|
|
|
353
368
|
### Version 2.2.0-beta.2
|
|
354
369
|
|
|
355
|
-
|
|
370
|
+
- Bug fix, hiding email field for non-AU residents.
|
|
356
371
|
|
|
357
372
|
### Version 2.2.0-beta.1
|
|
358
373
|
|
|
359
|
-
|
|
374
|
+
- Updating TaxDocumentationStatus type to include issues and treatyClaimStatus.
|
|
360
375
|
|
|
361
376
|
### Version 2.2.0-beta.0
|
|
362
377
|
|
|
363
|
-
|
|
378
|
+
- Adding SERR support for Australian residents.
|
|
364
379
|
|
|
365
380
|
### Version 2.1.0-beta.0
|
|
366
381
|
|
|
367
|
-
|
|
382
|
+
- Adding Real-Time Tin Validation for W-9
|
|
368
383
|
|
|
369
384
|
### Version 2.0.0-beta.2
|
|
370
385
|
|
|
371
|
-
|
|
386
|
+
- Adding es-MX ISO option.
|
|
372
387
|
|
|
373
388
|
### Version 2.0.0-beta.1
|
|
374
389
|
|
|
375
|
-
|
|
390
|
+
- Fixed required fields for non-us Regarded Owner.
|
|
376
391
|
|
|
377
392
|
### Version 2.0.0-beta.0
|
|
378
393
|
|
|
379
|
-
|
|
394
|
+
- W-8IMY support added.
|
|
380
395
|
|
|
381
396
|
### Version 1.2.0-beta.8
|
|
382
397
|
|
|
@@ -385,23 +400,23 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
385
400
|
|
|
386
401
|
### Version 1.2.0-beta.7
|
|
387
402
|
|
|
388
|
-
|
|
403
|
+
- Verifying Mailing Address for W8-BEN-E, showing UsPerson selection on Summary screen.
|
|
389
404
|
|
|
390
405
|
### Version 1.2.0-beta.6
|
|
391
406
|
|
|
392
|
-
|
|
407
|
+
- Fixing Treaty Claim header showing erroneously on the Summary screen.
|
|
393
408
|
|
|
394
409
|
### Version 1.2.0-beta.4
|
|
395
410
|
|
|
396
|
-
|
|
411
|
+
- Passing investmentEntityManaged boolean to the server.
|
|
397
412
|
|
|
398
413
|
### Version 1.2.0-beta.2
|
|
399
414
|
|
|
400
|
-
|
|
415
|
+
- React 17 issue fixed with void return types in components.
|
|
401
416
|
|
|
402
417
|
### Version 1.2.0-beta.0
|
|
403
418
|
|
|
404
|
-
|
|
419
|
+
- Self-Certification support
|
|
405
420
|
|
|
406
421
|
### Version 1.1.0-beta.1
|
|
407
422
|
|
|
@@ -410,7 +425,7 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
410
425
|
|
|
411
426
|
### Version 1.1.0-beta.0
|
|
412
427
|
|
|
413
|
-
|
|
428
|
+
- Treaty Claims Support on W-Forms.
|
|
414
429
|
|
|
415
430
|
### Version 1.0.0-beta.8
|
|
416
431
|
|
|
@@ -434,7 +449,7 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
434
449
|
|
|
435
450
|
### Version 1.0.0-beta.4
|
|
436
451
|
|
|
437
|
-
|
|
452
|
+
- More explicit typing for TaxbitQuestionnaire component props
|
|
438
453
|
|
|
439
454
|
### Version 1.0.0-beta.3
|
|
440
455
|
|
|
@@ -443,11 +458,11 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
443
458
|
|
|
444
459
|
### Version 1.0.0-beta.2
|
|
445
460
|
|
|
446
|
-
|
|
461
|
+
- The ClientTaxDocumentation type is exposed in the `useTaxbit` hook.
|
|
447
462
|
|
|
448
463
|
### Version 1.0.0-beta.1
|
|
449
464
|
|
|
450
|
-
|
|
465
|
+
- Showing "\*" when required for Addresses on Summary
|
|
451
466
|
|
|
452
467
|
### Version 1.0.0-beta.0
|
|
453
468
|
|
|
@@ -457,7 +472,7 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
457
472
|
|
|
458
473
|
### Version 0.6.2
|
|
459
474
|
|
|
460
|
-
|
|
475
|
+
- Added this Changelog file
|
|
461
476
|
|
|
462
477
|
### Version 0.6.1
|
|
463
478
|
|
|
@@ -479,7 +494,7 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
479
494
|
|
|
480
495
|
### Version 0.4.4
|
|
481
496
|
|
|
482
|
-
|
|
497
|
+
- Handle blank bearer token. No error, but a warning is logged.
|
|
483
498
|
|
|
484
499
|
### Version 0.4.3
|
|
485
500
|
|
|
@@ -489,11 +504,11 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
489
504
|
|
|
490
505
|
### Version 0.4.2
|
|
491
506
|
|
|
492
|
-
|
|
507
|
+
- Added stepIndex and steps fields to the Progress object. stepId is now typed to potential enum values.
|
|
493
508
|
|
|
494
509
|
### Version 0.4.1
|
|
495
510
|
|
|
496
|
-
|
|
511
|
+
- Bug fix for onProgress callback not being triggered from the TaxBitDAC7Form component.
|
|
497
512
|
|
|
498
513
|
### Version 0.4.0
|
|
499
514
|
|
|
@@ -507,19 +522,19 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
|
|
|
507
522
|
|
|
508
523
|
### Version 0.2.4
|
|
509
524
|
|
|
510
|
-
|
|
525
|
+
- Bug fix for naming of CommonJS module exports.
|
|
511
526
|
|
|
512
527
|
### Version 0.2.3
|
|
513
528
|
|
|
514
|
-
|
|
529
|
+
- Bug fix for the ClientTaxDocumentationStatus type not being accessible externally.
|
|
515
530
|
|
|
516
531
|
### Version 0.2.2
|
|
517
532
|
|
|
518
|
-
|
|
533
|
+
- onSubmit and onSuccess callbacks are invoked with a parameter of type ClientTaxDocumentation which is now exposed.
|
|
519
534
|
|
|
520
535
|
### Version 0.2.1
|
|
521
536
|
|
|
522
|
-
|
|
537
|
+
- The SDK now supports React versions 16, 17, 18 and TypeScript versions 4 and 5.
|
|
523
538
|
|
|
524
539
|
### Version 0.2.0
|
|
525
540
|
|
|
@@ -20,8 +20,10 @@ export type UseTaxDocumentationProps = {
|
|
|
20
20
|
realTimeTinValidation?: boolean;
|
|
21
21
|
staging?: boolean;
|
|
22
22
|
bearerToken?: string;
|
|
23
|
+
region?: 'US' | 'EU' | string;
|
|
24
|
+
proxyDomain?: string;
|
|
23
25
|
};
|
|
24
|
-
export declare const useTaxDocumentation: ({ data: startingData, language: initialLanguage, externalValidations, onSubmit, onProgress, step: initialStep, questionnaire, config, treatyClaims, dateFormat, realTimeTinValidation, staging, bearerToken, }: UseTaxDocumentationProps) => {
|
|
26
|
+
export declare const useTaxDocumentation: ({ data: startingData, language: initialLanguage, externalValidations, onSubmit, onProgress, step: initialStep, questionnaire, config, treatyClaims, dateFormat, realTimeTinValidation, staging, bearerToken, region, proxyDomain, }: UseTaxDocumentationProps) => {
|
|
25
27
|
config: InterviewConfig | undefined;
|
|
26
28
|
data: TaxDocumentation;
|
|
27
29
|
dateFormat: DateFormatConfig;
|
|
@@ -5,8 +5,17 @@ type UseTaxbitProps = {
|
|
|
5
5
|
questionnaire: QuestionnaireProp;
|
|
6
6
|
staging?: boolean;
|
|
7
7
|
onError?: (error: Error) => void | Promise<void>;
|
|
8
|
+
region?: 'US' | 'EU' | string;
|
|
9
|
+
proxyDomain?: never;
|
|
10
|
+
} | {
|
|
11
|
+
bearerToken: string;
|
|
12
|
+
questionnaire: QuestionnaireProp;
|
|
13
|
+
staging?: never;
|
|
14
|
+
region?: never;
|
|
15
|
+
proxyDomain?: string;
|
|
16
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
8
17
|
};
|
|
9
|
-
export declare const useTaxbit: ({ bearerToken, questionnaire, staging, onError, }: UseTaxbitProps) => {
|
|
18
|
+
export declare const useTaxbit: ({ bearerToken, questionnaire, staging, onError, region, proxyDomain, }: UseTaxbitProps) => {
|
|
10
19
|
serverData: import('@taxbit/utilities').SignedClientTaxDocumentation | undefined;
|
|
11
20
|
statusData: import('../..').ClientTaxDocumentationStatus | undefined;
|
|
12
21
|
canGetDocumentUrl: boolean;
|
|
@@ -7,8 +7,10 @@ type UseTaxbitStatusProps = {
|
|
|
7
7
|
onError?: (error: Error) => void | Promise<void>;
|
|
8
8
|
questionnaire: QuestionnaireProp;
|
|
9
9
|
staging?: boolean;
|
|
10
|
+
region?: 'US' | 'EU' | string;
|
|
11
|
+
proxyDomain?: string;
|
|
10
12
|
};
|
|
11
|
-
export declare const useTaxbitStatus: ({ bearerToken, questionnaire, staging, onError, }: UseTaxbitStatusProps) => {
|
|
13
|
+
export declare const useTaxbitStatus: ({ bearerToken, questionnaire, staging, onError, region, proxyDomain, }: UseTaxbitStatusProps) => {
|
|
12
14
|
serverData: SignedClientTaxDocumentation | undefined;
|
|
13
15
|
statusData: ClientTaxDocumentationStatus | undefined;
|
|
14
16
|
isLoading: boolean;
|
|
@@ -11,8 +11,10 @@ type UseUsTinValidationProps = {
|
|
|
11
11
|
bearerToken?: string;
|
|
12
12
|
isEnabled?: boolean;
|
|
13
13
|
staging?: boolean;
|
|
14
|
+
region?: 'US' | 'EU' | string;
|
|
15
|
+
proxyDomain?: string;
|
|
14
16
|
};
|
|
15
|
-
export declare const useUsTinValidation: ({ bearerToken, isEnabled, staging, }: UseUsTinValidationProps) => {
|
|
17
|
+
export declare const useUsTinValidation: ({ bearerToken, isEnabled, staging, region, proxyDomain, }: UseUsTinValidationProps) => {
|
|
16
18
|
doValidateUsTin: (name: string, usTin: string) => Promise<void>;
|
|
17
19
|
isValidatingUsTin: boolean;
|
|
18
20
|
usTinValidations: UsTinValidationAttempt[];
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { QuestionnaireProp } from 'types';
|
|
2
2
|
|
|
3
|
+
type Environment = 'PRODUCTION' | 'STAGING';
|
|
4
|
+
type Region = 'US' | 'EU' | string;
|
|
3
5
|
export declare const TAX_DOCUMENTATION_SUBMISSIONS_PATH = "tax-documentation/submissions";
|
|
4
6
|
export declare const TAX_DOCUMENTATION_STATUS_PATH = "tax-documentation-status";
|
|
5
7
|
export declare const TAX_DOCUMENT_PATH = "tax-documentation/document";
|
|
6
8
|
export declare const US_TIN_VALIDATION_PATH = "embedded-validations/us-tin";
|
|
7
9
|
export declare const api: {
|
|
8
10
|
taxDocumentationSubmissions: {
|
|
9
|
-
post: (environment:
|
|
10
|
-
get: (environment:
|
|
11
|
+
post: (environment: Environment, region: Region | undefined, proxyDomain: string | undefined) => string;
|
|
12
|
+
get: (environment: Environment, questionnaire: QuestionnaireProp, region: Region | undefined, proxyDomain: string | undefined) => string;
|
|
11
13
|
};
|
|
12
14
|
taxDocumentationStatus: {
|
|
13
|
-
get: (environment:
|
|
15
|
+
get: (environment: Environment, region: Region | undefined, proxyDomain: string | undefined) => string;
|
|
14
16
|
};
|
|
15
17
|
taxDocument: {
|
|
16
|
-
post: (environment:
|
|
17
|
-
get: (documentId: string, environment:
|
|
18
|
+
post: (environment: Environment, region: Region | undefined, proxyDomain: string | undefined) => string;
|
|
19
|
+
get: (documentId: string, environment: Environment, region?: Region, proxyDomain?: string) => string;
|
|
18
20
|
};
|
|
19
21
|
usTinValidation: {
|
|
20
|
-
post: (environment:
|
|
22
|
+
post: (environment: Environment, region: Region | undefined, proxyDomain: string | undefined) => string;
|
|
21
23
|
};
|
|
22
24
|
};
|
|
25
|
+
export {};
|
|
@@ -17,6 +17,7 @@ export declare const mockApi: {
|
|
|
17
17
|
get: {
|
|
18
18
|
success: (options?: ResponseOptions) => import('msw').HttpHandler;
|
|
19
19
|
unauthorized: (options?: ResponseOptions) => import('msw').HttpHandler;
|
|
20
|
+
forbidden: (options?: ResponseOptions) => import('msw').HttpHandler;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
taxDocument: {
|
|
@@ -3,7 +3,7 @@ import { default as React } from 'react';
|
|
|
3
3
|
import { Locale, QuestionnaireProp } from '../../types';
|
|
4
4
|
import { TaxbitQuestionnairePersistProps } from '../TaxbitQuestionnairePersist';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type BaseProps = {
|
|
7
7
|
data?: ClientTaxDocumentation;
|
|
8
8
|
language?: Locale;
|
|
9
9
|
questionnaire: QuestionnaireProp;
|
|
@@ -12,7 +12,8 @@ export type TaxbitQuestionnaireProps = {
|
|
|
12
12
|
onSubmit?: TaxbitQuestionnairePersistProps['onSubmit'];
|
|
13
13
|
dateFormat?: TaxbitQuestionnairePersistProps['dateFormat'];
|
|
14
14
|
realTimeTinValidation?: TaxbitQuestionnairePersistProps['realTimeTinValidation'];
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
type DemoProps = {
|
|
16
17
|
demoMode: true;
|
|
17
18
|
bearerToken?: never;
|
|
18
19
|
onError?: never;
|
|
@@ -20,13 +21,27 @@ export type TaxbitQuestionnaireProps = {
|
|
|
20
21
|
onSettled?: never;
|
|
21
22
|
onSuccess?: never;
|
|
22
23
|
staging?: never;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
region?: never;
|
|
25
|
+
proxyDomain?: never;
|
|
26
|
+
};
|
|
27
|
+
type AuthenticatedBase = {
|
|
28
|
+
demoMode?: false;
|
|
25
29
|
bearerToken: TaxbitQuestionnairePersistProps['bearerToken'];
|
|
26
30
|
onError?: TaxbitQuestionnairePersistProps['onError'];
|
|
27
31
|
loadingComponent?: TaxbitQuestionnairePersistProps['loadingComponent'];
|
|
28
32
|
onSettled?: TaxbitQuestionnairePersistProps['onSettled'];
|
|
29
33
|
onSuccess?: TaxbitQuestionnairePersistProps['onSuccess'];
|
|
34
|
+
};
|
|
35
|
+
type RegionMode = {
|
|
36
|
+
region?: TaxbitQuestionnairePersistProps['region'];
|
|
37
|
+
proxyDomain?: never;
|
|
30
38
|
staging?: TaxbitQuestionnairePersistProps['staging'];
|
|
31
|
-
}
|
|
32
|
-
|
|
39
|
+
};
|
|
40
|
+
type ProxyMode = {
|
|
41
|
+
proxyDomain: TaxbitQuestionnairePersistProps['proxyDomain'];
|
|
42
|
+
region?: never;
|
|
43
|
+
staging?: never;
|
|
44
|
+
};
|
|
45
|
+
export type TaxbitQuestionnaireProps = (BaseProps & DemoProps) | (BaseProps & AuthenticatedBase & RegionMode) | (BaseProps & AuthenticatedBase & ProxyMode);
|
|
46
|
+
export declare const TaxbitQuestionnaire: ({ bearerToken, data, demoMode, language, onError, loadingComponent, onProgress, onSettled, onSubmit, onSuccess, questionnaire, staging, treatyClaims, dateFormat, realTimeTinValidation, region, proxyDomain, }: TaxbitQuestionnaireProps) => React.JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -6,4 +6,4 @@ export type TaxbitQuestionnairePersistProps = UseTaxDocumentationProps & UseTaxb
|
|
|
6
6
|
loadingComponent?: React.ReactNode;
|
|
7
7
|
treatyClaims?: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const TaxbitQuestionnairePersist: ({ staging, data, bearerToken, language, questionnaire, loadingComponent, onProgress, onSubmit, onSettled, onSuccess, onError, treatyClaims, dateFormat, realTimeTinValidation, }: TaxbitQuestionnairePersistProps) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element;
|
|
9
|
+
export declare const TaxbitQuestionnairePersist: ({ staging, data, bearerToken, language, questionnaire, loadingComponent, onProgress, onSubmit, onSettled, onSuccess, onError, treatyClaims, dateFormat, realTimeTinValidation, region, proxyDomain, }: TaxbitQuestionnairePersistProps) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element;
|
|
@@ -11,8 +11,10 @@ export type UseTaxbitPersistProps = {
|
|
|
11
11
|
onSettled?: (data: ClientTaxDocumentation) => void | Promise<void>;
|
|
12
12
|
onError?: (error: Error) => void | Promise<void>;
|
|
13
13
|
onSubmit?: (data: ClientTaxDocumentation) => void | Promise<void>;
|
|
14
|
+
region?: 'US' | 'EU' | string;
|
|
15
|
+
proxyDomain?: string;
|
|
14
16
|
};
|
|
15
|
-
export declare const useTaxbitPersist: ({ bearerToken, data, onError, onSettled, onSubmit, onSuccess, questionnaire, staging, }: UseTaxbitPersistProps) => {
|
|
17
|
+
export declare const useTaxbitPersist: ({ bearerToken, data, onError, onSettled, onSubmit, onSuccess, questionnaire, staging, region, proxyDomain, }: UseTaxbitPersistProps) => {
|
|
16
18
|
handleOnSubmit: (data: SignedClientTaxDocumentation) => Promise<void>;
|
|
17
19
|
externalValidations: ExternalValidations;
|
|
18
20
|
formData: ClientTaxDocumentation;
|