@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
|
@@ -1,114 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
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
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.getVideoCapabilities = exports.getVideoTrack = exports.getActiveVideoDeviceLabel = exports.getAvailableVideoDeviceLabels = exports.getAvailableVideoDevices = exports.generateCanvasFromVideo = exports.isMainBackCamera = exports.isSelfieCamera = void 0;
|
|
40
|
-
|
|
4
|
+
const isSelfieCamera = (stream) => {
|
|
41
5
|
var _a;
|
|
42
|
-
|
|
6
|
+
const { facingMode } = ((_a = (0, exports.getVideoTrack)(stream)) === null || _a === void 0 ? void 0 : _a.getSettings()) || {};
|
|
43
7
|
// facingMode === undefined for desktop users
|
|
44
8
|
return facingMode === 'user' || facingMode === undefined;
|
|
45
9
|
};
|
|
46
10
|
exports.isSelfieCamera = isSelfieCamera;
|
|
47
|
-
|
|
48
|
-
return !!((deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.label) || '').match(/camera2? 0/g);
|
|
49
|
-
};
|
|
11
|
+
const isMainBackCamera = (deviceInfo) => !!((deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.label) || '').match(/camera2? 0/g);
|
|
50
12
|
exports.isMainBackCamera = isMainBackCamera;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!context) return [3 /*break*/, 2];
|
|
62
|
-
// Timeout is needed for intermittent iOS issue
|
|
63
|
-
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 100); })];
|
|
64
|
-
case 1:
|
|
65
|
-
// Timeout is needed for intermittent iOS issue
|
|
66
|
-
_a.sent();
|
|
67
|
-
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
68
|
-
_a.label = 2;
|
|
69
|
-
case 2: return [2 /*return*/, canvas];
|
|
13
|
+
const generateCanvasFromVideo = async (video) => {
|
|
14
|
+
const canvas = document.createElement('canvas');
|
|
15
|
+
if (video) {
|
|
16
|
+
canvas.setAttribute('height', `${video.videoHeight}`);
|
|
17
|
+
canvas.setAttribute('width', `${video.videoWidth}`);
|
|
18
|
+
const context = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d');
|
|
19
|
+
if (context) {
|
|
20
|
+
// Timeout is needed for intermittent iOS issue
|
|
21
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
22
|
+
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
70
23
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
24
|
+
}
|
|
25
|
+
return canvas;
|
|
26
|
+
};
|
|
73
27
|
exports.generateCanvasFromVideo = generateCanvasFromVideo;
|
|
74
|
-
|
|
28
|
+
const getAvailableVideoDevices = async () => {
|
|
75
29
|
var _a, _b;
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
case 0: return [4 /*yield*/, ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))];
|
|
79
|
-
case 1: return [2 /*return*/, ((_c.sent()) || []).filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}); };
|
|
30
|
+
return ((await ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))) || []).filter((deviceInfo) => deviceInfo.kind === 'videoinput');
|
|
31
|
+
};
|
|
83
32
|
exports.getAvailableVideoDevices = getAvailableVideoDevices;
|
|
84
|
-
|
|
33
|
+
const getAvailableVideoDeviceLabels = async () => {
|
|
85
34
|
var _a, _b;
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })
|
|
91
|
-
.map(function (deviceInfo) { return deviceInfo.label; })];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}); };
|
|
35
|
+
return ((await ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))) || [])
|
|
36
|
+
.filter((deviceInfo) => deviceInfo.kind === 'videoinput')
|
|
37
|
+
.map((deviceInfo) => deviceInfo.label);
|
|
38
|
+
};
|
|
95
39
|
exports.getAvailableVideoDeviceLabels = getAvailableVideoDeviceLabels;
|
|
96
|
-
|
|
97
|
-
var capabilities;
|
|
40
|
+
const getActiveVideoDeviceLabel = async (videoStream) => {
|
|
98
41
|
var _a, _b, _c;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
case 1: return [2 /*return*/, (_c = ((_d.sent()) || [])
|
|
105
|
-
.filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })
|
|
106
|
-
.find(function (deviceInfo) { return deviceInfo.deviceId === (capabilities === null || capabilities === void 0 ? void 0 : capabilities.deviceId); })) === null || _c === void 0 ? void 0 : _c.label];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}); };
|
|
42
|
+
const capabilities = (0, exports.getVideoCapabilities)(videoStream);
|
|
43
|
+
return (_c = ((await ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))) || [])
|
|
44
|
+
.filter((deviceInfo) => deviceInfo.kind === 'videoinput')
|
|
45
|
+
.find((deviceInfo) => deviceInfo.deviceId === (capabilities === null || capabilities === void 0 ? void 0 : capabilities.deviceId))) === null || _c === void 0 ? void 0 : _c.label;
|
|
46
|
+
};
|
|
110
47
|
exports.getActiveVideoDeviceLabel = getActiveVideoDeviceLabel;
|
|
111
|
-
|
|
48
|
+
const getVideoTrack = (videoStream) => { var _a; return (((_a = videoStream === null || videoStream === void 0 ? void 0 : videoStream.getVideoTracks) === null || _a === void 0 ? void 0 : _a.call(videoStream)) || [])[0]; };
|
|
112
49
|
exports.getVideoTrack = getVideoTrack;
|
|
113
|
-
|
|
50
|
+
const getVideoCapabilities = (videoStream) => { var _a, _b; return (_b = (_a = (0, exports.getVideoTrack)(videoStream)) === null || _a === void 0 ? void 0 : _a.getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a); };
|
|
114
51
|
exports.getVideoCapabilities = getVideoCapabilities;
|
|
@@ -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 CameraStep_1 = require("./CameraStep");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CameraStep_1).default; } });
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_intl_1 = require("react-intl");
|
|
8
|
+
const layout_1 = require("../../layout");
|
|
9
|
+
const ExternalConfirmationStep_messages_1 = __importDefault(require("./ExternalConfirmationStep.messages"));
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var formatMessage = (0, react_intl_1.useIntl)().formatMessage;
|
|
11
|
+
const noop = () => { };
|
|
12
|
+
const ExternalConfirmationStep = ({ url, onClose }) => {
|
|
13
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
15
14
|
return ((0, jsx_runtime_1.jsx)(layout_1.DynamicLayout, { components: [
|
|
16
15
|
{
|
|
17
16
|
type: 'box',
|
|
@@ -19,16 +18,16 @@ var ExternalConfirmationStep = function (_a) {
|
|
|
19
18
|
components: [
|
|
20
19
|
{
|
|
21
20
|
type: 'heading',
|
|
22
|
-
text: formatMessage(ExternalConfirmationStep_messages_1
|
|
21
|
+
text: formatMessage(ExternalConfirmationStep_messages_1.default.title),
|
|
23
22
|
size: 'lg',
|
|
24
23
|
align: 'center',
|
|
25
|
-
margin: 'xl'
|
|
24
|
+
margin: 'xl',
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
27
|
type: 'info',
|
|
29
|
-
markdown: formatMessage(ExternalConfirmationStep_messages_1
|
|
28
|
+
markdown: formatMessage(ExternalConfirmationStep_messages_1.default.description, { origin: getOrigin(url) }),
|
|
30
29
|
align: 'center',
|
|
31
|
-
margin: 'xl'
|
|
30
|
+
margin: 'xl',
|
|
32
31
|
},
|
|
33
32
|
{
|
|
34
33
|
type: 'box',
|
|
@@ -36,29 +35,29 @@ var ExternalConfirmationStep = function (_a) {
|
|
|
36
35
|
components: [
|
|
37
36
|
{
|
|
38
37
|
type: 'button',
|
|
39
|
-
action: { title: formatMessage(ExternalConfirmationStep_messages_1
|
|
38
|
+
action: { title: formatMessage(ExternalConfirmationStep_messages_1.default.open), type: 'primary', url, exit: true },
|
|
40
39
|
},
|
|
41
40
|
{
|
|
42
41
|
type: 'button',
|
|
43
42
|
action: {
|
|
44
|
-
title: formatMessage(ExternalConfirmationStep_messages_1
|
|
43
|
+
title: formatMessage(ExternalConfirmationStep_messages_1.default.cancel),
|
|
45
44
|
type: 'link',
|
|
46
45
|
url: '',
|
|
47
|
-
exit: true
|
|
48
|
-
}
|
|
46
|
+
exit: true,
|
|
47
|
+
},
|
|
49
48
|
},
|
|
50
|
-
]
|
|
49
|
+
],
|
|
51
50
|
},
|
|
52
|
-
]
|
|
51
|
+
],
|
|
53
52
|
},
|
|
54
|
-
], submitted: false, onAction:
|
|
53
|
+
], submitted: false, onAction: (action) => {
|
|
55
54
|
if (action.url) {
|
|
56
55
|
window.open(action.url, '_blank');
|
|
57
56
|
}
|
|
58
57
|
onClose();
|
|
59
58
|
}, onModelChange: noop, onPersistAsync: noop }));
|
|
60
59
|
};
|
|
61
|
-
exports
|
|
60
|
+
exports.default = ExternalConfirmationStep;
|
|
62
61
|
function getOrigin(url) {
|
|
63
62
|
try {
|
|
64
63
|
return new URL(url).origin;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
|
|
4
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_intl_1 = require("react-intl");
|
|
4
|
+
exports.default = (0, react_intl_1.defineMessages)({
|
|
5
5
|
title: {
|
|
6
6
|
id: 'dynamicFlows.ExternalConfirmation.title',
|
|
7
7
|
defaultMessage: 'Please confirm',
|
|
8
|
-
description: 'Heading for the confirmation screen.'
|
|
8
|
+
description: 'Heading for the confirmation screen.',
|
|
9
9
|
},
|
|
10
10
|
description: {
|
|
11
11
|
id: 'dynamicFlows.ExternalConfirmation.description',
|
|
12
12
|
defaultMessage: 'Please confirm you want to open **{origin}** in a new browser tab.',
|
|
13
|
-
description: 'Description for the confirmation screen.'
|
|
13
|
+
description: 'Description for the confirmation screen.',
|
|
14
14
|
},
|
|
15
15
|
open: {
|
|
16
16
|
id: 'dynamicFlows.ExternalConfirmation.open',
|
|
17
17
|
defaultMessage: 'Open in new tab',
|
|
18
|
-
description: 'Button text confirming opening a new browser tab.'
|
|
18
|
+
description: 'Button text confirming opening a new browser tab.',
|
|
19
19
|
},
|
|
20
20
|
cancel: {
|
|
21
21
|
id: 'dynamicFlows.ExternalConfirmation.cancel',
|
|
22
22
|
defaultMessage: 'Cancel',
|
|
23
|
-
description: 'Button text rejecting opening a new browser tab.'
|
|
24
|
-
}
|
|
23
|
+
description: 'Button text rejecting opening a new browser tab.',
|
|
24
|
+
},
|
|
25
25
|
});
|
|
@@ -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 ExternalConfirmationStep_1 = require("./ExternalConfirmationStep");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ExternalConfirmationStep_1).default; } });
|
package/build/step/index.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
6
|
exports.ExternalConfirmationStep = exports.CameraStep = exports.LayoutStep = void 0;
|
|
15
7
|
var layoutStep_1 = require("./layoutStep");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "LayoutStep", { enumerable: true, get: function () { return __importDefault(layoutStep_1).default; } });
|
|
17
9
|
var cameraStep_1 = require("./cameraStep");
|
|
18
|
-
|
|
10
|
+
Object.defineProperty(exports, "CameraStep", { enumerable: true, get: function () { return __importDefault(cameraStep_1).default; } });
|
|
19
11
|
var externalConfirmationStep_1 = require("./externalConfirmationStep");
|
|
20
|
-
|
|
12
|
+
Object.defineProperty(exports, "ExternalConfirmationStep", { enumerable: true, get: function () { return __importDefault(externalConfirmationStep_1).default; } });
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const contexts_1 = require("../../common/contexts");
|
|
5
|
+
const hooks_1 = require("../../common/hooks");
|
|
6
|
+
const validators_1 = require("../../common/validators");
|
|
7
|
+
const layout_1 = require("../../layout");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
const getComponents = (step, options) => {
|
|
10
10
|
var _a;
|
|
11
11
|
if (!step || (0, validators_1.isEmpty)(step) || (!step.layout && !step.type)) {
|
|
12
12
|
return [];
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
const layout = (0, utils_1.convertStepToLayout)(step, options);
|
|
15
15
|
return (0, utils_1.inlineReferences)({
|
|
16
|
-
layout
|
|
16
|
+
layout,
|
|
17
17
|
schemas: step.schemas || [],
|
|
18
18
|
actions: step.actions || [],
|
|
19
|
-
model: (_a = step.model) !== null && _a !== void 0 ? _a : null
|
|
19
|
+
model: (_a = step.model) !== null && _a !== void 0 ? _a : null,
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const LayoutStep = (props) => {
|
|
23
|
+
const { stepSpecification, stepLayoutOptions, submitted, model, formErrors, onModelChange } = props;
|
|
24
|
+
const components = getComponents(stepSpecification, stepLayoutOptions);
|
|
25
|
+
const { loading, registerPersistAsyncPromise } = (0, contexts_1.useDynamicFlow)();
|
|
26
|
+
const onEvent = (0, contexts_1.useEventDispatcher)();
|
|
27
|
+
const onAction = !loading
|
|
28
28
|
? props.onAction
|
|
29
|
-
:
|
|
29
|
+
: () => {
|
|
30
30
|
onEvent('Dynamic Flow - onAction supressed', { reason: 'LayoutStep - loading state' });
|
|
31
31
|
};
|
|
32
32
|
(0, hooks_1.useStepPolling)(stepSpecification.polling, onAction);
|
|
33
33
|
return ((0, jsx_runtime_1.jsx)(layout_1.DynamicLayout, { components: components, submitted: submitted, model: model, errors: formErrors, onAction: onAction, onModelChange: onModelChange, onPersistAsync: registerPersistAsyncPromise }));
|
|
34
34
|
};
|
|
35
|
-
exports
|
|
35
|
+
exports.default = LayoutStep;
|
|
@@ -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 LayoutStep_1 = require("./LayoutStep");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(LayoutStep_1).default; } });
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.inlineReferences = exports.convertStepToLayout = void 0;
|
|
15
4
|
var layout_utils_1 = require("./layout-utils");
|
|
16
|
-
|
|
5
|
+
Object.defineProperty(exports, "convertStepToLayout", { enumerable: true, get: function () { return layout_utils_1.convertStepToLayout; } });
|
|
17
6
|
var inline_reference_utils_1 = require("./inline-reference-utils");
|
|
18
|
-
|
|
7
|
+
Object.defineProperty(exports, "inlineReferences", { enumerable: true, get: function () { return inline_reference_utils_1.inlineReferences; } });
|
|
@@ -1,92 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
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
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.inlineReferences = void 0;
|
|
15
|
-
|
|
16
|
-
function inlineReferences(
|
|
17
|
-
var layout = _a.layout, schemas = _a.schemas, actions = _a.actions, model = _a.model;
|
|
4
|
+
const layout_utils_1 = require("./layout-utils");
|
|
5
|
+
function inlineReferences({ layout, schemas, actions, model, }) {
|
|
18
6
|
if (!layout) {
|
|
19
7
|
return [];
|
|
20
8
|
}
|
|
21
9
|
if (!schemas) {
|
|
22
10
|
return layout;
|
|
23
11
|
}
|
|
24
|
-
return layout.map(
|
|
12
|
+
return layout.map((component) => {
|
|
25
13
|
if (component.type === 'form') {
|
|
26
|
-
return inlineFormSchema({ formComponent: component, schemas
|
|
14
|
+
return inlineFormSchema({ formComponent: component, schemas });
|
|
27
15
|
}
|
|
28
16
|
if (component.type === 'decision') {
|
|
29
|
-
return inlineDecisionActions({ decisionComponent: component, actions
|
|
17
|
+
return inlineDecisionActions({ decisionComponent: component, actions });
|
|
30
18
|
}
|
|
31
19
|
if (component.type === 'button') {
|
|
32
|
-
return inlineAction({ actionComponent: component, actions
|
|
20
|
+
return inlineAction({ actionComponent: component, actions });
|
|
33
21
|
}
|
|
34
22
|
if (component.type === 'box') {
|
|
35
|
-
return inlineBoxReferences({ boxComponent: component, schemas
|
|
23
|
+
return inlineBoxReferences({ boxComponent: component, schemas, actions, model });
|
|
36
24
|
}
|
|
37
25
|
if (component.type === 'columns') {
|
|
38
|
-
return inlineColumnsReferences({ columnsComponent: component, schemas
|
|
26
|
+
return inlineColumnsReferences({ columnsComponent: component, schemas, actions, model });
|
|
39
27
|
}
|
|
40
28
|
return component;
|
|
41
29
|
});
|
|
42
30
|
}
|
|
43
31
|
exports.inlineReferences = inlineReferences;
|
|
44
|
-
function inlineFormSchema(
|
|
45
|
-
var formComponent = _a.formComponent, schemas = _a.schemas;
|
|
32
|
+
function inlineFormSchema({ formComponent, schemas, }) {
|
|
46
33
|
if (isReference(formComponent.schema) && formComponent.schema.$ref) {
|
|
47
|
-
return
|
|
34
|
+
return Object.assign(Object.assign({}, formComponent), { schema: getSchemaById(schemas, formComponent.schema.$ref) });
|
|
48
35
|
}
|
|
49
|
-
return
|
|
36
|
+
return Object.assign({}, formComponent);
|
|
50
37
|
}
|
|
51
|
-
function inlineDecisionActions(
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
var newOptions = (_b = decisionComponent === null || decisionComponent === void 0 ? void 0 : decisionComponent.options) === null || _b === void 0 ? void 0 : _b.map(function (option) {
|
|
38
|
+
function inlineDecisionActions({ decisionComponent, actions, }) {
|
|
39
|
+
var _a;
|
|
40
|
+
const newOptions = (_a = decisionComponent === null || decisionComponent === void 0 ? void 0 : decisionComponent.options) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
55
41
|
return option.action && isReference(option.action)
|
|
56
|
-
?
|
|
42
|
+
? Object.assign(Object.assign({}, option), { action: getActionById(actions, option.action.$ref) }) : option;
|
|
57
43
|
});
|
|
58
|
-
return
|
|
44
|
+
return Object.assign(Object.assign({}, decisionComponent), { options: newOptions });
|
|
59
45
|
}
|
|
60
|
-
function inlineAction(
|
|
61
|
-
var
|
|
62
|
-
var actionComponent = _a.actionComponent, actions = _a.actions;
|
|
46
|
+
function inlineAction({ actionComponent, actions, }) {
|
|
47
|
+
var _a;
|
|
63
48
|
if (actionComponent.action &&
|
|
64
49
|
isReference(actionComponent.action) &&
|
|
65
|
-
((
|
|
66
|
-
|
|
50
|
+
((_a = actionComponent.action) === null || _a === void 0 ? void 0 : _a.$ref)) {
|
|
51
|
+
const newAction = getActionById(actions, actionComponent.action.$ref);
|
|
67
52
|
return (0, layout_utils_1.convertStepActionToDynamicAction)(newAction);
|
|
68
53
|
}
|
|
69
54
|
return actionComponent;
|
|
70
55
|
}
|
|
71
|
-
function inlineBoxReferences(
|
|
72
|
-
|
|
73
|
-
return __assign(__assign({}, boxComponent), { components: inlineReferences({ layout: boxComponent.components, schemas: schemas, actions: actions, model: model }) });
|
|
56
|
+
function inlineBoxReferences({ boxComponent, schemas, actions, model, }) {
|
|
57
|
+
return Object.assign(Object.assign({}, boxComponent), { components: inlineReferences({ layout: boxComponent.components, schemas, actions, model }) });
|
|
74
58
|
}
|
|
75
|
-
function inlineColumnsReferences(
|
|
76
|
-
|
|
77
|
-
return __assign(__assign({}, columnsComponent), { left: inlineReferences({ layout: columnsComponent.left, schemas: schemas, actions: actions, model: model }), right: inlineReferences({ layout: columnsComponent.right, schemas: schemas, actions: actions, model: model }) });
|
|
59
|
+
function inlineColumnsReferences({ columnsComponent, schemas, actions, model, }) {
|
|
60
|
+
return Object.assign(Object.assign({}, columnsComponent), { left: inlineReferences({ layout: columnsComponent.left, schemas, actions, model }), right: inlineReferences({ layout: columnsComponent.right, schemas, actions, model }) });
|
|
78
61
|
}
|
|
79
62
|
function getSchemaById(schemas, id) {
|
|
80
|
-
|
|
63
|
+
const schema = schemas.find((schema) => schema.$id === id);
|
|
81
64
|
if (!schema) {
|
|
82
|
-
throw new Error(
|
|
65
|
+
throw new Error(`Fatal Error. Schema not found. $id ${id}`);
|
|
83
66
|
}
|
|
84
67
|
return schema;
|
|
85
68
|
}
|
|
86
69
|
function getActionById(actions, id) {
|
|
87
|
-
|
|
70
|
+
const action = actions.find((action) => action.$id === id);
|
|
88
71
|
if (!action) {
|
|
89
|
-
throw new Error(
|
|
72
|
+
throw new Error(`Fatal Error. Action not found. $id ${id}`);
|
|
90
73
|
}
|
|
91
74
|
return action;
|
|
92
75
|
}
|