appfunnel 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +65 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/default/appfunnel.config.ts +2 -0
- package/templates/default/src/components/ConsentDrawer.tsx +70 -0
- package/templates/default/src/components/Header.tsx +37 -0
- package/templates/default/src/components/paywall/PaymentCheckoutDialog.tsx +76 -0
- package/templates/default/src/pages/birthday.tsx +66 -0
- package/templates/default/src/pages/download.tsx +67 -0
- package/templates/default/src/pages/email.tsx +95 -0
- package/templates/default/src/pages/intro.tsx +109 -0
- package/templates/default/src/pages/multi-select.tsx +79 -0
- package/templates/default/src/pages/name.tsx +48 -0
- package/templates/default/src/pages/paywall.tsx +191 -0
- package/templates/default/src/pages/single-select.tsx +61 -0
- package/templates/default/src/pages/upsell.tsx +158 -0
- package/templates/default/template.json +1 -1
- package/templates/default/src/pages/index.tsx +0 -37
- package/templates/default/src/pages/loading.tsx +0 -76
- package/templates/default/src/pages/result.tsx +0 -38
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePage,
|
|
3
|
+
useProducts,
|
|
4
|
+
useNavigation,
|
|
5
|
+
usePayment,
|
|
6
|
+
} from '@appfunnel-dev/sdk'
|
|
7
|
+
import { motion } from '@appfunnel-dev/sdk/elements'
|
|
8
|
+
import {
|
|
9
|
+
PaymentCheckoutDialog,
|
|
10
|
+
type PaymentCheckoutDialogHandle,
|
|
11
|
+
} from '../components/paywall/PaymentCheckoutDialog'
|
|
12
|
+
import { useRef } from 'react'
|
|
13
|
+
|
|
14
|
+
export const page = definePage({
|
|
15
|
+
name: 'Paywall',
|
|
16
|
+
type: 'paywall',
|
|
17
|
+
routes: [{ to: 'upsell' }],
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export default function Paywall() {
|
|
21
|
+
const { products, selected, select } = useProducts()
|
|
22
|
+
const { goToNextPage } = useNavigation()
|
|
23
|
+
const { loading } = usePayment()
|
|
24
|
+
const checkoutRef = useRef<PaymentCheckoutDialogHandle>(null)
|
|
25
|
+
|
|
26
|
+
const plans = products.filter((p) => !p.id.startsWith('upsell'))
|
|
27
|
+
|
|
28
|
+
const handleContinue = () => {
|
|
29
|
+
checkoutRef.current?.open()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const canContinue = selected && !loading
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className="min-h-screen bg-white flex flex-col items-center">
|
|
36
|
+
<div className="flex flex-col max-w-[672px] mx-auto w-full px-4 pb-32">
|
|
37
|
+
{/* Header */}
|
|
38
|
+
<div className="pt-8 pb-6 text-center">
|
|
39
|
+
<h1 className="text-[28px] font-bold text-[#171717]">
|
|
40
|
+
Choose your plan
|
|
41
|
+
</h1>
|
|
42
|
+
<p className="text-base text-[#727272] mt-2">
|
|
43
|
+
Start your journey today
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
{/* Features */}
|
|
48
|
+
<div className="flex flex-col gap-3 mb-8">
|
|
49
|
+
{[
|
|
50
|
+
'Personalized plan based on your answers',
|
|
51
|
+
'Track your progress over time',
|
|
52
|
+
'Access to all premium features',
|
|
53
|
+
'Cancel anytime, no questions asked',
|
|
54
|
+
].map((text) => (
|
|
55
|
+
<div key={text} className="flex items-center gap-3">
|
|
56
|
+
<div className="w-6 h-6 rounded-full bg-blue-600 flex items-center justify-center shrink-0">
|
|
57
|
+
<svg
|
|
58
|
+
width="14"
|
|
59
|
+
height="14"
|
|
60
|
+
viewBox="0 0 24 24"
|
|
61
|
+
fill="none"
|
|
62
|
+
stroke="white"
|
|
63
|
+
strokeWidth="2.75"
|
|
64
|
+
strokeLinecap="round"
|
|
65
|
+
strokeLinejoin="round"
|
|
66
|
+
>
|
|
67
|
+
<polyline points="20 6 9 17 4 12" />
|
|
68
|
+
</svg>
|
|
69
|
+
</div>
|
|
70
|
+
<span className="text-[#171717] text-[15px]">
|
|
71
|
+
{text}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
{/* Plan cards */}
|
|
78
|
+
<div className="space-y-3 mb-6">
|
|
79
|
+
{plans.map((product) => {
|
|
80
|
+
const isSelected = selected?.id === product.id
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<button
|
|
84
|
+
key={product.id}
|
|
85
|
+
onClick={() => select(product.id)}
|
|
86
|
+
className={`w-full flex items-center justify-between text-left transition-all rounded-2xl px-5 py-4 border-2 ${
|
|
87
|
+
isSelected
|
|
88
|
+
? 'border-blue-600 bg-blue-50'
|
|
89
|
+
: 'border-gray-200 bg-transparent'
|
|
90
|
+
}`}
|
|
91
|
+
>
|
|
92
|
+
<div className="flex items-center gap-3">
|
|
93
|
+
<div
|
|
94
|
+
className={`w-[22px] h-[22px] rounded-full border-2 flex items-center justify-center shrink-0 ${
|
|
95
|
+
isSelected
|
|
96
|
+
? 'border-blue-600 bg-blue-600'
|
|
97
|
+
: 'border-gray-300 bg-transparent'
|
|
98
|
+
}`}
|
|
99
|
+
>
|
|
100
|
+
{isSelected && (
|
|
101
|
+
<svg
|
|
102
|
+
width="14"
|
|
103
|
+
height="14"
|
|
104
|
+
viewBox="0 0 24 24"
|
|
105
|
+
fill="none"
|
|
106
|
+
stroke="white"
|
|
107
|
+
strokeWidth="2.75"
|
|
108
|
+
strokeLinecap="round"
|
|
109
|
+
strokeLinejoin="round"
|
|
110
|
+
>
|
|
111
|
+
<polyline points="20 6 9 17 4 12" />
|
|
112
|
+
</svg>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
<div className="flex flex-col">
|
|
116
|
+
<span className="text-[#171717] text-base font-bold">
|
|
117
|
+
{product.displayName}
|
|
118
|
+
</span>
|
|
119
|
+
<span className="text-[#727272] text-sm">
|
|
120
|
+
{product.price}
|
|
121
|
+
{product.period
|
|
122
|
+
? ` / ${product.period}`
|
|
123
|
+
: ''}
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
{product.hasTrial && (
|
|
128
|
+
<span className="text-xs font-bold text-blue-600 bg-blue-50 px-2 py-1 rounded-full">
|
|
129
|
+
{product.trialDays}-day trial
|
|
130
|
+
</span>
|
|
131
|
+
)}
|
|
132
|
+
</button>
|
|
133
|
+
)
|
|
134
|
+
})}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
{/* Legal text */}
|
|
138
|
+
<p className="text-center text-gray-400 text-[11px] leading-4 mb-6">
|
|
139
|
+
By continuing, you agree that your subscription will
|
|
140
|
+
automatically renew at the regular price at the end of your
|
|
141
|
+
plan period. You can cancel at any time.
|
|
142
|
+
</p>
|
|
143
|
+
|
|
144
|
+
{/* Money-back guarantee */}
|
|
145
|
+
<div className="flex items-center gap-3 justify-center py-4">
|
|
146
|
+
<svg
|
|
147
|
+
width="28"
|
|
148
|
+
height="28"
|
|
149
|
+
viewBox="0 0 24 24"
|
|
150
|
+
fill="#2563EB"
|
|
151
|
+
stroke="none"
|
|
152
|
+
>
|
|
153
|
+
<path d="M12 2L3 5v6.09c0 5.05 3.41 9.76 9 10.91 5.59-1.15 9-5.86 9-10.91V5l-9-3zm-2 15l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z" />
|
|
154
|
+
</svg>
|
|
155
|
+
<div className="flex flex-col">
|
|
156
|
+
<span className="font-bold text-[#171717] text-sm">
|
|
157
|
+
Money-back guarantee
|
|
158
|
+
</span>
|
|
159
|
+
<span className="text-[#727272] text-xs">
|
|
160
|
+
Not satisfied? Get a full refund within 30 days.
|
|
161
|
+
</span>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
{/* Sticky continue */}
|
|
167
|
+
<div className="fixed bottom-0 left-0 right-0 z-30 bg-white px-4 py-3 pb-[max(12px,env(safe-area-inset-bottom))] border-t border-gray-200">
|
|
168
|
+
<div className="max-w-[672px] mx-auto">
|
|
169
|
+
<motion.button
|
|
170
|
+
whileTap={canContinue ? { scale: 0.95 } : {}}
|
|
171
|
+
transition={{ duration: 0.15 }}
|
|
172
|
+
onClick={handleContinue}
|
|
173
|
+
disabled={!canContinue}
|
|
174
|
+
className={`w-full py-4 rounded-2xl text-lg font-bold border-none ${
|
|
175
|
+
canContinue
|
|
176
|
+
? 'bg-blue-600 text-white cursor-pointer'
|
|
177
|
+
: 'bg-gray-400 text-white cursor-not-allowed'
|
|
178
|
+
}`}
|
|
179
|
+
>
|
|
180
|
+
Continue
|
|
181
|
+
</motion.button>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<PaymentCheckoutDialog
|
|
186
|
+
ref={checkoutRef}
|
|
187
|
+
onSuccess={goToNextPage}
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { definePage } from '@appfunnel-dev/sdk'
|
|
2
|
+
import { SingleSelect } from '@appfunnel-dev/sdk/elements'
|
|
3
|
+
import { Header } from '../components/Header'
|
|
4
|
+
|
|
5
|
+
export const page = definePage({
|
|
6
|
+
name: 'Goal',
|
|
7
|
+
routes: [{ to: 'multi-select' }],
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export default function Goal() {
|
|
11
|
+
return (
|
|
12
|
+
<div className="min-h-screen bg-white flex flex-col max-w-[672px] mx-auto w-full">
|
|
13
|
+
<Header showBack={false} />
|
|
14
|
+
<div className="flex-1 flex flex-col px-4 pt-8 pb-6">
|
|
15
|
+
<h1 className="text-[30px] leading-tight font-bold text-[#171717] mb-6">
|
|
16
|
+
What's your main goal?
|
|
17
|
+
</h1>
|
|
18
|
+
<SingleSelect
|
|
19
|
+
responseKey="goal"
|
|
20
|
+
className="flex flex-col gap-3"
|
|
21
|
+
options={[
|
|
22
|
+
{ label: 'Get started quickly', sublabel: 'Jump right in', value: 'get_started' },
|
|
23
|
+
{ label: 'Learn something new', sublabel: 'Explore and grow', value: 'learn' },
|
|
24
|
+
{ label: 'Improve my routine', sublabel: 'Level up daily habits', value: 'improve' },
|
|
25
|
+
{ label: 'Track my progress', sublabel: 'Stay on top of goals', value: 'track' },
|
|
26
|
+
{ label: 'Something else', sublabel: 'Tell us more later', value: 'other' },
|
|
27
|
+
]}
|
|
28
|
+
renderItem={({ item, active }) => (
|
|
29
|
+
<div
|
|
30
|
+
className={`w-full px-4 py-4 rounded-2xl text-left transition-all border-2 ${
|
|
31
|
+
active
|
|
32
|
+
? 'border-blue-600 bg-blue-50'
|
|
33
|
+
: 'border-transparent bg-[#F5F5F5]'
|
|
34
|
+
}`}
|
|
35
|
+
>
|
|
36
|
+
<div className="flex items-center gap-3">
|
|
37
|
+
<div
|
|
38
|
+
className={`w-5 h-5 rounded-full border-2 flex items-center justify-center shrink-0 ${
|
|
39
|
+
active ? 'border-blue-600 bg-blue-600' : 'border-gray-300'
|
|
40
|
+
}`}
|
|
41
|
+
>
|
|
42
|
+
{active && (
|
|
43
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="white" strokeWidth="3">
|
|
44
|
+
<polyline points="20 6 9 17 4 12" />
|
|
45
|
+
</svg>
|
|
46
|
+
)}
|
|
47
|
+
</div>
|
|
48
|
+
<div>
|
|
49
|
+
<div className="text-base font-semibold text-[#171717]">{item.label}</div>
|
|
50
|
+
{item.sublabel && (
|
|
51
|
+
<div className="text-sm text-[#727272]">{item.sublabel}</div>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePage,
|
|
3
|
+
useProducts,
|
|
4
|
+
useNavigation,
|
|
5
|
+
usePayment,
|
|
6
|
+
} from '@appfunnel-dev/sdk'
|
|
7
|
+
import { Loading, motion } from '@appfunnel-dev/sdk/elements'
|
|
8
|
+
|
|
9
|
+
export const page = definePage({
|
|
10
|
+
name: 'Upsell',
|
|
11
|
+
type: 'upsell',
|
|
12
|
+
routes: [{ to: 'download' }],
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export default function Upsell() {
|
|
16
|
+
const { products } = useProducts()
|
|
17
|
+
const { goToNextPage } = useNavigation()
|
|
18
|
+
const { loading, purchase } = usePayment()
|
|
19
|
+
|
|
20
|
+
const upsellProduct = products.find((p) => p.id.startsWith('upsell'))
|
|
21
|
+
|
|
22
|
+
const handleAdd = () => {
|
|
23
|
+
if (!upsellProduct) return
|
|
24
|
+
purchase(upsellProduct.id, {
|
|
25
|
+
onSuccess: goToNextPage,
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="min-h-screen bg-white flex flex-col items-center">
|
|
31
|
+
{/* Skip header */}
|
|
32
|
+
<div className="w-full max-w-[672px] flex justify-end px-4 pt-4">
|
|
33
|
+
<button
|
|
34
|
+
onClick={goToNextPage}
|
|
35
|
+
className="p-2 text-gray-400 hover:text-gray-600"
|
|
36
|
+
>
|
|
37
|
+
<svg
|
|
38
|
+
width="24"
|
|
39
|
+
height="24"
|
|
40
|
+
viewBox="0 0 24 24"
|
|
41
|
+
fill="none"
|
|
42
|
+
stroke="currentColor"
|
|
43
|
+
strokeWidth="2"
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
>
|
|
47
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
48
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
49
|
+
</svg>
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
{/* Content */}
|
|
54
|
+
<div className="max-w-[672px] w-full flex flex-col gap-6 px-4 pb-32">
|
|
55
|
+
{/* Badge */}
|
|
56
|
+
<div className="flex justify-center">
|
|
57
|
+
<span className="bg-blue-50 text-blue-600 text-sm font-bold px-4 py-1.5 rounded-full">
|
|
58
|
+
Special one-time offer
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{/* Title */}
|
|
63
|
+
<div className="text-center">
|
|
64
|
+
<h1 className="text-[28px] font-bold text-[#171717]">
|
|
65
|
+
Unlock the full experience
|
|
66
|
+
</h1>
|
|
67
|
+
<p className="text-base text-[#727272] mt-2">
|
|
68
|
+
Add premium features to supercharge your results
|
|
69
|
+
</p>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
{/* Features */}
|
|
73
|
+
<div className="flex flex-col gap-4">
|
|
74
|
+
{[
|
|
75
|
+
{
|
|
76
|
+
title: 'Advanced analytics',
|
|
77
|
+
desc: 'Get detailed insights into your progress',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: 'Priority support',
|
|
81
|
+
desc: 'Get help when you need it most',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: 'Exclusive content',
|
|
85
|
+
desc: 'Access members-only resources',
|
|
86
|
+
},
|
|
87
|
+
].map((item) => (
|
|
88
|
+
<div
|
|
89
|
+
key={item.title}
|
|
90
|
+
className="flex items-start gap-3"
|
|
91
|
+
>
|
|
92
|
+
<div className="w-6 h-6 rounded-full bg-blue-600 flex items-center justify-center shrink-0 mt-0.5">
|
|
93
|
+
<svg
|
|
94
|
+
width="12"
|
|
95
|
+
height="12"
|
|
96
|
+
viewBox="0 0 24 24"
|
|
97
|
+
fill="none"
|
|
98
|
+
stroke="white"
|
|
99
|
+
strokeWidth="3"
|
|
100
|
+
>
|
|
101
|
+
<polyline points="20 6 9 17 4 12" />
|
|
102
|
+
</svg>
|
|
103
|
+
</div>
|
|
104
|
+
<div>
|
|
105
|
+
<span className="text-[15px] font-bold text-[#171717]">
|
|
106
|
+
{item.title}
|
|
107
|
+
</span>
|
|
108
|
+
<p className="text-sm text-[#727272]">
|
|
109
|
+
{item.desc}
|
|
110
|
+
</p>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
{/* Price */}
|
|
117
|
+
{upsellProduct && (
|
|
118
|
+
<div className="text-center py-4">
|
|
119
|
+
<span className="text-3xl font-bold text-[#171717]">
|
|
120
|
+
{upsellProduct.price}
|
|
121
|
+
</span>
|
|
122
|
+
{upsellProduct.period && (
|
|
123
|
+
<span className="text-base text-[#727272]">
|
|
124
|
+
{' '}
|
|
125
|
+
/ {upsellProduct.period}
|
|
126
|
+
</span>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
{/* Legal */}
|
|
132
|
+
<p className="text-center text-gray-400 text-[11px] leading-4">
|
|
133
|
+
By continuing, you agree to be charged the amount shown
|
|
134
|
+
above. Cancel anytime.
|
|
135
|
+
</p>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
{/* Sticky button */}
|
|
139
|
+
<div className="fixed bottom-0 left-0 right-0 z-30 bg-white px-4 py-3 pb-[max(12px,env(safe-area-inset-bottom))] border-t border-gray-200">
|
|
140
|
+
<div className="max-w-[672px] mx-auto flex flex-col gap-2">
|
|
141
|
+
<motion.button
|
|
142
|
+
whileTap={!loading ? { scale: 0.95 } : {}}
|
|
143
|
+
transition={{ duration: 0.15 }}
|
|
144
|
+
onClick={handleAdd}
|
|
145
|
+
disabled={loading}
|
|
146
|
+
className={`w-full py-4 rounded-2xl text-lg font-bold border-none ${
|
|
147
|
+
loading
|
|
148
|
+
? 'bg-gray-400 text-white cursor-not-allowed'
|
|
149
|
+
: 'bg-blue-600 text-white cursor-pointer'
|
|
150
|
+
}`}
|
|
151
|
+
>
|
|
152
|
+
{loading ? <Loading size="sm" color="#fff" /> : 'Add to my plan'}
|
|
153
|
+
</motion.button>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "Default",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "9-page funnel with quiz, account creation, paywall, upsell, and download screens",
|
|
4
4
|
"products": [
|
|
5
5
|
{ "id": "plan_1", "label": "Plan 1", "description": "The cheapest plan — typically a short-term or weekly option" },
|
|
6
6
|
{ "id": "plan_2", "label": "Plan 2", "description": "Mid-tier plan — typically monthly, best balance of value and price" },
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { definePage, useResponse, useNavigation } from '@appfunnel-dev/sdk'
|
|
2
|
-
|
|
3
|
-
export const page = definePage({
|
|
4
|
-
name: 'Landing',
|
|
5
|
-
type: 'default',
|
|
6
|
-
routes: [{ to: 'loading' }],
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export default function Landing() {
|
|
10
|
-
const [goal, setGoal] = useResponse<string>('goal')
|
|
11
|
-
const { goToNextPage } = useNavigation()
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className="flex min-h-screen items-center justify-center p-4">
|
|
15
|
-
<div className="w-full max-w-md space-y-6">
|
|
16
|
-
<h1 className="text-3xl font-bold text-center">Welcome</h1>
|
|
17
|
-
<p className="text-center text-gray-500">
|
|
18
|
-
Tell us about your goal to get started.
|
|
19
|
-
</p>
|
|
20
|
-
<input
|
|
21
|
-
type="text"
|
|
22
|
-
value={goal}
|
|
23
|
-
onChange={(e) => setGoal(e.target.value)}
|
|
24
|
-
placeholder="What's your goal?"
|
|
25
|
-
className="w-full rounded-xl border p-4 text-lg"
|
|
26
|
-
/>
|
|
27
|
-
<button
|
|
28
|
-
onClick={goToNextPage}
|
|
29
|
-
disabled={!goal.trim()}
|
|
30
|
-
className="w-full rounded-xl bg-blue-600 py-4 text-lg font-bold text-white disabled:opacity-50"
|
|
31
|
-
>
|
|
32
|
-
Continue
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { definePage, useNavigation } from '@appfunnel-dev/sdk'
|
|
2
|
-
import { ProgressCircle } from '@appfunnel-dev/sdk/elements'
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
|
|
5
|
-
export const page = definePage({
|
|
6
|
-
name: 'Loading',
|
|
7
|
-
routes: [{ to: 'result' }],
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
const STEPS = [
|
|
11
|
-
'Analyzing your answers',
|
|
12
|
-
'Preparing your plan',
|
|
13
|
-
'Finalizing results',
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
export default function Loading() {
|
|
17
|
-
const { goToNextPage } = useNavigation()
|
|
18
|
-
const [progress, setProgress] = useState(0)
|
|
19
|
-
|
|
20
|
-
const currentStep = Math.min(Math.floor(progress / 34), STEPS.length - 1)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="flex min-h-screen flex-col items-center justify-center gap-8 p-4">
|
|
24
|
-
<h1 className="text-2xl font-bold text-center">
|
|
25
|
-
Preparing your results...
|
|
26
|
-
</h1>
|
|
27
|
-
|
|
28
|
-
<div className="w-40 h-40">
|
|
29
|
-
<ProgressCircle
|
|
30
|
-
duration={3000}
|
|
31
|
-
animation="easeOut"
|
|
32
|
-
trackColor="#e5e7eb"
|
|
33
|
-
fillColor="#3b82f6"
|
|
34
|
-
trackWidth={8}
|
|
35
|
-
fillWidth={8}
|
|
36
|
-
autoStart
|
|
37
|
-
onProgress={setProgress}
|
|
38
|
-
onComplete={() => setTimeout(goToNextPage, 400)}
|
|
39
|
-
renderInner={(p) => (
|
|
40
|
-
<span className="text-2xl font-bold">{p}%</span>
|
|
41
|
-
)}
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div className="flex flex-col gap-3 w-full max-w-xs">
|
|
46
|
-
{STEPS.map((step, i) => (
|
|
47
|
-
<div key={i} className="flex items-center gap-3">
|
|
48
|
-
<div
|
|
49
|
-
className={`w-5 h-5 rounded-full flex items-center justify-center shrink-0 ${
|
|
50
|
-
i <= currentStep ? 'bg-blue-600' : 'bg-gray-200'
|
|
51
|
-
}`}
|
|
52
|
-
>
|
|
53
|
-
{i <= currentStep && (
|
|
54
|
-
<svg
|
|
55
|
-
width="12"
|
|
56
|
-
height="12"
|
|
57
|
-
viewBox="0 0 24 24"
|
|
58
|
-
fill="none"
|
|
59
|
-
stroke="white"
|
|
60
|
-
strokeWidth="2.5"
|
|
61
|
-
>
|
|
62
|
-
<polyline points="20 6 9 17 4 12" />
|
|
63
|
-
</svg>
|
|
64
|
-
)}
|
|
65
|
-
</div>
|
|
66
|
-
<span
|
|
67
|
-
className={`text-sm ${i <= currentStep ? 'text-gray-900' : 'text-gray-400'}`}
|
|
68
|
-
>
|
|
69
|
-
{step}
|
|
70
|
-
</span>
|
|
71
|
-
</div>
|
|
72
|
-
))}
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { definePage, useResponse } from '@appfunnel-dev/sdk'
|
|
2
|
-
import { CountUp } from '@appfunnel-dev/sdk/elements'
|
|
3
|
-
|
|
4
|
-
export const page = definePage({
|
|
5
|
-
name: 'Result',
|
|
6
|
-
routes: [],
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export default function Result() {
|
|
10
|
-
const [goal] = useResponse<string>('goal')
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className="flex min-h-screen flex-col items-center justify-center gap-8 p-4">
|
|
14
|
-
<h1 className="text-3xl font-bold text-center">
|
|
15
|
-
Your plan is ready!
|
|
16
|
-
</h1>
|
|
17
|
-
|
|
18
|
-
<p className="text-gray-500 text-center max-w-md">
|
|
19
|
-
Based on your goal "{goal}", here's what we found:
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
<div className="flex gap-6">
|
|
23
|
-
<div className="flex flex-col items-center gap-2 rounded-xl bg-gray-50 p-6">
|
|
24
|
-
<CountUp from={0} to={94} duration={1500} suffix="%" />
|
|
25
|
-
<span className="text-sm text-gray-500">Match score</span>
|
|
26
|
-
</div>
|
|
27
|
-
<div className="flex flex-col items-center gap-2 rounded-xl bg-gray-50 p-6">
|
|
28
|
-
<CountUp from={0} to={12} duration={1500} suffix=" days" />
|
|
29
|
-
<span className="text-sm text-gray-500">Estimated time</span>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
<button className="w-full max-w-md rounded-xl bg-blue-600 py-4 text-lg font-bold text-white">
|
|
34
|
-
Get Started
|
|
35
|
-
</button>
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|