@apolitical/component-library 5.2.0-jc.0 → 5.2.0-jc.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.
@@ -1 +1,2 @@
1
1
  export { default as DiscussionLikes } from './likes';
2
+ export { default as LikesModal } from './likes-modal';
@@ -0,0 +1,28 @@
1
+ import { IBadgesOption } from '../../../user/badges';
2
+ import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
3
+ export interface ILikesModalProps {
4
+ /** Whether the modal is open on page load */
5
+ showModal?: boolean;
6
+ /** The number of likes */
7
+ likes?: number;
8
+ /** The ID of the activity to show likes for */
9
+ activityId: string;
10
+ /** The base path, used for slugs */
11
+ basePath: string;
12
+ /** The ID of the parent */
13
+ parentId: string;
14
+ /** Whether to show badges and the scope of the badge */
15
+ badges?: IBadgesOption;
16
+ /** Functions used inside the modal */
17
+ functions: {
18
+ likes: {
19
+ list: ILikesFeedQueryFns['list'];
20
+ };
21
+ /** Function to call when the modal is closed */
22
+ onClose?: () => void;
23
+ };
24
+ /** Additional classes */
25
+ className?: string;
26
+ }
27
+ declare const LikesModal: ({ showModal, activityId, functions: { onClose, likes: likesFns }, badges, likes, className, basePath, parentId, }: ILikesModalProps) => import("react/jsx-runtime").JSX.Element;
28
+ export default LikesModal;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { MemberProps } from '../../../user';
3
3
  import { IDiscussionContent } from './../../discussion';
4
+ import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
4
5
  interface Props {
5
6
  /** The element to render around the content */
6
7
  element?: 'li' | 'div';
@@ -16,17 +17,25 @@ interface Props {
16
17
  content?: IDiscussionContent;
17
18
  /** If the user is able to like the content */
18
19
  canLike?: boolean;
20
+ /** The ID of the activity */
21
+ activityId: string;
22
+ /** The base path, used for slugs */
23
+ basePath: string;
24
+ /** The ID of the parent, used for slugs */
25
+ parentId: string;
19
26
  /** Functions to handle liking and unliking */
20
- functions?: {
27
+ functions: {
21
28
  /** Function to create a like */
22
29
  createLike?: (args1: object) => void;
23
30
  /** Function to delete a like */
24
31
  deleteLike?: (args: object) => void;
32
+ /** Functions for the likes query */
33
+ listLikes?: ILikesFeedQueryFns['list'];
25
34
  };
26
35
  /** The language to use for the text */
27
36
  locale?: string;
28
37
  }
29
- declare const Likes: ({ element, likes, peopleWhoLiked, isShort, userLiked, content, canLike, functions: { createLike, deleteLike }, }: Props) => React.DetailedReactHTMLElement<{
38
+ declare const Likes: ({ element, likes, peopleWhoLiked, isShort, userLiked, content, canLike, activityId, basePath, parentId, functions: { createLike, deleteLike, listLikes, }, }: Props) => React.DetailedReactHTMLElement<{
30
39
  className: string;
31
40
  onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
32
41
  onMouseEnter: () => void;
@@ -0,0 +1,2 @@
1
+ import { MemberProps } from '../../../user';
2
+ export declare const peopleWhoLiked: MemberProps[];
@@ -0,0 +1,52 @@
1
+ export declare const likesResponseMock: {
2
+ results: ({
3
+ created_at: string;
4
+ updated_at: string;
5
+ id: string;
6
+ user_id: string;
7
+ user: {
8
+ id: string;
9
+ data: {
10
+ name: string;
11
+ thumbnail: string;
12
+ jobTitle: string;
13
+ organization: string;
14
+ };
15
+ created_at?: undefined;
16
+ updated_at?: undefined;
17
+ };
18
+ kind: string;
19
+ activity_id: string;
20
+ data: {
21
+ mentioned_users: null;
22
+ };
23
+ parent: string;
24
+ latest_children: {};
25
+ children_counts: {};
26
+ } | {
27
+ created_at: string;
28
+ updated_at: string;
29
+ id: string;
30
+ user_id: string;
31
+ user: {
32
+ created_at: string;
33
+ updated_at: string;
34
+ id: string;
35
+ data: {
36
+ jobTitle: string;
37
+ name: string;
38
+ organization: string;
39
+ thumbnail: string;
40
+ };
41
+ };
42
+ kind: string;
43
+ activity_id: string;
44
+ data: {
45
+ mentioned_users: null;
46
+ };
47
+ parent: string;
48
+ latest_children: {};
49
+ children_counts: {};
50
+ })[];
51
+ next: string;
52
+ };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { type ListMembers, ClickMentionFallback } from '../../../form';
3
- import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, IForceHide, IFullDiscussionContent } from '../../discussion';
2
+ import { ClickMentionFallback, type ListMembers } from '../../../form';
3
+ import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, DiscussionListLikesFunction, IForceHide, IFullDiscussionContent } from '../../discussion';
4
4
  import { IBadgesOption } from '../../../user/badges';
5
5
  interface PostContent extends IFullDiscussionContent {
6
6
  /** The post body */
@@ -36,6 +36,8 @@ interface Props {
36
36
  createLike: DiscussionCreateLikeFunction;
37
37
  /** Delete a like on the post */
38
38
  deleteLike: DiscussionDeleteLikeFunction;
39
+ /** List the likes on the post */
40
+ listLikes: DiscussionListLikesFunction;
39
41
  };
40
42
  comments: {
41
43
  /** Open comments on a post */
@@ -80,6 +82,10 @@ interface Props {
80
82
  isCommunity?: boolean;
81
83
  /** Whether to show badges and the scope of the badge */
82
84
  badges?: IBadgesOption;
85
+ /** The base path, used for slugs */
86
+ basePath: string;
87
+ /** The ID of the parent, used for slugs */
88
+ parentId: string;
83
89
  }
84
- declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, badges, }: Props) => import("react/jsx-runtime").JSX.Element;
90
+ declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, badges, basePath, parentId, }: Props) => import("react/jsx-runtime").JSX.Element;
85
91
  export default Post;
