@schibsted/account-sdk-browser 4.5.0 → 4.6.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## v4.6.0 (2022-02-23)
4
+
5
+ ## New features
6
+ * Add `eid`, `eid-no` and `eid-se` to valid acrValues
7
+
8
+ ## v4.5.3 (2021-11-26)
9
+
10
+ ## Fixes
11
+ * Fix SimplifiedLoginWidgetLoginOptions typo
12
+
13
+ ## v4.5.2 (2021-11-26)
14
+
15
+ ## Fixes
16
+ * Fix SimplifiedLoginWidgetLoginOptions
17
+
18
+ ## v4.5.1 (2021-11-19)
19
+
20
+ ## Fixes
21
+ * .d.ts files publishing
22
+
3
23
  ## v4.5.0 (2021-09-29)
4
24
 
5
25
  ## New features
package/README.md CHANGED
@@ -249,6 +249,7 @@ const identity = new Identity({
249
249
  clientId: '56e9a5d1eee0000000000000',
250
250
  redirectUri: 'https://awesomenews.site', // ensure it's listed in selfservice
251
251
  env: 'PRE', // Schibsted account env. A url or a special key: 'PRE', 'PRO', 'PRO_NO', 'PRO_FI' or 'PRO_DK'
252
+ sessionDomain: 'https://id.awesomenews.site', // client-configured session-service domain
252
253
  })
253
254
 
