@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.
Files changed (233) hide show
  1. package/build/common/constants/DateMode.js +2 -2
  2. package/build/common/constants/FormControlType.js +2 -2
  3. package/build/common/constants/MonthFormat.js +2 -2
  4. package/build/common/constants/SchemaType.js +2 -2
  5. package/build/common/constants/Size.js +2 -2
  6. package/build/common/constants/index.js +1 -1
  7. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +15 -27
  8. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +11 -9
  9. package/build/common/contexts/eventsContext/EventsContext.js +11 -28
  10. package/build/common/contexts/fetcherContexts/FetcherContexts.js +14 -27
  11. package/build/common/contexts/index.js +1 -1
  12. package/build/common/contexts/logContext/LogContext.js +12 -30
  13. package/build/common/hooks/index.js +1 -1
  14. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +3 -3
  15. package/build/common/hooks/useExternal/useExternal.js +8 -8
  16. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +20 -31
  17. package/build/common/hooks/usePersistAsync/usePersistAsync.js +60 -139
  18. package/build/common/hooks/usePolling/usePolling.js +20 -21
  19. package/build/common/hooks/usePrevious/usePrevious.js +5 -5
  20. package/build/common/hooks/useStepPolling/useStepPolling.js +15 -14
  21. package/build/common/makeFetcher/index.js +1 -1
  22. package/build/common/makeFetcher/makeFetcher.js +10 -24
  23. package/build/common/messages.js +5 -5
  24. package/build/common/utils/api-utils.js +3 -4
  25. package/build/common/utils/date-utils.js +11 -11
  26. package/build/common/utils/debounce.js +11 -15
  27. package/build/common/utils/file-utils.js +12 -25
  28. package/build/common/utils/id-utils.js +4 -5
  29. package/build/common/utils/index.js +1 -1
  30. package/build/common/utils/is-equal.js +8 -8
  31. package/build/common/utils/schema-utils.js +6 -6
  32. package/build/common/utils/step-utils.js +14 -14
  33. package/build/common/validators/index.js +7 -7
  34. package/build/common/validators/models/model-validators.js +8 -8
  35. package/build/common/validators/models/models.utils.js +29 -42
  36. package/build/common/validators/schemas/schema-validators.js +11 -13
  37. package/build/common/validators/types/type-validators.js +9 -13
  38. package/build/common/validators/validationFailures/validation-failures.js +14 -14
  39. package/build/common/validators/validationFailures/validation-failures.utils.js +5 -7
  40. package/build/common/validators/values/value-validators.js +4 -6
  41. package/build/dynamicFlow/DynamicFlow.js +185 -307
  42. package/build/dynamicFlow/DynamicFlowStep.js +12 -23
  43. package/build/dynamicFlow/DynamicFlowTypes.js +1 -1
  44. package/build/dynamicFlow/index.js +6 -14
  45. package/build/dynamicFlow/stories/DynamicFlow.story.js +20 -20
  46. package/build/dynamicFlow/stories/EditableDynamicFlow.js +20 -33
  47. package/build/dynamicFlow/stories/fixtureFetcher.js +46 -104
  48. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +22 -40
  49. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +6 -6
  50. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +10 -11
  51. package/build/dynamicFlow/utils/index.js +5 -2
  52. package/build/dynamicFlow/utils/responseParsers/response-parsers.js +53 -118
  53. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +9 -9
  54. package/build/dynamicFlow/utils/useDynamicFlowState.js +51 -74
  55. package/build/dynamicFlow/utils/useLoader.js +9 -20
  56. package/build/fixtures/components/alert.js +8 -8
  57. package/build/fixtures/components/box.js +7 -7
  58. package/build/fixtures/components/button.js +25 -36
  59. package/build/fixtures/components/columns.js +10 -10
  60. package/build/fixtures/components/copyable.js +6 -6
  61. package/build/fixtures/components/decision.js +15 -15
  62. package/build/fixtures/components/heading.js +7 -7
  63. package/build/fixtures/components/image.js +10 -10
  64. package/build/fixtures/components/index.js +17 -25
  65. package/build/fixtures/components/info.js +22 -6
  66. package/build/fixtures/components/list.js +8 -8
  67. package/build/fixtures/components/loading-indicator.js +5 -5
  68. package/build/fixtures/components/paragraph.js +9 -9
  69. package/build/fixtures/components/review.js +11 -11
  70. package/build/fixtures/examples/camera-capture.js +29 -29
  71. package/build/fixtures/examples/index.js +9 -17
  72. package/build/fixtures/examples/recipient-update.js +69 -69
  73. package/build/fixtures/examples/recipient.js +63 -63
  74. package/build/fixtures/examples/single-file-upload.js +21 -21
  75. package/build/fixtures/examples/step-validation-errors.js +21 -21
  76. package/build/fixtures/features/action-response.js +8 -8
  77. package/build/fixtures/features/external.js +8 -8
  78. package/build/fixtures/features/index.js +9 -17
  79. package/build/fixtures/features/persist-async.js +11 -11
  80. package/build/fixtures/features/polling.js +9 -9
  81. package/build/fixtures/features/validation-async.js +10 -10
  82. package/build/fixtures/index.js +11 -22
  83. package/build/fixtures/jsonSchemaForm/allOf.js +30 -30
  84. package/build/fixtures/jsonSchemaForm/audRecipient.js +271 -271
  85. package/build/fixtures/jsonSchemaForm/currency.js +12 -12
  86. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +11 -11
  87. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +11 -11
  88. package/build/fixtures/jsonSchemaForm/oneOf.js +27 -27
  89. package/build/fixtures/jsonSchemaForm/oneOfTabs.js +16 -16
  90. package/build/fixtures/jsonSchemaForm/promotedOneOf.js +17 -17
  91. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +30 -30
  92. package/build/fixtures/jsonSchemaForm/simple.js +16 -16
  93. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +19 -19
  94. package/build/fixtures/jsonSchemaForm/validationAsync.js +8 -8
  95. package/build/fixtures/layouts/all.js +37 -37
  96. package/build/fixtures/layouts/final-step-layout.js +9 -9
  97. package/build/fixtures/layouts/index.js +10 -18
  98. package/build/fixtures/layouts/list.js +10 -10
  99. package/build/fixtures/layouts/pay-in.js +23 -23
  100. package/build/fixtures/layouts/review.js +38 -38
  101. package/build/fixtures/layouts/success.js +15 -15
  102. package/build/fixtures/responses/action-response-final.js +8 -8
  103. package/build/fixtures/responses/action.js +3 -3
  104. package/build/fixtures/responses/exit.js +3 -3
  105. package/build/fixtures/responses/index.js +8 -16
  106. package/build/fixtures/responses/recipient-update-final.js +8 -8
  107. package/build/fixtures/schemas/basic-form.js +11 -11
  108. package/build/fixtures/schemas/index.js +8 -16
  109. package/build/fixtures/schemas/number-and-integer.js +11 -11
  110. package/build/fixtures/schemas/one-of.js +43 -46
  111. package/build/fixtures/schemas/string-formats.js +15 -15
  112. package/build/fixtures/utils/image-util.js +8 -8
  113. package/build/formControl/FormControl.js +118 -148
  114. package/build/formControl/index.js +6 -14
  115. package/build/formControl/utils/index.js +1 -1
  116. package/build/formControl/utils/value-utils.js +18 -23
  117. package/build/i18n/index.js +31 -31
  118. package/build/index.js +13 -10
  119. package/build/jsonSchemaForm/JsonSchemaForm.js +12 -24
  120. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +24 -37
  121. package/build/jsonSchemaForm/allOfSchema/index.js +6 -14
  122. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +9 -20
  123. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +9 -20
  124. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +6 -14
  125. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +56 -115
  126. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +7 -7
  127. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +6 -14
  128. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +1 -1
  129. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +19 -71
  130. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +10 -11
  131. package/build/jsonSchemaForm/arrayTypeSchema/index.js +6 -14
  132. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +45 -62
  133. package/build/jsonSchemaForm/basicTypeSchema/index.js +6 -14
  134. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +39 -50
  135. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +18 -18
  136. package/build/jsonSchemaForm/controlFeedback/index.js +6 -14
  137. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +52 -61
  138. package/build/jsonSchemaForm/genericSchema/index.js +6 -14
  139. package/build/jsonSchemaForm/help/Help.js +9 -9
  140. package/build/jsonSchemaForm/help/Help.messages.js +5 -5
  141. package/build/jsonSchemaForm/help/index.js +6 -14
  142. package/build/jsonSchemaForm/index.js +6 -14
  143. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +28 -49
  144. package/build/jsonSchemaForm/objectSchema/index.js +6 -14
  145. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +54 -74
  146. package/build/jsonSchemaForm/oneOfSchema/index.js +6 -14
  147. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +3 -3
  148. package/build/jsonSchemaForm/oneOfSchema/utils/index.js +1 -1
  149. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +19 -20
  150. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +11 -22
  151. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +5 -5
  152. package/build/jsonSchemaForm/persistAsyncSchema/index.js +6 -14
  153. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +73 -127
  154. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +6 -14
  155. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +45 -110
  156. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +17 -17
  157. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +6 -14
  158. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +28 -47
  159. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +6 -14
  160. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +4 -4
  161. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +13 -24
  162. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +11 -22
  163. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +12 -23
  164. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +24 -26
  165. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +6 -6
  166. package/build/jsonSchemaForm/readOnlySchema/index.js +6 -14
  167. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +26 -39
  168. package/build/jsonSchemaForm/schemaFormControl/index.js +6 -14
  169. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +5 -5
  170. package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -1
  171. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +30 -47
  172. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +57 -119
  173. package/build/jsonSchemaForm/validationAsyncSchema/index.js +6 -14
  174. package/build/layout/DynamicLayout.js +10 -21
  175. package/build/layout/alert/DynamicAlert.js +9 -9
  176. package/build/layout/box/DynamicBox.js +12 -23
  177. package/build/layout/button/DynamicButton.js +16 -27
  178. package/build/layout/columns/DynamicColumns.js +13 -24
  179. package/build/layout/decision/DynamicDecision.js +16 -27
  180. package/build/layout/divider/DynamicDivider.js +7 -8
  181. package/build/layout/external/DynamicExternal.js +16 -28
  182. package/build/layout/external/DynamicExternal.messages.js +5 -5
  183. package/build/layout/form/DynamicForm.js +10 -21
  184. package/build/layout/heading/DynamicHeading.js +12 -23
  185. package/build/layout/icon/DynamicIcon.js +9 -10
  186. package/build/layout/image/DynamicImage.js +43 -93
  187. package/build/layout/index.js +21 -29
  188. package/build/layout/info/DynamicInfo.js +7 -19
  189. package/build/layout/list/DynamicList.js +14 -26
  190. package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +8 -9
  191. package/build/layout/paragraph/DynamicParagraph.js +19 -37
  192. package/build/layout/paragraph/DynamicParagraph.messages.js +6 -6
  193. package/build/layout/paragraph/useSnackBarIfAvailable.js +4 -4
  194. package/build/layout/review/DynamicReview.js +14 -26
  195. package/build/layout/utils.js +4 -6
  196. package/build/step/cameraStep/CameraStep.js +42 -88
  197. package/build/step/cameraStep/cameraCapture/CameraCapture.js +48 -105
  198. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +7 -7
  199. package/build/step/cameraStep/cameraCapture/components/index.js +10 -28
  200. package/build/step/cameraStep/cameraCapture/hooks/index.js +17 -72
  201. package/build/step/cameraStep/cameraCapture/index.js +6 -14
  202. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +33 -45
  203. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +8 -19
  204. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +6 -6
  205. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +9 -21
  206. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +7 -7
  207. package/build/step/cameraStep/cameraCapture/screens/index.js +6 -14
  208. package/build/step/cameraStep/cameraCapture/tracking/index.js +17 -99
  209. package/build/step/cameraStep/cameraCapture/utils/index.js +33 -96
  210. package/build/step/cameraStep/index.js +6 -14
  211. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +20 -21
  212. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +8 -8
  213. package/build/step/externalConfirmationStep/index.js +6 -14
  214. package/build/step/index.js +7 -15
  215. package/build/step/layoutStep/LayoutStep.js +19 -19
  216. package/build/step/layoutStep/index.js +6 -14
  217. package/build/step/layoutStep/utils/index.js +3 -14
  218. package/build/step/layoutStep/utils/inline-reference-utils.js +29 -46
  219. package/build/step/layoutStep/utils/layout-utils.js +34 -53
  220. package/build/types/common/FormControl.js +1 -1
  221. package/build/types/index.js +13 -13
  222. package/build/types/specification/Action.js +1 -1
  223. package/build/types/specification/FileUploadSchema.js +1 -1
  224. package/build/types/specification/LayoutComponent.js +1 -1
  225. package/build/types/specification/Model.js +9 -17
  226. package/build/types/specification/PersistAsync.js +1 -1
  227. package/build/types/specification/Polling.js +1 -1
  228. package/build/types/specification/Promotion.js +1 -1
  229. package/build/types/specification/Schema.js +8 -8
  230. package/build/types/specification/Step.js +3 -5
  231. package/build/types/specification/ValidationAsync.js +1 -1
  232. package/build/types/specification/core.js +1 -1
  233. package/package.json +1 -1
