@amityco/ui-kit-open-source 3.2.4 → 4.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.
package/dist/index.d.mts CHANGED
@@ -36,6 +36,7 @@ interface UiKitProviderProps {
36
36
  http?: string;
37
37
  mqtt?: string;
38
38
  };
39
+ authToken?: string;
39
40
  userId: string;
40
41
  displayName: string;
41
42
  customComponents?: CustomComponentType;
@@ -57,13 +58,16 @@ interface UiKitProviderProps {
57
58
  onEditUser?: (userId: string) => void;
58
59
  onMessageUser?: (userId: string) => void;
59
60
  };
61
+ pageBehavior?: {
62
+ closeAction?: () => void;
63
+ hyperLinkAction?: () => void;
64
+ };
60
65
  socialCommunityCreationButtonVisible?: boolean;
61
66
  onConnectionStatusChange?: (state: Amity.SessionStates) => void;
62
67
  onConnected?: () => void;
63
68
  onDisconnected?: () => void;
64
- getAuthToken?: () => Promise<string>;
65
69
  }
66
- declare const UiKitProvider: ({ apiKey, apiRegion, apiEndpoint, userId, displayName, customComponents, postRendererConfig, theme, children, socialCommunityCreationButtonVisible, actionHandlers, onConnectionStatusChange, onDisconnected, getAuthToken, }: UiKitProviderProps) => React.JSX.Element;
70
+ declare const UiKitProvider: ({ apiKey, apiRegion, apiEndpoint, authToken, userId, displayName, customComponents, postRendererConfig, theme, children, socialCommunityCreationButtonVisible, actionHandlers, pageBehavior, onConnectionStatusChange, onDisconnected, }: UiKitProviderProps) => React.JSX.Element;
67
71
 
68
72
  interface FeedProps {
69
73
  className?: string;
@@ -129,6 +133,11 @@ type Page = {
129
133
  type: PageTypes.UserFeed | PageTypes.UserEdit;
130
134
  userId: string;
131
135
  communityId?: string;
136
+ } | {
137
+ type: PageTypes.ViewStory;
138
+ storyId: string;
139
+ targetId?: string;
140
+ communityId?: string;
132
141
  };
133
142
  type ContextValue = {
134
143
  page: Page;
@@ -136,6 +145,7 @@ type ContextValue = {
136
145
  onClickCategory: (categoryId: string) => void;
137
146
  onClickCommunity: (communityId: string) => void;
138
147
  onClickUser: (userId: string, pageType?: string) => void;
148
+ onClickStory: (storyId: string) => void;
139
149
  onCommunityCreated: (communityId: string) => void;
140
150
  onEditCommunity: (communityId: string, tab?: string) => void;
141
151
  onEditUser: (userId: string) => void;
@@ -203,4 +213,56 @@ declare const useSDK: () => {
203
213
  userRoles: string[];
204
214
  };
205
215
 
206
- export { _default$1 as AmityAvatar, CommentText as AmityExpandableText, PostContainer as AmityPostContainer, _default as AmityPostEngagementBar, ChatApplication as AmityUiKitChat, _default$2 as AmityUiKitFeed, UiKitProvider as AmityUiKitProvider, Community as AmityUiKitSocial, addChatMembers as amityAddChatMembers, removeChatMembers as amityRemoveChatMembers, useNavigation as useAmityNavigation, useSDK as useAmitySDK, useUser as useAmityUser };
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;
222
+ };
223
+ declare const DraftsPage: ({ pageId, file, onDiscardStory, onCreateStory }: DraftStoryProps) => React.JSX.Element | null;
224
+
225
+ interface ViewStoriesPageProps {
226
+ pageId: 'story_page';
227
+ targetId: string;
228
+ onClose: () => void;
229
+ }
230
+ declare const ViewStoriesPage: ({ pageId, targetId }: ViewStoriesPageProps) => React.JSX.Element;
231
+
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;
253
+ pageId?: string;
254
+ 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;
265
+ }
266
+ declare const StoryTab: ({ pageId, elementId, title, haveStoryPermission, storyRing, isSeen, uploadingStory, isErrored, avatar, onClick, onChange, }: StoryTabProps) => React.JSX.Element;
267
+
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 };
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ interface UiKitProviderProps {
36
36
  http?: string;
37
37
  mqtt?: string;
38
38
  };
