@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/es5/identity.js CHANGED
@@ -989,7 +989,43 @@ var _require = __webpack_require__(174),
989
989
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
990
990
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
991
991
  * @property {boolean} [oneStepLogin] - display username and password on one screen
992
- * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
992
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
993
+ * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
994
+ */
995
+
996
+ /**
997
+ * @typedef {object} SimplifiedLoginWidgetLoginOptions
998
+ * @property {string|function(): (string|Promise<string>)} state - An opaque value used by the client to maintain state between
999
+ * the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
1000
+ * @property {string} [acrValues] - Authentication Context Class Reference Values. If
1001
+ * omitted, the user will be asked to authenticate using username+password.
1002
+ * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
1003
+ * `password` (will force password confirmation, even if user is already logged in). Those values might
1004
+ * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
1005
+ * to verify AMR (Authentication Methods References) claim in ID token.
1006
+ * Might also be used to ensure additional acr (sms, otp) for already logged in users.
1007
+ * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
1008
+ * one time password using sms.
1009
+ * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
1010
+ * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
1011
+ * includes the id token which can be useful for getting information about the user. Omitting
1012
+ * scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
1013
+ * aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
1014
+ * @property {string} [redirectUri] - Redirect uri that will receive the
1015
+ * code. Must exactly match a redirectUri from your client in self-service
1016
+ * @property {boolean} [preferPopup] - Should we try to open a popup window?
1017
+ * @property {string} [loginHint] - user email or UUID hint
1018
+ * @property {string} [tag] - Pulse tag
1019
+ * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
1020
+ * in place of default teaser
1021
+ * @property {number|string} [maxAge] - Specifies the allowable elapsed time in seconds since
1022
+ * the last time the End-User was actively authenticated. If last authentication time is more
1023
+ * than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
1024
+ * spec section 3.1.2.1 for more information
1025
+ * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1026
+ * New flows supports nb_NO, fi_FI, sv_SE, en_US
1027
+ * @property {boolean} [oneStepLogin] - display username and password on one screen
1028
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
993
1029
  * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
994
1030
  */
995
1031
 
@@ -1045,6 +1081,11 @@ var _require = __webpack_require__(174),
1045
1081
  * @property {string} client_name - Client name
1046
1082
  */
1047
1083
 
1084
+ /**
1085
+ * @typedef {object} SimplifiedLoginWidgetOptions
1086
+ * @property {string} encoding - expected encoding of simplified login widget. Could be utf-8 (default), iso-8859-1 or iso-8859-15
1087
+ */
1088
+
1048
1089
 
1049
1090
  var HAS_SESSION_CACHE_KEY = 'hasSession-cache';
1050
1091
 
@@ -1066,7 +1107,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1066
1107
  * @param {string} options.clientId - Example: "1234567890abcdef12345678"
1067
1108
  * @param {string} options.sessionDomain - Example: "https://id.site.com"
1068
1109
  * @param {string} options.redirectUri - Example: "https://site.com"
1069
- * @param {string} [options.env=PRE] - Schibsted account environment: `PRE`, `PRO` or `PRO_NO`
1110
+ * @param {string} [options.env=PRE] - Schibsted account environment: `PRE`, `PRO`, `PRO_NO`, `PRO_FI` or `PRO_DK`
1070
1111
  * @param {function} [options.log] - A function that receives debug log information. If not set,
1071
1112
  * no logging will be done
1072
1113
  * @param {object} [options.window] - window object
@@ -1323,7 +1364,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1323
1364
  * @param {object} [options]
1324
1365
  * @param {number} [options.expiresIn] Override this to set number of seconds before the varnish
1325
1366
  * cookie expires. The default is to use the same time that hasSession responses are cached for
1326
- * @param {boolean} [options.domain] Override cookie domain. E.g. «vg.no» instead of «www.vg.no»
1367
+ * @param {string} [options.domain] Override cookie domain. E.g. «vg.no» instead of «www.vg.no»
1327
1368
  * @returns {void}
