@taxbit/react-sdk 0.4.0 → 0.4.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
@@ -176,18 +176,7 @@ The TaxBit React SDK provides callbacks for the following events on the `TaxBitD
176
176
 
177
177
  - `onSubmit` - called when the user clicks the submit button
178
178
  - `onSuccess` - called after the server responds with a successful submission
179
- - `onProgress` - called when the user navigates within the TaxBit UI. The function passed here will be passed a Progress object with the following shape:
180
-
181
- ```typescript
182
- type Progress = {
183
- stepNumber: number;
184
- totalSteps: number;
185
- percentComplete: number;
186
- stepTitle: string;
187
- stepId: string;
188
- language: Locale;
189
- };
190
- ```
179
+ - `onProgress` - called when the user navigates within the TaxBit UI. The function passed here will be passed a Progress object (see below for the type definition):
191
180
 
192
181
  The DAC7 sequence, for example, can have a total of 3, 4, or 5 steps, each with a localized `stepTitle` and `stepId`. The `stepNumber` is the current step (1 based), and `percentComplete` is the percentage of the steps that have been completed.
193
182
 
@@ -231,13 +220,29 @@ type Locale =
231
220
  | 'sv-se';
232
221
  ```
233
222
 
223
+ ```typescript
224
+ type StepId =
225
+ | 'accountHolderContactInformation'
226
+ | 'accountHolderTaxInformation'
227
+ | 'accountHolderTaxClarification'
228
+ | 'accountHolderClassification'
229
+ | 'confirmation'
230
+ | 'exemptions'
231
+ | 'regardedOwnerClassification'
232
+ | 'regardedOwnerContactInformation'
233
+ | 'regardedOwnerTaxInformation'
234
+ | 'summary';
235
+ ```
236
+
234
237
  ```typescript
235
238
  type Progress = {
236
- stepNumber: number;
237
- totalSteps: number;
239
+ language: Locale;
238
240
  percentComplete: number;
241
+ stepId: StepId;
242
+ stepIndex: number;
243
+ stepNumber: number;
239
244
  stepTitle: string;
240
- stepId: string;
241
- language: Locale;
245
+ steps: StepId[];
246
+ totalSteps: number;
242
247
  };
243
248
  ```
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { InputStep, Locale, Progress, TaxDocumentation, TaxForm } from 'types';
3
+ import type { StepId } from 'types/StepId';
3
4
  import { ClientTaxDocumentation } from 'types/client';
