@taxbit/react-sdk 2.2.0-beta.0 → 2.2.0-beta.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.
package/README.md CHANGED
@@ -157,9 +157,22 @@ The serverData object contains the currently saved tax documentation data for th
157
157
  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:
158
158
 
159
159
  ```typescript
160
+ type QuestionnaireIssue = {
161
+ issueType:
162
+ | 'CARE_OF_PERMANENT_ADDRESS'
163
+ | 'PO_BOX_PERMANENT_ADDRESS'
164
+ | 'US_PERMANENT_ADDRESS'
165
+ | 'TREATY_COUNTRY_MISMATCH'
166
+ | 'US_INDICIA'
167
+ | 'WITHHOLDING_DOCUMENTATION'
168
+ | 'CHANGE_IN_CIRCUMSTANCES';
169
+ createdAt: string;
170
+ };
171
+
160
172
  type ClientTaxDocumentationStatus = {
161
173
  dpsQuestionnaire?: {
162
174
  dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
175
+ expirationDate?: string;
163
176
  vatStatus?:
164
177
  | 'PENDING'
165
178
  | 'VALID'
@@ -168,12 +181,13 @@ type ClientTaxDocumentationStatus = {
168
181
  | 'NOT_REQUIRED'
169
182
  | 'NON_EU';
170
183
  vatValidationDate?: string;
171
- expirationDate?: string;
172
184
  };
173
185
  wFormQuestionnaire?: {
174
186
  dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
175
187
  type: 'W-9' | 'W-8BEN' | 'W-8BEN-E' | 'W-8IMY';
176
188
  expirationDate?: string;
189
+ issues?: QuestionnaireIssue[];
190
+ needsResubmission?: boolean;
177
191
  tinStatus?:
178
192
  | 'PENDING'
179
193
  | 'FOREIGN'
@@ -185,11 +199,12 @@ type ClientTaxDocumentationStatus = {
185
199
  | 'TIN_NOT_ISSUED'
186
200
  | 'ERROR';
187
201
  tinValidationDate?: string;
188
- needsResubmission: boolean;
202
+ treatyClaimStatus?: 'VALID' | 'INVALID';
189
203
  };
190
204
  selfCertification?: {
191
205
  dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
192
- needsResubmission: boolean;
206
+ issues?: QuestionnaireIssue[];
207
+ needsResubmission?: boolean;
193
208
  };
194
209
  };
195
210
  ```
@@ -331,6 +346,14 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
331
346
 
332
347
  ## Changelog
333
348
 
349
+ ### Version 2.2.0-beta.2
350
+
351
+ 1. Bug fix, hiding email field for non-AU residents.
352
+
353
+ ### Version 2.2.0-beta.1
354
+
355
+ 1. Updating TaxDocumentationStatus type to include issues and treatyClaimStatus.
356
+
334
357
  ### Version 2.2.0-beta.0
335
358
 
336
359
  1. Adding SERR support for Australian residents.
