@wise/dynamic-flow-client 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.js CHANGED
@@ -270,437 +270,6 @@ var init_index_d9418379_esm = __esm({
270
270
  }
271
271
  });
272
272
 
273
- // ../../node_modules/.pnpm/react-webcam@7.2.0_react-dom@18.2.0_react@18.2.0/node_modules/react-webcam/dist/react-webcam.js
274
- var require_react_webcam = __commonJS({
275
- "../../node_modules/.pnpm/react-webcam@7.2.0_react-dom@18.2.0_react@18.2.0/node_modules/react-webcam/dist/react-webcam.js"(exports, module2) {
276
- "use strict";
277
- (function webpackUniversalModuleDefinition(root, factory) {
278
- if (typeof exports === "object" && typeof module2 === "object")
279
- module2.exports = factory(require("react"));
280
- else if (typeof define === "function" && define.amd)
281
- define(["react"], factory);
282
- else if (typeof exports === "object")
283
- exports["Webcam"] = factory(require("react"));
284
- else
285
- root["Webcam"] = factory(root["React"]);
286
- })(exports, function(__WEBPACK_EXTERNAL_MODULE_react__) {
287
- return (
288
- /******/
289
- function(modules) {
290
- var installedModules = {};
291
- function __webpack_require__(moduleId) {
292
- if (installedModules[moduleId]) {
293
- return installedModules[moduleId].exports;
294
- }
295
- var module3 = installedModules[moduleId] = {
296
- /******/
297
- i: moduleId,
298
- /******/
299
- l: false,
300
- /******/
301
- exports: {}
302
- /******/
303
- };
304
- modules[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
305
- module3.l = true;
306
- return module3.exports;
307
- }
308
- __webpack_require__.m = modules;
309
- __webpack_require__.c = installedModules;
310
- __webpack_require__.d = function(exports2, name, getter) {
311
- if (!__webpack_require__.o(exports2, name)) {
312
- Object.defineProperty(exports2, name, { enumerable: true, get: getter });
313
- }
314
- };
315
- __webpack_require__.r = function(exports2) {
316
- if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
317
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
318
- }
319
- Object.defineProperty(exports2, "__esModule", { value: true });
320
- };
321
- __webpack_require__.t = function(value, mode) {
322
- if (mode & 1)
323
- value = __webpack_require__(value);
324
- if (mode & 8)
325
- return value;
326
- if (mode & 4 && typeof value === "object" && value && value.__esModule)
327
- return value;
328
- var ns = /* @__PURE__ */ Object.create(null);
329
- __webpack_require__.r(ns);
330
- Object.defineProperty(ns, "default", { enumerable: true, value });
331
- if (mode & 2 && typeof value != "string")
332
- for (var key in value)
333
- __webpack_require__.d(ns, key, function(key2) {
334
- return value[key2];
335
- }.bind(null, key));
336
- return ns;
337
- };
338
- __webpack_require__.n = function(module3) {
339
- var getter = module3 && module3.__esModule ? (
340
- /******/
341
- function getDefault() {
342
- return module3["default"];
343
- }
344
- ) : (
345
- /******/
346
- function getModuleExports() {
347
- return module3;
348
- }
349
- );
350
- __webpack_require__.d(getter, "a", getter);
351
- return getter;
352
- };
353
- __webpack_require__.o = function(object, property) {
354
- return Object.prototype.hasOwnProperty.call(object, property);
355
- };
356
- __webpack_require__.p = "";
357
- return __webpack_require__(__webpack_require__.s = "./src/react-webcam.tsx");
358
- }({
359
- /***/
360
- "./src/react-webcam.tsx": (
361
- /*!******************************!*\
362
- !*** ./src/react-webcam.tsx ***!
363
- \******************************/
364
- /*! exports provided: default */
365
- /***/
366
- function(module3, __webpack_exports__, __webpack_require__) {
367
- "use strict";
368
- __webpack_require__.r(__webpack_exports__);
369
- var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
370
- /*! react */
371
- "react"
372
- );
373
- var react__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
374
- var __extends = /* @__PURE__ */ function() {
375
- var extendStatics = function(d, b) {
376
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
377
- d2.__proto__ = b2;
378
- } || function(d2, b2) {
379
- for (var p in b2)
380
- if (b2.hasOwnProperty(p))
381
- d2[p] = b2[p];
382
- };
383
- return extendStatics(d, b);
384
- };
385
- return function(d, b) {
386
- extendStatics(d, b);
387
- function __() {
388
- this.constructor = d;
389
- }
390
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
391
- };
392
- }();
393
- var __assign = function() {
394
- __assign = Object.assign || function(t) {
395
- for (var s, i = 1, n = arguments.length; i < n; i++) {
396
- s = arguments[i];
397
- for (var p in s)
398
- if (Object.prototype.hasOwnProperty.call(s, p))
399
- t[p] = s[p];
400
- }
401
- return t;
402
- };
403
- return __assign.apply(this, arguments);
404
- };
405
- var __rest = function(s, e) {
406
- var t = {};
407
- for (var p in s)
408
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
409
- t[p] = s[p];
410
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
411
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
412
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
413
- t[p[i]] = s[p[i]];
414
- }
415
- return t;
416
- };
417
- (function polyfillGetUserMedia() {
418
- if (typeof window === "undefined") {
419
- return;
420
- }
421
- if (navigator.mediaDevices === void 0) {
422
- navigator.mediaDevices = {};
423
- }
424
- if (navigator.mediaDevices.getUserMedia === void 0) {
425
- navigator.mediaDevices.getUserMedia = function(constraints) {
426
- var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
427
- if (!getUserMedia) {
428
- return Promise.reject(new Error("getUserMedia is not implemented in this browser"));
429
- }
430
- return new Promise(function(resolve, reject) {
431
- getUserMedia.call(navigator, constraints, resolve, reject);
432
- });
433
- };
434
- }
435
- })();
436
- function hasGetUserMedia() {
437
- return !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia);
438
- }
439
- var Webcam2 = (
440
- /** @class */
441
- function(_super) {
442
- __extends(Webcam3, _super);
443
- function Webcam3(props) {
444
- var _this = _super.call(this, props) || this;
445
- _this.canvas = null;
446
- _this.ctx = null;
447
- _this.requestUserMediaId = 0;
448
- _this.unmounted = false;
449
- _this.state = {
450
- hasUserMedia: false
451
- };
452
- return _this;
453
- }
454
- Webcam3.prototype.componentDidMount = function() {
455
- var _a = this, state = _a.state, props = _a.props;
456
- this.unmounted = false;
457
- if (!hasGetUserMedia()) {
458
- props.onUserMediaError("getUserMedia not supported");
459
- return;
460
- }
461
- if (!state.hasUserMedia) {
462
- this.requestUserMedia();
463
- }
464
- if (props.children && typeof props.children != "function") {
465
- console.warn("children must be a function");
466
- }
467
- };
468
- Webcam3.prototype.componentDidUpdate = function(nextProps) {
469
- var props = this.props;
470
- if (!hasGetUserMedia()) {
471
- props.onUserMediaError("getUserMedia not supported");
472
- return;
473
- }
474
- var audioConstraintsChanged = JSON.stringify(nextProps.audioConstraints) !== JSON.stringify(props.audioConstraints);
475
- var videoConstraintsChanged = JSON.stringify(nextProps.videoConstraints) !== JSON.stringify(props.videoConstraints);
476
- var minScreenshotWidthChanged = nextProps.minScreenshotWidth !== props.minScreenshotWidth;
477
- var minScreenshotHeightChanged = nextProps.minScreenshotHeight !== props.minScreenshotHeight;
478
- if (videoConstraintsChanged || minScreenshotWidthChanged || minScreenshotHeightChanged) {
479
- this.canvas = null;
480
- this.ctx = null;
481
- }
482
- if (audioConstraintsChanged || videoConstraintsChanged) {
483
- this.stopAndCleanup();
484
- this.requestUserMedia();
485
- }
486
- };
487
- Webcam3.prototype.componentWillUnmount = function() {
488
- this.unmounted = true;
489
- this.stopAndCleanup();
490
- };
491
- Webcam3.stopMediaStream = function(stream) {
492
- if (stream) {
493
- if (stream.getVideoTracks && stream.getAudioTracks) {
494
- stream.getVideoTracks().map(function(track) {
495
- stream.removeTrack(track);
496
- track.stop();
497
- });
498
- stream.getAudioTracks().map(function(track) {
499
- stream.removeTrack(track);
500
- track.stop();
501
- });
502
- } else {
503
- stream.stop();
504
- }
505
- }
506
- };
507
- Webcam3.prototype.stopAndCleanup = function() {
508
- var state = this.state;
509
- if (state.hasUserMedia) {
510
- Webcam3.stopMediaStream(this.stream);
511
- if (state.src) {
512
- window.URL.revokeObjectURL(state.src);
513
- }
514
- }
515
- };
516
- Webcam3.prototype.getScreenshot = function(screenshotDimensions) {
517
- var _a = this, state = _a.state, props = _a.props;
518
- if (!state.hasUserMedia)
519
- return null;
520
- var canvas = this.getCanvas(screenshotDimensions);
521
- return canvas && canvas.toDataURL(props.screenshotFormat, props.screenshotQuality);
522
- };
523
- Webcam3.prototype.getCanvas = function(screenshotDimensions) {
524
- var _a = this, state = _a.state, props = _a.props;
525
- if (!this.video) {
526
- return null;
527
- }
528
- if (!state.hasUserMedia || !this.video.videoHeight)
529
- return null;
530
- if (!this.ctx) {
531
- var canvasWidth = this.video.videoWidth;
532
- var canvasHeight = this.video.videoHeight;
533
- if (!this.props.forceScreenshotSourceSize) {
534
- var aspectRatio = canvasWidth / canvasHeight;
535
- canvasWidth = props.minScreenshotWidth || this.video.clientWidth;
536
- canvasHeight = canvasWidth / aspectRatio;
537
- if (props.minScreenshotHeight && canvasHeight < props.minScreenshotHeight) {
538
- canvasHeight = props.minScreenshotHeight;
539
- canvasWidth = canvasHeight * aspectRatio;
540
- }
541
- }
542
- this.canvas = document.createElement("canvas");
543
- this.canvas.width = (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.width) || canvasWidth;
544
- this.canvas.height = (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.height) || canvasHeight;
545
- this.ctx = this.canvas.getContext("2d");
546
- }
547
- var _b = this, ctx = _b.ctx, canvas = _b.canvas;
548
- if (ctx && canvas) {
549
- canvas.width = (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.width) || canvas.width;
550
- canvas.height = (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.height) || canvas.height;
551
- if (props.mirrored) {
552
- ctx.translate(canvas.width, 0);
553
- ctx.scale(-1, 1);
554
- }
555
- ctx.imageSmoothingEnabled = props.imageSmoothing;
556
- ctx.drawImage(this.video, 0, 0, (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.width) || canvas.width, (screenshotDimensions === null || screenshotDimensions === void 0 ? void 0 : screenshotDimensions.height) || canvas.height);
557
- if (props.mirrored) {
558
- ctx.scale(-1, 1);
559
- ctx.translate(-canvas.width, 0);
560
- }
561
- }
562
- return canvas;
563
- };
564
- Webcam3.prototype.requestUserMedia = function() {
565
- var _this = this;
566
- var props = this.props;
567
- var sourceSelected = function(audioConstraints, videoConstraints) {
568
- var constraints = {
569
- video: typeof videoConstraints !== "undefined" ? videoConstraints : true
570
- };
571
- if (props.audio) {
572
- constraints.audio = typeof audioConstraints !== "undefined" ? audioConstraints : true;
573
- }
574
- _this.requestUserMediaId++;
575
- var myRequestUserMediaId = _this.requestUserMediaId;
576
- navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
577
- if (_this.unmounted || myRequestUserMediaId !== _this.requestUserMediaId) {
578
- Webcam3.stopMediaStream(stream);
579
- } else {
580
- _this.handleUserMedia(null, stream);
581
- }
582
- }).catch(function(e) {
583
- _this.handleUserMedia(e);
584
- });
585
- };
586
- if ("mediaDevices" in navigator) {
587
- sourceSelected(props.audioConstraints, props.videoConstraints);
588
- } else {
589
- var optionalSource_1 = function(id) {
590
- return { optional: [{ sourceId: id }] };
591
- };
592
- var constraintToSourceId_1 = function(constraint) {
593
- var deviceId = constraint.deviceId;
594
- if (typeof deviceId === "string") {
595
- return deviceId;
596
- }
597
- if (Array.isArray(deviceId) && deviceId.length > 0) {
598
- return deviceId[0];
599
- }
600
- if (typeof deviceId === "object" && deviceId.ideal) {
601
- return deviceId.ideal;
602
- }
603
- return null;
604
- };
605
- MediaStreamTrack.getSources(function(sources) {
606
- var audioSource = null;
607
- var videoSource = null;
608
- sources.forEach(function(source) {
609
- if (source.kind === "audio") {
610
- audioSource = source.id;
611
- } else if (source.kind === "video") {
612
- videoSource = source.id;
613
- }
614
- });
615
- var audioSourceId = constraintToSourceId_1(props.audioConstraints);
616
- if (audioSourceId) {
617
- audioSource = audioSourceId;
618
- }
619
- var videoSourceId = constraintToSourceId_1(props.videoConstraints);
620
- if (videoSourceId) {
621
- videoSource = videoSourceId;
622
- }
623
- sourceSelected(optionalSource_1(audioSource), optionalSource_1(videoSource));
624
- });
625
- }
626
- };
627
- Webcam3.prototype.handleUserMedia = function(err, stream) {
628
- var props = this.props;
629
- if (err || !stream) {
630
- this.setState({ hasUserMedia: false });
631
- props.onUserMediaError(err);
632
- return;
633
- }
634
- this.stream = stream;
635
- try {
636
- if (this.video) {
637
- this.video.srcObject = stream;
638
- }
639
- this.setState({ hasUserMedia: true });
640
- } catch (error) {
641
- this.setState({
642
- hasUserMedia: true,
643
- src: window.URL.createObjectURL(stream)
644
- });
645
- }
646
- props.onUserMedia(stream);
647
- };
648
- Webcam3.prototype.render = function() {
649
- var _this = this;
650
- var _a = this, state = _a.state, props = _a.props;
651
- var audio = props.audio, forceScreenshotSourceSize = props.forceScreenshotSourceSize, disablePictureInPicture = props.disablePictureInPicture, onUserMedia = props.onUserMedia, onUserMediaError = props.onUserMediaError, screenshotFormat = props.screenshotFormat, screenshotQuality = props.screenshotQuality, minScreenshotWidth = props.minScreenshotWidth, minScreenshotHeight = props.minScreenshotHeight, audioConstraints = props.audioConstraints, videoConstraints = props.videoConstraints, imageSmoothing = props.imageSmoothing, mirrored = props.mirrored, _b = props.style, style = _b === void 0 ? {} : _b, children = props.children, rest = __rest(props, ["audio", "forceScreenshotSourceSize", "disablePictureInPicture", "onUserMedia", "onUserMediaError", "screenshotFormat", "screenshotQuality", "minScreenshotWidth", "minScreenshotHeight", "audioConstraints", "videoConstraints", "imageSmoothing", "mirrored", "style", "children"]);
652
- var videoStyle = mirrored ? __assign(__assign({}, style), { transform: (style.transform || "") + " scaleX(-1)" }) : style;
653
- var childrenProps = {
654
- getScreenshot: this.getScreenshot.bind(this)
655
- };
656
- return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](
657
- react__WEBPACK_IMPORTED_MODULE_0__["Fragment"],
658
- null,
659
- react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("video", __assign({ autoPlay: true, disablePictureInPicture, src: state.src, muted: !audio, playsInline: true, ref: function(ref) {
660
- _this.video = ref;
661
- }, style: videoStyle }, rest)),
662
- children && children(childrenProps)
663
- );
664
- };
665
- Webcam3.defaultProps = {
666
- audio: false,
667
- disablePictureInPicture: false,
668
- forceScreenshotSourceSize: false,
669
- imageSmoothing: true,
670
- mirrored: false,
671
- onUserMedia: function() {
672
- return void 0;
673
- },
674
- onUserMediaError: function() {
675
- return void 0;
676
- },
677
- screenshotFormat: "image/webp",
678
- screenshotQuality: 0.92
679
- };
680
- return Webcam3;
681
- }(react__WEBPACK_IMPORTED_MODULE_0__["Component"])
682
- );
683
- __webpack_exports__["default"] = Webcam2;
684
- }
685
- ),
686
- /***/
687
- "react": (
688
- /*!**************************************************************************************!*\
689
- !*** external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} ***!
690
- \**************************************************************************************/
691
- /*! no static exports found */
692
- /***/
693
- function(module3, exports2) {
694
- module3.exports = __WEBPACK_EXTERNAL_MODULE_react__;
695
- }
696
- )
697
- /******/
698
- })["default"]
699
- );
700
- });
701
- }
702
- });
703
-
704
273
  // ../../node_modules/.pnpm/screenfull@5.2.0/node_modules/screenfull/dist/screenfull.js
705
274
  var require_screenfull = __commonJS({
706
275
  "../../node_modules/.pnpm/screenfull@5.2.0/node_modules/screenfull/dist/screenfull.js"(exports, module2) {
@@ -6428,7 +5997,7 @@ var import_react42 = require("react");
6428
5997
  // src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
6429
5998
  var import_react41 = require("react");
6430
5999
  var import_react_intl26 = require("react-intl");
6431
- var import_react_webcam = __toESM(require_react_webcam());
6000
+ var import_react_webcam = __toESM(require("react-webcam"));
6432
6001
 
6433
6002
  // src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
6434
6003
  var import_react_intl22 = require("react-intl");