@schibsted/account-sdk-browser 5.2.2 → 5.2.5

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
@@ -99,9 +99,9 @@ module.exports =
99
99
  window.regeneratorRuntime = __webpack_require__(1);
100
100
  var _require = __webpack_require__(2),
101
101
  Identity = _require.Identity;
102
- var _require2 = __webpack_require__(224),
102
+ var _require2 = __webpack_require__(225),
103
103
  Monetization = _require2.Monetization;
104
- var _require3 = __webpack_require__(226),
104
+ var _require3 = __webpack_require__(227),
105
105
  Payment = _require3.Payment;
106
106
  module.exports = {
107
107
  Identity: Identity,
@@ -889,6 +889,7 @@ __webpack_require__.r(__webpack_exports__);
889
889
  /* harmony import */ var _SDKError_js__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(189);
890
890
  /* harmony import */ var _spidTalk_js__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(222);
891
891
  /* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(223);
892
+ /* harmony import */ var _global_registry_js__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(224);
892
893
  /* Copyright 2024 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.
893
894
  * See LICENSE.md in the project root.
894
895
  */
@@ -978,6 +979,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
978
979
 
979
980
 
980
981
 
982
+
981
983
  /**
982
984
  * @typedef {object} LoginOptions
983
985
  * @property {string} state - An opaque value used by the client to maintain state between
@@ -988,7 +990,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
988
990
  * `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
989
991
  * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
990
992
  * to verify AMR (Authentication Methods References) claim in ID token.
991
- * Might also be used to ensure additional acr (sms, otp) for already logged in users.
993
+ * Might also be used to ensure additional acr (sms, otp) for already logged-in users.
992
994
  * Supported value is also 'otp-email' means one time password using email.
993
995
  * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
994
996
  * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
@@ -998,7 +1000,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
998
1000
  * @property {string} [redirectUri] - Redirect uri that will receive the
999
1001
  * code. Must exactly match a redirectUri from your client in self-service
1000
1002
  * @property {boolean} [preferPopup] - Should we try to open a popup window?
1001
- * @property {string} [loginHint] - user email or UUID hint
1003
+ * @property {string} [loginHint] - User email or UUID hint
1002
1004
  * @property {string} [tag] - Pulse tag
1003
1005
  * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
1004
1006
  * in place of default teaser
@@ -1008,9 +1010,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1008
1010
  * spec section 3.1.2.1 for more information
1009
1011
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1010
1012
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
1011
- * @property {boolean} [oneStepLogin] - display username and password on one screen
1013
+ * @property {boolean} [oneStepLogin] - Display username and password on one screen
1012
1014
  * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1013
- * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1015
+ * End-User for re-authentication or confirm account screen. Supported values: `select_account` or `login`
1016
+ * @property {string} [xDomainId] - Identifier for cross-domain tracking in Pulse
1017
+ * @property {string} [xEnvironmentId] - Environment for cross-domain tracking in Pulse
1018
+ * @property {string} [originCampaign] - Campaign identifier for tracking in Pulse
1014
1019
  */
1015
1020
  /**
1016
1021
  * @typedef {object} SimplifiedLoginWidgetLoginOptions
@@ -1022,7 +1027,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1022
1027
  * `password` (will force password confirmation, even if user is already logged in). Those values might
1023
1028
  * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
1024
1029
  * to verify AMR (Authentication Methods References) claim in ID token.
1025
- * Might also be used to ensure additional acr (sms, otp) for already logged in users.
1030
+ * Might also be used to ensure additional acr (sms, otp) for already logged-in users.
1026
1031
  * Supported value is also 'otp-email' means one time password using email.
1027
1032
  * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
1028
1033
  * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
@@ -1032,7 +1037,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1032
1037
  * @property {string} [redirectUri] - Redirect uri that will receive the
1033
1038
  * code. Must exactly match a redirectUri from your client in self-service
1034
1039
  * @property {boolean} [preferPopup] - Should we try to open a popup window?
1035
- * @property {string} [loginHint] - user email or UUID hint
1040
+ * @property {string} [loginHint] - User email or UUID hint
1036
1041
  * @property {string} [tag] - Pulse tag
1037
1042
  * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
1038
1043
  * in place of default teaser
@@ -1042,9 +1047,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1042
1047
  * spec section 3.1.2.1 for more information
1043
1048
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1044
1049
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
1045
- * @property {boolean} [oneStepLogin] - display username and password on one screen
1050
+ * @property {boolean} [oneStepLogin] - Display username and password on one screen
1046
1051
  * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1047
1052
  * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1053
+ * @property {string} [xDomainId] - Identifier for cross-domain tracking in Pulse
1054
+ * @property {string} [xEnvironmentId] - Environment for cross-domain tracking in Pulse
1055
+ * @property {string} [originCampaign] - Campaign identifier for tracking in Pulse
1048
1056
  */
1049
1057
 
1050
1058
  /**
@@ -1180,6 +1188,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1180
1188
  _this._setOauthServerUrl(env);
1181
1189
  _this._setGlobalSessionServiceUrl(env);
1182
1190
  _this._unblockSessionCall();
1191
+ Object(_global_registry_js__WEBPACK_IMPORTED_MODULE_66__["registerGlobal"])(window, 'Identity', _assertThisInitialized(_this));
1183
1192
  return _this;
1184
1193
  }
1185
1194
 
@@ -2063,6 +2072,8 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2063
2072
  * @param {boolean} [options.oneStepLogin=false]
2064
2073
  * @param {string} [options.prompt=select_account]
2065
2074
  * @param {string} [options.xDomainId]
2075
+ * @param {string} [options.xEnvironmentId]
2076
+ * @param {string} [options.originCampaign]
2066
2077
  * @return {Window|null} - Reference to popup window if created (or `null` otherwise)
2067
2078
  */
2068
2079
  }, {
@@ -2092,7 +2103,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2092
2103
  _ref4$prompt = _ref4.prompt,
2093
2104
  prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt,
2094
2105
  _ref4$xDomainId = _ref4.xDomainId,
2095
- xDomainId = _ref4$xDomainId === void 0 ? '' : _ref4$xDomainId;
2106
+ xDomainId = _ref4$xDomainId === void 0 ? '' : _ref4$xDomainId,
2107
+ _ref4$xEnvironmentId = _ref4.xEnvironmentId,
2108
+ xEnvironmentId = _ref4$xEnvironmentId === void 0 ? '' : _ref4$xEnvironmentId,
2109
+ _ref4$originCampaign = _ref4.originCampaign,
2110
+ originCampaign = _ref4$originCampaign === void 0 ? '' : _ref4$originCampaign;
2096
2111
  this._closePopup();
2097
2112
  this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2098
2113
  var url = this.loginUrl({
@@ -2107,7 +2122,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2107
2122
  locale: locale,
2108
2123
  oneStepLogin: oneStepLogin,
2109
2124
  prompt: prompt,
2110
- xDomainId: xDomainId
2125
+ xDomainId: xDomainId,
2126
+ xEnvironmentId: xEnvironmentId,
2127
+ originCampaign: originCampaign
2111
2128
  });
2112
2129
  if (preferPopup) {
2113
2130
  this.popup = _popup_js__WEBPACK_IMPORTED_MODULE_61__["open"](this.window, url, 'Schibsted account', {
@@ -2188,6 +2205,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2188
2205
  * @param {string} [options.locale]
2189
2206
  * @param {boolean} [options.oneStepLogin=false]
2190
2207
  * @param {string} [options.prompt=select_account]
2208
+ * @param {string} [options.xDomainId]
2209
+ * @param {string} [options.xEnvironmentId]
2210
+ * @param {string} [options.originCampaign]
2191
2211
  * @return {string} - The url
2192
2212
  */
2193
2213
  }, {
@@ -2215,7 +2235,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2215
2235
  _ref5$prompt = _ref5.prompt,
2216
2236
  prompt = _ref5$prompt === void 0 ? 'select_account' : _ref5$prompt,
2217
2237
  _ref5$xDomainId = _ref5.xDomainId,
2218
- xDomainId = _ref5$xDomainId === void 0 ? '' : _ref5$xDomainId;
2238
+ xDomainId = _ref5$xDomainId === void 0 ? '' : _ref5$xDomainId,
2239
+ _ref5$xEnvironmentId = _ref5.xEnvironmentId,
2240
+ xEnvironmentId = _ref5$xEnvironmentId === void 0 ? '' : _ref5$xEnvironmentId,
2241
+ _ref5$originCampaign = _ref5.originCampaign,
2242
+ originCampaign = _ref5$originCampaign === void 0 ? '' : _ref5$originCampaign;
2219
2243
  if (_typeof(arguments[0]) !== 'object') {
2220
2244
  // backward compatibility
2221
2245
  state = arguments[0];
@@ -2246,7 +2270,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2246
2270
  locale: locale,
2247
2271
  one_step_login: oneStepLogin || '',
2248
2272
  prompt: acrValues ? '' : prompt,
2249
- x_domain_id: xDomainId
2273
+ x_domain_id: xDomainId,
2274
+ x_env_id: xEnvironmentId,
2275
+ utm_campaign: originCampaign
2250
2276
  });
2251
2277
  }
2252
2278
 
@@ -12149,19 +12175,49 @@ __webpack_require__.r(__webpack_exports__);
12149
12175
 
12150
12176
 
12151
12177
 
12152
- var version = '5.2.2';
12178
+ var version = '5.2.5';
12153
12179
  /* harmony default export */ __webpack_exports__["default"] = (version);
12154
12180
 
12155
12181
  /***/ }),
