Skip to content

Commit 660f274

Browse files
chore: wip
1 parent ff73e22 commit 660f274

File tree

12 files changed

+35
-41
lines changed

12 files changed

+35
-41
lines changed

resources/functions/billing/payments.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export function useBillable() {
8080
})
8181

8282
const res: any = await response.json()
83-
8483

8584
return res
8685
}
@@ -99,15 +98,15 @@ export function useBillable() {
9998
},
10099
)
101100

102-
if (error)
103-
console.error(error.message) // Display or handle error for the user
101+
if (error) {
102+
console.error(error.message)
103+
} // Display or handle error for the user
104104
else {
105-
if (! paymentStore.hasPaymentMethods)
105+
if (!paymentStore.hasPaymentMethods)
106106
await setDefaultPaymentMethod(setupIntent.payment_method)
107107

108108
alert('Successfully saved payment method!')
109109
}
110-
111110
}
112111

113112
function isEmpty(object: any) {

resources/stores/payment.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1+
import type Stripe from 'stripe'
12
import type { StripePaymentMethod } from '../types/billing'
2-
import Stripe from 'stripe'
33

44
const apiUrl = `http://localhost:3008`
55

6-
76
export const usePaymentStore = defineStore('payment', {
87
state: (): any => {
98
return {
109
paymentMethods: [] as StripePaymentMethod[],
1110
defaultPaymentMethod: {} as StripePaymentMethod,
1211
stripeCustomer: {} as Stripe.Customer,
13-
paymentPlans: [] as any[]
12+
paymentPlans: [] as any[],
1413
}
1514
},
1615

@@ -29,9 +28,9 @@ export const usePaymentStore = defineStore('payment', {
2928

3029
async deletePaymentMethod(paymentMethod: string): Promise<string> {
3130
const url = 'http://localhost:3008/stripe/delete-payment-method'
32-
31+
3332
const body = { paymentMethod }
34-
33+
3534
const response = await fetch(url, {
3635
method: 'POST',
3736
headers: {
@@ -40,10 +39,9 @@ export const usePaymentStore = defineStore('payment', {
4039
},
4140
body: JSON.stringify(body),
4241
})
43-
42+
4443
const res: any = await response.json()
45-
46-
44+
4745
return res
4846
},
4947

@@ -86,7 +84,7 @@ export const usePaymentStore = defineStore('payment', {
8684
},
8785
getStripeCustomer(state): any {
8886
return state.stripeCustomer
89-
}
87+
},
9088
},
9189
})
9290

resources/views/dashboard/components/billing/payment-method-list.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ async function deletePayment(paymentMethodId: string) {
3636
<button
3737
aria-label="delete"
3838
type="button"
39-
@click="deletePayment(method.id)"
4039
class="border rounded-md bg-white px-2 py-1 text-sm text-white font-semibold shadow-sm hover:bg-blue-gray-50 focus-visible:outline-2 focus-visible:outline-blue-600 focus-visible:outline-offset-2 focus-visible:outline"
40+
@click="deletePayment(method.id)"
4141
>
4242
<svg class="h-4 w-4 text-gray-700" data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
4343
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />

resources/views/dashboard/components/billing/payment-method.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ async function submitPaymentMethod(clientSecret: string, elements: any) {
3030
3131
showStripe.value = false
3232
stripeLoading.value = true
33-
3433
}
3534
3635
function cancelPaymentForm() {

resources/views/dashboard/components/billing/plans.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
2-
import { useBillable } from '../../../../functions/billing/payments'
32
import { saas } from '@stacksjs/browser'
4-
3+
import { useBillable } from '../../../../functions/billing/payments'
54
65
const checkedPlanType = ref('monthly')
76
const selectedPlan = ref('')
@@ -12,15 +11,15 @@ const { subscribeToPlan } = useBillable()
1211
const loading = ref(true)
1312
1413
const monthlyPricing = computed(() =>
15-
saas.plans.flatMap(product => product.pricing).filter(price => price.interval === 'month')
14+
saas.plans.flatMap(product => product.pricing).filter(price => price.interval === 'month'),
1615
)
1716
1817
const yearlyPricing = computed(() =>
19-
saas.plans.flatMap(product => product.pricing).filter(price => price.interval === 'year')
18+
saas.plans.flatMap(product => product.pricing).filter(price => price.interval === 'year'),
2019
)
2120
2221
const noIntervalPricing = computed(() =>
23-
saas.plans.flatMap(product => product.pricing).filter(price => !price.interval)
22+
saas.plans.flatMap(product => product.pricing).filter(price => !price.interval),
2423
)
2524
2625
const perText = computed(() => {
@@ -39,7 +38,6 @@ const hobbyPrice = computed(() => {
3938
4039
return ((plan?.price || 3900) / 100)
4140
}
42-
4341
4442
if (checkedPlanType.value === 'annually') {
4543
const plan = yearlyPricing.value.find(monthly => monthly.key === 'stacks_hobby_yearly')
@@ -58,7 +56,6 @@ const proPrice = computed(() => {
5856
5957
return ((plan?.price || 5900) / 100)
6058
}
61-
6259
6360
if (checkedPlanType.value === 'annually') {
6461
const plan = yearlyPricing.value.find(monthly => monthly.key === 'stacks_pro_yearly')
@@ -68,7 +65,7 @@ const proPrice = computed(() => {
6865
6966
const plan = noIntervalPricing.value.find(monthly => monthly.key === 'stacks_pro_lifetime')
7067
71-
return ((plan?.price || 74900) / 100)
68+
return ((plan?.price || 74900) / 100)
7269
})
7370
7471
const getPlanTypeKey = computed(() => {
@@ -90,7 +87,7 @@ const getPlanTypeKey = computed(() => {
9087
async function subscribePlan() {
9188
const subscriptionIntent = await subscribeToPlan({
9289
type: getPlanTypeKey.value,
93-
plan: selectedPlan.value
90+
plan: selectedPlan.value,
9491
})
9592
9693
// TODO: fire a toast or something
@@ -143,8 +140,9 @@ async function subscribePlan() {
143140
<div class="pt-8">
144141
<fieldset>
145142
<div class="space-y-4">
146-
<label
147-
class="relative block cursor-pointer border rounded-lg bg-white px-6 py-4 shadow-sm sm:flex sm:justify-between focus:outline-none">
143+
<label
144+
class="relative block cursor-pointer border rounded-lg bg-white px-6 py-4 shadow-sm sm:flex sm:justify-between focus:outline-none"
145+
>
148146
<input v-model="selectedPlan" type="radio" value="hobby" class="sr-only">
149147
<span class="flex items-center">
150148
<span class="flex flex-col text-sm">

storage/framework/core/components/combobox/src/components/Styling.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async function handleCopyCode() {
4848
<div class="mt-5">
4949
<p class="my-3 text-base">
5050
Each component exposes information about its current state via <a class="text-blue-500" href="https://vuejs.org/guide/essentials/slots.html#slot-props" target="_blank">slot props</a> that you can use to conditionally apply different styles or render different content.
51-
<br /><br />
51+
<br><br>
5252
For example, the <code><b>ComboboxOption</b></code> component exposes an <code><b>active</b></code> state, which tells you if the item is currently focused via the mouse or keyboard.
5353
</p>
5454

storage/framework/core/components/radio-group/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts" setup>
2+
import Example from './components/Example.vue'
23
import Footer from './components/Footer.vue'
34
import Hero from './components/Hero.vue'
45
import Installation from './components/Installation.vue'
56
import Styling from './components/Styling.vue'
6-
import Example from './components/Example.vue'
77
import { useSEOHeader } from './composables/useSEOHeader'
88
99
useSEOHeader()

storage/framework/core/components/radio-group/src/components/Example.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import { ref } from 'vue'
3-
import { RadioGroup, RadioGroupOption, RadioGroupLabel } from '../components'
3+
import { RadioGroup, RadioGroupLabel, RadioGroupOption } from '../components'
44
55
const plans = [
66
{
@@ -26,20 +26,21 @@ const plans = [
2626
const selected = ref(plans[0])
2727
</script>
2828

29-
3029
<template>
3130
<section id="example">
3231
<div class="w-full px-4 pt-5">
33-
<div class="mx-auto w-full max-w-md">
32+
<div class="mx-auto max-w-md w-full">
3433
<RadioGroup v-model="selected">
35-
<RadioGroupLabel class="sr-only">Server size</RadioGroupLabel>
34+
<RadioGroupLabel class="sr-only">
35+
Server size
36+
</RadioGroupLabel>
3637
<div class="space-y-2">
3738
<RadioGroupOption
38-
as="template"
3939
v-for="plan in plans"
4040
:key="plan.name"
41-
:value="plan"
4241
v-slot="{ active, checked }"
42+
as="template"
43+
:value="plan"
4344
>
4445
<div
4546
:class="[
@@ -50,7 +51,7 @@ const selected = ref(plans[0])
5051
]"
5152
class="relative flex cursor-pointer rounded-lg px-5 py-4 shadow-md focus:outline-none"
5253
>
53-
<div class="flex w-full items-center justify-between">
54+
<div class="w-full flex items-center justify-between">
5455
<div class="flex items-center">
5556
<div class="text-sm">
5657
<RadioGroupLabel

storage/framework/core/components/radio-group/src/components/Styling.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function handleCopyCode() {
5656
<div class="mt-5">
5757
<p class="my-3 text-base">
5858
Each component exposes information about its current state via <a class="text-blue-500" href="https://vuejs.org/guide/essentials/slots.html#slot-props" target="_blank">slot props</a> that you can use to conditionally apply different styles or render different content.
59-
<br /><br />
59+
<br><br>
6060
For example, the <code>RadioGroupOption</code> component exposes an <code>active</code> state, which tells you if the item is currently focused via the mouse or keyboard.
6161
</p>
6262

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
RadioGroup,
3-
RadioGroupLabel,
43
RadioGroupDescription,
4+
RadioGroupLabel,
55
RadioGroupOption,
66
} from '@headlessui/vue'
77

8-
export { RadioGroup, RadioGroupLabel, RadioGroupDescription, RadioGroupOption }
8+
export { RadioGroup, RadioGroupDescription, RadioGroupLabel, RadioGroupOption }

0 commit comments

Comments
 (0)