@atlaskit/smart-hooks 1.1.0 → 1.2.0

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
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/smart-hooks
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`fbb51c73ed426`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fbb51c73ed426) -
8
+ Update i18n NPM package versions for linking-platform,smart-experiences (Group 15)
9
+
3
10
  ## 1.1.0
4
11
 
5
12
  ### Minor Changes
@@ -21,7 +21,7 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
21
21
  source: '@atlaskit/smart-hooks/use-user-recommendations',
22
22
  attributes: _objectSpread({
23
23
  packageName: "@atlaskit/smart-hooks",
24
- packageVersion: "0.0.0-development"
24
+ packageVersion: "1.1.0"
25
25
  }, attributes)
26
26
  };
27
27
  };
@@ -91,8 +91,8 @@ var useUserRecommendations = function useUserRecommendations(props) {
91
91
  }, [childObjectId, containerId, fieldId, includeTeams, maxNumberOfResults, objectId, preload, principalId, productKey, renderId, tenantId]);
92
92
  var fetchRecommendations = (0, _react.useCallback)( /*#__PURE__*/function () {
93
93
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {
94
- var _lastAbortController$, currentController, recommendedUsersResult;
95
- return _regenerator.default.wrap(function _callee$(_context) {
94
+ var _lastAbortController$, currentController, recommendedUsersResult, _t;
95
+ return _regenerator.default.wrap(function (_context) {
96
96
  while (1) switch (_context.prev = _context.next) {
97
97
  case 0:
98
98
  setIsLoading(true);
@@ -100,7 +100,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
100
100
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
101
101
  sessionId.current = (0, _uuid.v4)();
102
102
  _ufoExperiences.UsersFetchedUfoExperience.getInstance(fieldId).start();
103
- _context.prev = 3;
103
+ _context.prev = 1;
104
104
  if (lastAbortController.current) {
105
105
  (_lastAbortController$ = lastAbortController.current) === null || _lastAbortController$ === void 0 || _lastAbortController$.abort();
106
106
  }
@@ -108,7 +108,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
108
108
  // IE has no timeout applied on fetch since AbortController isn't available
109
109
  currentController = typeof AbortController !== 'undefined' ? new AbortController() : null;
110
110
  lastAbortController.current = currentController;
111
- _context.next = 9;
111
+ _context.next = 2;
112
112
  return (0, _smartCommon.fetchUserRecommendations)({
113
113
  baseUrl: baseUrl,
114
114
  context: {
@@ -129,7 +129,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
129
129
  searchQuery: cpusSearchQuery,
130
130
  query: query
131
131
  }, currentController === null || currentController === void 0 ? void 0 : currentController.signal);
132
- case 9:
132
+ case 2:
133
133
  recommendedUsersResult = _context.sent;
134
134
  currentQuery.current = query !== null && query !== void 0 ? query : '';
135
135
  _ufoExperiences.UsersFetchedUfoExperience.getInstance(fieldId).success({
@@ -138,33 +138,33 @@ var useUserRecommendations = function useUserRecommendations(props) {
138
138
  })
139
139
  });
140
140
  setRecommendations(recommendedUsersResult);
141
- _context.next = 24;
141
+ _context.next = 5;
142
142
  break;
143
- case 15:
144
- _context.prev = 15;
145
- _context.t0 = _context["catch"](3);
146
- if (!(_context.t0 instanceof Error && _context.t0.name === 'AbortError')) {
147
- _context.next = 22;
143
+ case 3:
144
+ _context.prev = 3;
145
+ _t = _context["catch"](1);
146
+ if (!(_t instanceof Error && _t.name === 'AbortError')) {
147
+ _context.next = 4;
148
148
  break;
149
149
  }
150
150
  // Request aborted client-side
151
151
  _ufoExperiences.UsersFetchedUfoExperience.getInstance(fieldId).abort();
152
152
  // return early to prevent disabling isLoading
153
153
  return _context.abrupt("return");
154
- case 22:
154
+ case 4:
155
155
  _ufoExperiences.UsersFetchedUfoExperience.getInstance(fieldId).failure({
156
156
  metadata: getAnalyticsAttributes()
157
157
  });
158
- setError(_context.t0);
159
- case 24:
158
+ setError(_t);
159
+ case 5:
160
160
  setIsLoading(false);
161
161
  // clear abort controller
162
162
  lastAbortController.current = undefined;
163
- case 26:
163
+ case 6:
164
164
  case "end":
165
165
  return _context.stop();
166
166
  }
167
- }, _callee, null, [[3, 15]]);
167
+ }, _callee, null, [[1, 3]]);
168
168
  }));
169
169
  return function (_x) {
170
170
  return _ref.apply(this, arguments);
@@ -10,7 +10,7 @@ const createEvent = (eventType, action, actionSubject, attributes = {}) => ({
10
10
  source: '@atlaskit/smart-hooks/use-user-recommendations',
11
11
  attributes: {
12
12
  packageName: "@atlaskit/smart-hooks",
13
- packageVersion: "0.0.0-development",
13
+ packageVersion: "1.1.0",
14
14
  ...attributes
15
15
  }
16
16
  });
@@ -15,7 +15,7 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
15
15
  source: '@atlaskit/smart-hooks/use-user-recommendations',
16
16
  attributes: _objectSpread({
17
17
  packageName: "@atlaskit/smart-hooks",
18
- packageVersion: "0.0.0-development"
18
+ packageVersion: "1.1.0"
19
19
  }, attributes)
20
20
  };
21
21
  };
