@taxbit/react-sdk 0.2.0 → 0.2.2

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.
Files changed (30) hide show
  1. package/dist/contexts/FormUI/index.d.ts +2 -1
  2. package/dist/contexts/TaxDocumentation/TaxBitFormProvider.d.ts +2 -2
  3. package/dist/contexts/TaxDocumentation/useTaxDocumentation.d.ts +3 -4
  4. package/dist/contexts/TaxDocumentation/useTaxDocumentationContext.d.ts +2 -188
  5. package/dist/entry/index.d.ts +3 -2
  6. package/dist/hooks/useTaxBit/useTaxBit.d.ts +5 -105
  7. package/dist/taxbit-react-sdk.es.js +19188 -19374
  8. package/dist/taxbit-react-sdk.umd.js +10 -10
  9. package/dist/types/CamelCaseKeys.d.ts +7 -0
  10. package/dist/types/CountryCode.d.ts +3 -3
  11. package/dist/types/TaxDocumentation.d.ts +2 -2
  12. package/dist/types/Utilities.d.ts +2 -0
  13. package/dist/types/client/ClientTaxDocumentation.d.ts +79 -0
  14. package/dist/types/client/ClientTaxDocumentationStatus.d.ts +9 -0
  15. package/dist/types/client/index.d.ts +2 -6
  16. package/dist/types/index.d.ts +12 -11
  17. package/dist/types/server/ComprehensiveTaxDocumentation.d.ts +5 -2
  18. package/dist/utils/camelCaseKeys.d.ts +1 -0
  19. package/dist/utils/index.d.ts +3 -0
  20. package/dist/utils/snakeCaseKeys.d.ts +1 -0
  21. package/dist/utils/transformForClient/index.d.ts +1 -0
  22. package/dist/utils/transformForClient/transformForClient.d.ts +3 -0
  23. package/dist/utils/transformInbound/getLLCClassification.d.ts +1 -1
  24. package/dist/utils/transformOutbound/transformOutbound.d.ts +2 -2
  25. package/dist/validations/getRequiredFields.d.ts +1 -1
  26. package/dist/widgets/TaxBitForm/TaxBitForm.d.ts +3 -3
  27. package/dist/wizard/RowInput/VisibleRow/VisibleRow.d.ts +1 -1
  28. package/dist/wizard/TaxBitFormUI/TaxBitDAC7FormUI.d.ts +1 -1
  29. package/dist/wizard/TaxBitFormUI/TaxBitFormUI.d.ts +2 -2
  30. package/package.json +6 -10
