@wise/dynamic-flow-client 3.19.7 → 3.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/build/main.js +146 -117
  2. package/build/main.min.js +1 -1
  3. package/build/main.mjs +146 -117
  4. package/build/types/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +0 -5
  5. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +1 -6
  6. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -6
  7. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -6
  8. package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +1 -8
  9. package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +0 -8
  10. package/build/types/legacy/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +0 -6
  11. package/build/types/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +0 -6
  12. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -5
  13. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -5
  14. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -5
  15. package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +1 -4
  16. package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +0 -9
  17. package/build/types/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -5
  18. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +4 -1
  19. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +1 -0
  20. package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
  21. package/build/types/revamp/domain/types.d.ts +2 -1
  22. package/build/types/revamp/types.d.ts +3 -2
  23. package/build/types/revamp/useDynamicFlowCore.d.ts +1 -0
  24. package/build/types/revamp/utils/openLinkInNewTab.d.ts +1 -0
  25. package/package.json +17 -18
package/build/main.mjs CHANGED
@@ -138,19 +138,20 @@ var init_clsx = __esm({
138
138
  }
139
139
  });
140
140
 
141
- // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js
141
+ // ../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js
142
142
  import { useState as useState2, useEffect as useEffect2, forwardRef, Suspense, lazy } from "react";
143
143
  import { jsx as jsx17, jsxs as jsxs4, Fragment as Fragment3 } from "react/jsx-runtime";
144
144
  var unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
