@schibsted/account-sdk-browser 4.6.0 → 4.7.2

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/src/identity.js CHANGED
@@ -27,8 +27,7 @@ const { version } = require('../package.json');
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
29
  * Might also be used to ensure additional acr (sms, otp) for already logged in users.
30
- * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
31
- * one time password using sms.
30
+ * Supported value is also 'otp-email' means one time password using email.
32
31
  * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
33
32
  * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
34
33
  * includes the id token which can be useful for getting information about the user. Omitting
@@ -62,8 +61,7 @@ const { version } = require('../package.json');
62
61
  * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
63
62
  * to verify AMR (Authentication Methods References) claim in ID token.
64
63
  * Might also be used to ensure additional acr (sms, otp) for already logged in users.
65
- * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
66
- * one time password using sms.
64
+ * Supported value is also 'otp-email' means one time password using email.
67
65
  * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
68
66
  * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
69
67
  * includes the id token which can be useful for getting information about the user. Omitting
@@ -783,8 +781,8 @@ export class Identity extends EventEmitter {
783
781
  teaser = arguments[6] || teaser;
784
782
  maxAge = isNaN(arguments[7]) ? maxAge : arguments[7];
785
783
  }
786
- const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid'], true);
787
- assert(!acrValues || isStrIn(acrValues, ['', 'otp-email', 'otp-sms'], true) || acrValues.split(' ').every(isValidAcrValue),
784
+ const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
785
+ assert(!acrValues || isStrIn(acrValues, ['', 'otp-email'], true) || acrValues.split(' ').every(isValidAcrValue),
788
786
  `The acrValues parameter is not acceptable: ${acrValues}`);
789
787
  assert(isUrl(redirectUri),
790
788
  `loginUrl(): redirectUri must be a valid url but is ${redirectUri}`);
@@ -824,7 +822,7 @@ export class Identity extends EventEmitter {
824
822
  * @return {string}
825
823
  */
826
824
  accountUrl(redirectUri = this.redirectUri) {
827
- return this._spid.makeUrl('account/summary', {
825
+ return this._spid.makeUrl('profile-pages', {
828
826
  response_type: 'code',
829
827
  redirect_uri: redirectUri
830
828
  });
@@ -836,7 +834,7 @@ export class Identity extends EventEmitter {
836
834
  * @return {string}
837
835
  */
838
836
  phonesUrl(redirectUri = this.redirectUri) {
839
- return this._spid.makeUrl('account/phones', {
837
+ return this._spid.makeUrl('profile-pages/about-you/phone', {
840
838
  response_type: 'code',
841
839
  redirect_uri: redirectUri
842
840
  });
@@ -854,7 +852,7 @@ export class Identity extends EventEmitter {
854
852
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
855
853
  */
856
854
  async showSimplifiedLoginWidget(loginParams, options) {
857
- // getUserContextData doens't throw exception
855
+ // getUserContextData doesn't throw exception
858
856
  const userData = await this.getUserContextData();
859
857
 
860
858
  const queryParams = { client_id: this.clientId };
@@ -890,6 +888,10 @@ export class Identity extends EventEmitter {
890
888
  },
891
889
  };
892
890
 
891
+ if (options && options.locale) {
892
+ initialParams.locale = options.locale;
893
+ }
894
+
893
895
  const loginHandler = async () => {
894
896
  this.login(Object.assign(await prepareLoginParams(loginParams), {loginHint: userData.identifier}));
895
897
  };