Skip to content

Commit

Permalink
Fix carousel issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Lundy authored and Andrew Lundy committed Mar 4, 2024
1 parent b222eab commit d1b5b03
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 175 deletions.
Binary file modified .DS_Store
Binary file not shown.
86 changes: 43 additions & 43 deletions rich-message-lightning-web-component/lwcchatpack.css
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
.chat-content {
position: relative;
font-weight: 400;
line-height: 1.3;
max-width: 70%;
padding: 10px;
font-size: 0.875em;
border-radius: 10px 10px 0;
float: right;
margin-left: 40px;
}

.chat-content.chat-bot-v4 {
background-color: #fff !important;
padding: 0 !important;
max-width: 100%;
overflow: hidden;
}

.agent.chat-content {
color: #000000;
background: #F2F2F3;
border-radius: 10px 10px 10px 0;
float: left;
}

/* .chasitor.chat-content {
background: #1f1f28;
color: #fff;
margin-left: auto;
} */

.message-hidden{
display:none;
}

.slds-rich-text-editor__output > span {
display: block;
text-align: left;
}

/* loader */
.chat-content {
position: relative;
font-weight: 400;
line-height: 1.3;
max-width: 70%;
padding: 10px;
font-size: 0.875em;
border-radius: 10px 10px 0;
float: right;
margin-left: 40px;
}

.chat-content.chat-bot-v4 {
background-color: #fff !important;
padding: 0 !important;
max-width: 100%;
overflow: hidden;
}

.agent.chat-content {
color: #000000;
background: #F2F2F3;
border-radius: 10px 10px 10px 0;
float: left;
}

/* .chasitor.chat-content {
background: #1f1f28;
color: #fff;
margin-left: auto;
} */

.message-hidden{
display:none;
}

.slds-rich-text-editor__output > span {
display: block;
text-align: left;
}

/* loader */

30 changes: 15 additions & 15 deletions rich-message-lightning-web-component/lwcchatpack.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<template>
<!-- DEFAULT CHAT TEMPLATE -->
<div class={messageStyle}>
<lightning-formatted-rich-text value={strMessage}></lightning-formatted-rich-text>
<template if:true={showLoader} >
<span class="loader">
<div class="tiblock">
<div class="tidot"></div>
<div class="tidot"></div>
<div class="tidot"></div>
</div>
</span>
</template>
</div>

<template>
<!-- DEFAULT CHAT TEMPLATE -->
<div class={messageStyle}>
<lightning-formatted-rich-text value={strMessage}></lightning-formatted-rich-text>
<template if:true={showLoader} >
<span class="loader">
<div class="tiblock">
<div class="tidot"></div>
<div class="tidot"></div>
<div class="tidot"></div>
</div>
</span>
</template>
</div>

</template>
114 changes: 57 additions & 57 deletions rich-message-lightning-web-component/lwcchatpack.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
import BaseChatMessage from 'lightningsnapin/baseChatMessage';
import { track } from 'lwc';

const CHAT_CONTENT_CLASS = 'chat-content rich-content-wrapper';
const CHAT_BOT_V4_CLASS = 'chat-bot-v4';
const AGENT_USER_TYPE = 'agent';
const CHASITOR_USER_TYPE = 'chasitor';
const SUPPORTED_USER_TYPES = [AGENT_USER_TYPE, CHASITOR_USER_TYPE];

const V1_KEY = '&amp;&amp;version1&amp;&amp;';
const V2_KEY = '&amp;&amp;version2&amp;&amp;';
const V3_KEY = '&amp;&amp;version3&amp;&amp;';
const V4_KEY = '&amp;&amp;version4&amp;&amp;';
const VERSIONS_LIST = [V1_KEY, V2_KEY, V3_KEY, V4_KEY];

export default class Lwcchatpack extends BaseChatMessage
{
@track strMessage = '';
@track showLoader = false;
connectedCallback()
{
this.strMessage = this.messageContent.value;
const isSupported = this.isSupportedUserType(this.userType);
if (isSupported)
{
this.showLoader = this.userType === AGENT_USER_TYPE;
this.messageStyle = `${CHAT_CONTENT_CLASS} ${this.userType}`;
VERSIONS_LIST.forEach((itemKey) => {
if(this.strMessage.includes(itemKey)) {
this.strMessage = this.strMessage.replace(itemKey, '');
if (itemKey === V4_KEY) {
this.messageStyle = `${CHAT_CONTENT_CLASS} ${CHAT_BOT_V4_CLASS} ${this.userType}`;
}
}
})
if(this.showLoader){
this.messageStyle = `${this.messageStyle} has-loader`
}
this.strMessage = this.strMessage.replace(/<a\shref=[\s\S]+target='_blank'>/g, '').replace(/<\/a>/g, '').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#x2F;/g, "/");
}
else
{
throw new Error('Unsupported user type passed in: ${this.userType}');
}
}


isSupportedUserType(userType)
{
return SUPPORTED_USER_TYPES.some((supportedUserType) => supportedUserType === userType);
}
import BaseChatMessage from 'lightningsnapin/baseChatMessage';
import { track } from 'lwc';

const CHAT_CONTENT_CLASS = 'chat-content rich-content-wrapper';
const CHAT_BOT_V4_CLASS = 'chat-bot-v4';
const AGENT_USER_TYPE = 'agent';
const CHASITOR_USER_TYPE = 'chasitor';
const SUPPORTED_USER_TYPES = [AGENT_USER_TYPE, CHASITOR_USER_TYPE];

const V1_KEY = '&amp;&amp;version1&amp;&amp;';
const V2_KEY = '&amp;&amp;version2&amp;&amp;';
const V3_KEY = '&amp;&amp;version3&amp;&amp;';
const V4_KEY = '&amp;&amp;version4&amp;&amp;';
const VERSIONS_LIST = [V1_KEY, V2_KEY, V3_KEY, V4_KEY];

export default class Lwcchatpack extends BaseChatMessage
{
@track strMessage = '';
@track showLoader = false;
connectedCallback()
{
this.strMessage = this.messageContent.value;
const isSupported = this.isSupportedUserType(this.userType);
if (isSupported)
{
this.showLoader = this.userType === AGENT_USER_TYPE;
this.messageStyle = `${CHAT_CONTENT_CLASS} ${this.userType}`;
VERSIONS_LIST.forEach((itemKey) => {
if(this.strMessage.includes(itemKey)) {
this.strMessage = this.strMessage.replace(itemKey, '');
if (itemKey === V4_KEY) {
this.messageStyle = `${CHAT_CONTENT_CLASS} ${CHAT_BOT_V4_CLASS} ${this.userType}`;
}
}
})
if(this.showLoader){
this.messageStyle = `${this.messageStyle} has-loader`
}
this.strMessage = this.strMessage.replace(/<a\shref=[\s\S]+target='_blank'>/g, '').replace(/<\/a>/g, '').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#x2F;/g, "/");
}
else
{
throw new Error('Unsupported user type passed in: ${this.userType}');
}
}


isSupportedUserType(userType)
{
return SUPPORTED_USER_TYPES.some((supportedUserType) => supportedUserType === userType);
}
}
16 changes: 8 additions & 8 deletions rich-message-lightning-web-component/lwcchatpack.js-meta.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Chat Lightning Web Component Pack</masterLabel>
<targets>
<target>lightningSnapin__ChatMessage</target>
</targets>
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Chat Lightning Web Component Pack</masterLabel>
<targets>
<target>lightningSnapin__ChatMessage</target>
</targets>
</LightningComponentBundle>
Loading

0 comments on commit d1b5b03

Please sign in to comment.