@amityco/ui-kit-open-source 4.0.0 → 4.1.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 (52) hide show
  1. package/README.md +126 -16
  2. package/dist/esm/index.css +6 -1
  3. package/dist/esm/index.js +1660 -2980
  4. package/dist/index.css +6 -1
  5. package/dist/index.d.mts +718 -86
  6. package/dist/index.d.ts +718 -86
  7. package/dist/index.js +1847 -3126
  8. package/dist/metafile-cjs.json +1 -1
  9. package/dist/metafile-esm.json +1 -1
  10. package/package.json +46 -24
  11. package/dist/Inter-Black-PFV6RWF7.woff2 +0 -0
  12. package/dist/Inter-BlackItalic-OUXR4CVK.woff2 +0 -0
  13. package/dist/Inter-Bold-K6PA7FOK.woff2 +0 -0
  14. package/dist/Inter-BoldItalic-QKFESTQE.woff2 +0 -0
  15. package/dist/Inter-ExtraBold-2ZPQFALF.woff2 +0 -0
  16. package/dist/Inter-ExtraBoldItalic-RR7KYXHD.woff2 +0 -0
  17. package/dist/Inter-ExtraLight-NASBO7I6.woff2 +0 -0
  18. package/dist/Inter-ExtraLightItalic-AUJY3XPT.woff2 +0 -0
  19. package/dist/Inter-Italic-2WJ2RX3Z.woff2 +0 -0
  20. package/dist/Inter-Light-E4ED7JRX.woff2 +0 -0
  21. package/dist/Inter-LightItalic-BJ4DXCNT.woff2 +0 -0
  22. package/dist/Inter-Medium-3R4SWUEO.woff2 +0 -0
  23. package/dist/Inter-MediumItalic-QTJUSOU7.woff2 +0 -0
  24. package/dist/Inter-Regular-6HYMGWZS.woff2 +0 -0
  25. package/dist/Inter-SemiBold-7SYQBR3A.woff2 +0 -0
  26. package/dist/Inter-SemiBoldItalic-3EHSSXIM.woff2 +0 -0
  27. package/dist/Inter-Thin-3L5KITMZ.woff2 +0 -0
  28. package/dist/Inter-ThinItalic-J7DGFM6P.woff2 +0 -0
  29. package/dist/Inter-italic.var-SWFAXF2C.woff2 +0 -0
  30. package/dist/Inter-roman.var-WIJJYAE4.woff2 +0 -0
  31. package/dist/Inter.var-OMHIC2JW.woff2 +0 -0
  32. package/dist/esm/Inter-Black-PFV6RWF7.woff2 +0 -0
  33. package/dist/esm/Inter-BlackItalic-OUXR4CVK.woff2 +0 -0
  34. package/dist/esm/Inter-Bold-K6PA7FOK.woff2 +0 -0
  35. package/dist/esm/Inter-BoldItalic-QKFESTQE.woff2 +0 -0
  36. package/dist/esm/Inter-ExtraBold-2ZPQFALF.woff2 +0 -0
  37. package/dist/esm/Inter-ExtraBoldItalic-RR7KYXHD.woff2 +0 -0
  38. package/dist/esm/Inter-ExtraLight-NASBO7I6.woff2 +0 -0
  39. package/dist/esm/Inter-ExtraLightItalic-AUJY3XPT.woff2 +0 -0
  40. package/dist/esm/Inter-Italic-2WJ2RX3Z.woff2 +0 -0
  41. package/dist/esm/Inter-Light-E4ED7JRX.woff2 +0 -0
  42. package/dist/esm/Inter-LightItalic-BJ4DXCNT.woff2 +0 -0
  43. package/dist/esm/Inter-Medium-3R4SWUEO.woff2 +0 -0
  44. package/dist/esm/Inter-MediumItalic-QTJUSOU7.woff2 +0 -0
  45. package/dist/esm/Inter-Regular-6HYMGWZS.woff2 +0 -0
  46. package/dist/esm/Inter-SemiBold-7SYQBR3A.woff2 +0 -0
  47. package/dist/esm/Inter-SemiBoldItalic-3EHSSXIM.woff2 +0 -0
  48. package/dist/esm/Inter-Thin-3L5KITMZ.woff2 +0 -0
  49. package/dist/esm/Inter-ThinItalic-J7DGFM6P.woff2 +0 -0
  50. package/dist/esm/Inter-italic.var-SWFAXF2C.woff2 +0 -0
  51. package/dist/esm/Inter-roman.var-WIJJYAE4.woff2 +0 -0
  52. package/dist/esm/Inter.var-OMHIC2JW.woff2 +0 -0
package/dist/index.d.mts CHANGED
@@ -1,48 +1,341 @@
1
- import React, { ReactNode } from 'react';
2
- import { PostContentType } from '@amityco/ts-sdk';
3
- import * as styled_components from 'styled-components';
1
+ import React, { ReactNode, RefObject } from 'react';
4
2
  import * as styled_components_dist_types from 'styled-components/dist/types';
3
+ import * as styled_components from 'styled-components';
5
4
 
6
- type CustomComponentName = 'Avatar' | 'CategoryHeader' | 'CategorySelector' | 'Chat' | 'ChatDetails' | 'ChatHeader' | 'ChatItem' | 'Comment' | 'CommentComposerBar' | 'CommentLikeButton' | 'CommunityCreatedModel' | 'CommunityCreationModal' | 'CommunityForm' | 'CommunityItem' | 'CommunityMembers' | 'CommunityName' | 'CommunityPermissions' | 'EmptyFeed' | 'EngagementBar' | 'Feed' | 'FeedHeaderTabs' | 'File' | 'Image' | 'ImageGallery' | 'Images' | 'Layout' | 'MediaGallery' | 'MenuTab' | 'Message' | 'MessageComposerBar' | 'MessageList' | 'Post' | 'PostLikeButton' | 'PostTargetSelector' | 'ProfileSettings' | 'ProfileSettingsTabs' | 'RecentChat' | 'SideNavBar' | 'SocialSearch' | 'Tabs' | 'UICategoryCard' | 'UICommunityCard' | 'UICommunityHeader' | 'UICommunityInfo' | 'UIEngagementBar' | 'UIPostHeader' | 'UITextContent' | 'UITrendingItem' | 'UIUserInfo' | 'UserChip' | 'UserHeader' | 'UserSelector';
7
- type CustomComponentType = Partial<Record<CustomComponentName, <TProps>(props: TProps) => React.ReactElement<TProps>>>;
5
+ type AmityReactionType = {
6
+ name: string;
7
+ image: string;
8
+ };
8
9
 
