@apolitical/component-library 4.7.5 → 4.7.7-SW.0

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.
Files changed (27) hide show
  1. package/discussion/components/post/post.d.ts +9 -1
  2. package/discussion/feeds/activities-feed/activities-feed.d.ts +2 -0
  3. package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +2 -0
  4. package/discussion/feeds/activities-feed/cache/hooks/pin/index.d.ts +1 -0
  5. package/discussion/feeds/activities-feed/cache/hooks/pin/pin.hook.d.ts +7 -0
  6. package/discussion/feeds/activities-feed/cache/hooks/unpin/index.d.ts +1 -0
  7. package/discussion/feeds/activities-feed/cache/hooks/unpin/unpin.hook.d.ts +8 -0
  8. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +36 -3
  9. package/discussion/sections/activity-section/activity-section.d.ts +1 -0
  10. package/discussion/sections/activity-section/cache/hooks/index.d.ts +2 -0
  11. package/discussion/sections/activity-section/cache/hooks/pin/index.d.ts +1 -0
  12. package/discussion/sections/activity-section/cache/hooks/pin/pin.hook.d.ts +8 -0
  13. package/discussion/sections/activity-section/cache/hooks/unpin/index.d.ts +1 -0
  14. package/discussion/sections/activity-section/cache/hooks/unpin/unpin.hook.d.ts +8 -0
  15. package/discussion/shared/helpers/activity.helper.d.ts +2 -0
  16. package/discussion/shared/mocks/reaction.mock.d.ts +20 -0
  17. package/helpers/intl.d.ts +2 -0
  18. package/index.js +51 -51
  19. package/index.mjs +8777 -8630
  20. package/navigation/tabs/tabs.d.ts +6 -0
  21. package/navigation/tabs/tabs.mocks.d.ts +11 -0
  22. package/package.json +1 -1
  23. package/sections/edit-section/edit-section.d.ts +3 -1
  24. package/style.css +1 -1
  25. package/styles/base/buttons/_icons.scss +3 -1
  26. package/styles/variables/colors/theme/_discussion.scss +2 -0
  27. package/styles/variables/colors/theme/_text.scss +1 -1
@@ -12,6 +12,8 @@ interface Props {
12
12
  content: PostContent;
13
13
  /** If the user has permission to interact with the post box and content, e.g. if they're a member of the community */
14
14
  userHasPermissions?: boolean;
15
+ /** If the user has owner permissions, e.g. if they're a community owner */
16
+ userHasOwnerPermissions?: boolean;
15
17
  /** If the post is still loading */
16
18
  isLoading?: boolean;
17
19
  /** The ID of the original post author, for threads */
@@ -44,6 +46,12 @@ interface Props {
44
46
  /** Function to call when clicking mention fallback */
45
47
  clickMentionFallback: ClickMentionFallback;
46
48
  };
49
+ pins?: {
50
+ /** Pin the post */
51
+ createPin?: () => void;
52
+ /** Unpin the post */
53
+ deletePin?: () => void;
54
+ };
47
55
  };
48
56
  /** Optional `href`s for the card to link to */
49
57
  links?: {
@@ -70,5 +78,5 @@ interface Props {
70
78
  /** If the post is used within a community */
71
79
  isCommunity?: boolean;
72
80
  }
73
- declare const Post: ({ element, content, userHasPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, }: Props) => import("react/jsx-runtime").JSX.Element;
81
+ declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, }: Props) => import("react/jsx-runtime").JSX.Element;
74
82
  export default Post;