@@ -1,3 +1,6 @@
1
+ import { useQuestionnaireStep } from './useQuestionnaireStep.ts';
2
+
3
+ export type QuestionnaireStepContextValue = ReturnType<typeof useQuestionnaireStep>;
1
4
  export declare const useQuestionnaireStepContext: () => {
2
5
  getBadgeKey: (key: import('../../types/TaxDocumentation.ts').TaxDocumentationKey) => import('../../hooks/index.ts').UsTinValidationStatus | undefined;
3
6
  getLocalAddressTitle: (data: import('../../types/TaxDocumentation.ts').TaxDocumentation) => string;
@@ -0,0 +1,11 @@
1
+ import { QuestionnaireStepContextValue } from 'contexts/QuestionnaireStep/useQuestionnaireStepContext';
2
+ import { default as React } from 'react';
3
+
4
+ /**
5
+ * A wrapper for unit testing questionnaire components that combines a real value from the
6
+ * `useQuestionnaireStep` hook with the provided context value overrides.
7
+ */
8
+ export declare const StepWrapper: ({ contextValue, children, }: {
9
+ contextValue: Partial<QuestionnaireStepContextValue>;
10
+ children: React.ReactNode;
11
+ }) => React.JSX.Element;
@@ -1,8 +1,26 @@
1
1
  import { ClientTaxDocumentation } from '@taxbit/utilities';
2
+ import { QuestionnaireStepContextValue } from 'contexts';
2
3
  import { default as React } from 'react';
3
4
  import { QuestionnaireProp } from '../types';
4
5
 
5
- export declare const Wrapper: React.FC<React.PropsWithChildren & {
6
+ export type WrapperProps = React.PropsWithChildren<{
7
+ /**
8
+ * Initial data for the questionnaire.
9
+ */
6
10
  initialData?: ClientTaxDocumentation;
11
+ /**
12
+ * The type of questionnaire to render. Defaults to 'W-FORM'.
13
+ */
7
14
  questionnaire?: QuestionnaireProp;
15
+ /**
16
+ * Overrides for the context value of the `QuestionnaireStepProvider`. When provided, these
17
+ * overrides will be combined with the real output of a `useQuestionnaireStep` hook to produce
18
+ * a complete context value. When not provided, an actual provider with complete stateful data
19
+ * will be rendered.
20
+ */
21
+ contextValue?: Partial<QuestionnaireStepContextValue>;
8
22
  }>;
23
+ /**
24
+ * A test wrapper for unit testing questionnaire components.
25
+ */
26
+ export declare const Wrapper: React.FC<WrapperProps>;
@@ -1,5 +1,7 @@
1
- import { ClientTaxDocumentation } from '@taxbit/utilities';
2
1
  import { default as React } from 'react';
3
- import { QuestionnaireProp } from '../types';
2
+ import { WrapperProps } from './Wrapper';
4
3
 
5
- export declare const getWrapper: (initialData?: ClientTaxDocumentation, questionnaire?: QuestionnaireProp) => ({ children }: React.PropsWithChildren) => React.ReactNode | Promise<React.ReactNode>;
4
+ /**
5
+ * A helper function to create a test wrapper for unit testing questionnaire components.
6
+ */
7
+ export declare const getWrapper: (initialData?: WrapperProps["initialData"], questionnaire?: WrapperProps["questionnaire"], contextValue?: WrapperProps["contextValue"]) => ({ children }: React.PropsWithChildren) => React.ReactNode | Promise<React.ReactNode>;
@@ -0,0 +1,3 @@
1
+ import { WrapperProps } from './Wrapper';
2
+
3
+ export declare const renderWithWrapper: ({ contextValue, children, initialData, questionnaire, }: WrapperProps) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
@@ -1,20 +1,28 @@
1
+ type QuestionnaireIssue = {
2
+ issueType: 'CARE_OF_PERMANENT_ADDRESS' | 'PO_BOX_PERMANENT_ADDRESS' | 'US_PERMANENT_ADDRESS' | 'TREATY_COUNTRY_MISMATCH' | 'US_INDICIA' | 'WITHHOLDING_DOCUMENTATION' | 'CHANGE_IN_CIRCUMSTANCES';
3
+ createdAt: string;
4
+ };
1
5
  export type ClientTaxDocumentationStatus = {
2
6
  dpsQuestionnaire?: {
3
7
  dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
8
+ expirationDate?: string;
4
9
  vatStatus?: 'PENDING' | 'VALID' | 'INVALID' | 'INSUFFICIENT_DATA' | 'NOT_REQUIRED' | 'NON_EU';
5
10
  vatValidationDate?: string;
6
- expirationDate?: string;
7
11
  };
8
12
  wFormQuestionnaire?: {
9
13
  dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
10
- type: 'W-9' | 'W-8BEN' | 'W-8BEN-E';
14
+ type: 'W-9' | 'W-8BEN' | 'W-8BEN-E' | 'W-8IMY';
11
15
  expirationDate?: string;
16
+ issues?: QuestionnaireIssue[];
17
+ needsResubmission?: boolean;
12
18
  tinStatus?: 'PENDING' | 'FOREIGN' | 'INVALID_DATA' | 'VALID_SSN_MATCH' | 'VALID_EIN_MATCH' | 'VALID_SSN_EIN_MATCH' | 'MISMATCH' | 'TIN_NOT_ISSUED' | 'ERROR';
13
19
  tinValidationDate?: string;
14
- needsResubmission: boolean;
20
+ treatyClaimStatus?: 'VALID' | 'INVALID';
15
21
  };
16
22
  selfCertification?: {
17
23
  dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
18
- needsResubmission: boolean;
24
+ issues?: QuestionnaireIssue[];
25
+ needsResubmission?: boolean;
19
26
  };
20
27
  };
28
+ export {};
@@ -1,20 +1,28 @@
1
+ type Issue = {
2
+ issue_type: 'CARE_OF_PERMANENT_ADDRESS' | 'PO_BOX_PERMANENT_ADDRESS' | 'US_PERMANENT_ADDRESS' | 'TREATY_COUNTRY_MISMATCH' | 'US_INDICIA' | 'WITHHOLDING_DOCUMENTATION' | 'CHANGE_IN_CIRCUMSTANCES';
3
+ created_at: string;
4
+ };
1
5
  export type TaxDocumentationStatus = {
2
6
  dps_questionnaire?: {
3
7
  data_collection_status: 'COMPLETE' | 'INCOMPLETE';
8
+ expiration_date?: string;
4
9
  vat_status?: 'PENDING' | 'VALID' | 'INVALID' | 'INSUFFICIENT_DATA' | 'NOT_REQUIRED' | 'NON_EU';
5
10
  vat_validation_date?: string;
6
- expiration_date?: string;
7
11
  };
8
12
  w_form_questionnaire?: {
9
13
  data_collection_status: 'COMPLETE' | 'INCOMPLETE';
10
- type: 'W-9' | 'W-8BEN' | 'W-8BEN-E';
14
+ type: 'W-9' | 'W-8BEN' | 'W-8BEN-E' | 'W-8IMY';
11
15
  expiration_date?: string;
16
+ issues?: Issue[];
17
+ needs_resubmission?: boolean;
12
18
  tin_status?: 'PENDING' | 'FOREIGN' | 'INVALID_DATA' | 'VALID_SSN_MATCH' | 'VALID_EIN_MATCH' | 'VALID_SSN_EIN_MATCH' | 'MISMATCH' | 'TIN_NOT_ISSUED' | 'ERROR';
13
19
  tin_validation_date?: string;
14
- needs_resubmission: boolean;
20
+ treaty_claim_status?: 'VALID' | 'INVALID';
15
21
  };
16
22
  self_certification: {
17
23
  data_collection_status: 'COMPLETE' | 'INCOMPLETE';
18
- needs_resubmission: boolean;
24
+ issues?: Issue[];
25
+ needs_resubmission?: boolean;
19
26
  };
20
27
  };
28
+ export {};
@@ -13,4 +13,5 @@ export * from './ShowHideInput';
13
13
  export * from './TextArea';
14
14
  export * from './TextInput';
15
15
  export * from './ToggleButton';
16
+ export * from './useAriaAttributes';
16
17
  export * from './WithholdingInput';
@@ -0,0 +1,10 @@
1
+ import { TaxDocumentationKey } from '../types/TaxDocumentation';
2
+
3
+ /**
4
+ * Hook that returns any aria attributes needed to properly set up the given
5
+ * field for assistive technologies.
6
+ */
7
+ export declare const useAriaAttributes: (fieldName: TaxDocumentationKey) => {
8
+ 'aria-invalid': boolean;
9
+ 'aria-describedby': string | undefined;
10
+ };
@@ -0,0 +1,3 @@
1
+ import { TaxDocumentationKey } from 'types';
2
+
3
+ export declare const getErrorMessageId: (name: TaxDocumentationKey) => string;
@@ -1,6 +1,7 @@
1
1
  export * from './bearerTokenIsRequiredError';
2
2
  export * from './cx';
3
3
  export * from './formatTin';
4
+ export * from './getErrorMessageId';
4
5
  export * from './getFieldsState';
5
6
  export * from './getFormStatus';
6
7
  export * from './getHeaders';