@wise/dynamic-flow-client 0.5.0-beta-ce3986.10 → 0.5.0
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 +17 -22
- package/build/main.js +53 -59
- package/build/main.min.js +3 -3
- package/build/types/common/contexts/httpClientContext/HttpClientContext.d.ts +18 -0
- package/build/types/common/contexts/index.d.ts +1 -1
- package/build/types/common/makeHttpClient/index.d.ts +1 -0
- package/build/types/common/makeHttpClient/makeHttpClient.d.ts +2 -0
- package/build/types/dynamicFlow/DynamicFlowTypes.d.ts +3 -4
- package/build/types/dynamicFlow/stories/fixtureHttpClient.d.ts +2 -0
- package/build/types/dynamicFlow/utils/responseParsers/response-parsers.d.ts +2 -2
- package/build/types/index.d.ts +2 -2
- package/build/types/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +2 -2
- package/package.json +22 -23
- package/build/types/common/contexts/fetcherContexts/FetcherContexts.d.ts +0 -18
- package/build/types/common/makeFetcher/index.d.ts +0 -1
- package/build/types/common/makeFetcher/makeFetcher.d.ts +0 -2
- package/build/types/dynamicFlow/stories/fixtureFetcher.d.ts +0 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type HttpClient = typeof fetch;
|
|
3
|
+
type ProviderProps = {
|
|
4
|
+
httpClient: HttpClient;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const HttpClientProvider: ({ httpClient, children }: ProviderProps) => JSX.Element;
|
|
8
|
+
type ProviderFromBaseUrlProps = {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare const HttpClientProviderFromBaseUrl: ({ baseUrl, children }: ProviderFromBaseUrlProps) => JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Provides the fetch(er) function for dynamic flows asynchronous operations.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useHttpClient: () => typeof fetch;
|
|
17
|
+
export declare const useHasHttpClientProvider: () => boolean;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './makeHttpClient';
|
|
@@ -5,9 +5,8 @@ export type DynamicFlowPropsBasic = {
|
|
|
5
5
|
flowId: string;
|
|
6
6
|
loaderConfig?: LoaderConfig;
|
|
7
7
|
displayStepTitle?: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onStepChange?: (newStep: Step, previousStep: Step | undefined) => void;
|
|
8
|
+
httpClient: HttpClient;
|
|
9
|
+
onCompletion: (result: Record<string, unknown> | undefined | null) => void;
|
|
11
10
|
onError: (error: unknown, status?: number) => void;
|
|
12
11
|
onEvent?: EventHandler;
|
|
13
12
|
onLog?: LogEventHandler;
|
|
@@ -24,7 +23,7 @@ type DynamicFlowPropsWithInitialStep = {
|
|
|
24
23
|
};
|
|
25
24
|
export type DynamicFlowProps = DynamicFlowPropsBasic & (DynamicFlowPropsWithInitialAction | DynamicFlowPropsWithInitialStep);
|
|
26
25
|
export declare function isSchema(schema: FormLayout['schema']): schema is Schema;
|
|
27
|
-
export type
|
|
26
|
+
export type HttpClient = typeof fetch;
|
|
28
27
|
export type ETag = string;
|
|
29
28
|
export type LoaderConfig = {
|
|
30
29
|
size?: Size;
|
|
@@ -2,7 +2,7 @@ import { ActionResponseBody, ErrorResponseBody, Step } from '../../../types';
|
|
|
2
2
|
import { DynamicFlowProps } from '../../DynamicFlowTypes';
|
|
3
3
|
type ParsedBody = {
|
|
4
4
|
type: 'exit';
|
|
5
|
-
result: Parameters<DynamicFlowProps['
|
|
5
|
+
result: Parameters<DynamicFlowProps['onCompletion']>[0];
|
|
6
6
|
} | {
|
|
7
7
|
type: 'action';
|
|
8
8
|
action: ActionResponseBody['action'];
|
|
@@ -13,5 +13,5 @@ type ParsedBody = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const parseFetchResponse: (response: Response) => Promise<ParsedBody>;
|
|
15
15
|
export declare const parseErrorResponse: (response: Response) => Promise<ErrorResponseBody>;
|
|
16
|
-
export declare const parseExitResponse: (response: Response) => Promise<Parameters<DynamicFlowProps['
|
|
16
|
+
export declare const parseExitResponse: (response: Response) => Promise<Parameters<DynamicFlowProps['onCompletion']>[0]>;
|
|
17
17
|
export {};
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { convertStepToLayout, inlineReferences } from './step/layoutStep/utils';
|
|
2
2
|
export { default as DynamicFlow } from './dynamicFlow';
|
|
3
|
-
export {
|
|
3
|
+
export { makeHttpClient } from './common/makeHttpClient';
|
|
4
4
|
export { default as JsonSchemaForm } from './jsonSchemaForm';
|
|
5
5
|
export { DynamicLayout as Layout } from './layout';
|
|
6
6
|
export { isValidSchema } from './common/validators';
|
|
7
7
|
export { fixtures } from './fixtures';
|
|
8
8
|
export { default as translations } from './i18n';
|
|
9
9
|
export * from './dynamicFlow/DynamicFlow';
|
|
10
|
-
export type { DynamicFlowProps } from './dynamicFlow/DynamicFlowTypes';
|
|
10
|
+
export type { DynamicFlowProps, InitialAction } from './dynamicFlow/DynamicFlowTypes';
|
|
11
11
|
export type { Step } from './types';
|
package/build/types/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UploadProps } from '@transferwise/components/build/types/upload/Upload';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpClient } from '../../../dynamicFlow/DynamicFlowTypes';
|
|
3
3
|
import { PersistAsync } from '../../../types';
|
|
4
4
|
type Props = UploadProps & {
|
|
5
5
|
id: string;
|
|
6
|
-
|
|
6
|
+
httpClient: HttpClient;
|
|
7
7
|
fileId: number | string;
|
|
8
8
|
idProperty: string;
|
|
9
9
|
httpOptions: {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "0.5.0
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
|
+
"license": "Apache-2.0",
|
|
5
6
|
"main": "./build/main.min.js",
|
|
6
7
|
"types": "./build/types/index.d.ts",
|
|
7
8
|
"style": "./build/main.css",
|
|
8
|
-
"type": "commonjs",
|
|
9
9
|
"sideEffects": [
|
|
10
10
|
"*.css"
|
|
11
11
|
],
|
|
@@ -17,24 +17,6 @@
|
|
|
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",
|
|
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
|
-
"lint": "npm-run-all lint:ts lint:css",
|
|
34
|
-
"lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
|
|
35
|
-
"lint:css": "stylelint './src/**/*.css'",
|
|
36
|
-
"build-storybook": "storybook build -c .storybook"
|
|
37
|
-
},
|
|
38
20
|
"devDependencies": {
|
|
39
21
|
"@babel/core": "7.20.12",
|
|
40
22
|
"@babel/plugin-syntax-flow": "7.18.6",
|
|
@@ -107,9 +89,26 @@
|
|
|
107
89
|
},
|
|
108
90
|
"dependencies": {
|
|
109
91
|
"classnames": "2.3.2",
|
|
110
|
-
"react-use": "^17.4.0",
|
|
111
92
|
"react-webcam": "^7.0.1",
|
|
112
93
|
"screenfull": "^5.0.2"
|
|
113
94
|
},
|
|
114
|
-
"prettier": "@transferwise/eslint-config/.prettierrc.js"
|
|
115
|
-
|
|
95
|
+
"prettier": "@transferwise/eslint-config/.prettierrc.js",
|
|
96
|
+
"scripts": {
|
|
97
|
+
"dev": "storybook dev -p 3003",
|
|
98
|
+
"build": "rm -rf build && npm-run-all build:*",
|
|
99
|
+
"build:types": "tsc --project ./tsconfig.types.json",
|
|
100
|
+
"build:js": "node ./scripts/build.mjs",
|
|
101
|
+
"build:css": "postcss src/main.css -o build/main.css",
|
|
102
|
+
"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",
|
|
103
|
+
"build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
|
|
104
|
+
"test": "npm-run-all test:once test:tz",
|
|
105
|
+
"test:once": "jest --config jest.config.js --env=jsdom",
|
|
106
|
+
"test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
|
|
107
|
+
"test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
|
|
108
|
+
"test:watch": "pnpm test:once --watch",
|
|
109
|
+
"lint": "npm-run-all lint:ts lint:css",
|
|
110
|
+
"lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
|
|
111
|
+
"lint:css": "stylelint './src/**/*.css'",
|
|
112
|
+
"build-storybook": "storybook build -c .storybook"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Fetcher = typeof fetch;
|
|
3
|
-
type FetcherProviderProps = {
|
|
4
|
-
fetcher: Fetcher;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare const FetcherProvider: ({ fetcher, children }: FetcherProviderProps) => JSX.Element;
|
|
8
|
-
type FetcherProviderFromBaseUrlProps = {
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
export declare const FetcherProviderFromBaseUrl: ({ baseUrl, children, }: FetcherProviderFromBaseUrlProps) => JSX.Element;
|
|
13
|
-
/**
|
|
14
|
-
* Provides the fetch(er) function for dynamic flows asynchronous operations.
|
|
15
|
-
*/
|
|
16
|
-
export declare const useFetcher: () => typeof fetch;
|
|
17
|
-
export declare const useHasFetcherProvider: () => boolean;
|
|
18
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './makeFetcher';
|