Comparing version 3.7.1 to 3.8.0
# bitski | ||
## 3.8.0 | ||
### Minor Changes | ||
- [#403](https://github.com/BitskiCo/bitski-js/pull/403) [`1533a01`](https://github.com/BitskiCo/bitski-js/commit/1533a0158c2ba8ad767d24db147f7ce49d3b638b) Thanks [@chronicIntrovert](https://github.com/chronicIntrovert)! - Hash provider options for reuse or change if new config is passed. | ||
### Patch Changes | ||
- Updated dependencies [[`3d15e50`](https://github.com/BitskiCo/bitski-js/commit/3d15e507bfc54f5ab8e6768c404270c909646b73), [`3d15e50`](https://github.com/BitskiCo/bitski-js/commit/3d15e507bfc54f5ab8e6768c404270c909646b73)]: | ||
- bitski-provider@3.3.2 | ||
## 3.7.1 | ||
@@ -4,0 +15,0 @@ |
@@ -139,3 +139,3 @@ import { createBitskiProvider, LocalStorageStore, } from 'bitski-provider'; | ||
createProvider(options = {}) { | ||
return createBitskiProvider(Object.assign(Object.assign({ clientId: this.clientId, getAccessToken: this.getCurrentAccessToken.bind(this), clearAccessToken: this.signOut.bind(this), getUser: async () => this.authProvider.getUserFromCache(), signerBaseUrl: options.webBaseUrl, transactionCallbackUrl: options.callbackURL }, options), { additionalHeaders: Object.assign({ 'X-CLIENT-VERSION': "bitski-sdk-v3.7.1" }, options.additionalHeaders), prependMiddleware: undefined, signerMethod: 'iframe' })); | ||
return createBitskiProvider(Object.assign(Object.assign({ clientId: this.clientId, getAccessToken: this.getCurrentAccessToken.bind(this), clearAccessToken: this.signOut.bind(this), getUser: async () => this.authProvider.getUserFromCache(), signerBaseUrl: options.webBaseUrl, transactionCallbackUrl: options.callbackURL }, options), { additionalHeaders: Object.assign({ 'X-CLIENT-VERSION': "bitski-sdk-v3.8.0" }, options.additionalHeaders), prependMiddleware: undefined, signerMethod: 'iframe' })); | ||
} | ||
@@ -142,0 +142,0 @@ onSignOut() { |
@@ -5,2 +5,3 @@ import { processCallback } from './-private/utils/callback'; | ||
import { ConnectButton } from './-private/components/connect-button'; | ||
import hash from 'hash-it'; | ||
import { AuthenticationStatus, OAuthSignInMethod } from './-private/constants'; | ||
@@ -23,2 +24,3 @@ // Import these directly so we don't load the whole provider bundle | ||
this.options = options; | ||
this.providerCache = new Map(); | ||
} | ||
@@ -37,2 +39,7 @@ /** | ||
var _a; | ||
const existingProvider = this.providerCache.get(hash(options)); | ||
if (existingProvider) { | ||
this.provider = existingProvider; | ||
return existingProvider; | ||
} | ||
if (typeof window !== 'undefined' && ((_a = window.Bitski) === null || _a === void 0 ? void 0 : _a.getProvider)) { | ||
@@ -49,2 +56,3 @@ return window.Bitski.getProvider(options); | ||
} | ||
this.providerCache.set(hash(options), provider); | ||
return provider; | ||
@@ -51,0 +59,0 @@ } |
@@ -145,3 +145,3 @@ "use strict"; | ||
createProvider(options = {}) { | ||
return (0, bitski_provider_1.createBitskiProvider)(Object.assign(Object.assign({ clientId: this.clientId, getAccessToken: this.getCurrentAccessToken.bind(this), clearAccessToken: this.signOut.bind(this), getUser: async () => this.authProvider.getUserFromCache(), signerBaseUrl: options.webBaseUrl, transactionCallbackUrl: options.callbackURL }, options), { additionalHeaders: Object.assign({ 'X-CLIENT-VERSION': "bitski-sdk-v3.7.1" }, options.additionalHeaders), prependMiddleware: undefined, signerMethod: 'iframe' })); | ||
return (0, bitski_provider_1.createBitskiProvider)(Object.assign(Object.assign({ clientId: this.clientId, getAccessToken: this.getCurrentAccessToken.bind(this), clearAccessToken: this.signOut.bind(this), getUser: async () => this.authProvider.getUserFromCache(), signerBaseUrl: options.webBaseUrl, transactionCallbackUrl: options.callbackURL }, options), { additionalHeaders: Object.assign({ 'X-CLIENT-VERSION': "bitski-sdk-v3.8.0" }, options.additionalHeaders), prependMiddleware: undefined, signerMethod: 'iframe' })); | ||
} | ||
@@ -148,0 +148,0 @@ onSignOut() { |
@@ -20,2 +20,3 @@ import { BitskiProviderShim } from './provider-shim'; | ||
private provider?; | ||
private providerCache; | ||
/** | ||
@@ -22,0 +23,0 @@ * Alternative to using our static callback.html file. Call this from your own redirect page. |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,2 +11,3 @@ exports.LOGIN_PROMPT = exports.LOGIN_HINT_SIGNUP = exports.Bitski = exports.OAuthSignInMethod = exports.AuthenticationStatus = exports.Mumbai = exports.Polygon = exports.Goerli = exports.Mainnet = exports.BinanceSmartChainTestnet = exports.BinanceSmartChain = void 0; | ||
const connect_button_1 = require("./-private/components/connect-button"); | ||
const hash_it_1 = __importDefault(require("hash-it")); | ||
const constants_1 = require("./-private/constants"); | ||
@@ -33,2 +37,3 @@ Object.defineProperty(exports, "AuthenticationStatus", { enumerable: true, get: function () { return constants_1.AuthenticationStatus; } }); | ||
this.options = options; | ||
this.providerCache = new Map(); | ||
} | ||
@@ -47,2 +52,7 @@ /** | ||
var _a; | ||
const existingProvider = this.providerCache.get((0, hash_it_1.default)(options)); | ||
if (existingProvider) { | ||
this.provider = existingProvider; | ||
return existingProvider; | ||
} | ||
if (typeof window !== 'undefined' && ((_a = window.Bitski) === null || _a === void 0 ? void 0 : _a.getProvider)) { | ||
@@ -59,2 +69,3 @@ return window.Bitski.getProvider(options); | ||
} | ||
this.providerCache.set((0, hash_it_1.default)(options), provider); | ||
return provider; | ||
@@ -61,0 +72,0 @@ } |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "3.7.1", | ||
"version": "3.8.0", | ||
"scripts": { | ||
@@ -26,5 +26,6 @@ "lint": "eslint . --cache", | ||
"@openid/appauth": "^1.2.6", | ||
"bitski-provider": "^3.3.1", | ||
"bitski-provider": "^3.3.2", | ||
"decoders": "^2.0.1", | ||
"eth-provider-types": "^0.2.0", | ||
"decoders": "^2.0.1" | ||
"hash-it": "^6.0.0" | ||
}, | ||
@@ -31,0 +32,0 @@ "devDependencies": { |
@@ -5,2 +5,3 @@ import { processCallback } from './-private/utils/callback'; | ||
import { ConnectButton, ConnectButtonOptions } from './-private/components/connect-button'; | ||
import hash from 'hash-it'; | ||
@@ -44,3 +45,3 @@ import type { User } from './-private/auth/user'; | ||
private provider?: BitskiProviderShim; | ||
private providerCache = new Map<number, BitskiProviderShim>(); | ||
/** | ||
@@ -72,2 +73,9 @@ * Alternative to using our static callback.html file. Call this from your own redirect page. | ||
public getProvider(options?: ProviderOptions | string): BitskiProviderShim { | ||
const existingProvider = this.providerCache.get(hash(options)); | ||
if (existingProvider) { | ||
this.provider = existingProvider; | ||
return existingProvider; | ||
} | ||
if (typeof window !== 'undefined' && window.Bitski?.getProvider) { | ||
@@ -92,2 +100,4 @@ return window.Bitski.getProvider(options); | ||
this.providerCache.set(hash(options), provider); | ||
return provider; | ||
@@ -94,0 +104,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1076506
21488
5
+ Addedhash-it@^6.0.0
+ Addedhash-it@6.0.0(transitive)
Updatedbitski-provider@^3.3.2