Compare commits

..

430 Commits

Author SHA1 Message Date
Trisha Lim
243ab074eb Remove non-functional nav from image upload example 2025-02-18 20:21:55 +07:00
Trisha Lim
938f9256db Remove non-functional nav from form example 2025-02-18 15:31:53 +07:00
Anselm
88521721bf unpizzazz 😔 2025-02-17 20:35:01 +00:00
Guido D'Orsi
2701630582 Merge pull request #1385 from boorad/fix/rn-polyfills
fix: reduce RN polyfills
2025-02-17 18:50:22 +01:00
Guido D'Orsi
07ce619fa2 Merge pull request #1411 from garden-co/jazz-719-exclued-tsbuildinfo-files
Removes tsbuildinfo files from repo
2025-02-17 18:44:22 +01:00
Guido D'Orsi
895de1a470 Merge pull request #1372 from garden-co/jazz-705-rename-e2e-test-scripts
Jazz 705 rename e2e test scripts
2025-02-17 18:43:59 +01:00
Benjamin S. Leveritt
4450761a7b Removes tsbuildinfo files from repo 2025-02-17 17:14:02 +00:00
Benjamin S. Leveritt
08b3d65c0b Removes onboarding app 2025-02-17 17:08:28 +00:00
Benjamin S. Leveritt
5dac731f26 Gitignore test failure screenshots 2025-02-17 17:06:56 +00:00
Benjamin S. Leveritt
e99308cda2 Revert vite test workspace
...for now...
2025-02-17 17:05:10 +00:00
Guido D'Orsi
88e314d980 Merge pull request #1400 from garden-co/changeset-release/main
Version Packages
2025-02-17 18:00:56 +01:00
github-actions[bot]
62e0e5d721 Version Packages 2025-02-17 16:35:06 +00:00
Guido D'Orsi
aa16ad9c1c Merge pull request #1408 from garden-co/fix/clerk-auth-migration
fix: fixes the clerk credentials migration
2025-02-17 17:33:15 +01:00
Guido D'Orsi
ada802bff8 fix: fixes the clerk credentials migration 2025-02-17 17:16:19 +01:00
Benjamin S. Leveritt
44e1d140ca Builds dependencies for tests (rather than the package; read: faster) 2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
e0ef3fc1de Removes browser-integration from vite workspace
Vite treats it as a src package, and that breaks turbo's test task resolution (running tests at the root level). Vitest doesn't need it to be there to run the tests.
2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
a31ac66213 Fixes headless run of browser-integration tests 2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
b444b2e96a Renames e2e tests to separate from test task 2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
8fcc4b5e50 Runs turbo tests as in CI (ie. no watching) 2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
33bfbee9cf Removes unused test command 2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
d08e4e263b Fixes project jazz-auth-clerk name for tests 2025-02-17 15:39:05 +00:00
Benjamin S. Leveritt
471b8c6a15 Merge pull request #1405 from garden-co/jazz-716-fix-turbo-caching-of-llm-content
Adds llms.txt to turbo build output cache
2025-02-17 15:18:11 +00:00
Benjamin S. Leveritt
7dd080d907 Merge pull request #1401 from garden-co/jazz-714-add-turbo-to-nix-dev-environment
Updates flake, adds turbo dep
2025-02-17 15:07:44 +00:00
Benjamin S. Leveritt
69c81a3e90 Adds llms.txt to turbo build output cache 2025-02-17 15:06:53 +00:00
Benjamin S. Leveritt
d8ed987461 Merge pull request #1406 from garden-co/fix/missing-icon
Fix missing icon
2025-02-17 15:06:39 +00:00
Trisha Lim
beb45c2656 Fix missing icon 2025-02-17 15:06:11 +00:00
Brad Anderson
e6241dfb5a fix: reduce RN polyfills 2025-02-17 09:39:01 -05:00
Guido D'Orsi
1d71ca1511 feat: add React 19 to the peerDependencies 2025-02-17 15:32:04 +01:00
Benjamin S. Leveritt
65941c7f87 Updates flake, adds turbo dep 2025-02-17 12:07:23 +00:00
Guido D'Orsi
a37dc1c22f test: cover another case on existing account migrations 2025-02-17 13:01:59 +01:00
Benjamin S. Leveritt
774f232390 Merge pull request #1307 from garden-co/jazz-679-create-crypto-rust-crate
Jazz 679 Use jazz-crypto-rs
2025-02-17 12:00:46 +00:00
Benjamin S. Leveritt
12c19fc940 Merge pull request #1396 from garden-co/jazz-713-fix-llms-fulltxt-content
Fixes llms-full.txt, adds sanity tests
2025-02-17 11:56:29 +00:00
Guido D'Orsi
f0ae3ace13 Merge pull request #1398 from garden-co/changeset-release/main
Version Packages
2025-02-17 12:45:07 +01:00
github-actions[bot]
cc973137b7 Version Packages 2025-02-17 11:43:44 +00:00
Guido D'Orsi
7fff0e0b36 Merge pull request #1397 from garden-co/fix/existing-account-migration
fix: correct the account migration execution on existing accounts
2025-02-17 12:42:14 +01:00
Guido D'Orsi
6909357f64 test: cover existing account migration with a test on jazz-tools 2025-02-17 12:41:58 +01:00
Guido D'Orsi
59ff77e0dc fix: correct the account migration execution on existing accounts 2025-02-17 12:27:05 +01:00
Benjamin S. Leveritt
338f5421f4 Adds test task 2025-02-17 11:26:38 +00:00
Benjamin S. Leveritt
a7590d14d6 Merge pull request #1392 from garden-co/jazz-712-delete-hr-onboarding-example
Delete HR Onboarding example
2025-02-17 11:12:52 +00:00
Benjamin S. Leveritt
e0daca300b Fixes llms-full.txt, adds sanity tests 2025-02-17 11:07:16 +00:00
Guido D'Orsi
a5347b613b Merge pull request #1358 from garden-co/fix/dropdown-alignment
Alignment fixes
2025-02-17 10:51:45 +01:00
Guido D'Orsi
9de58bb098 Merge pull request #1387 from garden-co/jazz-510-indicate-activevisible-items-on-table-of-contents
Highlight table of contents active item, styling for side nav active item
2025-02-17 10:49:53 +01:00
Trisha Lim
de1be9ac18 Delete HR Onboarding example 2025-02-17 15:05:58 +07:00
Trisha Lim
43df7f2b48 Fix chat demo section alignment 2025-02-17 11:30:50 +07:00
Trisha Lim
5f4f70d06d Fix side nav error 2025-02-17 11:26:29 +07:00
Trisha Lim
a9aa61c2c0 Set max width on docs body 2025-02-17 11:13:47 +07:00
Trisha Lim
bc0d2fcd23 Use code group in jazz-run command code snippet 2025-02-17 11:06:46 +07:00
Trisha Lim
f5675c49a2 Fix horizontal overflow in docs on mobile 2025-02-17 11:03:01 +07:00
Trisha Lim
da13e9cf7c Dropdown adjustments 2025-02-17 11:02:46 +07:00
Trisha Lim
ab2546ca71 Fix copy button alignment 2025-02-17 11:02:46 +07:00
Trisha Lim
43c36a8c20 Fix dropdown alignment 2025-02-17 11:02:46 +07:00
Trisha Lim
24ad5f42b5 Indicate that examples is outside docs 2025-02-17 10:46:52 +07:00
Trisha Lim
c620d9c87c Make active nav item styling more prominent 2025-02-17 10:38:13 +07:00
Trisha Lim
59121a1f52 Styling for active item on docs side nav 2025-02-17 10:32:51 +07:00
Trisha Lim
f766de8d9e Indicate active/visible items on table of contents 2025-02-17 09:55:52 +07:00
Trisha Lim
eb8621550a Increase space between content and main nav 2025-02-17 09:53:09 +07:00
Trisha Lim
5d28413648 Increase space between side bars and content 2025-02-17 09:53:09 +07:00
Trisha Lim
d0ed7177a3 Reduce font size on headings 2025-02-17 09:53:09 +07:00
Guido D'Orsi
091d753ab4 Merge pull request #1362 from garden-co/fix/missing-focus-styles
Add global focus styles
2025-02-16 11:32:22 +01:00
Guido D'Orsi
87f917d297 Merge pull request #1386 from antoniel/tony/fix-contributing-md
tony/fix-contributing-md
2025-02-16 06:30:17 +01:00
Guido D'Orsi
88acea362a Merge pull request #1382 from boorad/fix/crypto-provider
fix: Add back ability to use different crypto providers for RN
2025-02-16 06:28:38 +01:00
antoniel
0107f4939d docs: update CONTRIBUTING.md with homepage and build steps 2025-02-15 15:49:15 -03:00
Brad Anderson
f468b89994 fix: Add back ability to use different crypto providers for RN 2025-02-15 10:55:55 -05:00
Guido D'Orsi
617ea91a13 Merge pull request #1384 from garden-co/changeset-release/main
Version Packages
2025-02-15 01:23:35 +01:00
github-actions[bot]
b0ef1259ae Version Packages 2025-02-15 00:23:03 +00:00
Guido D'Orsi
a0ba4f235f Merge pull request #1383 from garden-co/revert-queue-changes
Revert queue changes
2025-02-15 01:21:37 +01:00
Guido D'Orsi
e197900fc5 test: remove isNotEmpty reference 2025-02-15 01:19:00 +01:00
Guido D'Orsi
1af6072299 chore: changeset 2025-02-15 01:12:35 +01:00
Guido D'Orsi
510e8874e1 Revert "perf: optimize queue processing under heavy load"
This reverts commit b90393b43e.
2025-02-15 01:11:02 +01:00
Anselm Eickhoff
ed7ee85304 Merge pull request #1381 from jmsv/extremely-important-fix
upgrade @unicorn-poo/pizzazz to fix scroll offset
2025-02-14 16:45:48 +00:00
James Vickery
ac726421d2 extremely important fix 2025-02-14 16:33:26 +00:00
Anselm
585b22941e pizzazz 2025-02-14 10:54:19 +00:00
Guido D'Orsi
5d557a830a Merge pull request #1368 from garden-co/changeset-release/main
Version Packages
2025-02-13 12:06:41 +01:00
github-actions[bot]
f0188df13b Version Packages 2025-02-13 11:06:09 +00:00
Guido D'Orsi
4c8ce0a24f Merge pull request #1376 from garden-co/create-jazz-app-cleanup
Remove redundant passkey auth starter in create-jazz-app
2025-02-13 12:04:47 +01:00
Trisha Lim
8645f8ce86 Update help text 2025-02-13 17:54:04 +07:00
Trisha Lim
d01d467136 Change name of react native clerk starter 2025-02-13 17:39:50 +07:00
Trisha Lim
ad4fcbafa4 Add changeset 2025-02-13 17:38:14 +07:00
Trisha Lim
05c51d5a85 Rephrase starter prompt 2025-02-13 17:34:56 +07:00
Trisha Lim
ab20a81751 Rename react starter app to react-passkey-auth 2025-02-13 17:32:39 +07:00
Trisha Lim
adad802ceb Rename starters 2025-02-13 16:16:24 +07:00
Trisha Lim
32b1cc9dab Remove gradient text 2025-02-13 16:15:09 +07:00
Guido D'Orsi
5c236e5c3c Merge pull request #1371 from garden-co/jazz-706-fix-organization-example-build
Jazz 706 fix organization example build
2025-02-13 09:52:29 +01:00
Guido D'Orsi
7616d5789b chore(ci): trigger the React Native e2e tests when packages are changed 2025-02-13 09:17:29 +01:00
Guido D'Orsi
631486e235 Merge pull request #1364 from boorad/feat/move-e2e-to-android
feat: move E2E tests to Android
2025-02-13 09:15:15 +01:00
Guido D'Orsi
5e0d63a4d6 docs: fix broken links in the upgrade page 2025-02-13 08:37:54 +01:00
Benjamin S. Leveritt
ba988cbb90 Removes tsc builds of config files 2025-02-12 22:59:42 +00:00
Benjamin S. Leveritt
6f6800bcd8 Adds aliases for vite to build 2025-02-12 22:59:03 +00:00
Benjamin S. Leveritt
90290902e8 Merge pull request #1365 from garden-co/jazz-675-explicitly-assigning-undefined-to-a-cooptionaldate-on-create
Jazz 675 explicitly assigning undefined to a cooptionaldate on create
2025-02-12 21:50:09 +00:00
Benjamin S. Leveritt
d8582fc9ed Adds changeset 2025-02-12 21:49:01 +00:00
Benjamin S. Leveritt
5c76e37f14 Adds changeset 2025-02-12 21:35:05 +00:00
Benjamin S. Leveritt
0117d0c9b9 Bumps jazz-crypto version 2025-02-12 21:21:34 +00:00
Benjamin S. Leveritt
b90c766c05 Cleans up WasmCrypto.create 2025-02-12 21:21:13 +00:00
Benjamin S. Leveritt
262a36e456 Bumps dep 2025-02-12 20:20:27 +00:00
Benjamin S. Leveritt
cb1df65beb Refactors to use stateful Blake3Hasher 2025-02-12 20:20:26 +00:00
Benjamin S. Leveritt
ea91e63ff2 Bumps jazz-crypto-rs version 2025-02-12 20:20:26 +00:00
Benjamin S. Leveritt
8eae2eb31e Fixes test 2025-02-12 20:20:26 +00:00
Benjamin S. Leveritt
c9044f5123 Adds npm dep 2025-02-12 20:20:26 +00:00
Benjamin S. Leveritt
24340173fa Picks up that can
#riseandshinemrfreeman
2025-02-12 20:19:48 +00:00
Benjamin S. Leveritt
53e88993a0 Moves jazz-crypto-rs into own repo 2025-02-12 20:18:47 +00:00
Benjamin S. Leveritt
ece168878b Use external dep 2025-02-12 20:18:47 +00:00
Benjamin S. Leveritt
cad84db52b Adds comments 2025-02-12 20:18:47 +00:00
Benjamin S. Leveritt
342a385111 Simplifies build process 2025-02-12 20:18:47 +00:00
Benjamin S. Leveritt
f87ba7d927 Fixes seal port 2025-02-12 20:18:47 +00:00
Benjamin S. Leveritt
7c7f55b85c Ports high-level encrypt and decrypt fns 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
0e5b9f5292 Fixes unused lint 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
2f5af3dece Ports get_sealer_id 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
2c35e2ba85 Ports signing fns 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
0a4f79d5a4 Adds wasm-pack via pnpm 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
43cb7abba7 Exclude target output from formatter 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
25f76f6b02 Updates README 2025-02-12 20:18:46 +00:00
Benjamin S. Leveritt
6a56561c98 Refactor into modules 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
2ac31e7c51 Removes unused berith dep 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
1bbefab5a9 Ports final ed25519 fns 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
1143b32cf3 Remove generateNonce from crypto, as only used by PureJS class 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
51ada27810 Refactors to pass nonceMaterial to reduce wasm boundary crossing 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
954ecb3984 Ports xsalsa20 encrypt/decrypt fns to Rust 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
05089270d9 Refactors to pass nonceMaterial, rather than nonces 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
fecc81111a Ports seal/unseal to rs lib 2025-02-12 20:18:45 +00:00
Benjamin S. Leveritt
4d3e7dbcd5 Adds X25519 fns 2025-02-12 20:18:44 +00:00
Benjamin S. Leveritt
ee65f18fd9 Add note about rust-analyzer 2025-02-12 20:18:44 +00:00
Benjamin S. Leveritt
bcbc4636ed Moves randomBytes up into crypto class to remove duplication 2025-02-12 20:18:44 +00:00
Benjamin S. Leveritt
8c323c4513 Fixes type 2025-02-12 20:18:44 +00:00
Benjamin S. Leveritt
4103ea0c88 Removes hash-wasm dep 2025-02-12 20:18:44 +00:00
Brad Anderson
58905ae8f4 feat: move E2E tests to Android 2025-02-12 15:16:44 -05:00
Benjamin S. Leveritt
733ebec902 Ports more Blake3 functions 2025-02-12 19:50:23 +00:00
Benjamin S. Leveritt
10a3834668 Ports blake3_hash with context 2025-02-12 19:50:23 +00:00
Benjamin S. Leveritt
593c3aeb6e Port blake3_hash_once 2025-02-12 19:50:23 +00:00
Benjamin S. Leveritt
a55d71c28d Fixes exported fn for node 2025-02-12 19:49:53 +00:00
Benjamin S. Leveritt
c030c7a57e Adds isomorphic generate_nonce function to rs lib 2025-02-12 19:49:53 +00:00
Benjamin S. Leveritt
e5b4c0448a Refactor into nonceGeneration 2025-02-12 19:49:53 +00:00
Benjamin S. Leveritt
0d516a3c6a Adds a test for unsealed error 2025-02-12 19:49:53 +00:00
Benjamin S. Leveritt
271ff3eb40 Adds comments to crypto libs 2025-02-12 19:49:53 +00:00
Benjamin S. Leveritt
dcc836ff98 Imports jazz-crypto-rs into cojson 2025-02-12 19:49:53 +00:00
Guido D'Orsi
65f630fb44 Merge pull request #1367 from garden-co/changeset-release/main
Version Packages
2025-02-12 20:26:56 +01:00
github-actions[bot]
b68f85542b Version Packages 2025-02-12 18:32:59 +00:00
Guido D'Orsi
f122a9f938 Merge pull request #1366 from garden-co/fix-metro-config
fix: correctly setup the metro config on React Native templates
2025-02-12 19:31:50 +01:00
Benjamin S. Leveritt
22da4ea136 Add jazz-crypto-rs lib 2025-02-12 18:27:21 +00:00
Benjamin S. Leveritt
80e86c92b2 Add rust tools to nix dev environment 2025-02-12 18:27:21 +00:00
Benjamin S. Leveritt
e15d994df6 Adds OptionalDate encoding 2025-02-12 18:23:20 +00:00
Guido D'Orsi
48ac92bc67 fix: correctly setup the metro config on React Native templates 2025-02-12 19:22:23 +01:00
Benjamin S. Leveritt
226b1171e6 Adds check for undefined to co.optional.Date 2025-02-12 18:09:15 +00:00
Benjamin S. Leveritt
29228e21fe Adds optional date test 2025-02-12 18:08:56 +00:00
Trisha Lim
302a1e6660 Add global focus styles 2025-02-12 20:23:56 +07:00
Trisha Lim
d3603625fd Fix copy password button 2025-02-12 19:43:20 +07:00
Trisha Lim
fa94d8c171 Show button on mobile 2025-02-12 19:43:20 +07:00
Trisha Lim
aeb094baa1 Add "use as template" button to examples 2025-02-12 19:43:20 +07:00
Guido D'Orsi
18f3497397 Merge pull request #1361 from garden-co/changeset-release/main
Version Packages
2025-02-12 12:55:19 +01:00
github-actions[bot]
8be7158d1f Version Packages 2025-02-12 11:52:07 +00:00
Guido D'Orsi
cae3a9ee32 feat: add debug info to load failure end missing header errors 2025-02-12 12:50:29 +01:00
Guido D'Orsi
6260045140 docs: small improvement on the upgrade guide 2025-02-12 11:57:00 +01:00
Guido D'Orsi
466d79d9a6 docs: fix missing enclosing div 2025-02-12 11:47:46 +01:00
Guido D'Orsi
67776c77a0 Merge pull request #1360 from garden-co/changeset-release/main
Version Packages
2025-02-12 11:42:59 +01:00
github-actions[bot]
e6868d3030 Version Packages 2025-02-12 10:41:24 +00:00
Guido D'Orsi
c8ae3a36ca Merge pull request #1350 from garden-co/jazz-701-docs-in-main-nav-doesnt-get-highlighted-when-active
Fix: docs in main nav doesn't get highlighted when active
2025-02-12 11:39:47 +01:00
Guido D'Orsi
bf9c158455 Merge pull request #1359 from garden-co/fix/unstable_enablePackageExports
feat: remove the unstable_enablePackageExports requirement from RN
2025-02-12 11:38:53 +01:00
Guido D'Orsi
1301112a6b docs: add the breaking change to the 0-10-0 upgrade guide 2025-02-12 11:38:25 +01:00
Guido D'Orsi
c447f08029 chore: improve pre-release comment output 2025-02-12 11:31:20 +01:00
Guido D'Orsi
5a63cbae9b feat: remove the unstable_enablePackageExports requirement from RN 2025-02-12 10:48:08 +01:00
Guido D'Orsi
7d06f1dbf4 fix: fix the username input style in dark mode 2025-02-11 16:53:51 +01:00
Guido D'Orsi
e48a3e4c27 chore: fix test type error 2025-02-11 16:09:26 +01:00
Guido D'Orsi
a326ed971c Merge pull request #1353 from garden-co/jazz-696-mark-vue-and-svelte-as-experimental
Mark vue and svelte as experimental
2025-02-11 16:03:34 +01:00
Guido D'Orsi
b5f1bb35d1 Merge pull request #1356 from garden-co/changeset-release/main
Version Packages
2025-02-11 15:59:34 +01:00
github-actions[bot]
b4ed7b0587 Version Packages 2025-02-11 14:51:45 +00:00
Guido D'Orsi
652ff8f53c Merge pull request #1251 from garden-co/authv2
Jazz 0.10.0
2025-02-11 15:50:11 +01:00
Guido D'Orsi
f519cd7356 Merge pull request #1337 from garden-co/jazz-689-group-extension-with-role-mapping
feat: add role mapping to group extension
2025-02-11 15:36:15 +01:00
Guido D'Orsi
20babc2e41 docs: add Group suffix on the group variables 2025-02-11 15:26:39 +01:00
Guido D'Orsi
6fc8efc1b5 Apply suggestions from code review
Co-authored-by: Anselm Eickhoff <anselm.eickhoff@gmail.com>
2025-02-11 15:22:05 +01:00
Trisha Lim
e30bd2f489 Refine dark mode styles in chat demo 2025-02-11 21:01:53 +07:00
Guido D'Orsi
0b9cc2e0aa Merge branch 'authv2' into jazz-689-group-extension-with-role-mapping 2025-02-11 14:36:06 +01:00
Guido D'Orsi
610543c5b8 chore: changeset 2025-02-11 14:35:41 +01:00
Guido D'Orsi
53dbfee385 fix: fix Svelte tests preprocessing 2025-02-11 14:34:28 +01:00
Guido D'Orsi
9c577b98cd Apply suggestions from code review
Co-authored-by: Anselm Eickhoff <anselm.eickhoff@gmail.com>
2025-02-11 14:33:38 +01:00
Trisha Lim
6139803679 Use dropdown for framework selector 2025-02-11 19:18:48 +07:00
Guido D'Orsi
b2c03ca8c4 chore: restore shell: bash on action.yml 2025-02-11 13:01:19 +01:00
Guido D'Orsi
3feb3e82ff docs: small improvement on the wrapper suggestion 2025-02-11 12:59:06 +01:00
Guido D'Orsi
95e9bdb624 chore: update action.yaml to use blacksmith 2025-02-11 12:57:57 +01:00
Guido D'Orsi
68127a95d0 Merge remote-tracking branch 'origin/main' into authv2 2025-02-11 12:56:21 +01:00
Anselm Eickhoff
690e65ac06 Merge pull request #1352 from garden-co/blacksmith-migration-44f38f3
blacksmith.sh: Migrate workflows to Blacksmith
2025-02-11 11:42:01 +00:00
Guido D'Orsi
6f007a9470 Merge remote-tracking branch 'origin/authv2' into jazz-689-group-extension-with-role-mapping 2025-02-11 12:37:55 +01:00
Guido D'Orsi
23c588c717 docs: improve upgrade docs
Co-authored-by: Benjamin S. Leveritt <benjamin@leveritt.co.uk>
2025-02-11 12:34:38 +01:00
blacksmith-sh[bot]
494d902e79 Migrate workflows to Blacksmith 2025-02-11 11:25:06 +00:00
Guido D'Orsi
eebee4db6a docs: group inheritance and upgrade docs 2025-02-11 12:18:40 +01:00
Guido D'Orsi
44f38f3438 Merge pull request #1346 from garden-co/jazz-697-fix-copy-button-alignment
Fix copy button alignment
2025-02-11 11:45:06 +01:00
Trisha Lim
bb2052e1f2 Add dropdown 2025-02-11 17:42:30 +07:00
Trisha Lim
40af02acb3 Mark vue and svelte as experimental 2025-02-11 17:39:57 +07:00
Guido D'Orsi
950db502c2 Merge pull request #1313 from boorad/feat/maestro
feat: add Maestro e2e tests for RN
2025-02-11 11:39:06 +01:00
Trisha Lim
3bdb753b78 Fix: docs in main nav doesn't get highlighted when active 2025-02-11 17:37:14 +07:00
Trisha Lim
33293f3b64 Fix copy button alignment 2025-02-11 16:20:55 +07:00
Guido D'Orsi
d5d448670d feat: add role mapping to group extension 2025-02-10 17:31:25 +01:00
Brad Anderson
e3c3913c74 test: don't forget self 2025-02-10 10:14:49 -05:00
Brad Anderson
2ee2fcaa27 test: more selective trigger 2025-02-10 10:13:56 -05:00
Brad Anderson
edc77c4bd5 test: PR feedback 2025-02-10 10:06:41 -05:00
Guido D'Orsi
0ce25f143b Merge pull request #1333 from garden-co/authv2-frameworks-docs
docs: update the upgrade guide & authentication docs for the other frameworks
2025-02-10 14:57:34 +01:00
Trisha Lim
e35018a5fa Redesign mobile nav (#1177) 2025-02-10 20:53:33 +07:00
Guido D'Orsi
0d05c927f1 docs: update the upgrade guide & authentication docs for the other frameworks 2025-02-10 14:44:09 +01:00
Guido D'Orsi
4ef43e3477 Merge pull request #1321 from garden-co/changeset-release/main
Version Packages
2025-02-10 11:34:24 +01:00
Guido D'Orsi
d7ce078f17 Merge pull request #1311 from garden-co/authv2-docs
Update docs for the new auth flow
2025-02-08 13:10:25 +01:00
Brad Anderson
95349d59f8 test: opt out of analytics 2025-02-07 16:31:24 -05:00
Brad Anderson
bb13b6e41d test: stop erase_text forever loop 2025-02-07 15:00:34 -05:00
Brad Anderson
3c2da2f0db gha 2025-02-07 13:34:44 -05:00
Brad Anderson
7bac26cf7f gha 2025-02-07 13:01:55 -05:00
Brad Anderson
d3d9200acf gha 2025-02-07 12:39:47 -05:00
Guido D'Orsi
60558ee664 Merge pull request #1325 from garden-co/authv2-group-api
fix: make Group.removeMember return the promise from CoJSON
2025-02-07 18:35:31 +01:00
Guido D'Orsi
6354135af4 Merge pull request #1327 from garden-co/reduce-max-retry-not-found
fix: reduce the retries on coValue not found to two
2025-02-07 18:34:58 +01:00
Guido D'Orsi
69a0befb7b chore: fix type issues on tests 2025-02-07 18:34:17 +01:00
Brad Anderson
c48aa7358a gha 2025-02-07 12:28:18 -05:00
Guido D'Orsi
01517d1463 Merge pull request #1326 from garden-co/authv2upgrade-guide
docs: upgrade guide for react
2025-02-07 18:14:31 +01:00
Brad Anderson
cdd7e6454f gha 2025-02-07 12:09:55 -05:00
Brad Anderson
2e030ea942 fix: no-go on xlarge - billing put their hand out 2025-02-07 12:09:55 -05:00
Brad Anderson
5207c00582 fix: try xlarge 2025-02-07 12:09:55 -05:00
Brad Anderson
22fa01b9c5 fix: startup timeout 5 mins 👀 2025-02-07 12:09:55 -05:00
Brad Anderson
f5a1e42dd6 fix: maestro path and startup timeout 2025-02-07 12:09:55 -05:00
Brad Anderson
58fe07351e test: missed a couple workflows for source code action 2025-02-07 12:09:54 -05:00
Brad Anderson
25e79fd001 fix: add shell to action 2025-02-07 12:09:54 -05:00
Brad Anderson
53868a4d50 test: corepack and maestro bin 2025-02-07 12:09:54 -05:00
Brad Anderson
21f6f4d933 test: switch order to give app time to install/launch 2025-02-07 12:09:54 -05:00
Brad Anderson
21f691b6da test: enable Maestro install for non-local runs 2025-02-07 12:09:54 -05:00
Brad Anderson
45c46ff14a test: add shell to composite action 2025-02-07 12:09:54 -05:00
Brad Anderson
6dad0878da test: share source code action, run e2e rn tests 2025-02-07 12:09:54 -05:00
Brad Anderson
3b6552d728 feat: add Maestro e2e tests for RN 2025-02-07 12:09:54 -05:00
Guido D'Orsi
e83ce5d6c8 docs: small typos and corrections 2025-02-07 18:03:00 +01:00
Guido D'Orsi
b6c672a1ad docs: improvments on the auth docs based on PR feedback 2025-02-07 17:43:05 +01:00
Guido D'Orsi
e2cfa60caa docs: improvments on the auth docs based on PR feedback 2025-02-07 17:28:27 +01:00
Guido D'Orsi
fa8f4e03d2 docs: improvments on the upgrade guide based on PR feedback 2025-02-07 17:18:58 +01:00
Guido D'Orsi
ac3d9fa2c3 fix: educe the retries on coValue not found to one 2025-02-07 15:06:10 +01:00
Guido D'Orsi
ff325ebf2a docs: improve the React authentication docs 2025-02-07 14:50:24 +01:00
Guido D'Orsi
71825cb90a feat: simplify Passphrase auth consumer API 2025-02-07 14:32:32 +01:00
Guido D'Orsi
d1281e560a docs: add the loading API and the changes on the workers 2025-02-06 17:42:37 +01:00
Guido D'Orsi
a1dc7f38ed docs: upgrade guide for react on auth & local-only 2025-02-06 16:43:14 +01:00
Guido D'Orsi
581118b918 fix: rename getCurrentUserPassphrase into getCurrentAccountPassphrase 2025-02-06 12:04:48 +01:00
github-actions[bot]
ab378b3d16 Version Packages 2025-02-06 09:41:56 +00:00
Guido D'Orsi
dd034643da fix: make Group.removeMember return the promise from CoJSON 2025-02-06 10:41:29 +01:00
Guido D'Orsi
bc2e531c05 Merge pull request #1323 from garden-co/fix/garden-copyright
Update copyright to 2025
2025-02-06 10:40:41 +01:00
Guido D'Orsi
334f6cf2d8 Merge pull request #1324 from garden-co/authv2-browser-integration-tests
test: cover browser sync scenarios with tests
2025-02-06 10:31:43 +01:00
Guido D'Orsi
31296a6ce2 test: moar isolation 2025-02-06 10:31:14 +01:00
Guido D'Orsi
6fc8ae8293 test: skip flaky test 2025-02-06 10:27:23 +01:00
Guido D'Orsi
a1d6e7147b test: close sync servers on test end 2025-02-06 10:25:11 +01:00
Guido D'Orsi
0d111b15f8 test: do not close the context 2025-02-06 10:15:33 +01:00
Guido D'Orsi
95b9c4825f test: increase timeout on CI 2025-02-05 19:41:33 +01:00
Guido D'Orsi
65e26d9ba4 test: cover file download from storage 2025-02-05 19:25:59 +01:00
Guido D'Orsi
cabce37133 fix: correctly handle cd when the project name has spaces 2025-02-05 18:56:47 +01:00
Guido D'Orsi
20c4484066 feat: better solution to isolate IndexedDB databases 2025-02-05 18:55:24 +01:00
Guido D'Orsi
17dc5fc37f chore: little context on what are the commands 2025-02-05 18:45:31 +01:00
Guido D'Orsi
05d907b675 test: add tests for check sync on unstable connections 2025-02-05 18:36:10 +01:00
Guido D'Orsi
62cb650356 feat: make possible to disable storage 2025-02-05 18:22:49 +01:00
Guido D'Orsi
9f833b3931 test: fix failing clerk test 2025-02-05 17:31:04 +01:00
Guido D'Orsi
f0d123979c test: cover browser sync scenarios with tests 2025-02-05 17:15:39 +01:00
Guido D'Orsi
90078a4bce fix(logOut): return a Promise to wait for the credentials clear 2025-02-05 17:15:17 +01:00
Guido D'Orsi
2d3aa76bf0 fix: use addListener to catch the clerk auth changes 2025-02-05 15:21:46 +01:00
Guido D'Orsi
86bd86b966 docs: update docs with the new auth flow and changes 2025-02-05 13:04:37 +01:00
Guido D'Orsi
bebd0ede64 chore: rename onAnonymousUserDiscarded into onAnonymousAccountDiscarded 2025-02-05 12:43:37 +01:00
Trisha Lim
14bdd496f7 Update copyright to 2025 2025-02-05 18:36:15 +07:00
Guido D'Orsi
91fcb3f6b6 Merge pull request #1309 from garden-co/fix/rotate-before-revoke
fix: move access revoke after key rotation
2025-02-05 11:19:18 +01:00
Guido D'Orsi
ff94cadd7b Merge pull request #1319 from garden-co/feat/throw-ensure-loaded-mis
feat: make ensureLoaded throw when the resolved value is undefined
2025-02-05 11:15:17 +01:00
Guido D'Orsi
60fe8f9106 Merge pull request #1320 from garden-co/authv2-vitest-upgrade
feat: upgrade vitest to v3 and vite to v6
2025-02-05 11:15:05 +01:00
Guido D'Orsi
5158581b0c chore(ci): install playwright deps 2025-02-04 18:12:16 +01:00
Guido D'Orsi
ee511b4934 test: run indexeddb tests on browser mode 2025-02-04 18:10:15 +01:00
Guido D'Orsi
bc13653236 fix: playwrite duplicate versions 2025-02-04 17:43:07 +01:00
Guido D'Orsi
fe28e254a3 feat: upgrade vitest to v3 and vite to v6 2025-02-04 17:24:56 +01:00
Guido D'Orsi
82179812de feat: drop node 14 polyfill for globalThis.crypto 2025-02-04 17:22:08 +01:00
Guido D'Orsi
d42c2aa014 feat: make ensureLoaded throw when the resolved value is undefined 2025-02-04 14:55:48 +01:00
Guido D'Orsi
ff92316488 Merge pull request #1318 from garden-co/pre-release
feat: add a pre-release action
2025-02-04 11:45:58 +01:00
Guido D'Orsi
00f1072f5a fix: use glob 2025-02-04 11:40:09 +01:00
Guido D'Orsi
c2d56b5eb8 chore: add a console.log 2025-02-04 11:32:09 +01:00
Guido D'Orsi
0d9eacc1ec fix: remove --affected 2025-02-04 11:23:57 +01:00
Guido D'Orsi
75491e65c0 chore(ci): fix syntax errors 2025-02-04 11:20:23 +01:00
Guido D'Orsi
a93df6fcb2 Merge branch 'main' into authv2 2025-02-04 11:19:52 +01:00
Guido D'Orsi
b5962b4f81 chore(ci): fix syntax errors 2025-02-04 11:19:07 +01:00
Guido D'Orsi
b5be0273a6 fix pre-release.yml syntax error 2025-02-04 11:17:40 +01:00
Guido D'Orsi
62a1aec555 feat: add a pre-release action 2025-02-04 11:14:45 +01:00
Benjamin S. Leveritt
5053a6fc80 Uses latest corepack as part of CI build 2025-02-04 10:10:49 +01:00
Guido D'Orsi
f038c2d378 Merge pull request #1315 from garden-co/jazz-686-use-latest-corepack
Uses latest corepack as part of CI build
2025-02-04 10:10:06 +01:00
Benjamin S. Leveritt
febafecfdd Uses latest corepack as part of CI build 2025-02-04 09:08:23 +00:00
Guido D'Orsi
394feb715d Merge pull request #1305 from garden-co/isomorphic-worker
feat: remove the ws dependency and use native WebSocket
2025-02-04 10:01:47 +01:00
Guido D'Orsi
76c125e628 Merge pull request #1312 from garden-co/authv2-test-apis
feat: improve compat between new auth api and testing api
2025-02-03 21:54:58 +01:00
Guido D'Orsi
10ac9d8659 chore: add file extension for the .svelte.ts imports 2025-02-03 20:46:58 +01:00
Trisha Lim
9a6d950727 Replace api key in apiKey.ts in create-jazz-app 2025-02-03 21:58:39 +07:00
Trisha Lim
326d3b90c2 Move api key of example apps into apiKey.ts 2025-02-03 21:58:39 +07:00
Trisha Lim
499f39340b Fix type 2025-02-03 21:58:39 +07:00
Trisha Lim
54eba823ad Add changeset 2025-02-03 21:58:39 +07:00
Trisha Lim
61e787ec89 Add API key param to create jazz app 2025-02-03 21:58:39 +07:00
Trisha Lim
95d42b1340 Add framework param to create-jazz-app 2025-02-03 21:58:39 +07:00
Trisha Lim
bf9840ea46 Remove unused types 2025-02-03 21:58:39 +07:00
Guido D'Orsi
74dbbaf4d4 test: cover migration globalMe management 2025-01-31 17:09:26 +01:00
Guido D'Orsi
c2ae5b6206 feat: add Passphrase auth 2025-01-31 17:09:26 +01:00
Guido D'Orsi
25de660d27 test: add tests for PassPhrase auth 2025-01-31 17:09:25 +01:00
Guido D'Orsi
de90f45f41 feat(testing): throw when multiple migrations are executed in parallel 2025-01-31 17:09:25 +01:00
Guido D'Orsi
dda79df1c3 feat: improve compat between new auth api and testing api 2025-01-31 17:09:23 +01:00
Guido D'Orsi
26ea68999b Merge pull request #1310 from garden-co/authv2-throw-guest-mode
fix: throw when auth hooks are used in guest mode
2025-01-31 14:12:06 +01:00
Guido D'Orsi
4cfb4af1da Merge pull request #1308 from garden-co/authv2-onAnonymousUserDiscarded
feat: API to handle the authenticate on top of an anonymous user
2025-01-31 14:11:34 +01:00
Guido D'Orsi
11eaa99af7 fix: throw when auth hooks are used in guest mode 2025-01-30 19:34:22 +01:00
Guido D'Orsi
93231c27f4 fix: fix error handling on WebSocket and move WebSocketPeerWithReconnection in cojson-transport-ws for better DX 2025-01-30 19:33:04 +01:00
Guido D'Orsi
e7b9c90eef Merge remote-tracking branch 'origin/main' into authv2 2025-01-30 19:11:52 +01:00
Guido D'Orsi
70c9a5db88 fix: move access revoke after key rotation 2025-01-30 19:01:28 +01:00
Guido D'Orsi
2e6c2498b5 feat: API to handle the authenticate on top of an anonymous user 2025-01-30 18:36:16 +01:00
Guido D'Orsi
e7fd617ca9 test: remove only modifier 2025-01-30 18:35:59 +01:00
Guido D'Orsi
bd5b03b18d fix: always close the websocket on error 2025-01-30 18:30:52 +01:00
Guido D'Orsi
3a7ab9b3a1 feat: remove the ws dependency and use native WebSocket 2025-01-30 11:43:10 +01:00
Trisha Lim
0cf789622c Remove dropdown component 2025-01-30 12:02:45 +08:00
Trisha Lim
d63f5eec5e Move kicker to a separate component 2025-01-30 12:02:45 +08:00
Trisha Lim
42bd8b76a1 Create a more flexible component for headings 2025-01-30 12:02:45 +08:00
Trisha Lim
73742656ae Design system improvements 2025-01-30 12:02:45 +08:00
Guido D'Orsi
f71f26d1dc Merge pull request #1303 from garden-co/changeset-release/main
Version Packages
2025-01-29 19:43:35 +01:00
github-actions[bot]
95822300d7 Version Packages 2025-01-29 18:39:50 +00:00
Guido D'Orsi
679fe040cf Merge pull request #1302 from garden-co/handler-websocket-errors
fix: handle websocket errors and add onSuccess callback
2025-01-29 19:38:38 +01:00
Guido D'Orsi
14b6149f50 fix: handle websocket errors and add onSuccess callback 2025-01-29 18:58:56 +01:00
Guido D'Orsi
4446738940 chore: disable formatter on package.json 2025-01-29 18:57:48 +01:00
Guido D'Orsi
c8ad016d9c fix: improve ws error management 2025-01-29 18:46:04 +01:00
Guido D'Orsi
498954fd09 chore: changeset 2025-01-29 18:34:03 +01:00
Guido D'Orsi
198f6d3627 Merge remote-tracking branch 'origin/main' into authv2 2025-01-29 18:23:57 +01:00
Guido D'Orsi
f701f2a4f4 Merge pull request #1300 from garden-co/authv2-example-apps
feat: change the peer & localOnly props into sync
2025-01-29 18:21:19 +01:00
Guido D'Orsi
94131ba6d6 feat: change the peer & localOnly props into sync 2025-01-29 18:17:21 +01:00
Guido D'Orsi
c0e892313f Merge pull request #1282 from garden-co/not-found-state
fix(useCoState): return null when a coValue is not found
2025-01-29 18:13:20 +01:00
Guido D'Orsi
b426342c02 fix(useCoState): return null when a coValue is not found 2025-01-29 18:12:56 +01:00
Giordano Ricci
bbbd773c3f Merge pull request #1299 from garden-co/changeset-release/main
Version Packages
2025-01-29 16:53:17 +00:00
github-actions[bot]
7d5f4e5881 Version Packages 2025-01-29 16:40:51 +00:00
Giordano Ricci
29c44538dc Merge pull request #1298 from garden-co/gio/is-it-really-me
Change isMe to indicate whether an account is the currently active account
2025-01-29 16:39:46 +00:00
Giordano Ricci
198f995b21 update changeset 2025-01-29 16:31:33 +00:00
Guido D'Orsi
2d639667a3 Merge pull request #1296 from garden-co/authv2-example-apps
feat: improve builtin auth UIs
2025-01-29 17:24:33 +01:00
Giordano Ricci
1be017d69d make isMe indicate whether an account is the currently active one, add isLocalNodeOwner to reproduce previous behavior 2025-01-29 16:20:14 +00:00
Guido D'Orsi
03df4fee8e fix: move the Auth UI outside the container div 2025-01-29 16:34:36 +01:00
Guido D'Orsi
c658ed3404 fix: remove the localOnly prop where breaking 2025-01-29 16:20:07 +01:00
Guido D'Orsi
99e58e60dc test: fix the PasskeyAuthBasicUI test 2025-01-29 16:04:58 +01:00
Guido D'Orsi
a9ad0284e9 fix: fdix example apps tests 2025-01-29 15:39:31 +01:00
Guido D'Orsi
6e2d791c4b feat: better username management in chat example 2025-01-29 13:58:02 +01:00
Guido D'Orsi
f9be857bbb feat: improve builtin auth UIs 2025-01-29 13:40:38 +01:00
Guido D'Orsi
1288ac140e Merge pull request #1293 from garden-co/authv2-auth-state-refactoring
feat: update the React Native packages with the new auth system
2025-01-29 10:31:52 +01:00
Guido D'Orsi
7f07f7e049 Merge pull request #1294 from boorad/authv2-web-example-refactoring
feat: update web examples to new auth system
2025-01-29 10:31:25 +01:00
Guido D'Orsi
b22589bbad test: add integration tests for the websocket peer 2025-01-29 10:26:09 +01:00
Guido D'Orsi
be144adeee chore: rename onSuccessCalles to isFirstMessage and add a test 2025-01-29 10:17:59 +01:00
Brad Anderson
513619b04e feat: update web examples to new auth system 2025-01-28 23:13:44 -05:00
Guido D'Orsi
81f6a75aac chore: add comment 2025-01-28 20:11:52 +01:00
Guido D'Orsi
913d03de75 feat: update the RN example apps with the new Auth system 2025-01-28 19:34:56 +01:00
Guido D'Orsi
2d0172d839 feat: update the React Native packages with the new auth system 2025-01-28 19:34:04 +01:00
Guido D'Orsi
27d46641e3 feat: unify React Native and Jazz Tools DemoAuth users management 2025-01-28 19:32:55 +01:00
Guido D'Orsi
1014816d79 feat: move WebSocketPeerWithReconnection to jazz-tools 2025-01-28 19:09:34 +01:00
Guido D'Orsi
441194acb7 feat: add onSuccess hook and close the WebSocket on error 2025-01-28 19:06:35 +01:00
Guido D'Orsi
c9bea7200f feat: rename jazz-browser-clerk-auth in jazz-clerk-auth and update jazz-react-native-auth-clerk 2025-01-28 19:05:43 +01:00
Guido D'Orsi
9eaa88bd83 Merge pull request #1291 from garden-co/authv2-auth-state-refactoring
feat: make auth state platform agnostic
2025-01-28 18:35:50 +01:00
Guido D'Orsi
6ada48d57a chore: remove unused imports 2025-01-28 18:05:55 +01:00
Guido D'Orsi
8fa978df21 fix: initialize the anonymous storage only if newAccountProps is not provided 2025-01-28 16:27:25 +01:00
Guido D'Orsi
df7356fd24 chore: cleanup and small fix on websocket enable/disable 2025-01-28 14:45:58 +01:00
Guido D'Orsi
153fa4ce44 fix: invalidate context when localOnly is updated 2025-01-28 12:19:46 +01:00
Guido D'Orsi
6105bd2c88 test: cover createContext and ContextManager 2025-01-28 12:09:48 +01:00
Guido D'Orsi
c06d63eec1 fix: align passphrase auth with the current auth flow 2025-01-28 10:54:47 +01:00
Guido D'Orsi
4ee7359370 test: PassphraseAuth 2025-01-27 22:25:22 +01:00
Guido D'Orsi
7b5c47b377 test: cover DemoAuth 2025-01-27 22:12:42 +01:00
Guido D'Orsi
7ad57e88f3 test: add tests on the react-core auth hooks 2025-01-27 21:59:06 +01:00
Guido D'Orsi
c181e55557 feat: make auth state platform agnostic 2025-01-27 19:27:21 +01:00
Benjamin S. Leveritt
5574be699b Merge pull request #1290 from garden-co/jazz-682-update-nix-flake-to-node-22
Chore: Update nix flake for node22
2025-01-27 15:25:16 +00:00
Benjamin S. Leveritt
b3142cb8ed Chore: Update nix flake for node22 2025-01-27 15:02:20 +00:00
Benjamin S. Leveritt
cb08d9d1a3 Merge pull request #1240 from garden-co/jazz-662-add-llmstxt
Adds LLMs.txt generator
2025-01-27 14:55:10 +00:00
Guido D'Orsi
7e0cd721e6 Merge remote-tracking branch 'origin/main' into authv2 2025-01-27 15:51:33 +01:00
Guido D'Orsi
4d01cbae03 Merge pull request #1288 from garden-co/sync-tests-improvements
Improve sync tests and add some utils to track the messages exchanges
2025-01-27 15:47:03 +01:00
Guido D'Orsi
13f6389559 chore: format text 2025-01-27 15:38:34 +01:00
Guido D'Orsi
f6ea9bcc50 test: remove flaky test 2025-01-27 15:37:02 +01:00
Guido D'Orsi
f6f2766eac test: cover the initial messages exchanges 2025-01-27 15:35:35 +01:00
Guido D'Orsi
f8f63bface test: simplify sync tests with the test sync pattern 2025-01-27 15:35:34 +01:00
Guido D'Orsi
5ec561fec4 Merge pull request #1281 from garden-co/changeset-release/main
Version Packages
2025-01-27 11:07:35 +01:00
github-actions[bot]
277787cbd2 Version Packages 2025-01-27 10:03:17 +00:00
Guido D'Orsi
dda4336721 Merge pull request #1252 from garden-co/fix-ts-symbol-error
fix(typescript): replace private symbols with prefixed strings
2025-01-27 11:01:37 +01:00
Guido D'Orsi
59ddff40ab Merge pull request #1270 from garden-co/authv2-clerk
feat: improve the clerk integration
2025-01-27 11:01:13 +01:00
Guido D'Orsi
064d19b48c chore: move jazz-react-core version up to 0.9.19 2025-01-27 09:27:18 +01:00
Guido D'Orsi
3ea269f4d8 chore: package json formatting 2025-01-27 09:27:00 +01:00
Guido D'Orsi
c4b8befe27 Merge pull request #1278 from garden-co/changeset-release/main
Version Packages
2025-01-27 09:21:29 +01:00
Guido D'Orsi
06f667ef2a Merge pull request #1280 from doingandlearning/patch-2
Update README.md
2025-01-27 09:21:16 +01:00
github-actions[bot]
bac3cc7bf8 Version Packages 2025-01-27 08:17:07 +00:00
Guido D'Orsi
6ad0a9f886 chore: changeset 2025-01-27 09:15:44 +01:00
Kevin Cunningham
9b12932b66 Update README.md 2025-01-26 09:10:49 +00:00
Guido D'Orsi
82bb0d51d9 Merge pull request #1277 from garden-co/changeset-release/main
Version Packages
2025-01-25 20:27:12 +01:00
Guido D'Orsi
39dede92e8 Merge pull request #1273 from garden-co/fix/remove-npm-create
Remove npm create jazz-app from instructions
2025-01-25 20:27:00 +01:00
github-actions[bot]
84f4e6e48d Version Packages 2025-01-25 19:22:29 +00:00
Guido D'Orsi
e629dea585 fix: remove internal imports to cojson 2025-01-25 20:21:22 +01:00
Guido D'Orsi
2faf22ffff chore: changeset 2025-01-25 18:45:43 +01:00
Guido D'Orsi
2273505a13 Merge pull request #1276 from anchpop/@anchpop/remove-inspector-vite
fix(jazz-inspector): export typescript types and remove unneeded vite build step
2025-01-25 18:45:30 +01:00
Andre Popovitch
19eb29d831 fix(jazz-inspector): export typescript types and remove unneeded vite build step 2025-01-26 00:04:00 +09:00
Andre Popovitch
738c4c2bd7 fix(jazz-inspector): Add files entry to package.json so dist is included in published releases 2025-01-25 23:37:27 +09:00
Guido D'Orsi
64e2273475 Merge pull request #1274 from garden-co/changeset-release/main
Version Packages
2025-01-25 11:20:10 +01:00
github-actions[bot]
5a85c89154 Version Packages 2025-01-25 10:18:09 +00:00
Guido D'Orsi
8898b10e89 chore: changeset 2025-01-25 11:16:54 +01:00
Andre Popovitch
dc2d4e25f7 Remove npm create for examples 2025-01-25 18:09:52 +08:00
Trisha Lim
9275c4f6c0 Remove npm create jazz-app from instructions 2025-01-25 18:07:48 +08:00
Guido D'Orsi
cb75cc62b2 chore: exclude storage from the propsChanged check 2025-01-25 00:38:09 +01:00
Guido D'Orsi
b141f6a62f fix: double context creation on React 2025-01-25 00:36:58 +01:00
Guido D'Orsi
4a251a528c feat: improve the clerk integration 2025-01-24 19:37:59 +01:00
Guido D'Orsi
ac3c2df474 Merge pull request #1268 from garden-co/changeset-release/main
Version Packages
2025-01-24 17:32:53 +01:00
github-actions[bot]
681f973d4b Version Packages 2025-01-24 16:17:09 +00:00
Guido D'Orsi
338be7622f Merge pull request #1269 from garden-co/feat/group-add-member-typechecks
fix: improve typescript types for group.addMember
2025-01-24 17:15:57 +01:00
Guido D'Orsi
1227047b03 fix: improve typescript types for group.addMember 2025-01-24 17:07:32 +01:00
Guido D'Orsi
9afde8d0be Merge pull request #1267 from garden-co/feat/invite
feat: move invite API in jazz-tools
2025-01-24 17:06:10 +01:00
Guido D'Orsi
c2ca1feba0 feat: move invite API in jazz-tools 2025-01-24 16:52:34 +01:00
Guido D'Orsi
f8b6119996 feat: translate isAnonymous checks into isAuthenticated and add tests 2025-01-24 16:15:18 +01:00
Guido D'Orsi
a7c90f749e feat: move the context manager into jazz-tools 2025-01-24 15:30:43 +01:00
Benjamin S. Leveritt
4dab70eea3 Adds docs to llms-full 2025-01-24 10:51:32 +00:00
Guido D'Orsi
b01cc1fe9d fix(typescript): fix type error on ItemsSym 2025-01-23 19:21:29 +01:00
Guido D'Orsi
3a6e34589f feat: defaultName and better props tracking 2025-01-23 18:34:37 +01:00
Benjamin S. Leveritt
68e9c85d8f Adds docs to llms.txt 2025-01-23 16:44:44 +00:00
Benjamin S. Leveritt
1b124ff5c7 Changes extension for use in nodeJS 2025-01-23 16:44:29 +00:00
Guido D'Orsi
a1d512d9d7 Merge remote-tracking branch 'origin/main' into authv2 2025-01-23 17:28:14 +01:00
Guido D'Orsi
51bf6b7fdc Merge pull request #1223 from garden-co/auth-flow-rewrite
Auth flow rewrite
2025-01-23 17:26:53 +01:00
Guido D'Orsi
b5826fc0a5 Merge pull request #1176 from garden-co/user-onboarding-upgrade
feat: zero-setup auth, anonymous user upgrade and localOnly sync
2025-01-23 17:22:50 +01:00
Guido D'Orsi
becdd2f451 test(music-player): fix e2e tests 2025-01-23 17:12:47 +01:00
Guido D'Orsi
3b20bf354f feat: migrate svelte 2025-01-23 16:58:44 +01:00
Benjamin S. Leveritt
ab2645765d Generates two llms.txt, listing and full 2025-01-23 15:13:45 +00:00
Benjamin S. Leveritt
2dec852ce2 Adds API ref links to methods 2025-01-23 13:14:19 +00:00
Benjamin S. Leveritt
8cb09379f4 Adds ids for methods 2025-01-23 13:13:41 +00:00
Guido D'Orsi
fff7fe934b feat: update Vue 2025-01-23 12:55:12 +01:00
Benjamin S. Leveritt
9fb2e61e01 Extracts more information 2025-01-23 11:39:52 +00:00
Benjamin S. Leveritt
794927cac3 Adds LLMs.txt generator 2025-01-22 17:09:29 +00:00
Guido D'Orsi
4c8d128eee feat: auth flow rewrite 2025-01-22 18:04:45 +01:00
Guido D'Orsi
df106ca680 test: fix create image test 2025-01-21 11:15:18 +01:00
Guido D'Orsi
c58f93b597 Merge remote-tracking branch 'origin/main' into user-onboarding-upgrade 2025-01-21 10:49:01 +01:00
Guido D'Orsi
3f2a0ead1b fix: self-review fixes 2025-01-21 10:34:42 +01:00
Guido D'Orsi
c9e6d2998e feat: improve the jazz-react provider 2025-01-20 20:10:18 +01:00
Guido D'Orsi
40634c6ec1 chore: update lockfile 2025-01-20 12:41:08 +01:00
Guido D'Orsi
8bc758ce95 Merge remote-tracking branch 'origin/main' into user-onboarding-upgrade 2025-01-20 12:32:25 +01:00
Guido D'Orsi
73079ca1b7 test: update e2e tests 2025-01-17 22:57:45 +01:00
Guido D'Orsi
c36f19a97f fix: fix imports & and tests on createJazzBrowserContext 2025-01-17 19:28:38 +01:00
Guido D'Orsi
109338923a chore: update lockfile 2025-01-17 18:18:57 +01:00
Guido D'Orsi
f4c2501b06 chore: move auth hook in useInJazzAuth 2025-01-17 18:18:24 +01:00
Guido D'Orsi
9161229474 chore: revert the changes on the todo example 2025-01-17 18:17:46 +01:00
Guido D'Orsi
265f2f40bf fix: fix passkey auth cancelation and add tests 2025-01-17 17:50:35 +01:00
Guido D'Orsi
d2935ac2ae feat: make clerk auth compatible with passkeys 2025-01-17 14:49:25 +01:00
Guido D'Orsi
aaf00b8a20 feat: update starter example with anonymous auth 2025-01-17 14:49:25 +01:00
Guido D'Orsi
f9c6a49d2a feat: onboarding auth on todo example 2025-01-17 14:49:25 +01:00
Guido D'Orsi
2f54a48a3d feat: make auth code disappear from the React setup 2025-01-17 14:49:25 +01:00
Guido D'Orsi
be4dd0a787 feat: centralize auth secret management 2025-01-17 14:49:25 +01:00
Guido D'Orsi
f3f072e7cf feat: improve login/signup code and better UX on the music player auth 2025-01-17 14:49:24 +01:00
Guido D'Orsi
a6270bf552 feat: add onboarding user upgrade to Passkey and Clerk auth 2025-01-17 14:49:24 +01:00
616 changed files with 33512 additions and 11514 deletions

View File

@@ -11,7 +11,7 @@
"cojson-storage-sqlite", "cojson-storage-sqlite",
"cojson-transport-ws", "cojson-transport-ws",
"jazz-browser", "jazz-browser",
"jazz-browser-auth-clerk", "jazz-auth-clerk",
"jazz-browser-media-images", "jazz-browser-media-images",
"jazz-nodejs", "jazz-nodejs",
"jazz-react", "jazz-react",

View File

@@ -0,0 +1,39 @@
name: Setup Android Emulator
inputs:
api-level:
description: 'API level to use for the emulator'
required: true
default: '29'
runs:
using: "composite"
steps:
- name: Enable KVM
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
- name: AVD cache
uses: useblacksmith/cache@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ inputs.api-level }}
- name: Create AVD and Generate Snapshot for Caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: false
script: echo "Generated AVD snapshot for caching."

