@wise/dynamic-flow-client 1.0.1 → 1.1.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export type LogLevel = 'debug' | 'info' | 'warning' | 'error' | 'critical';
3
- export type LogTitle = 'Invalid schema or model' | 'Invalid model on change' | 'Invalid response' | 'Action supressed' | 'Deprecation advanced warning' | 'Deprecated schema' | 'Error fetching';
3
+ export type LogTitle = 'Invalid schema or model' | 'Invalid model on change' | 'Invalid response' | 'Action supressed' | 'Deprecation warning' | 'Deprecated schema' | 'Error fetching';
4
4
  type ExtraProps = Record<string, unknown>;
5
5
  export type LogEventHandler = (level: LogLevel, message: string, extra: ExtraProps) => void;
6
6
  type LogFunction = (title: LogTitle, description: string, extra?: ExtraProps) => void;
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;
@@ -4,6 +4,8 @@ export { default as button } from './button';
4
4
  export { default as columns } from './columns';
5
5
  export { default as copyable } from './copyable';
6
6
  export { default as decision } from './decision';
7
+ export { default as decisionFlags } from './decision-flags';
8
+ export { default as decisionIcons } from './decision-icons';
7
9
  export { default as heading } from './heading';
8
10
  export { default as image } from './image';
9
11
  export { default as info } from './info';
@@ -26,6 +26,8 @@ export declare const fixtures: {
26
26
  columns: import("../types").FormStep;
27
27
  copyable: import("../types").FormStep;
28
28
  decision: import("../types").FormStep;
29
+ decisionFlags: import("../types").FormStep;
30
+ decisionIcons: import("../types").FormStep;
29
31
  heading: import("../types").FormStep;
30
32
  image: import("../types").FormStep;
31
33
  info: import("../types").FormStep;
@@ -1,6 +1,7 @@
1
1
  import { FormControlType } from '../../common/constants';
2
+ import { useLogger } from '../../common/contexts';
2
3
  import { BasicModel, Schema } from '../../types';
3
- export declare const getControlType: (schema: Schema) => (typeof FormControlType)[keyof typeof FormControlType] | undefined;
4
+ export declare const getControlType: (schema: Schema, log: ReturnType<typeof useLogger>) => (typeof FormControlType)[keyof typeof FormControlType] | undefined;
4
5
  declare const SchemaFormControl: {
5
6
  (props: SchemaFormControlProps): JSX.Element;
6
7
  defaultProps: {
@@ -1,13 +1,13 @@
1
1
  import { Icon, Image, Schema } from '../../../types';
2
- export declare const mapConstSchemaToOption: (schema: Schema, controlType?: string) => RadioOption | SelectOption;
3
- export type RadioOption = {
2
+ declare const mapConstSchemaToOption: <ControlType extends string>(schema: Schema, controlType?: ControlType | undefined) => ControlType extends "select" ? SelectOption : RadioOption;
3
+ type RadioOption = {
4
4
  disabled?: boolean | undefined;
5
5
  avatar?: JSX.Element | undefined;
6
6
  currency?: string | undefined;
7
7
  label: string;
8
8
  value: string;
9
9
  };
10
- export type SelectOption = {
10
+ type SelectOption = {
11
11
  searchStrings?: string[];
12
12
  disabled?: boolean | undefined;
13
13
  icon?: JSX.Element | undefined;
@@ -15,20 +15,16 @@ export type SelectOption = {
15
15
  label: string;
16
16
  value: string;
17
17
  };
18
- export declare const mapImage: (image?: Image) => {
19
- icon: JSX.Element;
20
- } | null;
21
- export declare const mapIcon: (icon?: Icon) => {
22
- icon: JSX.Element;
23
- } | null;
24
- export declare const mapIconToAvatar: (icon?: Icon) => {
25
- avatar: JSX.Element;
26
- } | null;
27
- export declare const mapAvatar: (image?: Image) => {
18
+ declare const getAvatarPropertyForRadioOption: ({ image, icon }: {
19
+ image?: Image | undefined;
20
+ icon?: Icon | undefined;
21
+ }) => {
28
22
  avatar: JSX.Element;
29
23
  } | null;
30
- export declare const mapSchemaToUploadOptions: ({ accepts }: {
24
+ declare const mapSchemaToUploadOptions: ({ accepts }: {
31
25
  accepts?: string[] | undefined;
32
26
  }) => {
33
27
  usAccept?: string | undefined;
34
28
  };
29
+ export { mapConstSchemaToOption, getAvatarPropertyForRadioOption, mapSchemaToUploadOptions };
30
+ export type { RadioOption, SelectOption };
@@ -1,6 +1,6 @@
1
- type Props = {
1
+ export type Props = {
2
2
  type: string;
3
3
  };
4
- declare const DynamicIcon: ({ type }: Props) => JSX.Element;
4
+ declare const DynamicIcon: ({ type }: Props) => JSX.Element | null;
5
5
  export declare function isValidIconName(name: string): boolean;
6
6
  export default DynamicIcon;
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ name: string;
3
+ };
4
+ export declare const isFlagIcon: (name: string) => boolean;
5
+ export declare const FlagIcon: ({ name }: Props) => JSX.Element | null;
6
+ export declare const availableCurrencyFlags: string[];
7
+ export {};
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ name: string;
3
+ };
4
+ export declare const isNamedIcon: (name: string) => boolean;
5
+ export declare const NamedIcon: ({ name }: Props) => JSX.Element | null;
6
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -102,7 +102,7 @@
102
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
103
  "build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
104
104
  "test": "npm-run-all test:once test:tz",
105
- "test:once": "jest --config jest.config.js --env=jsdom",
105
+ "test:once": "jest --config jest.config.js --env=jsdom -w 2",
106
106
  "test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
107
107
  "test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
108
108
  "test:watch": "pnpm test:once --watch",
@@ -1,4 +0,0 @@
1
- declare const EditableDynamicFlow: ({ initialStepName }: {
2
- initialStepName?: string | undefined;
3
- }) => JSX.Element;
4
- export default EditableDynamicFlow;
@@ -1,3 +0,0 @@
1
- export declare function getCurrencyFlag(iconName?: string): {
2
- currency: string;
3
- } | null;