Compare commits
944 Commits
fix/code-i
...
jazz-vue@0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3c723776e | ||
|
|
33d7789530 | ||
|
|
dcd7398b06 | ||
|
|
c3dd8d0271 | ||
|
|
afe0accad5 | ||
|
|
5835ed1274 | ||
|
|
c5a6b87885 | ||
|
|
294678e18e | ||
|
|
9bb90489f8 | ||
|
|
67efefde3f | ||
|
|
5b28545714 | ||
|
|
b4352e38aa | ||
|
|
8015b8099b | ||
|
|
ee451ebd67 | ||
|
|
9dcd70c896 | ||
|
|
bcacd04773 | ||
|
|
65f20184e5 | ||
|
|
0c1817e5a4 | ||
|
|
addd31d43d | ||
|
|
53a02511e1 | ||
|
|
c66aa631b3 | ||
|
|
49a84bd8c5 | ||
|
|
218ec7eb8d | ||
|
|
54f313e41e | ||
|
|
f14d971a75 | ||
|
|
5290452e52 | ||
|
|
f49c24807a | ||
|
|
938f6767e4 | ||
|
|
b053369589 | ||
|
|
42c7f48c52 | ||
|
|
cd3c2cbe81 | ||
|
|
e55bcafedb | ||
|
|
dd3f7b5685 | ||
|
|
bde9d7637d | ||
|
|
b3f1bba17f | ||
|
|
eb33fe6cf0 | ||
|
|
54cf1b5906 | ||
|
|
c7f48a0750 | ||
|
|
f0419c5cde | ||
|
|
500ceb593c | ||
|
|
51251fd87c | ||
|
|
ce27b1d6f9 | ||
|
|
dc46e36281 | ||
|
|
b2bef6ffc2 | ||
|
|
2766009ce6 | ||
|
|
8f88b212c1 | ||
|
|
32e0133468 | ||
|
|
bf88604943 | ||
|
|
9b66fde52d | ||
|
|
1caa2761a4 | ||
|
|
4d54f1ec50 | ||
|
|
135ca17438 | ||
|
|
a5f9223215 | ||
|
|
b14a045cdb | ||
|
|
0dfbda0487 | ||
|
|
19cb9c3ad3 | ||
|
|
646c12f093 | ||
|
|
fbbaad3e80 | ||
|
|
425aa476c8 | ||
|
|
6922431197 | ||
|
|
31614c0a4f | ||
|
|
07222cd6b0 | ||
|
|
4a88732f89 | ||
|
|
57b69eb8da | ||
|
|
066676c243 | ||
|
|
2aac54b91d | ||
|
|
4e4b53c420 | ||
|
|
e141024656 | ||
|
|
2c48ae0434 | ||
|
|
2bf974390d | ||
|
|
a5116b9d63 | ||
|
|
91ffdcc82f | ||
|
|
810a7e6db2 | ||
|
|
e123715819 | ||
|
|
1b1c0a98af | ||
|
|
9fdf5b4831 | ||
|
|
0d087f3d4c | ||
|
|
e2c222c8a6 | ||
|
|
e410823087 | ||
|
|
5262580222 | ||
|
|
dcc11e5b60 | ||
|
|
1b05fe5b55 | ||
|
|
de8f896bf9 | ||
|
|
d63716a827 | ||
|
|
a1e7fce3b9 | ||
|
|
d5edad7ba5 | ||
|
|
559a4a223b | ||
|
|
16d5553ccd | ||
|
|
ef76c586cc | ||
|
|
8ea4b9761c | ||
|
|
a81f281079 | ||
|
|
3ecb602459 | ||
|
|
ea69ea1f67 | ||
|
|
e430bd061e | ||
|
|
a957485172 | ||
|
|
9060975dfb | ||
|
|
753ec83fdd | ||
|
|
44a9785e93 | ||
|
|
d9b390e538 | ||
|
|
b194f7831b | ||
|
|
9892dd708f | ||
|
|
b60be9405d | ||
|
|
84588e0798 | ||
|
|
e5b170f25e | ||
|
|
b6244582c7 | ||
|
|
cfbf3aa51e | ||
|
|
b1e00d2b18 | ||
|
|
ec330eaa14 | ||
|
|
07dd2c5e69 | ||
|
|
37ab25ff62 | ||
|
|
4750e23800 | ||
|
|
862386c19b | ||
|
|
30df1098e1 | ||
|
|
dad4394eed | ||
|
|
9b70336a38 | ||
|
|
75328ac49d | ||
|
|
0acdcf5f5f | ||
|
|
dafcce5ecd | ||
|
|
c93536f795 | ||
|
|
7bad34f2f5 | ||
|
|
91e0c09f33 | ||
|
|
e2d6ba3922 | ||
|
|
ba460c7b70 | ||
|
|
fc9f7c9199 | ||
|
|
2fcea1e91b | ||
|
|
191ae380c8 | ||
|
|
63d0b0673e | ||
|
|
2b456b5e07 | ||
|
|
e20809d314 | ||
|
|
eef1a5d994 | ||
|
|
daee7b900d | ||
|
|
9afcd38e3b | ||
|
|
477ff0284a | ||
|
|
85604ec4c5 | ||
|
|
1c641ad03d | ||
|
|
87cfca41f0 | ||
|
|
2783f8c308 | ||
|
|
de783063e2 | ||
|
|
9681691701 | ||
|
|
6c7ae1faee | ||
|
|
9472347b57 | ||
|
|
b43395d8ed | ||
|
|
12e9837858 | ||
|
|
422dbc4222 | ||
|
|
e7ccb2c054 | ||
|
|
2f7046002d | ||
|
|
20c1588249 | ||
|
|
f3d3d4dc5d | ||
|
|
3135d711d4 | ||
|
|
14ad9622ea | ||
|
|
0fee2aa21b | ||
|
|
b6de11e125 | ||
|
|
1e6581cd68 | ||
|
|
aaacaf0130 | ||
|
|
7dcca057e7 | ||
|
|
09b815b87e | ||
|
|
63570520a3 | ||
|
|
aeed9595ae | ||
|
|
6755e28d0f | ||
|
|
8e5ff13115 | ||
|
|
23521e6468 | ||
|
|
1627eb7652 | ||
|
|
ff846d9095 | ||
|
|
8d7d62d64f | ||
|
|
65a8227b2b | ||
|
|
a846e0730e | ||
|
|
e9c0e65170 | ||
|
|
14636606bd | ||
|
|
5118ff6585 | ||
|
|
51a0f86b99 | ||
|
|
fa61ab4eb5 | ||
|
|
1ab839bd59 | ||
|
|
af3b13428c | ||
|
|
fe241e7e7c | ||
|
|
d4cdd43cf7 | ||
|
|
c5d5fb25f7 | ||
|
|
38f2276fdd | ||
|
|
b92bfce041 | ||
|
|
e3fd7bf6e3 | ||
|
|
7526e444d6 | ||
|
|
28522bd062 | ||
|
|
824be82f94 | ||
|
|
8a9ef8ac78 | ||
|
|
5fb2f959f1 | ||
|
|
7a900d43f3 | ||
|
|
c8624d56d2 | ||
|
|
8ed7c3947d | ||
|
|
ec0e61a442 | ||
|
|
824d417d4e | ||
|
|
9f1ce81e09 | ||
|
|
48b32b6a72 | ||
|
|
03fec5f1b3 | ||
|
|
cdd7ac98cc | ||
|
|
8218a272ee | ||
|
|
25d146ead8 | ||
|
|
3f4d493286 | ||
|
|
d476b06d0e | ||
|
|
22baf1f547 | ||
|
|
d6ec873b1e | ||
|
|
160b30406b | ||
|
|
3e473eff50 | ||
|
|
47ad35085e | ||
|
|
0b0d06ea44 | ||
|
|
ec546b4cd6 | ||
|
|
cadc5ef913 | ||
|
|
f961dedbd0 | ||
|
|
c7b27e902b | ||
|
|
b1cbc9283a | ||
|
|
f2c7c20a75 | ||
|
|
53705d0ac1 | ||
|
|
4031b7532f | ||
|
|
5ac43c300d | ||
|
|
db3c737e9f | ||
|
|
064174501e | ||
|
|
b0c2a5a53f | ||
|
|
24d9a6b7e1 | ||
|
|
e270295387 | ||
|
|
67fa7be0d4 | ||
|
|
28d7fe9b90 | ||
|
|
3431076350 | ||
|
|
4c70ca198b | ||
|
|
e8092141e8 | ||
|
|
a2aac6791d | ||
|
|
742283263f | ||
|
|
aebd1519c3 | ||
|
|
a9cf6da27a | ||
|
|
2e0378639c | ||
|
|
5ba76eeab5 | ||
|
|
5f4e9a9936 | ||
|
|
279fc1c390 | ||
|
|
865b0e81a7 | ||
|
|
829ab08873 | ||
|
|
2c9b08a080 | ||
|
|
48bda8854f | ||
|
|
2858db7419 | ||
|
|
96ed9adf59 | ||
|
|
5e4905ca99 | ||
|
|
1d4949b70c | ||
|
|
7dacfd03f9 | ||
|
|
bd4191520e | ||
|
|
e3dfb1b06e | ||
|
|
7de210f225 | ||
|
|
d456a8c124 | ||
|
|
1676ff852a | ||
|
|
2217e12ba6 | ||
|
|
a8af6efe1a | ||
|
|
2b40b3052c | ||
|
|
519eda0ac2 | ||
|
|
a8725abfb4 | ||
|
|
2229e5a64f | ||
|
|
ee11b30d3a | ||
|
|
ef78d58729 | ||
|
|
40e2dd0ece | ||
|
|
b60c7c1ce0 | ||
|
|
69cd362114 | ||
|
|
526bf0a3cf | ||
|
|
439f0fe57e | ||
|
|
686433f42e | ||
|
|
3ba258e181 | ||
|
|
d6e143e4d5 | ||
|
|
3e6229da4d | ||
|
|
adfc9a6032 | ||
|
|
9dd926a59a | ||
|
|
9aa6ab6fea | ||
|
|
4207fb5914 | ||
|
|
1a6879b1c2 | ||
|
|
172fec56f6 | ||
|
|
13892071f5 | ||
|
|
cb3e5cbe81 | ||
|
|
b62d75b847 | ||
|
|
d199fb06b3 | ||
|
|
beafbd3088 | ||
|
|
653d8ba69f | ||
|
|
6c23dab790 | ||
|
|
80530a4065 | ||
|
|
e14e61f7d9 | ||
|
|
2ba5ea684e | ||
|
|
a8466946d3 | ||
|
|
105b240076 | ||
|
|
097dd8a646 | ||
|
|
138dd7ee8b | ||
|
|
5b17085b30 | ||
|
|
cb7bdffabe | ||
|
|
0eaa500aef | ||
|
|
90892523da | ||
|
|
774c05cef0 | ||
|
|
693a058890 | ||
|
|
4d20f1bcfc | ||
|
|
36bf3924ff | ||
|
|
6b6fc8b31a | ||
|
|
1649f06667 | ||
|
|
e9bd290dec | ||
|
|
9d76292db5 | ||
|
|
66373bade3 | ||
|
|
40118a0b2c | ||
|
|
86b57415b8 | ||
|
|
cdbc37a144 | ||
|
|
96a1f303fe | ||
|
|
e996c71e83 | ||
|
|
0f704a2330 | ||
|
|
2f206e7613 | ||
|
|
761759c893 | ||
|
|
15c57e24ad | ||
|
|
580e2577c9 | ||
|
|
3804198c02 | ||
|
|
537d56a30e | ||
|
|
5524d3e0cb | ||
|
|
3d2682e3a7 | ||
|
|
0c131f3af4 | ||
|
|
fada6b0eb5 | ||
|
|
c8b94475cd | ||
|
|
162a024345 | ||
|
|
7cd195b3a4 | ||
|
|
ccad5a3c70 | ||
|
|
4268d189cb | ||
|
|
d48712986f | ||
|
|
ba2fda5de1 | ||
|
|
b1d26f23d6 | ||
|
|
e7766746d9 | ||
|
|
7c64d104a6 | ||
|
|
1870a1268a | ||
|
|
a8222368d0 | ||
|
|
72d11ce003 | ||
|
|
6a55a548a0 | ||
|
|
5fbf9770d2 | ||
|
|
707dedb33e | ||
|
|
86d42d9e49 | ||
|
|
64f01915f4 | ||
|
|
9a8fd2ce47 | ||
|
|
4dc7cdb4e6 | ||
|
|
84b993944d | ||
|
|
fa064443a0 | ||
|
|
32e9678394 | ||
|
|
b1850efd7f | ||
|
|
922e3c8244 | ||
|
|
1c063455d1 | ||
|
|
35abeba323 | ||
|
|
84f623097f | ||
|
|
73015a3438 | ||
|
|
7c3bf78fef | ||
|
|
68cb6064a5 | ||
|
|
992d5e572e | ||
|
|
c75a3042ce | ||
|
|
0e87c1c971 | ||
|
|
fa8b20899d | ||
|
|
f24cad1909 | ||
|
|
8b2df0e5e2 | ||
|
|
f93222079f | ||
|
|
514f4c9a72 | ||
|
|
89fac342bf | ||
|
|
02a240ce75 | ||
|
|
6b781cf4a6 | ||
|
|
d5daf060c9 | ||
|
|
604cd4e3a9 | ||
|
|
3446b38f69 | ||
|
|
de12b03d3f | ||
|
|
c3db5cf0b5 | ||
|
|
e7f2521b41 | ||
|
|
0c6cd571c9 | ||
|
|
e1d56a45f7 | ||
|
|
e40e01fce0 | ||
|
|
d70343d864 | ||
|
|
160ab768e9 | ||
|
|
4ff03f67d9 | ||
|
|
5a81adffec | ||
|
|
f4fdb3c14e | ||
|
|
d001144a87 | ||
|
|
ded473b75e | ||
|
|
602c34b0f2 | ||
|
|
77cf06945a | ||
|
|
61f39bb56f | ||
|
|
7cc51b77f3 | ||
|
|
bf303d58e3 | ||
|
|
def5c474e6 | ||
|
|
c81dca23ad | ||
|
|
b470f63f86 | ||
|
|
5c7072bf6e | ||
|
|
bd62b1342a | ||
|
|
af314e8584 | ||
|
|
8ad1878f86 | ||
|
|
2fe5cd1326 | ||
|
|
2ae0b8df0d | ||
|
|
77dc51d466 | ||
|
|
bd645db4cc | ||
|
|
af46c68a4a | ||
|
|
fb58cb9299 | ||
|
|
b3605c0c22 | ||
|
|
63fb80e50d | ||
|
|
133b8abcbe | ||
|
|
e272849026 | ||
|
|
c4fdfeaa48 | ||
|
|
3f0859c3f2 | ||
|
|
6e286bac7e | ||
|
|
235aab15b6 | ||
|
|
a440121ac9 | ||
|
|
6209bd2285 | ||
|
|
8ad9fc57cc | ||
|
|
a763b947b8 | ||
|
|
026a26da3c | ||
|
|
d8d1addf2b | ||
|
|
937a34c76e | ||
|
|
c6142a1f64 | ||
|
|
f3fb2dee52 | ||
|
|
15996ced64 | ||
|
|
9fb98e2114 | ||
|
|
f55f779ea1 | ||
|
|
d23c71d511 | ||
|
|
18c98fc3f5 | ||
|
|
41b286b672 | ||
|
|
3c97e8e7f2 | ||
|
|
7996a2aa9c | ||
|
|
ba944c20ed | ||
|
|
0b89fadfdd | ||
|
|
1e50cebf55 | ||
|
|
ca8c5c0b02 | ||
|
|
a0aa261cab | ||
|
|
5d3d11e87c | ||
|
|
4a9ed21ea2 | ||
|
|
2ddfc9d92b | ||
|
|
a032fda936 | ||
|
|
c6fb8dc845 | ||
|
|
bf399d72c1 | ||
|
|
60fefe8158 | ||
|
|
9be66e196c | ||
|
|
04d96e52e0 | ||
|
|
5b483dac6f | ||
|
|
fadb4bf76e | ||
|
|
98a25b1fd6 | ||
|
|
69499e3965 | ||
|
|
d67ced14c4 | ||
|
|
95ae69ead2 | ||
|
|
4170f13858 | ||
|
|
45e4a77afb | ||
|
|
603538e255 | ||
|
|
afb49f3666 | ||
|
|
c6de2ce8b8 | ||
|
|
cdc4229df7 | ||
|
|
fa19f7471f | ||
|
|
75f3af2cc1 | ||
|
|
5ae77ee57e | ||
|
|
6df5d72dfd | ||
|
|
b91b33e9be | ||
|
|
b24071cf33 | ||
|
|
fd7226585b | ||
|
|
a5c88c08de | ||
|
|
712b67b782 | ||
|
|
88ea30a6f8 | ||
|
|
f4cbe395d5 | ||
|
|
c59fb5dc1f | ||
|
|
c712ef28e8 | ||
|
|
c62a4a1c69 | ||
|
|
87a7cf202f | ||
|
|
9a9b424ff2 | ||
|
|
dfe6146aa3 | ||
|
|
8b26728914 | ||
|
|
f5003ac8ec | ||
|
|
ee71ba99e2 | ||
|
|
56c7a2dda2 | ||
|
|
d28ce598e2 | ||
|
|
e050f17945 | ||
|
|
14475991c8 | ||
|
|
15d9ec4b38 | ||
|
|
f911545ae3 | ||
|
|
ad71530cc0 | ||
|
|
c33c02691f | ||
|
|
51c19770a8 | ||
|
|
5c2c7d4188 | ||
|
|
334d27d53d | ||
|
|
906932db1e | ||
|
|
2033e35a41 | ||
|
|
a5396a42ce | ||
|
|
8a60897086 | ||
|
|
5cfe38d547 | ||
|
|
3f7aa34726 | ||
|
|
008750d401 | ||
|
|
72708f82ea | ||
|
|
30f65f1c91 | ||
|
|
67d55ce0ee | ||
|
|
e887f37713 | ||
|
|
82a515d493 | ||
|
|
bd94012507 | ||
|
|
e1dbab1517 | ||
|
|
b675249960 | ||
|
|
05198e4181 | ||
|
|
ec9cb40fa4 | ||
|
|
dafea6039b | ||
|
|
ccc5f89ed7 | ||
|
|
fae9b521b8 | ||
|
|
ec1e2e4539 | ||
|
|
9550dcd6e7 | ||
|
|
4547525579 | ||
|
|
856ba0c1fa | ||
|
|
aaf217c61b | ||
|
|
29e05c4ad4 | ||
|
|
65719f21a3 | ||
|
|
05ff90c3c4 | ||
|
|
07408970bd | ||
|
|
ebd5ae2985 | ||
|
|
b0270e72d2 | ||
|
|
95c3001a7f | ||
|
|
4ba3ea6b4e | ||
|
|
fc6eab7efe | ||
|
|
c30fb098fe | ||
|
|
2ff226cf9a | ||
|
|
08bd887ab7 | ||
|
|
3396ed4b72 | ||
|
|
a703bc3102 | ||
|
|
18dc96c7b1 | ||
|
|
f8d9e9f5c8 | ||
|
|
e9e7f45e02 | ||
|
|
3b96af8686 | ||
|
|
49fb6311ad | ||
|
|
bce150c391 | ||
|
|
f8f07941fa | ||
|
|
6a1b01417b | ||
|
|
db60152b73 | ||
|
|
ebf082c145 | ||
|
|
f8b98ee3e1 | ||
|
|
01ef60bf04 | ||
|
|
17273a60e7 | ||
|
|
0439f4c404 | ||
|
|
e47fe35b15 | ||
|
|
f9e4520d64 | ||
|
|
91f23ee555 | ||
|
|
d06df65bd9 | ||
|
|
e9b9b85695 | ||
|
|
6a97cfd53d | ||
|
|
3497beea9e | ||
|
|
7ecd643719 | ||
|
|
4c26d43e2e | ||
|
|
b089f0bb5d | ||
|
|
d6c99a3ab9 | ||
|
|
fb41802011 | ||
|
|
e4313d94ed | ||
|
|
30bc01a4fd | ||
|
|
de6eccd197 | ||
|
|
ca6e98359c | ||
|
|
092fed118a | ||
|
|
3bb702d520 | ||
|
|
5f1979a61a | ||
|
|
1861867708 | ||
|
|
9ef32e0039 | ||
|
|
375db82ad4 | ||
|
|
1d2ed44548 | ||
|
|
e0dd4b678a | ||
|
|
db113ba816 | ||
|
|
6f58c43b48 | ||
|
|
0ff0710226 | ||
|
|
ce5c5a1558 | ||
|
|
500fc29a9e | ||
|
|
b7976929d0 | ||
|
|
6db4e8837c | ||
|
|
588a9aff0b | ||
|
|
399057b262 | ||
|
|
12daa15ef7 | ||
|
|
9356ffbd4e | ||
|
|
866d1b310a | ||
|
|
225103b095 | ||
|
|
328227316c | ||
|
|
dd5fe12dfe | ||
|
|
f837cfe994 | ||
|
|
f80bef8fef | ||
|
|
1bba26081b | ||
|
|
9efb2e2dd8 | ||
|
|
4b12b051e3 | ||
|
|
6bf2ddb7a8 | ||
|
|
978c30a7ca | ||
|
|
e2c02824e7 | ||
|
|
e05dff9c32 | ||
|
|
267ea4cf46 | ||
|
|
6dac7c7ce5 | ||
|
|
d0724a2c13 | ||
|
|
4c632e14a4 | ||
|
|
d7238267d9 | ||
|
|
a6cf01f867 | ||
|
|
17d148b1d2 | ||
|
|
2544782988 | ||
|
|
8f42c7a749 | ||
|
|
62aa4146af | ||
|
|
d423e3c4b3 | ||
|
|
bdac4d1188 | ||
|
|
47c9004d5f | ||
|
|
de19a6db37 | ||
|
|
cdc885994c | ||
|
|
6e1b27b0c9 | ||
|
|
64483ea09b | ||
|
|
1310c19bb0 | ||
|
|
dae58f8d54 | ||
|
|
b4af381043 | ||
|
|
6ac8bebf90 | ||
|
|
81d63606a6 | ||
|
|
29d0b6fa03 | ||
|
|
36cf5b1dbb | ||
|
|
13c1dc34f7 | ||
|
|
4530c4a9d2 | ||
|
|
ba8dc07630 | ||
|
|
c841b2da58 | ||
|
|
b42e5f5d82 | ||
|
|
24137a1269 | ||
|
|
22b5c4f083 | ||
|
|
5810572f54 | ||
|
|
ab3c61b7ca | ||
|
|
53b2cd93eb | ||
|
|
95cee57379 | ||
|
|
a5df996d67 | ||
|
|
a041ee5c4b | ||
|
|
a518e8b667 | ||
|
|
673197cf8e | ||
|
|
9a9aa1e811 | ||
|
|
793342b67a | ||
|
|
13074beebf | ||
|
|
9696bda2e9 | ||
|
|
87e0a23186 | ||
|
|
1acc9eb37b | ||
|
|
9ba228c804 | ||
|
|
a4bad7aab8 | ||
|
|
4e9aae1887 | ||
|
|
093bab7fbc | ||
|
|
b2449a3bae | ||
|
|
49784a7e65 | ||
|
|
5a2a12ccbb | ||
|
|
bc3d7bbb18 | ||
|
|
935cd745ba | ||
|
|
608d06d46f | ||
|
|
7690e19014 | ||
|
|
4626c79c46 | ||
|
|
aad0bd60f4 | ||
|
|
1fbe8d9651 | ||
|
|
2ba762b4c8 | ||
|
|
f24855e8e5 | ||
|
|
d288cb6954 | ||
|
|
e299fc9d51 | ||
|
|
0bd293f632 | ||
|
|
d8d186da09 | ||
|
|
9ddc5fa060 | ||
|
|
910683dce4 | ||
|
|
bb0f0ecbc0 | ||
|
|
1f54b4875a | ||
|
|
68759f1797 | ||
|
|
cdc5cbd6d6 | ||
|
|
f55097c480 | ||
|
|
e9695fa2eb | ||
|
|
0c11110567 | ||
|
|
f2db858221 | ||
|
|
a362cbba51 | ||
|
|
39c2586d3b | ||
|
|
4336342f74 | ||
|
|
3a5dfbe008 | ||
|
|
504e42b7ea | ||
|
|
6a9baa304f | ||
|
|
99b9b10d2d | ||
|
|
f42b73b09b | ||
|
|
41a62a8dde | ||
|
|
73f99a11b1 | ||
|
|
587d5267bb | ||
|
|
a747e1f466 | ||
|
|
95c967783b | ||
|
|
89ff69f005 | ||
|
|
e5eed7bd35 | ||
|
|
698d3b0a81 | ||
|
|
cb5e55d18f | ||
|
|
dcf8243551 | ||
|
|
39ae497153 | ||
|
|
cdab27084c | ||
|
|
17b499e68a | ||
|
|
f3f2344948 | ||
|
|
ce4064f6a7 | ||
|
|
d66bd6ee1f | ||
|
|
02c27ababc | ||
|
|
4296069148 | ||
|
|
e0b5df7f9e | ||
|
|
264c1c1fa5 | ||
|
|
54b2907f08 | ||
|
|
4dcb1d9af2 | ||
|
|
65862b085f | ||
|
|
8957684618 | ||
|
|
2c3ac8f2aa | ||
|
|
44332544ca | ||
|
|
421b225fed | ||
|
|
0ab6a5c739 | ||
|
|
65ce5dc40a | ||
|
|
c240395e76 | ||
|
|
25fd7e832f | ||
|
|
fa1f15d3af | ||
|
|
67a90b01f1 | ||
|
|
a20b4e4983 | ||
|
|
25de875826 | ||
|
|
0db0bdd97d | ||
|
|
0fd7d1c18a | ||
|
|
d4960e7f15 | ||
|
|
31ea2ef07a | ||
|
|
6e28ac946b | ||
|
|
cfce22fc63 | ||
|
|
752f453e80 | ||
|
|
19dabe8ffe | ||
|
|
d2234dc2ba | ||
|
|
21c935cb3d | ||
|
|
07d652c5e0 | ||
|
|
686b311590 | ||
|
|
80fe01e50d | ||
|
|
2ebb9351cd | ||
|
|
2dd7bdb007 | ||
|
|
d0e8b97926 | ||
|
|
f83897e64c | ||
|
|
ec4e56df61 | ||
|
|
f3e0b1ed74 | ||
|
|
ca9162476c | ||
|
|
f98f6f1a7a | ||
|
|
2624d037f3 | ||
|
|
66419abc66 | ||
|
|
608bd77f1c | ||
|
|
1b8029860e | ||
|
|
2d7917b169 | ||
|
|
4bec7b90c1 | ||
|
|
f822c3a787 | ||
|
|
7b25324660 | ||
|
|
6a81a1c9c5 | ||
|
|
4dd2c70f0f | ||
|
|
9d23d8ab6c | ||
|
|
a89611ae3b | ||
|
|
43433b75fe | ||
|
|
85830ad805 | ||
|
|
114f0fffab | ||
|
|
97e2e568cd | ||
|
|
d42298687c | ||
|
|
a19780566b | ||
|
|
dfc8935616 | ||
|
|
a6c0a4b4c8 | ||
|
|
19972d3183 | ||
|
|
566cddcd3e | ||
|
|
6e3dca448a | ||
|
|
6410d27f49 | ||
|
|
a2258ab728 | ||
|
|
c1f464bb41 | ||
|
|
0ca964c2f0 | ||
|
|
48d96956c6 | ||
|
|
c320615d8b | ||
|
|
2fd5f28404 | ||
|
|
e2ee06bebe | ||
|
|
daf6b5b3d2 | ||
|
|
038ac38e88 | ||
|
|
7e57eea71d | ||
|
|
34904eac47 | ||
|
|
0332daa038 | ||
|
|
924794a3a4 | ||
|
|
12e3d2ace0 | ||
|
|
d1bd998000 | ||
|
|
c803f8accb | ||
|
|
76e17835f9 | ||
|
|
db3dd94d82 | ||
|
|
4392888032 | ||
|
|
aa1c80e35b | ||
|
|
b4798fe733 | ||
|
|
582ab63d2f | ||
|
|
45ed69b943 | ||
|
|
ebb751bb38 | ||
|
|
5a39eec078 | ||
|
|
acb2d35bdc | ||
|
|
50d6c7770b | ||
|
|
d8019697a6 | ||
|
|
cc2ffeb286 | ||
|
|
cc204723d2 | ||
|
|
fc647f715b | ||
|
|
1c54a3b5e1 | ||
|
|
7fdb1952a6 | ||
|
|
6cfcb01cf0 | ||
|
|
bccff51061 | ||
|
|
02ec3fd436 | ||
|
|
ce177ca53e | ||
|
|
d7895504a4 | ||
|
|
699db46ed6 | ||
|
|
d303be6709 | ||
|
|
fe6f561afd | ||
|
|
93c7f6c253 | ||
|
|
3b2831f7de | ||
|
|
902e539f56 | ||
|
|
9e9946cf48 | ||
|
|
ecfc883419 | ||
|
|
a861fba3b1 | ||
|
|
37d9e60128 | ||
|
|
6db84dc673 | ||
|
|
f0ae3e47b6 | ||
|
|
4aded04223 | ||
|
|
06db1dd423 | ||
|
|
051e6c497e | ||
|
|
9b2a73b900 | ||
|
|
dd8ed599f7 | ||
|
|
33e51267e3 | ||
|
|
59251a58c4 | ||
|
|
e090b3992d | ||
|
|
31794684a0 | ||
|
|
14fcc8dde5 | ||
|
|
13f1821c04 | ||
|
|
4c3b85abcd | ||
|
|
4b0544fd0d | ||
|
|
568674a7fa | ||
|
|
ef012f07aa | ||
|
|
eee2330325 | ||
|
|
b83ec05ccc | ||
|
|
386525db48 | ||
|
|
a8809d840c | ||
|
|
005fc1f8c9 | ||
|
|
3129982582 | ||
|
|
5d7bb70c7d | ||
|
|
1a7a84f71b | ||
|
|
1d51bdc016 | ||
|
|
8da6f3a897 | ||
|
|
dca9293ae7 | ||
|
|
558bab2e58 | ||
|
|
2b362fd331 | ||
|
|
f03f1b6de8 | ||
|
|
bd57177586 | ||
|
|
9e0e2709a5 | ||
|
|
01b2ab7148 | ||
|
|
44b7d39467 | ||
|
|
5373ee2858 | ||
|
|
b19cab78d3 | ||
|
|
3f86dfce4f | ||
|
|
12f8bfa28f | ||
|
|
53211a4fca | ||
|
|
d0f188a072 | ||
|
|
9e55542872 | ||
|
|
0a6cd4e9b2 | ||
|
|
7af6cedfd6 | ||
|
|
847d379fe9 | ||
|
|
69954caee6 | ||
|
|
6a5bd28d07 | ||
|
|
ba58bc3ace | ||
|
|
94cb615a38 | ||
|
|
b130f46b6c | ||
|
|
989d59f978 | ||
|
|
c3dd099ee1 | ||
|
|
4dc7cf9389 | ||
|
|
882fd55d69 | ||
|
|
b2fdb8b9e5 | ||
|
|
e879ec981e | ||
|
|
980609ca87 | ||
|
|
71cd7396b7 | ||
|
|
dedc3e277c | ||
|
|
656866729d | ||
|
|
f93dd1f779 | ||
|
|
80d499f002 | ||
|
|
c9a87e52f3 | ||
|
|
3f98d9ab73 | ||
|
|
abb0e8fada | ||
|
|
be2e1f3c61 | ||
|
|
75f20d8176 | ||
|
|
e6bef5275b | ||
|
|
9813db1603 | ||
|
|
a3143f20a9 | ||
|
|
f54beb2d88 | ||
|
|
b7ce1e2da0 | ||
|
|
6dba138ec7 | ||
|
|
32f59a618f | ||
|
|
9b2de387ed | ||
|
|
b612258c5e | ||
|
|
09b59ed18b | ||
|
|
b7b186b67e | ||
|
|
f2ba925db6 | ||
|
|
bc9488241f | ||
|
|
4fc36779dd | ||
|
|
bc008aeb23 | ||
|
|
8ad45a421e | ||
|
|
197317efbf | ||
|
|
775ad975f3 | ||
|
|
eaedf455d4 | ||
|
|
017f6c8074 | ||
|
|
48dd922712 | ||
|
|
202b320ad1 | ||
|
|
ea094ae64b | ||
|
|
9412aeb938 | ||
|
|
785fc893ee | ||
|
|
4f5e471667 | ||
|
|
fc6b20d370 | ||
|
|
fe82631db6 | ||
|
|
e4886d1b03 | ||
|
|
dfb2b19209 | ||
|
|
1a92d6b1e5 | ||
|
|
d5c1f49cc5 | ||
|
|
7d6ce843de | ||
|
|
ae4be2be7a | ||
|
|
0298f0eb29 | ||
|
|
794c56dfac | ||
|
|
6b9382b5e9 | ||
|
|
08ae9b295f | ||
|
|
917e8a21d8 | ||
|
|
abdf4a3577 | ||
|
|
595e3c89df | ||
|
|
6b0e772c9f | ||
|
|
b9afa42662 | ||
|
|
5246a54118 | ||
|
|
a036391f69 | ||
|
|
039b1151bf | ||
|
|
6c79cfb109 | ||
|
|
b9f42bb733 | ||
|
|
542d839ed6 | ||
|
|
6ad24315bb | ||
|
|
3c1a4f124c | ||
|
|
48a83c356d | ||
|
|
756d52d106 | ||
|
|
83876a3523 | ||
|
|
b77c6d4edc | ||
|
|
c74fc11b25 | ||
|
|
7a636bd8c2 | ||
|
|
f6cc06b8dc | ||
|
|
6202436c9a | ||
|
|
65929a8e7e | ||
|
|
20e5786fc0 | ||
|
|
91bc3c432d | ||
|
|
1ff11cebf6 | ||
|
|
25cd967207 | ||
|
|
bcdc468a5d | ||
|
|
72d5112bac | ||
|
|
c1193c3c63 | ||
|
|
f30130b92f | ||
|
|
1a77233ecb | ||
|
|
09a95b8542 | ||
|
|
f46329ac68 | ||
|
|
c551839179 | ||
|
|
a0683f9d21 | ||
|
|
a56958c69e | ||
|
|
0b11a5f567 | ||
|
|
fac2d4a3b1 | ||
|
|
9f336103e8 | ||
|
|
1174942a4e | ||
|
|
267920b7dc | ||
|
|
63a7aa0f54 | ||
|
|
2b7534d30c | ||
|
|
be23a81b1b | ||
|
|
68416784fd | ||
|
|
84d3c09cb1 | ||
|
|
53e8c39e8d | ||
|
|
87b41fefad | ||
|
|
265a4e8cc5 | ||
|
|
623467503f | ||
|
|
3167ff16cd | ||
|
|
2e70b2b295 | ||
|
|
9a5e6eed16 | ||
|
|
28d74d73f8 | ||
|
|
6c9d90449a | ||
|
|
5398978d74 | ||
|
|
53148db482 | ||
|
|
44a0b54026 | ||
|
|
c877d377d2 |
@@ -12,9 +12,14 @@
|
||||
"cojson-transport-ws",
|
||||
"jazz-browser",
|
||||
"jazz-auth-clerk",
|
||||
"jazz-auth-betterauth",
|
||||
"jazz-betterauth-client-plugin",
|
||||
"jazz-betterauth-server-plugin",
|
||||
"jazz-react-auth-betterauth",
|
||||
"jazz-browser-media-images",
|
||||
"jazz-expo",
|
||||
"jazz-inspector",
|
||||
"jazz-inspector-element",
|
||||
"jazz-nodejs",
|
||||
"jazz-react",
|
||||
"jazz-react-core",
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/docs-request.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Docs request
|
||||
about: Allow people to quickly report issues & improvements for the docs
|
||||
title: 'Docs: '
|
||||
labels: docs, requested
|
||||
assignees: bensleveritt
|
||||
|
||||
---
|
||||
|
||||
|
||||
5
.github/workflows/code-quality.yml
vendored
@@ -15,4 +15,7 @@ jobs:
|
||||
with:
|
||||
version: latest
|
||||
- name: Run Biome
|
||||
run: biome ci .
|
||||
run: biome ci .
|
||||
|
||||
- name: Check Catalog Dependencies
|
||||
run: node scripts/check-catalog-deps.js
|
||||
|
||||
2
.github/workflows/playwright.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
project: ["tests/e2e", "examples/chat", "examples/file-share-svelte", "examples/form", "examples/music-player", "examples/pets", "starters/react-passkey-auth"]
|
||||
project: ["tests/e2e", "examples/chat", "examples/clerk", "examples/betterauth", "examples/file-share-svelte", "examples/form", "examples/music-player", "examples/organization", "examples/pets", "starters/react-passkey-auth"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
4
.gitignore
vendored
@@ -23,11 +23,11 @@ test-results
|
||||
.husky
|
||||
|
||||
.vscode/*
|
||||
.idea/*
|
||||
|
||||
.svelte-kit
|
||||
|
||||
.cursorrules
|
||||
.windsurfrules
|
||||
|
||||
|
||||
.idea
|
||||
playwright-report
|
||||
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
8
.idea/jazz.iml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/jazz.iml" filepath="$PROJECT_DIR$/.idea/jazz.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
19
.idea/php.xml
generated
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/prettier.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PrettierConfiguration">
|
||||
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -13,6 +13,7 @@
|
||||
"**/android/**",
|
||||
"packages/jazz-svelte/**",
|
||||
"examples/*svelte*/**",
|
||||
"examples/jazz-paper-scissors/src/routeTree.gen.ts",
|
||||
"homepage/homepage/**",
|
||||
"**/package.json"
|
||||
]
|
||||
|
||||
1
examples/betterauth/.env
Normal file
@@ -0,0 +1 @@
|
||||
BETTER_AUTH_SECRET="TEST_SECRET"
|
||||
47
examples/betterauth/.gitignore
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
sqlite.db
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/versions
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
.env*
|
||||
!.env
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
57
examples/betterauth/CHANGELOG.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# betterauth
|
||||
|
||||
## 0.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- jazz-tools@0.14.0
|
||||
- jazz-betterauth-server-plugin@0.14.0
|
||||
- jazz-inspector@0.14.0
|
||||
- jazz-react@0.14.0
|
||||
- jazz-react-auth-betterauth@0.14.0
|
||||
- jazz-betterauth-client-plugin@0.14.0
|
||||
|
||||
## 0.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-betterauth-server-plugin@0.13.32
|
||||
- jazz-react@0.13.32
|
||||
- jazz-react-auth-betterauth@0.13.32
|
||||
- jazz-betterauth-client-plugin@0.13.32
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- jazz-tools@0.13.31
|
||||
- jazz-betterauth-server-plugin@0.13.31
|
||||
- jazz-inspector@0.13.31
|
||||
- jazz-react@0.13.31
|
||||
- jazz-react-auth-betterauth@0.13.31
|
||||
- jazz-betterauth-client-plugin@0.13.31
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-betterauth-server-plugin@0.13.30
|
||||
- jazz-inspector@0.13.30
|
||||
- jazz-react@0.13.30
|
||||
- jazz-react-auth-betterauth@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
- jazz-betterauth-client-plugin@0.13.30
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [8e5ff13]
|
||||
- jazz-inspector@0.13.29
|
||||
- jazz-betterauth-server-plugin@0.0.1
|
||||
- jazz-react@0.13.29
|
||||
- jazz-react-auth-betterauth@0.0.1
|
||||
- jazz-tools@0.13.29
|
||||
- jazz-betterauth-client-plugin@0.0.1
|
||||
54
examples/betterauth/README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Better Auth Integration Example
|
||||
|
||||
This example demonstrates how to integrate [Better Auth](https://www.better-auth.com/) with Jazz.
|
||||
|
||||
## Getting started
|
||||
|
||||
To run this example, you may either:
|
||||
* Clone the Jazz monorepo and run this example from within.
|
||||
* Create a new Jazz project using this example as a template, and run that new project.
|
||||
|
||||
### Setting environment variables
|
||||
- `NEXT_PUBLIC_AUTH_BASE_URL`: A URL to a Better Auth server. If undefined, the example will self-host a Better Auth server.
|
||||
- `BETTER_AUTH_SECRET`: The encryption secret used by the self-hosted Better Auth server (required only if `NEXT_PUBLIC_AUTH_BASE_URL` is undefined)
|
||||
- `GITHUB_CLIENT_ID`: The client ID for the GitHub OAuth provider used by the self-hosted Better Auth server (required only if `NEXT_PUBLIC_AUTH_BASE_URL` is undefined)
|
||||
- `GITHUB_CLIENT_SECRET`: The client secret for the GitHub OAuth provider used by the self-hosted Better Auth server (required only if `NEXT_PUBLIC_AUTH_BASE_URL` is undefined)
|
||||
|
||||
### Using this example as a template
|
||||
|
||||
1. Create a new Jazz project, and use this example as a template.
|
||||
```sh
|
||||
npx create-jazz-app@latest betterauth-app --example betterauth
|
||||
```
|
||||
2. Navigate to the new project and start the development server.
|
||||
```sh
|
||||
cd betterauth-app
|
||||
pnpm install
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
### Using the monorepo
|
||||
|
||||
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||
|
||||
Clone the jazz repository.
|
||||
```bash
|
||||
git clone https://github.com/garden-co/jazz.git
|
||||
```
|
||||
|
||||
Install and build dependencies.
|
||||
```bash
|
||||
pnpm i && npx turbo build
|
||||
```
|
||||
|
||||
Go to the example directory.
|
||||
```bash
|
||||
cd jazz/examples/betterauth/
|
||||
```
|
||||
|
||||
Start the dev server.
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
21
examples/betterauth/components.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "new-york",
|
||||
"rsc": false,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/styles/globals.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"iconLibrary": "lucide"
|
||||
}
|
||||
7
examples/betterauth/next.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
51
examples/betterauth/package.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "betterauth",
|
||||
"version": "0.1.5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"format-and-lint": "biome check .",
|
||||
"format-and-lint:fix": "biome check . --write",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"email": "email dev --dir src/components/emails"
|
||||
},
|
||||
"dependencies": {
|
||||
"@icons-pack/react-simple-icons": "^12.8.0",
|
||||
"@radix-ui/react-label": "^2.1.6",
|
||||
"@radix-ui/react-slot": "^1.2.2",
|
||||
"better-auth": "^1.2.4",
|
||||
"better-sqlite3": "^11.9.1",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"jazz-betterauth-client-plugin": "workspace:*",
|
||||
"jazz-betterauth-server-plugin": "workspace:*",
|
||||
"jazz-inspector": "workspace:*",
|
||||
"jazz-react": "workspace:*",
|
||||
"jazz-react-auth-betterauth": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"lucide-react": "^0.510.0",
|
||||
"next": "15.3.2",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"sonner": "^2.0.3",
|
||||
"tailwind-merge": "^3.3.0",
|
||||
"tw-animate-css": "^1.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@playwright/test": "^1.50.1",
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@types/better-sqlite3": "^7.6.12",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"react-email": "^4.0.11",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
53
examples/betterauth/playwright.config.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
import isCI from "is-ci";
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// import dotenv from 'dotenv';
|
||||
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: "./tests",
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: isCI,
|
||||
/* Retry on CI only */
|
||||
retries: isCI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: isCI ? 1 : undefined,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: "html",
|
||||
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: "http://localhost:3000/",
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: "on-first-retry",
|
||||
permissions: ["clipboard-read", "clipboard-write"],
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
},
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: [
|
||||
{
|
||||
command: "pnpm dev",
|
||||
url: "http://localhost:3000/",
|
||||
reuseExistingServer: !isCI,
|
||||
},
|
||||
],
|
||||
});
|
||||
5
examples/betterauth/postcss.config.mjs
Normal file
@@ -0,0 +1,5 @@
|
||||
const config = {
|
||||
plugins: ["@tailwindcss/postcss"],
|
||||
};
|
||||
|
||||
export default config;
|
||||
15
examples/betterauth/public/jazz-logo.svg
Normal file
@@ -0,0 +1,15 @@
|
||||
<svg
|
||||
viewBox="0 0 386 146"
|
||||
fill="currentColor"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path id="text"
|
||||
d="M176.725 33.865H188.275V22.7H176.725V33.865ZM164.9 129.4H172.875C182.72 129.4 188.275 123.9 188.275 114.22V43.6H176.725V109.545C176.725 115.65 173.975 118.51 167.925 118.51H164.9V129.4ZM245.298 53.28C241.613 45.47 233.363 41.95 222.748 41.95C208.998 41.95 200.748 48.44 197.888 58.615L208.613 61.915C210.648 55.315 216.368 52.565 222.638 52.565C231.933 52.565 235.673 56.415 236.058 64.61C226.433 65.93 216.643 67.195 209.768 69.23C200.583 72.145 195.743 77.865 195.743 86.83C195.743 96.51 202.673 104.65 215.818 104.65C225.443 104.65 232.318 101.35 237.213 94.365V103H247.388V66.425C247.388 61.475 247.168 57.185 245.298 53.28ZM217.853 95.245C210.483 95.245 207.128 91.34 207.128 86.72C207.128 82.045 210.593 79.515 215.323 77.92C220.328 76.435 226.983 75.5 235.948 74.18C235.893 76.93 235.673 80.725 234.738 83.475C233.418 89.25 227.643 95.245 217.853 95.245ZM251.22 103H301.545V92.715H269.535L303.195 45.47V43.6H254.3V53.885H284.935L251.22 101.185V103ZM304.815 103H355.14V92.715H323.13L356.79 45.47V43.6H307.895V53.885H338.53L304.815 101.185V103Z"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M136.179 44.8277C136.179 44.8277 136.179 44.8277 136.179 44.8276V21.168C117.931 28.5527 97.9854 32.6192 77.0897 32.6192C65.1466 32.6192 53.5138 31.2908 42.331 28.7737V51.4076C42.331 51.4076 42.331 51.4076 42.331 51.4076V81.1508C41.2955 80.4385 40.1568 79.8458 38.9405 79.3915C36.1732 78.358 33.128 78.0876 30.1902 78.6145C27.2524 79.1414 24.5539 80.4419 22.4358 82.3516C20.3178 84.2613 18.8754 86.6944 18.291 89.3433C17.7066 91.9921 18.0066 94.7377 19.1528 97.2329C20.2991 99.728 22.2403 101.861 24.7308 103.361C27.2214 104.862 30.1495 105.662 33.1448 105.662H33.1455C33.6061 105.662 33.8365 105.662 34.0314 105.659C44.5583 105.449 53.042 96.9656 53.2513 86.4386C53.2534 86.3306 53.2544 86.2116 53.2548 86.0486H53.2552V85.7149L53.2552 85.5521V82.0762L53.2552 53.1993C61.0533 54.2324 69.0092 54.7656 77.0897 54.7656C77.6696 54.7656 78.2489 54.7629 78.8276 54.7574V110.696C77.792 109.983 76.6533 109.391 75.437 108.936C72.6697 107.903 69.6246 107.632 66.6867 108.159C63.7489 108.686 61.0504 109.987 58.9323 111.896C56.8143 113.806 55.3719 116.239 54.7875 118.888C54.2032 121.537 54.5031 124.283 55.6494 126.778C56.7956 129.273 58.7368 131.405 61.2273 132.906C63.7179 134.406 66.646 135.207 69.6414 135.207C70.1024 135.207 70.3329 135.207 70.5279 135.203C81.0548 134.994 89.5385 126.51 89.7478 115.983C89.7517 115.788 89.7517 115.558 89.7517 115.097V111.621L89.7517 54.3266C101.962 53.4768 113.837 51.4075 125.255 48.2397V80.9017C124.219 80.1894 123.081 79.5966 121.864 79.1424C119.097 78.1089 116.052 77.8384 113.114 78.3653C110.176 78.8922 107.478 80.1927 105.36 82.1025C103.242 84.0122 101.799 86.4453 101.215 89.0941C100.631 91.743 100.931 94.4886 102.077 96.9837C103.223 99.4789 105.164 101.612 107.655 103.112C110.145 104.612 113.073 105.413 116.069 105.413C116.53 105.413 116.76 105.413 116.955 105.409C127.482 105.2 135.966 96.7164 136.175 86.1895C136.179 85.9945 136.179 85.764 136.179 85.3029V81.8271L136.179 44.8277Z"
|
||||
fill="#146AFF"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
12
examples/betterauth/public/jazz.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 125 125"
|
||||
fill="none"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M118.179 29.6597V6C99.931 13.3847 79.9854 17.4512 59.0897 17.4512C47.1466 17.4512 35.5138 16.1228 24.331 13.6057V36.2396V65.9828C23.2955 65.2705 22.1568 64.6778 20.9405 64.2235C18.1732 63.19 15.128 62.9196 12.1902 63.4465C9.25242 63.9734 6.55392 65.2739 4.43582 67.1836C2.31782 69.0933 0.875416 71.5264 0.291016 74.1753C-0.293384 76.8241 0.00661504 79.5697 1.15281 82.0649C2.29911 84.56 4.24032 86.693 6.73082 88.193C9.22142 89.694 12.1495 90.494 15.1448 90.494C15.6054 90.494 15.8365 90.494 16.0314 90.491C26.5583 90.281 35.042 81.7976 35.2513 71.2706C35.2534 71.1626 35.2544 71.0436 35.2548 70.8806L35.2552 70.5469V70.3841V66.9082V38.0313C43.0533 39.0644 51.0092 39.5976 59.0897 39.5976C59.6696 39.5976 60.2489 39.5949 60.8276 39.5894V95.528C59.792 94.815 58.6533 94.223 57.437 93.768C54.6697 92.735 51.6246 92.464 48.6867 92.991C45.7489 93.518 43.0504 94.819 40.9323 96.728C38.8143 98.638 37.3719 101.071 36.7875 103.72C36.2032 106.369 36.5031 109.115 37.6494 111.61C38.7956 114.105 40.7368 116.237 43.2273 117.738C45.7179 119.238 48.646 120.039 51.6414 120.039C52.1024 120.039 52.3329 120.039 52.5279 120.035C63.0548 119.826 71.5385 111.342 71.7478 100.815C71.7517 100.62 71.7517 100.39 71.7517 99.929V96.453V39.1586C83.962 38.3088 95.837 36.2395 107.255 33.0717V65.7337C106.219 65.0214 105.081 64.4286 103.864 63.9744C101.097 62.9409 98.052 62.6704 95.114 63.1973C92.176 63.7242 89.478 65.0247 87.36 66.9345C85.242 68.8442 83.799 71.2773 83.215 73.9261C82.631 76.575 82.931 79.3206 84.077 81.8157C85.223 84.3109 87.164 86.444 89.655 87.944C92.145 89.444 95.073 90.245 98.069 90.245C98.53 90.245 98.76 90.245 98.955 90.241C109.482 90.032 117.966 81.5484 118.175 71.0215C118.179 70.8265 118.179 70.596 118.179 70.1349V66.6591V29.6597Z"
|
||||
fill="#146AFF"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
22
examples/betterauth/src/app/(app)/layout.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Navbar } from "@/components/navbar";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Jazz Example: Better Auth",
|
||||
description: "Jazz example application demonstrating Better Auth integration",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Navbar />
|
||||
<div className="container mx-auto pt-16 min-h-screen flex flex-col items-center justify-center">
|
||||
{children}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
113
examples/betterauth/src/app/(app)/page.tsx
Normal file
@@ -0,0 +1,113 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useAccount } from "jazz-react";
|
||||
import { Account } from "jazz-tools";
|
||||
import {
|
||||
AppWindowMacIcon,
|
||||
FileTextIcon,
|
||||
GlobeIcon,
|
||||
WrenchIcon,
|
||||
} from "lucide-react";
|
||||
import Image from "next/image";
|
||||
|
||||
export default function Home() {
|
||||
const { me } = useAccount(Account, { resolve: { profile: {} } });
|
||||
|
||||
if (!me) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="grow flex flex-col items-center justify-center">
|
||||
<main className="flex flex-col gap-8 row-start-2 grow justify-center">
|
||||
<Image
|
||||
src="/jazz-logo.svg"
|
||||
alt="Jazz logo"
|
||||
width={180}
|
||||
height={38}
|
||||
priority
|
||||
/>
|
||||
<p className="text-sm/6 text-center sm:text-left">
|
||||
Signed in as{" "}
|
||||
<span className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-mono font-semibold">
|
||||
{me.profile.name}
|
||||
</span>{" "}
|
||||
with id{" "}
|
||||
<span className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-mono font-semibold">
|
||||
{me.id}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div className="flex gap-4 items-center flex-row">
|
||||
<Button asChild size="lg">
|
||||
<a
|
||||
href="https://jazz.tools/docs"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image src="/jazz.svg" alt="" width={20} height={20} />
|
||||
Start building
|
||||
</a>
|
||||
</Button>
|
||||
|
||||
<Button asChild variant="secondary" size="lg">
|
||||
<a
|
||||
href="https://jazz.tools/docs"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<FileTextIcon className="size-4" />
|
||||
Read the docs
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer className="flex gap-4 py-8">
|
||||
<Button asChild variant="ghost">
|
||||
<a
|
||||
href="https://jazz.tools/api-reference"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<FileTextIcon className="size-4" />
|
||||
API reference
|
||||
</a>
|
||||
</Button>
|
||||
<Button asChild variant="ghost">
|
||||
<a
|
||||
href="https://jazz.tools/examples"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<AppWindowMacIcon className="size-4" />
|
||||
Examples
|
||||
</a>
|
||||
</Button>
|
||||
|
||||
<Button asChild variant="ghost">
|
||||
<a
|
||||
href="https://jazz.tools/status"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<GlobeIcon className="size-4" />
|
||||
Status
|
||||
</a>
|
||||
</Button>
|
||||
|
||||
<Button asChild variant="ghost">
|
||||
<a
|
||||
href="https://jazz.tools/showcase"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<WrenchIcon className="size-4" />
|
||||
Built with Jazz
|
||||
</a>
|
||||
</Button>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
14
examples/betterauth/src/app/(app)/settings/page.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { UserSettings } from "@/components/user-settings";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Settings | Jazz Example: Better Auth",
|
||||
};
|
||||
|
||||
export default function SettingsPage() {
|
||||
return (
|
||||
<div className="max-w-screen-md w-full mx-auto px-4">
|
||||
<UserSettings />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
10
examples/betterauth/src/app/api/auth/[...all]/route.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { auth } from "@/lib/auth";
|
||||
import { toNextJsHandler } from "better-auth/next-js";
|
||||
|
||||
export const { GET, POST } = (() => {
|
||||
if (!process.env.NEXT_PUBLIC_AUTH_BASE_URL) {
|
||||
return toNextJsHandler(auth.handler);
|
||||
} else {
|
||||
return { GET: undefined, POST: undefined };
|
||||
}
|
||||
})();
|
||||
10
examples/betterauth/src/app/auth/forgot-password/page.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ForgotPasswordForm } from "@/components/forgot-password-form";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Forgot password | Jazz Example: Better Auth",
|
||||
};
|
||||
|
||||
export default function ForgotPasswordPage() {
|
||||
return <ForgotPasswordForm />;
|
||||
}
|
||||
23
examples/betterauth/src/app/auth/layout.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function AuthLayout({ children }: Props) {
|
||||
return (
|
||||
<div className="bg-muted flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10">
|
||||
<div className="flex w-full max-w-sm flex-col gap-6">
|
||||
<Link
|
||||
href="/"
|
||||
className="flex items-center gap-2 self-center font-medium"
|
||||
>
|
||||
<Image src="/jazz.svg" alt="Jazz Logo" width={24} height={24} />
|
||||
Jazz BetterAuth Demo
|
||||
</Link>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
10
examples/betterauth/src/app/auth/reset-password/page.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ResetPasswordForm } from "@/components/reset-password-form";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Reset password | Jazz Example: Better Auth",
|
||||
};
|
||||
|
||||
export default function ResetPasswordPage() {
|
||||
return <ResetPasswordForm />;
|
||||
}
|
||||
11
examples/betterauth/src/app/auth/sign-in/page.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { SigninForm } from "@/components/signin-form";
|
||||
import type { Metadata } from "next";
|
||||
import { ssoProviders } from "../sso-providers";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Sign in | Jazz Example: Better Auth",
|
||||
};
|
||||
|
||||
export default function LoginPage() {
|
||||
return <SigninForm providers={ssoProviders} />;
|
||||
}
|
||||
11
examples/betterauth/src/app/auth/sign-up/page.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { SignupForm } from "@/components/signup-form";
|
||||
import type { Metadata } from "next";
|
||||
import { ssoProviders } from "../sso-providers";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Sign up | Jazz Example: Better Auth",
|
||||
};
|
||||
|
||||
export default function LoginPage() {
|
||||
return <SignupForm providers={ssoProviders} />;
|
||||
}
|
||||
4
examples/betterauth/src/app/auth/sso-providers.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { SSOProviderType } from "jazz-react-auth-betterauth";
|
||||
|
||||
// Fill in the providers you want to use
|
||||
export const ssoProviders: SSOProviderType[] = ["github"];
|
||||
BIN
examples/betterauth/src/app/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
123
examples/betterauth/src/app/globals.css
Normal file
@@ -0,0 +1,123 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--destructive-foreground: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.145 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.145 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.985 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.396 0.141 25.723);
|
||||
--destructive-foreground: oklch(0.637 0.237 25.331);
|
||||
--border: oklch(0.269 0 0);
|
||||
--input: oklch(0.269 0 0);
|
||||
--ring: oklch(0.439 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(0.269 0 0);
|
||||
--sidebar-ring: oklch(0.439 0 0);
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-destructive-foreground: var(--destructive-foreground);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
26
examples/betterauth/src/app/layout.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { JazzAndAuth } from "@/components/JazzAndAuth";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import type { Metadata } from "next";
|
||||
import "./globals.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Jazz Example: Better Auth",
|
||||
description: "Jazz example application demonstrating Better Auth integration",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className="antialiased">
|
||||
<JazzAndAuth>
|
||||
{children}
|
||||
<Toaster richColors />
|
||||
</JazzAndAuth>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
33
examples/betterauth/src/components/JazzAndAuth.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
import { JazzProvider } from "jazz-react";
|
||||
import { AuthProvider } from "jazz-react-auth-betterauth";
|
||||
import { type ReactNode, lazy } from "react";
|
||||
|
||||
const JazzDevTools =
|
||||
process.env.NODE_ENV === "production"
|
||||
? () => null
|
||||
: lazy(() =>
|
||||
import("jazz-inspector").then((res) => ({
|
||||
default: res.JazzInspector,
|
||||
})),
|
||||
);
|
||||
|
||||
export function JazzAndAuth({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<JazzProvider
|
||||
sync={{
|
||||
peer: "wss://cloud.jazz.tools/?key=betterauth-example@garden.co",
|
||||
}}
|
||||
>
|
||||
<AuthProvider
|
||||
options={{
|
||||
baseURL: process.env.NEXT_PUBLIC_AUTH_BASE_URL,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</AuthProvider>
|
||||
<JazzDevTools />
|
||||
</JazzProvider>
|
||||
);
|
||||
}
|
||||
137
examples/betterauth/src/components/SSOButton.tsx
Normal file
@@ -0,0 +1,137 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
SiApple,
|
||||
SiDiscord,
|
||||
SiDropbox,
|
||||
SiFacebook,
|
||||
SiGithub,
|
||||
SiGitlab,
|
||||
SiGoogle,
|
||||
SiKick,
|
||||
SiReddit,
|
||||
SiRoblox,
|
||||
SiSpotify,
|
||||
SiTiktok,
|
||||
SiTwitch,
|
||||
SiVk,
|
||||
SiX,
|
||||
SiZoom,
|
||||
} from "@icons-pack/react-simple-icons";
|
||||
import { type SSOProviderType, useAuth } from "jazz-react-auth-betterauth";
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { ReactNode } from "react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
interface SocialProvider {
|
||||
name: string;
|
||||
icon?: ReactNode;
|
||||
}
|
||||
|
||||
const socialProviderMap: Record<SSOProviderType, SocialProvider> = {
|
||||
github: {
|
||||
name: "GitHub",
|
||||
icon: <SiGithub />,
|
||||
},
|
||||
google: {
|
||||
name: "Google",
|
||||
icon: <SiGoogle />,
|
||||
},
|
||||
apple: {
|
||||
name: "Apple",
|
||||
icon: <SiApple />,
|
||||
},
|
||||
discord: {
|
||||
name: "Discord",
|
||||
icon: <SiDiscord />,
|
||||
},
|
||||
facebook: {
|
||||
name: "Facebook",
|
||||
icon: <SiFacebook />,
|
||||
},
|
||||
microsoft: {
|
||||
name: "Microsoft",
|
||||
},
|
||||
twitter: {
|
||||
name: "X",
|
||||
icon: <SiX />,
|
||||
},
|
||||
dropbox: {
|
||||
name: "Dropbox",
|
||||
icon: <SiDropbox />,
|
||||
},
|
||||
linkedin: {
|
||||
name: "LinkedIn",
|
||||
},
|
||||
gitlab: {
|
||||
name: "GitLab",
|
||||
icon: <SiGitlab />,
|
||||
},
|
||||
kick: {
|
||||
name: "Kick",
|
||||
icon: <SiKick />,
|
||||
},
|
||||
tiktok: {
|
||||
name: "TikTok",
|
||||
icon: <SiTiktok />,
|
||||
},
|
||||
twitch: {
|
||||
name: "Twitch",
|
||||
icon: <SiTwitch />,
|
||||
},
|
||||
vk: {
|
||||
name: "VK",
|
||||
icon: <SiVk />,
|
||||
},
|
||||
zoom: {
|
||||
name: "Zoom",
|
||||
icon: <SiZoom />,
|
||||
},
|
||||
roblox: {
|
||||
name: "Roblox",
|
||||
icon: <SiRoblox />,
|
||||
},
|
||||
reddit: {
|
||||
name: "Reddit",
|
||||
icon: <SiReddit />,
|
||||
},
|
||||
spotify: {
|
||||
name: "Spotify",
|
||||
icon: <SiSpotify />,
|
||||
},
|
||||
};
|
||||
|
||||
interface Props {
|
||||
provider: SSOProviderType;
|
||||
}
|
||||
|
||||
export function SSOButton({ provider }: Props) {
|
||||
const auth = useAuth();
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
auth.authClient.signIn.social(
|
||||
{
|
||||
provider,
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
router.push("/");
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error("Error", {
|
||||
description: error.error.message,
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
{socialProviderMap[provider].icon}
|
||||
Continue with {socialProviderMap[provider].name}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
85
examples/betterauth/src/components/forgot-password-form.tsx
Normal file
@@ -0,0 +1,85 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { useAuth } from "jazz-react-auth-betterauth";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export function ForgotPasswordForm() {
|
||||
const router = useRouter();
|
||||
const [email, setEmail] = useState("");
|
||||
const auth = useAuth();
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
auth.authClient.forgetPassword(
|
||||
{ email, redirectTo: `${window.location.origin}/auth/reset-password` },
|
||||
{
|
||||
onSuccess: () => {
|
||||
toast.success("Email sent");
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error("Error", {
|
||||
description: error.error.message,
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Card>
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-xl">Recover password</CardTitle>
|
||||
<CardDescription>
|
||||
Enter your email to receive a link to reset your password
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
placeholder="you@example.com"
|
||||
required
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button type="submit" className="w-full">
|
||||
Recover password
|
||||
</Button>
|
||||
</div>
|
||||
<div className="text-center text-sm">
|
||||
Back to{" "}
|
||||
<Link
|
||||
href="/auth/sign-in"
|
||||
className="underline underline-offset-4"
|
||||
>
|
||||
Sign in
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
55
examples/betterauth/src/components/navbar.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useAccount, useIsAuthenticated } from "jazz-react";
|
||||
import { useAuth } from "jazz-react-auth-betterauth";
|
||||
import { Account } from "jazz-tools";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { useCallback } from "react";
|
||||
|
||||
export function Navbar() {
|
||||
const { authClient } = useAuth();
|
||||
const { logOut } = useAccount(Account, { resolve: { profile: {} } });
|
||||
|
||||
const isAuthenticated = useIsAuthenticated();
|
||||
|
||||
const signOut = useCallback(() => {
|
||||
authClient.signOut().catch(console.error).finally(logOut);
|
||||
}, [logOut, authClient]);
|
||||
|
||||
return (
|
||||
<header className="absolute p-4 top-0 left-0 w-full z-10 flex justify-between">
|
||||
<nav className="flex gap-4">
|
||||
<Link href="/">
|
||||
<Image
|
||||
src="/jazz-logo.svg"
|
||||
alt="Jazz logo"
|
||||
width={96}
|
||||
height={96}
|
||||
priority
|
||||
/>
|
||||
</Link>
|
||||
{isAuthenticated && (
|
||||
<Button asChild variant="link">
|
||||
<Link href="/settings">Settings</Link>
|
||||
</Button>
|
||||
)}
|
||||
</nav>
|
||||
<nav className="flex gap-4">
|
||||
{isAuthenticated ? (
|
||||
<Button onClick={signOut}>Sign out</Button>
|
||||
) : (
|
||||
<>
|
||||
<Button asChild variant="secondary">
|
||||
<Link href="/auth/sign-in">Sign in</Link>
|
||||
</Button>
|
||||
<Button asChild>
|
||||
<Link href="/auth/sign-up">Sign up</Link>
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</nav>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
108
examples/betterauth/src/components/reset-password-form.tsx
Normal file
@@ -0,0 +1,108 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { useAuth } from "jazz-react-auth-betterauth";
|
||||
import Link from "next/link";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export function ResetPasswordForm() {
|
||||
const router = useRouter();
|
||||
const [password, setPassword] = useState("");
|
||||
const [confirmPassword, setConfirmPassword] = useState("");
|
||||
const auth = useAuth();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
const token = searchParams.get("token");
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
toast.error("Passwords do not match");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
toast.error("Invalid token");
|
||||
return;
|
||||
}
|
||||
|
||||
auth.authClient.resetPassword(
|
||||
{ newPassword: password, token },
|
||||
{
|
||||
onSuccess: () => {
|
||||
toast.success("Password successfully updated");
|
||||
router.push("/auth/sign-in");
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error("Error", {
|
||||
description: error.error.message,
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Card>
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-xl">Reset password</CardTitle>
|
||||
<CardDescription>Enter your new password</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="password">New password</Label>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
required
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="confirmPassword">Confirm password</Label>
|
||||
<Input
|
||||
id="confirmPassword"
|
||||
type="password"
|
||||
required
|
||||
value={confirmPassword}
|
||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button type="submit" className="w-full">
|
||||
Set password
|
||||
</Button>
|
||||
</div>
|
||||
<div className="text-center text-sm">
|
||||
Back to{" "}
|
||||
<Link
|
||||
href="/auth/sign-in"
|
||||
className="underline underline-offset-4"
|
||||
>
|
||||
Sign in
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
124
examples/betterauth/src/components/signin-form.tsx
Normal file
@@ -0,0 +1,124 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { type SSOProviderType, useAuth } from "jazz-react-auth-betterauth";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { SSOButton } from "./SSOButton";
|
||||
|
||||
interface Props {
|
||||
providers: SSOProviderType[];
|
||||
}
|
||||
|
||||
export function SigninForm({ providers }: Props) {
|
||||
const router = useRouter();
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
|
||||
const auth = useAuth();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
await auth.authClient.signIn.email(
|
||||
{ email, password },
|
||||
{
|
||||
onSuccess: async () => {
|
||||
await auth.logIn();
|
||||
router.push("/");
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error("Error", {
|
||||
description: error.error.message,
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Card>
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-xl">Welcome back</CardTitle>
|
||||
<CardDescription>
|
||||
Sign in with one of the following providers
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="grid gap-6">
|
||||
{providers.length > 0 && (
|
||||
<>
|
||||
<div className="flex flex-col gap-4">
|
||||
{providers?.map((provider) => (
|
||||
<SSOButton key={provider} provider={provider} />
|
||||
))}
|
||||
</div>
|
||||
<div className="after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t">
|
||||
<span className="bg-card text-muted-foreground relative z-10 px-2">
|
||||
Or continue with
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
placeholder="you@example.com"
|
||||
required
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Link
|
||||
href="/auth/forgot-password"
|
||||
className="ml-auto inline-block text-sm underline-offset-4 hover:underline"
|
||||
>
|
||||
Forgot your password?
|
||||
</Link>
|
||||
</div>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
required
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" className="w-full">
|
||||
Sign in
|
||||
</Button>
|
||||
</div>
|
||||
<div className="text-center text-sm">
|
||||
Don't have an account?{" "}
|
||||
<Link
|
||||
href="/auth/sign-up"
|
||||
className="underline underline-offset-4"
|
||||
>
|
||||
Sign up
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
151
examples/betterauth/src/components/signup-form.tsx
Normal file
@@ -0,0 +1,151 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { type SSOProviderType, useAuth } from "jazz-react-auth-betterauth";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { SSOButton } from "./SSOButton";
|
||||
|
||||
interface Props {
|
||||
providers: SSOProviderType[];
|
||||
}
|
||||
|
||||
export function SignupForm({ providers }: Props) {
|
||||
const router = useRouter();
|
||||
const auth = useAuth();
|
||||
const [name, setName] = useState("");
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [confirmPassword, setConfirmPassword] = useState("");
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
toast.error("Error", {
|
||||
description: "Passwords do not match",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await auth.authClient.signUp.email(
|
||||
{
|
||||
email,
|
||||
password,
|
||||
name,
|
||||
},
|
||||
{
|
||||
onSuccess: async () => {
|
||||
await auth.signIn();
|
||||
router.push("/");
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error("Sign up error", {
|
||||
description: error.error.message,
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Card>
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-xl">Welcome</CardTitle>
|
||||
<CardDescription>
|
||||
Sign up with one of the following providers
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="grid gap-6">
|
||||
{providers.length > 0 && (
|
||||
<>
|
||||
<div className="flex flex-col gap-4">
|
||||
{providers?.map((provider) => (
|
||||
<SSOButton key={provider} provider={provider} />
|
||||
))}
|
||||
</div>
|
||||
<div className="after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t">
|
||||
<span className="bg-card text-muted-foreground relative z-10 px-2">
|
||||
Or continue with
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Input
|
||||
id="name"
|
||||
type="text"
|
||||
placeholder="John Doe"
|
||||
required
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
placeholder="you@example.com"
|
||||
required
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
placeholder="********"
|
||||
required
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-3">
|
||||
<Label htmlFor="confirmPassword">Confirm password</Label>
|
||||
<Input
|
||||
id="confirmPassword"
|
||||
type="password"
|
||||
required
|
||||
value={confirmPassword}
|
||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" className="w-full">
|
||||
Sign up
|
||||
</Button>
|
||||
</div>
|
||||
<div className="text-center text-sm">
|
||||
Already have an account?{" "}
|
||||
<Link
|
||||
href="/auth/sign-in"
|
||||
className="underline underline-offset-4"
|
||||
>
|
||||
Sign in
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
59
examples/betterauth/src/components/ui/button.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Slot } from "@radix-ui/react-slot";
|
||||
import { type VariantProps, cva } from "class-variance-authority";
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
||||
ghost:
|
||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant,
|
||||
size,
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"button"> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean;
|
||||
}) {
|
||||
const Comp = asChild ? Slot : "button";
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot="button"
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Button, buttonVariants };
|
||||
92
examples/betterauth/src/components/ui/card.tsx
Normal file
@@ -0,0 +1,92 @@
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card"
|
||||
className={cn(
|
||||
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-title"
|
||||
className={cn("leading-none font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-description"
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-action"
|
||||
className={cn(
|
||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-content"
|
||||
className={cn("px-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardFooter,
|
||||
CardTitle,
|
||||
CardAction,
|
||||
CardDescription,
|
||||
CardContent,
|
||||
};
|
||||
21
examples/betterauth/src/components/ui/input.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
||||
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Input };
|
||||
22
examples/betterauth/src/components/ui/label.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as LabelPrimitive from "@radix-ui/react-label";
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function Label({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||
return (
|
||||
<LabelPrimitive.Root
|
||||
data-slot="label"
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Label };
|
||||
22
examples/betterauth/src/components/ui/sonner.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
||||
|
||||
const Toaster = ({ ...props }: ToasterProps) => {
|
||||
return (
|
||||
<Sonner
|
||||
theme="light"
|
||||
className="toaster group"
|
||||
style={
|
||||
{
|
||||
"--normal-bg": "var(--popover)",
|
||||
"--normal-text": "var(--popover-foreground)",
|
||||
"--normal-border": "var(--border)",
|
||||
} as React.CSSProperties
|
||||
}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export { Toaster };
|
||||
60
examples/betterauth/src/components/user-settings.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useAccount, useIsAuthenticated } from "jazz-react";
|
||||
import { useAuth } from "jazz-react-auth-betterauth";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export function UserSettings() {
|
||||
const router = useRouter();
|
||||
const { authClient } = useAuth();
|
||||
const { logOut } = useAccount();
|
||||
const isAuthenticated = useIsAuthenticated();
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return (
|
||||
<div className="flex flex-col gap-8">
|
||||
<h1 className="text-center text-2xl">Forbidden</h1>
|
||||
<p className="text-center text-sm text-muted-foreground">
|
||||
Please{" "}
|
||||
<Link href="/auth/sign-in" className="underline text-primary">
|
||||
sign in
|
||||
</Link>{" "}
|
||||
to access this page.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-8">
|
||||
<h1 className="text-4xl font-semibold">Settings</h1>
|
||||
|
||||
<Button
|
||||
variant="destructive"
|
||||
className="relative"
|
||||
type="button"
|
||||
onClick={async (e) => {
|
||||
e.preventDefault();
|
||||
authClient.deleteUser(undefined, {
|
||||
onSuccess: () => {
|
||||
logOut();
|
||||
router.push("/");
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error("Error", {
|
||||
description: error.error.message,
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
Delete account
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
50
examples/betterauth/src/lib/auth.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { betterAuth } from "better-auth";
|
||||
import { getMigrations } from "better-auth/db";
|
||||
import Database from "better-sqlite3";
|
||||
import { jazzPlugin } from "jazz-betterauth-server-plugin";
|
||||
import { socialProviders } from "./socialProviders";
|
||||
|
||||
export const auth = await (async () => {
|
||||
// Configure Better Auth server
|
||||
const auth = betterAuth({
|
||||
appName: "Jazz Example: Better Auth",
|
||||
database: new Database("sqlite.db"),
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
async sendResetPassword({ url }) {
|
||||
// Here we can send an email to the user with the reset password link
|
||||
console.log("****** RESET PASSWORD ******");
|
||||
console.log("navigate to", url, "to reset your password");
|
||||
console.log("******");
|
||||
},
|
||||
},
|
||||
emailVerification: {
|
||||
async sendVerificationEmail(data) {
|
||||
console.error("Not implemented");
|
||||
},
|
||||
},
|
||||
socialProviders,
|
||||
user: {
|
||||
deleteUser: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
plugins: [jazzPlugin()],
|
||||
databaseHooks: {
|
||||
user: {
|
||||
create: {
|
||||
async after(user) {
|
||||
// Here we can send a welcome email to the user
|
||||
console.error("Not implemented");
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Run database migrations
|
||||
const migrations = await getMigrations(auth.options);
|
||||
await migrations.runMigrations();
|
||||
|
||||
return auth;
|
||||
})();
|
||||
186
examples/betterauth/src/lib/socialProviders.ts
Normal file
@@ -0,0 +1,186 @@
|
||||
const apple =
|
||||
process.env.APPLE_CLIENT_ID &&
|
||||
process.env.APPLE_CLIENT_SECRET &&
|
||||
process.env.APPLE_APP_BUNDLE_IDENTIFIER
|
||||
? {
|
||||
apple: {
|
||||
clientId: process.env.APPLE_CLIENT_ID as string,
|
||||
clientSecret: process.env.APPLE_CLIENT_SECRET as string,
|
||||
// For native iOS
|
||||
appBundleIdentifier: process.env
|
||||
.APPLE_APP_BUNDLE_IDENTIFIER as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const discord =
|
||||
process.env.DISCORD_CLIENT_ID && process.env.DISCORD_CLIENT_SECRET
|
||||
? {
|
||||
discord: {
|
||||
clientId: process.env.DISCORD_CLIENT_ID as string,
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const facebook =
|
||||
process.env.FACEBOOK_CLIENT_ID && process.env.FACEBOOK_CLIENT_SECRET
|
||||
? {
|
||||
facebook: {
|
||||
clientId: process.env.FACEBOOK_CLIENT_ID as string,
|
||||
clientSecret: process.env.FACEBOOK_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const github =
|
||||
process.env.GITHUB_CLIENT_ID && process.env.GITHUB_CLIENT_SECRET
|
||||
? {
|
||||
github: {
|
||||
clientId: process.env.GITHUB_CLIENT_ID as string,
|
||||
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const google =
|
||||
process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET
|
||||
? {
|
||||
google: {
|
||||
clientId: process.env.GOOGLE_CLIENT_ID as string,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const kick =
|
||||
process.env.KICK_CLIENT_ID && process.env.KICK_CLIENT_SECRET
|
||||
? {
|
||||
kick: {
|
||||
clientId: process.env.KICK_CLIENT_ID as string,
|
||||
clientSecret: process.env.KICK_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const microsoft =
|
||||
process.env.MICROSOFT_CLIENT_ID && process.env.MICROSOFT_CLIENT_SECRET
|
||||
? {
|
||||
microsoft: {
|
||||
clientId: process.env.MICROSOFT_CLIENT_ID as string,
|
||||
clientSecret: process.env.MICROSOFT_CLIENT_SECRET as string,
|
||||
tenantId: "common",
|
||||
requireSelectAccount: true,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const tiktok =
|
||||
process.env.TIKTOK_CLIENT_ID &&
|
||||
process.env.TIKTOK_CLIENT_SECRET &&
|
||||
process.env.TIKTOK_CLIENT_KEY
|
||||
? {
|
||||
tiktok: {
|
||||
clientId: process.env.TIKTOK_CLIENT_ID,
|
||||
clientSecret: process.env.TIKTOK_CLIENT_SECRET,
|
||||
clientKey: process.env.TIKTOK_CLIENT_KEY,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const twitch =
|
||||
process.env.TWITCH_CLIENT_ID && process.env.TWITCH_CLIENT_SECRET
|
||||
? {
|
||||
twitch: {
|
||||
clientId: process.env.TWITCH_CLIENT_ID as string,
|
||||
clientSecret: process.env.TWITCH_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const twitter =
|
||||
process.env.TWITTER_CLIENT_ID && process.env.TWITTER_CLIENT_SECRET
|
||||
? {
|
||||
twitter: {
|
||||
clientId: process.env.TWITTER_CLIENT_ID,
|
||||
clientSecret: process.env.TWITTER_CLIENT_SECRET,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const dropbox =
|
||||
process.env.DROPBOX_CLIENT_ID && process.env.DROPBOX_CLIENT_SECRET
|
||||
? {
|
||||
dropbox: {
|
||||
clientId: process.env.DROPBOX_CLIENT_ID as string,
|
||||
clientSecret: process.env.DROPBOX_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const linkedin =
|
||||
process.env.LINKEDIN_CLIENT_ID && process.env.LINKEDIN_CLIENT_SECRET
|
||||
? {
|
||||
linkedin: {
|
||||
clientId: process.env.LINKEDIN_CLIENT_ID as string,
|
||||
clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const gitlab =
|
||||
process.env.GITLAB_CLIENT_ID &&
|
||||
process.env.GITLAB_CLIENT_SECRET &&
|
||||
process.env.GITLAB_ISSUER
|
||||
? {
|
||||
gitlab: {
|
||||
clientId: process.env.GITLAB_CLIENT_ID as string,
|
||||
clientSecret: process.env.GITLAB_CLIENT_SECRET as string,
|
||||
issuer: process.env.GITLAB_ISSUER as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const reddit =
|
||||
process.env.REDDIT_CLIENT_ID && process.env.REDDIT_CLIENT_SECRET
|
||||
? {
|
||||
reddit: {
|
||||
clientId: process.env.REDDIT_CLIENT_ID as string,
|
||||
clientSecret: process.env.REDDIT_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const roblox =
|
||||
process.env.ROBLOX_CLIENT_ID && process.env.ROBLOX_CLIENT_SECRET
|
||||
? {
|
||||
roblox: {
|
||||
clientId: process.env.ROBLOX_CLIENT_ID,
|
||||
clientSecret: process.env.ROBLOX_CLIENT_SECRET,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const spotify =
|
||||
process.env.SPOTIFY_CLIENT_ID && process.env.SPOTIFY_CLIENT_SECRET
|
||||
? {
|
||||
spotify: {
|
||||
clientId: process.env.SPOTIFY_CLIENT_ID as string,
|
||||
clientSecret: process.env.SPOTIFY_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const vk =
|
||||
process.env.VK_CLIENT_ID && process.env.VK_CLIENT_SECRET
|
||||
? {
|
||||
vk: {
|
||||
clientId: process.env.VK_CLIENT_ID as string,
|
||||
clientSecret: process.env.VK_CLIENT_SECRET as string,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
|
||||
export const socialProviders = {
|
||||
...(apple && { ...apple }),
|
||||
...(discord && { ...discord }),
|
||||
...(facebook && { ...facebook }),
|
||||
...(github && { ...github }),
|
||||
...(google && { ...google }),
|
||||
...(kick && { ...kick }),
|
||||
...(microsoft && { ...microsoft }),
|
||||
...(tiktok && { ...tiktok }),
|
||||
...(twitch && { ...twitch }),
|
||||
...(twitter && { ...twitter }),
|
||||
...(dropbox && { ...dropbox }),
|
||||
...(linkedin && { ...linkedin }),
|
||||
...(gitlab && { ...gitlab }),
|
||||
...(reddit && { ...reddit }),
|
||||
...(roblox && { ...roblox }),
|
||||
...(spotify && { ...spotify }),
|
||||
...(vk && { ...vk }),
|
||||
};
|
||||
6
examples/betterauth/src/lib/utils.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { type ClassValue, clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
28
examples/betterauth/tests/authFlow.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { test } from "@playwright/test";
|
||||
import { HomePage } from "./pages/HomePage";
|
||||
|
||||
test("should sign up, sign in, and logout", async ({ page }) => {
|
||||
const username = randomBytes(4).toString("hex");
|
||||
const email = `${username}@example.com`;
|
||||
const password = randomBytes(8).toString("hex");
|
||||
|
||||
// Sign up
|
||||
await page.goto("/");
|
||||
const homePage = new HomePage(page);
|
||||
await homePage.expectLoggedOut();
|
||||
await homePage.signUpLink.click();
|
||||
await homePage.signUpEmail(username, email, password);
|
||||
await homePage.expectLoggedIn(username);
|
||||
|
||||
// Log out & sign in
|
||||
await homePage.logout();
|
||||
await homePage.expectLoggedOut();
|
||||
await homePage.signInLink.click();
|
||||
await homePage.signInEmail(email, password);
|
||||
await homePage.expectLoggedIn(username);
|
||||
|
||||
// Logout
|
||||
await homePage.logout();
|
||||
await homePage.expectLoggedOut();
|
||||
});
|
||||
76
examples/betterauth/tests/pages/HomePage.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { type Page, expect } from "@playwright/test";
|
||||
|
||||
export class HomePage {
|
||||
constructor(public page: Page) {}
|
||||
|
||||
usernameInput = this.page.getByRole("textbox", {
|
||||
name: "Name",
|
||||
exact: true,
|
||||
});
|
||||
emailInput = this.page.getByRole("textbox", {
|
||||
name: "Email",
|
||||
exact: true,
|
||||
});
|
||||
passwordInput = this.page.getByRole("textbox", {
|
||||
name: "Password",
|
||||
exact: true,
|
||||
});
|
||||
confirmPasswordInput = this.page.getByRole("textbox", {
|
||||
name: "Confirm password",
|
||||
exact: true,
|
||||
});
|
||||
signUpButton = this.page.getByRole("button", {
|
||||
name: "Sign up",
|
||||
exact: true,
|
||||
});
|
||||
signInButton = this.page.getByRole("button", {
|
||||
name: "Sign in",
|
||||
exact: true,
|
||||
});
|
||||
signUpLink = this.page.getByRole("link", {
|
||||
name: "Sign up",
|
||||
exact: true,
|
||||
});
|
||||
signInLink = this.page.getByRole("link", {
|
||||
name: "Sign in",
|
||||
exact: true,
|
||||
});
|
||||
logoutButton = this.page.getByRole("button", {
|
||||
name: "Sign out",
|
||||
exact: true,
|
||||
});
|
||||
|
||||
async signUpEmail(name: string, email: string, password: string) {
|
||||
await this.usernameInput.fill(name);
|
||||
await this.emailInput.fill(email);
|
||||
await this.passwordInput.fill(password);
|
||||
await this.confirmPasswordInput.fill(password);
|
||||
await this.signUpButton.click();
|
||||
}
|
||||
|
||||
async signInEmail(email: string, password: string) {
|
||||
await this.emailInput.fill(email);
|
||||
await this.passwordInput.fill(password);
|
||||
await this.signInButton.click();
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await this.logoutButton.click();
|
||||
}
|
||||
|
||||
async expectLoggedIn(name?: string) {
|
||||
await expect(this.logoutButton).toBeVisible();
|
||||
await expect(this.signInLink).not.toBeVisible();
|
||||
await expect(this.signUpLink).not.toBeVisible();
|
||||
if (name) {
|
||||
await expect(this.page.getByText(`Signed in as ${name}`)).toBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
async expectLoggedOut() {
|
||||
await expect(this.logoutButton).not.toBeVisible();
|
||||
await expect(this.signInLink).toBeVisible();
|
||||
await expect(this.signUpLink).toBeVisible();
|
||||
await expect(this.page.getByText(`Anonymous user`)).toBeVisible();
|
||||
}
|
||||
}
|
||||
27
examples/betterauth/tsconfig.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -1,5 +1,263 @@
|
||||
# chat-rn-expo-clerk
|
||||
|
||||
## 1.0.124
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- jazz-tools@0.14.0
|
||||
- jazz-expo@0.14.0
|
||||
- jazz-react-native-media-images@0.14.0
|
||||
|
||||
## 1.0.123
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.32
|
||||
|
||||
## 1.0.122
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- jazz-tools@0.13.31
|
||||
- jazz-expo@0.13.31
|
||||
- jazz-react-native-media-images@0.13.31
|
||||
|
||||
## 1.0.121
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
- jazz-react-native-media-images@0.13.30
|
||||
|
||||
## 1.0.120
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.29
|
||||
- jazz-tools@0.13.29
|
||||
- jazz-react-native-media-images@0.13.29
|
||||
|
||||
## 1.0.119
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.28
|
||||
- jazz-tools@0.13.28
|
||||
- jazz-react-native-media-images@0.13.28
|
||||
|
||||
## 1.0.118
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.27
|
||||
- jazz-tools@0.13.27
|
||||
- jazz-react-native-media-images@0.13.27
|
||||
|
||||
## 1.0.117
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ff846d9]
|
||||
- jazz-tools@0.13.26
|
||||
- jazz-expo@0.13.26
|
||||
- jazz-react-native-media-images@0.13.26
|
||||
|
||||
## 1.0.116
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.25
|
||||
- jazz-tools@0.13.25
|
||||
- jazz-react-native-media-images@0.13.25
|
||||
|
||||
## 1.0.115
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [02a240c]
|
||||
- jazz-tools@0.13.23
|
||||
- jazz-expo@0.13.23
|
||||
- jazz-react-native-media-images@0.13.23
|
||||
|
||||
## 1.0.114
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.22
|
||||
|
||||
## 1.0.113
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
- jazz-react-native-media-images@0.13.21
|
||||
|
||||
## 1.0.112
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [439f0fe]
|
||||
- jazz-tools@0.13.20
|
||||
- jazz-expo@0.13.20
|
||||
- jazz-react-native-media-images@0.13.20
|
||||
|
||||
## 1.0.111
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [80530a4]
|
||||
- jazz-tools@0.13.19
|
||||
- jazz-expo@0.13.19
|
||||
- jazz-react-native-media-images@0.13.19
|
||||
|
||||
## 1.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [761759c]
|
||||
- jazz-tools@0.13.18
|
||||
- jazz-expo@0.13.18
|
||||
- jazz-react-native-media-images@0.13.18
|
||||
|
||||
## 1.0.109
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.17
|
||||
- jazz-tools@0.13.17
|
||||
- jazz-react-native-media-images@0.13.17
|
||||
|
||||
## 1.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.16
|
||||
- jazz-tools@0.13.16
|
||||
- jazz-react-native-media-images@0.13.16
|
||||
|
||||
## 1.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.15
|
||||
- jazz-tools@0.13.15
|
||||
- jazz-react-native-media-images@0.13.15
|
||||
|
||||
## 1.0.106
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bd94012]
|
||||
- jazz-expo@0.13.14
|
||||
- jazz-tools@0.13.14
|
||||
- jazz-react-native-media-images@0.13.14
|
||||
|
||||
## 1.0.105
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.13
|
||||
- jazz-tools@0.13.13
|
||||
- jazz-react-native-media-images@0.13.13
|
||||
|
||||
## 1.0.104
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4547525]
|
||||
- jazz-tools@0.13.12
|
||||
- jazz-expo@0.13.12
|
||||
- jazz-react-native-media-images@0.13.12
|
||||
|
||||
## 1.0.103
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17273a6]
|
||||
- jazz-tools@0.13.11
|
||||
- jazz-expo@0.13.11
|
||||
- jazz-react-native-media-images@0.13.11
|
||||
|
||||
## 1.0.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.10
|
||||
- jazz-tools@0.13.10
|
||||
- jazz-react-native-media-images@0.13.10
|
||||
|
||||
## 1.0.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6cf01f]
|
||||
- jazz-tools@0.13.9
|
||||
- jazz-expo@0.13.9
|
||||
- jazz-react-native-media-images@0.13.9
|
||||
|
||||
## 1.0.100
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.8
|
||||
|
||||
## 1.0.99
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bc3d7bb]
|
||||
- jazz-tools@0.13.7
|
||||
- jazz-expo@0.13.7
|
||||
- jazz-react-native-media-images@0.13.7
|
||||
|
||||
## 1.0.98
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fe6f561]
|
||||
- jazz-tools@0.13.5
|
||||
- jazz-expo@0.13.5
|
||||
- jazz-react-native-media-images@0.13.5
|
||||
|
||||
## 1.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3129982]
|
||||
- Updated dependencies [3129982]
|
||||
- jazz-expo@0.13.4
|
||||
- jazz-tools@0.13.4
|
||||
- jazz-react-native-media-images@0.13.4
|
||||
|
||||
## 1.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [12f8bfa]
|
||||
- Updated dependencies [bd57177]
|
||||
- jazz-tools@0.13.3
|
||||
- jazz-expo@0.13.3
|
||||
- jazz-react-native-media-images@0.13.3
|
||||
|
||||
## 1.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.2
|
||||
- jazz-tools@0.13.2
|
||||
- jazz-react-native-media-images@0.13.2
|
||||
|
||||
## 1.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [63a7aa0]
|
||||
- jazz-expo@0.13.1
|
||||
|
||||
## 1.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -2,28 +2,39 @@ import "../global.css";
|
||||
import { ClerkLoaded, ClerkProvider } from "@clerk/clerk-expo";
|
||||
import { secureStore } from "@clerk/clerk-expo/secure-store";
|
||||
import { useFonts } from "expo-font";
|
||||
import { Slot } from "expo-router";
|
||||
import { Slot, useRouter, useSegments } from "expo-router";
|
||||
import * as SplashScreen from "expo-splash-screen";
|
||||
import { useIsAuthenticated, useJazzContext } from "jazz-expo";
|
||||
import React, { useEffect } from "react";
|
||||
import { tokenCache } from "../cache";
|
||||
import { JazzAndAuth } from "../src/auth-context";
|
||||
|
||||
SplashScreen.preventAutoHideAsync();
|
||||
|
||||
export default function RootLayout() {
|
||||
const [loaded] = useFonts({
|
||||
SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"),
|
||||
});
|
||||
function InitialLayout() {
|
||||
const isAuthenticated = useIsAuthenticated();
|
||||
const segments = useSegments();
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (loaded) {
|
||||
SplashScreen.hideAsync();
|
||||
}
|
||||
}, [loaded]);
|
||||
const inAuthGroup = segments[0] === "(auth)";
|
||||
|
||||
if (!loaded) {
|
||||
return null;
|
||||
}
|
||||
if (isAuthenticated && inAuthGroup) {
|
||||
router.replace("/chat");
|
||||
} else if (!isAuthenticated && !inAuthGroup) {
|
||||
router.replace("/");
|
||||
}
|
||||
|
||||
SplashScreen.hideAsync();
|
||||
}, [isAuthenticated, segments, router]);
|
||||
|
||||
return <Slot />;
|
||||
}
|
||||
|
||||
export default function RootLayout() {
|
||||
const [fontsLoaded] = useFonts({
|
||||
SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"),
|
||||
});
|
||||
|
||||
const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY;
|
||||
|
||||
@@ -33,6 +44,17 @@ export default function RootLayout() {
|
||||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (fontsLoaded) {
|
||||
} else {
|
||||
SplashScreen.preventAutoHideAsync();
|
||||
}
|
||||
}, [fontsLoaded]);
|
||||
|
||||
if (!fontsLoaded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ClerkProvider
|
||||
tokenCache={tokenCache}
|
||||
@@ -41,7 +63,7 @@ export default function RootLayout() {
|
||||
>
|
||||
<ClerkLoaded>
|
||||
<JazzAndAuth>
|
||||
<Slot />
|
||||
<InitialLayout />
|
||||
</JazzAndAuth>
|
||||
</ClerkLoaded>
|
||||
</ClerkProvider>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useLocalSearchParams } from "expo-router";
|
||||
import { useAccount, useCoState } from "jazz-expo";
|
||||
import { ProgressiveImg } from "jazz-expo";
|
||||
import { createImage } from "jazz-react-native-media-images";
|
||||
import { Group, ID } from "jazz-tools";
|
||||
import { CoPlainText, Group, Loaded } from "jazz-tools";
|
||||
import { useEffect, useLayoutEffect, useState } from "react";
|
||||
import React, {
|
||||
SafeAreaView,
|
||||
@@ -26,7 +26,7 @@ import React, {
|
||||
export default function Conversation() {
|
||||
const { chatId } = useLocalSearchParams();
|
||||
const { me } = useAccount();
|
||||
const [chat, setChat] = useState<Chat>();
|
||||
const [chat, setChat] = useState<Loaded<typeof Chat>>();
|
||||
const [message, setMessage] = useState("");
|
||||
const loadedChat = useCoState(Chat, chat?.id, { resolve: { $each: true } });
|
||||
const navigation = useNavigation();
|
||||
@@ -37,7 +37,7 @@ export default function Conversation() {
|
||||
if (chatId === "new") {
|
||||
createChat();
|
||||
} else {
|
||||
loadChat(chatId as ID<Chat>);
|
||||
loadChat(chatId as string);
|
||||
}
|
||||
}, [chat]);
|
||||
|
||||
@@ -69,10 +69,10 @@ export default function Conversation() {
|
||||
setChat(chat);
|
||||
};
|
||||
|
||||
const loadChat = async (chatId: ID<Chat>) => {
|
||||
const loadChat = async (chatId: string) => {
|
||||
try {
|
||||
const chat = await Chat.load(chatId, me);
|
||||
setChat(chat);
|
||||
const chat = await Chat.load(chatId);
|
||||
if (chat) setChat(chat);
|
||||
} catch (error) {
|
||||
console.log("Error loading chat", error);
|
||||
Alert.alert("Error", `Error loading chat: ${error}`);
|
||||
@@ -82,7 +82,12 @@ export default function Conversation() {
|
||||
const sendMessage = () => {
|
||||
if (!chat) return;
|
||||
if (message.trim()) {
|
||||
chat.push(Message.create({ text: message }, { owner: chat._owner }));
|
||||
chat.push(
|
||||
Message.create(
|
||||
{ text: CoPlainText.create(message, chat._owner) },
|
||||
chat._owner,
|
||||
),
|
||||
);
|
||||
setMessage("");
|
||||
}
|
||||
};
|
||||
@@ -104,7 +109,12 @@ export default function Conversation() {
|
||||
maxSize: 2048,
|
||||
});
|
||||
|
||||
chat.push(Message.create({ text: "", image }, { owner: chat._owner }));
|
||||
chat.push(
|
||||
Message.create(
|
||||
{ text: CoPlainText.create("", chat._owner), image },
|
||||
chat._owner,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert("Error", "Failed to upload image");
|
||||
@@ -113,8 +123,8 @@ export default function Conversation() {
|
||||
}
|
||||
};
|
||||
|
||||
const renderMessageItem = ({ item }: { item: Message }) => {
|
||||
const isMe = item._edits.text.by?.isMe;
|
||||
const renderMessageItem = ({ item }: { item: Loaded<typeof Message> }) => {
|
||||
const isMe = item._edits.text?.by?.isMe;
|
||||
return (
|
||||
<View
|
||||
className={clsx(
|
||||
@@ -129,7 +139,7 @@ export default function Conversation() {
|
||||
isMe ? "text-right" : "text-left",
|
||||
)}
|
||||
>
|
||||
{item._edits.text.by?.profile?.name}
|
||||
{item._edits.text?.by?.profile?.name}
|
||||
</Text>
|
||||
) : null}
|
||||
<View
|
||||
@@ -165,8 +175,8 @@ export default function Conversation() {
|
||||
!isMe ? "mt-2 text-gray-500" : "mt-1 text-gray-200",
|
||||
)}
|
||||
>
|
||||
{item._edits.text.madeAt?.getHours().toString().padStart(2, "0")}:
|
||||
{item._edits.text.madeAt?.getMinutes().toString().padStart(2, "0")}
|
||||
{item._edits.text?.madeAt?.getHours().toString().padStart(2, "0")}:
|
||||
{item._edits.text?.madeAt?.getMinutes().toString().padStart(2, "0")}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function ChatScreen() {
|
||||
});
|
||||
}, [navigation]);
|
||||
|
||||
const loadChat = async (chatId: ID<Chat> | "new") => {
|
||||
const loadChat = async (chatId: string | "new") => {
|
||||
router.navigate(`/chat/${chatId}`);
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ export default function ChatScreen() {
|
||||
text: "Join",
|
||||
onPress: (chatId) => {
|
||||
if (chatId) {
|
||||
loadChat(chatId as ID<Chat>);
|
||||
loadChat(chatId);
|
||||
} else {
|
||||
Alert.alert("Error", "Chat ID cannot be empty.");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-expo-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.93",
|
||||
"version": "1.0.124",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
@@ -12,62 +12,56 @@
|
||||
"web": "expo start --web",
|
||||
"run:ios": "pnpm expo prebuild && npx pod-install && pnpm expo run:ios"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "jest-expo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/core-asynciterator-polyfill": "^1.0.2",
|
||||
"@bacons/text-decoder": "0.0.0",
|
||||
"@bam.tech/react-native-image-resizer": "^3.0.11",
|
||||
"@clerk/clerk-expo": "^2.2.21",
|
||||
"@craftzdog/react-native-buffer": "6.0.5",
|
||||
"@expo/vector-icons": "^14.0.2",
|
||||
"@expo/vector-icons": "^14.1.0",
|
||||
"@react-native-community/netinfo": "11.4.1",
|
||||
"@react-navigation/native": "7.0.19",
|
||||
"@react-navigation/native-stack": "7.2.1",
|
||||
"clsx": "^2.0.0",
|
||||
"expo": "^52.0.42",
|
||||
"expo-build-properties": "~0.13.1",
|
||||
"expo-clipboard": "~7.0.0",
|
||||
"expo-constants": "~17.0.8",
|
||||
"expo-crypto": "~14.0.2",
|
||||
"expo-dev-client": "~5.0.16",
|
||||
"expo-file-system": "^18.0.4",
|
||||
"expo-font": "~13.0.1",
|
||||
"expo-image-picker": "~16.0.6",
|
||||
"expo-linking": "~7.0.5",
|
||||
"expo-router": "~4.0.19",
|
||||
"expo-secure-store": "~14.0.0",
|
||||
"expo-splash-screen": "~0.29.22",
|
||||
"expo-sqlite": "15.1.3",
|
||||
"expo-status-bar": "~2.0.1",
|
||||
"expo-web-browser": "~14.0.1",
|
||||
"expo": "^53.0.8",
|
||||
"expo-build-properties": "~0.14.6",
|
||||
"expo-clipboard": "~7.1.4",
|
||||
"expo-constants": "~17.1.6",
|
||||
"expo-crypto": "~14.1.4",
|
||||
"expo-dev-client": "~5.1.8",
|
||||
"expo-file-system": "^18.1.9",
|
||||
"expo-font": "~13.3.1",
|
||||
"expo-image-picker": "~16.1.4",
|
||||
"expo-linking": "~7.1.4",
|
||||
"expo-router": "~5.0.6",
|
||||
"expo-secure-store": "~14.2.3",
|
||||
"expo-splash-screen": "~0.30.8",
|
||||
"expo-sqlite": "15.2.9",
|
||||
"expo-status-bar": "~2.2.3",
|
||||
"expo-web-browser": "~14.1.6",
|
||||
"jazz-expo": "workspace:*",
|
||||
"jazz-react-native-media-images": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"nativewind": "^4.1.21",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-native": "0.76.7",
|
||||
"react-native-gesture-handler": "~2.20.2",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"react-native": "0.79.2",
|
||||
"react-native-gesture-handler": "~2.24.0",
|
||||
"react-native-get-random-values": "^1.11.0",
|
||||
"react-native-reanimated": "~3.16.3",
|
||||
"react-native-safe-area-context": "4.12.0",
|
||||
"react-native-screens": "4.4.0",
|
||||
"react-native-reanimated": "~3.17.5",
|
||||
"react-native-safe-area-context": "5.4.0",
|
||||
"react-native-screens": "4.10.0",
|
||||
"react-native-url-polyfill": "^2.0.0",
|
||||
"react-native-web": "~0.19.13",
|
||||
"react-native-web": "~0.20.0",
|
||||
"readable-stream": "4.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@types/jest": "^29.5.13",
|
||||
"@types/react": "~18.3.12",
|
||||
"@types/react": "~19.0.14",
|
||||
"@types/react-test-renderer": "^19.0.0",
|
||||
"jest": "^29.6.3",
|
||||
"jest-expo": "~52.0.2",
|
||||
"react-test-renderer": "18.3.1",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2"
|
||||
"typescript": "5.8.3"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useClerk } from "@clerk/clerk-expo";
|
||||
// FIXME: why isn't the export working? IDE is fine, Metro doesn't like the non 'dist' import
|
||||
import { JazzProviderWithClerk } from "jazz-expo/dist/auth/clerk";
|
||||
import { JazzProviderWithClerk } from "jazz-expo/auth/clerk";
|
||||
import React, { PropsWithChildren } from "react";
|
||||
import { apiKey } from "./apiKey";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CoList, CoMap, ImageDefinition, co } from "jazz-tools";
|
||||
import { CoList, co, coField, z } from "jazz-tools";
|
||||
|
||||
export class Message extends CoMap {
|
||||
text = co.string;
|
||||
image = co.optional.ref(ImageDefinition);
|
||||
}
|
||||
export const Message = co.map({
|
||||
text: co.plainText(),
|
||||
image: z.optional(co.image()),
|
||||
});
|
||||
|
||||
export class Chat extends CoList.Of(co.ref(Message)) {}
|
||||
export const Chat = co.list(Message);
|
||||
|
||||
@@ -1,5 +1,236 @@
|
||||
# chat-rn-expo
|
||||
|
||||
## 1.0.111
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- jazz-tools@0.14.0
|
||||
- jazz-expo@0.14.0
|
||||
|
||||
## 1.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.32
|
||||
|
||||
## 1.0.109
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- jazz-tools@0.13.31
|
||||
- jazz-expo@0.13.31
|
||||
|
||||
## 1.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
|
||||
## 1.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.29
|
||||
- jazz-tools@0.13.29
|
||||
|
||||
## 1.0.106
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.28
|
||||
- jazz-tools@0.13.28
|
||||
|
||||
## 1.0.105
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.27
|
||||
- jazz-tools@0.13.27
|
||||
|
||||
## 1.0.104
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ff846d9]
|
||||
- jazz-tools@0.13.26
|
||||
- jazz-expo@0.13.26
|
||||
|
||||
## 1.0.103
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.25
|
||||
- jazz-tools@0.13.25
|
||||
|
||||
## 1.0.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [02a240c]
|
||||
- jazz-tools@0.13.23
|
||||
- jazz-expo@0.13.23
|
||||
|
||||
## 1.0.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.22
|
||||
|
||||
## 1.0.100
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 1.0.99
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [439f0fe]
|
||||
- jazz-tools@0.13.20
|
||||
- jazz-expo@0.13.20
|
||||
|
||||
## 1.0.98
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [80530a4]
|
||||
- jazz-tools@0.13.19
|
||||
- jazz-expo@0.13.19
|
||||
|
||||
## 1.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [761759c]
|
||||
- jazz-tools@0.13.18
|
||||
- jazz-expo@0.13.18
|
||||
|
||||
## 1.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.17
|
||||
- jazz-tools@0.13.17
|
||||
|
||||
## 1.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.16
|
||||
- jazz-tools@0.13.16
|
||||
|
||||
## 1.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.15
|
||||
- jazz-tools@0.13.15
|
||||
|
||||
## 1.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bd94012]
|
||||
- jazz-expo@0.13.14
|
||||
- jazz-tools@0.13.14
|
||||
|
||||
## 1.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.13
|
||||
- jazz-tools@0.13.13
|
||||
|
||||
## 1.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4547525]
|
||||
- jazz-tools@0.13.12
|
||||
- jazz-expo@0.13.12
|
||||
|
||||
## 1.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17273a6]
|
||||
- jazz-tools@0.13.11
|
||||
- jazz-expo@0.13.11
|
||||
|
||||
## 1.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.10
|
||||
- jazz-tools@0.13.10
|
||||
|
||||
## 1.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6cf01f]
|
||||
- jazz-tools@0.13.9
|
||||
- jazz-expo@0.13.9
|
||||
|
||||
## 1.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.8
|
||||
|
||||
## 1.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bc3d7bb]
|
||||
- jazz-tools@0.13.7
|
||||
- jazz-expo@0.13.7
|
||||
|
||||
## 1.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fe6f561]
|
||||
- jazz-tools@0.13.5
|
||||
- jazz-expo@0.13.5
|
||||
|
||||
## 1.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3129982]
|
||||
- Updated dependencies [3129982]
|
||||
- jazz-expo@0.13.4
|
||||
- jazz-tools@0.13.4
|
||||
|
||||
## 1.0.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [12f8bfa]
|
||||
- Updated dependencies [bd57177]
|
||||
- jazz-tools@0.13.3
|
||||
- jazz-expo@0.13.3
|
||||
|
||||
## 1.0.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.2
|
||||
- jazz-tools@0.13.2
|
||||
|
||||
## 1.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [63a7aa0]
|
||||
- jazz-expo@0.13.1
|
||||
|
||||
## 1.0.80
|
||||
|
||||
### Patch Changes
|
||||
|
||||
55
examples/chat-rn-expo/app.config.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const { withBuildProperties } = require("expo-build-properties");
|
||||
const { withDangerousMod } = require("@expo/config-plugins");
|
||||
const fs = require("fs/promises");
|
||||
const path = require("path");
|
||||
|
||||
/**
|
||||
* https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
|
||||
*/
|
||||
function withCustomIosMod(config) {
|
||||
// Use expo-build-properties to bump iOS deployment target
|
||||
config = withBuildProperties(config, { ios: { deploymentTarget: "16.0" } });
|
||||
// Patch the generated Podfile fallback to ensure platform is always 16.0
|
||||
config = withDangerousMod(config, [
|
||||
"ios",
|
||||
async (modConfig) => {
|
||||
const podfilePath = path.join(
|
||||
modConfig.modRequest.platformProjectRoot,
|
||||
"Podfile",
|
||||
);
|
||||
let contents = await fs.readFile(podfilePath, "utf-8");
|
||||
|
||||
// Check if the IPHONEOS_DEPLOYMENT_TARGET setting is already present
|
||||
// We search for the key being assigned, e.g., config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] =
|
||||
const deploymentTargetSettingExists =
|
||||
/\.build_settings\s*\[\s*['"]IPHONEOS_DEPLOYMENT_TARGET['"]\s*\]\s*=/.test(
|
||||
contents,
|
||||
);
|
||||
|
||||
if (!deploymentTargetSettingExists) {
|
||||
// IPHONEOS_DEPLOYMENT_TARGET setting not found, proceed to add it.
|
||||
contents = contents.replace(
|
||||
/(post_install\s+do\s+\|installer\|[\s\S]*?)(\r?\n\s end\s*)$/m,
|
||||
`$1
|
||||
|
||||
# Expo Build Properties: force deployment target
|
||||
# https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
|
||||
end
|
||||
end
|
||||
$2`,
|
||||
);
|
||||
}
|
||||
|
||||
await fs.writeFile(podfilePath, contents);
|
||||
return modConfig;
|
||||
},
|
||||
]);
|
||||
return config;
|
||||
}
|
||||
|
||||
module.exports = ({ config }) => {
|
||||
return withCustomIosMod(config);
|
||||
};
|
||||
@@ -23,7 +23,12 @@
|
||||
},
|
||||
"package": "com.jazz.chatrn"
|
||||
},
|
||||
"plugins": ["expo-secure-store", "expo-sqlite", "expo-build-properties"],
|
||||
"plugins": [
|
||||
"expo-secure-store",
|
||||
"expo-sqlite",
|
||||
"expo-build-properties",
|
||||
"expo-web-browser"
|
||||
],
|
||||
"extra": {
|
||||
"eas": {
|
||||
"projectId": "e0e61872-1906-4c84-b9d8-9be77355cad0"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "chat-rn-expo",
|
||||
"version": "1.0.80",
|
||||
"version": "1.0.111",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"build": "tsc --noEmit && expo export -p ios",
|
||||
"start": "expo start",
|
||||
"format-and-lint": "biome check .",
|
||||
"format-and-lint:fix": "biome check . --write",
|
||||
@@ -19,33 +19,35 @@
|
||||
"@react-navigation/native": "7.0.19",
|
||||
"@react-navigation/native-stack": "7.2.1",
|
||||
"clsx": "^2.0.0",
|
||||
"expo": "52.0.42",
|
||||
"expo-build-properties": "~0.13.1",
|
||||
"expo-clipboard": "~7.0.0",
|
||||
"expo-constants": "~17.0.8",
|
||||
"expo-dev-client": "~5.0.16",
|
||||
"expo-linking": "~7.0.5",
|
||||
"expo-secure-store": "~14.0.0",
|
||||
"expo-sqlite": "15.1.3",
|
||||
"expo-status-bar": "~2.0.1",
|
||||
"expo-web-browser": "~14.0.1",
|
||||
"expo": "53.0.8",
|
||||
"expo-build-properties": "~0.14.6",
|
||||
"expo-clipboard": "~7.1.4",
|
||||
"expo-constants": "~17.1.6",
|
||||
"expo-dev-client": "~5.1.8",
|
||||
"expo-linking": "~7.1.4",
|
||||
"expo-secure-store": "~14.2.3",
|
||||
"expo-sqlite": "15.2.9",
|
||||
"expo-status-bar": "~2.2.3",
|
||||
"expo-web-browser": "~14.1.6",
|
||||
"jazz-expo": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"nativewind": "^4.1.21",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-native": "0.76.7",
|
||||
"react": "19.0.0",
|
||||
"react-dom": "19.0.0",
|
||||
"react-native": "0.79.2",
|
||||
"react-native-get-random-values": "^1.11.0",
|
||||
"react-native-safe-area-context": "4.12.0",
|
||||
"react-native-screens": "4.4.0",
|
||||
"react-native-safe-area-context": "5.4.0",
|
||||
"react-native-screens": "4.10.0",
|
||||
"react-native-nitro-modules": "0.25.2",
|
||||
"react-native-quick-crypto": "1.0.0-beta.15",
|
||||
"react-native-url-polyfill": "^2.0.0",
|
||||
"readable-stream": "4.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@types/react": "~18.3.12",
|
||||
"@types/react": "~19.0.14",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2"
|
||||
"typescript": "5.8.3"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from "@react-navigation/native";
|
||||
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
||||
import * as Linking from "expo-linking";
|
||||
import { RNQuickCrypto } from "jazz-expo/crypto";
|
||||
import React, { StrictMode, useEffect, useState } from "react";
|
||||
import HandleInviteScreen from "./invite";
|
||||
|
||||
@@ -46,6 +47,7 @@ function App() {
|
||||
return (
|
||||
<StrictMode>
|
||||
<JazzProvider
|
||||
CryptoProvider={RNQuickCrypto}
|
||||
sync={{
|
||||
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import clsx from "clsx";
|
||||
import * as Clipboard from "expo-clipboard";
|
||||
import { Group, ID, Profile } from "jazz-tools";
|
||||
import { Group, ID, Loaded, Profile } from "jazz-tools";
|
||||
import { useEffect, useState } from "react";
|
||||
import React, {
|
||||
Button,
|
||||
@@ -19,7 +19,8 @@ import { Chat, Message } from "./schema";
|
||||
|
||||
export default function ChatScreen({ navigation }: { navigation: any }) {
|
||||
const { me, logOut } = useAccount();
|
||||
const [chatId, setChatId] = useState<ID<Chat>>();
|
||||
const [chatId, setChatId] = useState<string>();
|
||||
const [chatIdInput, setChatIdInput] = useState<string>();
|
||||
const loadedChat = useCoState(Chat, chatId, { resolve: { $each: true } });
|
||||
const [message, setMessage] = useState("");
|
||||
const profile = useCoState(Profile, me._refs.profile?.id, {});
|
||||
@@ -57,27 +58,11 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
|
||||
};
|
||||
|
||||
const joinChat = () => {
|
||||
Alert.prompt(
|
||||
"Join Chat",
|
||||
"Enter the Chat ID (example: co_zBGEHYvRfGuT2YSBraY3njGjnde)",
|
||||
[
|
||||
{
|
||||
text: "Cancel",
|
||||
style: "cancel",
|
||||
},
|
||||
{
|
||||
text: "Join",
|
||||
onPress: (chatId) => {
|
||||
if (chatId) {
|
||||
setChatId(chatId as ID<Chat>);
|
||||
} else {
|
||||
Alert.alert("Error", "Chat ID cannot be empty.");
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"plain-text",
|
||||
);
|
||||
if (chatIdInput) {
|
||||
setChatId(chatIdInput);
|
||||
} else {
|
||||
Alert.alert("Error", "Chat ID cannot be empty.");
|
||||
}
|
||||
};
|
||||
|
||||
const sendMessage = () => {
|
||||
@@ -90,7 +75,7 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
|
||||
}
|
||||
};
|
||||
|
||||
const renderMessageItem = ({ item }: { item: Message }) => {
|
||||
const renderMessageItem = ({ item }: { item: Loaded<typeof Message> }) => {
|
||||
const isMe = item._edits?.text?.by?.isMe;
|
||||
return (
|
||||
<View
|
||||
@@ -160,9 +145,25 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
|
||||
>
|
||||
<Text className="text-white font-semibold">Start new chat</Text>
|
||||
</TouchableOpacity>
|
||||
<Text className="text-m font-bold mt-6">Join existing chat</Text>
|
||||
<TextInput
|
||||
className="rounded h-12 p-2 m-2 mt-4 w-80 border border-gray-200 block"
|
||||
placeholder="Chat ID"
|
||||
value={chatIdInput ?? ""}
|
||||
onChangeText={(value) => {
|
||||
setChatIdInput(value);
|
||||
}}
|
||||
textAlignVertical="center"
|
||||
onSubmitEditing={() => {
|
||||
if (chatIdInput) {
|
||||
setChatId(chatIdInput);
|
||||
}
|
||||
}}
|
||||
testID="chat-id-input"
|
||||
/>
|
||||
<TouchableOpacity
|
||||
onPress={joinChat}
|
||||
className="bg-green-500 p-4 rounded-md mt-4"
|
||||
className="bg-green-500 p-4 rounded-md"
|
||||
>
|
||||
<Text className="text-white font-semibold">Join chat</Text>
|
||||
</TouchableOpacity>
|
||||
@@ -172,7 +173,6 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
|
||||
<FlatList
|
||||
contentContainerStyle={{
|
||||
flexGrow: 1,
|
||||
flex: 1,
|
||||
gap: 6,
|
||||
padding: 8,
|
||||
}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CoList, CoMap, co } from "jazz-tools";
|
||||
import { co, z } from "jazz-tools";
|
||||
|
||||
export class Message extends CoMap {
|
||||
text = co.string;
|
||||
}
|
||||
export const Message = co.map({
|
||||
text: z.string(),
|
||||
});
|
||||
|
||||
export class Chat extends CoList.Of(co.ref(Message)) {}
|
||||
export const Chat = co.list(Message);
|
||||
|
||||
@@ -9,6 +9,8 @@ appId: com.jazz.chatrn
|
||||
# - tapOn: "Reload"
|
||||
|
||||
# login
|
||||
- assertVisible: "Logout"
|
||||
- tapOn: "Logout"
|
||||
- assertVisible: "Anonymous user"
|
||||
- runFlow:
|
||||
label: "Erase existing username"
|
||||
@@ -42,9 +44,11 @@ appId: com.jazz.chatrn
|
||||
# logout
|
||||
- tapOn: "Logout"
|
||||
- assertVisible: "Anonymous user"
|
||||
# This doesn't work on CI, maybe because Android has a different alert dialog
|
||||
# - tapOn: "Join chat"
|
||||
# - inputText: "co_zFs6KFyhxPw4xtw83tcEMzeHUNv" # Use a static id because maestro doesn't have access to the system clipboard
|
||||
# - pressKey: "enter"
|
||||
# - assertVisible: "boorad"
|
||||
# - assertVisible: "bro, low key, it do be like that tho"
|
||||
|
||||
# join chat
|
||||
- tapOn:
|
||||
id: "chat-id-input"
|
||||
- inputText: "co_zFs6KFyhxPw4xtw83tcEMzeHUNv" # Use a static id because maestro doesn't have access to the system clipboard
|
||||
- tapOn: "Join chat"
|
||||
- assertVisible: "boorad"
|
||||
- assertVisible: "bro, low key, it do be like that tho"
|
||||
|
||||
@@ -1,5 +1,312 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.119
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- Updated dependencies [5835ed1]
|
||||
- cojson@0.14.0
|
||||
- jazz-tools@0.14.0
|
||||
- cojson-transport-ws@0.14.0
|
||||
- jazz-react-native@0.14.0
|
||||
|
||||
## 1.0.118
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.13.32
|
||||
|
||||
## 1.0.117
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- Updated dependencies [d63716a]
|
||||
- Updated dependencies [d5edad7]
|
||||
- jazz-tools@0.13.31
|
||||
- cojson@0.13.31
|
||||
- jazz-react-native@0.13.31
|
||||
- cojson-transport-ws@0.13.31
|
||||
|
||||
## 1.0.116
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07dd2c5]
|
||||
- cojson@0.13.30
|
||||
- cojson-transport-ws@0.13.30
|
||||
- jazz-react-native@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
|
||||
## 1.0.115
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [eef1a5d]
|
||||
- Updated dependencies [191ae38]
|
||||
- Updated dependencies [daee7b9]
|
||||
- cojson@0.13.29
|
||||
- jazz-react-native@0.13.29
|
||||
- cojson-transport-ws@0.13.29
|
||||
- jazz-tools@0.13.29
|
||||
|
||||
## 1.0.114
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e7ccb2c]
|
||||
- Updated dependencies [422dbc4]
|
||||
- cojson@0.13.28
|
||||
- cojson-transport-ws@0.13.28
|
||||
- jazz-react-native@0.13.28
|
||||
- jazz-tools@0.13.28
|
||||
|
||||
## 1.0.113
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6357052]
|
||||
- cojson@0.13.27
|
||||
- cojson-transport-ws@0.13.27
|
||||
- jazz-react-native@0.13.27
|
||||
- jazz-tools@0.13.27
|
||||
|
||||
## 1.0.112
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ff846d9]
|
||||
- jazz-tools@0.13.26
|
||||
- jazz-react-native@0.13.26
|
||||
|
||||
## 1.0.111
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a846e07]
|
||||
- cojson@0.13.25
|
||||
- cojson-transport-ws@0.13.25
|
||||
- jazz-react-native@0.13.25
|
||||
- jazz-tools@0.13.25
|
||||
|
||||
## 1.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6b781cf]
|
||||
- Updated dependencies [02a240c]
|
||||
- cojson@0.13.23
|
||||
- jazz-tools@0.13.23
|
||||
- cojson-transport-ws@0.13.23
|
||||
- jazz-react-native@0.13.23
|
||||
|
||||
## 1.0.109
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.13.22
|
||||
|
||||
## 1.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
- jazz-react-native@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 1.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [adfc9a6]
|
||||
- Updated dependencies [1389207]
|
||||
- Updated dependencies [d6e143e]
|
||||
- Updated dependencies [439f0fe]
|
||||
- Updated dependencies [3e6229d]
|
||||
- cojson@0.13.20
|
||||
- jazz-tools@0.13.20
|
||||
- jazz-react-native@0.13.20
|
||||
- cojson-transport-ws@0.13.20
|
||||
|
||||
## 1.0.106
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [80530a4]
|
||||
- jazz-tools@0.13.19
|
||||
- jazz-react-native@0.13.19
|
||||
|
||||
## 1.0.105
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9089252]
|
||||
- Updated dependencies [b470f63]
|
||||
- Updated dependencies [761759c]
|
||||
- Updated dependencies [66373ba]
|
||||
- Updated dependencies [f24cad1]
|
||||
- cojson@0.13.18
|
||||
- jazz-tools@0.13.18
|
||||
- cojson-transport-ws@0.13.18
|
||||
- jazz-react-native@0.13.18
|
||||
|
||||
## 1.0.104
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [9fb98e2]
|
||||
- Updated dependencies [0b89fad]
|
||||
- cojson@0.13.17
|
||||
- cojson-transport-ws@0.13.17
|
||||
- jazz-react-native@0.13.17
|
||||
- jazz-tools@0.13.17
|
||||
|
||||
## 1.0.103
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c6fb8dc]
|
||||
- cojson@0.13.16
|
||||
- cojson-transport-ws@0.13.16
|
||||
- jazz-react-native@0.13.16
|
||||
- jazz-tools@0.13.16
|
||||
|
||||
## 1.0.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c712ef2]
|
||||
- cojson@0.13.15
|
||||
- cojson-transport-ws@0.13.15
|
||||
- jazz-react-native@0.13.15
|
||||
- jazz-tools@0.13.15
|
||||
|
||||
## 1.0.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5c2c7d4]
|
||||
- cojson@0.13.14
|
||||
- cojson-transport-ws@0.13.14
|
||||
- jazz-react-native@0.13.14
|
||||
- jazz-tools@0.13.14
|
||||
|
||||
## 1.0.100
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ec9cb40]
|
||||
- cojson@0.13.13
|
||||
- cojson-transport-ws@0.13.13
|
||||
- jazz-react-native@0.13.13
|
||||
- jazz-tools@0.13.13
|
||||
|
||||
## 1.0.99
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4547525]
|
||||
- Updated dependencies [65719f2]
|
||||
- jazz-tools@0.13.12
|
||||
- cojson@0.13.12
|
||||
- jazz-react-native@0.13.12
|
||||
- cojson-transport-ws@0.13.12
|
||||
|
||||
## 1.0.98
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17273a6]
|
||||
- Updated dependencies [3396ed4]
|
||||
- Updated dependencies [17273a6]
|
||||
- Updated dependencies [267ea4c]
|
||||
- cojson@0.13.11
|
||||
- jazz-tools@0.13.11
|
||||
- cojson-transport-ws@0.13.11
|
||||
- jazz-react-native@0.13.11
|
||||
|
||||
## 1.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f837cfe]
|
||||
- cojson@0.13.10
|
||||
- cojson-transport-ws@0.13.10
|
||||
- jazz-react-native@0.13.10
|
||||
- jazz-tools@0.13.10
|
||||
|
||||
## 1.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6cf01f]
|
||||
- jazz-tools@0.13.9
|
||||
- jazz-react-native@0.13.9
|
||||
|
||||
## 1.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bc3d7bb]
|
||||
- Updated dependencies [4e9aae1]
|
||||
- Updated dependencies [21c935c]
|
||||
- Updated dependencies [aa1c80e]
|
||||
- Updated dependencies [13074be]
|
||||
- jazz-tools@0.13.7
|
||||
- cojson@0.13.7
|
||||
- jazz-react-native@0.13.7
|
||||
- cojson-transport-ws@0.13.7
|
||||
|
||||
## 1.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e090b39]
|
||||
- Updated dependencies [fe6f561]
|
||||
- cojson@0.13.5
|
||||
- jazz-tools@0.13.5
|
||||
- cojson-transport-ws@0.13.5
|
||||
- jazz-react-native@0.13.5
|
||||
|
||||
## 1.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3129982]
|
||||
- jazz-tools@0.13.4
|
||||
- jazz-react-native@0.13.4
|
||||
|
||||
## 1.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [12f8bfa]
|
||||
- Updated dependencies [b19cab7]
|
||||
- Updated dependencies [bd57177]
|
||||
- jazz-tools@0.13.3
|
||||
- cojson-transport-ws@0.13.3
|
||||
- jazz-react-native@0.13.3
|
||||
|
||||
## 1.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c551839]
|
||||
- cojson@0.13.2
|
||||
- cojson-transport-ws@0.13.2
|
||||
- jazz-react-native@0.13.2
|
||||
- jazz-tools@0.13.2
|
||||
|
||||
## 1.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [63a7aa0]
|
||||
- jazz-react-native@0.13.1
|
||||
|
||||
## 1.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.89",
|
||||
"version": "1.0.119",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
"ios": "react-native run-ios",
|
||||
"lint": "eslint .",
|
||||
"start": "react-native start",
|
||||
"test": "jest",
|
||||
"pods": "pod-install"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -25,7 +24,7 @@
|
||||
"jazz-react-native": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "18.3.1",
|
||||
"react-native": "0.76.7",
|
||||
"react-native": "0.79.2",
|
||||
"react-native-get-random-values": "^1.11.0",
|
||||
"react-native-mmkv": "^3.2.0",
|
||||
"react-native-polyfill-globals": "^3.1.0",
|
||||
@@ -47,16 +46,13 @@
|
||||
"@react-native/typescript-config": "0.76.7",
|
||||
"@rnx-kit/metro-config": "^2.0.1",
|
||||
"@rnx-kit/metro-resolver-symlinks": "^0.2.1",
|
||||
"@types/jest": "^29.5.13",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-test-renderer": "^18.0.0",
|
||||
"babel-jest": "^29.6.3",
|
||||
"eslint": "^8.19.0",
|
||||
"jest": "^29.6.3",
|
||||
"pod-install": "^0.3.5",
|
||||
"prettier": "2.8.8",
|
||||
"react-test-renderer": "18.3.1",
|
||||
"typescript": "5.0.4"
|
||||
"typescript": "5.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Clipboard from "@react-native-clipboard/clipboard";
|
||||
import { useAccount, useCoState } from "jazz-react-native";
|
||||
import { Group, ID, Profile } from "jazz-tools";
|
||||
import { CoPlainText, Group, ID, Loaded, Profile } from "jazz-tools";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
Alert,
|
||||
@@ -18,7 +18,7 @@ import { Chat, Message } from "./schema";
|
||||
|
||||
export function ChatScreen({ navigation }: { navigation: any }) {
|
||||
const { me, logOut } = useAccount();
|
||||
const [chatId, setChatId] = useState<ID<Chat>>();
|
||||
const [chatId, setChatId] = useState<string>();
|
||||
const loadedChat = useCoState(Chat, chatId, { resolve: { $each: true } });
|
||||
const [message, setMessage] = useState("");
|
||||
const profile = useCoState(Profile, me._refs.profile?.id, {});
|
||||
@@ -68,7 +68,7 @@ export function ChatScreen({ navigation }: { navigation: any }) {
|
||||
text: "Join",
|
||||
onPress: (chatId) => {
|
||||
if (chatId) {
|
||||
setChatId(chatId as ID<Chat>);
|
||||
setChatId(chatId);
|
||||
} else {
|
||||
Alert.alert("Error", "Chat ID cannot be empty.");
|
||||
}
|
||||
@@ -83,13 +83,18 @@ export function ChatScreen({ navigation }: { navigation: any }) {
|
||||
if (!loadedChat) return;
|
||||
if (message.trim()) {
|
||||
loadedChat.push(
|
||||
Message.create({ text: message }, { owner: loadedChat?._owner }),
|
||||
Message.create(
|
||||
{ text: CoPlainText.create(message, loadedChat?._owner) },
|
||||
loadedChat?._owner,
|
||||
),
|
||||
);
|
||||
setMessage("");
|
||||
}
|
||||
};
|
||||
|
||||
const renderMessageItem = ({ item }: { item: Message }) => {
|
||||
const renderMessageItem = ({
|
||||
item,
|
||||
}: { item: Loaded<typeof Message, { text: true }> }) => {
|
||||
const isMe = item._edits?.text?.by?.isMe;
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CoList, CoMap, co } from "jazz-tools";
|
||||
import { co } from "jazz-tools";
|
||||
|
||||
export class Message extends CoMap {
|
||||
text = co.string;
|
||||
}
|
||||
export const Message = co.map({
|
||||
text: co.plainText(),
|
||||
});
|
||||
|
||||
export class Chat extends CoList.Of(co.ref(Message)) {}
|
||||
export const Chat = co.list(Message);
|
||||
|
||||
@@ -1,5 +1,244 @@
|
||||
# chat-vue
|
||||
|
||||
## 0.0.102
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- jazz-tools@0.14.0
|
||||
- jazz-browser@0.14.0
|
||||
- jazz-vue@0.14.0
|
||||
|
||||
## 0.0.101
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.32
|
||||
- jazz-vue@0.13.32
|
||||
|
||||
## 0.0.100
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- jazz-tools@0.13.31
|
||||
- jazz-browser@0.13.31
|
||||
- jazz-vue@0.13.31
|
||||
|
||||
## 0.0.99
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
- jazz-vue@0.13.30
|
||||
|
||||
## 0.0.98
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.29
|
||||
- jazz-tools@0.13.29
|
||||
- jazz-vue@0.13.29
|
||||
|
||||
## 0.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.28
|
||||
- jazz-tools@0.13.28
|
||||
- jazz-vue@0.13.28
|
||||
|
||||
## 0.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.27
|
||||
- jazz-tools@0.13.27
|
||||
- jazz-vue@0.13.27
|
||||
|
||||
## 0.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ff846d9]
|
||||
- jazz-tools@0.13.26
|
||||
- jazz-browser@0.13.26
|
||||
- jazz-vue@0.13.26
|
||||
|
||||
## 0.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.25
|
||||
- jazz-tools@0.13.25
|
||||
- jazz-vue@0.13.25
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [02a240c]
|
||||
- jazz-tools@0.13.23
|
||||
- jazz-browser@0.13.23
|
||||
- jazz-vue@0.13.23
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
- jazz-vue@0.13.21
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [439f0fe]
|
||||
- jazz-tools@0.13.20
|
||||
- jazz-browser@0.13.20
|
||||
- jazz-vue@0.13.20
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [80530a4]
|
||||
- jazz-tools@0.13.19
|
||||
- jazz-browser@0.13.19
|
||||
- jazz-vue@0.13.19
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [761759c]
|
||||
- jazz-tools@0.13.18
|
||||
- jazz-browser@0.13.18
|
||||
- jazz-vue@0.13.18
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.17
|
||||
- jazz-tools@0.13.17
|
||||
- jazz-vue@0.13.17
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.16
|
||||
- jazz-tools@0.13.16
|
||||
- jazz-vue@0.13.16
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.15
|
||||
- jazz-tools@0.13.15
|
||||
- jazz-vue@0.13.15
|
||||
|
||||
## 0.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.14
|
||||
- jazz-tools@0.13.14
|
||||
- jazz-vue@0.13.14
|
||||
|
||||
## 0.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.13
|
||||
- jazz-tools@0.13.13
|
||||
- jazz-vue@0.13.13
|
||||
|
||||
## 0.0.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4547525]
|
||||
- Updated dependencies [29e05c4]
|
||||
- jazz-tools@0.13.12
|
||||
- jazz-browser@0.13.12
|
||||
- jazz-vue@0.13.12
|
||||
|
||||
## 0.0.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17273a6]
|
||||
- jazz-tools@0.13.11
|
||||
- jazz-browser@0.13.11
|
||||
- jazz-vue@0.13.11
|
||||
|
||||
## 0.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.10
|
||||
- jazz-tools@0.13.10
|
||||
- jazz-vue@0.13.10
|
||||
|
||||
## 0.0.80
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6cf01f]
|
||||
- jazz-tools@0.13.9
|
||||
- jazz-browser@0.13.9
|
||||
- jazz-vue@0.13.9
|
||||
|
||||
## 0.0.79
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bc3d7bb]
|
||||
- jazz-tools@0.13.7
|
||||
- jazz-browser@0.13.7
|
||||
- jazz-vue@0.13.7
|
||||
|
||||
## 0.0.78
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fe6f561]
|
||||
- jazz-tools@0.13.5
|
||||
- jazz-browser@0.13.5
|
||||
- jazz-vue@0.13.5
|
||||
|
||||
## 0.0.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3129982]
|
||||
- jazz-browser@0.13.4
|
||||
- jazz-tools@0.13.4
|
||||
- jazz-vue@0.13.4
|
||||
|
||||
## 0.0.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [12f8bfa]
|
||||
- Updated dependencies [bd57177]
|
||||
- jazz-tools@0.13.3
|
||||
- jazz-browser@0.13.3
|
||||
- jazz-vue@0.13.3
|
||||
|
||||
## 0.0.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.2
|
||||
- jazz-tools@0.13.2
|
||||
- jazz-vue@0.13.2
|
||||
|
||||
## 0.0.74
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<link rel="icon" href="./public/favicon.ico" type="image/png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
<title>Jazz Chat Vue Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "chat-vue",
|
||||
"version": "0.0.74",
|
||||
"version": "0.0.102",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build-type-check": "run-p type-check \"build-only {@}\" --",
|
||||
"build-type-check": "run-p type-check \"build {@}\" --",
|
||||
"preview": "vite preview",
|
||||
"build": "vite build",
|
||||
"type-check": "vue-tsc --build --force",
|
||||
@@ -31,8 +31,8 @@
|
||||
"npm-run-all2": "^6.2.3",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2",
|
||||
"vite": "^6.0.11",
|
||||
"typescript": "5.6.2",
|
||||
"vite": "6.0.11",
|
||||
"vite-plugin-vue-devtools": "^7.4.6",
|
||||
"vue-tsc": "^2.1.6"
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 15 KiB |
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<BubbleContainer :fromMe="lastEdit.by?.isMe">
|
||||
<BubbleBody>{{ msg.text }}</BubbleBody>
|
||||
<BubbleInfo :by="lastEdit.by?.profile?.name" :madeAt="lastEdit.madeAt" />
|
||||
</BubbleContainer>
|
||||
</template>
|
||||
<BubbleContainer :fromMe="lastEdit.by?.isMe">
|
||||
<BubbleBody>{{ msg.text }}</BubbleBody>
|
||||
<BubbleInfo :by="lastEdit.by?.profile?.name" :madeAt="lastEdit.madeAt" />
|
||||
</BubbleContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent } from "vue";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CoList, CoMap, co } from "jazz-tools";
|
||||
import { CoList, CoMap, CoPlainText, coField } from "jazz-tools";
|
||||
|
||||
export class Message extends CoMap {
|
||||
text = co.string;
|
||||
text = coField.ref(CoPlainText);
|
||||
}
|
||||
|
||||
export class Chat extends CoList.Of(co.ref(Message)) {}
|
||||
export class Chat extends CoList.Of(coField.ref(Message)) {}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import type { ID } from "jazz-tools";
|
||||
import { CoPlainText, type ID } from "jazz-tools";
|
||||
import { useCoState } from "jazz-vue";
|
||||
import { type PropType, computed, defineComponent, ref } from "vue";
|
||||
import ChatBody from "../components/ChatBody.vue";
|
||||
@@ -61,7 +61,12 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function handleSubmit(text: string) {
|
||||
chat?.value?.push(Message.create({ text }, { owner: chat.value._owner }));
|
||||
chat?.value?.push(
|
||||
Message.create(
|
||||
{ text: CoPlainText.create(text, chat.value._owner) },
|
||||
chat.value._owner,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,257 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.200
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- jazz-tools@0.14.0
|
||||
- jazz-inspector@0.14.0
|
||||
- jazz-react@0.14.0
|
||||
|
||||
## 0.0.199
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.32
|
||||
|
||||
## 0.0.198
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- jazz-tools@0.13.31
|
||||
- jazz-inspector@0.13.31
|
||||
- jazz-react@0.13.31
|
||||
|
||||
## 0.0.197
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.30
|
||||
- jazz-react@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
|
||||
## 0.0.196
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [8e5ff13]
|
||||
- jazz-inspector@0.13.29
|
||||
- jazz-react@0.13.29
|
||||
- jazz-tools@0.13.29
|
||||
|
||||
## 0.0.195
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.28
|
||||
- jazz-react@0.13.28
|
||||
- jazz-tools@0.13.28
|
||||
|
||||
## 0.0.194
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.27
|
||||
- jazz-react@0.13.27
|
||||
- jazz-tools@0.13.27
|
||||
|
||||
## 0.0.193
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ff846d9]
|
||||
- jazz-tools@0.13.26
|
||||
- jazz-inspector@0.13.26
|
||||
- jazz-react@0.13.26
|
||||
|
||||
## 0.0.192
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.25
|
||||
- jazz-react@0.13.25
|
||||
- jazz-tools@0.13.25
|
||||
|
||||
## 0.0.191
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [02a240c]
|
||||
- jazz-tools@0.13.23
|
||||
- jazz-inspector@0.13.23
|
||||
- jazz-react@0.13.23
|
||||
|
||||
## 0.0.190
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- jazz-inspector@0.13.21
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.189
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [439f0fe]
|
||||
- jazz-tools@0.13.20
|
||||
- jazz-inspector@0.13.20
|
||||
- jazz-react@0.13.20
|
||||
|
||||
## 0.0.188
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [80530a4]
|
||||
- jazz-tools@0.13.19
|
||||
- jazz-inspector@0.13.19
|
||||
- jazz-react@0.13.19
|
||||
|
||||
## 0.0.187
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [761759c]
|
||||
- jazz-tools@0.13.18
|
||||
- jazz-inspector@0.13.18
|
||||
- jazz-react@0.13.18
|
||||
|
||||
## 0.0.186
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.17
|
||||
- jazz-react@0.13.17
|
||||
- jazz-tools@0.13.17
|
||||
|
||||
## 0.0.185
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.16
|
||||
- jazz-react@0.13.16
|
||||
- jazz-tools@0.13.16
|
||||
|
||||
## 0.0.184
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.15
|
||||
- jazz-react@0.13.15
|
||||
- jazz-tools@0.13.15
|
||||
|
||||
## 0.0.183
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.14
|
||||
- jazz-react@0.13.14
|
||||
- jazz-tools@0.13.14
|
||||
|
||||
## 0.0.182
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.13
|
||||
- jazz-react@0.13.13
|
||||
- jazz-tools@0.13.13
|
||||
|
||||
## 0.0.181
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4547525]
|
||||
- jazz-tools@0.13.12
|
||||
- jazz-inspector@0.13.12
|
||||
- jazz-react@0.13.12
|
||||
|
||||
## 0.0.180
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17273a6]
|
||||
- jazz-tools@0.13.11
|
||||
- jazz-inspector@0.13.11
|
||||
- jazz-react@0.13.11
|
||||
|
||||
## 0.0.179
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector@0.13.10
|
||||
- jazz-react@0.13.10
|
||||
- jazz-tools@0.13.10
|
||||
|
||||
## 0.0.178
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6cf01f]
|
||||
- jazz-tools@0.13.9
|
||||
- jazz-inspector@0.13.9
|
||||
- jazz-react@0.13.9
|
||||
|
||||
## 0.0.177
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [22b5c4f]
|
||||
- Updated dependencies [31ea2ef]
|
||||
- Updated dependencies [4530c4a]
|
||||
- Updated dependencies [bc3d7bb]
|
||||
- jazz-inspector@0.13.7
|
||||
- jazz-tools@0.13.7
|
||||
- jazz-react@0.13.7
|
||||
|
||||
## 0.0.176
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c320615]
|
||||
- jazz-inspector@0.13.6
|
||||
|
||||
## 0.0.175
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [08ae9b2]
|
||||
- Updated dependencies [fe6f561]
|
||||
- jazz-inspector@0.13.5
|
||||
- jazz-tools@0.13.5
|
||||
- jazz-react@0.13.5
|
||||
|
||||
## 0.0.174
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3129982]
|
||||
- jazz-react@0.13.4
|
||||
- jazz-tools@0.13.4
|
||||
- jazz-inspector@0.13.4
|
||||
|
||||
## 0.0.173
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [12f8bfa]
|
||||
- Updated dependencies [bd57177]
|
||||
- Updated dependencies [017f6c8]
|
||||
- jazz-tools@0.13.3
|
||||
- jazz-inspector@0.13.3
|
||||
- jazz-react@0.13.3
|
||||
|
||||
## 0.0.172
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ae4be2b]
|
||||
- jazz-inspector@0.13.2
|
||||
- jazz-react@0.13.2
|
||||
- jazz-tools@0.13.2
|
||||
|
||||
## 0.0.171
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.171",
|
||||
"version": "0.0.200",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -20,7 +20,8 @@
|
||||
"jazz-tools": "workspace:*",
|
||||
"lucide-react": "^0.274.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
"react-dom": "^18.3.1",
|
||||
"zod": "4.0.0-beta.20250505T012514"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.50.1",
|
||||
@@ -31,7 +32,7 @@
|
||||
"is-ci": "^3.0.1",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2",
|
||||
"vite": "^6.0.11"
|
||||
"typescript": "5.6.2",
|
||||
"vite": "6.0.11"
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -3,7 +3,7 @@ import { getRandomUsername, inIframe, onChatLoad } from "@/util.ts";
|
||||
import { useIframeHashRouter } from "hash-slash";
|
||||
import { JazzInspector } from "jazz-inspector";
|
||||
import { JazzProvider, useAccount } from "jazz-react";
|
||||
import { Group, ID } from "jazz-tools";
|
||||
import { Group } from "jazz-tools";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { ChatScreen } from "./chatScreen.tsx";
|
||||
@@ -43,7 +43,7 @@ export function App() {
|
||||
</TopBar>
|
||||
{router.route({
|
||||
"/": () => createChat() as never,
|
||||
"/chat/:id": (id) => <ChatScreen chatID={id as ID<Chat>} />,
|
||||
"/chat/:id": (id) => <ChatScreen chatID={id} />,
|
||||
})}
|
||||
</AppContainer>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createImage, useAccount, useCoState } from "jazz-react";
|
||||
import { Account, ID } from "jazz-tools";
|
||||
import { Account, Loaded, co } from "jazz-tools";
|
||||
import { useState } from "react";
|
||||
import { Chat, Message } from "./schema.ts";
|
||||
import {
|
||||
@@ -15,8 +15,10 @@ import {
|
||||
TextInput,
|
||||
} from "./ui.tsx";
|
||||
|
||||
export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
const chat = useCoState(Chat, props.chatID, { resolve: { $each: true } });
|
||||
export function ChatScreen(props: { chatID: string }) {
|
||||
const chat = useCoState(Chat, props.chatID, {
|
||||
resolve: { $each: { text: true } },
|
||||
});
|
||||
const account = useAccount();
|
||||
const [showNLastMessages, setShowNLastMessages] = useState(30);
|
||||
|
||||
@@ -36,7 +38,15 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
}
|
||||
|
||||
createImage(file, { owner: chat._owner }).then((image) => {
|
||||
chat.push(Message.create({ text: file.name, image: image }, chat._owner));
|
||||
chat.push(
|
||||
Message.create(
|
||||
{
|
||||
text: co.plainText().create(file.name, chat._owner),
|
||||
image: image,
|
||||
},
|
||||
chat._owner,
|
||||
),
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -66,7 +76,12 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
|
||||
<TextInput
|
||||
onSubmit={(text) => {
|
||||
chat.push(Message.create({ text }, { owner: chat._owner }));
|
||||
chat.push(
|
||||
Message.create(
|
||||
{ text: co.plainText().create(text, chat._owner) },
|
||||
chat._owner,
|
||||
),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</InputBar>
|
||||
@@ -74,8 +89,11 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
);
|
||||
}
|
||||
|
||||
function ChatBubble(props: { me: Account; msg: Message }) {
|
||||
if (!props.me.canRead(props.msg)) {
|
||||
function ChatBubble(props: {
|
||||
me: Account;
|
||||
msg: Loaded<typeof Message, { text: true }>;
|
||||
}) {
|
||||
if (!props.me.canRead(props.msg) || !props.msg.text?.toString()) {
|
||||
return (
|
||||
<BubbleContainer fromMe={false}>
|
||||
<BubbleBody fromMe={false}>
|
||||
@@ -89,7 +107,7 @@ function ChatBubble(props: { me: Account; msg: Message }) {
|
||||
}
|
||||
|
||||
const lastEdit = props.msg._edits.text;
|
||||
const fromMe = lastEdit.by?.isMe;
|
||||
const fromMe = lastEdit?.by?.isMe;
|
||||
const { text, image } = props.msg;
|
||||
|
||||
return (
|
||||
@@ -98,7 +116,9 @@ function ChatBubble(props: { me: Account; msg: Message }) {
|
||||
{image && <BubbleImage image={image} />}
|
||||
<BubbleText text={text} />
|
||||
</BubbleBody>
|
||||
<BubbleInfo by={lastEdit.by?.profile?.name} madeAt={lastEdit.madeAt} />
|
||||
{lastEdit && (
|
||||
<BubbleInfo by={lastEdit.by?.profile?.name} madeAt={lastEdit.madeAt} />
|
||||
)}
|
||||
</BubbleContainer>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CoList, CoMap, ImageDefinition, co } from "jazz-tools";
|
||||
import { co, z } from "jazz-tools";
|
||||
|
||||
export class Message extends CoMap {
|
||||
text = co.string;
|
||||
image = co.optional.ref(ImageDefinition);
|
||||
}
|
||||
export const Message = co.map({
|
||||
text: co.plainText(),
|
||||
image: z.optional(co.image()),
|
||||
});
|
||||
|
||||
export class Chat extends CoList.Of(co.ref(Message)) {}
|
||||
export const Chat = co.list(Message);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import clsx from "clsx";
|
||||
import { ProgressiveImg } from "jazz-react";
|
||||
import { ImageDefinition } from "jazz-tools";
|
||||
import { CoPlainText, ImageDefinition, Loaded } from "jazz-tools";
|
||||
import { ImageIcon } from "lucide-react";
|
||||
import { useId, useRef } from "react";
|
||||
|
||||
@@ -70,7 +70,10 @@ export function BubbleBody(props: {
|
||||
);
|
||||
}
|
||||
|
||||
export function BubbleText(props: { text: string; className?: string }) {
|
||||
export function BubbleText(props: {
|
||||
text: CoPlainText | string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<p className={clsx("px-2 leading-relaxed", props.className)}>
|
||||
{props.text}
|
||||
@@ -78,7 +81,7 @@ export function BubbleText(props: { text: string; className?: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function BubbleImage(props: { image: ImageDefinition }) {
|
||||
export function BubbleImage(props: { image: Loaded<typeof ImageDefinition> }) {
|
||||
return (
|
||||
<ProgressiveImg image={props.image}>
|
||||
{({ src }) => (
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// This is NOT needed to make the chat work
|
||||
|
||||
import { Chat } from "@/schema.ts";
|
||||
|
||||
export function onChatLoad(chat: Chat) {
|
||||
import { Loaded } from "jazz-tools";
|
||||
export function onChatLoad(chat: Loaded<typeof Chat>) {
|
||||
if (window.parent) {
|
||||
chat.waitForSync().then(() => {
|
||||
window.parent.postMessage(
|
||||
|
||||
@@ -36,7 +36,7 @@ const config: Config = {
|
||||
blue: {
|
||||
...colors.indigo,
|
||||
500: "#5870F1",
|
||||
DEFAULT: "#3313F7",
|
||||
DEFAULT: "#146AFF",
|
||||
},
|
||||
},
|
||||
container: {
|
||||
@@ -56,18 +56,6 @@ const config: Config = {
|
||||
plugins: [
|
||||
plugin(({ addBase }) =>
|
||||
addBase({
|
||||
":root": {
|
||||
"--gcmp-border-color": stonePalette[200],
|
||||
"--gcmp-invert-border-color": stonePalette[900],
|
||||
},
|
||||
"*": {
|
||||
borderColor: "var(--gcmp-border-color)",
|
||||
},
|
||||
"@media (prefers-color-scheme: dark)": {
|
||||
"*": {
|
||||
borderColor: "var(--gcmp-invert-border-color)",
|
||||
},
|
||||
},
|
||||
"*:focus": {
|
||||
outline: "none",
|
||||
},
|
||||
|
||||
2
examples/clerk/.gitignore
vendored
@@ -22,3 +22,5 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
playwright-report
|
||||
@@ -1,5 +1,250 @@
|
||||
# minimal-auth-clerk
|
||||
|
||||
## 0.0.99
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5835ed1]
|
||||
- jazz-tools@0.14.0
|
||||
- jazz-react@0.14.0
|
||||
- jazz-react-auth-clerk@0.14.0
|
||||
|
||||
## 0.0.98
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.32
|
||||
- jazz-react-auth-clerk@0.13.32
|
||||
|
||||
## 0.0.97
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e5b170f]
|
||||
- jazz-tools@0.13.31
|
||||
- jazz-react@0.13.31
|
||||
- jazz-react-auth-clerk@0.13.31
|
||||
|
||||
## 0.0.96
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.30
|
||||
- jazz-react-auth-clerk@0.13.30
|
||||
- jazz-tools@0.13.30
|
||||
|
||||
## 0.0.95
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.29
|
||||
- jazz-react-auth-clerk@0.13.29
|
||||
- jazz-tools@0.13.29
|
||||
|
||||
## 0.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.28
|
||||
- jazz-react-auth-clerk@0.13.28
|
||||
- jazz-tools@0.13.28
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.27
|
||||
- jazz-react-auth-clerk@0.13.27
|
||||
- jazz-tools@0.13.27
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ff846d9]
|
||||
- jazz-tools@0.13.26
|
||||
- jazz-react@0.13.26
|
||||
- jazz-react-auth-clerk@0.13.26
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.25
|
||||
- jazz-react-auth-clerk@0.13.25
|
||||
- jazz-tools@0.13.25
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [02a240c]
|
||||
- jazz-tools@0.13.23
|
||||
- jazz-react@0.13.23
|
||||
- jazz-react-auth-clerk@0.13.23
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-react-auth-clerk@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [439f0fe]
|
||||
- jazz-tools@0.13.20
|
||||
- jazz-react@0.13.20
|
||||
- jazz-react-auth-clerk@0.13.20
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [80530a4]
|
||||
- jazz-tools@0.13.19
|
||||
- jazz-react@0.13.19
|
||||
- jazz-react-auth-clerk@0.13.19
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [761759c]
|
||||
- jazz-tools@0.13.18
|
||||
- jazz-react@0.13.18
|
||||
- jazz-react-auth-clerk@0.13.18
|
||||
|
||||
## 0.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.17
|
||||
- jazz-react-auth-clerk@0.13.17
|
||||
- jazz-tools@0.13.17
|
||||
|
||||
## 0.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.16
|
||||
- jazz-react-auth-clerk@0.13.16
|
||||
- jazz-tools@0.13.16
|
||||
|
||||
## 0.0.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.15
|
||||
- jazz-react-auth-clerk@0.13.15
|
||||
- jazz-tools@0.13.15
|
||||
|
||||
## 0.0.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.14
|
||||
- jazz-react-auth-clerk@0.13.14
|
||||
- jazz-tools@0.13.14
|
||||
|
||||
## 0.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.13
|
||||
- jazz-react-auth-clerk@0.13.13
|
||||
- jazz-tools@0.13.13
|
||||
|
||||
## 0.0.80
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4547525]
|
||||
- jazz-tools@0.13.12
|
||||
- jazz-react@0.13.12
|
||||
- jazz-react-auth-clerk@0.13.12
|
||||
|
||||
## 0.0.79
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17273a6]
|
||||
- jazz-tools@0.13.11
|
||||
- jazz-react@0.13.11
|
||||
- jazz-react-auth-clerk@0.13.11
|
||||
|
||||
## 0.0.78
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.10
|
||||
- jazz-react-auth-clerk@0.13.10
|
||||
- jazz-tools@0.13.10
|
||||
|
||||
## 0.0.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6cf01f]
|
||||
- jazz-tools@0.13.9
|
||||
- jazz-react@0.13.9
|
||||
- jazz-react-auth-clerk@0.13.9
|
||||
|
||||
## 0.0.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-auth-clerk@0.13.8
|
||||
|
||||
## 0.0.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [bc3d7bb]
|
||||
- jazz-tools@0.13.7
|
||||
- jazz-react@0.13.7
|
||||
- jazz-react-auth-clerk@0.13.7
|
||||
|
||||
## 0.0.74
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fe6f561]
|
||||
- jazz-tools@0.13.5
|
||||
- jazz-react@0.13.5
|
||||
- jazz-react-auth-clerk@0.13.5
|
||||
|
||||
## 0.0.73
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3129982]
|
||||
- Updated dependencies [3129982]
|
||||
- jazz-react-auth-clerk@0.13.4
|
||||
- jazz-react@0.13.4
|
||||
- jazz-tools@0.13.4
|
||||
|
||||
## 0.0.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [12f8bfa]
|
||||
- Updated dependencies [bd57177]
|
||||
- jazz-tools@0.13.3
|
||||
- jazz-react@0.13.3
|
||||
- jazz-react-auth-clerk@0.13.3
|
||||
|
||||
## 0.0.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.2
|
||||
- jazz-react-auth-clerk@0.13.2
|
||||
- jazz-tools@0.13.2
|
||||
|
||||
## 0.0.70
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
{
|
||||
"name": "clerk",
|
||||
"private": true,
|
||||
"version": "0.0.70",
|
||||
"version": "0.0.99",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"preview": "vite preview",
|
||||
"format-and-lint": "biome check .",
|
||||
"format-and-lint:fix": "biome check . --write"
|
||||
"format-and-lint:fix": "biome check . --write",
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:ui": "playwright test --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@clerk/clerk-react": "^5.4.1",
|
||||
@@ -19,12 +21,13 @@
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.50.1",
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.3",
|
||||
"globals": "^15.11.0",
|
||||
"typescript": "~5.6.2",
|
||||
"vite": "^6.0.11"
|
||||
"typescript": "5.6.2",
|
||||
"vite": "6.0.11"
|
||||
}
|
||||
}
|
||||
|
||||
53
examples/clerk/playwright.config.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
import isCI from "is-ci";
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// import dotenv from 'dotenv';
|
||||
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: "./tests",
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: isCI,
|
||||
/* Retry on CI only */
|
||||
retries: isCI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: isCI ? 1 : undefined,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: "html",
|
||||
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: "http://localhost:5173/",
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: "on-first-retry",
|
||||
permissions: ["clipboard-read", "clipboard-write"],
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
},
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: [
|
||||
{
|
||||
command: "pnpm preview --port 5173",
|
||||
url: "http://localhost:5173/",
|
||||
reuseExistingServer: !isCI,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SignInButton } from "@clerk/clerk-react";
|
||||
import { SignInButton, SignOutButton } from "@clerk/clerk-react";
|
||||
import { useAccount, useIsAuthenticated } from "jazz-react";
|
||||
|
||||
function App() {
|
||||
const { me, logOut } = useAccount();
|
||||
const { me } = useAccount();
|
||||
|
||||
const isAuthenticated = useIsAuthenticated();
|
||||
|
||||
@@ -11,7 +11,7 @@ function App() {
|
||||
<div className="container">
|
||||
<h1>You're logged in</h1>
|
||||
<p>Welcome back, {me?.profile?.name}</p>
|
||||
<button onClick={() => logOut()}>Logout</button>
|
||||
<SignOutButton>Logout</SignOutButton>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ClerkProvider, useClerk } from "@clerk/clerk-react";
|
||||
import { ClerkProvider, SignOutButton, useClerk } from "@clerk/clerk-react";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./App.tsx";
|
||||
@@ -28,12 +28,23 @@ function JazzProvider({ children }: { children: React.ReactNode }) {
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
|
||||
<JazzProvider>
|
||||
<App />
|
||||
</JazzProvider>
|
||||
</ClerkProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
// Route to test that when the Clerk user expires, the app is logged out
|
||||
if (location.search.includes("expirationTest")) {
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
|
||||
<SignOutButton>Simulate expiration</SignOutButton>
|
||||
</ClerkProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
} else {
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
|
||||
<JazzProvider>
|
||||
<App />
|
||||
</JazzProvider>
|
||||
</ClerkProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
}
|
||||
|
||||
36
examples/clerk/tests/expiration.spec.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("login & expiration", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
|
||||
expect(page.getByText("You're not logged in")).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Sign in" }).click();
|
||||
|
||||
await page
|
||||
.getByRole("textbox", { name: "Email address" })
|
||||
.fill("guido+clerk-test@garden.co");
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page
|
||||
.getByRole("textbox", { name: "Password" })
|
||||
.fill("guido+clerk-test@garden.co");
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page.waitForURL("/");
|
||||
|
||||
await page.getByText("You're logged in").waitFor({ state: "visible" });
|
||||
|
||||
expect(page.getByText("You're logged in")).toBeVisible();
|
||||
|
||||
await page.goto("/?expirationTest");
|
||||
|
||||
// Simulate expiration by logging out outside of Jazz
|
||||
await page.getByRole("button", { name: "Simulate expiration" }).click();
|
||||
|
||||
await page.goto("/");
|
||||
|
||||
await page.getByText("You're not logged in").waitFor({ state: "visible" });
|
||||
});
|
||||
33
examples/clerk/tests/logout.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("login & logout", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
|
||||
expect(page.getByText("You're not logged in")).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Sign in" }).click();
|
||||
|
||||
await page
|
||||
.getByRole("textbox", { name: "Email address" })
|
||||
.fill("guido+clerk-test@garden.co");
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page
|
||||
.getByRole("textbox", { name: "Password" })
|
||||
.fill("guido+clerk-test@garden.co");
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page.waitForURL("/");
|
||||
|
||||
await page.getByText("You're logged in").waitFor({ state: "visible" });
|
||||
|
||||
expect(page.getByText("You're logged in")).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Logout" }).click();
|
||||
|
||||
await page.getByText("You're not logged in").waitFor({ state: "visible" });
|
||||
|
||||
expect(page.getByText("You're not logged in")).toBeVisible();
|
||||
});
|
||||
33
examples/clerk/tests/reload.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("login & reload", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
|
||||
expect(page.getByText("You're not logged in")).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Sign in" }).click();
|
||||
|
||||
await page
|
||||
.getByRole("textbox", { name: "Email address" })
|
||||
.fill("guido+clerk-test@garden.co");
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page
|
||||
.getByRole("textbox", { name: "Password" })
|
||||
.fill("guido+clerk-test@garden.co");
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page.waitForURL("/");
|
||||
|
||||
await page.getByText("You're logged in").waitFor({ state: "visible" });
|
||||
|
||||
expect(page.getByText("You're logged in")).toBeVisible();
|
||||
|
||||
await page.reload();
|
||||
|
||||
await page.getByText("You're logged in").waitFor({ state: "visible" });
|
||||
|
||||
expect(page.getByText("You're logged in")).toBeVisible();
|
||||
});
|
||||