@apolitical/component-library 5.0.0-4749.1 → 5.0.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 (36) hide show
  1. package/communities/members-list/members-list.d.ts +2 -1
  2. package/communities/members-list/members-list.mock.d.ts +21 -0
  3. package/context/badges/badges.context.d.ts +13 -0
  4. package/context/badges/badges.hook.d.ts +1 -0
  5. package/context/badges/badges.provider.d.ts +8 -0
  6. package/context/badges/index.d.ts +4 -0
  7. package/context/global/global.providers.d.ts +1 -1
  8. package/context/index.d.ts +1 -0
  9. package/discussion/components/add-post/add-post.d.ts +2 -0
  10. package/discussion/components/form/form.d.ts +1 -1
  11. package/discussion/components/form/form.type.d.ts +2 -0
  12. package/discussion/components/post/post.d.ts +4 -1
  13. package/discussion/discussion.helpers.d.ts +1 -0
  14. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +42 -0
  15. package/discussion/feeds/replies-feed/mocks/replies-feed.mock.d.ts +33 -0
  16. package/discussion/feeds/replies-feed/nested-replies-feed/mocks/nested-replies-feed.mock.d.ts +29 -2
  17. package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +5 -0
  18. package/discussion/shared/interfaces/user.interface.d.ts +2 -0
  19. package/form/components/rich-text-editor/helpers/transform/transform.d.ts +1 -1
  20. package/index.js +63 -63
  21. package/index.mjs +7716 -7550
  22. package/package.json +1 -1
  23. package/style.css +1 -1
  24. package/styles/variables/colors/_colors.scss +1 -0
  25. package/styles/variables/colors/theme/_user.scss +6 -0
  26. package/text/pill/pill.d.ts +2 -1
  27. package/user/badge/badge.d.ts +7 -0
  28. package/user/badge/icon-mapping.d.ts +11 -0
  29. package/user/badge/index.d.ts +2 -0
  30. package/user/badge/interface/badge.interfaces.d.ts +9 -0
  31. package/user/badges/badges.d.ts +12 -0
  32. package/user/badges/badges.interface.d.ts +8 -0
  33. package/user/badges/index.d.ts +2 -0
  34. package/user/member/member.d.ts +7 -1
  35. package/user/member/member.helpers.d.ts +2 -0
  36. package/user/member/member.mock.d.ts +8 -0
@@ -10,6 +10,7 @@ interface Props {
10
10
  data: CommunityMemberProps[];
11
11
  total?: number;
12
12
  };
13
+ communitySlug?: string;
13
14
  /** Whether the user is a member of the community */
14
15
  isMember?: boolean;
15
16
  /** Whether there is another page of members to load */
@@ -25,5 +26,5 @@ interface Props {
25
26
  /** Additional classes */
26
27
  className?: string;
27
28
  }
