@wise/dynamic-flow-client 2.2.2 → 2.3.0-beta-923c14.19

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 (36) hide show
  1. package/build/i18n/en.json +2 -0
  2. package/build/i18n/hu.json +1 -1
  3. package/build/main.css +19 -0
  4. package/build/main.js +785 -478
  5. package/build/main.min.js +8 -1
  6. package/build/types/common/contexts/featureContext/FeatureContext.d.ts +9 -0
  7. package/build/types/common/utils/index.d.ts +1 -0
  8. package/build/types/common/utils/mobile-utils.d.ts +4 -0
  9. package/build/types/dynamicFlow/DynamicFlowTypes.d.ts +4 -0
  10. package/build/types/revamp/DynamicFlowRevamp.d.ts +3 -0
  11. package/build/types/revamp/domain/AlertComponent.d.ts +14 -0
  12. package/build/types/revamp/domain/HeadingComponent.d.ts +16 -0
  13. package/build/types/revamp/domain/ParagraphComponent.d.ts +16 -0
  14. package/build/types/revamp/domain/Step.d.ts +9 -0
  15. package/build/types/revamp/domain/types.d.ts +8 -0
  16. package/build/types/revamp/mappers/componentToProps/alertComponentToProps.d.ts +3 -0
  17. package/build/types/revamp/mappers/componentToProps/headingComponentToProps.d.ts +3 -0
  18. package/build/types/revamp/mappers/componentToProps/paragraphComponentToProps.d.ts +3 -0
  19. package/build/types/revamp/mappers/specToDomain/alertLayoutToDomain.d.ts +2 -0
  20. package/build/types/revamp/mappers/specToDomain/headingLayoutToDomain.d.ts +2 -0
  21. package/build/types/revamp/mappers/specToDomain/mapStepToDomain.d.ts +4 -0
  22. package/build/types/revamp/mappers/specToDomain/paragraphLayoutToDomain.d.ts +2 -0
  23. package/build/types/revamp/renderers/neptune/AlertRenderer.d.ts +3 -0
  24. package/build/types/revamp/renderers/neptune/HeadingRenderer.d.ts +3 -0
  25. package/build/types/revamp/renderers/neptune/ParagraphRenderer.d.ts +3 -0
  26. package/build/types/revamp/renderers/neptune/utils/layout-utils.d.ts +7 -0
  27. package/build/types/revamp/renderers/types.d.ts +31 -0
  28. package/build/types/revamp/renderers/utils/renderComponent.d.ts +7 -0
  29. package/build/types/revamp/step/Step.d.ts +8 -0
  30. package/build/types/revamp/stories/utils/fixtureHttpClient.d.ts +2 -0
  31. package/build/types/step/cameraStep/cameraCapture/components/index.d.ts +1 -0
  32. package/build/types/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +2 -0
  33. package/build/types/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.d.ts +13 -0
  34. package/build/types/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +4 -0
  35. package/package.json +26 -26
  36. /package/build/types/step/cameraStep/cameraCapture/hooks/{index.d.ts → useVideoConstraints.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FeatureFlags } from '../../../dynamicFlow/DynamicFlowTypes';
