@schibsted/account-sdk-browser 5.2.1 → 5.2.3
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/es5/global.js +36 -13
- 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 +36 -13
- 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 +36 -13
- 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 +1 -1
- package/es5/monetization.js.map +1 -1
- package/es5/monetization.min.js +1 -1
- package/es5/monetization.min.js.map +1 -1
- package/package.json +1 -1
- package/src/identity.d.ts +24 -3
- package/src/identity.js +32 -13
- package/src/version.js +1 -1
package/package.json
CHANGED
package/src/identity.d.ts
CHANGED
|
@@ -305,9 +305,11 @@ export class Identity extends TinyEmitter {
|
|
|
305
305
|
* @param {boolean} [options.oneStepLogin=false]
|
|
306
306
|
* @param {string} [options.prompt=select_account]
|
|
307
307
|
* @param {string} [options.xDomainId]
|
|
308
|
+
* @param {string} [options.xEnvironmentId]
|
|
309
|
+
* @param {string} [options.originCampaign]
|
|
308
310
|
* @return {Window|null} - Reference to popup window if created (or `null` otherwise)
|
|
309
311
|
*/
|
|
310
|
-
login({ state, acrValues, scope, redirectUri, preferPopup, loginHint, tag, teaser, maxAge, locale, oneStepLogin, prompt, xDomainId }: LoginOptions): Window | null;
|
|
312
|
+
login({ state, acrValues, scope, redirectUri, preferPopup, loginHint, tag, teaser, maxAge, locale, oneStepLogin, prompt, xDomainId, xEnvironmentId, originCampaign }: LoginOptions): Window | null;
|
|
311
313
|
/**
|
|
312
314
|
* @async
|
|
313
315
|
* @summary Retrieve the sp_id (Varnish ID)
|
|
@@ -337,9 +339,12 @@ export class Identity extends TinyEmitter {
|
|
|
337
339
|
* @param {string} [options.locale]
|
|
338
340
|
* @param {boolean} [options.oneStepLogin=false]
|
|
339
341
|
* @param {string} [options.prompt=select_account]
|
|
342
|
+
* @param {string} [options.xDomainId]
|
|
343
|
+
* @param {string} [options.xEnvironmentId]
|
|
344
|
+
* @param {string} [options.originCampaign]
|
|
340
345
|
* @return {string} - The url
|
|
341
346
|
*/
|
|
342
|
-
loginUrl({ state, acrValues, scope, redirectUri, loginHint, tag, teaser, maxAge, locale, oneStepLogin, prompt, }: LoginOptions, ...args: any[]): string;
|
|
347
|
+
loginUrl({ state, acrValues, scope, redirectUri, loginHint, tag, teaser, maxAge, locale, oneStepLogin, prompt, xDomainId, xEnvironmentId, originCampaign }: LoginOptions, ...args: any[]): string;
|
|
343
348
|
/**
|
|
344
349
|
* The url for logging the user out
|
|
345
350
|
* @param {string} [redirectUri=this.redirectUri]
|
|
@@ -444,7 +449,14 @@ export type LoginOptions = {
|
|
|
444
449
|
* - Identifier for cross-domain tracking in Pulse
|
|
445
450
|
*/
|
|
446
451
|
xDomainId?: string;
|
|
447
|
-
|
|
452
|
+
/**
|
|
453
|
+
* - Environment for cross-domain tracking in Pulse
|
|
454
|
+
*/
|
|
455
|
+
xEnvironmentId?: string;
|
|
456
|
+
/**
|
|
457
|
+
* - Campaign identifier for tracking in Pulse
|
|
458
|
+
*/
|
|
459
|
+
originCampaign?: string;
|
|
448
460
|
};
|
|
449
461
|
export type SimplifiedLoginWidgetLoginOptions = {
|
|
450
462
|
/**
|
|
@@ -518,6 +530,15 @@ export type SimplifiedLoginWidgetLoginOptions = {
|
|
|
518
530
|
* - Identifier for cross-domain tracking in Pulse
|
|
519
531
|
*/
|
|
520
532
|
xDomainId?: string;
|
|
533
|
+
/**
|
|
534
|
+
* - Environment for cross-domain tracking in Pulse
|
|
535
|
+
*/
|
|
536
|
+
xEnvironmentId?: string;
|
|
537
|
+
/**
|
|
538
|
+
* - Campaign identifier for tracking in Pulse
|
|
539
|
+
*/
|
|
540
|
+
originCampaign?: string;
|
|
541
|
+
|
|
521
542
|
};
|
|
522
543
|
export type HasSessionSuccessResponse = {
|
|
523
544
|
/**
|
package/src/identity.js
CHANGED
|
@@ -26,7 +26,7 @@ import version from './version.js';
|
|
|
26
26
|
* `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
|
|
27
27
|
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
28
28
|
* to verify AMR (Authentication Methods References) claim in ID token.
|
|
29
|
-
* Might also be used to ensure additional acr (sms, otp) for already logged
|
|
29
|
+
* Might also be used to ensure additional acr (sms, otp) for already logged-in users.
|
|
30
30
|
* Supported value is also 'otp-email' means one time password using email.
|
|
31
31
|
* @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
|
|
32
32
|
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
@@ -36,7 +36,7 @@ import version from './version.js';
|
|
|
36
36
|
* @property {string} [redirectUri] - Redirect uri that will receive the
|
|
37
37
|
* code. Must exactly match a redirectUri from your client in self-service
|
|
38
38
|
* @property {boolean} [preferPopup] - Should we try to open a popup window?
|
|
39
|
-
* @property {string} [loginHint] -
|
|
39
|
+
* @property {string} [loginHint] - User email or UUID hint
|
|
40
40
|
* @property {string} [tag] - Pulse tag
|
|
41
41
|
* @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
|
|
42
42
|
* in place of default teaser
|
|
@@ -46,9 +46,12 @@ import version from './version.js';
|
|
|
46
46
|
* spec section 3.1.2.1 for more information
|
|
47
47
|
* @property {string} [locale] - Optional parameter to overwrite client locale setting.
|
|
48
48
|
* New flows supports nb_NO, fi_FI, sv_SE, en_US
|
|
49
|
-
* @property {boolean} [oneStepLogin] -
|
|
49
|
+
* @property {boolean} [oneStepLogin] - Display username and password on one screen
|
|
50
50
|
* @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
|
|
51
|
-
* End-User for
|
|
51
|
+
* End-User for re-authentication or confirm account screen. Supported values: `select_account` or `login`
|
|
52
|
+
* @property {string} [xDomainId] - Identifier for cross-domain tracking in Pulse
|
|
53
|
+
* @property {string} [xEnvironmentId] - Environment for cross-domain tracking in Pulse
|
|
54
|
+
* @property {string} [originCampaign] - Campaign identifier for tracking in Pulse
|
|
52
55
|
*/
|
|
53
56
|
/**
|
|
54
57
|
* @typedef {object} SimplifiedLoginWidgetLoginOptions
|
|
@@ -60,7 +63,7 @@ import version from './version.js';
|
|
|
60
63
|
* `password` (will force password confirmation, even if user is already logged in). Those values might
|
|
61
64
|
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
62
65
|
* to verify AMR (Authentication Methods References) claim in ID token.
|
|
63
|
-
* Might also be used to ensure additional acr (sms, otp) for already logged
|
|
66
|
+
* Might also be used to ensure additional acr (sms, otp) for already logged-in users.
|
|
64
67
|
* Supported value is also 'otp-email' means one time password using email.
|
|
65
68
|
* @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
|
|
66
69
|
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
@@ -70,7 +73,7 @@ import version from './version.js';
|
|
|
70
73
|
* @property {string} [redirectUri] - Redirect uri that will receive the
|
|
71
74
|
* code. Must exactly match a redirectUri from your client in self-service
|
|
72
75
|
* @property {boolean} [preferPopup] - Should we try to open a popup window?
|
|
73
|
-
* @property {string} [loginHint] -
|
|
76
|
+
* @property {string} [loginHint] - User email or UUID hint
|
|
74
77
|
* @property {string} [tag] - Pulse tag
|
|
75
78
|
* @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
|
|
76
79
|
* in place of default teaser
|
|
@@ -80,9 +83,12 @@ import version from './version.js';
|
|
|
80
83
|
* spec section 3.1.2.1 for more information
|
|
81
84
|
* @property {string} [locale] - Optional parameter to overwrite client locale setting.
|
|
82
85
|
* New flows supports nb_NO, fi_FI, sv_SE, en_US
|
|
83
|
-
* @property {boolean} [oneStepLogin] -
|
|
86
|
+
* @property {boolean} [oneStepLogin] - Display username and password on one screen
|
|
84
87
|
* @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
|
|
85
88
|
* End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
|
|
89
|
+
* @property {string} [xDomainId] - Identifier for cross-domain tracking in Pulse
|
|
90
|
+
* @property {string} [xEnvironmentId] - Environment for cross-domain tracking in Pulse
|
|
91
|
+
* @property {string} [originCampaign] - Campaign identifier for tracking in Pulse
|
|
86
92
|
*/
|
|
87
93
|
|
|
88
94
|
/**
|
|
@@ -204,7 +210,7 @@ export class Identity extends EventEmitter {
|
|
|
204
210
|
this._session = {};
|
|
205
211
|
|
|
206
212
|
this._setSessionServiceUrl(sessionDomain);
|
|
207
|
-
this._usedSessionServiceGetSessionEndpoint = this._sessionService.url.pathname && this._sessionService.url.pathname.length <= 1 ? 'session' : '
|
|
213
|
+
this._usedSessionServiceGetSessionEndpoint = this._sessionService.url.pathname && this._sessionService.url.pathname.length <= 1 ? 'v2/session' : 'session';
|
|
208
214
|
|
|
209
215
|
this._setSpidServerUrl(env);
|
|
210
216
|
this._setBffServerUrl(env);
|
|
@@ -834,6 +840,7 @@ export class Identity extends EventEmitter {
|
|
|
834
840
|
return null;
|
|
835
841
|
}
|
|
836
842
|
}
|
|
843
|
+
|
|
837
844
|
/**
|
|
838
845
|
* If a popup is desired, this function needs to be called in response to a user event (like
|
|
839
846
|
* click or tap) in order to work correctly. Otherwise the popup will be blocked by the
|
|
@@ -855,6 +862,8 @@ export class Identity extends EventEmitter {
|
|
|
855
862
|
* @param {boolean} [options.oneStepLogin=false]
|
|
856
863
|
* @param {string} [options.prompt=select_account]
|
|
857
864
|
* @param {string} [options.xDomainId]
|
|
865
|
+
* @param {string} [options.xEnvironmentId]
|
|
866
|
+
* @param {string} [options.originCampaign]
|
|
858
867
|
* @return {Window|null} - Reference to popup window if created (or `null` otherwise)
|
|
859
868
|
*/
|
|
860
869
|
login({
|
|
@@ -870,7 +879,9 @@ export class Identity extends EventEmitter {
|
|
|
870
879
|
locale = '',
|
|
871
880
|
oneStepLogin = false,
|
|
872
881
|
prompt = 'select_account',
|
|
873
|
-
xDomainId = ''
|
|
882
|
+
xDomainId = '',
|
|
883
|
+
xEnvironmentId = '',
|
|
884
|
+
originCampaign = ''
|
|
874
885
|
}) {
|
|
875
886
|
this._closePopup();
|
|
876
887
|
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
@@ -886,7 +897,9 @@ export class Identity extends EventEmitter {
|
|
|
886
897
|
locale,
|
|
887
898
|
oneStepLogin,
|
|
888
899
|
prompt,
|
|
889
|
-
xDomainId
|
|
900
|
+
xDomainId,
|
|
901
|
+
xEnvironmentId,
|
|
902
|
+
originCampaign
|
|
890
903
|
});
|
|
891
904
|
|
|
892
905
|
if (preferPopup) {
|
|
@@ -943,6 +956,9 @@ export class Identity extends EventEmitter {
|
|
|
943
956
|
* @param {string} [options.locale]
|
|
944
957
|
* @param {boolean} [options.oneStepLogin=false]
|
|
945
958
|
* @param {string} [options.prompt=select_account]
|
|
959
|
+
* @param {string} [options.xDomainId]
|
|
960
|
+
* @param {string} [options.xEnvironmentId]
|
|
961
|
+
* @param {string} [options.originCampaign]
|
|
946
962
|
* @return {string} - The url
|
|
947
963
|
*/
|
|
948
964
|
loginUrl({
|
|
@@ -957,7 +973,9 @@ export class Identity extends EventEmitter {
|
|
|
957
973
|
locale = '',
|
|
958
974
|
oneStepLogin = false,
|
|
959
975
|
prompt = 'select_account',
|
|
960
|
-
xDomainId = ''
|
|
976
|
+
xDomainId = '',
|
|
977
|
+
xEnvironmentId = '',
|
|
978
|
+
originCampaign = ''
|
|
961
979
|
}) {
|
|
962
980
|
if (typeof arguments[0] !== 'object') {
|
|
963
981
|
// backward compatibility
|
|
@@ -991,7 +1009,9 @@ export class Identity extends EventEmitter {
|
|
|
991
1009
|
locale,
|
|
992
1010
|
one_step_login: oneStepLogin || '',
|
|
993
1011
|
prompt: acrValues ? '' : prompt,
|
|
994
|
-
x_domain_id: xDomainId
|
|
1012
|
+
x_domain_id: xDomainId,
|
|
1013
|
+
x_env_id: xEnvironmentId,
|
|
1014
|
+
utm_campaign: originCampaign
|
|
995
1015
|
});
|
|
996
1016
|
}
|
|
997
1017
|
|
|
@@ -1061,7 +1081,6 @@ export class Identity extends EventEmitter {
|
|
|
1061
1081
|
return loginPrams;
|
|
1062
1082
|
}
|
|
1063
1083
|
|
|
1064
|
-
|
|
1065
1084
|
return new Promise(
|
|
1066
1085
|
(resolve, reject) => {
|
|
1067
1086
|
if (!userData || !userData.display_text || !userData.identifier) {
|
package/src/version.js
CHANGED