@apolitical/component-library 6.5.1-beta.1 → 6.6.0-SW.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/discussion/components/add-post/add-post.d.ts +3 -1
- package/discussion/components/conversation/conversation.d.ts +1 -1
- package/discussion/components/discussion-form-card/discussion-form-card.d.ts +2 -2
- package/discussion/components/form/components/guidelines/guidelines.d.ts +1 -1
- package/discussion/components/form/components/label/label.d.ts +1 -1
- package/discussion/components/form/form.type.d.ts +1 -1
- package/discussion/components/post/components/author-section/author-section.d.ts +14 -0
- package/discussion/components/post/components/author-section/index.d.ts +1 -0
- package/discussion/components/post/components/categories/categories.d.ts +5 -0
- package/discussion/components/post/components/categories/index.d.ts +1 -0
- package/discussion/components/post/components/index.d.ts +4 -0
- package/discussion/components/post/components/poll-content/index.d.ts +1 -0
- package/discussion/components/post/components/poll-content/poll-content.d.ts +10 -0
- package/discussion/components/post/components/post-content/index.d.ts +1 -0
- package/discussion/components/post/components/post-content/post-content.d.ts +15 -0
- package/discussion/components/post/post.d.ts +13 -5
- package/discussion/components/post/post.helpers.d.ts +5 -1
- package/discussion/feeds/activities-feed/activities-feed.d.ts +5 -2
- package/discussion/feeds/activities-feed/cache/hooks/create-poll/create-poll.hook.d.ts +24 -0
- package/discussion/feeds/activities-feed/cache/hooks/create-poll/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/create-vote/create-vote.hook.d.ts +8 -0
- package/discussion/feeds/activities-feed/cache/hooks/create-vote/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +3 -0
- package/discussion/feeds/activities-feed/cache/hooks/remove-vote/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/remove-vote/remove-vote.hook.d.ts +8 -0
- package/discussion/feeds/replies-feed/components/nested-replies-feed/nested-replies-feed.d.ts +1 -1
- package/discussion/feeds/replies-feed/components/reply-item/reply-item.d.ts +1 -1
- package/discussion/feeds/replies-feed/replies-feed.d.ts +1 -1
- package/discussion/index.d.ts +1 -2
- package/discussion/sections/activity-section/activity-section.d.ts +4 -1
- package/discussion/sections/activity-section/activity-section.helpers.d.ts +2 -2
- package/discussion/sections/activity-section/cache/hooks/create-vote/create-vote.hook.d.ts +7 -0
- package/discussion/sections/activity-section/cache/hooks/create-vote/index.d.ts +1 -0
- package/discussion/sections/activity-section/cache/hooks/index.d.ts +4 -2
- package/discussion/sections/activity-section/cache/hooks/remove-vote/index.d.ts +1 -0
- package/discussion/sections/activity-section/cache/hooks/remove-vote/remove-vote.hook.d.ts +7 -0
- package/discussion/sections/activity-section/mocks/activity-functions.mock.d.ts +5 -0
- package/discussion/shared/constants.d.ts +1 -0
- package/discussion/shared/helpers/activity.helper.d.ts +44 -1
- package/discussion/shared/helpers/cache.helper.d.ts +7 -1
- package/discussion/shared/helpers/index.d.ts +2 -1
- package/discussion/shared/helpers/poll.helper.d.ts +46 -0
- package/discussion/shared/helpers/reaction.helper.d.ts +38 -0
- package/discussion/shared/interfaces/activity.interface.d.ts +16 -1
- package/discussion/shared/interfaces/discussion.interface.d.ts +14 -3
- package/discussion/shared/interfaces/reaction.interface.d.ts +1 -1
- package/form/components/form/components/fields/checkbox/checkbox.d.ts +0 -2
- package/form/components/form/components/fields/input/input.d.ts +6 -3
- package/form/components/form/form.types.d.ts +1 -9
- package/form/components/rich-text-editor/components/context/context.d.ts +1 -1
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +1 -1
- package/helpers/intl.d.ts +2 -0
- package/helpers/replace-mention-data.d.ts +1 -1
- package/hooks/index.d.ts +0 -1
- package/index.js +55 -55
- package/index.mjs +9201 -8807
- package/navigation/action-bar/action-bar.d.ts +1 -2
- package/navigation/action-bar/components/likes/likes.d.ts +1 -1
- package/package.json +2 -1
- package/polls/poll/index.d.ts +1 -1
- package/polls/poll/poll.d.ts +4 -5
- package/polls/poll/poll.mocks.d.ts +1 -0
- package/polls/poll/poll.types.d.ts +9 -0
- package/style.css +1 -1
- package/styles/base/form/_fields.scss +0 -4
- package/styles/variables/colors/theme/_base.scss +0 -2
- package/hooks/use-auto-resize.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IDiscussionForm } from '../../../discussion/components/form';
|
|
3
|
-
import { ICategory } from '../../shared';
|
|
3
|
+
import { type ICategory } from '../../shared';
|
|
4
4
|
interface Props {
|
|
5
5
|
/** Whether the form should be displayed as a card */
|
|
6
6
|
isCard?: boolean;
|
|
@@ -23,6 +23,8 @@ interface Props {
|
|
|
23
23
|
/** The text to show when the user is not a member of the community */
|
|
24
24
|
notMemberStateText?: string;
|
|
25
25
|
};
|
|
26
|
+
/** The locale of the page */
|
|
27
|
+
locale?: string;
|
|
26
28
|
}
|
|
27
29
|
declare const AddPost: React.FC<Props>;
|
|
28
30
|
export default AddPost;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IConversation, IListMemberData } from '
|
|
2
|
+
import type { IConversation, IListMemberData } from '../../../discussion/shared';
|
|
3
3
|
export declare const ConversationContext: React.Context<{
|
|
4
4
|
showForm: boolean;
|
|
5
5
|
prepopulateForm?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IMentions } from '
|
|
1
|
+
import type { IDiscussionForm } from './../form';
|
|
2
|
+
import type { IMentions } from '../../../discussion/shared';
|
|
3
3
|
export interface CachedText {
|
|
4
4
|
/** Whether the cached text should show on the form card; this is false by default
|
|
5
5
|
* to prevent the text changing right away and distracting the user */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ILabelProps } from '../../../../../form';
|
|
2
|
-
import { IDiscussionContentType } from '
|
|
2
|
+
import type { IDiscussionContentType } from '../../../../../discussion/shared';
|
|
3
3
|
interface Props extends ILabelProps {
|
|
4
4
|
/** The internationalisation path for the label */
|
|
5
5
|
intlPath: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IEnrichedUrlData } from '../../../navigation';
|
|
2
|
-
import type { ICategory,
|
|
2
|
+
import type { ICategory, IDiscussionContent, IDiscussionFormFunctions, IMentions } from '../../../discussion/shared';
|
|
3
3
|
interface IPollData {
|
|
4
4
|
options: string[];
|
|
5
5
|
multipleAnswers: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IFullDiscussionContent } from '../../../../../discussion/shared';
|
|
2
|
+
import type { IDiscussionPostProps } from '../../post';
|
|
3
|
+
export interface IAuthorSectionProps {
|
|
4
|
+
author: IFullDiscussionContent['author'];
|
|
5
|
+
originalAuthorId?: string;
|
|
6
|
+
createdAt: IFullDiscussionContent['createdAt'];
|
|
7
|
+
contentData: {
|
|
8
|
+
didEdit: boolean;
|
|
9
|
+
};
|
|
10
|
+
content: IDiscussionPostProps['content'];
|
|
11
|
+
badges?: IDiscussionPostProps['badges'];
|
|
12
|
+
gtmContext?: string;
|
|
13
|
+
}
|
|
14
|
+
export default function AuthorSection({ author, originalAuthorId, createdAt, contentData, content, gtmContext, badges, }: IAuthorSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AuthorSection } from './author-section';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Categories } from './categories';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PollContent } from './poll-content';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IPollFns } from '../../../../../polls';
|
|
2
|
+
import { IDiscussionPostProps } from '../../post';
|
|
3
|
+
export interface IPollContentProps {
|
|
4
|
+
content: IDiscussionPostProps['content'];
|
|
5
|
+
contentData: {
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
functions: IPollFns;
|
|
9
|
+
}
|
|
10
|
+
export default function PollContent({ content, contentData, functions, }: IPollContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PostContent } from './post-content';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IDiscussionPostProps } from '../../post';
|
|
2
|
+
import type { IFullDiscussionContent } from '../../../../../discussion';
|
|
3
|
+
export interface IPostContentProps {
|
|
4
|
+
links: IDiscussionPostProps['links'];
|
|
5
|
+
contentData: {
|
|
6
|
+
title: string;
|
|
7
|
+
isEditing: boolean;
|
|
8
|
+
didEdit: boolean;
|
|
9
|
+
postBody: string;
|
|
10
|
+
data: IFullDiscussionContent['data'];
|
|
11
|
+
};
|
|
12
|
+
postCutOff: number;
|
|
13
|
+
content: IDiscussionPostProps['content'];
|
|
14
|
+
}
|
|
15
|
+
export default function PostContent({ links, contentData, postCutOff, content, }: IPostContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { IBadgesOption } from '../../../user/badges';
|
|
2
|
+
import type { IPollFns, IPollProps } from '../../../polls';
|
|
3
|
+
import type { IMemberComponentProps } from '../../../user';
|
|
4
|
+
import type { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, DiscussionListLikesFunction, IDiscussionFormFns, IForceHide, IFullDiscussionContent } from '../../../discussion/shared';
|
|
5
|
+
import type { IBadgesOption } from '../../../user/badges';
|
|
6
6
|
export interface IPostContent extends IFullDiscussionContent {
|
|
7
7
|
/** The post body */
|
|
8
8
|
postBody?: string;
|
|
@@ -10,6 +10,13 @@ export interface IPostContent extends IFullDiscussionContent {
|
|
|
10
10
|
/** Custom props to pass through to the Member component */
|
|
11
11
|
member: IMemberComponentProps;
|
|
12
12
|
};
|
|
13
|
+
/** The options for the Poll */
|
|
14
|
+
pollOptions?: IPollProps['options'];
|
|
15
|
+
/** The settings for the Poll */
|
|
16
|
+
pollSettings?: IPollProps['settings'];
|
|
17
|
+
}
|
|
18
|
+
export interface IPollFunctions extends IPollFns {
|
|
19
|
+
removePoll: (args?: object) => void;
|
|
13
20
|
}
|
|
14
21
|
export interface IDiscussionPostProps {
|
|
15
22
|
/** The element that will render around the content */
|
|
@@ -44,6 +51,7 @@ export interface IDiscussionPostProps {
|
|
|
44
51
|
/** List the likes on the post */
|
|
45
52
|
listLikes: DiscussionListLikesFunction;
|
|
46
53
|
};
|
|
54
|
+
polls?: IPollFunctions;
|
|
47
55
|
comments: {
|
|
48
56
|
/** Open comments on a post */
|
|
49
57
|
openComments?: () => void;
|
|
@@ -89,5 +97,5 @@ export interface IDiscussionPostProps {
|
|
|
89
97
|
/** The ID of the parent, used for slugs */
|
|
90
98
|
parentId: string;
|
|
91
99
|
}
|
|
92
|
-
declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, setFocus, isCommunity, badges, basePath, parentId, }: IDiscussionPostProps) => import("react/jsx-runtime").JSX.Element;
|
|
100
|
+
declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, setFocus, isCommunity, badges, basePath, parentId, locale, }: IDiscussionPostProps) => import("react/jsx-runtime").JSX.Element;
|
|
93
101
|
export default Post;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { IMentions } from '
|
|
1
|
+
import type { IMentions } from '../../../discussion/shared';
|
|
2
2
|
import { ListMembers } from '../../../form';
|
|
3
3
|
import { ICategory } from '../../shared';
|
|
4
4
|
export declare const getPostBody: (body: string, isTruncated: boolean | number, mentions?: IMentions, listMembers?: ListMembers) => Promise<string>;
|
|
5
5
|
export declare const enrichPostCategories: (postCategories: string[], allCategories: ICategory[]) => (ICategory | undefined)[];
|
|
6
|
+
export declare const allowClickUntilClassNameFound: (event: React.MouseEvent<HTMLElement, MouseEvent>, contentClasses: string[], breakClassName: string) => boolean;
|
|
7
|
+
export declare const getTitleText: (title: string | {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
} | undefined, locale: string) => string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type IProfileFormProps } from '../../../form';
|
|
3
|
-
import { ICategory } from '../../../discussion/shared';
|
|
3
|
+
import { ICategory, type IDiscussionFormFns } from '../../../discussion/shared';
|
|
4
4
|
import type { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
|
|
5
|
-
import type { IDiscussionFormFns } from '../../../discussion/discussion.d';
|
|
6
5
|
import { type IQueryFns } from './cache';
|
|
7
6
|
interface Props {
|
|
8
7
|
/** The base path, used for slugs */
|
|
@@ -26,9 +25,13 @@ interface Props {
|
|
|
26
25
|
/** Function to leave the community */
|
|
27
26
|
leave: () => Promise<void>;
|
|
28
27
|
likes: ILikesFeedQueryFns;
|
|
28
|
+
/** Query functions for polls */
|
|
29
|
+
polls: IQueryFns;
|
|
29
30
|
};
|
|
30
31
|
/** Props to pass into the profile form */
|
|
31
32
|
profile: IProfileFormProps;
|
|
33
|
+
/** The locale of the page */
|
|
34
|
+
locale?: string;
|
|
32
35
|
}
|
|
33
36
|
declare const ActivitiesFeed: React.FC<Props>;
|
|
34
37
|
export default ActivitiesFeed;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IMutationContext } from '../../../../../../discussion/shared';
|
|
2
|
+
import type { ICache, ICacheItem } from '../..';
|
|
3
|
+
import { ResultsVisibility } from '../../../../../../polls';
|
|
4
|
+
interface ICreatePollVars {
|
|
5
|
+
title: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
options: {
|
|
9
|
+
position: number;
|
|
10
|
+
description: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
}[];
|
|
14
|
+
settings: {
|
|
15
|
+
show_remove_vote?: boolean;
|
|
16
|
+
allow_multiple_votes?: boolean;
|
|
17
|
+
deadline_at?: string;
|
|
18
|
+
hide_participants?: boolean;
|
|
19
|
+
number_of_winners?: number;
|
|
20
|
+
results_visibility?: ResultsVisibility;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function useCreatePoll({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, user, }: IMutationContext<ICacheItem, Error, ICreatePollVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IActivity, Error, ICreatePollVars, ICache>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-poll.hook';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IMutationContext } from '../../../../../../discussion/shared';
|
|
2
|
+
import type { ICache, ICacheSubitem } from '../..';
|
|
3
|
+
interface ICreateVoteVars {
|
|
4
|
+
activityId: string;
|
|
5
|
+
reactionId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function useCreateVote({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, user, }: IMutationContext<ICacheSubitem, Error, ICreateVoteVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, ICreateVoteVars, ICache>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-vote.hook';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export * from './create';
|
|
2
|
+
export * from './create-poll';
|
|
3
|
+
export * from './create-vote';
|
|
2
4
|
export * from './edit';
|
|
3
5
|
export * from './feed';
|
|
4
6
|
export * from './like';
|
|
5
7
|
export * from './list';
|
|
6
8
|
export * from './pin';
|
|
7
9
|
export * from './remove';
|
|
10
|
+
export * from './remove-vote';
|
|
8
11
|
export * from './unlike';
|
|
9
12
|
export * from './unpin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './remove-vote.hook';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IMutationContext } from '../../../../../../discussion/shared';
|
|
2
|
+
import type { ICache } from '../..';
|
|
3
|
+
interface IRemoveVoteVars {
|
|
4
|
+
activityId: string;
|
|
5
|
+
reactionId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function useRemoveVote({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IRemoveVoteVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IRemoveVoteVars, ICache>;
|
|
8
|
+
export {};
|
package/discussion/feeds/replies-feed/components/nested-replies-feed/nested-replies-feed.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type
|
|
2
|
+
import { type IDiscussionFormFns } from '../../../../../discussion/shared';
|
|
3
3
|
import { ILikesFeedQueryFns } from '../../../../../discussion/feeds/likes-feed';
|
|
4
4
|
import { type IQueryFns } from '../../cache';
|
|
5
5
|
interface NestedRepliesFunctions {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ILikesFeedQueryFns } from '../../../../../discussion/feeds/likes-feed';
|
|
3
|
-
import type
|
|
3
|
+
import { type IDiscussionFormFns } from '../../../../../discussion/shared';
|
|
4
4
|
import type { IParsedReplies, IQueryFns } from '../../cache';
|
|
5
5
|
interface IMutations {
|
|
6
6
|
edit: (params: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type IProfileFormProps } from '../../../form';
|
|
3
|
+
import { type IDiscussionFormFns } from '../../../discussion/shared';
|
|
3
4
|
import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
|
|
4
|
-
import type { IDiscussionFormFns } from '../../discussion';
|
|
5
5
|
import { type IQueryFns } from './cache';
|
|
6
6
|
interface RepliesFunctions {
|
|
7
7
|
/** Functions for the replies query */
|
package/discussion/index.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ export * from './components';
|
|
|
2
2
|
export * from './feeds';
|
|
3
3
|
export * from './discussion.helpers';
|
|
4
4
|
export * from './sections';
|
|
5
|
-
export
|
|
6
|
-
export type { IDiscussionFormFns } from './discussion.d';
|
|
5
|
+
export * from './shared/interfaces';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type IProfileFormProps } from '../../../form';
|
|
3
3
|
import { type ILikesFeedQueryFns, type IRepliesFeedQueryFns } from '../../../discussion/feeds';
|
|
4
|
-
import type
|
|
4
|
+
import { type IDiscussionFormFns } from '../../../discussion/shared';
|
|
5
5
|
import { type IQueryFns } from './cache';
|
|
6
6
|
import { ICategory } from '../../shared';
|
|
7
7
|
interface IActivitySectionQueryFns extends IQueryFns {
|
|
@@ -20,9 +20,12 @@ export interface IActivitySectionProps {
|
|
|
20
20
|
form: IDiscussionFormFns;
|
|
21
21
|
join: () => Promise<void>;
|
|
22
22
|
leave: () => Promise<void>;
|
|
23
|
+
polls: IQueryFns;
|
|
23
24
|
};
|
|
24
25
|
profile: IProfileFormProps;
|
|
25
26
|
categories?: ICategory[];
|
|
27
|
+
/** The locale of the page */
|
|
28
|
+
locale?: string;
|
|
26
29
|
}
|
|
27
30
|
declare const ActivitySection: React.FC<IActivitySectionProps>;
|
|
28
31
|
export default ActivitySection;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function
|
|
1
|
+
import { IActivity } from '../../shared';
|
|
2
|
+
export declare function hasUserVoted(activity: IActivity): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IMutationContext } from '../../../../../../discussion/shared';
|
|
2
|
+
import type { ICache, ICacheSubitem } from '../..';
|
|
3
|
+
interface ICreateVoteVars {
|
|
4
|
+
reactionId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function useCreateVote({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, user, }: IMutationContext<ICacheSubitem, Error, ICreateVoteVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, ICreateVoteVars, import('../../../../../../discussion/shared').IActivity>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-vote.hook';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from './create-vote';
|
|
1
2
|
export * from './edit';
|
|
3
|
+
export * from './like';
|
|
4
|
+
export * from './pin';
|
|
2
5
|
export * from './read';
|
|
6
|
+
export * from './remove-vote';
|
|
3
7
|
export * from './section';
|
|
4
|
-
export * from './like';
|
|
5
8
|
export * from './unlike';
|
|
6
|
-
export * from './pin';
|
|
7
9
|
export * from './unpin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './remove-vote.hook';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IMutationContext } from '../../../../../../discussion/shared';
|
|
2
|
+
import type { ICache } from '../..';
|
|
3
|
+
interface IRemoveVoteVars {
|
|
4
|
+
reactionId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function useRemoveVote({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IRemoveVoteVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IRemoveVoteVars, import('../../../../../../discussion/shared').IActivity>;
|
|
7
|
+
export {};
|
|
@@ -28,6 +28,11 @@ export declare const mockFunctions: {
|
|
|
28
28
|
listMembers: jest.Mock<any, any, any>;
|
|
29
29
|
clickMentionFallback: jest.Mock<any, any, any>;
|
|
30
30
|
};
|
|
31
|
+
polls: {
|
|
32
|
+
createVote: jest.Mock<any, any, any>;
|
|
33
|
+
removeVote: jest.Mock<any, any, any>;
|
|
34
|
+
removePoll: jest.Mock<any, any, any>;
|
|
35
|
+
};
|
|
31
36
|
join: jest.Mock<any, any, any>;
|
|
32
37
|
leave: jest.Mock<any, any, any>;
|
|
33
38
|
};
|
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
import type { IUserContext } from '../../../context';
|
|
2
2
|
import type { IActivity, IReaction } from '..';
|
|
3
|
+
import { ActivityType } from '../../../discussion/shared';
|
|
4
|
+
import { ResultsVisibility } from '../../../polls';
|
|
3
5
|
interface IPrepareActivityArgs {
|
|
4
6
|
title?: string;
|
|
5
7
|
content?: string;
|
|
6
8
|
categories?: string;
|
|
7
9
|
}
|
|
10
|
+
interface IPreparePollActivityArgs {
|
|
11
|
+
title?: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
options: {
|
|
15
|
+
position: number;
|
|
16
|
+
description: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
settings: {
|
|
21
|
+
show_remove_vote?: boolean;
|
|
22
|
+
allow_multiple_votes?: boolean;
|
|
23
|
+
deadline_at?: string;
|
|
24
|
+
hide_participants?: boolean;
|
|
25
|
+
number_of_winners?: number;
|
|
26
|
+
results_visibility?: ResultsVisibility;
|
|
27
|
+
};
|
|
28
|
+
user: IUserContext;
|
|
29
|
+
correctActivityId?: string;
|
|
30
|
+
}
|
|
8
31
|
interface IEnrichActivityArgs {
|
|
9
32
|
activity: IActivity | Partial<IActivity>;
|
|
10
33
|
user: IUserContext;
|
|
11
34
|
}
|
|
35
|
+
interface IEnrichPollActivityArgs {
|
|
36
|
+
activity: IActivity | Partial<IActivity>;
|
|
37
|
+
options: {
|
|
38
|
+
position: number;
|
|
39
|
+
description: {
|
|
40
|
+
[key: string]: string;
|
|
41
|
+
};
|
|
42
|
+
}[];
|
|
43
|
+
user: IUserContext;
|
|
44
|
+
}
|
|
12
45
|
interface IIncrementActivityLikesArgs {
|
|
13
46
|
activity: IActivity;
|
|
14
47
|
reaction?: IReaction;
|
|
@@ -24,9 +57,19 @@ export declare function prepareActivity({ title, content, categories }: IPrepare
|
|
|
24
57
|
categories: string[];
|
|
25
58
|
id: string;
|
|
26
59
|
time: string;
|
|
27
|
-
verb:
|
|
60
|
+
verb: ActivityType;
|
|
61
|
+
};
|
|
62
|
+
export declare function preparePollActivity({ title, options, settings, user, correctActivityId, }: IPreparePollActivityArgs): {
|
|
63
|
+
title: {
|
|
64
|
+
[key: string]: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
content: string;
|
|
67
|
+
id: string;
|
|
68
|
+
time: string;
|
|
69
|
+
verb: ActivityType;
|
|
28
70
|
};
|
|
29
71
|
export declare function enrichActivity({ activity, user }: IEnrichActivityArgs): IActivity;
|
|
72
|
+
export declare function enrichPollActivity({ activity, options, user }: IEnrichPollActivityArgs): IActivity;
|
|
30
73
|
export declare function incrementActivityLikes({ activity, reaction, }: IIncrementActivityLikesArgs): void;
|
|
31
74
|
export declare function decrementActivityLikes({ activity, user }: IDecrementActivityLikesArgs): void;
|
|
32
75
|
export declare function incrementActivityPins({ activity, reaction, }: IIncrementActivityLikesArgs): void;
|
|
@@ -18,7 +18,13 @@ export declare function buildEmptyCacheWithItem<ICacheItem>(item: ICacheItem): {
|
|
|
18
18
|
}[];
|
|
19
19
|
pageParams: string[];
|
|
20
20
|
};
|
|
21
|
-
export declare function addItem<ICacheItem extends ICacheItemBase>(item: ICacheItem, cache?: ICache<ICacheItem>, opts?: IAdditionOptions):
|
|
21
|
+
export declare function addItem<ICacheItem extends ICacheItemBase>(item: ICacheItem, cache?: ICache<ICacheItem>, opts?: IAdditionOptions): {
|
|
22
|
+
pages: {
|
|
23
|
+
next: string;
|
|
24
|
+
results: ICacheItem[];
|
|
25
|
+
}[];
|
|
26
|
+
pageParams: string[];
|
|
27
|
+
};
|
|
22
28
|
export declare function findItem<ICacheItem extends ICacheItemBase>(itemId: string, cache?: ICache<ICacheItem>): ICacheItem | undefined;
|
|
23
29
|
export declare function removeItem<ICacheItem extends ICacheItemBase>(itemId: string, cache: ICache<ICacheItem>): ICache<ICacheItem>;
|
|
24
30
|
export declare function flattenCache<ICacheItem extends ICacheItemBase>(cache?: ICache<ICacheItem>): ICacheItem[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IPollOption } from '../../../polls';
|
|
2
|
+
import { type IActivity } from '../interfaces/activity.interface';
|
|
3
|
+
import type { IUserContext } from '../../../context';
|
|
4
|
+
import { ICacheItem } from '../../feeds/activities-feed/cache';
|
|
5
|
+
interface IPreparePollVoteArgs {
|
|
6
|
+
activity: IActivity;
|
|
7
|
+
reactionId: string;
|
|
8
|
+
user?: IUserContext;
|
|
9
|
+
}
|
|
10
|
+
interface IPreparePollOptionArgs {
|
|
11
|
+
position: number;
|
|
12
|
+
description: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
user?: IUserContext;
|
|
16
|
+
}
|
|
17
|
+
interface IEnrichPollArgs {
|
|
18
|
+
activity: IActivity;
|
|
19
|
+
activityId: string;
|
|
20
|
+
}
|
|
21
|
+
interface IEnrichPollVoteArgs extends IPreparePollVoteArgs {
|
|
22
|
+
correctReactionId: string;
|
|
23
|
+
}
|
|
24
|
+
interface IRemovePollVoteArgs {
|
|
25
|
+
activity: IActivity;
|
|
26
|
+
reactionId: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const getActivityPollOptions: (pollOption: ICacheItem, locale?: string) => IPollOption[];
|
|
29
|
+
export declare function preparePollVote({ activity, reactionId, user }: IPreparePollVoteArgs): void;
|
|
30
|
+
export declare function enrichPollVote({ activity, reactionId, correctReactionId, user, }: IEnrichPollVoteArgs): void;
|
|
31
|
+
export declare function removePollVote({ activity, reactionId }: IRemovePollVoteArgs): void;
|
|
32
|
+
export declare function enrichPoll({ activity, activityId }: IEnrichPollArgs): void;
|
|
33
|
+
export declare function preparePollOption({ position, description }: IPreparePollOptionArgs, user?: IUserContext): {
|
|
34
|
+
created_at: string;
|
|
35
|
+
updated_at: string;
|
|
36
|
+
id: string;
|
|
37
|
+
kind: string;
|
|
38
|
+
data: {
|
|
39
|
+
description: {
|
|
40
|
+
[key: string]: string;
|
|
41
|
+
};
|
|
42
|
+
position: number;
|
|
43
|
+
};
|
|
44
|
+
parent: string;
|
|
45
|
+
} | undefined;
|
|
46
|
+
export {};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { IUserContext } from '../../../context';
|
|
1
2
|
export declare function buildEmptyReactionsForActivity(): {
|
|
2
3
|
latest_reactions: {
|
|
3
4
|
like: never[];
|
|
4
5
|
reply: never[];
|
|
6
|
+
'poll-option': never[];
|
|
5
7
|
};
|
|
6
8
|
reaction_counts: {
|
|
7
9
|
like: number;
|
|
8
10
|
reply: number;
|
|
11
|
+
'poll-option': number;
|
|
9
12
|
};
|
|
10
13
|
own_reactions: {
|
|
11
14
|
like: never[];
|
|
12
15
|
reply: never[];
|
|
16
|
+
'poll-option': never[];
|
|
13
17
|
};
|
|
14
18
|
};
|
|
15
19
|
export declare function buildEmptyReactionsForReply(): {
|
|
@@ -26,3 +30,37 @@ export declare function buildEmptyReactionsForReply(): {
|
|
|
26
30
|
reply: never[];
|
|
27
31
|
};
|
|
28
32
|
};
|
|
33
|
+
export declare function buildReactionsForPollActivity(options: {
|
|
34
|
+
position: number;
|
|
35
|
+
description: {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
};
|
|
38
|
+
}[], user: IUserContext): {
|
|
39
|
+
latest_reactions: {
|
|
40
|
+
like: never[];
|
|
41
|
+
reply: never[];
|
|
42
|
+
'poll-option': ({
|
|
43
|
+
created_at: string;
|
|
44
|
+
updated_at: string;
|
|
45
|
+
id: string;
|
|
46
|
+
kind: string;
|
|
47
|
+
data: {
|
|
48
|
+
description: {
|
|
49
|
+
[key: string]: string;
|
|
50
|
+
};
|
|
51
|
+
position: number;
|
|
52
|
+
};
|
|
53
|
+
parent: string;
|
|
54
|
+
} | undefined)[];
|
|
55
|
+
};
|
|
56
|
+
reaction_counts: {
|
|
57
|
+
like: number;
|
|
58
|
+
reply: number;
|
|
59
|
+
'poll-option': number;
|
|
60
|
+
};
|
|
61
|
+
own_reactions: {
|
|
62
|
+
like: never[];
|
|
63
|
+
reply: never[];
|
|
64
|
+
'poll-option': never[];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import type { FlatActivityEnriched } from 'getstream';
|
|
2
2
|
import type { IEnrichedUrlData } from '../../../navigation/enriched-url';
|
|
3
|
+
import { ResultsVisibility } from '../../../polls/poll';
|
|
4
|
+
export declare enum ActivityType {
|
|
5
|
+
Post = "post",
|
|
6
|
+
Poll = "poll"
|
|
7
|
+
}
|
|
3
8
|
export interface IActivity extends FlatActivityEnriched {
|
|
4
9
|
content: string;
|
|
5
10
|
categories?: string[];
|
|
6
11
|
feed_id?: string;
|
|
7
|
-
title: string
|
|
12
|
+
title: string | {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
8
15
|
total_replies?: number;
|
|
9
16
|
total_likes?: number;
|
|
10
17
|
additional_data?: {
|
|
11
18
|
link?: IEnrichedUrlData | false | undefined;
|
|
12
19
|
};
|
|
20
|
+
settings?: {
|
|
21
|
+
show_remove_vote?: boolean;
|
|
22
|
+
allow_multiple_votes?: boolean;
|
|
23
|
+
deadline_at?: string;
|
|
24
|
+
hide_participants?: boolean;
|
|
25
|
+
number_of_winners?: number;
|
|
26
|
+
results_visibility?: ResultsVisibility;
|
|
27
|
+
};
|
|
13
28
|
}
|