3
+ type FeatureContextProviderProps = {
4
+ featureFlags: FeatureFlags | undefined;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare const FeatureContextProvider: ({ featureFlags, children }: FeatureContextProviderProps) => JSX.Element;
8
+ export declare const useFeatureContext: () => FeatureFlags;
9
+ export {};
@@ -8,3 +8,4 @@ export * from './step-utils';
8
8
  export * from './model-utils';
9
9
  export * from './misc-utils';
10
10
  export * from './schema-utils';
11
+ export * from './mobile-utils';
@@ -0,0 +1,4 @@
1
+ export declare const isMobile: () => boolean;
2
+ export declare const isMobileUA: (userAgent?: string) => boolean;
3
+ export declare const isMobileScreenSize: (width?: number, height?: number) => boolean;
4
+ export declare const isTouchScreen: (navigator?: Navigator, matchMedia?: ((query: string) => MediaQueryList) & typeof matchMedia) => boolean;
@@ -5,6 +5,7 @@ export type DynamicFlowPropsBasic = {
5
5
  flowId: string;
6
6
  loaderConfig?: LoaderConfig;
7
7
  displayStepTitle?: boolean;
8
+ featureFlags?: FeatureFlags;
8
9
  httpClient: HttpClient;
9
10
  onCompletion: (result: Record<string, unknown> | undefined | null) => void;
10
11
  onError: (error: unknown, status?: number) => void;
@@ -44,3 +45,6 @@ export type InitialAction = {
44
45
  method: 'POST';
45
46
  data: Record<string, unknown>;
46
47
  };
48
+ export type FeatureFlags = {
49
+ cameraOrientationLock?: boolean;
50
+ };
@@ -0,0 +1,3 @@
1
+ import { DynamicFlowProps } from '../dynamicFlow/DynamicFlowTypes';
2
+ declare const DynamicFlowRevamp: ({ flowId, httpClient, initialStep, onError, onLog, }: DynamicFlowProps) => JSX.Element;
3
+ export default DynamicFlowRevamp;
@@ -0,0 +1,14 @@
1
+ import { Context, Margin } from '@wise/dynamic-flow-types';
2
+ import { LayoutComponent } from './types';
3
+ export type AlertComponent = LayoutComponent & {
4
+ type: 'alert';
5
+ markdown: string;
6
+ context: Context;
7
+ margin: Margin;
8
+ };
9
+ export declare const createAlertComponent: (alertProps: {
10
+ uid: string;
11
+ markdown: string;
12
+ context: Context;
13
+ margin: Margin;
14
+ }) => AlertComponent;
@@ -0,0 +1,16 @@
1
+ import { Align, Margin, Size } from '@wise/dynamic-flow-types';
2
+ import { LayoutComponent } from './types';
3
+ export type HeadingComponent = LayoutComponent & {
4
+ type: 'heading';
5
+ text: string;
6
+ align: Align;
7
+ margin: Margin;
8
+ size: Size;
9
+ };
10
+ export declare const createHeadingComponent: (headingProps: {
11
+ uid: string;
12
+ text: string;
13
+ align: Align;
14
+ margin: Margin;
15
+ size: Size;
16
+ }) => HeadingComponent;
@@ -0,0 +1,16 @@
1
+ import { Align, Margin } from '@wise/dynamic-flow-types';
2
+ import { LayoutComponent } from './types';
3
+ export type ParagraphComponent = LayoutComponent & {
4
+ type: 'paragraph';
5
+ text: string;
6
+ control?: 'copyable' | string;
7
+ margin: Margin;
8
+ align: Align;
9
+ };
10
+ export declare const createParagraphComponent: (paragraphProps: {
11
+ uid: string;
12
+ text: string;
13
+ control?: 'copyable' | string;
14
+ margin: Margin;
15
+ align: Align;
16
+ }) => ParagraphComponent;
@@ -0,0 +1,9 @@
1
+ import { StepComponent } from './types';
2
+ export type Step = {
3
+ id: string;
4
+ components: StepComponent[];
5
+ };
6
+ export declare const createStep: ({ id, components, }: {
7
+ id: string;
8
+ components: StepComponent[];
9
+ }) => Step;
@@ -0,0 +1,8 @@
1
+ import { AlertComponent } from './AlertComponent';
2
+ import { HeadingComponent } from './HeadingComponent';
3
+ import { ParagraphComponent } from './ParagraphComponent';
4
+ export type StepComponent = AlertComponent | HeadingComponent | ParagraphComponent;
5
+ export type LayoutComponent = {
6
+ type: string;
7
+ uid: string;
8
+ };
@@ -0,0 +1,3 @@
1
+ import { AlertComponent } from '../../domain/AlertComponent';
2
+ import { AlertRendererProps } from '../../renderers/types';
3
+ export declare const alertComponentToProps: ({ uid, markdown, margin, context, }: AlertComponent) => AlertRendererProps;
@@ -0,0 +1,3 @@
1
+ import { HeadingComponent } from '../../domain/HeadingComponent';
2
+ import { HeadingRendererProps } from '../../renderers/types';
3
+ export declare const headingComponentToProps: ({ uid, text, align, margin, size, }: HeadingComponent) => HeadingRendererProps;
@@ -0,0 +1,3 @@
1
+ import { ParagraphComponent } from '../../domain/ParagraphComponent';
2
+ import { ParagraphRendererProps } from '../../renderers/types';
3
+ export declare const paragraphComponentToProps: ({ uid, text, control, align, margin, }: ParagraphComponent) => ParagraphRendererProps;
@@ -0,0 +1,2 @@
1
+ import { AlertLayout } from '@wise/dynamic-flow-types';
2
+ export declare const alertLayoutToDomain: ({ markdown, margin, context }: AlertLayout, uid: string) => import("../../domain/AlertComponent").AlertComponent;
@@ -0,0 +1,2 @@
1
+ import { HeadingLayout } from '@wise/dynamic-flow-types';
2
+ export declare const headingLayoutToDomain: ({ text, size, margin, align }: HeadingLayout, uid: string) => import("../../domain/HeadingComponent").HeadingComponent;
@@ -0,0 +1,4 @@
1
+ import { Step as DFStep } from '@wise/dynamic-flow-types';
2
+ export declare const mapStepToDomain: ({ step }: {
3
+ step: DFStep;
4
+ }) => import("../../domain/Step").Step;
@@ -0,0 +1,2 @@
1
+ import { ParagraphLayout } from '@wise/dynamic-flow-types';
2
+ export declare const paragraphLayoutToDomain: ({ text, control, align, margin }: ParagraphLayout, uid: string) => import("../../domain/ParagraphComponent").ParagraphComponent;
@@ -0,0 +1,3 @@
1
+ import { AlertRendererProps, Renderer } from '../types';
2
+ declare const AlertRenderer: Renderer<AlertRendererProps>;
3
+ export default AlertRenderer;
@@ -0,0 +1,3 @@
1
+ import { HeadingRendererProps, Renderer } from '../types';
2
+ declare const HeadingRenderer: Renderer<HeadingRendererProps>;
3
+ export default HeadingRenderer;
@@ -0,0 +1,3 @@
1
+ import { ParagraphRendererProps, Renderer } from '../types';
2
+ declare const ParagraphRenderer: Renderer<ParagraphRendererProps>;
3
+ export default ParagraphRenderer;
@@ -0,0 +1,7 @@
1
+ import { Align, Size } from '@wise/dynamic-flow-types';
2
+ declare const getTopMargin: (size: Size) => "" | "m-t-0" | "m-t-1" | "m-t-2" | "m-t-3" | "m-t-5";
3
+ declare const getTextAlignmentAndTopMargin: (component: {
4
+ align: Align;
5
+ margin: Size;
6
+ }) => string;
7
+ export { getTopMargin, getTextAlignmentAndTopMargin };
@@ -0,0 +1,31 @@
1
+ import { Align, Context, Margin, Size } from '@wise/dynamic-flow-types';
2
+ import { ReactNode } from 'react';
3
+ export type Renderer<P extends RendererProps> = {
4
+ canRender: (props: RendererProps) => boolean;
5
+ render: (props: P) => ReactNode;
6
+ };
7
+ export interface RendererProps {
8
+ type: string;
9
+ id: string;
10
+ }
11
+ export interface AlertRendererProps extends RendererProps {
12
+ type: 'alert';
13
+ markdown: string;
14
+ context: Context;
15
+ margin: Margin;
16
+ }
17
+ export interface HeadingRendererProps extends RendererProps {
18
+ type: 'heading';
19
+ text: string;
20
+ control?: string;
21
+ align: Align;
22
+ margin: Margin;
23
+ size: Size;
24
+ }
25
+ export interface ParagraphRendererProps extends RendererProps {
26
+ type: 'paragraph';
27
+ text: string;
28
+ control?: 'copyable' | string;
29
+ margin: Margin;
30
+ align: Align;
31
+ }
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ import { StepComponent } from '../../domain/types';
3
+ import { Renderer, RendererProps } from '../types';
4
+ export declare const renderComponent: ({ component, renderers, }: {
5
+ component: StepComponent;
6
+ renderers: Renderer<RendererProps>[];
7
+ }) => ReactNode | ReactNode[];
@@ -0,0 +1,8 @@
1
+ import { Step as DFStep } from '@wise/dynamic-flow-types';
2
+ import { Renderer, RendererProps } from '../renderers/types';
3
+ type StepProps = {
4
+ step: DFStep;
5
+ renderers: Renderer<RendererProps>[];
6
+ };
7
+ declare const Step: ({ step: dfStep, renderers }: StepProps) => JSX.Element;
8
+ export default Step;
@@ -0,0 +1,2 @@
1
+ export declare const getObjectKeys: <T>(object: T) => (keyof T)[];
2
+ export declare const fixtureHttpClient: typeof fetch;
@@ -5,3 +5,4 @@ export declare const ReviewBottomBar: ({ onSubmit, onRetry, }: {
5
5
  onSubmit: () => void;
6
6
  onRetry: () => void;
7
7
  }) => JSX.Element;
8
+ export { default as OrientationLockOverlay } from './orientationLockOverlay/OrientationLockOverlay';
@@ -0,0 +1,2 @@
1
+ declare const OrientationLockOverlay: () => JSX.Element;
2
+ export default OrientationLockOverlay;
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ text: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ imgAlt: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export declare const useFullScreenOrientationLock: (shouldLockOrientation: boolean) => {
2
+ enterFullScreen: () => void;
3
+ exitFullScreen: () => void;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.2.2",
3
+ "version": "2.3.0-beta-923c14.19",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -17,6 +17,25 @@
17
17
  "fullname": "transferwise/dynamic-flow",
18
18
  "url": "git+https://github.com/transferwise/dynamic-flow.git"
19
19
  },
20
+ "scripts": {
21
+ "dev": "storybook dev -p 3003",
22
+ "build": "rm -rf build && npm-run-all build:*",
23
+ "build:types": "tsc --project ./tsconfig.types.json",
24
+ "build:js": "node ./scripts/build.mjs",
25
+ "build:css": "postcss src/main.css -o build/main.css",
26
+ "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",
27
+ "build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
28
+ "test": "npm-run-all test:once test:tz",
29
+ "test:once": "jest --config jest.config.js --env=jsdom -w 2",
30
+ "test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
31
+ "test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
32
+ "test:watch": "pnpm test:once --watch",
33
+ "types": "pnpm tsc",
34
+ "lint": "npm-run-all lint:ts lint:css",
35
+ "lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
36
+ "lint:css": "stylelint './src/**/*.css'",
37
+ "build-storybook": "storybook build -c .storybook"
38
+ },
20
39
  "devDependencies": {
21
40
  "@babel/core": "7.23.2",
22
41
  "@babel/plugin-syntax-flow": "7.22.5",
@@ -52,6 +71,7 @@
52
71
  "@types/testing-library__jest-dom": "5.14.9",
53
72
  "@wise/art": "2.8.4",
54
73
  "@wise/components-theming": "^0.8.4",
74
+ "@wise/dynamic-flow-fixtures": "workspace:*",
55
75
  "babel-jest": "29.7.0",
56
76
  "currency-flags": "4.0.7",
57
77
  "enzyme": "^3.11.0",
@@ -76,8 +96,7 @@
76
96
  "stylelint-no-unsupported-browser-features": "5.0.4",
77
97
  "stylelint-value-no-unknown-custom-properties": "4.0.0",
78
98
  "typescript": "4.9.5",
79
- "webpack": "5.89.0",
80
- "@wise/dynamic-flow-fixtures": "0.0.1"
99
+ "webpack": "5.89.0"
81
100
  },
82
101
  "peerDependencies": {
83
102
  "@transferwise/components": "^43",
@@ -89,29 +108,10 @@
89
108
  "react-intl": "^6"
90
109
  },
91
110
  "dependencies": {
111
+ "@wise/dynamic-flow-types": "workspace:*",
92
112
  "classnames": "2.3.2",
93
113
  "react-webcam": "^7.1.1",
94
- "screenfull": "^5.2.0",
95
- "@wise/dynamic-flow-types": "2.0.1"
114
+ "screenfull": "^5.2.0"
96
115
  },
97
- "prettier": "@transferwise/eslint-config/.prettierrc.js",
98
- "scripts": {
99
- "dev": "storybook dev -p 3003",
100
- "build": "rm -rf build && npm-run-all build:*",
101
- "build:types": "tsc --project ./tsconfig.types.json",
102
- "build:js": "node ./scripts/build.mjs",
103
- "build:css": "postcss src/main.css -o build/main.css",
104
- "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",
105
- "build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
106
- "test": "npm-run-all test:once test:tz",
107
- "test:once": "jest --config jest.config.js --env=jsdom -w 2",
108
- "test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
109
- "test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
110
- "test:watch": "pnpm test:once --watch",
111
- "types": "pnpm tsc",
112
- "lint": "npm-run-all lint:ts lint:css",
113
- "lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
114
- "lint:css": "stylelint './src/**/*.css'",
115
- "build-storybook": "storybook build -c .storybook"
116
- }
117
- }
116
+ "prettier": "@transferwise/eslint-config/.prettierrc.js"
117
+ }