@apolitical/component-library 1.17.2 → 1.18.0-4247.39

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 (95) hide show
  1. package/discussion/components/thread/thread.d.ts +2 -2
  2. package/discussion/feeds/activities-feed/cache/cache.helper.d.ts +5 -0
  3. package/discussion/feeds/activities-feed/cache/cache.interface.d.ts +13 -0
  4. package/discussion/feeds/activities-feed/cache/hooks/create/create.hook.d.ts +7 -0
  5. package/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +8 -0
  6. package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +3 -2
  7. package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +2 -2
  8. package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +7 -0
  9. package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +4 -3
  10. package/discussion/feeds/activities-feed/cache/index.d.ts +2 -3
  11. package/discussion/feeds/activities-feed/cache/mocks/cache.mock.d.ts +24 -0
  12. package/discussion/feeds/activities-feed/cache/mocks/index.d.ts +0 -4
  13. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +57 -0
  14. package/discussion/feeds/activities-feed/mocks/index.d.ts +1 -0
  15. package/discussion/feeds/replies-feed/cache/cache.helper.d.ts +16 -0
  16. package/discussion/feeds/replies-feed/cache/cache.interface.d.ts +13 -0
  17. package/discussion/feeds/replies-feed/cache/hooks/create/create.hook.d.ts +9 -0
  18. package/discussion/feeds/replies-feed/cache/hooks/create/index.d.ts +1 -0
  19. package/discussion/feeds/replies-feed/cache/hooks/edit/edit.hook.d.ts +8 -0
  20. package/discussion/feeds/replies-feed/cache/hooks/edit/index.d.ts +1 -0
  21. package/discussion/feeds/replies-feed/cache/hooks/feed/index.d.ts +1 -0
  22. package/discussion/feeds/replies-feed/cache/hooks/index.d.ts +7 -0
  23. package/discussion/feeds/replies-feed/cache/hooks/like/index.d.ts +1 -0
  24. package/discussion/feeds/replies-feed/cache/hooks/like/like.hook.d.ts +8 -0
  25. package/discussion/feeds/replies-feed/cache/hooks/list/index.d.ts +1 -0
  26. package/discussion/feeds/replies-feed/cache/hooks/list/list.hook.d.ts +14 -0
  27. package/discussion/feeds/replies-feed/cache/hooks/remove/index.d.ts +1 -0
  28. package/discussion/feeds/replies-feed/cache/hooks/remove/remove.hook.d.ts +7 -0
  29. package/discussion/feeds/replies-feed/cache/hooks/unlike/index.d.ts +1 -0
  30. package/discussion/feeds/replies-feed/cache/hooks/unlike/unlike.hook.d.ts +8 -0
  31. package/discussion/feeds/replies-feed/cache/index.d.ts +3 -0
  32. package/discussion/feeds/replies-feed/cache/mocks/cache.mock.d.ts +24 -0
  33. package/discussion/feeds/replies-feed/cache/mocks/index.d.ts +1 -0
  34. package/discussion/feeds/replies-feed/index.d.ts +2 -0
  35. package/discussion/feeds/replies-feed/mocks/index.d.ts +1 -0
  36. package/discussion/feeds/replies-feed/mocks/replies-feed.mock.d.ts +101 -0
  37. package/discussion/feeds/replies-feed/nested-replies-feed/index.d.ts +1 -0
  38. package/discussion/feeds/replies-feed/nested-replies-feed/mocks/index.d.ts +1 -0
  39. package/discussion/feeds/replies-feed/nested-replies-feed/mocks/nested-replies-feed.mock.d.ts +26 -0
  40. package/discussion/feeds/replies-feed/nested-replies-feed/nested-replies-feed.d.ts +12 -0
  41. package/discussion/feeds/replies-feed/replies-feed.d.ts +2 -24
  42. package/discussion/sections/activity-section/activity-section.d.ts +7 -37
  43. package/discussion/sections/activity-section/cache/cache.interface.d.ts +5 -0
  44. package/discussion/sections/activity-section/cache/hooks/edit/edit.hook.d.ts +7 -0
  45. package/discussion/sections/activity-section/cache/hooks/edit/index.d.ts +1 -0
  46. package/discussion/sections/activity-section/cache/hooks/index.d.ts +5 -0
  47. package/discussion/sections/activity-section/cache/hooks/like/index.d.ts +1 -0
  48. package/discussion/sections/activity-section/cache/hooks/like/like.hook.d.ts +8 -0
  49. package/discussion/sections/activity-section/cache/hooks/read/index.d.ts +1 -0
  50. package/discussion/sections/activity-section/cache/hooks/read/read.hook.d.ts +12 -0
  51. package/discussion/sections/activity-section/cache/hooks/section/index.d.ts +1 -0
  52. package/discussion/sections/activity-section/cache/hooks/unlike/index.d.ts +1 -0
  53. package/discussion/sections/activity-section/cache/hooks/unlike/unlike.hook.d.ts +8 -0
  54. package/discussion/sections/activity-section/cache/index.d.ts +2 -0
  55. package/discussion/sections/activity-section/cache/mocks/cache.mock.d.ts +4 -0
  56. package/discussion/sections/activity-section/cache/mocks/index.d.ts +1 -0
  57. package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +37 -0
  58. package/discussion/sections/activity-section/mocks/index.d.ts +2 -0
  59. package/discussion/shared/constants.d.ts +3 -0
  60. package/discussion/shared/handlers/error.handler.d.ts +2 -0
  61. package/discussion/shared/handlers/mutate.handler.d.ts +2 -0
  62. package/discussion/shared/helpers/activity.helper.d.ts +28 -0
  63. package/discussion/{feeds/activities-feed/cache → shared}/helpers/index.d.ts +1 -1
  64. package/discussion/shared/helpers/reaction.helper.d.ts +28 -0
  65. package/discussion/shared/helpers/reply.helper.d.ts +33 -0
  66. package/discussion/shared/helpers/user.helper.d.ts +10 -0
  67. package/discussion/shared/index.d.ts +5 -0
  68. package/discussion/shared/interfaces/activity.interface.d.ts +4 -0
  69. package/discussion/shared/interfaces/context.interface.d.ts +14 -0
  70. package/discussion/shared/interfaces/index.d.ts +4 -0
  71. package/discussion/shared/interfaces/reaction.interface.d.ts +3 -0
  72. package/discussion/shared/interfaces/user.interface.d.ts +9 -0
  73. package/discussion/shared/mocks/index.d.ts +4 -0
  74. package/discussion/shared/mocks/reply.mock.d.ts +80 -0
  75. package/index.js +15 -15
  76. package/index.mjs +3740 -3135
  77. package/package.json +1 -1
  78. package/discussion/feeds/activities-feed/activities-feed.mock.d.ts +0 -318
  79. package/discussion/feeds/activities-feed/cache/handlers/error.handler.d.ts +0 -2
  80. package/discussion/feeds/activities-feed/cache/handlers/mutate.handler.d.ts +0 -2
  81. package/discussion/feeds/activities-feed/cache/interfaces/cache.interface.d.ts +0 -15
  82. package/discussion/feeds/activities-feed/cache/interfaces/index.d.ts +0 -3
  83. package/discussion/feeds/activities-feed/cache/interfaces/mutation.interface.d.ts +0 -12
  84. package/discussion/feeds/activities-feed/cache/interfaces/query.interface.d.ts +0 -5
  85. package/discussion/feeds/replies-feed/replies-feed.handlers.d.ts +0 -147
  86. package/discussion/feeds/replies-feed/replies-feed.mock.d.ts +0 -2
  87. package/discussion/feeds/replies-to-replies-feed/index.d.ts +0 -1
  88. package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.d.ts +0 -38
  89. package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.handlers.d.ts +0 -161
  90. package/discussion/sections/activity-section/activity-section.handlers.d.ts +0 -84
  91. package/discussion/sections/activity-section/activity.mock.d.ts +0 -2
  92. /package/discussion/{feeds/activities-feed/cache → shared}/handlers/index.d.ts +0 -0
  93. /package/discussion/{feeds/activities-feed/cache → shared}/mocks/activity.mock.d.ts +0 -0
  94. /package/discussion/{feeds/activities-feed/cache → shared}/mocks/reaction.mock.d.ts +0 -0
  95. /package/discussion/{feeds/activities-feed/cache → shared}/mocks/user.mock.d.ts +0 -0
