@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,84 +1,29 @@
|
|
|
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
|
-
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
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.useVideoConstraints = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const useVideoConstraints = (direction) => {
|
|
7
|
+
const [videoConstraints, setVideoConstraints] = (0, react_1.useState)();
|
|
8
|
+
const defaultVideoConstraints = {
|
|
56
9
|
facingMode: direction === 'front' ? 'user' : 'environment',
|
|
57
10
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
58
11
|
width: { min: 640, max: 1920, ideal: 1280 },
|
|
59
12
|
frameRate: 30,
|
|
60
|
-
aspectRatio: 16 / 9
|
|
13
|
+
aspectRatio: 16 / 9,
|
|
61
14
|
};
|
|
62
|
-
(0, react_1.useEffect)(
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
63
16
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
64
17
|
}, [direction]);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!(direction === 'back')) return [3 /*break*/, 2];
|
|
71
|
-
return [4 /*yield*/, (0, utils_1.getAvailableVideoDevices)()];
|
|
72
|
-
case 1:
|
|
73
|
-
mainCamera = (_a.sent()).find(utils_1.isMainBackCamera);
|
|
74
|
-
if (mainCamera === null || mainCamera === void 0 ? void 0 : mainCamera.deviceId) {
|
|
75
|
-
return [2 /*return*/, __assign(__assign({}, defaultVideoConstraints), { deviceId: { exact: mainCamera.deviceId } })];
|
|
76
|
-
}
|
|
77
|
-
_a.label = 2;
|
|
78
|
-
case 2: return [2 /*return*/, defaultVideoConstraints];
|
|
18
|
+
const getVideoConstraints = async (direction) => {
|
|
19
|
+
if (direction === 'back') {
|
|
20
|
+
const mainCamera = (await (0, utils_1.getAvailableVideoDevices)()).find(utils_1.isMainBackCamera);
|
|
21
|
+
if (mainCamera === null || mainCamera === void 0 ? void 0 : mainCamera.deviceId) {
|
|
22
|
+
return Object.assign(Object.assign({}, defaultVideoConstraints), { deviceId: { exact: mainCamera.deviceId } });
|
|
79
23
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
24
|
+
}
|
|
25
|
+
return defaultVideoConstraints;
|
|
26
|
+
};
|
|
27
|
+
return { videoConstraints };
|
|
83
28
|
};
|
|
84
29
|
exports.useVideoConstraints = useVideoConstraints;
|
|
@@ -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 CameraCapture_1 = require("./CameraCapture");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CameraCapture_1).default; } });
|
|
@@ -1,50 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
14
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
4
|
/* eslint-disable fp/no-mutation */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var svgReference = (0, react_1.useRef)(null);
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const debounce_1 = require("../../../../common/utils/debounce");
|
|
7
|
+
const captureButtonHeight = 92;
|
|
8
|
+
const reviewButtonsHeight = 120;
|
|
9
|
+
const imageHeight = 40;
|
|
10
|
+
const titleHeight = 32;
|
|
11
|
+
const instructionsHeight = 48;
|
|
12
|
+
const reviewInstructionsHeight = 40;
|
|
13
|
+
const overlayMaxWidth = 800;
|
|
14
|
+
const Overlay = ({ overlay, outline, imageUrl, title, instructions, reviewInstructions, }) => {
|
|
15
|
+
const svgReference = (0, react_1.useRef)(null);
|
|
28
16
|
/*
|
|
29
17
|
SVG doesn't always rerender when screen orientation changes,
|
|
30
18
|
so need to force rerender
|
|
31
19
|
*/
|
|
32
|
-
(0, react_1.useEffect)(
|
|
33
|
-
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
const listener = (0, debounce_1.debounce)(() => {
|
|
34
22
|
var _a;
|
|
35
23
|
if ((_a = svgReference.current) === null || _a === void 0 ? void 0 : _a.innerHTML) {
|
|
36
|
-
|
|
24
|
+
const reference = svgReference.current;
|
|
37
25
|
reference.innerHTML += '';
|
|
38
26
|
}
|
|
39
27
|
}, 100);
|
|
40
28
|
window.addEventListener('resize', listener);
|
|
41
|
-
return
|
|
29
|
+
return () => window.removeEventListener('resize', listener);
|
|
42
30
|
});
|
|
43
|
-
|
|
31
|
+
let helperBoxHeight = (imageUrl ? imageHeight : 0) +
|
|
44
32
|
(title ? titleHeight : 0) +
|
|
45
33
|
(instructions ? instructionsHeight : 0);
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
let helperBox = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [imageUrl && (0, jsx_runtime_1.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }), title && (0, jsx_runtime_1.jsx)("h4", Object.assign({ className: "camera-capture-title" }, { children: title })), instructions && (0, jsx_runtime_1.jsx)("small", Object.assign({ className: "camera-capture-instructions" }, { children: instructions }))] }));
|
|
35
|
+
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
48
36
|
/*
|
|
49
37
|
frameBottomMargin needs to stay the same for the review page so that
|
|
50
38
|
the overlay position does not change! Basically if it is the review step
|
|
@@ -54,27 +42,27 @@ var Overlay = function (_a) {
|
|
|
54
42
|
*/
|
|
55
43
|
if (reviewInstructions) {
|
|
56
44
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
57
|
-
helperBox = (0, jsx_runtime_1.jsx)("small",
|
|
58
|
-
|
|
45
|
+
helperBox = (0, jsx_runtime_1.jsx)("small", Object.assign({ className: "camera-capture-instructions" }, { children: reviewInstructions }));
|
|
46
|
+
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
59
47
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
60
48
|
helperBox = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
61
49
|
}
|
|
62
50
|
}
|
|
63
|
-
|
|
51
|
+
const framePosition = {
|
|
64
52
|
x: '50%',
|
|
65
53
|
y: '5%',
|
|
66
|
-
width:
|
|
67
|
-
height:
|
|
68
|
-
style: { transform:
|
|
54
|
+
width: `min(90%, ${overlayMaxWidth}px)`,
|
|
55
|
+
height: `calc(90% - ${frameBottomMargin}px)`,
|
|
56
|
+
style: { transform: `translateX(max(-45%, -${overlayMaxWidth / 2}px))` },
|
|
69
57
|
};
|
|
70
|
-
|
|
58
|
+
const helperBoxPosition = {
|
|
71
59
|
style: {
|
|
72
60
|
left: '5%',
|
|
73
|
-
top:
|
|
74
|
-
height:
|
|
75
|
-
width: '90%'
|
|
76
|
-
}
|
|
61
|
+
top: `calc(100% - ${frameBottomMargin}px - 5%)`,
|
|
62
|
+
height: `calc(${helperBoxHeight}px + 5%)`,
|
|
63
|
+
width: '90%',
|
|
64
|
+
},
|
|
77
65
|
};
|
|
78
|
-
return ((0, jsx_runtime_1.jsxs)("svg",
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("svg", Object.assign({ ref: svgReference, xmlns: "http://www.w3.org/2000/svg" }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", Object.assign({ id: "mask" }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }), (0, jsx_runtime_1.jsx)("image", Object.assign({ href: overlay }, framePosition))] })) }), overlay && (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }), outline && (0, jsx_runtime_1.jsx)("image", Object.assign({ href: outline }, framePosition)), (0, jsx_runtime_1.jsx)("foreignObject", Object.assign({ width: "100%", height: "100%" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "camera-capture-text-and-image-container" }, helperBoxPosition, { children: helperBox })) }))] })));
|
|
79
67
|
};
|
|
80
|
-
exports
|
|
68
|
+
exports.default = Overlay;
|
package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
|
-
exports
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
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 CameraNotSupported_messages_1 = __importDefault(require("./CameraNotSupported.messages"));
|
|
9
|
+
const CameraNotSupported = () => {
|
|
10
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ id: "camera-not-supported" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "container p-t-5" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)("h2", Object.assign({ className: "text-xs-center m-b-3" }, { children: intl.formatMessage(CameraNotSupported_messages_1.default.title) })), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "text-xs-center m-b-5" }, { children: intl.formatMessage(CameraNotSupported_messages_1.default.paragraph) }))] })) })) })) })));
|
|
23
12
|
};
|
|
24
|
-
exports
|
|
13
|
+
exports.default = CameraNotSupported;
|
|
@@ -1,15 +1,15 @@
|
|
|
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.CameraCapture.CameraNotSupported.title',
|
|
7
7
|
defaultMessage: 'Camera not supported',
|
|
8
|
-
description: 'Title of standalone page prompting that camera is not available on users browser'
|
|
8
|
+
description: 'Title of standalone page prompting that camera is not available on users browser',
|
|
9
9
|
},
|
|
10
10
|
paragraph: {
|
|
11
11
|
id: 'dynamicFlows.CameraCapture.CameraNotSupported.paragraph',
|
|
12
12
|
defaultMessage: "The browser you're using doesn't have support for a camera. Try a different browser, device, or download our mobile app.",
|
|
13
|
-
description: "Further text of standalone page prompting that camera is not available on user's browser"
|
|
14
|
-
}
|
|
13
|
+
description: "Further text of standalone page prompting that camera is not available on user's browser",
|
|
14
|
+
},
|
|
15
15
|
});
|
|
@@ -1,26 +1,14 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
|
-
exports
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)("div", __assign({ id: "no-camera-access" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "container p-t-5" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)("h2", __assign({ className: "text-xs-center m-b-3" }, { children: intl.formatMessage(NoCameraAccess_messages_1["default"].title) })), (0, jsx_runtime_1.jsx)("p", __assign({ className: "text-xs-center m-b-5" }, { children: intl.formatMessage(NoCameraAccess_messages_1["default"].paragraph) })), (0, jsx_runtime_1.jsx)(components_1.Button, __assign({ block: true, onClick: onAction }, { children: intl.formatMessage(NoCameraAccess_messages_1["default"].action) }))] })) })) })) })));
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const components_1 = require("@transferwise/components");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const NoCameraAccess_messages_1 = __importDefault(require("./NoCameraAccess.messages"));
|
|
10
|
+
const NoCameraAccess = ({ onAction }) => {
|
|
11
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ id: "no-camera-access" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "container p-t-5" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)("h2", Object.assign({ className: "text-xs-center m-b-3" }, { children: intl.formatMessage(NoCameraAccess_messages_1.default.title) })), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "text-xs-center m-b-5" }, { children: intl.formatMessage(NoCameraAccess_messages_1.default.paragraph) })), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ block: true, onClick: onAction }, { children: intl.formatMessage(NoCameraAccess_messages_1.default.action) }))] })) })) })) })));
|
|
25
13
|
};
|
|
26
|
-
exports
|
|
14
|
+
exports.default = NoCameraAccess;
|
package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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.CameraCapture.NoCameraAccess.title',
|
|
7
7
|
defaultMessage: "We can't access your camera",
|
|
8
|
-
description: 'Title of standalone page prompting missing camera permissions'
|
|
8
|
+
description: 'Title of standalone page prompting missing camera permissions',
|
|
9
9
|
},
|
|
10
10
|
paragraph: {
|
|
11
11
|
id: 'dynamicFlows.CameraCapture.NoCameraAccess.paragraph',
|
|
12
12
|
defaultMessage: "Enable camera access in your browser's settings to get going again.",
|
|
13
|
-
description: 'Further text of standalone page prompting missing camera permissions'
|
|
13
|
+
description: 'Further text of standalone page prompting missing camera permissions',
|
|
14
14
|
},
|
|
15
15
|
action: {
|
|
16
16
|
id: 'dynamicFlows.CameraCapture.NoCameraAccess.action',
|
|
17
17
|
defaultMessage: 'Enable camera access',
|
|
18
|
-
description: 'Action to ask for camera permissions again'
|
|
19
|
-
}
|
|
18
|
+
description: 'Action to ask for camera permissions again',
|
|
19
|
+
},
|
|
20
20
|
});
|
|
@@ -1,18 +1,10 @@
|
|
|
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.CameraNotSupported = exports.NoCameraAccess = void 0;
|
|
15
7
|
var NoCameraAccess_1 = require("./NoCameraAccess/NoCameraAccess");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "NoCameraAccess", { enumerable: true, get: function () { return __importDefault(NoCameraAccess_1).default; } });
|
|
17
9
|
var CameraNotSupported_1 = require("./CameraNotSupported/CameraNotSupported");
|
|
18
|
-
|
|
10
|
+
Object.defineProperty(exports, "CameraNotSupported", { enumerable: true, get: function () { return __importDefault(CameraNotSupported_1).default; } });
|
|
@@ -1,104 +1,22 @@
|
|
|
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
|
-
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
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.trackCameraNotSupported = exports.trackCameraFeedStarted = exports.trackCameraPermissionDenied = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return onEvent === null || onEvent === void 0 ? void 0 : onEvent('Dynamic Flow - Camera Permission Denied', {});
|
|
54
|
-
};
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const trackCameraPermissionDenied = (onEvent) => onEvent === null || onEvent === void 0 ? void 0 : onEvent('Dynamic Flow - Camera Permission Denied', {});
|
|
55
6
|
exports.trackCameraPermissionDenied = trackCameraPermissionDenied;
|
|
56
|
-
|
|
57
|
-
switch (_d.label) {
|
|
58
|
-
case 0:
|
|
59
|
-
if (!(onEvent === null || onEvent === void 0)) return [3 /*break*/, 1];
|
|
60
|
-
_a = void 0;
|
|
61
|
-
return [3 /*break*/, 3];
|
|
62
|
-
case 1:
|
|
63
|
-
_b = onEvent;
|
|
64
|
-
_c = ['Dynamic Flow - Camera Feed Started'];
|
|
65
|
-
return [4 /*yield*/, getCameraStartedProperties(props, stream)];
|
|
66
|
-
case 2:
|
|
67
|
-
_a = _b.apply(void 0, _c.concat([_d.sent()]));
|
|
68
|
-
_d.label = 3;
|
|
69
|
-
case 3: return [2 /*return*/, _a];
|
|
70
|
-
}
|
|
71
|
-
}); }); };
|
|
7
|
+
const trackCameraFeedStarted = async (onEvent, props, stream) => onEvent === null || onEvent === void 0 ? void 0 : onEvent('Dynamic Flow - Camera Feed Started', await getCameraStartedProperties(props, stream));
|
|
72
8
|
exports.trackCameraFeedStarted = trackCameraFeedStarted;
|
|
73
|
-
|
|
9
|
+
const trackCameraNotSupported = (onEvent, error) => onEvent === null || onEvent === void 0 ? void 0 : onEvent('Dynamic Flow - Camera Not Supported', { Error: error });
|
|
74
10
|
exports.trackCameraNotSupported = trackCameraNotSupported;
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (!_b) return [3 /*break*/, 3];
|
|
88
|
-
_e = {};
|
|
89
|
-
_c = 'Available Video Devices (by label)';
|
|
90
|
-
return [4 /*yield*/, (0, utils_1.getAvailableVideoDeviceLabels)()];
|
|
91
|
-
case 1:
|
|
92
|
-
_e[_c] = _g.sent();
|
|
93
|
-
_d = 'Active Video Device (by label)';
|
|
94
|
-
return [4 /*yield*/, (0, utils_1.getActiveVideoDeviceLabel)(videoStream)];
|
|
95
|
-
case 2:
|
|
96
|
-
_b = (_e[_d] = _g.sent(),
|
|
97
|
-
_e['Camera Capabilities'] = capabilities,
|
|
98
|
-
_e['Camera Settings'] = settings,
|
|
99
|
-
_e);
|
|
100
|
-
_g.label = 3;
|
|
101
|
-
case 3: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b)])), { 'Camera Direction (Asked)': props === null || props === void 0 ? void 0 : props.direction }])];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}); };
|
|
11
|
+
const getCameraStartedProperties = async (props, videoStream) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const videoTrack = (0, utils_1.getVideoTrack)(videoStream);
|
|
14
|
+
const capabilities = (0, utils_1.getVideoCapabilities)(videoStream);
|
|
15
|
+
const settings = (_a = videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.getSettings) === null || _a === void 0 ? void 0 : _a.call(videoTrack);
|
|
16
|
+
return Object.assign(Object.assign({}, (videoTrack && {
|
|
17
|
+
'Available Video Devices (by label)': await (0, utils_1.getAvailableVideoDeviceLabels)(),
|
|
18
|
+
'Active Video Device (by label)': await (0, utils_1.getActiveVideoDeviceLabel)(videoStream),
|
|
19
|
+
'Camera Capabilities': capabilities,
|
|
20
|
+
'Camera Settings': settings,
|
|
21
|
+
})), { 'Camera Direction (Asked)': props === null || props === void 0 ? void 0 : props.direction });
|
|
22
|
+
};
|