@bigbinary/neeto-media-recorder 2.7.46 → 2.7.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-media-recorder",
3
- "version": "2.7.46",
3
+ "version": "2.7.48",
4
4
  "description": "A package to simplify the media capturing process",
5
5
  "repository": "git@github.com:bigbinary/neeto-media-recorder.git",
6
6
  "license": "MIT",
package/v2/index.js CHANGED
@@ -3,7 +3,7 @@ import { useState, useRef, useCallback, useEffect, forwardRef, useImperativeHand
3
3
  import { Toastr, Typography, Spinner, Callout, Button, Progress, Alert } from '@bigbinary/neeto-atoms';
4
4
  import { useMutation, isCancelledError } from '@tanstack/react-query';
5
5
  import { noop } from '@bigbinary/neeto-cist';
6
- import { ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, SCREEN_RECORDER_STATUS, UPLOAD_STATUS as UPLOAD_STATUS$1, MIME_TYPE as MIME_TYPE$1, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, IS_EXTENSION as IS_EXTENSION$1, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, COUNTDOWN_TIME, MIC_NOT_WORKING_SILENCE_TIMEOUT, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
6
+ import { ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, SCREEN_RECORDER_STATUS, UPLOAD_STATUS as UPLOAD_STATUS$1, MIME_TYPE as MIME_TYPE$1, IS_EXTENSION as IS_EXTENSION$1, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, COUNTDOWN_TIME, MIC_NOT_WORKING_SILENCE_TIMEOUT, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
7
7
  import { screenRecorder, useMultipartS3UploadStatus, getMultipartS3Uploader } from '@bigbinary/neeto-media-recorder/core';
8
8
  import PageLoader from '@bigbinary/neeto-molecules/v2/PageLoader';
9
9
  import { Trans, useTranslation } from 'react-i18next';
@@ -945,7 +945,16 @@ var copyRecordingLinkToClipboardOnStop = function copyRecordingLinkToClipboardOn
945
945
  return _ref4.apply(this, arguments);
946
946
  };
947
947
  }();
948
- if (typeof window.ClipboardItem === "function" && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.write) {
948
+
949
+ // The gesture-preserving ClipboardItem path only works when this runs
950
+ // synchronously inside a user gesture in the focused recorder document.
951
+ // In the Chrome extension the recorder lives in a background options page
952
+ // and "stop" arrives via chrome.runtime.onMessage (from the toolbar content
953
+ // script / shortcut), so there is no transient user activation to preserve —
954
+ // navigator.clipboard.write always rejects there. Route the extension to the
955
+ // deferred copyToClipboard fallback instead, which succeeds in the focused
956
+ // options page (writeText, with a document.execCommand fallback).
957
+ if (!IS_EXTENSION$1 && typeof window.ClipboardItem === "function" && (_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.write) {
949
958
  var linkBlobPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
950
959
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
951
960
  while (1) switch (_context3.prev = _context3.next) {
@@ -995,10 +1004,11 @@ var copyRecordingLinkToClipboardOnStop = function copyRecordingLinkToClipboardOn
995
1004
  return;
996
1005
  }
997
1006
 
998
- // Legacy fallback for browsers without ClipboardItem (e.g. Firefox < 127).
999
- // These browsers don't enforce Safari's strict gesture requirement, so a
1000
- // deferred async write is acceptable. copyToClipboard handles its own
1001
- // success toastr and falls back to document.execCommand internally.
1007
+ // Deferred fallback for the Chrome extension and for browsers without
1008
+ // ClipboardItem (e.g. Firefox < 127). Neither enforces Safari's strict
1009
+ // gesture requirement, so a deferred async write is acceptable.
1010
+ // copyToClipboard handles its own success toastr and falls back to
1011
+ // document.execCommand internally.
1002
1012
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
1003
1013
  var link;
1004
1014
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -1215,24 +1225,9 @@ var DesktopAppCallout = function DesktopAppCallout() {
1215
1225
  });
1216
1226
  };
1217
1227
 
1218
- var RequestRecordingCallout = function RequestRecordingCallout(_ref) {
1219
- var _ref$requestedUser = _ref.requestedUser,
1220
- requestedUser = _ref$requestedUser === void 0 ? "" : _ref$requestedUser;
1221
- return /*#__PURE__*/jsx(Callout, {
1222
- className: "mb-6 text-center",
1223
- variant: "info",
1224
- children: /*#__PURE__*/jsxs(Typography, {
1225
- as: "span",
1226
- variant: "h6",
1227
- children: [requestedUser, " is asking you to send a screen recording."]
1228
- })
1229
- });
1230
- };
1231
-
1232
1228
  var Callouts = withT(function (_ref) {
1233
1229
  var t = _ref.t,
1234
1230
  requested = _ref.requested,
1235
- requestedUser = _ref.requestedUser,
1236
1231
  error = _ref.error,
1237
1232
  appName = _ref.appName,
1238
1233
  isRecorderStatus = _ref.isRecorderStatus,
@@ -1240,9 +1235,7 @@ var Callouts = withT(function (_ref) {
1240
1235
  shouldShowTimeLimitWarning = _ref.shouldShowTimeLimitWarning,
1241
1236
  elapsedTime = _ref.elapsedTime;
1242
1237
  return /*#__PURE__*/jsxs(Fragment, {
1243
- children: [requested ? /*#__PURE__*/jsx(RequestRecordingCallout, {
1244
- requestedUser: requestedUser
1245
- }) : /*#__PURE__*/jsx(DesktopAppCallout, {}), error === SCREEN_RECORDER_ERROR.InsufficientData && /*#__PURE__*/jsx(Callout, {
1238
+ children: [!requested && /*#__PURE__*/jsx(DesktopAppCallout, {}), error === SCREEN_RECORDER_ERROR.InsufficientData && /*#__PURE__*/jsx(Callout, {
1246
1239
  className: "mb-2 p-3",
1247
1240
  "data-testid": "recorder-insufficient-data-error-callout",
1248
1241
  variant: "danger",
@@ -2409,8 +2402,24 @@ var MediaRecorder$1 = function MediaRecorder(_ref, ref) {
2409
2402
  case 8:
2410
2403
  createRecordingPromise.current = null;
2411
2404
  case 9:
2405
+ // On the web the link is copied by handleStopRecording (the Controls
2406
+ // Stop button's onClick). In the extension the recorder runs in the
2407
+ // background options page and "stop" arrives via an external
2408
+ // screenRecorder.stopRecording() (relayed from the toolbar/shortcut),
2409
+ // so that button — and its copy — never fires. Trigger the copy here
2410
+ // on the stop event instead. copyRecordingLinkToClipboardOnStop routes
2411
+ // the extension to its deferred fallback (no user gesture to drive
2412
+ // navigator.clipboard.write).
2413
+ if (IS_EXTENSION) {
2414
+ copyRecordingLinkToClipboardOnStop({
2415
+ createRecordingPromise: createRecordingPromise,
2416
+ recordingRef: recordingRef,
2417
+ baseURLRef: baseURLRef,
2418
+ successMessage: t("neetoMediaRecorder.record.copyToClipboardToastrMessage")
2419
+ });
2420
+ }
2412
2421
  multipartS3Uploader.completeUpload();
2413
- case 10:
2422
+ case 11:
2414
2423
  case "end":
2415
2424
  return _context4.stop();
2416
2425
  }