12156
12182
  /* 224 */
12157
12183
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
12158
12184
 
12185
+ "use strict";
12186
+ __webpack_require__.r(__webpack_exports__);
12187
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerGlobal", function() { return registerGlobal; });
12188
+ /**
12189
+ * Registers a component as a property on the provided global object, if not already registered, and dispatches an event to notify listeners.
12190
+ * The event is dispatched on `document` and will have the name `$sch${componentClassName}:ready` and a `detail` property with the instance.
12191
+ *
12192
+ * @param {any} global typically `window`
12193
+ * @param {string} componentClassName the name of the component to register, 'identity', 'monetization' or 'payment'
12194
+ * @param {any} instance the instance of the component to register
12195
+ * @returns {void}
12196
+ */
12197
+ var registerGlobal = function registerGlobal(global, componentClassName, instance) {
12198
+ var prefixedName = "sch".concat(componentClassName);
12199
+ if (!global[prefixedName]) {
12200
+ global[prefixedName] = instance;
12201
+ }
12202
+ if (typeof global.dispatchEvent === 'function') {
12203
+ global.dispatchEvent(new CustomEvent("".concat(prefixedName, ":ready"), {
12204
+ detail: {
12205
+ instance: instance
12206
+ }
12207
+ }));
12208
+ }
12209
+ };
12210
+
12211
+ /***/ }),
12212
+ /* 225 */
12213
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
12214
+
12159
12215
  "use strict";
