@wise/dynamic-flow-client 2.1.5 → 2.2.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/build/main.js CHANGED
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b ||= {})
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
8
  var __commonJS = (cb, mod) => function __require() {
26
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
10
  };
@@ -50,6 +33,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
50
33
  // ../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js
51
34
  var require_classnames = __commonJS({
52
35
  "../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"(exports, module2) {
36
+ "use strict";
53
37
  (function() {
54
38
  "use strict";
55
39
  var hasOwn = {}.hasOwnProperty;
@@ -98,9 +82,10 @@ var require_classnames = __commonJS({
98
82
  }
99
83
  });
100
84
 
101
- // ../../node_modules/.pnpm/react-webcam@7.0.1_biqbaboplfbrettd7655fr4n2y/node_modules/react-webcam/dist/react-webcam.js
85
+ // ../../node_modules/.pnpm/react-webcam@7.1.1_biqbaboplfbrettd7655fr4n2y/node_modules/react-webcam/dist/react-webcam.js
102
86
  var require_react_webcam = __commonJS({
103
- "../../node_modules/.pnpm/react-webcam@7.0.1_biqbaboplfbrettd7655fr4n2y/node_modules/react-webcam/dist/react-webcam.js"(exports, module2) {
87
+ "../../node_modules/.pnpm/react-webcam@7.1.1_biqbaboplfbrettd7655fr4n2y/node_modules/react-webcam/dist/react-webcam.js"(exports, module2) {
88
+ "use strict";
104
89
  (function webpackUniversalModuleDefinition(root, factory) {
105
90
  if (typeof exports === "object" && typeof module2 === "object")
106
91
  module2.exports = factory(require("react"));
@@ -373,6 +358,8 @@ var require_react_webcam = __commonJS({
373
358
  }
374
359
  var _b = this, ctx = _b.ctx, canvas = _b.canvas;
375
360
  if (ctx && canvas) {
361
+ canvas.width = (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.width) || canvas.width;
362
+ canvas.height = (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.height) || canvas.height;
376
363
  if (props.mirrored) {
377
364
  ctx.translate(canvas.width, 0);
378
365
  ctx.scale(-1, 1);
@@ -611,7 +598,7 @@ function convertFinalStepToDynamicLayout(step) {
611
598
  }
612
599
  if (step.actions) {
613
600
  const actions = step.actions.map(
614
- (action) => convertStepActionToDynamicAction(__spreadProps(__spreadValues({}, action), { type: action.type || "primary" }))
601
+ (action) => convertStepActionToDynamicAction({ ...action, type: action.type || "primary" })
615
602
  );
616
603
  layout.push(dynamicBox(actions, "md"));
617
604
  }
@@ -687,7 +674,7 @@ function convertFinalStepImageToDynamicImage(image) {
687
674
  } : convertStepImageToDynamicImage(image);
688
675
  }
689
676
  function convertStepActionToDynamicAction(action) {
690
- const newAction = __spreadProps(__spreadValues({}, action), { title: action.title });
677
+ const newAction = { ...action, title: action.title };
691
678
  return {
692
679
  type: "button",
693
680
  action: newAction
@@ -781,7 +768,7 @@ function inlineFormSchema({
781
768
  };
782
769
  }
783
770
  if (formComponent.schema && !isReference(formComponent.schema)) {
784
- return __spreadValues({}, formComponent);
771
+ return { ...formComponent };
785
772
  }
786
773
  throw new Error('Invalid form layout component. Missing "schema" or "schemaId" properties.');
787
774
  }
@@ -789,22 +776,22 @@ function inlineDecisionActions({
789
776
  decisionComponent,
790
777
  actions
791
778
  }) {
792
- var _a;
793
- const newOptions = (_a = decisionComponent == null ? void 0 : decisionComponent.options) == null ? void 0 : _a.map((option) => {
794
- return option.action && isReference(option.action) ? __spreadProps(__spreadValues({}, option), {
779
+ const newOptions = decisionComponent?.options?.map((option) => {
780
+ return option.action && isReference(option.action) ? {
781
+ ...option,
795
782
  action: getActionById(actions, option.action.$ref)
796
- }) : option;
783
+ } : option;
797
784
  });
798
- return __spreadProps(__spreadValues({}, decisionComponent), {
785
+ return {
786
+ ...decisionComponent,
799
787
  options: newOptions
800
- });
788
+ };
801
789
  }
802
790
  function inlineAction({
803
791
  actionComponent,
804
792
  actions
805
793
  }) {
806
- var _a;
807
- if (actionComponent.action && isReference(actionComponent.action) && ((_a = actionComponent.action) == null ? void 0 : _a.$ref)) {
794
+ if (actionComponent.action && isReference(actionComponent.action) && actionComponent.action?.$ref) {
808
795
  const newAction = getActionById(actions, actionComponent.action.$ref);
809
796
  return convertStepActionToDynamicAction(newAction);
810
797
  }
@@ -816,9 +803,10 @@ function inlineBoxReferences({
816
803
  actions,
817
804
  model
818
805
  }) {
819
- return __spreadProps(__spreadValues({}, boxComponent), {
806
+ return {
807
+ ...boxComponent,
820
808
  components: inlineReferences({ layout: boxComponent.components, schemas, actions, model })
821
- });
809
+ };
822
810
  }
823
811
  function inlineColumnsReferences({
824
812
  columnsComponent,
@@ -826,10 +814,11 @@ function inlineColumnsReferences({
826
814
  actions,
827
815
  model
828
816
  }) {
829
- return __spreadProps(__spreadValues({}, columnsComponent), {
817
+ return {
818
+ ...columnsComponent,
830
819
  left: inlineReferences({ layout: columnsComponent.left, schemas, actions, model }),
831
820
  right: inlineReferences({ layout: columnsComponent.right, schemas, actions, model })
832
- });
821
+ };
833
822
  }
834
823
  function getSchemaById(schemas, id) {
835
824
  const schema = schemas.find((schema2) => schema2.$id === id);
@@ -916,8 +905,8 @@ function useEventDispatcher() {
916
905
  }
917
906
  var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) => {
918
907
  try {
919
- onEvent(eventName, __spreadValues(__spreadValues({}, metadata), properties));
920
- } catch (e) {
908
+ onEvent(eventName, { ...metadata, ...properties });
909
+ } catch {
921
910
  }
922
911
  };
923
912
 
@@ -940,8 +929,8 @@ function isRelativePath(url = "") {
940
929
  // src/common/makeHttpClient/makeHttpClient.ts
941
930
  var makeHttpClient = (baseUrl, additionalHeaders) => (input, init) => {
942
931
  const resource = applyBaseUrl(input, baseUrl || "");
943
- const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
944
- return fetch(resource, __spreadProps(__spreadValues({}, init || {}), { headers: headers2 }));
932
+ const headers2 = mergeHeaders(init?.headers, additionalHeaders);
933
+ return fetch(resource, { ...init || {}, headers: headers2 });
945
934
  };
946
935
  var applyBaseUrl = (input, baseUrl) => {
947
936
  return typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
@@ -981,11 +970,12 @@ var import_react5 = require("react");
981
970
  var import_jsx_runtime4 = require("react/jsx-runtime");
982
971
  var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
983
972
  try {
984
- onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
973
+ onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, {
985
974
  flowId,
986
- stepId
987
- }, extra));
988
- } catch (e) {
975
+ stepId,
976
+ ...extra
977
+ });
978
+ } catch {
989
979
  }
990
980
  };
991
981
  var LogContext = (0, import_react5.createContext)(null);
@@ -1019,7 +1009,7 @@ var isInteger = (value) => {
1019
1009
  return isNumber(value) && Math.floor(value) === value;
1020
1010
  };
1021
1011
  var isBoolean = (value) => typeof value === "boolean";
1022
- var isObject = (value) => !isNull(value) && !isUndefined(value) && (value == null ? void 0 : value.constructor) === Object;
1012
+ var isObject = (value) => !isNull(value) && !isUndefined(value) && value?.constructor === Object;
1023
1013
  var isArray = (value) => Array.isArray(value);
1024
1014
  var isNull = (value) => value === null;
1025
1015
  var isUndefined = (value) => typeof value === "undefined";
@@ -1034,12 +1024,11 @@ function cleanBasicModelWithOneOfSchema(model, schema) {
1034
1024
  ) ? model : null;
1035
1025
  }
1036
1026
  function cleanArrayModelWithOneOfSchema(model, schema) {
1037
- var _a;
1038
1027
  const validModels = schema.oneOf.map((nestedSchema) => getValidArrayModelOrNull(model, nestedSchema)).filter((item) => item !== null);
1039
1028
  if (validModels.length === 0) {
1040
1029
  return null;
1041
1030
  }
1042
- return (_a = validModels.find((model2) => model2.some((item) => item !== null))) != null ? _a : validModels[0];
1031
+ return validModels.find((model2) => model2.some((item) => item !== null)) ?? validModels[0];
1043
1032
  }
1044
1033
  function getValidArrayModelOrNull(model, schema) {
1045
1034
  if (!isArraySchema(schema)) {
@@ -1081,7 +1070,7 @@ function cleanObjectModelWithObjectSchema(model, schema) {
1081
1070
  const subSchema = schema.properties[property];
1082
1071
  const newValue = getValidModelParts(subModel, subSchema);
1083
1072
  if (!isNull(newValue)) {
1084
- return __spreadProps(__spreadValues({}, cleanedModel), { [property]: newValue });
1073
+ return { ...cleanedModel, [property]: newValue };
1085
1074
  }
1086
1075
  }
1087
1076
  return cleanedModel;
@@ -1091,7 +1080,7 @@ function cleanObjectModelWithAllOfSchema(model, schema) {
1091
1080
  return schema.allOf.reduce((cleanObjectModel, nestedSchema) => {
1092
1081
  const validSubsetOfModel = getValidObjectModelParts(model, nestedSchema);
1093
1082
  if (isObjectModel(validSubsetOfModel)) {
1094
- return __spreadValues(__spreadValues({}, cleanObjectModel), validSubsetOfModel);
1083
+ return { ...cleanObjectModel, ...validSubsetOfModel };
1095
1084
  }
1096
1085
  return cleanObjectModel;
1097
1086
  }, {});
@@ -1116,15 +1105,17 @@ function deepMergeObject(object1, object2) {
1116
1105
  const object1Property = object1[property];
1117
1106
  const object2Property = object2[property];
1118
1107
  if (isObjectModel(object1Property) && isObjectModel(object2Property)) {
1119
- return __spreadProps(__spreadValues({}, acc), {
1108
+ return {
1109
+ ...acc,
1120
1110
  [property]: deepMergeObject(object1Property, object2Property)
1121
- });
1111
+ };
1122
1112
  }
1123
- return __spreadProps(__spreadValues({}, acc), {
1113
+ return {
1114
+ ...acc,
1124
1115
  [property]: object2[property]
1125
- });
1116
+ };
1126
1117
  },
1127
- __spreadValues({}, object1)
1118
+ { ...object1 }
1128
1119
  );
1129
1120
  }
1130
1121
 
@@ -1539,7 +1530,7 @@ var toBase64 = (file) => {
1539
1530
  };
1540
1531
  function areFilesSame(newFiles, files) {
1541
1532
  const fileIdToExistingFileMap = files.reduce((map, fileObject) => {
1542
- return __spreadProps(__spreadValues({}, map), { [fileObject.id]: fileObject });
1533
+ return { ...map, [fileObject.id]: fileObject };
1543
1534
  }, {});
1544
1535
  for (const newFile of newFiles) {
1545
1536
  const existingFileObject = fileIdToExistingFileMap[newFile.id];
@@ -1562,7 +1553,7 @@ var generateRandomId = (prefix = "") => {
1562
1553
 
1563
1554
  // src/common/utils/schema-utils.ts
1564
1555
  function isConstSchema(schema) {
1565
- return !isUndefined(schema == null ? void 0 : schema.const);
1556
+ return !isUndefined(schema?.const);
1566
1557
  }
1567
1558
  function isNoNConstSchema(schema) {
1568
1559
  return !!schema && !isConstSchema(schema);
@@ -1652,16 +1643,13 @@ var isCameraStep = (step) => {
1652
1643
  return isFormStep(step) && hasSingleAction(step) && hasSingleFileUploadSchemaWithCameraOnly(step);
1653
1644
  };
1654
1645
  var isFormStep = (step) => !step.type || step.type === "form";
1655
- var hasSingleAction = (step) => {
1656
- var _a;
1657
- return ((_a = step == null ? void 0 : step.actions) == null ? void 0 : _a.length) === 1;
1658
- };
1646
+ var hasSingleAction = (step) => step?.actions?.length === 1;
1659
1647
  var hasSingleFileUploadSchemaWithCameraOnly = (step) => {
1660
1648
  if (!step.schemas) {
1661
1649
  return false;
1662
1650
  }
1663
1651
  const schemas = filterHiddenSchemas(step.schemas);
1664
- if ((schemas == null ? void 0 : schemas.length) !== 1) {
1652
+ if (schemas?.length !== 1) {
1665
1653
  return false;
1666
1654
  }
1667
1655
  const firstSchema = schemas[0];
@@ -1677,9 +1665,9 @@ var hasSingleFileUploadSchemaWithCameraOnly = (step) => {
1677
1665
  var filterHiddenSchemas = (schemas) => {
1678
1666
  return schemas.filter((schema) => {
1679
1667
  if (isObjectSchema(schema)) {
1680
- return Object.values((schema == null ? void 0 : schema.properties) || {}).find((schema2) => (schema2 == null ? void 0 : schema2.hidden) !== true);
1668
+ return Object.values(schema?.properties || {}).find((schema2) => schema2?.hidden !== true);
1681
1669
  }
1682
- return (schema == null ? void 0 : schema.hidden) !== true;
1670
+ return schema?.hidden !== true;
1683
1671
  });
1684
1672
  };
1685
1673
 
@@ -1742,7 +1730,7 @@ function useExternalStepPolling(polling, onAction) {
1742
1730
  if (response.ok) {
1743
1731
  try {
1744
1732
  return response.json();
1745
- } catch (e) {
1733
+ } catch {
1746
1734
  throw new Error("failed");
1747
1735
  }
1748
1736
  } else {
@@ -1756,30 +1744,30 @@ function useExternalStepPolling(polling, onAction) {
1756
1744
  }, [polling, httpClient]);
1757
1745
  const onPollingResponse = (0, import_react8.useCallback)(
1758
1746
  (pollingResponse) => {
1759
- const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
1747
+ const responseHandlers = polling?.responseHandlers || [];
1760
1748
  const responseHandler = responseHandlers.find(
1761
1749
  (handler) => handler.result === pollingResponse.result
1762
1750
  );
1763
- if (responseHandler == null ? void 0 : responseHandler.action) {
1751
+ if (responseHandler?.action) {
1764
1752
  const { action } = responseHandler;
1765
1753
  if (action.exit) {
1766
- const mergedResult = __spreadValues(__spreadValues({}, action.result || {}), pollingResponse.data || {});
1767
- onAction(__spreadProps(__spreadValues({}, action), { result: mergedResult }));
1754
+ const mergedResult = { ...action.result || {}, ...pollingResponse.data || {} };
1755
+ onAction({ ...action, result: mergedResult });
1768
1756
  } else {
1769
- const mergedData = __spreadValues(__spreadValues({}, action.data || {}), pollingResponse.data || {});
1770
- onAction(__spreadProps(__spreadValues({}, action), { data: mergedData }));
1757
+ const mergedData = { ...action.data || {}, ...pollingResponse.data || {} };
1758
+ onAction({ ...action, data: mergedData });
1771
1759
  }
1772
1760
  return false;
1773
1761
  }
1774
1762
  return true;
1775
1763
  },
1776
- [polling == null ? void 0 : polling.responseHandlers, onAction]
1764
+ [polling?.responseHandlers, onAction]
1777
1765
  );
1778
1766
  usePolling({
1779
1767
  asyncFn,
1780
- interval: (polling == null ? void 0 : polling.interval) || 0,
1781
- maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
1782
- maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
1768
+ interval: polling?.interval || 0,
1769
+ maxAttempts: polling?.maxAttempts || 0,
1770
+ maxConsecutiveFails: polling?.maxConsecutiveFails || 0,
1783
1771
  onPollingResponse,
1784
1772
  onFailure: (0, import_react8.useCallback)(() => {
1785
1773
  if (polling) {
@@ -2075,10 +2063,7 @@ var NamedIcon = ({ name }) => {
2075
2063
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size: 24 });
2076
2064
  };
2077
2065
  var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
2078
- var capitaliseFirstChar = (value) => {
2079
- var _a;
2080
- return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
2081
- };
2066
+ var capitaliseFirstChar = (value) => `${value[0]?.toUpperCase()}${value.slice(1)}`;
2082
2067
 
2083
2068
  // src/layout/icon/DynamicIcon.tsx
2084
2069
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -2099,13 +2084,13 @@ var DynamicIcon_default = DynamicIcon;
2099
2084
  // src/layout/utils/getNavigationOptionMedia.tsx
2100
2085
  var import_jsx_runtime8 = require("react/jsx-runtime");
2101
2086
  var getNavigationOptionMedia = ({ icon, image }) => {
2102
- if (icon == null ? void 0 : icon.name) {
2087
+ if (icon?.name) {
2103
2088
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components.Avatar, { type: import_components.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicIcon_default, { type: icon.name }) });
2104
2089
  }
2105
- if (icon == null ? void 0 : icon.text) {
2090
+ if (icon?.text) {
2106
2091
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components.Avatar, { type: import_components.AvatarType.INITIALS, children: icon.text });
2107
2092
  }
2108
- if (image == null ? void 0 : image.url) {
2093
+ if (image?.url) {
2109
2094
  const { url, text } = image;
2110
2095
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: url, alt: text });
2111
2096
  }
@@ -2242,9 +2227,8 @@ var priorities = {
2242
2227
  negative: "primary"
2243
2228
  };
2244
2229
  var getButtonPriority = (component) => {
2245
- var _a;
2246
2230
  const actionType = component.action.type;
2247
- return (_a = component.control) != null ? _a : actionType ? priorities[actionType] : "secondary";
2231
+ return component.control ?? (actionType ? priorities[actionType] : "secondary");
2248
2232
  };
2249
2233
  var types = {
2250
2234
  primary: "neutral",
@@ -2254,9 +2238,8 @@ var types = {
2254
2238
  negative: "negative"
2255
2239
  };
2256
2240
  var getButtonType = (component) => {
2257
- var _a;
2258
2241
  const actionType = component.action.type;
2259
- const type = (_a = component.context) != null ? _a : actionType ? types[actionType] : "neutral";
2242
+ const type = component.context ?? (actionType ? types[actionType] : "neutral");
2260
2243
  return type === "neutral" ? "accent" : type;
2261
2244
  };
2262
2245
  var getButtonSize = (size) => {
@@ -2276,7 +2259,6 @@ var getButtonSize = (size) => {
2276
2259
  // src/layout/button/DynamicButton.tsx
2277
2260
  var import_jsx_runtime11 = require("react/jsx-runtime");
2278
2261
  var DynamicButton = (props) => {
2279
- var _a;
2280
2262
  const { component, onAction } = props;
2281
2263
  const componentAction = component.action;
2282
2264
  const type = getButtonType(component);
@@ -2293,7 +2275,7 @@ var DynamicButton = (props) => {
2293
2275
  className,
2294
2276
  disabled: component.disabled || componentAction.disabled || loading,
2295
2277
  onClick: () => onAction(componentAction),
2296
- children: (_a = component.title) != null ? _a : componentAction.title
2278
+ children: component.title ?? componentAction.title
2297
2279
  }
2298
2280
  );
2299
2281
  };
@@ -2405,9 +2387,10 @@ var DynamicExternal = ({ component, onAction }) => {
2405
2387
  (0, import_react9.useEffect)(() => {
2406
2388
  openExternalUrl();
2407
2389
  }, [openExternalUrl]);
2408
- const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
2390
+ const pollingConfiguration = polling && responseHandlers ? {
2391
+ ...polling,
2409
2392
  responseHandlers
2410
- }) : void 0;
2393
+ } : void 0;
2411
2394
  useExternalStepPolling(pollingConfiguration, onAction);
2412
2395
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2413
2396
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components5.Loader, { size: import_components5.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
@@ -2429,7 +2412,7 @@ var splitModel = (model, schemas) => {
2429
2412
  };
2430
2413
  var combineModels = (models) => {
2431
2414
  return models.reduce((current, combined) => {
2432
- return __spreadValues(__spreadValues({}, combined), current);
2415
+ return { ...combined, ...current };
2433
2416
  }, {});
2434
2417
  };
2435
2418
  var getSchemaColumnClasses = (width) => {
@@ -2444,7 +2427,7 @@ var AllOfSchema = (props) => {
2444
2427
  const modelSchema = props.schema.allOf[index];
2445
2428
  models[index] = getValidObjectModelParts(onChangeProps.model, modelSchema) || {};
2446
2429
  setModels(models);
2447
- props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
2430
+ props.onChange({ ...onChangeProps, model: combineModels(models) });
2448
2431
  };
2449
2432
  const [models, setModels] = (0, import_react10.useState)(splitModel(props.model, props.schema.allOf));
2450
2433
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
@@ -2460,10 +2443,11 @@ var AllOfSchema = (props) => {
2460
2443
  errors: props.errors,
2461
2444
  submitted: props.submitted,
2462
2445
  disabled: props.disabled,
2463
- onChange: (onChangeProps) => onChangeModelIndex(index, __spreadProps(__spreadValues({}, onChangeProps), {
2446
+ onChange: (onChangeProps) => onChangeModelIndex(index, {
2447
+ ...onChangeProps,
2464
2448
  // We can safely assume that the model here is going to be of the same type as the model prop
2465
2449
  model: onChangeProps.model
2466
- })),
2450
+ }),
2467
2451
  onPersistAsync: props.onPersistAsync
2468
2452
  }
2469
2453
  ) }, index)
@@ -2543,11 +2527,17 @@ var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
2543
2527
  // src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
2544
2528
  var import_jsx_runtime17 = require("react/jsx-runtime");
2545
2529
  var ControlFeedback = (props) => {
2546
- var _a;
2547
2530
  const defaultValidationMessages = useDefaultValidationMessages(props.schema);
2548
- const validationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), props.validationMessages), props.schema.validationMessages);
2531
+ const validationMessages = {
2532
+ ...defaultValidationMessages,
2533
+ // default validation messages
2534
+ ...props.validationMessages,
2535
+ // overridden by props
2536
+ ...props.schema.validationMessages
2537
+ // overriden by schema
2538
+ };
2549
2539
  const isErrorVisible = (props.submitted || !props.changed) && !!props.errors;
2550
- const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && !!((_a = props.validations) == null ? void 0 : _a.length);
2540
+ const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && !!props.validations?.length;
2551
2541
  const isDescriptionVisible = props.focused && props.schema.description && !isValidationVisible;
2552
2542
  const hasInfoMessage = !!props.infoMessage;
2553
2543
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id: props.id, children: [
@@ -2608,7 +2598,10 @@ function useDefaultValidationMessages(schema) {
2608
2598
  )
2609
2599
  }) : void 0
2610
2600
  };
2611
- return __spreadValues(__spreadValues({}, formattedMessages), dateOverrides);
2601
+ return {
2602
+ ...formattedMessages,
2603
+ ...dateOverrides
2604
+ };
2612
2605
  }
2613
2606
  return formattedMessages;
2614
2607
  }
@@ -2629,7 +2622,7 @@ async function createPayload(userUploadedFile, isBlobSchema2) {
2629
2622
  }
2630
2623
  function constructUploadResponse(response) {
2631
2624
  const id = response.data;
2632
- return __spreadValues({ id }, response);
2625
+ return { id, ...response };
2633
2626
  }
2634
2627
  function constructUploadError(response) {
2635
2628
  const isError = response instanceof Error;
@@ -2642,9 +2635,10 @@ function constructUploadError(response) {
2642
2635
  const error = response;
2643
2636
  return { id: generateRandomId(), message: error.message };
2644
2637
  } else {
2645
- return __spreadValues({
2646
- message: isString(response.message) ? response.message : ""
2647
- }, response);
2638
+ return {
2639
+ message: isString(response.message) ? response.message : "",
2640
+ ...response
2641
+ };
2648
2642
  }
2649
2643
  }
2650
2644
 
@@ -2699,7 +2693,6 @@ function useFormattedDefaultErrorMessages({
2699
2693
  // src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
2700
2694
  var import_jsx_runtime18 = require("react/jsx-runtime");
2701
2695
  var MultipleFileUploadSchema = (props) => {
2702
- var _a, _b;
2703
2696
  const { onChange, schema } = props;
2704
2697
  const onEvent = useEventDispatcher();
2705
2698
  const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
@@ -2741,27 +2734,28 @@ var MultipleFileUploadSchema = (props) => {
2741
2734
  const showError = Boolean(props.errors) || (inputChanged || props.submitted) && Boolean(fileListValidationFailures.length);
2742
2735
  const accepts = "accepts" in fileSchemaDescriptor && fileSchemaDescriptor.accepts;
2743
2736
  const maxSize = "maxSize" in fileSchemaDescriptor && fileSchemaDescriptor.maxSize;
2744
- const uploadInputProps = __spreadProps(__spreadValues(__spreadValues({
2737
+ const uploadInputProps = {
2745
2738
  multiple: true,
2746
2739
  className: "form-control",
2747
2740
  files,
2748
2741
  fileInputName: uid,
2749
- id: uid
2750
- }, accepts ? { fileTypes: accepts } : void 0), maxSize ? { sizeLimit: toKilobytes(maxSize) } : void 0), {
2751
- sizeLimitErrorMessage: ((_a = fileSchemaDescriptor.validationMessages) == null ? void 0 : _a.maxSize) || defaultErrorMessages.maxFileSizeErrorMessage,
2742
+ id: uid,
2743
+ ...accepts ? { fileTypes: accepts } : void 0,
2744
+ ...maxSize ? { sizeLimit: toKilobytes(maxSize) } : void 0,
2745
+ sizeLimitErrorMessage: fileSchemaDescriptor.validationMessages?.maxSize || defaultErrorMessages.maxFileSizeErrorMessage,
2752
2746
  maxFiles: props.schema.maxItems,
2753
- maxFilesErrorMessage: ((_b = props.schema.validationMessages) == null ? void 0 : _b.maxItems) || defaultErrorMessages.maxItemsErrorMessage,
2747
+ maxFilesErrorMessage: props.schema.validationMessages?.maxItems || defaultErrorMessages.maxItemsErrorMessage,
2754
2748
  uploadButtonTitle: fileSchemaDescriptor.title,
2755
2749
  description: fileSchemaDescriptor.description,
2756
2750
  disabled: props.disabled,
2757
2751
  onUploadFile: (formData) => uploadFile(formData.get(uid)),
2758
2752
  onFilesChange,
2759
2753
  onDeleteFile: () => Promise.resolve()
2760
- });
2754
+ };
2761
2755
  const feedbackId = `${uid}-feedback`;
2762
2756
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
2763
2757
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
2764
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.UploadInput, __spreadValues({}, uploadInputProps)) }),
2758
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.UploadInput, { ...uploadInputProps }) }),
2765
2759
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2766
2760
  ControlFeedback_default,
2767
2761
  {
@@ -2799,7 +2793,11 @@ function isValidId(id) {
2799
2793
  }
2800
2794
  function getValidationMessages(schema, required, defaultErrorMessages) {
2801
2795
  const { minItems, maxItems } = schema;
2802
- return __spreadValues(__spreadValues(__spreadValues({}, required && { required: defaultErrorMessages.requiredMessage }), minItems && { minItems: defaultErrorMessages.minItemsErrorMessage }), maxItems && { maxItems: defaultErrorMessages.maxItemsErrorMessage });
2796
+ return {
2797
+ ...required && { required: defaultErrorMessages.requiredMessage },
2798
+ ...minItems && { minItems: defaultErrorMessages.minItemsErrorMessage },
2799
+ ...maxItems && { maxItems: defaultErrorMessages.maxItemsErrorMessage }
2800
+ };
2803
2801
  }
2804
2802
 
2805
2803
  // src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
@@ -2981,19 +2979,13 @@ var getItemSummaryFromSchema = (schema, model, defaults = {}) => {
2981
2979
  schema,
2982
2980
  model,
2983
2981
  providesProp: "providesIcon",
2984
- getValueFromSchema: (schema2) => {
2985
- var _a;
2986
- return (_a = schema2.icon) != null ? _a : null;
2987
- }
2982
+ getValueFromSchema: (schema2) => schema2.icon ?? null
2988
2983
  });
2989
2984
  const image = getSummaryPropFromSchema({
2990
2985
  schema,
2991
2986
  model,
2992
2987
  providesProp: "providesImage",
2993
- getValueFromSchema: (schema2) => {
2994
- var _a;
2995
- return (_a = schema2.image) != null ? _a : null;
2996
- }
2988
+ getValueFromSchema: (schema2) => schema2.image ?? null
2997
2989
  });
2998
2990
  return {
2999
2991
  value: model,
@@ -3029,10 +3021,11 @@ var getObjectValueFromSchema = (props) => {
3029
3021
  for (const propertyKey in objectSchema.properties) {
3030
3022
  const propertySchema = objectSchema.properties[propertyKey];
3031
3023
  const propertyModel = isObjectModel(model) && propertyKey in model ? model[propertyKey] : null;
3032
- const result = getSummaryPropFromSchema(__spreadProps(__spreadValues({}, props), {
3024
+ const result = getSummaryPropFromSchema({
3025
+ ...props,
3033
3026
  schema: propertySchema,
3034
3027
  model: propertyModel
3035
- }));
3028
+ });
3036
3029
  if (result) {
3037
3030
  return result;
3038
3031
  }
@@ -3050,26 +3043,29 @@ var getOneOfValueFromSchema = (props) => {
3050
3043
  return null;
3051
3044
  }
3052
3045
  const activeSchema = schema.oneOf[activeSchemaIndex2];
3053
- return getSummaryPropFromSchema(__spreadProps(__spreadValues({}, props), {
3046
+ return getSummaryPropFromSchema({
3047
+ ...props,
3054
3048
  schema: activeSchema
3055
- }));
3049
+ });
3056
3050
  }
3057
3051
  const oneOfSchema = schema;
3058
3052
  const activeSchemaIndex = getActiveSchemaIndex(oneOfSchema, model);
3059
3053
  if (activeSchemaIndex === null || activeSchemaIndex < 0) {
3060
3054
  return null;
3061
3055
  }
3062
- return getSummaryPropFromSchema(__spreadProps(__spreadValues({}, props), {
3056
+ return getSummaryPropFromSchema({
3057
+ ...props,
3063
3058
  schema: oneOfSchema.oneOf[activeSchemaIndex]
3064
- }));
3059
+ });
3065
3060
  };
3066
3061
  var getAllOfValueFromSchema = (props) => {
3067
3062
  const { schema } = props;
3068
3063
  const allOfSchema = schema;
3069
3064
  for (const childSchema of allOfSchema.allOf) {
3070
- const result = getSummaryPropFromSchema(__spreadProps(__spreadValues({}, props), {
3065
+ const result = getSummaryPropFromSchema({
3066
+ ...props,
3071
3067
  schema: childSchema
3072
- }));
3068
+ });
3073
3069
  if (result) {
3074
3070
  return result;
3075
3071
  }
@@ -3106,7 +3102,7 @@ var RepeatableSchema = ({
3106
3102
  "RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
3107
3103
  );
3108
3104
  }
3109
- return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
3105
+ return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema?.summary)) : null;
3110
3106
  });
3111
3107
  const [editableItem, setEditableItem] = (0, import_react12.useState)({ item: null, model: null });
3112
3108
  const broadcastModelChange = (updatedItems) => {
@@ -3125,7 +3121,10 @@ var RepeatableSchema = ({
3125
3121
  setOpenModalType("edit");
3126
3122
  };
3127
3123
  const onSaveItem = (action) => {
3128
- const updatedItem = action === "remove" ? null : getItemSummaryFromSchema(schema.items, editableItem.model, schema == null ? void 0 : schema.summary);
3124
+ const updatedItem = action === "remove" ? null : getItemSummaryFromSchema(schema.items, editableItem.model, schema?.summary);
3125
+ if (action !== "remove" && !isValidSchema(updatedItem?.value ?? null, schema.items)) {
3126
+ return;
3127
+ }
3129
3128
  const updatedItemSummaries = getUpdatedItemSummaries(action, {
3130
3129
  originalItem: editableItem.item,
3131
3130
  updatedItem,
@@ -3168,13 +3167,13 @@ var RepeatableSchema = ({
3168
3167
  body: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3169
3168
  RepeatableSchemaStep_default,
3170
3169
  {
3171
- type: openModalType != null ? openModalType : "add",
3170
+ type: openModalType ?? "add",
3172
3171
  schema,
3173
3172
  model: editableItem.model,
3174
3173
  errors,
3175
3174
  submitted,
3176
3175
  onAction: onSaveItem,
3177
- onModelChange: ({ model: model2 }) => setEditableItem(__spreadProps(__spreadValues({}, editableItem), { model: model2 }))
3176
+ onModelChange: ({ model: model2 }) => setEditableItem({ ...editableItem, model: model2 })
3178
3177
  }
3179
3178
  )
3180
3179
  }
@@ -3210,10 +3209,10 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
3210
3209
  var ArrayListSchema = (props) => {
3211
3210
  const { schema } = props;
3212
3211
  if (isMultipleFileUploadSchema(schema)) {
3213
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
3212
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MultipleFileUploadSchema_default, { ...props, schema });
3214
3213
  }
3215
3214
  if (isListArraySchema(schema)) {
3216
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
3215
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RepeatableSchema_default, { ...props, schema });
3217
3216
  }
3218
3217
  throw new Error("Invalid array list schema");
3219
3218
  };
@@ -3228,7 +3227,7 @@ var import_jsx_runtime23 = require("react/jsx-runtime");
3228
3227
  var ArraySchema = (props) => {
3229
3228
  const { schema } = props;
3230
3229
  if (isListArraySchema(schema)) {
3231
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrayListSchema_default, __spreadValues({}, props));
3230
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrayListSchema_default, { ...props });
3232
3231
  }
3233
3232
  throw new Error("Not implemented");
3234
3233
  };
@@ -3249,7 +3248,9 @@ var getSchemaColumnClasses2 = (width) => {
3249
3248
  };
3250
3249
  };
3251
3250
  var ObjectSchema = (props) => {
3252
- const [model, setModel] = (0, import_react13.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
3251
+ const [model, setModel] = (0, import_react13.useState)(() => ({
3252
+ ...getValidObjectModelParts(props.model, props.schema)
3253
+ }));
3253
3254
  const onChangeProperty = (propertyName, onChangeProps) => {
3254
3255
  if (onChangeProps.model !== null) {
3255
3256
  model[propertyName] = onChangeProps.model;
@@ -3257,7 +3258,7 @@ var ObjectSchema = (props) => {
3257
3258
  delete model[propertyName];
3258
3259
  }
3259
3260
  setModel(model);
3260
- props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
3261
+ props.onChange({ ...onChangeProps, model });
3261
3262
  };
3262
3263
  const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
3263
3264
  (0, import_react13.useEffect)(() => {
@@ -3471,7 +3472,7 @@ var logInvalidTypeFallbackWarning = ({
3471
3472
 
3472
3473
  // src/formControl/FormControl.tsx
3473
3474
  var import_jsx_runtime26 = require("react/jsx-runtime");
3474
- var _FormControl = class extends import_react14.PureComponent {
3475
+ var FormControl = class _FormControl extends import_react14.PureComponent {
3475
3476
  constructor(props) {
3476
3477
  super(props);
3477
3478
  /**
@@ -3487,19 +3488,14 @@ var _FormControl = class extends import_react14.PureComponent {
3487
3488
  this.props.onChange(event.target.value);
3488
3489
  };
3489
3490
  this.handleOnFocus = () => {
3490
- var _a, _b;
3491
- (_b = (_a = this.props).onFocus) == null ? void 0 : _b.call(_a);
3491
+ this.props.onFocus?.();
3492
3492
  };
3493
3493
  this.handleOnBlur = () => {
3494
- var _a, _b;
3495
- (_b = (_a = this.props).onBlur) == null ? void 0 : _b.call(_a);
3494
+ this.props.onBlur?.();
3496
3495
  };
3497
3496
  this.getSelectedOption = (options) => {
3498
3497
  if (this.state.selectedOption !== null && typeof this.state.selectedOption !== "undefined") {
3499
- return options.find((option) => {
3500
- var _a;
3501
- return ((_a = this.state.selectedOption) == null ? void 0 : _a.value) === option.value;
3502
- });
3498
+ return options.find((option) => this.state.selectedOption?.value === option.value);
3503
3499
  }
3504
3500
  if (this.props.value !== null && typeof this.props.value !== "undefined") {
3505
3501
  return options.find((option) => this.props.value === option.value);
@@ -3507,12 +3503,13 @@ var _FormControl = class extends import_react14.PureComponent {
3507
3503
  return void 0;
3508
3504
  };
3509
3505
  this.mapOption = (option) => {
3510
- return __spreadProps(__spreadValues({}, option), {
3506
+ return {
3507
+ ...option,
3511
3508
  value: isNumber(option.value) || isString(option.value) ? option.value : void 0,
3512
3509
  secondary: option.note,
3513
3510
  disabled: option.disabled || this.props.disabled,
3514
3511
  readOnly: this.props.readOnly
3515
- });
3512
+ };
3516
3513
  };
3517
3514
  this.state = {
3518
3515
  selectedOption: props.selectedOption,
@@ -3520,6 +3517,18 @@ var _FormControl = class extends import_react14.PureComponent {
3520
3517
  prevValue: props.value
3521
3518
  };
3522
3519
  }
3520
+ static {
3521
+ this.Type = FormControlType;
3522
+ }
3523
+ static {
3524
+ this.Size = Size;
3525
+ }
3526
+ static {
3527
+ this.MonthFormat = MonthFormat;
3528
+ }
3529
+ static {
3530
+ this.DateMode = DateMode;
3531
+ }
3523
3532
  static getDerivedStateFromProps(nextProps, previousState) {
3524
3533
  if (previousState.prevValue !== nextProps.value) {
3525
3534
  return { prevValue: nextProps.value, value: nextProps.value };
@@ -3527,7 +3536,6 @@ var _FormControl = class extends import_react14.PureComponent {
3527
3536
  return null;
3528
3537
  }
3529
3538
  render() {
3530
- var _a;
3531
3539
  const {
3532
3540
  name,
3533
3541
  placeholder,
@@ -3597,9 +3605,8 @@ var _FormControl = class extends import_react14.PureComponent {
3597
3605
  searchPlaceholder,
3598
3606
  searchValue,
3599
3607
  onChange: (option) => {
3600
- var _a2;
3601
- this.setState({ selectedOption: option != null ? option : void 0 });
3602
- this.props.onChange((_a2 = option == null ? void 0 : option.value) != null ? _a2 : null);
3608
+ this.setState({ selectedOption: option ?? void 0 });
3609
+ this.props.onChange(option?.value ?? null);
3603
3610
  },
3604
3611
  onFocus: this.handleOnFocus,
3605
3612
  onBlur: this.handleOnBlur,
@@ -3611,7 +3618,7 @@ var _FormControl = class extends import_react14.PureComponent {
3611
3618
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3612
3619
  import_components11.Tabs,
3613
3620
  {
3614
- selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
3621
+ selected: this.getSelectedOption(options)?.value || 0,
3615
3622
  tabs: options.map((option) => ({
3616
3623
  title: option.label,
3617
3624
  content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, {}),
@@ -3753,19 +3760,20 @@ var _FormControl = class extends import_react14.PureComponent {
3753
3760
  if (this.props.displayPattern) {
3754
3761
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3755
3762
  import_components11.TextareaWithDisplayFormat,
3756
- __spreadProps(__spreadValues({
3757
- displayPattern: this.props.displayPattern
3758
- }, textareaProps), {
3763
+ {
3764
+ displayPattern: this.props.displayPattern,
3765
+ ...textareaProps,
3759
3766
  onChange: this.handleOnChange
3760
- })
3767
+ }
3761
3768
  );
3762
3769
  }
3763
3770
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3764
3771
  "textarea",
3765
- __spreadProps(__spreadValues({}, textareaProps), {
3772
+ {
3773
+ ...textareaProps,
3766
3774
  onChange: this.handleInputOnChange,
3767
3775
  "aria-describedby": describedBy
3768
- })
3776
+ }
3769
3777
  );
3770
3778
  }
3771
3779
  case FormControlType.FILE:
@@ -3775,7 +3783,8 @@ var _FormControl = class extends import_react14.PureComponent {
3775
3783
  // @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
3776
3784
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3777
3785
  import_components11.Upload,
3778
- __spreadProps(__spreadValues({}, uploadProps), {
3786
+ {
3787
+ ...uploadProps,
3779
3788
  usAccept: uploadProps.usAccept || "*",
3780
3789
  usDisabled: uploadProps.usDisabled || disabled,
3781
3790
  onSuccess: (base64url) => {
@@ -3787,7 +3796,7 @@ var _FormControl = class extends import_react14.PureComponent {
3787
3796
  onCancel: () => {
3788
3797
  this.handleOnChange(null);
3789
3798
  }
3790
- })
3799
+ }
3791
3800
  )
3792
3801
  );
3793
3802
  }
@@ -3812,59 +3821,57 @@ var _FormControl = class extends import_react14.PureComponent {
3812
3821
  if (this.props.displayPattern) {
3813
3822
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3814
3823
  import_components11.InputWithDisplayFormat,
3815
- __spreadProps(__spreadValues({
3816
- displayPattern: this.props.displayPattern
3817
- }, inputProps), {
3824
+ {
3825
+ displayPattern: this.props.displayPattern,
3826
+ ...inputProps,
3818
3827
  onChange: this.handleOnChange
3819
- })
3828
+ }
3820
3829
  );
3821
3830
  }
3822
3831
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3823
3832
  "input",
3824
- __spreadProps(__spreadValues({}, inputProps), {
3833
+ {
3834
+ ...inputProps,
3825
3835
  onChange: this.handleInputOnChange,
3826
3836
  "aria-describedby": describedBy
3827
- })
3837
+ }
3828
3838
  );
3829
3839
  }
3830
3840
  }
3831
3841
  }
3832
- };
3833
- var FormControl = _FormControl;
3834
- FormControl.Type = FormControlType;
3835
- FormControl.Size = Size;
3836
- FormControl.MonthFormat = MonthFormat;
3837
- FormControl.DateMode = DateMode;
3838
- FormControl.defaultProps = {
3839
- autoComplete: true,
3840
- countryCode: null,
3841
- disabled: false,
3842
- displayPattern: null,
3843
- id: null,
3844
- label: "",
3845
- max: null,
3846
- maxDate: null,
3847
- maxLength: null,
3848
- min: null,
3849
- minDate: null,
3850
- minLength: null,
3851
- mode: _FormControl.DateMode.DAY_MONTH_YEAR,
3852
- monthFormat: _FormControl.MonthFormat.LONG,
3853
- onBlur: null,
3854
- onFocus: null,
3855
- onSearchChange: null,
3856
- options: [],
3857
- placeholder: null,
3858
- readOnly: false,
3859
- required: false,
3860
- searchPlaceholder: null,
3861
- searchValue: "",
3862
- selectedOption: null,
3863
- size: _FormControl.Size.MEDIUM,
3864
- step: 1,
3865
- type: _FormControl.Type.TEXT,
3866
- uploadProps: {},
3867
- value: null
3842
+ static {
3843
+ this.defaultProps = {
3844
+ autoComplete: true,
3845
+ countryCode: null,
3846
+ disabled: false,
3847
+ displayPattern: null,
3848
+ id: null,
3849
+ label: "",
3850
+ max: null,
3851
+ maxDate: null,
3852
+ maxLength: null,
3853
+ min: null,
3854
+ minDate: null,
3855
+ minLength: null,
3856
+ mode: _FormControl.DateMode.DAY_MONTH_YEAR,
3857
+ monthFormat: _FormControl.MonthFormat.LONG,
3858
+ onBlur: null,
3859
+ onFocus: null,
3860
+ onSearchChange: null,
3861
+ options: [],
3862
+ placeholder: null,
3863
+ readOnly: false,
3864
+ required: false,
3865
+ searchPlaceholder: null,
3866
+ searchValue: "",
3867
+ selectedOption: null,
3868
+ size: _FormControl.Size.MEDIUM,
3869
+ step: 1,
3870
+ type: _FormControl.Type.TEXT,
3871
+ uploadProps: {},
3872
+ value: null
3873
+ };
3874
+ }
3868
3875
  };
3869
3876
 
3870
3877
  // src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
@@ -3880,22 +3887,30 @@ var mapConstSchemaToOption = (schema, controlType) => {
3880
3887
  }
3881
3888
  };
3882
3889
  var mapConstSchemaToRadioOption = (schema) => {
3883
- return __spreadValues(__spreadValues(__spreadValues({
3890
+ return {
3884
3891
  // TODO: LOW avoid type assertion -- using || '' would fail some tests
3885
3892
  label: schema.title,
3886
- value: schema.const
3887
- }, getOptionDescription(schema.title, schema.description)), getAvatarPropertyForRadioOption(schema)), getDisabled(schema.disabled));
3893
+ value: schema.const,
3894
+ ...getOptionDescription(schema.title, schema.description),
3895
+ ...getAvatarPropertyForRadioOption(schema),
3896
+ ...getDisabled(schema.disabled)
3897
+ };
3888
3898
  };
3889
3899
  var mapConstSchemaToSelectOption = (schema) => {
3890
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
3900
+ return {
3891
3901
  // TODO: LOW avoid type assertion -- using || '' would fail some tests
3892
3902
  label: schema.title,
3893
- value: schema.const
3894
- }, getOptionDescription(schema.title, schema.description)), getIconPropertyForSelectOption(schema.icon)), mapImage(schema.image)), getDisabled(schema.disabled)), mapKeywordsToSearchStrings(schema.keywords));
3903
+ value: schema.const,
3904
+ ...getOptionDescription(schema.title, schema.description),
3905
+ ...getIconPropertyForSelectOption(schema.icon),
3906
+ ...mapImage(schema.image),
3907
+ ...getDisabled(schema.disabled),
3908
+ ...mapKeywordsToSearchStrings(schema.keywords)
3909
+ };
3895
3910
  };
3896
3911
  var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { searchStrings } : {};
3897
3912
  var mapImage = (image) => {
3898
- if (image == null ? void 0 : image.url) {
3913
+ if (image?.url) {
3899
3914
  return {
3900
3915
  icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
3901
3916
  };
@@ -3903,36 +3918,38 @@ var mapImage = (image) => {
3903
3918
  return null;
3904
3919
  };
3905
3920
  var getIconPropertyForSelectOption = (icon) => {
3906
- if ((icon == null ? void 0 : icon.name) && isFlagIcon(icon.name)) {
3921
+ if (icon?.name && isFlagIcon(icon.name)) {
3907
3922
  return { currency: icon.name.substring(5) };
3908
3923
  }
3909
- if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
3924
+ if (icon?.name && isValidIconName(icon.name)) {
3910
3925
  return { icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DynamicIcon_default, { type: icon.name }) };
3911
3926
  }
3912
- if (icon == null ? void 0 : icon.text) {
3927
+ if (icon?.text) {
3913
3928
  return { icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: icon.text }) };
3914
3929
  }
3915
3930
  return null;
3916
3931
  };
3917
3932
  var getAvatarPropertyForRadioOption = ({ image, icon }) => {
3918
- if (image == null ? void 0 : image.url) {
3933
+ if (image?.url) {
3919
3934
  return {
3920
3935
  avatar: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: image.url, alt: "" }) })
3921
3936
  };
3922
3937
  }
3923
- if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
3938
+ if (icon?.name && isValidIconName(icon.name)) {
3924
3939
  return {
3925
3940
  avatar: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DynamicIcon_default, { type: icon.name }) })
3926
3941
  };
3927
3942
  }
3928
- if (icon == null ? void 0 : icon.text) {
3943
+ if (icon?.text) {
3929
3944
  return {
3930
3945
  avatar: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.INITIALS, children: icon.text })
3931
3946
  };
3932
3947
  }
3933
3948
  return null;
3934
3949
  };
3935
- var mapSchemaToUploadOptions = ({ accepts }) => __spreadValues({}, isArray(accepts) && { usAccept: accepts.join(",") });
3950
+ var mapSchemaToUploadOptions = ({ accepts }) => ({
3951
+ ...isArray(accepts) && { usAccept: accepts.join(",") }
3952
+ });
3936
3953
  var getOptionDescription = (title, description) => {
3937
3954
  if (title && description) {
3938
3955
  const keyForDescription = (title + description).length > 50 ? "secondary" : "note";
@@ -4025,7 +4042,7 @@ var SchemaFormControl = (props) => {
4025
4042
  uploadProps: mapSchemaToUploadOptions(schema),
4026
4043
  describedBy
4027
4044
  };
4028
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
4045
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FormControl, { type: controlType, value: safeValue, ...events, ...controlProps }) });
4029
4046
  };
4030
4047
  SchemaFormControl.defaultProps = {
4031
4048
  value: null,
@@ -4117,7 +4134,7 @@ var OneOfSchema = (props) => {
4117
4134
  if (type !== "init" && props.schema.analyticsId) {
4118
4135
  onEvent("Dynamic Flow - OneOf Selected", {
4119
4136
  oneOfId: props.schema.analyticsId,
4120
- schemaId: newSchema == null ? void 0 : newSchema.analyticsId
4137
+ schemaId: newSchema?.analyticsId
4121
4138
  });
4122
4139
  }
4123
4140
  };
@@ -4192,7 +4209,7 @@ function getTitleAndHelp(schema, id) {
4192
4209
  return schema.title ? titleElement : helpElement;
4193
4210
  }
4194
4211
  function getValidations(props, schemaIndex) {
4195
- const selectedSchema = props.schema.oneOf[schemaIndex != null ? schemaIndex : -1];
4212
+ const selectedSchema = props.schema.oneOf[schemaIndex ?? -1];
4196
4213
  if (isConstSchema(selectedSchema)) {
4197
4214
  return getValidationFailures(selectedSchema.const, props.schema, !!props.required);
4198
4215
  }
@@ -4211,7 +4228,7 @@ function getModelPartsForSchemas(model, schemas) {
4211
4228
  return schemas.map((schema) => getValidModelParts(model, schema));
4212
4229
  }
4213
4230
  function mapSchemasForSelect(schema) {
4214
- return __spreadProps(__spreadValues({}, schema), { oneOf: schema.oneOf.map(mapOneOfToConst) });
4231
+ return { ...schema, oneOf: schema.oneOf.map(mapOneOfToConst) };
4215
4232
  }
4216
4233
  function mapOneOfToConst(schema, index) {
4217
4234
  const { title, description, disabled = false, icon, image, keywords } = schema;
@@ -4331,7 +4348,7 @@ var PersistAsyncBlobSchema = (props) => {
4331
4348
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
4332
4349
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4333
4350
  UploadInputAdapter,
4334
- __spreadValues({
4351
+ {
4335
4352
  id,
4336
4353
  fileId: props.model,
4337
4354
  idProperty: props.schema.persistAsync.idProperty,
@@ -4343,8 +4360,9 @@ var PersistAsyncBlobSchema = (props) => {
4343
4360
  httpClient,
4344
4361
  onSuccess,
4345
4362
  onFailure,
4346
- onCancel
4347
- }, mapSchemaToUploadOptions(props.schema.persistAsync.schema))
4363
+ onCancel,
4364
+ ...mapSchemaToUploadOptions(props.schema.persistAsync.schema)
4365
+ }
4348
4366
  ) }),
4349
4367
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4350
4368
  ControlFeedback_default,
@@ -4357,9 +4375,10 @@ var PersistAsyncBlobSchema = (props) => {
4357
4375
  errors: props.errors,
4358
4376
  schema: props.schema,
4359
4377
  validations: combinedValidations,
4360
- validationMessages: __spreadValues({
4361
- required: "Value is required..."
4362
- }, persistAsyncValidationMessages),
4378
+ validationMessages: {
4379
+ required: "Value is required...",
4380
+ ...persistAsyncValidationMessages
4381
+ },
4363
4382
  infoMessage: null
4364
4383
  }
4365
4384
  )
@@ -4378,10 +4397,12 @@ var PersistAsyncSchema = (props) => {
4378
4397
  if (persistAsyncSchemaType === "blob") {
4379
4398
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4380
4399
  PersistAsyncBlobSchema_default,
4381
- __spreadValues({}, props)
4400
+ {
4401
+ ...props
4402
+ }
4382
4403
  );
4383
4404
  }
4384
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
4405
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PersistAsyncBasicSchema_default, { ...props });
4385
4406
  };
4386
4407
  PersistAsyncSchema.defaultProps = {
4387
4408
  required: false
@@ -4406,7 +4427,7 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
4406
4427
  var PromotedOneOfCheckboxControl = (props) => {
4407
4428
  const { id, selection, setSelection } = props;
4408
4429
  const { promoted, other, checkedMeans } = props.promotion;
4409
- const title = checkedMeans === "other" ? other.title : (promoted == null ? void 0 : promoted.title) || props.promotedOneOf.title;
4430
+ const title = checkedMeans === "other" ? other.title : promoted?.title || props.promotedOneOf.title;
4410
4431
  const selectionWhenChecked = checkedMeans === "other" ? "other" : "promoted";
4411
4432
  const selectionWhenUnchecked = checkedMeans === "other" ? "promoted" : "other";
4412
4433
  const checked = selection === selectionWhenChecked;
@@ -4422,20 +4443,21 @@ var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
4422
4443
  var import_components15 = require("@transferwise/components");
4423
4444
  var import_jsx_runtime34 = require("react/jsx-runtime");
4424
4445
  var PromotedOneOfRadioControl = (props) => {
4425
- var _a, _b;
4426
4446
  const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
4427
4447
  const radios = [
4428
- __spreadValues({
4448
+ {
4429
4449
  value: "promoted",
4430
4450
  // TODO: LOW avoid type assertion below the expression may be nullish, but "label" cannot be
4431
- label: ((_a = promotion.promoted) == null ? void 0 : _a.title) || promotedOneOf.title,
4432
- secondary: ((_b = promotion.promoted) == null ? void 0 : _b.description) || promotedOneOf.description
4433
- }, getAvatarPropertyForRadioOption(promotedOneOf)),
4434
- __spreadValues({
4451
+ label: promotion.promoted?.title || promotedOneOf.title,
4452
+ secondary: promotion.promoted?.description || promotedOneOf.description,
4453
+ ...getAvatarPropertyForRadioOption(promotedOneOf)
4454
+ },
4455
+ {
4435
4456
  value: "other",
4436
4457
  label: promotion.other.title,
4437
- secondary: promotion.other.description
4438
- }, getAvatarPropertyForRadioOption(promotion.other))
4458
+ secondary: promotion.other.description,
4459
+ ...getAvatarPropertyForRadioOption(promotion.other)
4460
+ }
4439
4461
  ];
4440
4462
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "form-group", children: [
4441
4463
  title && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
@@ -4462,9 +4484,9 @@ var PromotedOneOfControl = (props) => {
4462
4484
  const controlType = props.promotion.control || "radio";
4463
4485
  switch (controlType) {
4464
4486
  case "radio":
4465
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
4487
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfRadioControl_default, { ...props });
4466
4488
  case "checkbox":
4467
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
4489
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfCheckboxControl_default, { ...props });
4468
4490
  default:
4469
4491
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {});
4470
4492
  }
@@ -4479,9 +4501,8 @@ var PromotedOneOfControl_default = PromotedOneOfControl;
4479
4501
  var import_jsx_runtime36 = require("react/jsx-runtime");
4480
4502
  var isPromoted = (schema) => schema.promoted === true;
4481
4503
  var PromotedOneOfSchema = (props) => {
4482
- var _a;
4483
4504
  const [selection, setSelection] = (0, import_react19.useState)(
4484
- getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
4505
+ getSelectionFromModel(props.schema, props.model) || props.schema.promotion?.default || "promoted"
4485
4506
  );
4486
4507
  const promotedAlert = props.schema.alert;
4487
4508
  const promotedOneOf = props.schema.oneOf.find(isPromoted);
@@ -4500,23 +4521,23 @@ var PromotedOneOfSchema = (props) => {
4500
4521
  setSelection
4501
4522
  }
4502
4523
  ),
4503
- selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
4504
- selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
4524
+ selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ObjectSchema_default, { ...props, schema: promotedObjectSchema }),
4525
+ selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(GenericSchema_default, { ...props, schema: otherOneOf })
4505
4526
  ] });
4506
4527
  };
4507
4528
  function getPromotedObjectSchema(promotedSchema) {
4508
- return __spreadProps(__spreadValues({}, promotedSchema), {
4529
+ return {
4530
+ ...promotedSchema,
4509
4531
  // We don't need to show these since they are already displayed in the radio option
4510
4532
  title: void 0,
4511
4533
  description: void 0
4512
- });
4534
+ };
4513
4535
  }
4514
4536
  function getOtherOneOf(schema) {
4515
- var _a, _b, _c;
4516
- const other = ((_a = schema.promotion) == null ? void 0 : _a.displayTwice) ? [...schema.oneOf] : schema.oneOf.filter((one) => !isPromoted(one));
4517
- const title = (_c = (_b = schema.promotion) == null ? void 0 : _b.other.heading) == null ? void 0 : _c.text;
4537
+ const other = schema.promotion?.displayTwice ? [...schema.oneOf] : schema.oneOf.filter((one) => !isPromoted(one));
4538
+ const title = schema.promotion?.other.heading?.text;
4518
4539
  if (other.length === 1) {
4519
- return __spreadProps(__spreadValues({}, other[0]), { title });
4540
+ return { ...other[0], title };
4520
4541
  }
4521
4542
  if (other.length > 1) {
4522
4543
  return {
@@ -4588,7 +4609,7 @@ function getSelectedOneOf(schema, model) {
4588
4609
  function getValueFromOption(option) {
4589
4610
  const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
4590
4611
  const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
4591
- return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
4612
+ return icon?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
4592
4613
  icon.avatar,
4593
4614
  " ",
4594
4615
  text
@@ -4645,7 +4666,7 @@ var ValidationAsyncSchema = (props) => {
4645
4666
  } else if (response.status === 422) {
4646
4667
  setValidationAsyncErrors(isString(jsonResponse.message) ? jsonResponse.message : null);
4647
4668
  }
4648
- } catch (e) {
4669
+ } catch {
4649
4670
  onEvent("Dynamic Flow - ValidationAsync", { status: "failure" });
4650
4671
  }
4651
4672
  };
@@ -4663,10 +4684,11 @@ var ValidationAsyncSchema = (props) => {
4663
4684
  }
4664
4685
  };
4665
4686
  const onValidationAsyncChange = (parameters) => {
4666
- onChange(__spreadProps(__spreadValues({}, parameters), {
4687
+ onChange({
4688
+ ...parameters,
4667
4689
  triggerSchema: schema,
4668
4690
  triggerModel: parameters.model
4669
- }));
4691
+ });
4670
4692
  setValidationAsyncErrors(null);
4671
4693
  setValidationAsyncSuccessMessage(null);
4672
4694
  setValidationAsyncModel(parameters.model);
@@ -4681,7 +4703,7 @@ var ValidationAsyncSchema = (props) => {
4681
4703
  required,
4682
4704
  schema
4683
4705
  };
4684
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
4706
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BasicTypeSchema_default, { ...basicTypeSchemaProps });
4685
4707
  };
4686
4708
  ValidationAsyncSchema.defaultProps = { required: false };
4687
4709
  var ValidationAsyncSchema_default = ValidationAsyncSchema;
@@ -4691,7 +4713,7 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
4691
4713
  var import_react22 = require("react");
4692
4714
  var GenericSchemaForm = (props) => {
4693
4715
  const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
4694
- const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
4716
+ const schemaProps = { ...props, model, errors, hideTitle, disabled };
4695
4717
  const type = getSchemaType(schema);
4696
4718
  const log = useLogger();
4697
4719
  (0, import_react21.useEffect)(() => {
@@ -4704,25 +4726,25 @@ var GenericSchemaForm = (props) => {
4704
4726
  }, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
4705
4727
  switch (type) {
4706
4728
  case "readOnly":
4707
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
4729
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ReadOnlySchema_default, { ...schemaProps });
4708
4730
  case "persistAsync":
4709
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
4731
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PersistAsyncSchema_default, { ...schemaProps });
4710
4732
  case "validationAsync":
4711
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
4733
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ValidationAsyncSchema_default, { ...schemaProps });
4712
4734
  case "basic": {
4713
- const basicTypeProps = __spreadValues({ infoMessage: null }, schemaProps);
4714
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
4735
+ const basicTypeProps = { infoMessage: null, ...schemaProps };
4736
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasicTypeSchema_default, { ...basicTypeProps });
4715
4737
  }
4716
4738
  case "object":
4717
- return /* @__PURE__ */ (0, import_react22.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
4739
+ return /* @__PURE__ */ (0, import_react22.createElement)(ObjectSchema_default, { ...schemaProps, key: JSON.stringify(schema) });
4718
4740
  case "array":
4719
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
4741
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ArraySchema_default, { ...schemaProps });
4720
4742
  case "promotedOneOf":
4721
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
4743
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PromotedOneOfSchema_default, { ...schemaProps });
4722
4744
  case "oneOf":
4723
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
4745
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OneOfSchema_default, { ...schemaProps });
4724
4746
  case "allOf":
4725
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
4747
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AllOfSchema_default, { ...schemaProps });
4726
4748
  }
4727
4749
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, {});
4728
4750
  };
@@ -4753,14 +4775,15 @@ var isValidGenericSchema = (schema, model, errors) => {
4753
4775
  // src/jsonSchemaForm/JsonSchemaForm.tsx
4754
4776
  var import_jsx_runtime40 = require("react/jsx-runtime");
4755
4777
  var JsonSchemaForm = (props) => {
4756
- const schemaProps = __spreadValues({
4778
+ const schemaProps = {
4757
4779
  model: null,
4758
4780
  errors: null,
4759
4781
  disabled: false,
4760
- baseUrl: ""
4761
- }, props);
4782
+ baseUrl: "",
4783
+ ...props
4784
+ };
4762
4785
  if (useHasHttpClientProvider() || schemaProps.baseUrl == null) {
4763
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GenericSchema_default, __spreadValues({}, schemaProps));
4786
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GenericSchema_default, { ...schemaProps });
4764
4787
  }
4765
4788
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4766
4789
  Providers,
@@ -4768,17 +4791,17 @@ var JsonSchemaForm = (props) => {
4768
4791
  baseUrl: schemaProps.baseUrl,
4769
4792
  onEvent: schemaProps.onEvent,
4770
4793
  onLog: schemaProps.onLog,
4771
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GenericSchema_default, __spreadValues({}, schemaProps))
4794
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GenericSchema_default, { ...schemaProps })
4772
4795
  }
4773
4796
  );
4774
4797
  };
4775
4798
  var JsonSchemaForm_default = JsonSchemaForm;
4776
4799
  var Providers = ({ baseUrl, onEvent, onLog, children }) => {
4777
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog != null ? onLog : noop2, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4800
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog ?? noop2, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4778
4801
  EventsContextProvider,
4779
4802
  {
4780
4803
  metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
4781
- onEvent: onEvent != null ? onEvent : noop2,
4804
+ onEvent: onEvent ?? noop2,
4782
4805
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
4783
4806
  }
4784
4807
  ) });
@@ -4799,7 +4822,7 @@ var DynamicForm = (props) => {
4799
4822
  submitted: props.submitted,
4800
4823
  errors: props.errors,
4801
4824
  onChange: (parameters) => {
4802
- props.onModelChange(__spreadValues({ formSchema }, parameters));
4825
+ props.onModelChange({ formSchema, ...parameters });
4803
4826
  },
4804
4827
  onPersistAsync: props.onPersistAsync
4805
4828
  }
@@ -4859,7 +4882,7 @@ var DynamicImage = ({ component: image }) => {
4859
4882
  if (!imageSource) {
4860
4883
  return null;
4861
4884
  }
4862
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components18.Image, __spreadValues({ className: `img-responsive ${getMargin(margin || "md")}` }, imageProps)) });
4885
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components18.Image, { className: `img-responsive ${getMargin(margin || "md")}`, ...imageProps }) });
4863
4886
  };
4864
4887
  var readImageBlobAsDataURL = (imageBlob) => {
4865
4888
  return new Promise((resolve, reject) => {
@@ -4870,9 +4893,8 @@ var readImageBlobAsDataURL = (imageBlob) => {
4870
4893
  });
4871
4894
  };
4872
4895
  var getImageSource = async (httpClient, imageUrl) => {
4873
- var _a;
4874
4896
  try {
4875
- if (isRelativePath(imageUrl) || (imageUrl == null ? void 0 : imageUrl.indexOf(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`)) === 0) {
4897
+ if (isRelativePath(imageUrl) || imageUrl?.indexOf(`${window?.location?.origin}/`) === 0) {
4876
4898
  return httpClient(imageUrl, {
4877
4899
  method: "GET",
4878
4900
  headers: { "Content-Type": "image/image" },
@@ -4885,7 +4907,7 @@ var getImageSource = async (httpClient, imageUrl) => {
4885
4907
  }).then(readImageBlobAsDataURL).catch(() => imageUrl);
4886
4908
  }
4887
4909
  return imageUrl;
4888
- } catch (e) {
4910
+ } catch {
4889
4911
  return imageUrl;
4890
4912
  }
4891
4913
  };
@@ -4957,7 +4979,7 @@ var DynamicLayout = (props) => {
4957
4979
  onModelChange,
4958
4980
  onPersistAsync
4959
4981
  },
4960
- getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
4982
+ getKey({ ...component, errors: errors ?? null })
4961
4983
  );
4962
4984
  case "button":
4963
4985
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
@@ -5012,12 +5034,14 @@ var DynamicStatusList = ({ component }) => {
5012
5034
  ] });
5013
5035
  };
5014
5036
  var mapListItemToSummary = ({ title, description, icon, status }) => {
5015
- const props = __spreadValues(__spreadValues({
5037
+ const props = {
5016
5038
  key: `${title}/${description || ""}`,
5017
5039
  title,
5018
- description
5019
- }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
5020
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components20.Summary, __spreadValues({}, props));
5040
+ description,
5041
+ ...icon?.name ? { icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicIcon_default, { type: icon.name }) } : {},
5042
+ ...status ? { status: statusMap[status] } : {}
5043
+ };
5044
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components20.Summary, { ...props });
5021
5045
  };
5022
5046
  var statusListMap = {
5023
5047
  done: "done",
@@ -5029,7 +5053,7 @@ var legacyStatusMap = {
5029
5053
  warning: "pending",
5030
5054
  neutral: "notDone"
5031
5055
  };
5032
- var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMap);
5056
+ var statusMap = { ...statusListMap, ...legacyStatusMap };
5033
5057
  var DynamicStatusList_default = DynamicStatusList;
5034
5058
 
5035
5059
  // src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
@@ -5092,8 +5116,7 @@ var CopyableDynamicParagraph = ({ component }) => {
5092
5116
  const createSnackbar = useSnackBarIfAvailable();
5093
5117
  const { text } = component;
5094
5118
  const copy = () => {
5095
- var _a;
5096
- (_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
5119
+ navigator.clipboard?.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
5097
5120
  };
5098
5121
  const classNames7 = getTextAlignmentAndMargin({ align: component.align }) + " form-control";
5099
5122
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
@@ -5181,10 +5204,18 @@ var import_react26 = require("react");
5181
5204
  // src/layout/search/SearchInput.tsx
5182
5205
  var import_components25 = require("@transferwise/components");
5183
5206
  var import_jsx_runtime51 = require("react/jsx-runtime");
5184
- var SearchInput = ({ title, value, onChange }) => {
5207
+ var SearchInput = ({ title, value, onFocus, onChange }) => {
5185
5208
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "control-label d-inline", children: [
5186
5209
  title,
5187
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components25.Input, { type: "text", value, onChange: (event) => onChange(event.currentTarget.value) })
5210
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5211
+ import_components25.Input,
5212
+ {
5213
+ type: "text",
5214
+ value,
5215
+ onFocus,
5216
+ onChange: (event) => onChange(event.currentTarget.value)
5217
+ }
5218
+ )
5188
5219
  ] });
5189
5220
  };
5190
5221
 
@@ -5258,8 +5289,7 @@ var useSearch = (defaultSearchConfig) => {
5258
5289
  const httpClient = useHttpClient();
5259
5290
  const search = (0, import_react25.useCallback)(
5260
5291
  async (query, { url, method, param } = defaultSearchConfig) => {
5261
- var _a;
5262
- (_a = abortControllerRef.current) == null ? void 0 : _a.abort();
5292
+ abortControllerRef.current?.abort();
5263
5293
  if (!query) {
5264
5294
  setState({ status: "idle" });
5265
5295
  return;
@@ -5325,18 +5355,27 @@ var DynamicSearch = ({ component, onAction }) => {
5325
5355
  const [query, setQuery] = (0, import_react26.useState)("");
5326
5356
  const { title, margin, url, method, param, emptyMessage } = component;
5327
5357
  const { status, results, search } = useSearch({ url, method, param });
5358
+ const onEvent = useEventDispatcher();
5328
5359
  const debouncedSearch = (0, import_react26.useMemo)(() => debounce(search, DEBOUNCE_TIME), [search]);
5360
+ const onSearchStart = () => {
5361
+ onEvent("Dynamic Flow - Search Started", {});
5362
+ };
5329
5363
  const onChange = (value) => {
5330
5364
  setQuery(value);
5331
5365
  debouncedSearch(value);
5332
5366
  };
5333
5367
  const onResultSelected = ({ type, value }) => {
5334
5368
  if (type === "action") {
5369
+ onEvent("Dynamic Flow - Search Result Selected", {
5370
+ type: "action",
5371
+ actionId: value.id || value.$id
5372
+ });
5335
5373
  onAction(value);
5336
5374
  }
5337
5375
  if (type === "search") {
5338
5376
  setQuery(value.query);
5339
5377
  const { url: url2, method: method2, param: param2, query: query2 } = value;
5378
+ onEvent("Dynamic Flow - Search Result Selected", { type: "search" });
5340
5379
  void search(query2, { url: url2, method: method2, param: param2 });
5341
5380
  }
5342
5381
  };
@@ -5345,7 +5384,7 @@ var DynamicSearch = ({ component, onAction }) => {
5345
5384
  void search(query);
5346
5385
  };
5347
5386
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
5348
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchInput, { title, value: query, onChange }),
5387
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
5349
5388
  status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
5350
5389
  status === "error" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorResult, { onRetrySearch }),
5351
5390
  status === "success" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
@@ -5360,7 +5399,6 @@ var getDefaultValue = (schema) => {
5360
5399
  return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
5361
5400
  };
5362
5401
  var BasicTypeSchema = (props) => {
5363
- var _a, _b, _c;
5364
5402
  const onChange = (newModel) => {
5365
5403
  setChanged(true);
5366
5404
  setModelAndBroadcast(sanitiseModel(newModel), "user");
@@ -5391,8 +5429,8 @@ var BasicTypeSchema = (props) => {
5391
5429
  props.onBlur();
5392
5430
  }
5393
5431
  };
5394
- const [model, setModel] = (0, import_react27.useState)((_a = props.model) != null ? _a : null);
5395
- const [lastModel, setLastModel] = (0, import_react27.useState)((_b = props.model) != null ? _b : null);
5432
+ const [model, setModel] = (0, import_react27.useState)(props.model ?? null);
5433
+ const [lastModel, setLastModel] = (0, import_react27.useState)(props.model ?? null);
5396
5434
  const [changed, setChanged] = (0, import_react27.useState)(false);
5397
5435
  const [focused, setFocused] = (0, import_react27.useState)(false);
5398
5436
  const [blurred, setBlurred] = (0, import_react27.useState)(false);
@@ -5415,8 +5453,7 @@ var BasicTypeSchema = (props) => {
5415
5453
  (0, import_react27.useEffect)(refreshValidations, [props.model, props.submitted]);
5416
5454
  (0, import_react27.useEffect)(onSchemaChange, [props.schema]);
5417
5455
  (0, import_react27.useEffect)(() => {
5418
- var _a2;
5419
- const newModel = (_a2 = props.model) != null ? _a2 : null;
5456
+ const newModel = props.model ?? null;
5420
5457
  if (newModel !== model) {
5421
5458
  setModel(newModel);
5422
5459
  }
@@ -5458,7 +5495,7 @@ var BasicTypeSchema = (props) => {
5458
5495
  focused,
5459
5496
  blurred,
5460
5497
  submitted: props.submitted,
5461
- errors: (_c = props.errors) != null ? _c : null,
5498
+ errors: props.errors ?? null,
5462
5499
  schema: props.schema,
5463
5500
  validations,
5464
5501
  infoMessage: props.infoMessage
@@ -5480,8 +5517,7 @@ var getIdFromResponse = (idProperty, response) => {
5480
5517
  return response[idProperty];
5481
5518
  };
5482
5519
  var getErrorFromResponse = (errorProperty, response) => {
5483
- var _a;
5484
- return (_a = response.validation) == null ? void 0 : _a[errorProperty];
5520
+ return response.validation?.[errorProperty];
5485
5521
  };
5486
5522
  var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
5487
5523
  FormControlType.RADIO,
@@ -5533,14 +5569,14 @@ var PersistAsyncBasicSchema = (props) => {
5533
5569
  onChange({ model: id, triggerSchema: schema, triggerModel: id });
5534
5570
  } else if (isStatus422(response.status)) {
5535
5571
  const { validation } = responseBody;
5536
- const error = isObject(validation) && (validation == null ? void 0 : validation[param]) || null;
5572
+ const error = isObject(validation) && validation?.[param] || null;
5537
5573
  setPersistAsyncError(error);
5538
5574
  onChange({ model: null, triggerSchema: schema, triggerModel: null });
5539
5575
  } else {
5540
5576
  setGenericPersistAsyncError();
5541
5577
  }
5542
5578
  onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId: schema.$id });
5543
- } catch (e) {
5579
+ } catch {
5544
5580
  onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId: schema.$id });
5545
5581
  setGenericPersistAsyncError();
5546
5582
  }
@@ -5614,7 +5650,9 @@ var usePersistAsync = (persistAsync) => {
5614
5650
  const requestBody = isBlob ? wrapInFormData(requestKey, model) : JSON.stringify({ [requestKey]: model });
5615
5651
  return {
5616
5652
  method: persistAsync.method,
5617
- headers: __spreadValues({}, !isBlob && { "Content-Type": "application/json" }),
5653
+ headers: {
5654
+ ...!isBlob && { "Content-Type": "application/json" }
5655
+ },
5618
5656
  body: requestBody,
5619
5657
  signal
5620
5658
  };
@@ -5755,7 +5793,7 @@ function useStepPolling(polling, onAction) {
5755
5793
  }, [polling, httpClient]);
5756
5794
  const onPollingResponse = (0, import_react32.useCallback)(
5757
5795
  (pollingResponse) => {
5758
- if (pollingResponse == null ? void 0 : pollingResponse.action) {
5796
+ if (pollingResponse?.action) {
5759
5797
  onAction(pollingResponse.action);
5760
5798
  return false;
5761
5799
  }
@@ -5765,8 +5803,8 @@ function useStepPolling(polling, onAction) {
5765
5803
  );
5766
5804
  usePolling({
5767
5805
  asyncFn,
5768
- interval: 1e3 * ((polling == null ? void 0 : polling.interval) || 0),
5769
- maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
5806
+ interval: 1e3 * (polling?.interval || 0),
5807
+ maxAttempts: polling?.maxAttempts || 0,
5770
5808
  maxConsecutiveFails: 1,
5771
5809
  onPollingResponse,
5772
5810
  onFailure: (0, import_react32.useCallback)(() => {
@@ -5780,7 +5818,6 @@ function useStepPolling(polling, onAction) {
5780
5818
  // src/step/layoutStep/LayoutStep.tsx
5781
5819
  var import_jsx_runtime56 = require("react/jsx-runtime");
5782
5820
  var getComponents = (step, options) => {
5783
- var _a;
5784
5821
  if (isEmpty(step)) {
5785
5822
  return [];
5786
5823
  }
@@ -5789,7 +5826,7 @@ var getComponents = (step, options) => {
5789
5826
  layout,
5790
5827
  schemas: step.schemas || [],
5791
5828
  actions: step.actions || [],
5792
- model: (_a = step.model) != null ? _a : null
5829
+ model: step.model ?? null
5793
5830
  });
5794
5831
  };
5795
5832
  var LayoutStep = (props) => {
@@ -5896,17 +5933,16 @@ var import_react33 = require("react");
5896
5933
 
5897
5934
  // src/step/cameraStep/cameraCapture/utils/index.ts
5898
5935
  var isSelfieCamera = (stream) => {
5899
- var _a;
5900
- const { facingMode } = ((_a = getVideoTrack(stream)) == null ? void 0 : _a.getSettings()) || {};
5936
+ const { facingMode } = getVideoTrack(stream)?.getSettings() || {};
5901
5937
  return facingMode === "user" || facingMode === void 0;
5902
5938
  };
5903
- var isMainBackCamera = (deviceInfo) => !!((deviceInfo == null ? void 0 : deviceInfo.label) || "").match(/camera2? 0/g);
5939
+ var isMainBackCamera = (deviceInfo) => !!(deviceInfo?.label || "").match(/camera2? 0/g);
5904
5940
  var generateCanvasFromVideo = async (video) => {
5905
5941
  const canvas = document.createElement("canvas");
5906
5942
  if (video) {
5907
5943
  canvas.setAttribute("height", `${video.videoHeight}`);
5908
5944
  canvas.setAttribute("width", `${video.videoWidth}`);
5909
- const context = canvas == null ? void 0 : canvas.getContext("2d");
5945
+ const context = canvas?.getContext("2d");
5910
5946
  if (context) {
5911
5947
  await new Promise((resolve) => setTimeout(resolve, 100));
5912
5948
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
@@ -5914,29 +5950,16 @@ var generateCanvasFromVideo = async (video) => {
5914
5950
  }
5915
5951
  return canvas;
5916
5952
  };
5917
- var getAvailableVideoDevices = async () => {
5918
- var _a, _b;
5919
- return (await ((_b = (_a = navigator == null ? void 0 : navigator.mediaDevices) == null ? void 0 : _a.enumerateDevices) == null ? void 0 : _b.call(_a)) || []).filter(
5920
- (deviceInfo) => deviceInfo.kind === "videoinput"
5921
- );
5922
- };
5923
- var getAvailableVideoDeviceLabels = async () => {
5924
- var _a, _b;
5925
- return (await ((_b = (_a = navigator == null ? void 0 : navigator.mediaDevices) == null ? void 0 : _a.enumerateDevices) == null ? void 0 : _b.call(_a)) || []).filter((deviceInfo) => deviceInfo.kind === "videoinput").map((deviceInfo) => deviceInfo.label);
5926
- };
5953
+ var getAvailableVideoDevices = async () => (await navigator?.mediaDevices?.enumerateDevices?.() || []).filter(
5954
+ (deviceInfo) => deviceInfo.kind === "videoinput"
5955
+ );
5956
+ var getAvailableVideoDeviceLabels = async () => (await navigator?.mediaDevices?.enumerateDevices?.() || []).filter((deviceInfo) => deviceInfo.kind === "videoinput").map((deviceInfo) => deviceInfo.label);
5927
5957
  var getActiveVideoDeviceLabel = async (videoStream) => {
5928
- var _a, _b, _c;
5929
5958
  const capabilities = getVideoCapabilities(videoStream);
5930
- return (_c = (await ((_b = (_a = navigator == null ? void 0 : navigator.mediaDevices) == null ? void 0 : _a.enumerateDevices) == null ? void 0 : _b.call(_a)) || []).filter((deviceInfo) => deviceInfo.kind === "videoinput").find((deviceInfo) => deviceInfo.deviceId === (capabilities == null ? void 0 : capabilities.deviceId))) == null ? void 0 : _c.label;
5931
- };
5932
- var getVideoTrack = (videoStream) => {
5933
- var _a;
5934
- return (((_a = videoStream == null ? void 0 : videoStream.getVideoTracks) == null ? void 0 : _a.call(videoStream)) || [])[0];
5935
- };
5936
- var getVideoCapabilities = (videoStream) => {
5937
- var _a, _b;
5938
- return (_b = (_a = getVideoTrack(videoStream)) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
5959
+ return (await navigator?.mediaDevices?.enumerateDevices?.() || []).filter((deviceInfo) => deviceInfo.kind === "videoinput").find((deviceInfo) => deviceInfo.deviceId === capabilities?.deviceId)?.label;
5939
5960
  };
5961
+ var getVideoTrack = (videoStream) => (videoStream?.getVideoTracks?.() || [])[0];
5962
+ var getVideoCapabilities = (videoStream) => getVideoTrack(videoStream)?.getCapabilities?.();
5940
5963
 
5941
5964
  // src/step/cameraStep/cameraCapture/hooks/index.ts
5942
5965
  var useVideoConstraints = (direction) => {
@@ -5954,10 +5977,11 @@ var useVideoConstraints = (direction) => {
5954
5977
  const getVideoConstraints = async (direction2) => {
5955
5978
  if (direction2 === "back") {
5956
5979
  const mainCamera = (await getAvailableVideoDevices()).find(isMainBackCamera);
5957
- if (mainCamera == null ? void 0 : mainCamera.deviceId) {
5958
- return __spreadProps(__spreadValues({}, defaultVideoConstraints), {
5980
+ if (mainCamera?.deviceId) {
5981
+ return {
5982
+ ...defaultVideoConstraints,
5959
5983
  deviceId: { exact: mainCamera.deviceId }
5960
- });
5984
+ };
5961
5985
  }
5962
5986
  }
5963
5987
  return defaultVideoConstraints;
@@ -5986,8 +6010,7 @@ var Overlay = ({
5986
6010
  const svgReference = (0, import_react34.useRef)(null);
5987
6011
  (0, import_react34.useEffect)(() => {
5988
6012
  const listener = debounce(() => {
5989
- var _a;
5990
- if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
6013
+ if (svgReference.current?.innerHTML) {
5991
6014
  const reference = svgReference.current;
5992
6015
  reference.innerHTML += "";
5993
6016
  }
@@ -6028,11 +6051,11 @@ var Overlay = ({
6028
6051
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
6029
6052
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("mask", { id: "mask", children: [
6030
6053
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
6031
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("image", __spreadValues({ href: overlay }, framePosition))
6054
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("image", { href: overlay, ...framePosition })
6032
6055
  ] }) }),
6033
6056
  overlay && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
6034
- outline && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("image", __spreadValues({ href: outline }, framePosition)),
6035
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
6057
+ outline && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("image", { href: outline, ...framePosition }),
6058
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "camera-capture-text-and-image-container", ...helperBoxPosition, children: helperBox }) })
6036
6059
  ] });
6037
6060
  };
6038
6061
  var Overlay_default = Overlay;
@@ -6103,22 +6126,22 @@ var CameraNotSupported = () => {
6103
6126
  var CameraNotSupported_default = CameraNotSupported;
6104
6127
 
6105
6128
  // src/step/cameraStep/cameraCapture/tracking/index.ts
6106
- var trackCameraPermissionDenied = (onEvent) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Permission Denied", {});
6107
- var trackCameraFeedStarted = async (onEvent, props, stream) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Feed Started", await getCameraStartedProperties(props, stream));
6108
- var trackCameraNotSupported = (onEvent, error) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Not Supported", { Error: error });
6129
+ var trackCameraPermissionDenied = (onEvent) => onEvent?.("Dynamic Flow - Camera Permission Denied", {});
6130
+ var trackCameraFeedStarted = async (onEvent, props, stream) => onEvent?.("Dynamic Flow - Camera Feed Started", await getCameraStartedProperties(props, stream));
6131
+ var trackCameraNotSupported = (onEvent, error) => onEvent?.("Dynamic Flow - Camera Not Supported", { Error: error });
6109
6132
  var getCameraStartedProperties = async (props, videoStream) => {
6110
- var _a;
6111
6133
  const videoTrack = getVideoTrack(videoStream);
6112
6134
  const capabilities = getVideoCapabilities(videoStream);
6113
- const settings = (_a = videoTrack == null ? void 0 : videoTrack.getSettings) == null ? void 0 : _a.call(videoTrack);
6114
- return __spreadProps(__spreadValues({}, videoTrack && {
6115
- "Available Video Devices (by label)": await getAvailableVideoDeviceLabels(),
6116
- "Active Video Device (by label)": await getActiveVideoDeviceLabel(videoStream),
6117
- "Camera Capabilities": capabilities,
6118
- "Camera Settings": settings
6119
- }), {
6120
- "Camera Direction (Asked)": props == null ? void 0 : props.direction
6121
- });
6135
+ const settings = videoTrack?.getSettings?.();
6136
+ return {
6137
+ ...videoTrack && {
6138
+ "Available Video Devices (by label)": await getAvailableVideoDeviceLabels(),
6139
+ "Active Video Device (by label)": await getActiveVideoDeviceLabel(videoStream),
6140
+ "Camera Capabilities": capabilities,
6141
+ "Camera Settings": settings
6142
+ },
6143
+ "Camera Direction (Asked)": props?.direction
6144
+ };
6122
6145
  };
6123
6146
 
6124
6147
  // src/step/cameraStep/cameraCapture/CameraCapture.tsx
@@ -6142,11 +6165,10 @@ var CameraCapture = ({
6142
6165
  const { videoConstraints } = useVideoConstraints(direction);
6143
6166
  const intl = (0, import_react_intl28.useIntl)();
6144
6167
  const handleCapture = (0, import_react35.useCallback)(async () => {
6145
- var _a, _b, _c, _d, _e, _f;
6146
- if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
6147
- (_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
6148
- const canvas = await generateCanvasFromVideo((_f = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _f.video);
6149
- canvas == null ? void 0 : canvas.toBlob(
6168
+ if (webcamReference?.current?.video && webcamReference?.current?.video?.readyState >= 3) {
6169
+ webcamReference?.current?.video?.pause();
6170
+ const canvas = await generateCanvasFromVideo(webcamReference?.current?.video);
6171
+ canvas?.toBlob(
6150
6172
  (blob) => {
6151
6173
  if (blob) {
6152
6174
  if (showReview) {
@@ -6165,7 +6187,7 @@ var CameraCapture = ({
6165
6187
  }, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
6166
6188
  const handleUserMediaError = (0, import_react35.useCallback)(
6167
6189
  (error) => {
6168
- if (error instanceof DOMException && (error == null ? void 0 : error.name) === "NotAllowedError") {
6190
+ if (error instanceof DOMException && error?.name === "NotAllowedError") {
6169
6191
  setMode("NO_CAMERA_ACCESS");
6170
6192
  trackCameraPermissionDenied(onEvent);
6171
6193
  return;
@@ -6184,7 +6206,7 @@ var CameraCapture = ({
6184
6206
  [setIsVideoMirrored, onEvent, direction]
6185
6207
  );
6186
6208
  const handleReviewSubmit = () => {
6187
- onCapture((reviewImage == null ? void 0 : reviewImage.blob) || null);
6209
+ onCapture(reviewImage?.blob || null);
6188
6210
  };
6189
6211
  const handleReviewRetry = () => {
6190
6212
  setMode("CAPTURE");
@@ -6216,7 +6238,7 @@ var CameraCapture = ({
6216
6238
  ready && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
6217
6239
  ] });
6218
6240
  const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
6219
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
6241
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: "review-image", src: reviewImage?.source, alt: "" }),
6220
6242
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
6221
6243
  Overlay_default,
6222
6244
  {
@@ -6315,11 +6337,10 @@ function getCameraSchema(step) {
6315
6337
  return firstProperty;
6316
6338
  }
6317
6339
  function getFirstAction(step) {
6318
- var _a, _b;
6319
- if (!step.schemas || ((_a = filterHiddenSchemas(step.schemas)) == null ? void 0 : _a.length) !== 1) {
6340
+ if (!step.schemas || filterHiddenSchemas(step.schemas)?.length !== 1) {
6320
6341
  throw new Error("camera step expects 1 non-hidden object schema");
6321
6342
  }
6322
- if (((_b = step == null ? void 0 : step.actions) == null ? void 0 : _b.length) !== 1) {
6343
+ if (step?.actions?.length !== 1) {
6323
6344
  throw new Error("camera step expects 1 action");
6324
6345
  }
6325
6346
  return step.actions[0];
@@ -6418,7 +6439,7 @@ var ExternalConfirmationStep_default = ExternalConfirmationStep;
6418
6439
  function getOrigin(url) {
6419
6440
  try {
6420
6441
  return new URL(url).origin;
6421
- } catch (e) {
6442
+ } catch {
6422
6443
  return url;
6423
6444
  }
6424
6445
  }
@@ -6433,7 +6454,7 @@ var BackButton = ({ title, action, onAction }) => {
6433
6454
  {
6434
6455
  onClick: (event) => {
6435
6456
  event.preventDefault();
6436
- onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
6457
+ onAction({ ...action, skipValidation: true });
6437
6458
  },
6438
6459
  href: "/",
6439
6460
  className: "df-back-btn",
@@ -6450,10 +6471,9 @@ var BackButton_default = BackButton;
6450
6471
  // src/dynamicFlow/DynamicFlowStep.tsx
6451
6472
  var import_jsx_runtime65 = require("react/jsx-runtime");
6452
6473
  var DynamicFlowStep = (props) => {
6453
- var _a, _b, _c;
6454
6474
  const { step, globalError, onAction } = props;
6455
- const externalUrl = (_a = step == null ? void 0 : step.external) == null ? void 0 : _a.url;
6456
- const backButton = ((_b = step == null ? void 0 : step.navigation) == null ? void 0 : _b.back) || ((_c = step == null ? void 0 : step.navigation) == null ? void 0 : _c.backButton);
6475
+ const externalUrl = step?.external?.url;
6476
+ const backButton = step?.navigation?.back || step?.navigation?.backButton;
6457
6477
  const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
6458
6478
  if (step === void 0) {
6459
6479
  return null;
@@ -6462,12 +6482,12 @@ var DynamicFlowStep = (props) => {
6462
6482
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
6463
6483
  }
6464
6484
  if (isCameraStep(step)) {
6465
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
6485
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(CameraStep_default, { ...props, step });
6466
6486
  }
6467
6487
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
6468
- backButton && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
6488
+ backButton && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BackButton_default, { ...backButton, onAction }),
6469
6489
  globalError ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
6470
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
6490
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LayoutStep_default, { ...props, stepSpecification: step })
6471
6491
  ] });
6472
6492
  };
6473
6493
 
@@ -6500,30 +6520,29 @@ var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && sche
6500
6520
  // src/dynamicFlow/utils/useDynamicFlowState.ts
6501
6521
  var import_react38 = require("react");
6502
6522
  var useDynamicFlowState = (initialStep) => {
6503
- var _a, _b;
6504
- const [formErrors, setFormErrors] = (0, import_react38.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
6505
- const [globalError, setGlobalError] = (0, import_react38.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
6523
+ const [formErrors, setFormErrors] = (0, import_react38.useState)(initialStep?.errors?.validation);
6524
+ const [globalError, setGlobalError] = (0, import_react38.useState)(initialStep?.errors?.error);
6506
6525
  const [stepAndModels, setStepAndModels] = (0, import_react38.useState)({
6507
6526
  step: initialStep || void 0,
6508
- models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
6527
+ models: initialStep?.model ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
6509
6528
  etag: void 0
6510
6529
  });
6511
6530
  const { step, models, etag } = stepAndModels;
6512
6531
  const setStepAndEtag = (step2, etag2) => {
6513
- var _a2, _b2, _c, _d;
6514
6532
  setStepAndModels((previous) => ({
6515
6533
  step: step2,
6516
6534
  models: step2.model ? buildInitialModels(step2.model, getAllSchemas(step2)) : previous.models,
6517
6535
  etag: etag2
6518
6536
  }));
6519
- setFormErrors((_b2 = (_a2 = step2 == null ? void 0 : step2.errors) == null ? void 0 : _a2.validation) != null ? _b2 : null);
6520
- setGlobalError((_d = (_c = step2 == null ? void 0 : step2.errors) == null ? void 0 : _c.error) != null ? _d : null);
6537
+ setFormErrors(step2?.errors?.validation ?? null);
6538
+ setGlobalError(step2?.errors?.error ?? null);
6521
6539
  };
6522
6540
  const setSchemaModel = (schemaId, objectModel, onModelsUpdated) => {
6523
6541
  setStepAndModels((previous) => {
6524
- const updatedModels = __spreadProps(__spreadValues({}, previous.models), {
6542
+ const updatedModels = {
6543
+ ...previous.models,
6525
6544
  [schemaId]: objectModel
6526
- });
6545
+ };
6527
6546
  const updatedState = {
6528
6547
  step: previous.step,
6529
6548
  models: updatedModels,
@@ -6555,14 +6574,15 @@ var buildInitialModels = (model, schemas = []) => {
6555
6574
  if (!schema.$id) {
6556
6575
  console.warn("Schema without $id property found.");
6557
6576
  }
6558
- return __spreadProps(__spreadValues({}, acc), {
6577
+ return {
6578
+ ...acc,
6559
6579
  [schema.$id || ""]: getValidObjectModelParts(model, schema) || {}
6560
- });
6580
+ };
6561
6581
  }, {});
6562
6582
  };
6563
6583
  var getAllSchemas = (step) => [
6564
- ...getAllSchemasInLayout((step == null ? void 0 : step.layout) || []),
6565
- ...(step == null ? void 0 : step.schemas) || []
6584
+ ...getAllSchemasInLayout(step?.layout || []),
6585
+ ...step?.schemas || []
6566
6586
  ];
6567
6587
  var getAllSchemasInLayout = (components) => components.flatMap((component) => {
6568
6588
  switch (component.type) {
@@ -6577,8 +6597,8 @@ var getAllSchemasInLayout = (components) => components.flatMap((component) => {
6577
6597
  }
6578
6598
  });
6579
6599
  var getAllValidatableSchemas = (step) => [
6580
- ...getAllReferencedSchemaIds((step == null ? void 0 : step.layout) || []).map((id) => ((step == null ? void 0 : step.schemas) || []).find((schema) => schema.$id === id)).filter(Boolean),
6581
- ...getAllSchemasInLayout((step == null ? void 0 : step.layout) || [])
6600
+ ...getAllReferencedSchemaIds(step?.layout || []).map((id) => (step?.schemas || []).find((schema) => schema.$id === id)).filter(Boolean),
6601
+ ...getAllSchemasInLayout(step?.layout || [])
6582
6602
  ];
6583
6603
  var getAllReferencedSchemaIds = (components) => components.flatMap((component) => {
6584
6604
  switch (component.type) {
@@ -6593,12 +6613,12 @@ var getAllReferencedSchemaIds = (components) => components.flatMap((component) =
6593
6613
  }
6594
6614
  }).filter(Boolean);
6595
6615
  var areModelsValid = (formModels, schemas = []) => {
6596
- return !(schemas == null ? void 0 : schemas.some((schema) => {
6616
+ return !schemas?.some((schema) => {
6597
6617
  if (!schema.$id) {
6598
6618
  console.warn("Schema without $id property found.");
6599
6619
  }
6600
6620
  return !isValidSchema(formModels[schema.$id || ""] || {}, schema);
6601
- }));
6621
+ });
6602
6622
  };
6603
6623
  var getSchemaReference = (component) => {
6604
6624
  if (component.schema && !isInlineSchema(component.schema)) {
@@ -6615,11 +6635,12 @@ var import_components31 = require("@transferwise/components");
6615
6635
  var import_react39 = require("react");
6616
6636
  var import_jsx_runtime66 = require("react/jsx-runtime");
6617
6637
  function useLoader(loaderConfig, initialState) {
6618
- const config = __spreadValues({
6638
+ const config = {
6619
6639
  size: import_components31.Size.EXTRA_LARGE,
6620
6640
  initial: true,
6621
- submission: false
6622
- }, loaderConfig);
6641
+ submission: false,
6642
+ ...loaderConfig
6643
+ };
6623
6644
  const [loadingState, setLoadingState] = (0, import_react39.useState)(initialState);
6624
6645
  const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
6625
6646
  const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
@@ -6730,17 +6751,16 @@ var parseExitResponse = async (response) => {
6730
6751
  return { type: "exit", result: await getJsonObjectOrNull(response) };
6731
6752
  };
6732
6753
  var parseFetchResponse = async (response) => {
6733
- var _a, _b, _c;
6734
6754
  assertResponseIsValid(response);
6735
- if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
6755
+ if (response.headers?.has("X-Df-Response-Type")) {
6736
6756
  const type = response.headers.get("X-Df-Response-Type");
6737
6757
  return parseFetchResponseByResponseType(response, type);
6738
6758
  }
6739
- if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-ResponseType")) {
6759
+ if (response.headers?.has("X-Df-ResponseType")) {
6740
6760
  const type = response.headers.get("X-Df-ResponseType");
6741
6761
  return parseFetchResponseByResponseType(response, type);
6742
6762
  }
6743
- if ((_c = response.headers) == null ? void 0 : _c.has("X-Df-Exit")) {
6763
+ if (response.headers?.has("X-Df-Exit")) {
6744
6764
  return parseExitResponse(response);
6745
6765
  }
6746
6766
  const jsonBody = await parseResponseJson(response.clone());
@@ -6768,7 +6788,7 @@ var getJsonObjectOrNull = async (response) => {
6768
6788
  var parseResponseJson = async (response) => {
6769
6789
  try {
6770
6790
  return await response.json();
6771
- } catch (e) {
6791
+ } catch {
6772
6792
  return null;
6773
6793
  }
6774
6794
  };
@@ -6818,12 +6838,9 @@ var DynamicFlowComponent = ({
6818
6838
  loaderConfig,
6819
6839
  initialStep ? "idle" : "initial"
6820
6840
  );
6821
- const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
6841
+ const logCritical = getLogger("critical", onLog, flowId, step?.id || step?.key);
6822
6842
  const analyticsMetadata = (0, import_react41.useMemo)(
6823
- () => {
6824
- var _a;
6825
- return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
6826
- },
6843
+ () => ({ flowId, stepId: step?.id || step?.key, ...step?.analytics ?? {} }),
6827
6844
  [flowId, step]
6828
6845
  );
6829
6846
  const dispatchEvent = (0, import_react41.useMemo)(
@@ -6833,13 +6850,14 @@ var DynamicFlowComponent = ({
6833
6850
  const dfHttpClient = (0, import_react41.useCallback)(
6834
6851
  ({ action, data, etag: etag2 }) => {
6835
6852
  const { url, method = "POST" } = action;
6836
- return httpClient(url != null ? url : "", {
6853
+ return httpClient(url ?? "", {
6837
6854
  method,
6838
- headers: __spreadValues({
6855
+ headers: {
6839
6856
  "accept-language": locale,
6840
6857
  // FIXME move this out of the library https://transferwise.atlassian.net/browse/MC-3286
6841
- "Content-Type": "application/json"
6842
- }, etag2 ? { "If-None-Match": etag2 } : {}),
6858
+ "Content-Type": "application/json",
6859
+ ...etag2 ? { "If-None-Match": etag2 } : {}
6860
+ },
6843
6861
  credentials: "include",
6844
6862
  body: method === "GET" ? void 0 : JSON.stringify(data)
6845
6863
  });
@@ -6877,7 +6895,7 @@ var DynamicFlowComponent = ({
6877
6895
  };
6878
6896
  const handleExitResponse = async (response, actionResult) => {
6879
6897
  const exitResult = await getJsonObjectOrNull(response);
6880
- dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
6898
+ dispatchEventAndComplete({ ...exitResult, ...actionResult });
6881
6899
  };
6882
6900
  const debouncedRefresh = useDebouncedRefresh(performRefresh);
6883
6901
  const dispatchEventAndComplete = (0, import_react41.useCallback)(
@@ -6892,10 +6910,11 @@ var DynamicFlowComponent = ({
6892
6910
  }, []);
6893
6911
  (0, import_react41.useEffect)(() => {
6894
6912
  if (!initialStep) {
6895
- const action = __spreadValues({
6913
+ const action = {
6896
6914
  id: "#initial-step-request",
6897
- method: "GET"
6898
- }, initialAction);
6915
+ method: "GET",
6916
+ ...initialAction
6917
+ };
6899
6918
  void performAction(action, action.data);
6900
6919
  }
6901
6920
  }, [httpClient, locale, JSON.stringify(initialStep), JSON.stringify(initialAction)]);
@@ -6927,9 +6946,10 @@ var DynamicFlowComponent = ({
6927
6946
  setLoadingState("idle");
6928
6947
  if (fetchType === "submission") {
6929
6948
  setSubmitted(false);
6930
- dispatchEvent("Dynamic Flow - Step Started", __spreadValues({
6931
- stepId: newStep.id || newStep.key
6932
- }, newStep == null ? void 0 : newStep.analytics));
6949
+ dispatchEvent("Dynamic Flow - Step Started", {
6950
+ stepId: newStep.id || newStep.key,
6951
+ ...newStep?.analytics
6952
+ });
6933
6953
  } else {
6934
6954
  dispatchEvent("Dynamic Flow - Step Refreshed", { status: "success" });
6935
6955
  }
@@ -6975,7 +6995,7 @@ var DynamicFlowComponent = ({
6975
6995
  const { triggerSchema } = props;
6976
6996
  if (shouldTriggerRefresh(props)) {
6977
6997
  const triggerSchemaRefreshUrl = triggerSchema.refreshUrl || triggerSchema.refreshFormUrl;
6978
- const stepRefreshUrl = (step == null ? void 0 : step.refreshUrl) || (step == null ? void 0 : step.refreshFormUrl);
6998
+ const stepRefreshUrl = step?.refreshUrl || step?.refreshFormUrl;
6979
6999
  const refreshUrl = triggerSchemaRefreshUrl || stepRefreshUrl;
6980
7000
  if (refreshUrl) {
6981
7001
  debouncedRefresh(refreshUrl, combineModels2(updatedModels), etag, triggerSchema);
@@ -6992,7 +7012,7 @@ var DynamicFlowComponent = ({
6992
7012
  }
6993
7013
  const actionHandler = action.exit ? performExitAction : performAction;
6994
7014
  const { data, method, skipValidation } = action;
6995
- const submissionData = __spreadValues(__spreadValues({}, combineModels2(models)), data);
7015
+ const submissionData = { ...combineModels2(models), ...data };
6996
7016
  if (isSubmissionMethod(method)) {
6997
7017
  setFormErrors(null);
6998
7018
  if (!skipValidation) {
@@ -7005,7 +7025,7 @@ var DynamicFlowComponent = ({
7005
7025
  await actionHandler(action);
7006
7026
  }
7007
7027
  };
7008
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7028
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(LogProvider, { flowId, stepId: step?.id || step?.key, onLog, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7009
7029
  DynamicFlowStep,
7010
7030
  {
7011
7031
  step,
@@ -7021,10 +7041,10 @@ var DynamicFlowComponent = ({
7021
7041
  }
7022
7042
  ) }) }) }) });
7023
7043
  };
7024
- var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
7044
+ var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DynamicFlowComponent, { ...props }) });
7025
7045
  var DynamicFlow_default = DynamicFlow;
7026
7046
  var combineModels2 = (formModels) => {
7027
- return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
7047
+ return Object.values(formModels).reduce((previous, model) => ({ ...previous, ...model }), {});
7028
7048
  };
7029
7049
  var isSubmissionMethod = (method = "POST") => {
7030
7050
  const submissionMethods = ["POST", "PUT", "PATCH"];
@@ -7034,7 +7054,7 @@ var shouldTriggerRefresh = (props) => {
7034
7054
  const { type, triggerSchema, triggerModel, lastTriggerModel = null } = props;
7035
7055
  const isValid = () => isValidSchema(triggerModel, triggerSchema);
7036
7056
  const wasValid = () => isValidSchema(lastTriggerModel, triggerSchema);
7037
- const hasRefreshOnChange = (triggerSchema == null ? void 0 : triggerSchema.refreshStepOnChange) || (triggerSchema == null ? void 0 : triggerSchema.refreshFormOnChange);
7057
+ const hasRefreshOnChange = triggerSchema?.refreshStepOnChange || triggerSchema?.refreshFormOnChange;
7038
7058
  return type !== "init" && hasRefreshOnChange && (isValid() || wasValid());
7039
7059
  };
7040
7060
 
@@ -7129,7 +7149,7 @@ var en_default = {
7129
7149
  // src/i18n/es.json
7130
7150
  var es_default = {
7131
7151
  "dynamicFlows.ArraySchema.addItem": "Guardar",
7132
- "dynamicFlows.ArraySchema.addItemTitle": "Add Item",
7152
+ "dynamicFlows.ArraySchema.addItemTitle": "A\xF1adir elemento",
7133
7153
  "dynamicFlows.ArraySchema.editItem": "Guardar",
7134
7154
  "dynamicFlows.ArraySchema.maxItemsError": "A\xF1ade {maxItems} o menos.",
7135
7155
  "dynamicFlows.ArraySchema.minItemsError": "A\xF1ade al menos {minItems}.",