Skip to content

Commit c18f36a

Browse files
committed
Fix billing page
1 parent 8f9ab0e commit c18f36a

9 files changed

Lines changed: 354 additions & 31 deletions

File tree

web/.env.production

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ APP_GITHUB_URL=https://github.com/NdoleStudio/httpsms
66
APP_DOCUMENTATION_URL=https://docs.httpsms.com
77
APP_DOWNLOAD_URL=https://github.com/NdoleStudio/httpsms/releases/latest/download/HttpSms.apk
88
APP_ENV=production
9+
10+
CHECKOUT_URL=https://httpsms.lemonsqueezy.com/checkout/buy/277d9687-836f-4bfb-8065-8bbc9b9ca674

web/components/LoadingButton.vue

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<template>
2+
<v-btn
3+
:block="block"
4+
:type="type"
5+
:small="small"
6+
:large="large"
7+
:x-large="xLarge"
8+
:color="color"
9+
:text="text"
10+
:tile="tile"
11+
exact
12+
:disabled="isLoading"
13+
@click.prevent="onClick"
14+
>
15+
<v-progress-circular
16+
v-if="isClicked"
17+
:size="small ? 20 : 25"
18+
color="grey"
19+
class="mr-2"
20+
indeterminate
21+
></v-progress-circular>
22+
<v-icon v-if="icon && !isLoading" left>{{ icon }}</v-icon>
23+
<slot></slot>
24+
</v-btn>
25+
</template>
26+
27+
<script lang="ts">
28+
import { Component, PropSync, Prop, Vue, Watch } from 'vue-property-decorator'
29+
@Component
30+
export default class SocialButtons extends Vue {
31+
@Prop({ required: false, type: String, default: 'submit' }) type!: string
32+
@Prop({ required: false, type: Boolean, default: false }) block!: boolean
33+
@Prop({ required: false, type: Boolean, default: false }) large!: boolean
34+
@Prop({ required: false, type: Boolean, default: false }) xLarge!: boolean
35+
@Prop({ required: false, type: Boolean, default: false }) tile!: boolean
36+
@Prop({ required: false, type: Boolean, default: false }) text!: boolean
37+
@Prop({ required: false, type: Boolean, default: false }) small!: boolean
38+
@Prop({ required: false, type: String, default: 'primary' }) color!: string
39+
@Prop({ required: false, type: String, default: null }) icon!: string | null
40+
@PropSync('loading', { required: true, type: Boolean }) isLoading!: boolean
41+
42+
isClicked = false
43+
44+
@Watch('loading')
45+
onChildChanged(submitting: boolean) {
46+
if (!submitting && this.isClicked) {
47+
this.isClicked = false
48+
}
49+
}
50+
51+
onClick() {
52+
this.isClicked = true
53+
this.$emit('click')
54+
}
55+
}
56+
</script>

web/layouts/default.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class DefaultLayout extends Vue {
5757
if (this.$store.getters.getAuthUser && this.$store.getters.getOwner) {
5858
promises.push(
5959
this.$store.dispatch('loadThreads'),
60-
this.$store.dispatch('getHeartbeat')
60+
this.$store.dispatch('getHeartbeat'),
6161
)
6262
}
6363
@@ -69,8 +69,8 @@ export default class DefaultLayout extends Vue {
6969
promises.push(
7070
this.$store.dispatch(
7171
'loadThreadMessages',
72-
this.$store.getters.getThread.id
73-
)
72+
this.$store.getters.getThread.id,
73+
),
7474
)
7575
}
7676
await Promise.all(promises)

web/middleware/user.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const setUser = (context: Context): Promise<User | null> => {
1515
let stateUser: StateUser | null = null
1616
if (user) {
1717
stateUser = {
18+
email: user.email,
19+
displayName: user.displayName,
1820
id: user.uid,
1921
}
2022
setAuthHeader(await user.getIdToken())
@@ -23,7 +25,7 @@ const setUser = (context: Context): Promise<User | null> => {
2325
resolve(user)
2426
})
2527
},
26-
reject
28+
reject,
2729
)
2830
})
2931
}

web/models/user.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ export interface User {
33
email: string
44
api_key: string
55
active_phone_id: string | null
6+
subscription_ends_at: string
7+
/** @example "8f9c71b8-b84e-4417-8408-a62274f65a08" */
8+
subscription_id: string
9+
/** @example "free" */
10+
subscription_name: string
11+
/** @example "2022-06-05T14:26:02.302718+03:00" */
12+
subscription_renews_at: string
13+
/** @example "on_trial" */
14+
subscription_status: string
615
created_at: string
716
updated_at: string
817
}

web/nuxt.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,16 @@ export default {
107107
measurementId: 'G-EZ5W9DVK8T',
108108
},
109109
services: {
110-
auth: true,
111110
analytics: true,
111+
auth: {
112+
persistence: 'local', // default
113+
initialize: {
114+
onAuthStateChangedAction: 'onAuthStateChanged',
115+
onIdTokenChangedAction: 'onAuthStateChanged',
116+
subscribeManually: false,
117+
},
118+
ssr: false,
119+
},
112120
},
113121
},
114122
],
@@ -150,6 +158,10 @@ export default {
150158
exclude: ['/messages', '/settings', '/threads**'],
151159
},
152160

161+
publicRuntimeConfig: {
162+
checkoutURL: process.env.CHECKOUT_URL,
163+
},
164+
153165
// Build Configuration: https://go.nuxtjs.dev/config-build
154166
build: {},
155167
}

0 commit comments

Comments
 (0)