@@ -0,0 +1 @@
1
+ export * from './like.hook';
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache, ICacheSubitem } from '../..';
3
+ interface ILikeVars {
4
+ activityId: string;
5
+ reactionId?: string;
6
+ }
7
+ export declare function useLikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, queryClient, queryKey, }: IMutationContext<ICacheSubitem, Error, ILikeVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<import('../../../../../../discussion/shared').IReaction, Error, ILikeVars, import('../../../../../../discussion/shared').IActivity>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export * from './read.hook';
@@ -0,0 +1,12 @@
1
+ import { QueryKey } from '@tanstack/react-query';
2
+ import type { ICache } from '../..';
3
+ export interface IReadActivityArgs {
4
+ queryFn: (_: unknown) => Promise<ICache>;
5
+ queryKey: QueryKey;
6
+ }
7
+ export declare function useReadActivity({ queryFn, queryKey }: IReadActivityArgs): {
8
+ activity: import("../../../../../shared").IActivity | undefined;
9
+ error: Error | null;
10
+ isLoading: boolean;
11
+ isFetching: boolean;
12
+ };
@@ -0,0 +1 @@
1
+ export * from './section.hook';
@@ -0,0 +1 @@
1
+ export * from './unlike.hook';
@@ -0,0 +1,8 @@
1
+ import type { IMutationContext } from '../../../../../../discussion/shared';
2
+ import type { ICache } from '../..';
3
+ interface IUnlikeVars {
4
+ activityId: string;
5
+ reactionId?: string;
6
+ }
7
+ export declare function useUnlikeActivity({ mutationFn, mutationHandlers: { mutate: mutateWrapper, error: onError, }, user, }: IMutationContext<unknown, Error, IUnlikeVars, ICache>): import("@tanstack/react-query/build/legacy/types").UseMutateFunction<unknown, Error, IUnlikeVars, import('../../../../../../discussion/shared').IActivity>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ export * from './cache.interface';
@@ -0,0 +1,4 @@
1
+ export declare const cacheMock1: Readonly<import('../../../../../discussion/shared').IActivity>;
2
+ export declare const cacheMock2: Readonly<import('../../../../../discussion/shared').IActivity>;
3
+ export declare const cacheMock3: Readonly<import('../../../../../discussion/shared').IActivity>;
4
+ export declare const cacheMock4: Readonly<import('../../../../../discussion/shared').IActivity>;
@@ -0,0 +1 @@
1
+ export * from './cache.mock';
@@ -0,0 +1,37 @@
1
+ export declare const activitySectionMock: {
2
+ actor: {
3
+ created_at: string;
4
+ updated_at: string;
5
+ id: string;
6
+ data: {
7
+ jobTitle: string;
8
+ name: string;
9
+ organization: string;
10
+ };
11
+ };
12
+ content: string;
13
+ feed_id: string;
14
+ foreign_id: string;
15
+ id: string;
16
+ latest_reactions: {
17
+ like: never[];
18
+ reply: never[];
19
+ };
20
+ latest_reactions_extra: {
21
+ like: never[];
22
+ reply: never[];
23
+ };
24
+ object: string;
25
+ origin: null;
26
+ own_reactions: {
27
+ like: never[];
28
+ reply: never[];
29
+ };
30
+ reaction_counts: {
31
+ like: number;
32
+ reply: number;
33
+ };
34
+ target: string;
35
+ time: string;
36
+ verb: string;
37
+ };
@@ -0,0 +1,2 @@
1
+ export { repliesFeedMock } from '../../../feeds/replies-feed';
2
+ export * from './activity-section.mock';
@@ -0,0 +1,3 @@
1
+ export declare const ACTIVITY_VERB = "post";
2
+ export declare const REPLY_KIND = "reply";
3
+ export declare const TMP_ID = "00000000-0000-0000-0000-000000000000";
@@ -0,0 +1,2 @@
1
+ import type { IHandlerContext } from '..';
2
+ export declare function buildErrorHandler<TCache>({ queryClient, queryKey }: IHandlerContext): (_err: Error, _vars: unknown, cache?: TCache) => void;
@@ -0,0 +1,2 @@
1
+ import type { IHandlerContext } from '..';
2
+ export declare function buildMutateHandler<TCache>({ queryClient, queryKey }: IHandlerContext): (fn: (_: TCache) => TCache) => Promise<TCache>;
@@ -0,0 +1,28 @@
1
+ import type { IUserContext } from '../../../context';
2
+ import type { IActivity, IReaction } from '..';
3
+ interface IPrepareActivityArgs {
4
+ content: string;
5
+ }
6
+ interface IEnrichActivityArgs {
7
+ activity: IActivity | Partial<IActivity>;
8
+ user: IUserContext;
9
+ }
10
+ interface IIncrementActivityLikesArgs {
11
+ activity: IActivity;
12
+ reaction?: IReaction;
13
+ user?: IUserContext;
14
+ }
15
+ interface IDecrementActivityLikesArgs {
16
+ activity: IActivity;
17
+ user?: IUserContext;
18
+ }
19
+ export declare function prepareActivity({ content }: IPrepareActivityArgs): {
20
+ content: string;
21
+ id: string;
22
+ time: string;
23
+ verb: string;
24
+ };
25
+ export declare function enrichActivity({ activity, user }: IEnrichActivityArgs): IActivity;
26
+ export declare function incrementActivityLikes({ activity, reaction }: IIncrementActivityLikesArgs): void;
27
+ export declare function decrementActivityLikes({ activity, user }: IDecrementActivityLikesArgs): void;
28
+ export {};
@@ -1,2 +1,2 @@
1
1
  export * from './activity.helper';
