@apolitical/component-library 1.16.0-4186.18 → 1.16.0-4186.49

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 (46) hide show
  1. package/communities/members-list/members-list.d.ts +7 -6
  2. package/context/user/user.context.d.ts +1 -1
  3. package/context/user/user.hook.d.ts +1 -1
  4. package/context/user/user.provider.d.ts +1 -1
  5. package/discussion/feeds/activities-feed/activities-feed.d.ts +1 -1
  6. package/discussion/feeds/activities-feed/cache/handlers/error.handler.d.ts +2 -0
  7. package/discussion/feeds/activities-feed/cache/handlers/index.d.ts +2 -0
  8. package/discussion/feeds/activities-feed/cache/handlers/mutate.handler.d.ts +2 -0
  9. package/discussion/feeds/activities-feed/cache/helpers/activity.helper.d.ts +21 -0
  10. package/discussion/feeds/activities-feed/cache/helpers/cache.helper.d.ts +4 -0
  11. package/discussion/feeds/activities-feed/cache/helpers/context.helper.d.ts +2 -0
  12. package/discussion/feeds/activities-feed/cache/helpers/index.d.ts +3 -0
  13. package/discussion/feeds/activities-feed/cache/hooks/create/create.hook.d.ts +6 -0
  14. package/discussion/feeds/activities-feed/cache/hooks/create/index.d.ts +1 -0
  15. package/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +7 -0
  16. package/discussion/feeds/activities-feed/cache/hooks/edit/index.d.ts +1 -0
  17. package/discussion/feeds/activities-feed/cache/hooks/feed/index.d.ts +1 -0
  18. package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +7 -0
  19. package/discussion/feeds/activities-feed/cache/hooks/like/index.d.ts +1 -0
  20. package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +7 -0
  21. package/discussion/feeds/activities-feed/cache/hooks/list/index.d.ts +1 -0
  22. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +7 -0
  23. package/discussion/feeds/activities-feed/cache/hooks/remove/index.d.ts +1 -0
  24. package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +6 -0
  25. package/discussion/feeds/activities-feed/cache/hooks/unlike/index.d.ts +1 -0
  26. package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +7 -0
  27. package/discussion/feeds/activities-feed/cache/index.d.ts +3 -0
  28. package/discussion/feeds/activities-feed/cache/interfaces/cache.interface.d.ts +4 -0
  29. package/discussion/feeds/activities-feed/cache/interfaces/handler.interface.d.ts +4 -0
  30. package/discussion/feeds/activities-feed/cache/interfaces/index.d.ts +4 -0
  31. package/discussion/feeds/activities-feed/cache/interfaces/mutation.interface.d.ts +12 -0
  32. package/discussion/feeds/activities-feed/cache/interfaces/query.interface.d.ts +9 -0
  33. package/discussion/feeds/activities-feed/cache/mocks/activity.mock.d.ts +44 -0
  34. package/discussion/feeds/activities-feed/cache/mocks/cache.mock.d.ts +4 -0
  35. package/discussion/feeds/activities-feed/cache/mocks/context.mock.d.ts +9 -0
  36. package/discussion/feeds/activities-feed/cache/mocks/index.d.ts +5 -0
  37. package/discussion/feeds/activities-feed/cache/mocks/reaction.mock.d.ts +20 -0
  38. package/discussion/feeds/activities-feed/cache/mocks/user.mock.d.ts +20 -0
  39. package/discussion/feeds/replies-feed/replies-feed.handlers.d.ts +1 -1
  40. package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.handlers.d.ts +1 -1
  41. package/discussion/sections/activity-section/activity-section.handlers.d.ts +1 -1
  42. package/index.js +14 -14
  43. package/index.mjs +1965 -1871
  44. package/package.json +1 -1
  45. package/discussion/feeds/activities-feed/activities-feed.helpers.d.ts +0 -51
  46. package/discussion/feeds/activities-feed/activities-feed.hooks.d.ts +0 -34
@@ -1,4 +1,3 @@
1
- import { PaginationType } from '../../navigation';
2
1
  import { MemberDetailsProps } from '../../user';