4
- import { TitleKey } from '../../i18n/types';
5
5
  type UseTaxDocumentationProps = {
6
6
  data: ClientTaxDocumentation;
7
7
  language?: Locale;
@@ -22,7 +22,7 @@ export declare const useTaxDocumentation: ({ data: initialData, language: initia
22
22
  onResetTaxDocumentation: (data: ClientTaxDocumentation) => void;
23
23
  editTo: (form: InputStep) => void;
24
24
  onCancel: (() => void) | undefined;
25
- getTitleKey: (key: InputStep) => TitleKey;
25
+ getStepId: (key: InputStep) => StepId;
26
26
  goTo: (form: InputStep) => void;
27
27
  goBack: (() => void) | undefined;
28
28
  goToNext: (data: TaxDocumentation) => void;
@@ -11,7 +11,7 @@ export declare const useTaxDocumentationContext: () => {
11
11
  onResetTaxDocumentation: (data: import("../../entry").ClientTaxDocumentation) => void;
12
12
  editTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
13
13
  onCancel: (() => void) | undefined;
14
- getTitleKey: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => import("../../i18n/types").TitleKey;
14
+ getStepId: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => import("../../entry").StepId;
15
15
  goTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
16
16
  goBack: (() => void) | undefined;
17
17
  goToNext: (data: import("../../types").TaxDocumentation) => void;
@@ -34,7 +34,7 @@ export declare const useTaxDocumentationContext: () => {
34
34
  onResetTaxDocumentation: (data: import("../../entry").ClientTaxDocumentation) => void;
35
35
  editTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
36
36
  onCancel: (() => void) | undefined;
37
- getTitleKey: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => import("../../i18n/types").TitleKey;
37
+ getStepId: (key: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => import("../../entry").StepId;
38
38
  goTo: (form: "AccountHolderClassification" | "AccountHolderContact" | "AccountHolderTax" | "AccountHolderTaxClarification" | "Confirmation" | "Exemptions" | "RegardedOwnerClassification" | "RegardedOwnerContact" | "RegardedOwnerTax" | "Summary") => void;
39
39
  goBack: (() => void) | undefined;
40
40
  goToNext: (data: import("../../types").TaxDocumentation) => void;
@@ -1,6 +1,7 @@
1
1
  export * from '../hooks/useTaxBit';
2
2
  export * from '../types/Locale';
3
3
  export * from '../types/Progress';
4
+ export * from '../types/StepId';
4
5
  export * from '../types/TaxForm';
5
6
  export * from '../types/client';
6
7
  export * from '../widgets/TaxBitForm';
@@ -0,0 +1,13 @@
1
+ export declare const expectRowError: (prompt: string) => void;
2
+ export declare const expectNoRowError: (prompt: string) => void;
3
+ export declare const expectText: (text: string, length?: number) => void;
4
+ export declare const expectNullInput: (ariaLabel: string) => void;
5
+ export declare const expectInputValue: (ariaLabel: string, value: string) => void;
6
+ export declare const clickLabel: (ariaLabel: string) => void;
7
+ export declare const changeInput: (ariaLabel: string, value: string) => void;
8
+ export declare const clickInput: (ariaLabel: string) => void;
9
+ export declare const clickBack: () => void;
10
+ export declare const clickNext: () => void;
11
+ export declare const clickAddAdditionalResidence: () => void;
12
+ export declare const setBusinessNameAndAddress: () => void;
13
+ export declare const setIndividualNameAndAddress: () => void;
@@ -1,9 +1,12 @@
1
1
  import { Locale } from './Locale.ts';
2
+ import type { StepId } from './StepId.ts';
2
3
  export type Progress = {
3
- stepNumber: number;
4
- totalSteps: number;
4
+ language: Locale;
5
5
  percentComplete: number;
6
+ stepId: StepId;
7
+ stepIndex: number;
8
+ stepNumber: number;
6
9
  stepTitle: string;
7
- stepId: string;
8
- language: Locale;
10
+ steps: StepId[];
11
+ totalSteps: number;
9
12
  };
@@ -0,0 +1 @@
1
+ export type StepId = 'accountHolderContactInformation' | 'accountHolderTaxInformation' | 'accountHolderTaxClarification' | 'accountHolderClassification' | 'confirmation' | 'exemptions' | 'regardedOwnerClassification' | 'regardedOwnerContactInformation' | 'regardedOwnerTaxInformation' | 'summary';
@@ -7,7 +7,7 @@ export * from './getMonthlyDayCount';
7
7
  export * from './getPromptKeyMap';
8
8
  export * from './isBlank';
9
9
  export * from './kebabCase';
10
- export * from './mergeDeep';
10
+ export * from './mergeClientTaxDocumentationData';
11
11
  export * from './snakeCaseKeys';
12
12
  export * from './transformForClient';
13
13
  export * from './transformInbound';
@@ -0,0 +1,2 @@
1
+ import { ClientTaxDocumentation } from '../types/client';
2
+ export declare const mergeClientTaxDocumentationData: (serverData: ClientTaxDocumentation | undefined, clientData: ClientTaxDocumentation | undefined) => ClientTaxDocumentation;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { TaxBitFormProps } from './TaxBitForm';
3
3
  export type TaxBitDAC7FormProps = Omit<TaxBitFormProps, 'taxForms'>;
4
- export declare const TaxBitDAC7Form: ({ data, staging, bearerToken, language, onSubmit, onSuccess, }: TaxBitDAC7FormProps) => React.JSX.Element;
4
+ export declare const TaxBitDAC7Form: ({ data, staging, bearerToken, language, onSubmit, onProgress, onSuccess, }: TaxBitDAC7FormProps) => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { ClientTaxDocumentation } from '../../types/client';
2
+ import { TaxBitFormProps } from './TaxBitForm.tsx';
3
+ type UseTaxBitFormProps = Exclude<TaxBitFormProps, 'language'>;
4
+ export declare const useTaxBitForm: ({ bearerToken, data, onSubmit, onSuccess, staging, }: UseTaxBitFormProps) => {
5
+ handleOnSubmit: (data: ClientTaxDocumentation) => Promise<void>;
6
+ formData: ClientTaxDocumentation | undefined;
7
+ isComplete: boolean;
8
+ isLoading: boolean;
9
+ };
10
+ export {};