Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
Fixing prettier
Acho Arnold6a1b1afd3889
diff --git a/web/components/FirebaseAuth.vue b/web/components/FirebaseAuth.vueindex c53ea9f7..061c0b36 100644--- a/web/components/FirebaseAuth.vue+++ b/web/components/FirebaseAuth.vue@@ -46,7 +46,7 @@ export default class FirebaseAuth extends Vue {return {callbacks: {signInSuccessWithAuthResult: (- authResult: firebase.auth.UserCredential,+ authResult: firebase.auth.UserCredential) => {this.$store.dispatch('addNotification', {message: 'Login successfull!',@@ -66,7 +66,7 @@ export default class FirebaseAuth extends Vue {this.firebaseUIInitialized = trueconst container = this.$refs.authContainer as HTMLElementArray.from(- container.getElementsByClassName('firebaseui-idp-text-long'),+ container.getElementsByClassName('firebaseui-idp-text-long')).forEach((item: Element) => {item.textContent =item.textContent?.replace('Sign in with', 'Continue with') || nulldiff --git a/web/components/MessageThreadHeader.vue b/web/components/MessageThreadHeader.vueindex 125e8c96..1aa43cdf 100644--- a/web/components/MessageThreadHeader.vue+++ b/web/components/MessageThreadHeader.vue@@ -213,7 +213,7 @@ export default class MessageThreadHeader extends Vue {text: this.$options.filters?.phoneNumber(phone.phone_number),value: phone.phone_number,}- },+ })}diff --git a/web/layouts/default.vue b/web/layouts/default.vueindex 0be46745..c72c2aad 100644--- a/web/layouts/default.vue+++ b/web/layouts/default.vue@@ -40,14 +40,11 @@ export default class DefaultLayout extends Vue {mounted() {// this.startPoller()- setTimeout(- () => {- if (this.poller) {- clearInterval(this.poller)- }- },- 60 * 1000 * 60,- )+ setTimeout(() => {+ if (this.poller) {+ clearInterval(this.poller)+ }+ }, 60 * 1000 * 60)}beforeDestroy(): void {@@ -65,7 +62,7 @@ export default class DefaultLayout extends Vue {setAuthHeader((await this.$fire.auth.currentUser?.getIdToken()) ?? '')promises.push(this.$store.dispatch('loadThreads'),- this.$store.dispatch('getHeartbeat'),+ this.$store.dispatch('getHeartbeat'))}@@ -77,8 +74,8 @@ export default class DefaultLayout extends Vue {promises.push(this.$store.dispatch('loadThreadMessages',- this.$store.getters.getThread.id,- ),+ this.$store.getters.getThread.id+ ))}await Promise.all(promises)diff --git a/web/pages/billing/index.vue b/web/pages/billing/index.vueindex 6cb4738d..810fd21b 100644--- a/web/pages/billing/index.vue+++ b/web/pages/billing/index.vue@@ -49,7 +49,7 @@Your next bill is for <b>${{ plan.price }}</b> on<b>{{new Date(- $store.getters.getUser.subscription_renews_at,+ $store.getters.getUser.subscription_renews_at).toLocaleDateString()}}</b></p>@@ -64,7 +64,7 @@You will be downgraded to the <b>FREE</b> plan on<b>{{new Date(- $store.getters.getUser.subscription_ends_at,+ $store.getters.getUser.subscription_ends_at).toLocaleDateString()}}</b></p>@@ -116,7 +116,7 @@of the current billing period on<b>{{new Date(- $store.getters.getUser.subscription_renews_at,+ $store.getters.getUser.subscription_renews_at).toLocaleDateString()}}</b></p>@@ -238,8 +238,8 @@<div class="d-flex"><h2 class="text-h4 font-weight-bold mt-4">{{- $store.getters.getBillingUsage.received_messages- | decimal+ $store.getters.getBillingUsage.received_messages |+ decimal}}</h2></div>@@ -411,7 +411,7 @@ export default Vue.extend({plan(): PaymentPlan {return this.plans.find((x) =>- x.id === (this.$store.getters.getUser?.subscription_name || 'free'),+ x.id === (this.$store.getters.getUser?.subscription_name || 'free'))!},isOnFreePlan(): boolean {diff --git a/web/pages/heartbeats/_id.vue b/web/pages/heartbeats/_id.vueindex 6a53816e..84d1f9d5 100644--- a/web/pages/heartbeats/_id.vue+++ b/web/pages/heartbeats/_id.vue@@ -115,7 +115,7 @@ export default {if (index < this.heartbeats.length - 1) {interval = this.getDiff(heartbeat.timestamp,- this.heartbeats[index + 1].timestamp,+ this.heartbeats[index + 1].timestamp)}const item = {@@ -148,7 +148,7 @@ export default {}const duration = intervalToDuration({start: new Date(- context.dataset.data[context.dataIndex + 1].x,+ context.dataset.data[context.dataIndex + 1].x),end: new Date(context.dataset.data[context.dataIndex].x),})diff --git a/web/pages/messages/index.vue b/web/pages/messages/index.vueindex a1a2a154..cb6b752e 100644--- a/web/pages/messages/index.vue+++ b/web/pages/messages/index.vue@@ -109,8 +109,8 @@ export default {errors.set('to',response.data.data.to.map((x) =>- x.replace('to field', 'phone number field'),- ),+ x.replace('to field', 'phone number field')+ ))}if (response.data.data.from) {diff --git a/web/pages/settings/index.vue b/web/pages/settings/index.vueindex 9b439b5a..d23a482a 100644--- a/web/pages/settings/index.vue+++ b/web/pages/settings/index.vue@@ -738,7 +738,7 @@ export default Vue.extend({id: webhook.id,url: webhook.url,phone_numbers: webhook.phone_numbers.filter(- (x) => this.phoneNumbers.find((y) => y === x) !== undefined,+ (x) => this.phoneNumbers.find((y) => y === x) !== undefined),signing_key: webhook.signing_key,events: webhook.events,@@ -768,7 +768,7 @@ export default Vue.extend({url: '',signing_key: '',phone_numbers: this.$store.getters.getPhones.map(- (phone) => phone.phone_number,+ (phone) => phone.phone_number),events: ['message.phone.received',diff --git a/web/plugins/chart.ts b/web/plugins/chart.tsindex dcae6717..a5ad4a71 100644--- a/web/plugins/chart.ts+++ b/web/plugins/chart.ts@@ -26,7 +26,7 @@ ChartJS.register(CategoryScale,LinearScale,LineElement,- ArcElement,+ ArcElement)Vue.component('BarChart', {diff --git a/web/plugins/errors.ts b/web/plugins/errors.tsindex 437b641f..813c6b63 100644--- a/web/plugins/errors.ts+++ b/web/plugins/errors.ts@@ -21,7 +21,7 @@ const sanitize = (key: string, values: Array<string>): Array<string> => {.split(' char').join(' character').split(' field ')- .join(' '),+ .join(' '))})}diff --git a/web/store/index.ts b/web/store/index.tsindex 3b721115..6b76e45f 100644--- a/web/store/index.ts+++ b/web/store/index.ts@@ -327,7 +327,7 @@ export const actions = {if (context.state.user && context.state.user.active_phone_id) {const phone = response.data.data.find(- (x: EntitiesPhone) => x.id === context.state.user?.active_phone_id,+ (x: EntitiesPhone) => x.id === context.state.user?.active_phone_id)if (phone) {context.commit('setOwner', phone.phone_number)@@ -351,7 +351,7 @@ export const actions = {async updatePhone(context: ActionContext<State, State>,- phone: EntitiesPhone,+ phone: EntitiesPhone) {await axios.put(`/v1/phones`, {@@ -359,7 +359,7 @@ export const actions = {sim: phone.sim,phone_number: phone.phone_number,message_expiration_seconds: parseInt(- phone.message_expiration_seconds.toString(),+ phone.message_expiration_seconds.toString()),max_send_attempts: parseInt(phone.max_send_attempts.toString()),messages_per_minute: parseInt(phone.messages_per_minute.toString()),@@ -379,7 +379,7 @@ export const actions = {async handleAxiosError(context: ActionContext<State, State>,- error: AxiosError,+ error: AxiosError) {const errorMessage =error.response?.data?.data[Object.keys(error.response?.data?.data)[0]][0]@@ -394,7 +394,7 @@ export const actions = {getHeartbeat(context: ActionContext<State, State>,- limit = 1,+ limit = 1): Promise<Array<Heartbeat>> {return new Promise<Array<Heartbeat>>((resolve, reject) => {axios@@ -430,7 +430,7 @@ export const actions = {async sendMessage(context: ActionContext<State, State>,- request: SendMessageRequest,+ request: SendMessageRequest) {try {const response = await axios.post('/v1/messages/send', request)@@ -455,7 +455,7 @@ export const actions = {addNotification(context: ActionContext<State, State>,- request: NotificationRequest,+ request: NotificationRequest) {context.commit('setNotification', request)},@@ -466,7 +466,7 @@ export const actions = {loadThreadMessages(context: ActionContext<State, State>,- threadId: string | null,+ threadId: string | null): Promise<Array<Message>> {context.commit('setThreadId', threadId)return new Promise<Array<Message>>((resolve, reject) => {@@ -494,7 +494,7 @@ export const actions = {async setAuthUser(context: ActionContext<State, State>,- user: AuthUser | null | undefined,+ user: AuthUser | null | undefined) {const userChanged = user?.id !== context.getters.getAuthUser?.id@@ -511,7 +511,7 @@ export const actions = {])const phone = context.getters.getPhones.find(- (x: EntitiesPhone) => x.id === context.getters.getUser.active_phone_id,+ (x: EntitiesPhone) => x.id === context.getters.getUser.active_phone_id)if (phone) {await context.dispatch('updateUser', {@@ -524,7 +524,7 @@ export const actions = {async onAuthStateChanged(context: ActionContext<State, State>,// @ts-ignore- { authUser },+ { authUser }) {if (authUser == null) {await Promise.all([@@ -544,7 +544,7 @@ export const actions = {async onIdTokenChanged(_: ActionContext<State, State>,// @ts-ignore- { authUser },+ { authUser }) {if (authUser == null) {setApiKey('')@@ -559,7 +559,7 @@ export const actions = {async updateUser(context: ActionContext<State, State>,- payload: { owner: string; timezone: string },+ payload: { owner: string; timezone: string }) {await context.commit('setOwner', payload.owner)@@ -579,7 +579,7 @@ export const actions = {async updateThread(context: ActionContext<State, State>,- payload: { threadId: string; isArchived: boolean },+ payload: { threadId: string; isArchived: boolean }) {await axios.put(`/v1/message-threads/${payload.threadId}`, {is_archived: payload.isArchived,@@ -632,7 +632,7 @@ export const actions = {createDiscord(context: ActionContext<State, State>,- payload: RequestsDiscordStore,+ payload: RequestsDiscordStore): Promise<EntitiesDiscord> {return new Promise<EntitiesDiscord>((resolve, reject) => {axios@@ -681,13 +681,13 @@ export const actions = {updateDiscordIntegration(context: ActionContext<State, State>,- payload: RequestsDiscordUpdate & { id: string },+ payload: RequestsDiscordUpdate & { id: string }) {return new Promise<EntitiesDiscord>((resolve, reject) => {axios.put<ResponsesDiscordResponse>(`/v1/discord-integrations/${payload.id}`,- payload,+ payload).then((response: AxiosResponse<ResponsesDiscordResponse>) => {resolve(response.data.data)@@ -708,7 +708,7 @@ export const actions = {deleteDiscordIntegration(context: ActionContext<State, State>,- payload: string,+ payload: string) {return new Promise<void>((resolve, reject) => {axios@@ -732,7 +732,7 @@ export const actions = {createWebhook(context: ActionContext<State, State>,- payload: RequestsWebhookStore,+ payload: RequestsWebhookStore) {return new Promise<EntitiesWebhook>((resolve, reject) => {axios@@ -780,7 +780,7 @@ export const actions = {updateWebhook(context: ActionContext<State, State>,- payload: RequestsWebhookUpdate & { id: string },+ payload: RequestsWebhookUpdate & { id: string }) {return new Promise<EntitiesWebhook>((resolve, reject) => {axios