254
255
  async function whenSiteLoaded() {
@@ -318,13 +319,14 @@ experimental purposes for now. Please let us know before using this in productio
318
319
  The default is username & password. If you wish to use one of the passwordless login methods, the
319
320
  `login()` function takes an optional parameter called `acrValues` (Authentication Context Class Reference).
320
321
  The `acrValues` parameter with multifactor authentication can take following values:
322
+ - `eid` - authentication using BankID (for DEV and PRE environments you can choose between country specific solution by specifying `eid-no` or `eid-se` instead)
321
323
  - `otp-email` - passwordless authentication using code sent to registered email
322
324
  - `otp-sms` - passwordless authentication using code sent to registered phone number
323
325
  - `password` - force password authentication (even if user is already logged in)
324
326
  - `otp` - authentication using registered one time code generator (https://tools.ietf.org/html/rfc6238)
325
327
  - `sms` - authentication using SMS code sent to phone number
326
328
  - `password otp sms` - those authentication methods might be combined
327
-
329
+
328
330
  The classic way to authenticate a user, is to send them from your site to the Schibsted account
329
331
  domain, let the user authenticate there, and then have us redirect them back to your site. If you
330
332
  prefer, we also provide a popup that you can use. In this method, the authentication happens on a
package/es5/global.js CHANGED
@@ -1962,6 +1962,42 @@ var _require = __webpack_require__(175),
1962
1962
  * the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
1963
1963
  * @property {string} [acrValues] - Authentication Context Class Reference Values. If
1964
1964
  * omitted, the user will be asked to authenticate using username+password.
1965
+ * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password),
1966
+ * `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
1967
+ * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
1968
+ * to verify AMR (Authentication Methods References) claim in ID token.
1969
+ * Might also be used to ensure additional acr (sms, otp) for already logged in users.
1970
+ * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
1971
+ * one time password using sms.
1972
+ * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
1973
+ * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
1974
+ * includes the id token which can be useful for getting information about the user. Omitting
1975
+ * scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
1976
+ * aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
1977
+ * @property {string} [redirectUri] - Redirect uri that will receive the
1978
+ * code. Must exactly match a redirectUri from your client in self-service
1979
+ * @property {boolean} [preferPopup] - Should we try to open a popup window?
1980
+ * @property {string} [loginHint] - user email or UUID hint
1981
+ * @property {string} [tag] - Pulse tag
1982
+ * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
1983
+ * in place of default teaser
1984
+ * @property {number|string} [maxAge] - Specifies the allowable elapsed time in seconds since
1985
+ * the last time the End-User was actively authenticated. If last authentication time is more
1986
+ * than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
1987
+ * spec section 3.1.2.1 for more information
1988
+ * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1989
+ * New flows supports nb_NO, fi_FI, sv_SE, en_US
1990
+ * @property {boolean} [oneStepLogin] - display username and password on one screen
1991
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1992
+ * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1993
+ */
1994
+
1995
+ /**
1996
+ * @typedef {object} SimplifiedLoginWidgetLoginOptions
1997
+ * @property {string|function(): (string|Promise<string>)} state - An opaque value used by the client to maintain state between
1998
+ * the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
1999
+ * @property {string} [acrValues] - Authentication Context Class Reference Values. If
2000
+ * omitted, the user will be asked to authenticate using username+password.
1965
2001
  * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
1966
2002
  * `password` (will force password confirmation, even if user is already logged in). Those values might
1967
2003
  * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
@@ -1988,7 +2024,7 @@ var _require = __webpack_require__(175),
1988
2024
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1989
2025
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
1990
2026
  * @property {boolean} [oneStepLogin] - display username and password on one screen
1991
- * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
2027
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1992
2028
  * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1993
2029
  */
1994
2030
 
@@ -3048,7 +3084,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3048
3084
  }
3049
3085
 
3050
3086
  var isValidAcrValue = function isValidAcrValue(acrValue) {
3051
- return Object(_validate__WEBPACK_IMPORTED_MODULE_21__["isStrIn"])(acrValue, ['password', 'otp', 'sms'], true);
3087
+ return Object(_validate__WEBPACK_IMPORTED_MODULE_21__["isStrIn"])(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid'], true);
3052
3088
  };
3053
3089
 
3054
3090
  Object(_validate__WEBPACK_IMPORTED_MODULE_21__["assert"])(!acrValues || Object(_validate__WEBPACK_IMPORTED_MODULE_21__["isStrIn"])(acrValues, ['', 'otp-email', 'otp-sms'], true) || acrValues.split(' ').every(isValidAcrValue), "The acrValues parameter is not acceptable: ".concat(acrValues));
@@ -3121,7 +3157,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3121
3157
  * and store that info in localStorage. Widget will be display only if user is logged in to SSO.
3122
3158
  *
3123
3159
  * @async
3124
- * @param {LoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
3160
+ * @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
3125
3161
  * continue action. `state` might be string or async function.
3126
3162
  * @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
3127
3163
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
@@ -11513,7 +11549,7 @@ function emulate(global) {
11513
11549
  /* 175 */
11514
11550
  /***/ (function(module) {
11515
11551
 
11516
- module.exports = JSON.parse("{\"name\":\"@schibsted/account-sdk-browser\",\"version\":\"4.5.0\",\"description\":\"Schibsted account SDK for browsers\",\"main\":\"index.js\",\"scripts\":{\"build\":\"./build.sh\",\"clean\":\"rimraf .cache coverage dist docs\",\"docs\":\"rimraf docs && jsdoc -c ./utils/jsdoc.js --verbose\",\"lint\":\"eslint .\",\"pretest\":\"npm run lint\",\"test\":\"jest\",\"precover\":\"npm run lint\",\"cover\":\"jest --coverage\",\"postcover\":\"codecov\"},\"author\":\"\",\"license\":\"MIT\",\"dependencies\":{\"tiny-emitter\":\"^2.1.0\"},\"devDependencies\":{\"@babel/core\":\"^7.11.4\",\"@babel/preset-env\":\"^7.11.0\",\"babel-loader\":\"^8.1.0\",\"codecov\":\"^3.6.5\",\"core-js\":\"^3.6.5\",\"docdash\":\"git+https://github.com/torarvid/docdash.git#v0.5.0\",\"eslint\":\"^6.8.0\",\"eslint-plugin-import\":\"^2.20.2\",\"jest\":\"^26.4.2\",\"jest-junit\":\"^10.0.0\",\"jsdoc\":\"^3.6.5\",\"node-fetch\":\"^2.6.0\",\"regenerator-runtime\":\"^0.13.7\",\"webpack\":\"^4.44.1\",\"webpack-cli\":\"^3.3.12\",\"whatwg-url\":\"^8.0.0\"},\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/schibsted/account-sdk-browser.git\"},\"babel\":{\"presets\":[[\"@babel/preset-env\",{\"useBuiltIns\":\"usage\",\"corejs\":3,\"targets\":{\"browsers\":[\"> 1%\",\"last 10 chrome major versions\",\"last 10 firefox major versions\",\"last 10 opera major versions\",\"last 2 safari major versions\",\"last 2 ios major versions\",\"last 2 ie major versions\",\"last 5 edge major versions\"]}}]]},\"typings\":\"index.d.ts\"}");
11552
+ module.exports = JSON.parse("{\"name\":\"@schibsted/account-sdk-browser\",\"version\":\"4.6.0\",\"description\":\"Schibsted account SDK for browsers\",\"main\":\"index.js\",\"scripts\":{\"build\":\"./build.sh\",\"clean\":\"rimraf .cache coverage dist docs\",\"docs\":\"rimraf docs && jsdoc -c ./utils/jsdoc.js --verbose\",\"lint\":\"eslint .\",\"pretest\":\"npm run lint\",\"test\":\"jest\",\"precover\":\"npm run lint\",\"cover\":\"jest --coverage\",\"postcover\":\"codecov\"},\"author\":\"\",\"license\":\"MIT\",\"dependencies\":{\"tiny-emitter\":\"^2.1.0\"},\"devDependencies\":{\"@babel/core\":\"^7.11.4\",\"@babel/preset-env\":\"^7.11.0\",\"babel-loader\":\"^8.1.0\",\"codecov\":\"^3.6.5\",\"core-js\":\"^3.6.5\",\"docdash\":\"git+https://github.com/torarvid/docdash.git#v0.5.0\",\"eslint\":\"^6.8.0\",\"eslint-plugin-import\":\"^2.20.2\",\"jest\":\"^26.4.2\",\"jest-junit\":\"^10.0.0\",\"jsdoc\":\"^3.6.5\",\"node-fetch\":\"^2.6.0\",\"regenerator-runtime\":\"^0.13.7\",\"webpack\":\"^4.44.1\",\"webpack-cli\":\"^3.3.12\",\"whatwg-url\":\"^8.0.0\"},\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/schibsted/account-sdk-browser.git\"},\"babel\":{\"presets\":[[\"@babel/preset-env\",{\"useBuiltIns\":\"usage\",\"corejs\":3,\"targets\":{\"browsers\":[\"> 1%\",\"last 10 chrome major versions\",\"last 10 firefox major versions\",\"last 10 opera major versions\",\"last 2 safari major versions\",\"last 2 ios major versions\",\"last 2 ie major versions\",\"last 5 edge major versions\"]}}]]},\"typings\":\"index.d.ts\"}");
11517
11553
 
11518
11554
  /***/ }),
11519
11555
  /* 176 */
@@ -12132,6 +12168,7 @@ var Payment = /*#__PURE__*/function () {
12132
12168
  });
12133
12169
  }
12134
12170
  /**
12171
+ * @deprecated
12135
12172
  * Get the url for flow to purchase a promo code product with ZUORA
12136
12173
  * @param {string} code - promocode product code
12137
12174
  * @param {string} [state=''] - An opaque value used by the client to maintain state between