@apolitical/component-library 8.7.21 → 8.7.22
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/post/post.d.ts +24 -1
- package/discussion/feeds/activities-feed/activities-feed.d.ts +14 -0
- package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +23 -1
- package/discussion/sections/activity-section/activity-section.d.ts +9 -0
- package/discussion/sections/activity-section/activity-section.mock.d.ts +7 -0
- package/discussion/sections/activity-section/mocks/activity-functions.mock.d.ts +3 -0
- package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +11 -1
- package/discussion/shared/helpers/activity.helper.d.ts +1 -1
- package/discussion/shared/interfaces/discussion.interface.d.ts +19 -0
- package/discussion/shared/interfaces/payload.interface.d.ts +2 -0
- package/helpers/intl.d.ts +21 -0
- package/index.js +140 -140
- package/index.mjs +13773 -13578
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -14,6 +14,15 @@ export interface IPostContent extends IFullDiscussionContent {
|
|
|
14
14
|
pollOptions?: IPollProps['options'];
|
|
15
15
|
/** The settings for the Poll */
|
|
16
16
|
pollSettings?: IPollProps['settings'];
|
|
17
|
+
/** The locale of the content */
|
|
18
|
+
locale?: string;
|
|
19
|
+
/** Translation indicators for easy access */
|
|
20
|
+
translationInfo?: {
|
|
21
|
+
isOriginalPost?: boolean;
|
|
22
|
+
hasTranslation?: boolean;
|
|
23
|
+
};
|
|
24
|
+
payloadId?: string;
|
|
25
|
+
payloadCollection?: string;
|
|
17
26
|
}
|
|
18
27
|
export interface IPollFunctions extends IPollFns {
|
|
19
28
|
removePoll: (args?: object) => void;
|
|
@@ -99,6 +108,20 @@ export interface IDiscussionPostProps {
|
|
|
99
108
|
disableMentions?: boolean;
|
|
100
109
|
/** The function to call when the post is clicked */
|
|
101
110
|
onClick?: (link?: string) => void;
|
|
111
|
+
translation?: {
|
|
112
|
+
/** Whether the post is translatable - to control what gets the button */
|
|
113
|
+
isTranslatable?: boolean;
|
|
114
|
+
/** The function to call when the post should be translated */
|
|
115
|
+
onTranslate?: (args: {
|
|
116
|
+
activityId: string;
|
|
117
|
+
locale: string;
|
|
118
|
+
payloadId: string;
|
|
119
|
+
payloadCollection: string;
|
|
120
|
+
}) => Promise<{
|
|
121
|
+
title?: string | undefined;
|
|
122
|
+
body?: string | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
};
|
|
102
125
|
}
|
|
103
|
-
declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, setFocus, isCommunity, badges, basePath, parentId,
|
|
126
|
+
declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, setFocus, isCommunity, badges, basePath, parentId, disableMentions, onClick: onClickPost, translation, }: IDiscussionPostProps) => import("react/jsx-runtime").JSX.Element;
|
|
104
127
|
export default Post;
|
|
@@ -32,6 +32,20 @@ interface Props {
|
|
|
32
32
|
profile: IProfileFormProps;
|
|
33
33
|
/** The locale of the page */
|
|
34
34
|
locale?: string;
|
|
35
|
+
translation?: {
|
|
36
|
+
/** Whether the post is translatable - to control what gets the button */
|
|
37
|
+
isTranslatable?: boolean;
|
|
38
|
+
/** The function to call when the post should be translated */
|
|
39
|
+
onTranslate?: (args: {
|
|
40
|
+
activityId: string;
|
|
41
|
+
locale: string;
|
|
42
|
+
payloadId: string;
|
|
43
|
+
payloadCollection: string;
|
|
44
|
+
}) => Promise<{
|
|
45
|
+
title?: string | undefined;
|
|
46
|
+
body?: string | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
35
49
|
}
|
|
36
50
|
declare const ActivitiesFeed: React.FC<Props>;
|
|
37
51
|
export default ActivitiesFeed;
|
|
@@ -16,16 +16,18 @@ export declare const activitiesFeedMock: {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
payload: {
|
|
19
|
+
id: string;
|
|
20
|
+
collection: string;
|
|
19
21
|
data: {
|
|
20
22
|
original: {
|
|
21
23
|
title: string;
|
|
22
24
|
locale: string;
|
|
23
25
|
body: string;
|
|
24
26
|
};
|
|
27
|
+
translations?: undefined;
|
|
25
28
|
};
|
|
26
29
|
};
|
|
27
30
|
title: string;
|
|
28
|
-
categories: string[];
|
|
29
31
|
content: string;
|
|
30
32
|
feed_id: string;
|
|
31
33
|
foreign_id: string;
|
|
@@ -117,6 +119,7 @@ export declare const activitiesFeedMock: {
|
|
|
117
119
|
target: string;
|
|
118
120
|
time: string;
|
|
119
121
|
verb: string;
|
|
122
|
+
categories?: undefined;
|
|
120
123
|
} | {
|
|
121
124
|
actor: {
|
|
122
125
|
created_at: string;
|
|
@@ -134,12 +137,20 @@ export declare const activitiesFeedMock: {
|
|
|
134
137
|
};
|
|
135
138
|
};
|
|
136
139
|
payload: {
|
|
140
|
+
id: string;
|
|
141
|
+
collection: string;
|
|
137
142
|
data: {
|
|
138
143
|
original: {
|
|
139
144
|
title: string;
|
|
140
145
|
locale: string;
|
|
141
146
|
body: string;
|
|
142
147
|
};
|
|
148
|
+
translations: {
|
|
149
|
+
en: {
|
|
150
|
+
title: string;
|
|
151
|
+
body: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
143
154
|
};
|
|
144
155
|
};
|
|
145
156
|
title: string;
|
|
@@ -176,12 +187,20 @@ export declare const activitiesFeedMock: {
|
|
|
176
187
|
};
|
|
177
188
|
};
|
|
178
189
|
payload: {
|
|
190
|
+
id: string;
|
|
191
|
+
collection: string;
|
|
179
192
|
data: {
|
|
180
193
|
original: {
|
|
181
194
|
title: string;
|
|
182
195
|
locale: string;
|
|
183
196
|
body: string;
|
|
184
197
|
};
|
|
198
|
+
translations: {
|
|
199
|
+
en: {
|
|
200
|
+
title: string;
|
|
201
|
+
body: string;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
185
204
|
};
|
|
186
205
|
};
|
|
187
206
|
categories: string[];
|
|
@@ -240,12 +259,15 @@ export declare const activitiesFeedMock: {
|
|
|
240
259
|
};
|
|
241
260
|
};
|
|
242
261
|
payload: {
|
|
262
|
+
id: string;
|
|
263
|
+
collection: string;
|
|
243
264
|
data: {
|
|
244
265
|
original: {
|
|
245
266
|
title: string;
|
|
246
267
|
locale: string;
|
|
247
268
|
body: string;
|
|
248
269
|
};
|
|
270
|
+
translations?: undefined;
|
|
249
271
|
};
|
|
250
272
|
};
|
|
251
273
|
title: string;
|
|
@@ -34,6 +34,15 @@ export interface IActivitySectionProps {
|
|
|
34
34
|
id: string;
|
|
35
35
|
}[];
|
|
36
36
|
};
|
|
37
|
+
translation?: {
|
|
38
|
+
/** Whether the post is translatable - to control what gets the button */
|
|
39
|
+
isTranslatable?: boolean;
|
|
40
|
+
/** The function to call when the post should be translated */
|
|
41
|
+
onTranslate?: (args: any) => Promise<{
|
|
42
|
+
title?: string;
|
|
43
|
+
body?: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
37
46
|
}
|
|
38
47
|
declare const ActivitySection: React.FC<IActivitySectionProps>;
|
|
39
48
|
export default ActivitySection;
|
|
@@ -100,6 +100,13 @@ export declare const args: {
|
|
|
100
100
|
name: string;
|
|
101
101
|
slug: string;
|
|
102
102
|
}[];
|
|
103
|
+
translation: {
|
|
104
|
+
isTranslatable: boolean;
|
|
105
|
+
onTranslate: () => Promise<{
|
|
106
|
+
title: string;
|
|
107
|
+
body: string;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
103
110
|
};
|
|
104
111
|
export declare const argsForCourseDiscussion: {
|
|
105
112
|
basePath: string;
|
|
@@ -7,6 +7,9 @@ export declare const mockFunctions: {
|
|
|
7
7
|
unlike: jest.Mock<any, any, any>;
|
|
8
8
|
pin: jest.Mock<any, any, any>;
|
|
9
9
|
unpin: jest.Mock<any, any, any>;
|
|
10
|
+
createVote: jest.Mock<any, any, any>;
|
|
11
|
+
removeVote: jest.Mock<any, any, any>;
|
|
12
|
+
removePoll: jest.Mock<any, any, any>;
|
|
10
13
|
};
|
|
11
14
|
reactions: {
|
|
12
15
|
add: jest.Mock<any, any, any>;
|
|
@@ -19,7 +19,6 @@ export declare const activitySectionMock: {
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
categories: never[];
|
|
22
|
-
content: string;
|
|
23
22
|
feed_id: string;
|
|
24
23
|
foreign_id: string;
|
|
25
24
|
id: string;
|
|
@@ -31,6 +30,17 @@ export declare const activitySectionMock: {
|
|
|
31
30
|
like: never[];
|
|
32
31
|
reply: never[];
|
|
33
32
|
};
|
|
33
|
+
payload: {
|
|
34
|
+
id: string;
|
|
35
|
+
collection: string;
|
|
36
|
+
data: {
|
|
37
|
+
original: {
|
|
38
|
+
title: string;
|
|
39
|
+
locale: string;
|
|
40
|
+
body: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
34
44
|
object: string;
|
|
35
45
|
origin: null;
|
|
36
46
|
own_reactions: {
|
|
@@ -90,5 +90,5 @@ export declare function incrementActivityLikes({ activity, reaction, }: IIncreme
|
|
|
90
90
|
export declare function decrementActivityLikes({ activity, user }: IDecrementActivityLikesArgs): void;
|
|
91
91
|
export declare function incrementActivityPins({ activity, reaction, }: IIncrementActivityLikesArgs): void;
|
|
92
92
|
export declare function decrementActivityPins({ activity }: IDecrementActivityLikesArgs): void;
|
|
93
|
-
export declare const constructActivityContent: (activity: IActivity, categories?: ICategory[]) => IPostContent;
|
|
93
|
+
export declare const constructActivityContent: (activity: IActivity, categories?: ICategory[], currentLocale?: string) => IPostContent;
|
|
94
94
|
export {};
|
|
@@ -62,6 +62,25 @@ export interface IFullDiscussionContent extends IDiscussionContent {
|
|
|
62
62
|
mentions?: IMentions;
|
|
63
63
|
/** Link metadata, to show an enriched url for the first link in the post */
|
|
64
64
|
link?: false | IEnrichedUrlData;
|
|
65
|
+
/** Translation information for the post */
|
|
66
|
+
translationInfo?: {
|
|
67
|
+
/** Whether the post has been translated */
|
|
68
|
+
hasTranslation: boolean;
|
|
69
|
+
/** Whether this is the original post */
|
|
70
|
+
isOriginalPost: boolean;
|
|
71
|
+
/** Current title being displayed */
|
|
72
|
+
currentTitle?: string;
|
|
73
|
+
/** Current body being displayed */
|
|
74
|
+
currentBody?: string;
|
|
75
|
+
/** Original title */
|
|
76
|
+
originalTitle?: string;
|
|
77
|
+
/** Original body */
|
|
78
|
+
originalBody?: string;
|
|
79
|
+
/** Original locale */
|
|
80
|
+
originalLocale?: string;
|
|
81
|
+
/** Current locale */
|
|
82
|
+
currentLocale?: string;
|
|
83
|
+
};
|
|
65
84
|
};
|
|
66
85
|
/** If the content has been edited */
|
|
67
86
|
isEdited?: boolean;
|
package/helpers/intl.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
export declare const checkIntlPathExists: (path: string, language?: {
|
|
2
2
|
apolitical: string;
|
|
3
|
+
language_en: string;
|
|
4
|
+
language_fr: string;
|
|
5
|
+
'language_fr-CA': string;
|
|
6
|
+
language_id: string;
|
|
7
|
+
language_pt: string;
|
|
8
|
+
language_es: string;
|
|
9
|
+
'language_es-419': string;
|
|
10
|
+
language_ar: string;
|
|
11
|
+
language_pl: string;
|
|
12
|
+
language_it: string;
|
|
13
|
+
language_ja: string;
|
|
14
|
+
language_sr: string;
|
|
15
|
+
language_ko: string;
|
|
16
|
+
language_de: string;
|
|
17
|
+
language_pt_BR: string;
|
|
3
18
|
dates_now: string;
|
|
4
19
|
dates_hours: string;
|
|
5
20
|
dates_days: string;
|
|
@@ -195,6 +210,12 @@ export declare const checkIntlPathExists: (path: string, language?: {
|
|
|
195
210
|
discussion_share_copy_link_success: string;
|
|
196
211
|
discussion_thread_show: string;
|
|
197
212
|
discussion_thread_hide: string;
|
|
213
|
+
discussion_translation_seeOriginal: string;
|
|
214
|
+
discussion_translation_translate: string;
|
|
215
|
+
discussion_translation_translate_loading: string;
|
|
216
|
+
discussion_translation_translated: string;
|
|
217
|
+
discussion_translation_translate_error: string;
|
|
218
|
+
discussion_translation_coming_soon: string;
|
|
198
219
|
discussion_thread_loadMore: string;
|
|
199
220
|
profileModalLauncher_successMessage: string;
|
|
200
221
|
profileModalLauncher_title: string;
|