@taxbit/react-sdk 0.4.2 → 0.4.3
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/src/contexts/FormUI/useFormUI.d.ts +1 -0
- package/dist/src/contexts/FormUI/useFormUIContext.d.ts +2 -0
- package/dist/src/contexts/TaxDocumentation/TaxBitFormProvider.d.ts +3 -2
- package/dist/src/contexts/TaxDocumentation/useTaxDocumentation.d.ts +4 -2
- package/dist/src/contexts/TaxDocumentation/useTaxDocumentationContext.d.ts +2 -0
- package/dist/src/hooks/useTaxBit/useTaxBit.d.ts +0 -1
- package/dist/src/i18n/types/LocalizationKey.d.ts +1 -1
- package/dist/src/types/Progress.d.ts +2 -2
- package/dist/src/types/client/ClientTaxDocumentationStatus.d.ts +1 -0
- package/dist/src/types/client/ExternalValidations.d.ts +7 -0
- package/dist/src/types/client/index.d.ts +1 -0
- package/dist/src/types/server/TaxDocumentationStatus.d.ts +2 -1
- package/dist/src/validations/getInvalidFields.d.ts +2 -1
- package/dist/src/validations/invalidFieldRules.d.ts +2 -1
- package/dist/src/widgets/TaxBitForm/__tests__/TaxBitForm.complete.test.d.ts +0 -0
- package/dist/src/widgets/TaxBitForm/useTaxBitForm.d.ts +4 -3
- package/dist/src/wizard/TaxBitFormUI/TaxBitFormUI.d.ts +3 -2
- package/dist/taxbit-react-sdk.js +1180 -1113
- package/dist/taxbit-react-sdk.umd.cjs +10 -10
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ export declare const useFormUI: () => {
|
|
|
32
32
|
setValue: (key: TaxDocumentationKey, value: string | undefined) => void;
|
|
33
33
|
isErrorFree: boolean;
|
|
34
34
|
showErrors: boolean;
|
|
35
|
+
showErrorsForField: (key: TaxDocumentationKey) => boolean | undefined;
|
|
35
36
|
exposeErrors: () => void;
|
|
36
37
|
hideErrors: () => void;
|
|
37
38
|
getRequiredLocalPrompt: (key: TaxDocumentationKey) => string;
|
|
@@ -23,6 +23,7 @@ export declare const useFormUIContext: () => {
|
|
|
23
23
|
setValue: (key: keyof import("../../types").AccountHolderContactData | keyof import("../../types").AccountHolderTaxData | keyof import("../../types").AccountHolderClassificationData | keyof import("../../types").RegardedOwnerContactData | keyof import("../../types").RegardedOwnerClassificationData | keyof import("../../types").RegardedOwnerTaxData | keyof import("../../types").SummaryData | keyof import("../../types").CalculatedData, value: string | undefined) => void;
|
|
24
24
|
isErrorFree: boolean;
|
|
25
25
|
showErrors: boolean;
|
|
26
|
+
showErrorsForField: (key: keyof import("../../types").AccountHolderContactData | keyof import("../../types").AccountHolderTaxData | keyof import("../../types").AccountHolderClassificationData | keyof import("../../types").RegardedOwnerContactData | keyof import("../../types").RegardedOwnerClassificationData | keyof import("../../types").RegardedOwnerTaxData | keyof import("../../types").SummaryData | keyof import("../../types").CalculatedData) => boolean | undefined;
|
|
26
27
|
exposeErrors: () => void;
|
|
27
28
|
hideErrors: () => void;
|
|
28
29
|
getRequiredLocalPrompt: (key: keyof import("../../types").AccountHolderContactData | keyof import("../../types").AccountHolderTaxData | keyof import("../../types").AccountHolderClassificationData | keyof import("../../types").RegardedOwnerContactData | keyof import("../../types").RegardedOwnerClassificationData | keyof import("../../types").RegardedOwnerTaxData | keyof import("../../types").SummaryData | keyof import("../../types").CalculatedData) => string;
|
|
@@ -55,6 +56,7 @@ export declare const useFormUIContext: () => {
|
|
|
55
56
|
setValue: (key: keyof import("../../types").AccountHolderContactData | keyof import("../../types").AccountHolderTaxData | keyof import("../../types").AccountHolderClassificationData | keyof import("../../types").RegardedOwnerContactData | keyof import("../../types").RegardedOwnerClassificationData | keyof import("../../types").RegardedOwnerTaxData | keyof import("../../types").SummaryData | keyof import("../../types").CalculatedData, value: string | undefined) => void;
|
|
56
57
|
isErrorFree: boolean;
|
|
57
58
|
showErrors: boolean;
|
|
59
|
+
showErrorsForField: (key: keyof import("../../types").AccountHolderContactData | keyof import("../../types").AccountHolderTaxData | keyof import("../../types").AccountHolderClassificationData | keyof import("../../types").RegardedOwnerContactData | keyof import("../../types").RegardedOwnerClassificationData | keyof import("../../types").RegardedOwnerTaxData | keyof import("../../types").SummaryData | keyof import("../../types").CalculatedData) => boolean | undefined;
|
|
58
60
|
exposeErrors: () => void;
|
|
59
61
|
hideErrors: () => void;
|
|
60
62
|
getRequiredLocalPrompt: (key: keyof import("../../types").AccountHolderContactData | keyof import("../../types").AccountHolderTaxData | keyof import("../../types").AccountHolderClassificationData | keyof import("../../types").RegardedOwnerContactData | keyof import("../../types").RegardedOwnerClassificationData | keyof import("../../types").RegardedOwnerTaxData | keyof import("../../types").SummaryData | keyof import("../../types").CalculatedData) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { InputStep, Locale, Progress, TaxForm } from '../../types';
|
|
3
|
-
import { ClientTaxDocumentation } from '../../types/client';
|
|
3
|
+
import { ClientTaxDocumentation, ExternalValidations } from '../../types/client';
|
|
4
4
|
type TaxDocumentationProviderProps = {
|
|
5
5
|
data?: ClientTaxDocumentation;
|
|
6
6
|
onSubmit: (data: ClientTaxDocumentation) => void;
|
|
@@ -9,6 +9,7 @@ type TaxDocumentationProviderProps = {
|
|
|
9
9
|
taxForms?: TaxForm[];
|
|
10
10
|
step?: InputStep;
|
|
11
11
|
onProgress?: (progress: Progress) => void;
|
|
12
|
+
externalValidations?: ExternalValidations;
|
|
12
13
|
};
|
|
13
|
-
export declare const TaxBitFormProvider: ({ data, onSubmit, onProgress, language, taxForms, step, children, }: TaxDocumentationProviderProps) => React.JSX.Element;
|
|
14
|
+
export declare const TaxBitFormProvider: ({ data, externalValidations, onSubmit, onProgress, language, taxForms, step, children, }: TaxDocumentationProviderProps) => React.JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { InputStep, Locale, Progress, TaxDocumentation, TaxForm } from 'types';
|
|
3
3
|
import type { StepId } from 'types/StepId';
|
|
4
|
-
import { ClientTaxDocumentation } from 'types/client';
|
|
4
|
+
import { ClientTaxDocumentation, ExternalValidations } from 'types/client';
|
|
5
5
|
type UseTaxDocumentationProps = {
|
|
6
6
|
data: ClientTaxDocumentation;
|
|
7
7
|
language?: Locale;
|
|
8
|
+
externalValidations?: ExternalValidations;
|
|
8
9
|
onSubmit: (data: ClientTaxDocumentation) => void;
|
|
9
10
|
onProgress?: (progress: Progress) => void;
|
|
10
11
|
step?: InputStep;
|
|
11
12
|
taxForms?: TaxForm[];
|
|
12
13
|
};
|
|
13
|
-
export declare const useTaxDocumentation: ({ data:
|
|
14
|
+
export declare const useTaxDocumentation: ({ data: startingData, language: initialLanguage, externalValidations, onSubmit, onProgress, step: initialStep, taxForms: supportedForms, }: UseTaxDocumentationProps) => {
|
|
14
15
|
isW9: boolean;
|
|
15
16
|
isW8: boolean;
|
|
16
17
|
isW8Ben: boolean;
|
|
@@ -33,5 +34,6 @@ export declare const useTaxDocumentation: ({ data: initialData, language: initia
|
|
|
33
34
|
language: "bg-bg" | "cs-cz" | "da-dk" | "de-at" | "de-de" | "el-cy" | "el-gr" | "en-gb" | "en-us" | "es-es" | "et-ee" | "fi-fi" | "fr-fr" | "fr-lu" | "ga-ie" | "hr-hr" | "hu-hu" | "it-it" | "lt-lt" | "lv-lv" | "mt-mt" | "nl-be" | "nl-nl" | "no-no" | "pl-pl" | "pt-pt" | "ro-ro" | "sk-sk" | "sl-si" | "sv-se";
|
|
34
35
|
supportedForms: TaxForm[];
|
|
35
36
|
setSupportedForms: import("react").Dispatch<import("react").SetStateAction<TaxForm[]>>;
|
|
37
|
+
externalValidations: ExternalValidations | undefined;
|
|
36
38
|
};
|
|
37
39
|
export {};
|
|
@@ -22,6 +22,7 @@ export declare const useTaxDocumentationContext: () => {
|
|
|
22
22
|
language: "bg-bg" | "cs-cz" | "da-dk" | "de-at" | "de-de" | "el-cy" | "el-gr" | "en-gb" | "en-us" | "es-es" | "et-ee" | "fi-fi" | "fr-fr" | "fr-lu" | "ga-ie" | "hr-hr" | "hu-hu" | "it-it" | "lt-lt" | "lv-lv" | "mt-mt" | "nl-be" | "nl-nl" | "no-no" | "pl-pl" | "pt-pt" | "ro-ro" | "sk-sk" | "sl-si" | "sv-se";
|
|
23
23
|
supportedForms: import("../../types").TaxForm[];
|
|
24
24
|
setSupportedForms: import("react").Dispatch<import("react").SetStateAction<import("../../types").TaxForm[]>>;
|
|
25
|
+
externalValidations: import("../../entry").ExternalValidations | undefined;
|
|
25
26
|
}, TaxDocumentationContextProvider: import("react").Provider<{
|
|
26
27
|
isW9: boolean;
|
|
27
28
|
isW8: boolean;
|
|
@@ -45,4 +46,5 @@ export declare const useTaxDocumentationContext: () => {
|
|
|
45
46
|
language: "bg-bg" | "cs-cz" | "da-dk" | "de-at" | "de-de" | "el-cy" | "el-gr" | "en-gb" | "en-us" | "es-es" | "et-ee" | "fi-fi" | "fr-fr" | "fr-lu" | "ga-ie" | "hr-hr" | "hu-hu" | "it-it" | "lt-lt" | "lv-lv" | "mt-mt" | "nl-be" | "nl-nl" | "no-no" | "pl-pl" | "pt-pt" | "ro-ro" | "sk-sk" | "sl-si" | "sv-se";
|
|
46
47
|
supportedForms: import("../../types").TaxForm[];
|
|
47
48
|
setSupportedForms: import("react").Dispatch<import("react").SetStateAction<import("../../types").TaxForm[]>>;
|
|
49
|
+
externalValidations: import("../../entry").ExternalValidations | undefined;
|
|
48
50
|
} | undefined>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ClientTaxDocumentation, ClientTaxDocumentationStatus } from '../../types/client';
|
|
2
2
|
export declare const useTaxBit: (bearerToken: string, staging?: true) => {
|
|
3
3
|
postData: (data: ClientTaxDocumentation) => Promise<void>;
|
|
4
|
-
formStatus: "NOT_SUBMITTED" | "COMPLETE" | "INCOMPLETE" | undefined;
|
|
5
4
|
status: ClientTaxDocumentationStatus | undefined;
|
|
6
5
|
formSubmitted: boolean;
|
|
7
6
|
serverData: ClientTaxDocumentation | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ButtonKey = 'edit' | 'back' | 'next' | 'reset' | 'submit' | 'cancel' | 'hide' | 'show';
|
|
2
|
-
export type ErrorKey = 'required' | 'invalid' | 'invalidDate' | 'mustBeSixCharacters' | 'mustBeNineDigits' | 'mustBeFiveOrNineDigits' | 'mustMatchName' | 'mustBeInDateFormat' | 'mustBeValidBirthDate' | 'mustNotMatchVatin' | 'residencesMustIncludeVatCountry' | 'residencesMustIncludeAddressCountry' | 'residencesMustIncludeAnEUCountry';
|
|
2
|
+
export type ErrorKey = 'required' | 'invalid' | 'invalidDate' | 'invalidVat' | 'mustBeSixCharacters' | 'mustBeNineDigits' | 'mustBeFiveOrNineDigits' | 'mustMatchName' | 'mustBeInDateFormat' | 'mustBeValidBirthDate' | 'mustNotMatchVatin' | 'residencesMustIncludeVatCountry' | 'residencesMustIncludeAddressCountry' | 'residencesMustIncludeAnEUCountry';
|
|
3
3
|
export type OptionKey = 'usPerson_yes' | 'usPerson_no' | 'regardedOwnerUsPerson_yes' | 'regardedOwnerUsPerson_no' | 'isIndividual_yes' | 'isIndividual_no' | 'cCorporation' | 'centralBankOfIssue' | 'complexTrust' | 'corporation' | 'disregardedEntity' | 'estate' | 'foreignGovernmentControlledEntity' | 'foreignGovernmentIntegralPart' | 'grantorTrust' | 'individual' | 'internationalOrganization' | 'llc' | 'no' | 'other' | 'partnership' | 'privateFoundation' | 'sCorporation' | 'simpleTrust' | 'smllc' | 'soleProprietor' | 'taxExemptOrganization' | 'trust' | 'trustEstate' | 'yes';
|
|
4
4
|
export type PromptKey = 'addAdditional' | 'address' | 'businessRegistrationNumber' | 'businessRegistrationCountry' | 'city' | 'cityOfBirth' | 'country' | 'countryOfBirth' | 'countryOfCitizenship' | 'dateOfBirth' | 'day' | 'dbaName' | 'exemptPayeeCode' | 'exemptFatcaCode' | 'financialAccountIdentifier' | 'financialAccountName' | 'foreignAccountType' | 'foreignOtherClassification' | 'foreignTin' | 'foreignTinIsNotRequired' | 'foreignTrustClassification' | 'isEuResident' | 'isIndividual' | 'iAcknowlegeESignIsOk' | 'iAmACitizenOfTheUs' | 'iAmExemptFromFatcaReporting' | 'iAmNotSubjectToBackupWithholding' | 'iAuthorizeWithholdingAgent' | 'iCertifyToAll' | 'iConfirmIncomeIsNonUs' | 'iConfirmTheBeneficialOwnerIsExempt' | 'iConfirmTheInformationIsCorrectComplete' | 'iConfirmTheEntityIsNotAUsPerson' | 'iConfirmTheEntityIsTheBeneficialOwner' | 'iConfirmTheTaxIdIsCorrect' | 'iHaveLegalCapacityToSign' | 'mailingAddress' | 'mailingAddressIsDifferent' | 'month' | 'name' | 'nameOfEntity' | 'nameOfCCorporation' | 'nameOfCorporation' | 'nameOfIndividual' | 'nameOfLlc' | 'nameOfOrganization' | 'nameOfPartnership' | 'nameOfSCorporation' | 'nameOfSoleProprietor' | 'nameOfTrustEstate' | 'nameOfTrust' | 'province' | 'regardedOwnerUsPerson' | 'removeAdditional' | 'signature' | 'smllcElection' | 'state' | 'stateProvince' | 'street' | 'street2' | 'taxIdNumber' | 'taxIdNumberIsNotRequired' | 'tin' | 'usAccountType' | 'usLlcClassification' | 'usOtherClassification' | 'usPerson' | 'usEin' | 'usSsn' | 'usTin' | 'usTrustEstateEin' | 'vatIdentificationNumber' | 'vatIsNotRequired' | 'vatCountry' | 'year' | 'zip';
|
|
5
5
|
export type SubPromptKey = 'smllcElection' | 'iConfirmIncomeIsNonUs' | 'isEuResident' | 'isIndividual' | 'financialAccountIdentifier' | 'financialAccountName' | 'vatIdentificationNumber' | 'placeOfBirth';
|
|
@@ -3,6 +3,7 @@ export type ClientTaxDocumentationStatus = {
|
|
|
3
3
|
submissionStatus: 'SUBMITTED' | 'NOT_SUBMITTED';
|
|
4
4
|
DAC7Interview?: {
|
|
5
5
|
dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
|
|
6
|
+
vatStatus: 'PENDING' | 'VALID' | 'INVALID' | 'INSUFFICIENT_DATA' | 'NOT_REQUIRED';
|
|
6
7
|
expirationDate: string;
|
|
7
8
|
};
|
|
8
9
|
};
|
|
@@ -2,7 +2,8 @@ export type TaxDocumentationStatus = {
|
|
|
2
2
|
status: 'UNDOCUMENTED' | 'UNDETERMINED';
|
|
3
3
|
submission_status: 'SUBMITTED' | 'NOT_SUBMITTED';
|
|
4
4
|
DAC7_interview?: {
|
|
5
|
-
|
|
5
|
+
data_collection_status: 'COMPLETE' | 'INCOMPLETE';
|
|
6
|
+
vat_status: 'PENDING' | 'VALID' | 'INVALID' | 'INSUFFICIENT_DATA' | 'NOT_REQUIRED';
|
|
6
7
|
expiration_date: string;
|
|
7
8
|
};
|
|
8
9
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { TaxDocumentationErrorFile } from '../contexts';
|
|
2
2
|
import { TaxDocumentation } from '../types';
|
|
3
|
-
|
|
3
|
+
import { ExternalValidations } from '../types/client';
|
|
4
|
+
export declare const getInvalidFields: (fields: TaxDocumentation, externalValidations?: ExternalValidations) => TaxDocumentationErrorFile;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ErrorKey } from 'i18n/types';
|
|
2
2
|
import { TaxDocumentation, TaxDocumentationKey } from 'types/TaxDocumentation';
|
|
3
|
-
|
|
3
|
+
import { ExternalValidations } from '../types/client';
|
|
4
|
+
export type FormUIValidation = (fields: TaxDocumentation, externalValidations?: ExternalValidations) => ErrorKey[] | undefined;
|
|
4
5
|
export type FormUIValidations = {
|
|
5
6
|
[key in TaxDocumentationKey]?: FormUIValidation;
|
|
6
7
|
};
|
|
File without changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ClientTaxDocumentation } from '
|
|
2
|
-
import { TaxBitFormProps } from './TaxBitForm
|
|
1
|
+
import { ClientTaxDocumentation, ExternalValidations } from 'types/client';
|
|
2
|
+
import { TaxBitFormProps } from './TaxBitForm';
|
|
3
3
|
type UseTaxBitFormProps = Exclude<TaxBitFormProps, 'language'>;
|
|
4
4
|
export declare const useTaxBitForm: ({ bearerToken, data, onSubmit, onSuccess, staging, }: UseTaxBitFormProps) => {
|
|
5
5
|
handleOnSubmit: (data: ClientTaxDocumentation) => Promise<void>;
|
|
6
|
-
|
|
6
|
+
externalValidations: ExternalValidations;
|
|
7
|
+
formData: ClientTaxDocumentation;
|
|
7
8
|
isComplete: boolean;
|
|
8
9
|
isLoading: boolean;
|
|
9
10
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Locale, Progress, TaxForm } from '../../types';
|
|
3
|
-
import { ClientTaxDocumentation } from '../../types/client';
|
|
3
|
+
import { ClientTaxDocumentation, ExternalValidations } from '../../types/client';
|
|
4
4
|
export type TaxBitFormUIProps = {
|
|
5
5
|
data?: ClientTaxDocumentation;
|
|
6
6
|
onSubmit: (data: ClientTaxDocumentation) => void;
|
|
7
|
+
externalValidations?: ExternalValidations;
|
|
7
8
|
language?: Locale;
|
|
8
9
|
taxForms?: TaxForm[];
|
|
9
10
|
complete?: boolean;
|
|
10
11
|
onProgress?: (progress: Progress) => void;
|
|
11
12
|
};
|
|
12
|
-
export declare const TaxBitFormUI: ({ data, onSubmit, language, taxForms, complete, onProgress, }: TaxBitFormUIProps) => React.JSX.Element;
|
|
13
|
+
export declare const TaxBitFormUI: ({ data, onSubmit, language, taxForms, complete, onProgress, externalValidations, }: TaxBitFormUIProps) => React.JSX.Element;
|