0351d front end linting (#377)

* feat: disable custom script for  trial users

* after lint fix

* frontend linting

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Favour Olayinka
2024-04-15 18:39:03 +01:00
committed by GitHub
parent 8d35fc8b1a
commit bcd45ce8a6
228 changed files with 17036 additions and 8744 deletions

View File

@@ -1,35 +1,39 @@
<template></template>
<script setup>
import {onMounted} from "vue";
import { default as _has } from 'lodash/has'
import { onMounted } from "vue"
import { default as _has } from "lodash/has"
const scriptLoaded = ref(false);
const scriptLoaded = ref(false)
const authStore = useAuthStore()
const user = computed(() => authStore.user)
const isImpersonating = computed(() => authStore.isImpersonating)
const featureBaseOrganization = useRuntimeConfig().public.featureBaseOrganization;
const featureBaseOrganization =
useRuntimeConfig().public.featureBaseOrganization
const loadScript = () => {
if (scriptLoaded.value || !user.value || !featureBaseOrganization) return;
const script = document.createElement("script");
script.src = "https://do.featurebase.app/js/sdk.js";
script.id = "featurebase-sdk";
document.head.appendChild(script);
scriptLoaded.value = true;
};
if (scriptLoaded.value || !user.value || !featureBaseOrganization) return
const script = document.createElement("script")
script.src = "https://do.featurebase.app/js/sdk.js"
script.id = "featurebase-sdk"
document.head.appendChild(script)
scriptLoaded.value = true
}
const setupForUser = () => {
if (import.meta.server || !user.value || !featureBaseOrganization ||isImpersonating.value) return
window.Featurebase(
"identify",
{
organization: featureBaseOrganization,
email: user.value.email,
name: user.value.name,
id: user.value.id.toString(),
profilePicture: user.value.photo_url
}
);
if (
import.meta.server ||
!user.value ||
!featureBaseOrganization ||
isImpersonating.value
)
return
window.Featurebase("identify", {
organization: featureBaseOrganization,
email: user.value.email,
name: user.value.name,
id: user.value.id.toString(),
profilePicture: user.value.photo_url,
})
window.Featurebase("initialize_changelog_widget", {
organization: featureBaseOrganization,
@@ -37,7 +41,7 @@ const setupForUser = () => {
theme: "light",
alwaysShow: true,
fullscreenPopup: true,
usersName: user.value?.name
usersName: user.value?.name,
})
window.Featurebase("initialize_feedback_widget", {
@@ -45,18 +49,21 @@ const setupForUser = () => {
theme: "light",
placement: "right",
email: user.value?.email,
usersName: user.value?.name
});
usersName: user.value?.name,
})
}
onMounted(() => {
if (import.meta.server) return
// Setup base
if (!_has(window, 'Featurebase') || typeof window.Featurebase !== "function") {
if (
!_has(window, "Featurebase") ||
typeof window.Featurebase !== "function"
) {
window.Featurebase = function () {
(window.Featurebase.q = window.Featurebase.q || []).push(arguments);
};
(window.Featurebase.q = window.Featurebase.q || []).push(arguments)
}
}
if (!user.value) return
@@ -69,8 +76,7 @@ watch(user, (val) => {
loadScript()
setupForUser()
});
})
</script>
<style>

View File

