@chat21/chat21-ionic 2.0.13 → 3.0.5-9.2
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/.github/workflows/docker-community-push-latest.yml +22 -0
- package/.github/workflows/docker-image-tag-community-tag-push.yml +21 -0
- package/CHANGELOG.md +637 -212
- package/Dockerfile +1 -2
- package/LICENSE +21 -661
- package/README.md +40 -9
- package/angular.json +230 -0
- package/browserslist +12 -0
- package/config.xml +60 -47
- package/deploy_pre.sh +14 -12
- package/deploy_prod.sh +26 -6
- package/env.sample +28 -9
- package/ionic.config.json +2 -2
- package/karma.conf.js +31 -0
- package/nginx.conf +1 -1
- package/package.json +91 -105
- package/publish_pre.sh +33 -0
- package/publish_prod.sh +33 -0
- package/resources/Android/icon/drawable-hdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-ldpi-icon.png +0 -0
- package/resources/Android/icon/drawable-mdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/Android/icon.png +0 -0
- package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash.png +0 -0
- package/src/app/app-routing.module.ts +90 -0
- package/src/app/app.component.html +26 -0
- package/src/app/app.component.scss +11 -0
- package/src/app/app.component.spec.ts +47 -0
- package/src/app/app.component.ts +1154 -128
- package/src/app/app.module.ts +314 -135
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +143 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.scss +335 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.spec.ts +179 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +303 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +149 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +199 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.spec.ts +24 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +97 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.html +17 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.scss +83 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.spec.ts +27 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.ts +43 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +76 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +51 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.spec.ts +84 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +215 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +3 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +83 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +37 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +24 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +61 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +30 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +3 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +47 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +29 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.html +3 -0
- package/{bin/chat21-ionic → src/app/chatlib/conversation-detail/message/frame/frame.component.scss} +0 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +10 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.scss +34 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.spec.ts +35 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +78 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.html +2 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.scss +15 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.spec.ts +27 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +35 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +56 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +169 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.spec.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +80 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.html +18 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +27 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.ts +24 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.html +5 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.scss +26 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.spec.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.ts +56 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +154 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +222 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.spec.ts +24 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +113 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +46 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.scss +200 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.spec.ts +27 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +135 -0
- package/src/app/components/authentication/login/login.component.html +65 -0
- package/src/app/components/authentication/login/login.component.scss +85 -0
- package/src/app/components/authentication/login/login.component.spec.ts +24 -0
- package/src/app/components/authentication/login/login.component.ts +174 -0
- package/src/app/components/contacts-directory/contacts-directory.component.html +22 -0
- package/src/app/components/contacts-directory/contacts-directory.component.scss +123 -0
- package/src/app/components/contacts-directory/contacts-directory.component.spec.ts +24 -0
- package/src/app/components/contacts-directory/contacts-directory.component.ts +109 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +3 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +21 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +14 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +54 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +98 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +84 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +30 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +83 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +68 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +3 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +10 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +14 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +71 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +161 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +133 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +64 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +124 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.spec.ts +25 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +685 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.html +13 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.scss +0 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.ts +24 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.html +64 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.scss +135 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.spec.ts +24 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.ts +53 -0
- package/src/app/components/conversation-info/conversation-info.module.ts +13 -0
- package/src/app/components/conversation-info/info-content/info-content.component.html +18 -0
- package/src/app/components/conversation-info/info-content/info-content.component.scss +5 -0
- package/src/app/components/conversation-info/info-content/info-content.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-content/info-content.component.ts +395 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.html +57 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.scss +62 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.ts +67 -0
- package/src/app/components/conversation-info/info-group/info-group.component.html +115 -0
- package/src/app/components/conversation-info/info-group/info-group.component.scss +80 -0
- package/src/app/components/conversation-info/info-group/info-group.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-group/info-group.component.ts +218 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.html +6 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.scss +0 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.ts +29 -0
- package/src/app/components/ddp-header/ddp-header.component.html +31 -0
- package/src/app/components/ddp-header/ddp-header.component.scss +26 -0
- package/src/app/components/ddp-header/ddp-header.component.spec.ts +24 -0
- package/src/app/components/ddp-header/ddp-header.component.ts +33 -0
- package/src/app/components/image-viewer/image-viewer.component.html +23 -0
- package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
- package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
- package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
- package/src/app/components/project-item/project-item.component.html +147 -0
- package/src/app/components/project-item/project-item.component.scss +669 -0
- package/src/app/components/project-item/project-item.component.spec.ts +24 -0
- package/src/app/components/project-item/project-item.component.ts +350 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.html +12 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.scss +29 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.spec.ts +24 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +41 -0
- package/src/app/components/utils/user-presence/user-presence.component.html +2 -0
- package/src/app/components/utils/user-presence/user-presence.component.scss +24 -0
- package/src/app/components/utils/user-presence/user-presence.component.spec.ts +24 -0
- package/src/app/components/utils/user-presence/user-presence.component.ts +159 -0
- package/src/app/directives/autofocus.directive.ts +41 -0
- package/src/app/directives/html-entities-encode.pipe.spec.ts +8 -0
- package/src/app/directives/html-entities-encode.pipe.ts +17 -0
- package/src/app/directives/marked.pipe.spec.ts +8 -0
- package/src/app/directives/marked.pipe.ts +27 -0
- package/src/app/directives/safe-html.pipe.ts +16 -0
- package/src/app/pages/authentication/login/login-routing.module.ts +17 -0
- package/src/app/pages/authentication/login/login.module.ts +39 -0
- package/src/app/pages/authentication/login/login.page.html +7 -0
- package/src/app/pages/authentication/login/login.page.scss +5 -0
- package/src/app/pages/authentication/login/login.page.spec.ts +24 -0
- package/src/app/pages/authentication/login/login.page.ts +187 -0
- package/src/app/pages/contacts-directory/contacts-directory-routing.module.ts +17 -0
- package/src/app/pages/contacts-directory/contacts-directory.module.ts +42 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.html +19 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.scss +0 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.spec.ts +24 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.ts +125 -0
- package/src/app/pages/conversation-detail/conversation-detail-routing.module.ts +17 -0
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +69 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.html +191 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +492 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.spec.ts +24 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +1525 -0
- package/src/app/pages/conversations-list/conversations-list-routing.module.ts +17 -0
- package/src/app/pages/conversations-list/conversations-list.module.ts +43 -0
- package/src/app/pages/conversations-list/conversations-list.page.html +112 -0
- package/src/app/pages/conversations-list/conversations-list.page.scss +302 -0
- package/src/app/pages/conversations-list/conversations-list.page.spec.ts +24 -0
- package/src/app/pages/conversations-list/conversations-list.page.ts +1032 -0
- package/src/app/pages/details/details-routing.module.ts +17 -0
- package/src/app/pages/details/details.module.ts +21 -0
- package/src/app/pages/details/details.page.html +28 -0
- package/src/app/pages/details/details.page.scss +23 -0
- package/src/app/pages/details/details.page.spec.ts +24 -0
- package/src/app/pages/details/details.page.ts +65 -0
- package/src/app/pages/loader-preview/loader-preview-routing.module.ts +17 -0
- package/src/app/pages/loader-preview/loader-preview.module.ts +29 -0
- package/src/app/pages/loader-preview/loader-preview.page.html +62 -0
- package/src/app/pages/loader-preview/loader-preview.page.scss +117 -0
- package/src/app/pages/loader-preview/loader-preview.page.spec.ts +24 -0
- package/src/app/pages/loader-preview/loader-preview.page.ts +353 -0
- package/src/app/pages/profile-info/profile-info-routing.module.ts +17 -0
- package/src/app/pages/profile-info/profile-info.module.ts +41 -0
- package/src/app/pages/profile-info/profile-info.page.html +86 -0
- package/src/app/pages/profile-info/profile-info.page.scss +264 -0
- package/src/app/pages/profile-info/profile-info.page.spec.ts +24 -0
- package/src/app/pages/profile-info/profile-info.page.ts +223 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +116 -0
- package/src/app/services/app-config.ts +107 -0
- package/src/app/services/canned-responses/canned-responses.service.spec.ts +12 -0
- package/src/app/services/canned-responses/canned-responses.service.ts +49 -0
- package/src/app/services/contacts/contacts.service.spec.ts +12 -0
- package/src/app/services/contacts/contacts.service.ts +172 -0
- package/src/app/services/events-service.ts +79 -0
- package/src/app/services/nav-proxy.service.spec.ts +12 -0
- package/src/app/services/nav-proxy.service.ts +80 -0
- package/src/app/services/network-service/network.service.spec.ts +12 -0
- package/src/app/services/network-service/network.service.ts +46 -0
- package/src/app/services/tiledesk/tiledesk.service.spec.ts +12 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +99 -0
- package/src/app/services/websocket/websocket-js.ts +560 -0
- package/src/app/services/websocket/websocket.service.spec.ts +12 -0
- package/src/app/services/websocket/websocket.service.ts +292 -0
- package/src/app/shared/shared-conversation-info.module.ts +33 -0
- package/src/app/shared/shared.module.ts +130 -0
- package/src/{utils → app/utils}/constants.ts-e +0 -0
- package/src/app/utils/scrollbar-theme.directive.ts +63 -0
- package/src/assets/i18n/en.json +122 -38
- package/src/assets/i18n/it.json +101 -10
- package/src/assets/icon/favicon.ico +0 -0
- package/src/assets/icon/ionic_favicon.png +0 -0
- package/src/assets/images/f21ico-done.svg +1 -0
- package/src/assets/images/f21ico-done_all.svg +1 -0
- package/src/assets/images/f21ico-schedule.svg +1 -0
- package/src/assets/images/file-alt-solid.png +0 -0
- package/src/assets/images/no_conversation.jpg +0 -0
- package/src/assets/{img → images}/no_image.png +0 -0
- package/src/assets/js/chat21client.js +1027 -0
- package/src/assets/js/mqtt/4.1.0/mqtt.min.js +1 -0
- package/src/assets/js/mqtt/4.2.6/mqtt.min.js +1 -0
- package/src/assets/js/mqtt/4.2.8/mqtt.min.js +1 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/shapes.svg +1 -0
- package/src/assets/sounds/pling.mp3 +0 -0
- package/src/assets/transparent.png +0 -0
- package/src/chat-config-mqtt-ver-uploaded.json +22 -0
- package/src/chat-config-mqtt.json +26 -0
- package/src/chat-config-pre-test.json +32 -0
- package/src/chat-config-pre.json +23 -0
- package/src/chat-config-template.json +20 -6
- package/src/chat-config.json +30 -0
- package/src/{models → chat21-core/models}/conversation.ts +6 -2
- package/src/{models → chat21-core/models}/group.ts +7 -5
- package/src/{models → chat21-core/models}/message.ts +8 -8
- package/src/{models → chat21-core/models}/upload.ts +5 -5
- package/src/{models → chat21-core/models}/user.ts +2 -1
- package/src/chat21-core/providers/abstract/app-storage.service.spec.ts +15 -0
- package/src/chat21-core/providers/abstract/app-storage.service.ts +17 -0
- package/src/chat21-core/providers/abstract/archivedconversations-handler.service.spec.ts +13 -0
- package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +34 -0
- package/src/chat21-core/providers/abstract/conversation-handler-builder.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/conversation-handler-builder.service.ts +11 -0
- package/src/chat21-core/providers/abstract/conversation-handler.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/conversation-handler.service.ts +43 -0
- package/src/chat21-core/providers/abstract/conversations-handler.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +42 -0
- package/src/chat21-core/providers/abstract/groups-handler.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/groups-handler.service.ts +28 -0
- package/src/chat21-core/providers/abstract/image-repo.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/image-repo.service.ts +26 -0
- package/src/chat21-core/providers/abstract/logger.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/logger.service.ts +16 -0
- package/src/chat21-core/providers/abstract/messagingAuth.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/messagingAuth.service.ts +54 -0
- package/src/chat21-core/providers/abstract/notifications.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/notifications.service.ts +31 -0
- package/src/chat21-core/providers/abstract/presence.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/presence.service.ts +34 -0
- package/src/chat21-core/providers/abstract/typing.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/typing.service.ts +31 -0
- package/src/chat21-core/providers/abstract/upload.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/upload.service.ts +39 -0
- package/src/chat21-core/providers/chat-manager.ts +282 -0
- package/src/chat21-core/providers/custom-translate.service.spec.ts +12 -0
- package/src/chat21-core/providers/custom-translate.service.ts +42 -0
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +476 -0
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +376 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler-builder.service.ts +19 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +416 -0
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +570 -0
- package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +303 -0
- package/src/chat21-core/providers/firebase/firebase-image-repo.ts +40 -0
- package/src/chat21-core/providers/firebase/firebase-init-service.ts +31 -0
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +246 -0
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +190 -0
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +93 -0
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +106 -0
- package/src/chat21-core/providers/localSessionStorage.ts +215 -0
- package/src/chat21-core/providers/logger/customLogger.ts +70 -0
- package/src/chat21-core/providers/logger/loggerInstance.ts +20 -0
- package/src/chat21-core/providers/mqtt/chat-service.ts +44 -0
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +707 -0
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +313 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler-builder.service.ts +25 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +446 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +601 -0
- package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +139 -0
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +122 -0
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +229 -0
- package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +93 -0
- package/src/chat21-core/providers/native/native-image-repo.ts +30 -0
- package/src/chat21-core/providers/native/native-upload-service.ts +85 -0
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.spec.ts +12 -0
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +211 -0
- package/src/chat21-core/utils/constants.ts +109 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.html +6 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.scss +62 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.spec.ts +24 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.ts +114 -0
- package/src/chat21-core/utils/utils-message.ts +117 -0
- package/src/chat21-core/utils/utils-user.ts +46 -0
- package/src/chat21-core/utils/utils.ts +893 -0
- package/src/firebase-messaging-sw-template.js +1 -1
- package/src/global.scss +585 -0
- package/src/index.html +71 -42
- package/src/main.ts +12 -0
- package/src/manifest.json +0 -11
- package/src/models/department.ts +12 -0
- package/src/polyfills.ts +73 -0
- package/src/test.ts +21 -0
- package/src/theme/variables.scss +236 -93
- package/src/variables.scss +30 -0
- package/src/zone-flags.ts +5 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +23 -18
- package/tsconfig.spec.json +19 -0
- package/tslint.json +84 -7
- package/app.json +0 -7
- package/curl +0 -1
- package/deploy_dev.sh +0 -28
- package/docs/changelog.html +0 -227
- package/docs/classes/ConversationModel.html +0 -1022
- package/docs/classes/GroupModel.html +0 -527
- package/docs/classes/MessageModel.html +0 -843
- package/docs/classes/UploadModel.html +0 -417
- package/docs/classes/UserModel.html +0 -728
- package/docs/classes/_DetailPage.html +0 -144
- package/docs/classes/_MasterPage.html +0 -144
- package/docs/components/ArchivedConversationsPage.html +0 -1024
- package/docs/components/ChatBubble.html +0 -327
- package/docs/components/DettaglioConversazionePage.html +0 -6060
- package/docs/components/ElasticTextarea.html +0 -619
- package/docs/components/InfoAdvancedPage.html +0 -656
- package/docs/components/InfoConversationPage.html +0 -5681
- package/docs/components/InfoMessagePage.html +0 -993
- package/docs/components/InfoUserPage.html +0 -1420
- package/docs/components/ListaConversazioniPage.html +0 -3576
- package/docs/components/LoginPage.html +0 -1457
- package/docs/components/MyApp.html +0 -1388
- package/docs/components/PlaceholderPage.html +0 -397
- package/docs/components/PopoverPage.html +0 -986
- package/docs/components/PopoverProfilePage.html +0 -639
- package/docs/components/ProfilePage.html +0 -1187
- package/docs/components/RegisterPage.html +0 -1271
- package/docs/components/ResetpwdPage.html +0 -1039
- package/docs/components/UpdateImageProfilePage.html +0 -997
- package/docs/components/UsersPage.html +0 -1297
- package/docs/coverage.html +0 -1421
- package/docs/dependencies.html +0 -210
- package/docs/directives/AutosizeDirective.html +0 -556
- package/docs/fonts/FontAwesome.otf +0 -0
- package/docs/fonts/fontawesome-webfont.eot +0 -0
- package/docs/fonts/fontawesome-webfont.svg +0 -685
- package/docs/fonts/fontawesome-webfont.ttf +0 -0
- package/docs/fonts/fontawesome-webfont.woff +0 -0
- package/docs/fonts/fontawesome-webfont.woff2 +0 -0
- package/docs/fonts/ionicons.eot +0 -0
- package/docs/fonts/ionicons.svg +0 -2090
- package/docs/fonts/ionicons.ttf +0 -0
- package/docs/fonts/ionicons.woff +0 -0
- package/docs/fonts/ionicons.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-300.eot +0 -0
- package/docs/fonts/roboto-v15-latin-300.svg +0 -314
- package/docs/fonts/roboto-v15-latin-300.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-300.woff +0 -0
- package/docs/fonts/roboto-v15-latin-300.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-700.eot +0 -0
- package/docs/fonts/roboto-v15-latin-700.svg +0 -310
- package/docs/fonts/roboto-v15-latin-700.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-700.woff +0 -0
- package/docs/fonts/roboto-v15-latin-700.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-italic.eot +0 -0
- package/docs/fonts/roboto-v15-latin-italic.svg +0 -323
- package/docs/fonts/roboto-v15-latin-italic.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-italic.woff +0 -0
- package/docs/fonts/roboto-v15-latin-italic.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-regular.eot +0 -0
- package/docs/fonts/roboto-v15-latin-regular.svg +0 -308
- package/docs/fonts/roboto-v15-latin-regular.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-regular.woff +0 -0
- package/docs/fonts/roboto-v15-latin-regular.woff2 +0 -0
- package/docs/graph/dependencies.svg +0 -870
- package/docs/images/compodoc-vectorise-inverted.png +0 -0
- package/docs/images/compodoc-vectorise-inverted.svg +0 -201
- package/docs/images/compodoc-vectorise.png +0 -0
- package/docs/images/compodoc-vectorise.svg +0 -201
- package/docs/images/coverage-badge-documentation.svg +0 -9
- package/docs/images/coverage-badge.svg +0 -9
- package/docs/images/favicon.ico +0 -0
- package/docs/index.html +0 -233
- package/docs/injectables/AppConfigProvider.html +0 -411
- package/docs/injectables/AuthService.html +0 -1016
- package/docs/injectables/ChatArchivedConversationsHandler.html +0 -1832
- package/docs/injectables/ChatContactsSynchronizer.html +0 -841
- package/docs/injectables/ChatConversationHandler.html +0 -1960
- package/docs/injectables/ChatConversationsHandler.html +0 -2584
- package/docs/injectables/ChatManager.html +0 -1779
- package/docs/injectables/ChatPresenceHandler.html +0 -1187
- package/docs/injectables/CustomTranslateService.html +0 -496
- package/docs/injectables/DatabaseProvider.html +0 -1444
- package/docs/injectables/GroupService.html +0 -1458
- package/docs/injectables/MessagingService.html +0 -1165
- package/docs/injectables/NavProxyService.html +0 -1028
- package/docs/injectables/TiledeskConversationProvider.html +0 -945
- package/docs/injectables/UploadService.html +0 -791
- package/docs/injectables/UserService.html +0 -1612
- package/docs/js/compodoc.js +0 -14
- package/docs/js/lazy-load-graphs.js +0 -44
- package/docs/js/libs/EventDispatcher.js +0 -5
- package/docs/js/libs/bootstrap-native.js +0 -2
- package/docs/js/libs/clipboard.min.js +0 -7
- package/docs/js/libs/custom-elements-es5-adapter.js +0 -15
- package/docs/js/libs/custom-elements.min.js +0 -38
- package/docs/js/libs/d3.v3.min.js +0 -2
- package/docs/js/libs/deep-iterator.js +0 -2
- package/docs/js/libs/es6-shim.min.js +0 -11
- package/docs/js/libs/htmlparser.js +0 -23
- package/docs/js/libs/innersvg.js +0 -9
- package/docs/js/libs/lit-html.js +0 -1
- package/docs/js/libs/prism.js +0 -14
- package/docs/js/libs/promise.min.js +0 -6
- package/docs/js/libs/svg-pan-zoom.min.js +0 -3
- package/docs/js/libs/tablesort.min.js +0 -6
- package/docs/js/libs/tablesort.number.min.js +0 -6
- package/docs/js/libs/vis.min.js +0 -46
- package/docs/js/libs/zepto.min.js +0 -2
- package/docs/js/menu-wc.js +0 -594
- package/docs/js/menu.js +0 -261
- package/docs/js/routes.js +0 -280
- package/docs/js/search/lunr.min.js +0 -6
- package/docs/js/search/search-lunr.js +0 -67
- package/docs/js/search/search.js +0 -268
- package/docs/js/search/search_index.js +0 -4
- package/docs/js/sourceCode.js +0 -58
- package/docs/js/svg-pan-zoom.controls.js +0 -53
- package/docs/js/tabs.js +0 -21
- package/docs/js/tree.js +0 -147
- package/docs/license.html +0 -664
- package/docs/miscellaneous/functions.html +0 -2417
- package/docs/miscellaneous/variables.html +0 -994
- package/docs/modules/AppModule/dependencies.svg +0 -454
- package/docs/modules/AppModule.html +0 -967
- package/docs/modules/ArchivedConversationsPageModule/dependencies.svg +0 -50
- package/docs/modules/ArchivedConversationsPageModule.html +0 -225
- package/docs/modules/DettaglioConversazionePageModule/dependencies.svg +0 -66
- package/docs/modules/DettaglioConversazionePageModule.html +0 -256
- package/docs/modules/InfoAdvancedPageModule/dependencies.svg +0 -50
- package/docs/modules/InfoAdvancedPageModule.html +0 -225
- package/docs/modules/InfoConversationPageModule/dependencies.svg +0 -50
- package/docs/modules/InfoConversationPageModule.html +0 -227
- package/docs/modules/InfoUserPageModule/dependencies.svg +0 -50
- package/docs/modules/InfoUserPageModule.html +0 -225
- package/docs/modules/ListaConversazioniPageModule/dependencies.svg +0 -66
- package/docs/modules/ListaConversazioniPageModule.html +0 -255
- package/docs/modules/LoginModule/dependencies.svg +0 -66
- package/docs/modules/LoginModule.html +0 -253
- package/docs/modules/PlaceholderPageModule/dependencies.svg +0 -66
- package/docs/modules/PlaceholderPageModule.html +0 -253
- package/docs/modules/PopoverPageModule/dependencies.svg +0 -66
- package/docs/modules/PopoverPageModule.html +0 -253
- package/docs/modules/PopoverProfilePageModule/dependencies.svg +0 -66
- package/docs/modules/PopoverProfilePageModule.html +0 -253
- package/docs/modules/ProfilePageModule/dependencies.svg +0 -66
- package/docs/modules/ProfilePageModule.html +0 -253
- package/docs/modules/RegisterModule/dependencies.svg +0 -66
- package/docs/modules/RegisterModule.html +0 -253
- package/docs/modules/ResetpwdModule/dependencies.svg +0 -66
- package/docs/modules/ResetpwdModule.html +0 -253
- package/docs/modules/UpdateImageProfilePageModule/dependencies.svg +0 -66
- package/docs/modules/UpdateImageProfilePageModule.html +0 -253
- package/docs/modules/UsersModule/dependencies.svg +0 -66
- package/docs/modules/UsersModule.html +0 -253
- package/docs/modules.html +0 -379
- package/docs/overview.html +0 -1033
- package/docs/styles/bootstrap-card.css +0 -219
- package/docs/styles/bootstrap.min.css +0 -5
- package/docs/styles/compodoc.css +0 -996
- package/docs/styles/font-awesome.min.css +0 -4
- package/docs/styles/ionicons.min.css +0 -11
- package/docs/styles/laravel.css +0 -69
- package/docs/styles/material.css +0 -109
- package/docs/styles/original.css +0 -47
- package/docs/styles/postmark.css +0 -224
- package/docs/styles/prism.css +0 -267
- package/docs/styles/readthedocs.css +0 -108
- package/docs/styles/reset.css +0 -48
- package/docs/styles/stripe.css +0 -65
- package/docs/styles/style.css +0 -7
- package/docs/styles/tablesort.css +0 -33
- package/docs/styles/vagrant.css +0 -96
- package/firebase-functions/.firebaserc +0 -5
- package/firebase-functions/firebase.json +0 -1
- package/firebase-functions/functions/index.js +0 -208
- package/firebase-functions/functions/package.json +0 -9
- package/google-services.json +0 -42
- package/hooks/README.md +0 -196
- package/resources/android/icon/drawable-hdpi-icon.png +0 -0
- package/resources/android/icon/drawable-ldpi-icon.png +0 -0
- package/resources/android/icon/drawable-mdpi-icon.png +0 -0
- package/resources/android/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/android/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/android/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/android/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/icon.png +0 -0
- package/resources/icon.png.md5 +0 -1
- package/resources/ios/icon/icon-1024.png +0 -0
- package/resources/ios/icon/icon-40.png +0 -0
- package/resources/ios/icon/icon-40@2x.png +0 -0
- package/resources/ios/icon/icon-40@3x.png +0 -0
- package/resources/ios/icon/icon-50.png +0 -0
- package/resources/ios/icon/icon-50@2x.png +0 -0
- package/resources/ios/icon/icon-60.png +0 -0
- package/resources/ios/icon/icon-60@2x.png +0 -0
- package/resources/ios/icon/icon-60@3x.png +0 -0
- package/resources/ios/icon/icon-72.png +0 -0
- package/resources/ios/icon/icon-72@2x.png +0 -0
- package/resources/ios/icon/icon-76.png +0 -0
- package/resources/ios/icon/icon-76@2x.png +0 -0
- package/resources/ios/icon/icon-83.5@2x.png +0 -0
- package/resources/ios/icon/icon-small.png +0 -0
- package/resources/ios/icon/icon-small@2x.png +0 -0
- package/resources/ios/icon/icon-small@3x.png +0 -0
- package/resources/ios/icon/icon.png +0 -0
- package/resources/ios/icon/icon@2x.png +0 -0
- package/resources/ios/splash/Default-568h@2x~iphone.png +0 -0
- package/resources/ios/splash/Default-667h.png +0 -0
- package/resources/ios/splash/Default-736h.png +0 -0
- package/resources/ios/splash/Default-Landscape-736h.png +0 -0
- package/resources/ios/splash/Default-Landscape@2x~ipad.png +0 -0
- package/resources/ios/splash/Default-Landscape@~ipadpro.png +0 -0
- package/resources/ios/splash/Default-Landscape~ipad.png +0 -0
- package/resources/ios/splash/Default-Portrait@2x~ipad.png +0 -0
- package/resources/ios/splash/Default-Portrait@~ipadpro.png +0 -0
- package/resources/ios/splash/Default-Portrait~ipad.png +0 -0
- package/resources/ios/splash/Default@2x~iphone.png +0 -0
- package/resources/ios/splash/Default@2x~universal~anyany.png +0 -0
- package/resources/ios/splash/Default~iphone.png +0 -0
- package/resources/splash.png +0 -0
- package/resources/splash.png.md5 +0 -1
- package/server.js +0 -7
- package/src/app/app.html +0 -56
- package/src/app/app.scss +0 -236
- package/src/app/main.ts +0 -9
- package/src/assets/chat-background.jpg +0 -0
- package/src/assets/chat21-ionic-pattern-2.svg +0 -5110
- package/src/assets/chat21-ionic-pattern.png +0 -0
- package/src/assets/chat21-ionic-pattern.svg +0 -1
- package/src/assets/download.svg +0 -1
- package/src/assets/dummyDump.sql +0 -1
- package/src/assets/icon/favicon_old.ico +0 -0
- package/src/assets/img/c21-down-gray.svg +0 -1
- package/src/assets/img/chat21-icon.png +0 -0
- package/src/assets/img/f21ico-attached.svg +0 -1
- package/src/assets/img/f21ico-close.svg +0 -1
- package/src/assets/img/f21ico-photo.svg +0 -1
- package/src/assets/img/ic_keyboard_arrow_down_black_24px.svg +0 -4
- package/src/assets/img/ic_keyboard_arrow_down_white_24px.svg +0 -4
- package/src/assets/img/icon.png +0 -0
- package/src/assets/message-mine.png +0 -0
- package/src/assets/message-other.png +0 -0
- package/src/assets/pling.mp3 +0 -0
- package/src/assets/splash.png +0 -0
- package/src/declarations.d.ts +0 -14
- package/src/directives/autosize/autosize.ts +0 -82
- package/src/environments/environment.pre.ts +0 -22
- package/src/environments/environment.prod.ts +0 -22
- package/src/environments/environment.ts +0 -21
- package/src/pages/_DetailPage.ts +0 -1
- package/src/pages/_MasterPage.ts +0 -1
- package/src/pages/archived-conversations/archived-conversations.html +0 -32
- package/src/pages/archived-conversations/archived-conversations.module.ts +0 -13
- package/src/pages/archived-conversations/archived-conversations.scss +0 -153
- package/src/pages/archived-conversations/archived-conversations.ts +0 -121
- package/src/pages/authentication/login/login.html +0 -58
- package/src/pages/authentication/login/login.module.ts +0 -16
- package/src/pages/authentication/login/login.scss +0 -121
- package/src/pages/authentication/login/login.ts +0 -221
- package/src/pages/authentication/register/register.html +0 -88
- package/src/pages/authentication/register/register.module.ts +0 -16
- package/src/pages/authentication/register/register.scss +0 -95
- package/src/pages/authentication/register/register.ts +0 -122
- package/src/pages/authentication/resetpwd/resetpwd.html +0 -40
- package/src/pages/authentication/resetpwd/resetpwd.module.ts +0 -16
- package/src/pages/authentication/resetpwd/resetpwd.scss +0 -102
- package/src/pages/authentication/resetpwd/resetpwd.ts +0 -93
- package/src/pages/components/chatBubble_old/chatBubble.scss +0 -83
- package/src/pages/components/chatBubble_old/chatBubble.ts +0 -30
- package/src/pages/components/elasticTextarea_old.ts +0 -46
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.html +0 -261
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.module.ts +0 -19
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.scss +0 -701
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.ts +0 -1395
- package/src/pages/index.ts +0 -5
- package/src/pages/info-advanced/info-advanced.html +0 -90
- package/src/pages/info-advanced/info-advanced.module.ts +0 -13
- package/src/pages/info-advanced/info-advanced.scss +0 -196
- package/src/pages/info-advanced/info-advanced.ts +0 -44
- package/src/pages/info-conversation/info-conversation.html +0 -225
- package/src/pages/info-conversation/info-conversation.module.ts +0 -15
- package/src/pages/info-conversation/info-conversation.scss +0 -444
- package/src/pages/info-conversation/info-conversation.ts +0 -1233
- package/src/pages/info-message/info-message.html +0 -74
- package/src/pages/info-message/info-message.module.ts +0 -13
- package/src/pages/info-message/info-message.scss +0 -216
- package/src/pages/info-message/info-message.ts +0 -89
- package/src/pages/info-user/info-user.html +0 -89
- package/src/pages/info-user/info-user.module.ts +0 -13
- package/src/pages/info-user/info-user.scss +0 -187
- package/src/pages/info-user/info-user.ts +0 -177
- package/src/pages/lista-conversazioni/lista-conversazioni.html +0 -88
- package/src/pages/lista-conversazioni/lista-conversazioni.module.ts +0 -18
- package/src/pages/lista-conversazioni/lista-conversazioni.scss +0 -245
- package/src/pages/lista-conversazioni/lista-conversazioni.ts +0 -736
- package/src/pages/placeholder/placeholder.html +0 -3
- package/src/pages/placeholder/placeholder.module.ts +0 -16
- package/src/pages/placeholder/placeholder.scss +0 -23
- package/src/pages/placeholder/placeholder.ts +0 -18
- package/src/pages/popover/popover.html +0 -27
- package/src/pages/popover/popover.module.ts +0 -16
- package/src/pages/popover/popover.scss +0 -23
- package/src/pages/popover/popover.ts +0 -95
- package/src/pages/popover-profile/popover-profile.html +0 -20
- package/src/pages/popover-profile/popover-profile.module.ts +0 -16
- package/src/pages/popover-profile/popover-profile.scss +0 -10
- package/src/pages/popover-profile/popover-profile.ts +0 -40
- package/src/pages/profile/profile.html +0 -54
- package/src/pages/profile/profile.module.ts +0 -16
- package/src/pages/profile/profile.scss +0 -45
- package/src/pages/profile/profile.ts +0 -108
- package/src/pages/update-image-profile/update-image-profile.html +0 -39
- package/src/pages/update-image-profile/update-image-profile.module.ts +0 -16
- package/src/pages/update-image-profile/update-image-profile.scss +0 -50
- package/src/pages/update-image-profile/update-image-profile.ts +0 -111
- package/src/pages/users/users.html +0 -55
- package/src/pages/users/users.module.ts +0 -16
- package/src/pages/users/users.scss +0 -10
- package/src/pages/users/users.ts +0 -222
- package/src/providers/app-config/app-config.ts +0 -33
- package/src/providers/auth-service.ts +0 -140
- package/src/providers/canned-responses-service/canned-responses-service.ts +0 -57
- package/src/providers/chat-archived-conversations-handler.ts +0 -283
- package/src/providers/chat-contacts-synchronizer.ts +0 -179
- package/src/providers/chat-conversation-handler.ts +0 -547
- package/src/providers/chat-conversations-handler.ts +0 -519
- package/src/providers/chat-manager/chat-manager.ts +0 -246
- package/src/providers/chat-presence-handler.ts +0 -188
- package/src/providers/database/database.ts +0 -214
- package/src/providers/group/group.ts +0 -243
- package/src/providers/messaging-service.ts +0 -267
- package/src/providers/nav-proxy.ts +0 -104
- package/src/providers/tiledesk-conversation/tiledesk-conversation.ts +0 -134
- package/src/providers/translate-service.ts +0 -61
- package/src/providers/upload-service/upload-service.ts +0 -117
- package/src/providers/user/user.ts +0 -320
- package/src/service-worker.js +0 -30
- package/src/utils/constants.ts +0 -73
- package/src/utils/utils.ts +0 -548
- package/src/videochat.php +0 -20
|
@@ -0,0 +1,1525 @@
|
|
|
1
|
+
import { URL_SOUND_LIST_CONVERSATION } from './../../../chat21-core/utils/constants';
|
|
2
|
+
import { Component, OnInit, OnDestroy, AfterViewInit, ViewChild, ElementRef, Directive, HostListener, ChangeDetectorRef } from '@angular/core';
|
|
3
|
+
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|
4
|
+
import { ModalController, ToastController, PopoverController, Platform, ActionSheetController, NavController, IonContent, IonTextarea } from '@ionic/angular';
|
|
5
|
+
|
|
6
|
+
// models
|
|
7
|
+
import { UserModel } from 'src/chat21-core/models/user';
|
|
8
|
+
import { MessageModel } from 'src/chat21-core/models/message';
|
|
9
|
+
import { ConversationModel } from 'src/chat21-core/models/conversation';
|
|
10
|
+
import { GroupModel } from 'src/chat21-core/models/group';
|
|
11
|
+
|
|
12
|
+
// services
|
|
13
|
+
import { ChatManager } from 'src/chat21-core/providers/chat-manager';
|
|
14
|
+
import { AppConfigProvider } from '../../services/app-config';
|
|
15
|
+
|
|
16
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
17
|
+
import { TypingService } from 'src/chat21-core/providers/abstract/typing.service';
|
|
18
|
+
import { ConversationHandlerBuilderService } from 'src/chat21-core/providers/abstract/conversation-handler-builder.service';
|
|
19
|
+
import { GroupsHandlerService } from 'src/chat21-core/providers/abstract/groups-handler.service';
|
|
20
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
21
|
+
import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service';
|
|
22
|
+
import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
|
|
23
|
+
import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service';
|
|
24
|
+
import { ContactsService } from 'src/app/services/contacts/contacts.service';
|
|
25
|
+
import { CannedResponsesService } from '../../services/canned-responses/canned-responses.service';
|
|
26
|
+
import { compareValues } from '../../../chat21-core/utils/utils';
|
|
27
|
+
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
|
|
28
|
+
import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service';
|
|
29
|
+
|
|
30
|
+
// utils
|
|
31
|
+
import { TYPE_MSG_TEXT, MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from '../../../chat21-core/utils/constants';
|
|
32
|
+
import { checkPlatformIsMobile, checkWindowWidthIsLessThan991px, setConversationAvatar, setChannelType } from '../../../chat21-core/utils/utils';
|
|
33
|
+
import { isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
34
|
+
|
|
35
|
+
// Logger
|
|
36
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
37
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
38
|
+
|
|
39
|
+
import { Subject } from 'rxjs';
|
|
40
|
+
import { takeUntil } from 'rxjs/operators';
|
|
41
|
+
import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
|
|
42
|
+
import { NetworkService } from '../../services/network-service/network.service';
|
|
43
|
+
import { EventsService } from '../../services/events-service';
|
|
44
|
+
|
|
45
|
+
@Component({
|
|
46
|
+
selector: 'app-conversation-detail',
|
|
47
|
+
templateUrl: './conversation-detail.page.html',
|
|
48
|
+
styleUrls: ['./conversation-detail.page.scss'],
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit {
|
|
52
|
+
@ViewChild('ionContentChatArea', { static: false }) ionContentChatArea: IonContent;
|
|
53
|
+
@ViewChild('rowMessageTextArea', { static: false }) rowTextArea: ElementRef;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
// @ViewChild('info_content', { static: false }) info_content_child : InfoContentComponent;
|
|
58
|
+
|
|
59
|
+
showButtonToBottom = false; // indica lo stato del pulsante per scrollare la chat (showed/hidden)
|
|
60
|
+
NUM_BADGES = 0; // numero di messaggi non letti
|
|
61
|
+
COLOR_GREEN = '#24d066'; // colore presence active da spostare nelle costanti
|
|
62
|
+
COLOR_RED = '#db4437'; // colore presence none da spostare nelle costanti
|
|
63
|
+
|
|
64
|
+
private unsubscribe$: Subject<any> = new Subject<any>();
|
|
65
|
+
private subscriptions: Array<any>;
|
|
66
|
+
public tenant: string;
|
|
67
|
+
public loggedUser: UserModel;
|
|
68
|
+
public conversationWith: string;
|
|
69
|
+
public conversationWithFullname: string;
|
|
70
|
+
public messages: Array<MessageModel> = [];
|
|
71
|
+
public groupDetail: GroupModel;
|
|
72
|
+
public messageSelected: any;
|
|
73
|
+
public channelType: string;
|
|
74
|
+
public online: boolean;
|
|
75
|
+
public lastConnectionDate: string;
|
|
76
|
+
public showMessageWelcome: boolean;
|
|
77
|
+
public openInfoConversation = false;
|
|
78
|
+
public openInfoMessage: boolean; // check is open info message
|
|
79
|
+
public isMobile = false;
|
|
80
|
+
public isLessThan991px = false; // nk added
|
|
81
|
+
public isTyping = false;
|
|
82
|
+
public nameUserTypingNow: string;
|
|
83
|
+
|
|
84
|
+
public heightMessageTextArea = '';
|
|
85
|
+
public translationMap: Map<string, string>;
|
|
86
|
+
public conversationAvatar: any;
|
|
87
|
+
public membersConversation: any;
|
|
88
|
+
public member: UserModel;
|
|
89
|
+
public urlConversationSupportGroup: any;
|
|
90
|
+
public isFileSelected: boolean;
|
|
91
|
+
public showIonContent = false;
|
|
92
|
+
public conv_type: string;
|
|
93
|
+
|
|
94
|
+
public tagsCanned: any = [];
|
|
95
|
+
public tagsCannedFilter: any = [];
|
|
96
|
+
public HIDE_CANNED_RESPONSES: boolean = false;
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
public window: any = window;
|
|
100
|
+
public styleMap: Map<string, string> = new Map();
|
|
101
|
+
|
|
102
|
+
MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
|
|
103
|
+
MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
|
|
104
|
+
MESSAGE_TYPE_OTHERS = MESSAGE_TYPE_OTHERS;
|
|
105
|
+
|
|
106
|
+
arrowkeyLocation = -1;
|
|
107
|
+
|
|
108
|
+
//SOUND
|
|
109
|
+
setTimeoutSound: any;
|
|
110
|
+
audio: any
|
|
111
|
+
isOpenInfoConversation: boolean;
|
|
112
|
+
USER_HAS_OPENED_CLOSE_INFO_CONV: boolean = false
|
|
113
|
+
isHovering: boolean = false;
|
|
114
|
+
|
|
115
|
+
dropEvent: any
|
|
116
|
+
isMine = isMine;
|
|
117
|
+
isInfo = isInfo;
|
|
118
|
+
isFirstMessage = isFirstMessage;
|
|
119
|
+
messageType = messageType;
|
|
120
|
+
// info_content_child_enabled: boolean = false
|
|
121
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
public isOnline: boolean = true;
|
|
125
|
+
public checkInternet: boolean;
|
|
126
|
+
public msgCount: number
|
|
127
|
+
/**
|
|
128
|
+
* Constructor
|
|
129
|
+
* @param route
|
|
130
|
+
* @param chatManager
|
|
131
|
+
* @param actionSheetCtrl
|
|
132
|
+
* @param platform
|
|
133
|
+
* @param customTranslateService
|
|
134
|
+
* @param appConfigProvider
|
|
135
|
+
* @param modalController
|
|
136
|
+
* @param typingService
|
|
137
|
+
* @param tiledeskAuthService
|
|
138
|
+
* @param conversationsHandlerService
|
|
139
|
+
* @param archivedConversationsHandlerService
|
|
140
|
+
* @param conversationHandlerService
|
|
141
|
+
* @param groupService
|
|
142
|
+
* @param contactsService
|
|
143
|
+
* @param conversationHandlerBuilderService
|
|
144
|
+
* @param linkifyService
|
|
145
|
+
* @param logger
|
|
146
|
+
* @param cannedResponsesService
|
|
147
|
+
* @param imageRepoService
|
|
148
|
+
* @param presenceService
|
|
149
|
+
* @param toastController
|
|
150
|
+
*/
|
|
151
|
+
constructor(
|
|
152
|
+
private route: ActivatedRoute,
|
|
153
|
+
public chatManager: ChatManager,
|
|
154
|
+
public actionSheetCtrl: ActionSheetController,
|
|
155
|
+
public platform: Platform,
|
|
156
|
+
private customTranslateService: CustomTranslateService,
|
|
157
|
+
public appConfigProvider: AppConfigProvider,
|
|
158
|
+
public modalController: ModalController,
|
|
159
|
+
public typingService: TypingService,
|
|
160
|
+
public tiledeskAuthService: TiledeskAuthService,
|
|
161
|
+
public conversationsHandlerService: ConversationsHandlerService,
|
|
162
|
+
public archivedConversationsHandlerService: ArchivedConversationsHandlerService,
|
|
163
|
+
public conversationHandlerService: ConversationHandlerService,
|
|
164
|
+
public groupService: GroupsHandlerService,
|
|
165
|
+
public contactsService: ContactsService,
|
|
166
|
+
public conversationHandlerBuilderService: ConversationHandlerBuilderService,
|
|
167
|
+
public cannedResponsesService: CannedResponsesService,
|
|
168
|
+
public imageRepoService: ImageRepoService,
|
|
169
|
+
public presenceService: PresenceService,
|
|
170
|
+
public toastController: ToastController,
|
|
171
|
+
public tiledeskService: TiledeskService,
|
|
172
|
+
private networkService: NetworkService,
|
|
173
|
+
private events: EventsService
|
|
174
|
+
) {
|
|
175
|
+
|
|
176
|
+
// Change list on date change
|
|
177
|
+
this.route.paramMap.subscribe(params => {
|
|
178
|
+
this.logger.log('[CONVS-DETAIL] - constructor -> params: ', params);
|
|
179
|
+
this.conversationWith = params.get('IDConv');
|
|
180
|
+
this.conversationWithFullname = params.get('FullNameConv');
|
|
181
|
+
this.conv_type = params.get('Convtype');
|
|
182
|
+
|
|
183
|
+
this.events.publish('supportconvid:haschanged', this.conversationWith);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// -----------------------------------------------------------
|
|
189
|
+
// @ Lifehooks
|
|
190
|
+
// -----------------------------------------------------------
|
|
191
|
+
ngOnInit() {
|
|
192
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
|
|
193
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
194
|
+
// const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
|
|
195
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
|
|
196
|
+
// const accept_files_array = accept_files.split(',')
|
|
197
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array ', accept_files_array);
|
|
198
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
|
|
199
|
+
|
|
200
|
+
// accept_files_array.forEach(accept_file => {
|
|
201
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file ', accept_file);
|
|
202
|
+
// const accept_file_segment = accept_file.split('/')
|
|
203
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file_segment ', accept_file_segment);
|
|
204
|
+
// if (accept_file_segment[1] === '*') {
|
|
205
|
+
|
|
206
|
+
// }
|
|
207
|
+
// });
|
|
208
|
+
this.watchToConnectionStatus();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
watchToConnectionStatus() {
|
|
212
|
+
|
|
213
|
+
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
214
|
+
this.checkInternet = isOnline
|
|
215
|
+
// console.log('[CONVS-LIST-PAGE] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
216
|
+
|
|
217
|
+
// checking internet connection
|
|
218
|
+
if (this.checkInternet == true) {
|
|
219
|
+
|
|
220
|
+
this.isOnline = true;
|
|
221
|
+
} else {
|
|
222
|
+
this.isOnline = false;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
ngAfterViewInit() {
|
|
228
|
+
this.logger.log('[CONVS-DETAIL] > ngAfterViewInit')
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
ngOnDestroy() {
|
|
232
|
+
this.logger.log('[CONVS-DETAIL] > ngOnDestroy')
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
ngOnChanges() {
|
|
236
|
+
this.logger.log('[CONVS-DETAIL] > ngOnChanges')
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
ionViewWillEnter() {
|
|
241
|
+
// this.info_content_child_enabled = true;
|
|
242
|
+
this.logger.log('[CONVS-DETAIL] TEST > ionViewWillEnter - convId ', this.conversationWith)
|
|
243
|
+
this.loggedUser = this.tiledeskAuthService.getCurrentUser();
|
|
244
|
+
this.logger.log('[CONVS-DETAIL] ionViewWillEnter loggedUser: ', this.loggedUser);
|
|
245
|
+
this.listnerStart();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
ionViewDidEnter() {
|
|
249
|
+
this.logger.log('[CONVS-DETAIL] > ionViewDidEnter')
|
|
250
|
+
// this.info_content_child_enabled = true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Unsubscibe when new page transition end
|
|
254
|
+
ionViewWillLeave() {
|
|
255
|
+
this.logger.log('[CONVS-DETAIL] > ionViewWillLeave')
|
|
256
|
+
|
|
257
|
+
// this.logger.log('[CONVS-DETAIL] > ionViewWillLeave info_content_child ', this.info_content_child)
|
|
258
|
+
// if (this.info_content_child) {
|
|
259
|
+
// this.logger.log('[CONVS-DETAIL] > HERE YES')
|
|
260
|
+
// this.info_content_child.destroy();
|
|
261
|
+
// }
|
|
262
|
+
|
|
263
|
+
// this.logger.log('[CONVS-DETAIL] TEST > ionViewWillLeave info_content_child_enabled ', this.info_content_child_enabled , 'convId ', this.conversationWith)
|
|
264
|
+
this.unsubescribeAll();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// reloadTree() {
|
|
268
|
+
// this.info_content_child_enabled = false;
|
|
269
|
+
// // now notify angular to check for updates
|
|
270
|
+
// this.changeDetector.detectChanges();
|
|
271
|
+
// // change detection should remove the component now
|
|
272
|
+
// // then we can enable it again to create a new instance
|
|
273
|
+
// this.info_content_child_enabled = true;
|
|
274
|
+
// }
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
private listnerStart() {
|
|
279
|
+
const that = this;
|
|
280
|
+
this.chatManager.BSStart.subscribe((data: any) => {
|
|
281
|
+
this.logger.log('[CONVS-DETAIL] - BSStart data:', data);
|
|
282
|
+
if (data) {
|
|
283
|
+
that.initialize();
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// --------------------------------------------------
|
|
289
|
+
// @ Inizialize
|
|
290
|
+
// --------------------------------------------------
|
|
291
|
+
initialize() {
|
|
292
|
+
|
|
293
|
+
// this.logger.log('[CONVS-DETAIL] x conversationWith getConversationDetail', this.conversationWith)
|
|
294
|
+
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationsHandlerService)
|
|
295
|
+
// this.logger.log('[CONVS-DETAIL] x this.conv_type getConversationDetail', this.conv_type)
|
|
296
|
+
|
|
297
|
+
// if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
298
|
+
// this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
299
|
+
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
300
|
+
// })
|
|
301
|
+
// }
|
|
302
|
+
// else { //get conversation from 'conversations' firebase node
|
|
303
|
+
// this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
304
|
+
// this.logger.log('[CONVS-DETAIL] x archivedConversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
305
|
+
|
|
306
|
+
// })
|
|
307
|
+
// }
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
this.loggedUser = this.tiledeskAuthService.getCurrentUser();
|
|
312
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser);
|
|
313
|
+
this.translations();
|
|
314
|
+
// this.conversationSelected = localStorage.getItem('conversationSelected');
|
|
315
|
+
this.showButtonToBottom = false;
|
|
316
|
+
this.showMessageWelcome = false;
|
|
317
|
+
|
|
318
|
+
const appconfig = this.appConfigProvider.getConfig()
|
|
319
|
+
// this.tenant = appconfig.tenant;
|
|
320
|
+
this.tenant = appconfig.firebaseConfig.tenant;
|
|
321
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant);
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> conversationWith: ', this.conversationWith, ' -> conversationWithFullname: ', this.conversationWithFullname);
|
|
327
|
+
this.subscriptions = [];
|
|
328
|
+
this.setHeightTextArea();
|
|
329
|
+
this.tagsCanned = []; // list of canned
|
|
330
|
+
this.messages = []; // list messages of conversation
|
|
331
|
+
this.isFileSelected = false; // indicates if a file has been selected (image to upload)
|
|
332
|
+
this.openInfoMessage = false; // indicates whether the info message panel is open
|
|
333
|
+
|
|
334
|
+
if (checkPlatformIsMobile()) {
|
|
335
|
+
this.isMobile = true;
|
|
336
|
+
// this.openInfoConversation = false; // indica se è aperto il box info conversazione
|
|
337
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
|
|
338
|
+
} else {
|
|
339
|
+
this.isMobile = false;
|
|
340
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
|
|
341
|
+
// this.openInfoConversation = true;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (this.isMobile === false) {
|
|
345
|
+
if (checkWindowWidthIsLessThan991px()) {
|
|
346
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
347
|
+
this.openInfoConversation = false; // indica se è aperto il box info conversazione
|
|
348
|
+
this.isOpenInfoConversation = false;
|
|
349
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
350
|
+
} else {
|
|
351
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
352
|
+
this.openInfoConversation = true;
|
|
353
|
+
this.isOpenInfoConversation = true;
|
|
354
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
this.online = false;
|
|
359
|
+
this.lastConnectionDate = '';
|
|
360
|
+
|
|
361
|
+
// init handler vengono prima delle sottoscrizioni!
|
|
362
|
+
// this.initConversationsHandler(); // nk
|
|
363
|
+
if (this.conversationWith) {
|
|
364
|
+
this.initConversationHandler();
|
|
365
|
+
this.initGroupsHandler();
|
|
366
|
+
this.initSubscriptions();
|
|
367
|
+
}
|
|
368
|
+
this.addEventsKeyboard();
|
|
369
|
+
this.startConversation();
|
|
370
|
+
this.updateConversationBadge(); // AGGIORNO STATO DELLA CONVERSAZIONE A 'LETTA' (is_new = false)
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
returnOpenCloseInfoConversation(openInfoConversation: boolean) {
|
|
374
|
+
this.logger.log('[CONVS-DETAIL] returnOpenCloseInfoConversation - openInfoConversation ', openInfoConversation);
|
|
375
|
+
this.resizeTextArea();
|
|
376
|
+
this.openInfoMessage = false;
|
|
377
|
+
this.openInfoConversation = openInfoConversation;
|
|
378
|
+
this.isOpenInfoConversation = openInfoConversation
|
|
379
|
+
this.USER_HAS_OPENED_CLOSE_INFO_CONV = true;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@HostListener('window:resize', ['$event'])
|
|
383
|
+
onResize(event: any) {
|
|
384
|
+
const newInnerWidth = event.target.innerWidth;
|
|
385
|
+
if (newInnerWidth < 991) {
|
|
386
|
+
if (this.USER_HAS_OPENED_CLOSE_INFO_CONV === false) {
|
|
387
|
+
this.openInfoConversation = false;
|
|
388
|
+
this.isOpenInfoConversation = false;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// --------------------------------------------------------
|
|
394
|
+
// translations
|
|
395
|
+
// translationMap passed to components in the html file
|
|
396
|
+
// --------------------------------------------------------
|
|
397
|
+
public translations() {
|
|
398
|
+
const keys = [
|
|
399
|
+
'LABEL_AVAILABLE',
|
|
400
|
+
'LABEL_NOT_AVAILABLE',
|
|
401
|
+
'LABEL_TODAY',
|
|
402
|
+
'LABEL_TOMORROW',
|
|
403
|
+
'LABEL_TO',
|
|
404
|
+
'LABEL_LAST_ACCESS',
|
|
405
|
+
'ARRAY_DAYS',
|
|
406
|
+
'LABEL_ACTIVE_NOW',
|
|
407
|
+
'LABEL_IS_WRITING',
|
|
408
|
+
'LABEL_INFO_ADVANCED',
|
|
409
|
+
'ID_CONVERSATION',
|
|
410
|
+
'UPLOAD_FILE_ERROR',
|
|
411
|
+
'LABEL_ENTER_MSG',
|
|
412
|
+
'LABEL_ENTER_MSG_SHORT',
|
|
413
|
+
'LABEL_ENTER_MSG_SHORTER',
|
|
414
|
+
'ONLY_IMAGE_FILES_ARE_ALLOWED_TO_PASTE',
|
|
415
|
+
'FAILED_TO_UPLOAD_THE_FORMAT_IS NOT_SUPPORTED',
|
|
416
|
+
'NO_INFORMATION_AVAILABLE',
|
|
417
|
+
'CONTACT_ID',
|
|
418
|
+
'USER_ID'
|
|
419
|
+
];
|
|
420
|
+
|
|
421
|
+
this.translationMap = this.customTranslateService.translateLanguage(keys);
|
|
422
|
+
this.logger.log('[CONVS-DETAIL] x this.translationMap ', this.translationMap)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// --------------------------------------------------------
|
|
426
|
+
// setTranslationMapForConversationHandler
|
|
427
|
+
// --------------------------------------------------------
|
|
428
|
+
private setTranslationMapForConversationHandler(): Map<string, string> {
|
|
429
|
+
const keys = [
|
|
430
|
+
'INFO_SUPPORT_USER_ADDED_SUBJECT',
|
|
431
|
+
'INFO_SUPPORT_USER_ADDED_YOU_VERB',
|
|
432
|
+
'INFO_SUPPORT_USER_ADDED_COMPLEMENT',
|
|
433
|
+
'INFO_SUPPORT_USER_ADDED_VERB',
|
|
434
|
+
'INFO_SUPPORT_CHAT_REOPENED',
|
|
435
|
+
'INFO_SUPPORT_CHAT_CLOSED',
|
|
436
|
+
'LABEL_TODAY',
|
|
437
|
+
'LABEL_TOMORROW',
|
|
438
|
+
'LABEL_LAST_ACCESS',
|
|
439
|
+
'LABEL_TO',
|
|
440
|
+
'ARRAY_DAYS'
|
|
441
|
+
];
|
|
442
|
+
return this.customTranslateService.translateLanguage(keys);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// -------------------------------------------------------------------------------------
|
|
446
|
+
// * retrieving the handler from chatManager
|
|
447
|
+
// * if it DOESN'T EXIST I create a handler and connect and store it in the chatmanager
|
|
448
|
+
// * if IT EXISTS I connect
|
|
449
|
+
// * Upload the messages
|
|
450
|
+
// * I wait x sec if no messages arrive I display msg wellcome
|
|
451
|
+
// -------------------------------------------------------------------------------------
|
|
452
|
+
initConversationHandler() {
|
|
453
|
+
const translationMap = this.setTranslationMapForConversationHandler();
|
|
454
|
+
this.showMessageWelcome = false;
|
|
455
|
+
const handler: ConversationHandlerService = this.chatManager.getConversationHandlerByConversationId(this.conversationWith);
|
|
456
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - handler ', handler, ' conversationWith ', this.conversationWith);
|
|
457
|
+
if (!handler) {
|
|
458
|
+
this.conversationHandlerService = this.conversationHandlerBuilderService.build();
|
|
459
|
+
this.conversationHandlerService.initialize(
|
|
460
|
+
this.conversationWith,
|
|
461
|
+
this.conversationWithFullname,
|
|
462
|
+
this.loggedUser,
|
|
463
|
+
this.tenant,
|
|
464
|
+
translationMap
|
|
465
|
+
);
|
|
466
|
+
this.conversationHandlerService.connect();
|
|
467
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - NEW handler - conversationHandlerService', this.conversationHandlerService);
|
|
468
|
+
this.messages = this.conversationHandlerService.messages;
|
|
469
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - messages: ', this.messages);
|
|
470
|
+
this.chatManager.addConversationHandler(this.conversationHandlerService);
|
|
471
|
+
|
|
472
|
+
// // wait 8 second and then display the message if there are no messages
|
|
473
|
+
const that = this;
|
|
474
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages);
|
|
475
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length);
|
|
476
|
+
this.msgCount = that.messages.length
|
|
477
|
+
setTimeout(() => {
|
|
478
|
+
if (!that.messages || that.messages.length === 0) {
|
|
479
|
+
this.showIonContent = true;
|
|
480
|
+
that.showMessageWelcome = true;
|
|
481
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - showMessageWelcome: ', that.showMessageWelcome);
|
|
482
|
+
}
|
|
483
|
+
}, 8000);
|
|
484
|
+
|
|
485
|
+
} else {
|
|
486
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - conversationHandlerService ', this.conversationHandlerService, ' handler', handler);
|
|
487
|
+
this.conversationHandlerService = handler;
|
|
488
|
+
this.messages = this.conversationHandlerService.messages;
|
|
489
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - this.messages: ', this.messages);
|
|
490
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - this.showMessageWelcome: ', this.showMessageWelcome);
|
|
491
|
+
}
|
|
492
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - message ', this.messages, ' showIonContent', this.showIonContent);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
initGroupsHandler() {
|
|
497
|
+
if (this.conversationWith.startsWith("support-group") || this.conversationWith.startsWith("group-")) {
|
|
498
|
+
this.groupService.initialize(this.tenant, this.loggedUser.uid)
|
|
499
|
+
this.logger.log('[CONVS-DETAIL] - initGroupsHandler - tenant', this.tenant, ' loggedUser UID', this.loggedUser.uid);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
private setAttributes(): any {
|
|
505
|
+
const attributes: any = {
|
|
506
|
+
client: navigator.userAgent,
|
|
507
|
+
sourcePage: location.href,
|
|
508
|
+
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
//TODO: servono ???
|
|
512
|
+
if (this.loggedUser && this.loggedUser.email) {
|
|
513
|
+
attributes.userEmail = this.loggedUser.email
|
|
514
|
+
}
|
|
515
|
+
if (this.loggedUser && this.loggedUser.fullname) {
|
|
516
|
+
attributes.userFullname = this.loggedUser.fullname
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return attributes;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
// ---------------------------------
|
|
525
|
+
// startConversation
|
|
526
|
+
// ---------------------------------
|
|
527
|
+
startConversation() {
|
|
528
|
+
this.logger.log('[CONVS-DETAIL] - startConversation conversationWith: ', this.conversationWith);
|
|
529
|
+
if (this.conversationWith) {
|
|
530
|
+
this.channelType = setChannelType(this.conversationWith);
|
|
531
|
+
this.logger.log('[CONVS-DETAIL] - startConversation channelType : ', this.channelType);
|
|
532
|
+
// this.selectInfoContentTypeComponent();
|
|
533
|
+
this.setHeaderContent();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
setHeaderContent() {
|
|
538
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
539
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
540
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conv_type', this.conv_type)
|
|
541
|
+
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
542
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
543
|
+
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
544
|
+
if (conv) {
|
|
545
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv)
|
|
546
|
+
this.conversationAvatar = setConversationAvatar(
|
|
547
|
+
conv.conversation_with,
|
|
548
|
+
conv.conversation_with_fullname,
|
|
549
|
+
conv.channel_type
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar);
|
|
553
|
+
})
|
|
554
|
+
}
|
|
555
|
+
else { //get conversation from 'conversations' firebase node
|
|
556
|
+
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
557
|
+
if (conv) {
|
|
558
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, conv)
|
|
559
|
+
this.conversationAvatar = setConversationAvatar(
|
|
560
|
+
conv.conversation_with,
|
|
561
|
+
conv.conversation_with_fullname,
|
|
562
|
+
conv.channel_type
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// this.conversationAvatar = setConversationAvatar(
|
|
569
|
+
// this.conversationWith,
|
|
570
|
+
// this.conversationWithFullname,
|
|
571
|
+
// this.channelType
|
|
572
|
+
// );
|
|
573
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
returnSendMessage(e: any) {
|
|
577
|
+
this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith);
|
|
578
|
+
|
|
579
|
+
this.logger.log('[CONVS-DETAIL] - returnSendMessage event message', e.message);
|
|
580
|
+
try {
|
|
581
|
+
let message = '';
|
|
582
|
+
if (e.message) {
|
|
583
|
+
message = e.message;
|
|
584
|
+
}
|
|
585
|
+
const type = e.type;
|
|
586
|
+
const metadata = e.metadata;
|
|
587
|
+
|
|
588
|
+
this.sendMessage(message, type, metadata);
|
|
589
|
+
|
|
590
|
+
} catch (err) {
|
|
591
|
+
this.logger.error('[CONVS-DETAIL] - returnSendMessage error: ', err);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* SendMessage
|
|
598
|
+
* @param msg
|
|
599
|
+
* @param type
|
|
600
|
+
* @param metadata
|
|
601
|
+
* @param additional_attributes
|
|
602
|
+
*/
|
|
603
|
+
sendMessage(msg: string, type: string, metadata?: any, additional_attributes?: any) {
|
|
604
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - MSG: ', msg);
|
|
605
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - type: ', type);
|
|
606
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - metadata: ', metadata);
|
|
607
|
+
let fullname = this.loggedUser.uid;
|
|
608
|
+
if (this.loggedUser.fullname) {
|
|
609
|
+
fullname = this.loggedUser.fullname;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const g_attributes = this.setAttributes();
|
|
613
|
+
// added <any> to resolve the Error occurred during the npm installation: Property 'userFullname' does not exist on type '{}'
|
|
614
|
+
const attributes = <any>{};
|
|
615
|
+
if (g_attributes) {
|
|
616
|
+
for (const [key, value] of Object.entries(g_attributes)) {
|
|
617
|
+
attributes[key] = value;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (additional_attributes) {
|
|
621
|
+
for (const [key, value] of Object.entries(additional_attributes)) {
|
|
622
|
+
attributes[key] = value;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// || type === 'image'
|
|
627
|
+
if (type === 'file') {
|
|
628
|
+
|
|
629
|
+
if (msg) {
|
|
630
|
+
// msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
631
|
+
msg = `[${metadata.name}](${metadata.src})` + '\n' + msg
|
|
632
|
+
|
|
633
|
+
} else {
|
|
634
|
+
// msg = 'File: ' + metadata.src;
|
|
635
|
+
// msg = `<a href=${metadata.src} download>
|
|
636
|
+
// ${metadata.name}
|
|
637
|
+
// </a>`
|
|
638
|
+
|
|
639
|
+
// msg =  + [${metadata.name}](${metadata.src})
|
|
640
|
+
msg = `[${metadata.name}](${metadata.src})`
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// else if (type === 'image') {
|
|
645
|
+
// if (msg) {
|
|
646
|
+
// // msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
647
|
+
// msg = metadata.name + '\n' + msg
|
|
648
|
+
|
|
649
|
+
// } else {
|
|
650
|
+
|
|
651
|
+
// msg = metadata.name
|
|
652
|
+
// }
|
|
653
|
+
|
|
654
|
+
// }
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
(metadata) ? metadata = metadata : metadata = '';
|
|
658
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser);
|
|
659
|
+
|
|
660
|
+
if (msg && msg.trim() !== '' || type !== TYPE_MSG_TEXT) {
|
|
661
|
+
this.conversationHandlerService.sendMessage(
|
|
662
|
+
msg,
|
|
663
|
+
type,
|
|
664
|
+
metadata,
|
|
665
|
+
this.conversationWith,
|
|
666
|
+
this.conversationWithFullname,
|
|
667
|
+
this.loggedUser.uid,
|
|
668
|
+
fullname,
|
|
669
|
+
this.channelType,
|
|
670
|
+
attributes
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
// ----------------------------------------------------------
|
|
676
|
+
// InitSubscriptions BS subscriptions
|
|
677
|
+
// ----------------------------------------------------------
|
|
678
|
+
initSubscriptions() {
|
|
679
|
+
this.logger.log('[CONVS-DETAIL] - initSubscriptions: ', this.subscriptions);
|
|
680
|
+
|
|
681
|
+
const that = this;
|
|
682
|
+
let subscription: any;
|
|
683
|
+
let subscriptionKey: string;
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
subscriptionKey = 'BSConversationsChanged';
|
|
687
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
688
|
+
if (!subscription) {
|
|
689
|
+
subscription = this.conversationsHandlerService.conversationChanged.subscribe((data: ConversationModel) => {
|
|
690
|
+
this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid);
|
|
691
|
+
|
|
692
|
+
if (data && data.sender !== this.loggedUser.uid) {
|
|
693
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
|
|
694
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
695
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
|
|
696
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
697
|
+
// UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
698
|
+
// AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
699
|
+
if (!this.showButtonToBottom && data.is_new) { // ARE AT THE END
|
|
700
|
+
this.updateConversationBadge()
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
705
|
+
this.subscriptions.push(subscribe);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
subscriptionKey = 'messageAdded';
|
|
709
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
710
|
+
if (!subscription) {
|
|
711
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService);
|
|
712
|
+
subscription = this.conversationHandlerService.messageAdded.subscribe((msg: any) => {
|
|
713
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg);
|
|
714
|
+
if (msg) {
|
|
715
|
+
that.newMessageAdded(msg);
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
719
|
+
this.subscriptions.push(subscribe);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// IS USED ?
|
|
723
|
+
subscriptionKey = 'messageChanged';
|
|
724
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
725
|
+
if (!subscription) {
|
|
726
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged');
|
|
727
|
+
subscription = this.conversationHandlerService.messageChanged.subscribe((msg: any) => {
|
|
728
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged - msg ', msg);
|
|
729
|
+
});
|
|
730
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
731
|
+
this.subscriptions.push(subscribe);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
subscriptionKey = 'messageRemoved';
|
|
736
|
+
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
737
|
+
if (!subscription) {
|
|
738
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved');
|
|
739
|
+
subscription = this.conversationHandlerService.messageRemoved.subscribe((messageId: any) => {
|
|
740
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId);
|
|
741
|
+
});
|
|
742
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
743
|
+
this.subscriptions.push(subscribe);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// subscriptionKey = 'onGroupChange';
|
|
747
|
+
// subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
748
|
+
// if (!subscription) {
|
|
749
|
+
// subscription =
|
|
750
|
+
if (this.conversationWith.startsWith("group-")) {
|
|
751
|
+
this.groupService.onGroupChange(this.conversationWith)
|
|
752
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
753
|
+
.subscribe((groupDetail: any) => {
|
|
754
|
+
this.groupDetail = groupDetail;
|
|
755
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ', this.groupDetail)
|
|
756
|
+
}, (error) => {
|
|
757
|
+
this.logger.error('I[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error);
|
|
758
|
+
}, () => {
|
|
759
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */');
|
|
760
|
+
this.groupDetail = null
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
// const subscribe = { key: subscriptionKey, value: subscription };
|
|
764
|
+
// this.subscriptions.push(subscribe);
|
|
765
|
+
// }
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
// -------------------------------------------------
|
|
770
|
+
// addEventsKeyboard
|
|
771
|
+
// -------------------------------------------------
|
|
772
|
+
addEventsKeyboard() {
|
|
773
|
+
window.addEventListener('keyboardWillShow', () => {
|
|
774
|
+
this.logger.log('[CONVS-DETAIL] - Keyboard will Show');
|
|
775
|
+
});
|
|
776
|
+
window.addEventListener('keyboardDidShow', () => {
|
|
777
|
+
this.logger.log('[CONVS-DETAIL] - Keyboard is Shown');
|
|
778
|
+
});
|
|
779
|
+
window.addEventListener('keyboardWillHide', () => {
|
|
780
|
+
this.logger.log('[CONVS-DETAIL] - Keyboard will Hide');
|
|
781
|
+
});
|
|
782
|
+
window.addEventListener('keyboardDidHide', () => {
|
|
783
|
+
this.logger.log('[CONVS-DETAIL] - Keyboard is Hidden');
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// ----------------------------------------------------------------
|
|
788
|
+
// @ Unsubscribe all subscribed events (called in ionViewWillLeave)
|
|
789
|
+
// ----------------------------------------------------------------
|
|
790
|
+
unsubescribeAll() {
|
|
791
|
+
this.logger.log('[CONVS-DETAIL] unsubescribeAll 1: ', this.subscriptions);
|
|
792
|
+
if (this.subscriptions) {
|
|
793
|
+
this.logger.log('[CONVS-DETAIL] unsubescribeAll 2: ', this.subscriptions);
|
|
794
|
+
this.subscriptions.forEach(subscription => {
|
|
795
|
+
subscription.value.unsubscribe(); // vedere come fare l'unsubscribe!!!!
|
|
796
|
+
});
|
|
797
|
+
this.subscriptions = [];
|
|
798
|
+
|
|
799
|
+
// https://www.w3schools.com/jsref/met_element_removeeventlistener.asp
|
|
800
|
+
window.removeEventListener('keyboardWillShow', null);
|
|
801
|
+
window.removeEventListener('keyboardDidShow', null);
|
|
802
|
+
window.removeEventListener('keyboardWillHide', null);
|
|
803
|
+
window.removeEventListener('keyboardDidHide', null);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
this.unsubscribe$.next();
|
|
807
|
+
this.unsubscribe$.complete();
|
|
808
|
+
// this.conversationHandlerService.dispose();
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* newMessageAdded
|
|
814
|
+
* @param message
|
|
815
|
+
*/
|
|
816
|
+
newMessageAdded(message: MessageModel) {
|
|
817
|
+
if (message) {
|
|
818
|
+
this.logger.log('[CONVS-DETAIL] - newMessageAdded message ', message);
|
|
819
|
+
|
|
820
|
+
if (message.isSender) {
|
|
821
|
+
this.scrollBottom(0);
|
|
822
|
+
|
|
823
|
+
} else if (!message.isSender) {
|
|
824
|
+
if (this.showButtonToBottom) { // NON SONO ALLA FINE
|
|
825
|
+
this.NUM_BADGES++;
|
|
826
|
+
} else { //SONO ALLA FINE
|
|
827
|
+
this.scrollBottom(0);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
updateConversationBadge() {
|
|
834
|
+
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
835
|
+
this.conversationsHandlerService.setConversationRead(this.conversationWith)
|
|
836
|
+
} else if (this.conversationWith && this.archivedConversationsHandlerService && this.conv_type === 'archived') {
|
|
837
|
+
this.archivedConversationsHandlerService.setConversationRead(this.conversationWith)
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// -----------------------------------------------------------
|
|
842
|
+
// OUTPUT-EVENT handler
|
|
843
|
+
// -----------------------------------------------------------
|
|
844
|
+
logScrollStart(event: any) {
|
|
845
|
+
this.logger.log('[CONVS-DETAIL] logScrollStart: ', event);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
logScrolling(event: any) {
|
|
849
|
+
// EVENTO IONIC-NATIVE: SCATTA SEMPRE, QUINDI DECIDO SE MOSTRARE O MENO IL BADGE
|
|
850
|
+
// this.logger.log('[CONVS-DETAIL] logScrolling: ', event);
|
|
851
|
+
this.detectBottom()
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
logScrollEnd(event: any) {
|
|
855
|
+
// this.logger.log('[CONVS-DETAIL] logScrollEnd: ', event);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
returnChangeTextArea(e: any) {
|
|
860
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea event', e);
|
|
861
|
+
try {
|
|
862
|
+
let height: number = e.offsetHeight;
|
|
863
|
+
if (height < 50) {
|
|
864
|
+
height = 50;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
this.heightMessageTextArea = height.toString(); //e.target.scrollHeight + 20;
|
|
868
|
+
const message = e.msg;
|
|
869
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ', this.heightMessageTextArea);
|
|
870
|
+
|
|
871
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea e.detail.value', e.msg);
|
|
872
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea loggedUser uid:', this.loggedUser.uid);
|
|
873
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea loggedUser firstname:', this.loggedUser.firstname);
|
|
874
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea conversationSelected uid:', this.conversationWith);
|
|
875
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea channelType:', this.channelType);
|
|
876
|
+
let idCurrentUser = '';
|
|
877
|
+
let userFullname = '';
|
|
878
|
+
|
|
879
|
+
// serve x mantenere la compatibilità con le vecchie chat
|
|
880
|
+
// if (this.channelType === TYPE_DIRECT) {
|
|
881
|
+
// userId = this.loggedUser.uid;
|
|
882
|
+
// }
|
|
883
|
+
idCurrentUser = this.loggedUser.uid;
|
|
884
|
+
|
|
885
|
+
if (this.loggedUser.firstname && this.loggedUser.firstname !== undefined) {
|
|
886
|
+
userFullname = this.loggedUser.firstname;
|
|
887
|
+
}
|
|
888
|
+
this.typingService.setTyping(this.conversationWith, message, idCurrentUser, userFullname);
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
// ----------------------------------------------------------
|
|
893
|
+
// DISPLAY CANNED RESPONSES if message.lastIndexOf("/")
|
|
894
|
+
// ----------------------------------------------------------
|
|
895
|
+
setTimeout(() => {
|
|
896
|
+
if (this.conversationWith.startsWith("support-group")) {
|
|
897
|
+
|
|
898
|
+
const pos = message.lastIndexOf("/");
|
|
899
|
+
// console.log("[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / (using lastIndexOf) ", pos);
|
|
900
|
+
|
|
901
|
+
// test
|
|
902
|
+
// var rest = message.substring(0, message.lastIndexOf("/") + 1);
|
|
903
|
+
// var last = message.substring(message.lastIndexOf("/") + 1, message.length);
|
|
904
|
+
// console.log('[CONVS-DETAIL] - returnChangeTextArea rest', rest);
|
|
905
|
+
// console.log('[CONVS-DETAIL] - returnChangeTextArea last', last);
|
|
906
|
+
// console.log('[CONVS-DETAIL] - returnChangeTextArea last', last.length);
|
|
907
|
+
// if (last.length === 1 && last.trim() === '') {
|
|
908
|
+
// console.log('[CONVS-DETAIL] - returnChangeTextArea last is a white space ');
|
|
909
|
+
// } else if (last.length === 1 && last.trim() !== '') {
|
|
910
|
+
// console.log('[CONVS-DETAIL] - returnChangeTextArea last is NOT space ');
|
|
911
|
+
// }
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
if (pos >= 0) {
|
|
915
|
+
var strSearch = message.substr(pos + 1);
|
|
916
|
+
this.logger.log("[CONVS-DETAIL] - returnChangeTextArea - canned responses strSearch ", strSearch);
|
|
917
|
+
|
|
918
|
+
// --------------------------------------------
|
|
919
|
+
// Load canned responses
|
|
920
|
+
// --------------------------------------------
|
|
921
|
+
this.loadTagsCanned(strSearch, this.conversationWith);
|
|
922
|
+
|
|
923
|
+
// ------------------------------------------------------------------------------------------------------------------------------------------
|
|
924
|
+
// Hide / display Canned when the SLASH has POSITION POS 0 and checking if there is a space after the SLASH (in this case it will be hidden)
|
|
925
|
+
// ------------------------------------------------------------------------------------------------------------------------------------------
|
|
926
|
+
|
|
927
|
+
var after_slash = message.substring(message.lastIndexOf("/") + 1, message.length);
|
|
928
|
+
if (pos === 0 && after_slash.length === 1 && after_slash.trim() === '') {
|
|
929
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ');
|
|
930
|
+
this.HIDE_CANNED_RESPONSES = true
|
|
931
|
+
this.tagsCannedFilter = []
|
|
932
|
+
} else if (pos === 0 && after_slash.length === 0) {
|
|
933
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after');
|
|
934
|
+
this.HIDE_CANNED_RESPONSES = false
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
if (pos > 0) {
|
|
939
|
+
|
|
940
|
+
// ------------------------------------------------------------------------------------------------------------------------------------------
|
|
941
|
+
// Hide / display Canned when the SLASH has POSITION POS > and checking if there is a space after the SLASH (in this case they it be hidden)
|
|
942
|
+
// and if there is not a space before the SLASH (in this it will be hidden)
|
|
943
|
+
// ------------------------------------------------------------------------------------------------------------------------------------------
|
|
944
|
+
|
|
945
|
+
let beforeSlash = message.substr(pos - 1)
|
|
946
|
+
let afterSlash = message.substr(pos + 1)
|
|
947
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea * POS ', pos);
|
|
948
|
+
|
|
949
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash);
|
|
950
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash);
|
|
951
|
+
var afterSlashParts = afterSlash.split("/")
|
|
952
|
+
var beforeSlashParts = beforeSlash.split("/")
|
|
953
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash parts', afterSlashParts);
|
|
954
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts', beforeSlashParts);
|
|
955
|
+
|
|
956
|
+
if (beforeSlashParts.length === 2) {
|
|
957
|
+
if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === '') {
|
|
958
|
+
this.HIDE_CANNED_RESPONSES = false
|
|
959
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash there is a white space After Not');
|
|
960
|
+
// if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0].indexOf(' ') >= 0)
|
|
961
|
+
} else if (beforeSlashParts[0].indexOf(' ') < 0 && afterSlashParts[0] === '') {
|
|
962
|
+
this.HIDE_CANNED_RESPONSES = true;
|
|
963
|
+
this.tagsCannedFilter = []
|
|
964
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not');
|
|
965
|
+
} else if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === ' ') {
|
|
966
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES');
|
|
967
|
+
this.HIDE_CANNED_RESPONSES = true;
|
|
968
|
+
this.tagsCannedFilter = []
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
} else {
|
|
975
|
+
this.tagsCannedFilter = [];
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}, 300);
|
|
979
|
+
// ./ CANNED RESPONSES //
|
|
980
|
+
|
|
981
|
+
} catch (err) {
|
|
982
|
+
this.logger.error('[CONVS-DETAIL] - returnChangeTextArea - error: ', err);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// ----------------------------------------------------------
|
|
987
|
+
// @ CANNED RESPONSES methods
|
|
988
|
+
// ----------------------------------------------------------
|
|
989
|
+
loadTagsCanned(strSearch, conversationWith) {
|
|
990
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned strSearch ", strSearch);
|
|
991
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned groupDetail ", this.groupDetail);
|
|
992
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned conversationWith ", conversationWith);
|
|
993
|
+
|
|
994
|
+
const conversationWith_segments = conversationWith.split('-');
|
|
995
|
+
// Removes the last element of the array if is = to the separator
|
|
996
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
997
|
+
conversationWith_segments.pop();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
if (conversationWith_segments.length === 4) {
|
|
1001
|
+
const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
|
|
1002
|
+
this.logger.log('[CONVS-DETAIL] - lastArrayElement ', lastArrayElement);
|
|
1003
|
+
this.logger.log('[CONVS-DETAIL] - lastArrayElement length', lastArrayElement.length);
|
|
1004
|
+
if (lastArrayElement.length !== 32) {
|
|
1005
|
+
conversationWith_segments.pop();
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ", conversationWith_segments);
|
|
1010
|
+
let projectId = ""
|
|
1011
|
+
|
|
1012
|
+
if (conversationWith_segments.length === 4) {
|
|
1013
|
+
projectId = conversationWith_segments[2];
|
|
1014
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned projectId ", projectId);
|
|
1015
|
+
|
|
1016
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1017
|
+
|
|
1018
|
+
} else {
|
|
1019
|
+
this.getProjectIdByConversationWith(strSearch, this.conversationWith)
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
getProjectIdByConversationWith(strSearch, conversationWith: string) {
|
|
1024
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
1025
|
+
|
|
1026
|
+
this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe(res => {
|
|
1027
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res);
|
|
1028
|
+
if (res) {
|
|
1029
|
+
const projectId = res.id_project
|
|
1030
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId);
|
|
1031
|
+
if (projectId) {
|
|
1032
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
}, (error) => {
|
|
1037
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error);
|
|
1038
|
+
|
|
1039
|
+
}, () => {
|
|
1040
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *');
|
|
1041
|
+
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
getAndShowCannedResponses(strSearch, projectId) {
|
|
1046
|
+
|
|
1047
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
1048
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned tagsCanned.length', this.tagsCanned.length);
|
|
1049
|
+
//if(this.tagsCanned.length <= 0 ){
|
|
1050
|
+
this.tagsCanned = [];
|
|
1051
|
+
this.cannedResponsesService.getCannedResponses(tiledeskToken, projectId).subscribe(res => {
|
|
1052
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res);
|
|
1053
|
+
|
|
1054
|
+
this.tagsCanned = res
|
|
1055
|
+
|
|
1056
|
+
if (this.HIDE_CANNED_RESPONSES === false) {
|
|
1057
|
+
this.showTagsCanned(strSearch);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
}, (error) => {
|
|
1061
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error);
|
|
1062
|
+
|
|
1063
|
+
}, () => {
|
|
1064
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *');
|
|
1065
|
+
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
showTagsCanned(strSearch) {
|
|
1071
|
+
this.logger.log('[CONVS-DETAIL] - showTagsCanned strSearch ', strSearch);
|
|
1072
|
+
this.tagsCannedFilter = [];
|
|
1073
|
+
var tagsCannedClone = JSON.parse(JSON.stringify(this.tagsCanned));
|
|
1074
|
+
this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedClone ', tagsCannedClone);
|
|
1075
|
+
//this.logger.log("that.contacts lenght:: ", strSearch);
|
|
1076
|
+
this.tagsCannedFilter = this.filterItems(tagsCannedClone, strSearch);
|
|
1077
|
+
this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedFilter ', this.tagsCannedFilter);
|
|
1078
|
+
|
|
1079
|
+
this.tagsCannedFilter.sort(compareValues('title', 'asc'));
|
|
1080
|
+
var strReplace = strSearch;
|
|
1081
|
+
if (strSearch.length > 0) {
|
|
1082
|
+
strReplace = "<b class='highlight-search-string'>" + strSearch + "</b>";
|
|
1083
|
+
}
|
|
1084
|
+
for (var i = 0; i < this.tagsCannedFilter.length; i++) {
|
|
1085
|
+
|
|
1086
|
+
const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(this.tagsCannedFilter[i].text) + "</div>";
|
|
1087
|
+
this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + "</div>" + textCanned + '</div>';
|
|
1088
|
+
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
filterItems(items, searchTerm) {
|
|
1093
|
+
this.logger.log('[CONVS-DETAIL] filterItems tagsCannedClone ', items, ' searchTerm: ', searchTerm);
|
|
1094
|
+
//this.logger.log("filterItems::: ",searchTerm);
|
|
1095
|
+
return items.filter((item) => {
|
|
1096
|
+
//this.logger.log("filterItems::: ", item.title.toString().toLowerCase());
|
|
1097
|
+
this.logger.log('[CONVS-DETAIL] filtered tagsCannedClone item ', item);
|
|
1098
|
+
return item.title.toString().toLowerCase().indexOf(searchTerm.toString().toLowerCase()) > -1;
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
replacePlaceholderInCanned(str) {
|
|
1103
|
+
this.logger.log('[CONVS-DETAIL] - replacePlaceholderInCanned str ', str);
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
str = str.replace('$recipient_name', this.conversationWithFullname);
|
|
1107
|
+
|
|
1108
|
+
if (this.loggedUser && this.loggedUser.fullname) {
|
|
1109
|
+
str = str.replace('$agent_name', this.loggedUser.fullname);
|
|
1110
|
+
}
|
|
1111
|
+
return str;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
replaceTagInMessage(canned, event) {
|
|
1115
|
+
this.logger.log("[CONVS-DETAIL] replaceTagInMessage event ", event);
|
|
1116
|
+
const elTextArea = this.rowTextArea['el'];
|
|
1117
|
+
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0];
|
|
1118
|
+
|
|
1119
|
+
this.logger.log("[CONVS-DETAIL] replaceTagInMessage textArea ", textArea);
|
|
1120
|
+
this.logger.log("[CONVS-DETAIL] replaceTagInMessage textArea value", textArea.value)
|
|
1121
|
+
|
|
1122
|
+
// var lastChar = textArea.value.substr(-1); // Selects the last character
|
|
1123
|
+
// if (lastChar === '/') {
|
|
1124
|
+
// textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
|
|
1125
|
+
// }
|
|
1126
|
+
// this.insertAtCursor(this.textArea, textArea.value)
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
this.arrowkeyLocation = -1
|
|
1130
|
+
this.tagsCannedFilter = [];
|
|
1131
|
+
this.logger.log("[CONVS-DETAIL] replaceTagInMessage canned text ", canned.text);
|
|
1132
|
+
// // prendo val input
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
// replace text
|
|
1137
|
+
var pos = textArea.value.lastIndexOf("/");
|
|
1138
|
+
var strSearch = textArea.value.substr(pos);
|
|
1139
|
+
this.logger.log("[CONVS-DETAIL] replaceTagInMessage strSearch ", strSearch);
|
|
1140
|
+
|
|
1141
|
+
var strTEMP = textArea.value.replace(strSearch, canned.text);
|
|
1142
|
+
strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1143
|
+
this.logger.log("[CONVS-DETAIL] replaceTagInMessage strSearch ", strTEMP);
|
|
1144
|
+
// strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1145
|
+
// textArea.value = '';
|
|
1146
|
+
// that.messageString = strTEMP;
|
|
1147
|
+
textArea.value = strTEMP;
|
|
1148
|
+
setTimeout(() => {
|
|
1149
|
+
// textArea.focus();
|
|
1150
|
+
textArea.setFocus();
|
|
1151
|
+
this.resizeTextArea();
|
|
1152
|
+
}, 200);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
@HostListener('document:keydown', ['$event'])
|
|
1157
|
+
handleKeyboardEvent(event: KeyboardEvent) {
|
|
1158
|
+
// this.logger.log("CONVERSATION-DETAIL handleKeyboardEvent event.key ", event.key);
|
|
1159
|
+
|
|
1160
|
+
if (this.tagsCannedFilter.length > 0) {
|
|
1161
|
+
|
|
1162
|
+
if (event.key === 'ArrowDown') {
|
|
1163
|
+
|
|
1164
|
+
this.arrowkeyLocation++;
|
|
1165
|
+
if (this.arrowkeyLocation === this.tagsCannedFilter.length) {
|
|
1166
|
+
this.arrowkeyLocation--
|
|
1167
|
+
}
|
|
1168
|
+
// this.replaceTagInMessage(this.tagsCannedFilter[this.arrowkeyLocation])
|
|
1169
|
+
}
|
|
1170
|
+
else if (event.key === 'ArrowUp') {
|
|
1171
|
+
|
|
1172
|
+
if (this.arrowkeyLocation > 0) {
|
|
1173
|
+
this.arrowkeyLocation--;
|
|
1174
|
+
} else if (this.arrowkeyLocation < 0) {
|
|
1175
|
+
this.arrowkeyLocation++;
|
|
1176
|
+
}
|
|
1177
|
+
// this.replaceTagInMessage(this.tagsCannedFilter[this.arrowkeyLocation])
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
if (event.key === 'Enter') {
|
|
1181
|
+
const canned_selected = this.tagsCannedFilter[this.arrowkeyLocation]
|
|
1182
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned_selected ', canned_selected)
|
|
1183
|
+
if (canned_selected) {
|
|
1184
|
+
|
|
1185
|
+
this.replaceTagInMessage(canned_selected, 'enter')
|
|
1186
|
+
// event.preventDefault();
|
|
1187
|
+
// return false;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
// ----------------------------------------------------------
|
|
1193
|
+
// ./end CANNED RESPONSES methods
|
|
1194
|
+
// ----------------------------------------------------------
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
// ----------------------------------------------------------
|
|
1199
|
+
// @ Rule of sound message
|
|
1200
|
+
// * if I send it -> NO SOUND
|
|
1201
|
+
// * if I'm not in the conversation -> SOUND
|
|
1202
|
+
// * if I'm in the conversation at the bottom of the page -> NO SOUND
|
|
1203
|
+
// * otherwise -> SOUND
|
|
1204
|
+
// ----------------------------------------------------------
|
|
1205
|
+
soundMessage() {
|
|
1206
|
+
const that = this;
|
|
1207
|
+
this.audio = new Audio();
|
|
1208
|
+
// this.audio.src = '/assets/sounds/pling.mp3';
|
|
1209
|
+
this.audio.src = URL_SOUND_LIST_CONVERSATION;
|
|
1210
|
+
this.audio.load();
|
|
1211
|
+
this.logger.log('[CONVS-DETAIL] soundMessage conversation this.audio', this.audio);
|
|
1212
|
+
clearTimeout(this.setTimeoutSound);
|
|
1213
|
+
this.setTimeoutSound = setTimeout(function () {
|
|
1214
|
+
that.audio.play().then(() => {
|
|
1215
|
+
// Audio is playing.
|
|
1216
|
+
this.logger.log('[CONVS-DETAIL] soundMessag that.audio.src ', that.audio.src);
|
|
1217
|
+
}).catch(error => {
|
|
1218
|
+
that.logger.error(error);
|
|
1219
|
+
});
|
|
1220
|
+
}, 1000);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
returnOnBeforeMessageRender(event) {
|
|
1226
|
+
//this.onBeforeMessageRender.emit(event)
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
returnOnAfterMessageRender(event) {
|
|
1230
|
+
// this.onAfterMessageRender.emit(event)
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
returnOnMenuOption(event: boolean) {
|
|
1234
|
+
// this.isMenuShow = event;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
returnOnScrollContent(event: boolean) {
|
|
1238
|
+
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
returnOnAttachmentButtonClicked(event: any) {
|
|
1242
|
+
this.logger.debug('[CONV-COMP] eventbutton', event)
|
|
1243
|
+
if (!event || !event.target.type) {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
switch (event.target.type) {
|
|
1247
|
+
case 'url':
|
|
1248
|
+
try {
|
|
1249
|
+
this.openLink(event.target.button);
|
|
1250
|
+
} catch (err) {
|
|
1251
|
+
this.logger.error('[CONV-COMP] url > Error :' + err);
|
|
1252
|
+
}
|
|
1253
|
+
return;
|
|
1254
|
+
case 'action':
|
|
1255
|
+
try {
|
|
1256
|
+
this.actionButton(event.target.button);
|
|
1257
|
+
} catch (err) {
|
|
1258
|
+
this.logger.error('[CONV-COMP] action > Error :' + err);
|
|
1259
|
+
}
|
|
1260
|
+
return false;
|
|
1261
|
+
case 'text':
|
|
1262
|
+
try {
|
|
1263
|
+
const text = event.target.button.value
|
|
1264
|
+
const metadata = { 'button': true };
|
|
1265
|
+
this.sendMessage(text, TYPE_MSG_TEXT, metadata);
|
|
1266
|
+
} catch (err) {
|
|
1267
|
+
this.logger.error('[CONV-COMP] text > Error :' + err);
|
|
1268
|
+
}
|
|
1269
|
+
default: return;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
onImageRenderedFN(event) {
|
|
1274
|
+
const imageRendered = event;
|
|
1275
|
+
if (this.showButtonToBottom) {
|
|
1276
|
+
this.scrollBottom(0)
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
private openLink(event: any) {
|
|
1282
|
+
const link = event.link ? event.link : '';
|
|
1283
|
+
const target = event.target ? event.target : '';
|
|
1284
|
+
if (target === 'self' || target === 'parent') {
|
|
1285
|
+
window.open(link, '_parent');
|
|
1286
|
+
} else {
|
|
1287
|
+
window.open(link, '_blank');
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
private actionButton(event: any) {
|
|
1293
|
+
// console.log(event);
|
|
1294
|
+
const action = event.action ? event.action : '';
|
|
1295
|
+
const message = event.value ? event.value : '';
|
|
1296
|
+
const subtype = event.show_reply ? '' : 'info';
|
|
1297
|
+
|
|
1298
|
+
const attributes = {
|
|
1299
|
+
action: action,
|
|
1300
|
+
subtype: subtype
|
|
1301
|
+
};
|
|
1302
|
+
this.sendMessage(message, TYPE_MSG_TEXT, null, attributes);
|
|
1303
|
+
this.logger.debug('[CONV-COMP] > action :');
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
addUploadingBubbleEvent(event: boolean) {
|
|
1307
|
+
this.logger.log('[CONVS-DETAIL] addUploadingBubbleEvent event', event);
|
|
1308
|
+
if (event === true) {
|
|
1309
|
+
this.scrollBottom(0);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
onPresentModalScrollToBottom(event: boolean) {
|
|
1314
|
+
this.logger.log('[CONVS-DETAIL] onPresentModalScrollToBottom event', event);
|
|
1315
|
+
if (event === true) {
|
|
1316
|
+
this.scrollBottom(0);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// -------------- START SCROLL/RESIZE -------------- //
|
|
1321
|
+
/** */
|
|
1322
|
+
resizeTextArea() {
|
|
1323
|
+
try {
|
|
1324
|
+
const elTextArea = this.rowTextArea['el'];
|
|
1325
|
+
const that = this;
|
|
1326
|
+
setTimeout(() => {
|
|
1327
|
+
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0];
|
|
1328
|
+
if (textArea) {
|
|
1329
|
+
this.logger.log('[CONVS-DETAIL] resizeTextArea textArea ', textArea);
|
|
1330
|
+
const txtValue = textArea.value;
|
|
1331
|
+
textArea.value = ' ';
|
|
1332
|
+
textArea.value = txtValue;
|
|
1333
|
+
}
|
|
1334
|
+
}, 0);
|
|
1335
|
+
setTimeout(() => {
|
|
1336
|
+
if (elTextArea) {
|
|
1337
|
+
this.logger.log('[CONVS-DETAIL] resizeTextArea elTextArea.offsetHeight ', elTextArea.offsetHeight);
|
|
1338
|
+
that.heightMessageTextArea = elTextArea.offsetHeight;
|
|
1339
|
+
}
|
|
1340
|
+
}, 100);
|
|
1341
|
+
} catch (err) {
|
|
1342
|
+
this.logger.error('[CONVS-DETAIL] resizeTextArea - error: ', err);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
/**
|
|
1347
|
+
* scrollBottom
|
|
1348
|
+
* @param time
|
|
1349
|
+
*/
|
|
1350
|
+
private scrollBottom(time: number) {
|
|
1351
|
+
this.showIonContent = true;
|
|
1352
|
+
if (this.ionContentChatArea) {
|
|
1353
|
+
setTimeout(() => {
|
|
1354
|
+
this.ionContentChatArea.scrollToBottom(time);
|
|
1355
|
+
}, 0);
|
|
1356
|
+
// nota: se elimino il settimeout lo scrollToBottom non viene richiamato!!!!!
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* detectBottom
|
|
1362
|
+
*/
|
|
1363
|
+
async detectBottom() {
|
|
1364
|
+
const scrollElement = await this.ionContentChatArea.getScrollElement();
|
|
1365
|
+
|
|
1366
|
+
if (scrollElement.scrollTop < scrollElement.scrollHeight - scrollElement.clientHeight) {
|
|
1367
|
+
//NON SONO ALLA FINE --> mostra badge
|
|
1368
|
+
this.showButtonToBottom = true;
|
|
1369
|
+
} else {
|
|
1370
|
+
// SONO ALLA FINE --> non mostrare badge,
|
|
1371
|
+
this.showButtonToBottom = false;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Scroll to bottom of page after a short delay.
|
|
1377
|
+
* FIREBY BY: click event ScrollToBottom bottom-right icon button
|
|
1378
|
+
*/
|
|
1379
|
+
public actionScrollBottom() {
|
|
1380
|
+
this.logger.log('[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ', this.ionContentChatArea);
|
|
1381
|
+
// const that = this;
|
|
1382
|
+
this.showButtonToBottom = false;
|
|
1383
|
+
this.updateConversationBadge()
|
|
1384
|
+
this.NUM_BADGES = 0;
|
|
1385
|
+
setTimeout(() => {
|
|
1386
|
+
this.ionContentChatArea.scrollToBottom(0);
|
|
1387
|
+
// this.conversationsHandlerService.readAllMessages.next(this.conversationWith);
|
|
1388
|
+
}, 0);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Scroll to top of the page after a short delay.
|
|
1393
|
+
*/
|
|
1394
|
+
scrollTop() {
|
|
1395
|
+
this.logger.log('[CONVS-DETAIL] scrollTop');
|
|
1396
|
+
this.ionContentChatArea.scrollToTop(100);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/** */
|
|
1400
|
+
setHeightTextArea() {
|
|
1401
|
+
try {
|
|
1402
|
+
if (this.rowTextArea) {
|
|
1403
|
+
this.heightMessageTextArea = this.rowTextArea['el'].offsetHeight;
|
|
1404
|
+
this.logger.log('[CONVS-DETAIL] setHeightTextArea - heightMessageTextArea: ', this.heightMessageTextArea);
|
|
1405
|
+
}
|
|
1406
|
+
} catch (e) {
|
|
1407
|
+
this.logger.error('[CONVS-DETAIL] setHeightTextArea - ERROR ', e)
|
|
1408
|
+
// this.heightMessageTextArea = '50';
|
|
1409
|
+
this.heightMessageTextArea = '57'; // NK edited
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
checkAcceptedFile(draggedFileMimeType) {
|
|
1413
|
+
let isAcceptFile = false;
|
|
1414
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
1415
|
+
const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
|
|
1416
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - mimeType: ', draggedFileMimeType);
|
|
1417
|
+
if (accept_files === "*/*") {
|
|
1418
|
+
isAcceptFile = true;
|
|
1419
|
+
return isAcceptFile
|
|
1420
|
+
} else if (accept_files !== "*/*") {
|
|
1421
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept typeof accept_files ', typeof accept_files);
|
|
1422
|
+
const accept_files_array = accept_files.split(',')
|
|
1423
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array ', accept_files_array);
|
|
1424
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
|
|
1425
|
+
|
|
1426
|
+
accept_files_array.forEach(accept_file => {
|
|
1427
|
+
|
|
1428
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file ', accept_file);
|
|
1429
|
+
const accept_file_segment = accept_file.split('/')
|
|
1430
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file_segment ', accept_file_segment);
|
|
1431
|
+
if (accept_file_segment[1] === '*') {
|
|
1432
|
+
if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
|
|
1433
|
+
isAcceptFile = true;
|
|
1434
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile);
|
|
1435
|
+
return isAcceptFile
|
|
1436
|
+
|
|
1437
|
+
} else {
|
|
1438
|
+
isAcceptFile = false;
|
|
1439
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile);
|
|
1440
|
+
return isAcceptFile
|
|
1441
|
+
|
|
1442
|
+
}
|
|
1443
|
+
} else if (accept_file_segment[1] !== '*') {
|
|
1444
|
+
if (draggedFileMimeType === accept_file) {
|
|
1445
|
+
isAcceptFile = true;
|
|
1446
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile);
|
|
1447
|
+
return isAcceptFile
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return isAcceptFile
|
|
1451
|
+
});
|
|
1452
|
+
return isAcceptFile
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
// -------------------------------------------------------------
|
|
1456
|
+
// DRAG FILE
|
|
1457
|
+
// -------------------------------------------------------------
|
|
1458
|
+
// DROP (WHEN THE FILE IS RELEASED ON THE DROP ZONE)
|
|
1459
|
+
drop(ev: any) {
|
|
1460
|
+
ev.preventDefault();
|
|
1461
|
+
ev.stopPropagation();
|
|
1462
|
+
|
|
1463
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev ', ev);
|
|
1464
|
+
const fileList = ev.dataTransfer.files;
|
|
1465
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev.dataTransfer.files ', fileList);
|
|
1466
|
+
this.isHovering = false;
|
|
1467
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP isHovering ', this.isHovering);
|
|
1468
|
+
if (fileList.length > 0) {
|
|
1469
|
+
const file: File = fileList[0];
|
|
1470
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP file ', file);
|
|
1471
|
+
|
|
1472
|
+
var mimeType = fileList[0].type;
|
|
1473
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType);
|
|
1474
|
+
|
|
1475
|
+
// if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
|
|
1476
|
+
// this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
1477
|
+
// this.checkAcceptedFile(mimeType);
|
|
1478
|
+
const isAccepted = this.checkAcceptedFile(mimeType);
|
|
1479
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP', isAccepted);
|
|
1480
|
+
if (isAccepted === true) {
|
|
1481
|
+
this.handleDropEvent(ev);
|
|
1482
|
+
|
|
1483
|
+
} else {
|
|
1484
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType, 'NOT SUPPORTED FILE TYPE');
|
|
1485
|
+
this.presentToastOnlyImageFilesAreAllowedToDrag()
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
handleDropEvent(ev) {
|
|
1491
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - HANDLE DROP EVENT ', ev);
|
|
1492
|
+
this.dropEvent = ev
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// DRAG OVER (WHEN HOVER OVER ON THE "DROP ZONE")
|
|
1496
|
+
allowDrop(ev: any) {
|
|
1497
|
+
ev.preventDefault();
|
|
1498
|
+
ev.stopPropagation();
|
|
1499
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop ev ', ev);
|
|
1500
|
+
this.isHovering = true;
|
|
1501
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop isHovering ', this.isHovering);
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
// DRAG LEAVE (WHEN LEAVE FROM THE DROP ZONE)
|
|
1505
|
+
drag(ev: any) {
|
|
1506
|
+
ev.preventDefault();
|
|
1507
|
+
ev.stopPropagation();
|
|
1508
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragleave) drag ev ', ev);
|
|
1509
|
+
this.isHovering = false;
|
|
1510
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ', this.isHovering);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
async presentToastOnlyImageFilesAreAllowedToDrag() {
|
|
1514
|
+
const toast = await this.toastController.create({
|
|
1515
|
+
message: this.translationMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'),
|
|
1516
|
+
duration: 5000,
|
|
1517
|
+
color: "danger",
|
|
1518
|
+
cssClass: 'toast-custom-class',
|
|
1519
|
+
});
|
|
1520
|
+
toast.present();
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
|
|
1524
|
+
}
|
|
1525
|
+
// END ALL //
|