@apolitical/component-library 8.7.16 → 8.7.17
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/constants/cookie.d.ts +1 -0
- package/constants/index.d.ts +1 -0
- package/discussion/components/form/form.helpers.d.ts +1 -1
- package/discussion/feeds/activities-feed/cache/hooks/create-poll/create-poll.hook.d.ts +4 -6
- package/discussion/shared/helpers/activity.helper.d.ts +12 -18
- package/discussion/shared/helpers/poll.helper.d.ts +3 -7
- package/discussion/shared/helpers/reaction.helper.d.ts +2 -6
- package/helpers/get-cookie.d.ts +1 -0
- package/helpers/index.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/use-locale.d.ts +2 -0
- package/index.js +124 -124
- package/index.mjs +9557 -9535
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const APOLITICAL_LOCALE_COOKIE = "apolitical_locale";
|
package/constants/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IFormValues } from '../../../form';
|
|
2
2
|
import type { IRTEValues } from './form.type';
|
|
3
3
|
import type { ITransformedPollData } from './../../shared';
|
|
4
|
-
export declare const transformPollData: (data: IRTEValues & IFormValues) => ITransformedPollData;
|
|
4
|
+
export declare const transformPollData: (data: IRTEValues & IFormValues, locale: string) => ITransformedPollData;
|
|
@@ -2,14 +2,11 @@ import type { IMutationContext } from '../../../../../../discussion/shared';
|
|
|
2
2
|
import type { ICache, ICacheItem } from '../..';
|
|
3
3
|
import { ResultsVisibility } from '../../../../../../polls';
|
|
4
4
|
export interface ICreatePollVars {
|
|
5
|
-
title:
|
|
6
|
-
[key: string]: string;
|
|
7
|
-
};
|
|
5
|
+
title: string;
|
|
8
6
|
options: {
|
|
9
7
|
position: number;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
8
|
+
body: string;
|
|
9
|
+
locale: string;
|
|
13
10
|
}[];
|
|
14
11
|
settings: {
|
|
15
12
|
show_remove_vote?: boolean;
|
|
@@ -19,5 +16,6 @@ export interface ICreatePollVars {
|
|
|
19
16
|
number_of_winners?: number;
|
|
20
17
|
results_visibility?: ResultsVisibility;
|
|
21
18
|
};
|
|
19
|
+
locale: string;
|
|
22
20
|
}
|
|
23
21
|
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").UseMutateAsyncFunction<import('../../../../../../discussion/shared').IActivity, Error, ICreatePollVars, ICache>;
|
|
@@ -8,16 +8,14 @@ interface IPrepareActivityArgs {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
content?: string;
|
|
10
10
|
categories?: string;
|
|
11
|
+
locale?: string;
|
|
11
12
|
}
|
|
12
13
|
interface IPreparePollActivityArgs {
|
|
13
|
-
title?:
|
|
14
|
-
[key: string]: string;
|
|
15
|
-
};
|
|
14
|
+
title?: string;
|
|
16
15
|
options: {
|
|
17
16
|
position: number;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
17
|
+
body: string;
|
|
18
|
+
locale: string;
|
|
21
19
|
}[];
|
|
22
20
|
settings: {
|
|
23
21
|
show_remove_vote?: boolean;
|
|
@@ -33,14 +31,14 @@ interface IPreparePollActivityArgs {
|
|
|
33
31
|
interface IEnrichActivityArgs {
|
|
34
32
|
activity: IActivity | Partial<IActivity>;
|
|
35
33
|
user: IUserContext;
|
|
34
|
+
vars?: IPrepareActivityArgs;
|
|
36
35
|
}
|
|
37
36
|
interface IEnrichPollActivityArgs {
|
|
38
37
|
activity: IActivity | Partial<IActivity>;
|
|
39
38
|
options: {
|
|
40
39
|
position: number;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
40
|
+
body: string;
|
|
41
|
+
locale: string;
|
|
44
42
|
}[];
|
|
45
43
|
user: IUserContext;
|
|
46
44
|
}
|
|
@@ -53,7 +51,7 @@ interface IDecrementActivityLikesArgs {
|
|
|
53
51
|
activity: IActivity;
|
|
54
52
|
user?: IUserContext;
|
|
55
53
|
}
|
|
56
|
-
export declare function prepareActivity({ title, content, categories }: IPrepareActivityArgs): {
|
|
54
|
+
export declare function prepareActivity({ title, content, categories, locale, }: IPrepareActivityArgs): {
|
|
57
55
|
title: string | undefined;
|
|
58
56
|
content: string | undefined;
|
|
59
57
|
payload: {
|
|
@@ -61,7 +59,7 @@ export declare function prepareActivity({ title, content, categories }: IPrepare
|
|
|
61
59
|
original: {
|
|
62
60
|
title: string | undefined;
|
|
63
61
|
body: string | undefined;
|
|
64
|
-
locale: string;
|
|
62
|
+
locale: string | undefined;
|
|
65
63
|
};
|
|
66
64
|
translations: {};
|
|
67
65
|
};
|
|
@@ -72,16 +70,12 @@ export declare function prepareActivity({ title, content, categories }: IPrepare
|
|
|
72
70
|
verb: ActivityType;
|
|
73
71
|
};
|
|
74
72
|
export declare function preparePollActivity({ title, options, settings, user, correctActivityId, }: IPreparePollActivityArgs): {
|
|
75
|
-
title:
|
|
76
|
-
[key: string]: string;
|
|
77
|
-
} | undefined;
|
|
73
|
+
title: string | undefined;
|
|
78
74
|
content: string;
|
|
79
75
|
payload: {
|
|
80
76
|
data: {
|
|
81
77
|
original: {
|
|
82
|
-
title:
|
|
83
|
-
[key: string]: string;
|
|
84
|
-
} | undefined;
|
|
78
|
+
title: string | undefined;
|
|
85
79
|
locale: string;
|
|
86
80
|
};
|
|
87
81
|
};
|
|
@@ -90,7 +84,7 @@ export declare function preparePollActivity({ title, options, settings, user, co
|
|
|
90
84
|
time: string;
|
|
91
85
|
verb: ActivityType;
|
|
92
86
|
};
|
|
93
|
-
export declare function enrichActivity({ activity, user }: IEnrichActivityArgs): IActivity;
|
|
87
|
+
export declare function enrichActivity({ activity, user, vars }: IEnrichActivityArgs): IActivity;
|
|
94
88
|
export declare function enrichPollActivity({ activity, options, user }: IEnrichPollActivityArgs): IActivity;
|
|
95
89
|
export declare function incrementActivityLikes({ activity, reaction, }: IIncrementActivityLikesArgs): void;
|
|
96
90
|
export declare function decrementActivityLikes({ activity, user }: IDecrementActivityLikesArgs): void;
|
|
@@ -10,9 +10,8 @@ interface IPreparePollVoteArgs {
|
|
|
10
10
|
interface IPreparePollOptionArgs {
|
|
11
11
|
id?: string;
|
|
12
12
|
position: number;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
13
|
+
body: string;
|
|
14
|
+
locale: string;
|
|
16
15
|
user?: IUserContext;
|
|
17
16
|
}
|
|
18
17
|
interface IEnrichPollArgs {
|
|
@@ -31,15 +30,12 @@ export declare function preparePollVote({ activity, reactionId, user }: IPrepare
|
|
|
31
30
|
export declare function enrichPollVote({ activity, reactionId, correctReactionId, user, }: IEnrichPollVoteArgs): void;
|
|
32
31
|
export declare function removePollVote({ activity, reactionId }: IRemovePollVoteArgs): void;
|
|
33
32
|
export declare function enrichPoll({ activity, activityId }: IEnrichPollArgs): void;
|
|
34
|
-
export declare function preparePollOption({ id, position,
|
|
33
|
+
export declare function preparePollOption({ id, position, body, locale }: IPreparePollOptionArgs, user?: IUserContext): {
|
|
35
34
|
created_at: string;
|
|
36
35
|
updated_at: string;
|
|
37
36
|
id: string;
|
|
38
37
|
kind: string;
|
|
39
38
|
data: {
|
|
40
|
-
description: {
|
|
41
|
-
[key: string]: string;
|
|
42
|
-
};
|
|
43
39
|
payload: {
|
|
44
40
|
data: {
|
|
45
41
|
original: {
|
|
@@ -33,9 +33,8 @@ export declare function buildEmptyReactionsForReply(): {
|
|
|
33
33
|
export declare function buildReactionsForPollActivity(options: {
|
|
34
34
|
id?: string;
|
|
35
35
|
position: number;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
36
|
+
body: string;
|
|
37
|
+
locale: string;
|
|
39
38
|
}[], user: IUserContext): {
|
|
40
39
|
latest_reactions: {
|
|
41
40
|
like: never[];
|
|
@@ -46,9 +45,6 @@ export declare function buildReactionsForPollActivity(options: {
|
|
|
46
45
|
id: string;
|
|
47
46
|
kind: string;
|
|
48
47
|
data: {
|
|
49
|
-
description: {
|
|
50
|
-
[key: string]: string;
|
|
51
|
-
};
|
|
52
48
|
payload: {
|
|
53
49
|
data: {
|
|
54
50
|
original: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCookie(name: string): string | null;
|
package/helpers/index.d.ts
CHANGED
package/hooks/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './use-auto-resize';
|
|
|
2
2
|
export { default as useCurrentPath } from './use-current-path';
|
|
3
3
|
export { default as useEffectAfterMount } from './use-effect-after-mount';
|
|
4
4
|
export { default as useElementWidth } from './use-element-width';
|
|
5
|
+
export { default as useLocale } from './use-locale';
|
|
5
6
|
export { default as useHomepagePath } from './use-homepage-path';
|
|
6
7
|
export { default as useScrollListener } from './use-scroll-listener';
|
|
7
8
|
export { default as useScrollToHash } from './use-scroll-to-hash';
|