Skip to content

Commit 2a12503

Browse files
committed
fix: incorrect compute if user is subscribed
1 parent 4d342bb commit 2a12503

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/components/screens/SingleQR.vue

+11-15
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ const props = defineProps({
9797
9898
const isLoading = ref(false);
9999
100-
const hasBillableRedirects = computed(() => {
101-
return !!(props.subscribed || props.endpoints.length > 1);
102-
});
103-
104100
const copiedTimeout = ref<NodeJS.Timeout | null>(null);
105101
106102
const copyToClipboard = (text: string) => {
@@ -141,7 +137,7 @@ const printMagicLink = () => {
141137
const openTabs = ref(["1"]);
142138
143139
const lineChartData = computed(() => {
144-
if (!hasBillableRedirects.value || !props.endpoints.length) {
140+
if (!props.subscribed || !props.endpoints.length) {
145141
return [];
146142
}
147143
// 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(
258254
params: { redirectId: props.redirectId },
259255
}"
260256
>{{
261-
hasBillableRedirects
257+
subscribed
262258
? $t("Add more free destinations")
263259
: $t("Add more destinations to same code")
264260
}}</base-button
@@ -308,7 +304,7 @@ const QRDestinations = defineAsyncComponent(
308304
:clicksAllTime="clicksAllTime"
309305
:bestEndpoint="bestEndpoint"
310306
:isLoading="isLoading || loading"
311-
:hasBillableRedirects="hasBillableRedirects"
307+
:hasBillableRedirects="subscribed"
312308
/>
313309
</div>
314310

@@ -326,7 +322,7 @@ const QRDestinations = defineAsyncComponent(
326322
:title="$t('Code design')"
327323
:subtitle="$t('Customise the look of your magic link')"
328324
>
329-
<div :class="{ disabled: !hasBillableRedirects }">
325+
<div :class="{ disabled: !subscribed }">
330326
<div class="two-column-grid mobile-grid">
331327
<div>
332328
<label for="darkColor">{{ $t("Color") }}</label>
@@ -335,7 +331,7 @@ const QRDestinations = defineAsyncComponent(
335331
type="color"
336332
v-model="darkColor"
337333
name="darkColor"
338-
:disabled="!hasBillableRedirects"
334+
:disabled="!subscribed"
339335
/>
340336
</div>
341337
<div>
@@ -345,7 +341,7 @@ const QRDestinations = defineAsyncComponent(
345341
type="color"
346342
v-model="lightColor"
347343
name="lightColor"
348-
:disabled="!hasBillableRedirects"
344+
:disabled="!subscribed"
349345
/>
350346
</div>
351347
</div>
@@ -355,7 +351,7 @@ const QRDestinations = defineAsyncComponent(
355351
name="shape"
356352
id="shape"
357353
v-model="selectedShape"
358-
:disabled="!hasBillableRedirects"
354+
:disabled="!subscribed"
359355
>
360356
<option value="square">{{ $t("Square") }}</option>
361357
<option value="rounded">{{ $t("Rounded") }}</option>
@@ -366,7 +362,7 @@ const QRDestinations = defineAsyncComponent(
366362
:redirectId="redirectId"
367363
:title="$t('Enable custom designs')"
368364
:submitText="$t('Enable custom designs')"
369-
v-if="!hasBillableRedirects"
365+
v-if="!subscribed"
370366
>
371367
<base-button class="full-width no-margin">
372368
{{ $t("Enable custom designs") }}</base-button
@@ -387,14 +383,14 @@ const QRDestinations = defineAsyncComponent(
387383
<hgroup>
388384
<h3>
389385
{{
390-
hasBillableRedirects
386+
subscribed
391387
? $t("Unsubscribe Magic Link")
392388
: $t("Subscribe Magic Link")
393389
}}
394390
</h3>
395391
<p>
396392
{{
397-
hasBillableRedirects
393+
subscribed
398394
? $t(
399395
"Remove advanced analytics, multiple destinations, and custom designs"
400396
)
@@ -404,7 +400,7 @@ const QRDestinations = defineAsyncComponent(
404400
}}
405401
</p>
406402
</hgroup>
407-
<template v-if="hasBillableRedirects !== true">
403+
<template v-if="subscribed !== true">
408404
<confirms-subscription-start
409405
:redirectId="redirectId"
410406
:title="$t('Subscribe')"

0 commit comments

Comments
 (0)