isometrik-plugin-chat-sdk 1.0.8 → 1.3.13
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/LICENSE +21 -0
- package/dist/cjs/attachment-preview_22.cjs.entry.js +10 -9
- package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
- package/dist/cjs/audio-bubble_4.cjs.entry.js +1 -1
- package/dist/cjs/chat-assets-e32e80c0.js +73 -0
- package/dist/cjs/chat-assets-e32e80c0.js.map +1 -0
- package/dist/cjs/chat-tile_3.cjs.entry.js +1 -1
- package/dist/cjs/forward-memebers.cjs.entry.js +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 +23 -13
- package/dist/cjs/login-page_3.cjs.entry.js.map +1 -1
- package/dist/cjs/member-add.cjs.entry.js +1 -1
- package/dist/cjs/new-chat-sidebar.cjs.entry.js +1 -1
- package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js +6 -7
- package/dist/collection/components/ChatUIComponent/ChatSidebar/ChatSidebar.js.map +1 -1
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js +12 -12
- package/dist/collection/components/ChatUIComponent/WebChatBody/WebChatBody.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/WebChat.js +39 -6
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
- package/dist/collection/components/my-component/web-chat/shell-render.js +4 -2
- package/dist/collection/components/my-component/web-chat/shell-render.js.map +1 -1
- package/dist/collection/components/theme-provider.js +9 -9
- package/dist/collection/components/theme-provider.js.map +1 -1
- package/dist/collection/constants/chat-assets.js +39 -123
- package/dist/components/ChatSidebar.js +2 -2
- package/dist/components/ChatSidebar.js.map +1 -1
- package/dist/components/WebChat.js +15 -4
- package/dist/components/WebChat.js.map +1 -1
- package/dist/components/WebChatBody.js +9 -8
- package/dist/components/WebChatBody.js.map +1 -1
- package/dist/components/chat-assets.js +34 -82
- package/dist/components/chat-assets.js.map +1 -1
- package/dist/components/theme-provider2.js +9 -9
- package/dist/components/theme-provider2.js.map +1 -1
- package/dist/esm/attachment-preview_22.entry.js +10 -9
- package/dist/esm/attachment-preview_22.entry.js.map +1 -1
- package/dist/esm/audio-bubble_4.entry.js +1 -1
- package/dist/esm/chat-assets-4dfb1106.js +38 -0
- package/dist/esm/chat-assets-4dfb1106.js.map +1 -0
- package/dist/esm/chat-tile_3.entry.js +1 -1
- package/dist/esm/forward-memebers.entry.js +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 +23 -13
- package/dist/esm/login-page_3.entry.js.map +1 -1
- package/dist/esm/member-add.entry.js +1 -1
- package/dist/esm/new-chat-sidebar.entry.js +1 -1
- package/dist/isometrik-webchat/isometrik-webchat.css +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-188b2631.entry.js → p-0085b397.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-ab5e1e85.entry.js → p-1ad1127f.entry.js} +2 -2
- package/dist/isometrik-webchat/p-6d9f8cec.entry.js +2 -0
- package/dist/isometrik-webchat/p-6d9f8cec.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-b44f0bd1.entry.js → p-6ec350aa.entry.js} +2 -2
- package/dist/isometrik-webchat/p-6ffeb379.entry.js +2 -0
- package/dist/isometrik-webchat/p-6ffeb379.entry.js.map +1 -0
- package/dist/isometrik-webchat/{p-e589ff24.entry.js → p-71cc96a3.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-ff8f6bd2.entry.js → p-b8cef5e4.entry.js} +2 -2
- package/dist/isometrik-webchat/p-d424871c.js +2 -0
- package/dist/isometrik-webchat/p-d424871c.js.map +1 -0
- package/dist/types/components/ChatUIComponent/ChatSidebar/ChatSidebar.d.ts +2 -1
- package/dist/types/components/ChatUIComponent/WebChatBody/WebChatBody.d.ts +2 -2
- package/dist/types/components/theme-provider.d.ts +3 -2
- package/dist/types/components.d.ts +26 -8
- package/package.json +53 -10
- package/readme.md +428 -0
- package/dist/cjs/chat-assets-ff067e4d.js +0 -121
- package/dist/cjs/chat-assets-ff067e4d.js.map +0 -1
- package/dist/collection/assets/ExcelDocument.js +0 -2
- package/dist/collection/assets/IsometrikLogo.js +0 -38
- package/dist/collection/assets/Moon.svg +0 -1
- package/dist/collection/assets/New-Chat.svg +0 -5
- package/dist/collection/assets/NoChatPlaceholder.js +0 -16
- package/dist/collection/assets/NoContactsPlaceholder.js +0 -9
- package/dist/collection/assets/NoMessagePlaceholder.svg +0 -13
- package/dist/collection/assets/PdfDocument.js +0 -2
- package/dist/collection/assets/ProfilePlaceholder.js +0 -1
- package/dist/collection/assets/SelectChatPlaceholder.js +0 -13
- package/dist/collection/assets/Sun.svg +0 -1
- package/dist/collection/assets/add-user.svg +0 -6
- package/dist/collection/assets/attachment.svg +0 -4
- package/dist/collection/assets/avatar.svg +0 -1
- package/dist/collection/assets/block-user.svg +0 -4
- package/dist/collection/assets/camera-add.svg +0 -4
- package/dist/collection/assets/camera.svg +0 -17
- package/dist/collection/assets/cancel.svg +0 -12
- package/dist/collection/assets/chatBG.png +0 -0
- package/dist/collection/assets/chatdefaultbg.svg +0 -6140
- package/dist/collection/assets/clear-chat.svg +0 -4
- package/dist/collection/assets/close.svg +0 -4
- package/dist/collection/assets/dark-theme.svg +0 -12
- package/dist/collection/assets/delete.svg +0 -8
- package/dist/collection/assets/doc.png +0 -0
- package/dist/collection/assets/documents.svg +0 -15
- package/dist/collection/assets/doublecheck.svg +0 -1
- package/dist/collection/assets/download.svg +0 -4
- package/dist/collection/assets/drop-down.svg +0 -5
- package/dist/collection/assets/edit.svg +0 -4
- package/dist/collection/assets/equalizer.svg +0 -1
- package/dist/collection/assets/excel.svg +0 -2
- package/dist/collection/assets/forward.svg +0 -4
- package/dist/collection/assets/group-cast.svg +0 -1
- package/dist/collection/assets/group.svg +0 -13
- package/dist/collection/assets/imagePlaceholder.png +0 -0
- package/dist/collection/assets/imagePlaceholder.svg +0 -2
- package/dist/collection/assets/info.svg +0 -4
- package/dist/collection/assets/left-arrow.svg +0 -4
- package/dist/collection/assets/link.svg +0 -1
- package/dist/collection/assets/login.svg +0 -3051
- package/dist/collection/assets/logout.svg +0 -5
- package/dist/collection/assets/message-outline.svg +0 -5
- package/dist/collection/assets/message.svg +0 -1
- package/dist/collection/assets/microphone.svg +0 -2
- package/dist/collection/assets/new_group.svg +0 -9
- package/dist/collection/assets/odt-file.png +0 -0
- package/dist/collection/assets/onboarding.webp +0 -0
- package/dist/collection/assets/paper.svg +0 -5
- package/dist/collection/assets/pause.svg +0 -4
- package/dist/collection/assets/pdf.svg +0 -11
- package/dist/collection/assets/photos.svg +0 -4
- package/dist/collection/assets/play.svg +0 -19
- package/dist/collection/assets/profilePlaceholderImage.png +0 -0
- package/dist/collection/assets/reply.svg +0 -4
- package/dist/collection/assets/rtf.png +0 -0
- package/dist/collection/assets/search.svg +0 -4
- package/dist/collection/assets/send.svg +0 -4
- package/dist/collection/assets/singlecheck.svg +0 -1
- package/dist/collection/assets/smile.svg +0 -2
- package/dist/collection/assets/three-dots.svg +0 -5
- package/dist/collection/assets/txt.png +0 -0
- package/dist/collection/assets/videoPlaceholder.svg +0 -4
- package/dist/collection/assets/videoThumbnail.svg +0 -1
- package/dist/collection/components/ChatUIComponent/AudioBubble.js +0 -315
- package/dist/collection/components/ChatUIComponent/BlockChatList.js +0 -177
- package/dist/collection/components/ChatUIComponent/ForwardMessageList.js +0 -152
- package/dist/collection/components/ChatUIComponent/GroupCast.js +0 -461
- package/dist/collection/components/ChatUIComponent/shared/attachment-preview.js +0 -230
- package/dist/collection/components/ChatUIComponent/shared/chat-loading-placeholder.js +0 -70
- package/dist/collection/components/ChatUIComponent/shared/confirm-dialog.js +0 -51
- package/dist/collection/components/ChatUIComponent/shared/contact-info.js +0 -255
- package/dist/collection/components/ChatUIComponent/shared/context-menu.js +0 -112
- package/dist/collection/components/ChatUIComponent/shared/delete-message.js +0 -49
- package/dist/collection/components/ChatUIComponent/shared/document-message.js +0 -161
- package/dist/collection/components/ChatUIComponent/shared/forward-message.js +0 -139
- package/dist/collection/components/ChatUIComponent/shared/group-chat-contacts.js +0 -201
- package/dist/collection/components/ChatUIComponent/shared/group-info.js +0 -170
- package/dist/collection/components/ChatUIComponent/shared/image-message.js +0 -156
- package/dist/collection/components/ChatUIComponent/shared/incoming-text-message-bubble.js +0 -98
- package/dist/collection/components/ChatUIComponent/shared/link-preview.js +0 -125
- package/dist/collection/components/ChatUIComponent/shared/media-gallery.js +0 -152
- package/dist/collection/components/ChatUIComponent/shared/message-body-render.js +0 -19
- package/dist/collection/components/ChatUIComponent/shared/message-bubble.js +0 -189
- package/dist/collection/components/ChatUIComponent/shared/message-date-pill.js +0 -86
- package/dist/collection/components/ChatUIComponent/shared/message-info.js +0 -188
- package/dist/collection/components/ChatUIComponent/shared/message-search.js +0 -125
- package/dist/collection/components/ChatUIComponent/shared/new-chat-sidebar.js +0 -181
- package/dist/collection/components/ChatUIComponent/shared/outgoing-text-message-bubble.js +0 -98
- package/dist/collection/components/ChatUIComponent/shared/profile-avatar.js +0 -136
- package/dist/collection/components/ChatUIComponent/shared/profile-info.js +0 -220
- package/dist/collection/components/ChatUIComponent/shared/reply-block.js +0 -162
- package/dist/collection/components/ChatUIComponent/shared/reply-message-container.js +0 -193
- package/dist/collection/components/ChatUIComponent/shared/share-popup.js +0 -69
- package/dist/collection/components/ChatUIComponent/shared/spinner-loader.js +0 -74
- package/dist/collection/components/ChatUIComponent/shared/toast-notification.js +0 -106
- package/dist/collection/components/ChatUIComponent/shared/video-message.js +0 -165
- package/dist/collection/components/my-component/my-component.e2e.js +0 -25
- package/dist/collection/components/my-component/my-component.spec.js +0 -34
- package/dist/collection/components/my-component/web-chat/web-chat-split.spec.js +0 -40
- package/dist/collection/lib/chat/chat.spec.js +0 -28
- package/dist/collection/lib/custom-ui/custom-ui.spec.js +0 -49
- package/dist/collection/lib/message-body-segments.spec.js +0 -21
- package/dist/collection/lib/message-dedup.spec.js +0 -17
- package/dist/collection/lib/mqtt/mqtt.spec.js +0 -39
- package/dist/collection/utils/utils.spec.js +0 -15
- package/dist/esm/chat-assets-95633770.js +0 -86
- package/dist/esm/chat-assets-95633770.js.map +0 -1
- package/dist/isometrik-webchat/assets/ExcelDocument.js +0 -2
- package/dist/isometrik-webchat/assets/IsometrikLogo.js +0 -38
- package/dist/isometrik-webchat/assets/Moon.svg +0 -1
- package/dist/isometrik-webchat/assets/New-Chat.svg +0 -5
- package/dist/isometrik-webchat/assets/NoChatPlaceholder.js +0 -16
- package/dist/isometrik-webchat/assets/NoContactsPlaceholder.js +0 -9
- package/dist/isometrik-webchat/assets/NoMessagePlaceholder.svg +0 -13
- package/dist/isometrik-webchat/assets/PdfDocument.js +0 -2
- package/dist/isometrik-webchat/assets/ProfilePlaceholder.js +0 -1
- package/dist/isometrik-webchat/assets/SelectChatPlaceholder.js +0 -13
- package/dist/isometrik-webchat/assets/Sun.svg +0 -1
- package/dist/isometrik-webchat/assets/add-user.svg +0 -6
- package/dist/isometrik-webchat/assets/attachment.svg +0 -4
- package/dist/isometrik-webchat/assets/avatar.svg +0 -1
- package/dist/isometrik-webchat/assets/block-user.svg +0 -4
- package/dist/isometrik-webchat/assets/camera-add.svg +0 -4
- package/dist/isometrik-webchat/assets/camera.svg +0 -17
- package/dist/isometrik-webchat/assets/cancel.svg +0 -12
- package/dist/isometrik-webchat/assets/chatBG.png +0 -0
- package/dist/isometrik-webchat/assets/chatdefaultbg.svg +0 -6140
- package/dist/isometrik-webchat/assets/clear-chat.svg +0 -4
- package/dist/isometrik-webchat/assets/close.svg +0 -4
- package/dist/isometrik-webchat/assets/dark-theme.svg +0 -12
- package/dist/isometrik-webchat/assets/delete.svg +0 -8
- package/dist/isometrik-webchat/assets/doc.png +0 -0
- package/dist/isometrik-webchat/assets/documents.svg +0 -15
- package/dist/isometrik-webchat/assets/doublecheck.svg +0 -1
- package/dist/isometrik-webchat/assets/download.svg +0 -4
- package/dist/isometrik-webchat/assets/drop-down.svg +0 -5
- package/dist/isometrik-webchat/assets/edit.svg +0 -4
- package/dist/isometrik-webchat/assets/equalizer.svg +0 -1
- package/dist/isometrik-webchat/assets/excel.svg +0 -2
- package/dist/isometrik-webchat/assets/forward.svg +0 -4
- package/dist/isometrik-webchat/assets/group-cast.svg +0 -1
- package/dist/isometrik-webchat/assets/group.svg +0 -13
- package/dist/isometrik-webchat/assets/imagePlaceholder.png +0 -0
- package/dist/isometrik-webchat/assets/imagePlaceholder.svg +0 -2
- package/dist/isometrik-webchat/assets/info.svg +0 -4
- package/dist/isometrik-webchat/assets/left-arrow.svg +0 -4
- package/dist/isometrik-webchat/assets/link.svg +0 -1
- package/dist/isometrik-webchat/assets/login.svg +0 -3051
- package/dist/isometrik-webchat/assets/logout.svg +0 -5
- package/dist/isometrik-webchat/assets/message-outline.svg +0 -5
- package/dist/isometrik-webchat/assets/message.svg +0 -1
- package/dist/isometrik-webchat/assets/microphone.svg +0 -2
- package/dist/isometrik-webchat/assets/new_group.svg +0 -9
- package/dist/isometrik-webchat/assets/odt-file.png +0 -0
- package/dist/isometrik-webchat/assets/onboarding.webp +0 -0
- package/dist/isometrik-webchat/assets/paper.svg +0 -5
- package/dist/isometrik-webchat/assets/pause.svg +0 -4
- package/dist/isometrik-webchat/assets/pdf.svg +0 -11
- package/dist/isometrik-webchat/assets/photos.svg +0 -4
- package/dist/isometrik-webchat/assets/play.svg +0 -19
- package/dist/isometrik-webchat/assets/profilePlaceholderImage.png +0 -0
- package/dist/isometrik-webchat/assets/reply.svg +0 -4
- package/dist/isometrik-webchat/assets/rtf.png +0 -0
- package/dist/isometrik-webchat/assets/search.svg +0 -4
- package/dist/isometrik-webchat/assets/send.svg +0 -4
- package/dist/isometrik-webchat/assets/singlecheck.svg +0 -1
- package/dist/isometrik-webchat/assets/smile.svg +0 -2
- package/dist/isometrik-webchat/assets/three-dots.svg +0 -5
- package/dist/isometrik-webchat/assets/txt.png +0 -0
- package/dist/isometrik-webchat/assets/videoPlaceholder.svg +0 -4
- package/dist/isometrik-webchat/assets/videoThumbnail.svg +0 -1
- package/dist/isometrik-webchat/p-4bad6da9.entry.js +0 -2
- package/dist/isometrik-webchat/p-4bad6da9.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-8c73a5d5.entry.js +0 -2
- package/dist/isometrik-webchat/p-8c73a5d5.entry.js.map +0 -1
- package/dist/isometrik-webchat/p-d6f0838c.js +0 -2
- package/dist/isometrik-webchat/p-d6f0838c.js.map +0 -1
- /package/dist/isometrik-webchat/{p-188b2631.entry.js.map → p-0085b397.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-ab5e1e85.entry.js.map → p-1ad1127f.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-b44f0bd1.entry.js.map → p-6ec350aa.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-e589ff24.entry.js.map → p-71cc96a3.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-ff8f6bd2.entry.js.map → p-b8cef5e4.entry.js.map} +0 -0
|
@@ -1,461 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Component, h, Prop, State, Event, Element, Listen } from '@stencil/core';
|
|
8
|
-
import ChatSDK from 'test-iso-chat-sdk';
|
|
9
|
-
import './shared/chat-tile/chat-tile';
|
|
10
|
-
import './shared/spinner-loader';
|
|
11
|
-
import './shared/context-menu';
|
|
12
|
-
import './shared/searchable list/searchable-list';
|
|
13
|
-
import './shared/group-info';
|
|
14
|
-
import { formatUnixTimestamp } from '../../utils/unixTimeConverter';
|
|
15
|
-
import { drawerDialogService } from '../../lib/drawer';
|
|
16
|
-
import { getCustomPartTag } from '../../lib/custom-ui';
|
|
17
|
-
import { postGroupCast } from '../../api/groupcast.js';
|
|
18
|
-
import { GROUP_PROFILE_PLACEHOLDER_IMAGE } from '../../constants/urls';
|
|
19
|
-
import { New_Chat } from '../../constants/chat-assets';
|
|
20
|
-
import { showToast } from '../../lib/toast';
|
|
21
|
-
let GroupCast = class GroupCast {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.groupCastData = [];
|
|
24
|
-
this.userMetaData = {};
|
|
25
|
-
this.selectedGroupcastId = null;
|
|
26
|
-
this.contextMenuX = 0;
|
|
27
|
-
this.contextMenuY = 0;
|
|
28
|
-
this.isContextMenuOpen = false;
|
|
29
|
-
this.showMemberPicker = false;
|
|
30
|
-
this.showGroupInfo = false;
|
|
31
|
-
this.pendingMembers = [];
|
|
32
|
-
this.nonBlockedContacts = [];
|
|
33
|
-
this.skip = 0;
|
|
34
|
-
this.hasMoreMembers = false;
|
|
35
|
-
this.isLoadingMember = false;
|
|
36
|
-
this.isPaginationMember = false;
|
|
37
|
-
this.isCreating = false;
|
|
38
|
-
this.handleScroll = (event) => {
|
|
39
|
-
const target = event.target;
|
|
40
|
-
const isBottom = target.scrollHeight - target.scrollTop <= target.clientHeight + 100;
|
|
41
|
-
if (isBottom)
|
|
42
|
-
this.groupcastScrolledToBottom.emit();
|
|
43
|
-
};
|
|
44
|
-
this.handleMenuItemSelected = (e) => {
|
|
45
|
-
var _a;
|
|
46
|
-
const { action } = e.detail;
|
|
47
|
-
switch (action) {
|
|
48
|
-
case 'delete': {
|
|
49
|
-
const groupcastId = (_a = this.selectedTileForMenu) === null || _a === void 0 ? void 0 : _a.groupcastId;
|
|
50
|
-
drawerDialogService.openDialog('confirm-dialog', {
|
|
51
|
-
title: 'Delete Groupcast',
|
|
52
|
-
description: "Are you sure you want to delete this groupcast? This action can't be undone",
|
|
53
|
-
handleConfirm: () => {
|
|
54
|
-
const customEvent = new CustomEvent('delete-groupcast', {
|
|
55
|
-
detail: { groupcastId },
|
|
56
|
-
bubbles: true,
|
|
57
|
-
composed: true,
|
|
58
|
-
});
|
|
59
|
-
this.element.dispatchEvent(customEvent);
|
|
60
|
-
drawerDialogService.closeDialog('confirm-dialog');
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
this.handleMenuClosed();
|
|
67
|
-
};
|
|
68
|
-
this.handleMenuClosed = () => {
|
|
69
|
-
this.isContextMenuOpen = false;
|
|
70
|
-
this.selectedTileForMenu = null;
|
|
71
|
-
};
|
|
72
|
-
this.openCreate = () => {
|
|
73
|
-
this.showMemberPicker = true;
|
|
74
|
-
this.showGroupInfo = false;
|
|
75
|
-
this.pendingMembers = [];
|
|
76
|
-
this.getMembers('', 0);
|
|
77
|
-
};
|
|
78
|
-
this.closeCreate = () => {
|
|
79
|
-
this.showMemberPicker = false;
|
|
80
|
-
this.showGroupInfo = false;
|
|
81
|
-
this.pendingMembers = [];
|
|
82
|
-
this.nonBlockedContacts = [];
|
|
83
|
-
};
|
|
84
|
-
this.getMembers = async (searchTag = '', skip = 0) => {
|
|
85
|
-
var _a;
|
|
86
|
-
if (skip === 0) {
|
|
87
|
-
this.isLoadingMember = true;
|
|
88
|
-
this.nonBlockedContacts = [];
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
this.isPaginationMember = true;
|
|
92
|
-
}
|
|
93
|
-
this.hasMoreMembers = true;
|
|
94
|
-
try {
|
|
95
|
-
this.skip = skip;
|
|
96
|
-
const params = { sort: 1, limit: 20, skip, context: 'group_chat' };
|
|
97
|
-
if (searchTag === null || searchTag === void 0 ? void 0 : searchTag.trim())
|
|
98
|
-
params.searchTag = searchTag;
|
|
99
|
-
const res = await ChatSDK.getInstance().user.getUserNonblock(params);
|
|
100
|
-
if ((_a = res === null || res === void 0 ? void 0 : res.users) === null || _a === void 0 ? void 0 : _a.length) {
|
|
101
|
-
this.nonBlockedContacts = skip === 0 ? [...res.users] : [...this.nonBlockedContacts, ...res.users];
|
|
102
|
-
if (res.users.length < 20)
|
|
103
|
-
this.hasMoreMembers = false;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.hasMoreMembers = false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
console.error(error);
|
|
111
|
-
this.hasMoreMembers = false;
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
this.isLoadingMember = false;
|
|
115
|
-
this.isPaginationMember = false;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
this.onMembersNext = (selectedIds, selectedNames) => {
|
|
119
|
-
if (!(selectedIds === null || selectedIds === void 0 ? void 0 : selectedIds.length))
|
|
120
|
-
return;
|
|
121
|
-
this.pendingMembers = selectedIds.map((id, i) => ({
|
|
122
|
-
userId: id,
|
|
123
|
-
userName: (selectedNames === null || selectedNames === void 0 ? void 0 : selectedNames[i]) || id,
|
|
124
|
-
}));
|
|
125
|
-
this.showMemberPicker = false;
|
|
126
|
-
this.showGroupInfo = true;
|
|
127
|
-
};
|
|
128
|
-
this.backToMembers = () => {
|
|
129
|
-
this.showGroupInfo = false;
|
|
130
|
-
this.showMemberPicker = true;
|
|
131
|
-
};
|
|
132
|
-
this.getPresignedUrl = async (file) => {
|
|
133
|
-
var _a;
|
|
134
|
-
const mediaExtension = file.name.split('.').pop();
|
|
135
|
-
const res = await ChatSDK.getInstance().user.getPresignedurlCreate({
|
|
136
|
-
userIdentifier: (_a = this.userMetaData) === null || _a === void 0 ? void 0 : _a.userIdentifier,
|
|
137
|
-
mediaExtension,
|
|
138
|
-
});
|
|
139
|
-
await fetch(res.presignedUrl, {
|
|
140
|
-
method: 'PUT',
|
|
141
|
-
body: file,
|
|
142
|
-
headers: { 'Content-Type': file.type },
|
|
143
|
-
});
|
|
144
|
-
return res.mediaUrl;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
async componentDidLoad() {
|
|
148
|
-
document.addEventListener('menu-item-selected', this.handleMenuItemSelected);
|
|
149
|
-
}
|
|
150
|
-
disconnectedCallback() {
|
|
151
|
-
document.removeEventListener('menu-item-selected', this.handleMenuItemSelected);
|
|
152
|
-
}
|
|
153
|
-
getGroupcastIdFromURL() {
|
|
154
|
-
return new URLSearchParams(window.location.search).get('groupcast');
|
|
155
|
-
}
|
|
156
|
-
isTileSelected(tileGroupcastId) {
|
|
157
|
-
return tileGroupcastId === this.getGroupcastIdFromURL();
|
|
158
|
-
}
|
|
159
|
-
handleGroupcastTileSelected(groupcast) {
|
|
160
|
-
const selectedGroupcastId = groupcast.groupcastId;
|
|
161
|
-
this.selectedGroupcastId = selectedGroupcastId;
|
|
162
|
-
const url = new URL(window.location.href);
|
|
163
|
-
url.search = '';
|
|
164
|
-
url.searchParams.set('groupcast', selectedGroupcastId);
|
|
165
|
-
window.history.pushState({}, '', url);
|
|
166
|
-
this.groupcastTileSelected.emit({ groupcastId: selectedGroupcastId });
|
|
167
|
-
}
|
|
168
|
-
handleRightClick(e, tile) {
|
|
169
|
-
e.preventDefault();
|
|
170
|
-
this.contextMenuX = e.clientX;
|
|
171
|
-
this.contextMenuY = e.clientY;
|
|
172
|
-
this.isContextMenuOpen = true;
|
|
173
|
-
this.selectedTileForMenu = tile;
|
|
174
|
-
}
|
|
175
|
-
async handleCreateSubmitted(event) {
|
|
176
|
-
var _a;
|
|
177
|
-
const { conversationTitle, imageFile, selectedUserIds, selectedUsers } = event.detail || {};
|
|
178
|
-
try {
|
|
179
|
-
this.isCreating = true;
|
|
180
|
-
let groupcastImageUrl = GROUP_PROFILE_PLACEHOLDER_IMAGE;
|
|
181
|
-
if (imageFile)
|
|
182
|
-
groupcastImageUrl = await this.getPresignedUrl(imageFile);
|
|
183
|
-
const members = (selectedUserIds || []).map((id) => {
|
|
184
|
-
const user = selectedUsers === null || selectedUsers === void 0 ? void 0 : selectedUsers.find((u) => (u === null || u === void 0 ? void 0 : u.userId) === id);
|
|
185
|
-
return {
|
|
186
|
-
newConversationTypingEvents: true,
|
|
187
|
-
newConversationReadEvents: true,
|
|
188
|
-
newConversationPushNotificationsEvents: true,
|
|
189
|
-
newConversationMetadata: {},
|
|
190
|
-
memberId: id,
|
|
191
|
-
newConversationCustomType: 'Groupcast',
|
|
192
|
-
userName: (user === null || user === void 0 ? void 0 : user.userName) || id,
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
|
-
const res = await postGroupCast({
|
|
196
|
-
groupcastTitle: conversationTitle,
|
|
197
|
-
groupcastImageUrl,
|
|
198
|
-
searchableTags: [conversationTitle],
|
|
199
|
-
metaData: { description: 'groupcast created', members: selectedUsers },
|
|
200
|
-
customType: 'groupcast',
|
|
201
|
-
members,
|
|
202
|
-
});
|
|
203
|
-
this.closeCreate();
|
|
204
|
-
const groupcastId = res.groupcastId;
|
|
205
|
-
const created = {
|
|
206
|
-
groupcastId,
|
|
207
|
-
groupcastTitle: conversationTitle,
|
|
208
|
-
groupcastImageUrl,
|
|
209
|
-
membersCount: members.length,
|
|
210
|
-
createdAt: Date.now(),
|
|
211
|
-
metaData: { description: 'groupcast created' },
|
|
212
|
-
};
|
|
213
|
-
(_a = this.onCreated) === null || _a === void 0 ? void 0 : _a.call(this, created);
|
|
214
|
-
const url = new URL(window.location.href);
|
|
215
|
-
url.search = '';
|
|
216
|
-
url.searchParams.set('groupcast', groupcastId);
|
|
217
|
-
window.history.pushState({}, '', url);
|
|
218
|
-
this.groupcastTileSelected.emit({ groupcastId });
|
|
219
|
-
showToast({ message: 'Group Cast created successfully', type: 'success', position: 'bottom-right' });
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
console.error(error);
|
|
223
|
-
showToast({ message: 'Failed to create group cast', type: 'error', position: 'bottom-right' });
|
|
224
|
-
}
|
|
225
|
-
finally {
|
|
226
|
-
this.isCreating = false;
|
|
227
|
-
this.closeCreate();
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
renderList() {
|
|
231
|
-
if (!this.groupCastData) {
|
|
232
|
-
return h("div", { class: "empty" }, "Unable to load groupcast chats");
|
|
233
|
-
}
|
|
234
|
-
if (!this.groupCastData.length) {
|
|
235
|
-
return h("div", { class: "empty" }, "No groupcast chats available");
|
|
236
|
-
}
|
|
237
|
-
return this.groupCastData.map((groupcast, index) => {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
const formattedMessageDate = formatUnixTimestamp(groupcast === null || groupcast === void 0 ? void 0 : groupcast.createdAt);
|
|
240
|
-
const isSelected = this.isTileSelected(groupcast === null || groupcast === void 0 ? void 0 : groupcast.groupcastId);
|
|
241
|
-
const customTileTag = getCustomPartTag('groupcastTile', this.element) || getCustomPartTag('chatTile', this.element);
|
|
242
|
-
if (customTileTag) {
|
|
243
|
-
return h(customTileTag, {
|
|
244
|
-
key: index,
|
|
245
|
-
groupcast,
|
|
246
|
-
conversation: groupcast,
|
|
247
|
-
isSelected,
|
|
248
|
-
userMetaData: null,
|
|
249
|
-
unreadCount: 0,
|
|
250
|
-
previewText: ((_a = groupcast === null || groupcast === void 0 ? void 0 : groupcast.metaData) === null || _a === void 0 ? void 0 : _a.description) || '',
|
|
251
|
-
onSelect: () => this.handleGroupcastTileSelected(groupcast),
|
|
252
|
-
onClick: () => this.handleGroupcastTileSelected(groupcast),
|
|
253
|
-
onContextmenu: e => this.handleRightClick(e, groupcast),
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return (h("chat-tile", { key: index, isSelected: isSelected, isGroup: true, sidebarSelectedColor: 'var(--bg-primary-light)', onClick: () => this.handleGroupcastTileSelected(groupcast), onContextmenu: e => this.handleRightClick(e, groupcast), imageSrc: groupcast === null || groupcast === void 0 ? void 0 : groupcast.groupcastImageUrl, imageAlt: "", imageHeight: "50px", imageWidth: "50px", imageRadius: "50%", username: (groupcast === null || groupcast === void 0 ? void 0 : groupcast.groupcastTitle) || `RECIPIENTS: ${groupcast === null || groupcast === void 0 ? void 0 : groupcast.membersCount}`, userNameFontWeight: "600", userNameColor: "var(--text-primary-color)", usernameFontSize: "16px", chatPreview: (_b = groupcast === null || groupcast === void 0 ? void 0 : groupcast.metaData) === null || _b === void 0 ? void 0 : _b.description, chatPreviewFontSize: "14px", messageDate: formattedMessageDate, padding: "10px", usernamePadding: "1px", height: "fit-content", width: "100%", messageDateColor: "var(--text-last-seen) ", messageDateFontWeight: "normal", messageDateFontSize: "12px", messageDateFontStyle: "italic", borderWidth: "0 0 0.5px 0", borderColor: "var(--bg-secondary-color)", borderStyle: "solid" }));
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
render() {
|
|
260
|
-
if (this.showGroupInfo) {
|
|
261
|
-
return (h("div", { class: "group-cast-container", style: { position: 'relative' } },
|
|
262
|
-
this.isCreating ? (h("div", { class: "loader" },
|
|
263
|
-
h("spinner-loader", { height: "30px", width: "30px" }))) : null,
|
|
264
|
-
h("div", { class: "create-panel" },
|
|
265
|
-
h("iso-group-info", { label: "Create New Groupcast", selectedUserIds: this.pendingMembers.map(m => m.userId), selectedUsers: this.pendingMembers, isGroupCast: true, closeGroupInfo: this.backToMembers, afterCreate: () => {
|
|
266
|
-
this.showGroupInfo = false;
|
|
267
|
-
this.showMemberPicker = false;
|
|
268
|
-
} }))));
|
|
269
|
-
}
|
|
270
|
-
if (this.showMemberPicker) {
|
|
271
|
-
return (h("div", { class: "group-cast-container" },
|
|
272
|
-
h("div", { class: "create-panel" },
|
|
273
|
-
h("div", { class: "picker-back" },
|
|
274
|
-
h("button", { type: "button", onClick: this.closeCreate, "aria-label": "Back" }, "\u2190")),
|
|
275
|
-
h("searchable-list", { label: "New Group Cast", contactList: this.nonBlockedContacts, isSearching: true, isLoading: this.isLoadingMember, hasMore: this.hasMoreMembers, skip: this.skip, paginationLoading: this.isPaginationMember, getForwardMessageMemberList: (query, skip) => this.getMembers(query || '', skip || 0), onSend: this.onMembersNext, height: "100%" }))));
|
|
276
|
-
}
|
|
277
|
-
return (h("div", { class: "group-cast-container" },
|
|
278
|
-
h("div", { class: "group-cast-header-row" },
|
|
279
|
-
h("h1", { class: "group-cast-header" }, "Groupcast Chats"),
|
|
280
|
-
h("button", { type: "button", class: "icon-btn", title: "New Group Cast", onClick: this.openCreate },
|
|
281
|
-
h("img", { src: New_Chat, alt: "New group cast" }))),
|
|
282
|
-
h("div", { class: "group-cast-body", onScroll: this.handleScroll },
|
|
283
|
-
this.renderList(),
|
|
284
|
-
this.isLoadingMore ? h("div", { class: "empty" }, "Loading more chats...") : null,
|
|
285
|
-
this.isContextMenuOpen ? (h("context-menu", { x: this.contextMenuX, y: this.contextMenuY, isOpen: this.isContextMenuOpen, menuItems: [
|
|
286
|
-
{
|
|
287
|
-
label: 'Delete Groupcast',
|
|
288
|
-
action: 'delete',
|
|
289
|
-
type: 'danger',
|
|
290
|
-
},
|
|
291
|
-
], onMenuItemSelected: e => this.handleMenuItemSelected(e), onMenuClosed: () => this.handleMenuClosed() })) : null)));
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
__decorate([
|
|
295
|
-
Element()
|
|
296
|
-
], GroupCast.prototype, "element", void 0);
|
|
297
|
-
__decorate([
|
|
298
|
-
Prop()
|
|
299
|
-
], GroupCast.prototype, "groupCastData", void 0);
|
|
300
|
-
__decorate([
|
|
301
|
-
Prop()
|
|
302
|
-
], GroupCast.prototype, "isLoadingMore", void 0);
|
|
303
|
-
__decorate([
|
|
304
|
-
Prop()
|
|
305
|
-
], GroupCast.prototype, "userMetaData", void 0);
|
|
306
|
-
__decorate([
|
|
307
|
-
State()
|
|
308
|
-
], GroupCast.prototype, "selectedGroupcastId", void 0);
|
|
309
|
-
__decorate([
|
|
310
|
-
State()
|
|
311
|
-
], GroupCast.prototype, "contextMenuX", void 0);
|
|
312
|
-
__decorate([
|
|
313
|
-
State()
|
|
314
|
-
], GroupCast.prototype, "contextMenuY", void 0);
|
|
315
|
-
__decorate([
|
|
316
|
-
State()
|
|
317
|
-
], GroupCast.prototype, "isContextMenuOpen", void 0);
|
|
318
|
-
__decorate([
|
|
319
|
-
State()
|
|
320
|
-
], GroupCast.prototype, "selectedTileForMenu", void 0);
|
|
321
|
-
__decorate([
|
|
322
|
-
State()
|
|
323
|
-
], GroupCast.prototype, "showMemberPicker", void 0);
|
|
324
|
-
__decorate([
|
|
325
|
-
State()
|
|
326
|
-
], GroupCast.prototype, "showGroupInfo", void 0);
|
|
327
|
-
__decorate([
|
|
328
|
-
State()
|
|
329
|
-
], GroupCast.prototype, "pendingMembers", void 0);
|
|
330
|
-
__decorate([
|
|
331
|
-
State()
|
|
332
|
-
], GroupCast.prototype, "nonBlockedContacts", void 0);
|
|
333
|
-
__decorate([
|
|
334
|
-
State()
|
|
335
|
-
], GroupCast.prototype, "skip", void 0);
|
|
336
|
-
__decorate([
|
|
337
|
-
State()
|
|
338
|
-
], GroupCast.prototype, "hasMoreMembers", void 0);
|
|
339
|
-
__decorate([
|
|
340
|
-
State()
|
|
341
|
-
], GroupCast.prototype, "isLoadingMember", void 0);
|
|
342
|
-
__decorate([
|
|
343
|
-
State()
|
|
344
|
-
], GroupCast.prototype, "isPaginationMember", void 0);
|
|
345
|
-
__decorate([
|
|
346
|
-
State()
|
|
347
|
-
], GroupCast.prototype, "isCreating", void 0);
|
|
348
|
-
__decorate([
|
|
349
|
-
Event()
|
|
350
|
-
], GroupCast.prototype, "groupcastTileSelected", void 0);
|
|
351
|
-
__decorate([
|
|
352
|
-
Event()
|
|
353
|
-
], GroupCast.prototype, "groupcastScrolledToBottom", void 0);
|
|
354
|
-
__decorate([
|
|
355
|
-
Prop()
|
|
356
|
-
], GroupCast.prototype, "onCreated", void 0);
|
|
357
|
-
__decorate([
|
|
358
|
-
Listen('create-group-cast-submitted')
|
|
359
|
-
], GroupCast.prototype, "handleCreateSubmitted", null);
|
|
360
|
-
GroupCast = __decorate([
|
|
361
|
-
Component({
|
|
362
|
-
tag: 'group-cast',
|
|
363
|
-
shadow: false,
|
|
364
|
-
styles: `
|
|
365
|
-
:host {
|
|
366
|
-
display: block;
|
|
367
|
-
height: 100%;
|
|
368
|
-
background: var(--bg-primary, var(--bg-primary-color));
|
|
369
|
-
color: var(--text-primary, var(--text-primary-color));
|
|
370
|
-
}
|
|
371
|
-
.group-cast-container {
|
|
372
|
-
padding: 20px 0 20px 20px;
|
|
373
|
-
height: 96%;
|
|
374
|
-
display: flex;
|
|
375
|
-
flex-direction: column;
|
|
376
|
-
gap: 5px;
|
|
377
|
-
box-sizing: border-box;
|
|
378
|
-
}
|
|
379
|
-
.group-cast-header-row {
|
|
380
|
-
display: flex;
|
|
381
|
-
align-items: center;
|
|
382
|
-
justify-content: space-between;
|
|
383
|
-
padding: 0 20px 0 0;
|
|
384
|
-
}
|
|
385
|
-
.group-cast-header {
|
|
386
|
-
font-size: var(--title-font-size, 24px);
|
|
387
|
-
font-weight: 600;
|
|
388
|
-
margin: 0;
|
|
389
|
-
}
|
|
390
|
-
.icon-btn {
|
|
391
|
-
border: none;
|
|
392
|
-
background: transparent;
|
|
393
|
-
cursor: pointer;
|
|
394
|
-
padding: 0;
|
|
395
|
-
display: flex;
|
|
396
|
-
align-items: center;
|
|
397
|
-
}
|
|
398
|
-
.icon-btn img {
|
|
399
|
-
width: 28px;
|
|
400
|
-
height: 28px;
|
|
401
|
-
}
|
|
402
|
-
.group-cast-body {
|
|
403
|
-
flex: 1;
|
|
404
|
-
min-height: 0;
|
|
405
|
-
overflow: hidden auto;
|
|
406
|
-
padding: 0 15px 0 0;
|
|
407
|
-
}
|
|
408
|
-
.group-cast-body::-webkit-scrollbar { width: 5px; }
|
|
409
|
-
.group-cast-body::-webkit-scrollbar-track { background: transparent; }
|
|
410
|
-
.group-cast-body::-webkit-scrollbar-thumb {
|
|
411
|
-
background-color: var(--bg-secondary, var(--bg-secondary-color)) !important;
|
|
412
|
-
border-radius: 10px;
|
|
413
|
-
}
|
|
414
|
-
chat-tile:hover {
|
|
415
|
-
background-color: var(--bg-secondary, var(--bg-secondary-color)) !important;
|
|
416
|
-
}
|
|
417
|
-
.create-panel {
|
|
418
|
-
display: flex;
|
|
419
|
-
flex-direction: column;
|
|
420
|
-
flex: 1;
|
|
421
|
-
min-height: 0;
|
|
422
|
-
height: 100%;
|
|
423
|
-
padding-right: 20px;
|
|
424
|
-
}
|
|
425
|
-
.create-panel searchable-list,
|
|
426
|
-
.create-panel iso-group-info {
|
|
427
|
-
display: block;
|
|
428
|
-
flex: 1;
|
|
429
|
-
min-height: 0;
|
|
430
|
-
height: 100%;
|
|
431
|
-
}
|
|
432
|
-
.picker-back {
|
|
433
|
-
display: flex;
|
|
434
|
-
align-items: center;
|
|
435
|
-
padding: 0 0 8px;
|
|
436
|
-
}
|
|
437
|
-
.picker-back button {
|
|
438
|
-
border: none;
|
|
439
|
-
background: transparent;
|
|
440
|
-
color: inherit;
|
|
441
|
-
font-size: 18px;
|
|
442
|
-
cursor: pointer;
|
|
443
|
-
}
|
|
444
|
-
.empty {
|
|
445
|
-
text-align: center;
|
|
446
|
-
padding: 20px;
|
|
447
|
-
color: var(--text-tertiary, var(--text-tertiary-color));
|
|
448
|
-
}
|
|
449
|
-
.loader {
|
|
450
|
-
position: absolute;
|
|
451
|
-
inset: 0;
|
|
452
|
-
display: flex;
|
|
453
|
-
align-items: center;
|
|
454
|
-
justify-content: center;
|
|
455
|
-
background: rgba(0,0,0,0.25);
|
|
456
|
-
z-index: 5;
|
|
457
|
-
}
|
|
458
|
-
`,
|
|
459
|
-
})
|
|
460
|
-
], GroupCast);
|
|
461
|
-
export { GroupCast };
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Component, Prop, State, h, Event } from '@stencil/core';
|
|
8
|
-
let AttachmentPreview = class AttachmentPreview {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.content = [];
|
|
11
|
-
this.contentType = [];
|
|
12
|
-
this.selectedIndex = 0;
|
|
13
|
-
this.inputValue = '';
|
|
14
|
-
this.showCamera = false;
|
|
15
|
-
this.localIndex = 0;
|
|
16
|
-
this.onCaption = (e) => {
|
|
17
|
-
const value = e.target.value;
|
|
18
|
-
this.inputValue = value;
|
|
19
|
-
this.inputChange.emit({ value });
|
|
20
|
-
};
|
|
21
|
-
this.onFile = (e) => {
|
|
22
|
-
const files = Array.from(e.target.files || []);
|
|
23
|
-
if (!files.length)
|
|
24
|
-
return;
|
|
25
|
-
const detail = { files, fileTypes: files.map(f => f.type.split('/')[0]), totalFiles: files.length };
|
|
26
|
-
this.fileUploaded.emit(detail);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
componentWillLoad() {
|
|
30
|
-
this.localIndex = this.selectedIndex || 0;
|
|
31
|
-
}
|
|
32
|
-
items() {
|
|
33
|
-
return Array.isArray(this.content) ? this.content : [];
|
|
34
|
-
}
|
|
35
|
-
current() {
|
|
36
|
-
const list = this.items();
|
|
37
|
-
return list[this.localIndex] || list[0];
|
|
38
|
-
}
|
|
39
|
-
srcOf(item) {
|
|
40
|
-
if (!item)
|
|
41
|
-
return '';
|
|
42
|
-
if (typeof item === 'string')
|
|
43
|
-
return item;
|
|
44
|
-
return item.src || item.mediaUrl || '';
|
|
45
|
-
}
|
|
46
|
-
typeOf(item, i) {
|
|
47
|
-
if (item === null || item === void 0 ? void 0 : item.type)
|
|
48
|
-
return item.type;
|
|
49
|
-
const types = this.contentType || [];
|
|
50
|
-
return types[i] || '';
|
|
51
|
-
}
|
|
52
|
-
close() {
|
|
53
|
-
if (typeof this.onClose === 'function')
|
|
54
|
-
this.onClose();
|
|
55
|
-
}
|
|
56
|
-
send() {
|
|
57
|
-
if (typeof this.onSend === 'function')
|
|
58
|
-
this.onSend();
|
|
59
|
-
}
|
|
60
|
-
render() {
|
|
61
|
-
var _a;
|
|
62
|
-
const list = this.items();
|
|
63
|
-
const cur = this.current();
|
|
64
|
-
const type = this.typeOf(cur, this.localIndex);
|
|
65
|
-
return (h("div", { class: "preview-container" },
|
|
66
|
-
h("div", { class: "topbar" },
|
|
67
|
-
h("button", { class: "close-btn", type: "button", onClick: () => this.close() }, "\u2715"),
|
|
68
|
-
h("span", null, this.showCamera ? 'Camera' : `Preview (${list.length || 0})`),
|
|
69
|
-
h("button", { class: "send-btn", type: "button", onClick: () => this.send(), title: "Send" }, "\u27A4")),
|
|
70
|
-
h("div", { class: "main" }, this.showCamera ? (h("div", { class: "camera-placeholder" },
|
|
71
|
-
h("p", null, "Camera capture"),
|
|
72
|
-
h("label", null,
|
|
73
|
-
h("input", { type: "file", accept: "image/*,video/*", capture: "environment", onChange: this.onFile })))) : !cur ? (h("div", null, "No attachment")) : type === 'video' ? (h("video", { src: this.srcOf(cur), controls: true })) : type === 'image' || !type ? (h("img", { src: this.srcOf(cur), alt: "" })) : (h("div", { class: "file-chip" }, ((_a = cur === null || cur === void 0 ? void 0 : cur.file) === null || _a === void 0 ? void 0 : _a.name) || (cur === null || cur === void 0 ? void 0 : cur.name) || type || 'File'))),
|
|
74
|
-
list.length > 1 ? (h("div", { class: "thumbs" }, list.map((item, i) => (h("img", { class: `thumb ${i === this.localIndex ? 'active' : ''}`, src: this.srcOf(item), alt: "", onClick: () => {
|
|
75
|
-
this.localIndex = i;
|
|
76
|
-
this.selectedIndex = i;
|
|
77
|
-
} }))))) : null,
|
|
78
|
-
h("div", { class: "composer", style: { padding: this.inputContainerPadding } },
|
|
79
|
-
h("input", { type: "text", placeholder: this.inputPlaceholder || 'Add a caption…', value: this.inputValue || '', onInput: this.onCaption, style: {
|
|
80
|
-
borderColor: this.inputBorderColor,
|
|
81
|
-
borderWidth: this.inputBorderWidth,
|
|
82
|
-
borderRadius: this.inputBorderRadius || '10px',
|
|
83
|
-
background: this.inputBgColor,
|
|
84
|
-
color: this.inputFontColor,
|
|
85
|
-
fontSize: this.inputFontSize,
|
|
86
|
-
} }))));
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
__decorate([
|
|
90
|
-
Prop()
|
|
91
|
-
], AttachmentPreview.prototype, "content", void 0);
|
|
92
|
-
__decorate([
|
|
93
|
-
Prop()
|
|
94
|
-
], AttachmentPreview.prototype, "contentType", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
Prop({ mutable: true })
|
|
97
|
-
], AttachmentPreview.prototype, "selectedIndex", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
Prop()
|
|
100
|
-
], AttachmentPreview.prototype, "caption", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
Prop()
|
|
103
|
-
], AttachmentPreview.prototype, "onClose", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
Prop()
|
|
106
|
-
], AttachmentPreview.prototype, "onSend", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
Prop({ mutable: true })
|
|
109
|
-
], AttachmentPreview.prototype, "inputValue", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
Prop()
|
|
112
|
-
], AttachmentPreview.prototype, "inputBorderColor", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
Prop()
|
|
115
|
-
], AttachmentPreview.prototype, "inputBorderWidth", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
Prop()
|
|
118
|
-
], AttachmentPreview.prototype, "inputBorderStyle", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
Prop()
|
|
121
|
-
], AttachmentPreview.prototype, "inputPlaceholder", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
Prop()
|
|
124
|
-
], AttachmentPreview.prototype, "inputBgColor", void 0);
|
|
125
|
-
__decorate([
|
|
126
|
-
Prop()
|
|
127
|
-
], AttachmentPreview.prototype, "inputFontSize", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
Prop()
|
|
130
|
-
], AttachmentPreview.prototype, "inputFontColor", void 0);
|
|
131
|
-
__decorate([
|
|
132
|
-
Prop()
|
|
133
|
-
], AttachmentPreview.prototype, "inputBorderRadius", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
Prop()
|
|
136
|
-
], AttachmentPreview.prototype, "inputContainerBorderColor", void 0);
|
|
137
|
-
__decorate([
|
|
138
|
-
Prop()
|
|
139
|
-
], AttachmentPreview.prototype, "inputContainerBorderWidth", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
Prop()
|
|
142
|
-
], AttachmentPreview.prototype, "inputContainerBorderRadius", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
Prop()
|
|
145
|
-
], AttachmentPreview.prototype, "inputPlaceholderColor", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
Prop()
|
|
148
|
-
], AttachmentPreview.prototype, "inputContainerPadding", void 0);
|
|
149
|
-
__decorate([
|
|
150
|
-
Prop()
|
|
151
|
-
], AttachmentPreview.prototype, "showCloseIcon", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
Prop()
|
|
154
|
-
], AttachmentPreview.prototype, "sendButtonIconHeight", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
Prop()
|
|
157
|
-
], AttachmentPreview.prototype, "sendButtonIconWidth", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
Prop()
|
|
160
|
-
], AttachmentPreview.prototype, "conversationDetails", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
Prop()
|
|
163
|
-
], AttachmentPreview.prototype, "showMentionList", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
Prop()
|
|
166
|
-
], AttachmentPreview.prototype, "mentionSearchQuery", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
Prop()
|
|
169
|
-
], AttachmentPreview.prototype, "cursorPosition", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
Prop()
|
|
172
|
-
], AttachmentPreview.prototype, "userMetaData", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
Prop()
|
|
175
|
-
], AttachmentPreview.prototype, "showCamera", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
Prop()
|
|
178
|
-
], AttachmentPreview.prototype, "isOpen", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
State()
|
|
181
|
-
], AttachmentPreview.prototype, "localIndex", void 0);
|
|
182
|
-
__decorate([
|
|
183
|
-
Event({ eventName: 'input-change', bubbles: true, composed: true })
|
|
184
|
-
], AttachmentPreview.prototype, "inputChange", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
Event({ eventName: 'file-uploaded', bubbles: true, composed: true })
|
|
187
|
-
], AttachmentPreview.prototype, "fileUploaded", void 0);
|
|
188
|
-
AttachmentPreview = __decorate([
|
|
189
|
-
Component({
|
|
190
|
-
tag: 'attachment-preview',
|
|
191
|
-
shadow: true,
|
|
192
|
-
styles: `
|
|
193
|
-
:host { display: block; background: var(--bg-primary-color); color: var(--text-primary-color); height: calc(100dvh - 75px); width: 100%; }
|
|
194
|
-
.preview-container { display: flex; flex-direction: column; height: 100%; }
|
|
195
|
-
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px; }
|
|
196
|
-
.close-btn, .send-btn {
|
|
197
|
-
background: none; border: none; cursor: pointer; color: inherit; font-size: 18px;
|
|
198
|
-
}
|
|
199
|
-
.send-btn {
|
|
200
|
-
background: var(--base-color, #4A76FD); color: #fff; border-radius: 50%;
|
|
201
|
-
width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
|
|
202
|
-
}
|
|
203
|
-
.main {
|
|
204
|
-
flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 12px;
|
|
205
|
-
}
|
|
206
|
-
.main img, .main video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
|
|
207
|
-
.file-chip {
|
|
208
|
-
padding: 16px 20px; border-radius: 8px; background: var(--bg-secondary-color); max-width: 80%;
|
|
209
|
-
}
|
|
210
|
-
.thumbs { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; }
|
|
211
|
-
.thumb {
|
|
212
|
-
width: 56px; height: 56px; border-radius: 6px; object-fit: cover; cursor: pointer;
|
|
213
|
-
border: 2px solid transparent; flex-shrink: 0; background: var(--bg-primary-light);
|
|
214
|
-
}
|
|
215
|
-
.thumb.active { border-color: var(--base-color, #4A76FD); }
|
|
216
|
-
.composer {
|
|
217
|
-
display: flex; gap: 8px; align-items: center; padding: 10px 12px;
|
|
218
|
-
border-top: 1px solid var(--bg-secondary-color);
|
|
219
|
-
}
|
|
220
|
-
.composer input {
|
|
221
|
-
flex: 1; border: 1px solid var(--bg-grey-color, #ccc); border-radius: 10px;
|
|
222
|
-
padding: 10px; outline: none; background: var(--bg-secondary-color); color: var(--text-primary-color);
|
|
223
|
-
}
|
|
224
|
-
.camera-placeholder {
|
|
225
|
-
flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
|
|
226
|
-
}
|
|
227
|
-
`,
|
|
228
|
-
})
|
|
229
|
-
], AttachmentPreview);
|
|
230
|
-
export { AttachmentPreview };
|