Skip to content

Commit

Permalink
Merge remote-tracking branch 'development' into organization-system
Browse files Browse the repository at this point in the history
  • Loading branch information
WcaleNieWolny committed Dec 1, 2023
2 parents 58e8554 + 8eaf9ea commit eec8a95
Show file tree
Hide file tree
Showing 50 changed files with 1,701 additions and 330 deletions.
11 changes: 0 additions & 11 deletions .eslintrc.js

This file was deleted.

1,037 changes: 1,037 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
applicationId "ee.forgr.capacitor_go"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1032500999
versionCode 1032500602
versionName "10.325.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
Expand Down
12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import antfu from '@antfu/eslint-config'

export default antfu(
{
ignorePatterns: ['src/types/supabase.types.ts', 'supabase/functions/_utils/supabase.types.ts'],
rules: {
'vue/no-deprecated-slot-attribute': 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
},
},
)
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1032500999;
CURRENT_PROJECT_VERSION = 1032500602;
DEVELOPMENT_TEAM = UVTJ336J2D;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Capgo;
Expand All @@ -373,7 +373,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1032500999;
CURRENT_PROJECT_VERSION = 1032500602;
DEVELOPMENT_TEAM = UVTJ336J2D;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Capgo;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "capgo-app",
"type": "module",
"version": "10.324.0",
"version": "10.325.0-alpha.2",
"private": true,
"scripts": {
"build": "vite build",
Expand Down Expand Up @@ -141,9 +141,9 @@
"@antfu/eslint-config": "2.1.0",
"@capacitor/cli": "^5.5.1",
"@capacitor/core": "^5.5.1",
"@iconify-json/carbon": "1.1.21",
"@iconify-json/carbon": "1.1.22",
"@iconify-json/heroicons": "^1.1.13",
"@iconify-json/ion": "1.1.12",
"@iconify-json/ion": "1.1.13",
"@iconify-json/ls": "1.1.5",
"@iconify/json": "^2.2.145",
"@playwright/test": "next",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/convert_deno_to_node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const mutationsNode = [
{ from: 'return await this.pipeline.hdel(key, ...fields)', to: 'this.pipeline.hdel(key, ...fields)\n return Promise.resolve(0)' },
{ from: '.hscan(key, cursor, opts)', to: '.hscan(key, cursor, \'MATCH\', opts?.pattern ?? \'\', \'COUNT\', opts?.count ?? \'\')' },
{ from: 'import { connect, parseURL } from \'https://deno.land/x/redis@v0.24.0/mod.ts\'', to: 'import { Redis } from \'ioredis\'' },
{ from: 'https://esm.sh/@supabase/supabase-js@^2.2.3', to: '@supabase/supabase-js' },
{ from: 'https://esm.sh/@supabase/supabase-js@^2.38.5', to: '@supabase/supabase-js' },
{ from: 'https://deno.land/x/axiod@0.26.2/mod.ts', to: 'axios' },
{ from: 'https://deno.land/x/s3_lite_client@0.6.1/mod.ts', to: 'minio' },
{ from: '{ S3Client }', to: '{ Client }' },
Expand Down
6 changes: 2 additions & 4 deletions src/components/LineChartStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,15 @@ const chartData = ref<ChartData<'line'>>({
tension: 0.3,
pointRadius: 2,
pointBorderWidth: 0,
},
{
}, {
label: t('prediction'),
data: projectionData.value,
borderColor: 'transparent',
backgroundColor: props.colors[200],
tension: 0.9,
pointRadius: 2,
pointBorderWidth: 0,
},
],
}],
})
const chartOptions = ref({
scales: {
Expand Down
5 changes: 3 additions & 2 deletions src/components/NewUserModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function close() {
clearErrors('create-user')
}
async function submit(form: { first_name: string; last_name: string; email: string }) {
async function submit(form: { first_name: string, last_name: string, email: string }) {
isLoading.value = true
try {
if (!main.canUseMore) {
Expand Down Expand Up @@ -120,7 +120,8 @@ async function submit(form: { first_name: string; last_name: string; email: stri
first_name: user.user?.user_metadata.first_name,
last_name: user.user?.user_metadata.last_name,
email: user.user?.email,
})
},
)
isLoading.value = false
if (error || userTableError)
setErrors('create-user', [userTableError!.message], {})
Expand Down
2 changes: 1 addition & 1 deletion src/components/StatsBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { Stat } from './comp_def'
const props = defineProps<{ stats: Stat[]; mini?: boolean }>()
const props = defineProps<{ stats: Stat[], mini?: boolean }>()
</script>

<template>
Expand Down
20 changes: 16 additions & 4 deletions src/components/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import debounce from 'lodash.debounce'
import { computed, onMounted, ref, watch } from 'vue'
import { initDropdowns } from 'flowbite'
import {
kList, kListItem,
kList,
kListItem,
} from 'konsta/vue'
import { useI18n } from 'vue-i18n'
import type { MobileColType, TableColumn } from './comp_def'
Expand Down Expand Up @@ -34,9 +35,20 @@ interface Props {
const props = defineProps<Props>()
const emit = defineEmits([
'reload', 'reset', 'next', 'prev', 'fastForward', 'fastBackward',
'update:search', 'update:filters', 'update:columns', 'update:currentPage',
'filterClick', 'rowClick', 'sortClick'])
'reload',
'reset',
'next',
'prev',
'fastForward',
'fastBackward',
'update:search',
'update:filters',
'update:columns',
'update:currentPage',
'filterClick',
'rowClick',
'sortClick',
])
const { t } = useI18n()
const searchVal = ref(props.search || '')
// const sorts = ref<TableSort>({})
Expand Down
2 changes: 1 addition & 1 deletion src/components/tables/LogTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const currentVersionsNumber = computed(() => {
return (currentPage.value - 1) * offset
})
function findVersion(id: number, versions: { name: string; id: number }[]) {
function findVersion(id: number, versions: { name: string, id: number }[]) {
return versions.find(elem => elem.id === id)
}
Expand Down
31 changes: 17 additions & 14 deletions src/layouts/settings.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, shallowRef, watch } from 'vue'
import { ref, shallowRef, watchEffect } from 'vue'
import { useI18n } from 'vue-i18n'
import { Capacitor } from '@capacitor/core'
import { useRouter } from 'vue-router'
Expand All @@ -13,7 +13,6 @@ import IconBilling from '~icons/mingcute/bill-fill'
import IconNotification from '~icons/mdi/message-notification'
import IconAdmin from '~icons/eos-icons/admin'
import type { Tab } from '~/components/comp_def'
import { isAdmin, isSpoofed } from '~/services/supabase'
import { useMainStore } from '~/stores/main'
import { openPortal } from '~/services/stripe'
Expand Down Expand Up @@ -81,24 +80,28 @@ if (!Capacitor.isNativePlatform()) {
onClick: openPortal,
})
}
if (main.user?.id) {
isAdmin().then((res) => {
if (!!res || isSpoofed()) {
tabs.value.push({
label: 'admin',
icon: shallowRef(IconAdmin) as any,
key: '/dashboard/settings/admin',
})
}
})
if (main.paying) {
watchEffect(() => {
if (main.paying && !tabs.value.find(tab => tab.label === 'usage')) {
tabs.value.push({
label: 'usage',
icon: shallowRef(IconPlans) as any,
key: '/dashboard/settings/usage',
})
}
}
else if (!main.paying && tabs.value.find(tab => tab.label === 'usage')) {
tabs.value = tabs.value.filter(tab => tab.label !== 'usage')
}
if (main.isAdmin && !tabs.value.find(tab => tab.label === 'admin')) {
tabs.value.push({
label: 'admin',
icon: shallowRef(IconAdmin) as any,
key: '/dashboard/settings/admin',
})
}
else if (!main.isAdmin && tabs.value.find(tab => tab.label === 'admin')) {
tabs.value = tabs.value.filter(tab => tab.label !== 'admin')
}
})
async function gotoOrgSettings() {
type.value = 'organization'
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import './styles/style.css'

import { initPlausible } from './services/plausible'
import formkit from './styles/formkit'
import { getRemoteConfig } from './services/supabase'

await getRemoteConfig()
const app = createApp(App)
app.use(plugin, defaultConfig({
config: {
Expand All @@ -32,7 +34,7 @@ const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL
app.use(router)
initPlausible(import.meta.env.pls_domain as string)
// install all modules under `modules/`
type UserModule = (ctx: { app: typeof app; router: Router }) => void
type UserModule = (ctx: { app: typeof app, router: Router }) => void

Object.values(import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }))
.forEach(i => i.install?.({ app, router }))
Expand Down
15 changes: 9 additions & 6 deletions src/modules/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isSpoofed, spoofUser } from './../services/supabase'
import { isAdmin, isSpoofed, spoofUser } from './../services/supabase'
import type { UserModule } from '~/types'
import { useMainStore } from '~/stores/main'
import { isAllowedAction, isCanceled, isGoodPlan, isPaying, isTrial, useSupabase } from '~/services/supabase'
Expand Down Expand Up @@ -45,22 +45,25 @@ async function guard(next: any, to: string, from: string) {
}
await main.updateDashboard()
initStunning(main.user?.customer_id)
isTrial().then((res) => {
isTrial(main.auth?.id).then((res) => {
// console.log('isTrial', res)
main.trialDaysLeft = res
})
isPaying().then((res) => {
isPaying(main.auth?.id).then((res) => {
main.paying = res
})
isAllowedAction().then((res) => {
isAllowedAction(main.auth?.id).then((res) => {
main.canUseMore = res
})
isGoodPlan().then((res) => {
isGoodPlan(main.auth?.id).then((res) => {
main.goodPlan = res
})
isCanceled().then((res) => {
isCanceled(main.auth?.id).then((res) => {
main.canceled = res
})
isAdmin().then((res) => {
main.isAdmin = res
})

snag.track({
channel: 'user-login',
Expand Down
3 changes: 2 additions & 1 deletion src/pages/app/p/[p]/channel/[channel].vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ref, watch, watchEffect } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import {
kList, kListItem,
kList,
kListItem,
kRange,
kToggle,
} from 'konsta/vue'
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/settings/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function getEmoji(country: string) {
return countryCodeToFlagEmoji(countryCode)
}
async function submit(form: { first_name: string; last_name: string; email: string; country: string }) {
async function submit(form: { first_name: string, last_name: string, email: string, country: string }) {
if (isLoading.value || !main.user?.id)
return
isLoading.value = true
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/settings/ChangePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const supabase = useSupabase()
const { t } = useI18n()
async function submit(form: { password: string; password_confirm: string }) {
async function submit(form: { password: string, password_confirm: string }) {
console.log('submitting', form)
if (isLoading.value)
return
Expand Down
11 changes: 6 additions & 5 deletions src/pages/dashboard/settings/Plans.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function getUsages() {
// get aapp_stats
if (!main.user?.id)
return
stats.value = await getTotalStats()
stats.value = await getTotalStats(main.auth?.id)
await findBestPlan(stats.value).then(res => planSuggest.value = res)
}
Expand All @@ -99,9 +99,9 @@ async function loadData() {
plans.value.push(...pls)
})
await getUsages()
await getCurrentPlanName().then(res => planCurrrent.value = res)
await getCurrentPlanName(main.auth?.id).then(res => planCurrrent.value = res)
try {
await getPlanUsagePercent().then(res => planPercent.value = res)
await getPlanUsagePercent(main.auth?.id).then(res => planPercent.value = res)
}
catch (error) {
console.log(error)
Expand All @@ -120,7 +120,8 @@ watch(
else if (prevMyPlan && !myPlan) {
isLoading.value = true
}
})
},
)
watchEffect(async () => {
if (route.path === '/dashboard/settings/plans') {
Expand All @@ -146,7 +147,7 @@ function isDisabled(plan: Database['public']['Tables']['plans']['Row']) {
const hightLights = computed<Stat[]>(() => ([
{
label: main.paying ? t('Current') : t('failed'),
label: (main.paying || main.trialDaysLeft > 0) ? t('Current') : t('failed'),
value: currentPlan.value?.name,
},
{
Expand Down
Loading

0 comments on commit eec8a95

Please sign in to comment.