1328
1369
  */
1329
1370
 
@@ -2117,18 +2158,19 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2117
2158
  * and store that info in localStorage. Widget will be display only if user is logged in to SSO.
2118
2159
  *
2119
2160
  * @async
2120
- * @param {LoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
2161
+ * @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
2121
2162
  * continue action. `state` might be string or async function.
2163
+ * @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
2122
2164
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
2123
2165
  */
2124
2166
 
2125
2167
  }, {
2126
2168
  key: "showSimplifiedLoginWidget",
2127
2169
  value: function () {
2128
- var _showSimplifiedLoginWidget = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(loginParams) {
2170
+ var _showSimplifiedLoginWidget = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(loginParams, options) {
2129
2171
  var _this3 = this;
2130
2172
 
2131
- var userData, widgetUrl, prepareLoginParams;
2173
+ var userData, queryParams, widgetUrl, prepareLoginParams;
2132
2174
  return regeneratorRuntime.wrap(function _callee12$(_context12) {
2133
2175
  while (1) {
2134
2176
  switch (_context12.prev = _context12.next) {
@@ -2138,9 +2180,15 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2138
2180
 
2139
2181
  case 2:
2140
2182
  userData = _context12.sent;
2141
- widgetUrl = this._bffService.makeUrl('simplified-login-widget', {
2183
+ queryParams = {
2142
2184
  client_id: this.clientId
2143
- }, false);
2185
+ };
2186
+
2187
+ if (options && options.encoding) {
2188
+ queryParams.encoding = options.encoding;
2189
+ }
2190
+
2191
+ widgetUrl = this._bffService.makeUrl('simplified-login-widget', queryParams, false);
2144
2192
 
2145
2193
  prepareLoginParams = /*#__PURE__*/function () {
2146
2194
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(loginPrams) {
@@ -2170,7 +2218,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2170
2218
  }, _callee9);
2171
2219
  }));
2172
2220
 
2173
- return function prepareLoginParams(_x2) {
2221
+ return function prepareLoginParams(_x3) {
2174
2222
  return _ref5.apply(this, arguments);
2175
2223
  };
2176
2224
  }();
@@ -2282,7 +2330,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2282
2330
  document.getElementsByTagName('body')[0].appendChild(simplifiedLoginWidget);
2283
2331
  }));
2284
2332
 
2285
- case 6:
2333
+ case 8:
2286
2334
  case "end":
2287
2335
  return _context12.stop();
2288
2336
  }
@@ -2290,7 +2338,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2290
2338
  }, _callee12, this);
2291
2339
  }));
2292
2340
 
