@wise/dynamic-flow-client 1.0.1 → 1.0.2

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
@@ -3499,15 +3499,22 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
3499
3499
  var isNativeInput = (propsSchemaType) => {
3500
3500
  return propsSchemaType === "string" || propsSchemaType === "number";
3501
3501
  };
3502
- var getControlType = (schema2) => {
3503
- if ("control" in schema2 && schema2.control) {
3504
- if (isOneOfSchema(schema2) && schema2.oneOf.length > 3) {
3502
+ var getControlType = (schema2, log) => {
3503
+ if (isOneOfSchema(schema2)) {
3504
+ if (schema2.control === FormControlType.TAB && schema2.oneOf.length > 3) {
3505
3505
  return FormControlType.SELECT;
3506
3506
  }
3507
- return schema2.control;
3507
+ if (schema2.oneOf.length === 2 && !schema2.control) {
3508
+ log.warning(
3509
+ "Deprecation warning",
3510
+ 'A oneOf schema with 2 options and no control type currently renders as a "radio" but will be changed to render as a "select". Please specify control radio to retain the existing behaviour.'
3511
+ );
3512
+ return FormControlType.RADIO;
3513
+ }
3514
+ return schema2.control || FormControlType.SELECT;
3508
3515
  }
3509
- if (schema2.oneOf) {
3510
- return schema2.oneOf.length === 1 || schema2.oneOf.length >= 3 ? "select" : "radio";
3516
+ if ("control" in schema2 && schema2.control) {
3517
+ return schema2.control;
3511
3518
  }
3512
3519
  if (schema2.type === "string") {
3513
3520
  switch (schema2.format) {
@@ -3543,10 +3550,10 @@ var SchemaFormControl = (props) => {
3543
3550
  const onChange = (value, type) => {
3544
3551
  props.onChange(getValidBasicModelOrNull(value, props.schema), type);
3545
3552
  };
3546
- const controlType = getControlType(props.schema);
3553
+ const controlType = getControlType(props.schema, log);
3547
3554
  if (controlType === "file") {
3548
3555
  log.warning(
3549
- "Deprecation advanced warning",
3556
+ "Deprecation warning",
3550
3557
  "Please use a persist-async blob schema instead of string with base64url for file uploads. The base64url does not perform well on low end devices. Support for this schema will be removed in a later release."
3551
3558
  );
3552
3559
  }
@@ -4886,10 +4893,11 @@ var PersistAsyncBasicSchema = (props) => {
4886
4893
  const [persistAsyncError, setPersistAsyncError] = (0, import_react22.useState)(null);
4887
4894
  const [fieldSubmitted, setFieldSubmitted] = (0, import_react22.useState)(false);
4888
4895
  const [abortController, setAbortController] = (0, import_react22.useState)(null);
4896
+ const log = useLogger();
4889
4897
  (0, import_react22.useEffect)(() => {
4890
4898
  if (controlTypesWithPersistOnChange.has(
4891
4899
  // TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
4892
- getControlType(props.schema.persistAsync.schema)
4900
+ getControlType(props.schema.persistAsync.schema, log)
4893
4901
  )) {
4894
4902
  persistAsyncIfValid();
4895
4903
  }