box-content-preview 3.94.0 → 3.95.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 CHANGED
@@ -2,7 +2,7 @@
2
2
  [![Mergify Status](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/box/box-content-preview&style=flat)](https://mergify.io)
3
3
  [![Styled With Prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
4
4
  [![build status](https://img.shields.io/travis/box/box-content-preview/master.svg?style=flat-square)](https://travis-ci.org/box/box-content-preview)
5
- [![version](https://img.shields.io/badge/version-v3.94.0-blue.svg?style=flat-square)](https://github.com/box/box-content-preview)
5
+ [![version](https://img.shields.io/badge/version-v3.95.0-blue.svg?style=flat-square)](https://github.com/box/box-content-preview)
6
6
  [![npm version](https://img.shields.io/npm/v/box-ui-elements.svg?style=flat-square)](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.94.0
25
+ - Version: v3.95.0
26
26
  - Locale: en-US
27
27
 
28
- https://cdn01.boxcdn.net/platform/preview/3.94.0/en-US/preview.js
29
- https://cdn01.boxcdn.net/platform/preview/3.94.0/en-US/preview.css
28
+ https://cdn01.boxcdn.net/platform/preview/3.95.0/en-US/preview.js
29
+ https://cdn01.boxcdn.net/platform/preview/3.95.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.94.0/en-US/preview.js"></script>
55
+ <script src="https://cdn01.boxcdn.net/platform/preview/3.95.0/en-US/preview.js"></script>
56
56
  <link
57
57
  rel="stylesheet"
58
- href="https://cdn01.boxcdn.net/platform/preview/3.94.0/en-US/preview.css"
58
+ href="https://cdn01.boxcdn.net/platform/preview/3.95.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.94.0`
79
+ - Check out a specific version with `git checkout v3.95.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
@@ -1018,7 +1018,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
1018
1018
  const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
1019
1019
  const CLIENT_NAME_KEY = 'box_client_name';
1020
1020
  const CLIENT_VERSION_KEY = 'box_client_version';
1021
- const CLIENT_VERSION = "3.94.0"; // eslint-disable-line no-undef
1021
+ const CLIENT_VERSION = "3.95.0"; // eslint-disable-line no-undef
1022
1022
  const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
1023
1023
  const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
1024
1024
  const PROMISE_MAP = {};
@@ -24650,7 +24650,7 @@ class Browser {
24650
24650
  ;// ./src/lib/Logger.js
24651
24651
  /* eslint-disable no-undef */
24652
24652
  const CLIENT_NAME = "box-content-preview";
24653
- const CLIENT_VERSION = "3.94.0";
24653
+ const CLIENT_VERSION = "3.95.0";
24654
24654
  /* eslint-enable no-undef */
24655
24655
 
24656
24656
  class Logger {
@@ -55034,18 +55034,15 @@ const LOG_RETRY_COUNT = 3; // number of times to retry logging preview event
55034
55034
  const MS_IN_S = 1000; // ms in a sec
55035
55035
  const SUPPORT_URL = 'https://support.box.com';
55036
55036
 
55037
- // All preview assets are relative to preview.js. Here we create a location
55038
- // object that mimics the window location object and points to where
55039
- // preview.js is loaded from by the browser. This needs to be done statically
55040
- // outside the class so that location is found while this script is executing
55041
- // and not when preview is instantiated, which is too late.
55042
- // findScriptLocation throws when there is no preview.js <script> tag in the DOM;
55043
- // npm consumers have no such tag and populate this via Preview.show({ location }).
55044
- let PREVIEW_LOCATION;
55045
- try {
55046
- PREVIEW_LOCATION = (0,util/* findScriptLocation */.Is)(constants/* PREVIEW_SCRIPT_NAME */.Lq, document.currentScript);
55047
- } catch (e) {
55048
- PREVIEW_LOCATION = {};
55037
+ // document.currentScript is this file only while it evaluates.
55038
+ const IS_NPM_BUILD = true && true;
55039
+ let PREVIEW_LOCATION = {};
55040
+ if (!IS_NPM_BUILD) {
55041
+ try {
55042
+ PREVIEW_LOCATION = (0,util/* findScriptLocation */.Is)(constants/* PREVIEW_SCRIPT_NAME */.Lq, document.currentScript);
55043
+ } catch (e) {
55044
+ PREVIEW_LOCATION = {};
55045
+ }
55049
55046
  }
55050
55047
  class Preview extends (events_default()) {
55051
55048
  //--------------------------------------------------------------------------
@@ -55116,10 +55113,6 @@ class Preview extends (events_default()) {
55116
55113
  DEFAULT_DISABLED_VIEWERS.forEach(viewerName => {
55117
55114
  this.disabledViewers[viewerName] = 1;
55118
55115
  });
55119
-
55120
- // All preview assets are relative to preview.js. Here we create a location
55121
- // object that mimics the window location object and points to where
55122
- // preview.js is loaded from by the browser.
55123
55116
  this.location = PREVIEW_LOCATION;
55124
55117
  this.cache = new lib_Cache();
55125
55118
  this.ui = new lib_PreviewUI();
@@ -55188,11 +55181,11 @@ class Preview extends (events_default()) {
55188
55181
  // But it cannot be a random object.
55189
55182
  if (token === null || typeof token !== 'object') {
55190
55183
  // npm consumers have no CDN-served pdfjs at runtime; force the bundled npm pdfjs path.
55191
- const finalOptions = true ? Preview_objectSpread(Preview_objectSpread({}, options), {}, {
55184
+ const finalOptions = IS_NPM_BUILD ? Preview_objectSpread(Preview_objectSpread({}, options), {}, {
55192
55185
  features: Preview_objectSpread({
55193
55186
  useNpmPdfjs: true
55194
55187
  }, options.features || {})
55195
- }) : 0;
55188
+ }) : options;
55196
55189
  this.previewOptions = Preview_objectSpread(Preview_objectSpread({}, finalOptions), {}, {
55197
55190
  token
55198
55191
  });
@@ -55210,6 +55203,11 @@ class Preview extends (events_default()) {
55210
55203
  // Parse the preview options
55211
55204
  this.parseOptions(this.previewOptions);
55212
55205
 
55206
+ // /preview.js parses to locale ''. Throw only when locale is absent.
55207
+ if ((0,util/* getProp */.GT)(this.location, 'locale') == null) {
55208
+ throw new Error('Missing preview location. Load preview.js, or pass location to show().');
55209
+ }
55210
+
55213
55211
  // Load the preview
55214
55212
  this.load(fileIdOrFile);
55215
55213
  }
@@ -57155,8 +57153,10 @@ class Preview extends (events_default()) {
57155
57153
  return (0,util/* getProp */.GT)(this.previewOptions, `fileOptions.${fileId}.${optionName}`);
57156
57154
  }
57157
57155
  }
57158
- globalThis.Box = globalThis.Box || {};
57159
- globalThis.Box.Preview = Preview;
57156
+ if (!IS_NPM_BUILD) {
57157
+ globalThis.Box = globalThis.Box || {};
57158
+ globalThis.Box.Preview = Preview;
57159
+ }
57160
57160
  /* harmony default export */ const lib_Preview = (Preview);
57161
57161
  ;// ./src/index.ts
57162
57162
  // useNpmPdfjs is auto-injected by Preview.show() under __BCP_NPM_BUILD__.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "box-content-preview",
3
- "version": "3.94.0",
3
+ "version": "3.95.0",
4
4
  "description": "Box Content Preview UI Element",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",