28
- declare const MembersList: ({ members: { data, total }, isMember, hasNextPage, loadNextPage, profile, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
29
+ declare const MembersList: ({ members: { data, total }, communitySlug, isMember, hasNextPage, loadNextPage, profile, gtmContext, gtmType, className, }: Props) => import("react/jsx-runtime").JSX.Element | null;
29
30
  export default MembersList;
@@ -1,6 +1,23 @@
1
1
  declare const _default: {
2
2
  members: {
3
3
  data: ({
4
+ id: string;
5
+ name: string;
6
+ jobTitle: string;
7
+ organization: string;
8
+ badges: {
9
+ communities: {
10
+ playground: string[];
11
+ };
12
+ };
13
+ location: {
14
+ country: string;
15
+ };
16
+ image: {
17
+ thumbnail: string;
18
+ };
19
+ isAdmin: boolean;
20
+ } | {
4
21
  id: string;
5
22
  name: string;
6
23
  jobTitle: string;
@@ -12,6 +29,7 @@ declare const _default: {
12
29
  thumbnail: string;
13
30
  };
14
31
  isAdmin: boolean;
32
+ badges?: undefined;
15
33
  } | {
16
34
  id: string;
17
35
  name: string;
@@ -23,6 +41,7 @@ declare const _default: {
23
41
  image: {
24
42
  thumbnail: string;
25
43
  };
44
+ badges?: undefined;
26
45
  isAdmin?: undefined;
27
46
  } | {
28
47
  id: string;
@@ -32,6 +51,7 @@ declare const _default: {
32
51
  location: {
33
52
  country: string;
34
53
  };
54
+ badges?: undefined;
35
55
  image?: undefined;
36
56
  isAdmin?: undefined;
37
57
  })[];
@@ -41,6 +61,7 @@ declare const _default: {
41
61
  length: number;
42
62
  limit: number;
43
63
  };
64
+ communitySlug: string;
44
65
  profile: {
45
66
  hooks: {
46
67
  useMaps: () => {
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface IBadge {
3
+ name: string;
4
+ slug: string;
5
+ description?: string;
6
+ icon?: string;
7
+ colour?: 'Grey' | 'Blue' | 'Green' | 'Pink' | 'Purple' | 'Orange';
8
+ }
9
+ export interface IBadgesContext {
10
+ badges: IBadge[];
11
+ isLoading: boolean;
12
+ }
13
+ export declare const BadgesContext: import("react").Context<IBadgesContext>;
@@ -0,0 +1 @@
1
+ export declare function useBadges(): import("./badges.context").IBadgesContext;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { IBadgesContext } from './badges.context';
3
+ interface Props {
4
+ children: React.ReactNode;
5
+ badges: IBadgesContext;
6
+ }
7
+ export declare const BadgesProvider: ({ children, badges }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ export type { IBadge, IBadgesContext } from './badges.context';
2
+ export * from './badges.context';
3
+ export * from './badges.hook';
4
+ export * from './badges.provider';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { type IIntlContext } from '../intl';
3
3
  import { type IUserContext } from '../user';
4
4
  interface Props {
5
- bootstrap: () => Promise<IUserContext>;
5
+ bootstrap: () => Promise<IUserContext | any[]>;
6
6
  children: React.ReactNode;
7
7
  intl?: IIntlContext;
8
8
  showDevTools?: boolean;
@@ -1,3 +1,4 @@
1
+ export * from './badges';
1
2
  export * from './cache';
2
3
  export * from './flags';
3
4
  export * from './global';
@@ -3,6 +3,8 @@ import type { IDiscussionForm } from '../../../discussion/components/form';
3
3
  interface Props {
4
4
  /** Whether the form should be displayed as a card */
5
5
  isCard?: boolean;
6
+ /** The ID of the parent, used for slugs */
7
+ parentId?: string;
6
8
  /** Props for the form - this uses everything the `DiscussionForm` component does */
7
9
  form: IDiscussionForm;
8
10
  /** Details about what a user needs to have to be able to access the form */
@@ -1,3 +1,3 @@
1
1
  import { IDiscussionForm } from './form.type';
2
- declare const DiscussionForm: ({ id, content, userHasPermissions, meta, placeholder, maxLength, buttons, forceShow, isCommunity, functions, data, gtmContext, }: IDiscussionForm) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DiscussionForm: ({ id, parentId, content, userHasPermissions, meta, placeholder, maxLength, buttons, forceShow, isCommunity, functions, data, gtmContext, }: IDiscussionForm) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DiscussionForm;
@@ -33,6 +33,8 @@ export interface IDiscussionFormMeta {
33
33
  export interface IDiscussionForm {
34
34
  /** A unique ID for the form */
35
35
  id?: string;
36
+ /** The ID of the parent, used for slugs */
37
+ parentId?: string;
36
38
  /** Information about the content being created/edited */
37
39
  content: IDiscussionContent;
38
40
  /** If the user has permission to interact with the form, e.g. if they're a member of the community */
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type ListMembers, ClickMentionFallback } from '../../../form';
3
3
  import { DiscussionCreateContentFunction, DiscussionCreateLikeFunction, DiscussionDeleteLikeFunction, IForceHide, IFullDiscussionContent } from '../../discussion';
4
+ import { IBadgesOption } from '../../../user/badges';
4
5
  interface PostContent extends IFullDiscussionContent {
5
6
  /** The post body */
6
7
  postBody?: string;
@@ -77,6 +78,8 @@ interface Props {
77
78
  setFocus?: boolean;
78
79
  /** If the post is used within a community */
79
80
  isCommunity?: boolean;
81
+ /** Whether to show badges and the scope of the badge */
82
+ badges?: IBadgesOption;
80
83
  }
81
- declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, }: Props) => import("react/jsx-runtime").JSX.Element;
84
+ declare const Post: ({ element, content, userHasPermissions, userHasOwnerPermissions, isLoading, originalAuthorId, forceHide, functions, links, className, gtmContext, children, isTruncated, styling: { showShareLinkButton }, setFocus, isCommunity, badges, }: Props) => import("react/jsx-runtime").JSX.Element;
82
85
  export default Post;
@@ -15,4 +15,5 @@ export declare const getAuthorData: (author: IUser) => "deleted" | {
15
15
  image: {
16
16
  thumbnail: string | undefined;
17
17
  };
18
+ badges: import("../user/badge").IBadgesObject | undefined;
18
19
  };
@@ -8,6 +8,11 @@ export declare const activitiesFeedMock: {
8
8
  jobTitle: string;
9
9
  name: string;
10
10
  organization: string;
11
+ badges: {
12
+ communities: {
13
+ 'community-slug': string[];
14
+ };
15
+ };
11
16
  };
12
17
  };
13
18
  title: string;
@@ -62,6 +67,11 @@ export declare const activitiesFeedMock: {
62
67
  jobTitle: string;
63
68
  name: string;
64
69
  organization: string;
70
+ badges: {
71
+ communities: {
72
+ 'community-slug': string[];
73
+ };
74
+ };
65
75
  };
66
76
  };
67
77
  title: string;
@@ -92,6 +102,7 @@ export declare const activitiesFeedMock: {
92
102
  jobTitle: string;
93
103
  name: string;
94
104
  organization: string;
105
+ badges?: undefined;
95
106
  };
96
107
  };
97
108
  content: string;
@@ -113,6 +124,37 @@ export declare const activitiesFeedMock: {
113
124
  time: string;
114
125
  verb: string;
115
126
  title?: undefined;
127
+ } | {
128
+ actor: {
129
+ created_at: string;
130
+ updated_at: string;
131
+ id: string;
132
+ data: {
133
+ jobTitle: string;
134
+ name: string;
135
+ organization: string;
136
+ badges?: undefined;
137
+ };
138
+ };
139
+ title: string;
140
+ content: string;
141
+ feed_id: string;
142
+ foreign_id: string;
143
+ id: string;
144
+ latest_reactions: {
145
+ pin?: undefined;
146
+ };
147
+ latest_reactions_extra: {};
148
+ object: string;
149
+ origin: null;
150
+ own_reactions: {};
151
+ reaction_counts: {
152
+ like?: undefined;
153
+ pin?: undefined;
154
+ };
155
+ target: string;
156
+ time: string;
157
+ verb: string;
116
158
  })[];
117
159
  next: string;
118
160
  duration: string;
@@ -11,6 +11,11 @@ export declare const repliesFeedMock: {
11
11
  id: string;
12
12
  data: {
13
13
  name: string;
14
+ badges: {
15
+ communities: {
16
+ 'community-slug': string[];
17
+ };
18
+ };
14
19
  };
15
20
  };
16
21
  kind: string;
@@ -37,6 +42,7 @@ export declare const repliesFeedMock: {
37
42
  id: string;
38
43
  data: {
39
44
  name: string;
45
+ badges?: undefined;
40
46
  };
41
47
  };
42
48
  kind: string;
@@ -96,6 +102,33 @@ export declare const repliesFeedMock: {
96
102
  children_counts: {
97
103
  reply: number;
98
104
  };
105
+ } | {
106
+ created_at: string;
107
+ updated_at: string;
108
+ id: string;
109
+ user_id: string;
110
+ user: {
111
+ created_at: string;
112
+ updated_at: string;
113
+ id: string;
114
+ data: {
115
+ name: string;
116
+ badges?: undefined;
117
+ };
118
+ };
119
+ kind: string;
120
+ activity_id: string;
121
+ data: {
122
+ content: string;
123
+ };
124
+ parent: string;
125
+ latest_children: {
126
+ reply?: undefined;
127
+ };
128
+ children_counts: {
129
+ reply?: undefined;
130
+ };
131
+ own_children?: undefined;
99
132
  })[];
100
133
  duration: string;
101
134
  };
@@ -1,6 +1,6 @@
1
1
  export declare const nestedRepliesFeedMock: {
2
2
  next: string;
3
- results: {
3
+ results: ({
4
4
  created_at: string;
5
5
  updated_at: string;
6
6
  id: string;
@@ -11,6 +11,11 @@ export declare const nestedRepliesFeedMock: {
11
11
  id: string;
12
12
  data: {
13
13
  name: string;
14
+ badges: {
15
+ communities: {
16
+ 'community-slug': string[];
17
+ };
18
+ };
14
19
  };
15
20
  };
16
21
  kind: string;
@@ -21,6 +26,28 @@ export declare const nestedRepliesFeedMock: {
21
26
  parent: string;
22
27
  latest_children: {};
23
28
  children_counts: {};
24
- }[];
29
+ } | {
30
+ created_at: string;
31
+ updated_at: string;
32
+ id: string;
33
+ user_id: string;
34
+ user: {
35
+ created_at: string;
36
+ updated_at: string;
37
+ id: string;
38
+ data: {
39
+ name: string;
40
+ badges?: undefined;
41
+ };
42
+ };
43
+ kind: string;
44
+ activity_id: string;
45
+ data: {
46
+ content: string;
47
+ };
48
+ parent: string;
49
+ latest_children: {};
50
+ children_counts: {};
51
+ })[];
25
52
  duration: string;
26
53
  };
@@ -10,6 +10,11 @@ export declare const activitySectionMock: {
10
10
  location: {
11
11
  country: string;
12
12
  };
13
+ badges: {
14
+ communities: {
15
+ 'community-slug': string[];
16
+ };
17
+ };
13
18
  };
14
19
  };
15
20
  content: string;
@@ -1,3 +1,4 @@
1
+ import { IBadgesObject } from '../../../user/badge';
1
2
  import type { EnrichedUser } from 'getstream';
2
3
  export interface IUser extends EnrichedUser {
3
4
  error?: string;
@@ -9,5 +10,6 @@ export interface IUser extends EnrichedUser {
9
10
  country?: string;
10
11
  };
11
12
  thumbnail?: string;
13
+ badges?: IBadgesObject;
12
14
  };
13
15
  }
@@ -12,7 +12,7 @@ export default function transform<T extends InputNodeTypes>(node: MdastNode, opt
12
12
  position?: any;
13
13
  ordered?: boolean | undefined;
14
14
  checked?: any;
15
- depth?: 1 | 2 | 3 | 4 | 6 | 5 | undefined;
15
+ depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
16
16
  lang?: string | undefined;
17
17
  spread?: any;
18
18
  indent?: any;