@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/identity.js CHANGED
@@ -883,6 +883,7 @@ __webpack_require__.r(__webpack_exports__);
883
883
  /* harmony import */ var _SDKError_js__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(189);
884
884
  /* harmony import */ var _spidTalk_js__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(222);
885
885
  /* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(223);
886
+ /* harmony import */ var _global_registry_js__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(224);
886
887
  /* Copyright 2024 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.
887
888
  * See LICENSE.md in the project root.
888
889
  */
@@ -972,6 +973,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
972
973
 
973
974
 
974
975
 
976
+
975
977
  /**
976
978
  * @typedef {object} LoginOptions
977
979
  * @property {string} state - An opaque value used by the client to maintain state between
@@ -982,7 +984,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
982
984
  * `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
983
985
  * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
984
986
  * to verify AMR (Authentication Methods References) claim in ID token.
985
- * Might also be used to ensure additional acr (sms, otp) for already logged in users.
987
+ * Might also be used to ensure additional acr (sms, otp) for already logged-in users.
986
988
  * Supported value is also 'otp-email' means one time password using email.
987
989
  * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
988
990
  * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
@@ -992,7 +994,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
992
994
  * @property {string} [redirectUri] - Redirect uri that will receive the
993
995
  * code. Must exactly match a redirectUri from your client in self-service
994
996
  * @property {boolean} [preferPopup] - Should we try to open a popup window?
995
- * @property {string} [loginHint] - user email or UUID hint
997
+ * @property {string} [loginHint] - User email or UUID hint
996
998
  * @property {string} [tag] - Pulse tag
997
999
  * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
998
1000
  * in place of default teaser
@@ -1002,9 +1004,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1002
1004
  * spec section 3.1.2.1 for more information
1003
1005
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1004
1006
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
1005
- * @property {boolean} [oneStepLogin] - display username and password on one screen
1007
+ * @property {boolean} [oneStepLogin] - Display username and password on one screen
1006
1008
  * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1007
- * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1009
+ * End-User for re-authentication or confirm account screen. Supported values: `select_account` or `login`
1010
+ * @property {string} [xDomainId] - Identifier for cross-domain tracking in Pulse
1011
+ * @property {string} [xEnvironmentId] - Environment for cross-domain tracking in Pulse
1012
+ * @property {string} [originCampaign] - Campaign identifier for tracking in Pulse
1008
1013
  */
1009
1014
  /**
1010
1015
  * @typedef {object} SimplifiedLoginWidgetLoginOptions
@@ -1016,7 +1021,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1016
1021
  * `password` (will force password confirmation, even if user is already logged in). Those values might
1017
1022
  * be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
1018
1023
  * to verify AMR (Authentication Methods References) claim in ID token.
1019
- * Might also be used to ensure additional acr (sms, otp) for already logged in users.
1024
+ * Might also be used to ensure additional acr (sms, otp) for already logged-in users.
1020
1025
  * Supported value is also 'otp-email' means one time password using email.
1021
1026
  * @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
1022
1027
  * scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
@@ -1026,7 +1031,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1026
1031
  * @property {string} [redirectUri] - Redirect uri that will receive the
1027
1032
  * code. Must exactly match a redirectUri from your client in self-service
1028
1033
  * @property {boolean} [preferPopup] - Should we try to open a popup window?
1029
- * @property {string} [loginHint] - user email or UUID hint
1034
+ * @property {string} [loginHint] - User email or UUID hint
1030
1035
  * @property {string} [tag] - Pulse tag
1031
1036
  * @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
1032
1037
  * in place of default teaser
@@ -1036,9 +1041,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1036
1041
  * spec section 3.1.2.1 for more information
1037
1042
  * @property {string} [locale] - Optional parameter to overwrite client locale setting.
1038
1043
  * New flows supports nb_NO, fi_FI, sv_SE, en_US
1039
- * @property {boolean} [oneStepLogin] - display username and password on one screen
1044
+ * @property {boolean} [oneStepLogin] - Display username and password on one screen
1040
1045
  * @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
1041
1046
  * End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
1047
+ * @property {string} [xDomainId] - Identifier for cross-domain tracking in Pulse
1048
+ * @property {string} [xEnvironmentId] - Environment for cross-domain tracking in Pulse
1049
+ * @property {string} [originCampaign] - Campaign identifier for tracking in Pulse
1042
1050
  */
1043
1051
 
1044
1052
  /**
@@ -1174,6 +1182,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1174
1182
  _this._setOauthServerUrl(env);
1175
1183
  _this._setGlobalSessionServiceUrl(env);
1176
1184
  _this._unblockSessionCall();
1185
+ Object(_global_registry_js__WEBPACK_IMPORTED_MODULE_66__["registerGlobal"])(window, 'Identity', _assertThisInitialized(_this));
1177
1186
  return _this;
1178
1187
  }
1179
1188
 
@@ -2057,6 +2066,8 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2057
2066
  * @param {boolean} [options.oneStepLogin=false]
2058
2067
  * @param {string} [options.prompt=select_account]
2059
2068
  * @param {string} [options.xDomainId]
2069
+ * @param {string} [options.xEnvironmentId]
2070
+ * @param {string} [options.originCampaign]
2060
2071
  * @return {Window|null} - Reference to popup window if created (or `null` otherwise)
2061
2072
  */
