@apolitical/component-library 8.7.12-re.1 → 8.7.12

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.
@@ -1,3 +1,3 @@
1
1
  import type { CardProps } from './../cards.types';
2
- declare const Card: ({ id, className, buildCardData, buildMemberData, card, cta, gtmContext, handleCardClick, meta, onClick, }: CardProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Card: ({ id, className, buildCardData, buildMemberData, card, cta, gtmContext, handleCardClick, meta, }: CardProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Card;
@@ -11,8 +11,6 @@ export interface ICardBlockProps {
11
11
  /** Additional classes to add to the card block */
12
12
  className?: string;
13
13
  focusCardIndex?: number;
14
- /** A callback to run when the user clicks on the card */
15
- onClick?: (link: string) => void;
16
14
  }
17
15
  declare const CardBlock: ({ cards, cardTypes, className, gtmContext, ...props }: ICardBlockProps) => import("react/jsx-runtime").JSX.Element;
18
16
  export default CardBlock;
@@ -104,8 +104,6 @@ export interface CardProps {
104
104
  /** If the browser should focus on this card */
105
105
  setFocus?: boolean;
106
106
  };
107
- /** A callback to run when the user clicks on the card */
108
- onClick?: (link: string) => void;
109
107
  }
110
108
  export interface CarouselTitleProps {
111
109
  /** The title text */
@@ -158,8 +156,6 @@ export interface IndividualCarouselProps extends BaseCarouselProps {
158
156
  cards: CardType[];
159
157
  /** The types for each card, from Contentful */
160
158
  cardTypes: CardContentType[];
161
- /** A callback to run when the user clicks on the card */
162
- onClick?: (link: string) => void;
163
159
  }
164
160
  export interface NarrowCardType {
165
161
  /** The image to use */
@@ -3,7 +3,7 @@ import { ListMembers } from '../../../form';
3
3
  import { ICategory } from '../../shared';
4
4
  export declare const getInitialBody: (body: string, isTruncated: boolean | number, mentions?: IMentions) => string;
5
5
  export declare const getPostBody: (body: string, isTruncated: boolean | number, mentions?: IMentions, listMembers?: ListMembers) => Promise<string>;
6
- export declare const enrichPostCategories: (postCategories: string[], allCategories: ICategory[]) => (ICategory | undefined)[];
6
+ export declare const enrichPostCategories: (postCategories: string[] | ICategory[], allCategories: ICategory[]) => (ICategory | undefined)[];
7
7
  export declare const allowClickUntilClassNameFound: (event: React.MouseEvent<HTMLElement, MouseEvent>, contentClasses: string[], breakClassName: string) => boolean;
8
8
  export declare const getTitleText: (title: string | {
9
9
  [key: string]: string;
@@ -1,24 +1,24 @@
1
1
  export declare const cacheMock1: Readonly<{
2
2
  pages: {
3
3
  next: string;
4
- results: import('../../../../../discussion/shared').IActivity[];
4
+ results: import("@apolitical/contracts").IActivity[];
5
5
  }[];
6
6
  }>;
7
7
  export declare const cacheMock2: Readonly<{
8
8
  pages: {
9
9
  next: string;
10
- results: import('../../../../../discussion/shared').IActivity[];
10
+ results: import("@apolitical/contracts").IActivity[];
11
11
  }[];
12
12
  }>;
13
13
  export declare const cacheMock3: Readonly<{
14
14
  pages: {
15
15
  next: string;
16
- results: import('../../../../../discussion/shared').IActivity[];
16
+ results: import("@apolitical/contracts").IActivity[];
17
17
  }[];
18
18
  }>;
19
19
  export declare const cacheMock4: Readonly<{
20
20
  pages: {
21
21
  next: string;
22
- results: import('../../../../../discussion/shared').IActivity[];
22
+ results: import("@apolitical/contracts").IActivity[];
23
23
  }[];
24
24
  }>;
@@ -15,6 +15,15 @@ export declare const activitiesFeedMock: {
15
15
  };
16
16
  };
17
17
  };
18
+ payload: {
19
+ data: {
20
+ original: {
21
+ title: string;
22
+ locale: string;
23
+ body: string;
24
+ };
25
+ };
26
+ };
18
27
  title: string;
19
28
  categories: string[];
20
29
  content: string;
@@ -124,6 +133,15 @@ export declare const activitiesFeedMock: {
124
133
  };
125
134
  };
126
135
  };
136
+ payload: {
137
+ data: {
138
+ original: {
139
+ title: string;
140
+ locale: string;
141
+ body: string;
142
+ };
143
+ };
144
+ };
127
145
  title: string;
128
146
  categories: string[];
129
147
  content: string;
@@ -157,6 +175,15 @@ export declare const activitiesFeedMock: {
157
175
  badges?: undefined;
158
176
  };
159
177
  };
178
+ payload: {
179
+ data: {
180
+ original: {
181
+ title: string;
182
+ locale: string;
183
+ body: string;
184
+ };
185
+ };
186
+ };
160
187
  categories: string[];
161
188
  content: string;
162
189
  feed_id: string;
@@ -212,6 +239,15 @@ export declare const activitiesFeedMock: {
212
239
  badges?: undefined;
213
240
  };
214
241
  };
242
+ payload: {
243
+ data: {
244
+ original: {
245
+ title: string;
246
+ locale: string;
247
+ body: string;
248
+ };
249
+ };
250
+ };
215
251
  title: string;
