box-content-preview 3.69.0 → 3.70.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.js +58 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://mergify.io)
|
|
3
3
|
[](https://github.com/prettier/prettier)
|
|
4
4
|
[](https://travis-ci.org/box/box-content-preview)
|
|
5
|
-
[](https://github.com/box/box-content-preview)
|
|
6
6
|
[](https://www.npmjs.com/package/box-ui-elements)
|
|
7
7
|
|
|
8
8
|
# [Box Content Preview](https://developer.box.com/docs/box-content-preview)
|
|
@@ -22,11 +22,11 @@ We encourage all users to update their applications to utilize modern browsers f
|
|
|
22
22
|
|
|
23
23
|
## Current Version
|
|
24
24
|
|
|
25
|
-
- Version: v3.
|
|
25
|
+
- Version: v3.70.0
|
|
26
26
|
- Locale: en-US
|
|
27
27
|
|
|
28
|
-
https://cdn01.boxcdn.net/platform/preview/3.
|
|
29
|
-
https://cdn01.boxcdn.net/platform/preview/3.
|
|
28
|
+
https://cdn01.boxcdn.net/platform/preview/3.70.0/en-US/preview.js
|
|
29
|
+
https://cdn01.boxcdn.net/platform/preview/3.70.0/en-US/preview.css
|
|
30
30
|
|
|
31
31
|
## Supported Locales
|
|
32
32
|
|
|
@@ -52,10 +52,10 @@ You can self-host the Box Content Preview library or reference the versions avai
|
|
|
52
52
|
<title>Box Content Preview Demo</title>
|
|
53
53
|
|
|
54
54
|
<!-- Latest version of Preview SDK for your locale -->
|
|
55
|
-
<script src="https://cdn01.boxcdn.net/platform/preview/3.
|
|
55
|
+
<script src="https://cdn01.boxcdn.net/platform/preview/3.70.0/en-US/preview.js"></script>
|
|
56
56
|
<link
|
|
57
57
|
rel="stylesheet"
|
|
58
|
-
href="https://cdn01.boxcdn.net/platform/preview/3.
|
|
58
|
+
href="https://cdn01.boxcdn.net/platform/preview/3.70.0/en-US/preview.css"
|
|
59
59
|
/>
|
|
60
60
|
</head>
|
|
61
61
|
<body>
|
|
@@ -76,7 +76,7 @@ To self-host the Box Content Preview library, follow these steps:
|
|
|
76
76
|
|
|
77
77
|
1. Either fork the repo and check out the version you want to host or download the specific version as a zip:
|
|
78
78
|
|
|
79
|
-
- Check out a specific version with `git checkout v3.
|
|
79
|
+
- Check out a specific version with `git checkout v3.70.0`
|
|
80
80
|
- Download a specific version as a zip from https://github.com/box/box-content-preview/releases
|
|
81
81
|
|
|
82
82
|
2. Install dependencies and build the library with `yarn install && yarn build:i18n && yarn build:prod`
|
package/dist/lib/index.js
CHANGED
|
@@ -17387,6 +17387,15 @@ const USER_DOCUMENT_THUMBNAIL_EVENTS = {
|
|
|
17387
17387
|
NAVIGATE: 'user_document_thumbnails_navigate',
|
|
17388
17388
|
OPEN: 'user_document_thumbnails_open'
|
|
17389
17389
|
};
|
|
17390
|
+
|
|
17391
|
+
// Events fired when using gallery view
|
|
17392
|
+
const USER_DOCUMENT_GALLERY_EVENTS = {
|
|
17393
|
+
DISMISS: 'user_document_gallery_dismiss',
|
|
17394
|
+
// The gallery closes without the user settling on a page
|
|
17395
|
+
NAVIGATE: 'user_document_gallery_navigate',
|
|
17396
|
+
// The user picks a page, or closes on one they browsed to
|
|
17397
|
+
OPEN: 'user_document_gallery_open' // The user opens the gallery
|
|
17398
|
+
};
|
|
17390
17399
|
const MISSING_EXTERNAL_REFS = 'missing_x_refs';
|
|
17391
17400
|
const MEDIA_METRIC = {
|
|
17392
17401
|
bufferFill: 'bufferFill',
|
|
@@ -17416,7 +17425,7 @@ function util_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
17416
17425
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
17417
17426
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
17418
17427
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
17419
|
-
const CLIENT_VERSION = "3.
|
|
17428
|
+
const CLIENT_VERSION = "3.70.0"; // eslint-disable-line no-undef
|
|
17420
17429
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
17421
17430
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
17422
17431
|
const PROMISE_MAP = {};
|
|
@@ -19141,7 +19150,7 @@ class Browser {
|
|
|
19141
19150
|
;// ./src/lib/Logger.js
|
|
19142
19151
|
/* eslint-disable no-undef */
|
|
19143
19152
|
const Logger_CLIENT_NAME = "box-content-preview";
|
|
19144
|
-
const Logger_CLIENT_VERSION = "3.
|
|
19153
|
+
const Logger_CLIENT_VERSION = "3.70.0";
|
|
19145
19154
|
/* eslint-enable no-undef */
|
|
19146
19155
|
|
|
19147
19156
|
class Logger {
|
|
@@ -24627,13 +24636,13 @@ const ImageLoader_VIEWERS = [{
|
|
|
24627
24636
|
NAME: 'Image',
|
|
24628
24637
|
CONSTRUCTOR: image_ImageViewer,
|
|
24629
24638
|
REP: 'jpg',
|
|
24630
|
-
EXT: ['jpeg', 'jpg', 'cr2', 'crw', 'dng', 'nef', 'raf', 'raw'],
|
|
24639
|
+
EXT: ['jpeg', 'jpg', 'cr2', 'cr3', 'crw', 'dng', 'nef', 'raf', 'raw'],
|
|
24631
24640
|
ASSET: '1.jpg'
|
|
24632
24641
|
}, {
|
|
24633
24642
|
NAME: 'Image',
|
|
24634
24643
|
CONSTRUCTOR: image_ImageViewer,
|
|
24635
24644
|
REP: 'png',
|
|
24636
|
-
EXT: ['ai', 'bmp', 'dcm', 'eps', 'gif', 'heic', 'png', 'ps', 'psd', 'tga', 'tif', 'tiff', 'webp'],
|
|
24645
|
+
EXT: ['ai', 'avif', 'bmp', 'dcm', 'eps', 'gif', 'heic', 'png', 'ps', 'psd', 'tga', 'tif', 'tiff', 'webp'],
|
|
24637
24646
|
ASSET: '1.png'
|
|
24638
24647
|
}];
|
|
24639
24648
|
class ImageLoader extends viewers_AssetLoader {
|
|
@@ -39742,6 +39751,7 @@ const GalleryTile = /*#__PURE__*/__WEBPACK_EXTERNAL_MODULE_react_default__.memo(
|
|
|
39742
39751
|
"aria-selected": isFocused,
|
|
39743
39752
|
className: `bp-gallery-tile${isFocused ? ' bp-gallery-tile--selected' : ''}`,
|
|
39744
39753
|
"data-page": pageNum,
|
|
39754
|
+
"data-resin-target": "galleryTile",
|
|
39745
39755
|
onClick: () => onClick(pageNum),
|
|
39746
39756
|
onFocus: () => onFocus(pageNum),
|
|
39747
39757
|
role: "option",
|
|
@@ -40092,6 +40102,7 @@ class GalleryController {
|
|
|
40092
40102
|
GalleryController_defineProperty(this, "focusToggle", void 0);
|
|
40093
40103
|
GalleryController_defineProperty(this, "onBeforeOpen", void 0);
|
|
40094
40104
|
GalleryController_defineProperty(this, "onAfterClose", void 0);
|
|
40105
|
+
GalleryController_defineProperty(this, "onClose", void 0);
|
|
40095
40106
|
GalleryController_defineProperty(this, "galleryRoot", null);
|
|
40096
40107
|
GalleryController_defineProperty(this, "galleryEl", null);
|
|
40097
40108
|
GalleryController_defineProperty(this, "galleryThumbnail", null);
|
|
@@ -40100,6 +40111,7 @@ class GalleryController {
|
|
|
40100
40111
|
GalleryController_defineProperty(this, "gallerySidebarTimeoutId", null);
|
|
40101
40112
|
GalleryController_defineProperty(this, "sidebarWasOpen", false);
|
|
40102
40113
|
GalleryController_defineProperty(this, "isGalleryOpen", false);
|
|
40114
|
+
GalleryController_defineProperty(this, "pickedPage", null);
|
|
40103
40115
|
GalleryController_defineProperty(this, "toggle", () => {
|
|
40104
40116
|
this.isGalleryOpen = !this.isGalleryOpen;
|
|
40105
40117
|
if (this.isGalleryOpen) {
|
|
@@ -40150,6 +40162,11 @@ class GalleryController {
|
|
|
40150
40162
|
}, THUMBNAILS_SIDEBAR_TRANSITION_TIME);
|
|
40151
40163
|
}
|
|
40152
40164
|
}
|
|
40165
|
+
const {
|
|
40166
|
+
pickedPage
|
|
40167
|
+
} = this;
|
|
40168
|
+
this.pickedPage = null;
|
|
40169
|
+
this.onClose(pickedPage ?? navigateToPage);
|
|
40153
40170
|
}
|
|
40154
40171
|
this.requestUiUpdate();
|
|
40155
40172
|
if (!this.isGalleryOpen) {
|
|
@@ -40159,6 +40176,7 @@ class GalleryController {
|
|
|
40159
40176
|
});
|
|
40160
40177
|
GalleryController_defineProperty(this, "handleGalleryNavigate", pageNum => {
|
|
40161
40178
|
this.galleryFocusedPage = pageNum;
|
|
40179
|
+
this.pickedPage = pageNum;
|
|
40162
40180
|
this.toggle();
|
|
40163
40181
|
});
|
|
40164
40182
|
GalleryController_defineProperty(this, "handleFocusChange", pageNum => {
|
|
@@ -40189,6 +40207,7 @@ class GalleryController {
|
|
|
40189
40207
|
this.focusToggle = opts.focusToggle;
|
|
40190
40208
|
this.onBeforeOpen = opts.onBeforeOpen;
|
|
40191
40209
|
this.onAfterClose = opts.onAfterClose;
|
|
40210
|
+
this.onClose = opts.onClose;
|
|
40192
40211
|
}
|
|
40193
40212
|
get isOpen() {
|
|
40194
40213
|
return this.isGalleryOpen;
|
|
@@ -40229,6 +40248,12 @@ class GalleryController {
|
|
|
40229
40248
|
}
|
|
40230
40249
|
}
|
|
40231
40250
|
destroy() {
|
|
40251
|
+
// Teardown with the gallery still open (file switch, preview closed) resolves the open
|
|
40252
|
+
// instead of leaving it looking abandoned. Depends on the viewer destroying this controller
|
|
40253
|
+
// before BaseViewer.destroy drops the metric listeners.
|
|
40254
|
+
if (this.isGalleryOpen) {
|
|
40255
|
+
this.onClose(null);
|
|
40256
|
+
}
|
|
40232
40257
|
if (this.galleryMountTimeoutId !== null) {
|
|
40233
40258
|
clearTimeout(this.galleryMountTimeoutId);
|
|
40234
40259
|
this.galleryMountTimeoutId = null;
|
|
@@ -40275,6 +40300,7 @@ class GalleryController {
|
|
|
40275
40300
|
}
|
|
40276
40301
|
const thumbnail = this.galleryThumbnail;
|
|
40277
40302
|
this.galleryEl = document.createElement('div');
|
|
40303
|
+
this.galleryEl.setAttribute('data-resin-component', 'gallery');
|
|
40278
40304
|
this.containerEl.insertBefore(this.galleryEl, this.containerEl.querySelector('.bp-ControlsRoot'));
|
|
40279
40305
|
this.galleryRoot = __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7_createRoot__(this.galleryEl);
|
|
40280
40306
|
this.galleryFocusedPage = pdfViewer.currentPageNumber;
|
|
@@ -41844,7 +41870,8 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
41844
41870
|
}
|
|
41845
41871
|
},
|
|
41846
41872
|
onBeforeOpen: () => this.handleGalleryEnter(),
|
|
41847
|
-
onAfterClose: () => this.handleGalleryExit()
|
|
41873
|
+
onAfterClose: () => this.handleGalleryExit(),
|
|
41874
|
+
onClose: landedPage => this.handleGalleryClose(landedPage)
|
|
41848
41875
|
});
|
|
41849
41876
|
}
|
|
41850
41877
|
|
|
@@ -43575,9 +43602,35 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
43575
43602
|
if (this.annotator) {
|
|
43576
43603
|
this.annotator.toggleAnnotationMode(AnnotationMode.NONE);
|
|
43577
43604
|
}
|
|
43605
|
+
this.emitMetric({
|
|
43606
|
+
name: USER_DOCUMENT_GALLERY_EVENTS.OPEN,
|
|
43607
|
+
data: this.pdfViewer?.pagesCount ?? 0
|
|
43608
|
+
});
|
|
43578
43609
|
this.emit(VIEWER_EVENT.galleryOpen);
|
|
43579
43610
|
}
|
|
43580
43611
|
|
|
43612
|
+
/**
|
|
43613
|
+
* Called as the gallery closes, with the page the user landed on or null if they left without
|
|
43614
|
+
* settling on one. Reported as two distinct metrics so the pick-through rate is measurable.
|
|
43615
|
+
*
|
|
43616
|
+
* @protected
|
|
43617
|
+
* @param {number|null} landedPage - Page the gallery left the document on, or null if unchanged
|
|
43618
|
+
* @return {void}
|
|
43619
|
+
*/
|
|
43620
|
+
handleGalleryClose(landedPage) {
|
|
43621
|
+
if (landedPage !== null) {
|
|
43622
|
+
this.emitMetric({
|
|
43623
|
+
name: USER_DOCUMENT_GALLERY_EVENTS.NAVIGATE,
|
|
43624
|
+
data: landedPage
|
|
43625
|
+
});
|
|
43626
|
+
} else {
|
|
43627
|
+
this.emitMetric({
|
|
43628
|
+
name: USER_DOCUMENT_GALLERY_EVENTS.DISMISS,
|
|
43629
|
+
data: this.pdfViewer?.pagesCount ?? 0
|
|
43630
|
+
});
|
|
43631
|
+
}
|
|
43632
|
+
}
|
|
43633
|
+
|
|
43581
43634
|
/**
|
|
43582
43635
|
* Called after the gallery closes. Restores REGION mode so the region-comment cursor is active.
|
|
43583
43636
|
*
|