2062
2073
  }, {
@@ -2086,7 +2097,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2086
2097
  _ref4$prompt = _ref4.prompt,
2087
2098
  prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt,
2088
2099
  _ref4$xDomainId = _ref4.xDomainId,
2089
- xDomainId = _ref4$xDomainId === void 0 ? '' : _ref4$xDomainId;
2100
+ xDomainId = _ref4$xDomainId === void 0 ? '' : _ref4$xDomainId,
2101
+ _ref4$xEnvironmentId = _ref4.xEnvironmentId,
2102
+ xEnvironmentId = _ref4$xEnvironmentId === void 0 ? '' : _ref4$xEnvironmentId,
2103
+ _ref4$originCampaign = _ref4.originCampaign,
2104
+ originCampaign = _ref4$originCampaign === void 0 ? '' : _ref4$originCampaign;
2090
2105
  this._closePopup();
2091
2106
  this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2092
2107
  var url = this.loginUrl({
@@ -2101,7 +2116,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2101
2116
  locale: locale,
2102
2117
  oneStepLogin: oneStepLogin,
2103
2118
  prompt: prompt,
2104
- xDomainId: xDomainId
2119
+ xDomainId: xDomainId,
2120
+ xEnvironmentId: xEnvironmentId,
2121
+ originCampaign: originCampaign
2105
2122
  });
2106
2123
  if (preferPopup) {
2107
2124
  this.popup = _popup_js__WEBPACK_IMPORTED_MODULE_61__["open"](this.window, url, 'Schibsted account', {
@@ -2182,6 +2199,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2182
2199
  * @param {string} [options.locale]
2183
2200
  * @param {boolean} [options.oneStepLogin=false]
2184
2201
  * @param {string} [options.prompt=select_account]
2202
+ * @param {string} [options.xDomainId]
2203
+ * @param {string} [options.xEnvironmentId]
2204
+ * @param {string} [options.originCampaign]
2185
2205
  * @return {string} - The url
2186
2206
  */
2187
2207
  }, {
@@ -2209,7 +2229,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2209
2229
  _ref5$prompt = _ref5.prompt,
2210
2230
  prompt = _ref5$prompt === void 0 ? 'select_account' : _ref5$prompt,
2211
2231
  _ref5$xDomainId = _ref5.xDomainId,
2212
- xDomainId = _ref5$xDomainId === void 0 ? '' : _ref5$xDomainId;
2232
+ xDomainId = _ref5$xDomainId === void 0 ? '' : _ref5$xDomainId,
2233
+ _ref5$xEnvironmentId = _ref5.xEnvironmentId,
2234
+ xEnvironmentId = _ref5$xEnvironmentId === void 0 ? '' : _ref5$xEnvironmentId,
2235
+ _ref5$originCampaign = _ref5.originCampaign,
2236
+ originCampaign = _ref5$originCampaign === void 0 ? '' : _ref5$originCampaign;
2213
2237
  if (_typeof(arguments[0]) !== 'object') {
2214
2238
  // backward compatibility
2215
2239
  state = arguments[0];
@@ -2240,7 +2264,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2240
2264
  locale: locale,
2241
2265
  one_step_login: oneStepLogin || '',
2242
2266
  prompt: acrValues ? '' : prompt,
2243
- x_domain_id: xDomainId
2267
+ x_domain_id: xDomainId,
2268
+ x_env_id: xEnvironmentId,
2269
+ utm_campaign: originCampaign
2244
2270
  });
2245
2271
  }
2246
2272
 
@@ -12143,9 +12169,39 @@ __webpack_require__.r(__webpack_exports__);
12143
12169
 
12144
12170
 
12145
12171
 
12146
- var version = '5.2.2';
12172
+ var version = '5.2.5';
12147
12173
  /* harmony default export */ __webpack_exports__["default"] = (version);
12148
12174
 
12175
+ /***/ }),
12176
+ /* 224 */
12177
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
12178
+
12179
+ "use strict";
12180
+ __webpack_require__.r(__webpack_exports__);
12181
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerGlobal", function() { return registerGlobal; });
12182
+ /**
12183
+ * Registers a component as a property on the provided global object, if not already registered, and dispatches an event to notify listeners.
12184
+ * The event is dispatched on `document` and will have the name `$sch${componentClassName}:ready` and a `detail` property with the instance.
12185
+ *
12186
+ * @param {any} global typically `window`
12187
+ * @param {string} componentClassName the name of the component to register, 'identity', 'monetization' or 'payment'
12188
+ * @param {any} instance the instance of the component to register
12189
+ * @returns {void}
12190
+ */
12191
+ var registerGlobal = function registerGlobal(global, componentClassName, instance) {
12192
+ var prefixedName = "sch".concat(componentClassName);
12193
+ if (!global[prefixedName]) {
12194
+ global[prefixedName] = instance;
12195
+ }
12196
+ if (typeof global.dispatchEvent === 'function') {
12197
+ global.dispatchEvent(new CustomEvent("".concat(prefixedName, ":ready"), {
12198
+ detail: {
12199
+ instance: instance
12200
+ }
12201
+ }));
12202
+ }
12203
+ };
12204
+
12149
12205
  /***/ })
12150
12206
  /******/ ]);
12151
12207
  //# sourceMappingURL=identity.js.map