@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/index.js CHANGED
@@ -997,7 +997,43 @@ var _require = __webpack_require__(174),
997
997
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
998
998
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
999
999
  * @property {boolean} [oneStepLogin] - display username and password on one screen
1000
- * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1000
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1001
+ * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1002
+ */
1003
+
1004
+ /**
1005
+ * @typedef {object} SimplifiedLoginWidgetLoginOptions
1006
+ * @property {string|function(): (string|Promise<string>)} state - An opaque value used by the client to maintain state between
1007
+ * the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
1008
+ * @property {string} [acrValues] - Authentication Context Class Reference Values. If
1009
+ * omitted, the user will be asked to authenticate using username+password.
1010
+ * For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
1011
+ * `password` (will force password confirmation, even if user is already logged in). Those values might
1012
+ * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
1013
+ * to verify AMR (Authentication Methods References) claim in ID token.
1014
+ * Might also be used to ensure additional acr (sms, otp) for already logged in users.
1015
+ * Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
1016
+ * one time password using sms.
1017
+ * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
1018
+ * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
1019
+ * includes the id token which can be useful for getting information about the user. Omitting
1020
+ * scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
1021
+ * aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
1022
+ * @property {string} [redirectUri] - Redirect uri that will receive the
1023
+ * code. Must exactly match a redirectUri from your client in self-service
1024
+ * @property {boolean} [preferPopup] - Should we try to open a popup window?
1025
+ * @property {string} [loginHint] - user email or UUID hint
1026
+ * @property {string} [tag] - Pulse tag
1027
+ * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
1028
+ * in place of default teaser
1029
+ * @property {number|string} [maxAge] - Specifies the allowable elapsed time in seconds since
1030
+ * the last time the End-User was actively authenticated. If last authentication time is more
1031
+ * than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
1032
+ * spec section 3.1.2.1 for more information
1033
+ * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1034
+ * New flows supports nb_NO, fi_FI, sv_SE, en_US
1035
+ * @property {boolean} [oneStepLogin] - display username and password on one screen
1036
+ * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1001
1037
  * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1002
1038
  */
1003
1039
 
@@ -1053,6 +1089,11 @@ var _require = __webpack_require__(174),
1053
1089
  * @property {string} client_name - Client name
1054
1090
  */
1055
1091
 
1092
+ /**
1093
+ * @typedef {object} SimplifiedLoginWidgetOptions
1094
+ * @property {string} encoding - expected encoding of simplified login widget. Could be utf-8 (default), iso-8859-1 or iso-8859-15
1095
+ */
1096
+
1056
1097
 
1057
1098
  var HAS_SESSION_CACHE_KEY = 'hasSession-cache';
1058
1099
 
@@ -1074,7 +1115,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1074
1115
  * @param {string} options.clientId - Example: "1234567890abcdef12345678"
1075
1116
  * @param {string} options.sessionDomain - Example: "https://id.site.com"
1076
1117
  * @param {string} options.redirectUri - Example: "https://site.com"
1077
- * @param {string} [options.env=PRE] - Schibsted account environment: `PRE`, `PRO` or `PRO_NO`
1118
+ * @param {string} [options.env=PRE] - Schibsted account environment: `PRE`, `PRO`, `PRO_NO`, `PRO_FI` or `PRO_DK`
1078
1119
  * @param {function} [options.log] - A function that receives debug log information. If not set,
1079
1120
  * no logging will be done
1080
1121
  * @param {object} [options.window] - window object
@@ -1331,7 +1372,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1331
1372
  * @param {object} [options]
1332
1373
  * @param {number} [options.expiresIn] Override this to set number of seconds before the varnish
1333
1374
  * cookie expires. The default is to use the same time that hasSession responses are cached for
1334
- * @param {boolean} [options.domain] Override cookie domain. E.g. «vg.no» instead of «www.vg.no»
1375
+ * @param {string} [options.domain] Override cookie domain. E.g. «vg.no» instead of «www.vg.no»
1335
1376
  * @returns {void}
1336
1377
  */
1337
1378
 
