From a467c44b91ec3c80d45cfa5dc68a9e7479dcf144 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Nov 2024 11:51:13 +0100 Subject: [PATCH 1/6] feat: refs #6818 saysimple integration --- src/components/ui/VnLinkPhone.vue | 19 ++++++++++++++++--- src/pages/Customer/Card/CustomerSummary.vue | 7 ++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue index 3ce0b7aa6..490dd838e 100644 --- a/src/components/ui/VnLinkPhone.vue +++ b/src/components/ui/VnLinkPhone.vue @@ -1,16 +1,29 @@ diff --git a/src/pages/Customer/Card/CustomerSummary.vue b/src/pages/Customer/Card/CustomerSummary.vue index 8e41119ef..4cc6057e8 100644 --- a/src/pages/Customer/Card/CustomerSummary.vue +++ b/src/pages/Customer/Card/CustomerSummary.vue @@ -95,6 +95,11 @@ const sumRisk = ({ clientRisks }) => { { From 3bae121ed74f6078ed2ccf8769443646487baf5d Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Nov 2024 13:04:40 +0100 Subject: [PATCH 2/6] fix: refs #6818 use right icon --- src/components/ui/VnLinkPhone.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue index 490dd838e..a69cb4509 100644 --- a/src/components/ui/VnLinkPhone.vue +++ b/src/components/ui/VnLinkPhone.vue @@ -6,7 +6,7 @@ const props = defineProps({ }); const config = { - sip: { icon: 'phone_in_talk', href: `sip:${props.phoneNumber}` }, + sip: { icon: 'phone', href: `sip:${props.phoneNumber}` }, 'say-simple': { icon: 'help', // 'whatsapp', href: `https://verdnatura.saysimple.io/start-conversation?customerIdentity=%2B${props.phoneNumber}&channelId=${props.channel}`, From 7fb3e71688f874ab6ca76c24bedc139ed890dc08 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Nov 2024 17:41:27 +0100 Subject: [PATCH 3/6] feat: refs #6818 fetch url & default channel --- src/components/ui/VnLinkPhone.vue | 36 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue index a69cb4509..a7b2d9b77 100644 --- a/src/components/ui/VnLinkPhone.vue +++ b/src/components/ui/VnLinkPhone.vue @@ -1,18 +1,38 @@ From 700701f0554c7b06985f31e9dcecc8ad51056de0 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 12 Nov 2024 10:10:26 +0100 Subject: [PATCH 4/6] refactor: refs #6818 channel logic --- src/components/ui/VnLinkPhone.vue | 34 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue index a7b2d9b77..3b3153ac3 100644 --- a/src/components/ui/VnLinkPhone.vue +++ b/src/components/ui/VnLinkPhone.vue @@ -9,29 +9,33 @@ const props = defineProps({ const config = reactive({ sip: { icon: 'phone', href: `sip:${props.phoneNumber}` }, 'say-simple': { - icon: 'help', // 'whatsapp', + icon: 'help', // 'whatsapp icon #6818', href: null, + channel: props.channel, }, }); const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip'; onBeforeMount(async () => { let url; - let channel = props.channel; - if (type === 'say-simple') - url = (await axios.get('SaySimpleConfigs/findOne')).data.url; - if (!props.channel) - channel = ( - await axios.get('SaySimpleCountries/findOne', { - params: { - filter: { fields: ['channel'], where: { countryFk: 0 } }, - }, - }) - ).data?.channel; + let { channel } = config[type]; + if (type === 'sip') return; - config[ - 'say-simple' - ].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`; + if (type === 'say-simple') { + url = (await axios.get('SaySimpleConfigs/findOne')).data.url; + if (!channel) + channel = ( + await axios.get('SaySimpleCountries/findOne', { + params: { + filter: { fields: ['channel'], where: { countryFk: 0 } }, + }, + }) + ).data?.channel; + + config[ + type + ].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`; + } });