@schibsted/account-sdk-browser 4.3.0 → 4.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## v4.5.3 (2021-11-26)
4
+
5
+ ## Fixes
6
+ * Fix SimplifiedLoginWidgetLoginOptions typo
7
+
8
+ ## v4.5.2 (2021-11-26)
9
+
10
+ ## Fixes
11
+ * Fix SimplifiedLoginWidgetLoginOptions
12
+
13
+ ## v4.5.1 (2021-11-19)
14
+
15
+ ## Fixes
16
+ * .d.ts files publishing
17
+
18
+ ## v4.5.0 (2021-09-29)
19
+
20
+ ## New features
21
+ * Add Danish env
22
+
23
+ ## Fixes
24
+ * `options` param in `showSimplifiedLoginWidget` function is optional in Typescript now
25
+
26
+ ## v4.4.0 (2021-06-24)
27
+
28
+ ## New features
29
+ * Added optional `options` param to `showSimplifiedLoginWidget` function, allowing to specify widget `encoding`
30
+
3
31
  ## v4.3.0 (2020-12-16)
4
32
 
5
33
  ## New features
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![logo](https://www.schibsted.com/Global/LogoTypes/Logos%202014/SMG_Small_2014_RGB.png)](https://github.com/schibsted/account-sdk-browser)
2
2
 
3
- [![Build Status](https://travis-ci.org/schibsted/account-sdk-browser.svg?branch=master)](https://travis-ci.org/schibsted/account-sdk-browser)
3
+ [![Build Status](https://travis-ci.com/schibsted/account-sdk-browser.svg?branch=master)](https://travis-ci.com/schibsted/account-sdk-browser)
4
4
  [![Code coverage](https://codecov.io/gh/schibsted/account-sdk-browser/branch/master/graph/badge.svg)](https://codecov.io/gh/schibsted/account-sdk-browser)
5
5
  [![Snyk](https://snyk.io/test/github/schibsted/account-sdk-browser/badge.svg?targetFile=package.json)](https://snyk.io/test/github/schibsted/account-sdk-browser)
6
6
 
@@ -150,6 +150,14 @@ them from polyfill.io like this:
150
150
 
151
151
  <a name="itp-yo"></a>
152
152
 
153
+ #### Local development on Chrome version 88 (or higher)
154
+
155
+ Google Chrome in version 88 (or higher) [introduced changes](https://support.google.com/chrome/a/answer/7679408#88&zippy=%2Cchrome) in the definition of cookies `same-site` attribute.
156
+ From now on cross-scheme requests (e.g. `http` <-> `https`) will be considered cross-site instead of same-site, hence you may experience problems with localhost development, resulting in `Bad Request` responses from `hasSession` calls.
157
+ While we are working on more permanent resolution of this this issue, as a temporary workaround we can suggest [running your site with HTTPS locally](https://web.dev/how-to-use-local-https/) or disabling `schemeful-same-site` flag in Chrome for the time of local development.
158
+
159
+ More info: https://web.dev/schemeful-samesite/
160
+
153
161
  ## Notes on Apple Intelligent Tracking Prevention (ITP)
154
162
  #### or.. how I learned to stop worrying and ❤️ the Schibsted account session service
155
163
 
@@ -240,7 +248,7 @@ import { Identity } from '@schibsted/account-sdk-browser'
240
248
  const identity = new Identity({
241
249
  clientId: '56e9a5d1eee0000000000000',
242
250
  redirectUri: 'https://awesomenews.site', // ensure it's listed in selfservice
243
- env: 'PRE', // Schibsted account env. A url or a special key: 'PRE', 'PRO' or 'PRO_NO'
251
+ env: 'PRE', // Schibsted account env. A url or a special key: 'PRE', 'PRO', 'PRO_NO', 'PRO_FI' or 'PRO_DK'
244
252
  })
245
253
 
246
254
  async function whenSiteLoaded() {
package/es5/global.js CHANGED
@@ -1988,7 +1988,43 @@ var _require = __webpack_require__(175),
1988
1988
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1989
1989
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
1990
1990
  * @property {boolean} [oneStepLogin] - display username and password on one screen
1991
- * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
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.
2001
+ * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
2002
+ * `password` (will force password confirmation, even if user is already logged in). Those values might
2003
+ * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
2004
+ * to verify AMR (Authentication Methods References) claim in ID token.
2005
+ * Might also be used to ensure additional acr (sms, otp) for already logged in users.
2006
+ * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
2007
+ * one time password using sms.
2008
+ * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
2009
+ * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
2010
+ * includes the id token which can be useful for getting information about the user. Omitting
2011
+ * scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
2012
+ * aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
2013
+ * @property {string} [redirectUri] - Redirect uri that will receive the
2014
+ * code. Must exactly match a redirectUri from your client in self-service
2015
+ * @property {boolean} [preferPopup] - Should we try to open a popup window?
2016
+ * @property {string} [loginHint] - user email or UUID hint
2017
+ * @property {string} [tag] - Pulse tag
2018
+ * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
2019
+ * in place of default teaser
2020
+ * @property {number|string} [maxAge] - Specifies the allowable elapsed time in seconds since
2021
+ * the last time the End-User was actively authenticated. If last authentication time is more
2022
+ * than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
2023
+ * spec section 3.1.2.1 for more information
2024
+ * @property {string} [locale] - Optional parameter to overwrite client locale setting.
2025
+ * New flows supports nb_NO, fi_FI, sv_SE, en_US
2026
+ * @property {boolean} [oneStepLogin] - display username and password on one screen
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
 
@@ -2044,6 +2080,11 @@ var _require = __webpack_require__(175),
2044
2080
  * @property {string} client_name - Client name
2045
2081
  */
2046
2082
 
2083
+ /**
2084
+ * @typedef {object} SimplifiedLoginWidgetOptions
2085
+ * @property {string} encoding - expected encoding of simplified login widget. Could be utf-8 (default), iso-8859-1 or iso-8859-15
2086
+ */
2087
+
2047
2088
 
2048
2089
  var HAS_SESSION_CACHE_KEY = 'hasSession-cache';
2049
2090
 
@@ -2065,7 +2106,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2065
2106
  * @param {string} options.clientId - Example: "1234567890abcdef12345678"
2066
2107
  * @param {string} options.sessionDomain - Example: "https://id.site.com"
2067
2108
  * @param {string} options.redirectUri - Example: "https://site.com"
2068
- * @param {string} [options.env=PRE] - Schibsted account environment: `PRE`, `PRO` or `PRO_NO`
2109
+ * @param {string} [options.env=PRE] - Schibsted account environment: `PRE`, `PRO`, `PRO_NO`, `PRO_FI` or `PRO_DK`
2069
2110
  * @param {function} [options.log] - A function that receives debug log information. If not set,
2070
2111
  * no logging will be done
2071
2112
  * @param {object} [options.window] - window object
@@ -2322,7 +2363,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2322
2363
  * @param {object} [options]
2323
2364
  * @param {number} [options.expiresIn] Override this to set number of seconds before the varnish
2324
2365
  * cookie expires. The default is to use the same time that hasSession responses are cached for
2325
- * @param {boolean} [options.domain] Override cookie domain. E.g. «vg.no» instead of «www.vg.no»
2366
+ * @param {string} [options.domain] Override cookie domain. E.g. «vg.no» instead of «www.vg.no»
2326
2367
  * @returns {void}
2327
2368
  */
2328
2369
 
@@ -3116,18 +3157,19 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3116
3157
  * and store that info in localStorage. Widget will be display only if user is logged in to SSO.
3117
3158
  *
3118
3159
  * @async
3119
- * @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
3120
3161
  * continue action. `state` might be string or async function.
3162
+ * @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
3121
3163
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
3122
3164
  */
3123
3165
 
3124
3166
  }, {
3125
3167
  key: "showSimplifiedLoginWidget",
3126
3168
  value: function () {
3127
- var _showSimplifiedLoginWidget = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(loginParams) {
3169
+ var _showSimplifiedLoginWidget = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(loginParams, options) {
3128
3170
  var _this3 = this;
3129
3171
 
3130
- var userData, widgetUrl, prepareLoginParams;
3172
+ var userData, queryParams, widgetUrl, prepareLoginParams;
3131
3173
  return regeneratorRuntime.wrap(function _callee12$(_context12) {
3132
3174
  while (1) {
3133
3175
  switch (_context12.prev = _context12.next) {
@@ -3137,9 +3179,15 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3137
3179
 
3138
3180
  case 2:
3139
3181
  userData = _context12.sent;
3140
- widgetUrl = this._bffService.makeUrl('simplified-login-widget', {
3182
+ queryParams = {
3141
3183
  client_id: this.clientId
3142
- }, false);
3184
+ };
3185
+
3186
+ if (options && options.encoding) {
3187
+ queryParams.encoding = options.encoding;
3188
+ }
3189
+
3190
+ widgetUrl = this._bffService.makeUrl('simplified-login-widget', queryParams, false);
3143
3191
 
3144
3192
  prepareLoginParams = /*#__PURE__*/function () {
3145
3193
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(loginPrams) {
@@ -3169,7 +3217,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3169
3217
  }, _callee9);
3170
3218
  }));
3171
3219
 
3172
- return function prepareLoginParams(_x2) {
3220
+ return function prepareLoginParams(_x3) {
3173
3221
  return _ref5.apply(this, arguments);
3174
3222
  };
3175
3223
  }();
@@ -3281,7 +3329,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3281
3329
  document.getElementsByTagName('body')[0].appendChild(simplifiedLoginWidget);
3282
3330
  }));
3283
3331
 
3284
- case 6:
3332
+ case 8:
3285
3333
  case "end":
3286
3334
  return _context12.stop();
3287
3335
  }
@@ -3289,7 +3337,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3289
3337
  }, _callee12, this);
3290
3338
  }));
3291
3339
 
3292
- function showSimplifiedLoginWidget(_x) {
3340
+ function showSimplifiedLoginWidget(_x, _x2) {
3293
3341
  return _showSimplifiedLoginWidget.apply(this, arguments);
3294
3342
  }
3295
3343
 
@@ -10405,6 +10453,7 @@ __webpack_require__.r(__webpack_exports__);
10405
10453
  * @prop {string} ENDPOINTS.SPiD.PRO - Production environment Sweden
10406
10454
  * @prop {string} ENDPOINTS.SPiD.PRO_NO - Production environment Norway
10407
10455
  * @prop {string} ENDPOINTS.SPiD.PRO_FI - Production environment Finland
10456
+ * @prop {string} ENDPOINTS.SPiD.PRO_DK - Production environment Denmark
10408
10457
  * @prop {object} ENDPOINTS.BFF - Endpoints used with new GDPR-compliant web flows
10409
10458
  * @prop {string} ENDPOINTS.BFF.LOCAL - Local endpoint (for Identity team)
10410
10459
  * @prop {string} ENDPOINTS.BFF.DEV - Dev environment (for Identity team)
@@ -10412,6 +10461,7 @@ __webpack_require__.r(__webpack_exports__);
10412
10461
  * @prop {string} ENDPOINTS.BFF.PRO - Production environment Sweden
10413
10462
  * @prop {string} ENDPOINTS.BFF.PRO_NO - Production environment Norway
10414
10463
  * @prop {string} ENDPOINTS.BFF.PRO_FI - Production environment Finland
10464
+ * @prop {string} ENDPOINTS.BFF.PRO_DK - Production environment Denmark
10415
10465
  * @prop {object} ENDPOINTS.SESSION_SERVICE - Endpoints to check global user session data
10416
10466
  * @prop {string} ENDPOINTS.SESSION_SERVICE.LOCAL - Local endpoint (for Identity team)
10417
10467
  * @prop {string} ENDPOINTS.SESSION_SERVICE.DEV - Dev environment (for Identity team)
@@ -10419,6 +10469,7 @@ __webpack_require__.r(__webpack_exports__);
10419
10469
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO - Production environment Sweden
10420
10470
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_NO - Production environment Norway
10421
10471
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_FI - Production environment Finland
10472
+ * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_DK - Production environment Denmark
10422
10473
  */
10423
10474
 
10424
10475
  var config = {
@@ -10429,7 +10480,8 @@ var config = {
10429
10480
  PRE: 'https://identity-pre.schibsted.com',
10430
10481
  PRO: 'https://login.schibsted.com',
10431
10482
  PRO_NO: 'https://payment.schibsted.no',
10432
- PRO_FI: 'https://login.schibsted.fi'
10483
+ PRO_FI: 'https://login.schibsted.fi',
10484
+ PRO_DK: 'https://login.schibsted.dk'
10433
10485
  },
10434
10486
  BFF: {
10435
10487
  LOCAL: 'http://id.localhost/authn/',
@@ -10437,7 +10489,8 @@ var config = {
10437
10489
  PRE: 'https://identity-pre.schibsted.com/authn/',
10438
10490
  PRO: 'https://login.schibsted.com/authn/',
10439
10491
  PRO_NO: 'https://payment.schibsted.no/authn/',
10440
- PRO_FI: 'https://login.schibsted.fi/authn/'
10492
+ PRO_FI: 'https://login.schibsted.fi/authn/',
10493
+ PRO_DK: 'https://login.schibsted.dk/authn/'
10441
10494
  },
10442
10495
  SESSION_SERVICE: {
10443
10496
  LOCAL: 'http://session-service.id.localhost',
@@ -10445,7 +10498,8 @@ var config = {
10445
10498
  PRE: 'https://session-service.identity-pre.schibsted.com',
10446
10499
  PRO: 'https://session-service.login.schibsted.com',
10447
10500
  PRO_NO: 'https://session-service.payment.schibsted.no',
10448
- PRO_FI: 'https://session-service.login.schibsted.fi'
10501
+ PRO_FI: 'https://session-service.login.schibsted.fi',
10502
+ PRO_DK: 'https://session-service.login.schibsted.dk'
10449
10503
  }
10450
10504
  },
10451
10505
  NAMESPACE: {
@@ -10454,7 +10508,8 @@ var config = {
10454
10508
  PRE: 'schibsted.com',
10455
10509
  PRO: 'schibsted.com',
10456
10510
  PRO_NO: 'spid.no',
10457
- PRO_FI: 'schibsted.fi'
10511
+ PRO_FI: 'schibsted.fi',
10512
+ PRO_DK: 'schibsted.dk'
10458
10513
  }
10459
10514
  };
10460
10515
  /* harmony default export */ __webpack_exports__["default"] = (config);
@@ -11494,7 +11549,7 @@ function emulate(global) {
11494
11549
  /* 175 */
11495
11550
  /***/ (function(module) {
11496
11551
 
11497
- module.exports = JSON.parse("{\"name\":\"@schibsted/account-sdk-browser\",\"version\":\"4.3.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.5.3\",\"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\"}");
11498
11553
 
11499
11554
  /***/ }),
11500
11555
  /* 176 */
@@ -12113,6 +12168,7 @@ var Payment = /*#__PURE__*/function () {
12113
12168
  });
12114
12169
  }
12115
12170
  /**
12171
+ * @deprecated
12116
12172
  * Get the url for flow to purchase a promo code product with ZUORA
12117
12173
  * @param {string} code - promocode product code
12118
12174
  * @param {string} [state=''] - An opaque value used by the client to maintain state between