@@ -2125,18 +2166,19 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2125
2166
  * and store that info in localStorage. Widget will be display only if user is logged in to SSO.
2126
2167
  *
2127
2168
  * @async
2128
- * @param {LoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
2169
+ * @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
2129
2170
  * continue action. `state` might be string or async function.
2171
+ * @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
2130
2172
  * @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
2131
2173
  */
2132
2174
 
2133
2175
  }, {
2134
2176
  key: "showSimplifiedLoginWidget",
2135
2177
  value: function () {
2136
- var _showSimplifiedLoginWidget = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(loginParams) {
2178
+ var _showSimplifiedLoginWidget = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(loginParams, options) {
2137
2179
  var _this3 = this;
2138
2180
 
2139
- var userData, widgetUrl, prepareLoginParams;
2181
+ var userData, queryParams, widgetUrl, prepareLoginParams;
2140
2182
  return regeneratorRuntime.wrap(function _callee12$(_context12) {
2141
2183
  while (1) {
2142
2184
  switch (_context12.prev = _context12.next) {
@@ -2146,9 +2188,15 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2146
2188
 
2147
2189
  case 2:
2148
2190
  userData = _context12.sent;
2149
- widgetUrl = this._bffService.makeUrl('simplified-login-widget', {
2191
+ queryParams = {
2150
2192
  client_id: this.clientId
2151
- }, false);
2193
+ };
2194
+
2195
+ if (options && options.encoding) {
2196
+ queryParams.encoding = options.encoding;
2197
+ }
2198
+
2199
+ widgetUrl = this._bffService.makeUrl('simplified-login-widget', queryParams, false);
2152
2200
 
2153
2201
  prepareLoginParams = /*#__PURE__*/function () {
2154
2202
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(loginPrams) {
@@ -2178,7 +2226,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2178
2226
  }, _callee9);
2179
2227
  }));
2180
2228
 
2181
- return function prepareLoginParams(_x2) {
2229
+ return function prepareLoginParams(_x3) {
2182
2230
  return _ref5.apply(this, arguments);
2183
2231
  };
2184
2232
  }();
@@ -2290,7 +2338,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2290
2338
  document.getElementsByTagName('body')[0].appendChild(simplifiedLoginWidget);
2291
2339
  }));
2292
2340
 
2293
- case 6:
2341
+ case 8:
2294
2342
  case "end":
2295
2343
  return _context12.stop();
2296
2344
  }
@@ -2298,7 +2346,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2298
2346
  }, _callee12, this);
2299
2347
  }));
2300
2348
 