36
.github/actions/source-code/action.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Get and Build Source Code
runs:
using: "composite"
steps:
- name: Enable latestcorepack
shell: bash
run: |
echo "Before: corepack version => $(corepack --version || echo 'not installed')"
npm install -g corepack@latest
echo "After : corepack version => $(corepack --version)"
corepack enable
pnpm --version
- name: Install Node.js
uses: useblacksmith/setup-node@v5
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: useblacksmith/cache@v5
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile

View File

@@ -6,7 +6,7 @@ on:
jobs: jobs:
build-examples: build-examples:
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
strategy: strategy:
matrix: matrix:
example: [ example: [
@@ -19,40 +19,16 @@ jobs:
"pets", "pets",
"reactions", "reactions",
"todo", "todo",
"onboarding",
] ]
steps: steps:
- uses: actions/checkout@v3 - name: Checkout
uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Enable corepack - name: Setup Source Code
run: corepack enable uses: ./.github/actions/source-code/
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Pnpm Build - name: Pnpm Build
run: | run: |

View File

@@ -2,51 +2,25 @@ name: Build Starters
on: on:
push: push:
branches: [ "main" ] branches: ["main"]
jobs: jobs:
build-starters: build-starters:
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
strategy: strategy:
matrix: matrix:
starter: [ starter: ["react-passkey-auth"]
"react-demo-auth-tailwind",
]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Enable corepack - name: Setup Source Code
run: corepack enable uses: ./.github/actions/source-code/
- name: Install Node.js - name: Pnpm Build
uses: actions/setup-node@v3 run: |
with: pnpm install
node-version-file: '.node-version' pnpm turbo build;
cache: 'pnpm' working-directory: ./starters/${{ matrix.starter }}
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Pnpm Build
run: |
pnpm install
pnpm turbo build;
working-directory: ./starters/${{ matrix.starter }}

