@wise/dynamic-flow-client 2.1.4 → 2.1.5
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 +61 -30
- package/build/main.min.js +1 -1
- package/build/types/formControl/FormControl.d.ts +1 -0
- package/build/types/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +1 -0
- package/build/types/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +1 -0
- package/package.json +2 -2
package/build/main.js
CHANGED
|
@@ -2550,7 +2550,7 @@ var ControlFeedback = (props) => {
|
|
|
2550
2550
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && !!((_a = props.validations) == null ? void 0 : _a.length);
|
|
2551
2551
|
const isDescriptionVisible = props.focused && props.schema.description && !isValidationVisible;
|
|
2552
2552
|
const hasInfoMessage = !!props.infoMessage;
|
|
2553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
2553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { id: props.id, children: [
|
|
2554
2554
|
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components6.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
2555
2555
|
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components6.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
2556
2556
|
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_components6.InlineAlert, { type: "info", children: [
|
|
@@ -2758,12 +2758,14 @@ var MultipleFileUploadSchema = (props) => {
|
|
|
2758
2758
|
onFilesChange,
|
|
2759
2759
|
onDeleteFile: () => Promise.resolve()
|
|
2760
2760
|
});
|
|
2761
|
+
const feedbackId = `${uid}-feedback`;
|
|
2761
2762
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
|
|
2762
2763
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
2763
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.UploadInput, __spreadValues({}, uploadInputProps)),
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
2764
2765
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2765
2766
|
ControlFeedback_default,
|
|
2766
2767
|
{
|
|
2768
|
+
id: feedbackId,
|
|
2767
2769
|
changed: inputChanged,
|
|
2768
2770
|
submitted: props.submitted,
|
|
2769
2771
|
errors: props.errors,
|
|
@@ -3552,7 +3554,8 @@ var _FormControl = class extends import_react14.PureComponent {
|
|
|
3552
3554
|
minDate,
|
|
3553
3555
|
maxDate,
|
|
3554
3556
|
value,
|
|
3555
|
-
mode
|
|
3557
|
+
mode,
|
|
3558
|
+
describedBy
|
|
3556
3559
|
} = this.props;
|
|
3557
3560
|
switch (type) {
|
|
3558
3561
|
case FormControlType.RADIO:
|
|
@@ -3649,7 +3652,8 @@ var _FormControl = class extends import_react14.PureComponent {
|
|
|
3649
3652
|
if (event.target instanceof HTMLElement) {
|
|
3650
3653
|
event.target.blur();
|
|
3651
3654
|
}
|
|
3652
|
-
}
|
|
3655
|
+
},
|
|
3656
|
+
"aria-describedby": describedBy
|
|
3653
3657
|
}
|
|
3654
3658
|
);
|
|
3655
3659
|
case FormControlType.HIDDEN:
|
|
@@ -3677,7 +3681,8 @@ var _FormControl = class extends import_react14.PureComponent {
|
|
|
3677
3681
|
value: getSafeStringValue(value, { coerceValue: true }),
|
|
3678
3682
|
onBlur: this.handleOnBlur,
|
|
3679
3683
|
onChange: this.handleInputOnChange,
|
|
3680
|
-
onFocus: this.handleOnFocus
|
|
3684
|
+
onFocus: this.handleOnFocus,
|
|
3685
|
+
"aria-describedby": describedBy
|
|
3681
3686
|
}
|
|
3682
3687
|
);
|
|
3683
3688
|
case FormControlType.DATE:
|
|
@@ -3755,7 +3760,13 @@ var _FormControl = class extends import_react14.PureComponent {
|
|
|
3755
3760
|
})
|
|
3756
3761
|
);
|
|
3757
3762
|
}
|
|
3758
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3764
|
+
"textarea",
|
|
3765
|
+
__spreadProps(__spreadValues({}, textareaProps), {
|
|
3766
|
+
onChange: this.handleInputOnChange,
|
|
3767
|
+
"aria-describedby": describedBy
|
|
3768
|
+
})
|
|
3769
|
+
);
|
|
3759
3770
|
}
|
|
3760
3771
|
case FormControlType.FILE:
|
|
3761
3772
|
case FormControlType.UPLOAD: {
|
|
@@ -3808,7 +3819,13 @@ var _FormControl = class extends import_react14.PureComponent {
|
|
|
3808
3819
|
})
|
|
3809
3820
|
);
|
|
3810
3821
|
}
|
|
3811
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3823
|
+
"input",
|
|
3824
|
+
__spreadProps(__spreadValues({}, inputProps), {
|
|
3825
|
+
onChange: this.handleInputOnChange,
|
|
3826
|
+
"aria-describedby": describedBy
|
|
3827
|
+
})
|
|
3828
|
+
);
|
|
3812
3829
|
}
|
|
3813
3830
|
}
|
|
3814
3831
|
}
|
|
@@ -3977,7 +3994,7 @@ var getOptions = (schema, controlType) => {
|
|
|
3977
3994
|
return null;
|
|
3978
3995
|
};
|
|
3979
3996
|
var SchemaFormControl = (props) => {
|
|
3980
|
-
const { id, schema, value, disabled, onChange, onFocus, onBlur, onSearchChange } = props;
|
|
3997
|
+
const { id, schema, value, disabled, onChange, onFocus, onBlur, onSearchChange, describedBy } = props;
|
|
3981
3998
|
const log = useLogger();
|
|
3982
3999
|
const getSanitisedValue = (value2) => isNativeInput(schema.type) && (isNull(value2) || isUndefined(value2)) ? "" : value2;
|
|
3983
4000
|
const onModelChange = (value2, type) => {
|
|
@@ -4005,9 +4022,10 @@ var SchemaFormControl = (props) => {
|
|
|
4005
4022
|
disabled: disabled || schema.disabled,
|
|
4006
4023
|
displayPattern: schema.displayFormat,
|
|
4007
4024
|
// TODO: LOW avoid type assertion below
|
|
4008
|
-
uploadProps: mapSchemaToUploadOptions(schema)
|
|
4025
|
+
uploadProps: mapSchemaToUploadOptions(schema),
|
|
4026
|
+
describedBy
|
|
4009
4027
|
};
|
|
4010
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps));
|
|
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)) });
|
|
4011
4029
|
};
|
|
4012
4030
|
SchemaFormControl.defaultProps = {
|
|
4013
4031
|
value: null,
|
|
@@ -4109,6 +4127,7 @@ var OneOfSchema = (props) => {
|
|
|
4109
4127
|
"form-group": true,
|
|
4110
4128
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
4111
4129
|
};
|
|
4130
|
+
const feedbackId = `${id}-feedback`;
|
|
4112
4131
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
4113
4132
|
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
4114
4133
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
|
|
@@ -4123,12 +4142,14 @@ var OneOfSchema = (props) => {
|
|
|
4123
4142
|
onChange: onChooseNewSchema,
|
|
4124
4143
|
onFocus,
|
|
4125
4144
|
onBlur,
|
|
4126
|
-
onSearchChange
|
|
4145
|
+
onSearchChange,
|
|
4146
|
+
describedBy: feedbackId
|
|
4127
4147
|
}
|
|
4128
4148
|
),
|
|
4129
4149
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4130
4150
|
ControlFeedback_default,
|
|
4131
4151
|
{
|
|
4152
|
+
id: feedbackId,
|
|
4132
4153
|
changed,
|
|
4133
4154
|
focused,
|
|
4134
4155
|
blurred,
|
|
@@ -4279,8 +4300,8 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4279
4300
|
(0, import_react18.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4280
4301
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
4281
4302
|
const jsonResponse = await httpResponse.json();
|
|
4282
|
-
const
|
|
4283
|
-
props.onChange({ model:
|
|
4303
|
+
const id2 = getIdFromResponse(props.schema.persistAsync.idProperty, jsonResponse);
|
|
4304
|
+
props.onChange({ model: id2, triggerSchema: props.schema, triggerModel: id2 });
|
|
4284
4305
|
setChanged(true);
|
|
4285
4306
|
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId: props.schema.$id });
|
|
4286
4307
|
};
|
|
@@ -4305,11 +4326,13 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4305
4326
|
"form-group": true,
|
|
4306
4327
|
"has-error": (props.submitted || changed) && !!combinedValidations.length
|
|
4307
4328
|
};
|
|
4329
|
+
const id = props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty;
|
|
4330
|
+
const feedbackId = `${id}-feedback`;
|
|
4308
4331
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
4309
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4332
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4310
4333
|
UploadInputAdapter,
|
|
4311
4334
|
__spreadValues({
|
|
4312
|
-
id
|
|
4335
|
+
id,
|
|
4313
4336
|
fileId: props.model,
|
|
4314
4337
|
idProperty: props.schema.persistAsync.idProperty,
|
|
4315
4338
|
animationDelay: 0,
|
|
@@ -4322,10 +4345,11 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4322
4345
|
onFailure,
|
|
4323
4346
|
onCancel
|
|
4324
4347
|
}, mapSchemaToUploadOptions(props.schema.persistAsync.schema))
|
|
4325
|
-
),
|
|
4348
|
+
) }),
|
|
4326
4349
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4327
4350
|
ControlFeedback_default,
|
|
4328
4351
|
{
|
|
4352
|
+
id: feedbackId,
|
|
4329
4353
|
blurred: true,
|
|
4330
4354
|
focused: false,
|
|
4331
4355
|
changed,
|
|
@@ -5071,7 +5095,7 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5071
5095
|
var _a;
|
|
5072
5096
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
|
|
5073
5097
|
};
|
|
5074
|
-
const classNames7 = getTextAlignmentAndMargin({ align: component.align
|
|
5098
|
+
const classNames7 = getTextAlignmentAndMargin({ align: component.align }) + " form-control";
|
|
5075
5099
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5076
5100
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5077
5101
|
"input",
|
|
@@ -5083,7 +5107,7 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5083
5107
|
style: { textOverflow: "ellipsis" }
|
|
5084
5108
|
}
|
|
5085
5109
|
),
|
|
5086
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.Button, { block: true, onClick: copy, className: getMargin("sm"), children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5087
5111
|
] });
|
|
5088
5112
|
};
|
|
5089
5113
|
function noop4() {
|
|
@@ -5142,11 +5166,11 @@ var DynamicReview = (props) => {
|
|
|
5142
5166
|
};
|
|
5143
5167
|
const orientation = getReviewLayout(review);
|
|
5144
5168
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5145
|
-
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("h6", { className:
|
|
5169
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("h6", { className: `m-b-2 ${margin}`, children: [
|
|
5146
5170
|
review.title,
|
|
5147
5171
|
review.action && getReviewAction(review.action)
|
|
5148
5172
|
] }),
|
|
5149
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5173
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: review.title ? "" : margin, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5150
5174
|
] });
|
|
5151
5175
|
};
|
|
5152
5176
|
var DynamicReview_default = DynamicReview;
|
|
@@ -5404,6 +5428,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5404
5428
|
};
|
|
5405
5429
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5406
5430
|
const schemaHelp = props.schema.help;
|
|
5431
|
+
const feedbackId = `${id}-feedback`;
|
|
5407
5432
|
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5408
5433
|
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5409
5434
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
@@ -5421,12 +5446,14 @@ var BasicTypeSchema = (props) => {
|
|
|
5421
5446
|
disabled: !!props.disabled,
|
|
5422
5447
|
onChange,
|
|
5423
5448
|
onFocus,
|
|
5424
|
-
onBlur
|
|
5449
|
+
onBlur,
|
|
5450
|
+
describedBy: feedbackId
|
|
5425
5451
|
}
|
|
5426
5452
|
),
|
|
5427
5453
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5428
5454
|
ControlFeedback_default,
|
|
5429
5455
|
{
|
|
5456
|
+
id: feedbackId,
|
|
5430
5457
|
changed,
|
|
5431
5458
|
focused,
|
|
5432
5459
|
blurred,
|
|
@@ -6423,10 +6450,10 @@ var BackButton_default = BackButton;
|
|
|
6423
6450
|
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6424
6451
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6425
6452
|
var DynamicFlowStep = (props) => {
|
|
6426
|
-
var _a, _b;
|
|
6453
|
+
var _a, _b, _c;
|
|
6427
6454
|
const { step, globalError, onAction } = props;
|
|
6428
6455
|
const externalUrl = (_a = step == null ? void 0 : step.external) == null ? void 0 : _a.url;
|
|
6429
|
-
const backButton = (_b = step == null ? void 0 : step.navigation) == null ? void 0 : _b.backButton;
|
|
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);
|
|
6430
6457
|
const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
|
|
6431
6458
|
if (step === void 0) {
|
|
6432
6459
|
return null;
|
|
@@ -6661,8 +6688,7 @@ var ErrorBoundary = class extends import_react40.Component {
|
|
|
6661
6688
|
var ErrorBoundary_default = ErrorBoundary;
|
|
6662
6689
|
|
|
6663
6690
|
// src/dynamicFlow/utils/responseParsers/response-parsers.ts
|
|
6664
|
-
var parseFetchResponseByResponseType = async (response) => {
|
|
6665
|
-
const type = response.headers.get("X-Df-ResponseType");
|
|
6691
|
+
var parseFetchResponseByResponseType = async (response, type) => {
|
|
6666
6692
|
switch (type) {
|
|
6667
6693
|
case "step":
|
|
6668
6694
|
return parseStepResponse(response);
|
|
@@ -6672,7 +6698,7 @@ var parseFetchResponseByResponseType = async (response) => {
|
|
|
6672
6698
|
return parseActionResponse(response);
|
|
6673
6699
|
default:
|
|
6674
6700
|
throw new Error(
|
|
6675
|
-
"Unsupported X-Df-
|
|
6701
|
+
"Unsupported X-Df-Response-Type. Allowed values are 'step', 'action', 'exit'."
|
|
6676
6702
|
);
|
|
6677
6703
|
}
|
|
6678
6704
|
};
|
|
@@ -6704,12 +6730,17 @@ var parseExitResponse = async (response) => {
|
|
|
6704
6730
|
return { type: "exit", result: await getJsonObjectOrNull(response) };
|
|
6705
6731
|
};
|
|
6706
6732
|
var parseFetchResponse = async (response) => {
|
|
6707
|
-
var _a, _b;
|
|
6733
|
+
var _a, _b, _c;
|
|
6708
6734
|
assertResponseIsValid(response);
|
|
6709
|
-
if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-
|
|
6710
|
-
|
|
6735
|
+
if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
|
|
6736
|
+
const type = response.headers.get("X-Df-Response-Type");
|
|
6737
|
+
return parseFetchResponseByResponseType(response, type);
|
|
6738
|
+
}
|
|
6739
|
+
if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-ResponseType")) {
|
|
6740
|
+
const type = response.headers.get("X-Df-ResponseType");
|
|
6741
|
+
return parseFetchResponseByResponseType(response, type);
|
|
6711
6742
|
}
|
|
6712
|
-
if ((
|
|
6743
|
+
if ((_c = response.headers) == null ? void 0 : _c.has("X-Df-Exit")) {
|
|
6713
6744
|
return parseExitResponse(response);
|
|
6714
6745
|
}
|
|
6715
6746
|
const jsonBody = await parseResponseJson(response.clone());
|