@@ -1,84 +1,29 @@
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
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
50
3
  exports.useVideoConstraints = void 0;
51
- var react_1 = require("react");
52
- var utils_1 = require("../utils");
53
- var useVideoConstraints = function (direction) {
54
- var _a = (0, react_1.useState)(), videoConstraints = _a[0], setVideoConstraints = _a[1];
55
- var defaultVideoConstraints = {
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)(function () {
15
+ (0, react_1.useEffect)(() => {
63
16
  void getVideoConstraints(direction).then(setVideoConstraints);
64
17
  }, [direction]);
65
- var getVideoConstraints = function (direction) { return __awaiter(void 0, void 0, void 0, function () {
66
- var mainCamera;
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
69
- case 0:
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
- return { videoConstraints: videoConstraints };
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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;
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
- __createBinding(exports, CameraCapture_1, "default");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CameraCapture_1).default; } });
@@ -1,50 +1,38 @@
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
- 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
- var react_1 = require("react");
17
- var debounce_1 = require("../../../../common/utils/debounce");
18
- var captureButtonHeight = 92;
19
- var reviewButtonsHeight = 120;
20
- var imageHeight = 40;
21
- var titleHeight = 32;
22
- var instructionsHeight = 48;
23
- var reviewInstructionsHeight = 40;
24
- var overlayMaxWidth = 800;
25
- var Overlay = function (_a) {
26
- var overlay = _a.overlay, outline = _a.outline, imageUrl = _a.imageUrl, title = _a.title, instructions = _a.instructions, reviewInstructions = _a.reviewInstructions;
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)(function () {
33
- var listener = (0, debounce_1.debounce)(function () {
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
- var reference = svgReference.current;
24
+ const reference = svgReference.current;
37
25
  reference.innerHTML += '';
38
26
  }
39
27
  }, 100);
40
28
  window.addEventListener('resize', listener);
41
- return function () { return window.removeEventListener('resize', listener); };
29
+ return () => window.removeEventListener('resize', listener);
42
30
  });
43
- var helperBoxHeight = (imageUrl ? imageHeight : 0) +
31
+ let helperBoxHeight = (imageUrl ? imageHeight : 0) +
44
32
  (title ? titleHeight : 0) +
45
33
  (instructions ? instructionsHeight : 0);
46
- var 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", __assign({ className: "camera-capture-title" }, { children: title })), instructions && (0, jsx_runtime_1.jsx)("small", __assign({ className: "camera-capture-instructions" }, { children: instructions }))] }));
47
- var frameBottomMargin = captureButtonHeight + helperBoxHeight;
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", __assign({ className: "camera-capture-instructions" }, { children: reviewInstructions }));
58
- var frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
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
- var framePosition = {
51
+ const framePosition = {
64
52
  x: '50%',
65
53
  y: '5%',
66
- width: "min(90%, ".concat(overlayMaxWidth, "px)"),
67
- height: "calc(90% - ".concat(frameBottomMargin, "px)"),
68
- style: { transform: "translateX(max(-45%, -".concat(overlayMaxWidth / 2, "px))") }
54
+ width: `min(90%, ${overlayMaxWidth}px)`,
55
+ height: `calc(90% - ${frameBottomMargin}px)`,
56
+ style: { transform: `translateX(max(-45%, -${overlayMaxWidth / 2}px))` },
69
57
  };
70
- var helperBoxPosition = {
58
+ const helperBoxPosition = {
71
59
  style: {
72
60
  left: '5%',
73
- top: "calc(100% - ".concat(frameBottomMargin, "px - 5%)"),
74
- height: "calc(".concat(helperBoxHeight, "px + 5%)"),
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", __assign({ ref: svgReference, xmlns: "http://www.w3.org/2000/svg" }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", __assign({ id: "mask" }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }), (0, jsx_runtime_1.jsx)("image", __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", __assign({ href: outline }, framePosition)), (0, jsx_runtime_1.jsx)("foreignObject", __assign({ width: "100%", height: "100%" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "camera-capture-text-and-image-container" }, helperBoxPosition, { children: helperBox })) }))] })));
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["default"] = Overlay;
68
+ exports.default = Overlay;
@@ -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.__esModule = true;
17
- var jsx_runtime_1 = require("react/jsx-runtime");
18
- var react_intl_1 = require("react-intl");
19
- var CameraNotSupported_messages_1 = __importDefault(require("./CameraNotSupported.messages"));
20
- var CameraNotSupported = function () {
21
- var intl = (0, react_intl_1.useIntl)();
22
- return ((0, jsx_runtime_1.jsx)("div", __assign({ id: "camera-not-supported" }, { 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(CameraNotSupported_messages_1["default"].title) })), (0, jsx_runtime_1.jsx)("p", __assign({ className: "text-xs-center m-b-5" }, { children: intl.formatMessage(CameraNotSupported_messages_1["default"].paragraph) }))] })) })) })) })));
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["default"] = CameraNotSupported;
13
+ exports.default = CameraNotSupported;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
- exports.__esModule = true;
3
- var react_intl_1 = require("react-intl");
4
- exports["default"] = (0, react_intl_1.defineMessages)({
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.__esModule = true;
17
- var jsx_runtime_1 = require("react/jsx-runtime");
18
- var components_1 = require("@transferwise/components");
19
- var react_intl_1 = require("react-intl");
20
- var NoCameraAccess_messages_1 = __importDefault(require("./NoCameraAccess.messages"));
21
- var NoCameraAccess = function (_a) {
22
- var onAction = _a.onAction;
23
- var intl = (0, react_intl_1.useIntl)();
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["default"] = NoCameraAccess;
14
+ exports.default = NoCameraAccess;
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
- exports.__esModule = true;
3
- var react_intl_1 = require("react-intl");
4
- exports["default"] = (0, react_intl_1.defineMessages)({
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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
+ 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
- __createBinding(exports, NoCameraAccess_1, "default", "NoCameraAccess");
8
+ Object.defineProperty(exports, "NoCameraAccess", { enumerable: true, get: function () { return __importDefault(NoCameraAccess_1).default; } });
17
9
  var CameraNotSupported_1 = require("./CameraNotSupported/CameraNotSupported");
18
- __createBinding(exports, CameraNotSupported_1, "default", "CameraNotSupported");
10
+ Object.defineProperty(exports, "CameraNotSupported", { enumerable: true, get: function () { return __importDefault(CameraNotSupported_1).default; } });
@@ -1,104 +1,22 @@
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
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
50
3
  exports.trackCameraNotSupported = exports.trackCameraFeedStarted = exports.trackCameraPermissionDenied = void 0;
51
- var utils_1 = require("../utils");
52
- var trackCameraPermissionDenied = function (onEvent) {
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
- var trackCameraFeedStarted = function (onEvent, props, stream) { return __awaiter(void 0, void 0, void 0, function () { var _a, _b, _c; return __generator(this, function (_d) {
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
- var trackCameraNotSupported = function (onEvent, error) { return onEvent === null || onEvent === void 0 ? void 0 : onEvent('Dynamic Flow - Camera Not Supported', { Error: error }); };
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
- var getCameraStartedProperties = function (props, videoStream) { return __awaiter(void 0, void 0, void 0, function () {
76
- var videoTrack, capabilities, settings, _a, _b, _c, _d;
77
- var _e;
78
- var _f;
79
- return __generator(this, function (_g) {
80
- switch (_g.label) {
81
- case 0:
82
- videoTrack = (0, utils_1.getVideoTrack)(videoStream);
83
- capabilities = (0, utils_1.getVideoCapabilities)(videoStream);
84
- settings = (_f = videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.getSettings) === null || _f === void 0 ? void 0 : _f.call(videoTrack);
85
- _a = [{}];
86
- _b = videoTrack;
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
+ };