@wise/dynamic-flow-client 2.8.0 → 2.8.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 (72) hide show
  1. package/build/main.js +12 -9
  2. package/build/main.min.js +1 -1
  3. package/build/types/index.d.ts +1 -1
  4. package/build/types/legacy/common/contexts/eventsContext/EventsContext.d.ts +1 -1
  5. package/build/types/legacy/common/contexts/featureContext/FeatureContext.d.ts +1 -1
  6. package/build/types/legacy/common/contexts/httpClientContext/HttpClientContext.d.ts +1 -1
  7. package/build/types/legacy/common/contexts/logContext/LogContext.d.ts +1 -1
  8. package/build/types/legacy/dynamicFlow/DynamicFlow.d.ts +1 -1
  9. package/build/types/legacy/dynamicFlow/stories/fixtureHttpClient.d.ts +1 -1
  10. package/build/types/legacy/dynamicFlow/utils/responseParsers/response-parsers.d.ts +1 -1
  11. package/build/types/legacy/dynamicFlow/utils/useLoader.d.ts +1 -1
  12. package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.d.ts +1 -1
  13. package/build/types/legacy/jsonSchemaForm/oneOfSchema/utils.d.ts +1 -1
  14. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +1 -1
  15. package/build/types/legacy/layout/search/useSearch.d.ts +1 -1
  16. package/build/types/legacy/step/cameraStep/cameraCapture/CameraCapture.d.ts +1 -1
  17. package/build/types/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +1 -1
  18. package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +1 -1
  19. package/build/types/legacy/test-utils/DynamicFlowProviders.d.ts +1 -1
  20. package/build/types/legacy/test-utils/legacy-utils.d.ts +1 -1
  21. package/build/types/revamp/DynamicFlowRevamp.d.ts +2 -2
  22. package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -3
  23. package/build/types/revamp/domain/components/BoxComponent.d.ts +2 -3
  24. package/build/types/revamp/domain/components/ButtonComponent.d.ts +2 -4
  25. package/build/types/revamp/domain/components/ColumnsComponent.d.ts +2 -3
  26. package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -2
  27. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +8 -0
  28. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +8 -0
  29. package/build/types/revamp/domain/components/ObjectComponent.d.ts +3 -3
  30. package/build/types/revamp/domain/components/ParagraphComponent.d.ts +1 -2
  31. package/build/types/revamp/domain/components/TextInputComponent.d.ts +4 -21
  32. package/build/types/revamp/domain/components/utils/component-utils.d.ts +12 -0
  33. package/build/types/revamp/domain/events/getAnalyticsEventDispatcher.d.ts +9 -0
  34. package/build/types/revamp/domain/events/getLogggingEventDispatcher.d.ts +4 -0
  35. package/build/types/revamp/domain/events/index.d.ts +2 -0
  36. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  37. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +1 -1
  38. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
  39. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +1 -1
  40. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +1 -1
  41. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -1
  42. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -1
  43. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +2 -2
  44. package/build/types/revamp/domain/mappers/mapSchemaToComponent.d.ts +1 -1
  45. package/build/types/revamp/domain/mappers/schema/integerSchemaToComponent.d.ts +5 -0
  46. package/build/types/revamp/domain/mappers/schema/numberSchemaToComponent.d.ts +5 -0
  47. package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +2 -2
  48. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +2 -9
  49. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +21 -0
  50. package/build/types/revamp/domain/mappers/schema/types.d.ts +5 -1
  51. package/build/types/revamp/domain/mappers/types.d.ts +6 -4
  52. package/build/types/revamp/domain/mappers/utils/getAutocompleteString.d.ts +2 -0
  53. package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +3 -3
  54. package/build/types/revamp/domain/types.d.ts +22 -5
  55. package/build/types/revamp/domain/validation/getModelValidationErrors.d.ts +6 -0
  56. package/build/types/revamp/domain/validation/spec-utils.d.ts +11 -0
  57. package/build/types/revamp/{utils → domain/validation}/validateComponents.d.ts +1 -1
  58. package/build/types/revamp/domain/validation/value-checks.d.ts +13 -0
  59. package/build/types/revamp/dynamic-flow-types.d.ts +38 -0
  60. package/build/types/revamp/renderers/mappers/integerInputComponentToProps.d.ts +3 -0
  61. package/build/types/revamp/renderers/mappers/numberInputComponentToProps.d.ts +3 -0
  62. package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +1 -1
  63. package/build/types/revamp/renderers/types.d.ts +20 -6
  64. package/build/types/revamp/step/Step.d.ts +5 -2
  65. package/build/types/revamp/step/utils/getSchemaErrorMessageFunction.d.ts +2 -3
  66. package/build/types/revamp/utils/getSubmittableData.d.ts +1 -1
  67. package/build/types/revamp/utils/type-utils.d.ts +7 -1
  68. package/build/types/revamp/wise/renderers/IntegerInputRenderer.d.ts +3 -0
  69. package/build/types/revamp/wise/renderers/NumberInputRenderer.d.ts +3 -0
  70. package/package.json +1 -1
  71. package/build/types/revamp/domain/mappers/utils/value-checks.d.ts +0 -10
  72. /package/build/types/{dynamic-flow-types.d.ts → legacy/dynamic-flow-types.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- import type { StepComponent } from '../domain/types';
1
+ import type { StepComponent } from '../types';
2
2
  export declare const validateComponents: (components: StepComponent[]) => boolean;
@@ -0,0 +1,13 @@
1
+ import type { IntegerSchema, Model, NumberSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { ErrorMessageFunctions } from '../mappers/types';
3
+ export type IsInvalidCheck<M extends Model> = (model: M | null) => string | null;
4
+ type GetIsInvalidCheck<S extends Schema, M extends Model> = (schema: S, messageFunctions: ErrorMessageFunctions) => IsInvalidCheck<M>;
5
+ export declare const getAboveMaxLengthCheck: GetIsInvalidCheck<StringSchema, string | null>;
6
+ export declare const getBelowMinLengthCheck: GetIsInvalidCheck<StringSchema, string | null>;
7
+ export declare const getAboveMaximumCheck: GetIsInvalidCheck<NumberSchema | IntegerSchema, number | null>;
8
+ export declare const getBelowMinimumCheck: GetIsInvalidCheck<NumberSchema | IntegerSchema, number | null>;
9
+ export declare const getAboveMaximumDateCheck: GetIsInvalidCheck<StringSchema, string | null>;
10
+ export declare const getBelowMinimumDateCheck: GetIsInvalidCheck<StringSchema, string | null>;
11
+ export declare const getNotAdheringToPatternCheck: GetIsInvalidCheck<StringSchema, string | null>;
12
+ export declare const getRequiredCheck: (required: boolean, messageFunctions: ErrorMessageFunctions) => IsInvalidCheck<Model | null>;
13
+ export {};
@@ -0,0 +1,38 @@
1
+ import type { Step, Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { AnalyticsEventHandler, LoggingEventHandler } from './domain/events';
3
+ export type DynamicFlowProps = DynamicFlowPropsWithInitialAction | DynamicFlowPropsWithInitialStep;
4
+ export type DynamicFlowPropsWithInitialAction = DynamicFlowPropsBasic & {
5
+ initialAction: InitialAction;
6
+ initialStep?: never;
7
+ };
8
+ export type DynamicFlowPropsWithInitialStep = DynamicFlowPropsBasic & {
9
+ initialAction?: never;
10
+ initialStep: Step;
11
+ };
12
+ export type InitialAction = {
13
+ $id?: string;
14
+ url: string;
15
+ method?: 'GET';
16
+ data?: never;
17
+ } | {
18
+ $id?: string;
19
+ url: string;
20
+ method: 'POST';
21
+ data: Model;
22
+ };
23
+ type DynamicFlowPropsBasic = {
24
+ flowId: string;
25
+ displayStepTitle?: boolean;
26
+ features?: Feature[];
27
+ httpClient: HttpClient;
28
+ onCompletion: (result: Model) => void;
29
+ onError: (error: unknown, status?: number) => void;
30
+ onEvent?: AnalyticsEventHandler;
31
+ onLog?: LoggingEventHandler;
32
+ };
33
+ export type HttpClient = typeof fetch;
34
+ type Feature = {
35
+ featureName: string;
36
+ variant: number | null;
37
+ };
38
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { IntegerInputComponent } from '../../domain/components/IntegerInputComponent';
2
+ import type { IntegerInputRendererProps } from '../types';
3
+ export declare const integerInputComponentToProps: (component: IntegerInputComponent) => IntegerInputRendererProps;
@@ -0,0 +1,3 @@
1
+ import type { NumberInputComponent } from '../../domain/components/NumberInputComponent';
2
+ import type { NumberInputRendererProps } from '../types';
3
+ export declare const numberInputComponentToProps: (component: NumberInputComponent) => NumberInputRendererProps;
@@ -1,3 +1,3 @@
1
1
  import type { TextInputComponent } from '../../domain/components/TextInputComponent';
2
2
  import type { TextInputRendererProps } from '../types';
3
- export declare const textComponentToProps: ({ format, errors, id, title, description, placeholder, value, onChange, }: TextInputComponent) => TextInputRendererProps;
3
+ export declare const textInputComponentToProps: (component: TextInputComponent) => TextInputRendererProps;
@@ -1,4 +1,4 @@
1
- import type { Context as DFContext, Margin as DFMargin, Size as DFSize } from '@wise/dynamic-flow-types';
1
+ import type { Margin as DFMargin, Size as DFSize } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { ReactNode } from 'react';
3
3
  export type Renderer<P extends RendererProps> = {
4
4
  canRender: (props: RendererProps) => boolean;
@@ -6,7 +6,7 @@ export type Renderer<P extends RendererProps> = {
6
6
  };
7
7
  export type Align = 'start' | 'center' | 'end';
8
8
  export type Bias = 'none' | 'start' | 'end';
9
- export type Context = DFContext;
9
+ export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
10
10
  export type Margin = DFMargin;
11
11
  export type Size = DFSize;
12
12
  export interface RendererProps {
@@ -54,9 +54,9 @@ export interface ObjectRendererProps extends RendererProps {
54
54
  description?: string;
55
55
  children: ReactNode;
56
56
  }
57
- export interface TextInputRendererProps extends RendererProps {
58
- type: 'input-text';
57
+ interface BaseInputRendererProps<M extends string | number> extends RendererProps {
59
58
  id: string;
59
+ autoComplete: string;
60
60
  control?: string;
61
61
  description?: string;
62
62
  error?: string;
@@ -64,8 +64,21 @@ export interface TextInputRendererProps extends RendererProps {
64
64
  label?: string;
65
65
  name: string;
66
66
  placeholder?: string;
67
- value: string | null;
68
- onChange: (value: string | null) => void;
67
+ value: M | null;
68
+ onChange: (value: M | null) => void;
69
+ onBlur: () => void;
70
+ onFocus: () => void;
71
+ }
72
+ export interface TextInputRendererProps extends BaseInputRendererProps<string> {
73
+ type: 'input-text';
74
+ control?: string;
75
+ format?: 'date';
76
+ }
77
+ export interface NumberInputRendererProps extends BaseInputRendererProps<number> {
78
+ type: 'input-number';
79
+ }
80
+ export interface IntegerInputRendererProps extends BaseInputRendererProps<number> {
81
+ type: 'input-integer';
69
82
  }
70
83
  export interface ButtonRendererProps extends RendererProps {
71
84
  type: 'button';
@@ -76,3 +89,4 @@ export interface ButtonRendererProps extends RendererProps {
76
89
  margin: Margin;
77
90
  onClick: () => void;
78
91
  }
92
+ export {};
@@ -1,8 +1,11 @@
1
- import type { Step as DFStep } from '@wise/dynamic-flow-types';
1
+ import type { Step as DFStep } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { Renderer, RendererProps } from '../renderers/types';
3
+ import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/events';
3
4
  type StepProps = {
4
5
  step: DFStep;
5
6
  renderers: Renderer<RendererProps>[];
7
+ trackEvent: AnalyticsEventDispatcher;
8
+ logEvent: LoggingEventDispatcher;
6
9
  };
7
- declare function Step({ step: dfStep, renderers }: StepProps): JSX.Element;
10
+ declare function Step({ step, renderers, trackEvent, logEvent }: StepProps): JSX.Element;
8
11
  export default Step;
@@ -1,4 +1,3 @@
1
- import type { Schema } from '@wise/dynamic-flow-types';
2
1
  import type { IntlFormatters } from 'react-intl';
3
- import type { ErrorMessageFunctions } from '../../domain/mappers/types';
4
- export declare function getSchemaErrorMessageFunction(formatMessage: IntlFormatters['formatMessage'], locale: string): (validationMessages: Schema['validationMessages']) => ErrorMessageFunctions;
2
+ import type { GetErrorMessageFunctions } from '../../domain/mappers/types';
3
+ export declare function getSchemaErrorMessageFunction(formatMessage: IntlFormatters['formatMessage'], locale: string): GetErrorMessageFunctions;
@@ -1,3 +1,3 @@
1
- import type { Model } from '@wise/dynamic-flow-types';
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { StepComponent } from '../domain/types';
3
3
  export declare const getSubmittableData: (components: StepComponent[]) => Model;
@@ -1,6 +1,12 @@
1
- import type { Model } from '@wise/dynamic-flow-types';
1
+ import type { AllOfSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { ContainerComponent, StepComponent } from '../domain/types';
3
3
  import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
4
4
  export declare const isContainerComponent: (component: StepComponent) => component is ContainerComponent;
5
5
  export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
6
6
  export declare const isObjectModel: (model: Model) => model is Record<string, Model>;
7
+ export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
8
+ export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
9
+ export declare const isObjectSchema: (schema: Schema) => schema is ObjectSchema;
10
+ export declare const isStringSchema: (schema: Schema) => schema is StringSchema;
11
+ export declare const isNumberSchema: (schema: Schema) => schema is NumberSchema;
12
+ export declare const isIntegerSchema: (schema: Schema) => schema is IntegerSchema;
@@ -0,0 +1,3 @@
1
+ import type { Renderer, IntegerInputRendererProps } from '../../renderers/types';
2
+ declare const IntegerInputRenderer: Renderer<IntegerInputRendererProps>;
3
+ export default IntegerInputRenderer;
@@ -0,0 +1,3 @@
1
+ import type { Renderer, NumberInputRendererProps } from '../../renderers/types';
2
+ declare const NumberInputRenderer: Renderer<NumberInputRendererProps>;
3
+ export default NumberInputRenderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -1,10 +0,0 @@
1
- import type { StringSchema } from '@wise/dynamic-flow-types';
2
- type IsInvalidCheck = (schema: StringSchema, model: string | null) => boolean;
3
- export declare const isAboveMaximum: IsInvalidCheck;
4
- export declare const isAboveMaxLength: IsInvalidCheck;
5
- export declare const isBelowMinimum: IsInvalidCheck;
6
- export declare const isBelowMinLength: IsInvalidCheck;
7
- export declare const isNotAdheringToPattern: IsInvalidCheck;
8
- export declare const isNotCorrectType: IsInvalidCheck;
9
- export declare const isNotProvided: IsInvalidCheck;
10
- export {};