2023-12-19 16:24:33 -05:00
|
|
|
<template lang="html">
|
|
|
|
<section class="ffz--widget ffz--service-tos">
|
|
|
|
<h4>{{ key }}</h4>
|
|
|
|
<markdown class="tw-mg-b-05" :source="linkText" />
|
2023-12-21 17:28:39 -05:00
|
|
|
<div v-if="hasAccepted">
|
|
|
|
{{ t('tooltip.has-accepted', 'You have accepted the Terms of Service.') }}
|
|
|
|
</div>
|
|
|
|
<template v-else>
|
|
|
|
<button
|
|
|
|
class="tw-button tw-mg-b-05"
|
2025-06-07 16:09:55 -06:00
|
|
|
@click="accept"
|
2023-12-21 17:28:39 -05:00
|
|
|
>
|
|
|
|
<span class="tw-button__text">
|
|
|
|
{{ acceptText }}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="! declined"
|
|
|
|
class="tw-button tw-button--text tw-block"
|
2025-06-07 16:09:55 -06:00
|
|
|
@click="reject"
|
2023-12-21 17:28:39 -05:00
|
|
|
>
|
|
|
|
<span class="tw-button__text">
|
|
|
|
{{ t('tooltip.decline-tos', 'I do not accept.') }}
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
<div v-else>
|
|
|
|
{{ t('tooltip.has-declined-tos', 'We won\'t ask you to accept the terms again, but you can still change your mind on this page.') }}
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-12-19 16:24:33 -05:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import ProviderMixin from '../provider-mixin';
|
|
|
|
|
|
|
|
let last_id = 0;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
mixins: [ProviderMixin],
|
|
|
|
props: ['item', 'context'],
|
|
|
|
|
|
|
|
data() {
|
2023-12-21 17:28:39 -05:00
|
|
|
const chat = this.item.getChat();
|
|
|
|
|
2023-12-19 16:24:33 -05:00
|
|
|
return {
|
|
|
|
id: last_id++,
|
|
|
|
|
2023-12-21 17:28:39 -05:00
|
|
|
declined: chat ? chat.hasDeclinedTerms(this.item.item) : false,
|
|
|
|
|
2023-12-19 16:24:33 -05:00
|
|
|
key: this.item.item
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2023-12-21 17:28:39 -05:00
|
|
|
acceptText() {
|
|
|
|
if ( this.data.i18n_accept )
|
|
|
|
return this.t(this.data.i18n_accept, this.data.accept);
|
|
|
|
else if ( this.data.accept )
|
|
|
|
return this.data.accept;
|
|
|
|
|
|
|
|
return this.t('tooltip.accept-tos', 'Yes, I accept the Terms of Service.');
|
|
|
|
},
|
|
|
|
|
2023-12-19 16:24:33 -05:00
|
|
|
linkText() {
|
|
|
|
if ( this.data.i18n_links )
|
|
|
|
return this.t(this.data.i18n_links, this.data.links);
|
|
|
|
return this.data.links;
|
|
|
|
},
|
|
|
|
|
|
|
|
hasAccepted() {
|
|
|
|
return Array.isArray(this.value) && this.value.includes(this.key)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
accept() {
|
|
|
|
const val = Array.isArray(this.value) ? [...this.value] : [];
|
|
|
|
val.push(this.key);
|
|
|
|
this.set(val);
|
2023-12-21 17:28:39 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
reject() {
|
|
|
|
if ( this.declined )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const chat = this.item.getChat();
|
|
|
|
if ( ! chat )
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.declined = true;
|
|
|
|
chat.declineTerms(this.key);
|
2023-12-19 16:24:33 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|