@atlaskit/reactions 21.8.0 → 22.0.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.
Files changed (200) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cjs/MockReactionsClient.js +24 -16
  3. package/dist/cjs/analytics/analytics.js +9 -1
  4. package/dist/cjs/analytics/ufo.js +24 -2
  5. package/dist/cjs/components/Counter/Counter.js +16 -20
  6. package/dist/cjs/components/Reaction/Reaction.js +52 -18
  7. package/dist/cjs/components/Reaction/styles.js +8 -1
  8. package/dist/cjs/components/ReactionDialog/ReactionView.js +121 -0
  9. package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +187 -0
  10. package/dist/cjs/components/ReactionDialog/ReactionsList.js +104 -0
  11. package/dist/cjs/components/ReactionDialog/index.js +13 -0
  12. package/dist/cjs/components/ReactionDialog/styles.js +202 -0
  13. package/dist/cjs/components/ReactionPicker/ReactionPicker.js +15 -20
  14. package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +26 -12
  15. package/dist/cjs/components/ReactionTooltip/styles.js +11 -2
  16. package/dist/cjs/components/Reactions/Reactions.js +166 -21
  17. package/dist/cjs/components/Reactions/styles.js +11 -6
  18. package/dist/cjs/components/Trigger/Trigger.js +1 -2
  19. package/dist/cjs/components/index.js +9 -1
  20. package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +6 -2
  21. package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +9 -4
  22. package/dist/cjs/shared/constants.js +62 -10
  23. package/dist/cjs/shared/i18n.js +40 -0
  24. package/dist/cjs/shared/utils.js +60 -2
  25. package/dist/cjs/types/reaction.js +13 -1
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/MockReactionsClient.js +22 -14
  28. package/dist/es2019/analytics/analytics.js +3 -0
  29. package/dist/es2019/analytics/ufo.js +19 -0
  30. package/dist/es2019/components/Counter/Counter.js +16 -15
  31. package/dist/es2019/components/Reaction/Reaction.js +43 -18
  32. package/dist/es2019/components/Reaction/styles.js +9 -2
  33. package/dist/es2019/components/ReactionDialog/ReactionView.js +69 -0
  34. package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +145 -0
  35. package/dist/es2019/components/ReactionDialog/ReactionsList.js +69 -0
  36. package/dist/es2019/components/ReactionDialog/index.js +1 -0
  37. package/dist/es2019/components/ReactionDialog/styles.js +169 -0
  38. package/dist/es2019/components/ReactionPicker/ReactionPicker.js +12 -20
  39. package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +22 -12
  40. package/dist/es2019/components/ReactionTooltip/styles.js +9 -1
  41. package/dist/es2019/components/Reactions/Reactions.js +146 -22
  42. package/dist/es2019/components/Reactions/styles.js +9 -5
  43. package/dist/es2019/components/Trigger/Trigger.js +1 -2
  44. package/dist/es2019/components/index.js +2 -1
  45. package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +8 -2
  46. package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +5 -4
  47. package/dist/es2019/shared/constants.js +55 -6
  48. package/dist/es2019/shared/i18n.js +43 -0
  49. package/dist/es2019/shared/utils.js +51 -0
  50. package/dist/es2019/types/reaction.js +13 -1
  51. package/dist/es2019/version.json +1 -1
  52. package/dist/esm/MockReactionsClient.js +24 -13
  53. package/dist/esm/analytics/analytics.js +5 -0
  54. package/dist/esm/analytics/ufo.js +19 -0
  55. package/dist/esm/components/Counter/Counter.js +17 -17
  56. package/dist/esm/components/Reaction/Reaction.js +51 -19
  57. package/dist/esm/components/Reaction/styles.js +9 -2
  58. package/dist/esm/components/ReactionDialog/ReactionView.js +98 -0
  59. package/dist/esm/components/ReactionDialog/ReactionsDialog.js +161 -0
  60. package/dist/esm/components/ReactionDialog/ReactionsList.js +79 -0
  61. package/dist/esm/components/ReactionDialog/index.js +1 -0
  62. package/dist/esm/components/ReactionDialog/styles.js +177 -0
  63. package/dist/esm/components/ReactionPicker/ReactionPicker.js +15 -20
  64. package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +26 -12
  65. package/dist/esm/components/ReactionTooltip/styles.js +9 -1
  66. package/dist/esm/components/Reactions/Reactions.js +158 -22
  67. package/dist/esm/components/Reactions/styles.js +9 -5
  68. package/dist/esm/components/Trigger/Trigger.js +1 -2
  69. package/dist/esm/components/index.js +2 -1
  70. package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +6 -2
  71. package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +8 -4
  72. package/dist/esm/shared/constants.js +57 -6
  73. package/dist/esm/shared/i18n.js +40 -0
  74. package/dist/esm/shared/utils.js +53 -0
  75. package/dist/esm/types/reaction.js +13 -1
  76. package/dist/esm/version.json +1 -1
  77. package/dist/types/MockReactionsClient.d.ts +7 -3
  78. package/dist/types/analytics/analytics.d.ts +10 -0
  79. package/dist/types/analytics/ufo.d.ts +18 -2
  80. package/dist/types/components/Counter/Counter.d.ts +0 -1
  81. package/dist/types/components/Reaction/Reaction.d.ts +11 -1
  82. package/dist/types/components/ReactionDialog/ReactionView.d.ts +19 -0
  83. package/dist/types/components/ReactionDialog/ReactionsDialog.d.ts +32 -0
  84. package/dist/types/components/ReactionDialog/ReactionsList.d.ts +23 -0
  85. package/dist/types/components/ReactionDialog/index.d.ts +1 -0
  86. package/dist/types/components/ReactionDialog/styles.d.ts +11 -0
  87. package/dist/types/components/ReactionPicker/ReactionPicker.d.ts +5 -0
  88. package/dist/types/components/ReactionTooltip/ReactionTooltip.d.ts +12 -0
  89. package/dist/types/components/ReactionTooltip/styles.d.ts +1 -0
  90. package/dist/types/components/Reactions/Reactions.d.ts +45 -6
  91. package/dist/types/components/Reactions/styles.d.ts +1 -0
  92. package/dist/types/components/index.d.ts +1 -0
  93. package/dist/types/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +0 -4
  94. package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +2 -11
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/types/shared/constants.d.ts +11 -5
  97. package/dist/types/shared/i18n.d.ts +40 -0
  98. package/dist/types/shared/utils.d.ts +7 -0
  99. package/dist/types/types/User.d.ts +10 -0
  100. package/dist/types/types/index.d.ts +1 -1
  101. package/dist/types/types/reaction.d.ts +15 -2
  102. package/docs/0-intro.tsx +3 -0
  103. package/docs/5-graphql-support.tsx +153 -0
  104. package/package.json +11 -18
  105. package/dist/types-ts4.0/MockReactionsClient.d.ts +0 -23
  106. package/dist/types-ts4.0/analytics/analytics.d.ts +0 -102
  107. package/dist/types-ts4.0/analytics/constants.d.ts +0 -1
  108. package/dist/types-ts4.0/analytics/index.d.ts +0 -2
  109. package/dist/types-ts4.0/analytics/ufo.d.ts +0 -40
  110. package/dist/types-ts4.0/client/ReactionServiceClient.d.ts +0 -35
  111. package/dist/types-ts4.0/client/index.d.ts +0 -1
  112. package/dist/types-ts4.0/components/Counter/Counter.d.ts +0 -45
  113. package/dist/types-ts4.0/components/Counter/index.d.ts +0 -3
  114. package/dist/types-ts4.0/components/Counter/styles.d.ts +0 -3
  115. package/dist/types-ts4.0/components/EmojiButton/EmojiButton.d.ts +0 -22
  116. package/dist/types-ts4.0/components/EmojiButton/index.d.ts +0 -2
  117. package/dist/types-ts4.0/components/EmojiButton/styles.d.ts +0 -1
  118. package/dist/types-ts4.0/components/FlashAnimation/FlashAnimation.d.ts +0 -20
  119. package/dist/types-ts4.0/components/FlashAnimation/index.d.ts +0 -2
  120. package/dist/types-ts4.0/components/FlashAnimation/styles.d.ts +0 -5
  121. package/dist/types-ts4.0/components/Reaction/Reaction.d.ts +0 -38
  122. package/dist/types-ts4.0/components/Reaction/index.d.ts +0 -2
  123. package/dist/types-ts4.0/components/Reaction/styles.d.ts +0 -10
  124. package/dist/types-ts4.0/components/ReactionPicker/ReactionPicker.d.ts +0 -50
  125. package/dist/types-ts4.0/components/ReactionPicker/index.d.ts +0 -2
  126. package/dist/types-ts4.0/components/ReactionPicker/styles.d.ts +0 -3
  127. package/dist/types-ts4.0/components/ReactionTooltip/ReactionTooltip.d.ts +0 -22
  128. package/dist/types-ts4.0/components/ReactionTooltip/index.d.ts +0 -2
  129. package/dist/types-ts4.0/components/ReactionTooltip/styles.d.ts +0 -4
  130. package/dist/types-ts4.0/components/Reactions/Reactions.d.ts +0 -57
  131. package/dist/types-ts4.0/components/Reactions/index.d.ts +0 -2
  132. package/dist/types-ts4.0/components/Reactions/styles.d.ts +0 -2
  133. package/dist/types-ts4.0/components/Selector/Selector.d.ts +0 -34
  134. package/dist/types-ts4.0/components/Selector/index.d.ts +0 -3
  135. package/dist/types-ts4.0/components/Selector/styles.d.ts +0 -12
  136. package/dist/types-ts4.0/components/ShowMore/ShowMore.d.ts +0 -35
  137. package/dist/types-ts4.0/components/ShowMore/index.d.ts +0 -2
  138. package/dist/types-ts4.0/components/ShowMore/styles.d.ts +0 -3
  139. package/dist/types-ts4.0/components/Trigger/Trigger.d.ts +0 -35
  140. package/dist/types-ts4.0/components/Trigger/index.d.ts +0 -2
  141. package/dist/types-ts4.0/components/Trigger/styles.d.ts +0 -5
  142. package/dist/types-ts4.0/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +0 -16
  143. package/dist/types-ts4.0/components/UfoErrorBoundary/index.d.ts +0 -2
  144. package/dist/types-ts4.0/components/index.d.ts +0 -8
  145. package/dist/types-ts4.0/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +0 -27
  146. package/dist/types-ts4.0/containers/ConnectedReactionPicker/index.d.ts +0 -2
  147. package/dist/types-ts4.0/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +0 -52
  148. package/dist/types-ts4.0/containers/ConnectedReactionsView/index.d.ts +0 -2
  149. package/dist/types-ts4.0/containers/index.d.ts +0 -2
  150. package/dist/types-ts4.0/hooks/index.d.ts +0 -1
  151. package/dist/types-ts4.0/hooks/useClickAway.d.ts +0 -9
  152. package/dist/types-ts4.0/i18n/cs.d.ts +0 -13
  153. package/dist/types-ts4.0/i18n/da.d.ts +0 -13
  154. package/dist/types-ts4.0/i18n/de.d.ts +0 -13
  155. package/dist/types-ts4.0/i18n/en.d.ts +0 -7
  156. package/dist/types-ts4.0/i18n/en_GB.d.ts +0 -7
  157. package/dist/types-ts4.0/i18n/en_ZZ.d.ts +0 -13
  158. package/dist/types-ts4.0/i18n/es.d.ts +0 -13
  159. package/dist/types-ts4.0/i18n/et.d.ts +0 -12
  160. package/dist/types-ts4.0/i18n/fi.d.ts +0 -13
  161. package/dist/types-ts4.0/i18n/fr.d.ts +0 -13
  162. package/dist/types-ts4.0/i18n/hu.d.ts +0 -13
  163. package/dist/types-ts4.0/i18n/index.d.ts +0 -35
  164. package/dist/types-ts4.0/i18n/is.d.ts +0 -6
  165. package/dist/types-ts4.0/i18n/it.d.ts +0 -13
  166. package/dist/types-ts4.0/i18n/ja.d.ts +0 -13
  167. package/dist/types-ts4.0/i18n/ko.d.ts +0 -13
  168. package/dist/types-ts4.0/i18n/languages.d.ts +0 -27
  169. package/dist/types-ts4.0/i18n/nb.d.ts +0 -13
  170. package/dist/types-ts4.0/i18n/nl.d.ts +0 -13
  171. package/dist/types-ts4.0/i18n/pl.d.ts +0 -13
  172. package/dist/types-ts4.0/i18n/pt_BR.d.ts +0 -13
  173. package/dist/types-ts4.0/i18n/pt_PT.d.ts +0 -12
  174. package/dist/types-ts4.0/i18n/ro.d.ts +0 -6
  175. package/dist/types-ts4.0/i18n/ru.d.ts +0 -13
  176. package/dist/types-ts4.0/i18n/sk.d.ts +0 -12
  177. package/dist/types-ts4.0/i18n/sv.d.ts +0 -13
  178. package/dist/types-ts4.0/i18n/th.d.ts +0 -13
  179. package/dist/types-ts4.0/i18n/tr.d.ts +0 -13
  180. package/dist/types-ts4.0/i18n/uk.d.ts +0 -13
  181. package/dist/types-ts4.0/i18n/vi.d.ts +0 -13
  182. package/dist/types-ts4.0/i18n/zh.d.ts +0 -13
  183. package/dist/types-ts4.0/i18n/zh_TW.d.ts +0 -13
  184. package/dist/types-ts4.0/index.d.ts +0 -7
  185. package/dist/types-ts4.0/shared/constants.d.ts +0 -21
  186. package/dist/types-ts4.0/shared/i18n.d.ts +0 -32
  187. package/dist/types-ts4.0/shared/index.d.ts +0 -3
  188. package/dist/types-ts4.0/shared/utils.d.ts +0 -11
  189. package/dist/types-ts4.0/store/MemoryReactionsStore.d.ts +0 -94
  190. package/dist/types-ts4.0/store/ReactionConsumer.d.ts +0 -57
  191. package/dist/types-ts4.0/store/batched.d.ts +0 -2
  192. package/dist/types-ts4.0/store/index.d.ts +0 -3
  193. package/dist/types-ts4.0/store/utils.d.ts +0 -11
  194. package/dist/types-ts4.0/types/Actions.d.ts +0 -27
  195. package/dist/types-ts4.0/types/Updater.d.ts +0 -1
  196. package/dist/types-ts4.0/types/User.d.ts +0 -10
  197. package/dist/types-ts4.0/types/client.d.ts +0 -38
  198. package/dist/types-ts4.0/types/index.d.ts +0 -7
  199. package/dist/types-ts4.0/types/reaction.d.ts +0 -100
  200. package/dist/types-ts4.0/types/store.d.ts +0 -63
