-
-
-
+
@@ -10,6 +44,9 @@
import WidgetHead from './WidgetHead';
import WidgetBody from './WidgetBody';
import WidgetFooter from './WidgetFooter';
+import InputRadioGroup from 'dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup';
+
+const { LOGO_THUMBNAIL: logoThumbnail } = window.globalConfig || {};
export default {
name: 'Widget',
@@ -17,13 +54,14 @@ export default {
WidgetHead,
WidgetBody,
WidgetFooter,
+ InputRadioGroup,
},
props: {
welcomeHeading: {
type: String,
- default: 'Hi There,',
+ default: '',
},
- welcomeTagLine: {
+ welcomeTagline: {
type: String,
default: '',
},
@@ -32,52 +70,228 @@ export default {
default: '',
required: true,
},
- websiteDomain: {
- type: String,
- default: '',
- },
logo: {
type: String,
default: '',
},
- isExpanded: {
- type: Boolean,
- default: true,
- },
isOnline: {
type: Boolean,
default: true,
},
replyTime: {
type: String,
- default: 'few minutes',
+ default: '',
},
+ color: {
+ type: String,
+ default: '',
+ },
+ widgetBubblePosition: {
+ type: String,
+ default: '',
+ },
+ widgetBubbleLauncherTitle: {
+ type: String,
+ default: '',
+ },
+ widgetBubbleType: {
+ type: String,
+ default: '',
+ },
+ },
+ data() {
+ return {
+ widgetScreens: [
+ {
+ id: 'default',
+ title: this.$t('INBOX_MGMT.WIDGET_BUILDER.WIDGET_SCREEN.DEFAULT'),
+ checked: true,
+ },
+ {
+ id: 'chat',
+ title: this.$t('INBOX_MGMT.WIDGET_BUILDER.WIDGET_SCREEN.CHAT'),
+ checked: false,
+ },
+ ],
+ isDefaultScreen: true,
+ isWidgetVisible: true,
+ globalConfig: {
+ logoThumbnail,
+ },
+ };
},
computed: {
getWidgetHeadConfig() {
return {
welcomeHeading: this.welcomeHeading,
- welcomeTagLine: this.welcomeTagLine,
+ welcomeTagline: this.welcomeTagline,
websiteName: this.websiteName,
- websiteDomain: this.websiteDomain,
logo: this.logo,
- isExpanded: this.isExpanded,
+ isDefaultScreen: this.isDefaultScreen,
isOnline: this.isOnline,
- replyTime: this.replyTime,
+ replyTime: this.replyTimeText,
+ color: this.color,
};
},
+ getWidgetBodyConfig() {
+ return {
+ welcomeHeading: this.welcomeHeading,
+ welcomeTagline: this.welcomeTagline,
+ isDefaultScreen: this.isDefaultScreen,
+ isOnline: this.isOnline,
+ replyTime: this.replyTimeText,
+ color: this.color,
+ logo: this.logo,
+ };
+ },
+ getWidgetFooterConfig() {
+ return {
+ isDefaultScreen: this.isDefaultScreen,
+ color: this.color,
+ };
+ },
+ replyTimeText() {
+ switch (this.replyTime) {
+ case 'in_a_few_minutes':
+ return this.$t(
+ 'INBOX_MGMT.WIDGET_BUILDER.REPLY_TIME.IN_A_FEW_MINUTES'
+ );
+ case 'in_a_day':
+ return this.$t('INBOX_MGMT.WIDGET_BUILDER.REPLY_TIME.IN_A_DAY');
+ default:
+ return this.$t('INBOX_MGMT.WIDGET_BUILDER.REPLY_TIME.IN_A_FEW_HOURS');
+ }
+ },
+ getBubblePositionStyle() {
+ return {
+ justifyContent: this.widgetBubblePosition === 'left' ? 'start' : 'end',
+ };
+ },
+ getBubbleTypeClass() {
+ return {
+ 'bubble-close': this.isWidgetVisible,
+ 'bubble-expanded':
+ !this.isWidgetVisible && this.widgetBubbleType === 'expanded_bubble',
+ };
+ },
+ getWidgetBubbleLauncherTitle() {
+ return this.isWidgetVisible || this.widgetBubbleType === 'standard'
+ ? ' '
+ : this.widgetBubbleLauncherTitle;
+ },
+ },
+ methods: {
+ handleScreenChange(item) {
+ this.isDefaultScreen = item.id === 'default';
+ },
+ toggleWidget() {
+ this.isWidgetVisible = !this.isWidgetVisible;
+ this.isDefaultScreen = true;
+ },
},
};
diff --git a/app/javascript/dashboard/modules/widget-preview/components/WidgetBody.vue b/app/javascript/dashboard/modules/widget-preview/components/WidgetBody.vue
index 7114e3bf6..1b4ab08a6 100644
--- a/app/javascript/dashboard/modules/widget-preview/components/WidgetBody.vue
+++ b/app/javascript/dashboard/modules/widget-preview/components/WidgetBody.vue
@@ -1,24 +1,42 @@
-
-
-
-
-
-
-
-
Hello
+
+
+
+
+ {{ getStatusText }}
+
+
+ {{ config.replyTime }}
+
+
+
+
+
+
+
+
+
+
+
+
{{ $t('INBOX_MGMT.WIDGET_BUILDER.BODY.USER_MESSAGE') }}
+
-
-
-
-
-
-
-
-
Hello
+
+
+
+
+
+
+
+ {{ $t('INBOX_MGMT.WIDGET_BUILDER.BODY.AGENT_MESSAGE') }}
+
+
@@ -29,51 +47,105 @@
diff --git a/app/javascript/dashboard/modules/widget-preview/components/WidgetHead.vue b/app/javascript/dashboard/modules/widget-preview/components/WidgetHead.vue
index 6a08f2f55..2ff57b552 100644
--- a/app/javascript/dashboard/modules/widget-preview/components/WidgetHead.vue
+++ b/app/javascript/dashboard/modules/widget-preview/components/WidgetHead.vue
@@ -6,25 +6,19 @@
v-if="config.logo"
:src="config.logo"
class="logo"
- :class="{ small: !config.isExpanded }"
+ :class="{ small: !isDefaultScreen }"
/>
-
-
-
{{ config.websiteName }}
+
+
+
{{ config.websiteName }}
-
- {{ responseTime }}
-
+
{{ config.replyTime }}
-
-
- {{ config.welcomeHeading }}
-
-
- {{ config.welcomeTagLine }}
-
+
+
{{ config.welcomeHeading }}
+
{{ config.welcomeTagline }}
@@ -35,44 +29,31 @@ export default {
props: {
config: {
type: Object,
- default() {
- return {};
- },
+ default: () => {},
},
},
computed: {
- responseTime() {
- switch (this.config.replyTime) {
- case 'in_a_few_minutes':
- return this.$t(
- 'INBOX_MGMT.ADD.WEBSITE_CHANNEL.REPLY_TIME.IN_A_FEW_MINUTES'
- );
- case 'in_a_few_hours':
- return this.$t(
- 'INBOX_MGMT.ADD.WEBSITE_CHANNEL.REPLY_TIME.IN_A_FEW_HOURS'
- );
- case 'in_a_day':
- return this.$t('INBOX_MGMT.ADD.WEBSITE_CHANNEL.REPLY_TIME.IN_A_DAY');
- default:
- return this.$t(
- 'INBOX_MGMT.ADD.WEBSITE_CHANNEL.REPLY_TIME.IN_A_FEW_HOURS'
- );
- }
+ isDefaultScreen() {
+ return (
+ this.config.isDefaultScreen &&
+ (this.config.welcomeHeading.length !== 0 ||
+ this.config.welcomeTagline.length !== 0)
+ );
},
},
};
diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup.vue
index 3326261fd..6f08afc3d 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup.vue
@@ -2,14 +2,17 @@
@@ -18,6 +21,10 @@