@@ -9,6 +9,8 @@ interface Props {
9
9
  parentId: string;
10
10
  /** Whether the user is a member of the community */
11
11
  isMember: boolean;
12
+ /** Whether the user is an owner of the community */
13
+ isOwner: boolean;
12
14
  /** Functions for the activities query */
13
15
  functions: {
14
16
  /** Query functions for the activities */
@@ -3,5 +3,7 @@ export * from './edit';
3
3
  export * from './feed';
4
4
  export * from './like';
5
5
  export * from './list';
6
+ export * from './pin';
6
7
  export * from './remove';
7
8
  export * from './unlike';
9
+ export * from './unpin';
@@ -0,0 +1 @@
1
+ export * from './pin.hook';
@@ -0,0 +1,7 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache, ICacheSubitem } from '../..';
3
+ interface IPinVars {
4
+ activityId: string;
5
+ }
6
+ export declare function usePinActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, }: IMutationContext<ICacheSubitem, Error, IPinVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, IPinVars, ICache>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export * from './unpin.hook';
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache } from '../..';
3
+ interface IUnpinVars {
4
+ activityId: string;
5
+ reactionId?: string;
6
+ }
7
+ export declare function useUnpinActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IUnpinVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnpinVars, ICache>;
8
+ export {};
@@ -15,13 +15,40 @@ export declare const activitiesFeedMock: {
15
15
  feed_id: string;
16
16
  foreign_id: string;
17
17
  id: string;
18
- latest_reactions: {};
18
+ latest_reactions: {
19
+ pin: {
20
+ created_at: string;
21
+ updated_at: string;
22
+ id: string;
23
+ user_id: string;
24
+ user: {
25
+ created_at: string;
26
+ updated_at: string;
27
+ id: string;
28
+ data: {
29
+ jobTitle: string;
30
+ name: string;
31
+ organization: string;
32
+ thumbnail: string;
33
+ };
34
+ };
35
+ kind: string;
36
+ activity_id: string;
37
+ data: {
38
+ mentioned_users: null;
39
+ };
40
+ parent: string;
41
+ latest_children: {};
42
+ children_counts: {};
43
+ }[];
44
+ };
19
45
  latest_reactions_extra: {};
20
46
  object: string;
21
47
  origin: null;
22
48
  own_reactions: {};
23
49
  reaction_counts: {
24
50
  like: number;
51
+ pin: number;
25
52
  };
26
53
  target: string;
27
54
  time: string;
@@ -42,13 +69,16 @@ export declare const activitiesFeedMock: {
42
69
  feed_id: string;
43
70
  foreign_id: string;
44
71
  id: string;
45
- latest_reactions: {};
72
+ latest_reactions: {
73
+ pin?: undefined;
74
+ };
46
75
  latest_reactions_extra: {};
47
76
  object: string;
48
77
  origin: null;
49
78
  own_reactions: {};
50
79
  reaction_counts: {
51
80
  like?: undefined;
81
+ pin?: undefined;
52
82
  };
53
83
  target: string;
54
84
  time: string;
@@ -68,13 +98,16 @@ export declare const activitiesFeedMock: {
68
98
  feed_id: string;
69
99
  foreign_id: string;
70
100
  id: string;
71
- latest_reactions: {};
101
+ latest_reactions: {
102
+ pin?: undefined;
103
+ };
72
104
  latest_reactions_extra: {};
73
105
  object: string;
74
106
  origin: null;
75
107
  own_reactions: {};
76
108
  reaction_counts: {
77
109
  like?: undefined;
110
+ pin?: undefined;
78
111
  };
79
112
  target: string;
80
113
  time: string;
@@ -11,6 +11,7 @@ interface Props {
11
11
  parentId: string;
12
12
  activityId: string;
13
13
  isMember: boolean;
14
+ isOwner: boolean;
14
15
  functions: {
15
16
  activities: IActivitySectionQueryFns;
16
17
  reactions: IRepliesFeedQueryFns;
@@ -3,3 +3,5 @@ export * from './read';
3
3
  export * from './section';
4
4
  export * from './like';
5
5
  export * from './unlike';
6
+ export * from './pin';
7
+ export * from './unpin';
@@ -0,0 +1 @@
1
+ export * from './pin.hook';
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache, ICacheSubitem } from '../..';
3
+ interface IPinVars {
4
+ activityId: string;
5
+ reactionId?: string;
6
+ }
7
+ export declare function usePinActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, queryClient, queryKey, }: IMutationContext<ICacheSubitem, Error, IPinVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, IPinVars, import('../../../../../../discussion/shared').IActivity>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export * from './unpin.hook';
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache } from '../..';
3
+ interface IUnpinVars {
4
+ activityId: string;
5
+ reactionId?: string;
6
+ }
7
+ export declare function useUnpinActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError }, user, }: IMutationContext<unknown, Error, IUnpinVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnpinVars, import('../../../../../../discussion/shared').IActivity>;
8
+ export {};
@@ -27,4 +27,6 @@ export declare function prepareActivity({ title, content }: IPrepareActivityArgs
27
27
  export declare function enrichActivity({ activity, user }: IEnrichActivityArgs): IActivity;
28
28
  export declare function incrementActivityLikes({ activity, reaction, }: IIncrementActivityLikesArgs): void;
29
29
  export declare function decrementActivityLikes({ activity, user }: IDecrementActivityLikesArgs): void;
30
+ export declare function incrementActivityPins({ activity, reaction, }: IIncrementActivityLikesArgs): void;
31
+ export declare function decrementActivityPins({ activity }: IDecrementActivityLikesArgs): void;
30
32
  export {};
@@ -18,3 +18,23 @@ export declare const reactionMock1: Readonly<{
18
18
  updated_at: string;
19
19
  };
20
20
  }>;
21
+ export declare const reactionMock2: Readonly<{
22
+ id: "some-reaction-id-1";
23
+ activity_id: "some-activity-id-1";
24
+ kind: "pin";
25
+ created_at: "2023-11-24T17:58:36.162000";
26
+ data: {};
27
+ parent: "";
28
+ updated_at: "2023-11-24T17:58:36.162000";
29
+ user_id: "some-user-id-2";
30
+ children_counts: {};
31
+ latest_children: {};
32
+ latest_children_extra: {};
33
+ own_children: {};
34
+ user: {
35
+ id: "some-user-id-2";
36
+ data: {};
37
+ created_at: string;
38
+ updated_at: string;
39
+ };
40
+ }>;
package/helpers/intl.d.ts CHANGED
@@ -152,6 +152,8 @@ export declare const checkIntlPathExists: (path: string, language?: {
152
152
  discussion_likes_show: string;
153
153
  discussion_moreMenu_edit: string;
154
154
  discussion_moreMenu_delete: string;
155
+ discussion_moreMenu_pin: string;
156
+ discussion_moreMenu_unpin: string;
155
157
  discussion_moreMenu_report: string;
156
158
  discussion_comments_screenReader: string;
157
159
  discussion_comments: string;