@wise/dynamic-flow-client 2.7.1 → 2.8.1

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 (70) hide show
  1. package/README.md +42 -13
  2. package/build/i18n/en.json +4 -0
  3. package/build/i18n/pt.json +2 -2
  4. package/build/i18n/zh_CN.json +20 -20
  5. package/build/main.css +0 -20
  6. package/build/main.js +333 -296
  7. package/build/main.min.js +1 -1
  8. package/build/types/dynamic-flow-types.d.ts +1 -1
  9. package/build/types/legacy/common/constants/FeatureName.d.ts +1 -1
  10. package/build/types/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +1 -1
  11. package/build/types/legacy/common/utils/debounce.d.ts +2 -2
  12. package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +5 -5
  13. package/build/types/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +40 -0
  14. package/build/types/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +1 -1
  15. package/build/types/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +2 -1
  16. package/build/types/legacy/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +1 -1
  17. package/build/types/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.d.ts +3 -0
  18. package/build/types/legacy/step/cameraStep/cameraCapture/screens/index.d.ts +1 -2
  19. package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +4 -3
  20. package/build/types/legacy/step/cameraStep/cameraCapture/types/index.d.ts +11 -0
  21. package/build/types/revamp/DynamicFlowRevamp.d.ts +5 -1
  22. package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -3
  23. package/build/types/revamp/domain/components/BoxComponent.d.ts +3 -4
  24. package/build/types/revamp/domain/components/ButtonComponent.d.ts +2 -4
  25. package/build/types/revamp/domain/components/ColumnsComponent.d.ts +19 -0
  26. package/build/types/revamp/domain/components/HeadingComponent.d.ts +2 -3
  27. package/build/types/revamp/domain/components/ObjectComponent.d.ts +3 -4
  28. package/build/types/revamp/domain/components/ParagraphComponent.d.ts +2 -3
  29. package/build/types/revamp/domain/components/TextInputComponent.d.ts +7 -8
  30. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  31. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +3 -3
  32. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
  33. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +4 -0
  34. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +1 -1
  35. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -1
  36. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -1
  37. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +2 -2
  38. package/build/types/revamp/domain/mappers/mapStepToComponents.d.ts +2 -9
  39. package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +1 -1
  40. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +9 -2
  41. package/build/types/revamp/domain/mappers/schema/types.d.ts +4 -1
  42. package/build/types/revamp/domain/mappers/types.d.ts +11 -0
  43. package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +5 -2
  44. package/build/types/revamp/domain/mappers/utils/type-validators.d.ts +9 -0
  45. package/build/types/revamp/domain/mappers/utils/value-checks.d.ts +10 -0
  46. package/build/types/revamp/domain/types.d.ts +13 -10
  47. package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +1 -1
  48. package/build/types/revamp/renderers/mappers/boxComponentToProps.d.ts +1 -1
  49. package/build/types/revamp/renderers/mappers/columnsComponentToProps.d.ts +4 -0
  50. package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +5 -1
  51. package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +1 -1
  52. package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +1 -1
  53. package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +1 -1
  54. package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +1 -1
  55. package/build/types/revamp/renderers/types.d.ts +19 -10
  56. package/build/types/revamp/step/Step.d.ts +1 -1
  57. package/build/types/revamp/step/utils/getRenderFunction.d.ts +3 -0
  58. package/build/types/revamp/step/utils/getSchemaErrorMessageFunction.d.ts +3 -0
  59. package/build/types/revamp/utils/getSubmittableData.d.ts +1 -1
  60. package/build/types/revamp/utils/type-utils.d.ts +7 -1
  61. package/build/types/revamp/utils/validateComponents.d.ts +2 -0
  62. package/build/types/revamp/wise/renderers/ColumnsRenderer.d.ts +3 -0
  63. package/package.json +4 -3
  64. package/build/types/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -2
  65. package/build/types/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -13
  66. package/build/types/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -5
  67. package/build/types/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -18
  68. package/build/types/revamp/renderers/utils/mapping-utils.d.ts +0 -3
  69. package/build/types/revamp/step/utils/render-utils.d.ts +0 -5
  70. /package/build/types/{legacy/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts → common/validationMessages/validation.messages.d.ts} +0 -0
@@ -1,16 +1,16 @@
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;
5
- render: (props: P) => ReactNode;
5
+ render: (props: P) => JSX.Element;
6
6
  };
7
7
  export type Align = 'start' | 'center' | 'end';
8
+ export type Bias = 'none' | 'start' | 'end';
9
+ export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
8
10
  export type Margin = DFMargin;
9
- export type Context = DFContext;
10
11
  export type Size = DFSize;
11
12
  export interface RendererProps {
12
13
  type: string;
13
- keyProp: string;
14
14
  }
