box-content-preview 3.107.0 → 3.109.0
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/README.md +7 -7
- package/dist/lib/index.css +38 -38
- package/dist/lib/index.js +157 -12
- package/package.json +9 -9
package/dist/lib/index.js
CHANGED
|
@@ -374,6 +374,7 @@ class PreviewError extends Error {
|
|
|
374
374
|
/* harmony export */ cR: () => (/* binding */ TEXT_STATIC_ASSETS_VERSION),
|
|
375
375
|
/* harmony export */ cZ: () => (/* binding */ CLASS_ANNOTATIONS_DISCOVERABLE),
|
|
376
376
|
/* harmony export */ dR: () => (/* binding */ BLUEPRINT_MIGRATION_MEDIA_CONTROLS),
|
|
377
|
+
/* harmony export */ dl: () => (/* binding */ AUDIO_PLAYER_V2_RESIN_FEATURE),
|
|
377
378
|
/* harmony export */ eA: () => (/* binding */ SUBTITLES_OFF),
|
|
378
379
|
/* harmony export */ eF: () => (/* binding */ CLASS_BOX_PREVIEW_PRELOAD_CONTENT),
|
|
379
380
|
/* harmony export */ eM: () => (/* binding */ CLASS_BOX_PREVIEW_HAS_NAVIGATION),
|
|
@@ -532,6 +533,7 @@ const X_REP_HINT_VIDEO_MP4 = '[mp4]';
|
|
|
532
533
|
const X_REP_HINT_WAVEFORM = '[waveform]';
|
|
533
534
|
const AI_TRANSCRIPTION_FOR_VIDEO_SUBTITLES = 'aiTranscriptionForVideoSubtitles';
|
|
534
535
|
const AUDIO_PLAYER_V2 = 'audioPlayerV2.enabled';
|
|
536
|
+
const AUDIO_PLAYER_V2_RESIN_FEATURE = 'audioPlayerV2';
|
|
535
537
|
|
|
536
538
|
// One per wave of the Blueprint migration. Each is reported as its own metric dimension so a
|
|
537
539
|
// dashboard can compare a wave's timings with its flag on against the same wave with it off.
|
|
@@ -1032,7 +1034,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1032
1034
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
1033
1035
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
1034
1036
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
1035
|
-
const CLIENT_VERSION = "3.
|
|
1037
|
+
const CLIENT_VERSION = "3.109.0"; // eslint-disable-line no-undef
|
|
1036
1038
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
1037
1039
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
1038
1040
|
const PROMISE_MAP = {};
|
|
@@ -5791,6 +5793,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
5791
5793
|
onPreviewChange,
|
|
5792
5794
|
onRangeChange,
|
|
5793
5795
|
onRangeClear,
|
|
5796
|
+
onResinAction,
|
|
5794
5797
|
range,
|
|
5795
5798
|
readOnly = false,
|
|
5796
5799
|
viewport
|
|
@@ -5963,6 +5966,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
5963
5966
|
}
|
|
5964
5967
|
event.preventDefault();
|
|
5965
5968
|
event.stopPropagation();
|
|
5969
|
+
onResinAction?.('waveformRangeResize');
|
|
5966
5970
|
const resolved = (0,waveform_range/* resolveRange */.Ss)(rangeRef.current, (0,waveform_range/* durationMsFromSec */.uH)(durationSecRef.current));
|
|
5967
5971
|
dragRef.current = {
|
|
5968
5972
|
handle,
|
|
@@ -5984,7 +5988,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
5984
5988
|
endMs: (0,waveform_range/* isRangeCollapsed */.BT)(rangeRef.current) ? null : resolved.endMs,
|
|
5985
5989
|
startMs: resolved.startMs
|
|
5986
5990
|
});
|
|
5987
|
-
}, [interactive, readOnly]);
|
|
5991
|
+
}, [interactive, onResinAction, readOnly]);
|
|
5988
5992
|
const onHandlePointerDown = (0,external_react_.useCallback)(event => {
|
|
5989
5993
|
const root = rootRef.current;
|
|
5990
5994
|
if (!root) {
|
|
@@ -6058,6 +6062,8 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6058
6062
|
ref: commentButtonRef,
|
|
6059
6063
|
"aria-label": "Clear",
|
|
6060
6064
|
className: "bp-WaveformRange-comment bp-WaveformRange-comment--clearOnly",
|
|
6065
|
+
"data-resin-target": "waveformRangeClear",
|
|
6066
|
+
"data-target-id": "Waveform-clearRange",
|
|
6061
6067
|
"data-testid": "bp-waveform-range-clear",
|
|
6062
6068
|
onClick: event => {
|
|
6063
6069
|
stopRangeEvent(event);
|
|
@@ -6075,6 +6081,8 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6075
6081
|
const commentAction = /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
6076
6082
|
ref: showClearControl ? undefined : commentButtonRef,
|
|
6077
6083
|
className: showClearControl ? 'bp-WaveformRange-commentLabel' : 'bp-WaveformRange-comment',
|
|
6084
|
+
"data-resin-target": "waveformRangeComment",
|
|
6085
|
+
"data-target-id": "Waveform-commentOnRange",
|
|
6078
6086
|
"data-testid": "bp-waveform-range-comment",
|
|
6079
6087
|
onClick: event => {
|
|
6080
6088
|
stopRangeEvent(event);
|
|
@@ -6096,6 +6104,8 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6096
6104
|
}), /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
6097
6105
|
"aria-label": "Clear",
|
|
6098
6106
|
className: "bp-WaveformRange-commentClear",
|
|
6107
|
+
"data-resin-target": "waveformRangeClear",
|
|
6108
|
+
"data-target-id": "Waveform-clearRange",
|
|
6099
6109
|
"data-testid": "bp-waveform-range-clear",
|
|
6100
6110
|
onClick: event => {
|
|
6101
6111
|
stopRangeEvent(event);
|
|
@@ -6130,6 +6140,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6130
6140
|
className: classnames_default()('bp-WaveformRange-handle', 'bp-WaveformRange-handle--start', {
|
|
6131
6141
|
'bp-WaveformRange-handle--dragging': activeHandle === 'start'
|
|
6132
6142
|
}),
|
|
6143
|
+
"data-target-id": "Waveform-resizeRangeStart",
|
|
6133
6144
|
"data-testid": "bp-waveform-range-handle-start",
|
|
6134
6145
|
onMouseMove: event => event.stopPropagation(),
|
|
6135
6146
|
onPointerDown: onHandlePointerDown
|
|
@@ -6140,6 +6151,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6140
6151
|
className: classnames_default()('bp-WaveformRange-handle', 'bp-WaveformRange-handle--end', {
|
|
6141
6152
|
'bp-WaveformRange-handle--dragging': activeHandle === 'end'
|
|
6142
6153
|
}),
|
|
6154
|
+
"data-target-id": "Waveform-resizeRangeEnd",
|
|
6143
6155
|
"data-testid": "bp-waveform-range-handle-end",
|
|
6144
6156
|
onMouseMove: event => event.stopPropagation(),
|
|
6145
6157
|
onPointerDown: onHandlePointerDown
|
|
@@ -6177,6 +6189,13 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6177
6189
|
|
|
6178
6190
|
|
|
6179
6191
|
|
|
6192
|
+
function recordGestureSession(lastAtRef, target, record) {
|
|
6193
|
+
const currentTime = Date.now();
|
|
6194
|
+
if (currentTime - lastAtRef.current > constants/* WAVEFORM_RESIN_GESTURE_GAP_MS */.Uz) {
|
|
6195
|
+
record?.(target);
|
|
6196
|
+
}
|
|
6197
|
+
lastAtRef.current = currentTime;
|
|
6198
|
+
}
|
|
6180
6199
|
|
|
6181
6200
|
/** Pointer X in the view and the media time under it; zoom keeps this point fixed. */
|
|
6182
6201
|
|
|
@@ -6339,6 +6358,7 @@ function WaveformView({
|
|
|
6339
6358
|
onRangeClear,
|
|
6340
6359
|
onRangeDragCreate,
|
|
6341
6360
|
onRangeDragChange,
|
|
6361
|
+
onResinAction,
|
|
6342
6362
|
onSeek,
|
|
6343
6363
|
onViewportChange,
|
|
6344
6364
|
onZoomChange,
|
|
@@ -6367,6 +6387,7 @@ function WaveformView({
|
|
|
6367
6387
|
const onRangeChangeRef = (0,external_react_.useRef)(onRangeChange); // latest range commit; drag-create must not re-bind
|
|
6368
6388
|
const onRangeClearRef = (0,external_react_.useRef)(onRangeClear); // latest click-outside clear; WaveSurfer click must not re-bind
|
|
6369
6389
|
const onRangeDragChangeRef = (0,external_react_.useRef)(onRangeDragChange); // latest drag flag; unmount must not re-bind
|
|
6390
|
+
const onResinActionRef = (0,external_react_.useRef)(onResinAction); // latest resin callback; gesture listeners must not re-bind
|
|
6370
6391
|
const onSeekRef = (0,external_react_.useRef)(onSeek); // latest onSeek; click/scroll handlers must not re-bind
|
|
6371
6392
|
const onViewportChangeRef = (0,external_react_.useRef)(onViewportChange); // latest viewport callback; camera commits here
|
|
6372
6393
|
const peaksRef = (0,external_react_.useRef)(peaks); // latest peaks; WaveSurfer create() + morph read this
|
|
@@ -6381,6 +6402,8 @@ function WaveformView({
|
|
|
6381
6402
|
const isPlayheadDraggingRef = (0,external_react_.useRef)(false); // playhead drag owns position until pointerup
|
|
6382
6403
|
const lastObservedWidthRef = (0,external_react_.useRef)(0); // last ResizeObserver width; skip no-op resizes
|
|
6383
6404
|
const liveHeightRef = (0,external_react_.useRef)(height); // canvas height last applied to WaveSurfer
|
|
6405
|
+
const lastPinchResinAtRef = (0,external_react_.useRef)(0); // last pinch resin time; one zoomIn/zoomOut per WAVEFORM_RESIN_GESTURE_GAP_MS
|
|
6406
|
+
const lastSwipeResinAtRef = (0,external_react_.useRef)(0); // last tape-swipe resin time; one waveformSwipe per burst
|
|
6384
6407
|
const pinchStartRef = (0,external_react_.useRef)(null); // two-finger distance and zoom at pinch start
|
|
6385
6408
|
const playheadDragRef = (0,external_react_.useRef)(null); // active playhead drag; pointerup seeks
|
|
6386
6409
|
const playheadPinRef = (0,external_react_.useRef)(null); // dragged time until media/props catch up
|
|
@@ -6407,6 +6430,7 @@ function WaveformView({
|
|
|
6407
6430
|
onRangeChangeRef.current = onRangeChange;
|
|
6408
6431
|
onRangeClearRef.current = onRangeClear;
|
|
6409
6432
|
onRangeDragChangeRef.current = onRangeDragChange;
|
|
6433
|
+
onResinActionRef.current = onResinAction;
|
|
6410
6434
|
onSeekRef.current = onSeek;
|
|
6411
6435
|
onViewportChangeRef.current = onViewportChange;
|
|
6412
6436
|
peaksRef.current = peaks;
|
|
@@ -6524,6 +6548,7 @@ function WaveformView({
|
|
|
6524
6548
|
suppressNextTapPlayPauseTimerRef.current = 0;
|
|
6525
6549
|
return;
|
|
6526
6550
|
}
|
|
6551
|
+
onResinActionRef.current?.('playPause');
|
|
6527
6552
|
onPlayPauseRef.current?.(!isPlayingRef.current);
|
|
6528
6553
|
suppressTapToPlayPause();
|
|
6529
6554
|
}, [isUserPanning, suppressTapToPlayPause]);
|
|
@@ -6574,6 +6599,7 @@ function WaveformView({
|
|
|
6574
6599
|
* show the scrub chip until the swipe settles.
|
|
6575
6600
|
*/
|
|
6576
6601
|
const handleTapeSwipe = (0,external_react_.useCallback)(timeSec => {
|
|
6602
|
+
recordGestureSession(lastSwipeResinAtRef, 'waveformSwipe', onResinActionRef.current);
|
|
6577
6603
|
// Swallow the click WaveSurfer/iOS fires after a swipe or pinch.
|
|
6578
6604
|
suppressNextTapPlayPauseRef.current = true;
|
|
6579
6605
|
window.clearTimeout(suppressNextTapPlayPauseTimerRef.current);
|
|
@@ -6738,12 +6764,14 @@ function WaveformView({
|
|
|
6738
6764
|
viewport: viewportRef.current
|
|
6739
6765
|
})) {
|
|
6740
6766
|
onRangeClearRef.current?.();
|
|
6767
|
+
onResinActionRef.current?.('waveformRangeDismiss');
|
|
6741
6768
|
}
|
|
6742
6769
|
}
|
|
6743
6770
|
if (cameraModeRef.current === 'tape') {
|
|
6744
6771
|
toggleTapePlaybackRef.current?.();
|
|
6745
6772
|
return;
|
|
6746
6773
|
}
|
|
6774
|
+
onResinActionRef.current?.('waveformSeek');
|
|
6747
6775
|
onSeekRef.current?.(timeSec);
|
|
6748
6776
|
});
|
|
6749
6777
|
const unsubscribeScroll = wavesurfer.on('scroll', () => {
|
|
@@ -7024,6 +7052,7 @@ function WaveformView({
|
|
|
7024
7052
|
return;
|
|
7025
7053
|
}
|
|
7026
7054
|
event.preventDefault();
|
|
7055
|
+
recordGestureSession(lastPinchResinAtRef, event.deltaY > 0 ? 'zoomOut' : 'zoomIn', onResinActionRef.current);
|
|
7027
7056
|
captureZoomOrigin(event.clientX);
|
|
7028
7057
|
setZoomLevel(zoomRef.current * Math.exp(-event.deltaY * 0.01));
|
|
7029
7058
|
};
|
|
@@ -7049,9 +7078,13 @@ function WaveformView({
|
|
|
7049
7078
|
return;
|
|
7050
7079
|
}
|
|
7051
7080
|
event.preventDefault();
|
|
7081
|
+
const distance = touchDistance(event.touches);
|
|
7082
|
+
if (distance !== pinch.distance) {
|
|
7083
|
+
recordGestureSession(lastPinchResinAtRef, distance > pinch.distance ? 'zoomIn' : 'zoomOut', onResinActionRef.current);
|
|
7084
|
+
}
|
|
7052
7085
|
zoomOriginRef.current = zoomOriginFromPinch(event.touches);
|
|
7053
7086
|
markPointerZoom();
|
|
7054
|
-
setZoomLevel(pinch.zoom * (
|
|
7087
|
+
setZoomLevel(pinch.zoom * (distance / pinch.distance));
|
|
7055
7088
|
};
|
|
7056
7089
|
const onTouchEnd = event => {
|
|
7057
7090
|
if (event.touches.length < 2) {
|
|
@@ -7246,6 +7279,7 @@ function WaveformView({
|
|
|
7246
7279
|
drag.range = drawnRangeFromMove(drag, moveEvent.clientX, moveTrack, viewportRef.current, playheadSec, durationSecRef.current);
|
|
7247
7280
|
if (!drag.active) {
|
|
7248
7281
|
drag.active = true;
|
|
7282
|
+
onResinActionRef.current?.('waveformRangeCreate');
|
|
7249
7283
|
handleRangeDragChange(true);
|
|
7250
7284
|
}
|
|
7251
7285
|
setCreateRange(drag.range);
|
|
@@ -7441,6 +7475,7 @@ function WaveformView({
|
|
|
7441
7475
|
} catch {
|
|
7442
7476
|
return; // Don't start a drag we cannot track after the pointer leaves.
|
|
7443
7477
|
}
|
|
7478
|
+
onResinActionRef.current?.('waveformPlayheadDrag');
|
|
7444
7479
|
const fromSec = mediaElRef.current ? mediaElRef.current.currentTime : currentTimeRef.current;
|
|
7445
7480
|
playheadDragRef.current = {
|
|
7446
7481
|
fromSec,
|
|
@@ -7553,6 +7588,7 @@ function WaveformView({
|
|
|
7553
7588
|
onPointerUp: onPlayheadPointerUp
|
|
7554
7589
|
}, showPlayheadComment && /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
7555
7590
|
className: "bp-WaveformRange-comment bp-WaveformView-playheadComment",
|
|
7591
|
+
"data-resin-target": "waveformPlayheadComment",
|
|
7556
7592
|
"data-target-id": "Waveform-commentAtTime",
|
|
7557
7593
|
"data-testid": "bp-waveform-playhead-comment",
|
|
7558
7594
|
onClick: event => {
|
|
@@ -7579,6 +7615,7 @@ function WaveformView({
|
|
|
7579
7615
|
onDragPointerX: clientX => {
|
|
7580
7616
|
rangeDragPointerXRef.current = clientX;
|
|
7581
7617
|
},
|
|
7618
|
+
onResinAction: onResinAction,
|
|
7582
7619
|
onPreviewChange: setPreviewRange,
|
|
7583
7620
|
onRangeChange: interactive && !isOverlayReadOnly ? onRangeChange : undefined,
|
|
7584
7621
|
onRangeClear: isTape && !isRangeDragging ? onRangeClear : undefined,
|
|
@@ -7859,6 +7896,7 @@ function MP3ControlsV2({
|
|
|
7859
7896
|
onCommentRangeDragCreate,
|
|
7860
7897
|
onCommentRangeDragChange,
|
|
7861
7898
|
onPlayheadComment,
|
|
7899
|
+
onResinAction,
|
|
7862
7900
|
onMuteChange,
|
|
7863
7901
|
onPlayPause,
|
|
7864
7902
|
onPlayNextChange,
|
|
@@ -7985,11 +8023,12 @@ function MP3ControlsV2({
|
|
|
7985
8023
|
if (!(target instanceof Element) || target.closest(RANGE_DISMISS_IGNORE)) {
|
|
7986
8024
|
return;
|
|
7987
8025
|
}
|
|
8026
|
+
onResinAction?.('waveformRangeDismiss');
|
|
7988
8027
|
onCommentRangeClear();
|
|
7989
8028
|
};
|
|
7990
8029
|
root.addEventListener('pointerdown', onPointerDown);
|
|
7991
8030
|
return () => root.removeEventListener('pointerdown', onPointerDown);
|
|
7992
|
-
}, [canDismissOpenRange, onCommentRangeClear]);
|
|
8031
|
+
}, [canDismissOpenRange, onCommentRangeClear, onResinAction]);
|
|
7993
8032
|
const isWaitingToPlay = hasStarted && !hasMediaMetadata;
|
|
7994
8033
|
const showPlayOverlay = !hasStarted && !isPlaying;
|
|
7995
8034
|
const hasZoomHandlers = hasRealPeaks && !showPlayOverlay;
|
|
@@ -8015,6 +8054,7 @@ function MP3ControlsV2({
|
|
|
8015
8054
|
mediaEl: mediaEl,
|
|
8016
8055
|
onPlayheadComment: isWaveformInteractive && !shuttleDirection ? onPlayheadComment : undefined,
|
|
8017
8056
|
onPlayPause: isWaveformInteractive ? onPlayPause : undefined,
|
|
8057
|
+
onResinAction: onResinAction,
|
|
8018
8058
|
onRangeChange: isWaveformInteractive ? onCommentRangeChange : undefined,
|
|
8019
8059
|
onRangeClear: isWaveformInteractive ? onCommentRangeClear : undefined,
|
|
8020
8060
|
onRangeDragChange: onCommentRangeDragChange,
|
|
@@ -8052,6 +8092,8 @@ function MP3ControlsV2({
|
|
|
8052
8092
|
dangerouslySetInnerHTML: {
|
|
8053
8093
|
__html: play_48px
|
|
8054
8094
|
},
|
|
8095
|
+
"data-resin-target": "playOverlay",
|
|
8096
|
+
"data-target-id": "MP3ControlsV2-play",
|
|
8055
8097
|
"data-testid": "bp-MP3ControlsV2-play-overlay",
|
|
8056
8098
|
onClick: handlePlayOverlayClick,
|
|
8057
8099
|
onMouseDown: event => event.preventDefault(),
|
|
@@ -8183,6 +8225,7 @@ function isFpsAvailable(player) {
|
|
|
8183
8225
|
/* harmony export */ Oe: () => (/* binding */ WAVEFORM_TAPE_RANGE_LONG_PRESS_CANCEL_PX),
|
|
8184
8226
|
/* harmony export */ QD: () => (/* binding */ WAVEFORM_ZOOM_BUTTON_STEP),
|
|
8185
8227
|
/* harmony export */ RQ: () => (/* binding */ WAVEFORM_TAPE_RANGE_LONG_PRESS_MS),
|
|
8228
|
+
/* harmony export */ Uz: () => (/* binding */ WAVEFORM_RESIN_GESTURE_GAP_MS),
|
|
8186
8229
|
/* harmony export */ VS: () => (/* binding */ WAVEFORM_RANGE_EDGE_SCROLL_AUDIO_SEC_PER_SEC),
|
|
8187
8230
|
/* harmony export */ XS: () => (/* binding */ WAVEFORM_BAR_MIN_HEIGHT),
|
|
8188
8231
|
/* harmony export */ Zs: () => (/* binding */ WAVEFORM_FOLLOW_SCROLL_SETTLE_MS),
|
|
@@ -8246,6 +8289,8 @@ const WAVEFORM_PLAYHEAD_JUMP_MS = 400;
|
|
|
8246
8289
|
const WAVEFORM_FOLLOW_SCROLL_SETTLE_MS = 150;
|
|
8247
8290
|
/** Ignore a WaveSurfer click after a tape swipe (iOS delayed click). Must outlast the scrub-chip hide. */
|
|
8248
8291
|
const WAVEFORM_TAPE_CLICK_SUPPRESS_MS = 200;
|
|
8292
|
+
/** One pinch or swipe burst. Same idle gap image, doc, text, and gallery use for pinch resin. */
|
|
8293
|
+
const WAVEFORM_RESIN_GESTURE_GAP_MS = 200;
|
|
8249
8294
|
const WAVEFORM_BAR_GAP = 2;
|
|
8250
8295
|
const WAVEFORM_BAR_WIDTH = 2;
|
|
8251
8296
|
const WAVEFORM_BAR_RADIUS = WAVEFORM_BAR_WIDTH / 2;
|
|
@@ -25364,7 +25409,7 @@ class Browser {
|
|
|
25364
25409
|
;// ./src/lib/Logger.js
|
|
25365
25410
|
/* eslint-disable no-undef */
|
|
25366
25411
|
const CLIENT_NAME = "box-content-preview";
|
|
25367
|
-
const CLIENT_VERSION = "3.
|
|
25412
|
+
const CLIENT_VERSION = "3.109.0";
|
|
25368
25413
|
/* eslint-enable no-undef */
|
|
25369
25414
|
|
|
25370
25415
|
class Logger {
|
|
@@ -38127,7 +38172,10 @@ function MP3ControlsRoot_toPrimitive(t, r) { if ("object" != typeof t || !t) ret
|
|
|
38127
38172
|
|
|
38128
38173
|
class MP3ControlsRoot {
|
|
38129
38174
|
constructor({
|
|
38130
|
-
containerEl
|
|
38175
|
+
containerEl,
|
|
38176
|
+
fileExtension,
|
|
38177
|
+
fileId,
|
|
38178
|
+
resinFeature
|
|
38131
38179
|
}) {
|
|
38132
38180
|
MP3ControlsRoot_defineProperty(this, "containerEl", void 0);
|
|
38133
38181
|
MP3ControlsRoot_defineProperty(this, "controlsEl", void 0);
|
|
@@ -38135,6 +38183,12 @@ class MP3ControlsRoot {
|
|
|
38135
38183
|
this.controlsEl = document.createElement('div');
|
|
38136
38184
|
this.controlsEl.setAttribute('class', 'bp-MP3ControlsRoot');
|
|
38137
38185
|
this.controlsEl.setAttribute('data-testid', 'bp-controls');
|
|
38186
|
+
this.controlsEl.setAttribute('data-resin-component', 'toolbar');
|
|
38187
|
+
if (resinFeature) {
|
|
38188
|
+
this.controlsEl.setAttribute('data-resin-feature', resinFeature);
|
|
38189
|
+
}
|
|
38190
|
+
this.controlsEl.setAttribute('data-resin-fileid', fileId != null ? String(fileId) : '');
|
|
38191
|
+
this.controlsEl.setAttribute('data-resin-fileextension', fileExtension || '');
|
|
38138
38192
|
this.containerEl = containerEl;
|
|
38139
38193
|
this.containerEl.appendChild(this.controlsEl);
|
|
38140
38194
|
this.root = __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7_createRoot__(this.controlsEl);
|
|
@@ -38164,6 +38218,8 @@ var validateWaveformPayload = __webpack_require__(1053);
|
|
|
38164
38218
|
|
|
38165
38219
|
;// ./src/lib/viewers/media/MP3Viewer.js
|
|
38166
38220
|
function MP3Viewer_extends() { return MP3Viewer_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, MP3Viewer_extends.apply(null, arguments); }
|
|
38221
|
+
function MP3Viewer_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
38222
|
+
function MP3Viewer_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? MP3Viewer_ownKeys(Object(t), !0).forEach(function (r) { MP3Viewer_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : MP3Viewer_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38167
38223
|
function MP3Viewer_defineProperty(e, r, t) { return (r = MP3Viewer_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
38168
38224
|
function MP3Viewer_toPropertyKey(t) { var i = MP3Viewer_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
38169
38225
|
function MP3Viewer_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -38242,6 +38298,23 @@ function createLoadFailedError(message) {
|
|
|
38242
38298
|
class MP3Viewer extends media_MediaBaseViewer {
|
|
38243
38299
|
constructor(...args) {
|
|
38244
38300
|
super(...args);
|
|
38301
|
+
/**
|
|
38302
|
+
* One toolbar resin event.
|
|
38303
|
+
*
|
|
38304
|
+
* @param {string} target
|
|
38305
|
+
* @return {void}
|
|
38306
|
+
*/
|
|
38307
|
+
MP3Viewer_defineProperty(this, "recordToolbarAction", target => {
|
|
38308
|
+
const file = this.options.file || {};
|
|
38309
|
+
this.options.resin?.recordAction({
|
|
38310
|
+
action: 'programmatic',
|
|
38311
|
+
component: 'toolbar',
|
|
38312
|
+
feature: constants/* AUDIO_PLAYER_V2_RESIN_FEATURE */.dl,
|
|
38313
|
+
target,
|
|
38314
|
+
fileId: file.id,
|
|
38315
|
+
fileExtension: file.extension
|
|
38316
|
+
});
|
|
38317
|
+
});
|
|
38245
38318
|
/**
|
|
38246
38319
|
* @inheritdoc
|
|
38247
38320
|
*/
|
|
@@ -38510,14 +38583,67 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38510
38583
|
}
|
|
38511
38584
|
return super.onKeydown(key, event);
|
|
38512
38585
|
}
|
|
38586
|
+
/**
|
|
38587
|
+
* Route slider and settings programmatic events through the audio v2 feature.
|
|
38588
|
+
* Clicks pick the same feature up from data-resin-feature on the player root.
|
|
38589
|
+
*
|
|
38590
|
+
* @return {void}
|
|
38591
|
+
*/
|
|
38592
|
+
bindAudioPlayerV2Resin() {
|
|
38593
|
+
const host = this.options.resin;
|
|
38594
|
+
if (!this.isAudioPlayerV2 || !host || typeof host.recordAction !== 'function' || this.audioPlayerV2ResinHost) {
|
|
38595
|
+
return;
|
|
38596
|
+
}
|
|
38597
|
+
this.audioPlayerV2ResinHost = host;
|
|
38598
|
+
const wrapped = {
|
|
38599
|
+
recordAction: props => host.recordAction(MP3Viewer_objectSpread({
|
|
38600
|
+
feature: constants/* AUDIO_PLAYER_V2_RESIN_FEATURE */.dl
|
|
38601
|
+
}, props))
|
|
38602
|
+
};
|
|
38603
|
+
this.options.resin = wrapped;
|
|
38604
|
+
if (window.Box?.Preview) {
|
|
38605
|
+
window.Box.Preview.resin = wrapped;
|
|
38606
|
+
}
|
|
38607
|
+
}
|
|
38608
|
+
|
|
38609
|
+
/**
|
|
38610
|
+
* @return {void}
|
|
38611
|
+
*/
|
|
38612
|
+
unbindAudioPlayerV2Resin() {
|
|
38613
|
+
const host = this.audioPlayerV2ResinHost;
|
|
38614
|
+
if (!host) {
|
|
38615
|
+
return;
|
|
38616
|
+
}
|
|
38617
|
+
this.options.resin = host;
|
|
38618
|
+
if (window.Box?.Preview) {
|
|
38619
|
+
window.Box.Preview.resin = host;
|
|
38620
|
+
}
|
|
38621
|
+
this.audioPlayerV2ResinHost = null;
|
|
38622
|
+
}
|
|
38623
|
+
|
|
38624
|
+
/**
|
|
38625
|
+
* @return {MP3ControlsRoot}
|
|
38626
|
+
*/
|
|
38627
|
+
createControlsRoot() {
|
|
38628
|
+
this.bindAudioPlayerV2Resin();
|
|
38629
|
+
const file = this.options.file || {};
|
|
38630
|
+
return new MP3ControlsRoot({
|
|
38631
|
+
containerEl: this.mediaContainerEl,
|
|
38632
|
+
fileExtension: file.extension || '',
|
|
38633
|
+
fileId: file.id,
|
|
38634
|
+
resinFeature: this.isAudioPlayerV2 ? constants/* AUDIO_PLAYER_V2_RESIN_FEATURE */.dl : undefined
|
|
38635
|
+
});
|
|
38636
|
+
}
|
|
38513
38637
|
handleKeydownAudioV2(key, event) {
|
|
38514
38638
|
const decoded = (key || '').toLowerCase();
|
|
38515
38639
|
const altKey = !!(event && event.altKey);
|
|
38516
38640
|
switch (decoded) {
|
|
38517
38641
|
case 'space':
|
|
38642
|
+
this.recordToolbarAction('playPause');
|
|
38518
38643
|
this.toggleV2Play();
|
|
38519
38644
|
return true;
|
|
38520
38645
|
case 'k':
|
|
38646
|
+
this.recordToolbarAction('playPause');
|
|
38521
38647
|
this.exitShuttle();
|
|
38522
38648
|
this.pause(undefined, true);
|
|
38523
38649
|
return true;
|
|
@@ -38528,15 +38654,19 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38528
38654
|
this.shuttle('forward');
|
|
38529
38655
|
return true;
|
|
38530
38656
|
case 'arrowleft':
|
|
38657
|
+
this.recordToolbarAction('seekBackward');
|
|
38531
38658
|
this.quickSeek(-AUDIO_V2_SKIP_SEC);
|
|
38532
38659
|
return true;
|
|
38533
38660
|
case 'arrowright':
|
|
38661
|
+
this.recordToolbarAction('seekForward');
|
|
38534
38662
|
this.quickSeek(AUDIO_V2_SKIP_SEC);
|
|
38535
38663
|
return true;
|
|
38536
38664
|
case ',':
|
|
38665
|
+
this.recordToolbarAction('frameBackward');
|
|
38537
38666
|
this.frameStep('back');
|
|
38538
38667
|
return true;
|
|
38539
38668
|
case '.':
|
|
38669
|
+
this.recordToolbarAction('frameForward');
|
|
38540
38670
|
this.frameStep('forward');
|
|
38541
38671
|
return true;
|
|
38542
38672
|
case 'arrowup':
|
|
@@ -38557,17 +38687,25 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38557
38687
|
if (!this.mediaEl || !Number.isFinite(this.mediaEl.duration)) {
|
|
38558
38688
|
return false;
|
|
38559
38689
|
}
|
|
38690
|
+
this.recordToolbarAction('seekEnd');
|
|
38560
38691
|
this.exitShuttle();
|
|
38561
38692
|
this.setMediaTime(this.mediaEl.duration);
|
|
38562
38693
|
return true;
|
|
38563
38694
|
case '0':
|
|
38564
38695
|
case 'home':
|
|
38696
|
+
this.recordToolbarAction('seekStart');
|
|
38565
38697
|
this.exitShuttle();
|
|
38566
38698
|
return false;
|
|
38699
|
+
case 'm':
|
|
38700
|
+
case 'shift+m':
|
|
38701
|
+
this.recordToolbarAction('volumeToggle');
|
|
38702
|
+
return false;
|
|
38567
38703
|
case 'shift+arrowleft':
|
|
38704
|
+
this.recordToolbarAction('skipBackward');
|
|
38568
38705
|
this.quickSeek(-AUDIO_V2_SHIFT_SKIP_SEC);
|
|
38569
38706
|
return true;
|
|
38570
38707
|
case 'shift+arrowright':
|
|
38708
|
+
this.recordToolbarAction('skipForward');
|
|
38571
38709
|
this.quickSeek(AUDIO_V2_SHIFT_SKIP_SEC);
|
|
38572
38710
|
return true;
|
|
38573
38711
|
case 'i':
|
|
@@ -38580,10 +38718,12 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38580
38718
|
case 'shift++':
|
|
38581
38719
|
case '+':
|
|
38582
38720
|
case '=':
|
|
38721
|
+
this.recordToolbarAction('waveformZoomIn');
|
|
38583
38722
|
this.stepKeyboardZoom(1);
|
|
38584
38723
|
return true;
|
|
38585
38724
|
case '-':
|
|
38586
38725
|
case 'shift+_':
|
|
38726
|
+
this.recordToolbarAction('waveformZoomOut');
|
|
38587
38727
|
this.stepKeyboardZoom(-1);
|
|
38588
38728
|
return true;
|
|
38589
38729
|
default:
|
|
@@ -38604,6 +38744,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38604
38744
|
if ((0,useTapeWaveform/* isTapeWaveformInput */.MQ)()) {
|
|
38605
38745
|
return;
|
|
38606
38746
|
}
|
|
38747
|
+
this.recordToolbarAction(direction === 'forward' ? 'shuttleForward' : 'shuttleReverse');
|
|
38607
38748
|
const sameDirection = this.shuttleDirection === direction;
|
|
38608
38749
|
const rate = nextShuttleRate(this.shuttleRate, sameDirection);
|
|
38609
38750
|
if (direction === 'forward') {
|
|
@@ -38697,9 +38838,11 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38697
38838
|
if (!target || target.id === this.hostSelectedMarkerId) {
|
|
38698
38839
|
return;
|
|
38699
38840
|
}
|
|
38841
|
+
this.recordToolbarAction(direction < 0 ? 'commentMarkerPrevious' : 'commentMarkerNext');
|
|
38700
38842
|
this.handleCommentMarkerClick(target);
|
|
38701
38843
|
}
|
|
38702
38844
|
stepKeyboardVolume(direction) {
|
|
38845
|
+
this.recordToolbarAction('volumeSlider');
|
|
38703
38846
|
this.keyboardVolumeStep += 1;
|
|
38704
38847
|
if (direction > 0) {
|
|
38705
38848
|
this.increaseVolume();
|
|
@@ -38741,6 +38884,10 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38741
38884
|
*/
|
|
38742
38885
|
fallbackToV1Controls() {
|
|
38743
38886
|
this.isAudioPlayerV2 = false;
|
|
38887
|
+
this.unbindAudioPlayerV2Resin();
|
|
38888
|
+
if (this.controls && this.controls.controlsEl) {
|
|
38889
|
+
this.controls.controlsEl.removeAttribute('data-resin-feature');
|
|
38890
|
+
}
|
|
38744
38891
|
this.abortWaveformLoads();
|
|
38745
38892
|
if (this.wrapperEl) {
|
|
38746
38893
|
this.wrapperEl.classList.remove('bp-media--v2');
|
|
@@ -38788,6 +38935,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38788
38935
|
this.shuttleDirection = null;
|
|
38789
38936
|
this.shuttleRate = 0;
|
|
38790
38937
|
this.abortWaveformLoads();
|
|
38938
|
+
this.unbindAudioPlayerV2Resin();
|
|
38791
38939
|
super.destroy();
|
|
38792
38940
|
}
|
|
38793
38941
|
|
|
@@ -38817,9 +38965,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38817
38965
|
showAudioLoadingShell() {
|
|
38818
38966
|
this.showMedia();
|
|
38819
38967
|
if (!this.controls) {
|
|
38820
|
-
this.controls =
|
|
38821
|
-
containerEl: this.mediaContainerEl
|
|
38822
|
-
});
|
|
38968
|
+
this.controls = this.createControlsRoot();
|
|
38823
38969
|
}
|
|
38824
38970
|
this.ensureV2Controls().then(Mp3ControlsV2 => {
|
|
38825
38971
|
if (this.destroyed) {
|
|
@@ -39201,9 +39347,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
39201
39347
|
loadUIReact() {
|
|
39202
39348
|
super.loadUIReact();
|
|
39203
39349
|
if (!this.controls) {
|
|
39204
|
-
this.controls =
|
|
39205
|
-
containerEl: this.mediaContainerEl
|
|
39206
|
-
});
|
|
39350
|
+
this.controls = this.createControlsRoot();
|
|
39207
39351
|
}
|
|
39208
39352
|
this.bindCommentMarkersListener();
|
|
39209
39353
|
this.bindCommentRangeDraftListeners();
|
|
@@ -39461,6 +39605,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
39461
39605
|
onCommentRangeDragChange: this.handleCommentRangeDragChange,
|
|
39462
39606
|
onCommentRangeDragCreate: this.getCanCreateComment() ? this.handleCommentRangeDragCreate : undefined,
|
|
39463
39607
|
onPlayheadComment: this.getCanCreateComment() ? this.handlePlayheadComment : undefined,
|
|
39608
|
+
onResinAction: this.recordToolbarAction,
|
|
39464
39609
|
onPlayNextChange: this.setPlayNext,
|
|
39465
39610
|
peaks: this.waveformPeaks,
|
|
39466
39611
|
playNext: this.isPlayNextEnabled(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "box-content-preview",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.109.0",
|
|
4
4
|
"description": "Box Content Preview UI Element",
|
|
5
5
|
"author": "Box (https://www.box.com/)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@box/blueprint-web": "^17.11.3",
|
|
40
40
|
"@box/blueprint-web-assets": "^5.10.10",
|
|
41
|
-
"@box/react-virtualized": "9.22.3-rc-box.
|
|
41
|
+
"@box/react-virtualized": "^9.22.3-rc-box.10",
|
|
42
42
|
"axios": "^0.34.0",
|
|
43
43
|
"box-annotations": "^5.2.1-beta.0",
|
|
44
44
|
"box-ui-elements": "^20.0.0",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"@box/blueprint-web-assets": "^5.10.10",
|
|
59
59
|
"@box/frontend": "^11.0.1",
|
|
60
60
|
"@box/languages": "^1.0.0",
|
|
61
|
-
"@box/react-virtualized": "9.22.3-rc-box.
|
|
61
|
+
"@box/react-virtualized": "^9.22.3-rc-box.10",
|
|
62
62
|
"@commitlint/cli": "^19.8.0",
|
|
63
63
|
"@commitlint/config-conventional": "^19.8.0",
|
|
64
64
|
"@commitlint/travis-cli": "^19.8.0",
|
|
65
|
-
"@testing-library/dom": "^10.4.
|
|
66
|
-
"@testing-library/jest-dom": "
|
|
67
|
-
"@testing-library/react": "16.
|
|
65
|
+
"@testing-library/dom": "^10.4.1",
|
|
66
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
67
|
+
"@testing-library/react": "^16.3.2",
|
|
68
68
|
"@testing-library/user-event": "^14.5.2",
|
|
69
69
|
"@types/classnames": "^2.2.11",
|
|
70
70
|
"@types/jest": "^29.5.13",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"autoprefixer": "^10.4.21",
|
|
77
77
|
"axios": "^0.34.0",
|
|
78
78
|
"babel-jest": "^29.7.0",
|
|
79
|
-
"babel-loader": "^
|
|
79
|
+
"babel-loader": "^9.1.3",
|
|
80
80
|
"babel-plugin-transform-require-ignore": "^0.1.1",
|
|
81
81
|
"box-annotations": "^5.2.1-beta.0",
|
|
82
82
|
"box-ui-elements": "^20.0.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"conventional-changelog": "^8.1.3",
|
|
86
86
|
"conventional-changelog-conventionalcommits": "^10.3.0",
|
|
87
87
|
"create-react-class": "^15.6.2",
|
|
88
|
-
"css-loader": "^
|
|
88
|
+
"css-loader": "^7.1.4",
|
|
89
89
|
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
90
90
|
"cypress": "^15.20.1",
|
|
91
91
|
"eslint": "^8.57.0",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"react-dom": "18.3.1",
|
|
121
121
|
"react-intl": "^6.4.2",
|
|
122
122
|
"react-tether": "^1.0.5",
|
|
123
|
-
"sass": "1.
|
|
123
|
+
"sass": "1.77.6",
|
|
124
124
|
"sass-loader": "^16.0.5",
|
|
125
125
|
"sinon": "^9.0.3",
|
|
126
126
|
"style-loader": "^4.0.0",
|