feat: refs #6818 saysimple integration #904

Merged
jorgep merged 11 commits from 6818-saySimpleIntegration into dev 2024-11-13 08:25:27 +00:00
1 changed files with 30 additions and 6 deletions
Showing only changes of commit 7fb3e71688 - Show all commits

View File

@ -1,18 +1,38 @@
<script setup>
import { useAttrs } from 'vue';
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
import axios from 'axios';
const props = defineProps({
phoneNumber: { type: [String, Number], default: null },
channel: { type: Number, default: 1320 },
channel: { type: Number, default: null },
});
const config = {
const config = reactive({
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
'say-simple': {
icon: 'help', // 'whatsapp',
jorgep marked this conversation as resolved Outdated
Outdated
Review

quitar comentario?

quitar comentario?

Lo quiero dejar porque está pendiente. Cuando Paco rico lo pase lo añadiré pero de momento pongo ese. Le añado el número de tarea

Lo quiero dejar porque está pendiente. Cuando Paco rico lo pase lo añadiré pero de momento pongo ese. Le añado el número de tarea
href: `https://verdnatura.saysimple.io/start-conversation?customerIdentity=%2B${props.phoneNumber}&channelId=${props.channel}`,
href: null,
},
};
});
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)
jorgep marked this conversation as resolved Outdated
Outdated
Review

Y si el tipo no es say-simple igualmente le pone el canal?

Y si el tipo no es say-simple igualmente le pone el canal?
channel = (
jorgep marked this conversation as resolved Outdated
Outdated
Review

es lo mismo que poner if (type === 'say-simple') directamente jaja

es lo mismo que poner if (type === 'say-simple') directamente jaja

Tiene usted razón

Tiene usted razón
await axios.get('SaySimpleCountries/findOne', {
params: {
filter: { fields: ['channel'], where: { countryFk: 0 } },
},
})
).data?.channel;
config[
'say-simple'
].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`;
});
</script>
<template>
<QBtn
@ -25,5 +45,9 @@ const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
padding="none"
:href="config[type].href"
@click.stop
/>
>
<QTooltip>
{{ capitalize(type).replace('-', '') }}
</QTooltip>
</QBtn>
</template>