@atlaskit/reactions 22.3.1 → 22.3.2
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 +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.5/MockReactionsClient.d.ts +27 -0
- package/dist/types-ts4.5/analytics/analytics.d.ts +121 -0
- package/dist/types-ts4.5/analytics/index.d.ts +2 -0
- package/dist/types-ts4.5/analytics/ufo.d.ts +56 -0
- package/dist/types-ts4.5/client/ReactionServiceClient.d.ts +35 -0
- package/dist/types-ts4.5/client/index.d.ts +1 -0
- package/dist/types-ts4.5/components/Counter/Counter.d.ts +44 -0
- package/dist/types-ts4.5/components/Counter/index.d.ts +3 -0
- package/dist/types-ts4.5/components/Counter/styles.d.ts +4 -0
- package/dist/types-ts4.5/components/EmojiButton/EmojiButton.d.ts +22 -0
- package/dist/types-ts4.5/components/EmojiButton/index.d.ts +2 -0
- package/dist/types-ts4.5/components/EmojiButton/styles.d.ts +1 -0
- package/dist/types-ts4.5/components/FlashAnimation/FlashAnimation.d.ts +20 -0
- package/dist/types-ts4.5/components/FlashAnimation/index.d.ts +2 -0
- package/dist/types-ts4.5/components/FlashAnimation/styles.d.ts +5 -0
- package/dist/types-ts4.5/components/Reaction/Reaction.d.ts +48 -0
- package/dist/types-ts4.5/components/Reaction/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Reaction/styles.d.ts +10 -0
- package/dist/types-ts4.5/components/ReactionDialog/ReactionView.d.ts +19 -0
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsDialog.d.ts +32 -0
- package/dist/types-ts4.5/components/ReactionDialog/ReactionsList.d.ts +23 -0
- package/dist/types-ts4.5/components/ReactionDialog/index.d.ts +1 -0
- package/dist/types-ts4.5/components/ReactionDialog/styles.d.ts +11 -0
- package/dist/types-ts4.5/components/ReactionPicker/ReactionPicker.d.ts +59 -0
- package/dist/types-ts4.5/components/ReactionPicker/RepositionOnUpdate.d.ts +13 -0
- package/dist/types-ts4.5/components/ReactionPicker/index.d.ts +2 -0
- package/dist/types-ts4.5/components/ReactionPicker/styles.d.ts +4 -0
- package/dist/types-ts4.5/components/ReactionTooltip/ReactionTooltip.d.ts +34 -0
- package/dist/types-ts4.5/components/ReactionTooltip/index.d.ts +2 -0
- package/dist/types-ts4.5/components/ReactionTooltip/styles.d.ts +5 -0
- package/dist/types-ts4.5/components/Reactions/Reactions.d.ts +96 -0
- package/dist/types-ts4.5/components/Reactions/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Reactions/styles.d.ts +3 -0
- package/dist/types-ts4.5/components/Selector/Selector.d.ts +34 -0
- package/dist/types-ts4.5/components/Selector/index.d.ts +3 -0
- package/dist/types-ts4.5/components/Selector/styles.d.ts +12 -0
- package/dist/types-ts4.5/components/ShowMore/ShowMore.d.ts +35 -0
- package/dist/types-ts4.5/components/ShowMore/index.d.ts +2 -0
- package/dist/types-ts4.5/components/ShowMore/styles.d.ts +3 -0
- package/dist/types-ts4.5/components/Trigger/Trigger.d.ts +36 -0
- package/dist/types-ts4.5/components/Trigger/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Trigger/styles.d.ts +5 -0
- package/dist/types-ts4.5/components/UfoErrorBoundary/UfoErrorBoundary.d.ts +16 -0
- package/dist/types-ts4.5/components/UfoErrorBoundary/index.d.ts +2 -0
- package/dist/types-ts4.5/components/index.d.ts +9 -0
- package/dist/types-ts4.5/containers/ConnectedReactionPicker/ConnectedReactionPicker.d.ts +23 -0
- package/dist/types-ts4.5/containers/ConnectedReactionPicker/index.d.ts +2 -0
- package/dist/types-ts4.5/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +43 -0
- package/dist/types-ts4.5/containers/ConnectedReactionsView/index.d.ts +2 -0
- package/dist/types-ts4.5/containers/index.d.ts +2 -0
- package/dist/types-ts4.5/hooks/index.d.ts +1 -0
- package/dist/types-ts4.5/hooks/useCloseManager.d.ts +11 -0
- package/dist/types-ts4.5/hooks/useFocusTrap.d.ts +5 -0
- package/dist/types-ts4.5/i18n/cs.d.ts +23 -0
- package/dist/types-ts4.5/i18n/da.d.ts +23 -0
- package/dist/types-ts4.5/i18n/de.d.ts +22 -0
- package/dist/types-ts4.5/i18n/en.d.ts +23 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +23 -0
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +23 -0
- package/dist/types-ts4.5/i18n/es.d.ts +23 -0
- package/dist/types-ts4.5/i18n/et.d.ts +11 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +22 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +23 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +23 -0
- package/dist/types-ts4.5/i18n/index.d.ts +35 -0
- package/dist/types-ts4.5/i18n/is.d.ts +6 -0
- package/dist/types-ts4.5/i18n/it.d.ts +23 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +23 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +22 -0
- package/dist/types-ts4.5/i18n/languages.d.ts +27 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +22 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +23 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +23 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +23 -0
- package/dist/types-ts4.5/i18n/pt_PT.d.ts +11 -0
- package/dist/types-ts4.5/i18n/ro.d.ts +6 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +22 -0
- package/dist/types-ts4.5/i18n/sk.d.ts +11 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +23 -0
- package/dist/types-ts4.5/i18n/th.d.ts +23 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +23 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +23 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +23 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +23 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +22 -0
- package/dist/types-ts4.5/index.d.ts +7 -0
- package/dist/types-ts4.5/shared/constants.d.ts +28 -0
- package/dist/types-ts4.5/shared/i18n.d.ts +72 -0
- package/dist/types-ts4.5/shared/index.d.ts +3 -0
- package/dist/types-ts4.5/shared/utils.d.ts +18 -0
- package/dist/types-ts4.5/store/MemoryReactionsStore.d.ts +94 -0
- package/dist/types-ts4.5/store/ReactionConsumer.d.ts +57 -0
- package/dist/types-ts4.5/store/batched.d.ts +2 -0
- package/dist/types-ts4.5/store/index.d.ts +3 -0
- package/dist/types-ts4.5/store/utils.d.ts +11 -0
- package/dist/types-ts4.5/types/Actions.d.ts +27 -0
- package/dist/types-ts4.5/types/Updater.d.ts +1 -0
- package/dist/types-ts4.5/types/User.d.ts +20 -0
- package/dist/types-ts4.5/types/client.d.ts +38 -0
- package/dist/types-ts4.5/types/index.d.ts +7 -0
- package/dist/types-ts4.5/types/reaction.d.ts +113 -0
- package/dist/types-ts4.5/types/store.d.ts +63 -0
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import * as Types from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Set of all available UFO experiences relating to reaction element
|
|
5
|
+
*/
|
|
6
|
+
export declare const ufoExperiences: {
|
|
7
|
+
/**
|
|
8
|
+
* Experience when a reaction emoji gets added
|
|
9
|
+
*/
|
|
10
|
+
add: import("@atlaskit/ufo").ConcurrentExperience;
|
|
11
|
+
/**
|
|
12
|
+
* Experience when a reaction emoji gets removed/decrement
|
|
13
|
+
*/
|
|
14
|
+
remove: import("@atlaskit/ufo").ConcurrentExperience;
|
|
15
|
+
/**
|
|
16
|
+
* Experience when the list of reactions gets rendered with sampling
|
|
17
|
+
*/
|
|
18
|
+
render: (instanceId: string) => import("@atlaskit/emoji").WithSamplingUFOExperience;
|
|
19
|
+
/**
|
|
20
|
+
* Experience when a reaction details gets fetched
|
|
21
|
+
*/
|
|
22
|
+
fetchDetails: import("@atlaskit/ufo").ConcurrentExperience;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Optional metadata information in the store used in sending the API client requests
|
|
26
|
+
*/
|
|
27
|
+
interface StoreMetadata {
|
|
28
|
+
subproduct?: string;
|
|
29
|
+
[k: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export declare class MemoryReactionsStore implements Types.Store {
|
|
32
|
+
private client;
|
|
33
|
+
private state;
|
|
34
|
+
private metadata;
|
|
35
|
+
private callbacks;
|
|
36
|
+
private createAnalyticsEvent?;
|
|
37
|
+
/**
|
|
38
|
+
* default initial store data
|
|
39
|
+
*/
|
|
40
|
+
private initialState;
|
|
41
|
+
constructor(client: Types.Client, state?: Types.State, metadata?: StoreMetadata);
|
|
42
|
+
/**
|
|
43
|
+
* Update the store state data with a new data
|
|
44
|
+
* @param newState new store data
|
|
45
|
+
*/
|
|
46
|
+
private setState;
|
|
47
|
+
/**
|
|
48
|
+
* Calls any onChange callbacks in the store using latest state data.
|
|
49
|
+
*/
|
|
50
|
+
private triggerOnChange;
|
|
51
|
+
private setReactions;
|
|
52
|
+
private getReactionsState;
|
|
53
|
+
private handleDetailedReactionResponse;
|
|
54
|
+
private setFlash;
|
|
55
|
+
private flash;
|
|
56
|
+
private optmisticUpdate;
|
|
57
|
+
/**
|
|
58
|
+
* Utility function to help execute a callback to Reaction if its state is ready.
|
|
59
|
+
*
|
|
60
|
+
*
|
|
61
|
+
* @param containerAri
|
|
62
|
+
* @param ari
|
|
63
|
+
*
|
|
64
|
+
* @returns (updater: Updater<ReactionsReadyState>) => ReactionsState?
|
|
65
|
+
* A function that will execute the received callback with the ReactionsState if
|
|
66
|
+
* ready. If some state is returned, the new state will be applied.
|
|
67
|
+
*/
|
|
68
|
+
private withReadyReaction;
|
|
69
|
+
/**
|
|
70
|
+
* Utility function to help execute actions with a reaction. It handles reaction discovery
|
|
71
|
+
* and branching between reacted and not reacted.
|
|
72
|
+
*
|
|
73
|
+
* @param reactedCallback callback that will be executed when the user has already reacted
|
|
74
|
+
* with the emoji
|
|
75
|
+
* @param notReactedCallback callback that will be executed when the user hasn't reacted
|
|
76
|
+
* with the emoji
|
|
77
|
+
*
|
|
78
|
+
* @returns (containerAri: string, ari: string, emojiId: string) => ReactionsState?
|
|
79
|
+
* A function that will execute the correct callback to the triple containerAri, ari and
|
|
80
|
+
* emojiId. If some state is returned, the new state will be applied.
|
|
81
|
+
*/
|
|
82
|
+
private withReaction;
|
|
83
|
+
private doAddReaction;
|
|
84
|
+
private doRemoveReaction;
|
|
85
|
+
setCreateAnalyticsEvent: (createAnalyticsEvent?: CreateUIAnalyticsEvent) => void;
|
|
86
|
+
getReactions: (key: string, ...args: string[]) => void;
|
|
87
|
+
toggleReaction: (containerAri: string, ari: string, emojiId: string) => void;
|
|
88
|
+
addReaction: (containerAri: string, ari: string, emojiId: string) => void;
|
|
89
|
+
getDetailedReaction: (containerAri: string, ari: string, emojiId: string) => void;
|
|
90
|
+
getState: () => Types.State;
|
|
91
|
+
onChange: (callback: Types.OnChangeCallback) => void;
|
|
92
|
+
removeOnChangeListener: (toRemove: Types.OnChangeCallback) => void;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Actions, State, StorePropInput, Store } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Props type for the ReactionConsumer class component
|
|
5
|
+
*/
|
|
6
|
+
export type ReactioConsumerProps<PropsFromState, PropsFromActions> = {
|
|
7
|
+
/**
|
|
8
|
+
* Return a plain object containing the data that the connected component needs
|
|
9
|
+
*/
|
|
10
|
+
mapStateToProps?: (state: State) => PropsFromState;
|
|
11
|
+
/**
|
|
12
|
+
* Specify which actions the child component might need to dispatch from its props
|
|
13
|
+
*/
|
|
14
|
+
mapActionsToProps?: (actions: Actions) => PropsFromActions;
|
|
15
|
+
/**
|
|
16
|
+
* Component to render
|
|
17
|
+
*/
|
|
18
|
+
children: (props: PropsFromState & PropsFromActions) => React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Reference to the store.
|
|
21
|
+
* @remarks
|
|
22
|
+
* This was initially implemented with a sync and Async versions and will be replaced with just a sync Store in a future release (Please use only the sync version)
|
|
23
|
+
*/
|
|
24
|
+
store: StorePropInput;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* State type for the ReactionConsumer class component
|
|
28
|
+
*/
|
|
29
|
+
export type ReactionConsumerState = {
|
|
30
|
+
store?: Store;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A custom mapper class that takes the store instance and mapper functions "mapStateToProps" and "mapActionsToProps" to return the renderProps pattern as a child component
|
|
34
|
+
* @deprecated please avoid using this class as it will be removed in a future release
|
|
35
|
+
*/
|
|
36
|
+
export declare class ReactionConsumer<PropsFromState, PropsFromActions> extends React.PureComponent<ReactioConsumerProps<PropsFromState, PropsFromActions>, ReactionConsumerState> {
|
|
37
|
+
private previousActions;
|
|
38
|
+
private propsFromActions;
|
|
39
|
+
constructor(props: ReactioConsumerProps<PropsFromState, PropsFromActions>);
|
|
40
|
+
componentDidMount(): void;
|
|
41
|
+
componentWillUnmount(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Get the actions the child component might need to dispatch from its props
|
|
44
|
+
*/
|
|
45
|
+
private getPropsFromActions;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param state Internal state data
|
|
49
|
+
* @returns object containing the data that the connected component needs
|
|
50
|
+
*/
|
|
51
|
+
private getPropsFromState;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
private handleOnChange;
|
|
56
|
+
render(): React.ReactNode;
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Updater, ReactionsReadyState, ReactionSummary } from '../types';
|
|
2
|
+
type ReactionSummarySortFunction = (a: ReactionSummary, b: ReactionSummary) => number;
|
|
3
|
+
export declare const readyState: (reactions: ReactionSummary[]) => ReactionsReadyState;
|
|
4
|
+
export declare const byEmojiId: (emojiId: string) => (reaction: ReactionSummary) => boolean;
|
|
5
|
+
export declare const addOne: (reaction: ReactionSummary) => ReactionSummary;
|
|
6
|
+
export declare const removeOne: (reaction: ReactionSummary) => ReactionSummary;
|
|
7
|
+
export declare const updateByEmojiId: (emojiId: string, updater: Updater<ReactionSummary> | ReactionSummary) => (reaction: ReactionSummary) => void | ReactionSummary;
|
|
8
|
+
export declare const getReactionsSortFunction: (reactions?: ReactionSummary[]) => ReactionSummarySortFunction;
|
|
9
|
+
export declare const flattenAris: (a: string[], b: string[]) => string[];
|
|
10
|
+
export declare function isRealErrorFromService(errorCode?: number): boolean;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event callback by the client to the API
|
|
3
|
+
* @param containerAri the container for reactions/ari in the page (attached to the "quickReactionEmojis" prop)
|
|
4
|
+
* @param ariunique Atlassian identifier for an emoji (attached to the "quickReactionEmojis" prop)
|
|
5
|
+
* @param emojiId unique identifier guid for the emoji
|
|
6
|
+
*/
|
|
7
|
+
export type ReactionAction = (containerAri: string, ari: string, emojiId: string) => void;
|
|
8
|
+
export type Actions = {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve reaction collection api
|
|
11
|
+
* @param containerId the container for reactions/ari in the page
|
|
12
|
+
* @param aris collection of Asset ids in the container
|
|
13
|
+
*/
|
|
14
|
+
getReactions: (containerId: string, aris: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Select/deselect a rection callback
|
|
17
|
+
*/
|
|
18
|
+
toggleReaction: ReactionAction;
|
|
19
|
+
/**
|
|
20
|
+
* Add a new reation api
|
|
21
|
+
*/
|
|
22
|
+
addReaction: ReactionAction;
|
|
23
|
+
/**
|
|
24
|
+
* Hover an existing reaction emoji api
|
|
25
|
+
*/
|
|
26
|
+
getDetailedReaction: ReactionAction;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Updater<T> = (original: T) => T | void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
/**
|
|
3
|
+
* user id in system
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* name of user clicked on the reaction
|
|
8
|
+
*/
|
|
9
|
+
displayName: string;
|
|
10
|
+
/**
|
|
11
|
+
* optional path to a user profile picture
|
|
12
|
+
*/
|
|
13
|
+
profilePicture?: ProfilePicture;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Type defining the path to a user profile picture
|
|
17
|
+
*/
|
|
18
|
+
export type ProfilePicture = {
|
|
19
|
+
path: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Reactions, ReactionSummary } from './reaction';
|
|
2
|
+
export type Request<T> = (
|
|
3
|
+
/**
|
|
4
|
+
* Reaction Asset id in the container
|
|
5
|
+
*/
|
|
6
|
+
ari: string,
|
|
7
|
+
/**
|
|
8
|
+
* the container for reactions/ari
|
|
9
|
+
*/
|
|
10
|
+
containerAri: string,
|
|
11
|
+
/**
|
|
12
|
+
* unique Atlassian identifier for an emoji
|
|
13
|
+
*/
|
|
14
|
+
emojiId: string,
|
|
15
|
+
/**
|
|
16
|
+
* Optional metadata information used in the API request
|
|
17
|
+
*/
|
|
18
|
+
metadata?: Record<string, any>) => Promise<T>;
|
|
19
|
+
export interface Client {
|
|
20
|
+
/**
|
|
21
|
+
* fetch reactions request handler
|
|
22
|
+
* @param containerAri container wrapper id
|
|
23
|
+
* @param aris container reaction assets unique ids
|
|
24
|
+
*/
|
|
25
|
+
getReactions(containerAri: string, aris: string[]): Promise<Reactions>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch details for a given reaction.
|
|
28
|
+
*/
|
|
29
|
+
getDetailedReaction: Request<ReactionSummary>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch request when adding a reaction to a container.
|
|
32
|
+
*/
|
|
33
|
+
addReaction: Request<ReactionSummary[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Fetch request when removing a reaction from a container.
|
|
36
|
+
*/
|
|
37
|
+
deleteReaction: Request<ReactionSummary[]>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { ReactionAction, Actions } from './Actions';
|
|
2
|
+
export { ReactionStatus } from './reaction';
|
|
3
|
+
export type { ReactionSource, ReactionsError, ReactionsLoading, ReactionsReadyState, ReactionsState, ReactionSummary, QuickReactionEmojiSummary, ReactionsNotLoaded, Reactions, ReactionClick, ReactionMouseEnter, onDialogSelectReactionChange, } from './reaction';
|
|
4
|
+
export type { Client, Request } from './client';
|
|
5
|
+
export type { Updater } from './Updater';
|
|
6
|
+
export type { User } from './User';
|
|
7
|
+
export type { Store, StorePropInput, State, OnChangeCallback } from './store';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { User } from './User';
|
|
4
|
+
/**
|
|
5
|
+
* Collection of reactions as object (key is unique id from containerAri and ari combined)
|
|
6
|
+
*/
|
|
7
|
+
export type Reactions = Record<string, ReactionSummary[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Event handler when reactions dialog selected emoji is clicked
|
|
10
|
+
* @param emojiId selected emoji
|
|
11
|
+
* @param analyticsEvent Optional analytics event emitted from @atlaskit/tabs component
|
|
12
|
+
*/
|
|
13
|
+
export type onDialogSelectReactionChange = (emojiId: string, analyticsEvent: UIAnalyticsEvent) => void;
|
|
14
|
+
/**
|
|
15
|
+
* MetaData for Reaction object
|
|
16
|
+
*/
|
|
17
|
+
export interface ReactionSummary {
|
|
18
|
+
/**
|
|
19
|
+
* Reaction Asset id in the container
|
|
20
|
+
*/
|
|
21
|
+
ari: string;
|
|
22
|
+
/**
|
|
23
|
+
* the container for reactions/ari in the page
|
|
24
|
+
*/
|
|
25
|
+
containerAri: string;
|
|
26
|
+
/**
|
|
27
|
+
* unique Atlassian identifier for an emoji
|
|
28
|
+
*/
|
|
29
|
+
emojiId: string;
|
|
30
|
+
/**
|
|
31
|
+
* Number of selected count for the emoji
|
|
32
|
+
*/
|
|
33
|
+
count: number;
|
|
34
|
+
/**
|
|
35
|
+
* Has the current user selected the emoji or not
|
|
36
|
+
*/
|
|
37
|
+
reacted: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Users collection
|
|
40
|
+
*/
|
|
41
|
+
users?: User[];
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Legacy content Not in use anymore
|
|
44
|
+
*/
|
|
45
|
+
optimisticallyUpdated?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Metadata for composing a summary of emojis that will be shown in the the primary view even if the reaction count is zero
|
|
49
|
+
*/
|
|
50
|
+
export interface QuickReactionEmojiSummary {
|
|
51
|
+
/**
|
|
52
|
+
* unique Atlassian identifier for an emoji (attached to the "emojiIds" when forming {@link ReactionSummary} object)
|
|
53
|
+
*/
|
|
54
|
+
ari: string;
|
|
55
|
+
/**
|
|
56
|
+
* unique Atlassian identifier for the container grouping reactions/ari in the page (attached to the "emojiIds" when forming {@link ReactionSummary} object)
|
|
57
|
+
*/
|
|
58
|
+
containerAri: string;
|
|
59
|
+
/**
|
|
60
|
+
* emoji ids collection that will be shown in the the primary view even if the reaction count is zero
|
|
61
|
+
*/
|
|
62
|
+
emojiIds: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Event handler for when the user clicks on the reaction
|
|
66
|
+
* @param id give id for the emoji
|
|
67
|
+
* @param event selected mouse event proerties
|
|
68
|
+
*/
|
|
69
|
+
export type ReactionClick = (id: string, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Event handler for when the user hovers with the mouse on the reaction
|
|
72
|
+
* @param emojiId id of emoji
|
|
73
|
+
* @param event (Optional) custom DOM event handler callback
|
|
74
|
+
*/
|
|
75
|
+
export type ReactionMouseEnter = (emojiId: string, event?: React.MouseEvent<any>) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Event handler for when the user focused on the reaction
|
|
78
|
+
* @param emojiId id of emoji
|
|
79
|
+
* @param event (Optional) custom DOM event handler callback
|
|
80
|
+
*/
|
|
81
|
+
export type ReactionFocused = (emojiId: string, event?: React.FocusEvent<any>) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Condition of the reaction when gets loaded from the store
|
|
84
|
+
*/
|
|
85
|
+
export declare enum ReactionStatus {
|
|
86
|
+
ready = "READY",
|
|
87
|
+
loading = "LOADING",
|
|
88
|
+
error = "ERROR",
|
|
89
|
+
notLoaded = "NOT_LOADED",
|
|
90
|
+
disabled = "DISABLED"
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* state in which the reaction is at
|
|
94
|
+
*/
|
|
95
|
+
export type ReactionsState = ReactionsNotLoaded | ReactionsLoading | ReactionsReadyState | ReactionsError;
|
|
96
|
+
export type ReactionsReadyState = {
|
|
97
|
+
readonly status: ReactionStatus.ready;
|
|
98
|
+
readonly reactions: ReactionSummary[];
|
|
99
|
+
};
|
|
100
|
+
export type ReactionsLoading = {
|
|
101
|
+
readonly status: ReactionStatus.loading;
|
|
102
|
+
};
|
|
103
|
+
export type ReactionsError = {
|
|
104
|
+
readonly status: ReactionStatus.error;
|
|
105
|
+
readonly message: string;
|
|
106
|
+
};
|
|
107
|
+
export type ReactionsNotLoaded = {
|
|
108
|
+
readonly status: ReactionStatus.notLoaded;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Source where the emoji selected from ("quickSelector" -> default list, "emojiPicker" -> custom emoji list)
|
|
112
|
+
*/
|
|
113
|
+
export type ReactionSource = 'quickSelector' | 'emojiPicker';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { Actions } from './Actions';
|
|
3
|
+
import { ReactionsState } from './reaction';
|
|
4
|
+
/**
|
|
5
|
+
* Callback event when changes apply to the main store
|
|
6
|
+
* @param state latest store state
|
|
7
|
+
*/
|
|
8
|
+
export type OnChangeCallback = (state: State) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Map of state props
|
|
11
|
+
*/
|
|
12
|
+
export interface StoreProps {
|
|
13
|
+
/**
|
|
14
|
+
* Get current state of the stor
|
|
15
|
+
*/
|
|
16
|
+
getState: () => State;
|
|
17
|
+
/**
|
|
18
|
+
* Register a callbsack event on change to the store instance state data
|
|
19
|
+
* @param callback event to register
|
|
20
|
+
* @deprecated initially implemented by the MemoryReactionsStore class and kept. This will be removed in a future release
|
|
21
|
+
*/
|
|
22
|
+
onChange: (callback: OnChangeCallback) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Deregister any callback event on changes to the store instance state data
|
|
25
|
+
* @param callback event to de-register
|
|
26
|
+
* @deprecated initially implemented by the MemoryReactionsStore class and kept. This will be removed in a future release
|
|
27
|
+
*/
|
|
28
|
+
removeOnChangeListener: (callback: OnChangeCallback) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Add Atlaskit analytics events to different operations in the store
|
|
31
|
+
* @param createAnalyticsEvent analytics event trigger
|
|
32
|
+
* @deprecated initially implemented by the MemoryReactionsStore class and kept. This will be removed in a future release
|
|
33
|
+
*/
|
|
34
|
+
setCreateAnalyticsEvent?: (createAnalyticsEvent: CreateUIAnalyticsEvent) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* General Interface for a reaction store
|
|
38
|
+
*/
|
|
39
|
+
export interface Store extends Actions, StoreProps {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* the "store" prop option to the connected view and picker components
|
|
43
|
+
*/
|
|
44
|
+
export type StorePropInput = Store | Promise<Store>;
|
|
45
|
+
/**
|
|
46
|
+
* store main structure
|
|
47
|
+
*/
|
|
48
|
+
export type State = {
|
|
49
|
+
/**
|
|
50
|
+
* collection of the different reactions (key => unique reaction id , value => state of the reaction)
|
|
51
|
+
*/
|
|
52
|
+
reactions: {
|
|
53
|
+
[key: string]: ReactionsState;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* custom animation for given emojis as true|false (key => unique reaction id, value => collection of emojiIds and true|false to apply custom animation)
|
|
57
|
+
*/
|
|
58
|
+
flash: {
|
|
59
|
+
[key: string]: {
|
|
60
|
+
[emojiId: string]: boolean;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|