@apolitical/component-library 1.16.0 → 1.17.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 (24) hide show
  1. package/discussion/feeds/activities-feed/activities-feed.d.ts +6 -5
  2. package/discussion/feeds/activities-feed/cache/handlers/error.handler.d.ts +2 -2
  3. package/discussion/feeds/activities-feed/cache/handlers/mutate.handler.d.ts +2 -2
  4. package/discussion/feeds/activities-feed/cache/helpers/index.d.ts +0 -1
  5. package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +2 -2
  6. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +10 -4
  7. package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +2 -2
  8. package/discussion/feeds/activities-feed/cache/interfaces/cache.interface.d.ts +12 -2
  9. package/discussion/feeds/activities-feed/cache/interfaces/index.d.ts +0 -1
  10. package/discussion/feeds/activities-feed/cache/interfaces/mutation.interface.d.ts +3 -3
  11. package/discussion/feeds/activities-feed/cache/interfaces/query.interface.d.ts +0 -4
  12. package/index.js +14 -14
  13. package/index.mjs +1094 -1060
  14. package/navigation/load-more/load-more.d.ts +1 -1
  15. package/package.json +1 -1
  16. package/discussion/feeds/activities-feed/cache/helpers/activity.helper.d.ts +0 -21
  17. package/discussion/feeds/activities-feed/cache/helpers/cache.helper.d.ts +0 -4
  18. package/discussion/feeds/activities-feed/cache/helpers/context.helper.d.ts +0 -2
  19. package/discussion/feeds/activities-feed/cache/hooks/create/create.hook.d.ts +0 -6
  20. package/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +0 -7
  21. package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +0 -6
  22. package/discussion/feeds/activities-feed/cache/interfaces/handler.interface.d.ts +0 -4
  23. package/discussion/feeds/activities-feed/cache/mocks/cache.mock.d.ts +0 -4
  24. package/discussion/feeds/activities-feed/cache/mocks/context.mock.d.ts +0 -9
@@ -1,17 +1,18 @@
1
1
  /// <reference types="react" />
2
+ import type { ICacheItem, ICachePage, ICacheSubitem } from './cache';
2
3
  interface Props {
3
4
  basePath: string;
4
5
  parentId: string;
5
6
  isMember: boolean;
6
7
  functions: {
7
- create: (_: unknown) => Promise<void>;
8
- edit: (_: unknown) => Promise<void>;
8
+ create: (_: unknown) => Promise<ICacheItem>;
9
+ edit: (_: unknown) => Promise<ICacheItem>;
9
10
  join: () => Promise<void>;
10
11
  leave: () => Promise<void>;
11
- like: (_: unknown) => Promise<void>;
12
- list: () => Promise<unknown>;
12
+ like: (_: unknown) => Promise<ICacheSubitem>;
13
+ list: (_: unknown) => Promise<ICachePage>;
13
14
  remove: (_: unknown) => Promise<void>;
14
- unlike: (_: unknown) => Promise<void>;
15
+ unlike: (_: unknown) => Promise<ICacheSubitem>;
15
16
  };
16
17
  }
17
18
  declare const ActivitiesFeed: React.FC<Props>;
@@ -1,2 +1,2 @@
1
- import type { IHandlerContext, IQueryContext } from '../interfaces';
2
- export declare function buildErrorHandler({ queryClient, queryKey }: IQueryContext): (_1: Error, _2: unknown, context?: IHandlerContext) => void;
1
+ import type { ICache, IQueryContext } from '../interfaces';
2
+ export declare function buildErrorHandler({ queryClient, queryKey }: IQueryContext): (_1: Error, _2: unknown, cache?: ICache) => void;
@@ -1,2 +1,2 @@
1
- import type { ICacheItems, IHandlerContext, IQueryContext } from '../interfaces';
2
- export declare function buildMutateHandler({ queryClient, queryKey }: IQueryContext): (fn: (_: ICacheItems) => void) => Promise<IHandlerContext>;
1
+ import type { ICache, IQueryContext } from '../interfaces';
2
+ export declare function buildMutateHandler({ queryClient, queryKey }: IQueryContext): (fn: (_: ICache) => ICache) => Promise<ICache>;
@@ -1,3 +1,2 @@
1
1
  export * from './activity.helper';
2
2
  export * from './cache.helper';
