@chat21/chat21-web-widget 5.0.56-rc.1 → 5.0.56-rc.3
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/build.yml +1 -0
- package/CHANGELOG.md +13 -0
- package/angular.json +6 -7
- package/package.json +5 -4
- package/src/app/app.component.html +1 -11
- package/src/app/app.component.scss +12 -13
- package/src/app/app.component.spec.ts +0 -2
- package/src/app/app.component.ts +29 -35
- package/src/app/app.module.ts +4 -5
- package/src/app/component/conversation-detail/conversation/conversation.component.html +1 -10
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +5 -428
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +23 -25
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +4 -63
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +11 -81
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +0 -3
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +6 -6
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +7 -32
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +11 -11
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +8 -8
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +4 -25
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +5 -5
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts +4 -88
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +7 -16
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.ts +2 -26
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +1 -11
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.scss +5 -5
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +2 -19
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +10 -42
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +1 -2
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.ts +2 -3
- package/src/app/component/form/form-builder/form-builder.component.html +0 -1
- package/src/app/component/form/form-builder/form-builder.component.scss +1 -1
- package/src/app/component/form/form-builder/form-builder.component.ts +4 -5
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +1 -2
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +2 -3
- package/src/app/component/form/inputs/form-label/form-label.component.ts +0 -1
- package/src/app/component/form/inputs/form-text/form-text.component.scss +3 -13
- package/src/app/component/form/inputs/form-text/form-text.component.ts +1 -2
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +0 -13
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +4 -4
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +0 -10
- package/src/app/component/form/prechat-form/prechat-form.component.html +0 -2
- package/src/app/component/form/prechat-form/prechat-form.component.scss +2 -2
- package/src/app/component/form/prechat-form/prechat-form.component.ts +2 -2
- package/src/app/component/home/home.component.scss +7 -7
- package/src/app/component/home/home.component.ts +1 -4
- package/src/app/component/home-conversations/home-conversations.component.scss +7 -7
- package/src/app/component/home-conversations/home-conversations.component.ts +9 -12
- package/src/app/component/last-message/last-message.component.scss +4 -4
- package/src/app/component/last-message/last-message.component.ts +4 -7
- package/src/app/component/launcher-button/launcher-button.component.ts +3 -3
- package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -2
- package/src/app/component/list-all-conversations/list-all-conversations.component.ts +3 -3
- package/src/app/component/list-conversations/list-conversations.component.html +1 -1
- package/src/app/component/list-conversations/list-conversations.component.scss +3 -3
- package/src/app/component/list-conversations/list-conversations.component.ts +3 -6
- package/src/app/component/menu-options/menu-options.component.html +1 -8
- package/src/app/component/menu-options/menu-options.component.scss +4 -4
- package/src/app/component/menu-options/menu-options.component.ts +1 -1
- package/src/app/component/message/bubble-message/bubble-message.component.html +1 -2
- package/src/app/component/message/bubble-message/bubble-message.component.scss +3 -3
- package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +0 -2
- package/src/app/component/message/bubble-message/bubble-message.component.ts +1 -14
- package/src/app/component/message/buttons/action-button/action-button.component.scss +6 -6
- package/src/app/component/message/buttons/link-button/link-button.component.scss +7 -7
- package/src/app/component/message/buttons/text-button/text-button.component.scss +8 -8
- package/src/app/component/message/frame/frame.component.scss +1 -1
- package/src/app/component/message/frame/frame.component.ts +1 -1
- package/src/app/component/message/html/html.component.scss +4 -4
- package/src/app/component/message/html/html.component.ts +1 -2
- package/src/app/component/message/image/image.component.scss +1 -1
- package/src/app/component/message/image/image.component.ts +2 -3
- package/src/app/component/message/info-message/info-message.component.html +2 -1
- package/src/app/component/message/info-message/info-message.component.scss +6 -6
- package/src/app/component/message/like-unlike/like-unlike.component.scss +1 -1
- package/src/app/component/message/like-unlike/like-unlike.component.ts +2 -2
- package/src/app/component/message/text/text.component.scss +1 -1
- package/src/app/component/message/text/text.component.ts +1 -1
- package/src/app/component/message-attachment/message-attachment.component.ts +1 -1
- package/src/app/component/selection-department/selection-department.component.scss +6 -6
- package/src/app/component/selection-department/selection-department.component.ts +2 -2
- package/src/app/component/send-button/send-button.component.ts +1 -2
- package/src/app/component/star-rating-widget/star-rating-widget.component.scss +6 -6
- package/src/app/component/star-rating-widget/star-rating-widget.component.ts +2 -2
- package/src/app/pipe/date-ago.pipe.spec.ts +8 -0
- package/src/app/pipe/date-ago.pipe.ts +42 -0
- package/src/app/providers/app-config.service.ts +0 -1
- package/src/app/providers/global-settings.service.ts +3 -31
- package/src/app/providers/star-rating-widget.service.ts +4 -4
- package/src/app/providers/translator.service.ts +3 -11
- package/src/app/providers/waiting.service.ts +2 -2
- package/src/app/sass/_variables.scss +29 -26
- package/src/app/utils/globals.ts +4 -34
- package/src/app/utils/rules.ts +5 -7
- package/src/app/utils/utils.ts +47 -37
- package/src/assets/i18n/en.json +0 -2
- package/src/assets/i18n/es.json +0 -2
- package/src/assets/i18n/fr.json +0 -2
- package/src/assets/i18n/it.json +0 -2
- package/src/assets/twp/chatbot-panel.html +4 -0
- package/src/assets/twp/index.html +2 -57
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +15 -23
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +21 -20
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +15 -13
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +16 -23
- package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +15 -11
- package/src/chat21-core/providers/firebase/firebase-image-repo.ts +13 -4
- package/src/chat21-core/providers/firebase/firebase-init-service.ts +3 -3
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +11 -9
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +14 -11
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +17 -11
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +12 -9
- package/src/chat21-core/providers/localSessionStorage.ts +2 -15
- package/src/chat21-core/providers/mqtt/chat-service.ts +12 -2
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -34
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +4 -6
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +1 -11
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +13 -7
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +3 -3
- package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +3 -3
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -1
- package/src/chat21-core/utils/user-typing/user-typing.component.scss +3 -3
- package/src/chat21-core/utils/utils.ts +46 -118
- package/src/launch.js +42 -12
- package/src/models/message.ts +0 -23
- package/src/test-new.html +0 -6
- package/src/app/providers/settings-saver.service.spec.ts +0 -17
- package/src/app/providers/settings-saver.service.ts +0 -56
- package/src/app/providers/storage.service.spec.ts +0 -16
- package/src/app/providers/storage.service.ts +0 -220
- package/src/app/utils/translations.ts +0 -122
package/src/app/utils/utils.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import * as moment from 'moment';
|
|
2
|
-
import 'moment/locale/it.js';
|
|
3
|
-
|
|
4
|
-
// firebase
|
|
5
|
-
import 'firebase/storage';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// tslint:disable-next-line:max-line-length
|
|
9
1
|
import {
|
|
10
2
|
IMG_PROFILE_BOT,
|
|
11
3
|
IMG_PROFILE_DEFAULT,
|
|
@@ -25,26 +17,26 @@ import { environment } from '../../environments/environment';
|
|
|
25
17
|
* giorno della settimana (lunedì, martedì, ecc)
|
|
26
18
|
* @deprecated
|
|
27
19
|
*/
|
|
28
|
-
export function setHeaderDate(timestamp): string {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
20
|
+
// export function setHeaderDate(timestamp): string {
|
|
21
|
+
// const date = new Date(timestamp);
|
|
22
|
+
// const now: Date = new Date();
|
|
23
|
+
// let labelDays = '';
|
|
24
|
+
// if (now.getFullYear() !== date.getFullYear()) {
|
|
25
|
+
// labelDays = date.getDay() + '/' + date.getMonth() + '/' + date.getFullYear();
|
|
26
|
+
// } else if (now.getMonth() !== date.getMonth()) {
|
|
27
|
+
// labelDays = date.getDay() + '/' + date.getMonth() + '/' + date.getFullYear();
|
|
28
|
+
// } else if (now.getDay() === date.getDay()) {
|
|
29
|
+
// labelDays = LABEL_TODAY;
|
|
30
|
+
// } else if (now.getDay() - date.getDay() === 1) {
|
|
31
|
+
// labelDays = LABEL_TOMORROW;
|
|
32
|
+
// } else {
|
|
33
|
+
// labelDays = convertDayToString(date.getDay());
|
|
34
|
+
// }
|
|
35
|
+
// // se le date sono diverse o la data di riferimento non è impostata
|
|
36
|
+
// // ritorna la data calcolata
|
|
37
|
+
// // altrimenti torna null
|
|
38
|
+
// return labelDays;
|
|
39
|
+
// }
|
|
48
40
|
|
|
49
41
|
export function supports_html5_storage() {
|
|
50
42
|
try {
|
|
@@ -228,15 +220,6 @@ export function setColorFromString(str: string) {
|
|
|
228
220
|
return arrayBckColor[num];
|
|
229
221
|
}
|
|
230
222
|
|
|
231
|
-
export function getFromNow(windowContext, timestamp) {
|
|
232
|
-
let browserLang = windowContext.navigator.language;
|
|
233
|
-
if (this.g.lang && this.g.lang !== '') {
|
|
234
|
-
browserLang = this.g.lang;
|
|
235
|
-
}
|
|
236
|
-
moment.locale(browserLang);
|
|
237
|
-
return moment.unix(timestamp).fromNow();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
223
|
export function detectIfIsMobile(windowContext) {
|
|
241
224
|
let isMobile = false;
|
|
242
225
|
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(windowContext.navigator.userAgent))
|
|
@@ -246,6 +229,33 @@ export function detectIfIsMobile(windowContext) {
|
|
|
246
229
|
return isMobile;
|
|
247
230
|
}
|
|
248
231
|
|
|
232
|
+
/**
|
|
233
|
+
* definitely not the best way to findout if there is a mobile browser
|
|
234
|
+
* @returns {any}
|
|
235
|
+
*/
|
|
236
|
+
export function deviceOS() {
|
|
237
|
+
var useragent = navigator.userAgent;
|
|
238
|
+
if(useragent.match(/Android/i)) {
|
|
239
|
+
return 'android';
|
|
240
|
+
} else if(useragent.match(/webOS/i)) {
|
|
241
|
+
return 'webos';
|
|
242
|
+
} else if(useragent.match(/iPhone/i)) {
|
|
243
|
+
return 'iphone';
|
|
244
|
+
} else if(useragent.match(/iPod/i)) {
|
|
245
|
+
return 'ipod';
|
|
246
|
+
} else if(useragent.match(/iPad/i)) {
|
|
247
|
+
return 'ipad';
|
|
248
|
+
} else if(useragent.match(/Windows Phone/i)) {
|
|
249
|
+
return 'windows phone';
|
|
250
|
+
} else if(useragent.match(/SymbianOS/i)) {
|
|
251
|
+
return 'symbian';
|
|
252
|
+
} else if(useragent.match(/RIM/i) || useragent.match(/BB/i)) {
|
|
253
|
+
return 'blackberry';
|
|
254
|
+
} else {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
249
259
|
export function convertColorToRGBA(color, opacity) {
|
|
250
260
|
let result = color;
|
|
251
261
|
// console.log('convertColorToRGBA' , color, opacity);
|
package/src/assets/i18n/en.json
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
"LABEL_PLACEHOLDER": "type your message..",
|
|
4
4
|
"LABEL_START_NW_CONV": "New conversation",
|
|
5
5
|
"LABEL_WHATSAPP": "Message us",
|
|
6
|
-
"LABEL_FIRST_MSG": "Describe shortly your problem, you will be contacted by an agent.",
|
|
7
|
-
"LABEL_FIRST_MSG_NO_AGENTS": "🤔 All operators are offline at the moment. You can anyway describe your problem. It will be assigned to the support team who will answer you as soon as possible.",
|
|
8
6
|
"LABEL_SELECT_TOPIC": "Select a topic",
|
|
9
7
|
"LABEL_COMPLETE_FORM": "Complete the form to start a conversation with the next available agent.",
|
|
10
8
|
"LABEL_FIELD_NAME": "Name",
|
package/src/assets/i18n/es.json
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
"LABEL_TU": "",
|
|
3
3
|
"LABEL_PLACEHOLDER": "escribe tu mensaje..",
|
|
4
4
|
"LABEL_START_NW_CONV": "Nueva conversación",
|
|
5
|
-
"LABEL_FIRST_MSG": "Describa brevemente su problema, un agente lo contactará.",
|
|
6
|
-
"LABEL_FIRST_MSG_NO_AGENTS": "🤔 Todos los operadores están desconectados en este momento. De todos modos puedes describir tu problema. Se asignará al equipo de soporte que le responderá lo antes posible.",
|
|
7
5
|
"LABEL_SELECT_TOPIC": "Elige un tema",
|
|
8
6
|
"LABEL_COMPLETE_FORM": "Complete el formulario para iniciar una conversación con el próximo agente disponible.",
|
|
9
7
|
"LABEL_FIELD_NAME": "Nombre",
|
package/src/assets/i18n/fr.json
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
"LABEL_TU": "",
|
|
3
3
|
"LABEL_PLACEHOLDER": "Écrivez votre question ...",
|
|
4
4
|
"LABEL_START_NW_CONV": "Nouvelle conversation",
|
|
5
|
-
"LABEL_FIRST_MSG": "Décrivez brièvement votre problème, nous vous mettrons en relation avec un opérateur spécialisé.",
|
|
6
|
-
"LABEL_FIRST_MSG_NO_AGENTS": "🤔 Tous les opérateurs sont actuellement hors ligne. Vous pouvez toujours décrire votre problème. Il sera attribué à l'équipe d'assistance qui vous répondra dans les plus brefs délais.",
|
|
7
5
|
"LABEL_SELECT_TOPIC": "Sélectionnez un sujet",
|
|
8
6
|
"LABEL_COMPLETE_FORM": "Remplissez le formulaire pour démarrer une conversation avec le prochain agent disponible.",
|
|
9
7
|
"LABEL_FIELD_NAME": "Prenom",
|
package/src/assets/i18n/it.json
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
"LABEL_TU": "",
|
|
3
3
|
"LABEL_PLACEHOLDER": "Scrivi la tua domanda...",
|
|
4
4
|
"LABEL_START_NW_CONV": "Nuova conversazione",
|
|
5
|
-
"LABEL_FIRST_MSG": "Descrivi sinteticamente il tuo problema, ti metteremo in contatto con un operatore specializzato.",
|
|
6
|
-
"LABEL_FIRST_MSG_NO_AGENTS": "🤔 Tutti gli operatori sono offline al momento.Puoi comunque descrivere il tuo problema. Sarà assegnato al team di supporto che ti risponderà appena possibile.",
|
|
7
5
|
"LABEL_SELECT_TOPIC": "Seleziona un argomento",
|
|
8
6
|
"LABEL_COMPLETE_FORM": "Completa il form per iniziare una conversazione con il prossimo agente disponibile.",
|
|
9
7
|
"LABEL_FIELD_NAME": "Nome",
|
|
@@ -285,6 +285,10 @@
|
|
|
285
285
|
fjs.parentNode.insertBefore(js, fjs);
|
|
286
286
|
}(document, 'script', 'tiledesk-jssdk'));
|
|
287
287
|
|
|
288
|
+
window.addEventListener('load', (event)=> {
|
|
289
|
+
document.dispatchEvent(new Event('mousemove'))
|
|
290
|
+
})
|
|
291
|
+
|
|
288
292
|
window.Tiledesk('onLoadParams', function(event_data) {
|
|
289
293
|
console.log("onLoadParams Tiledesk FN", event_data);
|
|
290
294
|
// window.Tiledesk('signInWithCustomToken', 'JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MDliOGVmYTg3MzJlYjAwMTQxNzYzZDlfNWU0ZWNiOThiNzhlZTQwMDE3NDA2MTEwIiwiZmlyc3RuYW1lIjoiS2VsbHkiLCJsYXN0bmFtZSI6IkdyYWNlIiwiZW1haWwiOiJncmFjZUBlbWFpbG5hLmNvIiwic3ViIjoidXNlcmV4dGVybmFsIiwiYXVkIjoiaHR0cHM6Ly90aWxlZGVzay5jb20vcHJvamVjdHMvNjA5YjhlZmE4NzMyZWIwMDE0MTc2M2Q5IiwiaWF0IjoxNjQxODAzODk0fQ.p0reTwd25p93CsDTyQa8tkihgFxThAI4DXloNc6vbXw')
|
|
@@ -180,43 +180,6 @@
|
|
|
180
180
|
|
|
181
181
|
</style>
|
|
182
182
|
|
|
183
|
-
<!-- <script type="text/javascript">
|
|
184
|
-
|
|
185
|
-
// redirect to mobile version
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* definitely not the best way to findout if there is a mobile browser
|
|
189
|
-
* @returns {any}
|
|
190
|
-
*/
|
|
191
|
-
function deviceOS() {
|
|
192
|
-
var useragent = navigator.userAgent;
|
|
193
|
-
if(useragent.match(/Android/i)) {
|
|
194
|
-
return 'android';
|
|
195
|
-
} else if(useragent.match(/webOS/i)) {
|
|
196
|
-
return 'webos';
|
|
197
|
-
} else if(useragent.match(/iPhone/i)) {
|
|
198
|
-
return 'iphone';
|
|
199
|
-
} else if(useragent.match(/iPod/i)) {
|
|
200
|
-
return 'ipod';
|
|
201
|
-
} else if(useragent.match(/iPad/i)) {
|
|
202
|
-
return 'ipad';
|
|
203
|
-
} else if(useragent.match(/Windows Phone/i)) {
|
|
204
|
-
return 'windows phone';
|
|
205
|
-
} else if(useragent.match(/SymbianOS/i)) {
|
|
206
|
-
return 'symbian';
|
|
207
|
-
} else if(useragent.match(/RIM/i) || useragent.match(/BB/i)) {
|
|
208
|
-
return 'blackberry';
|
|
209
|
-
} else {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (deviceOS()) {
|
|
215
|
-
var frameEl = document.getElementById('frame');
|
|
216
|
-
location.href = "";
|
|
217
|
-
}
|
|
218
|
-
</script> -->
|
|
219
|
-
|
|
220
183
|
<meta property="og:title" content="Try Tiledesk now!" />
|
|
221
184
|
<meta property="og:description" content="Qualify your leads to increase your sales faster. It's really easy to do it with the Tiledesk conversational form builder" />
|
|
222
185
|
<meta property="og:image" content="https://tiledesk.com/wp-content/uploads/2022/12/6029654-02-min.png" />
|
|
@@ -227,20 +190,7 @@
|
|
|
227
190
|
<script defer="" src="./tiledesk_widget_files/jquery.min.js"></script>
|
|
228
191
|
<script defer="" src="./tiledesk_widget_files/bootstrap.min.js"></script>
|
|
229
192
|
|
|
230
|
-
<!-- <script type="application/javascript">
|
|
231
|
-
window.tiledeskSettings = {
|
|
232
|
-
marginX: "100px",
|
|
233
|
-
marginY: "50px"
|
|
234
|
-
};
|
|
235
|
-
(function(d, s, id) {
|
|
236
|
-
var js, fjs = d.getElementsByTagName(s)[0];
|
|
237
|
-
if (d.getElementById(id)) return;
|
|
238
|
-
js = d.createElement(s); js.id = id; //js.async=!0;
|
|
239
|
-
js.src = "../../launch.js";
|
|
240
|
-
fjs.parentNode.insertBefore(js, fjs);
|
|
241
|
-
}(document, 'script', 'tiledesk-jssdk'));
|
|
242
193
|
|
|
243
|
-
</script> -->
|
|
244
194
|
<script type="application/javascript">
|
|
245
195
|
window.tiledeskSettings = {
|
|
246
196
|
marginX: "100px",
|
|
@@ -306,10 +256,6 @@
|
|
|
306
256
|
|
|
307
257
|
window.Tiledesk('onAuthStateChanged', function(event_data) {
|
|
308
258
|
console.log("AUTHENTICATED!", event_data);
|
|
309
|
-
// if(event_data.detail.isLogged){
|
|
310
|
-
// console.log("isLogged!!!!", event_data);
|
|
311
|
-
// window.Tiledesk('show')
|
|
312
|
-
// }
|
|
313
259
|
});
|
|
314
260
|
</script>
|
|
315
261
|
|
|
@@ -549,9 +495,9 @@
|
|
|
549
495
|
</a>
|
|
550
496
|
|
|
551
497
|
<!-- whatsapp -->
|
|
552
|
-
|
|
498
|
+
<a onclick="shareOnWhatsapp()" style="cursor: pointer">
|
|
553
499
|
<img src="./tiledesk_widget_files/whatsapp.png" alt="Whatsapp">
|
|
554
|
-
</a>
|
|
500
|
+
</a>
|
|
555
501
|
|
|
556
502
|
</div>
|
|
557
503
|
</div>
|
|
@@ -598,7 +544,6 @@
|
|
|
598
544
|
<link href="./tiledesk_widget_files/bootstrap.min.css" rel="stylesheet" type="text/css">
|
|
599
545
|
<!-- <link href="./tiledesk_widget_files/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
|
|
600
546
|
<link href="./tiledesk_widget_files/website-poly.min.css" rel="stylesheet" type="text/css">
|
|
601
|
-
<!-- <link href="./tiledesk_widget_files/css" rel="stylesheet" type="text/css"> -->
|
|
602
547
|
</div>
|
|
603
548
|
</body>
|
|
604
549
|
</html>
|
|
@@ -3,18 +3,14 @@ import { BehaviorSubject, Subscription } from 'rxjs';
|
|
|
3
3
|
|
|
4
4
|
// firebase
|
|
5
5
|
// import * as firebase from 'firebase/app';
|
|
6
|
-
import firebase from 'firebase/app';
|
|
7
|
-
import 'firebase/messaging';
|
|
8
|
-
import 'firebase/database';
|
|
9
|
-
import 'firebase/auth';
|
|
10
|
-
import 'firebase/storage';
|
|
6
|
+
// import firebase from 'firebase/app';
|
|
11
7
|
|
|
12
8
|
// models
|
|
13
9
|
import { ConversationModel } from '../../models/conversation';
|
|
14
10
|
|
|
15
11
|
// utils
|
|
16
12
|
import { avatarPlaceholder, getColorBck } from '../../utils/utils-user';
|
|
17
|
-
import { compareValues,
|
|
13
|
+
import { compareValues, searchIndexInArrayForUid, archivedConversationsPathForUserId, isGroup } from '../../utils/utils';
|
|
18
14
|
import { ArchivedConversationsHandlerService } from '../abstract/archivedconversations-handler.service';
|
|
19
15
|
import { LoggerService } from '../abstract/logger.service';
|
|
20
16
|
import { LoggerInstance } from '../logger/loggerInstance';
|
|
@@ -44,10 +40,12 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
44
40
|
private translationMap: Map<string, string>;
|
|
45
41
|
private isConversationClosingMap: Map<string, boolean>;
|
|
46
42
|
private logger:LoggerService = LoggerInstance.getInstance()
|
|
47
|
-
private ref: firebase.database.Query;
|
|
43
|
+
// private ref: firebase.database.Query;
|
|
44
|
+
|
|
48
45
|
|
|
49
46
|
private subscribe: any;
|
|
50
|
-
|
|
47
|
+
private firebase: any;
|
|
48
|
+
private ref: any;
|
|
51
49
|
constructor(
|
|
52
50
|
//public databaseProvider: DatabaseProvider
|
|
53
51
|
) {
|
|
@@ -57,12 +55,17 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
57
55
|
/**
|
|
58
56
|
* inizializzo conversations handler
|
|
59
57
|
*/
|
|
60
|
-
initialize(tenant: string,userId: string,translationMap: Map<string, string>) {
|
|
58
|
+
async initialize(tenant: string,userId: string,translationMap: Map<string, string>) {
|
|
61
59
|
this.tenant = tenant;
|
|
62
60
|
this.loggedUserId = userId;
|
|
63
61
|
this.translationMap = translationMap;
|
|
64
62
|
this.archivedConversations = [];
|
|
65
63
|
this.isConversationClosingMap = new Map();
|
|
64
|
+
|
|
65
|
+
const { default: firebase} = await import("firebase/app");
|
|
66
|
+
await Promise.all([import("firebase/database"), import("firebase/auth")]);
|
|
67
|
+
this.firebase = firebase
|
|
68
|
+
this.ref = this.firebase.database['Query'];
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/**
|
|
@@ -94,7 +97,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
94
97
|
const that = this;
|
|
95
98
|
const urlNodeFirebase = archivedConversationsPathForUserId(this.tenant, this.loggedUserId);
|
|
96
99
|
this.logger.debug('[FIREBASEArchivedConversationsHandlerSERVICE] SubscribeToConversations conversations::ARCHIVED urlNodeFirebase', urlNodeFirebase)
|
|
97
|
-
this.ref = firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
|
|
100
|
+
this.ref = this.firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
|
|
98
101
|
this.ref.on('child_changed', (childSnapshot) => {
|
|
99
102
|
that.changed(childSnapshot);
|
|
100
103
|
});
|
|
@@ -134,7 +137,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
134
137
|
const urlUpdate = archivedConversationsPathForUserId(this.tenant, this.loggedUserId) + '/' + conversationrecipient;
|
|
135
138
|
const update = {};
|
|
136
139
|
update['/is_new'] = false;
|
|
137
|
-
firebase.database().ref(urlUpdate).update(update);
|
|
140
|
+
this.firebase.database().ref(urlUpdate).update(update);
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
|
|
@@ -173,7 +176,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
173
176
|
} else {
|
|
174
177
|
const urlNodeFirebase = archivedConversationsPathForUserId(this.tenant, this.loggedUserId) // + '/' + conversationId;
|
|
175
178
|
this.logger.debug('[FIREBASEArchivedConversationsHandlerSERVICE] urlNodeFirebase conversationDetail *****', urlNodeFirebase, conversationId)
|
|
176
|
-
const firebaseMessages = firebase.database().ref(urlNodeFirebase);
|
|
179
|
+
const firebaseMessages = this.firebase.database().ref(urlNodeFirebase);
|
|
177
180
|
// if(this.subscribe){
|
|
178
181
|
// this.logger.log('[FIREBASEArchivedConversationsHandlerSERVICE] getConversationDetail ALREADY SUBSCRIBED')
|
|
179
182
|
// return;
|
|
@@ -363,17 +366,6 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
363
366
|
return status;
|
|
364
367
|
}
|
|
365
368
|
|
|
366
|
-
/**
|
|
367
|
-
* calcolo il tempo trascorso da ora al timestamp passato
|
|
368
|
-
* @param timestamp
|
|
369
|
-
*/
|
|
370
|
-
private getTimeLastMessage(timestamp: string) {
|
|
371
|
-
const timestampNumber = parseInt(timestamp, 10) / 1000;
|
|
372
|
-
const time = getFromNow(timestampNumber);
|
|
373
|
-
return time;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
377
369
|
/**
|
|
378
370
|
* check if the conversations is valid or not
|
|
379
371
|
*/
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { environment } from 'src/environments/environment';
|
|
1
2
|
import { Injectable } from '@angular/core';
|
|
2
3
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
3
4
|
import { BehaviorSubject } from 'rxjs';
|
|
4
5
|
|
|
5
6
|
// firebase
|
|
6
|
-
import firebase from 'firebase/app';
|
|
7
|
-
import 'firebase/messaging';
|
|
8
|
-
import 'firebase/database';
|
|
9
|
-
import 'firebase/auth';
|
|
10
|
-
import 'firebase/storage';
|
|
7
|
+
// import firebase from 'firebase/app';
|
|
11
8
|
|
|
12
9
|
// services
|
|
13
10
|
import { MessagingAuthService } from '../abstract/messagingAuth.service';
|
|
@@ -35,6 +32,7 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
35
32
|
// private imageRepo: ImageRepoService = new FirebaseImageRepoService();
|
|
36
33
|
|
|
37
34
|
private firebaseToken: string;
|
|
35
|
+
private firebase: any;
|
|
38
36
|
private logger:LoggerService = LoggerInstance.getInstance()
|
|
39
37
|
constructor(
|
|
40
38
|
public http: HttpClient
|
|
@@ -45,14 +43,16 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
45
43
|
/**
|
|
46
44
|
*
|
|
47
45
|
*/
|
|
48
|
-
initialize() {
|
|
46
|
+
async initialize() {
|
|
49
47
|
this.SERVER_BASE_URL = this.getBaseUrl();
|
|
50
48
|
this.URL_TILEDESK_CREATE_CUSTOM_TOKEN = this.SERVER_BASE_URL + 'chat21/firebase/auth/createCustomToken';
|
|
51
49
|
this.logger.debug('[FIREBASEAuthSERVICE] - initialize URL_TILEDESK_CREATE_CUSTOM_TOKEN ', this.URL_TILEDESK_CREATE_CUSTOM_TOKEN)
|
|
52
|
-
// this.URL_TILEDESK_SIGNIN = this.SERVER_BASE_URL + 'auth/signin';
|
|
53
|
-
// this.URL_TILEDESK_SIGNIN_ANONYMOUSLY = this.SERVER_BASE_URL + 'auth/signinAnonymously'
|
|
54
|
-
// this.URL_TILEDESK_SIGNIN_WITH_CUSTOM_TOKEN = this.SERVER_BASE_URL + 'auth/signinWithCustomToken';
|
|
55
50
|
// this.checkIsAuth();
|
|
51
|
+
|
|
52
|
+
const { default: firebase} = await import("firebase/app");
|
|
53
|
+
await Promise.all([import("firebase/auth")]);
|
|
54
|
+
this.firebase = firebase
|
|
55
|
+
|
|
56
56
|
this.onAuthStateChanged();
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -93,7 +93,8 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
93
93
|
*/
|
|
94
94
|
onAuthStateChanged() {
|
|
95
95
|
const that = this;
|
|
96
|
-
|
|
96
|
+
|
|
97
|
+
this.firebase.auth().onAuthStateChanged(user => {
|
|
97
98
|
this.logger.debug('[FIREBASEAuthSERVICE] onAuthStateChanged', user)
|
|
98
99
|
if (!user) {
|
|
99
100
|
this.logger.debug('[FIREBASEAuthSERVICE] 1 - PUBLISH OFFLINE to chat-manager')
|
|
@@ -114,24 +115,24 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
114
115
|
let firebasePersistence;
|
|
115
116
|
switch (this.getPersistence()) {
|
|
116
117
|
case 'SESSION': {
|
|
117
|
-
firebasePersistence = firebase.auth.Auth.Persistence.SESSION;
|
|
118
|
+
firebasePersistence = this.firebase.auth.Auth.Persistence.SESSION;
|
|
118
119
|
break;
|
|
119
120
|
}
|
|
120
121
|
case 'LOCAL': {
|
|
121
|
-
firebasePersistence = firebase.auth.Auth.Persistence.LOCAL;
|
|
122
|
+
firebasePersistence = this.firebase.auth.Auth.Persistence.LOCAL;
|
|
122
123
|
break;
|
|
123
124
|
}
|
|
124
125
|
case 'NONE': {
|
|
125
|
-
firebasePersistence = firebase.auth.Auth.Persistence.NONE;
|
|
126
|
+
firebasePersistence = this.firebase.auth.Auth.Persistence.NONE;
|
|
126
127
|
break;
|
|
127
128
|
}
|
|
128
129
|
default: {
|
|
129
|
-
firebasePersistence = firebase.auth.Auth.Persistence.NONE;
|
|
130
|
+
firebasePersistence = this.firebase.auth.Auth.Persistence.NONE;
|
|
130
131
|
break;
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
return firebase.auth().setPersistence(firebasePersistence).then(async () => {
|
|
134
|
-
return firebase.auth().signInWithCustomToken(token).then(async () => {
|
|
134
|
+
return this.firebase.auth().setPersistence(firebasePersistence).then(async () => {
|
|
135
|
+
return this.firebase.auth().signInWithCustomToken(token).then(async () => {
|
|
135
136
|
// that.firebaseSignInWithCustomToken.next(response);
|
|
136
137
|
}).catch((error) => {
|
|
137
138
|
that.logger.error('[FIREBASEAuthSERVICE] signInFirebaseWithCustomToken Error: ', error);
|
|
@@ -151,7 +152,7 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
151
152
|
*/
|
|
152
153
|
createUserWithEmailAndPassword(email: string, password: string): any {
|
|
153
154
|
const that = this;
|
|
154
|
-
return firebase.auth().createUserWithEmailAndPassword(email, password).then((response) => {
|
|
155
|
+
return this.firebase.auth().createUserWithEmailAndPassword(email, password).then((response) => {
|
|
155
156
|
that.logger.debug('[FIREBASEAuthSERVICE] CRATE USER WITH EMAIL: ', email, ' & PSW: ', password);
|
|
156
157
|
// that.firebaseCreateUserWithEmailAndPassword.next(response);
|
|
157
158
|
return response;
|
|
@@ -167,7 +168,7 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
167
168
|
*/
|
|
168
169
|
sendPasswordResetEmail(email: string): any {
|
|
169
170
|
const that = this;
|
|
170
|
-
return firebase.auth().sendPasswordResetEmail(email).then(() => {
|
|
171
|
+
return this.firebase.auth().sendPasswordResetEmail(email).then(() => {
|
|
171
172
|
that.logger.debug('[FIREBASEAuthSERVICE] firebase-send-password-reset-email');
|
|
172
173
|
// that.firebaseSendPasswordResetEmail.next(email);
|
|
173
174
|
}).catch((error) => {
|
|
@@ -180,7 +181,7 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
180
181
|
*/
|
|
181
182
|
private signOut(): Promise<boolean> {
|
|
182
183
|
const that = this;
|
|
183
|
-
return new Promise((resolve, reject)=> {firebase.auth().signOut().then(() => {
|
|
184
|
+
return new Promise((resolve, reject)=> {this.firebase.auth().signOut().then(() => {
|
|
184
185
|
that.logger.debug('[FIREBASEAuthSERVICE] firebase-sign-out');
|
|
185
186
|
// cancello token
|
|
186
187
|
// this.appStorage.removeItem('tiledeskToken');
|
|
@@ -200,7 +201,7 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
200
201
|
*/
|
|
201
202
|
delete() {
|
|
202
203
|
const that = this;
|
|
203
|
-
firebase.auth().currentUser.delete().then(() => {
|
|
204
|
+
this.firebase.auth().currentUser.delete().then(() => {
|
|
204
205
|
that.logger.debug('[FIREBASEAuthSERVICE] firebase-current-user-delete');
|
|
205
206
|
// that.firebaseCurrentUserDelete.next();
|
|
206
207
|
}).catch((error) => {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { LIVE_PAGE, MEMBER_LEFT_GROUP, TOUCHING_OPERATOR } from './../../utils/constants';
|
|
2
|
-
import { CustomLogger } from './../logger/customLogger';
|
|
3
2
|
|
|
4
|
-
import { Inject, Injectable
|
|
3
|
+
import { Inject, Injectable } from '@angular/core';
|
|
5
4
|
import { BehaviorSubject } from 'rxjs';
|
|
6
5
|
|
|
7
6
|
// firebase
|
|
8
|
-
import firebase from 'firebase/app';
|
|
9
|
-
import 'firebase/messaging';
|
|
10
|
-
import 'firebase/database';
|
|
11
|
-
import 'firebase/firestore';
|
|
7
|
+
// import firebase from 'firebase/app';
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
// models
|
|
@@ -60,7 +56,10 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
60
56
|
private CLIENT_BROWSER: string;
|
|
61
57
|
private startTime: Date = new Date();
|
|
62
58
|
private logger:LoggerService = LoggerInstance.getInstance()
|
|
63
|
-
private ref: firebase.database.Query;
|
|
59
|
+
// private ref: firebase.database.Query;
|
|
60
|
+
|
|
61
|
+
private firebase: any;
|
|
62
|
+
private ref: any;
|
|
64
63
|
|
|
65
64
|
constructor(@Inject('skipMessage') private skipInfoMessage: boolean) {
|
|
66
65
|
super();
|
|
@@ -69,7 +68,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
69
68
|
/**
|
|
70
69
|
* inizializzo conversation handler
|
|
71
70
|
*/
|
|
72
|
-
initialize(recipientId: string,recipientFullName: string,loggedUser: UserModel,
|
|
71
|
+
async initialize(recipientId: string,recipientFullName: string,loggedUser: UserModel,
|
|
73
72
|
tenant: string, translationMap: Map<string, string>, showInfoMessage: string[]) {
|
|
74
73
|
this.logger.debug('[FIREBASEConversationHandlerSERVICE] initWithRecipient',recipientId, recipientFullName, loggedUser, tenant, translationMap)
|
|
75
74
|
this.recipientId = recipientId;
|
|
@@ -87,6 +86,9 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
87
86
|
this.messages = [];
|
|
88
87
|
this.showInfoMessage = showInfoMessage
|
|
89
88
|
// this.attributes = this.setAttributes();
|
|
89
|
+
const { default: firebase} = await import("firebase/app");
|
|
90
|
+
this.firebase = firebase
|
|
91
|
+
this.ref = this.firebase.database['Query'];
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
/**
|
|
@@ -100,7 +102,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
100
102
|
this.urlNodeFirebase = conversationMessagesRef(this.tenant, this.loggedUser.uid);
|
|
101
103
|
this.urlNodeFirebase = this.urlNodeFirebase + this.conversationWith;
|
|
102
104
|
this.logger.debug('[FIREBASEConversationHandlerSERVICE] urlNodeFirebase *****', this.urlNodeFirebase);
|
|
103
|
-
const firebaseMessages = firebase.database().ref(this.urlNodeFirebase);
|
|
105
|
+
const firebaseMessages = this.firebase.database().ref(this.urlNodeFirebase);
|
|
104
106
|
this.ref = firebaseMessages.orderByChild('timestamp').limitToLast(100);
|
|
105
107
|
this.ref.on('child_added', (childSnapshot) => {
|
|
106
108
|
that.logger.debug('[FIREBASEConversationHandlerSERVICE] >>>>>>>>>>>>>> child_added: ', childSnapshot.val())
|
|
@@ -151,12 +153,12 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
151
153
|
if (!channelType || channelType === 'undefined') {
|
|
152
154
|
channelType = TYPE_DIRECT;
|
|
153
155
|
}
|
|
154
|
-
const firebaseMessagesCustomUid = firebase.database().ref(this.urlNodeFirebase);
|
|
156
|
+
const firebaseMessagesCustomUid = this.firebase.database().ref(this.urlNodeFirebase);
|
|
155
157
|
|
|
156
158
|
// const key = messageRef.key;
|
|
157
159
|
const lang = document.documentElement.lang;
|
|
158
160
|
const recipientFullname = conversationWithFullname;
|
|
159
|
-
const timestamp = firebase.database.ServerValue.TIMESTAMP
|
|
161
|
+
const timestamp = this.firebase.database.ServerValue.TIMESTAMP
|
|
160
162
|
const message = new MessageModel(
|
|
161
163
|
'',
|
|
162
164
|
lang,
|
|
@@ -183,7 +185,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
183
185
|
status: 0,
|
|
184
186
|
metadata: metadataMsg,
|
|
185
187
|
text: msg,
|
|
186
|
-
timestamp: firebase.database.ServerValue.TIMESTAMP,
|
|
188
|
+
timestamp: this.firebase.database.ServerValue.TIMESTAMP,
|
|
187
189
|
type: typeMsg,
|
|
188
190
|
attributes: attributes,
|
|
189
191
|
channel_type: channelType
|
|
@@ -447,7 +449,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
447
449
|
if (msg.sender !== this.loggedUser.uid && msg.status < MSG_STATUS_RECEIVED) {
|
|
448
450
|
const urlNodeMessagesUpdate = this.urlNodeFirebase + '/' + uid;
|
|
449
451
|
this.logger.debug('[FIREBASEConversationHandlerSERVICE] update message status', urlNodeMessagesUpdate);
|
|
450
|
-
firebase.database().ref(urlNodeMessagesUpdate).update({ status: MSG_STATUS_RECEIVED });
|
|
452
|
+
this.firebase.database().ref(urlNodeMessagesUpdate).update({ status: MSG_STATUS_RECEIVED });
|
|
451
453
|
}
|
|
452
454
|
}
|
|
453
455
|
}
|