@@ -0,0 +1,7 @@
1
+ type CamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<CamelCase<U>>}` : S;
2
+ export type CamelCaseKeys<T> = T extends object ? T extends (infer U)[] ? U extends object ? {
3
+ [K in keyof U as CamelCase<K & string>]: CamelCaseKeys<U[K]>;
4
+ }[] : T : {
5
+ [K in keyof T as CamelCase<K & string>]: CamelCaseKeys<T[K]>;
6
+ } : T;
7
+ export {};
@@ -1,3 +1,3 @@
1
- import { type Extends } from "./Utilities";
2
- export type CountryCode = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
3
- export type EUCountryCode = Extends<CountryCode, "AT" | "BE" | "BG" | "CY" | "CZ" | "DE" | "DK" | "EE" | "ES" | "FI" | "FR" | "GR" | "HR" | "HU" | "IE" | "IT" | "LT" | "LU" | "LV" | "MT" | "NL" | "PL" | "PT" | "RO" | "SE" | "SI" | "SK">;
1
+ import type { Extends } from './Utilities';
2
+ export type CountryCode = 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW';
3
+ export type EUCountryCode = Extends<CountryCode, 'AT' | 'BE' | 'BG' | 'CY' | 'CZ' | 'DE' | 'DK' | 'EE' | 'ES' | 'FI' | 'FR' | 'GR' | 'HR' | 'HU' | 'IE' | 'IT' | 'LT' | 'LU' | 'LV' | 'MT' | 'NL' | 'PL' | 'PT' | 'RO' | 'SE' | 'SI' | 'SK'>;
@@ -1,6 +1,6 @@
1
1
  import type { ForeignAccountType, ForeignOtherAccountType, ForeignTrustAccountType, UsAccountType, UsLlcAccountType } from './AccountType';
2
- import { type Yes } from './Yes';
3
- import { type YesNo } from './YesNo';
2
+ import type { Yes } from './Yes';
3
+ import type { YesNo } from './YesNo';
4
4
  export type AccountHolderClassificationData = {
5
5
  accountHolderIsIndividual?: YesNo;
6
6
  accountHolderIsEuResident?: YesNo;
@@ -2,3 +2,5 @@ export type Requiredish<T> = {
2
2
  [K in keyof Required<T>]: T[K];
3
3
  };
4
4
  export type Extends<T, U extends T> = U;
5
+ export type IsExact<T, U> = [T] extends [U] ? [U] extends [T] ? true : false : false;
6
+ export declare function assertExactType<T extends true>(_expectTrue: T): void;
@@ -0,0 +1,79 @@
1
+ export type Address = {
2
+ city?: string;
3
+ country?: string;
4
+ stateOrProvince?: string;
5
+ firstLine?: string;
6
+ secondLine?: string;
7
+ postalCode?: string;
8
+ };
9
+ export type AccountHolderTaxDocumentation = {
10
+ address?: Address;
11
+ countryOfCitizenship?: string;
12
+ dateOfBirth?: string;
13
+ dbaName?: string;
14
+ mailingAddress?: Address;
15
+ mailingAddressIsDifferent?: boolean;
16
+ name?: string;
17
+ cityOfBirth?: string;
18
+ countryOfBirth?: string;
19
+ financialAccountIdentifier?: string;
20
+ financialAccountName?: string;
21
+ ftin?: string;
22
+ ftinNotLegallyRequired?: boolean;
23
+ taxResidences?: Array<{
24
+ country?: string;
25
+ tin?: string;
26
+ tinNotRequired?: boolean;
27
+ }>;
28
+ tin?: string;
29
+ vatin?: string;
30
+ vatinCountry?: string;
31
+ vatinNotRequired?: boolean;
32
+ exemptFatcaCode?: string;
33
+ exemptPayeeCode?: string;
34
+ isIndividual?: boolean;
35
+ isEuResident?: boolean;
36
+ isUsPerson?: boolean;
37
+ usAccountType?: string;
38
+ usSmllcElection?: boolean;
39
+ usLlcClassification?: string;
40
+ usOtherClassification?: string;
41
+ usTrustEstateEin?: boolean;
42
+ foreignAccountType?: string;
43
+ foreignTrustClassification?: string;
44
+ foreignOtherClassification?: string;
45
+ };
46
+ export type RegardedOwnerTaxDocumentation = {
47
+ address?: Address;
48
+ countryOfCitizenship?: string;
49
+ dateOfBirth?: string;
50
+ dbaName?: string;
51
+ mailingAddress?: Address;
52
+ mailingAddressIsDifferent?: boolean;
53
+ name?: string;
54
+ ftin?: string;
55
+ ftinNotLegallyRequired?: boolean;
56
+ tin?: string;
57
+ exemptFatcaCode?: string;
58
+ exemptPayeeCode?: string;
59
+ isUsPerson?: boolean;
60
+ usAccountType?: string;
61
+ usLlcClassification?: string;
62
+ usOtherClassification?: string;
63
+ usTrustEstateEin?: boolean;
64
+ foreignAccountType?: string;
65
+ foreignTrustClassification?: string;
66
+ foreignOtherClassification?: string;
67
+ };
68
+ export type ClientTaxDocumentation = {
69
+ accountHolder?: AccountHolderTaxDocumentation;
70
+ } & {
71
+ regardedOwner?: RegardedOwnerTaxDocumentation;
72
+ } & {
73
+ hasCertified?: boolean;
74
+ isNotSubjectBackupWithholding?: boolean;
75
+ signature?: string;
76
+ documentType?: 'COMPREHENSIVE';
77
+ source?: string;
78
+ signatureTimestamp?: string;
79
+ };
@@ -0,0 +1,9 @@
1
+ import { ComprehensiveFormStatusEnum, ComprehensiveStatusEnum } from '../server';
2
+ export type ClientTaxDocumentationStatus = {
3
+ status: ComprehensiveStatusEnum.Undocumented | ComprehensiveStatusEnum.Undetermined;
4
+ submissionStatus: ComprehensiveStatusEnum.Submitted | ComprehensiveStatusEnum.NotSubmitted;
5
+ DAC7Interview?: {
6
+ dataCollectionStatus: ComprehensiveFormStatusEnum.Complete | ComprehensiveFormStatusEnum.Incomplete;
7
+ expirationDate: string;
8
+ };
9
+ };
@@ -1,6 +1,2 @@
1
- import { CamelCasedPropertiesDeep } from 'type-fest';
2
- import { SignedComprehensiveTaxDocumentation, TaxDocumentationStatus } from '../server';
3
- export type ClientTaxDocumentation = CamelCasedPropertiesDeep<SignedComprehensiveTaxDocumentation>;
4
- export type ClientTaxDocumentationStatus = CamelCasedPropertiesDeep<TaxDocumentationStatus, {
5
- preserveConsecutiveUppercase: false;
6
- }>;
1
+ export type { ClientTaxDocumentation } from './ClientTaxDocumentation';
2
+ export type { ClientTaxDocumentationStatus } from './ClientTaxDocumentationStatus';
@@ -1,11 +1,12 @@
1
- export * from "./AccountType";
2
- export * from "./CaProvinceCode";
3
- export * from "./CountryCode";
4
- export * from "./Locale";
5
- export * from "./MonthCode";
6
- export * from "./TaxForm";
7
- export * from "./TaxDocumentation";
8
- export * from "./UsStateCode";
9
- export * from "./Utilities";
10
- export * from "./Yes";
11
- export * from "./YesNo";
1
+ export * from './AccountType';
2
+ export * from './CaProvinceCode';
3
+ export * from './CamelCaseKeys';
4
+ export * from './CountryCode';
5
+ export * from './Locale';
6
+ export * from './MonthCode';
7
+ export * from './TaxDocumentation';
8
+ export * from './TaxForm';
9
+ export * from './UsStateCode';
10
+ export * from './Utilities';
11
+ export * from './Yes';
12
+ export * from './YesNo';
@@ -20,11 +20,11 @@ export type AccountHolderTaxDocumentation = {
20
20
  financial_account_name?: string;
21
21
  ftin?: string;
22
22
  ftin_not_legally_required?: boolean;
23
- tax_residences?: {
23
+ tax_residences?: Array<{
24
24
  country?: string;
25
25
  tin?: string;
26
26
  tin_not_required?: boolean;
27
- }[];
27
+ }>;
28
28
  tin?: string;
29
29
  vatin?: string;
30
30
  vatin_country?: string;
@@ -76,3 +76,6 @@ export type SignedComprehensiveTaxDocumentation = {
76
76
  document_type?: 'COMPREHENSIVE';
77
77
  source?: string;
78
78
  };
79
+ export type SignedDatedComprehensiveTaxDocumentation = SignedComprehensiveTaxDocumentation & {
80
+ signature_timestamp?: string;
81
+ };
@@ -0,0 +1 @@
1
+ export declare const camelCaseKeys: (item: unknown) => unknown;
@@ -1,3 +1,4 @@
1
+ export * from './camelCaseKeys';
1
2
  export * from './cx';
2
3
  export * from './date';
3
4
  export * from './getFieldsState';
@@ -6,5 +7,7 @@ export * from './getMonthlyDayCount';
6
7
  export * from './getPromptKeyMap';
7
8
  export * from './isBlank';
8
9
  export * from './kebabCase';
10
+ export * from './snakeCaseKeys';
11
+ export * from './transformForClient';
9
12
  export * from './transformInbound';
10
13
  export * from './transformOutbound';
@@ -0,0 +1 @@
1
+ export declare const snakeCaseKeys: (item: unknown) => unknown;
@@ -0,0 +1 @@
1
+ export * from './transformForClient.ts';
@@ -0,0 +1,3 @@
1
+ import { TaxDocumentation } from '../../types';
2
+ import { ClientTaxDocumentation } from '../../types/client';
3
+ export declare const transformForClient: (data: TaxDocumentation) => ClientTaxDocumentation;
@@ -1,2 +1,2 @@
1
- import { type UsLLCAccountType } from 'lookups';
1
+ import type { UsLLCAccountType } from 'lookups';
2
2
  export declare const getLLCClassification: (accountType: string | undefined) => UsLLCAccountType | undefined;
@@ -1,3 +1,3 @@
1
1
  import { TaxDocumentation } from '../../types';
2
- import { SignedComprehensiveTaxDocumentation } from '../../types/server';
3
- export declare const transformOutbound: (data: TaxDocumentation) => SignedComprehensiveTaxDocumentation;
2
+ import { SignedDatedComprehensiveTaxDocumentation } from '../../types/server';
3
+ export declare const transformOutbound: (data: TaxDocumentation) => SignedDatedComprehensiveTaxDocumentation;
@@ -1,3 +1,3 @@
1
- import { type TaxDocumentationPropertyFile } from '../contexts';
1
+ import type { TaxDocumentationPropertyFile } from '../contexts';
2
2
  import { TaxDocumentation } from '../types';
3
3
  export declare const getRequiredFields: (fields: TaxDocumentation, visibleFields: TaxDocumentationPropertyFile) => TaxDocumentationPropertyFile;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Locale, TaxDocumentation, TaxForm } from 'types';
2
+ import { Locale, TaxForm } from 'types';
3
3
  import { ClientTaxDocumentation } from 'types/client';
4
4
  export type TaxBitFormProps = {
5
5
  data?: ClientTaxDocumentation;
@@ -7,7 +7,7 @@ export type TaxBitFormProps = {
7
7
  bearerToken: string;
8
8
  language?: Locale;
9
9
  taxForms?: TaxForm[];
10
- onSubmit?: (data?: TaxDocumentation) => void;
11
- onSuccess?: (data?: TaxDocumentation) => void;
10
+ onSubmit?: (data?: ClientTaxDocumentation) => void;
11
+ onSuccess?: (data?: ClientTaxDocumentation) => void;
12
12
  };
13
13
  export declare const TaxBitForm: ({ staging, data, bearerToken, language, taxForms, onSubmit, onSuccess, }: TaxBitFormProps) => React.JSX.Element;
@@ -7,4 +7,4 @@ export declare const VisibleRow: ({ label, subLabel, name, children, onEdit, not
7
7
  name: TaxDocumentationKey;
8
8
  children: React.ReactNode;
9
9
  onEdit?: (() => void) | undefined;
10
- }) => React.JSX.Element | undefined;
10
+ }) => React.JSX.Element | null;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { TaxBitFormUIProps } from './TaxBitFormUI';
3
3
  export type TaxDocumentationDAC7PathProps = Omit<TaxBitFormUIProps, 'taxForms'>;
4
- export declare const TaxBitDAC7FormUI: ({ data, onSubmit, language, }: TaxDocumentationDAC7PathProps) => React.JSX.Element;
4
+ export declare const TaxBitDAC7FormUI: ({ data, onSubmit, language, complete, }: TaxDocumentationDAC7PathProps) => React.JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import type { Locale, TaxDocumentation, TaxForm } from '../../types';
2
+ import type { Locale, TaxForm } from '../../types';
3
3
  import { ClientTaxDocumentation } from '../../types/client';
4
4
  export type TaxBitFormUIProps = {
5
5
  data?: ClientTaxDocumentation;
6
- onSubmit: (data: TaxDocumentation) => void;
6
+ onSubmit: (data: ClientTaxDocumentation) => void;
7
7
  language?: Locale;
8
8
  taxForms?: TaxForm[];
9
9
  complete?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taxbit/react-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "TaxBit Tax Documentation",
5
5
  "author": "TaxBit",
6
6
  "type": "module",
@@ -32,20 +32,16 @@
32
32
  "ts": "tsc",
33
33
  "test": "vitest"
34
34
  },
35
- "dependencies": {
36
- "@types/node": "^18.17.0",
37
- "@types/react": "^18.2.15",
38
- "@types/react-dom": "^18.2.7",
39
- "type-fest": "^4.3.2",
40
- "camelcase-keys": "^9.1.2"
41
- },
42
35
  "peerDependencies": {
43
- "react": "^18.0.0",
44
- "react-dom": "^18.0.0"
36
+ "react": "^16.0.0 || ^17.0.0 || ^18.0.0",
37
+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
45
38
  },
46
39
  "devDependencies": {
40
+ "@types/react": "^18.0.0",
41
+ "@types/react-dom": "^18.0.0",
47
42
  "@testing-library/react": "^14.0.0",
48
43
  "@testing-library/jest-dom": "^6.1.4",
44
+ "@types/node": "^18.17.0",
49
45
  "@typescript-eslint/eslint-plugin": "^6.0.0",
50
46
  "@typescript-eslint/parser": "^6.0.0",
51
47
  "@vitejs/plugin-react": "^4.0.3",