3
- export * from './context.helper';
@@ -1,7 +1,7 @@
1
- import type { IMutationProps, IHandlerContext, ICacheSubitem } from '../../interfaces';
1
+ import type { IMutationProps, ICache, ICacheSubitem } from '../../interfaces';
2
2
  interface ILikeVars {
3
3
  activityId: string;
4
4
  reactionId?: string;
5
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>;
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, ICache>;
7
7
  export {};
@@ -1,7 +1,13 @@
1
- import type { IQueryHookArgs, ICacheItems } from '../../interfaces';
2
- export declare function useListActivities({ queryKey, queryFn }: IQueryHookArgs): {
3
- activities: ICacheItems | undefined;
1
+ import { QueryKey } from '@tanstack/react-query';
2
+ import type { ICache, ICachePage } from '../../interfaces';
3
+ export interface IListActivitiesArgs {
4
+ queryFn: (_: unknown) => Promise<ICachePage>;
5
+ queryKey: QueryKey;
6
+ }
7
+ export declare function useListActivities({ queryFn, queryKey }: IListActivitiesArgs): {
8
+ activities: import("../../interfaces").ICacheItems;
4
9
  error: Error | null;
5
- isFetching: boolean;
6
10
  isLoading: boolean;
11
+ hasNextPage: boolean;
12
+ fetchNextPage: (options?: import("@tanstack/query-core/build/legacy/queryClient-13f81fcb").a2 | undefined) => Promise<import("@tanstack/query-core/build/legacy/queryClient-13f81fcb").aj<ICache, Error>>;
7
13
  };
@@ -1,7 +1,7 @@
1
- import type { IMutationProps, IHandlerContext } from '../../interfaces';
1
+ import type { IMutationProps, ICache } from '../../interfaces';
2
2
  interface IUnlikeVars {
3
3
  activityId: string;
4
4
  reactionId: string;
5
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>;
6
+ export declare function useUnlikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, user, }: IMutationProps): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnlikeVars, ICache>;
7
7
  export {};
@@ -1,5 +1,15 @@
1
- import type { EnrichedActivity, EnrichedReaction, EnrichedUser } from 'getstream';
2
- export type ICacheItem = EnrichedActivity;
1
+ import { InfiniteData } from '@tanstack/query-core';
2
+ import type { EnrichedReaction, EnrichedUser, FeedAPIResponse, FlatActivityEnriched } from 'getstream';
3
+ export type ICache = InfiniteData<ICachePage, string>;
4
+ export type ICachePage = ExtendedFeedAPIResponse;
3
5
  export type ICacheItems = ICacheItem[];
6
+ export type ICacheItem = ExtendedFlatActivityEnriched;
4
7
  export type ICacheSubitem = EnrichedReaction;
5
8
  export type ICacheUser = EnrichedUser;
9
+ interface ExtendedFlatActivityEnriched extends FlatActivityEnriched {
10
+ content: string;
11
+ }
12
+ interface ExtendedFeedAPIResponse extends FeedAPIResponse {
13
+ results: ExtendedFlatActivityEnriched[];
14
+ }
15
+ export {};
@@ -1,4 +1,3 @@
1
1
  export * from './cache.interface';
2
- export * from './handler.interface';
3
2
  export * from './mutation.interface';
4
3
  export * from './query.interface';
@@ -1,9 +1,9 @@
1
1
  import type { IUserContext } from '../../../../../context';
2
- import type { IQueryContext, ICacheItems, IHandlerContext } from '.';
2
+ import type { IQueryContext, ICache } from '.';
3
3
  export interface IMutationContext extends IQueryContext {
4
4
  mutationHandlers: {
5
- mutate: (callback: (data: ICacheItems) => ICacheItems) => Promise<IHandlerContext>;
6
- error: (error: Error, variables: unknown, context?: IHandlerContext) => void;
5
+ mutate: (callback: (cache: ICache) => ICache) => Promise<ICache>;
6
+ error: (error: Error, variables: unknown, cache?: ICache) => void;
7
7
  };
8
8
  user: IUserContext;
9
9
  }
@@ -3,7 +3,3 @@ export interface IQueryContext {
3
3
  queryClient: QueryClient;
4
4
  queryKey: QueryKey;
5
5
  }
6
- export interface IQueryHookArgs {
7
- queryFn: (..._: unknown[]) => unknown;
8
- queryKey: QueryKey;
9
- }