39
+ authToken?: string;
39
40
  userId: string;
40
41
  displayName: string;
41
42
  customComponents?: CustomComponentType;
@@ -57,13 +58,16 @@ interface UiKitProviderProps {
57
58
  onEditUser?: (userId: string) => void;
58
59
  onMessageUser?: (userId: string) => void;
59
60
  };
61
+ pageBehavior?: {
62
+ closeAction?: () => void;
63
+ hyperLinkAction?: () => void;
64
+ };
60
65
  socialCommunityCreationButtonVisible?: boolean;
61
66
  onConnectionStatusChange?: (state: Amity.SessionStates) => void;
62
67
  onConnected?: () => void;
63
68
  onDisconnected?: () => void;
64
- getAuthToken?: () => Promise<string>;
65
69
  }
66
- declare const UiKitProvider: ({ apiKey, apiRegion, apiEndpoint, userId, displayName, customComponents, postRendererConfig, theme, children, socialCommunityCreationButtonVisible, actionHandlers, onConnectionStatusChange, onDisconnected, getAuthToken, }: UiKitProviderProps) => React.JSX.Element;
70
+ declare const UiKitProvider: ({ apiKey, apiRegion, apiEndpoint, authToken, userId, displayName, customComponents, postRendererConfig, theme, children, socialCommunityCreationButtonVisible, actionHandlers, pageBehavior, onConnectionStatusChange, onDisconnected, }: UiKitProviderProps) => React.JSX.Element;
67
71
 
68
72
  interface FeedProps {
69
73
  className?: string;
@@ -129,6 +133,11 @@ type Page = {
129
133
  type: PageTypes.UserFeed | PageTypes.UserEdit;
130
134
  userId: string;
131
135
  communityId?: string;
136
+ } | {
137
+ type: PageTypes.ViewStory;
138
+ storyId: string;
139
+ targetId?: string;
140
+ communityId?: string;
132
141
  };
133
142
  type ContextValue = {
134
143
  page: Page;
@@ -136,6 +145,7 @@ type ContextValue = {
136
145
  onClickCategory: (categoryId: string) => void;
137
146
  onClickCommunity: (communityId: string) => void;
138
147
  onClickUser: (userId: string, pageType?: string) => void;
148
+ onClickStory: (storyId: string) => void;
139
149
  onCommunityCreated: (communityId: string) => void;
140
150
  onEditCommunity: (communityId: string, tab?: string) => void;
141
151
  onEditUser: (userId: string) => void;
@@ -203,4 +213,56 @@ declare const useSDK: () => {
203
213
  userRoles: string[];
204
214
  };
205
215
 
206
- export { _default$1 as AmityAvatar, CommentText as AmityExpandableText, PostContainer as AmityPostContainer, _default as AmityPostEngagementBar, ChatApplication as AmityUiKitChat, _default$2 as AmityUiKitFeed, UiKitProvider as AmityUiKitProvider, Community as AmityUiKitSocial, addChatMembers as amityAddChatMembers, removeChatMembers as amityRemoveChatMembers, useNavigation as useAmityNavigation, useSDK as useAmitySDK, useUser as useAmityUser };
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;
222
+ };
223
+ declare const DraftsPage: ({ pageId, file, onDiscardStory, onCreateStory }: DraftStoryProps) => React.JSX.Element | null;
224
+
225
+ interface ViewStoriesPageProps {
226
+ pageId: 'story_page';
227
+ targetId: string;
228
+ onClose: () => void;
229
+ }
230
+ declare const ViewStoriesPage: ({ pageId, targetId }: ViewStoriesPageProps) => React.JSX.Element;
231
+
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;
253
+ pageId?: string;
254
+ 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;
265
+ }
266
+ declare const StoryTab: ({ pageId, elementId, title, haveStoryPermission, storyRing, isSeen, uploadingStory, isErrored, avatar, onClick, onChange, }: StoryTabProps) => React.JSX.Element;
267
+
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 };