15
15
  export interface AlertRendererProps extends RendererProps {
16
16
  type: 'alert';
@@ -25,6 +25,14 @@ export interface BoxRendererProps extends RendererProps {
25
25
  margin: Margin;
26
26
  children: ReactNode;
27
27
  }
28
+ export interface ColumnsRendererProps extends RendererProps {
29
+ type: 'columns';
30
+ control?: string;
31
+ bias: Bias;
32
+ margin: Margin;
33
+ startChildren: ReactNode;
34
+ endChildren: ReactNode;
35
+ }
28
36
  export interface HeadingRendererProps extends RendererProps {
29
37
  type: 'heading';
30
38
  text: string;
@@ -36,7 +44,7 @@ export interface HeadingRendererProps extends RendererProps {
36
44
  export interface ParagraphRendererProps extends RendererProps {
37
45
  type: 'paragraph';
38
46
  text: string;
39
- control?: 'copyable' | string;
47
+ control?: string;
40
48
  margin: Margin;
41
49
  align: Align;
42
50
  }
@@ -48,12 +56,13 @@ export interface ObjectRendererProps extends RendererProps {
48
56
  }
49
57
  export interface TextInputRendererProps extends RendererProps {
50
58
  type: 'input-text';
51
- control?: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number' | 'date-lookup' | string;
52
- format: 'text' | 'date';
53
59
  id: string;
54
- name: string;
55
- label?: string;
60
+ control?: string;
56
61
  description?: string;
62
+ error?: string;
63
+ format?: 'date';
64
+ label?: string;
65
+ name: string;
57
66
  placeholder?: string;
58
67
  value: string | null;
59
68
  onChange: (value: string | null) => void;
@@ -61,7 +70,7 @@ export interface TextInputRendererProps extends RendererProps {
61
70
  export interface ButtonRendererProps extends RendererProps {
62
71
  type: 'button';
63
72
  title: string;
64
- control?: 'primary' | 'secondary' | 'tertiary' | string;
73
+ control?: string;
65
74
  context: Context;
66
75
  disabled: boolean;
67
76
  margin: Margin;
@@ -1,4 +1,4 @@
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
3
  type StepProps = {
4
4
  step: DFStep;
@@ -0,0 +1,3 @@
1
+ import type { StepComponent } from '../../domain/types';
2
+ import type { Renderer, RendererProps } from '../../renderers/types';
3
+ export declare const getRenderFunction: (renderers: Renderer<RendererProps>[]) => (component: StepComponent) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { IntlFormatters } from 'react-intl';
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,4 +1,10 @@
1
- import type { Model } from '@wise/dynamic-flow-types';
1
+ import type { AllOfSchema, Model, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { ContainerComponent, StepComponent } from '../domain/types';
3
+ import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
3
4
  export declare const isContainerComponent: (component: StepComponent) => component is ContainerComponent;
5
+ export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
4
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;
@@ -0,0 +1,2 @@
1
+ import type { StepComponent } from '../domain/types';
2
+ export declare const validateComponents: (components: StepComponent[]) => boolean;
@@ -0,0 +1,3 @@
1
+ import type { ColumnsRendererProps, Renderer } from '../../renderers/types';
2
+ declare const ColumnsRenderer: Renderer<ColumnsRendererProps>;
3
+ export default ColumnsRenderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.7.1",
3
+ "version": "2.8.1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -48,6 +48,7 @@
48
48
  "@types/jest": "29.5.10",
49
49
  "@types/react": "18",
50
50
  "@types/react-dom": "18",
51
+ "@types/react-intl": "3.0.0",
51
52
  "@types/testing-library__jest-dom": "5.14.9",
52
53
  "@wise/art": "2.8.4",
53
54
  "@wise/components-theming": "^0.8.4",
@@ -90,7 +91,7 @@
90
91
  "classnames": "2.3.2",
91
92
  "react-webcam": "^7.2.0",
92
93
  "screenfull": "^5.2.0",
93
- "@wise/dynamic-flow-types": "2.3.1"
94
+ "@wise/dynamic-flow-types": "2.4.0"
94
95
  },
95
96
  "scripts": {
96
97
  "dev": "storybook dev -p 3003",
@@ -98,7 +99,7 @@
98
99
  "build:types": "tsc --project ./tsconfig.types.json",
99
100
  "build:js": "node ./scripts/build.mjs",
100
101
  "build:css": "postcss src/main.css -o build/main.css",
101
- "build:messages-source": "formatjs extract 'src/**/*.messages.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
102
+ "build:messages-source": "formatjs extract 'src/**/{*.messages,messages}.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
102
103
  "build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
103
104
  "test": "npm-run-all test:once test:tz",
104
105
  "test:once": "jest --config jest.config.js --env=jsdom -w 2",
@@ -1,2 +0,0 @@
1
- declare const CameraNotSupported: () => JSX.Element;
2
- export default CameraNotSupported;
@@ -1,13 +0,0 @@
1
- declare const _default: {
2
- title: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- paragraph: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- };
13
- export default _default;
@@ -1,5 +0,0 @@
1
- type Props = {
2
- onAction: () => void;
3
- };
4
- declare function NoCameraAccess({ onAction }: Props): JSX.Element;
5
- export default NoCameraAccess;
@@ -1,18 +0,0 @@
1
- declare const _default: {
2
- title: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- paragraph: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- action: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- };
18
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { Align as DFAlign } from '@wise/dynamic-flow-types';
2
- import type { Align } from '../types';
3
- export declare const mapAlign: (align: DFAlign) => Align;
@@ -1,5 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { StepComponent } from '../../domain/types';
3
- import type { Renderer, RendererProps } from '../../renderers/types';
4
- export declare const renderComponent: (component: StepComponent, render: (props: RendererProps) => ReactNode) => ReactNode;
5
- export declare const getPropsRenderer: <P extends RendererProps>(renderers: Renderer<P>[]) => (props: P) => ReactNode;