@carbon/ibmdotcom-services 1.31.0-rc.0 → 1.31.0-rc.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
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.31.0-rc.3](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/compare/@carbon/ibmdotcom-services@1.31.0-rc.2...@carbon/ibmdotcom-services@1.31.0-rc.3) (2022-02-25)
7
+
8
+ **Note:** Version bump only for package @carbon/ibmdotcom-services
9
+
10
+
11
+
12
+
13
+
14
+ # [1.31.0-rc.2](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/compare/@carbon/ibmdotcom-services@1.31.0-rc.1...@carbon/ibmdotcom-services@1.31.0-rc.2) (2022-02-24)
15
+
16
+ **Note:** Version bump only for package @carbon/ibmdotcom-services
17
+
18
+
19
+
20
+
21
+
22
+ # [1.31.0-rc.1](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/compare/@carbon/ibmdotcom-services@1.31.0-rc.0...@carbon/ibmdotcom-services@1.31.0-rc.1) (2022-02-14)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **cloud-masthead:** replace cookie auth with window object status ([#8149](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/issues/8149)) ([1dc66b7](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/commit/1dc66b7))
28
+ * **cloud-masthead:** update the services and utilities to use canary ([#8250](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/issues/8250)) ([9a73de0](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/commit/9a73de0))
29
+ * **deps:** fix to marked dependency issues ([#8172](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/issues/8172)) ([c1bb7f5](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/commit/c1bb7f5))
30
+
31
+
32
+ ### Features
33
+
34
+ * **search-with-typeahead:** add scoped search support ([#8096](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/issues/8096)) ([8a26e56](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/commit/8a26e56)), closes [#7627](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/issues/7627)
35
+
36
+
37
+
38
+
39
+
6
40
  # [1.31.0-rc.0](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/compare/@carbon/ibmdotcom-services@1.30.0...@carbon/ibmdotcom-services@1.31.0-rc.0) (2022-02-01)
7
41
 
8
42
 
@@ -4,21 +4,14 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
 
6
6
  /**
7
- * Copyright IBM Corp. 2021
7
+ * Copyright IBM Corp. 2021, 2022
8
8
  *
9
9
  * This source code is licensed under the Apache-2.0 license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
  import axios from 'axios';
13
- import Cookies from 'js-cookie';
14
- /**
15
- * The cookie name for determining user login status for cloud.ibm.com.
16
- *
17
- * @type {string}
18
- * @private
19
- */
20
-
21
- var _cookieName = 'com.ibm.cloud.iam.LoggedIn.prod';
13
+ import { DDOAPI } from '../DDO';
14
+ import root from 'window-or-global';
22
15
 
23
16
  var CloudAccountAuthAPI = /*#__PURE__*/function () {
24
17
  function CloudAccountAuthAPI() {
@@ -26,24 +19,52 @@ var CloudAccountAuthAPI = /*#__PURE__*/function () {
26
19
  }
27
20
 
28
21
  _createClass(CloudAccountAuthAPI, null, [{
29
- key: "checkCookie",
22
+ key: "checkPersonalization",
30
23
 
31
24
  /**
32
- * retrieve the cloud login status via cookie
25
+ * retrieve the cloud login status via window object status
26
+ * gets the full digitalData (DDO) object.
33
27
  *
34
28
  * @example
35
29
  * import { cloudAccountAuthentication } from '@carbon/ibmdotcom-utilities';
36
30
  *
37
- * const status = cloudAccountAuthentication.checkCookie();
31
+ * const status = cloudAccountAuthentication.checkPersonalization();
38
32
  *
39
33
  * @returns {string} string determining login status
40
34
  */
41
- value: function checkCookie() {
42
- var cloudLogin = Cookies.get(_cookieName);
43
- return {
44
- user: cloudLogin === '1' ? 'authenticated' : 'anonymous'
45
- };
46
- }
35
+ value: function () {
36
+ var _checkPersonalization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
37
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
38
+ while (1) {
39
+ switch (_context.prev = _context.next) {
40
+ case 0:
41
+ _context.next = 2;
42
+ return DDOAPI.isReady().then(function () {
43
+ var _root$digitalData, _root$digitalData$use, _root$digitalData$use2;
44
+
45
+ var status = (_root$digitalData = root.digitalData) === null || _root$digitalData === void 0 ? void 0 : (_root$digitalData$use = _root$digitalData.user) === null || _root$digitalData$use === void 0 ? void 0 : (_root$digitalData$use2 = _root$digitalData$use.segment) === null || _root$digitalData$use2 === void 0 ? void 0 : _root$digitalData$use2.isCloudLoggedOn;
46
+ return {
47
+ user: status === true ? 'authenticated' : 'anonymous'
48
+ };
49
+ });
50
+
51
+ case 2:
52
+ return _context.abrupt("return", _context.sent);
53
+
54
+ case 3:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }
59
+ }, _callee);
60
+ }));
61
+
62
+ function checkPersonalization() {
63
+ return _checkPersonalization.apply(this, arguments);
64
+ }
65
+
66
+ return checkPersonalization;
67
+ }()
47
68
  /**
48
69
  * retrieve the cloud login status via api
49
70
  *
@@ -58,13 +79,13 @@ var CloudAccountAuthAPI = /*#__PURE__*/function () {
58
79
  }, {
59
80
  key: "checkAPI",
60
81
  value: function () {
61
- var _checkAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
82
+ var _checkAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
62
83
  var cloudLogin;
63
- return _regeneratorRuntime.wrap(function _callee$(_context) {
84
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
64
85
  while (1) {
65
- switch (_context.prev = _context.next) {
86
+ switch (_context2.prev = _context2.next) {
66
87
  case 0:
67
- _context.next = 2;
88
+ _context2.next = 2;
68
89
  return axios.get('/api/v6/selected-account?profile=true', {
69
90
  headers: {
70
91
  Accept: 'application/json'
@@ -77,17 +98,17 @@ var CloudAccountAuthAPI = /*#__PURE__*/function () {
77
98
  });
78
99
 
79
100
  case 2:
80
- cloudLogin = _context.sent;
81
- return _context.abrupt("return", {
101
+ cloudLogin = _context2.sent;
102
+ return _context2.abrupt("return", {
82
103
  user: cloudLogin
83
104
  });
84
105
 
85
106
  case 4:
86
107
  case "end":
87
- return _context.stop();
108
+ return _context2.stop();
88
109
  }
89
110
  }
90
- }, _callee);
111
+ }, _callee2);
91
112
  }));
92
113
 
93
114
  function checkAPI() {
@@ -4,7 +4,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
 
6
6
  /**
7
- * Copyright IBM Corp. 2020, 2021
7
+ * Copyright IBM Corp. 2020, 2022
8
8
  *
9
9
  * This source code is licensed under the Apache-2.0 license found in the
10
10
  * LICENSE file in the root directory of this source tree.
@@ -62,19 +62,26 @@ var SearchTypeaheadAPI = /*#__PURE__*/function () {
62
62
  */
63
63
  value: function () {
64
64
  var _getResults = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
65
- var lang, urlQuery, url;
65
+ var appid,
66
+ lang,
67
+ urlQuery,
68
+ url,
69
+ _args = arguments;
66
70
  return _regeneratorRuntime.wrap(function _callee$(_context) {
67
71
  while (1) {
68
72
  switch (_context.prev = _context.next) {
69
73
  case 0:
70
- _context.next = 2;
74
+ appid = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
75
+ _context.next = 3;
71
76
  return LocaleAPI.getLang();
72
77
 
73
- case 2:
78
+ case 3:
74
79
  lang = _context.sent;
75
- urlQuery = ["lang=".concat(lang.lc).concat(lang.cc ? "&cc=".concat(lang.cc) : ''), "query=".concat(encodeURIComponent(query))].join('&');
80
+ urlQuery = ["lang=".concat(lang.lc).concat(lang.cc ? "&cc=".concat(lang.cc) : ''), "query=".concat(encodeURIComponent(query)), "".concat(appid ? "appid=".concat(appid) : '')].filter(function (item) {
81
+ return item;
82
+ }).join('&');
76
83
  url = "".concat(_endpoint, "?").concat(urlQuery);
77
- _context.next = 7;
84
+ _context.next = 8;
78
85
  return axios.get(url, {
79
86
  headers: {
80
87
  'Content-Type': 'application/json; charset=utf-8'
@@ -83,10 +90,10 @@ var SearchTypeaheadAPI = /*#__PURE__*/function () {
83
90
  return response.data.response;
84
91
  });
85
92
 
86
- case 7:
93
+ case 8:
87
94
  return _context.abrupt("return", _context.sent);
88
95
 
89
- case 8:
96
+ case 9:
90
97
  case "end":
91
98
  return _context.stop();
92
99
  }
@@ -17,48 +17,68 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
17
17
 
18
18
  var _axios = _interopRequireDefault(require("axios"));
19
19
 
20
- var _jsCookie = _interopRequireDefault(require("js-cookie"));
20
+ var _DDO = require("../DDO");
21
+
22
+ var _windowOrGlobal = _interopRequireDefault(require("window-or-global"));
21
23
 
22
24
  /**
23
- * Copyright IBM Corp. 2021
25
+ * Copyright IBM Corp. 2021, 2022
24
26
  *
25
27
  * This source code is licensed under the Apache-2.0 license found in the
26
28
  * LICENSE file in the root directory of this source tree.
27
29
  */
28
-
29
- /**
30
- * The cookie name for determining user login status for cloud.ibm.com.
31
- *
32
- * @type {string}
33
- * @private
34
- */
35
- var _cookieName = 'com.ibm.cloud.iam.LoggedIn.prod';
36
-
37
30
  var CloudAccountAuthAPI = /*#__PURE__*/function () {
38
31
  function CloudAccountAuthAPI() {
39
32
  (0, _classCallCheck2.default)(this, CloudAccountAuthAPI);
40
33
  }
41
34
 
42
35
  (0, _createClass2.default)(CloudAccountAuthAPI, null, [{
43
- key: "checkCookie",
36
+ key: "checkPersonalization",
44
37
 
45
38
  /**
46
- * retrieve the cloud login status via cookie
39
+ * retrieve the cloud login status via window object status
40
+ * gets the full digitalData (DDO) object.
47
41
  *
48
42
  * @example
49
43
  * import { cloudAccountAuthentication } from '@carbon/ibmdotcom-utilities';
50
44
  *
51
- * const status = cloudAccountAuthentication.checkCookie();
45
+ * const status = cloudAccountAuthentication.checkPersonalization();
52
46
  *
53
47
  * @returns {string} string determining login status
54
48
  */
55
- value: function checkCookie() {
56
- var cloudLogin = _jsCookie.default.get(_cookieName);
49
+ value: function () {
50
+ var _checkPersonalization = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
51
+ return _regenerator.default.wrap(function _callee$(_context) {
52
+ while (1) {
53
+ switch (_context.prev = _context.next) {
54
+ case 0:
55
+ _context.next = 2;
56
+ return _DDO.DDOAPI.isReady().then(function () {
57
+ var _root$digitalData, _root$digitalData$use, _root$digitalData$use2;
58
+
59
+ var status = (_root$digitalData = _windowOrGlobal.default.digitalData) === null || _root$digitalData === void 0 ? void 0 : (_root$digitalData$use = _root$digitalData.user) === null || _root$digitalData$use === void 0 ? void 0 : (_root$digitalData$use2 = _root$digitalData$use.segment) === null || _root$digitalData$use2 === void 0 ? void 0 : _root$digitalData$use2.isCloudLoggedOn;
60
+ return {
61
+ user: status === true ? 'authenticated' : 'anonymous'
62
+ };
63
+ });
64
+
65
+ case 2:
66
+ return _context.abrupt("return", _context.sent);
57
67
 
58
- return {
59
- user: cloudLogin === '1' ? 'authenticated' : 'anonymous'
60
- };
61
- }
68
+ case 3:
69
+ case "end":
70
+ return _context.stop();
71
+ }
72
+ }
73
+ }, _callee);
74
+ }));
75
+
76
+ function checkPersonalization() {
77
+ return _checkPersonalization.apply(this, arguments);
78
+ }
79
+
80
+ return checkPersonalization;
81
+ }()
62
82
  /**
63
83
  * retrieve the cloud login status via api
64
84
  *
@@ -73,13 +93,13 @@ var CloudAccountAuthAPI = /*#__PURE__*/function () {
73
93
  }, {
74
94
  key: "checkAPI",
75
95
  value: function () {
76
- var _checkAPI = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
96
+ var _checkAPI = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
77
97
  var cloudLogin;
78
- return _regenerator.default.wrap(function _callee$(_context) {
98
+ return _regenerator.default.wrap(function _callee2$(_context2) {
79
99
  while (1) {
80
- switch (_context.prev = _context.next) {
100
+ switch (_context2.prev = _context2.next) {
81
101
  case 0:
82
- _context.next = 2;
102
+ _context2.next = 2;
83
103
  return _axios.default.get('/api/v6/selected-account?profile=true', {
84
104
  headers: {
85
105
  Accept: 'application/json'
@@ -92,17 +112,17 @@ var CloudAccountAuthAPI = /*#__PURE__*/function () {
92
112
  });
93
113
 
94
114
  case 2:
95
- cloudLogin = _context.sent;
96
- return _context.abrupt("return", {
115
+ cloudLogin = _context2.sent;
116
+ return _context2.abrupt("return", {
97
117
  user: cloudLogin
98
118
  });
99
119
 
100
120
  case 4:
101
121
  case "end":
102
- return _context.stop();
122
+ return _context2.stop();
103
123
  }
104
124
  }
105
- }, _callee);
125
+ }, _callee2);
106
126
  }));
107
127
 
108
128
  function checkAPI() {
@@ -20,7 +20,7 @@ var _axios = _interopRequireDefault(require("axios"));
20
20
  var _Locale = require("../Locale");
21
21
 
22
22
  /**
23
- * Copyright IBM Corp. 2020, 2021
23
+ * Copyright IBM Corp. 2020, 2022
24
24
  *
25
25
  * This source code is licensed under the Apache-2.0 license found in the
26
26
  * LICENSE file in the root directory of this source tree.
@@ -76,19 +76,26 @@ var SearchTypeaheadAPI = /*#__PURE__*/function () {
76
76
  */
77
77
  value: function () {
78
78
  var _getResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {
79
- var lang, urlQuery, url;
79
+ var appid,
80
+ lang,
81
+ urlQuery,
82
+ url,
83
+ _args = arguments;
80
84
  return _regenerator.default.wrap(function _callee$(_context) {
81
85
  while (1) {
82
86
  switch (_context.prev = _context.next) {
83
87
  case 0:
84
- _context.next = 2;
88
+ appid = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
89
+ _context.next = 3;
85
90
  return _Locale.LocaleAPI.getLang();
86
91
 
87
- case 2:
92
+ case 3:
88
93
  lang = _context.sent;
89
- urlQuery = ["lang=".concat(lang.lc).concat(lang.cc ? "&cc=".concat(lang.cc) : ''), "query=".concat(encodeURIComponent(query))].join('&');
94
+ urlQuery = ["lang=".concat(lang.lc).concat(lang.cc ? "&cc=".concat(lang.cc) : ''), "query=".concat(encodeURIComponent(query)), "".concat(appid ? "appid=".concat(appid) : '')].filter(function (item) {
95
+ return item;
96
+ }).join('&');
90
97
  url = "".concat(_endpoint, "?").concat(urlQuery);
91
- _context.next = 7;
98
+ _context.next = 8;
92
99
  return _axios.default.get(url, {
93
100
  headers: {
94
101
  'Content-Type': 'application/json; charset=utf-8'
@@ -97,10 +104,10 @@ var SearchTypeaheadAPI = /*#__PURE__*/function () {
97
104
  return response.data.response;
98
105
  });
99
106
 
100
- case 7:
107
+ case 8:
101
108
  return _context.abrupt("return", _context.sent);
102
109
 
103
- case 8:
110
+ case 9:
104
111
  case "end":
105
112
  return _context.stop();
106
113
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibmdotcom-services",
3
3
  "description": "Carbon for IBM.com Services",
4
- "version": "1.31.0-rc.0",
4
+ "version": "1.31.0-rc.3",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@babel/runtime": "^7.5.0",
51
- "@carbon/ibmdotcom-utilities": "1.31.0-rc.0",
51
+ "@carbon/ibmdotcom-utilities": "1.31.0-rc.3",
52
52
  "@carbon/telemetry": "0.0.0-alpha.6",
53
53
  "axios": "~0.21.4",
54
54
  "window-or-global": "^1.0.1"
@@ -62,7 +62,7 @@
62
62
  "@babel/plugin-proposal-export-namespace-from": "^7.2.0",
63
63
  "@babel/plugin-syntax-import-meta": "^7.2.0",
64
64
  "@babel/plugin-transform-object-assign": "^7.2.0",
65
- "@babel/plugin-transform-runtime": "7.16.10",
65
+ "@babel/plugin-transform-runtime": "7.17.0",
66
66
  "@babel/preset-env": "^7.4.3",
67
67
  "@rollup/plugin-node-resolve": "^8.4.0",
68
68
  "all-contributors-cli": "^6.0.0",
@@ -80,7 +80,7 @@
80
80
  "gzip-size": "^5.0.0",
81
81
  "jest": "25.5.4",
82
82
  "jest-circus": "25.5.4",
83
- "jsdoc": "^3.6.2",
83
+ "jsdoc": "^3.6.10",
84
84
  "object-assign": "^4.1.1",
85
85
  "promise": "^8.0.1",
86
86
  "rimraf": "^2.6.3",
@@ -99,5 +99,5 @@
99
99
  "release": {
100
100
  "branch": "main"
101
101
  },
102
- "gitHead": "86e3ea06070b7a38c4f3627449dd88c1a0736353"
102
+ "gitHead": "6ab966577f0f37cf498433b1fa49a86820e7ac1c"
103
103
  }