@apolitical/component-library 8.7.23 → 8.7.25-ac.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.
@@ -0,0 +1,48 @@
1
+ import { QueryKey } from '@tanstack/react-query';
2
+ import { IUserContext } from '../../../../../../context';
3
+ import { DiscussionType } from '../../../../../../discussion/shared';
4
+ import type { ICacheItem, ICachePage, ICacheSubitem, IParsedReplies } from '../..';
5
+ export interface IQueryFns {
6
+ create: (_: unknown) => Promise<ICacheItem>;
7
+ edit: (_: unknown) => Promise<ICacheItem>;
8
+ like: (_: unknown) => Promise<ICacheSubitem>;
9
+ list: (_: unknown) => Promise<ICachePage>;
10
+ remove: (_: unknown) => Promise<void>;
11
+ unlike: (_: unknown) => Promise<ICacheSubitem>;
12
+ }
13
+ interface IRepliesFeedArgs {
14
+ queryFns: IQueryFns;
15
+ queryKey: QueryKey;
16
+ type?: DiscussionType;
17
+ }
18
+ export interface IRepliesFeedReturn {
19
+ replies: IParsedReplies[];
20
+ mutations: {
21
+ create: (vars: {
22
+ activityId: string;
23
+ content: string;
24
+ replyId?: string;
25
+ }) => void;
26
+ edit: (vars: {
27
+ replyId: string;
28
+ content: string;
29
+ }) => void;
30
+ remove: (vars: {
31
+ replyId: string;
32
+ }) => void;
33
+ like: (vars: {
34
+ replyId: string;
35
+ }) => void;
36
+ unlike: (vars: {
37
+ replyId: string;
38
+ reactionId: string;
39
+ }) => void;
40
+ };
41
+ user: IUserContext;
42
+ error: Error | null;
43
+ isLoading: boolean;
44
+ hasNextPage: boolean;
45
+ fetchNextPage: () => void;
46
+ }
47
+ export declare function useRepliesFeed({ queryFns: { create, edit, like, list, remove, unlike }, queryKey, type, }: IRepliesFeedArgs): IRepliesFeedReturn;
48
+ export {};
@@ -1,2 +1,2 @@
1
1
  export * from './feed.hook';
2
- export type { IParsedReplies } from './parse-replies';
2
+ export { type IParsedReplies } from './parse-replies';
@@ -1 +1,2 @@
1
1
  export * from './parse-replies';
2
+ export { type IParsedReplies } from './parse-replies';
@@ -22,9 +22,10 @@ export interface IParsedReplies {
22
22
  user: EnrichedUser<DefaultGenerics> | undefined;
23
23
  locale?: string;
24
24
  }
25
- export declare function parseReplies({ replies, user, replyType, }: {
25
+ export declare function parseReplies({ replies, user, replyType, currentLocale, }: {
26
26
  replies: IReaction[];
27
27
  user: IUserContext;
28
28
  replyType?: DiscussionType;
29
+ currentLocale?: string;
29
30
  }): IParsedReplies[];
30
31
  export {};
@@ -1,3 +1,4 @@
1
1
  export type { IQueryFns as IRepliesFeedQueryFns } from './cache';
2
2
  export { repliesFeedMock, courseDiscussionRepliesFeedMock } from './mocks';
3
3
  export { default as RepliesFeed } from './replies-feed';
4
+ export { useRepliesFeed, type IRepliesFeedReturn, type IParsedReplies } from './cache';
@@ -22,6 +22,16 @@ export declare const repliesFeedMock: {
22
22
  activity_id: string;
23
23
  data: {
24
24
  content: string;
25
+ payload: {
26
+ id: string;
27
+ collection: string;
28
+ data: {
29
+ original: {
30
+ body: string;
31
+ locale: string;
32
+ };
33
+ };
34
+ };
25
35
  };
26
36
  parent: string;
27
37
  latest_children: {
@@ -49,6 +59,7 @@ export declare const repliesFeedMock: {
49
59
  activity_id: string;
50
60
  data: {
51
61
  content: string;
62
+ payload?: undefined;
52
63
  };
53
64
  parent: string;
54
65
  latest_children: {
@@ -120,6 +131,7 @@ export declare const repliesFeedMock: {
120
131
  activity_id: string;
121
132
  data: {
122
133
  content: string;
134
+ payload?: undefined;
123
135
  };
124
136
  parent: string;
125
137
  latest_children: {