2
- export * from './cache.helper';
2
+ export * from './reply.helper';
@@ -0,0 +1,28 @@
1
+ export declare function buildEmptyReactionsForActivity(): {
2
+ latest_reactions: {
3
+ like: never[];
4
+ reply: never[];
5
+ };
6
+ reaction_counts: {
7
+ like: number;
8
+ reply: number;
9
+ };
10
+ own_reactions: {
11
+ like: never[];
12
+ reply: never[];
13
+ };
14
+ };
15
+ export declare function buildEmptyReactionsForReply(): {
16
+ latest_children: {
17
+ like: never[];
18
+ reply: never[];
19
+ };
20
+ children_counts: {
21
+ like: number;
22
+ reply: number;
23
+ };
24
+ own_children: {
25
+ like: never[];
26
+ reply: never[];
27
+ };
28
+ };
@@ -0,0 +1,33 @@
1
+ import { IUserContext } from '../../../context';
2
+ import type { IReaction } from '..';
3
+ interface IPrepareReplyArgs {
4
+ activityId: string;
5
+ content: string;
6
+ replyId?: string;
7
+ }
8
+ interface IEnrichReplyArgs {
9
+ reply: IReaction | Partial<IReaction>;
10
+ user: IUserContext;
11
+ }
12
+ interface IIncrementReplyLikesArgs {
13
+ reply: IReaction;
14
+ reaction?: IReaction;
15
+ user?: IUserContext;
16
+ }
17
+ interface IDecrementReplyLikesArgs {
18
+ reply: IReaction;
19
+ user?: IUserContext;
20
+ }
21
+ export declare function prepareReply({ activityId, replyId, content }: IPrepareReplyArgs): {
22
+ activity_id: string;
23
+ data: {
24
+ content: string;
25
+ };
26
+ id: string;
27
+ kind: string;
28
+ parent: string;
29
+ };
30
+ export declare function enrichReply({ reply, user }: IEnrichReplyArgs): IReaction;
31
+ export declare function incrementReplyLikes({ reply, reaction }: IIncrementReplyLikesArgs): void;
32
+ export declare function decrementReplyLikes({ reply, user }: IDecrementReplyLikesArgs): void;
33
+ export {};
@@ -0,0 +1,10 @@
1
+ import { IUserContext } from '../../../context';
2
+ export declare function buildUser(user: IUserContext): {
3
+ id: string;
4
+ data: {
5
+ name: string;
6
+ organization: string;
7
+ jobTitle: string;
8
+ thumbnail: string;
9
+ };
10
+ };
@@ -0,0 +1,5 @@
1
+ export * from './constants';
2
+ export * from './handlers';
3
+ export * from './helpers';
4
+ export * from './interfaces';
5
+ export * from './mocks';
@@ -0,0 +1,4 @@
1
+ import type { FlatActivityEnriched } from 'getstream';
2
+ export interface IActivity extends FlatActivityEnriched {
3
+ content: string;
4
+ }
@@ -0,0 +1,14 @@
1
+ import { QueryClient, QueryKey } from '@tanstack/react-query';
2
+ import type { IUserContext } from '../../../context';
3
+ export interface IHandlerContext {
4
+ queryClient: QueryClient;
5
+ queryKey: QueryKey;
6
+ }
7
+ export interface IMutationContext<TData, IError, TVars, TCache> extends IHandlerContext {
8
+ mutationFn: (vars: TVars) => Promise<TData>;
9
+ mutationHandlers: {
10
+ mutate: (callback: (cache: TCache) => TCache) => Promise<TCache>;
11
+ error: (err: IError, vars: TVars, cache?: TCache) => void;
12
+ };
13
+ user: IUserContext;
14
+ }
@@ -0,0 +1,4 @@
1
+ export * from './activity.interface';
2
+ export * from './context.interface';
3
+ export * from './reaction.interface';
4
+ export * from './user.interface';
@@ -0,0 +1,3 @@
1
+ import type { EnrichedReaction } from 'getstream';
2
+ export interface IReaction extends EnrichedReaction {
3
+ }
@@ -0,0 +1,9 @@
1
+ import type { EnrichedUser } from 'getstream';
2
+ export interface IUser extends EnrichedUser {
3
+ data: {
4
+ name?: string;
5
+ organization?: string;
6
+ jobTitle?: string;
7
+ thumbnail?: string;
8
+ };
9
+ }
@@ -0,0 +1,4 @@
1
+ export * from './activity.mock';
2
+ export * from './reaction.mock';
3
+ export * from './reply.mock';
4
+ export * from './user.mock';
@@ -0,0 +1,80 @@
1
+ export declare const replyMock1: Readonly<{
2
+ created_at: "2023-12-03T21:53:45.999851Z";
3
+ updated_at: "2023-12-03T21:53:45.999851Z";
4
+ id: "some-reply-id-1";
5
+ user_id: "some-user-id-2";
6
+ user: {
7
+ id: "some-user-id-2";
8
+ data: {};
9
+ created_at: string;
10
+ updated_at: string;
11
+ };
12
+ kind: "reply";
13
+ activity_id: "some-activity-id-1";
14
+ data: {
15
+ content: string;
16
+ };
17
+ parent: "";
18
+ latest_children: {};
19
+ children_counts: {};
20
+ }>;
21
+ export declare const replyMock2: Readonly<{
22
+ created_at: "2023-12-03T21:53:45.999851Z";
23
+ updated_at: "2023-12-03T21:53:45.999851Z";
24
+ id: "some-reply-id-2";
25
+ user_id: "some-user-id-1";
26
+ user: {
27
+ id: "some-user-id-1";
28
+ data: {};
29
+ created_at: string;
30
+ updated_at: string;
31
+ };
32
+ kind: "reply";
33
+ activity_id: "some-activity-id-2";
34
+ data: {
35
+ content: string;
36
+ };
37
+ parent: "";
38
+ latest_children: {};
39
+ children_counts: {};
40
+ }>;
41
+ export declare const replyMock3: Readonly<{
42
+ created_at: "2023-12-03T21:53:45.999851Z";
43
+ updated_at: "2023-12-03T21:53:45.999851Z";
44
+ id: "some-reply-id-3";
45
+ user_id: "some-user-id-2";
46
+ user: {
47
+ id: "some-user-id-2";
48
+ data: {};
49
+ created_at: string;
50
+ updated_at: string;
51
+ };
52
+ kind: "reply";
53
+ activity_id: "some-activity-id-3";
54
+ data: {
55
+ content: string;
56
+ };
57
+ parent: "";
58
+ latest_children: {};
59
+ children_counts: {};
60
+ }>;
61
+ export declare const replyMock4: Readonly<{
62
+ created_at: "2023-12-03T21:53:45.999851Z";
63
+ updated_at: "2023-12-03T21:53:45.999851Z";
64
+ id: "some-reply-id-3";
65
+ user_id: "some-user-id-1";
66
+ user: {
67
+ id: "some-user-id-1";
68
+ data: {};
69
+ created_at: string;
70
+ updated_at: string;
71
+ };
72
+ kind: "reply";
73
+ activity_id: "some-activity-id-4";
74
+ data: {
75
+ content: string;
76
+ };
77
+ parent: "";
78
+ latest_children: {};
79
+ children_counts: {};
80
+ }>;