Skip to content

Commit 8b301e0

Browse files
Merge pull request #603 from Kommunicate-io/plugin-6.5
Release 6.5 [04-02-2021]
2 parents af92277 + 821d236 commit 8b301e0

14 files changed

+629
-333
lines changed

webplugin/css/app/km-rich-message.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,3 +1314,7 @@
13141314
.mck-rich-video-container video {
13151315
object-fit: initial;
13161316
}
1317+
.mck-rich-video-container video, .mck-rich-video-iframe, .km-template-video-caption-wrapper {
1318+
min-width: 160px;
1319+
max-width: 100%;
1320+
}

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

Lines changed: 104 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5082,6 +5082,9 @@ box-shadow: 0 0 4px rgba(0,0,0,.22), 0 4px 8px rgba(0,0,0,.31);
50825082
.mck-closed-conv-banner{
50835083
background-color: #f6f5f5;
50845084
}
5085+
.km-mid-conv-csat{
5086+
background-color: #f6f5f5;
5087+
}
50855088
#mck-conversation-status-box{
50865089
padding: 20px 0px 20px 0px;
50875090
font-size: 14px;
@@ -5413,6 +5416,58 @@ div#mck-waiting-queue {
54135416
padding: 12px 5px 13px 5px;
54145417
border-top: 1px dashed #CAD3E3;
54155418
}
5419+
.km-csat-skeleton {
5420+
padding: 0 10px;
5421+
position: relative;
5422+
}
5423+
5424+
.km-csat-skeleton .mck-rated {
5425+
text-align: center;
5426+
font-size: 13px;
5427+
font-weight: 300;
5428+
color: #000;
5429+
position: absolute;
5430+
width: 95%;
5431+
overflow: hidden;
5432+
padding: 3px 0px;
5433+
}
5434+
5435+
.km-csat-skeleton .mck-rated span svg {
5436+
height: 16px;
5437+
width: 16px;
5438+
margin: 0 5px -4px 3px;
5439+
}
5440+
5441+
.km-csat-skeleton .mck-rated:after,
5442+
.km-csat-skeleton .mck-rated:before {
5443+
content: "";
5444+
position: absolute;
5445+
height: 8px;
5446+
border-top: 1px solid #e2e2e2;
5447+
top: 50%;
5448+
width: 600px;
5449+
z-index: 0;
5450+
}
5451+
5452+
.km-csat-skeleton .mck-rated:after {
5453+
left: 79%;
5454+
}
5455+
5456+
.km-csat-skeleton .mck-rated:before {
5457+
right: 80%;
5458+
}
5459+
5460+
.km-csat-skeleton .mck-conversation-comment {
5461+
background: white;
5462+
padding: 30px 10px 10px;
5463+
text-align: center;
5464+
margin: 0 -15px;
5465+
font-weight: 300;
5466+
font-style: italic;
5467+
letter-spacing: 0.3px;
5468+
color: #676262;
5469+
font-size: 14px;
5470+
}
54165471

54175472
div#mck-rated {
54185473
text-align: center;
@@ -5475,12 +5530,15 @@ div#mck-rated:before{
54755530

54765531
#mck-submit-comment {
54775532
margin-top: 10px;
5478-
padding: 10px;
5479-
width: 100%;
5533+
padding: 10px;
5534+
width: 100%;
54805535
border-radius: 4px;
54815536
color: #fff;
5482-
font-size: 15px;
5537+
font-size: 15px;
5538+
border: none;
5539+
background: #5553b7;
54835540
}
5541+
54845542
#mck-submit-comment:disabled {
54855543
opacity:0.5;
54865544
cursor: default;
@@ -6078,4 +6136,47 @@ body.accesibility :focus {
60786136
}
60796137
#mck-conversation-filter span:last-child:hover{
60806138
text-decoration: underline;
6139+
}
6140+
6141+
#km-widget-options {
6142+
position: relative;
6143+
border-radius: 4px;
6144+
}
6145+
6146+
#km-widget-options.open {
6147+
background: #11101050;
6148+
}
6149+
6150+
#km-widget-options:hover {
6151+
cursor: pointer;
6152+
}
6153+
6154+
#km-widget-options .mck-dropdown-menu {
6155+
top: 40px;
6156+
border-radius: 4px;
6157+
}
6158+
6159+
#km-widget-options .mck-dropdown-menu::before {
6160+
content: none;
6161+
}
6162+
6163+
#km-widget-options .mck-dropdown-menu .menu-item {
6164+
padding: 5px 10px;
6165+
color: #333;
6166+
white-space: nowrap;
6167+
display: flex;
6168+
}
6169+
6170+
#km-widget-options .mck-dropdown-menu .menu-item:hover {
6171+
background: #F5F5F5;
6172+
}
6173+
6174+
.km-widget-options-button {
6175+
margin-right: 10px;
6176+
padding: 10px 0;
6177+
height: 100%;
6178+
max-height: 35px;
6179+
width: 100%;
6180+
border: 0;
6181+
text-align: center;
60816182
}