145
- var init_index_93a0c34e_esm = __esm({
146
- "../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js"() {
145
+ var init_index_a91e5689_esm = __esm({
146
+ "../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js"() {
147
147
  "use strict";
148
148
  init_clsx();
149
149
  unknownFlagName = "wise";
150
150
  Flag = ({
151
151
  code,
152
152
  intrinsicSize = 64,
153
- className = void 0
153
+ className = void 0,
154
+ loading = "lazy"
154
155
  }) => {
155
156
  const [fallback, setFallback] = useState2(null);
156
157
  useEffect2(() => {
@@ -161,6 +162,7 @@ var init_index_93a0c34e_esm = __esm({
161
162
  return /* @__PURE__ */ jsx17("img", {
162
163
  className: clsx(`wds-flag wds-flag-${name}`, className),
163
164
  src: `https://wise.com/web-art/assets/flags/${name}.svg`,
165
+ loading,
164
166
  alt: "",
165
167
  width: intrinsicSize,
166
168
  height: intrinsicSize,
@@ -6990,25 +6992,89 @@ var getActionByReference = ($ref, actions = []) => {
6990
6992
  };
6991
6993
 
6992
6994
  // src/revamp/domain/mappers/layout/buttonLayoutToComponent.ts
6993
- var buttonLayoutToComponent = (uid, button, { onAction, step }) => {
6995
+ var buttonLayoutToComponent = (uid, button, mapperProps) => {
6996
+ if (button.behavior) {
6997
+ return buttonLayoutToComponentWithBehavior(
6998
+ uid,
6999
+ __spreadProps(__spreadValues({}, button), { behavior: button.behavior }),
7000
+ mapperProps
7001
+ );
7002
+ }
7003
+ if (button.action) {
7004
+ return buttonLayoutToComponentWithAction(
7005
+ uid,
7006
+ __spreadProps(__spreadValues({}, button), { action: button.action }),
7007
+ mapperProps
7008
+ );
7009
+ }
7010
+ return buttonLayoutToComponentWithNoop(uid, button);
7011
+ };
7012
+ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
7013
+ const { onAction, onLink, step } = mapperProps;
7014
+ const { context, control, disabled, margin = "md", pinOrder, size, title, behavior } = button;
7015
+ const { action, link } = behavior;
7016
+ const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : null;
7017
+ const onClick = (() => {
7018
+ if (inlinedAction) {
7019
+ return () => {
7020
+ void onAction(inlinedAction);
7021
+ };
7022
+ }
7023
+ if (link) {
7024
+ return () => {
7025
+ onLink(link.url);
7026
+ };
7027
+ }
7028
+ return () => {
7029
+ };
7030
+ })();
7031
+ return createButtonComponent({
7032
+ uid,
7033
+ context: mapLegacyContext(context != null ? context : "neutral"),
7034
+ control,
7035
+ disabled: disabled != null ? disabled : false,
7036
+ margin,
7037
+ pinOrder,
7038
+ size,
7039
+ title: title != null ? title : "",
7040
+ onClick
7041
+ });
7042
+ };
7043
+ var buttonLayoutToComponentWithAction = (uid, button, mapperProps) => {
7044
+ const { onAction, step } = mapperProps;
6994
7045
  const { context, control, disabled, margin = "md", pinOrder, size, title } = button;
6995
- const action = button.action ? inlineAction(button.action, step == null ? void 0 : step.actions) : {};
6996
- const onClick = button.action ? () => {
6997
- void onAction(action);
6998
- } : () => {
7046
+ const { action } = button;
7047
+ const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : {};
7048
+ const onClick = () => {
7049
+ void onAction(inlinedAction);
6999
7050
  };
7000
7051
  return createButtonComponent({
7001
7052
  uid,
7002
- context: getButtonContext({ context, action }),
7003
- control: getButtonControl({ control, action }),
7004
- disabled: getButtonDisabled({ disabled, action }),
7053
+ context: getButtonContext({ context, action: inlinedAction }),
7054
+ control: getButtonControl({ control, action: inlinedAction }),
7055
+ disabled: getButtonDisabled({ disabled, action: inlinedAction }),
7005
7056
  margin,
7006
7057
  pinOrder,
7007
7058
  size,
7008
- title: getButtonTitle({ title, action }),
7059
+ title: getButtonTitle({ title, action: inlinedAction }),
7009
7060
  onClick
7010
7061
  });
7011
7062
  };
7063
+ var buttonLayoutToComponentWithNoop = (uid, button) => {
7064
+ const { context, control, disabled, margin = "md", pinOrder, size, title } = button;
7065
+ return createButtonComponent({
7066
+ uid,
7067
+ context: mapLegacyContext(context != null ? context : "neutral"),
7068
+ control,
7069
+ disabled: disabled != null ? disabled : false,
7070
+ margin,
7071
+ pinOrder,
7072
+ size,
7073
+ title: title != null ? title : "",
7074
+ onClick: () => {
7075
+ }
7076
+ });
7077
+ };
7012
7078
  var getButtonTitle = ({ title, action }) => {
7013
7079
  var _a;
7014
7080
  return (_a = title != null ? title : action == null ? void 0 : action.title) != null ? _a : "";
@@ -10707,6 +10773,7 @@ function useDynamicFlowCore(props) {
10707
10773
  const httpClient = useStableCallback(rest.httpClient);
10708
10774
  const onCompletion = useStableCallback(rest.onCompletion);
10709
10775
  const onValueChange = useStableCallback(props.onValueChange);
10776
+ const onLink = useStableCallback(props.onLink);
10710
10777
  const onError = useStableCallback(rest.onError);
10711
10778
  const onEvent = useStableCallback(rest.onEvent);
10712
10779
  const onLog = useStableCallback(rest.onLog);
@@ -10770,6 +10837,7 @@ function useDynamicFlowCore(props) {
10770
10837
  onAction,
10771
10838
  onRefresh,
10772
10839
  onPoll,
10840
+ onLink,
10773
10841
  onValueChange
10774
10842
  });
10775
10843
  setStepComponent(() => {
@@ -10948,14 +11016,7 @@ function DynamicFlowCore(props) {
10948
11016
  onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed", { error });
10949
11017
  onError == null ? void 0 : onError(error);
10950
11018
  },
10951
- children: /* @__PURE__ */ jsx5(
10952
- "div",
10953
- {
10954
- id: (_b = (_a = stepComponentRef.current) == null ? void 0 : _a.step) == null ? void 0 : _b.id,
10955
- className: "dynamic-flow",
10956
- children: stepComponentRef.current ? render(stepComponentRef.current) : null
10957
- }
10958
- )
11019
+ children: /* @__PURE__ */ jsx5("div", { id: (_b = (_a = stepComponentRef.current) == null ? void 0 : _a.step) == null ? void 0 : _b.id, className: "dynamic-flow", children: stepComponentRef.current ? render(stepComponentRef.current) : null })
10959
11020
  }
10960
11021
  );
10961
11022
  }
@@ -11337,8 +11398,8 @@ var DateInputRenderer_default = DateInputRenderer;
11337
11398
  // ../renderers/src/DecisionRenderer.tsx
11338
11399
  import { NavigationOptionsList, NavigationOption, Header } from "@transferwise/components";
11339
11400
 
11340
- // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
11341
- init_index_93a0c34e_esm();
11401
+ // ../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
11402
+ init_index_a91e5689_esm();
11342
11403
  init_clsx();
11343
11404
  import "react";
11344
11405
  import "react/jsx-runtime";
@@ -13021,13 +13082,24 @@ var getWiseRenderers = () => [
13021
13082
  StepRenderer
13022
13083
  ];
13023
13084
 
13085
+ // src/revamp/utils/openLinkInNewTab.tsx
13086
+ var openLinkInNewTab = (url) => {
13087
+ var _a;
13088
+ try {
13089
+ const w = (_a = window == null ? void 0 : window.open) == null ? void 0 : _a.call(window, url, "_blank");
13090
+ return Boolean(w);
13091
+ } catch (e) {
13092
+ return false;
13093
+ }
13094
+ };
13095
+
13024
13096
  // src/revamp/DynamicFlowWise.tsx
13025
13097
  import { jsx as jsx58 } from "react/jsx-runtime";
13026
13098
  var wiseRenderers = getWiseRenderers();
13027
13099
  function DynamicFlowWise(props) {
13028
- const { httpClient, renderers } = props;
13100
+ const { httpClient, renderers, onLink = openLinkInNewTab } = props;
13029
13101
  const mergedRenderers = useMemo4(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
13030
- return /* @__PURE__ */ jsx58(RendererHttpClientProvider, { httpClient, children: /* @__PURE__ */ jsx58(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers })) });
13102
+ return /* @__PURE__ */ jsx58(RendererHttpClientProvider, { httpClient, children: /* @__PURE__ */ jsx58(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers, onLink })) });
13031
13103
  }
13032
13104
  var DynamicFlowWise_default = DynamicFlowWise;
13033
13105
 
@@ -13058,10 +13130,17 @@ var useHasHttpClientProvider = () => {
13058
13130
  import { jsx as jsx60 } from "react/jsx-runtime";
13059
13131
  var wiseRenderers2 = getWiseRenderers();
13060
13132
  var DynamicFragmentWise = forwardRef2(function DynamicFragmentWise2(props, ref) {
13061
- const { httpClient, onCompletion = () => {
13062
- }, onEvent, onError, renderers } = props;
13133
+ const {
13134
+ httpClient,
13135
+ onCompletion = () => {
13136
+ },
13137
+ onEvent,
13138
+ onError,
13139
+ renderers,
13140
+ onLink = openLinkInNewTab
13141
+ } = props;
13063
13142
  const mergedRenderers = useMemo6(() => [...renderers != null ? renderers : [], ...wiseRenderers2], [renderers]);
13064
- const { stepComponentRef } = useDynamicFlowCore(__spreadValues({ onCompletion }, props));
13143
+ const { stepComponentRef } = useDynamicFlowCore(__spreadProps(__spreadValues({ onCompletion }, props), { onLink }));
13065
13144
  useImperativeHandle(
13066
13145
  ref,
13067
13146
  () => ({
@@ -13099,8 +13178,8 @@ import { forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle2,
13099
13178
  import { jsx as jsx61 } from "react/jsx-runtime";
13100
13179
  var DynamicFragmentCore = forwardRef3(function DynamicFragmentCore2(props, ref) {
13101
13180
  const { onCompletion = () => {
13102
- }, onEvent, onError, renderers } = props;
13103
- const { stepComponentRef } = useDynamicFlowCore(__spreadValues({ onCompletion }, props));
13181
+ }, onEvent, onError, onLink = openLinkInNewTab, renderers } = props;
13182
+ const { stepComponentRef } = useDynamicFlowCore(__spreadProps(__spreadValues({ onCompletion }, props), { onLink }));
13104
13183
  useImperativeHandle2(
13105
13184
  ref,
13106
13185
  () => ({
@@ -14835,6 +14914,7 @@ var getSchemaColumnClasses = (width) => ({
14835
14914
  "col-sm-4": width === "sm"
14836
14915
  });
14837
14916
  function AllOfSchema(props) {
14917
+ const { disabled = false } = props;
14838
14918
  const onChangeModelIndex = (index, onChangeProps) => {
14839
14919
  const modelSchema = props.schema.allOf[index];
14840
14920
  models[index] = getValidObjectModelParts(onChangeProps.model, modelSchema) || {};
@@ -14854,7 +14934,7 @@ function AllOfSchema(props) {
14854
14934
  model: models[index],
14855
14935
  errors: props.errors,
14856
14936
  submitted: props.submitted,
14857
- disabled: props.disabled,
14937
+ disabled,
14858
14938
  onChange: (onChangeProps) => onChangeModelIndex(index, __spreadProps(__spreadValues({}, onChangeProps), {
14859
14939
  // We can safely assume that the model here is going to be of the same type as the model prop
14860
14940
  model: onChangeProps.model
@@ -14865,9 +14945,6 @@ function AllOfSchema(props) {
14865
14945
  )) })
14866
14946
  ] });
14867
14947
  }
14868
- AllOfSchema.defaultProps = {
14869
- disabled: false
14870
- };
14871
14948
  var AllOfSchema_default = AllOfSchema;
14872
14949
 
14873
14950
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
@@ -14884,28 +14961,22 @@ import { formatDate as formatDate3 } from "@transferwise/formatting";
14884
14961
  import { useIntl as useIntl11 } from "react-intl";
14885
14962
  import { jsx as jsx78, jsxs as jsxs27 } from "react/jsx-runtime";
14886
14963
  function ControlFeedback(props) {
14887
- var _a;
14964
+ const { errors = "", validations = [], validationMessages = {} } = props;
14888
14965
  const defaultValidationMessages = useDefaultValidationMessages(props.schema);
14889
- const validationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), props.validationMessages), props.schema.validationMessages);
14890
- const isErrorVisible = (props.submitted || !props.changed) && Boolean(props.errors);
14891
- const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
14966
+ const mergedValidationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), validationMessages), props.schema.validationMessages);
14967
+ const isErrorVisible = (props.submitted || !props.changed) && Boolean(errors);
14968
+ const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean(validations == null ? void 0 : validations.length);
14892
14969
  const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
14893
14970
  const hasInfoMessage = Boolean(props.infoMessage);
14894
14971
  return /* @__PURE__ */ jsxs27("div", { id: props.id, children: [
14895
- isErrorVisible ? /* @__PURE__ */ jsx78(InlineAlert3, { type: "error", children: props.errors }) : null,
14896
- isValidationVisible ? /* @__PURE__ */ jsx78(InlineAlert3, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ jsx78("div", { children: validationMessages[validation] }, validation)) }) : null,
14972
+ isErrorVisible ? /* @__PURE__ */ jsx78(InlineAlert3, { type: "error", children: errors }) : null,
14973
+ isValidationVisible ? /* @__PURE__ */ jsx78(InlineAlert3, { type: "error", children: validations.map((validation) => /* @__PURE__ */ jsx78("div", { children: mergedValidationMessages[validation] }, validation)) }) : null,
14897
14974
  (isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ jsxs27(InlineAlert3, { type: "info", children: [
14898
14975
  isDescriptionVisible && /* @__PURE__ */ jsx78("div", { children: props.schema.description }),
14899
14976
  hasInfoMessage && /* @__PURE__ */ jsx78("div", { children: props.infoMessage })
14900
14977
  ] })
14901
14978
  ] });
14902
14979
  }
14903
- ControlFeedback.defaultProps = {
14904
- errors: "",
14905
- validations: [],
14906
- validationMessages: {},
14907
- validationAsyncSuccessMessage: null
14908
- };
14909
14980
  function useDefaultValidationMessages(schema) {
14910
14981
  const { formatMessage, locale } = useIntl11();
14911
14982
  const formattedMessages = {
@@ -15025,7 +15096,7 @@ function useFormattedDefaultErrorMessages({
15025
15096
  import { jsx as jsx79, jsxs as jsxs28 } from "react/jsx-runtime";
15026
15097
  function MultipleFileUploadSchema(props) {
15027
15098
  var _a, _b;
15028
- const { onChange, schema } = props;
15099
+ const { onChange, errors = null, schema, required = false } = props;
15029
15100
  const onEvent = useEventDispatcher();
15030
15101
  const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
15031
15102
  const uid = useMemo12(() => schema.$id || generateRandomId(), [schema.$id]);
@@ -15062,8 +15133,8 @@ function MultipleFileUploadSchema(props) {
15062
15133
  }
15063
15134
  const validFiles = getSuccessfullyProcessedFiles(files);
15064
15135
  const fileIds = validFiles.map((file) => file.id);
15065
- const fileListValidationFailures = getArrayValidationFailures(fileIds, schema, props.required);
15066
- const showError = Boolean(props.errors) || (inputChanged || props.submitted) && Boolean(fileListValidationFailures.length);
15136
+ const fileListValidationFailures = getArrayValidationFailures(fileIds, schema, required);
15137
+ const showError = Boolean(errors) || (inputChanged || props.submitted) && Boolean(fileListValidationFailures.length);
15067
15138
  const accepts = "accepts" in fileSchemaDescriptor && fileSchemaDescriptor.accepts;
15068
15139
  const maxSize = "maxSize" in fileSchemaDescriptor && fileSchemaDescriptor.maxSize;
15069
15140
  const uploadInputProps = __spreadProps(__spreadValues(__spreadValues({
@@ -15092,14 +15163,10 @@ function MultipleFileUploadSchema(props) {
15092
15163
  id: feedbackId,
15093
15164
  changed: inputChanged,
15094
15165
  submitted: props.submitted,
15095
- errors: props.errors,
15166
+ errors,
15096
15167
  schema: props.schema,
15097
15168
  validations: fileListValidationFailures,
15098
- validationMessages: getValidationMessages(
15099
- schema,
15100
- Boolean(props.required),
15101
- defaultErrorMessages
15102
- ),
15169
+ validationMessages: getValidationMessages(schema, Boolean(required), defaultErrorMessages),
15103
15170
  infoMessage: null,
15104
15171
  focused: false,
15105
15172
  blurred: true
@@ -15107,10 +15174,6 @@ function MultipleFileUploadSchema(props) {
15107
15174
  )
15108
15175
  ] });
15109
15176
  }
15110
- MultipleFileUploadSchema.defaultProps = {
15111
- errors: null,
15112
- required: false
15113
- };
15114
15177
  var MultipleFileUploadSchema_default = MultipleFileUploadSchema;
15115
15178
  function getSuccessfullyProcessedFiles(allFiles) {
15116
15179
  return allFiles.filter((file) => !file.error && file.status === "succeeded");
@@ -15807,22 +15870,18 @@ var RepeatableSchema_default = RepeatableSchema;
15807
15870
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
15808
15871
  import { jsx as jsx85 } from "react/jsx-runtime";
15809
15872
  function ArrayListSchema(props) {
15810
- const { schema } = props;
15873
+ const { errors = null, schema } = props;
15811
15874
  if (isMultipleFileUploadSchema(schema)) {
15812
- return /* @__PURE__ */ jsx85(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
15875
+ return /* @__PURE__ */ jsx85(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
15813
15876
  }
15814
15877
  if (isMultiSelectConstSchema(schema)) {
15815
- return /* @__PURE__ */ jsx85(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
15878
+ return /* @__PURE__ */ jsx85(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { errors, schema }));
15816
15879
  }
15817
15880
  if (isListArraySchema(schema)) {
15818
- return /* @__PURE__ */ jsx85(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
15881
+ return /* @__PURE__ */ jsx85(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
15819
15882
  }
15820
15883
  throw new Error("Invalid array list schema");
15821
15884
  }
15822
- ArrayListSchema.defaultProps = {
15823
- errors: null,
15824
- required: false
15825
- };
15826
15885
  var ArrayListSchema_default = ArrayListSchema;
15827
15886
 
15828
15887
  // src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
@@ -15834,9 +15893,6 @@ var ArraySchema = (props) => {
15834
15893
  }
15835
15894
  throw new Error("Not implemented");
15836
15895
  };
15837
- ArraySchema.defaultProps = {
15838
- required: false
15839
- };
15840
15896
  var ArraySchema_default = ArraySchema;
15841
15897
 
15842
15898
  // src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
@@ -15850,6 +15906,7 @@ var getSchemaColumnClasses2 = (width) => ({
15850
15906
  "col-sm-4": width === "sm"
15851
15907
  });
15852
15908
  function ObjectSchema(props) {
15909
+ const { disabled = false, hideTitle = false } = props;
15853
15910
  const [model, setModel] = useState17(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
15854
15911
  const onChangeProperty = (propertyName, onChangeProps) => {
15855
15912
  if (onChangeProps.model !== null) {
@@ -15882,8 +15939,8 @@ function ObjectSchema(props) {
15882
15939
  return /* @__PURE__ */ jsxs31(Fragment13, { children: [
15883
15940
  props.schema.alert && /* @__PURE__ */ jsx87(DynamicAlert_default, { component: props.schema.alert }),
15884
15941
  /* @__PURE__ */ jsxs31("fieldset", { children: [
15885
- props.schema.title && !props.hideTitle && /* @__PURE__ */ jsx87(Header10, { title: props.schema.title, as: "legend" }),
15886
- props.schema.description && !props.hideTitle && /* @__PURE__ */ jsxs31("p", { children: [
15942
+ props.schema.title && !hideTitle && /* @__PURE__ */ jsx87(Header10, { title: props.schema.title, as: "legend" }),
15943
+ props.schema.description && !hideTitle && /* @__PURE__ */ jsxs31("p", { children: [
15887
15944
  " ",
15888
15945
  props.schema.description,
15889
15946
  " "
@@ -15902,7 +15959,7 @@ function ObjectSchema(props) {
15902
15959
  errors: propsErrors == null ? void 0 : propsErrors[propertyName],
15903
15960
  submitted: props.submitted,
15904
15961
  required: isRequired(propertyName),
15905
- disabled: props.disabled,
15962
+ disabled,
15906
15963
  onChange: (onChangeProps) => onChangeProperty(propertyName, onChangeProps),
15907
15964
  onPersistAsync: props.onPersistAsync
15908
15965
  }
@@ -15913,10 +15970,6 @@ function ObjectSchema(props) {
15913
15970
  ] })
15914
15971
  ] });
15915
15972
  }
15916
- ObjectSchema.defaultProps = {
15917
- hideTitle: false,
15918
- disabled: false
15919
- };
15920
15973
  var ObjectSchema_default = ObjectSchema;
15921
15974
 
15922
15975
  // src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
@@ -16663,8 +16716,8 @@ function SchemaFormControl(props) {
16663
16716
  const {
16664
16717
  id,
16665
16718
  schema,
16666
- value,
16667
- disabled,
16719
+ value = null,
16720
+ disabled = false,
16668
16721
  invalid,
16669
16722
  required,
16670
16723
  onChange,
@@ -16714,13 +16767,6 @@ function SchemaFormControl(props) {
16714
16767
  };
16715
16768
  return /* @__PURE__ */ jsx90("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ jsx90(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
16716
16769
  }
16717
- SchemaFormControl.defaultProps = {
16718
- value: null,
16719
- onFocus: null,
16720
- onBlur: null,
16721
- onSearchChange: null,
16722
- disabled: false
16723
- };
16724
16770
  var warnIfInvalidSchema = (schema, log, controlType) => {
16725
16771
  if (isOneOfSchema2(schema) && schema.oneOf.length === 2 && !schema.control) {
16726
16772
  log.warning(
@@ -16747,6 +16793,7 @@ function OneOfSchema(props) {
16747
16793
  const [changed, setChanged] = useState18(false);
16748
16794
  const [focused, setFocused] = useState18(false);
16749
16795
  const [blurred, setBlurred] = useState18(false);
16796
+ const { disabled = false, required = false } = props;
16750
16797
  const id = useMemo15(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
16751
16798
  const [schemaIndex, setSchemaIndex] = useState18(
16752
16799
  getActiveSchemaIndex(props.schema, props.model)
@@ -16828,10 +16875,10 @@ function OneOfSchema(props) {
16828
16875
  id,
16829
16876
  schema: schemaForSelect,
16830
16877
  value: schemaIndex,
16831
- disabled: props.disabled,
16878
+ disabled,
16832
16879
  invalid: !isEmpty(props.errors) || validations.length > 0,
16833
16880
  describedBy: feedbackId,
16834
- required: props.required,
16881
+ required,
16835
16882
  onChange: onChooseNewSchema,
16836
16883
  onFocus,
16837
16884
  onBlur,
@@ -16862,7 +16909,7 @@ function OneOfSchema(props) {
16862
16909
  errors: props.errors,
16863
16910
  submitted: props.submitted,
16864
16911
  hideTitle: true,
16865
- disabled: props.disabled,
16912
+ disabled,
16866
16913
  onChange: (parameters) => onChildModelChange(schemaIndex, parameters),
16867
16914
  onPersistAsync: props.onPersistAsync
16868
16915
  }
@@ -16884,12 +16931,13 @@ function getTitleAndHelp(schema, forId) {
16884
16931
  return schema.title ? titleElement : helpElement;
16885
16932
  }
16886
16933
  function getValidations(props, schemaIndex) {
16887
- const selectedSchema = props.schema.oneOf[schemaIndex != null ? schemaIndex : -1];
16934
+ const { schema, required = false } = props;
16935
+ const selectedSchema = schema.oneOf[schemaIndex != null ? schemaIndex : -1];
16888
16936
  if (isConstSchema2(selectedSchema)) {
16889
- return getValidationFailures(selectedSchema.const, props.schema, Boolean(props.required));
16937
+ return getValidationFailures(selectedSchema.const, schema, Boolean(required));
16890
16938
  }
16891
16939
  if (schemaIndex === null || schemaIndex < 0) {
16892
- return getValidationFailures(null, props.schema, Boolean(props.required));
16940
+ return getValidationFailures(null, schema, Boolean(required));
16893
16941
  }
16894
16942
  return [];
16895
16943
  }
@@ -16909,10 +16957,6 @@ function mapOneOfToConst(schema, index) {
16909
16957
  const { title, description, disabled = false, icon, image, keywords } = schema;
16910
16958
  return { title, description, disabled, icon, image, const: index, keywords };
16911
16959
  }
16912
- OneOfSchema.defaultProps = {
16913
- required: false,
16914
- disabled: false
16915
- };
16916
16960
  var OneOfSchema_default = OneOfSchema;
16917
16961
 
16918
16962
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
@@ -16980,7 +17024,7 @@ function UploadInputAdapter(props) {
16980
17024
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
16981
17025
  import { jsx as jsx93, jsxs as jsxs33 } from "react/jsx-runtime";
16982
17026
  function PersistAsyncBlobSchema(props) {
16983
- const { model, schema, submitted, required, errors, onChange } = props;
17027
+ const { model, schema, submitted, required = false, errors, onChange } = props;
16984
17028
  const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = useState19({});
16985
17029
  const [persistAsyncValidations, setPersistAsyncValidations] = useState19(null);
16986
17030
  const [validations, setValidations] = useState19([]);
@@ -17064,9 +17108,6 @@ function PersistAsyncBlobSchema(props) {
17064
17108
  )
17065
17109
  ] });
17066
17110
  }
17067
- PersistAsyncBlobSchema.defaultProps = {
17068
- required: false
17069
- };
17070
17111
  var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
17071
17112
 
17072
17113
  // src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
@@ -17082,9 +17123,6 @@ function PersistAsyncSchema(props) {
17082
17123
  }
17083
17124
  return /* @__PURE__ */ jsx94(PersistAsyncBasicSchema_default, __spreadValues({}, props));
17084
17125
  }
17085
- PersistAsyncSchema.defaultProps = {
17086
- required: false
17087
- };
17088
17126
  var PersistAsyncSchema_default = PersistAsyncSchema;
17089
17127
 
17090
17128
  // src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
@@ -17114,7 +17152,6 @@ var PromotedOneOfCheckboxControl = (props) => {
17114
17152
  };
17115
17153
  return /* @__PURE__ */ jsx95("div", { className: "form-group", children: /* @__PURE__ */ jsx95(Checkbox3, { id, label: title, checked, onChange: toggleSelection }) });
17116
17154
  };
17117
- PromotedOneOfCheckboxControl.defaultProps = {};
17118
17155
  var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
17119
17156
 
17120
17157
  // src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
@@ -17298,7 +17335,7 @@ function getValueFromOption(option) {
17298
17335
  import { useEffect as useEffect14, useRef as useRef3, useState as useState21 } from "react";
17299
17336
  import { jsx as jsx100 } from "react/jsx-runtime";
17300
17337
  function ValidationAsyncSchema(props) {
17301
- const { schema, model, required, submitted, errors, onChange } = props;
17338
+ const { schema, model, required = false, submitted, errors, onChange } = props;
17302
17339
  const [validationAsyncModel, setValidationAsyncModel] = useState21(model);
17303
17340
  const previousRequestedModelReference = useRef3(null);
17304
17341
  const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = useState21(
@@ -17382,7 +17419,6 @@ function ValidationAsyncSchema(props) {
17382
17419
  };
17383
17420
  return /* @__PURE__ */ jsx100(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
17384
17421
  }
17385
- ValidationAsyncSchema.defaultProps = { required: false };
17386
17422
  var ValidationAsyncSchema_default = ValidationAsyncSchema;
17387
17423
 
17388
17424
  // src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
@@ -18165,11 +18201,12 @@ var getDefaultValue = (schema) => {
18165
18201
  };
18166
18202
  var BasicTypeSchema = (props) => {
18167
18203
  var _a, _b, _c;
18204
+ const { disabled = false, required = false } = props;
18168
18205
  const onChange = (newModel, _type, metadata) => {
18169
18206
  setChanged(true);
18170
18207
  setModelAndBroadcast(sanitiseModel(newModel), "user", metadata);
18171
18208
  };
18172
- const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema, props.required);
18209
+ const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema, required);
18173
18210
  const setModelAndBroadcast = (newModel, type, metadata) => {
18174
18211
  setModel(newModel);
18175
18212
  const validationKeys = getValidationKeys(newModel);
@@ -18249,7 +18286,7 @@ var BasicTypeSchema = (props) => {
18249
18286
  id,
18250
18287
  schema: props.schema,
18251
18288
  value: model,
18252
- disabled: !!props.disabled,
18289
+ disabled: !!disabled,
18253
18290
  onChange,
18254
18291
  onFocus,
18255
18292
  onBlur,
@@ -18274,11 +18311,6 @@ var BasicTypeSchema = (props) => {
18274
18311
  ] })
18275
18312
  ] }) : null;
18276
18313
  };
18277
- BasicTypeSchema.defaultProps = {
18278
- required: false,
18279
- disabled: false,
18280
- onBlur: null
18281
- };
18282
18314
  var BasicTypeSchema_default = BasicTypeSchema;
18283
18315
 
18284
18316
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
@@ -18296,7 +18328,7 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
18296
18328
  FormControlType.UPLOAD
18297
18329
  ]);
18298
18330
  function PersistAsyncBasicSchema(props) {
18299
- const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
18331
+ const { schema, required = false, submitted, errors, onChange, onPersistAsync } = props;
18300
18332
  const intl = useIntl23();
18301
18333
  const httpClient = useHttpClient();
18302
18334
  const onEvent = useEventDispatcher();
@@ -18386,9 +18418,6 @@ function PersistAsyncBasicSchema(props) {
18386
18418
  }
18387
18419
  );
18388
18420
  }
18389
- PersistAsyncBasicSchema.defaultProps = {
18390
- required: false
18391
- };
18392
18421
  var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
18393
18422
 
18394
18423
  // src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
@@ -1,11 +1,6 @@
1
1
  import type { AllOfSchema as AllOfSchemaType, ObjectModel } from '@wise/dynamic-flow-types';
2
2
  import type { GenericSchemaProps } from '../genericSchema/GenericSchema';
3
3
  declare function AllOfSchema(props: AllOfSchemaProps): import("react/jsx-runtime").JSX.Element;
4
- declare namespace AllOfSchema {
5
- var defaultProps: {
6
- disabled: boolean;
7
- };
8
- }
9
4
  export type AllOfSchemaProps = Omit<GenericSchemaProps, 'schema' | 'model'> & {
10
5
  schema: AllOfSchemaType;
11
6
  model: ObjectModel;
@@ -1,11 +1,6 @@
1
1
  import { ArrayModel, ArraySchema as ArraySchemaType } from '@wise/dynamic-flow-types';
2
2
  import { GenericSchemaProps } from '../genericSchema/GenericSchema';
3
- declare const ArraySchema: {
4
- (props: ArraySchemaProps): import("react/jsx-runtime").JSX.Element;
5
- defaultProps: {
6
- required: boolean;
7
- };
8
- };
3
+ declare const ArraySchema: (props: ArraySchemaProps) => import("react/jsx-runtime").JSX.Element;
9
4
  export type ArraySchemaProps = GenericSchemaProps & {
10
5
  schema: ArraySchemaType;
11
6
  model: ArrayModel | null;
@@ -6,10 +6,4 @@ type ArrayListSchemaProps = GenericSchemaProps & {
6
6
  model: ArrayModel | null;
7
7
  };
8
8
  declare function ArrayListSchema(props: ArrayListSchemaProps): import("react/jsx-runtime").JSX.Element;
9
- declare namespace ArrayListSchema {
10
- var defaultProps: {
11
- errors: null;
12
- required: boolean;
13
- };
14
- }
15
9
  export default ArrayListSchema;
@@ -1,12 +1,6 @@
1
1
  import type { ArrayModel, MultipleFileUploadSchema as MultipleFileUploadSchemaType } from '@wise/dynamic-flow-types';
2
2
  import type { GenericSchemaProps } from '../../../genericSchema/GenericSchema';
3
3
  declare function MultipleFileUploadSchema(props: Props): import("react/jsx-runtime").JSX.Element;
4
- declare namespace MultipleFileUploadSchema {
5
- var defaultProps: {
6
- errors: null;
7
- required: boolean;
8
- };
9
- }
10
4
  type Props = Omit<GenericSchemaProps, 'model'> & {
11
5
  schema: MultipleFileUploadSchemaType;
12
6
  model: ArrayModel | null;
@@ -1,14 +1,7 @@
1
1
  import { BasicModel, BasicSchema } from '@wise/dynamic-flow-types';
2
2
  import { OnChange } from '../JsonSchemaForm';
3
3
  import { GenericSchemaProps } from '../genericSchema/GenericSchema';
4
- declare const BasicTypeSchema: {
5
- (props: BasicTypeSchemaProps): import("react/jsx-runtime").JSX.Element | null;
6
- defaultProps: {
7
- required: boolean;
8
- disabled: boolean;
9
- onBlur: null;
10
- };
11
- };
4
+ declare const BasicTypeSchema: (props: BasicTypeSchemaProps) => import("react/jsx-runtime").JSX.Element | null;
12
5
  export type BasicTypeSchemaProps = Omit<GenericSchemaProps, 'schema' | 'model' | 'onChange' | 'errors' | 'onPersistAsync'> & {
13
6
  schema: BasicSchema;
14
7
  model: BasicModel | null;