2293
- function showSimplifiedLoginWidget(_x) {
2341
+ function showSimplifiedLoginWidget(_x, _x2) {
2294
2342
  return _showSimplifiedLoginWidget.apply(this, arguments);
2295
2343
  }
2296
2344
 
@@ -10368,6 +10416,7 @@ __webpack_require__.r(__webpack_exports__);
10368
10416
  * @prop {string} ENDPOINTS.SPiD.PRO - Production environment Sweden
10369
10417
  * @prop {string} ENDPOINTS.SPiD.PRO_NO - Production environment Norway
10370
10418
  * @prop {string} ENDPOINTS.SPiD.PRO_FI - Production environment Finland
10419
+ * @prop {string} ENDPOINTS.SPiD.PRO_DK - Production environment Denmark
10371
10420
  * @prop {object} ENDPOINTS.BFF - Endpoints used with new GDPR-compliant web flows
10372
10421
  * @prop {string} ENDPOINTS.BFF.LOCAL - Local endpoint (for Identity team)
10373
10422
  * @prop {string} ENDPOINTS.BFF.DEV - Dev environment (for Identity team)
@@ -10375,6 +10424,7 @@ __webpack_require__.r(__webpack_exports__);
10375
10424
  * @prop {string} ENDPOINTS.BFF.PRO - Production environment Sweden
10376
10425
  * @prop {string} ENDPOINTS.BFF.PRO_NO - Production environment Norway
10377
10426
  * @prop {string} ENDPOINTS.BFF.PRO_FI - Production environment Finland
10427
+ * @prop {string} ENDPOINTS.BFF.PRO_DK - Production environment Denmark
10378
10428
  * @prop {object} ENDPOINTS.SESSION_SERVICE - Endpoints to check global user session data
10379
10429
  * @prop {string} ENDPOINTS.SESSION_SERVICE.LOCAL - Local endpoint (for Identity team)
10380
10430
  * @prop {string} ENDPOINTS.SESSION_SERVICE.DEV - Dev environment (for Identity team)
@@ -10382,6 +10432,7 @@ __webpack_require__.r(__webpack_exports__);
10382
10432
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO - Production environment Sweden
10383
10433
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_NO - Production environment Norway
10384
10434
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_FI - Production environment Finland
10435
+ * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_DK - Production environment Denmark
10385
10436
  */
10386
10437
 
10387
10438
  var config = {
@@ -10392,7 +10443,8 @@ var config = {
10392
10443
  PRE: 'https://identity-pre.schibsted.com',
10393
10444
  PRO: 'https://login.schibsted.com',
10394
10445
  PRO_NO: 'https://payment.schibsted.no',
10395
- PRO_FI: 'https://login.schibsted.fi'
10446
+ PRO_FI: 'https://login.schibsted.fi',
10447
+ PRO_DK: 'https://login.schibsted.dk'
10396
10448
  },
10397
10449
  BFF: {
10398
10450
  LOCAL: 'http://id.localhost/authn/',
@@ -10400,7 +10452,8 @@ var config = {
10400
10452
  PRE: 'https://identity-pre.schibsted.com/authn/',
10401
10453
  PRO: 'https://login.schibsted.com/authn/',
10402
10454
  PRO_NO: 'https://payment.schibsted.no/authn/',
10403
- PRO_FI: 'https://login.schibsted.fi/authn/'
10455
+ PRO_FI: 'https://login.schibsted.fi/authn/',
10456
+ PRO_DK: 'https://login.schibsted.dk/authn/'
10404
10457
  },
10405
10458
  SESSION_SERVICE: {
10406
10459
  LOCAL: 'http://session-service.id.localhost',
@@ -10408,7 +10461,8 @@ var config = {
10408
10461
  PRE: 'https://session-service.identity-pre.schibsted.com',
10409
10462
  PRO: 'https://session-service.login.schibsted.com',
10410
10463
  PRO_NO: 'https://session-service.payment.schibsted.no',
10411
- PRO_FI: 'https://session-service.login.schibsted.fi'
10464
+ PRO_FI: 'https://session-service.login.schibsted.fi',
10465
+ PRO_DK: 'https://session-service.login.schibsted.dk'
10412
10466
  }
10413
10467
  },
10414
10468
  NAMESPACE: {
@@ -10417,7 +10471,8 @@ var config = {
10417
10471
  PRE: 'schibsted.com',
10418
10472
  PRO: 'schibsted.com',
10419
10473
  PRO_NO: 'spid.no',
10420
- PRO_FI: 'schibsted.fi'
10474
+ PRO_FI: 'schibsted.fi',
10475
+ PRO_DK: 'schibsted.dk'
10421
10476
  }
10422
10477
  };
10423
10478
  /* harmony default export */ __webpack_exports__["default"] = (config);
@@ -11457,7 +11512,7 @@ function emulate(global) {
11457
11512
  /* 174 */
11458
11513
  /***/ (function(module) {
11459
11514
 
11460
- 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\"}");
11515
+ 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\"}");
11461
11516
 
11462
11517
  /***/ })
11463
11518
  /******/ ]);