@@ -9,6 +9,58 @@ declare namespace _default {
9
9
  namespace likes {
10
10
  function createLike(): void;
11
11
  function deleteLike(): void;
12
+ function listLikes(): Promise<{
13
+ results: ({
14
+ created_at: string;
15
+ updated_at: string;
16
+ id: string;
17
+ user_id: string;
18
+ user: {
19
+ id: string;
20
+ data: {
21
+ name: string;
22
+ thumbnail: string;
23
+ jobTitle: string;
24
+ organization: string;
25
+ };
26
+ created_at?: undefined;
27
+ updated_at?: undefined;
28
+ };
29
+ kind: string;
30
+ activity_id: string;
31
+ data: {
32
+ mentioned_users: null;
33
+ };
34
+ parent: string;
35
+ latest_children: {};
36
+ children_counts: {};
37
+ } | {
38
+ created_at: string;
39
+ updated_at: string;
40
+ id: string;
41
+ user_id: string;
42
+ user: {
43
+ created_at: string;
44
+ updated_at: string;
45
+ id: string;
46
+ data: {
47
+ jobTitle: string;
48
+ name: string;
49
+ organization: string;
50
+ thumbnail: string;
51
+ };
52
+ };
53
+ kind: string;
54
+ activity_id: string;
55
+ data: {
56
+ mentioned_users: null;
57
+ };
58
+ parent: string;
59
+ latest_children: {};
60
+ children_counts: {};
61
+ })[];
62
+ next: string;
63
+ }>;
12
64
  }
13
65
  namespace comments {
14
66
  function openComments(): void;
@@ -2,6 +2,7 @@
2
2
  import { type IProfileFormProps } from '../../../form';
3
3
  import type { IMentionsFns } from '../../../discussion/discussion.d';
4
4
  import type { IQueryFns } from './cache';
5
+ import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
5
6
  interface Props {
6
7
  /** The base path, used for slugs */
7
8
  basePath: string;
@@ -21,6 +22,7 @@ interface Props {
21
22
  join: () => Promise<void>;
22
23
  /** Function to leave the community */
23
24
  leave: () => Promise<void>;
25
+ likes: ILikesFeedQueryFns;
24
26
  };
25
27
  /** Props to pass into the profile form */
26
28
  profile: IProfileFormProps;
@@ -46,6 +46,55 @@ export declare const activitiesFeedMock: {
46
46
  latest_children: {};
47
47
  children_counts: {};
48
48
  }[];
49
+ like: ({
50
+ created_at: string;
51
+ updated_at: string;
52
+ id: string;
53
+ user_id: string;
54
+ user: {
55
+ id: string;
56
+ data: {
57
+ name: string;
58
+ thumbnail: string;
59
+ jobTitle: string;
60
+ organization: string;
61
+ };
62
+ created_at?: undefined;
63
+ updated_at?: undefined;
64
+ };
65
+ kind: string;
66
+ activity_id: string;
67
+ data: {
68
+ mentioned_users: null;
69
+ };
70
+ parent: string;
71
+ latest_children: {};
72
+ children_counts: {};
73
+ } | {
74
+ created_at: string;
75
+ updated_at: string;
76
+ id: string;
77
+ user_id: string;
78
+ user: {
79
+ created_at: string;
80
+ updated_at: string;
81
+ id: string;
82
+ data: {
83
+ jobTitle: string;
84
+ name: string;
85
+ organization: string;
86
+ thumbnail: string;
87
+ };
88
+ };
89
+ kind: string;
90
+ activity_id: string;
91
+ data: {
92
+ mentioned_users: null;
93
+ };
94
+ parent: string;
95
+ latest_children: {};
96
+ children_counts: {};
97
+ })[];
49
98
  };
50
99
  latest_reactions_extra: {};
51
100
  object: string;
@@ -81,6 +130,7 @@ export declare const activitiesFeedMock: {
81
130
  id: string;
82
131
  latest_reactions: {
83
132
  pin?: undefined;
133
+ like?: undefined;
84
134
  };
85
135
  latest_reactions_extra: {};
86
136
  object: string;
@@ -110,6 +160,29 @@ export declare const activitiesFeedMock: {
110
160
  foreign_id: string;
111
161
  id: string;
112
162
  latest_reactions: {
163
+ like: {
164
+ created_at: string;
165
+ updated_at: string;
166
+ id: string;
167
+ user_id: string;
168
+ user: {
169
+ id: string;
170
+ data: {
171
+ name: string;
172
+ thumbnail: string;
173
+ jobTitle: string;
174
+ organization: string;
175
+ };
176
+ };
177
+ kind: string;
178
+ activity_id: string;
179
+ data: {
180
+ mentioned_users: null;
181
+ };
182
+ parent: string;
183
+ latest_children: {};
184
+ children_counts: {};
185
+ }[];
113
186
  pin?: undefined;
114
187
  };
115
188
  latest_reactions_extra: {};
@@ -117,7 +190,7 @@ export declare const activitiesFeedMock: {
117
190
  origin: null;
118
191
  own_reactions: {};
119
192
  reaction_counts: {
120
- like?: undefined;
193
+ like: number;
121
194
  pin?: undefined;
122
195
  };
123
196
  target: string;
@@ -143,6 +216,7 @@ export declare const activitiesFeedMock: {
143
216
  id: string;
144
217
  latest_reactions: {
145
218
  pin?: undefined;
219
+ like?: undefined;
146
220
  };
147
221
  latest_reactions_extra: {};
148
222
  object: string;
@@ -1,7 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import type { IMentionsFns } from '../../../../discussion/discussion.d';
3
3
  import type { IQueryFns } from './../cache';
4
- interface NestedRepliesFunctions extends IQueryFns, IMentionsFns {
4
+ import { ILikesFeedQueryFns } from '../../../../discussion/feeds/likes-feed';
5
+ interface NestedRepliesFunctions {
6
+ /** Functions for the replies query */
7
+ reactions: IQueryFns;
8
+ mentions: IMentionsFns;
9
+ /** Functions for the likes query */
10
+ likes: ILikesFeedQueryFns;
5
11
  }
6
12
  interface Props {
7
13
  /** The base path, used for slugs */
@@ -2,6 +2,19 @@
2
2
  import { type IProfileFormProps } from '../../../form';
3
3
  import type { IMentionsFns } from './../../discussion';
4
4
  import { type IQueryFns } from './cache';
5
+ import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
6
+ interface RepliesFunctions {
7
+ /** Functions for the replies query */
8
+ reactions: IQueryFns;
9
+ /** Functions for the likes query */
10
+ likes: ILikesFeedQueryFns;
11
+ /** Query functions for the mentions */
12
+ mentions: IMentionsFns;
13
+ /** Function to join the community */
14
+ join: () => Promise<void>;
15
+ /** Function to leave the community */
16
+ leave: () => Promise<void>;
17
+ }
5
18
  interface Props {
6
19
  /** The base path, used for slugs */
7
20
  basePath: string;
@@ -14,16 +27,7 @@ interface Props {
14
27
  /** Whether the user is a member of the community */
15
28
  isMember: boolean;
16
29
  /** Functions for the replies query */
17
- functions: {
18
- /** Query functions for the replies */
19
- reactions: IQueryFns;
20
- /** Query functions for the mentions */
21
- mentions: IMentionsFns;
22
- /** Function to join the community */
23
- join: () => Promise<void>;
24
- /** Function to leave the community */
25
- leave: () => Promise<void>;
26
- };
30
+ functions: RepliesFunctions;
27
31
  /** Props to pass into the profile form */
28
32
  profile: IProfileFormProps;
29
33
  }
@@ -3,6 +3,7 @@ import { type IProfileFormProps } from '../../../form';
3
3
  import { type IRepliesFeedQueryFns } from '../../../discussion/feeds';
4
4
  import type { IMentionsFns } from './../../discussion.d';
5
5
  import { type IQueryFns } from './cache';
6
+ import { ILikesFeedQueryFns } from '../../../discussion/feeds/likes-feed';
6
7
  interface IActivitySectionQueryFns extends IQueryFns {
7
8
  remove: () => Promise<void>;
8
9
  }
@@ -15,6 +16,7 @@ export interface IActivitySectionProps {
15
16
  functions: {
16
17
  activities: IActivitySectionQueryFns;
17
18
  reactions: IRepliesFeedQueryFns;
19
+ likes: ILikesFeedQueryFns;
18
20
  mentions: IMentionsFns;
19
21
  join: () => Promise<void>;
20
22
  leave: () => Promise<void>;
@@ -12,8 +12,8 @@ export default function transform<T extends InputNodeTypes>(node: MdastNode, opt
12
12
  position?: any;
13
13
  ordered?: boolean | undefined;
14
14
  checked?: any;
15
- depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
16
15
  lang?: string | undefined;
16
+ depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
17
17
  spread?: any;
18
18
  indent?: any;
19
19
  text: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ export interface ILinkProps {
3
3
  /** URL for link */
4
4
  href?: string | undefined;
5
5
  /** Content to rendered */
@@ -33,5 +33,5 @@ interface Props {
33
33
  /** Data attributes for the link */
34
34
  'data-before'?: string;
35
35
  }
36
- declare const Link: ({ href, children, fallbackElement, className, onClick, gtmContext, gtmType, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
36
+ declare const Link: ({ href, children, fallbackElement, className, onClick, gtmContext, gtmType, ...props }: ILinkProps) => import("react/jsx-runtime").JSX.Element;
37
37
  export default Link;
package/helpers/intl.d.ts CHANGED
@@ -154,7 +154,7 @@ export declare const checkIntlPathExists: (path: string, language?: {
154
154
  discussion_form_explainer_question: string;
155
155
  discussion_likes: string;
156
156
  discussion_likes_short: string;
157
- discussion_likes_more: string;
157
+ discussion_likes_showAll: string;
158
158
  discussion_likes_like: string;
159
159
  discussion_likes_unlike: string;
160
160
  discussion_likes_show: string;