216
252
  content: string;
217
253
  feed_id: string;
@@ -3,5 +3,5 @@ export * from './feeds';
3
3
  export * from './discussion.helpers';
4
4
  export * from './sections';
5
5
  export * from './shared/interfaces';
6
- export { getActivityPollOptions, constructActivityContent } from './shared/helpers';
6
+ export { getActivityPollOptions, constructActivityContent, getLocalisedActivityContent, getLocalisedReactionContent, } from './shared/helpers';
7
7
  export { useScrollToPost } from './shared/hooks';
@@ -1,4 +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>;
1
+ export declare const cacheMock1: Readonly<import("@apolitical/contracts").IActivity>;
2
+ export declare const cacheMock2: Readonly<import("@apolitical/contracts").IActivity>;
3
+ export declare const cacheMock3: Readonly<import("@apolitical/contracts").IActivity>;
4
+ export declare const cacheMock4: Readonly<import("@apolitical/contracts").IActivity>;
@@ -1,5 +1,6 @@
1
1
  import type { IUserContext } from '../../../context';
2
- import type { IActivity, ICategory, IReaction } from '..';
2
+ import { type IActivity } from '@apolitical/contracts';
3
+ import type { ICategory, IReaction } from '..';
3
4
  import { ActivityType } from '../../../discussion/shared';
4
5
  import { ResultsVisibility } from '../../../polls';
5
6
  import { IPostContent } from '../../components';
@@ -1,11 +1,9 @@
1
- export declare const getLocalisedActivityContent: ({ content, locale, }: {
2
- content: {
3
- [key: string]: string;
4
- };
5
- locale: string;
1
+ import { ELocale, IActivity } from '@apolitical/contracts';
2
+ export declare const getLocalisedActivityContent: ({ payload, locale, }: {
3
+ payload: IActivity['payload']['data'];
4
+ locale: ELocale;
6
5
  }) => string;
7
- export declare const getLocalisedReactionContent: ({ content, }: {
8
- content: {
9
- [key: string]: string;
10
- };
6
+ export declare const getLocalisedReactionContent: ({ payload, locale, }: {
7
+ payload: IActivity['payload']['data'];
8
+ locale: ELocale;
11
9
  }) => string;
@@ -1,5 +1,5 @@
1
1
  import type { IPollOption } from '../../../polls';
2
- import { type IActivity } from '../interfaces/activity.interface';
2
+ import { type IActivity } from '@apolitical/contracts';
3
3
  import type { IUserContext } from '../../../context';
4
4
  import { ICacheItem } from '../../feeds/activities-feed/cache';
5
5
  interface IPreparePollVoteArgs {
@@ -26,7 +26,7 @@ interface IRemovePollVoteArgs {
26
26
  activity: IActivity;
27
27
  reactionId: string;
28
28
  }
29
- export declare const getActivityPollOptions: (pollOption: ICacheItem, locale?: string) => IPollOption[];
29
+ export declare const getActivityPollOptions: (pollOption: ICacheItem, _locale?: string) => IPollOption[];
30
30
  export declare function preparePollVote({ activity, reactionId, user }: IPreparePollVoteArgs): void;
31
31
  export declare function enrichPollVote({ activity, reactionId, correctReactionId, user, }: IEnrichPollVoteArgs): void;
32
32
  export declare function removePollVote({ activity, reactionId }: IRemovePollVoteArgs): void;
@@ -1,30 +1,7 @@
1
- import type { FlatActivityEnriched } from 'getstream';
2
- import type { IEnrichedUrlData } from '../../../navigation/enriched-url';
3
- import { ResultsVisibility } from '../../../polls/poll';
1
+ import { type IActivity as IActivityContract } from '@apolitical/contracts';
4
2
  export declare enum ActivityType {
5
3
  Post = "post",
6
4
  Poll = "poll"
7
5
  }
8
- export interface IActivity extends FlatActivityEnriched {
9
- content: string | {
10
- [key: string]: string;
11
- };
12
- categories?: string[];
13
- feed_id?: string;
14
- title: string | {
15
- [key: string]: string;
16
- };
17
- total_replies?: number;
18
- total_likes?: number;
19
- additional_data?: {
20
- link?: IEnrichedUrlData | false | undefined;
21
- };
22
- settings?: {
23
- show_remove_vote?: boolean;
24
- allow_multiple_votes?: boolean;
25
- deadline_at?: string;
26
- hide_participants?: boolean;
27
- number_of_winners?: number;
28
- results_visibility?: ResultsVisibility;
29
- };
6
+ export interface IActivity extends IActivityContract {
30
7
  }
@@ -2,5 +2,6 @@ export * from './activity.interface';
2
2
  export * from './community.category.interface';
3
3
  export * from './context.interface';
4
4
  export * from './discussion.interface';
5
+ export * from './payload.interface';
5
6
  export * from './reaction.interface';
6
7
  export * from './user.interface';
@@ -0,0 +1,16 @@
1
+ import { ELocale } from '@apolitical/contracts';
2
+ export interface IPayload {
3
+ data: {
4
+ original: {
5
+ body?: string;
6
+ title?: string;
7
+ locale: ELocale;
8
+ };
9
+ translations?: {
10
+ [key in ELocale]?: {
11
+ body?: string;
12
+ title?: string;
13
+ };
14
+ };
15
+ };
16
+ }