@wise/dynamic-flow-client 4.21.0 → 4.21.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.
package/build/main.js CHANGED
@@ -4684,7 +4684,7 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
4684
4684
  // src/revamp/domain/mappers/schema/booleanSchemaToComponent.ts
4685
4685
  var booleanSchemaToComponent = (schemaMapperProps, mapperProps) => {
4686
4686
  const { schema, localValue, model, onPersistAsync } = schemaMapperProps;
4687
- const { default: defaultValue } = schema;
4687
+ const { default: defaultValue, additionalText, inlineAlert, supportingValues } = schema;
4688
4688
  const { updateComponent, onBehavior, onValueChange } = mapperProps;
4689
4689
  const schemaOnChange = getSchemaOnChange(schema, onBehavior);
4690
4690
  const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
@@ -4696,9 +4696,12 @@ var booleanSchemaToComponent = (schemaMapperProps, mapperProps) => {
4696
4696
  const value = onPersistAsync ? validLocalValue : validModel;
4697
4697
  return createBooleanInputComponent(
4698
4698
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
4699
- value: value != null ? value : false,
4700
- validationAsyncState,
4699
+ additionalText,
4700
+ inlineAlert: mapInlineAlert(inlineAlert),
4701
4701
  schemaOnChange,
4702
+ supportingValues,
4703
+ validationAsyncState,
4704
+ value: value != null ? value : false,
4702
4705
  performValidationAsync,
4703
4706
  onValueChange
4704
4707
  }),
@@ -5332,15 +5335,29 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
5332
5335
  }
