@schibsted/account-sdk-browser 5.1.1 → 5.2.1
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 +7 -8
- package/es5/global.js +233 -89
- package/es5/global.js.map +1 -1
- package/es5/global.min.js +1 -1
- package/es5/global.min.js.map +1 -1
- package/es5/identity.js +224 -80
- package/es5/identity.js.map +1 -1
- package/es5/identity.min.js +1 -1
- package/es5/identity.min.js.map +1 -1
- package/es5/index.js +233 -89
- package/es5/index.js.map +1 -1
- package/es5/index.min.js +1 -1
- package/es5/index.min.js.map +1 -1
- package/es5/monetization.js +224 -88
- package/es5/monetization.js.map +1 -1
- package/es5/monetization.min.js +1 -1
- package/es5/monetization.min.js.map +1 -1
- package/es5/payment.js +212 -76
- package/es5/payment.js.map +1 -1
- package/es5/payment.min.js +1 -1
- package/es5/payment.min.js.map +1 -1
- package/package.json +1 -1
- package/src/RESTClient.js +6 -2
- package/src/identity.d.ts +11 -1
- package/src/identity.js +11 -4
- package/src/version.js +1 -1
package/package.json
CHANGED
package/src/RESTClient.js
CHANGED
|
@@ -76,7 +76,9 @@ export class RESTClient {
|
|
|
76
76
|
constructor({ serverUrl = 'PRE', envDic, fetch = globalFetch(), log, defaultParams = {}}) {
|
|
77
77
|
assert(isObject(defaultParams), `defaultParams should be a non-null object`);
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
const mappedUrl = urlMapper(serverUrl, envDic);
|
|
80
|
+
const handledServerUrl = mappedUrl.endsWith('/') ? mappedUrl : `${mappedUrl}/`;
|
|
81
|
+
this.url = new URL(handledServerUrl);
|
|
80
82
|
|
|
81
83
|
this.defaultParams = defaultParams;
|
|
82
84
|
|
|
@@ -157,7 +159,9 @@ export class RESTClient {
|
|
|
157
159
|
* @return {string} - the resulting url string ready to pass to fetch
|
|
158
160
|
*/
|
|
159
161
|
makeUrl(pathname = '', query = {}, useDefaultParams = true) {
|
|
160
|
-
const
|
|
162
|
+
const handledPathname = pathname.startsWith('/') ? pathname.slice(1) : pathname;
|
|
163
|
+
|
|
164
|
+
const url = new URL(handledPathname, this.url);
|
|
161
165
|
url.search = RESTClient.search(query, useDefaultParams, this.defaultParams);
|
|
162
166
|
return url.href;
|
|
163
167
|
}
|
package/src/identity.d.ts
CHANGED
|
@@ -304,9 +304,10 @@ export class Identity extends TinyEmitter {
|
|
|
304
304
|
* @param {string} [options.locale]
|
|
305
305
|
* @param {boolean} [options.oneStepLogin=false]
|
|
306
306
|
* @param {string} [options.prompt=select_account]
|
|
307
|
+
* @param {string} [options.xDomainId]
|
|
307
308
|
* @return {Window|null} - Reference to popup window if created (or `null` otherwise)
|
|
308
309
|
*/
|
|
309
|
-
login({ state, acrValues, scope, redirectUri, preferPopup, loginHint, tag, teaser, maxAge, locale, oneStepLogin, prompt }: LoginOptions): Window | null;
|
|
310
|
+
login({ state, acrValues, scope, redirectUri, preferPopup, loginHint, tag, teaser, maxAge, locale, oneStepLogin, prompt, xDomainId }: LoginOptions): Window | null;
|
|
310
311
|
/**
|
|
311
312
|
* @async
|
|
312
313
|
* @summary Retrieve the sp_id (Varnish ID)
|
|
@@ -439,6 +440,11 @@ export type LoginOptions = {
|
|
|
439
440
|
* End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
|
|
440
441
|
*/
|
|
441
442
|
prompt?: string;
|
|
443
|
+
/**
|
|
444
|
+
* - Identifier for cross-domain tracking in Pulse
|
|
445
|
+
*/
|
|
446
|
+
xDomainId?: string;
|
|
447
|
+
|
|
442
448
|
};
|
|
443
449
|
export type SimplifiedLoginWidgetLoginOptions = {
|
|
444
450
|
/**
|
|
@@ -508,6 +514,10 @@ export type SimplifiedLoginWidgetLoginOptions = {
|
|
|
508
514
|
* End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
|
|
509
515
|
*/
|
|
510
516
|
prompt?: string;
|
|
517
|
+
/**
|
|
518
|
+
* - Identifier for cross-domain tracking in Pulse
|
|
519
|
+
*/
|
|
520
|
+
xDomainId?: string;
|
|
511
521
|
};
|
|
512
522
|
export type HasSessionSuccessResponse = {
|
|
513
523
|
/**
|
package/src/identity.js
CHANGED
|
@@ -204,6 +204,8 @@ export class Identity extends EventEmitter {
|
|
|
204
204
|
this._session = {};
|
|
205
205
|
|
|
206
206
|
this._setSessionServiceUrl(sessionDomain);
|
|
207
|
+
this._usedSessionServiceGetSessionEndpoint = this._sessionService.url.pathname && this._sessionService.url.pathname.length <= 1 ? 'session' : 'v2/session';
|
|
208
|
+
|
|
207
209
|
this._setSpidServerUrl(env);
|
|
208
210
|
this._setBffServerUrl(env);
|
|
209
211
|
this._setOauthServerUrl(env);
|
|
@@ -589,7 +591,7 @@ export class Identity extends EventEmitter {
|
|
|
589
591
|
}
|
|
590
592
|
let sessionData = null;
|
|
591
593
|
try {
|
|
592
|
-
sessionData = await this._sessionService.get(
|
|
594
|
+
sessionData = await this._sessionService.get(this._usedSessionServiceGetSessionEndpoint, {tabId: this._getTabId()});
|
|
593
595
|
} catch (err) {
|
|
594
596
|
if (err && err.code === 400 && this._enableSessionCaching) {
|
|
595
597
|
const expiresIn = 1000 * (err.expiresIn || 300);
|
|
@@ -852,6 +854,7 @@ export class Identity extends EventEmitter {
|
|
|
852
854
|
* @param {string} [options.locale]
|
|
853
855
|
* @param {boolean} [options.oneStepLogin=false]
|
|
854
856
|
* @param {string} [options.prompt=select_account]
|
|
857
|
+
* @param {string} [options.xDomainId]
|
|
855
858
|
* @return {Window|null} - Reference to popup window if created (or `null` otherwise)
|
|
856
859
|
*/
|
|
857
860
|
login({
|
|
@@ -866,7 +869,8 @@ export class Identity extends EventEmitter {
|
|
|
866
869
|
maxAge = '',
|
|
867
870
|
locale = '',
|
|
868
871
|
oneStepLogin = false,
|
|
869
|
-
prompt = 'select_account'
|
|
872
|
+
prompt = 'select_account',
|
|
873
|
+
xDomainId = ''
|
|
870
874
|
}) {
|
|
871
875
|
this._closePopup();
|
|
872
876
|
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
@@ -881,7 +885,8 @@ export class Identity extends EventEmitter {
|
|
|
881
885
|
maxAge,
|
|
882
886
|
locale,
|
|
883
887
|
oneStepLogin,
|
|
884
|
-
prompt
|
|
888
|
+
prompt,
|
|
889
|
+
xDomainId
|
|
885
890
|
});
|
|
886
891
|
|
|
887
892
|
if (preferPopup) {
|
|
@@ -952,6 +957,7 @@ export class Identity extends EventEmitter {
|
|
|
952
957
|
locale = '',
|
|
953
958
|
oneStepLogin = false,
|
|
954
959
|
prompt = 'select_account',
|
|
960
|
+
xDomainId = ''
|
|
955
961
|
}) {
|
|
956
962
|
if (typeof arguments[0] !== 'object') {
|
|
957
963
|
// backward compatibility
|
|
@@ -984,7 +990,8 @@ export class Identity extends EventEmitter {
|
|
|
984
990
|
max_age: maxAge,
|
|
985
991
|
locale,
|
|
986
992
|
one_step_login: oneStepLogin || '',
|
|
987
|
-
prompt: acrValues ? '' : prompt
|
|
993
|
+
prompt: acrValues ? '' : prompt,
|
|
994
|
+
x_domain_id: xDomainId
|
|
988
995
|
});
|
|
989
996
|
}
|
|
990
997
|
|
package/src/version.js
CHANGED