box-content-preview 3.51.0 → 3.52.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 +19 -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.52.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.52.0/en-US/preview.js
|
|
29
|
+
https://cdn01.boxcdn.net/platform/preview/3.52.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.52.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.52.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.52.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
|
@@ -9340,7 +9340,7 @@ function util_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
9340
9340
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
9341
9341
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
9342
9342
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
9343
|
-
const CLIENT_VERSION = "3.
|
|
9343
|
+
const CLIENT_VERSION = "3.52.0"; // eslint-disable-line no-undef
|
|
9344
9344
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
9345
9345
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
9346
9346
|
const PROMISE_MAP = {};
|
|
@@ -9611,14 +9611,21 @@ function appendAuthParamsV2(url) {
|
|
|
9611
9611
|
* @public
|
|
9612
9612
|
* @param {string} template - URL template to attach param to
|
|
9613
9613
|
* @param {string|void} [asset] - Optional asset name needed to access file
|
|
9614
|
+
* @param {boolean} [resolveCacheBuster] - Re-resolve the _cache_buster marker per request
|
|
9615
|
+
* (needed only when auth is header-based; the in-URL token otherwise varies the cache key).
|
|
9614
9616
|
* @return {string} Content url
|
|
9615
9617
|
*/
|
|
9616
9618
|
function createContentUrl(template, asset) {
|
|
9619
|
+
let resolveCacheBuster = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
9617
9620
|
if (lib_DownloadReachability.isDownloadHostBlocked()) {
|
|
9618
9621
|
// eslint-disable-next-line
|
|
9619
9622
|
template = lib_DownloadReachability.replaceDownloadHostWithDefault(template);
|
|
9620
9623
|
}
|
|
9621
|
-
|
|
9624
|
+
const url = template.replace('{+asset_path}', asset || '');
|
|
9625
|
+
if (!resolveCacheBuster) {
|
|
9626
|
+
return url;
|
|
9627
|
+
}
|
|
9628
|
+
return url.replace(/([?&]_cache_buster=)[^&]*/, `$1${Date.now().toString(36)}`);
|
|
9622
9629
|
}
|
|
9623
9630
|
|
|
9624
9631
|
/**
|
|
@@ -11058,7 +11065,7 @@ class Browser {
|
|
|
11058
11065
|
;// ./src/lib/Logger.js
|
|
11059
11066
|
/* eslint-disable no-undef */
|
|
11060
11067
|
const Logger_CLIENT_NAME = "box-content-preview";
|
|
11061
|
-
const Logger_CLIENT_VERSION = "3.
|
|
11068
|
+
const Logger_CLIENT_VERSION = "3.52.0";
|
|
11062
11069
|
/* eslint-enable no-undef */
|
|
11063
11070
|
|
|
11064
11071
|
class Logger {
|
|
@@ -12553,11 +12560,15 @@ class BaseViewer extends (events_default()) {
|
|
|
12553
12560
|
template = this.api.reachability.constructor.replaceDownloadHostWithDefault(template);
|
|
12554
12561
|
}
|
|
12555
12562
|
|
|
12563
|
+
// Cache-buster only needed when auth is header-based; the in-URL token otherwise
|
|
12564
|
+
// varies the cache key on its own.
|
|
12565
|
+
const resolveCacheBuster = this.featureEnabled('migrateAccessTokenToHeader');
|
|
12566
|
+
|
|
12556
12567
|
// Append optional query params
|
|
12557
12568
|
const {
|
|
12558
12569
|
queryParams
|
|
12559
12570
|
} = this.options;
|
|
12560
|
-
return appendQueryParams(createContentUrl(template, asset), queryParams);
|
|
12571
|
+
return appendQueryParams(createContentUrl(template, asset, resolveCacheBuster), queryParams);
|
|
12561
12572
|
}
|
|
12562
12573
|
|
|
12563
12574
|
/**
|
|
@@ -19173,7 +19184,10 @@ function addOriginalRepresentation(file) {
|
|
|
19173
19184
|
return;
|
|
19174
19185
|
}
|
|
19175
19186
|
const queryParams = {
|
|
19176
|
-
preview: 'true'
|
|
19187
|
+
preview: 'true',
|
|
19188
|
+
// Cache-buster marker; createContentUrl() re-resolves it per request when auth is
|
|
19189
|
+
// header-based. Stamped unconditionally since the file is cached before that flag is known.
|
|
19190
|
+
_cache_buster: Date.now().toString(36)
|
|
19177
19191
|
};
|
|
19178
19192
|
if (file.file_version) {
|
|
19179
19193
|
queryParams.version = file.file_version.id;
|