12160
12216
  __webpack_require__.r(__webpack_exports__);
12161
12217
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Monetization", function() { return Monetization; });
12162
12218
  /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
12163
12219
  /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__);
12164
- /* harmony import */ var core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(225);
12220
+ /* harmony import */ var core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(226);
12165
12221
  /* harmony import */ var core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_1__);
12166
12222
  /* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(70);
12167
12223
  /* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_2__);
@@ -12217,6 +12273,7 @@ __webpack_require__.r(__webpack_exports__);
12217
12273
  /* harmony import */ var _spidTalk_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(222);
12218
12274
  /* harmony import */ var _SDKError_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(189);
12219
12275
  /* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(223);
12276
+ /* harmony import */ var _global_registry_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(224);
12220
12277
  /* Copyright 2024 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.
12221
12278
  * See LICENSE.md in the project root.
12222
12279
  */
@@ -12272,6 +12329,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
12272
12329
 
12273
12330
 
12274
12331
 
12332
+
12275
12333
  var globalWindow = function globalWindow() {
12276
12334
  return window;
12277
12335
  };
@@ -12316,6 +12374,7 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
12316
12374
  Object(_validate_js__WEBPACK_IMPORTED_MODULE_24__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_24__["isUrl"])(sessionDomain), 'sessionDomain parameter is not a valid URL');
12317
12375
  _this._setSessionServiceUrl(sessionDomain);
12318
12376
  }
12377
+ Object(_global_registry_js__WEBPACK_IMPORTED_MODULE_33__["registerGlobal"])(window, 'Monetization', _assertThisInitialized(_this));
12319
12378
  return _this;
12320
12379
  }
12321
12380
 
@@ -12491,7 +12550,7 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
12491
12550
  /* harmony default export */ __webpack_exports__["default"] = (Monetization);
12492
12551
 
12493
12552
  /***/ }),
12494
- /* 225 */
12553
+ /* 226 */
12495
12554
  /***/ (function(module, exports, __webpack_require__) {
12496
12555
 
12497
12556
  "use strict";
@@ -12530,7 +12589,7 @@ $({
12530
12589
  });
12531
12590
 
12532
12591
  /***/ }),
12533
- /* 226 */
12592
+ /* 227 */
12534
12593
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
12535
12594
 
12536
12595
  "use strict";
@@ -12562,6 +12621,7 @@ __webpack_require__.r(__webpack_exports__);
12562
12621
  /* harmony import */ var _popup_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(211);
12563
12622
  /* harmony import */ var _RESTClient_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(214);
12564
12623
  /* harmony import */ var _spidTalk_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(222);
12624
+ /* harmony import */ var _global_registry_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(224);
12565
12625
  /* Copyright 2024 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.
12566
12626
  * See LICENSE.md in the project root.
12567
12627
  */
@@ -12590,6 +12650,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
12590
12650
 
12591
12651
 
12592
12652
 
12653
+
12593
12654
  var globalWindow = function globalWindow() {
12594
12655
  return window;
12595
12656
  };
@@ -12625,6 +12686,7 @@ var Payment = /*#__PURE__*/function () {
12625
12686
  this.publisher = publisher;
12626
12687
  this._setSpidServerUrl(env);
12627
12688
  this._setBffServerUrl(env);
12689
+ Object(_global_registry_js__WEBPACK_IMPORTED_MODULE_16__["registerGlobal"])(window, 'Payment', this);
12628
12690
  }
12629
12691
 
12630
12692
  /**