9
- type PostRendererProps = {
10
- childrenPosts?: Amity.Post[];
10
+ type ThemeValue = {
11
+ primary_color: string;
12
+ secondary_color: string;
13
+ secondary_shade1_color: string;
14
+ secondary_shade2_color: string;
15
+ secondary_shade3_color: string;
16
+ secondary_shade4_color: string;
17
+ base_color: string;
18
+ base_shade1_color: string;
19
+ base_shade2_color: string;
20
+ base_shade3_color: string;
21
+ base_shade4_color: string;
22
+ base_shade5_color: string;
23
+ alert_color: string;
24
+ background_color: string;
25
+ base_inverse_color: string;
26
+ };
27
+ type Theme = {
28
+ light: ThemeValue;
29
+ dark: ThemeValue;
30
+ };
31
+ type ThemeConfiguration = {
32
+ preferred_theme?: 'light' | 'dark' | 'default';
33
+ theme?: {
34
+ light?: Partial<Theme['light']>;
35
+ dark?: Partial<Theme['dark']>;
36
+ };
37
+ };
38
+ interface Config {
39
+ preferred_theme?: 'light' | 'dark' | 'default';
40
+ theme?: {
41
+ light?: Theme['light'];
42
+ dark?: Theme['dark'];
43
+ };
44
+ excludes?: string[];
45
+ message_reactions?: AmityReactionType[];
46
+ customizations?: {
47
+ [key: string]: IconConfiguration & TextConfiguration & ThemeConfiguration & CustomConfiguration;
48
+ };
49
+ }
50
+ type IconConfiguration = {
51
+ icon?: string;
52
+ image?: string;
53
+ };
54
+ type TextConfiguration = {
55
+ text?: string;
56
+ };
57
+ type CustomConfiguration = {
58
+ [key: string]: string | undefined | boolean | Array<string> | number | Record<string, unknown>;
59
+ };
60
+
61
+ declare enum AmityPostContentComponentStyle {
62
+ FEED = "feed",
63
+ DETAIL = "detail"
64
+ }
65
+ declare enum AmityPostCategory {
66
+ GENERAL = "general",
67
+ ANNOUNCEMENT = "announcement",
68
+ PIN = "pin",
69
+ PIN_AND_ANNOUNCEMENT = "pin_and_announcement"
70
+ }
71
+ interface PostContentProps {
72
+ post: Amity.Post;
73
+ onClick?: () => void;
74
+ onPostDeleted?: (post: Amity.Post) => void;
75
+ style: AmityPostContentComponentStyle;
76
+ category: AmityPostCategory;
77
+ hideMenu?: boolean;
78
+ hideTarget?: boolean;
79
+ pageId?: string;
80
+ disabledContent?: boolean;
81
+ isGlobalFeaturePost?: boolean;
11
82
  className?: string;
12
- currentUserId?: string;
13
- handleDeletePost?: (postId: string) => void;
14
- handleReportPost?: () => void;
15
- handleUnreportPost?: () => void;
16
- handleApprovePost?: () => void;
17
- handleDeclinePost?: () => void;
18
- handleClosePoll?: () => void;
19
- poll?: Amity.Poll | null;
20
- isPollClosed?: boolean;
21
- hidePostTarget?: boolean;
22
- isFlaggedByMe?: boolean;
23
- readonly?: boolean;
24
- post?: Amity.Post;
25
- user?: Amity.User | null;
26
- userRoles?: string[];
27
- loading?: boolean;
28
- avatarFileUrl?: string;
83
+ }
84
+ declare const PostContent: ({ pageId, post: initialPost, onClick, onPostDeleted, category, hideMenu, hideTarget, style, disabledContent, isGlobalFeaturePost, className, }: PostContentProps) => React.JSX.Element;
85
+
86
+ type MemberCommunitySetup = {
87
+ userId: string;
88
+ displayName: string;
29
89
  };
30
- type PostRendererConfigType = Record<ValueOf<typeof PostContentType> | string, (props: PostRendererProps) => ReactNode>;
90
+ declare enum AmityCommunitySetupPageMode {
91
+ CREATE = "create",
92
+ EDIT = "edit"
93
+ }
31
94
 
32
- interface UiKitProviderProps {
95
+ declare enum Mode {
96
+ CREATE = "create",
97
+ EDIT = "edit"
98
+ }
99
+ interface AmityPostComposerEditOptions {
100
+ mode: Mode.EDIT;
101
+ post: Amity.Post;
102
+ }
103
+ interface AmityPostComposerCreateOptions {
104
+ mode: Mode.CREATE;
105
+ targetId: string | null;
106
+ targetType: 'community' | 'user';
107
+ community?: Amity.Community;
108
+ }
109
+ type PostComposerPageProps = AmityPostComposerCreateOptions | AmityPostComposerEditOptions;
110
+ declare function PostComposerPage(props: PostComposerPageProps): React.JSX.Element;
111
+
112
+ declare const enum UserRelationshipPageTabs {
113
+ FOLLOWING = "following",
114
+ FOLLOWER = "followers"
115
+ }
116
+
117
+ interface PageBehavior {
118
+ AmityStoryViewPageBehavior?: {
119
+ onCloseAction?(): void;
120
+ hyperLinkAction?(context: Record<string, unknown>): void;
121
+ };
122
+ AmityDraftStoryPageBehavior?: {
123
+ closeAction?(): void;
124
+ };
125
+ onClickHyperLink?(): void;
126
+ AmitySocialHomePageBehavior?: Record<string, unknown>;
127
+ AmityGlobalFeedComponentBehavior?: {
128
+ goToPostDetailPage?: (context: {
129
+ postId: string;
130
+ hideTarget?: boolean;
131
+ category?: AmityPostCategory;
132
+ }) => void;
133
+ goToViewStoryPage?: (context: {
134
+ targetId: string;
135
+ targetType: Amity.StoryTargetType;
136
+ storyType: 'communityFeed' | 'globalFeed';
137
+ targetIds?: string[];
138
+ }) => void;
139
+ goToCreateCommunityPage?(context: {
140
+ mode: AmityCommunitySetupPageMode;
141
+ }): void;
142
+ };
143
+ AmityPostDetailPageBehavior?: Record<string, unknown>;
144
+ AmityPostContentComponentBehavior?: {
145
+ goToCommunityProfilePage?: (context: {
146
+ communityId: string;
147
+ }) => void;
148
+ goToUserProfilePage?: (context: {
149
+ userId: string;
150
+ }) => void;
151
+ goToPostComposerPage?: (context: {
152
+ mode: Mode.EDIT;
153
+ post: Amity.Post;
154
+ }) => void;
155
+ };
156
+ AmitySocialGlobalSearchPageBehavior?: Record<string, unknown>;
157
+ AmityCommunitySearchResultComponentBehavior?: {
158
+ goToCommunityProfilePage?: (context: {
159
+ communityId: string;
160
+ }) => void;
161
+ };
162
+ AmityUserSearchResultComponentBehavior?: {
163
+ goToUserProfilePage?: (context: {
164
+ userId: string;
165
+ }) => void;
166
+ };
167
+ AmityCreatePostMenuComponentBehavior?: {
168
+ goToSelectPostTargetPage?(): void;
169
+ goToStoryTargetSelectionPage?(): void;
170
+ goToSelectPollPostTargetPage?(): void;
171
+ };
172
+ AmityPostTargetSelectionPage?: {
173
+ goToPostComposerPage?: (context: {
174
+ mode: Mode.CREATE;
175
+ targetId: string | null;
176
+ targetType: 'community' | 'user';
177
+ community?: Amity.Community;
178
+ }) => void;
179
+ };
180
+ AmityStoryTargetSelectionPage?: {
181
+ goToStoryCreationPage?(context: {
182
+ targetId: string | null;
183
+ targetType: Amity.StoryTargetType;
184
+ mediaType: {
185
+ type: 'image';
186
+ url: string;
187
+ } | {
188
+ type: 'video';
189
+ url: string;
190
+ };
191
+ storyType: 'communityFeed' | 'globalFeed';
192
+ }): void;
193
+ };
194
+ AmityPostComposerPageBehavior?: {
195
+ goToSocialHomePage?(): void;
196
+ };
197
+ AmityCommunityProfilePageBehavior?: {
198
+ goToPostComposerPage?(context: {
199
+ mode: Mode.CREATE | Mode.EDIT;
200
+ targetId: string | null;
201
+ targetType: 'community' | 'user';
202
+ community?: Amity.Community;
203
+ post?: Amity.Post;
204
+ }): void;
205
+ goToPostDetailPage?(context: {
206
+ postId: string;
207
+ hideTarget?: boolean;
208
+ category?: AmityPostCategory;
209
+ }): void;
210
+ goToStoryCreationPage?(context: {
211
+ targetId: string | null;
212
+ targetType: Amity.StoryTargetType;
213
+ mediaType: {
214
+ type: 'image';
215
+ url: string;
216
+ } | {
217
+ type: 'video';
218
+ url: string;
219
+ };
220
+ storyType: 'communityFeed' | 'globalFeed';
221
+ }): void;
222
+ goToCommunitySettingPage?(context: {
223
+ community: Amity.Community;
224
+ }): void;
225
+ goToEditCommunityPage?(context: {
226
+ mode: AmityCommunitySetupPageMode;
227
+ community: Amity.Community;
228
+ }): void;
229
+ goToPendingPostPage?(context: {
230
+ communityId: string;
231
+ }): void;
232
+ goToMembershipPage?(context: {
233
+ community: Amity.Community;
234
+ }): void;
235
+ goToPollPostComposerPage?(context: {
236
+ targetId: string | null;
237
+ targetType: 'community' | 'user';
238
+ }): void;
239
+ };
240
+ AmitySocialHomeTopNavigationComponentBehavior?: {
241
+ goToCreateCommunityPage?(context: {
242
+ mode: AmityCommunitySetupPageMode;
243
+ }): void;
244
+ };
245
+ AmityCommunitySetupPageBehavior?: {
246
+ goToAddCategoryPage?(context: {
247
+ categories?: Amity.Category[];
248
+ }): void;
249
+ goToAddMemberPage?(context: {
250
+ members?: MemberCommunitySetup[];
251
+ communityId?: string;
252
+ onAddedAction?: (userId: string[]) => void;
253
+ }): void;
254
+ };
255
+ AmityCommunitySettingPageBehavior?: {
256
+ goToEditCommunityPage?(context: {
257
+ mode: AmityCommunitySetupPageMode;
258
+ community: Amity.Community;
259
+ }): void;
260
+ goToMembershipPage?(context: {
261
+ community: Amity.Community;
262
+ }): void;
263
+ goToPostPermissionPage?(context: {
264
+ community: Amity.Community;
265
+ }): void;
266
+ goToStorySettingPage?(context: {
267
+ community: Amity.Community;
268
+ }): void;
269
+ goToSocialHomePage?(): void;
270
+ };
271
+ AmityCommunityMembershipPage?: {
272
+ goToAddMemberPage?(context: {
273
+ members?: MemberCommunitySetup[];
274
+ communityId?: string;
275
+ onAddedAction?: (userId: string[]) => void;
276
+ }): void;
277
+ goToUserProfilePage?: (context: {
278
+ userId: string;
279
+ }) => void;
280
+ };
281
+ AmityUserFeedComponentBehavior?: {
282
+ goToPostDetailPage?(context: {
283
+ postId: string;
284
+ }): void;
285
+ };
286
+ AmityUserProfilePageBehavior?: {
287
+ goToEditUserPage?(context: {
288
+ userId: string;
289
+ }): void;
290
+ goToBlockedUsersPage?(): void;
291
+ goToPostComposerPage?(context: {
292
+ userId: string;
293
+ }): void;
294
+ };
295
+ AmityUserProfileHeaderComponentBehavior: {
296
+ goToUserRelationshipPage?(context: {
297
+ userId: string;
298
+ selectedTab: UserRelationshipPageTabs;
299
+ }): void;
300
+ goToPendingFollowRequestPage?(): void;
301
+ };
302
+ AmityUserRelationshipPageBehavior: {
303
+ goToUserProfilePage?(context: {
304
+ userId: string;
305
+ }): void;
306
+ };
307
+ AmityUserPendingFollowRequestsPageBehavior: {
308
+ goToUserProfilePage?(context: {
309
+ userId: string;
310
+ }): void;
311
+ };
312
+ AmityBlockedUsersPageBehavior: {
313
+ goToUserProfilePage?(context: {
314
+ userId: string;
315
+ }): void;
316
+ };
317
+ AmityPollTargetSelectionPageBehavior?: {
318
+ goToPollPostComposerPage?(context: {
319
+ targetId: string | null;
320
+ targetType: 'community' | 'user';
321
+ }): void;
322
+ };
323
+ }
324
+
325
+ type AmityUIKitConfig = Config;
326
+ interface AmityUIKitProviderProps {
33
327
  apiKey: string;
34
328
  apiRegion: string;
35
329
  apiEndpoint?: {
36
330
  http?: string;
37
331
  mqtt?: string;
38
332
  };
39
- authToken?: string;
40
333
  userId: string;
41
- displayName: string;
42
- customComponents?: CustomComponentType;
43
- postRendererConfig?: PostRendererConfigType;
334
+ displayName?: string;
335
+ postRendererConfig?: any;
44
336
  theme?: Record<string, unknown>;
45
337
  children?: React.ReactNode;
338
+ socialCommunityCreationButtonVisible?: boolean;
46
339
  actionHandlers?: {
47
340
  onChangePage?: (data: {
48
341
  type: string;
@@ -58,16 +351,14 @@ interface UiKitProviderProps {
58
351
  onEditUser?: (userId: string) => void;
59
352
  onMessageUser?: (userId: string) => void;
60
353
  };
61
- pageBehavior?: {
62
- closeAction?: () => void;
63
- hyperLinkAction?: () => void;
64
- };
65
- socialCommunityCreationButtonVisible?: boolean;
354
+ pageBehavior?: PageBehavior;
66
355
  onConnectionStatusChange?: (state: Amity.SessionStates) => void;
67
356
  onConnected?: () => void;
68
357
  onDisconnected?: () => void;
358
+ getAuthToken?: () => Promise<string>;
359
+ configs?: AmityUIKitConfig;
69
360
  }
70
- declare const UiKitProvider: ({ apiKey, apiRegion, apiEndpoint, authToken, userId, displayName, customComponents, postRendererConfig, theme, children, socialCommunityCreationButtonVisible, actionHandlers, pageBehavior, onConnectionStatusChange, onDisconnected, }: UiKitProviderProps) => React.JSX.Element;
361
+ declare const AmityUIKitProvider: React.FC<AmityUIKitProviderProps>;
71
362
 
72
363
  interface FeedProps {
73
364
  className?: string;
@@ -82,7 +373,7 @@ interface FeedProps {
82
373
  }
83
374
  declare const _default$2: React.MemoExoticComponent<(props: FeedProps) => React.JSX.Element>;
84
375
 
85
- declare const Community: () => React.JSX.Element;
376
+ declare const Application: () => React.JSX.Element;
86
377
 
87
378
  type PartialChannel = Pick<Amity.Channel, 'channelId' | 'type'>;
88
379
  declare const ChatApplication: ({ membershipFilter, defaultChannelId, onMemberSelect, onChannelSelect, onAddNewChannel, onEditChatMember, }: {
@@ -111,9 +402,24 @@ declare const enum PageTypes {
111
402
  CommunityFeed = "communityfeed",
112
403
  CommunityEdit = "communityedit",
113
404
  UserEdit = "useredit",
114
- ViewStory = "viewstory"
405
+ ViewStory = "viewstory",
406
+ DraftPage = "draftpage"
115
407
  }
116
408
 
409
+ type AmityStoryMediaType$1 = {
410
+ type: 'image';
411
+ url: string;
412
+ } | {
413
+ type: 'video';
414
+ url: string;
415
+ };
416
+ type AmityDraftStoryPageProps = {
417
+ targetId: string;
418
+ targetType: Amity.StoryTargetType;
419
+ mediaType?: AmityStoryMediaType$1;
420
+ };
421
+ declare const AmityDraftStoryPage: (props: AmityDraftStoryPageProps) => React.JSX.Element;
422
+
117
423
  type Page = {
118
424
  type: PageTypes.Explore | PageTypes.NewsFeed;
119
425
  communityId?: string;
@@ -136,8 +442,17 @@ type Page = {
136
442
  } | {
137
443
  type: PageTypes.ViewStory;
138
444
  storyId: string;
139
- targetId?: string;
445
+ targetId: string;
140
446
  communityId?: string;
447
+ targetIds: string[];
448
+ storyType: 'communityFeed' | 'globalFeed';
449
+ } | {
450
+ type: PageTypes.DraftPage;
451
+ communityId?: string;
452
+ mediaType: AmityStoryMediaType$1;
453
+ targetId: string;
454
+ targetType: Amity.StoryTargetType;
455
+ storyType: 'communityFeed' | 'globalFeed';
141
456
  };
142
457
  type ContextValue = {
143
458
  page: Page;
@@ -145,16 +460,18 @@ type ContextValue = {
145
460
  onClickCategory: (categoryId: string) => void;
146
461
  onClickCommunity: (communityId: string) => void;
147
462
  onClickUser: (userId: string, pageType?: string) => void;
148
- onClickStory: (storyId: string) => void;
463
+ onClickStory: (storyId: string, storyType: 'communityFeed' | 'globalFeed', targetId?: string[]) => void;
149
464
  onCommunityCreated: (communityId: string) => void;
150
465
  onEditCommunity: (communityId: string, tab?: string) => void;
151
466
  onEditUser: (userId: string) => void;
152
467
  onMessageUser: (userId: string) => void;
153
468
  onBack: () => void;
469
+ goToDraftStoryPage: (targetId: string, targetType: string, mediaType: AmityStoryMediaType$1, storyType: 'communityFeed' | 'globalFeed') => void;
154
470
  setNavigationBlocker?: (params: {
155
471
  title: ReactNode;
156
472
  content: ReactNode;
157
473
  okText: ReactNode;
474
+ onOk?: () => void;
158
475
  } | null | undefined) => void;
159
476
  };
160
477
  declare const useNavigation: () => ContextValue;
@@ -177,10 +494,10 @@ interface AvatarProps {
177
494
  }
178
495
  declare const _default$1: (props: AvatarProps) => React.JSX.Element;
179
496
 
180
- declare const PostContainer: styled_components.IStyledComponent<"web", styled_components_dist_types.FastOmit<{
497
+ declare const PostContainer: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<{
181
498
  className?: string | undefined;
182
499
  children?: ReactNode;
183
- }, never>> & Omit<({ className, ...props }: {
500
+ }, never>> & string & Omit<({ className, ...props }: {
184
501
  className?: string | undefined;
185
502
  children?: ReactNode;
186
503
  }) => React.JSX.Element, keyof React.Component<any, {}, any>>;
@@ -190,6 +507,7 @@ type Mentioned = {
190
507
  length: number;
191
508
  index: number;
192
509
  type: string;
510
+ displayName: string;
193
511
  };
194
512
 
195
513
  interface EngagementBarProps {
@@ -213,56 +531,370 @@ declare const useSDK: () => {
213
531
  userRoles: string[];
214
532
  };
215
533
 
216
- type DraftStoryProps = {
217
- pageId: 'create_story_page';
218
- file: File;
219
- creatorAvatar: string;
220
- onCreateStory: (file: File, imageMode: 'fit' | 'fill', metadata?: Amity.Metadata | undefined, items?: Amity.StoryItem[] | undefined) => void;
221
- onDiscardStory: () => void;
534
+ /**
535
+ * Interface representing the session handler for the Amity SDK.
536
+ */
537
+ interface SessionHandler {
538
+ /**
539
+ * Handles the access token renewal during the login process.
540
+ * @param renewal - The access token renewal handler.
541
+ */
542
+ sessionWillRenewAccessToken(renewal: Amity.AccessTokenRenewal): void;
543
+ }
544
+ /**
545
+ * Manages the Amity SDK client and authentication state.
546
+ */
547
+ declare class AmityUIKitManager {
548
+ private static instance;
549
+ private client;
550
+ private isConnected;
551
+ private stateChangeHandler;
552
+ private disconnectedHandler;
553
+ private onConnectionStatusChange?;
554
+ private onConnected?;
555
+ private onDisconnected?;
556
+ /**
557
+ * Private constructor to prevent direct instantiation.
558
+ */
559
+ private constructor();
560
+ /**
561
+ * Sets up the AmityUIKitManager instance with the provided configuration.
562
+ * @param config - The configuration object containing the API key and endpoint.
563
+ */
564
+ static setup(config: {
565
+ apiKey: string;
566
+ apiRegion: string;
567
+ apiEndpoint?: {
568
+ http?: string;
569
+ mqtt?: string;
570
+ };
571
+ }): void;
572
+ /**
573
+ * Registers a device with the Amity SDK and handles the login process.
574
+ * @param userId - The user ID to be used for login.
575
+ * @param displayName - The display name of the user.
576
+ * @param sessionHandler - The session handler for access token renewal.
577
+ * @param authToken - The authentication token to be used for login.
578
+ * @param onConnectionStatusChange - The callback function for connection status changes.
579
+ * @param onConnected - The callback function to be called when connected.
580
+ * @param onDisconnected - The callback function to be called when disconnected.
581
+ */
582
+ static registerDevice(userId: string, displayName: string, sessionHandler: SessionHandler, authToken?: string, onConnectionStatusChange?: (state: Amity.SessionStates) => void, onConnected?: () => void, onDisconnected?: () => void): Promise<void>;
583
+ /**
584
+ * Sets the AmityClient instance to be used by the AmityUIKitManager.
585
+ * This method is useful when sharing the AmityClient instance between different parts of the application.
586
+ * @param client - The AmityClient instance to be used.
587
+ */
588
+ static setClient(client: Amity.Client): void;
589
+ /**
590
+ * Connects and logs in to the Amity SDK with the provided user details and session handler.
591
+ * @param userId - The user ID to be used for login.
592
+ * @param displayName - The display name of the user.
593
+ * @param sessionHandler - The session handler for access token renewal.
594
+ */
595
+ private connectAndLogin;
596
+ /**
597
+ * Disconnects from the Amity SDK and cleans up resources.
598
+ */
599
+ disconnect(): void;
600
+ /**
601
+ * Retrieves the Amity SDK client instance.
602
+ * @returns The Amity SDK client instance or null if not connected.
603
+ */
604
+ static getClient(): Amity.Client | null;
605
+ /**
606
+ * Checks if the client is connected to the Amity SDK.
607
+ * @returns True if the client is connected, false otherwise.
608
+ */
609
+ isClientConnected(): boolean;
610
+ }
611
+
612
+ interface ChatHeaderProps {
613
+ channel: Amity.Channel | null;
614
+ pageId?: string;
615
+ componentId?: string;
616
+ }
617
+ declare const ChatHeader: ({ channel, pageId }: ChatHeaderProps) => React.JSX.Element;
618
+
619
+ interface AmityLiveChatMessageListProps {
620
+ pageId?: string;
621
+ channel: Amity.Channel;
622
+ replyMessage: (message: Amity.Message<'text'>) => void;
623
+ }
624
+ declare const MessageList: ({ pageId, channel, replyMessage, }: AmityLiveChatMessageListProps) => React.JSX.Element;
625
+
626
+ type ComposeActionTypes = {
627
+ replyMessage?: Amity.Message;
628
+ mentionMessage?: Amity.Message;
629
+ clearReplyMessage?: () => void;
630
+ clearMention?: () => void;
222
631
  };
223
- declare const DraftsPage: ({ pageId, file, onDiscardStory, onCreateStory }: DraftStoryProps) => React.JSX.Element | null;
632
+ interface MessageComposerProps {
633
+ channel: Amity.Channel;
634
+ composeAction: ComposeActionTypes;
635
+ suggestionRef?: RefObject<HTMLDivElement>;
636
+ disabled?: boolean;
637
+ pageId?: string;
638
+ }
639
+ declare const MessageComposer: ({ pageId, channel, composeAction: { replyMessage, mentionMessage, clearReplyMessage, clearMention }, }: MessageComposerProps) => React.JSX.Element;
640
+
641
+ declare const MessageReactionPreview: ({ message, onClick, }: {
642
+ message: Amity.Message;
643
+ onClick?: (() => void) | undefined;
644
+ }) => React.JSX.Element | null;
645
+
646
+ declare const MessageReactionPicker: ({ message, onSelectReaction, }: {
647
+ message: Amity.Message;
648
+ onSelectReaction: (reactionName: string) => void;
649
+ }) => React.JSX.Element | null;
650
+
651
+ interface MessageQuickReactionProps {
652
+ pageId?: string;
653
+ componentId?: string;
654
+ message: Amity.Message;
655
+ onSelectReaction?: () => void;
656
+ }
657
+ declare const MessageQuickReaction: ({ pageId, componentId, message, onSelectReaction, }: MessageQuickReactionProps) => React.JSX.Element;
658
+
659
+ type MessageActionType = {
660
+ onCopy?: () => void;
661
+ onFlag?: () => void;
662
+ onUnflag?: () => void;
663
+ onDelete?: () => void;
664
+ onReply?: () => void;
665
+ onMention?: () => void;
666
+ };
667
+
668
+ interface ReactionListProps$1 {
669
+ pageId: string;
670
+ referenceId: string;
671
+ referenceType: Amity.ReactableType;
672
+ }
673
+ declare const ReactionList: ({ pageId, referenceId, referenceType }: ReactionListProps$1) => React.JSX.Element | null;
674
+
675
+ interface ReactionListProps {
676
+ referenceId: string;
677
+ referenceType: Amity.ReactableType;
678
+ }
679
+
680
+ interface LiveChatProps {
681
+ channelId: Amity.Channel['channelId'];
682
+ }
683
+ declare const LiveChat: ({ channelId }: LiveChatProps) => React.JSX.Element;
684
+
685
+ type AmityStoryMediaType = {
686
+ type: 'image';
687
+ url: string;
688
+ } | {
689
+ type: 'video';
690
+ url: string;
691
+ };
692
+ type StoryPreviewProps = {
693
+ mediaType?: AmityStoryMediaType;
694
+ imageMode: 'fit' | 'fill';
695
+ width?: number;
696
+ height?: number;
697
+ hyperLink: {
698
+ data: {
699
+ url: string;
700
+ customText: string;
701
+ };
702
+ type: Amity.StoryItemType;
703
+ }[];
704
+ onPlay?: () => void;
705
+ onPause?: () => void;
706
+ avatar: string;
707
+ title: string;
708
+ description: string;
709
+ duration?: number;
710
+ isOfficial?: boolean;
711
+ };
712
+ declare const StoryPreview: React.FC<StoryPreviewProps>;
713
+
714
+ type StoryPreviewThumbnailProps = {
715
+ thumbnailUrl?: string;
716
+ hyperLink: {
717
+ data: {
718
+ url: string;
719
+ customText: string;
720
+ };
721
+ type: Amity.StoryItemType;
722
+ }[];
723
+ avatar: string;
724
+ title: string;
725
+ isOfficial?: boolean;
726
+ onClick?: () => void;
727
+ imageMode?: 'fit' | 'fill';
728
+ };
729
+ declare const StoryPreviewThumbnail: React.FC<StoryPreviewThumbnailProps>;
224
730
 
225
- interface ViewStoriesPageProps {
226
- pageId: 'story_page';
731
+ type ViewStoryPageType = 'communityFeed' | 'globalFeed';
732
+ interface AmityViewStoryPageProps {
733
+ type: ViewStoryPageType;
227
734
  targetId: string;
228
- onClose: () => void;
229
735
  }
230
- declare const ViewStoriesPage: ({ pageId, targetId }: ViewStoriesPageProps) => React.JSX.Element;
736
+ declare const ViewStoryPage: React.FC<AmityViewStoryPageProps>;
231
737
 
232
- interface CommentTrayProps {
233
- pageId: '*';
234
- storyId: string;
235
- commentId?: string;
236
- referenceType?: string;
237
- referenceId?: string;
238
- replyTo?: string;
239
- isReplying: boolean;
240
- limit?: number;
241
- isOpen: boolean;
242
- isJoined: boolean;
243
- allowCommentInStory?: boolean;
244
- onClose: () => void;
245
- onClickReply: (replyTo?: string, referenceType?: Amity.Comment['referenceType'], referenceId?: Amity.Comment['referenceId'], commentId?: Amity.Comment['commentId']) => void;
246
- onCancelReply: () => void;
247
- }
248
- declare const CommentTray: ({ pageId, storyId, commentId, referenceType, referenceId, limit, replyTo, isJoined, isOpen, isReplying, allowCommentInStory, onClose, onClickReply, onCancelReply, }: CommentTrayProps) => React.JSX.Element | null;
249
-
250
- interface StoryTabProps {
251
- haveStoryPermission: boolean;
252
- avatar: string | null;
738
+ declare function StoryTargetSelectionPage(): React.JSX.Element;
739
+
740
+ declare function SocialHomePage(): React.JSX.Element;
741
+
742
+ declare function SelectPostTargetPage(): React.JSX.Element;
743
+
744
+ declare function MyCommunitiesSearchPage(): React.JSX.Element;
745
+
746
+ declare function SocialGlobalSearchPage(): React.JSX.Element;
747
+
748
+ interface PostDetailPageProps {
749
+ id: string;
750
+ hideTarget?: boolean;
751
+ category?: AmityPostCategory;
752
+ }
753
+ declare function PostDetailPage({ id, hideTarget, category }: PostDetailPageProps): React.JSX.Element;
754
+
755
+ interface CommunityProfileProps {
756
+ communityId: string;
757
+ page?: number;
758
+ }
759
+ declare const CommunityProfilePage: React.FC<CommunityProfileProps>;
760
+
761
+ type UserProfilePageProps = {
762
+ userId: string;
763
+ };
764
+ declare const UserProfilePage: React.FC<UserProfilePageProps>;
765
+
766
+ interface EditUserProfilePageProps {
767
+ userId: string;
768
+ }
769
+ declare const EditUserProfilePage: React.FC<EditUserProfilePageProps>;
770
+
771
+ type CommentTrayProps = {
772
+ pageId?: string;
773
+ referenceId: string;
774
+ community: Amity.Community;
775
+ shouldAllowCreation?: boolean;
776
+ shouldAllowInteraction: boolean;
777
+ referenceType: Amity.CommentReferenceType;
778
+ };
779
+ declare const CommentTray: ({ referenceId, pageId, referenceType, shouldAllowCreation, shouldAllowInteraction, community, }: CommentTrayProps) => React.JSX.Element;
780
+
781
+ type StoryTabProps = ({
782
+ type: 'communityFeed';
783
+ communityId: string;
784
+ } | {
785
+ type: 'globalFeed';
786
+ }) & {
787
+ pageId?: string;
788
+ };
789
+ declare const StoryTab: React.FC<StoryTabProps>;
790
+
791
+ type CreatePostMenuProps = {
792
+ pageId: string;
793
+ };
794
+ declare function CreatePostMenu({ pageId }: CreatePostMenuProps): React.JSX.Element;
795
+
796
+ interface MediaAttachmentProps {
797
+ pageId: string;
798
+ uploadLoading?: boolean;
799
+ isVisibleCamera: boolean;
800
+ isVisibleImage: boolean;
801
+ isVisibleVideo: boolean;
802
+ onVideoFileChange?: (files: File[]) => void;
803
+ onImageFileChange?: (files: File[]) => void;
804
+ }
805
+ declare function MediaAttachment({ pageId, isVisibleCamera, isVisibleImage, isVisibleVideo, onVideoFileChange, onImageFileChange, }: MediaAttachmentProps): React.JSX.Element | null;
806
+
807
+ interface DetailedMediaAttachmentProps {
808
+ pageId: string;
809
+ isVisibleCamera: boolean;
810
+ isVisibleImage: boolean;
811
+ isVisibleVideo: boolean;
812
+ onVideoFileChange?: (files: File[]) => void;
813
+ onImageFileChange?: (files: File[]) => void;
814
+ }
815
+ declare function DetailedMediaAttachment({ pageId, isVisibleCamera, isVisibleImage, isVisibleVideo, onVideoFileChange, onImageFileChange, }: DetailedMediaAttachmentProps): React.JSX.Element | null;
816
+
817
+ type UserSearchResultProps = {
818
+ pageId?: string;
819
+ isLoading: boolean;
820
+ onLoadMore: () => void;
821
+ userCollection: Amity.User[];
822
+ onClosePopover?: () => void;
823
+ };
824
+ declare const UserSearchResult: ({ isLoading, onLoadMore, pageId, onClosePopover, userCollection, }: UserSearchResultProps) => React.JSX.Element;
825
+
826
+ type CommunitySearchResultProps = {
827
+ pageId?: string;
828
+ isLoading: boolean;
829
+ onLoadMore: () => void;
830
+ showJoinButton?: boolean;
831
+ onClosePopover?: () => void;
832
+ communityCollection: Amity.Community[];
833
+ };
834
+ declare const CommunitySearchResult: ({ isLoading, onLoadMore, pageId, onClosePopover, showJoinButton, communityCollection, }: CommunitySearchResultProps) => React.JSX.Element;
835
+
836
+ type TopSearchBarProps = {
837
+ pageId?: string;
838
+ onFocus?: () => void;
839
+ search: (keyword: string) => void;
840
+ };
841
+ declare function TopSearchBar({ pageId, search, onFocus }: TopSearchBarProps): React.JSX.Element | null;
842
+
843
+ interface MyCommunitiesProps {
844
+ pageId?: string;
845
+ }
846
+ declare const MyCommunities: ({ pageId }: MyCommunitiesProps) => React.JSX.Element;
847
+
848
+ interface GlobalFeedProps {
253
849
  pageId?: string;
254
850
  componentId?: string;
255
- elementId?: string;
256
- icon?: React.ReactNode;
257
- storyRing?: boolean;
258
- isSeen?: boolean;
259
- uploadingStory?: boolean;
260
- isErrored?: boolean;
261
- title?: string;
262
- onAddStory?: () => void;
263
- onClick?: () => void;
264
- onChange?: (file: File | null) => void;
851
+ items: Array<Amity.Post | Amity.Ad>;
852
+ isLoading: boolean;
853
+ onFeedReachBottom: () => void;
854
+ onPostDeleted?: (post: Amity.Post) => void;
855
+ }
856
+ declare const GlobalFeed: ({ pageId, componentId, items, isLoading, onFeedReachBottom, onPostDeleted, }: GlobalFeedProps) => React.JSX.Element;
857
+
858
+ interface EmptyNewsfeedProps {
859
+ pageId?: string;
860
+ }
861
+ declare function EmptyNewsfeed({ pageId }: EmptyNewsfeedProps): React.JSX.Element | null;
862
+
863
+ type NewsfeedProps = {
864
+ pageId?: string;
865
+ };
866
+ declare const Newsfeed: ({ pageId }: NewsfeedProps) => React.JSX.Element;
867
+
868
+ declare enum HomePageTab {
869
+ Newsfeed = "Newsfeed",
870
+ Explore = "Explore",
871
+ MyCommunities = "My communities"
872
+ }
873
+
874
+ interface TopNavigationProps {
875
+ pageId?: string;
876
+ selectedTab?: HomePageTab;
877
+ onClickPostCreationButton?: () => void;
878
+ }
879
+ declare function TopNavigation({ pageId, selectedTab, onClickPostCreationButton, }: TopNavigationProps): React.JSX.Element | null;
880
+
881
+ interface CommunityProfileHeaderProps {
882
+ pageId?: string;
883
+ community: Amity.Community;
884
+ isSticky?: boolean;
885
+ page?: number;
886
+ }
887
+ declare const CommunityHeader: React.FC<CommunityProfileHeaderProps>;
888
+
889
+ interface CommunityFeedProps {
890
+ communityId: string;
891
+ pageId?: string;
892
+ }
893
+ declare const CommunityFeed: ({ pageId, communityId }: CommunityFeedProps) => React.JSX.Element | null;
894
+
895
+ interface CommunityPinnedPostProps {
896
+ communityId?: string;
265
897
  }
266
- declare const StoryTab: ({ pageId, elementId, title, haveStoryPermission, storyRing, isSeen, uploadingStory, isErrored, avatar, onClick, onChange, }: StoryTabProps) => React.JSX.Element;
898
+ declare const CommunityPinnedPost: ({ communityId }: CommunityPinnedPostProps) => React.JSX.Element;
267
899
 
268
- export { _default$1 as AmityAvatar, CommentTray as AmityCommentTrayComponent, DraftsPage as AmityCreateStoryPage, CommentText as AmityExpandableText, PostContainer as AmityPostContainer, _default as AmityPostEngagementBar, StoryTab as AmityStoryTabComponent, ChatApplication as AmityUiKitChat, _default$2 as AmityUiKitFeed, UiKitProvider as AmityUiKitProvider, Community as AmityUiKitSocial, ViewStoriesPage as AmityViewStoryPage, addChatMembers as amityAddChatMembers, removeChatMembers as amityRemoveChatMembers, useNavigation as useAmityNavigation, useSDK as useAmitySDK, useUser as useAmityUser };
900
+ export { _default$1 as AmityAvatar, CommentTray as AmityCommentTrayComponent, CommunityFeed as AmityCommunityFeedComponent, CommunityHeader as AmityCommunityHeaderComponent, CommunityPinnedPost as AmityCommunityPinnedPostComponent, CommunityProfilePage as AmityCommunityProfilePage, CommunitySearchResult as AmityCommunitySearchResultComponent, CreatePostMenu as AmityCreatePostMenuComponent, DetailedMediaAttachment as AmityDetailedMediaAttachmentComponent, AmityDraftStoryPage, EditUserProfilePage as AmityEditUserProfilePage, EmptyNewsfeed as AmityEmptyNewsFeedComponent, CommentText as AmityExpandableText, GlobalFeed as AmityGlobalFeedComponent, ChatHeader as AmityLiveChatHeader, MessageComposer as AmityLiveChatMessageComposeBar, MessageList as AmityLiveChatMessageList, MessageQuickReaction as AmityLiveChatMessageQuickReaction, MessageReactionPicker as AmityLiveChatMessageReactionPicker, MessageReactionPreview as AmityLiveChatMessageReactionPreview, LiveChat as AmityLiveChatPage, MediaAttachment as AmityMediaAttachmentComponent, type MessageActionType as AmityMessageActionType, MyCommunities as AmityMyCommunitiesComponent, MyCommunitiesSearchPage as AmityMyCommunitiesSearchPage, Newsfeed as AmityNewsFeedComponent, PostComposerPage as AmityPostComposerPage, PostContainer as AmityPostContainer, PostContent as AmityPostContentComponent, PostDetailPage as AmityPostDetailPage, _default as AmityPostEngagementBar, SelectPostTargetPage as AmityPostTargetSelectionPage, ReactionList as AmityReactionListComponent, type ReactionListProps as AmityReactionListProps, SocialGlobalSearchPage as AmitySocialGlobalSearchPage, SocialHomePage as AmitySocialHomePage, HomePageTab as AmitySocialHomePageTab, TopNavigation as AmitySocialHomeTopNavigationComponent, StoryPreview as AmityStoryPreview, StoryPreviewThumbnail as AmityStoryPreviewThumbnail, StoryTab as AmityStoryTabComponent, StoryTargetSelectionPage as AmityStoryTargetSelectionPage, TopSearchBar as AmityTopSearchBarComponent, AmityUIKitManager, ChatApplication as AmityUiKitChat, _default$2 as AmityUiKitFeed, AmityUIKitProvider as AmityUiKitProvider, Application as AmityUiKitSocial, UserProfilePage as AmityUserProfilePage, UserSearchResult as AmityUserSearchResultComponent, ViewStoryPage as AmityViewStoryPage, addChatMembers as amityAddChatMembers, removeChatMembers as amityRemoveChatMembers, useNavigation as useAmityNavigation, useSDK as useAmitySDK, useUser as useAmityUser };