From f20c764bf807144a3c9a431787e6c375ac6edd08 Mon Sep 17 00:00:00 2001 From: niculescu-bogdan-constantin Date: Wed, 3 Apr 2024 14:45:53 +0200 Subject: [PATCH 1/2] move navigation in hasSessionInProgress --- package.json | 2 +- src/identity.js | 11 +++++++---- src/version.js | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 48068bf..eaf60fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@schibsted/account-sdk-browser", - "version": "4.8.7-beta.3", + "version": "4.8.7-beta.4", "description": "Schibsted account SDK for browsers", "main": "index.js", "type": "module", diff --git a/src/identity.js b/src/identity.js index 64946ab..fb1a55d 100644 --- a/src/identity.js +++ b/src/identity.js @@ -530,14 +530,12 @@ export class Identity extends EventEmitter { throw err; } - if(sessionData){ + if (sessionData){ // for expiring session and safari browser do full page redirect to gain new session if(_checkRedirectionNeed(sessionData)){ await this.callbackBeforeRedirect(); - this.window.location.href = this._sessionService.makeUrl(sessionData.redirectURL); - - return; + return this._sessionService.makeUrl(sessionData.redirectURL); } if (this._enableSessionCaching) { @@ -552,6 +550,11 @@ export class Identity extends EventEmitter { .then( sessionData => { this._hasSessionInProgress = false; + + if (typeof sessionData === 'string' && isUrl(sessionData)) { + return this.window.location.href = sessionData; + } + return sessionData; }, err => { diff --git a/src/version.js b/src/version.js index d2a263c..486704c 100644 --- a/src/version.js +++ b/src/version.js @@ -1,5 +1,5 @@ // Automatically generated in 'npm version' by scripts/genversion.js 'use strict' -const version = '4.8.7-beta.3'; +const version = '4.8.7-beta.4'; export default version; From 9da2310120edce4b56bd1772daf313a1eafe30a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20W=C3=B3jcik?= Date: Wed, 3 Apr 2024 15:57:33 +0200 Subject: [PATCH 2/2] fix: update package.json --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index e203d9e..2e14ccf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@schibsted/account-sdk-browser", - "version": "4.8.7-beta.3", + "version": "4.8.7-beta.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@schibsted/account-sdk-browser", - "version": "4.8.7-beta.3", + "version": "4.8.7-beta.4", "license": "MIT", "dependencies": { "tiny-emitter": "^2.1.0"