View File

@@ -6,7 +6,7 @@ on:
jobs: jobs:
quality: quality:
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

85
.github/workflows/e2e-rn-test.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: End-to-End Tests for React Native
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- ".github/actions/android-emulator/**"
- ".github/actions/source-code/**"
- ".github/workflows/e2e-rn-test.yml"
- "examples/chat-rn/**"
- "examples/chat-rn-clerk/**"
- "packages/**"
jobs:
e2e-tests:
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Source Code
uses: ./.github/actions/source-code/
- name: Create Output Directory
run: |
mkdir -p ~/output
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 22
cache: gradle
- name: Pnpm Build
run: pnpm turbo build --filter="./packages/*"
- name: chat-rn App Pre Build
working-directory: ./examples/chat-rn
run: |
pnpm build
pnpm expo prebuild --clean
- name: Install Maestro
run: |
curl -fsSL "https://get.maestro.mobile.dev" | bash
- name: Setup Android Emulator
id: android-emulator
uses: ./.github/actions/android-emulator/
with:
api-level: 29
- name: Test App
uses: reactivecircus/android-emulator-runner@v2
id: e2e_test
continue-on-error: true
with:
api-level: 29
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: true
working-directory: ./examples/chat-rn/
script: ./test/e2e/run.sh
- name: Copy Maestro Output
if: steps.e2e_test.outcome != 'success'
run: |
cp -r ~/.maestro/tests/* ~/output
- name: Upload Output Files
if: steps.e2e_test.outcome != 'success'
uses: actions/upload-artifact@v4
with:
name: e2e-test-output
path: ~/output/*
retention-days: 5
- name: Exit with Test Result
if: always()
run: |
if [ "${{ steps.e2e_test.outcome }}" != "success" ]; then
exit 1
fi

View File

@@ -8,38 +8,16 @@ on:
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Enable corepack - name: Setup Source Code
run: corepack enable uses: ./.github/actions/source-code/
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build jazz-run - name: Build jazz-run
run: pnpm exec turbo build && chmod +x dist/index.js; run: pnpm exec turbo build && chmod +x dist/index.js;
@@ -48,4 +26,3 @@ jobs:
- name: Run create account - name: Run create account
run: ./dist/index.js account create --name "Jazz Run CI test" run: ./dist/index.js account create --name "Jazz Run CI test"
working-directory: ./packages/jazz-run working-directory: ./packages/jazz-run

View File

@@ -9,41 +9,19 @@ on:
jobs: jobs:
test: test:
timeout-minutes: 60 timeout-minutes: 60
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
continue-on-error: true continue-on-error: true
strategy: strategy:
matrix: matrix:
project: ["tests/e2e", "examples/chat", "examples/file-share-svelte", "examples/form", "examples/music-player", "examples/pets", "examples/onboarding", "starters/react-demo-auth-tailwind"] project: ["tests/e2e", "examples/chat", "examples/file-share-svelte", "examples/form", "examples/music-player", "examples/pets", "starters/react-passkey-auth"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Enable corepack - name: Setup Source Code
run: corepack enable uses: ./.github/actions/source-code/
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Pnpm Build - name: Pnpm Build
run: pnpm turbo build run: pnpm turbo build

102
.github/workflows/pre-release.yml vendored Normal file
View File

@@ -0,0 +1,102 @@
name: Pre-Publish tagged Pull Requests
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
pre-release:
if: contains(github.event.pull_request.labels.*.name, 'pre-release')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Source Code
uses: ./.github/actions/source-code/
- name: Pnpm Build
run: pnpm turbo build --filter="./packages/*"
- name: Pre publish
run: pnpm exec pkg-pr-new publish --json output.json --comment=off "./packages/*"
- name: Post or update comment
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const output = JSON.parse(fs.readFileSync('output.json', 'utf8'));
const packages = output.packages
.map((p) => `- ${p.name}: ${p.url}`)
.join('\n');
const sha =
context.event_name === 'pull_request'
? context.payload.pull_request.head.sha
: context.payload.after;
const resolutions = Object.fromEntries(
output.packages.map((p) => [p.name, p.url])
);
const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`;
const body = `## Jazz pre-release
### Packages:
\`\`\`json
${JSON.stringify(resolutions, null, 4)}
\`\`\`
[View Commit](${commitUrl})`;
async function logPublishInfo() {
console.log('\n' + '='.repeat(50));
console.log('Publish Information');
console.log('='.repeat(50));
console.log('\nPublished Packages:');
console.log(output.packages);
console.log('\nTemplates:');
console.log(templates);
console.log(`\nCommit URL: ${commitUrl}`);
console.log('\n' + '='.repeat(50));
}
if (context.eventName === 'pull_request') {
if (context.issue.number) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body,
});
}
} else if (context.eventName === 'push') {
const pullRequests = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:${context.ref.replace(
'refs/heads/',
''
)}`,
});
if (pullRequests.data.length > 0) {
await github.rest.issues.createComment({
issue_number: pullRequests.data[0].number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body,
});
} else {
console.log(
'No open pull request found for this push. Logging publish information to console:'
);
await logPublishInfo();
}
}

View File

@@ -17,35 +17,13 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs: jobs:
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Enable corepack - name: Setup Source Code
run: corepack enable uses: ./.github/actions/source-code/
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish to npm - name: Create Release Pull Request or Publish to npm
id: changesets id: changesets

View File

@@ -9,39 +9,20 @@ on:
jobs: jobs:
unit-tests: unit-tests:
runs-on: ubuntu-latest runs-on: blacksmith-4vcpu-ubuntu-2204
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Enable corepack - name: Setup Source Code
run: corepack enable uses: ./.github/actions/source-code/
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Pnpm Build - name: Pnpm Build
run: pnpm turbo build --filter="./packages/*" run: pnpm turbo build --filter="./packages/*"
- name: Install Playwright Browsers
run: pnpm exec playwright install
- name: Unit Tests - name: Unit Tests
run: pnpm test:ci run: pnpm test:ci

6
.gitignore vendored
View File

@@ -7,11 +7,15 @@ docsTmp
coverage coverage
.direnv .direnv
# Typescript
**/*.tsbuildinfo
# Next.js # Next.js
**/.next **/.next
# Vite output # Vite output
**/dist **/dist
__screenshots__
# Playwright # Playwright
test-results test-results
@@ -19,3 +23,5 @@ test-results
.husky .husky
.vscode/settings.json .vscode/settings.json
.svelte-kit