webplugin/js/app/km-rich-text-event-handler.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ Kommunicate.richMsgEventHandler = {
371371
return ;
372372
}
373373
var data = {};
374+
var postBackData = {};
374375
var isActionableForm = (form.className.indexOf("mck-actionable-form") != -1 );
376+
var postBackToKommunicate = isActionableForm ? JSON.parse(target.dataset.postBackToKommunicate.toLowerCase()) : false ;
375377
var replyText = target.title || target.innerHTML;
376378
var formElements = [];
377379
formElements = Array.prototype.concat.apply(formElements, form.getElementsByTagName('input'));
@@ -415,6 +417,9 @@ Kommunicate.richMsgEventHandler = {
415417
console.log(e);
416418
}
417419
}
420+
if(KommunicateConstants.FORM_POST_BACK_MESSAGE_UNSUPPORTED_FIELDS.indexOf(type) == -1) {
421+
postBackData[name] = data[name];
422+
}
418423
}
419424
if(isActionableForm && validationResults.indexOf("failed") != -1 ) {
420425
return;
@@ -440,6 +445,8 @@ Kommunicate.richMsgEventHandler = {
440445
replyText && (messagePxy.message = replyText); //message to send
441446

442447
(isActionableForm && requestType == KommunicateConstants.POST_BACK_TO_BOT_PLATFORM) && (msgMetadata["KM_CHAT_CONTEXT"]= {"formData":data});
448+
var formDataMessageTemplate = postBackToKommunicate && Kommunicate.markup.getFormDataMessageTemplate(postBackData);
449+
formDataMessageTemplate && Kommunicate.sendMessage({message: formDataMessageTemplate, type: KommunicateConstants.MESSAGE_CONTENT_TYPE.TEXT_HTML});
443450
Object.keys(msgMetadata).length > 0 && (messagePxy["metadata"] = msgMetadata);
444451
(Object.keys(msgMetadata).length > 0 || Object.keys(messagePxy).length > 0 ) && Kommunicate.sendMessage(messagePxy);
445452
},

webplugin/js/app/km-richtext-markup-1.0.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ getFormTemplate: function() {
365365
{{/payload}}
366366
</div>
367367
{{#buttons}}
368-
<button type="{{type}}" class="km-cta-button km-custom-widget-text-color km-custom-widget-border-color mck-form-submit-button" data-requesttype="{{requestType}}" title="{{message}}" >{{label}}</button>
368+
<button type="{{type}}" class="km-cta-button km-custom-widget-text-color km-custom-widget-border-color mck-form-submit-button" data-requesttype="{{requestType}}" title="{{message}}" data-post-back-to-kommunicate="{{postBackToKommunicate}}">{{label}}</button>
369369
{{/buttons}}
370370
</form>
371371
</div>`
@@ -388,6 +388,14 @@ getVideoTemplate: function() {
388388
{{/caption}}
389389
{{/payload}}
390390
</div>`
391+
},
392+
getFormDataMessageTemplate: function(data){
393+
var element = "";
394+
Object.keys(data).forEach(function(key) {
395+
var value = data[key];
396+
value && (element += '<span>'+key+ " : "+value+'</span><br>');
397+
});
398+
return element;
391399
}
392400

393401
};
@@ -596,6 +604,7 @@ Kommunicate.markup.getActionableFormMarkup = function(options) {
596604
isActionObject = kommunicateCommons.isObject(item.action);
597605
options.actionUrl = item.formAction || (isActionObject && item.action.formAction) || "javascript:void(0);";
598606
options.requestType = item.requestType || (isActionObject && item.action.requestType) ;
607+
options.postBackToKommunicate = item.action.postBackToKommunicate || false;
599608
options.label = item.name || item.label;
600609
options.message = item.message || (isActionObject && item.action.message);
601610
options.payload[index].className = "km-cta-button";

webplugin/js/app/km-utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ KommunicateConstants = {
127127
VIDEO: "14",
128128
},
129129
FORM_SUPPORTED_FIELDS: ["text", "hidden", "radio", "checkbox", "dropdown", "textarea"],
130+
FORM_POST_BACK_MESSAGE_UNSUPPORTED_FIELDS:["password", "hidden"],
130131
COOKIES : {
131132
KOMMUNICATE_LOGGED_IN_ID: "km_id",
132133
KOMMUNICATE_LOGGED_IN_USERNAME: "km_user_name",
@@ -395,5 +396,5 @@ KommunicateUtils = {
395396
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
396397
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
397398
return pattern.test(str);
398-
}
399+
},
399400
}

webplugin/js/app/kommunicate-client.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ Kommunicate.client={
8989
metadata: groupMetadata,
9090
allowMessagesViaSocket: conversationDetail.allowMessagesViaSocket || false,
9191
callback: function (response) {
92-
console.log("response", response);
9392
if (response.status === 'success' && response.data.clientGroupId) {
9493
if (typeof callback == 'function') {
9594
callback(response.data.value);
9695
}
97-
KommunicateUI.handleWaitingQueueMessage();
9896
KommunicateUI.hideFaq();
9997
KommunicateUI.showClosedConversationBanner(false);
10098
/* conversation table migrated to Applozic

0 commit comments

Comments
 (0)