@@ -1,21 +1,48 @@
<template>
<div v-if="user.active_license" class="border p-5 shadow-md rounded-md">
<div
v-if="user.active_license"
class="border p-5 shadow-md rounded-md"
>
<div class="w-auto flex flex-col items-center">
<img src="/img/appsumo/as-taco-white-bg.png" class="max-w-[60px]" alt="AppSumo"/>
<img src="/img/appsumo/as-Select-dark.png" class="max-w-[150px]" alt="AppSumo"/>
<img
src="/img/appsumo/as-taco-white-bg.png"
class="max-w-[60px]"
alt="AppSumo"
>
<img
src="/img/appsumo/as-Select-dark.png"
class="max-w-[150px]"
alt="AppSumo"
>
</div>
<p class="mt-6">
Your AppSumo <span class="font-semibold">lifetime deal tier {{ licenseTier }}</span> license is active. Here's a reminder of your plan details:
Your AppSumo
<span class="font-semibold">lifetime deal tier {{ licenseTier }}</span>
license is active. Here's a reminder of your plan details:
</p>
<ul class="list-disc pl-5 mt-4">
<li>Number of Forms: <span class="font-semibold">{{ tierFeatures.form_quantity }}</span></li>
<li>Custom domains: <span class="font-semibold">{{ tierFeatures.domain_names }}</span></li>
<li>File Size Uploads: <span class="font-semibold">{{ tierFeatures.file_upload_size }}</span></li>
<li>
Number of Forms:
<span class="font-semibold">{{ tierFeatures.form_quantity }}</span>
</li>
<li>
Custom domains:
<span class="font-semibold">{{ tierFeatures.domain_names }}</span>
</li>
<li>
File Size Uploads:
<span class="font-semibold">{{ tierFeatures.file_upload_size }}</span>
</li>
</ul>
<div class="w-max">
<v-button color="outline-gray" shade="lighter" class="mt-4 block" href="https://appsumo.com/account/products/" target="_blank">
<v-button
color="outline-gray"
shade="lighter"
class="mt-4 block"
href="https://appsumo.com/account/products/"
target="_blank"
>
Mangage in AppSumo
</v-button>
</div>
@@ -23,60 +50,59 @@
</template>
<script>
import { computed } from 'vue'
import { useAuthStore } from '../../../stores/auth'
import VButton from '~/components/global/VButton.vue'
import { computed } from "vue"
import { useAuthStore } from "../../../stores/auth"
import VButton from "~/components/global/VButton.vue"
export default {
name: 'AppSumoBilling',
name: "AppSumoBilling",
components: { VButton },
setup () {
setup() {
const authStore = useAuthStore()
return {
user : computed(() => authStore.user),
user: computed(() => authStore.user),
}
},
data () {
return {
}
data() {
return {}
},
computed: {
licenseTier () {
licenseTier() {
return this.user?.active_license?.meta?.tier
},
tierFeatures () {
tierFeatures() {
if (!this.licenseTier) return {}
return {
1: {
form_quantity: 'Unlimited',
file_upload_size: '25mb',
domain_names: '5'
form_quantity: "Unlimited",
file_upload_size: "25mb",
domain_names: "5",
},
2: {
form_quantity: 'Unlimited',
file_upload_size: '50mb',
domain_names: '25'
form_quantity: "Unlimited",
file_upload_size: "50mb",
domain_names: "25",
},
3: {
form_quantity: 'Unlimited',
file_upload_size: '75mb',
domain_names: 'Unlimited'
}
form_quantity: "Unlimited",
file_upload_size: "75mb",
domain_names: "Unlimited",
},
}[this.licenseTier]
}
},
},
watch: {},
mounted () {},
mounted() {},
created () {},
created() {},
destroyed () {},
unmounted() {},
methods: {}
methods: {},
}
</script>

View File

@@ -1,34 +1,57 @@
<template>
<div v-if="hasValidLicense" class="p-6 bg-white border shadow-md rounded-md">
<img src="/img/appsumo/as-taco-white-bg.png" class="max-w-[60px] mx-auto" alt="AppSumo"/>
<div
v-if="hasValidLicense"
class="p-6 bg-white border shadow-md rounded-md"
>
<img
src="/img/appsumo/as-taco-white-bg.png"
class="max-w-[60px] mx-auto"
alt="AppSumo"
>
<img src="/img/appsumo/as-Select-dark.png" class="max-w-[300px] mx-auto" alt="AppSumo"/>
<img
src="/img/appsumo/as-Select-dark.png"
class="max-w-[300px] mx-auto"
alt="AppSumo"
>
<p class="mt-6">
<span class="text-green-500">We found your AppSumo Lifetime deal license!</span> Just complete the registration form to finalize the activation of
your license.
<span class="text-green-500">We found your AppSumo Lifetime deal license!</span>
Just complete the registration form to finalize the activation of your
license.
</p>
</div>
<div v-else-if="hasLicenseError" class="p-6 bg-white border border-red-500 shadow-md rounded-md">
<img src="/img/appsumo/as-taco-white-bg.png" class="max-w-[60px] mx-auto" alt="AppSumo"/>
<div
v-else-if="hasLicenseError"
class="p-6 bg-white border border-red-500 shadow-md rounded-md"
>
<img
src="/img/appsumo/as-taco-white-bg.png"
class="max-w-[60px] mx-auto"
alt="AppSumo"
>
<img src="/img/appsumo/as-Select-dark.png" class="max-w-[300px] mx-auto" alt="AppSumo"/>
<img
src="/img/appsumo/as-Select-dark.png"
class="max-w-[300px] mx-auto"
alt="AppSumo"
>
<p class="mt-6">
<span class="text-red-600">Invalid AppSumo license</span>. The license was probably already attached to an OpnForm account. Please contact support.
<span class="text-red-600">Invalid AppSumo license</span>. The license was
probably already attached to an OpnForm account. Please contact support.
</p>
</div>
</template>
<script>
export default {
name: "AppSumoRegister",
name: 'AppSumoRegister',
data () {
data() {
return {
hasValidLicense: false,
hasLicenseError: false
hasLicenseError: false,
}
},
@@ -36,19 +59,23 @@ export default {
watch: {},
mounted () {
if (this.$route.query.appsumo_license !== undefined && this.$route.query.appsumo_license) {
mounted() {
if (
this.$route.query.appsumo_license !== undefined &&
this.$route.query.appsumo_license
) {
this.hasValidLicense = true
} else if (this.$route.query.appsumo_error !== undefined && this.$route.query.appsumo_error) {
} else if (
this.$route.query.appsumo_error !== undefined &&
this.$route.query.appsumo_error
) {
this.hasLicenseError = true
}
},
created () {
},
destroyed () {
},
created() {},
unmounted() {},
methods: {}
methods: {},
}
</script>