diff --git a/app/javascript/dashboard/assets/images/bubble-logo.svg b/app/javascript/dashboard/assets/images/bubble-logo.svg new file mode 100644 index 000000000..1eb8c620e --- /dev/null +++ b/app/javascript/dashboard/assets/images/bubble-logo.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 2b8005e1d..629eac63e 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -413,7 +413,8 @@ "CONFIGURATION": "Configuration", "CAMPAIGN": "Campaigns", "PRE_CHAT_FORM": "Pre Chat Form", - "BUSINESS_HOURS": "Business Hours" + "BUSINESS_HOURS": "Business Hours", + "WIDGET_BUILDER": "Widget Builder" }, "SETTINGS": "Settings", "FEATURES": { @@ -574,6 +575,88 @@ "OPEN_SSL_VERIFY_MODE": "Open SSL Verify Mode", "AUTH_MECHANISM": "Authentication" }, - "NOTE": "Note: " + "NOTE": "Note: ", + "WIDGET_BUILDER": { + "WIDGET_OPTIONS":{ + "AVATAR":{ + "LABEL": "Website Avatar", + "DELETE":{ + "API":{ + "SUCCESS_MESSAGE": "Avatar deleted successfully", + "ERROR_MESSAGE": "There was an error, please try again" + } + } + }, + "WEBSITE_NAME": { + "LABEL": "Website Name", + "PLACE_HOLDER": "Enter your website name (eg: Acme Inc)", + "ERROR": "Please enter a valid website name" + }, + "WELCOME_HEADING": { + "LABEL": "Welcome Heading", + "PLACE_HOLDER": "Hi there!" + }, + "WELCOME_TAGLINE": { + "LABEL": "Welcome Tagline", + "PLACE_HOLDER": "We make it simple to connect with us. Ask us anything, or share your feedback." + }, + "REPLY_TIME": { + "LABEL": "Reply Time", + "IN_A_FEW_MINUTES": "In a few minutes", + "IN_A_FEW_HOURS": "In a few hours", + "IN_A_DAY": "In a day" + }, + "WIDGET_COLOR_LABEL": "Widget Color", + "WIDGET_BUBBLE_POSITION_LABEL": "Widget Bubble Position", + "WIDGET_BUBBLE_TYPE_LABEL": "Widget Bubble Type", + "WIDGET_BUBBLE_LAUNCHER_TITLE":{ + "DEFAULT": "Chat with us", + "LABEL": "Widget Bubble Launcher Title", + "PLACE_HOLDER": "Chat with us" + }, + "UPDATE": { + "BUTTON_TEXT": "Update Widget Settings", + "API": { + "SUCCESS_MESSAGE": "Widget settings updated successfully", + "ERROR_MESSAGE": "Unable to update widget settings" + } + }, + "WIDGET_VIEW_OPTION":{ + "PREVIEW": "Preview", + "SCRIPT": "Script" + }, + "WIDGET_BUBBLE_POSITION":{ + "LEFT": "Left", + "RIGHT": "Right" + }, + "WIDGET_BUBBLE_TYPE":{ + "STANDARD": "Standard", + "EXPANDED_BUBBLE": "Expanded Bubble" + } + }, + "WIDGET_SCREEN": { + "DEFAULT": "Default", + "CHAT": "Chat" + }, + "REPLY_TIME": { + "IN_A_FEW_MINUTES": "Typically replies in a few minutes", + "IN_A_FEW_HOURS": "Typically replies in a few hours", + "IN_A_DAY": "Typically replies in a day" + }, + "FOOTER": { + "START_CONVERSATION_BUTTON_TEXT": "Start Conversation", + "CHAT_INPUT_PLACEHOLDER": "Type your message" + }, + "BODY": { + "TEAM_AVAILABILITY":{ + "ONLINE": "We are Online", + "OFFLINE": "We are away at the moment" + }, + "USER_MESSAGE": "Hi", + "AGENT_MESSAGE": "Hello" + }, + "BRANDING_TEXT": "Powered by Chatwoot", + "SCRIPT_SETTINGS": "\n window.chatwootSettings = {options};" + } } } diff --git a/app/javascript/dashboard/modules/widget-preview/components/Widget.vue b/app/javascript/dashboard/modules/widget-preview/components/Widget.vue index 0f630cbf7..d2e5622a2 100644 --- a/app/javascript/dashboard/modules/widget-preview/components/Widget.vue +++ b/app/javascript/dashboard/modules/widget-preview/components/Widget.vue @@ -1,8 +1,42 @@ @@ -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 @@ 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 @@