@wise/dynamic-flow-client 0.4.0 → 0.4.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/common/constants/DateMode.js +2 -2
- package/build/common/constants/FormControlType.js +2 -2
- package/build/common/constants/MonthFormat.js +2 -2
- package/build/common/constants/SchemaType.js +2 -2
- package/build/common/constants/Size.js +2 -2
- package/build/common/constants/index.js +1 -1
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +15 -27
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +11 -9
- package/build/common/contexts/eventsContext/EventsContext.js +11 -28
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +14 -27
- package/build/common/contexts/index.js +1 -1
- package/build/common/contexts/logContext/LogContext.js +12 -30
- package/build/common/hooks/index.js +1 -1
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +3 -3
- package/build/common/hooks/useExternal/useExternal.js +8 -8
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +20 -31
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +60 -139
- package/build/common/hooks/usePolling/usePolling.js +20 -21
- package/build/common/hooks/usePrevious/usePrevious.js +5 -5
- package/build/common/hooks/useStepPolling/useStepPolling.js +15 -14
- package/build/common/makeFetcher/index.js +1 -1
- package/build/common/makeFetcher/makeFetcher.js +10 -24
- package/build/common/messages.js +5 -5
- package/build/common/utils/api-utils.js +3 -4
- package/build/common/utils/date-utils.js +11 -11
- package/build/common/utils/debounce.js +11 -15
- package/build/common/utils/file-utils.js +12 -25
- package/build/common/utils/id-utils.js +4 -5
- package/build/common/utils/index.js +1 -1
- package/build/common/utils/is-equal.js +8 -8
- package/build/common/utils/schema-utils.js +6 -6
- package/build/common/utils/step-utils.js +14 -14
- package/build/common/validators/index.js +7 -7
- package/build/common/validators/models/model-validators.js +8 -8
- package/build/common/validators/models/models.utils.js +29 -42
- package/build/common/validators/schemas/schema-validators.js +11 -13
- package/build/common/validators/types/type-validators.js +9 -13
- package/build/common/validators/validationFailures/validation-failures.js +14 -14
- package/build/common/validators/validationFailures/validation-failures.utils.js +5 -7
- package/build/common/validators/values/value-validators.js +4 -6
- package/build/dynamicFlow/DynamicFlow.js +185 -307
- package/build/dynamicFlow/DynamicFlowStep.js +12 -23
- package/build/dynamicFlow/DynamicFlowTypes.js +1 -1
- package/build/dynamicFlow/index.js +6 -14
- package/build/dynamicFlow/stories/DynamicFlow.story.js +20 -20
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +20 -33
- package/build/dynamicFlow/stories/fixtureFetcher.js +46 -104
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +22 -40
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +6 -6
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +10 -11
- package/build/dynamicFlow/utils/index.js +5 -2
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +53 -118
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +9 -9
- package/build/dynamicFlow/utils/useDynamicFlowState.js +51 -74
- package/build/dynamicFlow/utils/useLoader.js +9 -20
- package/build/fixtures/components/alert.js +8 -8
- package/build/fixtures/components/box.js +7 -7
- package/build/fixtures/components/button.js +25 -36
- package/build/fixtures/components/columns.js +10 -10
- package/build/fixtures/components/copyable.js +6 -6
- package/build/fixtures/components/decision.js +15 -15
- package/build/fixtures/components/heading.js +7 -7
- package/build/fixtures/components/image.js +10 -10
- package/build/fixtures/components/index.js +17 -25
- package/build/fixtures/components/info.js +22 -6
- package/build/fixtures/components/list.js +8 -8
- package/build/fixtures/components/loading-indicator.js +5 -5
- package/build/fixtures/components/paragraph.js +9 -9
- package/build/fixtures/components/review.js +11 -11
- package/build/fixtures/examples/camera-capture.js +29 -29
- package/build/fixtures/examples/index.js +9 -17
- package/build/fixtures/examples/recipient-update.js +69 -69
- package/build/fixtures/examples/recipient.js +63 -63
- package/build/fixtures/examples/single-file-upload.js +21 -21
- package/build/fixtures/examples/step-validation-errors.js +21 -21
- package/build/fixtures/features/action-response.js +8 -8
- package/build/fixtures/features/external.js +8 -8
- package/build/fixtures/features/index.js +9 -17
- package/build/fixtures/features/persist-async.js +11 -11
- package/build/fixtures/features/polling.js +9 -9
- package/build/fixtures/features/validation-async.js +10 -10
- package/build/fixtures/index.js +11 -22
- package/build/fixtures/jsonSchemaForm/allOf.js +30 -30
- package/build/fixtures/jsonSchemaForm/audRecipient.js +271 -271
- package/build/fixtures/jsonSchemaForm/currency.js +12 -12
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +11 -11
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +11 -11
- package/build/fixtures/jsonSchemaForm/oneOf.js +27 -27
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +16 -16
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +17 -17
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +30 -30
- package/build/fixtures/jsonSchemaForm/simple.js +16 -16
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +19 -19
- package/build/fixtures/jsonSchemaForm/validationAsync.js +8 -8
- package/build/fixtures/layouts/all.js +37 -37
- package/build/fixtures/layouts/final-step-layout.js +9 -9
- package/build/fixtures/layouts/index.js +10 -18
- package/build/fixtures/layouts/list.js +10 -10
- package/build/fixtures/layouts/pay-in.js +23 -23
- package/build/fixtures/layouts/review.js +38 -38
- package/build/fixtures/layouts/success.js +15 -15
- package/build/fixtures/responses/action-response-final.js +8 -8
- package/build/fixtures/responses/action.js +3 -3
- package/build/fixtures/responses/exit.js +3 -3
- package/build/fixtures/responses/index.js +8 -16
- package/build/fixtures/responses/recipient-update-final.js +8 -8
- package/build/fixtures/schemas/basic-form.js +11 -11
- package/build/fixtures/schemas/index.js +8 -16
- package/build/fixtures/schemas/number-and-integer.js +11 -11
- package/build/fixtures/schemas/one-of.js +43 -46
- package/build/fixtures/schemas/string-formats.js +15 -15
- package/build/fixtures/utils/image-util.js +8 -8
- package/build/formControl/FormControl.js +118 -148
- package/build/formControl/index.js +6 -14
- package/build/formControl/utils/index.js +1 -1
- package/build/formControl/utils/value-utils.js +18 -23
- package/build/i18n/index.js +31 -31
- package/build/index.js +13 -10
- package/build/jsonSchemaForm/JsonSchemaForm.js +12 -24
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +24 -37
- package/build/jsonSchemaForm/allOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +9 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +9 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +56 -115
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +7 -7
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +1 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +19 -71
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +10 -11
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +6 -14
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +45 -62
- package/build/jsonSchemaForm/basicTypeSchema/index.js +6 -14
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +39 -50
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +18 -18
- package/build/jsonSchemaForm/controlFeedback/index.js +6 -14
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +52 -61
- package/build/jsonSchemaForm/genericSchema/index.js +6 -14
- package/build/jsonSchemaForm/help/Help.js +9 -9
- package/build/jsonSchemaForm/help/Help.messages.js +5 -5
- package/build/jsonSchemaForm/help/index.js +6 -14
- package/build/jsonSchemaForm/index.js +6 -14
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +28 -49
- package/build/jsonSchemaForm/objectSchema/index.js +6 -14
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +54 -74
- package/build/jsonSchemaForm/oneOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +3 -3
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +1 -1
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +19 -20
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +11 -22
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +5 -5
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +6 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +73 -127
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +6 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +45 -110
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +17 -17
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +6 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +28 -47
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +4 -4
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +13 -24
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +11 -22
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +12 -23
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +24 -26
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +6 -6
- package/build/jsonSchemaForm/readOnlySchema/index.js +6 -14
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +26 -39
- package/build/jsonSchemaForm/schemaFormControl/index.js +6 -14
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +5 -5
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -1
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +30 -47
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +57 -119
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +6 -14
- package/build/layout/DynamicLayout.js +10 -21
- package/build/layout/alert/DynamicAlert.js +9 -9
- package/build/layout/box/DynamicBox.js +12 -23
- package/build/layout/button/DynamicButton.js +16 -27
- package/build/layout/columns/DynamicColumns.js +13 -24
- package/build/layout/decision/DynamicDecision.js +16 -27
- package/build/layout/divider/DynamicDivider.js +7 -8
- package/build/layout/external/DynamicExternal.js +16 -28
- package/build/layout/external/DynamicExternal.messages.js +5 -5
- package/build/layout/form/DynamicForm.js +10 -21
- package/build/layout/heading/DynamicHeading.js +12 -23
- package/build/layout/icon/DynamicIcon.js +9 -10
- package/build/layout/image/DynamicImage.js +43 -93
- package/build/layout/index.js +21 -29
- package/build/layout/info/DynamicInfo.js +7 -19
- package/build/layout/list/DynamicList.js +14 -26
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +8 -9
- package/build/layout/paragraph/DynamicParagraph.js +19 -37
- package/build/layout/paragraph/DynamicParagraph.messages.js +6 -6
- package/build/layout/paragraph/useSnackBarIfAvailable.js +4 -4
- package/build/layout/review/DynamicReview.js +14 -26
- package/build/layout/utils.js +4 -6
- package/build/step/cameraStep/CameraStep.js +42 -88
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +48 -105
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +7 -7
- package/build/step/cameraStep/cameraCapture/components/index.js +10 -28
- package/build/step/cameraStep/cameraCapture/hooks/index.js +17 -72
- package/build/step/cameraStep/cameraCapture/index.js +6 -14
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +33 -45
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +8 -19
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +6 -6
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +9 -21
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +7 -7
- package/build/step/cameraStep/cameraCapture/screens/index.js +6 -14
- package/build/step/cameraStep/cameraCapture/tracking/index.js +17 -99
- package/build/step/cameraStep/cameraCapture/utils/index.js +33 -96
- package/build/step/cameraStep/index.js +6 -14
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +20 -21
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +8 -8
- package/build/step/externalConfirmationStep/index.js +6 -14
- package/build/step/index.js +7 -15
- package/build/step/layoutStep/LayoutStep.js +19 -19
- package/build/step/layoutStep/index.js +6 -14
- package/build/step/layoutStep/utils/index.js +3 -14
- package/build/step/layoutStep/utils/inline-reference-utils.js +29 -46
- package/build/step/layoutStep/utils/layout-utils.js +34 -53
- package/build/types/common/FormControl.js +1 -1
- package/build/types/index.js +13 -13
- package/build/types/specification/Action.js +1 -1
- package/build/types/specification/FileUploadSchema.js +1 -1
- package/build/types/specification/LayoutComponent.js +1 -1
- package/build/types/specification/Model.js +9 -17
- package/build/types/specification/PersistAsync.js +1 -1
- package/build/types/specification/Polling.js +1 -1
- package/build/types/specification/Promotion.js +1 -1
- package/build/types/specification/Schema.js +8 -8
- package/build/types/specification/Step.js +3 -5
- package/build/types/specification/ValidationAsync.js +1 -1
- package/build/types/specification/core.js +1 -1
- package/package.json +1 -1
package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js
CHANGED
|
@@ -1,173 +1,119 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
41
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.getErrorFromResponse = exports.getIdFromResponse = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_intl_1 = require("react-intl");
|
|
10
|
+
const constants_1 = require("../../../common/constants");
|
|
11
|
+
const contexts_1 = require("../../../common/contexts");
|
|
12
|
+
const hooks_1 = require("../../../common/hooks");
|
|
13
|
+
const utils_1 = require("../../../common/utils");
|
|
14
|
+
const validators_1 = require("../../../common/validators");
|
|
15
|
+
const allOf_1 = __importDefault(require("../../../fixtures/jsonSchemaForm/allOf"));
|
|
16
|
+
const basicTypeSchema_1 = __importDefault(require("../../basicTypeSchema"));
|
|
17
|
+
const SchemaFormControl_1 = require("../../schemaFormControl/SchemaFormControl");
|
|
18
|
+
const PersistAsyncSchema_messages_1 = __importDefault(require("../PersistAsyncSchema.messages"));
|
|
55
19
|
// TODO: LOW avoid type assertion below -- consider throwing if return value is not the expected type
|
|
56
|
-
|
|
20
|
+
const getIdFromResponse = (idProperty, response) => {
|
|
57
21
|
return response[idProperty];
|
|
58
22
|
};
|
|
59
23
|
exports.getIdFromResponse = getIdFromResponse;
|
|
60
|
-
|
|
24
|
+
const getErrorFromResponse = (errorProperty, response) => {
|
|
61
25
|
var _a;
|
|
62
26
|
return (_a = response.validation) === null || _a === void 0 ? void 0 : _a[errorProperty];
|
|
63
27
|
};
|
|
64
28
|
exports.getErrorFromResponse = getErrorFromResponse;
|
|
65
|
-
|
|
29
|
+
const controlTypesWithPersistOnChange = new Set([
|
|
66
30
|
constants_1.FormControlType.RADIO,
|
|
67
31
|
constants_1.FormControlType.SELECT,
|
|
68
32
|
constants_1.FormControlType.DATELOOKUP,
|
|
69
33
|
constants_1.FormControlType.FILE,
|
|
70
34
|
constants_1.FormControlType.UPLOAD,
|
|
71
35
|
]);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
(0, react_1.useEffect)(
|
|
36
|
+
const PersistAsyncBasicSchema = (props) => {
|
|
37
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
38
|
+
const fetcher = (0, contexts_1.useFetcher)();
|
|
39
|
+
const onEvent = (0, contexts_1.useEventDispatcher)();
|
|
40
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, react_1.useState)(null);
|
|
41
|
+
const previousPersistAsyncModel = (0, hooks_1.usePrevious)(persistAsyncModel);
|
|
42
|
+
const [persistAsyncError, setPersistAsyncError] = (0, react_1.useState)(null);
|
|
43
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, react_1.useState)(false);
|
|
44
|
+
const [abortController, setAbortController] = (0, react_1.useState)(null);
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
82
46
|
if (controlTypesWithPersistOnChange.has(
|
|
83
47
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
84
48
|
(0, SchemaFormControl_1.getControlType)(props.schema.persistAsync.schema))) {
|
|
85
49
|
persistAsyncIfValid();
|
|
86
50
|
}
|
|
87
51
|
}, [persistAsyncModel]);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return [4 /*yield*/, persistAsyncFetch];
|
|
112
|
-
case 2:
|
|
113
|
-
response = _d.sent();
|
|
114
|
-
return [4 /*yield*/, response.json()];
|
|
115
|
-
case 3:
|
|
116
|
-
responseBody = _d.sent();
|
|
117
|
-
if (!(0, validators_1.isObject)(responseBody)) {
|
|
118
|
-
throw new Error('Response is not an object');
|
|
119
|
-
}
|
|
120
|
-
_a = props.schema.persistAsync, idProperty = _a.idProperty, param = _a.param;
|
|
121
|
-
if ((0, utils_1.isStatus2xx)(response.status)) {
|
|
122
|
-
id = (0, exports.getIdFromResponse)(idProperty, responseBody);
|
|
123
|
-
props.onChange({ model: id, triggerSchema: props.schema, triggerModel: id });
|
|
124
|
-
}
|
|
125
|
-
else if ((0, utils_1.isStatus422)(response.status)) {
|
|
126
|
-
validation = responseBody.validation;
|
|
127
|
-
error = ((0, validators_1.isObject)(validation) && (validation === null || validation === void 0 ? void 0 : validation[param])) || null;
|
|
128
|
-
setPersistAsyncError(error);
|
|
129
|
-
props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
setGenericPersistAsyncError();
|
|
133
|
-
}
|
|
134
|
-
onEvent('Dynamic Flow - PersistAsync', { status: 'success', schemaId: allOf_1["default"].$id });
|
|
135
|
-
return [3 /*break*/, 5];
|
|
136
|
-
case 4:
|
|
137
|
-
_b = _d.sent();
|
|
138
|
-
onEvent('Dynamic Flow - PersistAsync', { status: 'failure', schemaId: allOf_1["default"].$id });
|
|
139
|
-
setGenericPersistAsyncError();
|
|
140
|
-
return [3 /*break*/, 5];
|
|
141
|
-
case 5: return [2 /*return*/];
|
|
52
|
+
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(PersistAsyncSchema_messages_1.default.genericError));
|
|
53
|
+
const getPersistAsyncResponse = async (currentPersistAsyncModel, persistAsyncSpec) => {
|
|
54
|
+
const signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
55
|
+
const requestBody = { [persistAsyncSpec.param]: currentPersistAsyncModel };
|
|
56
|
+
setFieldSubmitted(true); // persist async initiated implied the field has been submitted
|
|
57
|
+
try {
|
|
58
|
+
onEvent('Dynamic Flow - PersistAsync', { status: 'pending', schemaId: allOf_1.default.$id });
|
|
59
|
+
const persistAsyncFetch = fetcher(persistAsyncSpec.url, {
|
|
60
|
+
method: persistAsyncSpec.method,
|
|
61
|
+
headers: { 'Content-Type': 'application/json' },
|
|
62
|
+
body: JSON.stringify(requestBody),
|
|
63
|
+
signal,
|
|
64
|
+
});
|
|
65
|
+
props.onPersistAsync(persistAsyncFetch);
|
|
66
|
+
const response = await persistAsyncFetch;
|
|
67
|
+
const responseBody = await response.json();
|
|
68
|
+
if (!(0, validators_1.isObject)(responseBody)) {
|
|
69
|
+
throw new Error('Response is not an object');
|
|
70
|
+
}
|
|
71
|
+
const { idProperty, param } = props.schema.persistAsync;
|
|
72
|
+
if ((0, utils_1.isStatus2xx)(response.status)) {
|
|
73
|
+
const id = (0, exports.getIdFromResponse)(idProperty, responseBody);
|
|
74
|
+
props.onChange({ model: id, triggerSchema: props.schema, triggerModel: id });
|
|
142
75
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
76
|
+
else if ((0, utils_1.isStatus422)(response.status)) {
|
|
77
|
+
const { validation } = responseBody;
|
|
78
|
+
const error = ((0, validators_1.isObject)(validation) && (validation === null || validation === void 0 ? void 0 : validation[param])) || null;
|
|
79
|
+
setPersistAsyncError(error);
|
|
80
|
+
props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
setGenericPersistAsyncError();
|
|
84
|
+
}
|
|
85
|
+
onEvent('Dynamic Flow - PersistAsync', { status: 'success', schemaId: allOf_1.default.$id });
|
|
86
|
+
}
|
|
87
|
+
catch (_a) {
|
|
88
|
+
onEvent('Dynamic Flow - PersistAsync', { status: 'failure', schemaId: allOf_1.default.$id });
|
|
89
|
+
setGenericPersistAsyncError();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const abortCurrentRequestAndGetNewAbortSignal = () => {
|
|
146
93
|
if (abortController) {
|
|
147
94
|
abortController.abort();
|
|
148
95
|
}
|
|
149
|
-
|
|
96
|
+
const newAbortController = new AbortController();
|
|
150
97
|
setAbortController(newAbortController);
|
|
151
98
|
return newAbortController.signal;
|
|
152
99
|
};
|
|
153
|
-
|
|
100
|
+
const persistAsyncIfValid = () => {
|
|
154
101
|
if (!(0, validators_1.isNull)(persistAsyncModel) && !(0, utils_1.isEqual)(persistAsyncModel, previousPersistAsyncModel)) {
|
|
155
102
|
void getPersistAsyncResponse(persistAsyncModel, props.schema.persistAsync);
|
|
156
103
|
}
|
|
157
104
|
};
|
|
158
|
-
|
|
105
|
+
const onBlur = () => {
|
|
159
106
|
persistAsyncIfValid();
|
|
160
107
|
};
|
|
161
|
-
|
|
162
|
-
var newPersistAsyncModel = _a.model;
|
|
108
|
+
const persistAsyncOnChange = ({ model: newPersistAsyncModel }) => {
|
|
163
109
|
setPersistAsyncError(null);
|
|
164
110
|
if ((0, validators_1.isValidSchema)(newPersistAsyncModel, props.schema.persistAsync.schema)) {
|
|
165
111
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
166
112
|
}
|
|
167
113
|
};
|
|
168
|
-
return ((0, jsx_runtime_1.jsx)(basicTypeSchema_1
|
|
114
|
+
return ((0, jsx_runtime_1.jsx)(basicTypeSchema_1.default, { required: props.required, submitted: props.submitted || fieldSubmitted, schema: props.schema.persistAsync.schema, errors: persistAsyncError || props.errors, model: null, infoMessage: null, onChange: persistAsyncOnChange, onBlur: onBlur }));
|
|
169
115
|
};
|
|
170
116
|
PersistAsyncBasicSchema.defaultProps = {
|
|
171
|
-
required: false
|
|
117
|
+
required: false,
|
|
172
118
|
};
|
|
173
|
-
exports
|
|
119
|
+
exports.default = PersistAsyncBasicSchema;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
exports["default"] = void 0;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
15
7
|
var PersistAsyncBasicSchema_1 = require("./PersistAsyncBasicSchema");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PersistAsyncBasicSchema_1).default; } });
|
package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js
CHANGED
|
@@ -1,131 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
4
|
};
|
|
52
|
-
exports
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const contexts_1 = require("../../../common/contexts");
|
|
10
|
+
const utils_1 = require("../../../common/utils");
|
|
11
|
+
const validators_1 = require("../../../common/validators");
|
|
12
|
+
const controlFeedback_1 = __importDefault(require("../../controlFeedback"));
|
|
13
|
+
const utils_2 = require("../../schemaFormControl/utils");
|
|
14
|
+
const PersistAsyncBasicSchema_1 = require("../persistAsyncBasicSchema/PersistAsyncBasicSchema");
|
|
15
|
+
const UploadInputAdapter_1 = require("./UploadInputAdapter");
|
|
16
|
+
const PersistAsyncBlobSchema = (props) => {
|
|
17
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, react_1.useState)({});
|
|
18
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, react_1.useState)(null);
|
|
19
|
+
const [validations, setValidations] = (0, react_1.useState)([]);
|
|
20
|
+
const [changed, setChanged] = (0, react_1.useState)(false);
|
|
21
|
+
const fetcher = (0, contexts_1.useFetcher)();
|
|
22
|
+
const onEvent = (0, contexts_1.useEventDispatcher)();
|
|
23
|
+
const refreshValidations = () => {
|
|
71
24
|
if (props.submitted) {
|
|
72
25
|
setValidations((0, validators_1.getValidationFailures)(props.model, props.schema, !!props.required));
|
|
73
26
|
}
|
|
74
27
|
};
|
|
75
28
|
(0, react_1.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0:
|
|
96
|
-
if (!(errorResponse.response && (0, utils_1.isStatus422)(errorResponse.response.status))) return [3 /*break*/, 2];
|
|
97
|
-
return [4 /*yield*/, errorResponse.response.json()];
|
|
98
|
-
case 1:
|
|
99
|
-
jsonResponse = (_a.sent());
|
|
100
|
-
setPersistAsyncValidationMessages(jsonResponse.validation || {});
|
|
101
|
-
setPersistAsyncValidations([props.schema.persistAsync.param]);
|
|
102
|
-
_a.label = 2;
|
|
103
|
-
case 2:
|
|
104
|
-
props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
|
|
105
|
-
setChanged(true);
|
|
106
|
-
onEvent('Dynamic Flow - PersistAsync', { status: 'failure', schemaId: props.schema.$id });
|
|
107
|
-
return [2 /*return*/];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}); };
|
|
111
|
-
var onCancel = function () {
|
|
29
|
+
const onSuccess = async (httpResponse, _fileName) => {
|
|
30
|
+
const jsonResponse = (await httpResponse.json());
|
|
31
|
+
const id = (0, PersistAsyncBasicSchema_1.getIdFromResponse)(props.schema.persistAsync.idProperty, jsonResponse);
|
|
32
|
+
props.onChange({ model: id, triggerSchema: props.schema, triggerModel: id });
|
|
33
|
+
setChanged(true);
|
|
34
|
+
onEvent('Dynamic Flow - PersistAsync', { status: 'success', schemaId: props.schema.$id });
|
|
35
|
+
};
|
|
36
|
+
const onFailure = async (errorResponse) => {
|
|
37
|
+
if (errorResponse.response && (0, utils_1.isStatus422)(errorResponse.response.status)) {
|
|
38
|
+
const jsonResponse = (await errorResponse.response.json());
|
|
39
|
+
setPersistAsyncValidationMessages(jsonResponse.validation || {});
|
|
40
|
+
setPersistAsyncValidations([props.schema.persistAsync.param]);
|
|
41
|
+
}
|
|
42
|
+
props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
|
|
43
|
+
setChanged(true);
|
|
44
|
+
onEvent('Dynamic Flow - PersistAsync', { status: 'failure', schemaId: props.schema.$id });
|
|
45
|
+
};
|
|
46
|
+
const onCancel = () => {
|
|
112
47
|
setPersistAsyncValidations(null);
|
|
113
48
|
props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
|
|
114
49
|
setChanged(true);
|
|
115
50
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
51
|
+
const { url, method } = props.schema.persistAsync;
|
|
52
|
+
const combinedValidations = persistAsyncValidations || validations;
|
|
53
|
+
const formGroupClasses = {
|
|
119
54
|
'form-group': true,
|
|
120
|
-
'has-error': (props.submitted || changed) && !!combinedValidations.length
|
|
55
|
+
'has-error': (props.submitted || changed) && !!combinedValidations.length,
|
|
121
56
|
};
|
|
122
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(formGroupClasses) }, { children: [(0, jsx_runtime_1.jsx)(UploadInputAdapter_1.UploadInputAdapter, Object.assign({ id: props.schema.$id ||
|
|
123
58
|
props.schema.persistAsync.schema.$id ||
|
|
124
59
|
props.schema.persistAsync.idProperty,
|
|
125
60
|
// TODO: LOW avoid type assertion -- model can be null, but fileId must be number | string -- or maybe make fileId: string| number | undefined
|
|
126
|
-
fileId: props.model, idProperty: props.schema.persistAsync.idProperty, animationDelay: 0, maxSize: props.schema.persistAsync.schema.maxSize, usLabel: props.schema.title || props.schema.persistAsync.schema.title, usPlaceholder: props.schema.description || props.schema.persistAsync.schema.description, httpOptions: { url
|
|
61
|
+
fileId: props.model, idProperty: props.schema.persistAsync.idProperty, animationDelay: 0, maxSize: props.schema.persistAsync.schema.maxSize, usLabel: props.schema.title || props.schema.persistAsync.schema.title, usPlaceholder: props.schema.description || props.schema.persistAsync.schema.description, httpOptions: { url, method, fileInputName: props.schema.persistAsync.param }, fetcher: fetcher, onSuccess: onSuccess, onFailure: onFailure, onCancel: onCancel }, (0, utils_2.mapSchemaToUploadOptions)(props.schema.persistAsync.schema))), (0, jsx_runtime_1.jsx)(controlFeedback_1.default, { blurred: true, focused: false, changed: changed, submitted: props.submitted, errors: props.errors, schema: props.schema, validations: combinedValidations, validationMessages: Object.assign({ required: 'Value is required...' }, persistAsyncValidationMessages), infoMessage: null })] })));
|
|
127
62
|
};
|
|
128
63
|
PersistAsyncBlobSchema.defaultProps = {
|
|
129
|
-
required: false
|
|
64
|
+
required: false,
|
|
130
65
|
};
|
|
131
|
-
exports
|
|
66
|
+
exports.default = PersistAsyncBlobSchema;
|
package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UploadInputAdapter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const components_1 = require("@transferwise/components");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const contexts_1 = require("../../../common/contexts");
|
|
8
|
+
const utils_1 = require("../../../common/utils");
|
|
9
|
+
const UploadInputAdapter = (props) => {
|
|
10
|
+
const { id, fetcher = fetch, httpOptions, fileId, idProperty, usAccept, maxSize, usPlaceholder, onSuccess, onFailure, onCancel, } = props;
|
|
11
|
+
const onEvent = (0, contexts_1.useEventDispatcher)();
|
|
12
|
+
const files = (0, react_1.useMemo)(() => (fileId ? [{ id: fileId, status: components_1.Status.SUCCEEDED }] : []), [fileId]);
|
|
13
|
+
const uploadFile = (formData) => {
|
|
14
14
|
onEvent('Dynamic Flow - PersistAsync', { status: 'pending', schemaId: id });
|
|
15
|
-
return fetcher(
|
|
15
|
+
return fetcher(`${httpOptions.url}`, {
|
|
16
16
|
method: httpOptions.method || 'POST',
|
|
17
|
-
body: formData
|
|
18
|
-
}).then(
|
|
17
|
+
body: formData,
|
|
18
|
+
}).then((response) => {
|
|
19
19
|
if (response.ok) {
|
|
20
20
|
onSuccess && onSuccess(response.clone());
|
|
21
|
-
return response.json().then(
|
|
21
|
+
return response.json().then((responseBody) => {
|
|
22
22
|
return { id: responseBody[idProperty] };
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
onFailure && onFailure({ response
|
|
26
|
+
onFailure && onFailure({ response });
|
|
27
27
|
return Promise.reject();
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(components_1.UploadInput, { id: id, fileInputName: httpOptions.fileInputName, files: files, uploadButtonTitle: props.usLabel, sizeLimit: maxSize ? (0, utils_1.toKilobytes)(maxSize) : undefined, fileTypes: usAccept, description: usPlaceholder, onUploadFile: uploadFile, onDeleteFile:
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(components_1.UploadInput, { id: id, fileInputName: httpOptions.fileInputName, files: files, uploadButtonTitle: props.usLabel, sizeLimit: maxSize ? (0, utils_1.toKilobytes)(maxSize) : undefined, fileTypes: usAccept, description: usPlaceholder, onUploadFile: uploadFile, onDeleteFile: (_id) => {
|
|
32
32
|
onCancel && onCancel();
|
|
33
33
|
return Promise.resolve();
|
|
34
34
|
} }));
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
exports["default"] = void 0;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
15
7
|
var PersistAsyncBlobSchema_1 = require("./PersistAsyncBlobSchema");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PersistAsyncBlobSchema_1).default; } });
|