@taxbit/react-sdk 2.2.0-beta.1 → 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
@@ -346,6 +346,10 @@ type QuestionnaireType = 'DPS' | 'W-FORM' | 'SELF-CERT';
346
346
 
347
347
  ## Changelog
348
348
 
349
+ ### Version 2.2.0-beta.2
350
+
351
+ 1. Bug fix, hiding email field for non-AU residents.
352
+
349
353
  ### Version 2.2.0-beta.1
350
354
 
351
355
  1. Updating TaxDocumentationStatus type to include issues and treatyClaimStatus.
@@ -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>;
@@ -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';