@@ -0,0 +1,153 @@
1
+ import React from 'react';
2
+ import { md, code, Props } from '@atlaskit/docs';
3
+ import SectionMessage from '@atlaskit/section-message';
4
+
5
+ export default md`
6
+
7
+ ### How to get reactions support GraphQL?
8
+
9
+ The pre-built \`ReactionClient\` is supporting REST APIs, if you want to support GraphQL, please follow best practice below.
10
+
11
+ We have a \`ReactionClient\` interface which can be extended to support integrating with Graphql APIs.
12
+
13
+ You can simply create your own \`ReactionGraphQLClient\` to extend our \`ReactionClient\` interface, and implement each method from interface by using your own GraphQL queries or mutations. Just ensure the payload is matched with the type defined from interface. You may need the data transformation before return the promise.
14
+
15
+ #### 1. Create your own \`ReactionsGraphQLClient\` to support your own GraphQL APIs:
16
+
17
+ ${code`
18
+ import type { ReactionClient } from "@atlaskit/reactions"
19
+
20
+ /**
21
+ * demo purpose, assume apolloClient has initialized in 'graphqlClient'
22
+ */
23
+ import apolloClient from 'graphqlClient'
24
+
25
+ export class ReactionsGraphQLClient implements ReactionClient {
26
+ private clientConfig: ClientConfig;
27
+ // optional, you can set up a clientConfig if you need some extra options that params from methods of ReactionClient doesn't provide.
28
+ constructor(clientConfig: ClientConfig) {
29
+ this.clientConfig = clientConfig;
30
+ }
31
+ getReactions(containerAri: string, aris: string[]) {
32
+ return apolloClient.
33
+ .query({
34
+ query: GET_REACTIONS_QUERY, // your own query to fetch reactions
35
+ variables: {
36
+ containerAri,
37
+ aris,
38
+ })
39
+ .then((response) => {
40
+ // transform data if needed to match return type from interface
41
+ return response.data; // type needs to be Reactions
42
+ });
43
+ }
44
+ getDetailedReaction(containerAri: string, ari: string, emojiId: string) {
45
+ return apolloClient.
46
+ .query({
47
+ query: GET_DETAILED_REACTION, // your own query to fetch detailed reaction
48
+ variables: {
49
+ containerAri,
50
+ aris,
51
+ })
52
+ .then((response) => {
53
+ // transform data if needed to match return type from interface
54
+ return response.data; // type needs to be Reactions
55
+ });
56
+ }
57
+ addReaction(containerAri: string, ari: string, emojiId: string) {
58
+ return apolloClient.
59
+ .mutate({
60
+ mutation: ADD_REACTION, // your own mutation to add reaction
61
+ variables: {
62
+ containerAri,
63
+ ari,
64
+ emojiId,
65
+ })
66
+ .then((response) => {
67
+ // transform data if needed to match return type from interface
68
+ return response.data; // type needs to be Reactions
69
+ });
70
+ }
71
+ deleteReaction(containerAri: string, ari: string, emojiId: string) {
72
+ return apolloClient.
73
+ .mutate({
74
+ mutation: REMOVE_REACTION, // your own mutation to delete reaction
75
+ variables: {
76
+ containerAri,
77
+ ari,
78
+ emojiId,
79
+ })
80
+ .then((response) => {
81
+ // transform data if needed to match return type from interface
82
+ return response.data; // type needs to be Reactions
83
+ });
84
+ }
85
+ }
86
+ `}
87
+
88
+ #### 2. Set up ReactionsStore with \`ReactionGraphQLClient\`:
89
+
90
+ ${code`
91
+ const intialState: State = {
92
+ reactions: {},
93
+ flash: {}
94
+ };
95
+
96
+ const reactionsStore = useMemo(() => {
97
+ return new MemoryReactionsStore(
98
+ new ReactionsGraphQLClient(
99
+ clientConfig, // client config from your own to provie extra options for your GraphQL APIs
100
+ ),
101
+ initialState,
102
+ {
103
+ subproduct: 'atlaskit', // e.g. jira, confluence, etc
104
+ }
105
+ );
106
+ }, [clientConfig]);
107
+ `}
108
+
109
+ #### 3. Consume your reactionsStore in your ConnectedReactionsView
110
+
111
+ ${code`
112
+ ReactDOM.render(
113
+ <ConnectedReactionsView
114
+ store={reactionsStore}
115
+ containerAri={containerAri}
116
+ ari={demoAri}
117
+ emojiProvider={Promise.resolve(emojiResource)}
118
+ />
119
+ container,
120
+ };`}
121
+
122
+ ${(
123
+ <>
124
+ <br />
125
+ <SectionMessage
126
+ appearance="information"
127
+ title="There should be only one instance of EmojiResource in your application"
128
+ >
129
+ <p>
130
+ Above examples show the best practice to integrate Graphql APIs. By
131
+ extending from our `ReactionsClient` interface, you are free to use any
132
+ GrapqhQL client, any queries or mutations, as long as they return the
133
+ same type as defined in the interface.
134
+ </p>
135
+ </SectionMessage>
136
+ <br />
137
+ <SectionMessage appearance="warning">
138
+ Use base UI Components `Reactions` from `@atlaskit/reactions` directly
139
+ with your own implementation around to support GraphQL or custom behavior
140
+ is at your own risk. Without using ReactionsStore, we can't track the
141
+ operations of reactions, please add your own tracking to measure. The
142
+ custom implementation will lead to limited support from us.
143
+ </SectionMessage>
144
+ </>
145
+ )}
146
+
147
+ ${(
148
+ <Props
149
+ heading="ReactionClient type"
150
+ props={require('!!extract-react-types-loader!../extract-react-type/reactionClient')}
151
+ />
152
+ )}
153
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.8.0",
3
+ "version": "22.0.0",
4
4
  "description": "Reactions component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,14 +12,6 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*",
19
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "atlaskit:src": "src/index.ts",
24
16
  "atlassian": {
25
17
  "team": "TWP Collaboration Platform",
@@ -36,14 +28,18 @@
36
28
  "@atlaskit/analytics-gas-types": "^5.0.0",
37
29
  "@atlaskit/analytics-namespaced-context": "^6.5.0",
38
30
  "@atlaskit/analytics-next": "^8.2.0",
39
- "@atlaskit/button": "^16.4.0",
31
+ "@atlaskit/avatar": "^21.0.0",
32
+ "@atlaskit/button": "^16.5.0",
40
33
  "@atlaskit/ds-lib": "^2.1.0",
41
- "@atlaskit/emoji": "^66.0.0",
34
+ "@atlaskit/emoji": "^66.1.0",
42
35
  "@atlaskit/icon": "^21.11.0",
36
+ "@atlaskit/modal-dialog": "^12.2.0",
43
37
  "@atlaskit/motion": "^1.3.0",
44
- "@atlaskit/popper": "^5.0.0",
38
+ "@atlaskit/popper": "^5.4.0",
39
+ "@atlaskit/spinner": "^15.3.0",
40
+ "@atlaskit/tabs": "^13.2.12",
45
41
  "@atlaskit/theme": "^12.2.0",
46
- "@atlaskit/tokens": "^0.10.0",
42
+ "@atlaskit/tokens": "^0.11.0",
47
43
  "@atlaskit/tooltip": "^17.6.0",
48
44
  "@atlaskit/ufo": "^0.1.0",
49
45
  "@atlaskit/util-service-support": "^6.1.0",
@@ -62,7 +58,7 @@
62
58
  "@atlaskit/elements-test-helpers": "^0.7.0",
63
59
  "@atlaskit/section-message": "^6.3.0",
64
60
  "@atlaskit/tooltip": "^17.6.0",
65
- "@atlaskit/util-data-test": "^17.5.0",
61
+ "@atlaskit/util-data-test": "^17.6.0",
66
62
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
67
63
  "@atlassian/ufo": "^0.1.0",
68
64
  "@emotion/jest": "^11.8.0",
@@ -71,17 +67,14 @@
71
67
  "@testing-library/react": "^12.1.5",
72
68
  "@testing-library/react-hooks": "^8.0.1",
73
69
  "@testing-library/user-event": "^14.4.3",
74
- "@types/webpack-dev-server": "^3.11.2",
75
70
  "dotenv": "^8.2.0",
76
- "enzyme": "^3.10.0",
77
- "enzyme-adapter-react-16": "^1.15.1",
78
71
  "es6-promise": "^4.0.5",
79
72
  "fetch-mock": "^8.0.0",
80
73
  "react": "^16.8.0",
81
74
  "react-intl-next": "npm:react-intl@^5.18.1",
82
75
  "typescript": "4.5.5",
83
76
  "wait-for-expect": "^1.2.0",
84
- "webpack-dev-server": "^3.11.2"
77
+ "webpack-dev-server": "^4.11.1"
85
78
  },
86
79
  "keywords": [
87
80
  "fabric",
@@ -1,23 +0,0 @@
1
- import { Reactions, Client, ReactionSummary } from './types';
2
- export declare const containerAri = "ari:cloud:owner:demo-cloud-id:container/1";
3
- export declare const ari = "ari:cloud:owner:demo-cloud-id:item/1";
4
- export declare const getReactionSummary: (shortName: string, count: number, reacted: boolean) => ReactionSummary;
5
- export declare const getUser: (id: string, displayName: string) => {
6
- id: string;
7
- displayName: string;
8
- };
9
- export declare const mockData: {
10
- [key: string]: ReactionSummary[];
11
- };
12
- /**
13
- * Mocked version of the client to fetch user information
14
- */
15
- export declare class MockReactionsClient implements Client {
16
- private delay;
17
- constructor(delay?: number);
18
- private delayPromise;
19
- getReactions(containerAri: string, aris: string[]): Promise<Reactions>;
20
- getDetailedReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary>;
21
- addReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary[]>;
22
- deleteReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary[]>;
23
- }
@@ -1,102 +0,0 @@
1
- import { AnalyticsEventPayload, CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
- import { EventType } from '@atlaskit/analytics-gas-types';
3
- import { ReactionSummary, ReactionSource } from '../types';
4
- export declare type PreviousState = 'new' | 'existingNotReacted' | 'existingReacted';
5
- export declare const createAndFireEventInElementsChannel: (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
6
- export declare const createAndFireSafe: <U extends any[], T extends (...args: U) => AnalyticsEventPayload>(createAnalyticsEvent: CreateUIAnalyticsEvent | void, creator: T, ...args: U) => void;
7
- export declare const createRestSucceededEvent: (actionSubject: string) => {
8
- action: string;
9
- actionSubject: string;
10
- eventType: EventType;
11
- actionSubjectId: string | undefined;
12
- attributes: {
13
- packageName: any;
14
- packageVersion: any;
15
- };
16
- };
17
- export declare const createRestFailedEvent: (actionSubject: string, errorCode?: number | undefined) => {
18
- action: string;
19
- actionSubject: string;
20
- eventType: EventType;
21
- actionSubjectId: string | undefined;
22
- attributes: {
23
- packageName: any;
24
- packageVersion: any;
25
- };
26
- };
27
- export declare const createReactionsRenderedEvent: (startTime: number) => {
28
- action: string;
29
- actionSubject: string;
30
- eventType: EventType;
31
- actionSubjectId: string | undefined;
32
- attributes: {
33
- packageName: any;
34
- packageVersion: any;
35
- };
36
- };
37
- export declare const createPickerButtonClickedEvent: (reactionEmojiCount: number) => {
38
- action: string;
39
- actionSubject: string;
40
- eventType: EventType;
41
- actionSubjectId: string | undefined;
42
- attributes: {
43
- packageName: any;
44
- packageVersion: any;
45
- };
46
- };
47
- export declare const createPickerCancelledEvent: (startTime?: number | undefined) => {
48
- action: string;
49
- actionSubject: string;
50
- eventType: EventType;
51
- actionSubjectId: string | undefined;
52
- attributes: {
53
- packageName: any;
54
- packageVersion: any;
55
- };
56
- };
57
- export declare const createPickerMoreClickedEvent: (startTime?: number | undefined) => {
58
- action: string;
59
- actionSubject: string;
60
- eventType: EventType;
61
- actionSubjectId: string | undefined;
62
- attributes: {
63
- packageName: any;
64
- packageVersion: any;
65
- };
66
- };
67
- export declare const createReactionSelectionEvent: (source: ReactionSource, emojiId: string, reaction?: ReactionSummary | undefined, startTime?: number | undefined) => {
68
- action: string;
69
- actionSubject: string;
70
- eventType: EventType;
71
- actionSubjectId: string | undefined;
72
- attributes: {
73
- packageName: any;
74
- packageVersion: any;
75
- };
76
- };
77
- export declare const createReactionHoveredEvent: (startTime?: number | undefined) => {
78
- action: string;
79
- actionSubject: string;
80
- eventType: EventType;
81
- actionSubjectId: string | undefined;
82
- attributes: {
83
- packageName: any;
84
- packageVersion: any;
85
- };
86
- };
87
- export declare const createReactionClickedEvent: (added: boolean, emojiId: string) => {
88
- action: string;
89
- actionSubject: string;
90
- eventType: EventType;
91
- actionSubjectId: string | undefined;
92
- attributes: {
93
- packageName: any;
94
- packageVersion: any;
95
- };
96
- };
97
- /**
98
- * Used for store failure metadata for analytics
99
- * @param error The error could be a service error with {code, reason} or an Error
100
- * @returns any
101
- */
102
- export declare const extractErrorInfo: (error: any) => any;
@@ -1 +0,0 @@
1
- export declare const SAMPLING_RATE_REACTIONS_RENDERED_EXP = 0.02;
@@ -1,2 +0,0 @@
1
- export * as Analytics from './analytics';
2
- export * as UFO from './ufo';
@@ -1,40 +0,0 @@
1
- import { ConcurrentExperience, UFOExperience } from '@atlaskit/ufo';
2
- /**
3
- * Types of experiences
4
- */
5
- export declare enum ExperienceName {
6
- REACTIONS_RENDERED = "reactions-rendered",
7
- PICKER_OPENED = "reactions-picker-opened",
8
- REACTION_ADDED = "reaction-added",
9
- REACTION_REMOVED = "reaction-removed",
10
- REACTION_DETAILS_FETCHED = "reaction-details-fetched"
11
- }
12
- /**
13
- * UFO types of components been instrumented
14
- */
15
- export declare enum ComponentName {
16
- PICKER_RENDERED = "reactions-picker",
17
- REACTIONS = "reactions-list",
18
- REACTION_ITEM = "reaction-item"
19
- }
20
- /**
21
- * Experience when the emoji picker is opened
22
- */
23
- export declare const PickerRender: UFOExperience;
24
- /**
25
- * Experience when the list of reactions gets rendered
26
- */
27
- export declare const ReactionsRendered: ConcurrentExperience;
28
- /**
29
- * Experience when a reaction emoji gets added
30
- */
31
- export declare const ReactionsAdd: ConcurrentExperience;
32
- /**
33
- * Experience when a reaction details gets fetched
34
- */
35
- export declare const ReactionDetailsFetch: ConcurrentExperience;
36
- /**
37
- * Experience when a reaction emoji gets removed/decrement
38
- */
39
- export declare const ReactionsRemove: ConcurrentExperience;
40
- export declare const sampledReactionsRendered: (instanceId: string) => import("@atlaskit/emoji").WithSamplingUFOExperience;
@@ -1,35 +0,0 @@
1
- import { Reactions, ReactionSummary, Client } from '../types';
2
- /**
3
- * Utility class to retrieve/modify all actions on reactions collection
4
- */
5
- export declare class ReactionServiceClient implements Client {
6
- /**
7
- * oAuth token
8
- */
9
- private sessionToken?;
10
- /**
11
- * API config
12
- */
13
- private serviceConfig;
14
- /**
15
- *
16
- * @param baseUrl base domain url
17
- * @param sessionToken oAuth token for reactions emoji services
18
- */
19
- constructor(baseUrl: string, sessionToken?: string);
20
- /**
21
- * Get http headers for the "fetch" request
22
- * @param hasBody
23
- */
24
- private getHeaders;
25
- /**
26
- * Send a request to remote service
27
- * @param path endpoint api url
28
- * @param options Optional custom params
29
- */
30
- private requestService;
31
- getReactions(containerAri: string, aris: string[]): Promise<Reactions>;
32
- getDetailedReaction(containerAri: string, ari: string, emojiId: string): Promise<ReactionSummary>;
33
- addReaction(containerAri: string, ari: string, emojiId: string, metadata?: Record<string, any>): Promise<ReactionSummary[]>;
34
- deleteReaction(containerAri: string, ari: string, emojiId: string, metadata?: Record<string, any>): Promise<ReactionSummary[]>;
35
- }
@@ -1 +0,0 @@
1
- export { ReactionServiceClient } from './ReactionServiceClient';
@@ -1,45 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- /**
4
- * Test id for component top level div
5
- */
6
- export declare const RENDER_COMPONENT_WRAPPER = "counter-wrapper";
7
- /**
8
- * Test id for wrapper div of the counter inside the slider
9
- */
10
- export declare const RENDER_COUNTER_TESTID = "counter-container";
11
- /**
12
- * Counter label value wrapper div
13
- */
14
- export declare const RENDER_LABEL_TESTID = "counter_label_wrapper";
15
- export interface CounterProps {
16
- /**
17
- * Count of emoji been selected
18
- */
19
- value: number;
20
- /**
21
- * Has the emoji been selected by given user (defaults to false)
22
- */
23
- highlight?: boolean;
24
- /**
25
- * Max threshold of selections to show before having a label (defaults to 1000)
26
- */
27
- limit?: number;
28
- /**
29
- * Label to show when the value surpasses the limit value (defaults to "1k+")
30
- */
31
- overLimitLabel?: string;
32
- /**
33
- * Optional wrapper class name
34
- */
35
- className?: string;
36
- /**
37
- * Duration in ms of how long the motion will take (defaults to "mediumDurationMs" from '@atlaskit/motion')
38
- */
39
- animationDuration?: number;
40
- }
41
- export declare const getLabel: (value: number, overLimitLabel?: string | undefined, limit?: number | undefined) => string;
42
- /**
43
- * Display reaction count next to the emoji button
44
- */
45
- export declare const Counter: React.FC<CounterProps>;
@@ -1,3 +0,0 @@
1
- export { Counter, RENDER_COUNTER_TESTID, RENDER_COMPONENT_WRAPPER, RENDER_LABEL_TESTID, } from './Counter';
2
- export type { CounterProps } from './Counter';
3
- export * as styles from './styles';
@@ -1,3 +0,0 @@
1
- export declare const countStyle: import("@emotion/react").SerializedStyles;
2
- export declare const highlightStyle: import("@emotion/react").SerializedStyles;
3
- export declare const containerStyle: import("@emotion/react").SerializedStyles;
@@ -1,22 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { EmojiId, OnEmojiEvent, EmojiProvider } from '@atlaskit/emoji';
4
- export declare const RENDER_BUTTON_TESTID = "button-emoji-id";
5
- export interface EmojiButtonProps {
6
- /**
7
- * identifier info for a given emoji
8
- */
9
- emojiId: EmojiId;
10
- /**
11
- * Async provider to fetch the emoji
12
- */
13
- emojiProvider: Promise<EmojiProvider>;
14
- /**
15
- * Event handler when a new emoji is selected
16
- */
17
- onClick: OnEmojiEvent;
18
- }
19
- /**
20
- * custom button to render the custom emoji selector inside the reaction picker
21
- */
22
- export declare const EmojiButton: React.FC<EmojiButtonProps>;
@@ -1,2 +0,0 @@
1
- export { EmojiButton, RENDER_BUTTON_TESTID } from './EmojiButton';
2
- export type { EmojiButtonProps } from './EmojiButton';
@@ -1 +0,0 @@
1
- export declare const emojiButtonStyle: import("@emotion/react").SerializedStyles;
@@ -1,20 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- export interface FlashAnimationProps {
4
- /**
5
- * Optional wrapper div class anme
6
- */
7
- className?: string;
8
- /**
9
- * Show custom animation or render as standard without animation (defaults to false)
10
- */
11
- flash?: boolean;
12
- }
13
- /**
14
- * Test id for wrapper FlashAnimation div
15
- */
16
- export declare const RENDER_FLASHANIMATION_TESTID = "flash-animation";
17
- /**
18
- * Flash animation background component. See Reaction component for usage.
19
- */
20
- export declare const FlashAnimation: React.FC<FlashAnimationProps>;
@@ -1,2 +0,0 @@
1
- export { FlashAnimation, RENDER_FLASHANIMATION_TESTID } from './FlashAnimation';
2
- export type { FlashAnimationProps } from './FlashAnimation';
@@ -1,5 +0,0 @@
1
- /** @jsx jsx */
2
- import { keyframes } from '@emotion/react';
3
- export declare const flashAnimation: typeof keyframes;
4
- export declare const containerStyle: import("@emotion/react").SerializedStyles;
5
- export declare const flashStyle: import("@emotion/react").SerializedStyles;
@@ -1,38 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { EmojiProvider } from '@atlaskit/emoji';
4
- import { ReactionSummary, ReactionClick, ReactionMouseEnter } from '../../types';
5
- /**
6
- * Test id for Reaction item wrapper div
7
- */
8
- export declare const RENDER_REACTION_TESTID = "render_reaction_wrapper";
9
- export interface ReactionProps {
10
- /**
11
- * Data for the reaction
12
- */
13
- reaction: ReactionSummary;
14
- /**
15
- * Provider for loading emojis
16
- */
17
- emojiProvider: Promise<EmojiProvider>;
18
- /**
19
- * event handler when the emoji button is clicked
20
- */
21
- onClick: ReactionClick;
22
- /**
23
- * Optional wrapper reaction <button /> class name
24
- */
25
- className?: string;
26
- /**
27
- * Optional event when the mouse cursor hovers over the reaction
28
- */
29
- onMouseEnter?: ReactionMouseEnter;
30
- /**
31
- * Show custom animation or render as standard without animation (defaults to false)
32
- */
33
- flash?: boolean;
34
- }
35
- /**
36
- * Render an emoji reaction button
37
- */
38
- export declare const Reaction: React.FC<ReactionProps>;
@@ -1,2 +0,0 @@
1
- export { Reaction, RENDER_REACTION_TESTID } from './Reaction';
2
- export type { ReactionProps } from './Reaction';
@@ -1,10 +0,0 @@
1
- /**
2
- * Styling Note:
3
- * Padding and line height are set within the child components
4
- * of FlashAnimation b/c it otherwise throws off the flash styling
5
- */
6
- export declare const emojiStyle: import("@emotion/react").SerializedStyles;
7
- export declare const reactionStyle: import("@emotion/react").SerializedStyles;
8
- export declare const reactedStyle: import("@emotion/react").SerializedStyles;
9
- export declare const flashHeight: number;
10
- export declare const flashStyle: import("@emotion/react").SerializedStyles;
@@ -1,50 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { EmojiProvider } from '@atlaskit/emoji/resource';
4
- import { SelectorProps } from '../Selector';
5
- import { TriggerProps } from '../Trigger';
6
- import { ReactionSource } from '../../types';
7
- /**
8
- * Test id for wrapper ReactionPicker div
9
- */
10
- export declare const RENDER_REACTIONPICKER_TESTID = "reactionPicker-testid";
11
- export interface ReactionPickerProps extends Pick<SelectorProps, 'pickerQuickReactionEmojiIds'>, Partial<Pick<TriggerProps, 'tooltipContent' | 'miniMode'>> {
12
- /**
13
- * Provider for loading emojis
14
- */
15
- emojiProvider: Promise<EmojiProvider>;
16
- /**
17
- * Event callback when an emoji button is selected
18
- * @param emojiId emoji unique id
19
- * @param source source where the reaction was picked (either the initial default reactions or the custom reactions picker)
20
- */
21
- onSelection: (emojiId: string, source: ReactionSource) => void;
22
- /**
23
- * Optional class name
24
- */
25
- className?: string;
26
- /**
27
- * Optional Show the "more emoji" selector icon for choosing emoji beyond the default list of emojis (defaults to false)
28
- */
29
- allowAllEmojis?: boolean;
30
- /**
31
- * Enable/Disable the button to be clickable (defaults to false)
32
- */
33
- disabled?: boolean;
34
- /**
35
- * Optional event handler when the emoji picker is opened
36
- */
37
- onOpen?: () => void;
38
- /**
39
- * Optional event handler when the emoji picker is clicked outside and closed
40
- */
41
- onCancel?: () => void;
42
- /**
43
- * Optional event handler when the custom emoji picker icon is selected
44
- */
45
- onShowMore?: () => void;
46
- }
47
- /**
48
- * Picker component for adding reactions
49
- */
50
- export declare const ReactionPicker: React.FC<ReactionPickerProps>;
@@ -1,2 +0,0 @@
1
- export { ReactionPicker, RENDER_REACTIONPICKER_TESTID } from './ReactionPicker';
2
- export type { ReactionPickerProps } from './ReactionPicker';