@atlaskit/smart-hooks 0.3.7 → 1.0.1

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,30 @@
1
1
  # @atlaskit/smart-hooks
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`d2e14ba5ae9fc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2e14ba5ae9fc) -
14
+ Removed `react-intl-next` alias and replaced all usages with `react-intl` directly.
15
+
16
+ What changed: The `react-intl-next` npm alias (which resolved to `react-intl@^5`) has been
17
+ removed. All imports now reference `react-intl` directly, and `peerDependencies` have been updated
18
+ to `"^5.25.1 || ^6.0.0 || ^7.0.0"`.
19
+
20
+ How consumer should update their code: Ensure `react-intl` is installed at a version satisfying
21
+ `^5.25.1 || ^6.0.0 || ^7.0.0`. If your application was using `react-intl-next` as an npm alias, it
22
+ can be safely removed. Replace any remaining `react-intl-next` imports with `react-intl`.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 0.3.7
4
29
 
5
30
  ### Patch Changes
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.messages = void 0;
7
- var _reactIntlNext = require("react-intl-next");
8
- var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
7
+ var _reactIntl = require("react-intl");
8
+ var messages = exports.messages = (0, _reactIntl.defineMessages)({
9
9
  externalUserSourcesHeading: {
10
10
  id: 'smart-experiences.smart-hooks.external.sourced.from',
11
11
  defaultMessage: 'Found in:',
12
- description: 'From where the external user is coming'
12
+ description: 'The text is shown as a label in the user picker dropdown preceding the list of external organizations or directories where the external user account was found (e.g. a guest directory or external workspace).'
13
13
  },
14
14
  slackProvider: {
15
15
  id: 'smart-experiences.smart-hooks.slack.provider',
@@ -10,7 +10,7 @@ var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
10
10
  var _analyticsListeners = require("@atlaskit/analytics-listeners");
11
11
  var _analyticsNext = require("@atlaskit/analytics-next");
12
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @typescript-eslint/consistent-type-imports
14
14
  var createAndFireEventInElementsChannel = (0, _analyticsNext.createAndFireEvent)(_analyticsListeners.FabricChannel.elements);
15
15
  var createEvent = function createEvent(eventType, action, actionSubject) {
16
16
  var attributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
@@ -1,9 +1,9 @@
1
- import { defineMessages } from 'react-intl-next';
1
+ import { defineMessages } from 'react-intl';
2
2
  export const messages = defineMessages({
3
3
  externalUserSourcesHeading: {
4
4
  id: 'smart-experiences.smart-hooks.external.sourced.from',
5
5
  defaultMessage: 'Found in:',
6
- description: 'From where the external user is coming'
6
+ description: 'The text is shown as a label in the user picker dropdown preceding the list of external organizations or directories where the external user account was found (e.g. a guest directory or external workspace).'
7
7
  },
8
8
  slackProvider: {
9
9
  id: 'smart-experiences.smart-hooks.slack.provider',
@@ -1,5 +1,6 @@
1
1
  import { TRACK_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
2
2
  import { FabricChannel } from '@atlaskit/analytics-listeners';
3
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
3
4
  import { createAndFireEvent } from '@atlaskit/analytics-next';
4
5
  const createAndFireEventInElementsChannel = createAndFireEvent(FabricChannel.elements);
5
6
  const createEvent = (eventType, action, actionSubject, attributes = {}) => ({
@@ -1,9 +1,9 @@
1
- import { defineMessages } from 'react-intl-next';
1
+ import { defineMessages } from 'react-intl';
2
2
  export var messages = defineMessages({
3
3
  externalUserSourcesHeading: {
4
4
  id: 'smart-experiences.smart-hooks.external.sourced.from',
5
5
  defaultMessage: 'Found in:',
6
- description: 'From where the external user is coming'
6
+ description: 'The text is shown as a label in the user picker dropdown preceding the list of external organizations or directories where the external user account was found (e.g. a guest directory or external workspace).'
7
7
  },
8
8
  slackProvider: {
9
9
  id: 'smart-experiences.smart-hooks.slack.provider',
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { TRACK_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
5
5
  import { FabricChannel } from '@atlaskit/analytics-listeners';
6
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
6
7
  import { createAndFireEvent } from '@atlaskit/analytics-next';
7
8
  var createAndFireEventInElementsChannel = createAndFireEvent(FabricChannel.elements);
8
9
  var createEvent = function createEvent(eventType, action, actionSubject) {
@@ -1,5 +1,6 @@
1
+ import { type MemoizedFn } from 'memoize-one';
1
2
  declare function useFunctionUsageTracking<InputFunctionType extends (...any: any) => any>(trackedFunction: InputFunctionType): {
2
3
  isUsed: boolean;
3
- trackingFunction: import("memoize-one").MemoizedFn<() => InputFunctionType>;
4
+ trackingFunction: MemoizedFn<() => InputFunctionType>;
4
5
  };
5
6
  export default useFunctionUsageTracking;
@@ -1,4 +1,4 @@
1
- import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
1
+ import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { type UserSearchItem } from '@atlaskit/smart-common';
3
3
  import { type UseUserRecommendationsProps } from '../../types';
4
4
  export declare const findUserPosition: (loadedUsers: UserSearchItem[], userId: string) => number;
@@ -17,4 +17,4 @@ export declare const createDefaultAttributes: (props: UseUserRecommendationsProp
17
17
  sessionId: string;
18
18
  tenantId: string;
19
19
  };
20
- export declare const fireUserSelectedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, payloadAttributes: AnalyticsEventPayload) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
20
+ export declare const fireUserSelectedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, payloadAttributes: AnalyticsEventPayload) => UIAnalyticsEvent;
@@ -26,7 +26,7 @@ export type UseUserRecommendationsProps = {
26
26
  * generating suggestions.
27
27
  * All fieldId's will be bucketed into a model that provides generic smart results,
28
28
  * except "assignee", "mentions" which are specifically trained for Jira Assignee and
29
- * @Mentions. For specifically trained models, please contact #search-plex.
29
+ * @Mentions. For specifically trained models, please contact #help-search-plex.
30
30
  */
31
31
  fieldId: string;
32
32
  /**
@@ -55,7 +55,7 @@ export type UseUserRecommendationsProps = {
55
55
  * the hook is used.
56
56
  * WARNING: please consider carefully before deciding to preload your suggestions
57
57
  * as this will increase the load on the recommendations services (has caused HOTs).
58
- * Please give #search-plex a ballpark on the expected request volume.
58
+ * Please give #help-search-plex a ballpark on the expected request volume.
59
59
  * (@default: false)
60
60
  */
61
61
  preload?: boolean;
@@ -85,7 +85,7 @@ export type UseUserRecommendationsProps = {
85
85
  * Identifier for the product's tenant, also known as siteId or cloudId.
86
86
  * If product is not tenanted, the convention is to provide the productKey
87
87
  * as the tenantId (e.g. "bitbucket") but this may vary across products.
88
- * Check with #search-plex.
88
+ * Check with #help-search-plex.
89
89
  */
90
90
  tenantId: string;
91
91
  };
@@ -1,4 +1,4 @@
1
- import { type IntlShape } from 'react-intl-next';
1
+ import { type IntlShape } from 'react-intl';
2
2
  import { type UserSearchItem } from '@atlaskit/smart-common';
3
3
  import { type OptionData } from '@atlaskit/user-picker';
4
4
  declare const _default: (recommendations: UserSearchItem[], intl: IntlShape) => OptionData[];
@@ -1,5 +1,6 @@
1
+ import { type MemoizedFn } from 'memoize-one';
1
2
  declare function useFunctionUsageTracking<InputFunctionType extends (...any: any) => any>(trackedFunction: InputFunctionType): {
2
3
  isUsed: boolean;
3
- trackingFunction: import("memoize-one").MemoizedFn<() => InputFunctionType>;
4
+ trackingFunction: MemoizedFn<() => InputFunctionType>;
4
5
  };
5
6
  export default useFunctionUsageTracking;
@@ -1,4 +1,4 @@
1
- import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
1
+ import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { type UserSearchItem } from '@atlaskit/smart-common';
3
3
  import { type UseUserRecommendationsProps } from '../../types';
4
4
  export declare const findUserPosition: (loadedUsers: UserSearchItem[], userId: string) => number;
@@ -17,4 +17,4 @@ export declare const createDefaultAttributes: (props: UseUserRecommendationsProp
17
17
  sessionId: string;
18
18
  tenantId: string;
19
19
  };
20
- export declare const fireUserSelectedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, payloadAttributes: AnalyticsEventPayload) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
20
+ export declare const fireUserSelectedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, payloadAttributes: AnalyticsEventPayload) => UIAnalyticsEvent;
@@ -26,7 +26,7 @@ export type UseUserRecommendationsProps = {
26
26
  * generating suggestions.
27
27
  * All fieldId's will be bucketed into a model that provides generic smart results,
28
28
  * except "assignee", "mentions" which are specifically trained for Jira Assignee and
29
- * @Mentions. For specifically trained models, please contact #search-plex.
29
+ * @Mentions. For specifically trained models, please contact #help-search-plex.
30
30
  */
31
31
  fieldId: string;
32
32
  /**
@@ -55,7 +55,7 @@ export type UseUserRecommendationsProps = {
55
55
  * the hook is used.
56
56
  * WARNING: please consider carefully before deciding to preload your suggestions
57
57
  * as this will increase the load on the recommendations services (has caused HOTs).
58
- * Please give #search-plex a ballpark on the expected request volume.
58
+ * Please give #help-search-plex a ballpark on the expected request volume.
59
59
  * (@default: false)
60
60
  */
61
61
  preload?: boolean;
@@ -85,7 +85,7 @@ export type UseUserRecommendationsProps = {
85
85
  * Identifier for the product's tenant, also known as siteId or cloudId.
86
86
  * If product is not tenanted, the convention is to provide the productKey
87
87
  * as the tenantId (e.g. "bitbucket") but this may vary across products.
88
- * Check with #search-plex.
88
+ * Check with #help-search-plex.
89
89
  */
90
90
  tenantId: string;
91
91
  };
@@ -1,4 +1,4 @@
1
- import { type IntlShape } from 'react-intl-next';
1
+ import { type IntlShape } from 'react-intl';
2
2
  import { type UserSearchItem } from '@atlaskit/smart-common';
3
3
  import { type OptionData } from '@atlaskit/user-picker';
4
4
  declare const _default: (recommendations: UserSearchItem[], intl: IntlShape) => OptionData[];
@@ -1,7 +1,97 @@
1
1
  export const userSampleAvatarUrl =
2
2
  'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIACAAIAMBIgACEQEDEQH/xAB1AAEAAwEAAAAAAAAAAAAAAAAHAgUGCBAAAQMCBQMDAgcAAAAAAAAAAQIDBAURAAYSIUEHEzEUImEVcSMyQlGBweEBAAMBAAAAAAAAAAAAAAAAAAMEBwURAAICAgMBAQEAAAAAAAAAAAECAxEABBIhIkExgf/aAAwDAQACEQMRAD8AxWVci1ipwmJdT7seKFbIMgLKrGxTYkkH4NsMH1D0UFwsqsAACom1zbxvje9QMoU6BVnnFPswkqBX71JQkj7nnBFmwNx6JJmw5zUtkKUlCmFhaCAkG+21/IxCZ2keQ2KA6/uWzyF5X2cs1T1To62n3jYoWUuDfyLf3gUzhl/MuUI06fDLjdMBGh5EtCyQogBOm2q9+L+MJ1Ep0p1SFd5lptwqSe6sJCRpBvvySQP4xoqZlFt6QluQ4iSUL1eQQP8AcG1pHieqsHFHcVyv8xB6l0hnNOUrzGPUKlsBBXYa0FJ/MkkEbEA253GB/I/SeH0wy1PocFtoU6pOeqbbUjthp3TY8nyPngbADHT1ejCi02LGaShx6GlJKFH2rPlV/ub4H85yI+bSqPGdRSZjThdbYeSUNlRFlAnwQfixGNTZn4zSRq3hjdYprRK0cbyD2ABeBHULpiOo8ymrluBNMpai4lgoU5+MFg6zpULWtbkEXww5Ey/EpFOhoYQtllsDVqPudI5V9/OI0ZNMyahuI4tqsy/euykak90nlXgC9hsNv3xd0xuTMImylLaSE3S3+kE8cYHJslwsQbyvzADXRHaSuz9z/9k=';
3
3
 
4
- export const mockUserSearchData = [
4
+ export const mockUserSearchData: (
5
+ | {
6
+ id: string;
7
+ avatarUrl: string;
8
+ name: string;
9
+ mentionName: string;
10
+ lozenge: string;
11
+ accessLevel: string;
12
+ presence: {
13
+ status: string;
14
+ time?: undefined;
15
+ };
16
+ nickname?: undefined;
17
+ userType?: undefined;
18
+ context?: undefined;
19
+ }
20
+ | {
21
+ id: string;
22
+ avatarUrl: string;
23
+ name: string;
24
+ mentionName: string;
25
+ lozenge: string;
26
+ accessLevel: string;
27
+ presence: {
28
+ status: string;
29
+ time: string;
30
+ };
31
+ nickname?: undefined;
32
+ userType?: undefined;
33
+ context?: undefined;
34
+ }
35
+ | {
36
+ id: string;
37
+ avatarUrl: string;
38
+ name: string;
39
+ mentionName: string;
40
+ nickname: string;
41
+ accessLevel: string;
42
+ presence: {
43
+ status: string;
44
+ time?: undefined;
45
+ };
46
+ lozenge?: undefined;
47
+ userType?: undefined;
48
+ context?: undefined;
49
+ }
50
+ | {
51
+ id: string;
52
+ name: string;
53
+ mentionName: string;
54
+ presence: {
55
+ time: string;
56
+ status?: undefined;
57
+ };
58
+ avatarUrl?: undefined;
59
+ lozenge?: undefined;
60
+ accessLevel?: undefined;
61
+ nickname?: undefined;
62
+ userType?: undefined;
63
+ context?: undefined;
64
+ }
65
+ | {
66
+ id: string;
67
+ avatarUrl: string;
68
+ name: string;
69
+ lozenge: string;
70
+ mentionName: string;
71
+ accessLevel?: undefined;
72
+ presence?: undefined;
73
+ nickname?: undefined;
74
+ userType?: undefined;
75
+ context?: undefined;
76
+ }
77
+ | {
78
+ id: string;
79
+ avatarUrl: string;
80
+ name: string;
81
+ userType: string;
82
+ context: {
83
+ members: never[];
84
+ includesYou: boolean;
85
+ memberCount: number;
86
+ teamLink: string;
87
+ };
88
+ mentionName?: undefined;
89
+ lozenge?: undefined;
90
+ accessLevel?: undefined;
91
+ presence?: undefined;
92
+ nickname?: undefined;
93
+ }
94
+ )[] = [
5
95
  {
6
96
  id: '2234',
7
97
  avatarUrl: userSampleAvatarUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-hooks",
3
- "version": "0.3.7",
3
+ "version": "1.0.1",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,11 +27,11 @@
27
27
  "dependencies": {
28
28
  "@atlaskit/afm-i18n-platform-smart-experiences-smart-hooks": "2.7.0",
29
29
  "@atlaskit/analytics-gas-types": "^5.1.0",
30
- "@atlaskit/analytics-listeners": "^10.0.0",
31
- "@atlaskit/analytics-next": "^11.1.0",
32
- "@atlaskit/smart-common": "^2.0.0",
33
- "@atlaskit/ufo": "^0.4.0",
34
- "@atlaskit/user-picker": "^11.23.0",
30
+ "@atlaskit/analytics-listeners": "^10.1.0",
31
+ "@atlaskit/analytics-next": "^11.2.0",
32
+ "@atlaskit/smart-common": "^2.1.0",
33
+ "@atlaskit/ufo": "^0.5.0",
34
+ "@atlaskit/user-picker": "^12.0.0",
35
35
  "@babel/runtime": "^7.0.0",
36
36
  "lodash": "^4.17.21",
37
37
  "memoize-one": "^6.0.0",
@@ -39,15 +39,16 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.2.0",
42
- "react-intl-next": "npm:react-intl@^5.18.1"
42
+ "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@atlassian/a11y-jest-testing": "^0.10.0",
45
+ "@atlassian/a11y-jest-testing": "^0.11.0",
46
46
  "@testing-library/react": "^16.3.0",
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
50
  "react-dom": "^18.2.0",
51
+ "react-intl": "^6.6.2",
51
52
  "wait-for-expect": "^1.2.0"
52
53
  },
53
54
  "techstack": {
package/report.api.md CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  ```ts
19
19
  import { EntityType } from '@atlaskit/smart-common';
20
- import { IntlShape } from 'react-intl-next';
20
+ import { IntlShape } from 'react-intl';
21
21
  import { MemoizedFn } from 'memoize-one';
22
22
  import { OptionData } from '@atlaskit/user-picker';
23
23
  import { UserSearchItem } from '@atlaskit/smart-common';
@@ -78,7 +78,7 @@ type UseUserRecommendationsProps = {
78
78
  ```json
79
79
  {
80
80
  "react": "^16.8.0",
81
- "react-intl-next": "npm:react-intl@^5.18.1"
81
+ "react-intl": "npm:react-intl@^5.18.1"
82
82
  }
83
83
  ```
84
84