box-content-preview 3.78.0 → 3.80.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 +188 -290
- package/package.json +5 -7
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.80.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.80.0/en-US/preview.js
|
|
29
|
+
https://cdn01.boxcdn.net/platform/preview/3.80.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.80.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.80.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.80.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
|
@@ -15388,7 +15388,7 @@ function util_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
15388
15388
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
15389
15389
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
15390
15390
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
15391
|
-
const CLIENT_VERSION = "3.
|
|
15391
|
+
const CLIENT_VERSION = "3.80.0"; // eslint-disable-line no-undef
|
|
15392
15392
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
15393
15393
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
15394
15394
|
const PROMISE_MAP = {};
|
|
@@ -17085,7 +17085,7 @@ class Browser {
|
|
|
17085
17085
|
;// ./src/lib/Logger.js
|
|
17086
17086
|
/* eslint-disable no-undef */
|
|
17087
17087
|
const Logger_CLIENT_NAME = "box-content-preview";
|
|
17088
|
-
const Logger_CLIENT_VERSION = "3.
|
|
17088
|
+
const Logger_CLIENT_VERSION = "3.80.0";
|
|
17089
17089
|
/* eslint-enable no-undef */
|
|
17090
17090
|
|
|
17091
17091
|
class Logger {
|
|
@@ -17813,8 +17813,7 @@ class RepStatus extends (events_default()) {
|
|
|
17813
17813
|
sharedLink,
|
|
17814
17814
|
sharedLinkPassword,
|
|
17815
17815
|
logger,
|
|
17816
|
-
fileId
|
|
17817
|
-
migrateAccessTokenToHeader = false
|
|
17816
|
+
fileId
|
|
17818
17817
|
}) {
|
|
17819
17818
|
super();
|
|
17820
17819
|
/** @property {Api} - Api used for XHR calls */
|
|
@@ -17826,12 +17825,8 @@ class RepStatus extends (events_default()) {
|
|
|
17826
17825
|
|
|
17827
17826
|
// Some representations (e.g. ORIGINAL) may not have an info url
|
|
17828
17827
|
const repInfo = this.representation.info;
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
this.headers = getHeaders({}, token);
|
|
17832
|
-
} else {
|
|
17833
|
-
this.infoUrl = repInfo ? appendAuthParams(repInfo.url, token, sharedLink, sharedLinkPassword) : '';
|
|
17834
|
-
}
|
|
17828
|
+
this.infoUrl = repInfo ? appendAuthParamsV2(repInfo.url, sharedLink, sharedLinkPassword) : '';
|
|
17829
|
+
this.headers = getHeaders({}, token);
|
|
17835
17830
|
this.promise = new Promise((resolve, reject) => {
|
|
17836
17831
|
this.resolve = resolve;
|
|
17837
17832
|
this.reject = reject;
|
|
@@ -18569,15 +18564,11 @@ class BaseViewer extends (events_default()) {
|
|
|
18569
18564
|
template = this.api.reachability.constructor.replaceDownloadHostWithDefault(template);
|
|
18570
18565
|
}
|
|
18571
18566
|
|
|
18572
|
-
//
|
|
18573
|
-
// varies the cache key on its own.
|
|
18574
|
-
const resolveCacheBuster = this.featureEnabled('migrateAccessTokenToHeader');
|
|
18575
|
-
|
|
18576
|
-
// Append optional query params
|
|
18567
|
+
// Auth is header-based, so re-resolve the cache-buster per request.
|
|
18577
18568
|
const {
|
|
18578
18569
|
queryParams
|
|
18579
18570
|
} = this.options;
|
|
18580
|
-
return appendQueryParams(createContentUrl(template, asset,
|
|
18571
|
+
return appendQueryParams(createContentUrl(template, asset, true), queryParams);
|
|
18581
18572
|
}
|
|
18582
18573
|
|
|
18583
18574
|
/**
|
|
@@ -18591,13 +18582,7 @@ class BaseViewer extends (events_default()) {
|
|
|
18591
18582
|
* @return {string} content url
|
|
18592
18583
|
*/
|
|
18593
18584
|
createContentUrlWithAuthParams(template, asset) {
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
// Append optional query params
|
|
18597
|
-
const {
|
|
18598
|
-
queryParams
|
|
18599
|
-
} = this.options;
|
|
18600
|
-
return appendQueryParams(urlWithAuthParams, queryParams);
|
|
18585
|
+
return this.createContentUrlV2(template, asset);
|
|
18601
18586
|
}
|
|
18602
18587
|
|
|
18603
18588
|
/**
|
|
@@ -19034,9 +19019,7 @@ class BaseViewer extends (events_default()) {
|
|
|
19034
19019
|
sharedLink,
|
|
19035
19020
|
sharedLinkPassword,
|
|
19036
19021
|
fileId: file.id,
|
|
19037
|
-
logger: representation ? null : logger
|
|
19038
|
-
// Do not log to main preview status if rep is passed in
|
|
19039
|
-
migrateAccessTokenToHeader: this.featureEnabled('migrateAccessTokenToHeader')
|
|
19022
|
+
logger: representation ? null : logger // Do not log to main preview status if rep is passed in
|
|
19040
19023
|
});
|
|
19041
19024
|
|
|
19042
19025
|
// Don't time out while conversion is pending
|
|
@@ -19615,14 +19598,10 @@ class ArchiveViewer extends viewers_BaseViewer {
|
|
|
19615
19598
|
} = this.options;
|
|
19616
19599
|
const template = get_default()(representation, 'content.url_template');
|
|
19617
19600
|
this.startLoadTimer();
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
});
|
|
19623
|
-
}
|
|
19624
|
-
const contentUrl = this.createContentUrlWithAuthParams(template);
|
|
19625
|
-
return this.api.get(contentUrl);
|
|
19601
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
19602
|
+
return this.api.get(contentUrl, {
|
|
19603
|
+
headers: this.appendAuthHeader()
|
|
19604
|
+
});
|
|
19626
19605
|
}).then(this.finishLoading).catch(this.handleAssetError);
|
|
19627
19606
|
}
|
|
19628
19607
|
}
|
|
@@ -21335,8 +21314,7 @@ class ImageViewer extends image_ImageBaseViewer {
|
|
|
21335
21314
|
this.removeListener('zoom', this.handleZoomEvent);
|
|
21336
21315
|
}
|
|
21337
21316
|
|
|
21338
|
-
//
|
|
21339
|
-
// Revoke to free the memory since blobs persist until explicitly released.
|
|
21317
|
+
// Blob URLs stay allocated until revoked.
|
|
21340
21318
|
if (this.imageEl && this.imageEl.src && this.imageEl.src.startsWith('blob:')) {
|
|
21341
21319
|
URL.revokeObjectURL(this.imageEl.src);
|
|
21342
21320
|
}
|
|
@@ -21382,23 +21360,21 @@ class ImageViewer extends image_ImageBaseViewer {
|
|
|
21382
21360
|
} = this.options;
|
|
21383
21361
|
const template = representation.content.url_template;
|
|
21384
21362
|
this.bindDOMListeners();
|
|
21385
|
-
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
}
|
|
21400
|
-
const downloadUrl = this.createContentUrlWithAuthParams(template, viewer.ASSET);
|
|
21401
|
-
return this.getRepStatus().getPromise().then(() => this.handleAssetAndRepLoad(downloadUrl)).catch(this.handleAssetError);
|
|
21363
|
+
const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
|
|
21364
|
+
return this.getRepStatus().getPromise().then(() => {
|
|
21365
|
+
this.startLoadTimer();
|
|
21366
|
+
return this.fetchContentAsBlobUrl(contentUrl);
|
|
21367
|
+
}).then(blobUrl => {
|
|
21368
|
+
if (this.isDestroyed()) {
|
|
21369
|
+
URL.revokeObjectURL(blobUrl);
|
|
21370
|
+
return;
|
|
21371
|
+
}
|
|
21372
|
+
this.imageEl.src = blobUrl;
|
|
21373
|
+
if (this.imageEl.complete) {
|
|
21374
|
+
this.finishLoading();
|
|
21375
|
+
}
|
|
21376
|
+
super.handleAssetAndRepLoad();
|
|
21377
|
+
}).catch(this.handleAssetError);
|
|
21402
21378
|
}
|
|
21403
21379
|
|
|
21404
21380
|
/**
|
|
@@ -21442,9 +21418,6 @@ class ImageViewer extends image_ImageBaseViewer {
|
|
|
21442
21418
|
this.firstRenderEmitted = true;
|
|
21443
21419
|
}
|
|
21444
21420
|
}
|
|
21445
|
-
prefetchFinishedLoading(event) {
|
|
21446
|
-
document.body.removeChild(event?.currentTarget);
|
|
21447
|
-
}
|
|
21448
21421
|
|
|
21449
21422
|
/**
|
|
21450
21423
|
* Prefetches assets for an image.
|
|
@@ -21464,16 +21437,13 @@ class ImageViewer extends image_ImageBaseViewer {
|
|
|
21464
21437
|
const isWatermarked = file && file.watermark_info && file.watermark_info.is_watermarked;
|
|
21465
21438
|
if ((content || preload) && !isWatermarked && this.isRepresentationReady(representation)) {
|
|
21466
21439
|
const template = representation.content.url_template;
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21473
|
-
|
|
21474
|
-
document.body.appendChild(preFetchedImg);
|
|
21475
|
-
preFetchedImg.src = this.createContentUrlWithAuthParams(template, viewer.ASSET);
|
|
21476
|
-
}
|
|
21440
|
+
const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
|
|
21441
|
+
this.api.get(contentUrl, {
|
|
21442
|
+
type: 'blob',
|
|
21443
|
+
headers: this.appendAuthHeader()
|
|
21444
|
+
}).catch(err => {
|
|
21445
|
+
console.warn('Image prefetch failed', err); // eslint-disable-line no-console
|
|
21446
|
+
});
|
|
21477
21447
|
}
|
|
21478
21448
|
}
|
|
21479
21449
|
|
|
@@ -22138,8 +22108,7 @@ class MultiImageViewer extends image_ImageBaseViewer {
|
|
|
22138
22108
|
*/
|
|
22139
22109
|
destroy() {
|
|
22140
22110
|
if (this.singleImageEls && this.singleImageEls.length > 0) {
|
|
22141
|
-
//
|
|
22142
|
-
// Revoke to free the memory since blobs persist until explicitly released.
|
|
22111
|
+
// Blob URLs stay allocated until revoked.
|
|
22143
22112
|
this.singleImageEls.forEach((el, index) => {
|
|
22144
22113
|
if (el.src && el.src.startsWith('blob:')) {
|
|
22145
22114
|
URL.revokeObjectURL(el.src);
|
|
@@ -22210,8 +22179,7 @@ class MultiImageViewer extends image_ImageBaseViewer {
|
|
|
22210
22179
|
} = representation;
|
|
22211
22180
|
const asset = viewer.ASSET;
|
|
22212
22181
|
this.pagesCount = metadata.pages;
|
|
22213
|
-
const
|
|
22214
|
-
const urlBase = useHeaders ? this.createContentUrlV2(template, asset) : this.createContentUrlWithAuthParams(template, asset);
|
|
22182
|
+
const urlBase = this.createContentUrlV2(template, asset);
|
|
22215
22183
|
const urls = [];
|
|
22216
22184
|
for (let pageNum = 1; pageNum <= this.pagesCount; pageNum += 1) {
|
|
22217
22185
|
urls.push(urlBase.replace('{page}', pageNum));
|
|
@@ -22236,13 +22204,13 @@ class MultiImageViewer extends image_ImageBaseViewer {
|
|
|
22236
22204
|
// Set page number. Page is index + 1.
|
|
22237
22205
|
this.singleImageEls[index].setAttribute('data-page-number', index + 1);
|
|
22238
22206
|
this.singleImageEls[index].classList.add(CLASS_MULTI_IMAGE_PAGE);
|
|
22239
|
-
|
|
22240
|
-
this.
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
this.singleImageEls[index].src =
|
|
22245
|
-
}
|
|
22207
|
+
this.fetchContentAsBlobUrl(imageUrl).then(blobUrl => {
|
|
22208
|
+
if (this.isDestroyed()) {
|
|
22209
|
+
URL.revokeObjectURL(blobUrl);
|
|
22210
|
+
return;
|
|
22211
|
+
}
|
|
22212
|
+
this.singleImageEls[index].src = blobUrl;
|
|
22213
|
+
}).catch(this.handleMultiImageDownloadError);
|
|
22246
22214
|
}
|
|
22247
22215
|
|
|
22248
22216
|
/**
|
|
@@ -24710,15 +24678,17 @@ class SWFViewer extends viewers_BaseViewer {
|
|
|
24710
24678
|
/* global swfobject */
|
|
24711
24679
|
const template = this.options.representation.content.url_template;
|
|
24712
24680
|
this.startLoadTimer();
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
|
|
24681
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
24682
|
+
return this.fetchContentAsBlobUrl(contentUrl).then(blobUrl => {
|
|
24683
|
+
/* istanbul ignore next */
|
|
24684
|
+
swfobject.embedSWF(blobUrl, this.playerEl.id, '100%', '100%', '9', null, null, SWF_PARAMS, null, () => {
|
|
24685
|
+
if (this.isDestroyed()) {
|
|
24686
|
+
return;
|
|
24687
|
+
}
|
|
24688
|
+
this.loaded = true;
|
|
24689
|
+
this.emit(VIEWER_EVENT.load);
|
|
24690
|
+
});
|
|
24691
|
+
}).catch(this.handleAssetError);
|
|
24722
24692
|
});
|
|
24723
24693
|
}
|
|
24724
24694
|
/**
|
|
@@ -25687,13 +25657,8 @@ class PlainTextViewer extends text_TextBaseViewer {
|
|
|
25687
25657
|
const headers = this.truncated ? {
|
|
25688
25658
|
Range: `bytes=0-${SIZE_LIMIT_BYTES}`
|
|
25689
25659
|
} : {};
|
|
25690
|
-
|
|
25691
|
-
|
|
25692
|
-
contentUrl = this.createContentUrlV2(template);
|
|
25693
|
-
PlainTextViewer_extends(headers, this.appendAuthHeader());
|
|
25694
|
-
} else {
|
|
25695
|
-
contentUrl = this.createContentUrlWithAuthParams(template);
|
|
25696
|
-
}
|
|
25660
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
25661
|
+
PlainTextViewer_extends(headers, this.appendAuthHeader());
|
|
25697
25662
|
this.startLoadTimer();
|
|
25698
25663
|
return this.api.get(contentUrl, {
|
|
25699
25664
|
headers,
|
|
@@ -25764,17 +25729,11 @@ class PlainTextViewer extends text_TextBaseViewer {
|
|
|
25764
25729
|
} = this.options;
|
|
25765
25730
|
if (content && this.isRepresentationReady(representation)) {
|
|
25766
25731
|
const template = representation.content.url_template;
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
});
|
|
25773
|
-
} else {
|
|
25774
|
-
this.api.get(this.createContentUrlWithAuthParams(template), {
|
|
25775
|
-
type: 'document'
|
|
25776
|
-
});
|
|
25777
|
-
}
|
|
25732
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
25733
|
+
this.api.get(contentUrl, {
|
|
25734
|
+
type: 'document',
|
|
25735
|
+
headers: this.appendAuthHeader()
|
|
25736
|
+
});
|
|
25778
25737
|
}
|
|
25779
25738
|
}
|
|
25780
25739
|
|
|
@@ -26243,15 +26202,11 @@ class CSVViewer extends text_TextBaseViewer {
|
|
|
26243
26202
|
worker: true
|
|
26244
26203
|
});
|
|
26245
26204
|
};
|
|
26246
|
-
|
|
26247
|
-
|
|
26248
|
-
|
|
26249
|
-
|
|
26250
|
-
|
|
26251
|
-
});
|
|
26252
|
-
}
|
|
26253
|
-
parseCSV(this.createContentUrlWithAuthParams(template));
|
|
26254
|
-
return undefined;
|
|
26205
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
26206
|
+
return this.fetchContentAsBlobUrl(contentUrl).then(blobUrl => {
|
|
26207
|
+
this.blobUrl = blobUrl;
|
|
26208
|
+
parseCSV(blobUrl);
|
|
26209
|
+
});
|
|
26255
26210
|
}).catch(this.handleAssetError);
|
|
26256
26211
|
}
|
|
26257
26212
|
|
|
@@ -26302,17 +26257,11 @@ class CSVViewer extends text_TextBaseViewer {
|
|
|
26302
26257
|
} = this.options;
|
|
26303
26258
|
if (content && this.isRepresentationReady(representation)) {
|
|
26304
26259
|
const template = representation.content.url_template;
|
|
26305
|
-
|
|
26306
|
-
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
|
|
26310
|
-
});
|
|
26311
|
-
} else {
|
|
26312
|
-
this.api.get(this.createContentUrlWithAuthParams(template), {
|
|
26313
|
-
type: 'document'
|
|
26314
|
-
});
|
|
26315
|
-
}
|
|
26260
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
26261
|
+
this.api.get(contentUrl, {
|
|
26262
|
+
type: 'document',
|
|
26263
|
+
headers: this.appendAuthHeader()
|
|
26264
|
+
});
|
|
26316
26265
|
}
|
|
26317
26266
|
}
|
|
26318
26267
|
|
|
@@ -28563,21 +28512,14 @@ class MediaBaseViewer extends viewers_BaseViewer {
|
|
|
28563
28512
|
// https://webkit.org/blog/6784/new-video-policies-for-ios/
|
|
28564
28513
|
this.mediaEl.autoplay = true;
|
|
28565
28514
|
}
|
|
28566
|
-
|
|
28567
|
-
const contentUrl = this.createContentUrlV2(template);
|
|
28568
|
-
return this.getRepStatus().getPromise().then(() => {
|
|
28569
|
-
this.startLoadTimer();
|
|
28570
|
-
return this.fetchContentAsBlobUrl(contentUrl);
|
|
28571
|
-
}).then(blobUrl => {
|
|
28572
|
-
this.mediaBlobUrl = blobUrl;
|
|
28573
|
-
this.mediaUrl = blobUrl;
|
|
28574
|
-
this.mediaEl.src = blobUrl;
|
|
28575
|
-
}).catch(this.handleAssetError);
|
|
28576
|
-
}
|
|
28577
|
-
this.mediaUrl = this.createContentUrlWithAuthParams(template);
|
|
28515
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
28578
28516
|
return this.getRepStatus().getPromise().then(() => {
|
|
28579
28517
|
this.startLoadTimer();
|
|
28580
|
-
|
|
28518
|
+
return this.fetchContentAsBlobUrl(contentUrl);
|
|
28519
|
+
}).then(blobUrl => {
|
|
28520
|
+
this.mediaBlobUrl = blobUrl;
|
|
28521
|
+
this.mediaUrl = blobUrl;
|
|
28522
|
+
this.mediaEl.src = blobUrl;
|
|
28581
28523
|
}).catch(this.handleAssetError);
|
|
28582
28524
|
}
|
|
28583
28525
|
|
|
@@ -28677,20 +28619,15 @@ class MediaBaseViewer extends viewers_BaseViewer {
|
|
|
28677
28619
|
} = this.mediaEl;
|
|
28678
28620
|
this.currentTime = currentTime;
|
|
28679
28621
|
this.options.token = newToken;
|
|
28680
|
-
if (this.
|
|
28681
|
-
|
|
28682
|
-
URL.revokeObjectURL(this.mediaBlobUrl);
|
|
28683
|
-
}
|
|
28684
|
-
const contentUrl = this.createContentUrlV2(this.options.representation.content.url_template);
|
|
28685
|
-
this.fetchContentAsBlobUrl(contentUrl).then(blobUrl => {
|
|
28686
|
-
this.mediaBlobUrl = blobUrl;
|
|
28687
|
-
this.mediaUrl = blobUrl;
|
|
28688
|
-
this.mediaEl.src = blobUrl;
|
|
28689
|
-
}).catch(this.handleAssetError);
|
|
28690
|
-
return;
|
|
28622
|
+
if (this.mediaBlobUrl) {
|
|
28623
|
+
URL.revokeObjectURL(this.mediaBlobUrl);
|
|
28691
28624
|
}
|
|
28692
|
-
|
|
28693
|
-
this.
|
|
28625
|
+
const contentUrl = this.createContentUrlV2(this.options.representation.content.url_template);
|
|
28626
|
+
this.fetchContentAsBlobUrl(contentUrl).then(blobUrl => {
|
|
28627
|
+
this.mediaBlobUrl = blobUrl;
|
|
28628
|
+
this.mediaUrl = blobUrl;
|
|
28629
|
+
this.mediaEl.src = blobUrl;
|
|
28630
|
+
}).catch(this.handleAssetError);
|
|
28694
28631
|
}
|
|
28695
28632
|
|
|
28696
28633
|
/**
|
|
@@ -32659,19 +32596,22 @@ class VideoBaseViewer extends media_MediaBaseViewer {
|
|
|
32659
32596
|
height: this.wrapperEl.clientHeight - controlsHeight
|
|
32660
32597
|
};
|
|
32661
32598
|
}
|
|
32662
|
-
|
|
32663
|
-
|
|
32664
|
-
|
|
32665
|
-
URL.revokeObjectURL(this.preloadBlobUrl);
|
|
32666
|
-
}
|
|
32667
|
-
this.fetchContentAsBlobUrl(contentUrl).then(blobUrl => {
|
|
32668
|
-
this.preloadBlobUrl = blobUrl;
|
|
32669
|
-
this.preloader.showPreload(blobUrl, this.mediaContainerEl, options);
|
|
32670
|
-
}).catch(this.handleAssetError);
|
|
32671
|
-
} else {
|
|
32672
|
-
const preloadUrlWithAuth = this.createContentUrlWithAuthParams(template);
|
|
32673
|
-
this.preloader.showPreload(preloadUrlWithAuth, this.mediaContainerEl, options);
|
|
32599
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
32600
|
+
if (this.preloadBlobUrl) {
|
|
32601
|
+
URL.revokeObjectURL(this.preloadBlobUrl);
|
|
32674
32602
|
}
|
|
32603
|
+
this.fetchContentAsBlobUrl(contentUrl).then(blobUrl => {
|
|
32604
|
+
if (this.isDestroyed()) {
|
|
32605
|
+
URL.revokeObjectURL(blobUrl);
|
|
32606
|
+
return;
|
|
32607
|
+
}
|
|
32608
|
+
this.preloadBlobUrl = blobUrl;
|
|
32609
|
+
this.preloader.showPreload(blobUrl, this.mediaContainerEl, options);
|
|
32610
|
+
}).catch(err => {
|
|
32611
|
+
// Poster is a non-critical first-frame enhancement.
|
|
32612
|
+
// Warn so prod 401s leave a breadcrumb in DevTools.
|
|
32613
|
+
console.warn('Video preload failed', err); // eslint-disable-line no-console
|
|
32614
|
+
});
|
|
32675
32615
|
this.mediaEl.classList.add(CLASS_INVISIBLE);
|
|
32676
32616
|
}
|
|
32677
32617
|
|
|
@@ -32712,18 +32652,13 @@ class VideoBaseViewer extends media_MediaBaseViewer {
|
|
|
32712
32652
|
if (!preloadRep || !this.isRepresentationReady(preloadRep) || !preloadRep.content?.url_template) {
|
|
32713
32653
|
return;
|
|
32714
32654
|
}
|
|
32715
|
-
|
|
32716
|
-
|
|
32717
|
-
|
|
32718
|
-
|
|
32719
|
-
|
|
32720
|
-
|
|
32721
|
-
}
|
|
32722
|
-
const preloadUrlWithAuth = this.createContentUrlWithAuthParams(preloadRep.content.url_template);
|
|
32723
|
-
this.api.get(preloadUrlWithAuth, {
|
|
32724
|
-
type: 'blob'
|
|
32725
|
-
}).catch(() => {});
|
|
32726
|
-
}
|
|
32655
|
+
const contentUrl = this.createContentUrlV2(preloadRep.content.url_template);
|
|
32656
|
+
this.api.get(contentUrl, {
|
|
32657
|
+
type: 'blob',
|
|
32658
|
+
headers: this.appendAuthHeader()
|
|
32659
|
+
}).catch(err => {
|
|
32660
|
+
console.warn('Video preload prefetch failed', err); // eslint-disable-line no-console
|
|
32661
|
+
});
|
|
32727
32662
|
}
|
|
32728
32663
|
buildPlayButtonWithSeekButtons() {
|
|
32729
32664
|
this.playContainerEl = this.mediaContainerEl.appendChild(document.createElement('div'));
|
|
@@ -34169,8 +34104,16 @@ function VideoFullscreenButton({
|
|
|
34169
34104
|
});
|
|
34170
34105
|
};
|
|
34171
34106
|
update();
|
|
34107
|
+
|
|
34108
|
+
// Watch both the video and the overlay parent. A sibling layout change
|
|
34109
|
+
// (e.g. a host-page sidebar) can shrink the parent and re-center the
|
|
34110
|
+
// video without changing the video element's box size, so observing
|
|
34111
|
+
// mediaEl alone would leave the button at a stale `right` offset.
|
|
34172
34112
|
const resizeObserver = new ResizeObserver(update);
|
|
34173
34113
|
resizeObserver.observe(mediaEl);
|
|
34114
|
+
if (ref.current?.offsetParent) {
|
|
34115
|
+
resizeObserver.observe(ref.current.offsetParent);
|
|
34116
|
+
}
|
|
34174
34117
|
window.addEventListener('resize', update);
|
|
34175
34118
|
return () => {
|
|
34176
34119
|
resizeObserver.disconnect();
|
|
@@ -34807,7 +34750,7 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
34807
34750
|
this.filmstripStatus.destroy();
|
|
34808
34751
|
}
|
|
34809
34752
|
|
|
34810
|
-
// Release blob: URL allocated for the filmstrip
|
|
34753
|
+
// Release blob: URL allocated for the filmstrip
|
|
34811
34754
|
if (this.filmstripUrl && this.filmstripUrl.startsWith('blob:')) {
|
|
34812
34755
|
URL.revokeObjectURL(this.filmstripUrl);
|
|
34813
34756
|
}
|
|
@@ -34885,17 +34828,11 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
34885
34828
|
} = this.options;
|
|
34886
34829
|
if (content && this.isRepresentationReady(representation)) {
|
|
34887
34830
|
const template = representation.content.url_template;
|
|
34888
|
-
|
|
34889
|
-
|
|
34890
|
-
|
|
34891
|
-
|
|
34892
|
-
|
|
34893
|
-
});
|
|
34894
|
-
} else {
|
|
34895
|
-
this.api.get(this.createContentUrlWithAuthParams(template, MANIFEST), {
|
|
34896
|
-
type: 'document'
|
|
34897
|
-
});
|
|
34898
|
-
}
|
|
34831
|
+
const contentUrl = this.createContentUrlV2(template, MANIFEST);
|
|
34832
|
+
this.api.get(contentUrl, {
|
|
34833
|
+
type: 'document',
|
|
34834
|
+
headers: this.appendAuthHeader()
|
|
34835
|
+
});
|
|
34899
34836
|
}
|
|
34900
34837
|
}
|
|
34901
34838
|
|
|
@@ -35021,7 +34958,7 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
35021
34958
|
}
|
|
35022
34959
|
|
|
35023
34960
|
/**
|
|
35024
|
-
*
|
|
34961
|
+
* Rewrites representation URIs without an access token and attaches Authorization headers.
|
|
35025
34962
|
* Manifest type will use an asset name. Segments will not.
|
|
35026
34963
|
*
|
|
35027
34964
|
* @private
|
|
@@ -35032,28 +34969,16 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
35032
34969
|
requestFilter(type, request) {
|
|
35033
34970
|
const asset = type === shaka.net.NetworkingEngine.RequestType.MANIFEST ? MANIFEST : undefined;
|
|
35034
34971
|
/* eslint-disable no-param-reassign */
|
|
35035
|
-
|
|
35036
|
-
|
|
35037
|
-
|
|
35038
|
-
|
|
35039
|
-
|
|
35040
|
-
|
|
35041
|
-
|
|
35042
|
-
|
|
35043
|
-
|
|
35044
|
-
|
|
35045
|
-
DashViewer_extends(request.headers, this.appendAuthHeader());
|
|
35046
|
-
} else {
|
|
35047
|
-
request.uris = request.uris.map(uri => {
|
|
35048
|
-
let newUri = this.createContentUrlWithAuthParams(uri, asset);
|
|
35049
|
-
if (asset !== MANIFEST && this.options.file.watermark_info.is_watermarked) {
|
|
35050
|
-
newUri = appendQueryParams(newUri, {
|
|
35051
|
-
watermark_content: this.watermarkCacheBust
|
|
35052
|
-
});
|
|
35053
|
-
}
|
|
35054
|
-
return newUri;
|
|
35055
|
-
});
|
|
35056
|
-
}
|
|
34972
|
+
request.uris = request.uris.map(uri => {
|
|
34973
|
+
let newUri = this.createContentUrlV2(uri, asset);
|
|
34974
|
+
if (asset !== MANIFEST && this.options.file.watermark_info.is_watermarked) {
|
|
34975
|
+
newUri = appendQueryParams(newUri, {
|
|
34976
|
+
watermark_content: this.watermarkCacheBust
|
|
34977
|
+
});
|
|
34978
|
+
}
|
|
34979
|
+
return newUri;
|
|
34980
|
+
});
|
|
34981
|
+
request.headers = DashViewer_extends(request.headers || {}, this.appendAuthHeader());
|
|
35057
34982
|
/* eslint-enable no-param-reassign */
|
|
35058
34983
|
}
|
|
35059
34984
|
|
|
@@ -35616,29 +35541,14 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
35616
35541
|
const filmstrip = getRepresentation(this.options.file, 'filmstrip');
|
|
35617
35542
|
const filmstripInterval = filmstrip && filmstrip.metadata && filmstrip.metadata.interval;
|
|
35618
35543
|
if (filmstripInterval > 0) {
|
|
35619
|
-
const useHeaders = this.featureEnabled('migrateAccessTokenToHeader');
|
|
35620
35544
|
const useReactControls = this.useReactControls();
|
|
35621
|
-
const url =
|
|
35545
|
+
const url = this.createContentUrlV2(filmstrip.content.url_template);
|
|
35622
35546
|
this.filmstripInterval = filmstripInterval;
|
|
35623
35547
|
this.filmstripStatus = this.getRepStatus(filmstrip);
|
|
35624
|
-
|
|
35625
|
-
|
|
35626
|
-
this.filmstripUrl = useHeaders ? null : url;
|
|
35627
|
-
|
|
35628
|
-
// Legacy controls have a synchronous init path when the URL already carries a token.
|
|
35629
|
-
if (!useHeaders && !useReactControls) {
|
|
35630
|
-
this.mediaControls.initFilmstrip(url, this.filmstripStatus, this.aspect, filmstripInterval);
|
|
35631
|
-
return;
|
|
35632
|
-
}
|
|
35633
|
-
this.filmstripStatus.getPromise().then(() => useHeaders ? this.fetchContentAsBlobUrl(url) : url).then(filmstripUrl => {
|
|
35634
|
-
// <img src> can't carry an Authorization header, so when the access-token has
|
|
35635
|
-
// been migrated out of the URL we expose the rep as a blob: URL instead.
|
|
35636
|
-
// If the viewer was destroyed while we were fetching, release the blob now —
|
|
35637
|
-
// destroy() can't see it because filmstripUrl was still null when it ran.
|
|
35548
|
+
this.filmstripUrl = null;
|
|
35549
|
+
this.filmstripStatus.getPromise().then(() => this.fetchContentAsBlobUrl(url)).then(filmstripUrl => {
|
|
35638
35550
|
if (this.destroyed) {
|
|
35639
|
-
|
|
35640
|
-
URL.revokeObjectURL(filmstripUrl);
|
|
35641
|
-
}
|
|
35551
|
+
URL.revokeObjectURL(filmstripUrl);
|
|
35642
35552
|
return;
|
|
35643
35553
|
}
|
|
35644
35554
|
this.filmstripUrl = filmstripUrl;
|
|
@@ -35648,9 +35558,8 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
35648
35558
|
this.mediaControls.initFilmstrip(filmstripUrl, this.filmstripStatus, this.aspect, filmstripInterval);
|
|
35649
35559
|
}
|
|
35650
35560
|
})
|
|
35651
|
-
// Filmstrip is a non-critical scrubbing-preview enhancement
|
|
35652
|
-
//
|
|
35653
|
-
// the whole viewer. Warn so prod 401s leave a breadcrumb in DevTools.
|
|
35561
|
+
// Filmstrip is a non-critical scrubbing-preview enhancement.
|
|
35562
|
+
// Warn so prod 401s leave a breadcrumb in DevTools.
|
|
35654
35563
|
.catch(err => {
|
|
35655
35564
|
console.warn('Filmstrip load failed', err); // eslint-disable-line no-console
|
|
35656
35565
|
});
|
|
@@ -35671,7 +35580,7 @@ class DashViewer extends media_VideoBaseViewer {
|
|
|
35671
35580
|
if (!extractedText?.content?.url_template) {
|
|
35672
35581
|
return;
|
|
35673
35582
|
}
|
|
35674
|
-
const transcriptionUrl = this.
|
|
35583
|
+
const transcriptionUrl = this.createContentUrlV2(extractedText.content.url_template);
|
|
35675
35584
|
this.transcriptionStatus = this.getRepStatus(extractedText);
|
|
35676
35585
|
try {
|
|
35677
35586
|
await this.transcriptionStatus.getPromise();
|
|
@@ -40671,15 +40580,14 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40671
40580
|
const pagedWebpRepReady = pagedWebpRep && this.isRepresentationReady(pagedWebpRep) && pagedWebpRep.content?.url_template;
|
|
40672
40581
|
const jpegRepReady = jpegPreloadRep && this.isRepresentationReady(jpegPreloadRep) && jpegPreloadRep.content?.url_template;
|
|
40673
40582
|
const onlyJpegRepAvailable = jpegRepReady && !pagedWebpRepReady;
|
|
40674
|
-
const
|
|
40675
|
-
const headersOption = useHeaders ? {
|
|
40583
|
+
const headersOption = {
|
|
40676
40584
|
headers: this.appendAuthHeader()
|
|
40677
|
-
}
|
|
40585
|
+
};
|
|
40678
40586
|
if (onlyJpegRepAvailable) {
|
|
40679
40587
|
const {
|
|
40680
40588
|
url_template: jpegUrlTemplate = ''
|
|
40681
40589
|
} = jpegPreloadRep.content;
|
|
40682
|
-
const jpegUrlAuthTemplate =
|
|
40590
|
+
const jpegUrlAuthTemplate = this.createContentUrlV2(jpegUrlTemplate);
|
|
40683
40591
|
const promises = getPreloadImageRequestPromises(this.api, jpegUrlAuthTemplate, 1, '', headersOption);
|
|
40684
40592
|
Promise.all(promises).then(() => {
|
|
40685
40593
|
this.preloaderImagesPrefetched = true;
|
|
@@ -40690,7 +40598,7 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40690
40598
|
} = pagedWebpRep.content;
|
|
40691
40599
|
const pageCount = pagedWebpRep.metadata?.pages || 8;
|
|
40692
40600
|
const newPagedUrlTemplate = pagedUrlTemplate.replace(/\{.*\}/, DocBaseViewer_PAGED_URL_TEMPLATE_PAGE_NUMBER_HOLDER);
|
|
40693
|
-
const pagedUrlAuthTemplate =
|
|
40601
|
+
const pagedUrlAuthTemplate = this.createContentUrlV2(newPagedUrlTemplate);
|
|
40694
40602
|
if (docFirstPagesConfig && docFirstPagesConfig.priorityPages) {
|
|
40695
40603
|
const {
|
|
40696
40604
|
priorityPages,
|
|
@@ -40755,19 +40663,11 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40755
40663
|
const {
|
|
40756
40664
|
url_template: template
|
|
40757
40665
|
} = preloadRep.content;
|
|
40758
|
-
|
|
40759
|
-
|
|
40760
|
-
|
|
40761
|
-
|
|
40762
|
-
|
|
40763
|
-
type: 'blob',
|
|
40764
|
-
headers: this.appendAuthHeader()
|
|
40765
|
-
});
|
|
40766
|
-
} else {
|
|
40767
|
-
this.api.get(this.createContentUrlWithAuthParams(template), {
|
|
40768
|
-
type: 'blob'
|
|
40769
|
-
});
|
|
40770
|
-
}
|
|
40666
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
40667
|
+
this.api.get(contentUrl, {
|
|
40668
|
+
type: 'blob',
|
|
40669
|
+
headers: this.appendAuthHeader()
|
|
40670
|
+
});
|
|
40771
40671
|
}
|
|
40772
40672
|
} else {
|
|
40773
40673
|
this.prefetchPreloaderImages(file);
|
|
@@ -40777,17 +40677,11 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40777
40677
|
const {
|
|
40778
40678
|
url_template: template
|
|
40779
40679
|
} = representation.content;
|
|
40780
|
-
|
|
40781
|
-
|
|
40782
|
-
|
|
40783
|
-
|
|
40784
|
-
|
|
40785
|
-
});
|
|
40786
|
-
} else {
|
|
40787
|
-
this.api.get(this.createContentUrlWithAuthParams(template), {
|
|
40788
|
-
type: 'document'
|
|
40789
|
-
});
|
|
40790
|
-
}
|
|
40680
|
+
const contentUrl = this.createContentUrlV2(template);
|
|
40681
|
+
this.api.get(contentUrl, {
|
|
40682
|
+
type: 'document',
|
|
40683
|
+
headers: this.appendAuthHeader()
|
|
40684
|
+
});
|
|
40791
40685
|
}
|
|
40792
40686
|
}
|
|
40793
40687
|
|
|
@@ -40846,11 +40740,10 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40846
40740
|
const {
|
|
40847
40741
|
url_template: template = ''
|
|
40848
40742
|
} = preloadRep?.content || {};
|
|
40849
|
-
const
|
|
40850
|
-
const
|
|
40851
|
-
const headersOption = useHeaders ? {
|
|
40743
|
+
const preloadUrl = this.createContentUrlV2(template);
|
|
40744
|
+
const headersOption = {
|
|
40852
40745
|
headers: this.appendAuthHeader()
|
|
40853
|
-
}
|
|
40746
|
+
};
|
|
40854
40747
|
if (!this.docFirstPagesEnabled) {
|
|
40855
40748
|
this.startPreloadTimer();
|
|
40856
40749
|
this.preloader.showPreload(preloadUrl, this.containerEl, headersOption);
|
|
@@ -40874,7 +40767,7 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40874
40767
|
url_template: pagedUrlTemplate = ''
|
|
40875
40768
|
} = preloadRepPaged?.content || {};
|
|
40876
40769
|
const newPagedUrlTemplate = pagedUrlTemplate.replace(/\{.*\}/, DocBaseViewer_PAGED_URL_TEMPLATE_PAGE_NUMBER_HOLDER);
|
|
40877
|
-
const pagedPreLoadUrl =
|
|
40770
|
+
const pagedPreLoadUrl = this.createContentUrlV2(newPagedUrlTemplate);
|
|
40878
40771
|
this.preloader.showPreload(null, this.containerEl, pagedPreLoadUrl, pageCount, this, headersOption);
|
|
40879
40772
|
}
|
|
40880
40773
|
}
|
|
@@ -40914,11 +40807,7 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
40914
40807
|
this.showPreload();
|
|
40915
40808
|
}
|
|
40916
40809
|
const template = this.options.representation.content.url_template;
|
|
40917
|
-
|
|
40918
|
-
this.pdfUrl = this.createContentUrlV2(template);
|
|
40919
|
-
} else {
|
|
40920
|
-
this.pdfUrl = this.createContentUrlWithAuthParams(template);
|
|
40921
|
-
}
|
|
40810
|
+
this.pdfUrl = this.createContentUrlV2(template);
|
|
40922
40811
|
let jsAssets;
|
|
40923
40812
|
let cssAssets;
|
|
40924
40813
|
const useNpmPdfjs = this.featureEnabled('useNpmPdfjs');
|
|
@@ -41317,9 +41206,7 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
41317
41206
|
rangeChunkSize,
|
|
41318
41207
|
url: pdfUrl
|
|
41319
41208
|
};
|
|
41320
|
-
|
|
41321
|
-
pdfDocConfig.httpHeaders = this.appendAuthHeader();
|
|
41322
|
-
}
|
|
41209
|
+
pdfDocConfig.httpHeaders = this.appendAuthHeader();
|
|
41323
41210
|
this.pdfLoadingTask = this.pdfjsLib.getDocument(pdfDocConfig);
|
|
41324
41211
|
if (this.pageTracker) {
|
|
41325
41212
|
this.addListener('preview_event_report', this.handlePreviewEventReport);
|
|
@@ -41638,13 +41525,10 @@ class DocBaseViewer extends viewers_BaseViewer {
|
|
|
41638
41525
|
* @return {Promise} Promise setting print blob
|
|
41639
41526
|
*/
|
|
41640
41527
|
fetchPrintBlob(pdfUrl) {
|
|
41641
|
-
|
|
41642
|
-
type: 'blob'
|
|
41643
|
-
|
|
41644
|
-
|
|
41645
|
-
options.headers = this.appendAuthHeader();
|
|
41646
|
-
}
|
|
41647
|
-
return this.api.get(pdfUrl, options).then(blob => {
|
|
41528
|
+
return this.api.get(pdfUrl, {
|
|
41529
|
+
type: 'blob',
|
|
41530
|
+
headers: this.appendAuthHeader()
|
|
41531
|
+
}).then(blob => {
|
|
41648
41532
|
this.printBlob = blob;
|
|
41649
41533
|
});
|
|
41650
41534
|
}
|
|
@@ -47341,7 +47225,7 @@ class OfficeViewer extends viewers_BaseViewer {
|
|
|
47341
47225
|
|
|
47342
47226
|
// This occurs in the case of .xlsb files where no pdf rep exists
|
|
47343
47227
|
if (template) {
|
|
47344
|
-
this.pdfUrl = this.
|
|
47228
|
+
this.pdfUrl = this.createContentUrlV2(template);
|
|
47345
47229
|
}
|
|
47346
47230
|
}
|
|
47347
47231
|
|
|
@@ -47501,7 +47385,8 @@ class OfficeViewer extends viewers_BaseViewer {
|
|
|
47501
47385
|
*/
|
|
47502
47386
|
fetchPrintBlob(pdfUrl) {
|
|
47503
47387
|
return this.api.get(pdfUrl, {
|
|
47504
|
-
type: 'blob'
|
|
47388
|
+
type: 'blob',
|
|
47389
|
+
headers: this.appendAuthHeader()
|
|
47505
47390
|
}).then(blob => {
|
|
47506
47391
|
this.printBlob = blob;
|
|
47507
47392
|
});
|
|
@@ -48930,8 +48815,25 @@ class Preview extends (events_default()) {
|
|
|
48930
48815
|
const params = Preview_objectSpread({
|
|
48931
48816
|
response_content_disposition_type: 'attachment'
|
|
48932
48817
|
}, queryParams);
|
|
48933
|
-
const downloadUrl = appendQueryParams(this.viewer.
|
|
48934
|
-
this.api.
|
|
48818
|
+
const downloadUrl = appendQueryParams(this.viewer.createContentUrlV2(contentUrlTemplate, this.viewer.getAssetPath()), params);
|
|
48819
|
+
this.api.get(downloadUrl, {
|
|
48820
|
+
type: 'blob',
|
|
48821
|
+
headers: this.getRequestHeaders()
|
|
48822
|
+
}).then(data => {
|
|
48823
|
+
const blob = data instanceof Blob ? data : new Blob([data]);
|
|
48824
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
48825
|
+
const anchor = document.createElement('a');
|
|
48826
|
+
anchor.href = blobUrl;
|
|
48827
|
+
anchor.download = this.file && this.file.name || 'download';
|
|
48828
|
+
document.body.appendChild(anchor);
|
|
48829
|
+
anchor.click();
|
|
48830
|
+
document.body.removeChild(anchor);
|
|
48831
|
+
URL.revokeObjectURL(blobUrl);
|
|
48832
|
+
}).catch(error => {
|
|
48833
|
+
const code = getProp(error, 'response.data.code');
|
|
48834
|
+
const msg = code === ERROR_CODE_403_FORBIDDEN_BY_POLICY ? downloadErrorDueToPolicyMsg : downloadErrorMsg;
|
|
48835
|
+
this.ui.showNotification(msg);
|
|
48836
|
+
});
|
|
48935
48837
|
|
|
48936
48838
|
// Otherwise, get the content download URL of the original file and download
|
|
48937
48839
|
} else {
|
|
@@ -49002,8 +48904,7 @@ class Preview extends (events_default()) {
|
|
|
49002
48904
|
sharedLinkPassword = '',
|
|
49003
48905
|
preload = false,
|
|
49004
48906
|
isDocFirstPrefetchEnabled = false,
|
|
49005
|
-
docFirstPagesConfig = null
|
|
49006
|
-
isAccessTokenHeaderEnabled = false
|
|
48907
|
+
docFirstPagesConfig = null
|
|
49007
48908
|
}) {
|
|
49008
48909
|
let file;
|
|
49009
48910
|
let loader;
|
|
@@ -49044,9 +48945,6 @@ class Preview extends (events_default()) {
|
|
|
49044
48945
|
options.sharedLinkPassword = sharedLinkPassword;
|
|
49045
48946
|
options.isDocFirstPrefetchEnabled = isDocFirstPrefetchEnabled;
|
|
49046
48947
|
options.docFirstPagesConfig = docFirstPagesConfig;
|
|
49047
|
-
options.features = Preview_objectSpread(Preview_objectSpread({}, this.options.features), {}, {
|
|
49048
|
-
migrateAccessTokenToHeader: isAccessTokenHeaderEnabled
|
|
49049
|
-
});
|
|
49050
48948
|
}
|
|
49051
48949
|
const viewerInstance = new viewer.CONSTRUCTOR(this.createViewerOptions(options));
|
|
49052
48950
|
if (typeof viewerInstance.prefetch === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "box-content-preview",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.80.0",
|
|
4
4
|
"description": "Box Content Preview UI Element",
|
|
5
5
|
"author": "Box (https://www.box.com/)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
50
50
|
"@babel/plugin-proposal-object-rest-spread": "^7.18.6",
|
|
51
51
|
"@babel/plugin-transform-object-assign": "^7.18.6",
|
|
52
|
-
"@babel/preset-env": "^7.
|
|
52
|
+
"@babel/preset-env": "^7.24.7",
|
|
53
53
|
"@babel/preset-react": "^7.18.6",
|
|
54
54
|
"@babel/preset-typescript": "^7.18.6",
|
|
55
55
|
"@box/blueprint-web": "^14.41.0",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"box-ui-elements": "^20.0.0",
|
|
81
81
|
"chai": "^4.2.0",
|
|
82
82
|
"classnames": "^2.2.6",
|
|
83
|
-
"conventional-changelog
|
|
84
|
-
"conventional-
|
|
83
|
+
"conventional-changelog": "^8.1.3",
|
|
84
|
+
"conventional-changelog-conventionalcommits": "^10.3.0",
|
|
85
85
|
"create-react-class": "^15.6.2",
|
|
86
86
|
"css-loader": "^6.11.0",
|
|
87
87
|
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
"eslint": "^8.43.0",
|
|
90
90
|
"eslint-config-airbnb": "^18.0.1",
|
|
91
91
|
"eslint-config-prettier": "^6.7.0",
|
|
92
|
-
"eslint-import-resolver-webpack": "^0.11.1",
|
|
93
92
|
"eslint-plugin-babel": "^5.3.0",
|
|
94
93
|
"eslint-plugin-chai-friendly": "^0.4.1",
|
|
95
94
|
"eslint-plugin-cypress": "^2.8.1",
|
|
@@ -114,7 +113,6 @@
|
|
|
114
113
|
"lodash": "^4.18.1",
|
|
115
114
|
"mini-css-extract-plugin": "^2.10.2",
|
|
116
115
|
"mock-local-storage": "^1.1.15",
|
|
117
|
-
"mojito-rb-gen": "^0.0.1",
|
|
118
116
|
"npm-run-all": "^4.1.5",
|
|
119
117
|
"postcss": "^8.5.18",
|
|
120
118
|
"postcss-loader": "^8.1.1",
|
|
@@ -149,7 +147,7 @@
|
|
|
149
147
|
"build": "yarn setup && yarn clean && yarn build:i18n && yarn build:dev",
|
|
150
148
|
"build:ci": "yarn setup && yarn webpack --progress --config build/webpack.config.js",
|
|
151
149
|
"build:dev": "BABEL_ENV=dev NODE_ENV=dev yarn webpack --progress --config build/webpack.config.js",
|
|
152
|
-
"build:i18n": "
|
|
150
|
+
"build:i18n": "node build/buildI18n.js",
|
|
153
151
|
"build:lib": "yarn build:i18n && yarn build:lib:js && yarn build:lib:verify && yarn build:lib:types",
|
|
154
152
|
"build:lib:verify": "node build/verifyLibBundle.js",
|
|
155
153
|
"build:lib:js": "BABEL_ENV=production NODE_ENV=production yarn webpack --config build/webpack.config.lib.js",
|