@wise/dynamic-flow-client 2.8.14 → 2.8.15
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 +32 -30
- package/build/main.min.js +1 -1
- package/build/types/common/messages/persist-async.messages.d.ts +8 -0
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +1 -1
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +15 -0
- package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +22 -0
- package/build/types/revamp/domain/features/persistAsync/persist-async-utils.d.ts +2 -0
- package/build/types/revamp/domain/features/validation/spec-utils.d.ts +1 -0
- package/build/types/revamp/domain/features/validation/validation-functions.d.ts +7 -0
- package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +1 -0
- package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +14 -13
- package/build/types/revamp/domain/mappers/types.d.ts +3 -0
- package/build/types/revamp/domain/types.d.ts +13 -5
- package/build/types/revamp/utils/{getSubmittableData.d.ts → component-utils.d.ts} +1 -0
- package/build/types/revamp/utils/type-utils.d.ts +7 -1
- package/build/types/test-utils/fetch-utils.d.ts +2 -2
- package/package.json +1 -1
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -8
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +0 -5
- package/build/types/revamp/domain/features/validation/validateComponents.d.ts +0 -2
- package/build/types/revamp/domain/validation/validation-functions.d.ts +0 -7
- /package/build/types/revamp/{domain/mappers/utils → utils}/type-validators.d.ts +0 -0
package/build/main.js
CHANGED
|
@@ -1983,9 +1983,9 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1983
1983
|
var import_react31 = require("react");
|
|
1984
1984
|
var import_react_intl21 = require("react-intl");
|
|
1985
1985
|
|
|
1986
|
-
// src/
|
|
1986
|
+
// src/common/messages/persist-async.messages.ts
|
|
1987
1987
|
var import_react_intl = require("react-intl");
|
|
1988
|
-
var
|
|
1988
|
+
var persist_async_messages_default = (0, import_react_intl.defineMessages)({
|
|
1989
1989
|
genericError: {
|
|
1990
1990
|
id: "dynamicFlows.PersistAsyncSchema.genericError",
|
|
1991
1991
|
defaultMessage: "Something went wrong, please try again later!",
|
|
@@ -4587,65 +4587,67 @@ function UploadInputAdapter(props) {
|
|
|
4587
4587
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4588
4588
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4589
4589
|
function PersistAsyncBlobSchema(props) {
|
|
4590
|
+
const { model, schema, submitted, required, errors, onChange } = props;
|
|
4590
4591
|
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react19.useState)({});
|
|
4591
4592
|
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react19.useState)(null);
|
|
4592
4593
|
const [validations, setValidations] = (0, import_react19.useState)([]);
|
|
4593
4594
|
const [changed, setChanged] = (0, import_react19.useState)(false);
|
|
4594
4595
|
const httpClient = useHttpClient();
|
|
4595
4596
|
const onEvent = useEventDispatcher();
|
|
4596
|
-
|
|
4597
|
-
if (
|
|
4598
|
-
setValidations(getValidationFailures(
|
|
4597
|
+
(0, import_react19.useEffect)(() => {
|
|
4598
|
+
if (submitted) {
|
|
4599
|
+
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
4600
|
+
} else {
|
|
4601
|
+
setValidations([]);
|
|
4599
4602
|
}
|
|
4600
|
-
};
|
|
4601
|
-
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4603
|
+
}, [model, schema, submitted, required]);
|
|
4602
4604
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
4603
4605
|
const jsonResponse = await httpResponse.json();
|
|
4604
|
-
const id2 = getIdFromResponse(
|
|
4605
|
-
|
|
4606
|
+
const id2 = getIdFromResponse(schema.persistAsync.idProperty, jsonResponse);
|
|
4607
|
+
onChange({ model: id2, triggerSchema: schema, triggerModel: id2 });
|
|
4606
4608
|
setChanged(true);
|
|
4607
|
-
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId:
|
|
4609
|
+
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId: schema.$id });
|
|
4608
4610
|
};
|
|
4609
4611
|
const onFailure = async (errorResponse) => {
|
|
4610
4612
|
if (errorResponse.response && isStatus422(errorResponse.response.status)) {
|
|
4611
4613
|
const jsonResponse = await errorResponse.response.json();
|
|
4612
4614
|
setPersistAsyncValidationMessages(jsonResponse.validation || {});
|
|
4613
|
-
setPersistAsyncValidations([
|
|
4615
|
+
setPersistAsyncValidations([schema.persistAsync.param]);
|
|
4614
4616
|
}
|
|
4615
|
-
|
|
4617
|
+
onChange({ model: null, triggerSchema: schema, triggerModel: null });
|
|
4616
4618
|
setChanged(true);
|
|
4617
|
-
onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId:
|
|
4619
|
+
onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId: schema.$id });
|
|
4618
4620
|
};
|
|
4619
4621
|
const onCancel = () => {
|
|
4620
4622
|
setPersistAsyncValidations(null);
|
|
4621
|
-
|
|
4623
|
+
onChange({ model: null, triggerSchema: schema, triggerModel: null });
|
|
4622
4624
|
setChanged(true);
|
|
4623
4625
|
};
|
|
4624
|
-
const { url, method } =
|
|
4626
|
+
const { url, method } = schema.persistAsync;
|
|
4625
4627
|
const combinedValidations = persistAsyncValidations || validations;
|
|
4626
4628
|
const formGroupClasses = {
|
|
4627
4629
|
"form-group": true,
|
|
4628
|
-
"has-error": (
|
|
4630
|
+
"has-error": (submitted || changed) && Boolean(combinedValidations.length)
|
|
4629
4631
|
};
|
|
4630
|
-
const id =
|
|
4632
|
+
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
4631
4633
|
const feedbackId = `${id}-feedback`;
|
|
4632
4634
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
4633
4635
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4634
4636
|
UploadInputAdapter,
|
|
4635
4637
|
__spreadValues({
|
|
4636
4638
|
id,
|
|
4637
|
-
fileId:
|
|
4638
|
-
idProperty:
|
|
4639
|
+
fileId: model,
|
|
4640
|
+
idProperty: schema.persistAsync.idProperty,
|
|
4639
4641
|
animationDelay: 0,
|
|
4640
|
-
maxSize:
|
|
4641
|
-
usLabel:
|
|
4642
|
-
usPlaceholder:
|
|
4643
|
-
httpOptions: { url, method, fileInputName:
|
|
4642
|
+
maxSize: schema.persistAsync.schema.maxSize,
|
|
4643
|
+
usLabel: schema.title || schema.persistAsync.schema.title,
|
|
4644
|
+
usPlaceholder: schema.description || schema.persistAsync.schema.description,
|
|
4645
|
+
httpOptions: { url, method, fileInputName: schema.persistAsync.param },
|
|
4644
4646
|
httpClient,
|
|
4645
4647
|
onSuccess,
|
|
4646
4648
|
onFailure,
|
|
4647
4649
|
onCancel
|
|
4648
|
-
}, mapSchemaToUploadOptions(
|
|
4650
|
+
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
4649
4651
|
) }),
|
|
4650
4652
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4651
4653
|
ControlFeedback_default,
|
|
@@ -4654,9 +4656,9 @@ function PersistAsyncBlobSchema(props) {
|
|
|
4654
4656
|
blurred: true,
|
|
4655
4657
|
focused: false,
|
|
4656
4658
|
changed,
|
|
4657
|
-
submitted
|
|
4658
|
-
errors
|
|
4659
|
-
schema
|
|
4659
|
+
submitted,
|
|
4660
|
+
errors,
|
|
4661
|
+
schema,
|
|
4660
4662
|
validations: combinedValidations,
|
|
4661
4663
|
validationMessages: __spreadValues({
|
|
4662
4664
|
required: "Value is required..."
|
|
@@ -5844,7 +5846,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
5844
5846
|
persistAsyncIfValid();
|
|
5845
5847
|
}
|
|
5846
5848
|
}, [persistAsyncModel]);
|
|
5847
|
-
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(
|
|
5849
|
+
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(persist_async_messages_default.genericError));
|
|
5848
5850
|
const getPersistAsyncResponse = async (currentPersistAsyncModel, persistAsyncSpec) => {
|
|
5849
5851
|
const signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
5850
5852
|
const requestBody = { [persistAsyncSpec.param]: currentPersistAsyncModel };
|
|
@@ -5983,10 +5985,10 @@ var usePersistAsync = (persistAsync) => {
|
|
|
5983
5985
|
}
|
|
5984
5986
|
}
|
|
5985
5987
|
}
|
|
5986
|
-
throw new Error(intl.formatMessage(
|
|
5988
|
+
throw new Error(intl.formatMessage(persist_async_messages_default.genericError));
|
|
5987
5989
|
}
|
|
5988
5990
|
const handleError = (error) => {
|
|
5989
|
-
const message = hasStringMessage(error) ? error.message : intl.formatMessage(
|
|
5991
|
+
const message = hasStringMessage(error) ? error.message : intl.formatMessage(persist_async_messages_default.genericError);
|
|
5990
5992
|
throw new Error(message);
|
|
5991
5993
|
};
|
|
5992
5994
|
return handlePersistAsync;
|