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