@cimpress/simple-auth-wrapper
Advanced tools
Comparing version 7.2.1 to 8.0.0
# Changelog | ||
## 8.0 (2021-08-18) | ||
Remove the Promise polyfill. | ||
## 7.2.1 (2021-07-22) | ||
@@ -4,0 +8,0 @@ |
@@ -13,7 +13,3 @@ "use strict"; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === "undefined" ? require("es6-promise").Promise : Promise; | ||
// https://auth0.com/docs/api-auth/tutorials/authorization-code-grant | ||
var AuthorizationCodeGrant = function () { | ||
@@ -55,3 +51,3 @@ function AuthorizationCodeGrant() { | ||
this.auth0.authorize({ state: state }); | ||
return _Promise.resolve(); | ||
return Promise.resolve(); | ||
} | ||
@@ -72,3 +68,3 @@ }, { | ||
return _Promise.resolve({ authorizationCode: authorizationCode, redirectUri: this.redirectUri, nextUri: nextUri }); | ||
return Promise.resolve({ authorizationCode: authorizationCode, redirectUri: this.redirectUri, nextUri: nextUri }); | ||
} else if (this.wasAuth0Redirect()) { | ||
@@ -78,3 +74,3 @@ return this.handleRedirect({ performRedirect: performRedirect }); | ||
return _Promise.resolve({}); | ||
return Promise.resolve({}); | ||
} | ||
@@ -102,6 +98,6 @@ }, { | ||
return _Promise.resolve({}); | ||
return Promise.resolve({}); | ||
} | ||
return _Promise.resolve({ authorizationCode: authorizationCode, redirectUri: this.redirectUri, nextUri: nextUri }); | ||
return Promise.resolve({ authorizationCode: authorizationCode, redirectUri: this.redirectUri, nextUri: nextUri }); | ||
} | ||
@@ -108,0 +104,0 @@ }]); |
@@ -27,7 +27,2 @@ 'use strict'; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
_promisify.promisify.Promise = _Promise; | ||
/// quickstart | ||
@@ -312,6 +307,6 @@ /// https://auth0.com/docs/quickstart/spa/vanillajs | ||
_this.setExpirationTimer(); | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
if (!window.location.hash) { | ||
return _Promise.resolve(false); | ||
return Promise.resolve(false); | ||
} | ||
@@ -364,3 +359,3 @@ var parseHash = (0, _promisify.promisify)(_this.auth0.parseHash.bind(_this.auth0)); | ||
if (_this.isLoggedIn() && !forceLogin) { | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
@@ -411,3 +406,3 @@ | ||
if (authenticated) { | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
@@ -414,0 +409,0 @@ |
@@ -9,5 +9,2 @@ 'use strict'; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
var Delegation = | ||
@@ -37,3 +34,3 @@ /// Delegation token should not be necessary once everyone moves to V2 | ||
if (delegationTokenWrapper && tokenValid) { | ||
return _Promise.resolve(delegationTokenWrapper.token); | ||
return Promise.resolve(delegationTokenWrapper.token); | ||
} else { | ||
@@ -40,0 +37,0 @@ var headers = new Headers({ |
@@ -40,4 +40,2 @@ 'use strict'; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
var SESSION_API_URL = 'https://sessions.cimpress.io/v1/sessions'; | ||
@@ -204,3 +202,3 @@ var PROFILE_API_URL = 'https://profile.cimpress.io/v1/profile'; | ||
case 8: | ||
return _context.abrupt('return', _Promise.resolve(false)); | ||
return _context.abrupt('return', Promise.resolve(false)); | ||
@@ -272,3 +270,3 @@ case 9: | ||
window.location = 'https://' + _this.domain + '/authorize?' + _qs2.default.stringify(queryStringParams); | ||
return _Promise.resolve(); | ||
return Promise.resolve(); | ||
}; | ||
@@ -316,7 +314,7 @@ | ||
_this.setSessionExpirationTimer(); | ||
return _context3.abrupt('return', _Promise.resolve(true)); | ||
return _context3.abrupt('return', Promise.resolve(true)); | ||
case 13: | ||
_this.clearLocalParams(); | ||
return _context3.abrupt('return', _Promise.resolve(false)); | ||
return _context3.abrupt('return', Promise.resolve(false)); | ||
@@ -346,3 +344,3 @@ case 15: | ||
if (authenticated) { | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
@@ -485,3 +483,3 @@ | ||
case 4: | ||
return _context6.abrupt('return', _Promise.resolve({})); | ||
return _context6.abrupt('return', Promise.resolve({})); | ||
@@ -488,0 +486,0 @@ case 5: |
@@ -17,7 +17,2 @@ 'use strict'; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
_promisify.promisify.Promise = _Promise; | ||
var UserMetadata = | ||
@@ -24,0 +19,0 @@ // requires either an embeddedAuth(default or centralizedAuth) |
{ | ||
"name": "@cimpress/simple-auth-wrapper", | ||
"version": "7.2.1", | ||
"version": "8.0.0", | ||
"description": "A simple utility class to wrap basic Auth0 functionality", | ||
@@ -19,3 +19,2 @@ "main": "lib/index.js", | ||
"auth0-js": "^9.14.0", | ||
"es6-promise": "^4.2.2", | ||
"events": "^2.0.0", | ||
@@ -22,0 +21,0 @@ "lodash.merge": "^4.6.2", |
import { WebAuth } from "auth0-js"; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === "undefined" ? require("es6-promise").Promise : Promise; | ||
// https://auth0.com/docs/api-auth/tutorials/authorization-code-grant | ||
@@ -32,3 +29,3 @@ export default class AuthorizationCodeGrant { | ||
this.auth0.authorize({ state }); | ||
return _Promise.resolve(); | ||
return Promise.resolve(); | ||
} | ||
@@ -46,3 +43,3 @@ | ||
return _Promise.resolve({ authorizationCode, redirectUri: this.redirectUri, nextUri }); | ||
return Promise.resolve({ authorizationCode, redirectUri: this.redirectUri, nextUri }); | ||
} | ||
@@ -54,3 +51,3 @@ | ||
return _Promise.resolve({}); | ||
return Promise.resolve({}); | ||
} | ||
@@ -74,7 +71,7 @@ | ||
return _Promise.resolve({}); | ||
return Promise.resolve({}); | ||
} | ||
return _Promise.resolve({ authorizationCode, redirectUri: this.redirectUri, nextUri }); | ||
return Promise.resolve({ authorizationCode, redirectUri: this.redirectUri, nextUri }); | ||
} | ||
} |
@@ -6,7 +6,2 @@ import Auth0 from 'auth0-js'; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
const _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
promisify.Promise = _Promise; | ||
/// quickstart | ||
@@ -238,6 +233,6 @@ /// https://auth0.com/docs/quickstart/spa/vanillajs | ||
this.setExpirationTimer(); | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
if (!window.location.hash) { | ||
return _Promise.resolve(false); | ||
return Promise.resolve(false); | ||
} | ||
@@ -290,3 +285,3 @@ const parseHash = promisify(this.auth0.parseHash.bind(this.auth0)); | ||
if (this.isLoggedIn() && !forceLogin) { | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
@@ -338,3 +333,3 @@ | ||
if (authenticated) { | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
@@ -341,0 +336,0 @@ |
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
export default class Delegation{ | ||
@@ -29,3 +26,3 @@ /// Delegation token should not be necessary once everyone moves to V2 | ||
if (delegationTokenWrapper && tokenValid) { | ||
return _Promise.resolve(delegationTokenWrapper.token); | ||
return Promise.resolve(delegationTokenWrapper.token); | ||
} else { | ||
@@ -32,0 +29,0 @@ let headers = new Headers({ |
@@ -9,4 +9,2 @@ import shaJs from 'sha.js' | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
const SESSION_API_URL = 'https://sessions.cimpress.io/v1/sessions'; | ||
@@ -84,3 +82,3 @@ const PROFILE_API_URL = 'https://profile.cimpress.io/v1/profile'; | ||
} else { | ||
return _Promise.resolve(false); | ||
return Promise.resolve(false); | ||
} | ||
@@ -144,3 +142,3 @@ }; | ||
window.location = `https://${this.domain}/authorize?${qs.stringify(queryStringParams)}`; | ||
return _Promise.resolve(); | ||
return Promise.resolve(); | ||
} | ||
@@ -161,7 +159,7 @@ | ||
this.setSessionExpirationTimer(); | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
} | ||
this.clearLocalParams(); | ||
return _Promise.resolve(false); | ||
return Promise.resolve(false); | ||
} | ||
@@ -178,3 +176,3 @@ | ||
if (authenticated) { | ||
return _Promise.resolve(true); | ||
return Promise.resolve(true); | ||
} | ||
@@ -260,3 +258,3 @@ | ||
} else { | ||
return _Promise.resolve({}); | ||
return Promise.resolve({}); | ||
} | ||
@@ -263,0 +261,0 @@ } |
import Auth0 from 'auth0-js'; | ||
import { promisify } from './promisify'; | ||
// if promise hasn't been polyfilled polyfill it just for this file | ||
var _Promise = typeof Promise === 'undefined' ? require('es6-promise').Promise : Promise; | ||
promisify.Promise = _Promise; | ||
export default class UserMetadata{ | ||
@@ -10,0 +5,0 @@ // requires either an embeddedAuth(default or centralizedAuth) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7
211893
2804
- Removedes6-promise@^4.2.2