From 2a12503eea2de02a42bfe54d0496ca16c9905e83 Mon Sep 17 00:00:00 2001 From: Michal Date: Fri, 26 Apr 2024 11:44:54 +0000 Subject: [PATCH] fix: incorrect compute if user is subscribed --- src/components/screens/SingleQR.vue | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/components/screens/SingleQR.vue b/src/components/screens/SingleQR.vue index f8573f8..5a89410 100644 --- a/src/components/screens/SingleQR.vue +++ b/src/components/screens/SingleQR.vue @@ -97,10 +97,6 @@ const props = defineProps({ const isLoading = ref(false); -const hasBillableRedirects = computed(() => { - return !!(props.subscribed || props.endpoints.length > 1); -}); - const copiedTimeout = ref(null); const copyToClipboard = (text: string) => { @@ -141,7 +137,7 @@ const printMagicLink = () => { const openTabs = ref(["1"]); const lineChartData = computed(() => { - if (!hasBillableRedirects.value || !props.endpoints.length) { + if (!props.subscribed || !props.endpoints.length) { return []; } // Each data item has a clicks_by_time_of_day array, we need to return it. We can flatten the array with flatMap @@ -258,7 +254,7 @@ const QRDestinations = defineAsyncComponent( params: { redirectId: props.redirectId }, }" >{{ - hasBillableRedirects + subscribed ? $t("Add more free destinations") : $t("Add more destinations to same code") }} @@ -326,7 +322,7 @@ const QRDestinations = defineAsyncComponent( :title="$t('Code design')" :subtitle="$t('Customise the look of your magic link')" > -
+
@@ -335,7 +331,7 @@ const QRDestinations = defineAsyncComponent( type="color" v-model="darkColor" name="darkColor" - :disabled="!hasBillableRedirects" + :disabled="!subscribed" />
@@ -345,7 +341,7 @@ const QRDestinations = defineAsyncComponent( type="color" v-model="lightColor" name="lightColor" - :disabled="!hasBillableRedirects" + :disabled="!subscribed" />
@@ -355,7 +351,7 @@ const QRDestinations = defineAsyncComponent( name="shape" id="shape" v-model="selectedShape" - :disabled="!hasBillableRedirects" + :disabled="!subscribed" > @@ -366,7 +362,7 @@ const QRDestinations = defineAsyncComponent( :redirectId="redirectId" :title="$t('Enable custom designs')" :submitText="$t('Enable custom designs')" - v-if="!hasBillableRedirects" + v-if="!subscribed" > {{ $t("Enable custom designs") }}

{{ - hasBillableRedirects + subscribed ? $t("Unsubscribe Magic Link") : $t("Subscribe Magic Link") }}

{{ - hasBillableRedirects + subscribed ? $t( "Remove advanced analytics, multiple destinations, and custom designs" ) @@ -404,7 +400,7 @@ const QRDestinations = defineAsyncComponent( }}

-