2301
- function showSimplifiedLoginWidget(_x) {
2349
+ function showSimplifiedLoginWidget(_x, _x2) {
2302
2350
  return _showSimplifiedLoginWidget.apply(this, arguments);
2303
2351
  }
2304
2352
 
@@ -10376,6 +10424,7 @@ __webpack_require__.r(__webpack_exports__);
10376
10424
  * @prop {string} ENDPOINTS.SPiD.PRO - Production environment Sweden
10377
10425
  * @prop {string} ENDPOINTS.SPiD.PRO_NO - Production environment Norway
10378
10426
  * @prop {string} ENDPOINTS.SPiD.PRO_FI - Production environment Finland
10427
+ * @prop {string} ENDPOINTS.SPiD.PRO_DK - Production environment Denmark
10379
10428
  * @prop {object} ENDPOINTS.BFF - Endpoints used with new GDPR-compliant web flows
10380
10429
  * @prop {string} ENDPOINTS.BFF.LOCAL - Local endpoint (for Identity team)
10381
10430
  * @prop {string} ENDPOINTS.BFF.DEV - Dev environment (for Identity team)
@@ -10383,6 +10432,7 @@ __webpack_require__.r(__webpack_exports__);
10383
10432
  * @prop {string} ENDPOINTS.BFF.PRO - Production environment Sweden
10384
10433
  * @prop {string} ENDPOINTS.BFF.PRO_NO - Production environment Norway
10385
10434
  * @prop {string} ENDPOINTS.BFF.PRO_FI - Production environment Finland
10435
+ * @prop {string} ENDPOINTS.BFF.PRO_DK - Production environment Denmark
10386
10436
  * @prop {object} ENDPOINTS.SESSION_SERVICE - Endpoints to check global user session data
10387
10437
  * @prop {string} ENDPOINTS.SESSION_SERVICE.LOCAL - Local endpoint (for Identity team)
10388
10438
  * @prop {string} ENDPOINTS.SESSION_SERVICE.DEV - Dev environment (for Identity team)
@@ -10390,6 +10440,7 @@ __webpack_require__.r(__webpack_exports__);
10390
10440
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO - Production environment Sweden
10391
10441
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_NO - Production environment Norway
10392
10442
  * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_FI - Production environment Finland
10443
+ * @prop {string} ENDPOINTS.SESSION_SERVICE.PRO_DK - Production environment Denmark
10393
10444
  */
10394
10445
 
10395
10446
  var config = {
@@ -10400,7 +10451,8 @@ var config = {
10400
10451
  PRE: 'https://identity-pre.schibsted.com',
10401
10452
  PRO: 'https://login.schibsted.com',
10402
10453
  PRO_NO: 'https://payment.schibsted.no',
10403
- PRO_FI: 'https://login.schibsted.fi'
10454
+ PRO_FI: 'https://login.schibsted.fi',
10455
+ PRO_DK: 'https://login.schibsted.dk'
10404
10456
  },
10405
10457
  BFF: {
10406
10458
  LOCAL: 'http://id.localhost/authn/',
@@ -10408,7 +10460,8 @@ var config = {
10408
10460
  PRE: 'https://identity-pre.schibsted.com/authn/',
10409
10461
  PRO: 'https://login.schibsted.com/authn/',
10410
10462
  PRO_NO: 'https://payment.schibsted.no/authn/',
10411
- PRO_FI: 'https://login.schibsted.fi/authn/'
10463
+ PRO_FI: 'https://login.schibsted.fi/authn/',
10464
+ PRO_DK: 'https://login.schibsted.dk/authn/'
10412
10465
  },
10413
10466
  SESSION_SERVICE: {
10414
10467
  LOCAL: 'http://session-service.id.localhost',
@@ -10416,7 +10469,8 @@ var config = {
10416
10469
  PRE: 'https://session-service.identity-pre.schibsted.com',
10417
10470
  PRO: 'https://session-service.login.schibsted.com',
10418
10471
  PRO_NO: 'https://session-service.payment.schibsted.no',
10419
- PRO_FI: 'https://session-service.login.schibsted.fi'
10472
+ PRO_FI: 'https://session-service.login.schibsted.fi',
10473
+ PRO_DK: 'https://session-service.login.schibsted.dk'
10420
10474
  }
10421
10475
  },
10422
10476
  NAMESPACE: {
@@ -10425,7 +10479,8 @@ var config = {
10425
10479
  PRE: 'schibsted.com',
10426
10480
  PRO: 'schibsted.com',
10427
10481
  PRO_NO: 'spid.no',
10428
- PRO_FI: 'schibsted.fi'
10482
+ PRO_FI: 'schibsted.fi',
10483
+ PRO_DK: 'schibsted.dk'
10429
10484
  }
10430
10485
  };
10431
10486
  /* harmony default export */ __webpack_exports__["default"] = (config);
@@ -11465,7 +11520,7 @@ function emulate(global) {
11465
11520
  /* 174 */
11466
11521
  /***/ (function(module) {
11467
11522
 
11468
- 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\"}");
11523
+ 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\"}");
11469
11524
 
11470
11525
  /***/ }),
11471
11526
  /* 175 */
@@ -12084,6 +12139,7 @@ var Payment = /*#__PURE__*/function () {
12084
12139
  });
12085
12140
  }
12086
12141
  /**
12142
+ * @deprecated
12087
12143
  * Get the url for flow to purchase a promo code product with ZUORA
12088
12144
  * @param {string} code - promocode product code
12089
12145
  * @param {string} [state=''] - An opaque value used by the client to maintain state between