box-content-preview 3.108.0 → 3.112.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 +2 -2
- package/dist/lib/index.d.ts +28 -0
- package/dist/lib/index.js +470 -22
- package/package.json +2 -2
package/dist/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
|
26
26
|
import { default as __WEBPACK_EXTERNAL_MODULE_axios_default__ } from "axios";
|
|
27
27
|
import { bdlBoxBlue as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__, bdlGray65 as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlGray65__, bdlGreenLight as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlGreenLight__, bdlGrimace as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlGrimace__, bdlWatermelonRed as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlWatermelonRed__, bdlYellorange as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlYellorange__, bdlYellow as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlYellow__, white as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_white__ } from "box-ui-elements/es/styles/variables";
|
|
28
28
|
import { createRoot as __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7_createRoot__ } from "react-dom/client";
|
|
29
|
+
import { BlueprintProvider as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_BlueprintProvider__, Toolbar as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_Toolbar__, TooltipProvider as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_TooltipProvider__, useNoopTreatment as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_useNoopTreatment__ } from "@box/blueprint-web";
|
|
29
30
|
import { default as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_tooltip_Tooltip_97b5ae91_default__ } from "box-ui-elements/es/components/tooltip/Tooltip";
|
|
30
31
|
import { withTargetedClickThrough as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_features_targeting_hocs_e326fa91_withTargetedClickThrough__ } from "box-ui-elements/es/features/targeting/hocs";
|
|
31
32
|
import { PreviewLoading as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_preview_386c8d2b_PreviewLoading__, getIcon as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_preview_386c8d2b_getIcon__ } from "box-ui-elements/es/components/preview";
|
|
@@ -355,6 +356,7 @@ class PreviewError extends Error {
|
|
|
355
356
|
/* harmony export */ T2: () => (/* binding */ CLASS_BOX_PREVIEW_BUTTON),
|
|
356
357
|
/* harmony export */ Td: () => (/* binding */ MIN_VIDEO_WIDTH_PX),
|
|
357
358
|
/* harmony export */ U3: () => (/* binding */ CLASS_BOX_PREVIEW_TOGGLE_OVERLAY),
|
|
359
|
+
/* harmony export */ Uj: () => (/* binding */ CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED),
|
|
358
360
|
/* harmony export */ VC: () => (/* binding */ CLASS_IS_SELECTABLE),
|
|
359
361
|
/* harmony export */ VF: () => (/* binding */ SELECTOR_BOX_PREVIEW_ICON),
|
|
360
362
|
/* harmony export */ VL: () => (/* binding */ CLASS_MULTI_IMAGE_PAGE),
|
|
@@ -374,6 +376,7 @@ class PreviewError extends Error {
|
|
|
374
376
|
/* harmony export */ cR: () => (/* binding */ TEXT_STATIC_ASSETS_VERSION),
|
|
375
377
|
/* harmony export */ cZ: () => (/* binding */ CLASS_ANNOTATIONS_DISCOVERABLE),
|
|
376
378
|
/* harmony export */ dR: () => (/* binding */ BLUEPRINT_MIGRATION_MEDIA_CONTROLS),
|
|
379
|
+
/* harmony export */ dl: () => (/* binding */ AUDIO_PLAYER_V2_RESIN_FEATURE),
|
|
377
380
|
/* harmony export */ eA: () => (/* binding */ SUBTITLES_OFF),
|
|
378
381
|
/* harmony export */ eF: () => (/* binding */ CLASS_BOX_PREVIEW_PRELOAD_CONTENT),
|
|
379
382
|
/* harmony export */ eM: () => (/* binding */ CLASS_BOX_PREVIEW_HAS_NAVIGATION),
|
|
@@ -394,6 +397,7 @@ class PreviewError extends Error {
|
|
|
394
397
|
/* harmony export */ nC: () => (/* binding */ X_REP_HINT_DOC_THUMBNAIL),
|
|
395
398
|
/* harmony export */ oK: () => (/* binding */ CLASS_BOX_PREVIEW_PRELOAD_PLACEHOLDER),
|
|
396
399
|
/* harmony export */ oS: () => (/* binding */ CLASS_BOX_PREVIEW_BASE_HEADER),
|
|
400
|
+
/* harmony export */ on: () => (/* binding */ CLASS_BOX_PREVIEW_VERSION_BANNER),
|
|
397
401
|
/* harmony export */ pM: () => (/* binding */ VIDEO_FTUX_CURSOR_SEEN_KEY),
|
|
398
402
|
/* harmony export */ pl: () => (/* binding */ X_REP_HINT_BASE),
|
|
399
403
|
/* harmony export */ qL: () => (/* binding */ VIDEO_PLAYER_CONTROL_BAR_HEIGHT),
|
|
@@ -424,7 +428,7 @@ class PreviewError extends Error {
|
|
|
424
428
|
/* harmony export */ zb: () => (/* binding */ CLASS_DOC_FIRST_IMAGE),
|
|
425
429
|
/* harmony export */ ze: () => (/* binding */ STATUS_PENDING)
|
|
426
430
|
/* harmony export */ });
|
|
427
|
-
/* unused harmony exports CLASS_ACTIVE, CLASS_BOX_PREVIEW, CLASS_BOX_PREVIEW_CONTAINER, CLASS_BOX_PREVIEW_HEADER_CONTAINER, CLASS_BOX_PREVIEW_ICON, CLASS_BOX_PREVIEW_LOGO_CUSTOM, CLASS_BOX_PREVIEW_LOGO_DEFAULT,
|
|
431
|
+
/* unused harmony exports CLASS_ACTIVE, CLASS_BOX_PREVIEW, CLASS_BOX_PREVIEW_CONTAINER, CLASS_BOX_PREVIEW_HEADER_CONTAINER, CLASS_BOX_PREVIEW_ICON, CLASS_BOX_PREVIEW_LOGO_CUSTOM, CLASS_BOX_PREVIEW_LOGO_DEFAULT, CLASS_PREFETCHED_IMAGE, SELECTOR_BOX_PREVIEW_VERSION_BANNER, SELECTOR_BOX_PREVIEW_HEADER, SELECTOR_BOX_PREVIEW_NOTIFICATION */
|
|
428
432
|
const CLASS_ACTIVE = 'bp-is-active';
|
|
429
433
|
const CLASS_ANNOTATIONS_CREATE_DRAWING = 'bp-annotations-create--drawing';
|
|
430
434
|
const CLASS_ANNOTATIONS_CREATE_HIGHLIGHT = 'bp-annotations-create--highlight';
|
|
@@ -532,6 +536,7 @@ const X_REP_HINT_VIDEO_MP4 = '[mp4]';
|
|
|
532
536
|
const X_REP_HINT_WAVEFORM = '[waveform]';
|
|
533
537
|
const AI_TRANSCRIPTION_FOR_VIDEO_SUBTITLES = 'aiTranscriptionForVideoSubtitles';
|
|
534
538
|
const AUDIO_PLAYER_V2 = 'audioPlayerV2.enabled';
|
|
539
|
+
const AUDIO_PLAYER_V2_RESIN_FEATURE = 'audioPlayerV2';
|
|
535
540
|
|
|
536
541
|
// One per wave of the Blueprint migration. Each is reported as its own metric dimension so a
|
|
537
542
|
// dashboard can compare a wave's timings with its flag on against the same wave with it off.
|
|
@@ -1032,7 +1037,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1032
1037
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
1033
1038
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
1034
1039
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
1035
|
-
const CLIENT_VERSION = "3.
|
|
1040
|
+
const CLIENT_VERSION = "3.112.0"; // eslint-disable-line no-undef
|
|
1036
1041
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
1037
1042
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
1038
1043
|
const PROMISE_MAP = {};
|
|
@@ -5791,6 +5796,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
5791
5796
|
onPreviewChange,
|
|
5792
5797
|
onRangeChange,
|
|
5793
5798
|
onRangeClear,
|
|
5799
|
+
onResinAction,
|
|
5794
5800
|
range,
|
|
5795
5801
|
readOnly = false,
|
|
5796
5802
|
viewport
|
|
@@ -5963,6 +5969,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
5963
5969
|
}
|
|
5964
5970
|
event.preventDefault();
|
|
5965
5971
|
event.stopPropagation();
|
|
5972
|
+
onResinAction?.('waveformRangeResize');
|
|
5966
5973
|
const resolved = (0,waveform_range/* resolveRange */.Ss)(rangeRef.current, (0,waveform_range/* durationMsFromSec */.uH)(durationSecRef.current));
|
|
5967
5974
|
dragRef.current = {
|
|
5968
5975
|
handle,
|
|
@@ -5984,7 +5991,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
5984
5991
|
endMs: (0,waveform_range/* isRangeCollapsed */.BT)(rangeRef.current) ? null : resolved.endMs,
|
|
5985
5992
|
startMs: resolved.startMs
|
|
5986
5993
|
});
|
|
5987
|
-
}, [interactive, readOnly]);
|
|
5994
|
+
}, [interactive, onResinAction, readOnly]);
|
|
5988
5995
|
const onHandlePointerDown = (0,external_react_.useCallback)(event => {
|
|
5989
5996
|
const root = rootRef.current;
|
|
5990
5997
|
if (!root) {
|
|
@@ -6058,6 +6065,8 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6058
6065
|
ref: commentButtonRef,
|
|
6059
6066
|
"aria-label": "Clear",
|
|
6060
6067
|
className: "bp-WaveformRange-comment bp-WaveformRange-comment--clearOnly",
|
|
6068
|
+
"data-resin-target": "waveformRangeClear",
|
|
6069
|
+
"data-target-id": "Waveform-clearRange",
|
|
6061
6070
|
"data-testid": "bp-waveform-range-clear",
|
|
6062
6071
|
onClick: event => {
|
|
6063
6072
|
stopRangeEvent(event);
|
|
@@ -6075,6 +6084,8 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6075
6084
|
const commentAction = /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
6076
6085
|
ref: showClearControl ? undefined : commentButtonRef,
|
|
6077
6086
|
className: showClearControl ? 'bp-WaveformRange-commentLabel' : 'bp-WaveformRange-comment',
|
|
6087
|
+
"data-resin-target": "waveformRangeComment",
|
|
6088
|
+
"data-target-id": "Waveform-commentOnRange",
|
|
6078
6089
|
"data-testid": "bp-waveform-range-comment",
|
|
6079
6090
|
onClick: event => {
|
|
6080
6091
|
stopRangeEvent(event);
|
|
@@ -6096,6 +6107,8 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6096
6107
|
}), /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
6097
6108
|
"aria-label": "Clear",
|
|
6098
6109
|
className: "bp-WaveformRange-commentClear",
|
|
6110
|
+
"data-resin-target": "waveformRangeClear",
|
|
6111
|
+
"data-target-id": "Waveform-clearRange",
|
|
6099
6112
|
"data-testid": "bp-waveform-range-clear",
|
|
6100
6113
|
onClick: event => {
|
|
6101
6114
|
stopRangeEvent(event);
|
|
@@ -6130,6 +6143,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6130
6143
|
className: classnames_default()('bp-WaveformRange-handle', 'bp-WaveformRange-handle--start', {
|
|
6131
6144
|
'bp-WaveformRange-handle--dragging': activeHandle === 'start'
|
|
6132
6145
|
}),
|
|
6146
|
+
"data-target-id": "Waveform-resizeRangeStart",
|
|
6133
6147
|
"data-testid": "bp-waveform-range-handle-start",
|
|
6134
6148
|
onMouseMove: event => event.stopPropagation(),
|
|
6135
6149
|
onPointerDown: onHandlePointerDown
|
|
@@ -6140,6 +6154,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
|
|
|
6140
6154
|
className: classnames_default()('bp-WaveformRange-handle', 'bp-WaveformRange-handle--end', {
|
|
6141
6155
|
'bp-WaveformRange-handle--dragging': activeHandle === 'end'
|
|
6142
6156
|
}),
|
|
6157
|
+
"data-target-id": "Waveform-resizeRangeEnd",
|
|
6143
6158
|
"data-testid": "bp-waveform-range-handle-end",
|
|
6144
6159
|
onMouseMove: event => event.stopPropagation(),
|
|
6145
6160
|
onPointerDown: onHandlePointerDown
|
|
@@ -6177,6 +6192,13 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
6177
6192
|
|
|
6178
6193
|
|
|
6179
6194
|
|
|
6195
|
+
function recordGestureSession(lastAtRef, target, record) {
|
|
6196
|
+
const currentTime = Date.now();
|
|
6197
|
+
if (currentTime - lastAtRef.current > constants/* WAVEFORM_RESIN_GESTURE_GAP_MS */.Uz) {
|
|
6198
|
+
record?.(target);
|
|
6199
|
+
}
|
|
6200
|
+
lastAtRef.current = currentTime;
|
|
6201
|
+
}
|
|
6180
6202
|
|
|
6181
6203
|
/** Pointer X in the view and the media time under it; zoom keeps this point fixed. */
|
|
6182
6204
|
|
|
@@ -6339,6 +6361,7 @@ function WaveformView({
|
|
|
6339
6361
|
onRangeClear,
|
|
6340
6362
|
onRangeDragCreate,
|
|
6341
6363
|
onRangeDragChange,
|
|
6364
|
+
onResinAction,
|
|
6342
6365
|
onSeek,
|
|
6343
6366
|
onViewportChange,
|
|
6344
6367
|
onZoomChange,
|
|
@@ -6367,6 +6390,7 @@ function WaveformView({
|
|
|
6367
6390
|
const onRangeChangeRef = (0,external_react_.useRef)(onRangeChange); // latest range commit; drag-create must not re-bind
|
|
6368
6391
|
const onRangeClearRef = (0,external_react_.useRef)(onRangeClear); // latest click-outside clear; WaveSurfer click must not re-bind
|
|
6369
6392
|
const onRangeDragChangeRef = (0,external_react_.useRef)(onRangeDragChange); // latest drag flag; unmount must not re-bind
|
|
6393
|
+
const onResinActionRef = (0,external_react_.useRef)(onResinAction); // latest resin callback; gesture listeners must not re-bind
|
|
6370
6394
|
const onSeekRef = (0,external_react_.useRef)(onSeek); // latest onSeek; click/scroll handlers must not re-bind
|
|
6371
6395
|
const onViewportChangeRef = (0,external_react_.useRef)(onViewportChange); // latest viewport callback; camera commits here
|
|
6372
6396
|
const peaksRef = (0,external_react_.useRef)(peaks); // latest peaks; WaveSurfer create() + morph read this
|
|
@@ -6381,6 +6405,8 @@ function WaveformView({
|
|
|
6381
6405
|
const isPlayheadDraggingRef = (0,external_react_.useRef)(false); // playhead drag owns position until pointerup
|
|
6382
6406
|
const lastObservedWidthRef = (0,external_react_.useRef)(0); // last ResizeObserver width; skip no-op resizes
|
|
6383
6407
|
const liveHeightRef = (0,external_react_.useRef)(height); // canvas height last applied to WaveSurfer
|
|
6408
|
+
const lastPinchResinAtRef = (0,external_react_.useRef)(0); // last pinch resin time; one zoomIn/zoomOut per WAVEFORM_RESIN_GESTURE_GAP_MS
|
|
6409
|
+
const lastSwipeResinAtRef = (0,external_react_.useRef)(0); // last tape-swipe resin time; one waveformSwipe per burst
|
|
6384
6410
|
const pinchStartRef = (0,external_react_.useRef)(null); // two-finger distance and zoom at pinch start
|
|
6385
6411
|
const playheadDragRef = (0,external_react_.useRef)(null); // active playhead drag; pointerup seeks
|
|
6386
6412
|
const playheadPinRef = (0,external_react_.useRef)(null); // dragged time until media/props catch up
|
|
@@ -6407,6 +6433,7 @@ function WaveformView({
|
|
|
6407
6433
|
onRangeChangeRef.current = onRangeChange;
|
|
6408
6434
|
onRangeClearRef.current = onRangeClear;
|
|
6409
6435
|
onRangeDragChangeRef.current = onRangeDragChange;
|
|
6436
|
+
onResinActionRef.current = onResinAction;
|
|
6410
6437
|
onSeekRef.current = onSeek;
|
|
6411
6438
|
onViewportChangeRef.current = onViewportChange;
|
|
6412
6439
|
peaksRef.current = peaks;
|
|
@@ -6524,6 +6551,7 @@ function WaveformView({
|
|
|
6524
6551
|
suppressNextTapPlayPauseTimerRef.current = 0;
|
|
6525
6552
|
return;
|
|
6526
6553
|
}
|
|
6554
|
+
onResinActionRef.current?.('playPause');
|
|
6527
6555
|
onPlayPauseRef.current?.(!isPlayingRef.current);
|
|
6528
6556
|
suppressTapToPlayPause();
|
|
6529
6557
|
}, [isUserPanning, suppressTapToPlayPause]);
|
|
@@ -6574,6 +6602,7 @@ function WaveformView({
|
|
|
6574
6602
|
* show the scrub chip until the swipe settles.
|
|
6575
6603
|
*/
|
|
6576
6604
|
const handleTapeSwipe = (0,external_react_.useCallback)(timeSec => {
|
|
6605
|
+
recordGestureSession(lastSwipeResinAtRef, 'waveformSwipe', onResinActionRef.current);
|
|
6577
6606
|
// Swallow the click WaveSurfer/iOS fires after a swipe or pinch.
|
|
6578
6607
|
suppressNextTapPlayPauseRef.current = true;
|
|
6579
6608
|
window.clearTimeout(suppressNextTapPlayPauseTimerRef.current);
|
|
@@ -6738,12 +6767,14 @@ function WaveformView({
|
|
|
6738
6767
|
viewport: viewportRef.current
|
|
6739
6768
|
})) {
|
|
6740
6769
|
onRangeClearRef.current?.();
|
|
6770
|
+
onResinActionRef.current?.('waveformRangeDismiss');
|
|
6741
6771
|
}
|
|
6742
6772
|
}
|
|
6743
6773
|
if (cameraModeRef.current === 'tape') {
|
|
6744
6774
|
toggleTapePlaybackRef.current?.();
|
|
6745
6775
|
return;
|
|
6746
6776
|
}
|
|
6777
|
+
onResinActionRef.current?.('waveformSeek');
|
|
6747
6778
|
onSeekRef.current?.(timeSec);
|
|
6748
6779
|
});
|
|
6749
6780
|
const unsubscribeScroll = wavesurfer.on('scroll', () => {
|
|
@@ -7024,6 +7055,7 @@ function WaveformView({
|
|
|
7024
7055
|
return;
|
|
7025
7056
|
}
|
|
7026
7057
|
event.preventDefault();
|
|
7058
|
+
recordGestureSession(lastPinchResinAtRef, event.deltaY > 0 ? 'zoomOut' : 'zoomIn', onResinActionRef.current);
|
|
7027
7059
|
captureZoomOrigin(event.clientX);
|
|
7028
7060
|
setZoomLevel(zoomRef.current * Math.exp(-event.deltaY * 0.01));
|
|
7029
7061
|
};
|
|
@@ -7049,9 +7081,13 @@ function WaveformView({
|
|
|
7049
7081
|
return;
|
|
7050
7082
|
}
|
|
7051
7083
|
event.preventDefault();
|
|
7084
|
+
const distance = touchDistance(event.touches);
|
|
7085
|
+
if (distance !== pinch.distance) {
|
|
7086
|
+
recordGestureSession(lastPinchResinAtRef, distance > pinch.distance ? 'zoomIn' : 'zoomOut', onResinActionRef.current);
|
|
7087
|
+
}
|
|
7052
7088
|
zoomOriginRef.current = zoomOriginFromPinch(event.touches);
|
|
7053
7089
|
markPointerZoom();
|
|
7054
|
-
setZoomLevel(pinch.zoom * (
|
|
7090
|
+
setZoomLevel(pinch.zoom * (distance / pinch.distance));
|
|
7055
7091
|
};
|
|
7056
7092
|
const onTouchEnd = event => {
|
|
7057
7093
|
if (event.touches.length < 2) {
|
|
@@ -7246,6 +7282,7 @@ function WaveformView({
|
|
|
7246
7282
|
drag.range = drawnRangeFromMove(drag, moveEvent.clientX, moveTrack, viewportRef.current, playheadSec, durationSecRef.current);
|
|
7247
7283
|
if (!drag.active) {
|
|
7248
7284
|
drag.active = true;
|
|
7285
|
+
onResinActionRef.current?.('waveformRangeCreate');
|
|
7249
7286
|
handleRangeDragChange(true);
|
|
7250
7287
|
}
|
|
7251
7288
|
setCreateRange(drag.range);
|
|
@@ -7441,6 +7478,7 @@ function WaveformView({
|
|
|
7441
7478
|
} catch {
|
|
7442
7479
|
return; // Don't start a drag we cannot track after the pointer leaves.
|
|
7443
7480
|
}
|
|
7481
|
+
onResinActionRef.current?.('waveformPlayheadDrag');
|
|
7444
7482
|
const fromSec = mediaElRef.current ? mediaElRef.current.currentTime : currentTimeRef.current;
|
|
7445
7483
|
playheadDragRef.current = {
|
|
7446
7484
|
fromSec,
|
|
@@ -7553,6 +7591,7 @@ function WaveformView({
|
|
|
7553
7591
|
onPointerUp: onPlayheadPointerUp
|
|
7554
7592
|
}, showPlayheadComment && /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
7555
7593
|
className: "bp-WaveformRange-comment bp-WaveformView-playheadComment",
|
|
7594
|
+
"data-resin-target": "waveformPlayheadComment",
|
|
7556
7595
|
"data-target-id": "Waveform-commentAtTime",
|
|
7557
7596
|
"data-testid": "bp-waveform-playhead-comment",
|
|
7558
7597
|
onClick: event => {
|
|
@@ -7579,6 +7618,7 @@ function WaveformView({
|
|
|
7579
7618
|
onDragPointerX: clientX => {
|
|
7580
7619
|
rangeDragPointerXRef.current = clientX;
|
|
7581
7620
|
},
|
|
7621
|
+
onResinAction: onResinAction,
|
|
7582
7622
|
onPreviewChange: setPreviewRange,
|
|
7583
7623
|
onRangeChange: interactive && !isOverlayReadOnly ? onRangeChange : undefined,
|
|
7584
7624
|
onRangeClear: isTape && !isRangeDragging ? onRangeClear : undefined,
|
|
@@ -7859,6 +7899,7 @@ function MP3ControlsV2({
|
|
|
7859
7899
|
onCommentRangeDragCreate,
|
|
7860
7900
|
onCommentRangeDragChange,
|
|
7861
7901
|
onPlayheadComment,
|
|
7902
|
+
onResinAction,
|
|
7862
7903
|
onMuteChange,
|
|
7863
7904
|
onPlayPause,
|
|
7864
7905
|
onPlayNextChange,
|
|
@@ -7985,11 +8026,12 @@ function MP3ControlsV2({
|
|
|
7985
8026
|
if (!(target instanceof Element) || target.closest(RANGE_DISMISS_IGNORE)) {
|
|
7986
8027
|
return;
|
|
7987
8028
|
}
|
|
8029
|
+
onResinAction?.('waveformRangeDismiss');
|
|
7988
8030
|
onCommentRangeClear();
|
|
7989
8031
|
};
|
|
7990
8032
|
root.addEventListener('pointerdown', onPointerDown);
|
|
7991
8033
|
return () => root.removeEventListener('pointerdown', onPointerDown);
|
|
7992
|
-
}, [canDismissOpenRange, onCommentRangeClear]);
|
|
8034
|
+
}, [canDismissOpenRange, onCommentRangeClear, onResinAction]);
|
|
7993
8035
|
const isWaitingToPlay = hasStarted && !hasMediaMetadata;
|
|
7994
8036
|
const showPlayOverlay = !hasStarted && !isPlaying;
|
|
7995
8037
|
const hasZoomHandlers = hasRealPeaks && !showPlayOverlay;
|
|
@@ -8015,6 +8057,7 @@ function MP3ControlsV2({
|
|
|
8015
8057
|
mediaEl: mediaEl,
|
|
8016
8058
|
onPlayheadComment: isWaveformInteractive && !shuttleDirection ? onPlayheadComment : undefined,
|
|
8017
8059
|
onPlayPause: isWaveformInteractive ? onPlayPause : undefined,
|
|
8060
|
+
onResinAction: onResinAction,
|
|
8018
8061
|
onRangeChange: isWaveformInteractive ? onCommentRangeChange : undefined,
|
|
8019
8062
|
onRangeClear: isWaveformInteractive ? onCommentRangeClear : undefined,
|
|
8020
8063
|
onRangeDragChange: onCommentRangeDragChange,
|
|
@@ -8052,6 +8095,8 @@ function MP3ControlsV2({
|
|
|
8052
8095
|
dangerouslySetInnerHTML: {
|
|
8053
8096
|
__html: play_48px
|
|
8054
8097
|
},
|
|
8098
|
+
"data-resin-target": "playOverlay",
|
|
8099
|
+
"data-target-id": "MP3ControlsV2-play",
|
|
8055
8100
|
"data-testid": "bp-MP3ControlsV2-play-overlay",
|
|
8056
8101
|
onClick: handlePlayOverlayClick,
|
|
8057
8102
|
onMouseDown: event => event.preventDefault(),
|
|
@@ -8183,6 +8228,7 @@ function isFpsAvailable(player) {
|
|
|
8183
8228
|
/* harmony export */ Oe: () => (/* binding */ WAVEFORM_TAPE_RANGE_LONG_PRESS_CANCEL_PX),
|
|
8184
8229
|
/* harmony export */ QD: () => (/* binding */ WAVEFORM_ZOOM_BUTTON_STEP),
|
|
8185
8230
|
/* harmony export */ RQ: () => (/* binding */ WAVEFORM_TAPE_RANGE_LONG_PRESS_MS),
|
|
8231
|
+
/* harmony export */ Uz: () => (/* binding */ WAVEFORM_RESIN_GESTURE_GAP_MS),
|
|
8186
8232
|
/* harmony export */ VS: () => (/* binding */ WAVEFORM_RANGE_EDGE_SCROLL_AUDIO_SEC_PER_SEC),
|
|
8187
8233
|
/* harmony export */ XS: () => (/* binding */ WAVEFORM_BAR_MIN_HEIGHT),
|
|
8188
8234
|
/* harmony export */ Zs: () => (/* binding */ WAVEFORM_FOLLOW_SCROLL_SETTLE_MS),
|
|
@@ -8246,6 +8292,8 @@ const WAVEFORM_PLAYHEAD_JUMP_MS = 400;
|
|
|
8246
8292
|
const WAVEFORM_FOLLOW_SCROLL_SETTLE_MS = 150;
|
|
8247
8293
|
/** Ignore a WaveSurfer click after a tape swipe (iOS delayed click). Must outlast the scrub-chip hide. */
|
|
8248
8294
|
const WAVEFORM_TAPE_CLICK_SUPPRESS_MS = 200;
|
|
8295
|
+
/** One pinch or swipe burst. Same idle gap image, doc, text, and gallery use for pinch resin. */
|
|
8296
|
+
const WAVEFORM_RESIN_GESTURE_GAP_MS = 200;
|
|
8249
8297
|
const WAVEFORM_BAR_GAP = 2;
|
|
8250
8298
|
const WAVEFORM_BAR_WIDTH = 2;
|
|
8251
8299
|
const WAVEFORM_BAR_RADIUS = WAVEFORM_BAR_WIDTH / 2;
|
|
@@ -25364,7 +25412,7 @@ class Browser {
|
|
|
25364
25412
|
;// ./src/lib/Logger.js
|
|
25365
25413
|
/* eslint-disable no-undef */
|
|
25366
25414
|
const CLIENT_NAME = "box-content-preview";
|
|
25367
|
-
const CLIENT_VERSION = "3.
|
|
25415
|
+
const CLIENT_VERSION = "3.112.0";
|
|
25368
25416
|
/* eslint-enable no-undef */
|
|
25369
25417
|
|
|
25370
25418
|
class Logger {
|
|
@@ -26380,12 +26428,17 @@ class AnnotationModule {
|
|
|
26380
26428
|
}
|
|
26381
26429
|
;// ./src/lib/featureChecking.ts
|
|
26382
26430
|
|
|
26431
|
+
|
|
26383
26432
|
const isFeatureEnabled = (features, featureName) => {
|
|
26384
26433
|
return !!get_default()(features, featureName, false);
|
|
26385
26434
|
};
|
|
26386
26435
|
const getFeatureConfig = (features, featureName) => {
|
|
26387
26436
|
return get_default()(features, featureName, {});
|
|
26388
26437
|
};
|
|
26438
|
+
|
|
26439
|
+
// Every React root gates Blueprint providers on this rather than on its own wave's flag, so a
|
|
26440
|
+
// Blueprint surface from any wave always has its providers, whichever root it renders in.
|
|
26441
|
+
const isBlueprintEnabled = features => [constants/* BLUEPRINT_MIGRATION_ARCHIVE */.cA, constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ, constants/* BLUEPRINT_MIGRATION_MEDIA_CONTROLS */.dR, constants/* BLUEPRINT_MIGRATION_SUPPORTING_UI */.Ed].some(feature => isFeatureEnabled(features, feature));
|
|
26389
26442
|
;// ./src/lib/viewers/BaseViewer.js
|
|
26390
26443
|
function BaseViewer_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; }
|
|
26391
26444
|
function BaseViewer_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? BaseViewer_ownKeys(Object(t), !0).forEach(function (r) { BaseViewer_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : BaseViewer_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -27778,6 +27831,15 @@ class BaseViewer extends (events_default()) {
|
|
|
27778
27831
|
return isFeatureEnabled(this.options.features, feature);
|
|
27779
27832
|
}
|
|
27780
27833
|
|
|
27834
|
+
/**
|
|
27835
|
+
* Whether any Blueprint migration wave is on, which is when React roots mount Blueprint providers
|
|
27836
|
+
*
|
|
27837
|
+
* @return {boolean}
|
|
27838
|
+
*/
|
|
27839
|
+
isBlueprintEnabled() {
|
|
27840
|
+
return isBlueprintEnabled(this.options.features);
|
|
27841
|
+
}
|
|
27842
|
+
|
|
27781
27843
|
/**
|
|
27782
27844
|
* Hides the preview mask element if it exists
|
|
27783
27845
|
*
|
|
@@ -27915,6 +27977,22 @@ var external_react_ = __webpack_require__(1649);
|
|
|
27915
27977
|
// EXTERNAL MODULE: ./node_modules/lodash/noop.js
|
|
27916
27978
|
var noop = __webpack_require__(3950);
|
|
27917
27979
|
var noop_default = /*#__PURE__*/__webpack_require__.n(noop);
|
|
27980
|
+
;// external "@box/blueprint-web"
|
|
27981
|
+
|
|
27982
|
+
;// ./src/lib/BlueprintProviders.tsx
|
|
27983
|
+
|
|
27984
|
+
|
|
27985
|
+
// Preview has no Split client, so Blueprint's treatment-driven configuration resolves to its defaults.
|
|
27986
|
+
function BlueprintProviders({
|
|
27987
|
+
children,
|
|
27988
|
+
container
|
|
27989
|
+
}) {
|
|
27990
|
+
return /*#__PURE__*/external_react_["default"].createElement(__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_BlueprintProvider__, {
|
|
27991
|
+
useTreatment: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_useNoopTreatment__
|
|
27992
|
+
}, /*#__PURE__*/external_react_["default"].createElement(__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_TooltipProvider__, {
|
|
27993
|
+
container: container
|
|
27994
|
+
}, children));
|
|
27995
|
+
}
|
|
27918
27996
|
;// ./src/lib/viewers/controls/controls-layer/ControlsLayerContext.ts
|
|
27919
27997
|
|
|
27920
27998
|
|
|
@@ -28034,12 +28112,14 @@ function ControlsRoot_toPrimitive(t, r) { if ("object" != typeof t || !t) return
|
|
|
28034
28112
|
|
|
28035
28113
|
|
|
28036
28114
|
|
|
28115
|
+
|
|
28037
28116
|
class ControlsRoot {
|
|
28038
28117
|
constructor({
|
|
28039
28118
|
className = 'bp-ControlsRoot',
|
|
28040
28119
|
containerEl,
|
|
28041
28120
|
fileExtension,
|
|
28042
28121
|
fileId,
|
|
28122
|
+
isBlueprintEnabled = false,
|
|
28043
28123
|
onHide = (noop_default()),
|
|
28044
28124
|
onShow = (noop_default())
|
|
28045
28125
|
}) {
|
|
@@ -28052,6 +28132,7 @@ class ControlsRoot {
|
|
|
28052
28132
|
});
|
|
28053
28133
|
ControlsRoot_defineProperty(this, "handleHide", void 0);
|
|
28054
28134
|
ControlsRoot_defineProperty(this, "handleShow", void 0);
|
|
28135
|
+
ControlsRoot_defineProperty(this, "isBlueprintEnabled", void 0);
|
|
28055
28136
|
ControlsRoot_defineProperty(this, "root", void 0);
|
|
28056
28137
|
ControlsRoot_defineProperty(this, "handleMount", helpers => {
|
|
28057
28138
|
this.controlsLayer = helpers;
|
|
@@ -28078,6 +28159,7 @@ class ControlsRoot {
|
|
|
28078
28159
|
this.root = __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7_createRoot__(this.controlsEl);
|
|
28079
28160
|
this.handleHide = onHide;
|
|
28080
28161
|
this.handleShow = onShow;
|
|
28162
|
+
this.isBlueprintEnabled = isBlueprintEnabled;
|
|
28081
28163
|
}
|
|
28082
28164
|
destroy() {
|
|
28083
28165
|
this.root.unmount();
|
|
@@ -28094,11 +28176,14 @@ class ControlsRoot {
|
|
|
28094
28176
|
this.controlsEl.classList.remove('bp-is-hidden');
|
|
28095
28177
|
}
|
|
28096
28178
|
render(controls) {
|
|
28097
|
-
|
|
28179
|
+
const layer = /*#__PURE__*/external_react_["default"].createElement(ControlsLayer, {
|
|
28098
28180
|
onHide: this.handleHide,
|
|
28099
28181
|
onMount: this.handleMount,
|
|
28100
28182
|
onShow: this.handleShow
|
|
28101
|
-
}, controls)
|
|
28183
|
+
}, controls);
|
|
28184
|
+
this.root.render(this.isBlueprintEnabled ? /*#__PURE__*/external_react_["default"].createElement(BlueprintProviders, {
|
|
28185
|
+
container: this.containerEl
|
|
28186
|
+
}, layer) : layer);
|
|
28102
28187
|
}
|
|
28103
28188
|
}
|
|
28104
28189
|
;// ./src/lib/viewers/image/ImageBaseViewer.js
|
|
@@ -28317,7 +28402,8 @@ class ImageBaseViewer extends viewers_BaseViewer {
|
|
|
28317
28402
|
this.controls = new ControlsRoot({
|
|
28318
28403
|
containerEl: this.containerEl,
|
|
28319
28404
|
fileExtension: this.options.file.extension,
|
|
28320
|
-
fileId: this.options.file.id
|
|
28405
|
+
fileId: this.options.file.id,
|
|
28406
|
+
isBlueprintEnabled: this.isBlueprintEnabled()
|
|
28321
28407
|
});
|
|
28322
28408
|
}
|
|
28323
28409
|
|
|
@@ -32792,7 +32878,8 @@ class Image360Viewer extends box3d_Box3DViewer {
|
|
|
32792
32878
|
createSubModules() {
|
|
32793
32879
|
this.controls = this.getViewerOption('useReactControls') ? new ControlsRoot({
|
|
32794
32880
|
containerEl: this.wrapperEl,
|
|
32795
|
-
fileId: this.options.file.id
|
|
32881
|
+
fileId: this.options.file.id,
|
|
32882
|
+
isBlueprintEnabled: this.isBlueprintEnabled()
|
|
32796
32883
|
}) : new box3d_Box3DControls(this.wrapperEl);
|
|
32797
32884
|
this.renderer = new image360_Image360Renderer(this.wrapperEl, this.boxSdk, {
|
|
32798
32885
|
api: this.api
|
|
@@ -33768,7 +33855,8 @@ class TextBaseViewer extends viewers_BaseViewer {
|
|
|
33768
33855
|
this.controls = new ControlsRoot({
|
|
33769
33856
|
containerEl: this.containerEl,
|
|
33770
33857
|
fileExtension: this.options.file.extension,
|
|
33771
|
-
fileId: this.options.file.id
|
|
33858
|
+
fileId: this.options.file.id,
|
|
33859
|
+
isBlueprintEnabled: this.isBlueprintEnabled()
|
|
33772
33860
|
});
|
|
33773
33861
|
this.bindDOMListeners();
|
|
33774
33862
|
this.renderUI();
|
|
@@ -38125,18 +38213,32 @@ function MP3ControlsRoot_toPropertyKey(t) { var i = MP3ControlsRoot_toPrimitive(
|
|
|
38125
38213
|
function MP3ControlsRoot_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); }
|
|
38126
38214
|
|
|
38127
38215
|
|
|
38216
|
+
|
|
38217
|
+
|
|
38128
38218
|
class MP3ControlsRoot {
|
|
38129
38219
|
constructor({
|
|
38130
|
-
containerEl
|
|
38220
|
+
containerEl,
|
|
38221
|
+
fileExtension,
|
|
38222
|
+
fileId,
|
|
38223
|
+
isBlueprintEnabled = false,
|
|
38224
|
+
resinFeature
|
|
38131
38225
|
}) {
|
|
38132
38226
|
MP3ControlsRoot_defineProperty(this, "containerEl", void 0);
|
|
38133
38227
|
MP3ControlsRoot_defineProperty(this, "controlsEl", void 0);
|
|
38228
|
+
MP3ControlsRoot_defineProperty(this, "isBlueprintEnabled", void 0);
|
|
38134
38229
|
MP3ControlsRoot_defineProperty(this, "root", void 0);
|
|
38135
38230
|
this.controlsEl = document.createElement('div');
|
|
38136
38231
|
this.controlsEl.setAttribute('class', 'bp-MP3ControlsRoot');
|
|
38137
38232
|
this.controlsEl.setAttribute('data-testid', 'bp-controls');
|
|
38233
|
+
this.controlsEl.setAttribute('data-resin-component', 'toolbar');
|
|
38234
|
+
if (resinFeature) {
|
|
38235
|
+
this.controlsEl.setAttribute('data-resin-feature', resinFeature);
|
|
38236
|
+
}
|
|
38237
|
+
this.controlsEl.setAttribute('data-resin-fileid', fileId != null ? String(fileId) : '');
|
|
38238
|
+
this.controlsEl.setAttribute('data-resin-fileextension', fileExtension || '');
|
|
38138
38239
|
this.containerEl = containerEl;
|
|
38139
38240
|
this.containerEl.appendChild(this.controlsEl);
|
|
38241
|
+
this.isBlueprintEnabled = isBlueprintEnabled;
|
|
38140
38242
|
this.root = __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7_createRoot__(this.controlsEl);
|
|
38141
38243
|
}
|
|
38142
38244
|
destroy() {
|
|
@@ -38146,7 +38248,9 @@ class MP3ControlsRoot {
|
|
|
38146
38248
|
}
|
|
38147
38249
|
}
|
|
38148
38250
|
render(controls) {
|
|
38149
|
-
this.root.render(
|
|
38251
|
+
this.root.render(this.isBlueprintEnabled ? /*#__PURE__*/external_react_["default"].createElement(BlueprintProviders, {
|
|
38252
|
+
container: this.containerEl
|
|
38253
|
+
}, controls) : controls);
|
|
38150
38254
|
}
|
|
38151
38255
|
}
|
|
38152
38256
|
// EXTERNAL MODULE: ./src/lib/viewers/media/waveform/constants.ts
|
|
@@ -38164,6 +38268,8 @@ var validateWaveformPayload = __webpack_require__(1053);
|
|
|
38164
38268
|
|
|
38165
38269
|
;// ./src/lib/viewers/media/MP3Viewer.js
|
|
38166
38270
|
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); }
|
|
38271
|
+
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; }
|
|
38272
|
+
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
38273
|
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
38274
|
function MP3Viewer_toPropertyKey(t) { var i = MP3Viewer_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
38169
38275
|
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 +38348,23 @@ function createLoadFailedError(message) {
|
|
|
38242
38348
|
class MP3Viewer extends media_MediaBaseViewer {
|
|
38243
38349
|
constructor(...args) {
|
|
38244
38350
|
super(...args);
|
|
38351
|
+
/**
|
|
38352
|
+
* One toolbar resin event.
|
|
38353
|
+
*
|
|
38354
|
+
* @param {string} target
|
|
38355
|
+
* @return {void}
|
|
38356
|
+
*/
|
|
38357
|
+
MP3Viewer_defineProperty(this, "recordToolbarAction", target => {
|
|
38358
|
+
const file = this.options.file || {};
|
|
38359
|
+
this.options.resin?.recordAction({
|
|
38360
|
+
action: 'programmatic',
|
|
38361
|
+
component: 'toolbar',
|
|
38362
|
+
feature: constants/* AUDIO_PLAYER_V2_RESIN_FEATURE */.dl,
|
|
38363
|
+
target,
|
|
38364
|
+
fileId: file.id,
|
|
38365
|
+
fileExtension: file.extension
|
|
38366
|
+
});
|
|
38367
|
+
});
|
|
38245
38368
|
/**
|
|
38246
38369
|
* @inheritdoc
|
|
38247
38370
|
*/
|
|
@@ -38510,14 +38633,68 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38510
38633
|
}
|
|
38511
38634
|
return super.onKeydown(key, event);
|
|
38512
38635
|
}
|
|
38636
|
+
/**
|
|
38637
|
+
* Route slider and settings programmatic events through the audio v2 feature.
|
|
38638
|
+
* Clicks pick the same feature up from data-resin-feature on the player root.
|
|
38639
|
+
*
|
|
38640
|
+
* @return {void}
|
|
38641
|
+
*/
|
|
38642
|
+
bindAudioPlayerV2Resin() {
|
|
38643
|
+
const host = this.options.resin;
|
|
38644
|
+
if (!this.isAudioPlayerV2 || !host || typeof host.recordAction !== 'function' || this.audioPlayerV2ResinHost) {
|
|
38645
|
+
return;
|
|
38646
|
+
}
|
|
38647
|
+
this.audioPlayerV2ResinHost = host;
|
|
38648
|
+
const wrapped = {
|
|
38649
|
+
recordAction: props => host.recordAction(MP3Viewer_objectSpread({
|
|
38650
|
+
feature: constants/* AUDIO_PLAYER_V2_RESIN_FEATURE */.dl
|
|
38651
|
+
}, props))
|
|
38652
|
+
};
|
|
38653
|
+
this.options.resin = wrapped;
|
|
38654
|
+
if (window.Box?.Preview) {
|
|
38655
|
+
window.Box.Preview.resin = wrapped;
|
|
38656
|
+
}
|
|
38657
|
+
}
|
|
38658
|
+
|
|
38659
|
+
/**
|
|
38660
|
+
* @return {void}
|
|
38661
|
+
*/
|
|
38662
|
+
unbindAudioPlayerV2Resin() {
|
|
38663
|
+
const host = this.audioPlayerV2ResinHost;
|
|
38664
|
+
if (!host) {
|
|
38665
|
+
return;
|
|
38666
|
+
}
|
|
38667
|
+
this.options.resin = host;
|
|
38668
|
+
if (window.Box?.Preview) {
|
|
38669
|
+
window.Box.Preview.resin = host;
|
|
38670
|
+
}
|
|
38671
|
+
this.audioPlayerV2ResinHost = null;
|
|
38672
|
+
}
|
|
38673
|
+
|
|
38674
|
+
/**
|
|
38675
|
+
* @return {MP3ControlsRoot}
|
|
38676
|
+
*/
|
|
38677
|
+
createControlsRoot() {
|
|
38678
|
+
this.bindAudioPlayerV2Resin();
|
|
38679
|
+
const file = this.options.file || {};
|
|
38680
|
+
return new MP3ControlsRoot({
|
|
38681
|
+
containerEl: this.mediaContainerEl,
|
|
38682
|
+
fileExtension: file.extension || '',
|
|
38683
|
+
fileId: file.id,
|
|
38684
|
+
isBlueprintEnabled: this.isBlueprintEnabled(),
|
|
38685
|
+
resinFeature: this.isAudioPlayerV2 ? constants/* AUDIO_PLAYER_V2_RESIN_FEATURE */.dl : undefined
|
|
38686
|
+
});
|
|
38687
|
+
}
|
|
38513
38688
|
handleKeydownAudioV2(key, event) {
|
|
38514
38689
|
const decoded = (key || '').toLowerCase();
|
|
38515
38690
|
const altKey = !!(event && event.altKey);
|
|
38516
38691
|
switch (decoded) {
|
|
38517
38692
|
case 'space':
|
|
38693
|
+
this.recordToolbarAction('playPause');
|
|
38518
38694
|
this.toggleV2Play();
|
|
38519
38695
|
return true;
|
|
38520
38696
|
case 'k':
|
|
38697
|
+
this.recordToolbarAction('playPause');
|
|
38521
38698
|
this.exitShuttle();
|
|
38522
38699
|
this.pause(undefined, true);
|
|
38523
38700
|
return true;
|
|
@@ -38528,15 +38705,19 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38528
38705
|
this.shuttle('forward');
|
|
38529
38706
|
return true;
|
|
38530
38707
|
case 'arrowleft':
|
|
38708
|
+
this.recordToolbarAction('seekBackward');
|
|
38531
38709
|
this.quickSeek(-AUDIO_V2_SKIP_SEC);
|
|
38532
38710
|
return true;
|
|
38533
38711
|
case 'arrowright':
|
|
38712
|
+
this.recordToolbarAction('seekForward');
|
|
38534
38713
|
this.quickSeek(AUDIO_V2_SKIP_SEC);
|
|
38535
38714
|
return true;
|
|
38536
38715
|
case ',':
|
|
38716
|
+
this.recordToolbarAction('frameBackward');
|
|
38537
38717
|
this.frameStep('back');
|
|
38538
38718
|
return true;
|
|
38539
38719
|
case '.':
|
|
38720
|
+
this.recordToolbarAction('frameForward');
|
|
38540
38721
|
this.frameStep('forward');
|
|
38541
38722
|
return true;
|
|
38542
38723
|
case 'arrowup':
|
|
@@ -38557,17 +38738,25 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38557
38738
|
if (!this.mediaEl || !Number.isFinite(this.mediaEl.duration)) {
|
|
38558
38739
|
return false;
|
|
38559
38740
|
}
|
|
38741
|
+
this.recordToolbarAction('seekEnd');
|
|
38560
38742
|
this.exitShuttle();
|
|
38561
38743
|
this.setMediaTime(this.mediaEl.duration);
|
|
38562
38744
|
return true;
|
|
38563
38745
|
case '0':
|
|
38564
38746
|
case 'home':
|
|
38747
|
+
this.recordToolbarAction('seekStart');
|
|
38565
38748
|
this.exitShuttle();
|
|
38566
38749
|
return false;
|
|
38750
|
+
case 'm':
|
|
38751
|
+
case 'shift+m':
|
|
38752
|
+
this.recordToolbarAction('volumeToggle');
|
|
38753
|
+
return false;
|
|
38567
38754
|
case 'shift+arrowleft':
|
|
38755
|
+
this.recordToolbarAction('skipBackward');
|
|
38568
38756
|
this.quickSeek(-AUDIO_V2_SHIFT_SKIP_SEC);
|
|
38569
38757
|
return true;
|
|
38570
38758
|
case 'shift+arrowright':
|
|
38759
|
+
this.recordToolbarAction('skipForward');
|
|
38571
38760
|
this.quickSeek(AUDIO_V2_SHIFT_SKIP_SEC);
|
|
38572
38761
|
return true;
|
|
38573
38762
|
case 'i':
|
|
@@ -38580,10 +38769,12 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38580
38769
|
case 'shift++':
|
|
38581
38770
|
case '+':
|
|
38582
38771
|
case '=':
|
|
38772
|
+
this.recordToolbarAction('waveformZoomIn');
|
|
38583
38773
|
this.stepKeyboardZoom(1);
|
|
38584
38774
|
return true;
|
|
38585
38775
|
case '-':
|
|
38586
38776
|
case 'shift+_':
|
|
38777
|
+
this.recordToolbarAction('waveformZoomOut');
|
|
38587
38778
|
this.stepKeyboardZoom(-1);
|
|
38588
38779
|
return true;
|
|
38589
38780
|
default:
|
|
@@ -38604,6 +38795,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38604
38795
|
if ((0,useTapeWaveform/* isTapeWaveformInput */.MQ)()) {
|
|
38605
38796
|
return;
|
|
38606
38797
|
}
|
|
38798
|
+
this.recordToolbarAction(direction === 'forward' ? 'shuttleForward' : 'shuttleReverse');
|
|
38607
38799
|
const sameDirection = this.shuttleDirection === direction;
|
|
38608
38800
|
const rate = nextShuttleRate(this.shuttleRate, sameDirection);
|
|
38609
38801
|
if (direction === 'forward') {
|
|
@@ -38697,9 +38889,11 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38697
38889
|
if (!target || target.id === this.hostSelectedMarkerId) {
|
|
38698
38890
|
return;
|
|
38699
38891
|
}
|
|
38892
|
+
this.recordToolbarAction(direction < 0 ? 'commentMarkerPrevious' : 'commentMarkerNext');
|
|
38700
38893
|
this.handleCommentMarkerClick(target);
|
|
38701
38894
|
}
|
|
38702
38895
|
stepKeyboardVolume(direction) {
|
|
38896
|
+
this.recordToolbarAction('volumeSlider');
|
|
38703
38897
|
this.keyboardVolumeStep += 1;
|
|
38704
38898
|
if (direction > 0) {
|
|
38705
38899
|
this.increaseVolume();
|
|
@@ -38741,6 +38935,10 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38741
38935
|
*/
|
|
38742
38936
|
fallbackToV1Controls() {
|
|
38743
38937
|
this.isAudioPlayerV2 = false;
|
|
38938
|
+
this.unbindAudioPlayerV2Resin();
|
|
38939
|
+
if (this.controls && this.controls.controlsEl) {
|
|
38940
|
+
this.controls.controlsEl.removeAttribute('data-resin-feature');
|
|
38941
|
+
}
|
|
38744
38942
|
this.abortWaveformLoads();
|
|
38745
38943
|
if (this.wrapperEl) {
|
|
38746
38944
|
this.wrapperEl.classList.remove('bp-media--v2');
|
|
@@ -38788,6 +38986,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38788
38986
|
this.shuttleDirection = null;
|
|
38789
38987
|
this.shuttleRate = 0;
|
|
38790
38988
|
this.abortWaveformLoads();
|
|
38989
|
+
this.unbindAudioPlayerV2Resin();
|
|
38791
38990
|
super.destroy();
|
|
38792
38991
|
}
|
|
38793
38992
|
|
|
@@ -38817,9 +39016,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
38817
39016
|
showAudioLoadingShell() {
|
|
38818
39017
|
this.showMedia();
|
|
38819
39018
|
if (!this.controls) {
|
|
38820
|
-
this.controls =
|
|
38821
|
-
containerEl: this.mediaContainerEl
|
|
38822
|
-
});
|
|
39019
|
+
this.controls = this.createControlsRoot();
|
|
38823
39020
|
}
|
|
38824
39021
|
this.ensureV2Controls().then(Mp3ControlsV2 => {
|
|
38825
39022
|
if (this.destroyed) {
|
|
@@ -39201,9 +39398,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
39201
39398
|
loadUIReact() {
|
|
39202
39399
|
super.loadUIReact();
|
|
39203
39400
|
if (!this.controls) {
|
|
39204
|
-
this.controls =
|
|
39205
|
-
containerEl: this.mediaContainerEl
|
|
39206
|
-
});
|
|
39401
|
+
this.controls = this.createControlsRoot();
|
|
39207
39402
|
}
|
|
39208
39403
|
this.bindCommentMarkersListener();
|
|
39209
39404
|
this.bindCommentRangeDraftListeners();
|
|
@@ -39461,6 +39656,7 @@ class MP3Viewer extends media_MediaBaseViewer {
|
|
|
39461
39656
|
onCommentRangeDragChange: this.handleCommentRangeDragChange,
|
|
39462
39657
|
onCommentRangeDragCreate: this.getCanCreateComment() ? this.handleCommentRangeDragCreate : undefined,
|
|
39463
39658
|
onPlayheadComment: this.getCanCreateComment() ? this.handlePlayheadComment : undefined,
|
|
39659
|
+
onResinAction: this.recordToolbarAction,
|
|
39464
39660
|
onPlayNextChange: this.setPlayNext,
|
|
39465
39661
|
peaks: this.waveformPeaks,
|
|
39466
39662
|
playNext: this.isPlayNextEnabled(),
|
|
@@ -40457,6 +40653,7 @@ class VideoBaseViewer extends media_MediaBaseViewer {
|
|
|
40457
40653
|
className: 'bp-VideoControlsRoot',
|
|
40458
40654
|
containerEl: controlsContainerEl,
|
|
40459
40655
|
fileId: this.options.file.id,
|
|
40656
|
+
isBlueprintEnabled: this.isBlueprintEnabled(),
|
|
40460
40657
|
onHide: this.handleControlsHide,
|
|
40461
40658
|
onShow: this.handleControlsShow
|
|
40462
40659
|
});
|
|
@@ -44230,6 +44427,107 @@ function DocControls({
|
|
|
44230
44427
|
onAnnotationColorChange: onAnnotationColorChange
|
|
44231
44428
|
})));
|
|
44232
44429
|
}
|
|
44430
|
+
;// ./src/lib/viewers/controls/controls-bar/ControlsBarV2.tsx
|
|
44431
|
+
const ControlsBarV2_excluded = ["children"];
|
|
44432
|
+
function ControlsBarV2_extends() { return ControlsBarV2_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; }, ControlsBarV2_extends.apply(null, arguments); }
|
|
44433
|
+
function ControlsBarV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsBarV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
44434
|
+
function ControlsBarV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
44435
|
+
|
|
44436
|
+
|
|
44437
|
+
function ControlsBarV2(_ref) {
|
|
44438
|
+
let {
|
|
44439
|
+
children
|
|
44440
|
+
} = _ref,
|
|
44441
|
+
rest = ControlsBarV2_objectWithoutProperties(_ref, ControlsBarV2_excluded);
|
|
44442
|
+
if (!children) {
|
|
44443
|
+
return null;
|
|
44444
|
+
}
|
|
44445
|
+
return /*#__PURE__*/external_react_["default"].createElement(__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9_Toolbar__.Root, ControlsBarV2_extends({
|
|
44446
|
+
"data-testid": "bp-ControlsBar"
|
|
44447
|
+
}, rest), children);
|
|
44448
|
+
}
|
|
44449
|
+
;// ./src/lib/viewers/doc/DocControlsV2.tsx
|
|
44450
|
+
|
|
44451
|
+
|
|
44452
|
+
|
|
44453
|
+
|
|
44454
|
+
|
|
44455
|
+
|
|
44456
|
+
|
|
44457
|
+
|
|
44458
|
+
|
|
44459
|
+
|
|
44460
|
+
|
|
44461
|
+
|
|
44462
|
+
function DocControlsV2({
|
|
44463
|
+
annotationColor,
|
|
44464
|
+
annotationMode,
|
|
44465
|
+
experiences,
|
|
44466
|
+
hasDrawing,
|
|
44467
|
+
hasGalleryZoom = false,
|
|
44468
|
+
hasHighlight,
|
|
44469
|
+
hasRegion,
|
|
44470
|
+
isGalleryOpen,
|
|
44471
|
+
isThumbnailsOpen,
|
|
44472
|
+
maxScale,
|
|
44473
|
+
minScale,
|
|
44474
|
+
onAnnotationColorChange,
|
|
44475
|
+
onAnnotationModeClick,
|
|
44476
|
+
onAnnotationModeEscape,
|
|
44477
|
+
onFindBarToggle,
|
|
44478
|
+
onFullscreenToggle,
|
|
44479
|
+
onGalleryToggle,
|
|
44480
|
+
onPageChange,
|
|
44481
|
+
onPageSubmit,
|
|
44482
|
+
onRotateLeft,
|
|
44483
|
+
onThumbnailsToggle,
|
|
44484
|
+
onZoomIn,
|
|
44485
|
+
onZoomOut,
|
|
44486
|
+
pageCount,
|
|
44487
|
+
pageNumber,
|
|
44488
|
+
scale
|
|
44489
|
+
}) {
|
|
44490
|
+
return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
|
|
44491
|
+
experiences: experiences
|
|
44492
|
+
}, /*#__PURE__*/external_react_["default"].createElement(ControlsBarV2, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggle, {
|
|
44493
|
+
isThumbnailsOpen: isThumbnailsOpen,
|
|
44494
|
+
onThumbnailsToggle: onThumbnailsToggle
|
|
44495
|
+
}), /*#__PURE__*/external_react_["default"].createElement(FindBarToggle, {
|
|
44496
|
+
onFindBarToggle: onFindBarToggle
|
|
44497
|
+
}), /*#__PURE__*/external_react_["default"].createElement(PageControls, {
|
|
44498
|
+
onPageChange: onPageChange,
|
|
44499
|
+
onPageSubmit: onPageSubmit,
|
|
44500
|
+
pageCount: pageCount,
|
|
44501
|
+
pageNumber: pageNumber
|
|
44502
|
+
})), (!isGalleryOpen || hasGalleryZoom) && /*#__PURE__*/external_react_["default"].createElement(ZoomControls, {
|
|
44503
|
+
maxScale: maxScale,
|
|
44504
|
+
minScale: minScale,
|
|
44505
|
+
onZoomIn: onZoomIn,
|
|
44506
|
+
onZoomOut: onZoomOut,
|
|
44507
|
+
resinTargetZoomIn: isGalleryOpen ? 'galleryZoomIn' : undefined,
|
|
44508
|
+
resinTargetZoomOut: isGalleryOpen ? 'galleryZoomOut' : undefined,
|
|
44509
|
+
scale: scale
|
|
44510
|
+
}), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(RotateControl, {
|
|
44511
|
+
onRotateLeft: onRotateLeft
|
|
44512
|
+
}), /*#__PURE__*/external_react_["default"].createElement(GalleryToggle, {
|
|
44513
|
+
isGalleryOpen: isGalleryOpen,
|
|
44514
|
+
onGalleryToggle: onGalleryToggle
|
|
44515
|
+
}), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggle, {
|
|
44516
|
+
onFullscreenToggle: onFullscreenToggle
|
|
44517
|
+
}), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(AnnotationsControls, {
|
|
44518
|
+
annotationColor: annotationColor,
|
|
44519
|
+
annotationMode: annotationMode,
|
|
44520
|
+
hasDrawing: hasDrawing,
|
|
44521
|
+
hasHighlight: hasHighlight,
|
|
44522
|
+
hasRegion: hasRegion,
|
|
44523
|
+
onAnnotationModeClick: onAnnotationModeClick,
|
|
44524
|
+
onAnnotationModeEscape: onAnnotationModeEscape
|
|
44525
|
+
})), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, /*#__PURE__*/external_react_["default"].createElement(DrawingControls, {
|
|
44526
|
+
annotationColor: annotationColor,
|
|
44527
|
+
annotationMode: annotationMode,
|
|
44528
|
+
onAnnotationColorChange: onAnnotationColorChange
|
|
44529
|
+
})));
|
|
44530
|
+
}
|
|
44233
44531
|
;// ./src/lib/icons/search.svg
|
|
44234
44532
|
const search_namespaceObject = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 15 14\" focusable=\"false\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M-2-3h20v20H-2z\"/>\n <path class=\"icon\" fill=\"#FFF\" d=\"M6.931 0a5.994 5.994 0 0 1 4.907 9.438l2.806 2.807a1 1 0 0 1 0 1.415l-.047.047a1 1 0 0 1-1.414 0L10.375 10.9A5.994 5.994 0 1 1 6.931 0zm0 1.998a3.996 3.996 0 1 0 0 7.992 3.996 3.996 0 0 0 0-7.992z\"/>\n </g>\n</svg>\n";
|
|
44235
44533
|
;// ./src/lib/icons/arrow_drop_up.svg
|
|
@@ -47810,6 +48108,7 @@ function DocBaseViewer_toPrimitive(t, r) { if ("object" != typeof t || !t) retur
|
|
|
47810
48108
|
|
|
47811
48109
|
|
|
47812
48110
|
|
|
48111
|
+
|
|
47813
48112
|
|
|
47814
48113
|
|
|
47815
48114
|
const DOC_FIRST_PAGES_ENABLED = 'docFirstPages.enabled';
|
|
@@ -49169,7 +49468,8 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
49169
49468
|
this.controls = new ControlsRoot({
|
|
49170
49469
|
containerEl: this.containerEl,
|
|
49171
49470
|
fileExtension: this.options.file.extension,
|
|
49172
|
-
fileId: this.options.file.id
|
|
49471
|
+
fileId: this.options.file.id,
|
|
49472
|
+
isBlueprintEnabled: this.isBlueprintEnabled()
|
|
49173
49473
|
});
|
|
49174
49474
|
this.annotationControlsFSM.subscribe(() => this.renderUI());
|
|
49175
49475
|
this.renderUI();
|
|
@@ -49207,7 +49507,8 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
49207
49507
|
const canRotate = this.featureEnabled('rotate.enabled');
|
|
49208
49508
|
const canGallery = !this.isMobile && this.galleryController.canRender(this.pdfViewer.pagesCount);
|
|
49209
49509
|
const isGalleryZoomActive = this.galleryController.isOpen && this.galleryController.isEnhancedGalleryEnabled;
|
|
49210
|
-
this.
|
|
49510
|
+
const Controls = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ) ? DocControlsV2 : DocControls;
|
|
49511
|
+
this.controls.render(/*#__PURE__*/external_react_["default"].createElement(Controls, {
|
|
49211
49512
|
annotationColor: this.annotationModule.getColor(),
|
|
49212
49513
|
annotationMode: this.annotationControlsFSM.getMode(),
|
|
49213
49514
|
experiences: this.experiences,
|
|
@@ -54113,7 +54414,8 @@ class Model3DViewer extends box3d_Box3DViewer {
|
|
|
54113
54414
|
createSubModules() {
|
|
54114
54415
|
this.controls = this.getViewerOption('useReactControls') ? new ControlsRoot({
|
|
54115
54416
|
containerEl: this.wrapperEl,
|
|
54116
|
-
fileId: this.options.file.id
|
|
54417
|
+
fileId: this.options.file.id,
|
|
54418
|
+
isBlueprintEnabled: this.isBlueprintEnabled()
|
|
54117
54419
|
}) : new model3d_Model3DControls(this.wrapperEl);
|
|
54118
54420
|
this.renderer = new model3d_Model3DRenderer(this.wrapperEl, this.boxSdk, {
|
|
54119
54421
|
api: this.api
|
|
@@ -55080,6 +55382,79 @@ office_OfficeLoader,
|
|
|
55080
55382
|
doc_DocLoader,
|
|
55081
55383
|
// should come after text
|
|
55082
55384
|
swf_SWFLoader, video360_Video360Loader, media_MediaLoader, image360_Image360Loader, image_ImageLoader, model3d_Model3DLoader, iframe_IFrameLoader]);
|
|
55385
|
+
;// ./src/lib/ComparisonBanner.tsx
|
|
55386
|
+
function ComparisonBanner_defineProperty(e, r, t) { return (r = ComparisonBanner_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
55387
|
+
function ComparisonBanner_toPropertyKey(t) { var i = ComparisonBanner_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
55388
|
+
function ComparisonBanner_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); }
|
|
55389
|
+
|
|
55390
|
+
|
|
55391
|
+
|
|
55392
|
+
function formatComparisonTimestamp(iso, locale) {
|
|
55393
|
+
if (!iso) {
|
|
55394
|
+
return '';
|
|
55395
|
+
}
|
|
55396
|
+
const date = new Date(iso);
|
|
55397
|
+
if (Number.isNaN(date.getTime())) {
|
|
55398
|
+
return '';
|
|
55399
|
+
}
|
|
55400
|
+
return new Intl.DateTimeFormat(locale || 'en-US', {
|
|
55401
|
+
month: 'short',
|
|
55402
|
+
day: 'numeric',
|
|
55403
|
+
hour: 'numeric',
|
|
55404
|
+
minute: '2-digit'
|
|
55405
|
+
}).format(date);
|
|
55406
|
+
}
|
|
55407
|
+
function getComparisonBannerAuthor(file = {}) {
|
|
55408
|
+
return file.modified_by?.name || file.created_by?.name || '';
|
|
55409
|
+
}
|
|
55410
|
+
function ComparisonBanner({
|
|
55411
|
+
file = {},
|
|
55412
|
+
isComparedPreview = false,
|
|
55413
|
+
locale
|
|
55414
|
+
}) {
|
|
55415
|
+
const versionNumber = file.version_number != null && file.version_number !== '' ? String(file.version_number) : '';
|
|
55416
|
+
const timestamp = formatComparisonTimestamp(file.modified_at, locale);
|
|
55417
|
+
const author = getComparisonBannerAuthor(file);
|
|
55418
|
+
if (!versionNumber && !timestamp && !author) {
|
|
55419
|
+
return null;
|
|
55420
|
+
}
|
|
55421
|
+
return /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
55422
|
+
"aria-label": isComparedPreview ? "Previous version" : "Current version",
|
|
55423
|
+
className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on,
|
|
55424
|
+
role: "status"
|
|
55425
|
+
}, versionNumber && /*#__PURE__*/external_react_["default"].createElement("span", {
|
|
55426
|
+
className: "bp-version-banner-badge"
|
|
55427
|
+
}, versionNumber), (timestamp || author) && /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
55428
|
+
className: "bp-version-banner-info"
|
|
55429
|
+
}, timestamp && /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
55430
|
+
className: "bp-version-banner-time"
|
|
55431
|
+
}, timestamp), author && /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
55432
|
+
className: "bp-version-banner-author"
|
|
55433
|
+
}, author)));
|
|
55434
|
+
}
|
|
55435
|
+
class ComparisonBannerRoot {
|
|
55436
|
+
constructor(containerEl) {
|
|
55437
|
+
ComparisonBanner_defineProperty(this, "hostEl", void 0);
|
|
55438
|
+
ComparisonBanner_defineProperty(this, "root", void 0);
|
|
55439
|
+
this.hostEl = document.createElement('div');
|
|
55440
|
+
containerEl.insertBefore(this.hostEl, containerEl.firstChild);
|
|
55441
|
+
this.root = __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7_createRoot__(this.hostEl);
|
|
55442
|
+
}
|
|
55443
|
+
render(file = {}, {
|
|
55444
|
+
isComparedPreview = false,
|
|
55445
|
+
locale
|
|
55446
|
+
} = {}) {
|
|
55447
|
+
this.root.render(/*#__PURE__*/external_react_["default"].createElement(ComparisonBanner, {
|
|
55448
|
+
file: file,
|
|
55449
|
+
isComparedPreview: isComparedPreview,
|
|
55450
|
+
locale: locale
|
|
55451
|
+
}));
|
|
55452
|
+
}
|
|
55453
|
+
destroy() {
|
|
55454
|
+
this.root.unmount();
|
|
55455
|
+
this.hostEl.remove();
|
|
55456
|
+
}
|
|
55457
|
+
}
|
|
55083
55458
|
;// external "box-ui-elements/es/components/preview"
|
|
55084
55459
|
|
|
55085
55460
|
;// ./src/lib/viewers/error/ErrorIcon.tsx
|
|
@@ -55830,6 +56205,7 @@ function Preview_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; v
|
|
|
55830
56205
|
|
|
55831
56206
|
|
|
55832
56207
|
|
|
56208
|
+
|
|
55833
56209
|
const DEFAULT_DISABLED_VIEWERS = ['Office']; // viewers disabled by default
|
|
55834
56210
|
const PREFETCH_COUNT = 4; // number of files to prefetch
|
|
55835
56211
|
const MOUSEMOVE_THROTTLE_MS = 1500; // for showing or hiding the navigation icons
|
|
@@ -55898,6 +56274,8 @@ class Preview extends (events_default()) {
|
|
|
55898
56274
|
Preview_defineProperty(this, "retryTimeout", void 0);
|
|
55899
56275
|
/** @property {HTMLElement} - Preview DOM container */
|
|
55900
56276
|
Preview_defineProperty(this, "container", void 0);
|
|
56277
|
+
/** @property {ComparisonBannerRoot} - Version comparison banner */
|
|
56278
|
+
Preview_defineProperty(this, "comparisonBannerRoot", void 0);
|
|
55901
56279
|
/** @property {Function} - Throttled mousemove handler */
|
|
55902
56280
|
Preview_defineProperty(this, "throttledMousemoveHandler", void 0);
|
|
55903
56281
|
/** @property {Cache} - Preview's cache instance */
|
|
@@ -56037,6 +56415,7 @@ class Preview extends (events_default()) {
|
|
|
56037
56415
|
if (this.perf) {
|
|
56038
56416
|
this.perf.destroy();
|
|
56039
56417
|
}
|
|
56418
|
+
this.destroyComparisonBanner();
|
|
56040
56419
|
|
|
56041
56420
|
// Clean the UI
|
|
56042
56421
|
this.ui.cleanup();
|
|
@@ -56721,11 +57100,14 @@ class Preview extends (events_default()) {
|
|
|
56721
57100
|
* @return {void}
|
|
56722
57101
|
*/
|
|
56723
57102
|
setupUI() {
|
|
57103
|
+
this.destroyComparisonBanner();
|
|
57104
|
+
|
|
56724
57105
|
// Setup the shell
|
|
56725
57106
|
this.container = this.ui.setup(this.options, this.keydownHandler, this.navigateLeft, this.navigateRight, this.throttledMousemoveHandler);
|
|
56726
57107
|
|
|
56727
57108
|
// Set up the notification
|
|
56728
57109
|
this.ui.setupNotification();
|
|
57110
|
+
this.updateComparisonBanner();
|
|
56729
57111
|
|
|
56730
57112
|
// Update navigation
|
|
56731
57113
|
this.ui.showNavigation(this.file.id, this.collection);
|
|
@@ -56739,6 +57121,67 @@ class Preview extends (events_default()) {
|
|
|
56739
57121
|
lib_Timer.start(previewDurationTag);
|
|
56740
57122
|
}
|
|
56741
57123
|
|
|
57124
|
+
/**
|
|
57125
|
+
* @public
|
|
57126
|
+
* @param {Object} [mode]
|
|
57127
|
+
* @param {boolean} [mode.isComparing] - This Preview is in a comparison (not “current pane”)
|
|
57128
|
+
* @param {boolean} [mode.isComparedPreview] - Compared (previous version) pane; implies isComparing
|
|
57129
|
+
* @return {void}
|
|
57130
|
+
*/
|
|
57131
|
+
setComparisonMode(mode = {}) {
|
|
57132
|
+
if ('isComparedPreview' in mode) {
|
|
57133
|
+
this.options.isComparedPreview = !!mode.isComparedPreview;
|
|
57134
|
+
}
|
|
57135
|
+
if ('isComparing' in mode) {
|
|
57136
|
+
this.options.isComparing = !!mode.isComparing;
|
|
57137
|
+
}
|
|
57138
|
+
if (this.options.isComparedPreview) {
|
|
57139
|
+
this.options.isComparing = true;
|
|
57140
|
+
}
|
|
57141
|
+
this.updateComparisonBanner();
|
|
57142
|
+
}
|
|
57143
|
+
|
|
57144
|
+
/**
|
|
57145
|
+
* @private
|
|
57146
|
+
* @return {void}
|
|
57147
|
+
*/
|
|
57148
|
+
updateComparisonBanner() {
|
|
57149
|
+
const {
|
|
57150
|
+
comparisonBanner,
|
|
57151
|
+
isComparing
|
|
57152
|
+
} = this.options;
|
|
57153
|
+
const isComparedPreview = !!this.options.isComparedPreview;
|
|
57154
|
+
if (!isComparing && !isComparedPreview) {
|
|
57155
|
+
this.destroyComparisonBanner();
|
|
57156
|
+
return;
|
|
57157
|
+
}
|
|
57158
|
+
if (!this.container) {
|
|
57159
|
+
return;
|
|
57160
|
+
}
|
|
57161
|
+
if (!this.comparisonBannerRoot) {
|
|
57162
|
+
this.comparisonBannerRoot = new ComparisonBannerRoot(this.container);
|
|
57163
|
+
}
|
|
57164
|
+
const {
|
|
57165
|
+
currentFileVersion,
|
|
57166
|
+
previousFileVersion
|
|
57167
|
+
} = comparisonBanner || {};
|
|
57168
|
+
this.comparisonBannerRoot.render(isComparedPreview ? previousFileVersion : currentFileVersion, {
|
|
57169
|
+
isComparedPreview,
|
|
57170
|
+
locale: (0,util/* getProp */.GT)(this.location, 'locale')
|
|
57171
|
+
});
|
|
57172
|
+
}
|
|
57173
|
+
|
|
57174
|
+
/**
|
|
57175
|
+
* @private
|
|
57176
|
+
* @return {void}
|
|
57177
|
+
*/
|
|
57178
|
+
destroyComparisonBanner() {
|
|
57179
|
+
if (this.comparisonBannerRoot) {
|
|
57180
|
+
this.comparisonBannerRoot.destroy();
|
|
57181
|
+
this.comparisonBannerRoot = undefined;
|
|
57182
|
+
}
|
|
57183
|
+
}
|
|
57184
|
+
|
|
56742
57185
|
/**
|
|
56743
57186
|
* Parses preview options.
|
|
56744
57187
|
*
|
|
@@ -56866,6 +57309,11 @@ class Preview extends (events_default()) {
|
|
|
56866
57309
|
// Options that are applicable to certain file ids
|
|
56867
57310
|
this.options.fileOptions = options.fileOptions || {};
|
|
56868
57311
|
|
|
57312
|
+
// isComparing = in a comparison; isComparedPreview = compared pane (implies isComparing)
|
|
57313
|
+
this.options.comparisonBanner = options.comparisonBanner || {};
|
|
57314
|
+
this.options.isComparedPreview = !!options.isComparedPreview;
|
|
57315
|
+
this.options.isComparing = !!options.isComparing || this.options.isComparedPreview;
|
|
57316
|
+
|
|
56869
57317
|
// Option to enable use of thumbnails sidebar for document types
|
|
56870
57318
|
this.options.enableThumbnailsSidebar = !!options.enableThumbnailsSidebar;
|
|
56871
57319
|
|