Skip to content

Commit

Permalink
chore(deps): Upgrade preview and production dependencies (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored Jan 11, 2020
1 parent b49e6dd commit 6102a0d
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 159 deletions.
60 changes: 29 additions & 31 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="stylesheet" href='./styles.css' />
<link rel="stylesheet" href='https://cdn01.boxcdn.net/platform/preview/2.4.0/en-US/preview.css' />
<link rel="stylesheet" href='https://unpkg.com/box-annotations/lib/annotations.css' />
<script src='https://cdn01.boxcdn.net/polyfills/core-js/2.5.3/core.min.js'></script>
<script src='https://cdn01.boxcdn.net/platform/preview/2.4.0/en-US/preview.js'></script>
<script src='https://unpkg.com/box-annotations/lib/annotations.js'></script>
<link rel="stylesheet" href="./styles.css" />
<link rel="stylesheet" href="https://cdn01.boxcdn.net/platform/preview/2.32.1/en-US/preview.css" />
<link rel="stylesheet" href="https://unpkg.com/box-annotations/lib/annotations.css" />
<script src="https://cdn01.boxcdn.net/polyfills/core-js/2.5.3/core.min.js"></script>
<script src="https://cdn01.boxcdn.net/platform/preview/2.32.1/en-US/preview.js"></script>
<script src="https://unpkg.com/box-annotations/lib/annotations.js"></script>
</head>

<body>
<div class='setters-container'>
<div class='container' id='token'>
<div> Token: <span id='token-display'></span> </div>
<input id='token-set' placeholder='Enter token' />
<button onClick="setProperty('token')">Set new token</button>
</div>
<div class="setters-container">
<div class="container" id="token">
<div>Token: <span id="token-display"></span></div>
<input id="token-set" placeholder="Enter token" />
<button onClick="setProperty('token')">Set new token</button>
</div>

<div class='container' id='file'>
<div> File ID: <span id='fileid-display'></span></div>
<input id='fileid-set' placeholder='Enter file ID' />
<button onClick="setProperty('fileid')">Set new file ID</button>
</div>
<div class="container" id="file">
<div>File ID: <span id="fileid-display"></span></div>
<input id="fileid-set" placeholder="Enter file ID" />
<button onClick="setProperty('fileid')">Set new file ID</button>
</div>
</div>

<div class='preview-container'> </div>
<div class="preview-container"></div>
<script>
function setProperty(selector) {
// Get new value, fallback to local storage
var inputValue = document.querySelector('#' + selector + '-set')
value = inputValue && inputValue.value || localStorage.getItem(selector);

var inputValue = document.querySelector('#' + selector + '-set');
value = (inputValue && inputValue.value) || localStorage.getItem(selector);

if (!value) {
return;
Expand All @@ -42,7 +41,7 @@
displayElement.textContent = value;

// Cache it in local storage
localStorage.setItem(selector, value)
localStorage.setItem(selector, value);

// Attempt to load Preview + Annotations
loadPreview();
Expand All @@ -52,21 +51,21 @@
var token = localStorage.getItem('token');
var fileid = localStorage.getItem('fileid');

if ( !token || !fileid) {
if (!token || !fileid) {
return;
}

// Load Preview + Annotations with the passed in file ID
var options = {
Image: {
enabledTypes: ["point"]
enabledTypes: ['point'],
},
Document: {
enabledTypes: ["draw", "point", "highlight-comment", "highlight"]
enabledTypes: ['draw', 'point', 'highlight-comment', 'highlight'],
},
Presentation: {
enabledTypes: ["draw", "point", "highlight-comment", "highlight"]
}
enabledTypes: ['draw', 'point', 'highlight-comment', 'highlight'],
},
};

/* global BoxAnnotations */
Expand All @@ -75,10 +74,9 @@
/* global Box */
var preview = new Box.Preview();
preview.show(fileid, token, {
container: ".preview-container",
boxAnnotations: annotations
container: '.preview-container',
boxAnnotations: annotations,
});

}

// Try to load all properties from storage on page load
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"yarn": ">=1.10.0"
},
"dependencies": {
"axios": "^0.18.0",
"bluebird": "^3.5.2",
"axios": "^0.19.1",
"bluebird": "^3.7.2",
"box-react-ui": "^29.0.0",
"chai": "^4.1.2",
"chai-dom": "^1.8.0",
Expand All @@ -31,27 +31,27 @@
"mousetrap": "^1.6.2",
"pikaday": "^1.8.0",
"rangy": "^1.3.0",
"rbush": "^2.0.1",
"react": "^16.4.2",
"react-dom": "^16.3.1",
"react-intl": "^2.4.0",
"react-tether": "^1.0.1",
"react-textarea-autosize": "^7.0.4",
"scroll-into-view-if-needed": "^2.2.16",
"tabbable": "^3.1.1",
"whatwg-fetch": "^2.0.3"
"rbush": "^3.0.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-intl": "^2.9.0",
"react-tether": "1.0.5",
"react-textarea-autosize": "^7.1.2",
"scroll-into-view-if-needed": "^2.2.22",
"tabbable": "^3.1.2",
"whatwg-fetch": "^3.0.0"
},
"peerDependencies": {
"box-react-ui": "^29.0.0",
"form-serialize": "^0.7.2",
"immutable": "^3.7.4",
"react": "^16.4.2",
"react-dom": "^16.3.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-immutable-proptypes": "^2.1.0",
"react-intl": "^2.4.0",
"react-intl": "^2.9.0",
"react-process-string": "^1.2.0",
"react-textarea-autosize": "^7.0.4",
"scroll-into-view-if-needed": "^2.2.16"
"react-textarea-autosize": "^7.1.2",
"scroll-into-view-if-needed": "^2.2.22"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
Expand Down
60 changes: 29 additions & 31 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="stylesheet" href='./styles.css' />
<link rel="stylesheet" href='https://cdn01.boxcdn.net/platform/preview/2.4.0/en-US/preview.css' />
<link rel="stylesheet" href='./annotations.css' />
<script src='https://cdn01.boxcdn.net/polyfills/core-js/2.5.3/core.min.js'></script>
<script src='https://cdn01.boxcdn.net/platform/preview/2.4.0/en-US/preview.js'></script>
<script src='./annotations.js'></script>
<link rel="stylesheet" href="./styles.css" />
<link rel="stylesheet" href="https://cdn01.boxcdn.net/platform/preview/2.32.1/en-US/preview.css" />
<link rel="stylesheet" href="./annotations.css" />
<script src="https://cdn01.boxcdn.net/polyfills/core-js/2.5.3/core.min.js"></script>
<script src="https://cdn01.boxcdn.net/platform/preview/2.32.1/en-US/preview.js"></script>
<script src="./annotations.js"></script>
</head>

<body>
<div class='setters-container'>
<div class='container' id='token'>
<div> Token: <span id='token-display'></span> </div>
<input id='token-set' data-testid="token" placeholder='Enter token' />
<button onClick="setProperty('token')" data-testid="token-set">Set new token</button>
</div>
<div class="setters-container">
<div class="container" id="token">
<div>Token: <span id="token-display"></span></div>
<input id="token-set" data-testid="token" placeholder="Enter token" />
<button onClick="setProperty('token')" data-testid="token-set">Set new token</button>
</div>

<div class='container' id='file'>
<div> File ID: <span id='fileid-display'></span></div>
<input id='fileid-set' placeholder='Enter file ID' data-testid="fileid"/>
<button onClick="setProperty('fileid')" data-testid="fileid-set">Set new file ID</button>
</div>
<div class="container" id="file">
<div>File ID: <span id="fileid-display"></span></div>
<input id="fileid-set" placeholder="Enter file ID" data-testid="fileid" />
<button onClick="setProperty('fileid')" data-testid="fileid-set">Set new file ID</button>
</div>
</div>

<div class="preview-container" data-testid="preview-container"> </div>
<div class="preview-container" data-testid="preview-container"></div>
<script>
function setProperty(selector) {
// Get new value, fallback to local storage
var inputValue = document.querySelector('#' + selector + '-set')
value = inputValue && inputValue.value || localStorage.getItem(selector);

var inputValue = document.querySelector('#' + selector + '-set');
value = (inputValue && inputValue.value) || localStorage.getItem(selector);

if (!value) {
return;
Expand All @@ -42,7 +41,7 @@
displayElement.textContent = value;

// Cache it in local storage
localStorage.setItem(selector, value)
localStorage.setItem(selector, value);

// Attempt to load Preview + Annotations
loadPreview();
Expand All @@ -52,21 +51,21 @@
var token = localStorage.getItem('token');
var fileid = localStorage.getItem('fileid');

if ( !token || !fileid) {
if (!token || !fileid) {
return;
}

// Load Preview + Annotations with the passed in file ID
var options = {
Image: {
enabledTypes: ["point"]
enabledTypes: ['point'],
},
Document: {
enabledTypes: ["draw", "point", "highlight-comment", "highlight"]
enabledTypes: ['draw', 'point', 'highlight-comment', 'highlight'],
},
Presentation: {
enabledTypes: ["draw", "point", "highlight-comment", "highlight"]
}
enabledTypes: ['draw', 'point', 'highlight-comment', 'highlight'],
},
};

/* global BoxAnnotations */
Expand All @@ -75,10 +74,9 @@
/* global Box */
var preview = new Box.Preview();
preview.show(fileid, token, {
container: ".preview-container",
boxAnnotations: annotations
container: '.preview-container',
boxAnnotations: annotations,
});

}

// Try to load all properties from storage on page load
Expand Down
Loading

0 comments on commit 6102a0d

Please sign in to comment.