@@ -85,8 +85,8 @@ var useUserRecommendations = function useUserRecommendations(props) {
85
85
  }, [childObjectId, containerId, fieldId, includeTeams, maxNumberOfResults, objectId, preload, principalId, productKey, renderId, tenantId]);
86
86
  var fetchRecommendations = useCallback( /*#__PURE__*/function () {
87
87
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
88
- var _lastAbortController$, currentController, recommendedUsersResult;
89
- return _regeneratorRuntime.wrap(function _callee$(_context) {
88
+ var _lastAbortController$, currentController, recommendedUsersResult, _t;
89
+ return _regeneratorRuntime.wrap(function (_context) {
90
90
  while (1) switch (_context.prev = _context.next) {
91
91
  case 0:
92
92
  setIsLoading(true);
@@ -94,7 +94,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
94
94
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
95
95
  sessionId.current = uuid();
96
96
  UsersFetchedUfoExperience.getInstance(fieldId).start();
97
- _context.prev = 3;
97
+ _context.prev = 1;
98
98
  if (lastAbortController.current) {
99
99
  (_lastAbortController$ = lastAbortController.current) === null || _lastAbortController$ === void 0 || _lastAbortController$.abort();
100
100
  }
@@ -102,7 +102,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
102
102
  // IE has no timeout applied on fetch since AbortController isn't available
103
103
  currentController = typeof AbortController !== 'undefined' ? new AbortController() : null;
104
104
  lastAbortController.current = currentController;
105
- _context.next = 9;
105
+ _context.next = 2;
106
106
  return fetchUserRecommendations({
107
107
  baseUrl: baseUrl,
108
108
  context: {
@@ -123,7 +123,7 @@ var useUserRecommendations = function useUserRecommendations(props) {
123
123
  searchQuery: cpusSearchQuery,
124
124
  query: query
125
125
  }, currentController === null || currentController === void 0 ? void 0 : currentController.signal);
126
- case 9:
126
+ case 2:
127
127
  recommendedUsersResult = _context.sent;
128
128
  currentQuery.current = query !== null && query !== void 0 ? query : '';
129
129
  UsersFetchedUfoExperience.getInstance(fieldId).success({
@@ -132,33 +132,33 @@ var useUserRecommendations = function useUserRecommendations(props) {
132
132
  })
133
133
  });
134
134
  setRecommendations(recommendedUsersResult);
135
- _context.next = 24;
135
+ _context.next = 5;
136
136
  break;
137
- case 15:
138
- _context.prev = 15;
139
- _context.t0 = _context["catch"](3);
140
- if (!(_context.t0 instanceof Error && _context.t0.name === 'AbortError')) {
141
- _context.next = 22;
137
+ case 3:
138
+ _context.prev = 3;
139
+ _t = _context["catch"](1);
140
+ if (!(_t instanceof Error && _t.name === 'AbortError')) {
141
+ _context.next = 4;
142
142
  break;
143
143
  }
144
144
  // Request aborted client-side
145
145
  UsersFetchedUfoExperience.getInstance(fieldId).abort();
146
146
  // return early to prevent disabling isLoading
147
147
  return _context.abrupt("return");
148
- case 22:
148
+ case 4:
149
149
  UsersFetchedUfoExperience.getInstance(fieldId).failure({
150
150
  metadata: getAnalyticsAttributes()
151
151
  });
152
- setError(_context.t0);
153
- case 24:
152
+ setError(_t);
153
+ case 5:
154
154
  setIsLoading(false);
155
155
  // clear abort controller
156
156
  lastAbortController.current = undefined;
157
- case 26:
157
+ case 6:
158
158
  case "end":
159
159
  return _context.stop();
160
160
  }
161
- }, _callee, null, [[3, 15]]);
161
+ }, _callee, null, [[1, 3]]);
162
162
  }));
163
163
  return function (_x) {
164
164
  return _ref.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-hooks",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,7 +25,7 @@
25
25
  "team": "Search Platform: Search Experience"
26
26
  },
27
27
  "dependencies": {
28
- "@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.7.0",
28
+ "@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.138.0",
29
29
  "@atlaskit/analytics-gas-types": "^5.1.0",
30
30
  "@atlaskit/analytics-listeners": "^10.1.0",
31
31
  "@atlaskit/analytics-next": "^11.2.0",
@@ -47,6 +47,7 @@
47
47
  "@welldone-software/why-did-you-render": "^6.2.0",
48
48
  "enzyme": "^3.10.0",
49
49
  "fetch-mock": "^8.0.0",
50
+ "react": "^18.2.0",
50
51
  "react-dom": "^18.2.0",
51
52
  "react-intl": "^6.6.2",
52
53
  "wait-for-expect": "^1.2.0"