@apolitical/component-library 1.16.0-4186.18 → 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 (37) hide show
  1. package/context/user/user.context.d.ts +1 -1
  2. package/context/user/user.hook.d.ts +1 -1
  3. package/context/user/user.provider.d.ts +1 -1
  4. package/discussion/feeds/activities-feed/activities-feed.d.ts +1 -1
  5. package/discussion/feeds/activities-feed/cache/handlers/error.handler.d.ts +2 -0
  6. package/discussion/feeds/activities-feed/cache/handlers/index.d.ts +2 -0
  7. package/discussion/feeds/activities-feed/cache/handlers/mutate.handler.d.ts +2 -0
  8. package/discussion/feeds/activities-feed/cache/helpers/activity.helper.d.ts +14 -0
  9. package/discussion/feeds/activities-feed/cache/helpers/index.d.ts +1 -0
  10. package/discussion/feeds/activities-feed/cache/hooks/create/create.hook.d.ts +6 -0
  11. package/discussion/feeds/activities-feed/cache/hooks/create/index.d.ts +1 -0
  12. package/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +7 -0
  13. package/discussion/feeds/activities-feed/cache/hooks/edit/index.d.ts +1 -0
  14. package/discussion/feeds/activities-feed/cache/hooks/feed/index.d.ts +1 -0
  15. package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +7 -0
  16. package/discussion/feeds/activities-feed/cache/hooks/like/index.d.ts +1 -0
  17. package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +7 -0
  18. package/discussion/feeds/activities-feed/cache/hooks/list/index.d.ts +1 -0
  19. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +7 -0
  20. package/discussion/feeds/activities-feed/cache/hooks/remove/index.d.ts +1 -0
  21. package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +6 -0
  22. package/discussion/feeds/activities-feed/cache/hooks/unlike/index.d.ts +1 -0
  23. package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +7 -0
  24. package/discussion/feeds/activities-feed/cache/index.d.ts +3 -0
  25. package/discussion/feeds/activities-feed/cache/interfaces/cache.interface.d.ts +4 -0
  26. package/discussion/feeds/activities-feed/cache/interfaces/handler.interface.d.ts +4 -0
  27. package/discussion/feeds/activities-feed/cache/interfaces/index.d.ts +4 -0
  28. package/discussion/feeds/activities-feed/cache/interfaces/mutation.interface.d.ts +12 -0
  29. package/discussion/feeds/activities-feed/cache/interfaces/query.interface.d.ts +9 -0
  30. package/discussion/feeds/replies-feed/replies-feed.handlers.d.ts +1 -1
  31. package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.handlers.d.ts +1 -1
  32. package/discussion/sections/activity-section/activity-section.handlers.d.ts +1 -1
  33. package/index.js +14 -14
  34. package/index.mjs +2036 -1944
  35. package/package.json +1 -1
  36. package/discussion/feeds/activities-feed/activities-feed.helpers.d.ts +0 -51
  37. package/discussion/feeds/activities-feed/activities-feed.hooks.d.ts +0 -34
@@ -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,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;