Skip to content

Commit bb49f6f

Browse files
authored
Merge pull request #1420 from Kommunicate-io/release-14.2.3-master
Release 14.2.3 master
2 parents 7d5acfe + 3dc7278 commit bb49f6f

3 files changed

Lines changed: 80 additions & 29 deletions

File tree

webplugin/js/app/km-nav-bar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ function KmNavBar(mckMsgLayout) {
3535
if (talkToHumanButton) {
3636
talkToHumanButton.disabled = false;
3737
}
38-
kommunicateCommons.show('#km-talk-to-human', '.km-option-talk-to-human');
38+
kommunicateCommons.hide('#km-talk-to-human', '.km-option-talk-to-human');
3939
} else if (HEADER_CTA.TALK_TO_HUMAN === appOptions.primaryCTA) {
40-
kommunicateCommons.hide('#km-talk-to-human');
40+
kommunicateCommons.show('#km-talk-to-human');
4141
}
4242
};
4343
}

webplugin/js/app/mck-sidebox-1.0.js

Lines changed: 69 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,48 +2613,90 @@ const firstVisibleMsg = {
26132613

26142614
function ensureConversationForFileDrop() {
26152615
if (!fileDropConversationPromise) {
2616-
var activeConversationId = getActiveConversationId();
2617-
if (activeConversationId) {
2618-
Kommunicate.openConversation(activeConversationId);
2619-
} else {
2620-
kommunicateIframe.classList.remove(
2621-
'km-iframe-dimension-with-popup',
2622-
'chat-popup-widget-horizontal'
2623-
);
2624-
2625-
kommunicateCommons.hide('#chat-popup-widget-container');
2626-
kommunicateIframe.classList.add('km-iframe-dimension-no-popup');
2627-
const conversationDetail = mckGroupLayout.createGroupDefaultSettings();
2628-
mckMessageService.createNewConversation(
2629-
conversationDetail,
2630-
function (groupId) {
2631-
/* Kommunicate.triggerEvent(KommunicateConstants.EVENT_IDS.WELCOME_MESSAGE, { "groupId": groupId, "applicationId": MCK_APP_ID });*/
2632-
console.log('Conversation created for dropped file:', groupId);
2633-
}
2634-
);
2635-
}
2616+
var expectedConversationId = null;
2617+
kommunicateIframe.classList.remove(
2618+
'km-iframe-dimension-with-popup',
2619+
'chat-popup-widget-horizontal'
2620+
);
2621+
kommunicateCommons.hide('#chat-popup-widget-container');
2622+
kommunicateCommons.setWidgetStateOpen(true);
2623+
kommunicateIframe.classList.remove('km-iframe-closed');
2624+
kommunicateIframe.classList.add('kommunicate-iframe-enable-media-query');
2625+
kommunicateCommons.hide('#applozic-badge-count');
2626+
kommunicateIframe.style.width = '';
2627+
POPUP_WIDGET
2628+
? (kommunicateIframe.classList.add('km-iframe-dimension-with-popup'),
2629+
(popUpcloseButton.style.display = 'flex'))
2630+
: kommunicateIframe.classList.add('km-iframe-dimension-no-popup');
2631+
2632+
const conversationDetail = mckGroupLayout.createGroupDefaultSettings();
26362633

26372634
fileDropConversationPromise = new Promise(function (resolve, reject) {
26382635
var isResolved = false;
2639-
var pollInterval = setInterval(function () {
2636+
var pollInterval = null;
2637+
var timeoutHandle = null;
2638+
2639+
function clearFileDropTimers() {
2640+
pollInterval && clearInterval(pollInterval);
2641+
timeoutHandle && clearTimeout(timeoutHandle);
2642+
}
2643+
2644+
function tryResolveWithActiveConversation() {
2645+
if (!expectedConversationId) {
2646+
return;
2647+
}
26402648
var activeConversationId = getActiveConversationId();
2641-
if (activeConversationId) {
2649+
if (
2650+
activeConversationId &&
2651+
String(activeConversationId) === String(expectedConversationId)
2652+
) {
26422653
isResolved = true;
2643-
clearInterval(pollInterval);
2644-
timeoutHandle && clearTimeout(timeoutHandle);
2654+
clearFileDropTimers();
26452655
resolve(activeConversationId);
26462656
}
2647-
}, FILE_DROP_CONVERSATION_POLL_INTERVAL);
2648-
var timeoutHandle = setTimeout(function () {
2657+
}
2658+
2659+
pollInterval = setInterval(
2660+
tryResolveWithActiveConversation,
2661+
FILE_DROP_CONVERSATION_POLL_INTERVAL
2662+
);
2663+
2664+
timeoutHandle = setTimeout(function () {
26492665
if (!isResolved) {
2650-
clearInterval(pollInterval);
2666+
clearFileDropTimers();
26512667
reject(
26522668
new Error(
26532669
'Timed out creating conversation for dropped file.'
26542670
)
26552671
);
26562672
}
26572673
}, FILE_DROP_CONVERSATION_TIMEOUT);
2674+
mckMessageService.createNewConversation(
2675+
conversationDetail,
2676+
function (groupId) {
2677+
// kommunicate.displayKommunicateWidget(true);
2678+
expectedConversationId = normalizeConversationId(groupId);
2679+
if (!expectedConversationId) {
2680+
isResolved = true;
2681+
clearFileDropTimers();
2682+
reject(
2683+
new Error(
2684+
'Unable to determine conversation for dropped file.'
2685+
)
2686+
);
2687+
return;
2688+
}
2689+
try {
2690+
Kommunicate.openConversation(expectedConversationId);
2691+
} catch (error) {
2692+
console.error(
2693+
'Unable to open conversation created for file drop:',
2694+
error
2695+
);
2696+
}
2697+
tryResolveWithActiveConversation();
2698+
}
2699+
);
26582700
});
26592701
}
26602702
return fileDropConversationPromise;

webplugin/template/mck-sidebox.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,15 @@ <h4 id="mck-conversation-title" class="mck-box-title mck-truncate">
260260
</div>
261261
<div id="km-business-hour-box" class="n-vis"></div>
262262
<div id="km-internet-disconnect-msg" class="km-offline-msg n-vis"></div>
263+
<div id="km-churn-customer" class="km-churn-banner n-vis">
264+
<img src="https://cdn.kommunicate.io/customer-churn.svg" />
265+
<div class="km-churn-heading">
266+
Messaging via
267+
<u><a id="deactivate-link" href="" target="_blank">Kommunicate chatbot</a></u>
268+
is disabled for this account. To enable, please contact the admin of the
269+
website. If you are the admin, get in touch at support@kommunicate.io
270+
</div>
271+
</div>
263272
<div id="km-socket-disconnect-msg" class="km-offline-msg n-vis"></div>
264273
<div id="km-local-file-system-warning" class="n-vis">
265274
<span id="km-local-file-system-warning-description">

0 commit comments

Comments
 (0)