@apolitical/component-library 1.15.5-beta.0 → 1.16.0-4186.44

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 (41) hide show
  1. package/communities/members-list/members-list.d.ts +6 -7
  2. package/context/user/index.d.ts +1 -0
  3. package/context/user/user.context.d.ts +1 -1
  4. package/context/user/user.hook.d.ts +1 -0
  5. package/context/user/user.provider.d.ts +1 -1
  6. package/discussion/feeds/activities-feed/activities-feed.d.ts +6 -20
  7. package/discussion/feeds/activities-feed/cache/handlers/error.handler.d.ts +2 -0
  8. package/discussion/feeds/activities-feed/cache/handlers/index.d.ts +2 -0
  9. package/discussion/feeds/activities-feed/cache/handlers/mutate.handler.d.ts +2 -0
  10. package/discussion/feeds/activities-feed/cache/helpers/activity.helper.d.ts +14 -0
  11. package/discussion/feeds/activities-feed/cache/helpers/index.d.ts +1 -0
  12. package/discussion/feeds/activities-feed/cache/hooks/create/create.hook.d.ts +6 -0
  13. package/discussion/feeds/activities-feed/cache/hooks/create/index.d.ts +1 -0
  14. package/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +7 -0
  15. package/discussion/feeds/activities-feed/cache/hooks/edit/index.d.ts +1 -0
  16. package/discussion/feeds/activities-feed/cache/hooks/feed/index.d.ts +1 -0
  17. package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +7 -0
  18. package/discussion/feeds/activities-feed/cache/hooks/like/index.d.ts +1 -0
  19. package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +7 -0
  20. package/discussion/feeds/activities-feed/cache/hooks/list/index.d.ts +1 -0
  21. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +7 -0
  22. package/discussion/feeds/activities-feed/cache/hooks/remove/index.d.ts +1 -0
  23. package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +6 -0
  24. package/discussion/feeds/activities-feed/cache/hooks/unlike/index.d.ts +1 -0
  25. package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +7 -0
  26. package/discussion/feeds/activities-feed/cache/index.d.ts +3 -0
  27. package/discussion/feeds/activities-feed/cache/interfaces/cache.interface.d.ts +4 -0
  28. package/discussion/feeds/activities-feed/cache/interfaces/handler.interface.d.ts +4 -0
  29. package/discussion/feeds/activities-feed/cache/interfaces/index.d.ts +4 -0
  30. package/discussion/feeds/activities-feed/cache/interfaces/mutation.interface.d.ts +12 -0
  31. package/discussion/feeds/activities-feed/cache/interfaces/query.interface.d.ts +9 -0
  32. package/discussion/feeds/replies-feed/replies-feed.handlers.d.ts +1 -1
  33. package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.handlers.d.ts +1 -1
  34. package/discussion/sections/activity-section/activity-section.handlers.d.ts +1 -1
  35. package/index.d.ts +0 -1
  36. package/index.js +15 -15
  37. package/index.mjs +2689 -2847
  38. package/package.json +1 -1
  39. package/style.css +1 -1
  40. package/discussion/feeds/activities-feed/activities-feed.handlers.d.ts +0 -72
  41. package/discussion/feeds/activities-feed/activities-feed.helpers.d.ts +0 -23
@@ -1,3 +1,4 @@
1
+ import { PaginationType } from '../../navigation';
1
2
  import { MemberDetailsProps } from '../../user';
2
3
  interface CommunityMemberProps extends MemberDetailsProps {
3
4
  /** Whether the user is an admin of the community or not */
@@ -6,13 +7,11 @@ interface CommunityMemberProps extends MemberDetailsProps {
6
7
  interface Props {
7
8
  /** Details about members in the community */
8
9
  members: {
9
- data: CommunityMemberProps[];
10
- total?: number;
10
+ total?: number | undefined;
11
+ data?: CommunityMemberProps[];
11
12
  };
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;
13
+ /** Details for the pagination */
14
+ pagination?: PaginationType;
16
15
  /** The GTM context to use */
17
16
  gtmContext?: string;
18
17
  /** The GTM event to use */
@@ -20,5 +19,5 @@ interface Props {
20
19
  /** Additional classes */
21
20
  className?: string;
22
21
  }
23
- declare const MembersList: ({ members: { data, total }, hasNextPage, loadNextPage, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
22
+ declare const MembersList: ({ members: { total, data: members }, pagination, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
24
23
  export default MembersList;
@@ -1,3 +1,4 @@
1
1
  export type { IUserDetails } from './user.context';
2
2
  export * from './user.context';
3
+ export * from './user.hook';
3
4
  export * from './user.provider';
@@ -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>;
@@ -0,0 +1 @@
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 {};
@@ -1,31 +1,17 @@
1
1
  /// <reference types="react" />
2
- import { InvalidateQueryFilters, QueryFunction } from '@tanstack/react-query';
3
2
  interface Props {
4
3
  basePath: string;
5
4
  parentId: string;
6
5
  isMember: boolean;
7
6
  functions: {
8
- list: QueryFunction<unknown, InvalidateQueryFilters[], never>;
9
- create: () => Promise<void>;
10
- edit: ({ parentId, activityId, content, }: {
11
- parentId: string;
12
- activityId: string;
13
- content: {
14
- body: string;
15
- };
16
- }) => Promise<void>;
17
- remove: ({ activityId }: {
18
- activityId: string;
19
- }) => Promise<void>;
20
- like: ({ activityId }: {
21
- activityId: string;
22
- }) => Promise<void>;
23
- unlike: ({ activityId, reactionId, }: {
24
- activityId: string;
25
- reactionId: string;
26
- }) => Promise<void>;
7
+ create: (_: unknown) => Promise<void>;
8
+ edit: (_: unknown) => Promise<void>;
27
9
  join: () => Promise<void>;
28
10
  leave: () => Promise<void>;
11
+ like: (_: unknown) => Promise<void>;
12
+ list: () => Promise<unknown>;
13
+ remove: (_: unknown) => Promise<void>;
14
+ unlike: (_: unknown) => Promise<void>;
29
15
  };
30
16
  }
31
17
  declare const ActivitiesFeed: React.FC<Props>;
@@ -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,14 @@
1
+ import type { IUserContext } from '../../../../../context';
2
+ import type { ICacheItem } from '../interfaces';
3
+ interface IBuildTmpActivity {
4
+ content: string;
5
+ user: IUserContext;
6
+ verb?: string;
7
+ }
8
+ interface IBuildFinalActivity {
9
+ activity: ICacheItem;
10
+ user: IUserContext;
11
+ }
12
+ export declare function buildTmpActivity({ content, user, verb }: IBuildTmpActivity): ICacheItem;
13
+ export declare function buildFinalActivity({ activity, user }: IBuildFinalActivity): ICacheItem;
14
+ export {};
@@ -0,0 +1 @@
1
+ export * from './activity.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").UseMutationResult<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").UseMutationResult<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").UseMutationResult<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").UseMutationResult<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, }, queryClient, queryKey, user, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutationResult<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
+ }
@@ -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;
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './accessibility';
2
2
  export * from './banners';
3
- export * from './cards';
4
3
  export * from './communities';
5
4
  export * from './constants';
6
5
  export * from './context';