View File

@@ -48,7 +48,19 @@ You'll need Node.js 20.x or 22.x installed (we're working on support for 23.x),
pnpm install pnpm install
``` ```
3. **Run tests** to verify everything is working: 3. **Install homepage dependencies**:
```bash
cd homepage && pnpm install
```
4. **Build the packages**:
```bash
pnpm build
```
5. **Run tests** to verify everything is working:
```bash ```bash
pnpm test pnpm test
``` ```

View File

@@ -1,4 +1,4 @@
Copyright 2024, Garden Computing, Inc. Copyright 2025, Garden Computing, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -17,4 +17,4 @@ For community and support, please join our [Discord](https://discord.gg/utDMjHYg
- Community & support: [Discord](https://discord.gg/utDMjHYg42) - Community & support: [Discord](https://discord.gg/utDMjHYg42)
- Updates: [X](https://x.com/jazz_tools) & [Email](https://garden.co/news) - Updates: [X](https://x.com/jazz_tools) & [Email](https://garden.co/news)
Copyright 2024 &mdash; Garden Computing, Inc. Copyright 2025 &mdash; Garden Computing, Inc.

View File

@@ -42,6 +42,15 @@
} }
}, },
"overrides": [ "overrides": [
{
"include": ["**/package.json"],
"linter": {
"enabled": false
},
"formatter": {
"enabled": false
}
},
{ {
"include": ["packages/**/src/**"], "include": ["packages/**/src/**"],
"linter": { "linter": {

View File

@@ -1,5 +1,141 @@
# chat-rn-clerk # chat-rn-clerk
## 1.0.71
### Patch Changes
- Updated dependencies [ada802b]
- jazz-tools@0.10.6
- jazz-react-native@0.10.6
- jazz-react-native-auth-clerk@0.10.6
- jazz-react-native-media-images@0.10.6
## 1.0.70
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-react-native@0.10.5
- jazz-react-native-auth-clerk@0.10.5
- jazz-react-native-media-images@0.10.5
## 1.0.69
### Patch Changes
- jazz-react-native@0.10.4
- jazz-react-native-auth-clerk@0.10.4
- jazz-tools@0.10.4
- jazz-react-native-media-images@0.10.4
## 1.0.68
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-react-native@0.10.3
- jazz-react-native-auth-clerk@0.10.3
- jazz-react-native-media-images@0.10.3
## 1.0.67
### Patch Changes
- jazz-react-native@0.10.2
- jazz-react-native-auth-clerk@0.10.2
- jazz-tools@0.10.2
- jazz-react-native-media-images@0.10.2
## 1.0.66
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-react-native@0.10.1
- jazz-react-native-auth-clerk@0.10.1
- jazz-react-native-media-images@0.10.1
## 1.0.65
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react-native-auth-clerk@0.10.0
- jazz-react-native@0.10.0
- jazz-tools@0.10.0
- jazz-react-native-media-images@0.10.0
## 1.0.64
### Patch Changes
- jazz-react-native@0.9.23
- jazz-react-native-auth-clerk@0.9.23
- jazz-tools@0.9.23
- jazz-react-native-media-images@0.9.23
## 1.0.63
### Patch Changes
- jazz-react-native@0.9.22
- jazz-react-native-auth-clerk@0.9.22
## 1.0.62
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-react-native@0.9.21
- jazz-react-native-auth-clerk@0.9.21
- jazz-react-native-media-images@0.9.21
## 1.0.61
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-react-native@0.9.20
- jazz-react-native-auth-clerk@0.9.20
- jazz-react-native-media-images@0.9.20
## 1.0.60
### Patch Changes
- jazz-react-native@0.9.19
- jazz-react-native-auth-clerk@0.9.19
- jazz-tools@0.9.19
- jazz-react-native-media-images@0.9.19
## 1.0.59
### Patch Changes
- jazz-react-native@0.9.18
- jazz-react-native-auth-clerk@0.9.18
- jazz-tools@0.9.18
- jazz-react-native-media-images@0.9.18
## 1.0.58
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-react-native@0.9.17
- jazz-react-native-auth-clerk@0.9.17
- jazz-react-native-media-images@0.9.17
## 1.0.57 ## 1.0.57
### Patch Changes ### Patch Changes

View File

@@ -1,9 +1,9 @@
import { Redirect, Stack } from "expo-router"; import { Redirect, Stack } from "expo-router";
import { useIsAuthenticated } from "jazz-react-native";
import React from "react"; import React from "react";
import { useAuth } from "../../src/auth-context";
export default function HomeLayout() { export default function HomeLayout() {
const { isAuthenticated } = useAuth(); const isAuthenticated = useIsAuthenticated();
if (isAuthenticated) { if (isAuthenticated) {
return <Redirect href={"/chat"} />; return <Redirect href={"/chat"} />;

View File

@@ -1,8 +1,8 @@
import { Redirect, Stack } from "expo-router"; import { Redirect, Stack } from "expo-router";
import { useAuth } from "../../src/auth-context"; import { useIsAuthenticated } from "jazz-react-native";
export default function UnAuthenticatedLayout() { export default function UnAuthenticatedLayout() {
const { isAuthenticated } = useAuth(); const isAuthenticated = useIsAuthenticated();
if (isAuthenticated) { if (isAuthenticated) {
return <Redirect href={"/chat"} />; return <Redirect href={"/chat"} />;

View File

@@ -20,10 +20,15 @@ export default function ChatScreen() {
const navigation = useNavigation(); const navigation = useNavigation();
const { user } = useUser(); const { user } = useUser();
function handleLogOut() {
logOut();
router.navigate("/");
}
useLayoutEffect(() => { useLayoutEffect(() => {
navigation.setOptions({ navigation.setOptions({
headerTitle: "Chat", headerTitle: "Chat",
headerRight: () => <Button onPress={logOut} title="Logout" />, headerRight: () => <Button onPress={handleLogOut} title="Logout" />,
}); });
}, [navigation]); }, [navigation]);

View File

@@ -19,7 +19,6 @@ config.resolver.nodeModulesPaths = [
path.resolve(workspaceRoot, "node_modules"), path.resolve(workspaceRoot, "node_modules"),
]; ];
config.resolver.sourceExts = ["mjs", "js", "json", "ts", "tsx"]; config.resolver.sourceExts = ["mjs", "js", "json", "ts", "tsx"];
config.resolver.unstable_enablePackageExports = true;
config.resolver.requireCycleIgnorePatterns = [ config.resolver.requireCycleIgnorePatterns = [
/(^|\/|\\)node_modules($|\/|\\)/, /(^|\/|\\)node_modules($|\/|\\)/,
/(^|\/|\\)packages($|\/|\\)/, /(^|\/|\\)packages($|\/|\\)/,

View File

@@ -1,7 +1,7 @@
{ {
"name": "chat-rn-clerk", "name": "chat-rn-clerk",
"main": "index.js", "main": "index.js",
"version": "1.0.57", "version": "1.0.71",
"scripts": { "scripts": {
"build": "expo export -p ios", "build": "expo export -p ios",
"start": "expo start", "start": "expo start",
@@ -9,23 +9,22 @@
"format-and-lint:fix": "biome check . --write", "format-and-lint:fix": "biome check . --write",
"android": "expo run:android", "android": "expo run:android",
"ios": "expo run:ios", "ios": "expo run:ios",
"web": "expo start --web", "web": "expo start --web"
"test": "jest --watchAll"
}, },
"jest": { "jest": {
"preset": "jest-expo" "preset": "jest-expo"
}, },
"dependencies": { "dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.2", "@azure/core-asynciterator-polyfill": "^1.0.2",
"@bacons/text-decoder": "0.0.0",
"@bam.tech/react-native-image-resizer": "^3.0.11", "@bam.tech/react-native-image-resizer": "^3.0.11",
"@craftzdog/react-native-buffer": "6.0.5",
"@clerk/clerk-expo": "^2.2.21", "@clerk/clerk-expo": "^2.2.21",
"@expo/vector-icons": "^14.0.2", "@expo/vector-icons": "^14.0.2",
"@op-engineering/op-sqlite": "^11.2.12", "@op-engineering/op-sqlite": "^11.2.12",
"@react-native-community/netinfo": "^11.4.1", "@react-native-community/netinfo": "^11.4.1",
"@react-navigation/native": "^7.0.13", "@react-navigation/native": "^7.0.13",
"@react-navigation/native-stack": "^7.1.14", "@react-navigation/native-stack": "^7.1.14",
"base-64": "^1.0.0",
"buffer": "^6.0.3",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"expo": "^52.0.0", "expo": "^52.0.0",
"expo-build-properties": "~0.13.1", "expo-build-properties": "~0.13.1",
@@ -51,18 +50,14 @@
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-native": "~0.76.3", "react-native": "~0.76.3",
"react-native-fetch-api": "^3.0.0",
"react-native-gesture-handler": "~2.20.2", "react-native-gesture-handler": "~2.20.2",
"react-native-get-random-values": "^1.11.0", "react-native-get-random-values": "^1.11.0",
"react-native-polyfill-globals": "^3.1.0",
"react-native-quick-base64": "^2.1.2",
"react-native-reanimated": "~3.16.3", "react-native-reanimated": "~3.16.3",
"react-native-safe-area-context": "4.12.0", "react-native-safe-area-context": "4.12.0",
"react-native-screens": "4.1.0", "react-native-screens": "4.1.0",
"react-native-url-polyfill": "^2.0.0", "react-native-url-polyfill": "^2.0.0",
"react-native-web": "~0.19.13", "react-native-web": "~0.19.13",
"text-encoding": "^0.7.0", "readable-stream": "4.7.0"
"web-streams-polyfill": "^3.2.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.0", "@babel/core": "^7.20.0",
@@ -72,7 +67,7 @@
"jest": "^29.2.1", "jest": "^29.2.1",
"jest-expo": "~52.0.2", "jest-expo": "~52.0.2",
"react-test-renderer": "18.2.0", "react-test-renderer": "18.2.0",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2" "typescript": "~5.6.2"
}, },
"private": true "private": true

View File

@@ -1,8 +1,17 @@
import "react-native-polyfill-globals/auto"; /* eslint-disable import/order */
import "@azure/core-asynciterator-polyfill";
import { Buffer } from "buffer";
import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions";
import { ReadableStream } from "web-streams-polyfill/ponyfill/es6";
// @ts-expect-error - @types/react-native doesn't cover this file
import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions";
import { Buffer } from "@craftzdog/react-native-buffer";
polyfillGlobal("Buffer", () => Buffer); polyfillGlobal("Buffer", () => Buffer);
// @ts-expect-error - @types/readable-stream doesn't have ReadableStream type
import { ReadableStream } from "readable-stream";
polyfillGlobal("ReadableStream", () => ReadableStream); polyfillGlobal("ReadableStream", () => ReadableStream);
import "@azure/core-asynciterator-polyfill";
import "@bacons/text-decoder/install";
import "react-native-get-random-values";

View File

@@ -0,0 +1 @@
export const apiKey = "chat-rn-clerk-example-jazz@garden.co";

View File

@@ -1,49 +1,21 @@
import { useClerk, useUser } from "@clerk/clerk-expo"; import { useClerk } from "@clerk/clerk-expo";
import { JazzProvider, setupKvStore } from "jazz-react-native"; import { JazzProviderWithClerk } from "jazz-react-native-auth-clerk";
import { useJazzClerkAuth } from "jazz-react-native-auth-clerk"; import React, { PropsWithChildren } from "react";
import React, { createContext, PropsWithChildren, useContext } from "react"; import { apiKey } from "./apiKey";
import { Text, View } from "react-native";
const AuthContext = createContext<{
isAuthenticated: boolean;
isLoading: boolean;
}>({
isAuthenticated: false,
isLoading: true,
});
export function useAuth() {
return useContext(AuthContext);
}
const kvStore = setupKvStore();
export function JazzAndAuth({ children }: PropsWithChildren) { export function JazzAndAuth({ children }: PropsWithChildren) {
const { isSignedIn, isLoaded: isClerkLoaded } = useUser();
const clerk = useClerk(); const clerk = useClerk();
const [auth, state] = useJazzClerkAuth(clerk, kvStore);
const isAuthenticated = Boolean(isSignedIn && isClerkLoaded && auth);
return ( return (
<AuthContext.Provider <JazzProviderWithClerk
value={{ isAuthenticated, isLoading: !isClerkLoaded || !auth }} clerk={clerk}
storage="sqlite"
sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
when: "signedUp", // This makes the app work in local mode when the user is not authenticated
}}
> >
{state?.errors?.length > 0 && {children}
state.errors.map((error) => ( </JazzProviderWithClerk>
<View key={error}>
<Text style={{ color: "red" }}>{error}</Text>
</View>
))}
{auth && clerk.user ? (
<JazzProvider
auth={auth}
storage="sqlite"
peer="wss://cloud.jazz.tools/?key=chat-rn-clerk-example-jazz@garden.co"
>
{children}
</JazzProvider>
) : (
children
)}
</AuthContext.Provider>
); );
} }

View File

@@ -1,5 +1,114 @@
# chat-rn # chat-rn
## 1.0.68
### Patch Changes
- Updated dependencies [ada802b]
- jazz-tools@0.10.6
- jazz-react-native@0.10.6
## 1.0.67
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-react-native@0.10.5
## 1.0.66
### Patch Changes
- jazz-react-native@0.10.4
- jazz-tools@0.10.4
## 1.0.65
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-react-native@0.10.3
## 1.0.64
### Patch Changes
- jazz-react-native@0.10.2
- jazz-tools@0.10.2
## 1.0.63
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-react-native@0.10.1
## 1.0.62
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react-native@0.10.0
- jazz-tools@0.10.0
## 1.0.61
### Patch Changes
- jazz-react-native@0.9.23
- jazz-tools@0.9.23
## 1.0.60
### Patch Changes
- jazz-react-native@0.9.22
## 1.0.59
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-react-native@0.9.21
## 1.0.58
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-react-native@0.9.20
## 1.0.57
### Patch Changes
- jazz-react-native@0.9.19
- jazz-tools@0.9.19
## 1.0.56
### Patch Changes
- jazz-react-native@0.9.18
- jazz-tools@0.9.18
## 1.0.55
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-react-native@0.9.17
## 1.0.54 ## 1.0.54
### Patch Changes ### Patch Changes

View File

@@ -19,7 +19,6 @@ config.resolver.nodeModulesPaths = [
path.resolve(workspaceRoot, "node_modules"), path.resolve(workspaceRoot, "node_modules"),
]; ];
config.resolver.sourceExts = ["mjs", "js", "json", "ts", "tsx"]; config.resolver.sourceExts = ["mjs", "js", "json", "ts", "tsx"];
config.resolver.unstable_enablePackageExports = true;
config.resolver.requireCycleIgnorePatterns = [ config.resolver.requireCycleIgnorePatterns = [
/(^|\/|\\)node_modules($|\/|\\)/, /(^|\/|\\)node_modules($|\/|\\)/,
/(^|\/|\\)packages($|\/|\\)/, /(^|\/|\\)packages($|\/|\\)/,

View File

@@ -1,6 +1,6 @@
{ {
"name": "chat-rn", "name": "chat-rn",
"version": "1.0.54", "version": "1.0.68",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "expo export -p ios", "build": "expo export -p ios",
@@ -13,17 +13,17 @@
}, },
"dependencies": { "dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.2", "@azure/core-asynciterator-polyfill": "^1.0.2",
"@bacons/text-decoder": "0.0.0",
"@craftzdog/react-native-buffer": "6.0.5",
"@op-engineering/op-sqlite": "^11.2.12", "@op-engineering/op-sqlite": "^11.2.12",
"@react-native-community/netinfo": "^11.4.1", "@react-native-community/netinfo": "^11.4.1",
"@react-navigation/native": "^7.0.13", "@react-navigation/native": "^7.0.13",
"@react-navigation/native-stack": "^7.1.14", "@react-navigation/native-stack": "^7.1.14",
"base-64": "^1.0.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"expo": "^52.0.0", "expo": "^52.0.0",
"expo-build-properties": "~0.13.1", "expo-build-properties": "~0.13.1",
"expo-clipboard": "~7.0.0", "expo-clipboard": "~7.0.0",
"expo-constants": "~17.0.3", "expo-constants": "~17.0.3",
"expo-crypto": "~14.0.1",
"expo-dev-client": "~5.0.5", "expo-dev-client": "~5.0.5",
"expo-linking": "~7.0.3", "expo-linking": "~7.0.3",
"expo-secure-store": "~14.0.0", "expo-secure-store": "~14.0.0",
@@ -34,19 +34,18 @@
"nativewind": "^4.1.21", "nativewind": "^4.1.21",
"react": "^18.3.1", "react": "^18.3.1",
"react-native": "~0.76.3", "react-native": "~0.76.3",
"react-native-fetch-api": "^3.0.0",
"react-native-get-random-values": "^1.11.0", "react-native-get-random-values": "^1.11.0",
"react-native-polyfill-globals": "^3.1.0", "react-native-nitro-modules": "0.21.0",
"react-native-quick-crypto": "1.0.0-beta.12",
"react-native-safe-area-context": "4.12.0", "react-native-safe-area-context": "4.12.0",
"react-native-screens": "4.1.0", "react-native-screens": "4.1.0",
"react-native-url-polyfill": "^2.0.0", "react-native-url-polyfill": "^2.0.0",
"text-encoding": "^0.7.0", "readable-stream": "4.7.0"
"web-streams-polyfill": "^3.2.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.0", "@babel/core": "^7.20.0",
"@types/react": "^18.3.12", "@types/react": "^18.3.12",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2" "typescript": "~5.6.2"
}, },
"private": true "private": true

View File

@@ -1,6 +1,17 @@
import "react-native-polyfill-globals/auto"; /* eslint-disable import/order */
import "@azure/core-asynciterator-polyfill";
import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions";
import { ReadableStream } from "web-streams-polyfill/ponyfill/es6";
// @ts-expect-error - @types/react-native doesn't cover this file
import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions";
import { Buffer } from "@craftzdog/react-native-buffer";
polyfillGlobal("Buffer", () => Buffer);
// @ts-expect-error - @types/readable-stream doesn't have ReadableStream type
import { ReadableStream } from "readable-stream";
polyfillGlobal("ReadableStream", () => ReadableStream); polyfillGlobal("ReadableStream", () => ReadableStream);
import "@azure/core-asynciterator-polyfill";
import "@bacons/text-decoder/install";
import "react-native-get-random-values";

View File

@@ -9,7 +9,8 @@ import * as Linking from "expo-linking";
import React, { StrictMode, useEffect, useState } from "react"; import React, { StrictMode, useEffect, useState } from "react";
import HandleInviteScreen from "./invite"; import HandleInviteScreen from "./invite";
import { DemoAuthBasicUI, JazzProvider, useDemoAuth } from "jazz-react-native"; import { JazzProvider, RNQuickCrypto } from "jazz-react-native";
import { apiKey } from "./apiKey";
import ChatScreen from "./chat"; import ChatScreen from "./chat";
const Stack = createNativeStackNavigator(); const Stack = createNativeStackNavigator();
@@ -28,7 +29,6 @@ const linking = {
}; };
function App() { function App() {
const [auth, state] = useDemoAuth();
const [initialRoute, setInitialRoute] = useState< const [initialRoute, setInitialRoute] = useState<
"ChatScreen" | "HandleInviteScreen" "ChatScreen" | "HandleInviteScreen"
>("ChatScreen"); >("ChatScreen");
@@ -43,16 +43,14 @@ function App() {
}); });
}, []); }, []);
if (!auth) {
return null;
}
return ( return (
<StrictMode> <StrictMode>
<JazzProvider <JazzProvider
auth={auth}
storage="sqlite" storage="sqlite"
peer="wss://cloud.jazz.tools/?key=chat-rn-example-jazz@garden.co" sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
}}
CryptoProvider={RNQuickCrypto}
> >
<NavigationContainer linking={linking} ref={navigationRef}> <NavigationContainer linking={linking} ref={navigationRef}>
<Stack.Navigator initialRouteName={initialRoute}> <Stack.Navigator initialRouteName={initialRoute}>
@@ -69,9 +67,6 @@ function App() {
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer> </NavigationContainer>
</JazzProvider> </JazzProvider>
{state.state !== "signedIn" ? (
<DemoAuthBasicUI appName="Jazz Chat" state={state} />
) : null}
</StrictMode> </StrictMode>
); );
} }

View File

@@ -0,0 +1 @@
export const apiKey = "chat-rn-example-jazz@garden.co";

View File

@@ -1,6 +1,6 @@
import clsx from "clsx"; import clsx from "clsx";
import * as Clipboard from "expo-clipboard"; import * as Clipboard from "expo-clipboard";
import { Group, ID } from "jazz-tools"; import { Group, ID, Profile } from "jazz-tools";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import React, { import React, {
Button, Button,
@@ -22,10 +22,16 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
const [chatId, setChatId] = useState<ID<Chat>>(); const [chatId, setChatId] = useState<ID<Chat>>();
const loadedChat = useCoState(Chat, chatId, [{}]); const loadedChat = useCoState(Chat, chatId, [{}]);
const [message, setMessage] = useState(""); const [message, setMessage] = useState("");
const profile = useCoState(Profile, me._refs.profile?.id, {});
function handleLogOut() {
setChatId(undefined);
logOut();
}
useEffect(() => { useEffect(() => {
navigation.setOptions({ navigation.setOptions({
headerRight: () => <Button onPress={logOut} title="Logout" />, headerRight: () => <Button onPress={handleLogOut} title="Logout" />,
headerLeft: () => headerLeft: () =>
loadedChat ? ( loadedChat ? (
<Button <Button
@@ -131,6 +137,19 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
<View className="flex flex-col h-full"> <View className="flex flex-col h-full">
{!loadedChat ? ( {!loadedChat ? (
<View className="flex flex-col h-full items-center justify-center"> <View className="flex flex-col h-full items-center justify-center">
<Text className="text-m font-bold mb-6">Username</Text>
<TextInput
className="rounded h-12 p-2 mb-12 w-40 border border-gray-200 block"
value={profile?.name ?? ""}
onChangeText={(value) => {
if (profile) {
profile.name = value;
}
}}
textAlignVertical="center"
onSubmitEditing={sendMessage}
testID="username-input"
/>
<TouchableOpacity <TouchableOpacity
onPress={createChat} onPress={createChat}
className="bg-blue-500 p-4 rounded-md" className="bg-blue-500 p-4 rounded-md"
@@ -172,10 +191,12 @@ export default function ChatScreen({ navigation }: { navigation: any }) {
placeholder="Type a message..." placeholder="Type a message..."
textAlignVertical="center" textAlignVertical="center"
onSubmitEditing={sendMessage} onSubmitEditing={sendMessage}
testID="message-input"
/> />
<TouchableOpacity <TouchableOpacity
onPress={sendMessage} onPress={sendMessage}
className="bg-gray-300 text-white rounded-full h-8 w-8 items-center justify-center" className="bg-gray-300 text-white rounded-full h-8 w-8 items-center justify-center"
testID="send-button"
> >
<Text></Text> <Text></Text>
</TouchableOpacity> </TouchableOpacity>

View File

@@ -0,0 +1,16 @@
# this sub-flow exists to work around an ios issue where the text field is not
# fully erased. The tap into the input field hits the middle, and clears all
# text to the left. If there's more to the right, it slides left, and thus we
# repeat this step. https://maestro.mobile.dev/api-reference/commands/erasetext
appId: com.jazz.chatrn
---
- copyTextFrom:
id: ${id}
- repeat:
times: 4
commands:
- tapOn:
id: ${id}
- eraseText
- copyTextFrom:
id: ${id}

View File

@@ -0,0 +1,47 @@
appId: com.jazz.chatrn
---
- launchApp
# # handle Expo screens (for local dev)
# - assertVisible: "Continue"
# - tapOn: "Continue"
# - assertVisible: "Reload"
# - tapOn: "Reload"
# login
- assertVisible: "Anonymous user"
- runFlow:
label: "Erase existing username"
file: erase_text.yml
env:
id: "username-input"
- inputText: "boorad"
- assertVisible: "boorad"
# start new chat
- tapOn: "Start new chat"
- assertVisible: "Share"
- assertVisible: "Jazz Chat"
- assertVisible: "Logout"
# send a message
- runFlow:
label: "Erase existing message"
file: erase_text.yml
env:
id: "message-input"
- inputText: "bro, low key, it do be like that tho"
- tapOn:
id: "send-button"
- assertVisible: "bro, low key, it do be like that tho"
# get invite code
- tapOn: "Share"
- assertVisible: "Copied to clipboard"
- tapOn: "OK"
# this assert doesn't work. maestro.copiedText only populates from `copyTextFrom`
# - assertTrue: ${maestro.copiedText.startsWith("co_z")}
# logout
- tapOn: "Logout"
- assertVisible: "Anonymous user"

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# This script is necessary, because unlike ios, the android emulator action
# accepts a script, runs it as your tests, then terminates.
set -e
# build and install the app
echo "Building and installing Android app."
echo "If it fails, its output will be in artifact: android-install.log..."
cd ./android/
./gradlew installRelease >> ~/output/android-install.log 2>&1
cd ..
# run the e2e tests
export PATH="$PATH":"$HOME/.maestro/bin"
export MAESTRO_DRIVER_STARTUP_TIMEOUT=300000 # setting to 5 mins 👀
export MAESTRO_CLI_NO_ANALYTICS=1
export MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED=true
maestro test test/e2e/flow.yml

View File

@@ -1,5 +1,128 @@
# chat-vue # chat-vue
## 0.0.55
### Patch Changes
- Updated dependencies [ada802b]
- jazz-tools@0.10.6
- jazz-browser@0.10.6
- jazz-vue@0.10.6
## 0.0.54
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-browser@0.10.5
- jazz-vue@0.10.5
## 0.0.53
### Patch Changes
- jazz-browser@0.10.4
- jazz-tools@0.10.4
- jazz-vue@0.10.4
## 0.0.52
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-browser@0.10.3
- jazz-vue@0.10.3
## 0.0.51
### Patch Changes
- jazz-browser@0.10.2
- jazz-tools@0.10.2
- jazz-vue@0.10.2
## 0.0.50
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-browser@0.10.1
- jazz-vue@0.10.1
## 0.0.49
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-browser@0.10.0
- jazz-tools@0.10.0
- jazz-vue@0.10.0
## 0.0.48
### Patch Changes
- jazz-browser@0.9.23
- jazz-tools@0.9.23
- jazz-vue@0.9.23
## 0.0.47
### Patch Changes
- jazz-browser@0.9.22
- jazz-vue@0.9.22
## 0.0.46
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-browser@0.9.21
- jazz-vue@0.9.21
## 0.0.45
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-browser@0.9.20
- jazz-vue@0.9.20
## 0.0.44
### Patch Changes
- jazz-browser@0.9.19
- jazz-tools@0.9.19
- jazz-vue@0.9.19
## 0.0.43
### Patch Changes
- jazz-browser@0.9.18
- jazz-tools@0.9.18
- jazz-vue@0.9.18
## 0.0.42
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-browser@0.9.17
- jazz-vue@0.9.17
## 0.0.41 ## 0.0.41
### Patch Changes ### Patch Changes

View File

@@ -11,10 +11,6 @@ You can either
Create a new Jazz project, and use this example as a template. Create a new Jazz project, and use this example as a template.
```bash ```bash
npm create jazz-app@latest --example chat-vue --project-name chat-vue
```
or
```bash
npx create-jazz-app@latest --example chat-vue --project-name chat-vue npx create-jazz-app@latest --example chat-vue --project-name chat-vue
``` ```

View File

@@ -1,6 +1,6 @@
{ {
"name": "chat-vue", "name": "chat-vue",
"version": "0.0.41", "version": "0.0.55",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -30,9 +30,9 @@
"eslint-plugin-vue": "^9.28.0", "eslint-plugin-vue": "^9.28.0",
"npm-run-all2": "^6.2.3", "npm-run-all2": "^6.2.3",
"postcss": "^8.4.27", "postcss": "^8.4.27",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10", "vite": "^6.0.11",
"vite-plugin-vue-devtools": "^7.4.6", "vite-plugin-vue-devtools": "^7.4.6",
"vue-tsc": "^2.1.6" "vue-tsc": "^2.1.6"
} }

View File

@@ -0,0 +1 @@
export const apiKey = "chat-example-jazz@garden.co";

View File

@@ -1,32 +1,31 @@
import { DemoAuthBasicUI, JazzProvider, useDemoAuth } from "jazz-vue"; import { DemoAuthBasicUI, JazzProvider } from "jazz-vue";
import { createApp, defineComponent, h } from "vue"; import { createApp, defineComponent, h } from "vue";
import App from "./App.vue"; import App from "./App.vue";
import "./index.css"; import "./index.css";
import { apiKey } from "@/apiKey";
import router from "./router"; import router from "./router";
const RootComponent = defineComponent({ const RootComponent = defineComponent({
name: "RootComponent", name: "RootComponent",
setup() { setup() {
const { authMethod, state } = useDemoAuth(); return () =>
return () => [
h( h(
JazzProvider, JazzProvider,
{ {
auth: authMethod.value, sync: {
peer: "wss://cloud.jazz.tools/?key=chat-example-jazz@garden.co", peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
},
}, },
{ h(
default: () => h(App), DemoAuthBasicUI,
}, {
), appName: "Jazz Vue Chat",
},
state.state !== "signedIn" && {
h(DemoAuthBasicUI, { default: () => h(App),
appName: "Jazz Chat", },
state, ),
}), );
];
}, },
}); });

View File

@@ -1,5 +1,130 @@
# jazz-example-chat # jazz-example-chat
## 0.0.151
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [ada802b]
- hash-slash@0.2.2
- jazz-react@0.10.6
- jazz-tools@0.10.6
- jazz-browser-media-images@0.10.6
## 0.0.150
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-browser-media-images@0.10.5
- jazz-react@0.10.5
## 0.0.149
### Patch Changes
- jazz-react@0.10.4
- jazz-tools@0.10.4
- jazz-browser-media-images@0.10.4
## 0.0.148
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-browser-media-images@0.10.3
- jazz-react@0.10.3
## 0.0.147
### Patch Changes
- jazz-react@0.10.2
- jazz-tools@0.10.2
- jazz-browser-media-images@0.10.2
## 0.0.146
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-browser-media-images@0.10.1
- jazz-react@0.10.1
## 0.0.145
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react@0.10.0
- jazz-tools@0.10.0
- jazz-browser-media-images@0.10.0
## 0.0.144
### Patch Changes
- jazz-react@0.9.23
- jazz-tools@0.9.23
- jazz-browser-media-images@0.9.23
## 0.0.143
### Patch Changes
- jazz-browser-media-images@0.9.22
- jazz-react@0.9.22
## 0.0.142
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-browser-media-images@0.9.21
- jazz-react@0.9.21
## 0.0.141
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-browser-media-images@0.9.20
- jazz-react@0.9.20
## 0.0.140
### Patch Changes
- jazz-react@0.9.19
- jazz-tools@0.9.19
- jazz-browser-media-images@0.9.19
## 0.0.139
### Patch Changes
- jazz-react@0.9.18
- jazz-tools@0.9.18
- jazz-browser-media-images@0.9.18
## 0.0.138
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-browser-media-images@0.9.17
- jazz-react@0.9.17
## 0.0.137 ## 0.0.137
### Patch Changes ### Patch Changes

View File

@@ -13,10 +13,6 @@ You can either
Create a new Jazz project, and use this example as a template. Create a new Jazz project, and use this example as a template.
```bash ```bash
npm create jazz-app@latest --example chat --project-name chat
```
or
```bash
npx create-jazz-app@latest --example chat --project-name chat npx create-jazz-app@latest --example chat --project-name chat
``` ```

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-example-chat", "name": "jazz-example-chat",
"private": true, "private": true,
"version": "0.0.137", "version": "0.0.151",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -9,8 +9,8 @@
"format-and-lint": "biome check .", "format-and-lint": "biome check .",
"format-and-lint:fix": "biome check . --write", "format-and-lint:fix": "biome check . --write",
"preview": "vite preview", "preview": "vite preview",
"test": "playwright test", "test:e2e": "playwright test",
"test:ui": "playwright test --ui" "test:e2e:ui": "playwright test --ui"
}, },
"dependencies": { "dependencies": {
"clsx": "^2.0.0", "clsx": "^2.0.0",
@@ -23,15 +23,15 @@
"react-dom": "^18.3.1" "react-dom": "^18.3.1"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.46.1", "@playwright/test": "^1.50.1",
"@types/react": "^18.3.12", "@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.3.2", "@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"is-ci": "^3.0.1", "is-ci": "^3.0.1",
"postcss": "^8.4.27", "postcss": "^8.4.27",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10" "vite": "^6.0.11"
} }
} }

View File

@@ -0,0 +1 @@
export const apiKey = "chat-example-jazz@garden.co";

View File

@@ -1,11 +1,11 @@
import { inIframe, onChatLoad } from "@/util.ts"; import { apiKey } from "@/apiKey.ts";
import { getRandomUsername, inIframe, onChatLoad } from "@/util.ts";
import { useIframeHashRouter } from "hash-slash"; import { useIframeHashRouter } from "hash-slash";
import { useAccount } from "jazz-react"; import { JazzProvider, useAccount } from "jazz-react";
import { Group, ID } from "jazz-tools"; import { Group, ID } from "jazz-tools";
import { StrictMode } from "react"; import { StrictMode } from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import { ChatScreen } from "./chatScreen.tsx"; import { ChatScreen } from "./chatScreen.tsx";
import { JazzAndAuth } from "./jazz.tsx";
import { Chat } from "./schema.ts"; import { Chat } from "./schema.ts";
import { ThemeProvider } from "./themeProvider.tsx"; import { ThemeProvider } from "./themeProvider.tsx";
import { AppContainer, TopBar } from "./ui.tsx"; import { AppContainer, TopBar } from "./ui.tsx";
@@ -28,7 +28,16 @@ export function App() {
return ( return (
<AppContainer> <AppContainer>
<TopBar> <TopBar>
<p>{me?.profile?.name}</p> <input
type="text"
value={me?.profile?.name ?? ""}
className="bg-transparent"
onChange={(e) => {
if (!me?.profile) return;
me.profile.name = e.target.value;
}}
placeholder="Set username"
/>
{!inIframe && <button onClick={logOut}>Log out</button>} {!inIframe && <button onClick={logOut}>Log out</button>}
</TopBar> </TopBar>
{router.route({ {router.route({
@@ -39,12 +48,20 @@ export function App() {
); );
} }
const url = new URL(window.location.href);
const defaultProfileName = url.searchParams.get("user") ?? getRandomUsername();
createRoot(document.getElementById("root")!).render( createRoot(document.getElementById("root")!).render(
<ThemeProvider> <ThemeProvider>
<StrictMode> <StrictMode>
<JazzAndAuth> <JazzProvider
sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
}}
defaultProfileName={defaultProfileName}
>
<App /> <App />
</JazzAndAuth> </JazzProvider>
</StrictMode> </StrictMode>
</ThemeProvider>, </ThemeProvider>,
); );

View File

@@ -1,19 +0,0 @@
import { DemoAuthBasicUI, JazzProvider, useDemoAuth } from "jazz-react";
export function JazzAndAuth({ children }: { children: React.ReactNode }) {
const [auth, state] = useDemoAuth();
return (
<>
<JazzProvider
auth={auth}
peer="wss://cloud.jazz.tools/?key=chat-example-jazz@garden.co"
>
{children}
</JazzProvider>
{state.state !== "signedIn" && (
<DemoAuthBasicUI appName="Jazz Chat" state={state} />
)}
</>
);
}

View File

@@ -6,7 +6,7 @@ import { useId, useRef } from "react";
export function AppContainer(props: { children: React.ReactNode }) { export function AppContainer(props: { children: React.ReactNode }) {
return ( return (
<div className="flex flex-col justify-between w-screen h-screen bg-stone-50 dark:bg-black dark:text-white"> <div className="flex flex-col justify-between w-screen h-screen bg-stone-50 dark:bg-stone-925 dark:text-white">
{props.children} {props.children}
</div> </div>
); );
@@ -14,7 +14,7 @@ export function AppContainer(props: { children: React.ReactNode }) {
export function TopBar(props: { children: React.ReactNode }) { export function TopBar(props: { children: React.ReactNode }) {
return ( return (
<div className="p-3 bg-white w-full flex justify-between gap-2 border-b dark:bg-transparent dark:border-stone-800"> <div className="p-3 bg-white w-full flex justify-between gap-2 border-b dark:bg-transparent dark:border-stone-900">
{props.children} {props.children}
</div> </div>
); );
@@ -33,7 +33,7 @@ export function ChatBody(props: { children: React.ReactNode }) {
export function EmptyChatMessage() { export function EmptyChatMessage() {
return ( return (
<div className="h-full text-base text-stone-500 flex items-center justify-center px-3 text-lg md:text-2xl"> <div className="h-full text-base text-stone-500 flex items-center justify-center px-3 md:text-2xl">
Start a conversation below. Start a conversation below.
</div> </div>
); );
@@ -61,7 +61,7 @@ export function BubbleBody(props: {
"line-clamp-10 text-ellipsis whitespace-pre-wrap", "line-clamp-10 text-ellipsis whitespace-pre-wrap",
"rounded-2xl overflow-hidden max-w-[calc(100%-5rem)] shadow-sm p-1", "rounded-2xl overflow-hidden max-w-[calc(100%-5rem)] shadow-sm p-1",
props.fromMe props.fromMe
? "bg-white dark:bg-stone-700 dark:text-white" ? "bg-white dark:bg-stone-900 dark:text-white"
: "bg-blue text-white", : "bg-blue text-white",
)} )}
> >
@@ -97,7 +97,7 @@ export function BubbleInfo(props: { by: string | undefined; madeAt: Date }) {
export function InputBar(props: { children: React.ReactNode }) { export function InputBar(props: { children: React.ReactNode }) {
return ( return (
<div className="p-3 bg-white border-t shadow-2xl mt-auto flex gap-1 dark:bg-transparent dark:border-stone-800"> <div className="p-3 bg-white border-t shadow-2xl mt-auto flex gap-1 dark:bg-transparent dark:border-stone-900">
{props.children} {props.children}
</div> </div>
); );
@@ -147,7 +147,7 @@ export function TextInput(props: { onSubmit: (text: string) => void }) {
</label> </label>
<input <input
id={inputId} id={inputId}
className="rounded-full py-1 px-3 border block w-full placeholder:text-stone-500 dark:bg-black dark:text-white dark:border-stone-700" className="rounded-full py-1 px-3 border block w-full placeholder:text-stone-500 dark:bg-stone-925 dark:text-white dark:border-stone-900"
placeholder="Type a message and press Enter" placeholder="Type a message and press Enter"
maxLength={2048} maxLength={2048}
onKeyDown={({ key, currentTarget: input }) => { onKeyDown={({ key, currentTarget: input }) => {

View File

@@ -15,3 +15,20 @@ export function onChatLoad(chat: Chat) {
} }
export const inIframe = window.self !== window.top; export const inIframe = window.self !== window.top;
const animals = [
"elephant",
"penguin",
"giraffe",
"octopus",
"kangaroo",
"dolphin",
"cheetah",
"koala",
"platypus",
"pangolin",
];
export function getRandomUsername() {
return `Anonymous ${animals[Math.floor(Math.random() * animals.length)]}`;
}

View File

@@ -1,48 +1,35 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { ChatPage } from "./pages/ChatPage"; import { ChatPage } from "./pages/ChatPage";
import { LoginPage } from "./pages/LoginPage";
test("chat between two users", async ({ page }) => { test("chat between two users", async ({ page: marioPage, browser }) => {
const loginPage = new LoginPage(page); const context = await browser.newContext();
const luigiPage = await context.newPage();
const mario = "S. Mario"; await marioPage.goto("/");
const luigi = "Luigi";
await loginPage.goto(); const marioChat = new ChatPage(marioPage);
await loginPage.fillUsername(mario); const luigiChat = new ChatPage(luigiPage);
await loginPage.signup();
const chatPage = new ChatPage(page); await marioChat.setUsername("Mario");
const message1ByMario = "Hello Luigi, are you ready to save the princess?"; const message1ByMario = "Hello Luigi, are you ready to save the princess?";
await chatPage.sendMessage(message1ByMario); await marioChat.sendMessage(message1ByMario);
await chatPage.expectMessageRow(message1ByMario); await marioChat.expectMessageRow(message1ByMario);
const roomURL = page.url(); const roomURL = marioPage.url();
await luigiPage.goto(roomURL);
await chatPage.logout(); await luigiChat.setUsername("Luigi");
await loginPage.expectLoaded(); await luigiChat.expectMessageRow(message1ByMario);
await loginPage.fillUsername(luigi);
await loginPage.signup();
await page.goto(roomURL);
await chatPage.expectMessageRow(message1ByMario);
const message2ByLuigi = const message2ByLuigi =
"No, I'm not ready yet. I'm still trying to find the key to the castle."; "No, I'm not ready yet. I'm still trying to find the key to the castle.";
await chatPage.sendMessage(message2ByLuigi); await luigiChat.sendMessage(message2ByLuigi);
await chatPage.expectMessageRow(message2ByLuigi); await luigiChat.expectMessageRow(message2ByLuigi);
await chatPage.logout(); await marioChat.expectMessageRow(message1ByMario);
await loginPage.loginAs(mario); await luigiChat.expectMessageRow(message2ByLuigi);
await page.goto(roomURL);
await chatPage.expectMessageRow(message1ByMario);
await chatPage.expectMessageRow(message2ByLuigi);
}); });

View File

@@ -4,7 +4,7 @@ export class ChatPage {
readonly page: Page; readonly page: Page;
readonly messageInput: Locator; readonly messageInput: Locator;
readonly logoutButton: Locator; readonly logoutButton: Locator;
readonly usernameInput: Locator;
constructor(page: Page) { constructor(page: Page) {
this.page = page; this.page = page;
this.messageInput = page.getByRole("textbox", { this.messageInput = page.getByRole("textbox", {
@@ -13,6 +13,11 @@ export class ChatPage {
this.logoutButton = page.getByRole("button", { this.logoutButton = page.getByRole("button", {
name: "Log out", name: "Log out",
}); });
this.usernameInput = page.getByPlaceholder("Set username");
}
async setUsername(username: string) {
await this.usernameInput.fill(username);
} }
async sendMessage(message: string) { async sendMessage(message: string) {

View File

@@ -1,40 +0,0 @@
import { Locator, Page, expect } from "@playwright/test";
export class LoginPage {
readonly page: Page;
readonly usernameInput: Locator;
readonly signupButton: Locator;
constructor(page: Page) {
this.page = page;
this.usernameInput = page.getByRole("textbox");
this.signupButton = page.getByRole("button", {
name: "Sign up",
});
}
async goto() {
this.page.goto("/");
}
async fillUsername(value: string) {
await this.usernameInput.clear();
await this.usernameInput.fill(value);
}
async loginAs(value: string) {
await this.page
.getByRole("button", {
name: value,
})
.click();
}
async signup() {
await this.signupButton.click();
}
async expectLoaded() {
await expect(this.signupButton).toBeVisible();
}
}

View File

@@ -1,5 +1,129 @@
# minimal-auth-clerk # minimal-auth-clerk
## 0.0.50
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [ada802b]
- jazz-react-auth-clerk@0.10.6
- jazz-react@0.10.6
- jazz-tools@0.10.6
## 0.0.49
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-react@0.10.5
- jazz-react-auth-clerk@0.10.5
## 0.0.48
### Patch Changes
- jazz-react@0.10.4
- jazz-react-auth-clerk@0.10.4
- jazz-tools@0.10.4
## 0.0.47
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-react@0.10.3
- jazz-react-auth-clerk@0.10.3
## 0.0.46
### Patch Changes
- jazz-react@0.10.2
- jazz-react-auth-clerk@0.10.2
- jazz-tools@0.10.2
## 0.0.45
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-react@0.10.1
- jazz-react-auth-clerk@0.10.1
## 0.0.44
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react-auth-clerk@0.10.0
- jazz-react@0.10.0
- jazz-tools@0.10.0
## 0.0.43
### Patch Changes
- jazz-react@0.9.23
- jazz-react-auth-clerk@0.9.23
- jazz-tools@0.9.23
## 0.0.42
### Patch Changes
- jazz-react@0.9.22
- jazz-react-auth-clerk@0.9.22
## 0.0.41
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-react@0.9.21
- jazz-react-auth-clerk@0.9.21
## 0.0.40
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-react@0.9.20
- jazz-react-auth-clerk@0.9.20
## 0.0.39
### Patch Changes
- jazz-react@0.9.19
- jazz-react-auth-clerk@0.9.19
- jazz-tools@0.9.19
## 0.0.38
### Patch Changes
- jazz-react@0.9.18
- jazz-react-auth-clerk@0.9.18
- jazz-tools@0.9.18
## 0.0.37
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-react@0.9.17
- jazz-react-auth-clerk@0.9.17
## 0.0.36 ## 0.0.36
### Patch Changes ### Patch Changes

View File

@@ -15,10 +15,6 @@ You can either
Create a new Jazz project, and use this example as a template. Create a new Jazz project, and use this example as a template.
```bash ```bash
npm create jazz-app@latest --example clerk --project-name clerk
```
or
```bash
npx create-jazz-app@latest --example clerk --project-name clerk npx create-jazz-app@latest --example clerk --project-name clerk
``` ```

View File

@@ -1,7 +1,7 @@
{ {
"name": "clerk", "name": "clerk",
"private": true, "private": true,
"version": "0.0.36", "version": "0.0.50",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -13,7 +13,7 @@
"dependencies": { "dependencies": {
"@clerk/clerk-react": "^5.4.1", "@clerk/clerk-react": "^5.4.1",
"jazz-react": "workspace:*", "jazz-react": "workspace:*",
"jazz-react-auth-clerk": "workspace:0.9.16", "jazz-react-auth-clerk": "workspace:0.10.6",
"jazz-tools": "workspace:*", "jazz-tools": "workspace:*",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1" "react-dom": "^18.3.1"
@@ -25,6 +25,6 @@
"@vitejs/plugin-react": "^4.3.3", "@vitejs/plugin-react": "^4.3.3",
"globals": "^15.11.0", "globals": "^15.11.0",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10" "vite": "^6.0.11"
} }
} }

View File

@@ -1,13 +1,25 @@
import { useAccount } from "jazz-react"; import { SignInButton } from "@clerk/clerk-react";
import { useAccount, useIsAuthenticated } from "jazz-react";
function App() { function App() {
const { me, logOut } = useAccount(); const { me, logOut } = useAccount();
const isAuthenticated = useIsAuthenticated();
if (isAuthenticated) {
return (
<div className="container">
<h1>You're logged in</h1>
<p>Welcome back, {me?.profile?.name}</p>
<button onClick={() => logOut()}>Logout</button>
</div>
);
}
return ( return (
<div className="container"> <div className="container">
<h1>You're logged in</h1> <h1>You're not logged in</h1>
<p>Welcome back, {me?.profile?.name}</p> <SignInButton />
<button onClick={() => logOut()}>Logout</button>
</div> </div>
); );
} }

View File

@@ -0,0 +1 @@
export const apiKey = "minimal-auth-clerk-example@garden.co";

View File

@@ -62,7 +62,7 @@ button {
} }
.container { .container {
max-width: 200px; max-width: 400px;
margin: 0 auto; margin: 0 auto;
padding: 0 1rem; padding: 0 1rem;
display: flex; display: flex;

View File

@@ -1,10 +1,10 @@
import { ClerkProvider, SignInButton, useClerk } from "@clerk/clerk-react"; import { ClerkProvider, useClerk } from "@clerk/clerk-react";
import { useJazzClerkAuth } from "jazz-react-auth-clerk";
import { StrictMode } from "react"; import { StrictMode } from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import App from "./App.tsx"; import App from "./App.tsx";
import "./index.css"; import "./index.css";
import { JazzProvider } from "jazz-react"; import { JazzProviderWithClerk } from "jazz-react-auth-clerk";
import { apiKey } from "./apiKey";
// Import your publishable key // Import your publishable key
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY; const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
@@ -13,35 +13,28 @@ if (!PUBLISHABLE_KEY) {
throw new Error("Add your Clerk publishable key to the .env.local file"); throw new Error("Add your Clerk publishable key to the .env.local file");
} }
function JazzAndAuth({ children }: { children: React.ReactNode }) { function JazzProvider({ children }: { children: React.ReactNode }) {
const clerk = useClerk(); const clerk = useClerk();
const [auth, state] = useJazzClerkAuth(clerk);
return ( return (
<main className="container"> <JazzProviderWithClerk
{state?.errors?.map((error) => ( clerk={clerk}
<div key={error}>{error}</div> sync={{
))} peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
{clerk.user && auth ? ( when: "signedUp", // This makes the app work in local mode when the user is not authenticated
<JazzProvider }}
auth={auth} >
peer="wss://cloud.jazz.tools/?key=minimal-auth-clerk-example@garden.co" {children}
> </JazzProviderWithClerk>
{children}
</JazzProvider>
) : (
<SignInButton />
)}
</main>
); );
} }
createRoot(document.getElementById("root")!).render( createRoot(document.getElementById("root")!).render(
<StrictMode> <StrictMode>
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/"> <ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
<JazzAndAuth> <JazzProvider>
<App /> <App />
</JazzAndAuth> </JazzProvider>
</ClerkProvider> </ClerkProvider>
</StrictMode>, </StrictMode>,
); );

View File

@@ -1,5 +1,114 @@
# file-share-svelte # file-share-svelte
## 0.0.35
### Patch Changes
- Updated dependencies [ada802b]
- jazz-tools@0.10.6
- jazz-svelte@0.10.6
## 0.0.34
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-svelte@0.10.5
## 0.0.33
### Patch Changes
- jazz-svelte@0.10.4
- jazz-tools@0.10.4
## 0.0.32
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-svelte@0.10.3
## 0.0.31
### Patch Changes
- jazz-svelte@0.10.2
- jazz-tools@0.10.2
## 0.0.30
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-svelte@0.10.1
## 0.0.29
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-tools@0.10.0
- jazz-svelte@0.10.0
## 0.0.28
### Patch Changes
- jazz-svelte@0.9.23
- jazz-tools@0.9.23
## 0.0.27
### Patch Changes
- jazz-svelte@0.9.22
## 0.0.26
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-svelte@0.9.21
## 0.0.25
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-svelte@0.9.20
## 0.0.24
### Patch Changes
- jazz-svelte@0.9.19
- jazz-tools@0.9.19
## 0.0.23
### Patch Changes
- jazz-svelte@0.9.18
- jazz-tools@0.9.18
## 0.0.22
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-svelte@0.9.17
## 0.0.21 ## 0.0.21
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "file-share-svelte", "name": "file-share-svelte",
"version": "0.0.21", "version": "0.0.35",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -13,13 +13,13 @@
"lint": "prettier --check . && eslint .", "lint": "prettier --check . && eslint .",
"format-and-lint": "pnpm run format && pnpm run lint", "format-and-lint": "pnpm run format && pnpm run lint",
"format-and-lint:fix": "pnpm run format --write && pnpm run lint --fix", "format-and-lint:fix": "pnpm run format --write && pnpm run lint --fix",
"test": "playwright test", "test:e2e": "playwright test",
"test:ui": "playwright test --ui" "test:e2e:ui": "playwright test --ui"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-vercel": "^5.5.0", "@sveltejs/adapter-vercel": "^5.5.0",
"@sveltejs/kit": "^2.0.0", "@sveltejs/kit": "^2.16.0",
"@sveltejs/vite-plugin-svelte": "^4.0.1", "@sveltejs/vite-plugin-svelte": "^5.0.0",
"@types/is-ci": "^3.0.4", "@types/is-ci": "^3.0.4",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^9.7.0", "eslint": "^9.7.0",
@@ -32,10 +32,10 @@
"prettier-plugin-tailwindcss": "^0.6.5", "prettier-plugin-tailwindcss": "^0.6.5",
"svelte": "^5.0.0", "svelte": "^5.0.0",
"svelte-check": "^4.0.0", "svelte-check": "^4.0.0",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"typescript-eslint": "^8.0.0", "typescript-eslint": "^8.0.0",
"vite": "^5.4.10" "vite": "^6.0.11"
}, },
"dependencies": { "dependencies": {
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",

View File

@@ -0,0 +1 @@
export const apiKey = "file-share-svelte@garden.co"

View File

@@ -17,6 +17,6 @@ export function formatFileSize(bytes: number): string {
* @param createdAt The creation date * @param createdAt The creation date
* @returns A unique file ID string * @returns A unique file ID string
*/ */
export function generateTempFileId(fileName: string, createdAt: Date): string { export function generateTempFileId(fileName: string | undefined, createdAt: Date | undefined): string {
return `file-${fileName}-${createdAt.getTime()}`; return `file-${fileName ?? 'unknown'}-${createdAt?.getTime() ?? 0}`;
} }

View File

@@ -12,11 +12,9 @@
import { Toaster } from 'svelte-sonner'; import { Toaster } from 'svelte-sonner';
import '../app.css'; import '../app.css';
import { FileShareAccount } from '$lib/schema'; import { FileShareAccount } from '$lib/schema';
import {apiKey} from '../apiKey';
let { children } = $props(); let { children } = $props();
const auth = usePasskeyAuth({
appName: 'File Share'
});
</script> </script>
<svelte:head> <svelte:head>
@@ -25,21 +23,16 @@
<Toaster richColors /> <Toaster richColors />
{#if auth.state.state === 'ready'} <JazzProvider
<div class="fixed inset-0 flex items-center justify-center bg-gray-50/80"> AccountSchema={FileShareAccount}
<div class="rounded-lg bg-white p-8 shadow-lg"> sync={{
<PasskeyAuthBasicUI state={auth.state} /> peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
</div> when: "signedUp",
</div> }}
{/if} >
{#if auth.current} <PasskeyAuthBasicUI appName="File Share">
<JazzProvider
AccountSchema={FileShareAccount}
auth={auth.current}
peer="wss://cloud.jazz.tools/?key=file-share-svelte@garden.co"
>
<div class="min-h-screen bg-gray-100"> <div class="min-h-screen bg-gray-100">
{@render children()} {@render children()}
</div> </div>
</JazzProvider> </PasskeyAuthBasicUI>
{/if} </JazzProvider>

View File

@@ -28,7 +28,7 @@
const input = event.target as HTMLInputElement; const input = event.target as HTMLInputElement;
const files = input.files; const files = input.files;
if (!files || !files.length || !me?.root?.sharedFiles || !me.root.publicGroup) return; if (!files || !files.length || !me.root?.sharedFiles || !me.root.publicGroup) return;
const file = files[0]; const file = files[0];
const fileName = file.name; const fileName = file.name;
@@ -129,12 +129,14 @@
{#if sharedFiles.current} {#if sharedFiles.current}
{#if !(sharedFiles.current.length === 0 && uploadingFiles.size === 0)} {#if !(sharedFiles.current.length === 0 && uploadingFiles.size === 0)}
{#each [...sharedFiles.current, ...uploadingFiles.values()] as file (generateTempFileId(file?.name, file?.createdAt))} {#each [...sharedFiles.current, ...uploadingFiles.values()] as file (generateTempFileId(file?.name, file?.createdAt))}
<FileItem {#if file}
{file} <FileItem
loading={uploadingFiles.has(generateTempFileId(file?.name, file?.createdAt))} {file}
onShare={shareFile} loading={uploadingFiles.has(generateTempFileId(file?.name, file?.createdAt))}
onDelete={deleteFile} onShare={shareFile}
/> onDelete={deleteFile}
/>
{/if}
{/each} {/each}
{:else} {:else}
<p class="text-center text-gray-500">No files yet</p> <p class="text-center text-gray-500">No files yet</p>

View File

@@ -1,5 +1,130 @@
# form # form
## 0.0.46
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [ada802b]
- hash-slash@0.2.2
- jazz-react@0.10.6
- jazz-tools@0.10.6
- jazz-browser-media-images@0.10.6
## 0.0.45
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-browser-media-images@0.10.5
- jazz-react@0.10.5
## 0.0.44
### Patch Changes
- jazz-react@0.10.4
- jazz-tools@0.10.4
- jazz-browser-media-images@0.10.4
## 0.0.43
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-browser-media-images@0.10.3
- jazz-react@0.10.3
## 0.0.42
### Patch Changes
- jazz-react@0.10.2
- jazz-tools@0.10.2
- jazz-browser-media-images@0.10.2
## 0.0.41
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-browser-media-images@0.10.1
- jazz-react@0.10.1
## 0.0.40
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react@0.10.0
- jazz-tools@0.10.0
- jazz-browser-media-images@0.10.0
## 0.0.39
### Patch Changes
- jazz-react@0.9.23
- jazz-tools@0.9.23
- jazz-browser-media-images@0.9.23
## 0.0.38
### Patch Changes
- jazz-browser-media-images@0.9.22
- jazz-react@0.9.22
## 0.0.37
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-browser-media-images@0.9.21
- jazz-react@0.9.21
## 0.0.36
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-browser-media-images@0.9.20
- jazz-react@0.9.20
## 0.0.35
### Patch Changes
- jazz-react@0.9.19
- jazz-tools@0.9.19
- jazz-browser-media-images@0.9.19
## 0.0.34
### Patch Changes
- jazz-react@0.9.18
- jazz-tools@0.9.18
- jazz-browser-media-images@0.9.18
## 0.0.33
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-browser-media-images@0.9.17
- jazz-react@0.9.17
## 0.0.32 ## 0.0.32
### Patch Changes ### Patch Changes

View File

@@ -28,10 +28,6 @@ You can either
Create a new Jazz project, and use this example as a template. Create a new Jazz project, and use this example as a template.
```bash ```bash
npm create jazz-app@latest --example form --project-name form
```
or
```bash
npx create-jazz-app@latest --example form --project-name form npx create-jazz-app@latest --example form --project-name form
``` ```

View File

@@ -1,7 +1,7 @@
{ {
"name": "form", "name": "form",
"private": true, "private": true,
"version": "0.0.32", "version": "0.0.46",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -20,7 +20,7 @@
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "1.9.4", "@biomejs/biome": "1.9.4",
"@playwright/test": "^1.46.1", "@playwright/test": "^1.50.1",
"@tailwindcss/forms": "^0.5.9", "@tailwindcss/forms": "^0.5.9",
"@types/react": "^18.3.12", "@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
@@ -29,8 +29,8 @@
"globals": "^15.11.0", "globals": "^15.11.0",
"is-ci": "^3.0.1", "is-ci": "^3.0.1",
"postcss": "^8.4.27", "postcss": "^8.4.27",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10" "vite": "^6.0.11"
} }
} }

View File

@@ -1,5 +1,4 @@
import { useIframeHashRouter } from "hash-slash"; import { useIframeHashRouter } from "hash-slash";
import { useAccount } from "jazz-react";
import { ID } from "jazz-tools"; import { ID } from "jazz-tools";
import { CreateOrder } from "./CreateOrder.tsx"; import { CreateOrder } from "./CreateOrder.tsx";
import { EditOrder } from "./EditOrder.tsx"; import { EditOrder } from "./EditOrder.tsx";
@@ -7,25 +6,10 @@ import { Orders } from "./Orders.tsx";
import { BubbleTeaOrder } from "./schema.ts"; import { BubbleTeaOrder } from "./schema.ts";
function App() { function App() {
const { me, logOut } = useAccount();
const router = useIframeHashRouter(); const router = useIframeHashRouter();
return ( return (
<> <>
<header>
<nav className="container py-2 border-b flex items-center justify-between">
<span>
You're logged in as <strong>{me?.profile?.name}</strong>
</span>
<button
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md dark:bg-stone-900 dark:text-white"
onClick={() => logOut()}
>
Log out
</button>
</nav>
</header>
<main className="container py-8 space-y-8"> <main className="container py-8 space-y-8">
{router.route({ {router.route({
"/": () => <Orders />, "/": () => <Orders />,

View File

@@ -0,0 +1 @@
export const apiKey = "form-example@garden.co";

View File

@@ -1,30 +1,11 @@
import { DemoAuthBasicUI, JazzProvider, useDemoAuth } from "jazz-react"; import { JazzProvider } from "jazz-react";
import { StrictMode } from "react"; import { StrictMode } from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import App from "./App.tsx"; import App from "./App.tsx";
import "./index.css"; import "./index.css";
import { apiKey } from "./apiKey";
import { JazzAccount } from "./schema.ts"; import { JazzAccount } from "./schema.ts";
function JazzAndAuth({ children }: { children: React.ReactNode }) {
const [auth, authState] = useDemoAuth();
return (
<>
<JazzProvider
auth={auth}
peer="wss://cloud.jazz.tools/?key=form-example@garden.co"
AccountSchema={JazzAccount}
>
{children}
</JazzProvider>
{authState.state !== "signedIn" && (
<DemoAuthBasicUI appName="Form" state={authState} />
)}
</>
);
}
declare module "jazz-react" { declare module "jazz-react" {
interface Register { interface Register {
Account: JazzAccount; Account: JazzAccount;
@@ -33,8 +14,13 @@ declare module "jazz-react" {
createRoot(document.getElementById("root")!).render( createRoot(document.getElementById("root")!).render(
<StrictMode> <StrictMode>
<JazzAndAuth> <JazzProvider
sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
}}
AccountSchema={JazzAccount}
>
<App /> <App />
</JazzAndAuth> </JazzProvider>
</StrictMode>, </StrictMode>,
); );

View File

@@ -1,13 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { LoginPage } from "./pages/LoginPage";
test("create and edit an order", async ({ page }) => { test("create and edit an order", async ({ page }) => {
const loginPage = new LoginPage(page); await page.goto("/");
await loginPage.goto();
await loginPage.fillUsername("Alice");
await loginPage.signup();
// start an order // start an order
await page.getByRole("link", { name: "Add new order" }).click(); await page.getByRole("link", { name: "Add new order" }).click();
await page.getByLabel("Base tea").selectOption("Oolong"); await page.getByLabel("Base tea").selectOption("Oolong");

View File

@@ -1,40 +0,0 @@
import { Locator, Page, expect } from "@playwright/test";
export class LoginPage {
readonly page: Page;
readonly usernameInput: Locator;
readonly signupButton: Locator;
constructor(page: Page) {
this.page = page;
this.usernameInput = page.getByRole("textbox");
this.signupButton = page.getByRole("button", {
name: "Sign up",
});
}
async goto() {
this.page.goto("/");
}
async fillUsername(value: string) {
await this.usernameInput.clear();
await this.usernameInput.fill(value);
}
async loginAs(value: string) {
await this.page
.getByRole("button", {
name: value,
})
.click();
}
async signup() {
await this.signupButton.click();
}
async expectLoaded() {
await expect(this.signupButton).toBeVisible();
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{"root":["./src/app.tsx","./src/createorder.tsx","./src/draftindicator.tsx","./src/editorder.tsx","./src/errors.tsx","./src/linktohome.tsx","./src/orderform.tsx","./src/orderthumbnail.tsx","./src/orders.tsx","./src/main.tsx","./src/schema.ts","./src/vite-env.d.ts"],"version":"5.6.3"}

View File

@@ -1,5 +1,129 @@
# image-upload # image-upload
## 0.0.48
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [ada802b]
- jazz-react@0.10.6
- jazz-tools@0.10.6
- jazz-browser-media-images@0.10.6
## 0.0.47
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-browser-media-images@0.10.5
- jazz-react@0.10.5
## 0.0.46
### Patch Changes
- jazz-react@0.10.4
- jazz-tools@0.10.4
- jazz-browser-media-images@0.10.4
## 0.0.45
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-browser-media-images@0.10.3
- jazz-react@0.10.3
## 0.0.44
### Patch Changes
- jazz-react@0.10.2
- jazz-tools@0.10.2
- jazz-browser-media-images@0.10.2
## 0.0.43
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-browser-media-images@0.10.1
- jazz-react@0.10.1
## 0.0.42
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react@0.10.0
- jazz-tools@0.10.0
- jazz-browser-media-images@0.10.0
## 0.0.41
### Patch Changes
- jazz-react@0.9.23
- jazz-tools@0.9.23
- jazz-browser-media-images@0.9.23
## 0.0.40
### Patch Changes
- jazz-browser-media-images@0.9.22
- jazz-react@0.9.22
## 0.0.39
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-browser-media-images@0.9.21
- jazz-react@0.9.21
## 0.0.38
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-browser-media-images@0.9.20
- jazz-react@0.9.20
## 0.0.37
### Patch Changes
- jazz-react@0.9.19
- jazz-tools@0.9.19
- jazz-browser-media-images@0.9.19
## 0.0.36
### Patch Changes
- jazz-react@0.9.18
- jazz-tools@0.9.18
- jazz-browser-media-images@0.9.18
## 0.0.35
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-browser-media-images@0.9.17
- jazz-react@0.9.17
## 0.0.34 ## 0.0.34
### Patch Changes ### Patch Changes

View File

@@ -15,10 +15,6 @@ You can either
Create a new Jazz project, and use this example as a template. Create a new Jazz project, and use this example as a template.
```bash ```bash
npm create jazz-app@latest --example image-upload --project-name image-upload
```
or
```bash
npx create-jazz-app@latest --example image-upload --project-name image-upload npx create-jazz-app@latest --example image-upload --project-name image-upload
``` ```

View File

@@ -1,7 +1,7 @@
{ {
"name": "image-upload", "name": "image-upload",
"private": true, "private": true,
"version": "0.0.34", "version": "0.0.48",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -24,6 +24,6 @@
"@vitejs/plugin-react": "^4.3.3", "@vitejs/plugin-react": "^4.3.3",
"globals": "^15.11.0", "globals": "^15.11.0",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10" "vite": "^6.0.11"
} }
} }

View File

@@ -1,19 +1,8 @@
import { useAccount } from "jazz-react";
import ImageUpload from "./ImageUpload.tsx"; import ImageUpload from "./ImageUpload.tsx";
function App() { function App() {
const { me, logOut } = useAccount();
return ( return (
<> <>
<header>
<nav className="container">
<span>
You're logged in as <strong>{me?.profile?.name}</strong>
</span>
<button onClick={() => logOut()}>Log out</button>
</nav>
</header>
<main className="container"> <main className="container">
<ImageUpload /> <ImageUpload />
</main> </main>

View File

@@ -46,7 +46,12 @@ export default function ImageUpload() {
) : ( ) : (
<div> <div>
<label>Upload image</label> <label>Upload image</label>
<input ref={inputRef} type="file" onChange={onImageChange} /> <input
ref={inputRef}
type="file"
accept="image/png, image/jpeg, image/gif"
onChange={onImageChange}
/>
</div> </div>
)} )}
</div> </div>

View File

@@ -0,0 +1 @@
export const apiKey = "image-upload-example@garden.co";

View File

@@ -72,8 +72,7 @@ nav {
.container { .container {
margin-right: auto; margin-right: auto;
margin-left: auto; margin-left: auto;
padding-right: 0.75rem; padding: 2rem 0.75rem;
padding-left: 0.75rem;
max-width: 800px; max-width: 800px;
} }

View File

@@ -1,30 +1,11 @@
import { DemoAuthBasicUI, JazzProvider, useDemoAuth } from "jazz-react"; import { JazzProvider } from "jazz-react";
import { StrictMode } from "react"; import { StrictMode } from "react";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
import App from "./App.tsx"; import App from "./App.tsx";
import "./index.css"; import "./index.css";
import { apiKey } from "./apiKey.ts";
import { JazzAccount } from "./schema.ts"; import { JazzAccount } from "./schema.ts";
function JazzAndAuth({ children }: { children: React.ReactNode }) {
const [auth, authState] = useDemoAuth();
return (
<>
<JazzProvider
auth={auth}
peer="wss://cloud.jazz.tools/?key=image-upload-example@garden.co"
AccountSchema={JazzAccount}
>
{children}
</JazzProvider>
{authState.state !== "signedIn" && (
<DemoAuthBasicUI appName="Image upload" state={authState} />
)}
</>
);
}
declare module "jazz-react" { declare module "jazz-react" {
interface Register { interface Register {
Account: JazzAccount; Account: JazzAccount;
@@ -33,8 +14,13 @@ declare module "jazz-react" {
createRoot(document.getElementById("root")!).render( createRoot(document.getElementById("root")!).render(
<StrictMode> <StrictMode>
<JazzAndAuth> <JazzProvider
sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
}}
AccountSchema={JazzAccount}
>
<App /> <App />
</JazzAndAuth> </JazzProvider>
</StrictMode>, </StrictMode>,
); );

View File

@@ -1,5 +1,82 @@
# jazz-example-inspector # jazz-example-inspector
## 0.0.107
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [5c76e37]
- hash-slash@0.2.2
- cojson@0.10.6
- cojson-transport-ws@0.10.6
## 0.0.106
### Patch Changes
- Updated dependencies [1af6072]
- cojson@0.10.4
- cojson-transport-ws@0.10.4
## 0.0.105
### Patch Changes
- Updated dependencies [cae3a9e]
- cojson@0.10.2
- cojson-transport-ws@0.10.2
## 0.0.104
### Patch Changes
- Updated dependencies [5a63cba]
- cojson@0.10.1
- cojson-transport-ws@0.10.1
## 0.0.103
### Patch Changes
- Updated dependencies [b426342]
- Updated dependencies [498954f]
- Updated dependencies [8217981]
- Updated dependencies [ac3d9fa]
- Updated dependencies [610543c]
- cojson@0.10.0
- cojson-transport-ws@0.10.0
## 0.0.102
### Patch Changes
- Updated dependencies [70c9a5d]
- cojson@0.9.23
- cojson-transport-ws@0.9.23
## 0.0.101
### Patch Changes
- Updated dependencies [14b6149]
- cojson-transport-ws@0.9.22
## 0.0.100
### Patch Changes
- Updated dependencies [6ad0a9f]
- cojson@0.9.19
- cojson-transport-ws@0.9.19
## 0.0.99
### Patch Changes
- Updated dependencies [8898b10]
- cojson@0.9.18
- cojson-transport-ws@0.9.18
## 0.0.98 ## 0.0.98
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-inspector-app", "name": "jazz-inspector-app",
"private": true, "private": true,
"version": "0.0.98", "version": "0.0.107",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -12,13 +12,13 @@
}, },
"dependencies": { "dependencies": {
"@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-toast": "^1.1.4", "@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"cojson": "workspace:0.9.13", "cojson": "workspace:0.10.6",
"cojson-transport-ws": "workspace:0.9.13", "cojson-transport-ws": "workspace:0.10.6",
"hash-slash": "workspace:0.2.1", "hash-slash": "workspace:0.2.2",
"lucide-react": "^0.274.0", "lucide-react": "^0.274.0",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"react": "^18.3.1", "react": "^18.3.1",
@@ -37,8 +37,8 @@
"@vitejs/plugin-react-swc": "^3.3.2", "@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"postcss": "^8.4.27", "postcss": "^8.4.27",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10" "vite": "^6.0.11"
} }
} }

View File

@@ -0,0 +1 @@
export const apiKey = "";

View File

@@ -5,13 +5,9 @@ import {
RawCoStream, RawCoStream,
RawCoValue, RawCoValue,
} from "cojson"; } from "cojson";
import { base64URLtoBytes } from "cojson/src/base64url.ts"; import { base64URLtoBytes } from "cojson";
import { import { BinaryStreamItem, BinaryStreamStart, CoStreamItem } from "cojson";
BinaryStreamItem, import { JsonObject, JsonValue } from "cojson";
BinaryStreamStart,
CoStreamItem,
} from "cojson/src/coValues/coStream.ts";
import { JsonObject, JsonValue } from "cojson/src/jsonValue.ts";
import { ArrowDownToLine } from "lucide-react"; import { ArrowDownToLine } from "lucide-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { PageInfo } from "./types"; import { PageInfo } from "./types";

View File

@@ -1,6 +1,6 @@
import clsx from "clsx"; import clsx from "clsx";
import { CoID, LocalNode, RawCoValue } from "cojson"; import { CoID, LocalNode, RawCoValue } from "cojson";
import { JsonObject } from "cojson/src/jsonValue.ts"; import { JsonObject } from "cojson";
import { ResolveIcon } from "./type-icon"; import { ResolveIcon } from "./type-icon";
import { PageInfo, isCoId } from "./types"; import { PageInfo, isCoId } from "./types";
import { CoMapPreview, ValueRenderer } from "./value-renderer"; import { CoMapPreview, ValueRenderer } from "./value-renderer";

View File

@@ -6,9 +6,9 @@ import {
RawAccount, RawAccount,
RawAccountID, RawAccountID,
RawCoValue, RawCoValue,
WasmCrypto,
} from "cojson"; } from "cojson";
import { createWebSocketPeer } from "cojson-transport-ws"; import { createWebSocketPeer } from "cojson-transport-ws";
import { WasmCrypto } from "cojson/crypto/WasmCrypto";
import { Trash2 } from "lucide-react"; import { Trash2 } from "lucide-react";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { Breadcrumbs } from "./breadcrumbs"; import { Breadcrumbs } from "./breadcrumbs";

View File

@@ -1,5 +1,5 @@
import { CoID, LocalNode, RawCoValue } from "cojson"; import { CoID, LocalNode, RawCoValue } from "cojson";
import { JsonObject } from "cojson/src/jsonValue.ts"; import { JsonObject } from "cojson";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import { LinkIcon } from "../link-icon"; import { LinkIcon } from "../link-icon";
import { PageInfo } from "./types"; import { PageInfo } from "./types";

View File

@@ -1,5 +1,135 @@
# jazz-example-musicplayer # jazz-example-musicplayer
## 0.0.72
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [ada802b]
- jazz-react@0.10.6
- jazz-tools@0.10.6
- jazz-inspector@0.10.6
## 0.0.71
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-inspector@0.10.5
- jazz-react@0.10.5
## 0.0.70
### Patch Changes
- jazz-inspector@0.10.4
- jazz-react@0.10.4
- jazz-tools@0.10.4
## 0.0.69
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-inspector@0.10.3
- jazz-react@0.10.3
## 0.0.68
### Patch Changes
- jazz-inspector@0.10.2
- jazz-react@0.10.2
- jazz-tools@0.10.2
## 0.0.67
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-inspector@0.10.1
- jazz-react@0.10.1
## 0.0.66
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-inspector@0.10.0
- jazz-react@0.10.0
- jazz-tools@0.10.0
## 0.0.65
### Patch Changes
- jazz-inspector@0.9.23
- jazz-react@0.9.23
- jazz-tools@0.9.23
## 0.0.64
### Patch Changes
- jazz-react@0.9.22
## 0.0.63
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-inspector@0.9.22
- jazz-react@0.9.21
## 0.0.62
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-inspector@0.9.21
- jazz-react@0.9.20
## 0.0.61
### Patch Changes
- jazz-inspector@0.9.20
- jazz-react@0.9.19
- jazz-tools@0.9.19
## 0.0.60
### Patch Changes
- Updated dependencies [2faf22f]
- jazz-inspector@0.9.19
## 0.0.59
### Patch Changes
- jazz-inspector@0.9.18
- jazz-react@0.9.18
- jazz-tools@0.9.18
## 0.0.58
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-inspector@0.9.17
- jazz-react@0.9.17
## 0.0.57 ## 0.0.57
### Patch Changes ### Patch Changes

View File

@@ -13,10 +13,6 @@ You can either
Create a new Jazz project, and use this example as a template. Create a new Jazz project, and use this example as a template.
```bash ```bash
npm create jazz-app@latest --example music-player --project-name music-player
```
or
```bash
npx create-jazz-app@latest --example music-player --project-name music-player npx create-jazz-app@latest --example music-player --project-name music-player
``` ```

View File

@@ -1,7 +1,7 @@
{ {
"name": "jazz-example-music-player", "name": "jazz-example-music-player",
"private": true, "private": true,
"version": "0.0.57", "version": "0.0.72",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -9,18 +9,21 @@
"format-and-lint": "biome check .", "format-and-lint": "biome check .",
"format-and-lint:fix": "biome check . --write", "format-and-lint:fix": "biome check . --write",
"preview": "vite preview", "preview": "vite preview",
"test": "playwright test", "test:e2e": "playwright test",
"test:ui": "playwright test --ui" "test:e2e:ui": "playwright test --ui"
}, },
"dependencies": { "dependencies": {
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-toast": "^1.1.4", "@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-tooltip": "^1.1.6",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"jazz-react": "workspace:0.9.16",
"jazz-tools": "workspace:0.9.16",
"jazz-inspector": "workspace:*", "jazz-inspector": "workspace:*",
"jazz-react": "workspace:0.10.6",
"jazz-tools": "workspace:0.10.6",
"lucide-react": "^0.274.0", "lucide-react": "^0.274.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
@@ -30,14 +33,14 @@
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.46.1", "@playwright/test": "^1.50.1",
"@types/react": "^18.3.12", "@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.3.2", "@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"postcss": "^8.4.27", "postcss": "^8.4.27",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"vite": "^5.4.10" "vite": "^6.0.11"
} }
} }

View File

@@ -36,6 +36,8 @@ export class MusicTrack extends CoMap {
*/ */
file = co.ref(FileStream); file = co.ref(FileStream);
waveform = co.ref(MusicTrackWaveform); waveform = co.ref(MusicTrackWaveform);
isExampleTrack = co.optional.boolean;
} }
export class MusicTrackWaveform extends CoMap { export class MusicTrackWaveform extends CoMap {
@@ -86,28 +88,20 @@ export class MusicaAccount extends Account {
* You can use it to set up the account root and any other initial CoValues you need. * You can use it to set up the account root and any other initial CoValues you need.
*/ */
migrate() { migrate() {
if (!this._refs.root) { if (this.root === undefined) {
const ownership = { owner: this }; const tracks = ListOfTracks.create([]);
const rootPlaylist = Playlist.create({
tracks,
title: "",
});
const tracks = ListOfTracks.create([], ownership); this.root = MusicaAccountRoot.create({
const rootPlaylist = Playlist.create( rootPlaylist,
{ playlists: ListOfPlaylists.create([]),
tracks, activeTrack: null,
title: "", activePlaylist: rootPlaylist,
}, exampleDataLoaded: false,
ownership, });
);
this.root = MusicaAccountRoot.create(
{
rootPlaylist,
playlists: ListOfPlaylists.create([], ownership),
activeTrack: null,
activePlaylist: rootPlaylist,
exampleDataLoaded: false,
},
ownership,
);
} }
} }
} }

View File

@@ -11,7 +11,9 @@ import { PlayerControls } from "./components/PlayerControls";
import "./index.css"; import "./index.css";
import { MusicaAccount } from "@/1_schema"; import { MusicaAccount } from "@/1_schema";
import { DemoAuthBasicUI, JazzProvider, useDemoAuth } from "jazz-react"; import { apiKey } from "@/apiKey.ts";
import { JazzProvider } from "jazz-react";
import { onAnonymousAccountDiscarded } from "./4_actions";
import { useUploadExampleData } from "./lib/useUploadExampleData"; import { useUploadExampleData } from "./lib/useUploadExampleData";
/** /**
@@ -54,30 +56,10 @@ function Main() {
); );
} }
function JazzAndAuth({ children }: { children: React.ReactNode }) { const peer =
const [auth, state] = useDemoAuth(); (new URL(window.location.href).searchParams.get(
"peer",
const peer = ) as `ws://${string}`) ?? `wss://cloud.jazz.tools/?key=${apiKey}`;
(new URL(window.location.href).searchParams.get(
"peer",
) as `ws://${string}`) ??
"wss://cloud.jazz.tools/?key=music-player-example-jazz@garden.co";
return (
<>
<JazzProvider
storage="indexedDB"
auth={auth}
peer={peer}
AccountSchema={MusicaAccount}
>
{children}
<JazzInspector />
</JazzProvider>
<DemoAuthBasicUI appName="Jazz Music Player" state={state} />
</>
);
}
declare module "jazz-react" { declare module "jazz-react" {
interface Register { interface Register {
@@ -87,8 +69,18 @@ declare module "jazz-react" {
ReactDOM.createRoot(document.getElementById("root")!).render( ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode> <React.StrictMode>
<JazzAndAuth> <JazzProvider
sync={{
peer,
when: "signedUp", // This makes the app work in local mode when the user is anonymous
}}
storage="indexedDB"
AccountSchema={MusicaAccount}
defaultProfileName="Anonymous unicorn"
onAnonymousAccountDiscarded={onAnonymousAccountDiscarded}
>
<Main /> <Main />
</JazzAndAuth> <JazzInspector />
</JazzProvider>
</React.StrictMode>, </React.StrictMode>,
); );

View File

@@ -1,12 +1,17 @@
import { useToast } from "@/hooks/use-toast"; import { useToast } from "@/hooks/use-toast";
import { createInviteLink, useAccount, useCoState } from "jazz-react"; import {
createInviteLink,
useAccount,
useCoState,
useIsAuthenticated,
} from "jazz-react";
import { ID } from "jazz-tools"; import { ID } from "jazz-tools";
import { useNavigate, useParams } from "react-router"; import { useNavigate, useParams } from "react-router";
import { Playlist } from "./1_schema"; import { Playlist } from "./1_schema";
import { createNewPlaylist, uploadMusicTracks } from "./4_actions"; import { createNewPlaylist, uploadMusicTracks } from "./4_actions";
import { MediaPlayer } from "./5_useMediaPlayer"; import { MediaPlayer } from "./5_useMediaPlayer";
import { AuthButton } from "./components/AuthButton";
import { FileUploadButton } from "./components/FileUploadButton"; import { FileUploadButton } from "./components/FileUploadButton";
import { LogoutButton } from "./components/LogoutButton";
import { MusicTrackRow } from "./components/MusicTrackRow"; import { MusicTrackRow } from "./components/MusicTrackRow";
import { PlaylistTitleInput } from "./components/PlaylistTitleInput"; import { PlaylistTitleInput } from "./components/PlaylistTitleInput";
import { SidePanel } from "./components/SidePanel"; import { SidePanel } from "./components/SidePanel";
@@ -66,6 +71,8 @@ export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
}); });
}; };
const isAuthenticated = useIsAuthenticated();
return ( return (
<div className="flex flex-col h-screen text-gray-800 bg-blue-50"> <div className="flex flex-col h-screen text-gray-800 bg-blue-50">
<div className="flex flex-1 overflow-hidden"> <div className="flex flex-1 overflow-hidden">
@@ -86,12 +93,12 @@ export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
<Button onClick={handleCreatePlaylist}>New playlist</Button> <Button onClick={handleCreatePlaylist}>New playlist</Button>
</> </>
)} )}
{!isRootPlaylist && ( {!isRootPlaylist && isAuthenticated && (
<Button onClick={handlePlaylistShareClick}> <Button onClick={handlePlaylistShareClick}>
Share playlist Share playlist
</Button> </Button>
)} )}
<LogoutButton /> <AuthButton />
</div> </div>
</div> </div>
<ul className="flex flex-col"> <ul className="flex flex-col">

View File

@@ -22,18 +22,18 @@ import {
* pattern that best fits your app. * pattern that best fits your app.
*/ */
export async function uploadMusicTracks(files: Iterable<File>) { export async function uploadMusicTracks(
const me = await MusicaAccount.getMe().ensureLoaded({ files: Iterable<File>,
isExampleTrack: boolean = false,
) {
const { root } = await MusicaAccount.getMe().ensureLoaded({
root: { root: {
rootPlaylist: { rootPlaylist: {
tracks: [], tracks: [],
}, },
playlists: [],
}, },
}); });
if (!me) return;
for (const file of files) { for (const file of files) {
// The ownership object defines the user that owns the created coValues // The ownership object defines the user that owns the created coValues
// We are creating a group for each CoValue in order to be able to share them via Playlist // We are creating a group for each CoValue in order to be able to share them via Playlist
@@ -52,25 +52,24 @@ export async function uploadMusicTracks(files: Iterable<File>) {
duration: data.duration, duration: data.duration,
waveform: MusicTrackWaveform.create({ data: data.waveform }, group), waveform: MusicTrackWaveform.create({ data: data.waveform }, group),
title: file.name, title: file.name,
isExampleTrack,
}, },
group, group,
); );
// The newly created musicTrack can be associated to the // The newly created musicTrack can be associated to the
// user track list using a simple push call // user track list using a simple push call
me.root.rootPlaylist.tracks.push(musicTrack); root.rootPlaylist.tracks.push(musicTrack);
} }
} }
export async function createNewPlaylist() { export async function createNewPlaylist() {
const me = await MusicaAccount.getMe().ensureLoaded({ const { root } = await MusicaAccount.getMe().ensureLoaded({
root: { root: {
playlists: [], playlists: [],
}, },
}); });
if (!me) throw new Error("Current playlist not resolved");
// Since playlists are meant to be shared we associate them // Since playlists are meant to be shared we associate them
// to a group which will contain the keys required to get // to a group which will contain the keys required to get
// access to the "owned" values // access to the "owned" values
@@ -86,7 +85,7 @@ export async function createNewPlaylist() {
// Again, we associate the new playlist to the // Again, we associate the new playlist to the
// user by pushing it into the playlists CoList // user by pushing it into the playlists CoList
me.root.playlists.push(playlist); root.playlists.push(playlist);
return playlist; return playlist;
} }
@@ -152,24 +151,49 @@ export async function updateMusicTrackTitle(track: MusicTrack, title: string) {
} }
export async function updateActivePlaylist(playlist?: Playlist) { export async function updateActivePlaylist(playlist?: Playlist) {
const me = await MusicaAccount.getMe().ensureLoaded({ const { root } = await MusicaAccount.getMe().ensureLoaded({
root: { root: {
activePlaylist: {}, activePlaylist: {},
rootPlaylist: {}, rootPlaylist: {},
}, },
}); });
if (!me) return; root.activePlaylist = playlist ?? root.rootPlaylist;
me.root.activePlaylist = playlist ?? me.root.rootPlaylist;
} }
export async function updateActiveTrack(track: MusicTrack) { export async function updateActiveTrack(track: MusicTrack) {
const me = await MusicaAccount.getMe().ensureLoaded({ const { root } = await MusicaAccount.getMe().ensureLoaded({
root: {}, root: {},
}); });
if (!me) return; root.activeTrack = track;
}
me.root.activeTrack = track;
export async function onAnonymousAccountDiscarded(
anonymousAccount: MusicaAccount,
) {
const { root: anonymousAccountRoot } = await anonymousAccount.ensureLoaded({
root: {
rootPlaylist: {
tracks: [{}],
},
},
});
const me = await MusicaAccount.getMe().ensureLoaded({
root: {
rootPlaylist: {
tracks: [],
},
},
});
for (const track of anonymousAccountRoot.rootPlaylist.tracks) {
if (track.isExampleTrack) continue;
const trackGroup = track._owner.castAs(Group);
trackGroup.addMember(me, "admin");
me.root.rootPlaylist.tracks.push(track);
}
} }

View File

@@ -19,8 +19,6 @@ export function InvitePage() {
}, },
}); });
if (!me) return;
if ( if (
playlist && playlist &&
!me.root.playlists.some((item) => playlist.id === item?.id) !me.root.playlists.some((item) => playlist.id === item?.id)

View File

@@ -0,0 +1 @@
export const apiKey = "music-player-example-jazz@garden.co";

View File

@@ -0,0 +1,40 @@
"use client";
import { Button } from "@/components/ui/button";
import { useAccount, useIsAuthenticated } from "jazz-react";
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import { AuthModal } from "./AuthModal";
export function AuthButton() {
const [open, setOpen] = useState(false);
const { logOut } = useAccount();
const navigate = useNavigate();
const isAuthenticated = useIsAuthenticated();
function handleSignOut() {
logOut();
navigate("/");
}
if (isAuthenticated) {
return (
<Button variant="outline" onClick={handleSignOut}>
Sign out
</Button>
);
}
return (
<>
<Button
onClick={() => setOpen(true)}
className="bg-white text-black hover:bg-gray-100"
>
Sign up
</Button>
<AuthModal open={open} onOpenChange={setOpen} />
</>
);
}

Some files were not shown because too many files have changed in this diff Show More