3
2
  interface CommunityMemberProps extends MemberDetailsProps {
4
3
  /** Whether the user is an admin of the community or not */
@@ -7,11 +6,13 @@ interface CommunityMemberProps extends MemberDetailsProps {
7
6
  interface Props {
8
7
  /** Details about members in the community */
9
8
  members: {
10
- total?: number | undefined;
11
- data?: CommunityMemberProps[];
9
+ data: CommunityMemberProps[];
10
+ total?: number;
12
11
  };
13
- /** Details for the pagination */
14
- pagination?: PaginationType;
12
+ /** Whether there is another page of members to load */
13
+ hasNextPage?: boolean;
14
+ /** Function to load the next page of members */
15
+ loadNextPage?: () => void;
15
16
  /** The GTM context to use */
16
17
  gtmContext?: string;
17
18
  /** The GTM event to use */
@@ -19,5 +20,5 @@ interface Props {
19
20
  /** Additional classes */
20
21
  className?: string;
21
22
  }
22
- declare const MembersList: ({ members: { total, data: members }, pagination, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
23
+ declare const MembersList: ({ members: { data, total }, hasNextPage, loadNextPage, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
23
24
  export default MembersList;
@@ -11,4 +11,4 @@ export interface IUserDetails {
11
11
  export interface IUserContext extends IUserDetails {
12
12
  isLoading: boolean;
13
13
  }
14
- export declare const UserContext: import("react").Context<IUserContext | null>;
14
+ export declare const UserContext: import("react").Context<IUserContext>;
@@ -1 +1 @@
1
- export declare function useUser(): import("./user.context").IUserContext | null;
1
+ export declare function useUser(): import("./user.context").IUserContext;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { IUserContext } from './user.context';
3
3
  interface Props {
4
4
  children: React.ReactNode;
5
- user: IUserContext | null;
5
+ user: IUserContext;
6
6
  }
7
7
  export declare const UserProvider: ({ children, user }: Props) => import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -4,7 +4,7 @@ interface Props {
4
4
  parentId: string;
5
5
  isMember: boolean;
6
6
  functions: {
7
- create: () => Promise<void>;
7
+ create: (_: unknown) => Promise<void>;
8
8
  edit: (_: unknown) => Promise<void>;
9
9
  join: () => Promise<void>;
10
10
  leave: () => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { IHandlerContext, IQueryContext } from '../interfaces';
2
+ export declare function buildErrorHandler({ queryClient, queryKey }: IQueryContext): (_1: Error, _2: unknown, context?: IHandlerContext) => void;
@@ -0,0 +1,2 @@
1
+ export * from './error.handler';
2
+ export * from './mutate.handler';
@@ -0,0 +1,2 @@
1
+ import type { ICacheItems, IHandlerContext, IQueryContext } from '../interfaces';
2
+ export declare function buildMutateHandler({ queryClient, queryKey }: IQueryContext): (fn: (_: ICacheItems) => void) => Promise<IHandlerContext>;
@@ -0,0 +1,21 @@
1
+ import type { IUserContext } from '../../../../../context';
2
+ import type { ICacheItem, ICacheSubitem } from '../interfaces';
3
+ interface IEnrichActivityArgs {
4
+ activity: ICacheItem | Partial<ICacheItem> | {
5
+ content: string;
6
+ };
7
+ user: IUserContext;
8
+ }
9
+ interface IIncrementLikesArgs {
10
+ activity: ICacheItem;
11
+ reaction?: ICacheSubitem;
12
+ user?: IUserContext;
13
+ }
14
+ interface IDecrementLikesArgs {
15
+ activity: ICacheItem;
16
+ user?: IUserContext;
17
+ }
18
+ export declare function enrichActivity({ activity, user }: IEnrichActivityArgs): ICacheItem;
19
+ export declare function incrementLikes({ activity, reaction }: IIncrementLikesArgs): void;
20
+ export declare function decrementLikes({ activity, user }: IDecrementLikesArgs): void;
21
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ICacheItem, ICacheItems } from '../interfaces';
2
+ export declare function addItem(item: ICacheItem, cache: ICacheItems): ICacheItem[];
3
+ export declare function findItem(itemId: string, cache: ICacheItems): ICacheItem | undefined;
4
+ export declare function removeItem(itemId: string, cache: ICacheItems): ICacheItem[];
@@ -0,0 +1,2 @@
1
+ import type { IHandlerContext } from '../interfaces';
2
+ export declare function extractData(context?: IHandlerContext): import("../interfaces").ICacheItems;
@@ -0,0 +1,3 @@
1
+ export * from './activity.helper';
2
+ export * from './cache.helper';
3
+ export * from './context.helper';
@@ -0,0 +1,6 @@
1
+ import type { IMutationProps, IHandlerContext, ICacheItem } from '../../interfaces';
2
+ interface ICreateVars {
3
+ content: string;
4
+ }
5
+ export declare function useCreateActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, queryClient, queryKey, user, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<ICacheItem, Error, ICreateVars, IHandlerContext>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from './create.hook';
@@ -0,0 +1,7 @@
1
+ import type { IMutationProps, IHandlerContext, ICacheItem } from '../../interfaces';
2
+ interface IEditVars {
3
+ activityId: string;
4
+ body: string;
5
+ }
6
+ export declare function useEditActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<ICacheItem, Error, IEditVars, IHandlerContext>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export * from './edit.hook';
@@ -0,0 +1 @@
1
+ export * from './feed.hook';
@@ -0,0 +1,7 @@
1
+ export * from './create';
2
+ export * from './edit';
3
+ export * from './feed';
4
+ export * from './like';
5
+ export * from './list';
6
+ export * from './remove';
7
+ export * from './unlike';
@@ -0,0 +1 @@
1
+ export * from './like.hook';
@@ -0,0 +1,7 @@
1
+ import type { IMutationProps, IHandlerContext, ICacheSubitem } from '../../interfaces';
2
+ interface ILikeVars {
3
+ activityId: string;
4
+ reactionId: string;
5
+ }
6
+ export declare function useLikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, queryClient, queryKey, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<ICacheSubitem, Error, ILikeVars, IHandlerContext>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export * from './list.hook';
@@ -0,0 +1,7 @@
1
+ import type { IQueryHookArgs, ICacheItems } from '../../interfaces';
2
+ export declare function useListActivities({ queryKey, queryFn }: IQueryHookArgs): {
3
+ activities: ICacheItems | undefined;
4
+ error: Error | null;
5
+ isFetching: boolean;
6
+ isLoading: boolean;
7
+ };
@@ -0,0 +1 @@
1
+ export * from './remove.hook';
@@ -0,0 +1,6 @@
1
+ import type { IMutationProps, IHandlerContext, ICacheItem } from '../../interfaces';
2
+ interface IRemoveVars {
3
+ activityId: string;
4
+ }
5
+ export declare function useRemoveActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<ICacheItem, Error, IRemoveVars, IHandlerContext>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from './unlike.hook';
@@ -0,0 +1,7 @@
1
+ import type { IMutationProps, IHandlerContext } from '../../interfaces';
2
+ interface IUnlikeVars {
3
+ activityId: string;
4
+ reactionId: string;
5
+ }
6
+ export declare function useUnlikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, user, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnlikeVars, IHandlerContext>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './handlers';
2
+ export * from './helpers';
3
+ export * from './hooks';
@@ -0,0 +1,4 @@
1
+ import type { EnrichedActivity, EnrichedReaction } from 'getstream';
2
+ export type ICacheItem = EnrichedActivity;
3
+ export type ICacheItems = ICacheItem[];
4
+ export type ICacheSubitem = EnrichedReaction;
@@ -0,0 +1,4 @@
1
+ import type { ICacheItems } from './cache.interface';
2
+ export interface IHandlerContext {
3
+ data: ICacheItems;
4
+ }
@@ -0,0 +1,4 @@
1
+ export * from './cache.interface';
2
+ export * from './handler.interface';
3
+ export * from './mutation.interface';
4
+ export * from './query.interface';
@@ -0,0 +1,12 @@
1
+ import type { IUserContext } from '../../../../../context';
2
+ import type { IQueryContext, ICacheItems, IHandlerContext } from '.';
3
+ export interface IMutationContext extends IQueryContext {
4
+ mutationHandlers: {
5
+ mutate: (callback: (data: ICacheItems) => ICacheItems) => Promise<IHandlerContext>;
6
+ error: (error: Error, variables: unknown, context?: IHandlerContext) => void;
7
+ };
8
+ user: IUserContext;
9
+ }
10
+ export interface IMutationProps extends IMutationContext {
11
+ mutationFn: (_: any) => Promise<any>;
12
+ }
@@ -0,0 +1,9 @@
1
+ import { QueryClient, QueryKey } from '@tanstack/react-query';
2
+ export interface IQueryContext {
3
+ queryClient: QueryClient;
4
+ queryKey: QueryKey;
5
+ }
6
+ export interface IQueryHookArgs {
7
+ queryFn: (..._: unknown[]) => unknown;
8
+ queryKey: QueryKey;
9
+ }
@@ -0,0 +1,44 @@
1
+ export declare const activityMock1: Readonly<{
2
+ actor: "SU:some-user-id-1";
3
+ content: "some content 1";
4
+ duration: "5.53ms";
5
+ feed_id: "some-feed-id-1";
6
+ foreign_id: "post:some-foriegn-id-1";
7
+ id: "some-activity-id-1";
8
+ object: "comment";
9
+ time: "2023-11-24T17:52:36.162000";
10
+ verb: "post";
11
+ }>;
12
+ export declare const activityMock2: Readonly<{
13
+ actor: "SU:some-user-id-2";
14
+ content: "some content 2";
15
+ duration: "5.53ms";
16
+ feed_id: "some-feed-id-2";
17
+ foreign_id: "post:some-foriegn-id-2";
18
+ id: "some-activity-id-2";
19
+ object: "comment";
20
+ time: "2023-11-24T17:54:36.162000";
21
+ verb: "post";
22
+ }>;
23
+ export declare const activityMock3: Readonly<{
24
+ actor: "SU:some-user-id-1";
25
+ content: "some content 3";
26
+ duration: "5.53ms";
27
+ feed_id: "some-feed-id-3";
28
+ foreign_id: "post:some-foriegn-id-3";
29
+ id: "some-activity-id-3";
30
+ object: "comment";
31
+ time: "2023-11-24T17:56:36.162000";
32
+ verb: "post";
33
+ }>;
34
+ export declare const activityMock4: Readonly<{
35
+ actor: "SU:some-user-id-2";
36
+ content: "some content 4";
37
+ duration: "5.53ms";
38
+ feed_id: "some-feed-id-4";
39
+ foreign_id: "post:some-foriegn-id-4";
40
+ id: "some-activity-id-4";
41
+ object: "comment";
42
+ time: "2023-11-24T17:54:36.162000";
43
+ verb: "post";
44
+ }>;
@@ -0,0 +1,4 @@
1
+ export declare const cacheMock1: readonly import("../interfaces").ICacheItem[];
2
+ export declare const cacheMock2: readonly import("../interfaces").ICacheItem[];
3
+ export declare const cacheMock3: readonly import("../interfaces").ICacheItem[];
4
+ export declare const cacheMock4: readonly import("../interfaces").ICacheItem[];
@@ -0,0 +1,9 @@
1
+ export declare const contextMock1: Readonly<{
2
+ data: readonly import("../interfaces").ICacheItem[];
3
+ }>;
4
+ export declare const contextMock2: Readonly<{
5
+ data: readonly import("../interfaces").ICacheItem[];
6
+ }>;
7
+ export declare const contextMock3: Readonly<{
8
+ data: readonly import("../interfaces").ICacheItem[];
9
+ }>;
@@ -0,0 +1,5 @@
1
+ export * from './activity.mock';
2
+ export * from './cache.mock';
3
+ export * from './context.mock';
4
+ export * from './reaction.mock';
5
+ export * from './user.mock';
@@ -0,0 +1,20 @@
1
+ export declare const reactionMock1: Readonly<{
2
+ id: "some-reaction-id-1";
3
+ activity_id: "some-activity-id-1";
4
+ kind: "like";
5
+ created_at: "2023-11-24T17:58:36.162000";
6
+ data: {};
7
+ parent: "";
8
+ updated_at: "2023-11-24T17:58:36.162000";
9
+ user_id: "some-user-id-2";
10
+ children_counts: {};
11
+ latest_children: {};
12
+ latest_children_extra: {};
13
+ own_children: {};
14
+ user: {
15
+ id: "some-user-id-2";
16
+ data: {};
17
+ created_at: string;
18
+ updated_at: string;
19
+ };
20
+ }>;
@@ -0,0 +1,20 @@
1
+ export declare const userMock1: Readonly<{
2
+ id: "some-user-id-1";
3
+ name: "some user name 1";
4
+ organization: "some user organization 1";
5
+ jobTitle: "some user job title 1";
6
+ image: {
7
+ thumbnail: string;
8
+ };
9
+ isLoading: false;
10
+ }>;
11
+ export declare const userMock2: Readonly<{
12
+ id: "some-user-id-2";
13
+ name: "some user name 2";
14
+ organization: "some user organization 2";
15
+ jobTitle: "some user job title 2";
16
+ image: {
17
+ thumbnail: string;
18
+ };
19
+ isLoading: false;
20
+ }>;
@@ -117,7 +117,7 @@ export declare const buildLikeReplyHandlers: ({ queryClient, queryKey, mutationF
117
117
  interface buildUnlikeReplyHandlersProps {
118
118
  queryClient: QueryClient;
119
119
  queryKey: QueryKey;
120
- user: IUserContext | null;
120
+ user: IUserContext;
121
121
  mutationFn: ({ replyId }: {
122
122
  replyId: string;
123
123
  }) => Promise<void>;
@@ -127,7 +127,7 @@ export declare const buildLikeReplyHandlers: ({ queryClient, queryKey, mutationF
127
127
  interface buildUnlikeReplyHandlersProps {
128
128
  queryClient: QueryClient;
129
129
  queryKey: QueryKey;
130
- user: IUserContext | null;
130
+ user: IUserContext;
131
131
  mutationFn: ({ replyId, replyParentId, }: {
132
132
  replyId: string;
133
133
  replyParentId?: string;
@@ -56,7 +56,7 @@ export declare const buildLikeActivityHandlers: ({ queryClient, queryKey, mutati
56
56
  interface buildUnlikeActivityHandlersProps {
57
57
  queryClient: QueryClient;
58
58
  queryKey: QueryKey;
59
- user: IUserContext | null;
59
+ user: IUserContext;
60
60
  activity: IActivity | undefined;
61
61
  mutationFn: ({ activityId }: {
62
62
  activityId: string;