isometrik-plugin-chat-sdk 2.0.8 → 2.0.11
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/cjs/attachment-preview_22.cjs.entry.js +254 -37
- package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
- package/dist/cjs/isometrik-webchat.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/login-page_3.cjs.entry.js +1 -1
- package/dist/cjs/member-add.cjs.entry.js +1 -1
- package/dist/cjs/reaction-container.cjs.entry.js +1 -1
- package/dist/cjs/toast-75ef0607.js +159 -0
- package/dist/cjs/toast-75ef0607.js.map +1 -0
- package/dist/cjs/toast-notification.cjs.entry.js +21 -15
- package/dist/cjs/toast-notification.cjs.entry.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +29 -23
- package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js +19 -8
- package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js +129 -3
- package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/shared/toast-notification/toast-notification.js +32 -26
- package/dist/collection/components/ChatUIComponent/shared/toast-notification/toast-notification.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/WebchatRightSide.js +17 -2
- package/dist/collection/components/my-component/web-chat/WebchatRightSide.js.map +1 -1
- package/dist/collection/lib/chat/group-title.js +8 -0
- package/dist/collection/lib/chat/group-title.js.map +1 -0
- package/dist/collection/lib/chat/index.js +2 -0
- package/dist/collection/lib/chat/index.js.map +1 -1
- package/dist/collection/lib/chat/mentioned-users.js +59 -0
- package/dist/collection/lib/chat/mentioned-users.js.map +1 -0
- package/dist/collection/lib/friendly-toast-message.js +38 -0
- package/dist/collection/lib/friendly-toast-message.js.map +1 -0
- package/dist/collection/lib/toast.js +76 -21
- package/dist/collection/lib/toast.js.map +1 -1
- package/dist/components/ChatFooter.js +87 -23
- package/dist/components/ChatFooter.js.map +1 -1
- package/dist/components/WebChatHeader.js +19 -8
- package/dist/components/WebChatHeader.js.map +1 -1
- package/dist/components/WebchatRightSide.js +17 -2
- package/dist/components/WebchatRightSide.js.map +1 -1
- package/dist/components/contact-info2.js +138 -5
- package/dist/components/contact-info2.js.map +1 -1
- package/dist/components/toast-notification.js +21 -15
- package/dist/components/toast-notification.js.map +1 -1
- package/dist/components/toast.js +112 -21
- package/dist/components/toast.js.map +1 -1
- package/dist/esm/attachment-preview_22.entry.js +254 -37
- package/dist/esm/attachment-preview_22.entry.js.map +1 -1
- package/dist/esm/isometrik-webchat.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/login-page_3.entry.js +1 -1
- package/dist/esm/member-add.entry.js +1 -1
- package/dist/esm/reaction-container.entry.js +1 -1
- package/dist/esm/toast-45ac7913.js +157 -0
- package/dist/esm/toast-45ac7913.js.map +1 -0
- package/dist/esm/toast-notification.entry.js +21 -15
- package/dist/esm/toast-notification.entry.js.map +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
- package/dist/isometrik-webchat/p-0c06a021.js +2 -0
- package/dist/isometrik-webchat/p-0c06a021.js.map +1 -0
- package/dist/isometrik-webchat/p-2d69086d.entry.js +2 -0
- package/dist/isometrik-webchat/p-2d69086d.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-76341adb.entry.js → p-6024bf2a.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-35d9ecdc.entry.js → p-63ff4eea.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-2195b0c0.entry.js → p-ba6de4e2.entry.js} +2 -2
- package/dist/isometrik-webchat/p-d6fd2dd7.entry.js +2 -0
- package/dist/isometrik-webchat/p-d6fd2dd7.entry.js.map +1 -0
- package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +7 -3
- package/dist/types/components/ChatUIComponent/Header/WebChatHeader.d.ts +1 -0
- package/dist/types/components/ChatUIComponent/shared/contact-info/contact-info.d.ts +15 -0
- package/dist/types/lib/chat/group-title.d.ts +2 -0
- package/dist/types/lib/chat/index.d.ts +2 -0
- package/dist/types/lib/chat/mentioned-users.d.ts +18 -0
- package/dist/types/lib/friendly-toast-message.d.ts +5 -0
- package/dist/types/lib/toast.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/toast-f810e550.js +0 -68
- package/dist/cjs/toast-f810e550.js.map +0 -1
- package/dist/esm/toast-533dd183.js +0 -66
- package/dist/esm/toast-533dd183.js.map +0 -1
- package/dist/isometrik-webchat/p-4cb54460.js +0 -2
- package/dist/isometrik-webchat/p-4cb54460.js.map +0 -1
- package/dist/isometrik-webchat/p-a119be75.entry.js +0 -2
- package/dist/isometrik-webchat/p-a119be75.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-e1d632b0.entry.js +0 -2
- package/dist/isometrik-webchat/p-e1d632b0.entry.js.map +0 -1
- /package/dist/isometrik-webchat/{p-76341adb.entry.js.map → p-6024bf2a.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-35d9ecdc.entry.js.map → p-63ff4eea.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-2195b0c0.entry.js.map → p-ba6de4e2.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebchatRightSide.js","sourceRoot":"","sources":["../../../../src/components/my-component/web-chat/WebchatRightSide.tsx"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,KAAK,EAAC,CAAC,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,wDAAwD,CAAC;AAChE,OAAO,wDAAwD,CAAC;AAChE,OAAO,OAAO,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E,OAAO,IAAI,CAAC;IACd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["// @ts-nocheck\nimport { Component, Element, Listen, Prop, State,Watch,h } from \"@stencil/core\";\nimport '../../ChatUIComponent/shared/contact-info/contact-info';\nimport '../../ChatUIComponent/shared/profile-info/profile-info';\nimport ChatSDK from 'test-iso-chat-sdk';\nimport { showToast } from '../../../lib/toast';\nimport { groupMembersStore } from \"../../../store/group-members\";\nimport { conversationStore } from \"../../../store/conversation\";\nimport { makeAdmin, removeAdmin } from '../../../api/membership-control';\nimport '../../ChatUIComponent/shared/message-search/message-search';\nimport { drawerDialogService } from '../../../lib/drawer';\nimport '../../ChatUIComponent/AddMember';\n@Component({\n tag: 'web-chat-right-sidebar',\n shadow: true,\n styles: `\n :host {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: var(--w-full);\n height: var(--h-full);\n min-height: 0;\n background: var(--bg-primary);\n color: var(--text-primary);\n }\n `\n})\nexport class WebChatRightSide {\n\n@Prop() conversationMetaData: any = {};\n@Prop() selectedConversationId: string | null = null;\n@Prop() conversationIdFromContactinfo: string | null = null;\n@Prop() hasMoreEligibleMembers: boolean = true;\n@Prop() isContactInfoOpen:boolean =false;\n@Prop() isProfileInfoOpen:boolean =false;\n@Prop() eligibleMembers: any[] = [];\n@Prop() allAttachments:[]\n@Prop() userMetaData: any = null;\n@Prop() messageAction: { action: string; initiator: boolean } = { action: \"\", initiator: false };\n@State() groupMembers: any[] = [];\n@State() isLoading: boolean = false;\n@Prop() searchedMessageDetails:any[] = [];\n@Prop() onSearchHandler: (text: string) => void;\n@Prop() onSearchResultClick: (messageId: string) => Promise<void>;\n@Prop() handleChatSelect: (conversationId: string) => void;\n@Prop() openOwnProfile: () => void;\n@Prop() isOpenSearchBar: boolean = false;\n@Prop() isLoadingMessage: boolean = false;\n@Element() el: HTMLElement;\n@Prop() chatBodyRef: HTMLWebChatBodyElement;\n@Prop() allLinks: any;\n@Prop() allLinksCount: number;\n@Prop() isBlocked: boolean | string = null;\n@Prop() groupcastMembers: any = [];\n\n@Listen('remove-admin-clicked')\nasync handleRemoveAdmin(event: CustomEvent) {\n const { userId, username } = event.detail;\n try {\n this.isLoading = true;\n await removeAdmin(this.selectedConversationId, userId);\n groupMembersStore.updateAdminStatus(userId, false);\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: false } : member\n );\n this.el.dispatchEvent(new CustomEvent('admin-status-changed', {\n detail: {\n userId,\n isAdmin: false\n },\n bubbles: true,\n composed: true\n }));\n showToast({\n message: `${username} is no longer an admin`,\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n groupMembersStore.updateAdminStatus(userId, true);\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: true } : member\n );\n\n showToast({\n message: 'Failed to remove admin',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n } finally {\n this.isLoading = false;\n drawerDialogService.closeDialog('confirm-dialog');\n }\n}\n\n@Listen('make-admin-clicked')\n async handleMakeAdmin(event: CustomEvent) {\n const { userId, username } = event.detail;\n\n try {\n this.isLoading = true;\n await makeAdmin(this.selectedConversationId, userId);\n groupMembersStore.updateAdminStatus(userId, true);\n\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: true } : member\n );\n\n this.el.dispatchEvent(new CustomEvent('admin-status-changed', {\n detail: {\n userId,\n isAdmin: true\n },\n bubbles: true,\n composed: true\n }));\n showToast({\n message: `${username} is now an admin`,\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n groupMembersStore.updateAdminStatus(userId, false);\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: false } : member\n );\n showToast({\n message: 'Failed to make user admin',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n } finally {\n this.isLoading = false;\n drawerDialogService.closeDialog('confirm-dialog');\n }\n }\n \n\n handleEditGroupTitle = async (conversationTitle: string, conversationId: string) => {\n try {\n await ChatSDK.getInstance().Conversation.patchTitle({conversationId: conversationId, conversationTitle: conversationTitle});\n showToast({\n message: 'Group title updated successfully',\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n console.error(error, 'error');\n showToast({\n message: 'Failed to update group title',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n }\n } \n\n handleEditGroupImage = async (conversationImageUrl: string, conversationId: string) => {\n try {\n await ChatSDK.getInstance().Conversation.patchImage({conversationId: conversationId, conversationImageUrl: conversationImageUrl});\n showToast({\n message: 'Group image updated successfully',\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n console.error(error, 'error');\n showToast({\n message: 'Failed to update group image',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n }\n }\n\n @Listen('edit-title')\n async handleEditTitle (event: CustomEvent) {\n const { currentTitle, newTitle, conversationId, onError } = event.detail;\n \n if (newTitle && newTitle !== currentTitle) {\n try {\n // Update conversation details optimistically\n this.conversationMetaData.conversationTitle = newTitle;\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationTitle: newTitle\n };\n\n conversationStore.updateTitle(newTitle);\n\n await this.handleEditGroupTitle(newTitle, conversationId);\n\n // Emit event to notify parent that conversation details need to be refreshed\n this.el.dispatchEvent(new CustomEvent('conversation-updated', {\n detail: {\n conversationId,\n type: 'title',\n value: newTitle\n },\n bubbles: true,\n composed: true\n }));\n\n } catch (error) {\n console.error('Failed to update title:', error);\n if (onError) onError();\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationTitle: currentTitle\n };\n conversationStore.updateTitle(currentTitle);\n }\n }\n }\n\n @Listen('edit-image')\n async handleEditImage (event: CustomEvent) {\n const { currentImage, conversationId, file, onError, onSuccess } = event.detail;\n \n if (file) {\n try {\n // Get presigned URL\n const response = await ChatSDK.getInstance().message.postMessagesPresignedurls({\n conversationId,\n attachments: [{\n nameWithExtension: file.name,\n mediaType: 0, // for image\n mediaId: Date.now().toString(),\n }]\n });\n\n if (response?.presignedUrls?.[0]) {\n const { mediaPresignedUrl, mediaUrl } = response.presignedUrls[0];\n \n // Upload to presigned URL\n await fetch(mediaPresignedUrl, {\n method: 'PUT',\n body: file,\n headers: {\n 'Content-Type': file.type,\n },\n });\n\n await this.handleEditGroupImage(mediaUrl, conversationId)\n \n // Update conversation details with the new image URL\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationImageUrl: mediaUrl\n };\n\n if (onSuccess) onSuccess();\n }\n } catch (error) {\n console.error('Failed to update image:', error);\n if (onError) onError();\n \n // Revert optimistic update in conversation details\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationImageUrl: currentImage\n };\n }\n }\n }\n handleSearchInput = (searchText: string) => {\n this.onSearchHandler(searchText)\n }\n @Watch('selectedConversationId')\n async updateConversation(){\n this.el.dispatchEvent(new CustomEvent('close-right-Sidebar', {\n detail: {\n type: 'close-right-Sidebar',\n },\n bubbles: true,\n composed: true\n })); \n }\n render() {\n // Return the right sidebar content or null if nothing should be displayed\n if (this.isContactInfoOpen) {\n return (\n <slot name=\"contact-info\">\n <contact-info\n height=\"var(--h-full)\"\n width=\"var(--w-full)\"\n boxShadow=\"none\"\n backgroundColor=\"var(--bg-primary)\"\n textColor=\"var(--text-primary)\"\n contactName={this.conversationMetaData?.groupcastId ? this.conversationMetaData?.groupcastTitle : this.conversationMetaData?.conversationTitle || this.conversationMetaData?.opponentDetails?.userName}\n contactEmail={this.conversationMetaData?.opponentDetails?.userIdentifier}\n oppenentId={this.conversationMetaData?.opponentDetails?.userId}\n messageAction={this.messageAction}\n isGroup={this.conversationMetaData?.isGroup}\n contactImage={this.conversationMetaData?.groupcastId ? this.conversationMetaData?.groupcastImageUrl : this.conversationMetaData?.isGroup ? this.conversationMetaData.conversationImageUrl : this.conversationMetaData?.opponentDetails?.userProfileImageUrl}\n groupMembers={this.conversationMetaData?.members || this.conversationMetaData?.metaData?.members}\n allAttachments={this.allAttachments}\n closeContactInfo={() => (this.isContactInfoOpen = false)}\n conversationId={this.selectedConversationId}\n userMetaData={this.userMetaData}\n eligibleMembers={this.eligibleMembers}\n hasMoreEligibleMembers={this.hasMoreEligibleMembers}\n openOwnProfile={this.openOwnProfile}\n allLinks={this.allLinks}\n allLinksCount={this.allLinksCount}\n isBlocked={this.isBlocked}\n conversationMetaData={this.conversationMetaData}\n groupcastMembers={this.groupcastMembers}\n ></contact-info>\n </slot>\n );\n }\n if (this.isProfileInfoOpen) {\n return (\n <slot name=\"profile-info\">\n <profile-info\n height=\"var(--h-full)\"\n width=\"var(--w-full)\"\n boxShadow=\"none\"\n backgroundColor=\"var(--bg-primary)\"\n textColor=\"var(--text-primary)\"\n contactName={this.conversationMetaData?.conversationTitle || this.conversationMetaData?.opponentDetails?.userName}\n contactEmail={this.conversationMetaData?.opponentDetails?.userIdentifier}\n oppenentId={this.conversationMetaData?.opponentDetails?.userId}\n messageAction={this.messageAction}\n isGroup={false}\n contactImage={this.conversationMetaData?.isGroup ? this.conversationMetaData.conversationImageUrl : this.conversationMetaData?.opponentDetails?.userProfileImageUrl}\n groupMembers={this.conversationMetaData?.members}\n allAttachments={this.allAttachments}\n closeContactInfo={() => (this.isProfileInfoOpen = false)}\n conversationId={this.conversationIdFromContactinfo}\n userMetaData={this.userMetaData}\n eligibleMembers={this.eligibleMembers}\n hasMoreEligibleMembers={this.hasMoreEligibleMembers}\n handleChatSelect={this.handleChatSelect}\n isBlocked={this.isBlocked}\n conversationMetaData={this.conversationMetaData}\n ></profile-info>\n </slot>\n );\n }\n \n if (this.isOpenSearchBar) {\n return (\n <slot name=\"message-search\">\n <message-search\n onSearchResultClick={this.onSearchResultClick}\n onSearchHandler={this.onSearchHandler}\n searchedMessageDetails={this.searchedMessageDetails}\n onSearchInput={this.handleSearchInput}\n chatBodyRef={this.chatBodyRef}\n isLoadingMessage={this.isLoadingMessage}\n ></message-search>\n </slot>\n );\n }\n \n // Return null or an empty container when nothing should be displayed\n return null;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"WebchatRightSide.js","sourceRoot":"","sources":["../../../../src/components/my-component/web-chat/WebchatRightSide.tsx"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,KAAK,EAAC,CAAC,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,wDAAwD,CAAC;AAChE,OAAO,wDAAwD,CAAC;AAChE,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,iCAAiC,CAAC;AAiBzC,MAAM,OAAO,gBAAgB;;QAmH1B,yBAAoB,GAAG,KAAK,EAAE,iBAAyB,EAAE,cAAsB,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["// @ts-nocheck\nimport { Component, Element, Listen, Prop, State,Watch,h } from \"@stencil/core\";\nimport '../../ChatUIComponent/shared/contact-info/contact-info';\nimport '../../ChatUIComponent/shared/profile-info/profile-info';\nimport ChatSDK from 'test-iso-chat-sdk';\nimport { showToast } from '../../../lib/toast';\nimport { groupMembersStore } from \"../../../store/group-members\";\nimport { conversationStore } from \"../../../store/conversation\";\nimport { makeAdmin, removeAdmin } from '../../../api/membership-control';\nimport '../../ChatUIComponent/shared/message-search/message-search';\nimport { drawerDialogService } from '../../../lib/drawer';\nimport '../../ChatUIComponent/AddMember';\n@Component({\n tag: 'web-chat-right-sidebar',\n shadow: true,\n styles: `\n :host {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: var(--w-full);\n height: var(--h-full);\n min-height: 0;\n background: var(--bg-primary);\n color: var(--text-primary);\n }\n `\n})\nexport class WebChatRightSide {\n\n@Prop() conversationMetaData: any = {};\n@Prop() selectedConversationId: string | null = null;\n@Prop() conversationIdFromContactinfo: string | null = null;\n@Prop() hasMoreEligibleMembers: boolean = true;\n@Prop() isContactInfoOpen:boolean =false;\n@Prop() isProfileInfoOpen:boolean =false;\n@Prop() eligibleMembers: any[] = [];\n@Prop() allAttachments:[]\n@Prop() userMetaData: any = null;\n@Prop() messageAction: { action: string; initiator: boolean } = { action: \"\", initiator: false };\n@State() groupMembers: any[] = [];\n@State() isLoading: boolean = false;\n@Prop() searchedMessageDetails:any[] = [];\n@Prop() onSearchHandler: (text: string) => void;\n@Prop() onSearchResultClick: (messageId: string) => Promise<void>;\n@Prop() handleChatSelect: (conversationId: string) => void;\n@Prop() openOwnProfile: () => void;\n@Prop() isOpenSearchBar: boolean = false;\n@Prop() isLoadingMessage: boolean = false;\n@Element() el: HTMLElement;\n@Prop() chatBodyRef: HTMLWebChatBodyElement;\n@Prop() allLinks: any;\n@Prop() allLinksCount: number;\n@Prop() isBlocked: boolean | string = null;\n@Prop() groupcastMembers: any = [];\n\n@Listen('remove-admin-clicked')\nasync handleRemoveAdmin(event: CustomEvent) {\n const { userId, username } = event.detail;\n try {\n this.isLoading = true;\n await removeAdmin(this.selectedConversationId, userId);\n groupMembersStore.updateAdminStatus(userId, false);\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: false } : member\n );\n this.el.dispatchEvent(new CustomEvent('admin-status-changed', {\n detail: {\n userId,\n isAdmin: false\n },\n bubbles: true,\n composed: true\n }));\n showToast({\n message: `${username} is no longer an admin`,\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n groupMembersStore.updateAdminStatus(userId, true);\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: true } : member\n );\n\n showToast({\n message: 'Failed to remove admin',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n } finally {\n this.isLoading = false;\n drawerDialogService.closeDialog('confirm-dialog');\n }\n}\n\n@Listen('make-admin-clicked')\n async handleMakeAdmin(event: CustomEvent) {\n const { userId, username } = event.detail;\n\n try {\n this.isLoading = true;\n await makeAdmin(this.selectedConversationId, userId);\n groupMembersStore.updateAdminStatus(userId, true);\n\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: true } : member\n );\n\n this.el.dispatchEvent(new CustomEvent('admin-status-changed', {\n detail: {\n userId,\n isAdmin: true\n },\n bubbles: true,\n composed: true\n }));\n showToast({\n message: `${username} is now an admin`,\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n groupMembersStore.updateAdminStatus(userId, false);\n this.groupMembers = this.groupMembers.map(member => \n member.userId === userId ? { ...member, isAdmin: false } : member\n );\n showToast({\n message: 'Failed to make user admin',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n } finally {\n this.isLoading = false;\n drawerDialogService.closeDialog('confirm-dialog');\n }\n }\n \n\n handleEditGroupTitle = async (conversationTitle: string, conversationId: string) => {\n try {\n await ChatSDK.getInstance().Conversation.patchTitle({conversationId: conversationId, conversationTitle: conversationTitle});\n showToast({\n message: 'Group title updated successfully',\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n console.error(error, 'error');\n showToast({\n message: 'Failed to update group title',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n }\n } \n\n handleEditGroupImage = async (conversationImageUrl: string, conversationId: string) => {\n try {\n await ChatSDK.getInstance().Conversation.patchImage({conversationId: conversationId, conversationImageUrl: conversationImageUrl});\n showToast({\n message: 'Group image updated successfully',\n type: 'success',\n duration: 4000,\n position: 'bottom-left'\n });\n } catch (error) {\n console.error(error, 'error');\n showToast({\n message: 'Failed to update group image',\n type: 'error',\n duration: 4000,\n position: 'bottom-left'\n });\n }\n }\n\n @Listen('edit-title')\n async handleEditTitle (event: CustomEvent) {\n const { currentTitle, newTitle, conversationId, onError } = event.detail;\n \n if (newTitle && newTitle !== currentTitle) {\n try {\n // Update conversation details optimistically\n this.conversationMetaData.conversationTitle = newTitle;\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationTitle: newTitle\n };\n\n conversationStore.updateTitle(newTitle);\n\n await this.handleEditGroupTitle(newTitle, conversationId);\n\n // Emit event to notify parent that conversation details need to be refreshed\n this.el.dispatchEvent(new CustomEvent('conversation-updated', {\n detail: {\n conversationId,\n type: 'title',\n value: newTitle\n },\n bubbles: true,\n composed: true\n }));\n\n } catch (error) {\n console.error('Failed to update title:', error);\n if (onError) onError();\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationTitle: currentTitle\n };\n conversationStore.updateTitle(currentTitle);\n }\n }\n }\n\n @Listen('edit-image')\n async handleEditImage (event: CustomEvent) {\n const { currentImage, conversationId, file, onError, onSuccess } = event.detail;\n \n if (file) {\n try {\n // Get presigned URL\n const response = await ChatSDK.getInstance().message.postMessagesPresignedurls({\n conversationId,\n attachments: [{\n nameWithExtension: file.name,\n mediaType: 0, // for image\n mediaId: Date.now().toString(),\n }]\n });\n\n if (response?.presignedUrls?.[0]) {\n const { mediaPresignedUrl, mediaUrl } = response.presignedUrls[0];\n \n // Upload to presigned URL\n await fetch(mediaPresignedUrl, {\n method: 'PUT',\n body: file,\n headers: {\n 'Content-Type': file.type,\n },\n });\n\n await this.handleEditGroupImage(mediaUrl, conversationId);\n\n // Keep Group info + header store + conversation list in sync\n // (same path as edit-title → hostConversationUpdate type:'image').\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationImageUrl: mediaUrl,\n };\n conversationStore.updateConversationDetails({\n conversationImageUrl: mediaUrl,\n });\n this.el.dispatchEvent(\n new CustomEvent('conversation-updated', {\n detail: {\n conversationId,\n type: 'image',\n value: mediaUrl,\n },\n bubbles: true,\n composed: true,\n }),\n );\n\n if (onSuccess) onSuccess();\n }\n } catch (error) {\n console.error('Failed to update image:', error);\n if (onError) onError();\n\n this.conversationMetaData = {\n ...this.conversationMetaData,\n conversationImageUrl: currentImage,\n };\n conversationStore.updateConversationDetails({\n conversationImageUrl: currentImage,\n });\n }\n }\n }\n handleSearchInput = (searchText: string) => {\n this.onSearchHandler(searchText)\n }\n @Watch('selectedConversationId')\n async updateConversation(){\n this.el.dispatchEvent(new CustomEvent('close-right-Sidebar', {\n detail: {\n type: 'close-right-Sidebar',\n },\n bubbles: true,\n composed: true\n })); \n }\n render() {\n // Return the right sidebar content or null if nothing should be displayed\n if (this.isContactInfoOpen) {\n return (\n <slot name=\"contact-info\">\n <contact-info\n height=\"var(--h-full)\"\n width=\"var(--w-full)\"\n boxShadow=\"none\"\n backgroundColor=\"var(--bg-primary)\"\n textColor=\"var(--text-primary)\"\n contactName={this.conversationMetaData?.groupcastId ? this.conversationMetaData?.groupcastTitle : this.conversationMetaData?.conversationTitle || this.conversationMetaData?.opponentDetails?.userName}\n contactEmail={this.conversationMetaData?.opponentDetails?.userIdentifier}\n oppenentId={this.conversationMetaData?.opponentDetails?.userId}\n messageAction={this.messageAction}\n isGroup={this.conversationMetaData?.isGroup}\n contactImage={this.conversationMetaData?.groupcastId ? this.conversationMetaData?.groupcastImageUrl : this.conversationMetaData?.isGroup ? this.conversationMetaData.conversationImageUrl : this.conversationMetaData?.opponentDetails?.userProfileImageUrl}\n groupMembers={this.conversationMetaData?.members || this.conversationMetaData?.metaData?.members}\n allAttachments={this.allAttachments}\n closeContactInfo={() => (this.isContactInfoOpen = false)}\n conversationId={this.selectedConversationId}\n userMetaData={this.userMetaData}\n eligibleMembers={this.eligibleMembers}\n hasMoreEligibleMembers={this.hasMoreEligibleMembers}\n openOwnProfile={this.openOwnProfile}\n allLinks={this.allLinks}\n allLinksCount={this.allLinksCount}\n isBlocked={this.isBlocked}\n conversationMetaData={this.conversationMetaData}\n groupcastMembers={this.groupcastMembers}\n ></contact-info>\n </slot>\n );\n }\n if (this.isProfileInfoOpen) {\n return (\n <slot name=\"profile-info\">\n <profile-info\n height=\"var(--h-full)\"\n width=\"var(--w-full)\"\n boxShadow=\"none\"\n backgroundColor=\"var(--bg-primary)\"\n textColor=\"var(--text-primary)\"\n contactName={this.conversationMetaData?.conversationTitle || this.conversationMetaData?.opponentDetails?.userName}\n contactEmail={this.conversationMetaData?.opponentDetails?.userIdentifier}\n oppenentId={this.conversationMetaData?.opponentDetails?.userId}\n messageAction={this.messageAction}\n isGroup={false}\n contactImage={this.conversationMetaData?.isGroup ? this.conversationMetaData.conversationImageUrl : this.conversationMetaData?.opponentDetails?.userProfileImageUrl}\n groupMembers={this.conversationMetaData?.members}\n allAttachments={this.allAttachments}\n closeContactInfo={() => (this.isProfileInfoOpen = false)}\n conversationId={this.conversationIdFromContactinfo}\n userMetaData={this.userMetaData}\n eligibleMembers={this.eligibleMembers}\n hasMoreEligibleMembers={this.hasMoreEligibleMembers}\n handleChatSelect={this.handleChatSelect}\n isBlocked={this.isBlocked}\n conversationMetaData={this.conversationMetaData}\n ></profile-info>\n </slot>\n );\n }\n \n if (this.isOpenSearchBar) {\n return (\n <slot name=\"message-search\">\n <message-search\n onSearchResultClick={this.onSearchResultClick}\n onSearchHandler={this.onSearchHandler}\n searchedMessageDetails={this.searchedMessageDetails}\n onSearchInput={this.handleSearchInput}\n chatBodyRef={this.chatBodyRef}\n isLoadingMessage={this.isLoadingMessage}\n ></message-search>\n </slot>\n );\n }\n \n // Return null or an empty container when nothing should be displayed\n return null;\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-title.js","sourceRoot":"","sources":["../../../src/lib/chat/group-title.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,GAAG,GAAG,GAAG;IACxD,OAAO,MAAM,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC;SACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE;SACN,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACnB,CAAC","sourcesContent":["/** Trim + clamp for Conversation.patchTitle. */\nexport function normalizeGroupTitle(raw: string, max = 100): string {\n return String(raw ?? '')\n .replace(/\\s+/g, ' ')\n .trim()\n .slice(0, max);\n}\n"]}
|
|
@@ -10,4 +10,6 @@ export { ATTACHMENT_BODY_PLACEHOLDER, mediaTypeFromMime, customTypeFromMime, isA
|
|
|
10
10
|
export { MAX_MEDIA_PER_MESSAGE, takeMediaFiles, mediaLimitToastMessage, } from './media-limits';
|
|
11
11
|
export { filesToOutboxMedia, outboxMediaToFiles, MAX_OUTBOX_MEDIA_BYTES } from './media-outbox';
|
|
12
12
|
export { isPdfAttachment, previewKindFromAttachment, deliveryUiState } from './preview-kind';
|
|
13
|
+
export { toMentionedUsersPayload, } from './mentioned-users';
|
|
14
|
+
export { normalizeGroupTitle } from './group-title';
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/chat/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC/I,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAA0B,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC3G,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/**\n * Chat data helpers used by <web-chat>.\n * Plain functions — no Stencil. WebChat owns @State and calls these.\n */\nexport { sortConversationsByLatestMessage, fetchConversationsPage, fetchConversationDetails, mergeUniqueConversations } from './conversations';\nexport {\n fetchMessagesPage,\n markConversationRead,\n mergeMessagesById,\n searchMessages,\n fetchLinkMessages,\n fetchMediaCount,\n fetchMediaAttachments,\n filterMediaMessages,\n attachmentBucket,\n splitSharedMessages,\n mediaPreviewUrl,\n mediaPreviewUrls,\n docIconKind,\n} from './messages';\nexport { initializeChatSdk, fetchUserDetails, type ChatSdkInitConfig } from './session';\nexport { fetchGroupcastDetails, fetchGroupcastMembersPage, fetchGroupcastContactsPage } from './groupcast';\nexport {\n ATTACHMENT_BODY_PLACEHOLDER,\n mediaTypeFromMime,\n customTypeFromMime,\n isAttachmentBodyPlaceholder,\n attachmentCaption,\n attachmentBodyForApi,\n prepareMediaAttachments,\n buildLocalMediaAttachments,\n buildReplyMetaData,\n uploadAndPostMediaMessage,\n} from './send-media';\nexport {\n MAX_MEDIA_PER_MESSAGE,\n takeMediaFiles,\n mediaLimitToastMessage,\n} from './media-limits';\nexport { filesToOutboxMedia, outboxMediaToFiles, MAX_OUTBOX_MEDIA_BYTES } from './media-outbox';\nexport { isPdfAttachment, previewKindFromAttachment, deliveryUiState } from './preview-kind';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/chat/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC/I,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAA0B,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC3G,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EACL,uBAAuB,GAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/**\n * Chat data helpers used by <web-chat>.\n * Plain functions — no Stencil. WebChat owns @State and calls these.\n */\nexport { sortConversationsByLatestMessage, fetchConversationsPage, fetchConversationDetails, mergeUniqueConversations } from './conversations';\nexport {\n fetchMessagesPage,\n markConversationRead,\n mergeMessagesById,\n searchMessages,\n fetchLinkMessages,\n fetchMediaCount,\n fetchMediaAttachments,\n filterMediaMessages,\n attachmentBucket,\n splitSharedMessages,\n mediaPreviewUrl,\n mediaPreviewUrls,\n docIconKind,\n} from './messages';\nexport { initializeChatSdk, fetchUserDetails, type ChatSdkInitConfig } from './session';\nexport { fetchGroupcastDetails, fetchGroupcastMembersPage, fetchGroupcastContactsPage } from './groupcast';\nexport {\n ATTACHMENT_BODY_PLACEHOLDER,\n mediaTypeFromMime,\n customTypeFromMime,\n isAttachmentBodyPlaceholder,\n attachmentCaption,\n attachmentBodyForApi,\n prepareMediaAttachments,\n buildLocalMediaAttachments,\n buildReplyMetaData,\n uploadAndPostMediaMessage,\n} from './send-media';\nexport {\n MAX_MEDIA_PER_MESSAGE,\n takeMediaFiles,\n mediaLimitToastMessage,\n} from './media-limits';\nexport { filesToOutboxMedia, outboxMediaToFiles, MAX_OUTBOX_MEDIA_BYTES } from './media-outbox';\nexport { isPdfAttachment, previewKindFromAttachment, deliveryUiState } from './preview-kind';\nexport {\n toMentionedUsersPayload,\n type MentionedUserPayload,\n} from './mentioned-users';\nexport { normalizeGroupTitle } from './group-title';\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API `mentionedUsers` shape for postMessages.
|
|
3
|
+
* Callers (custom UI / HOA) may pass `{ userId, userName }`; we map to
|
|
4
|
+
* `{ userId, wordCount, order }` before send.
|
|
5
|
+
*/
|
|
6
|
+
function wordCountForName(userName) {
|
|
7
|
+
const n = userName.trim().split(/\s+/).filter(Boolean).length;
|
|
8
|
+
return n > 0 ? n : 1;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build API mention list from composer body + picker selections.
|
|
12
|
+
* - Prefers `userName` to locate `@Name` in body and derive wordCount
|
|
13
|
+
* - Drops mentions no longer present in body
|
|
14
|
+
* - One entry per userId (first appearance wins)
|
|
15
|
+
* - `order` is 1-based by appearance in body
|
|
16
|
+
*/
|
|
17
|
+
export function toMentionedUsersPayload(body, list) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
if (!Array.isArray(list) || !list.length)
|
|
20
|
+
return [];
|
|
21
|
+
const text = String(body !== null && body !== void 0 ? body : '');
|
|
22
|
+
const hits = [];
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
for (const raw of list) {
|
|
25
|
+
if (!raw || typeof raw !== 'object')
|
|
26
|
+
continue;
|
|
27
|
+
const userId = String((_a = raw.userId) !== null && _a !== void 0 ? _a : '').trim();
|
|
28
|
+
if (!userId || seen.has(userId))
|
|
29
|
+
continue;
|
|
30
|
+
const userName = String((_b = raw.userName) !== null && _b !== void 0 ? _b : '').trim();
|
|
31
|
+
let wordCount = Number(raw.wordCount);
|
|
32
|
+
let start = -1;
|
|
33
|
+
if (userName) {
|
|
34
|
+
start = text.indexOf(`@${userName}`);
|
|
35
|
+
if (start < 0)
|
|
36
|
+
continue;
|
|
37
|
+
if (!Number.isFinite(wordCount) || wordCount < 1) {
|
|
38
|
+
wordCount = wordCountForName(userName);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (Number.isFinite(wordCount) && wordCount >= 1) {
|
|
42
|
+
// Already API-shaped (no name) — keep relative order via `order`
|
|
43
|
+
const ord = Number(raw.order);
|
|
44
|
+
start = Number.isFinite(ord) ? ord : hits.length + 1;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
seen.add(userId);
|
|
50
|
+
hits.push({ userId, wordCount, start });
|
|
51
|
+
}
|
|
52
|
+
hits.sort((a, b) => a.start - b.start);
|
|
53
|
+
return hits.map((h, i) => ({
|
|
54
|
+
userId: h.userId,
|
|
55
|
+
wordCount: h.wordCount,
|
|
56
|
+
order: i + 1,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=mentioned-users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mentioned-users.js","sourceRoot":"","sources":["../../../src/lib/chat/mentioned-users.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,SAAS,gBAAgB,CAAC,QAAgB;IACxC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,CAA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AAC;QACH,CAAC;aAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;YACxD,iEAAiE;YACjE,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC9B,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,SAAS;QACX,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,KAAK,EAAE,CAAC,GAAG,CAAC;KACb,CAAC,CAAC,CAAC;AACN,CAAC","sourcesContent":["/**\n * API `mentionedUsers` shape for postMessages.\n * Callers (custom UI / HOA) may pass `{ userId, userName }`; we map to\n * `{ userId, wordCount, order }` before send.\n */\n\nexport type MentionedUserPayload = {\n userId: string;\n wordCount: number;\n order: number;\n};\n\ntype MentionInput = {\n userId?: unknown;\n userName?: unknown;\n wordCount?: unknown;\n order?: unknown;\n};\n\nfunction wordCountForName(userName: string): number {\n const n = userName.trim().split(/\\s+/).filter(Boolean).length;\n return n > 0 ? n : 1;\n}\n\n/**\n * Build API mention list from composer body + picker selections.\n * - Prefers `userName` to locate `@Name` in body and derive wordCount\n * - Drops mentions no longer present in body\n * - One entry per userId (first appearance wins)\n * - `order` is 1-based by appearance in body\n */\nexport function toMentionedUsersPayload(\n body: string,\n list: unknown\n): MentionedUserPayload[] {\n if (!Array.isArray(list) || !list.length) return [];\n const text = String(body ?? '');\n\n type Hit = { userId: string; wordCount: number; start: number };\n const hits: Hit[] = [];\n const seen = new Set<string>();\n\n for (const raw of list as MentionInput[]) {\n if (!raw || typeof raw !== 'object') continue;\n const userId = String(raw.userId ?? '').trim();\n if (!userId || seen.has(userId)) continue;\n\n const userName = String(raw.userName ?? '').trim();\n let wordCount = Number(raw.wordCount);\n let start = -1;\n\n if (userName) {\n start = text.indexOf(`@${userName}`);\n if (start < 0) continue;\n if (!Number.isFinite(wordCount) || wordCount < 1) {\n wordCount = wordCountForName(userName);\n }\n } else if (Number.isFinite(wordCount) && wordCount >= 1) {\n // Already API-shaped (no name) — keep relative order via `order`\n const ord = Number(raw.order);\n start = Number.isFinite(ord) ? ord : hits.length + 1;\n } else {\n continue;\n }\n\n seen.add(userId);\n hits.push({ userId, wordCount, start });\n }\n\n hits.sort((a, b) => a.start - b.start);\n return hits.map((h, i) => ({\n userId: h.userId,\n wordCount: h.wordCount,\n order: i + 1,\n }));\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map raw API / SDK errors to short user-facing copy.
|
|
3
|
+
* Never surface HTTP status phrases like "Unprocessable entity".
|
|
4
|
+
*/
|
|
5
|
+
export function friendlyToastMessage(raw, fallback = 'Something went wrong. Try again.') {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const s = String((_b = (_a = raw === null || raw === void 0 ? void 0 : raw.message) !== null && _a !== void 0 ? _a : raw) !== null && _b !== void 0 ? _b : '')
|
|
8
|
+
.trim()
|
|
9
|
+
.replace(/\s+/g, ' ');
|
|
10
|
+
if (!s)
|
|
11
|
+
return fallback;
|
|
12
|
+
const lower = s.toLowerCase();
|
|
13
|
+
if (lower.includes('unprocessable') ||
|
|
14
|
+
lower.includes('422') ||
|
|
15
|
+
lower === 'bad request' ||
|
|
16
|
+
lower.includes('invalid payload')) {
|
|
17
|
+
return "Couldn't send that message. Please try again.";
|
|
18
|
+
}
|
|
19
|
+
if (lower.includes('network') ||
|
|
20
|
+
lower.includes('failed to fetch') ||
|
|
21
|
+
lower.includes('timeout')) {
|
|
22
|
+
return 'Network issue. Check your connection and try again.';
|
|
23
|
+
}
|
|
24
|
+
if (lower.includes('unauthorized') ||
|
|
25
|
+
lower.includes('401') ||
|
|
26
|
+
lower.includes('forbidden') ||
|
|
27
|
+
lower.includes('403')) {
|
|
28
|
+
return 'Session expired. Please refresh and try again.';
|
|
29
|
+
}
|
|
30
|
+
if (lower.includes('not found') || lower.includes('404')) {
|
|
31
|
+
return 'That chat is no longer available.';
|
|
32
|
+
}
|
|
33
|
+
// Keep short human messages; truncate giant stack/JSON blobs.
|
|
34
|
+
if (s.length > 120 || s.startsWith('{') || s.includes('\n'))
|
|
35
|
+
return fallback;
|
|
36
|
+
return s;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=friendly-toast-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friendly-toast-message.js","sourceRoot":"","sources":["../../src/lib/friendly-toast-message.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAY,EACZ,QAAQ,GAAG,kCAAkC;;IAE7C,MAAM,CAAC,GAAG,MAAM,CAAC,MAAA,MAAC,GAA6B,aAA7B,GAAG,uBAAH,GAAG,CAA4B,OAAO,mCAAI,GAAG,mCAAI,EAAE,CAAC;SACnE,IAAI,EAAE;SACN,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IAExB,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9B,IACE,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC/B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QACrB,KAAK,KAAK,aAAa;QACvB,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EACjC,CAAC;QACD,OAAO,+CAA+C,CAAC;IACzD,CAAC;IACD,IACE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;QACzB,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QACjC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EACzB,CAAC;QACD,OAAO,qDAAqD,CAAC;IAC/D,CAAC;IACD,IACE,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC9B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QACrB,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC3B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrB,CAAC;QACD,OAAO,gDAAgD,CAAC;IAC1D,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,OAAO,mCAAmC,CAAC;IAC7C,CAAC;IACD,8DAA8D;IAC9D,IAAI,CAAC,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC7E,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * Map raw API / SDK errors to short user-facing copy.\n * Never surface HTTP status phrases like \"Unprocessable entity\".\n */\nexport function friendlyToastMessage(\n raw: unknown,\n fallback = 'Something went wrong. Try again.',\n): string {\n const s = String((raw as { message?: unknown })?.message ?? raw ?? '')\n .trim()\n .replace(/\\s+/g, ' ');\n if (!s) return fallback;\n\n const lower = s.toLowerCase();\n if (\n lower.includes('unprocessable') ||\n lower.includes('422') ||\n lower === 'bad request' ||\n lower.includes('invalid payload')\n ) {\n return \"Couldn't send that message. Please try again.\";\n }\n if (\n lower.includes('network') ||\n lower.includes('failed to fetch') ||\n lower.includes('timeout')\n ) {\n return 'Network issue. Check your connection and try again.';\n }\n if (\n lower.includes('unauthorized') ||\n lower.includes('401') ||\n lower.includes('forbidden') ||\n lower.includes('403')\n ) {\n return 'Session expired. Please refresh and try again.';\n }\n if (lower.includes('not found') || lower.includes('404')) {\n return 'That chat is no longer available.';\n }\n // Keep short human messages; truncate giant stack/JSON blobs.\n if (s.length > 120 || s.startsWith('{') || s.includes('\\n')) return fallback;\n return s;\n}\n"]}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import "../components/ChatUIComponent/shared/toast-notification/toast-notification";
|
|
2
2
|
import { createCustomPartElement } from "./custom-ui";
|
|
3
|
+
import { friendlyToastMessage } from "./friendly-toast-message";
|
|
4
|
+
export { friendlyToastMessage } from './friendly-toast-message';
|
|
3
5
|
class ToastHelper {
|
|
4
6
|
constructor() {
|
|
5
7
|
this.container = document.createElement('div');
|
|
6
|
-
this.container.
|
|
7
|
-
this.container.style
|
|
8
|
+
this.container.id = 'isometrik-toast-root';
|
|
9
|
+
Object.assign(this.container.style, {
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
zIndex: '100000',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
gap: '8px',
|
|
15
|
+
pointerEvents: 'none',
|
|
16
|
+
maxWidth: 'min(22rem, calc(100vw - 2rem))',
|
|
17
|
+
});
|
|
8
18
|
document.body.appendChild(this.container);
|
|
9
19
|
}
|
|
10
20
|
static getInstance() {
|
|
@@ -12,50 +22,95 @@ class ToastHelper {
|
|
|
12
22
|
ToastHelper.instance = new ToastHelper();
|
|
13
23
|
return ToastHelper.instance;
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Solid fallbacks — host themes often leave --danger / --bg-primary unset
|
|
27
|
+
* or map --bg-primary to a light surface (white-on-white toast).
|
|
28
|
+
*/
|
|
15
29
|
getTypeStyles(type = 'info') {
|
|
16
30
|
const styles = {
|
|
17
|
-
success: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
success: {
|
|
32
|
+
bgColor: 'var(--success, #15803d)',
|
|
33
|
+
color: '#ffffff',
|
|
34
|
+
progressBarColor: 'rgba(255,255,255,0.55)',
|
|
35
|
+
borderColor: 'transparent',
|
|
36
|
+
},
|
|
37
|
+
error: {
|
|
38
|
+
bgColor: 'var(--danger, #b91c1c)',
|
|
39
|
+
color: '#ffffff',
|
|
40
|
+
progressBarColor: 'rgba(255,255,255,0.55)',
|
|
41
|
+
borderColor: 'transparent',
|
|
42
|
+
},
|
|
43
|
+
warning: {
|
|
44
|
+
bgColor: 'var(--text-warning-color, #c2410c)',
|
|
45
|
+
color: '#ffffff',
|
|
46
|
+
progressBarColor: 'rgba(255,255,255,0.55)',
|
|
47
|
+
borderColor: 'transparent',
|
|
48
|
+
},
|
|
49
|
+
info: {
|
|
50
|
+
bgColor: 'var(--hoa-chat-ink, #18181b)',
|
|
51
|
+
color: '#ffffff',
|
|
52
|
+
progressBarColor: 'rgba(255,255,255,0.55)',
|
|
53
|
+
borderColor: 'transparent',
|
|
54
|
+
},
|
|
21
55
|
};
|
|
22
56
|
return styles[type] || styles.info;
|
|
23
57
|
}
|
|
24
58
|
setPosition(position = 'top-right') {
|
|
59
|
+
// Clear previous transform so center variants don't stick.
|
|
60
|
+
this.container.style.transform = '';
|
|
25
61
|
const positions = {
|
|
26
|
-
'top-right': { top: '
|
|
27
|
-
'top-left': { top: '
|
|
28
|
-
|
|
29
|
-
'bottom-
|
|
30
|
-
'
|
|
31
|
-
'
|
|
62
|
+
'top-right': { top: '1rem', right: '1rem', bottom: 'auto', left: 'auto' },
|
|
63
|
+
'top-left': { top: '1rem', right: 'auto', bottom: 'auto', left: '1rem' },
|
|
64
|
+
// Sit above typical chat composer (~5.5rem).
|
|
65
|
+
'bottom-right': { top: 'auto', right: '1rem', bottom: '5.5rem', left: 'auto' },
|
|
66
|
+
'bottom-left': { top: 'auto', right: 'auto', bottom: '5.5rem', left: '1rem' },
|
|
67
|
+
'top-center': {
|
|
68
|
+
top: '1rem',
|
|
69
|
+
right: 'auto',
|
|
70
|
+
bottom: 'auto',
|
|
71
|
+
left: '50%',
|
|
72
|
+
transform: 'translateX(-50%)',
|
|
73
|
+
},
|
|
74
|
+
'bottom-center': {
|
|
75
|
+
top: 'auto',
|
|
76
|
+
right: 'auto',
|
|
77
|
+
bottom: '5.5rem',
|
|
78
|
+
left: '50%',
|
|
79
|
+
transform: 'translateX(-50%)',
|
|
80
|
+
},
|
|
32
81
|
};
|
|
33
82
|
Object.assign(this.container.style, positions[position] || positions['top-right']);
|
|
34
83
|
}
|
|
35
84
|
show(options) {
|
|
36
|
-
const {
|
|
85
|
+
const { duration = 3500, type = 'info', position = 'top-right' } = options;
|
|
86
|
+
const message = friendlyToastMessage(options.message);
|
|
37
87
|
this.setPosition(position);
|
|
38
88
|
const toast = document.createElement('toast-notification');
|
|
39
89
|
const styles = this.getTypeStyles(type);
|
|
40
90
|
toast.bgColor = styles.bgColor;
|
|
41
|
-
toast.color =
|
|
42
|
-
toast.progressBarColor =
|
|
91
|
+
toast.color = styles.color;
|
|
92
|
+
toast.progressBarColor = styles.progressBarColor;
|
|
93
|
+
toast.progressBarBg = 'transparent';
|
|
94
|
+
toast.borderColor = styles.borderColor;
|
|
95
|
+
toast.borderWidth = '0';
|
|
43
96
|
toast.toastMessage = message;
|
|
44
|
-
toast.padding = '12px';
|
|
45
|
-
toast.borderRadius = '
|
|
46
|
-
toast.width = '
|
|
47
|
-
toast.
|
|
97
|
+
toast.padding = '12px 14px';
|
|
98
|
+
toast.borderRadius = '0.5rem';
|
|
99
|
+
toast.width = '100%';
|
|
100
|
+
toast.fontWeight = '600';
|
|
101
|
+
toast.style.pointerEvents = 'auto';
|
|
48
102
|
toast.style.display = 'block';
|
|
103
|
+
toast.style.boxShadow = '0 8px 24px rgba(24, 24, 27, 0.18)';
|
|
49
104
|
this.container.appendChild(toast);
|
|
50
105
|
setTimeout(() => toast.remove(), duration);
|
|
51
106
|
}
|
|
52
107
|
}
|
|
53
108
|
export const showToast = (options) => {
|
|
54
109
|
var _a;
|
|
55
|
-
const custom = createCustomPartElement('toast', options);
|
|
110
|
+
const custom = createCustomPartElement('toast', Object.assign(Object.assign({}, options), { message: friendlyToastMessage(options.message) }));
|
|
56
111
|
if (custom) {
|
|
57
112
|
document.body.appendChild(custom);
|
|
58
|
-
setTimeout(() => custom.remove(), (_a = options.duration) !== null && _a !== void 0 ? _a :
|
|
113
|
+
setTimeout(() => custom.remove(), (_a = options.duration) !== null && _a !== void 0 ? _a : 3500);
|
|
59
114
|
return;
|
|
60
115
|
}
|
|
61
116
|
ToastHelper.getInstance().show(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/lib/toast.ts"],"names":[],"mappings":"AAAA,OAAO,4EAA4E,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/lib/toast.ts"],"names":[],"mappings":"AAAA,OAAO,4EAA4E,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAShE,MAAM,WAAW;IAIf;QACE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,sBAAsB,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;YAClC,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,MA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AClC,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,IAAI,CAAC,CAAC;QAC5D,OAAO;IACT,CAAC;IACD,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import '../components/ChatUIComponent/shared/toast-notification/toast-notification';\nimport { createCustomPartElement } from './custom-ui';\nimport { friendlyToastMessage } from './friendly-toast-message';\n\nexport { friendlyToastMessage } from './friendly-toast-message';\n\nexport interface ToastOptions {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';\n}\n\nclass ToastHelper {\n private static instance: ToastHelper;\n private container: HTMLDivElement;\n\n private constructor() {\n this.container = document.createElement('div');\n this.container.id = 'isometrik-toast-root';\n Object.assign(this.container.style, {\n position: 'fixed',\n zIndex: '100000',\n display: 'flex',\n flexDirection: 'column',\n gap: '8px',\n pointerEvents: 'none',\n maxWidth: 'min(22rem, calc(100vw - 2rem))',\n } as CSSStyleDeclaration);\n document.body.appendChild(this.container);\n }\n\n public static getInstance(): ToastHelper {\n if (!ToastHelper.instance) ToastHelper.instance = new ToastHelper();\n return ToastHelper.instance;\n }\n\n /**\n * Solid fallbacks — host themes often leave --danger / --bg-primary unset\n * or map --bg-primary to a light surface (white-on-white toast).\n */\n private getTypeStyles(type: string = 'info') {\n const styles: Record<\n string,\n { bgColor: string; color: string; progressBarColor: string; borderColor: string }\n > = {\n success: {\n bgColor: 'var(--success, #15803d)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n error: {\n bgColor: 'var(--danger, #b91c1c)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n warning: {\n bgColor: 'var(--text-warning-color, #c2410c)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n info: {\n bgColor: 'var(--hoa-chat-ink, #18181b)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n };\n return styles[type] || styles.info;\n }\n\n private setPosition(position: string = 'top-right') {\n // Clear previous transform so center variants don't stick.\n this.container.style.transform = '';\n const positions: Record<string, Partial<CSSStyleDeclaration>> = {\n 'top-right': { top: '1rem', right: '1rem', bottom: 'auto', left: 'auto' },\n 'top-left': { top: '1rem', right: 'auto', bottom: 'auto', left: '1rem' },\n // Sit above typical chat composer (~5.5rem).\n 'bottom-right': { top: 'auto', right: '1rem', bottom: '5.5rem', left: 'auto' },\n 'bottom-left': { top: 'auto', right: 'auto', bottom: '5.5rem', left: '1rem' },\n 'top-center': {\n top: '1rem',\n right: 'auto',\n bottom: 'auto',\n left: '50%',\n transform: 'translateX(-50%)',\n },\n 'bottom-center': {\n top: 'auto',\n right: 'auto',\n bottom: '5.5rem',\n left: '50%',\n transform: 'translateX(-50%)',\n },\n };\n Object.assign(this.container.style, positions[position] || positions['top-right']);\n }\n\n public show(options: ToastOptions): void {\n const { duration = 3500, type = 'info', position = 'top-right' } = options;\n const message = friendlyToastMessage(options.message);\n this.setPosition(position);\n const toast = document.createElement('toast-notification') as any;\n const styles = this.getTypeStyles(type);\n toast.bgColor = styles.bgColor;\n toast.color = styles.color;\n toast.progressBarColor = styles.progressBarColor;\n toast.progressBarBg = 'transparent';\n toast.borderColor = styles.borderColor;\n toast.borderWidth = '0';\n toast.toastMessage = message;\n toast.padding = '12px 14px';\n toast.borderRadius = '0.5rem';\n toast.width = '100%';\n toast.fontWeight = '600';\n toast.style.pointerEvents = 'auto';\n toast.style.display = 'block';\n toast.style.boxShadow = '0 8px 24px rgba(24, 24, 27, 0.18)';\n this.container.appendChild(toast);\n setTimeout(() => toast.remove(), duration);\n }\n}\n\nexport const showToast = (options: ToastOptions): void => {\n const custom = createCustomPartElement('toast', {\n ...options,\n message: friendlyToastMessage(options.message),\n } as any);\n if (custom) {\n document.body.appendChild(custom);\n setTimeout(() => custom.remove(), options.duration ?? 3500);\n return;\n }\n ToastHelper.getInstance().show(options);\n};\n"]}
|