5333
5336
  const options = schema.oneOf.map((childSchema, index) => {
5334
5337
  var _a2;
5335
- const { title = "", description, image, icon, media, keywords = [], tags } = childSchema;
5338
+ const {
5339
+ title = "",
5340
+ description,
5341
+ image,
5342
+ icon,
5343
+ media,
5344
+ keywords = [],
5345
+ tags,
5346
+ additionalText,
5347
+ inlineAlert,
5348
+ supportingValues
5349
+ } = childSchema;
5336
5350
  return {
5337
5351
  title,
5338
5352
  description,
5339
- media: getDomainLayerMedia({ icon, image, media }),
5353
+ additionalText,
5354
+ analyticsId: (_a2 = childSchema.analyticsId) != null ? _a2 : childSchema.$id,
5355
+ disabled: "disabled" in childSchema ? Boolean(childSchema.disabled) : false,
5356
+ inlineAlert: mapInlineAlert(inlineAlert),
5340
5357
  keywords,
5358
+ media: getDomainLayerMedia({ icon, image, media }),
5359
+ supportingValues,
5341
5360
  tags,
5342
- disabled: "disabled" in childSchema ? Boolean(childSchema.disabled) : false,
5343
- analyticsId: (_a2 = childSchema.analyticsId) != null ? _a2 : childSchema.$id,
5344
5361
  component: mapSchemaToComponent(
5345
5362
  {
5346
5363
  uid: `${uid}.oneOf-${index}`,
@@ -6296,6 +6313,7 @@ var executeSubmission = async (props) => {
6296
6313
  }
6297
6314
  case "modal": {
6298
6315
  assertModalResponseBody(body);
6316
+ trackSubmissionEvent("Action Succeeded", { actionId });
6299
6317
  return { type: "behavior", behavior: __spreadProps(__spreadValues({}, body), { type: "modal" }) };
6300
6318
  }
6301
6319
  default: {
@@ -6926,6 +6944,9 @@ function useDynamicFlowCore(props) {
6926
6944
  updateStep(__spreadProps(__spreadValues({}, command.step), { errors }), command.etag);
6927
6945
  }
6928
6946
  break;
6947
+ case "noop":
6948
+ rootComponentRef.current.setLoadingState("idle");
6949
+ break;
6929
6950
  case "error": {
6930
6951
  closeWithError(
6931
6952
  new Error("Failed to refresh"),
@@ -6934,9 +6955,6 @@ function useDynamicFlowCore(props) {
6934
6955
  );
6935
6956
  break;
6936
6957
  }
6937
- case "noop":
6938
- rootComponentRef.current.setLoadingState("idle");
6939
- break;
6940
6958
  }
6941
6959
  } catch (error) {
6942
6960
  closeWithError(error, void 0);
@@ -7112,6 +7130,9 @@ var inputComponentToProps = (component, type) => {
7112
7130
  var booleanInputComponentToProps = (component, rendererMapperProps) => {
7113
7131
  var _a;
7114
7132
  return __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-checkbox")), rendererMapperProps), {
7133
+ additionalText: component.additionalText,
7134
+ supportingValues: component.supportingValues,
7135
+ inlineAlert: component.inlineAlert,
7115
7136
  value: (_a = component.value) != null ? _a : false,
7116
7137
  onChange: component.onChange.bind(component)
7117
7138
  });
@@ -7995,7 +8016,14 @@ function DynamicFlowCore(props) {
7995
8016
  scrollToTop: (behavior) => {
7996
8017
  var _a2;
7997
8018
  const element = document.querySelector(`div#${normalisedFlowId}.${className}`);
7998
- (_a2 = element == null ? void 0 : element.scrollIntoView) == null ? void 0 : _a2.call(element, { behavior });
8019
+ if (!element || !window) {
8020
+ return;
8021
+ }
8022
+ const rect = element.getBoundingClientRect();
8023
+ const isInView = rect.top >= 0 && rect.top <= window.innerHeight;
8024
+ if (!isInView) {
8025
+ (_a2 = element.scrollIntoView) == null ? void 0 : _a2.call(element, { behavior });
8026
+ }
7999
8027
  }
8000
8028
  }));
8001
8029
  const render = (0, import_react4.useMemo)(
package/build/main.mjs CHANGED
@@ -4641,7 +4641,7 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
4641
4641
  // src/revamp/domain/mappers/schema/booleanSchemaToComponent.ts
4642
4642
  var booleanSchemaToComponent = (schemaMapperProps, mapperProps) => {
4643
4643
  const { schema, localValue, model, onPersistAsync } = schemaMapperProps;
4644
- const { default: defaultValue } = schema;
4644
+ const { default: defaultValue, additionalText, inlineAlert, supportingValues } = schema;
4645
4645
  const { updateComponent, onBehavior, onValueChange } = mapperProps;
4646
4646
  const schemaOnChange = getSchemaOnChange(schema, onBehavior);
4647
4647
  const { performValidationAsync, validationAsyncState } = getValidationAsyncInitialState(
@@ -4653,9 +4653,12 @@ var booleanSchemaToComponent = (schemaMapperProps, mapperProps) => {
4653
4653
  const value = onPersistAsync ? validLocalValue : validModel;
4654
4654
  return createBooleanInputComponent(
4655
4655
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
4656
- value: value != null ? value : false,
4657
- validationAsyncState,
4656
+ additionalText,
4657
+ inlineAlert: mapInlineAlert(inlineAlert),
4658
4658
  schemaOnChange,
4659
+ supportingValues,
4660
+ validationAsyncState,
4661
+ value: value != null ? value : false,
4659
4662
  performValidationAsync,
4660
4663
  onValueChange
4661
4664
  }),
@@ -5289,15 +5292,29 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
5289
5292
  }
5290
5293
  const options = schema.oneOf.map((childSchema, index) => {
5291
5294
  var _a2;
5292
- const { title = "", description, image, icon, media, keywords = [], tags } = childSchema;
5295
+ const {
5296
+ title = "",
5297
+ description,
5298
+ image,
5299
+ icon,
5300
+ media,
5301
+ keywords = [],
5302
+ tags,
5303
+ additionalText,
5304
+ inlineAlert,
5305
+ supportingValues
5306
+ } = childSchema;
5293
5307
  return {
5294
5308
  title,
5295
5309
  description,
5296
- media: getDomainLayerMedia({ icon, image, media }),
5310
+ additionalText,
5311
+ analyticsId: (_a2 = childSchema.analyticsId) != null ? _a2 : childSchema.$id,
5312
+ disabled: "disabled" in childSchema ? Boolean(childSchema.disabled) : false,
5313
+ inlineAlert: mapInlineAlert(inlineAlert),
5297
5314
  keywords,
5315
+ media: getDomainLayerMedia({ icon, image, media }),
5316
+ supportingValues,
5298
5317
  tags,
5299
- disabled: "disabled" in childSchema ? Boolean(childSchema.disabled) : false,
5300
- analyticsId: (_a2 = childSchema.analyticsId) != null ? _a2 : childSchema.$id,
5301
5318
  component: mapSchemaToComponent(
5302
5319
  {
5303
5320
  uid: `${uid}.oneOf-${index}`,
@@ -6253,6 +6270,7 @@ var executeSubmission = async (props) => {
6253
6270
  }
6254
6271
  case "modal": {
6255
6272
  assertModalResponseBody(body);
6273
+ trackSubmissionEvent("Action Succeeded", { actionId });
6256
6274
  return { type: "behavior", behavior: __spreadProps(__spreadValues({}, body), { type: "modal" }) };
6257
6275
  }
6258
6276
  default: {
@@ -6883,6 +6901,9 @@ function useDynamicFlowCore(props) {
6883
6901
  updateStep(__spreadProps(__spreadValues({}, command.step), { errors }), command.etag);
6884
6902
  }
6885
6903
  break;
6904
+ case "noop":
6905
+ rootComponentRef.current.setLoadingState("idle");
6906
+ break;
6886
6907
  case "error": {
6887
6908
  closeWithError(
6888
6909
  new Error("Failed to refresh"),
@@ -6891,9 +6912,6 @@ function useDynamicFlowCore(props) {
6891
6912
  );
6892
6913
  break;
6893
6914
  }
6894
- case "noop":
6895
- rootComponentRef.current.setLoadingState("idle");
6896
- break;
6897
6915
  }
6898
6916
  } catch (error) {
6899
6917
  closeWithError(error, void 0);
@@ -7069,6 +7087,9 @@ var inputComponentToProps = (component, type) => {
7069
7087
  var booleanInputComponentToProps = (component, rendererMapperProps) => {
7070
7088
  var _a;
7071
7089
  return __spreadProps(__spreadValues(__spreadValues({}, inputComponentToProps(component, "input-checkbox")), rendererMapperProps), {
7090
+ additionalText: component.additionalText,
7091
+ supportingValues: component.supportingValues,
7092
+ inlineAlert: component.inlineAlert,
7072
7093
  value: (_a = component.value) != null ? _a : false,
7073
7094
  onChange: component.onChange.bind(component)
7074
7095
  });
@@ -7952,7 +7973,14 @@ function DynamicFlowCore(props) {
7952
7973
  scrollToTop: (behavior) => {
7953
7974
  var _a2;
7954
7975
  const element = document.querySelector(`div#${normalisedFlowId}.${className}`);
7955
- (_a2 = element == null ? void 0 : element.scrollIntoView) == null ? void 0 : _a2.call(element, { behavior });
7976
+ if (!element || !window) {
7977
+ return;
7978
+ }
7979
+ const rect = element.getBoundingClientRect();
7980
+ const isInView = rect.top >= 0 && rect.top <= window.innerHeight;
7981
+ if (!isInView) {
7982
+ (_a2 = element.scrollIntoView) == null ? void 0 : _a2.call(element, { behavior });
7983
+ }
7956
7984
  }
7957
7985
  }));
7958
7986
  const render = useMemo2(
@@ -1,13 +1,16 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
3
- import type { BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
3
+ import type { BaseInputComponent, InlineAlert, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState, SupportingValues } from '../types';
4
4
  export type BooleanInputComponent = BaseInputComponent<boolean> & {
5
5
  type: 'boolean';
6
6
  kind: 'input';
7
+ additionalText?: string;
8
+ inlineAlert?: InlineAlert;
9
+ supportingValues?: SupportingValues;
7
10
  validationAsyncState: ValidationAsyncState;
8
11
  onChange: (value: boolean) => void;
9
12
  };
10
- export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "uid" | "id" | "analyticsId" | "alert" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "media" | "required" | "title" | "tags" | "value" | "validationAsyncState"> & {
13
+ export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "uid" | "id" | "additionalText" | "analyticsId" | "alert" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "inlineAlert" | "media" | "required" | "supportingValues" | "title" | "tags" | "value" | "validationAsyncState"> & {
11
14
  schemaOnChange: SchemaOnChange | undefined;
12
15
  performValidationAsync: PerformValidationAsync | undefined;
13
16
  summariser: (value: boolean) => RepeatableSummary;
@@ -1,6 +1,7 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { AnalyticsEventDispatcher } from '../features/events';
3
3
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
4
+ import type { InlineAlert, SupportingValues } from '../types';
4
5
  import type { IsInvalidCheck } from '../features/validation/value-checks';
5
6
  import type { BaseInputComponent, LocalValue, Media, OnValueChange, RepeatableSummary, SchemaComponent, UpdateComponent } from '../types';
6
7
  export type SelectInputComponent = BaseInputComponent<LocalValue | null> & {
@@ -15,13 +16,16 @@ export type SelectInputComponent = BaseInputComponent<LocalValue | null> & {
15
16
  getSelectedChild: () => SchemaComponent | null;
16
17
  };
17
18
  export type SelectInputOption = {
19
+ additionalText?: string;
18
20
  analyticsId?: string;
19
- title: string;
20
21
  description?: string;
21
- media?: Media;
22
- keywords: string[];
23
22
  disabled: boolean;
23
+ inlineAlert?: InlineAlert;
24
+ keywords: string[];
25
+ media?: Media;
26
+ supportingValues?: SupportingValues;
24
27
  tags?: string[];
28
+ title: string;
25
29
  };
26
30
  export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "uid" | "id" | "analyticsId" | "alert" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "placeholder" | "required" | "title" | "tags"> & {
27
31
  initialModel: Model;
@@ -82,6 +82,9 @@ export declare const oneOfSchemaToComponent: (schemaMapperProps: SchemaMapperPro
82
82
  } & {
83
83
  type: "boolean";
84
84
  kind: "input";
85
+ additionalText?: string;
86
+ inlineAlert?: import("../../../types").InlineAlert;
87
+ supportingValues?: import("../../../types").SupportingValues;
85
88
  validationAsyncState: import("../../../types").ValidationAsyncState;
86
89
  onChange: (value: boolean) => void;
87
90
  } & {
@@ -56,6 +56,9 @@ export declare const persistAsyncSchemaToComponent: (schemaMapperProps: SchemaMa
56
56
  } & {
57
57
  type: "boolean";
58
58
  kind: "input";
59
+ additionalText?: string;
60
+ inlineAlert?: import("../../types").InlineAlert;
61
+ supportingValues?: import("../../types").SupportingValues;
59
62
  validationAsyncState: import("../../types").ValidationAsyncState;
60
63
  onChange: (value: boolean) => void;
61
64
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.21.0",
3
+ "version": "4.21.1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -52,7 +52,7 @@
52
52
  "@transferwise/navigation-ui": "4.40.0",
53
53
  "@transferwise/neptune-css": "14.25.1",
54
54
  "@types/jest": "30.0.0",
55
- "@types/node": "22.18.13",
55
+ "@types/node": "22.19.0",
56
56
  "@types/react": "18.3.26",
57
57
  "@types/react-dom": "18.3.7",
58
58
  "@types/react-intl": "3.0.0",
@@ -97,7 +97,7 @@
97
97
  "classnames": "2.5.1",
98
98
  "react-webcam": "^7.2.0",
99
99
  "screenfull": "^5.2.0",
100
- "@wise/dynamic-flow-types": "3.18.0"
100
+ "@wise/dynamic-flow-types": "3.19.0"
101
101
  },
102
102
  "scripts": {
103
103
  "dev": "EXCLUDE_VISUAL_TESTS=true pnpm storybook dev -p 3003",