fix: opt in to import.meta.* properties (#364)

This commit is contained in:
Daniel Roe
2024-03-28 16:59:41 +00:00
committed by GitHub
parent 2191f46214
commit d9996e0d9d
25 changed files with 40 additions and 40 deletions

View File

@@ -144,7 +144,7 @@ export default {
watch: {
showUploadModal: {
handler (val) {
if (process.server) return
if (import.meta.server) return
document.removeEventListener('paste', this.onUploadPasteEvent)
if (this.showUploadModal) {
document.addEventListener('paste', this.onUploadPasteEvent)

View File

@@ -88,13 +88,13 @@ const closeOnEscape = (e) => {
}
onMounted(() => {
if (process.server) return
if (import.meta.server) return
document.addEventListener('keydown', closeOnEscape)
initMotions()
})
onBeforeUnmount(() => {
if (process.server) return
if (import.meta.server) return
document.removeEventListener('keydown', closeOnEscape)
})

View File

@@ -235,7 +235,7 @@ export default {
methods: {
openChangelog() {
if (process.server) return
if (import.meta.server) return
window.Featurebase('manually_open_changelog_popup')
},
async logout() {

View File

@@ -152,7 +152,7 @@ export default {
computed: {
isEmbedPopup () {
return process.client && window.location.href.includes('popup=true')
return import.meta.client && window.location.href.includes('popup=true')
},
theme () {
return this.themes[this.themes.hasOwnProperty(this.form.theme) ? this.form.theme : 'default']
@@ -161,7 +161,7 @@ export default {
return this.$route.name === 'forms-slug'
},
isHideTitle () {
return this.form.hide_title || (process.client && window.location.href.includes('hide_title=true'))
return this.form.hide_title || (import.meta.client && window.location.href.includes('hide_title=true'))
}
},

View File

@@ -267,7 +267,7 @@ export default {
mounted () {
this.initForm()
if (process.client && window.location.href.includes('auto_submit=true')) {
if (import.meta.client && window.location.href.includes('auto_submit=true')) {
this.isAutoSubmit = true
this.submitForm()
}
@@ -279,7 +279,7 @@ export default {
return
}
if (this.form.use_captcha && process.client) {
if (this.form.use_captcha && import.meta.client) {
this.dataForm['h-captcha-response'] = document.getElementsByName('h-captcha-response')[0].value
this.$refs.hcaptcha.reset()
}
@@ -311,7 +311,7 @@ export default {
}
// Scroll to error
if (process.server) return
if (import.meta.server) return
const elements = document.getElementsByClassName('has-error')
if (elements.length > 0) {
window.scroll({

View File

@@ -37,7 +37,7 @@ const props = defineProps({
})
const copyToClipboard = () => {
if (process.server) return
if (import.meta.server) return
copy(props.content)
if(props.isDraft){
useAlert().warning('Copied! But other people won\'t be able to see the form since it\'s currently in draft mode')

View File

@@ -145,7 +145,7 @@ export default {
},
computed: {
parentPage() {
if (process.server) {
if (import.meta.server) {
return null
}
return window
@@ -261,7 +261,7 @@ export default {
this.properties = columns
},
onChangeDisplayColumns() {
if (!process.client) return
if (!import.meta.client) return
window.localStorage.setItem('display-columns-formid-' + this.form.id, JSON.stringify(this.displayColumns))
this.properties = clonedeep(this.form.properties).concat(this.removed_properties).filter((field) => {
return this.displayColumns[field.id] === true

View File

@@ -59,7 +59,7 @@ const preFillUrl = computed(() => {
})
const copyToClipboard = () => {
if (process.server) return
if (import.meta.server) return
copy(preFillUrl.value)
useAlert().success('Copied!')
}

View File

@@ -32,7 +32,7 @@ export default {
methods: {
mouseDownHandler(e) {
if (process.server) return
if (import.meta.server) return
// Get the current mouse position
this.x = e.clientX

View File

@@ -150,12 +150,12 @@ const onClose = () => {
showEmbedFormAsPopupModal.value = false
}
const copyToClipboard = () => {
if (process.server) return
if (import.meta.server) return
copy(embedPopupCode.value)
useAlert().success('Copied!')
}
const removePreview = () => {
if (process.server) return
if (import.meta.server) return
const oldP = document.head.querySelector('#nf-popup-preview')
if (oldP) {
oldP.remove()
@@ -166,7 +166,7 @@ const removePreview = () => {
}
}
const previewPopup = (nfData) => {
if (process.server) return
if (import.meta.server) return
if (!showEmbedFormAsPopupModal.value) {
return
}

View File

@@ -33,7 +33,7 @@ export default {
methods: {
loadScript () {
if (process.server) return
if (import.meta.server) return
const script = document.createElement('script')
script.setAttribute('src', 'https://testimonial.to/js/iframeResizer.min.js')
document.head.appendChild(script)

View File

@@ -18,7 +18,7 @@ const loadScript = () => {
};
const setupForUser = () => {
if (process.server || !user.value || !featureBaseOrganization ||isImpersonating.value) return
if (import.meta.server || !user.value || !featureBaseOrganization ||isImpersonating.value) return
window.Featurebase(
"identify",
{
@@ -49,7 +49,7 @@ const setupForUser = () => {
}
onMounted(() => {
if (process.server) return
if (import.meta.server) return
// Setup base
if (!window.hasOwnProperty('Featurebase') || typeof window.Featurebase !== "function") {
@@ -64,7 +64,7 @@ onMounted(() => {
})
watch(user, (val) => {
if (process.server || !val) return
if (import.meta.server || !val) return
loadScript()
setupForUser()