Compare commits
244 Commits
jazz-react
...
jazz-react
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae6f3a39c7 | ||
|
|
5d72d0a5a0 | ||
|
|
bb874490c5 | ||
|
|
a2c6d0cb16 | ||
|
|
fe6648b3a5 | ||
|
|
c1ab97d976 | ||
|
|
3cb27e11dd | ||
|
|
50f94c2b81 | ||
|
|
3937781246 | ||
|
|
44bcf6e411 | ||
|
|
b66206f1a6 | ||
|
|
973824795e | ||
|
|
f4974e5975 | ||
|
|
9099bbf75f | ||
|
|
e1a40b41eb | ||
|
|
9683e24237 | ||
|
|
0ff381b8d5 | ||
|
|
ef7931761a | ||
|
|
da30641856 | ||
|
|
01435dc20b | ||
|
|
506256e291 | ||
|
|
6bb0d38b26 | ||
|
|
397ff9ce09 | ||
|
|
df42b2b295 | ||
|
|
aae280b7da | ||
|
|
d1e4ee0fe4 | ||
|
|
7cfd47b7f3 | ||
|
|
c34ce695ea | ||
|
|
7666dc6da2 | ||
|
|
be3ac8aa63 | ||
|
|
b759668022 | ||
|
|
1ada04f6f4 | ||
|
|
f3455bc691 | ||
|
|
044f61e3d7 | ||
|
|
6d63f4cf2e | ||
|
|
b828f41cf0 | ||
|
|
14d24888e1 | ||
|
|
29bdb0a120 | ||
|
|
c7ec6baba8 | ||
|
|
f8cf198a27 | ||
|
|
720435e2f2 | ||
|
|
2dcf6925b4 | ||
|
|
55d49a3435 | ||
|
|
33d1c11909 | ||
|
|
02ee69672d | ||
|
|
743f7d068b | ||
|
|
c0a1bb272e | ||
|
|
a9f08ebbbe | ||
|
|
0d86b132ea | ||
|
|
5114bbec88 | ||
|
|
29deedb163 | ||
|
|
a322a0e3b5 | ||
|
|
4fea86141f | ||
|
|
d923d45a82 | ||
|
|
ff52fb3275 | ||
|
|
c65a8806f6 | ||
|
|
8c8a5b242a | ||
|
|
d020ee2825 | ||
|
|
2e2a13f22d | ||
|
|
b1056c2ed3 | ||
|
|
e00489d8ee | ||
|
|
1e08581049 | ||
|
|
5a5f886bdf | ||
|
|
e5c575ec10 | ||
|
|
68c2b2598e | ||
|
|
c0ba15cca8 | ||
|
|
3e0493f88f | ||
|
|
e511d6d56a | ||
|
|
53f4b23c0a | ||
|
|
749a424cf1 | ||
|
|
33c4ef902d | ||
|
|
e2e3751172 | ||
|
|
6c62f4be5d | ||
|
|
0a2fae3830 | ||
|
|
4ab533af6b | ||
|
|
0fa017d148 | ||
|
|
99cda2f33d | ||
|
|
7c4f519ca1 | ||
|
|
e4fcafd576 | ||
|
|
a9cff03bcb | ||
|
|
26324d4b1e | ||
|
|
bd022ffd5e | ||
|
|
94e3922efc | ||
|
|
dcc9c2e376 | ||
|
|
48edcaff37 | ||
|
|
a18ed077ca | ||
|
|
7780346208 | ||
|
|
699553fe9f | ||
|
|
bdd5ad7eb1 | ||
|
|
28fea37446 | ||
|
|
61915fe3ed | ||
|
|
a6942030d4 | ||
|
|
905c6b312b | ||
|
|
1a4bda09ca | ||
|
|
815f54fafb | ||
|
|
fc845cc930 | ||
|
|
0e6ea3f762 | ||
|
|
f0060e0355 | ||
|
|
9e9788395c | ||
|
|
6371c7689f | ||
|
|
605734c71c | ||
|
|
db5227b463 | ||
|
|
7ed748a0f6 | ||
|
|
8492dd9501 | ||
|
|
b957085e02 | ||
|
|
75fdff431a | ||
|
|
a5559529ae | ||
|
|
2c74fdaa71 | ||
|
|
2b16a97f7a | ||
|
|
e5f135b82a | ||
|
|
0fa0cb2338 | ||
|
|
7e7b6b981a | ||
|
|
f762afd361 | ||
|
|
63d46c985c | ||
|
|
e5b89e2f96 | ||
|
|
eae724a9f3 | ||
|
|
b14eb2106a | ||
|
|
379e56efe9 | ||
|
|
caf682fecd | ||
|
|
2f6d3ac8e6 | ||
|
|
ed80b52ad3 | ||
|
|
a64690e5f3 | ||
|
|
3bcacecbad | ||
|
|
01e3e8a954 | ||
|
|
9adcfc2cd9 | ||
|
|
738bf3a1bb | ||
|
|
59d37df8a2 | ||
|
|
8b63994048 | ||
|
|
f1a7478331 | ||
|
|
a713d4ad51 | ||
|
|
f33aa5c28a | ||
|
|
2ec7e5f287 | ||
|
|
e7d96c9c76 | ||
|
|
c1e49fe727 | ||
|
|
812b13ecbd | ||
|
|
0e6eb7a592 | ||
|
|
9f8506fe76 | ||
|
|
f62f227e14 | ||
|
|
3e17c0e221 | ||
|
|
1af61c8895 | ||
|
|
0c781d28f7 | ||
|
|
a93db84530 | ||
|
|
b529ae3c55 | ||
|
|
a6780401b5 | ||
|
|
b7ef6db1f6 | ||
|
|
9d089ab94f | ||
|
|
3b7a5c0e9d | ||
|
|
7dc2a2828e | ||
|
|
ea93cacd45 | ||
|
|
162da453ca | ||
|
|
e17e959307 | ||
|
|
0d43b2edbc | ||
|
|
9b220b17de | ||
|
|
d4a1aab5d5 | ||
|
|
32b258a966 | ||
|
|
6846f74bc5 | ||
|
|
5fc3e7b700 | ||
|
|
6a799b0d65 | ||
|
|
0a88aeb5a9 | ||
|
|
28ae36391b | ||
|
|
cf5c636fdd | ||
|
|
3f04b75418 | ||
|
|
6a7047f862 | ||
|
|
640559c56f | ||
|
|
9ef6264ff3 | ||
|
|
2ac09180a5 | ||
|
|
588129b311 | ||
|
|
0c95d4af0b | ||
|
|
807846ae79 | ||
|
|
b92b17340e | ||
|
|
0f3d239500 | ||
|
|
eec30fbcdf | ||
|
|
f382656d77 | ||
|
|
4d8a6400e0 | ||
|
|
cf5bd53dbb | ||
|
|
66a30e8041 | ||
|
|
a4d2f2dd26 | ||
|
|
5724735a95 | ||
|
|
5f9c018106 | ||
|
|
24c018f1f2 | ||
|
|
6f745be39a | ||
|
|
29703797cf | ||
|
|
2241ad4089 | ||
|
|
aed769f7b3 | ||
|
|
d348c2d021 | ||
|
|
e5f68904ed | ||
|
|
0aebbdc2fc | ||
|
|
665a099013 | ||
|
|
c70131aece | ||
|
|
d78f590712 | ||
|
|
7033ae968f | ||
|
|
124bf670a2 | ||
|
|
f4acb91d51 | ||
|
|
47a5047ec8 | ||
|
|
877596f389 | ||
|
|
6902b5bb91 | ||
|
|
e914f11d9e | ||
|
|
1a0cd3df7f | ||
|
|
d9a78739a5 | ||
|
|
756528e18e | ||
|
|
466e587fba | ||
|
|
22caae870d | ||
|
|
435fc0c917 | ||
|
|
3dfce294d4 | ||
|
|
90be185094 | ||
|
|
9eac8633b5 | ||
|
|
007c462362 | ||
|
|
e442bb820b | ||
|
|
3f7235c6f7 | ||
|
|
56d94bd8cd | ||
|
|
cb937c4335 | ||
|
|
b4e31657a0 | ||
|
|
f6bf75890a | ||
|
|
5bb1ad4c42 | ||
|
|
3ed74b6b1d | ||
|
|
823a343fe1 | ||
|
|
5b3c3fff7b | ||
|
|
e3f1c49fdd | ||
|
|
42765020e5 | ||
|
|
6cc7a905f8 | ||
|
|
75753f1d37 | ||
|
|
6c113e7bf0 | ||
|
|
53a74e1b7d | ||
|
|
c63b538251 | ||
|
|
f8c3b495e0 | ||
|
|
a05d90dc6b | ||
|
|
307e7fcd3c | ||
|
|
d0ff589447 | ||
|
|
f6cb4f1225 | ||
|
|
1141a23a37 | ||
|
|
05497d5f77 | ||
|
|
bb126009c8 | ||
|
|
cee7beb02a | ||
|
|
5f12e31a80 | ||
|
|
5f96a6fef2 | ||
|
|
08db39ef2f | ||
|
|
67029e00c7 | ||
|
|
2b520e938e | ||
|
|
63568273db | ||
|
|
16702702c8 | ||
|
|
cab4f1f89c | ||
|
|
45df82ed16 | ||
|
|
b38f902d70 | ||
|
|
a6085094a7 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -16,3 +16,5 @@ coverage
|
|||||||
test-results
|
test-results
|
||||||
|
|
||||||
.husky
|
.husky
|
||||||
|
|
||||||
|
.vscode/settings.json
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"editor.defaultFormatter": "biomejs.biome"
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,94 @@
|
|||||||
# @jazz-e2e/binarycostream
|
# @jazz-e2e/binarycostream
|
||||||
|
|
||||||
|
## 0.0.110
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.109
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- cojson@0.8.32
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.108
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [e511d6d]
|
||||||
|
- cojson@0.8.31
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.107
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [0a2fae3]
|
||||||
|
- Updated dependencies [99cda2f]
|
||||||
|
- cojson@0.8.30
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.106
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [dcc9c2e]
|
||||||
|
- Updated dependencies [699553f]
|
||||||
|
- cojson@0.8.29
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.105
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [605734c]
|
||||||
|
- cojson@0.8.28
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.104
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [75fdff4]
|
||||||
|
- cojson@0.8.27
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.103
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.102
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.101
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [6f745be]
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [124bf67]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- cojson@0.8.23
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
|
||||||
## 0.0.100
|
## 0.0.100
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<link rel="icon" type="image/png" href="/jazz-logo.png" />
|
<link rel="icon" type="image/png" href="/jazz-logo.png" />
|
||||||
<link rel="stylesheet" href="/src/index.css" />
|
<link rel="stylesheet" href="/src/index.css" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Jazz BinaryCoStream Tests</title>
|
<title>Jazz FileStream Tests</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@jazz-e2e/binarycostream",
|
"name": "@jazz-e2e/filestream",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.100",
|
"version": "0.0.110",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
"test:ui": "playwright test --ui"
|
"test:ui": "playwright test --ui"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cojson": "workspace:0.8.21",
|
"cojson": "workspace:0.8.32",
|
||||||
"hash-slash": "workspace:0.2.1",
|
"hash-slash": "workspace:0.2.1",
|
||||||
"is-ci": "^3.0.1",
|
"is-ci": "^3.0.1",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
import { Account, BinaryCoStream, ID } from "jazz-tools";
|
import { Account, FileStream, ID } from "jazz-tools";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useAccount, useCoState } from "./jazz";
|
import { useAccount, useCoState } from "./jazz";
|
||||||
import { waitForCoValue } from "./lib/waitForCoValue";
|
|
||||||
import { UploadedFile } from "./schema";
|
import { UploadedFile } from "./schema";
|
||||||
|
|
||||||
async function getUploadedFile(me: Account, uploadedFileId: ID<UploadedFile>) {
|
async function getUploadedFile(me: Account, uploadedFileId: ID<UploadedFile>) {
|
||||||
const uploadedFile = await waitForCoValue(
|
const uploadedFile = await UploadedFile.load(uploadedFileId, me, {});
|
||||||
UploadedFile,
|
|
||||||
uploadedFileId,
|
if (!uploadedFile) {
|
||||||
me,
|
throw new Error("Uploaded file not found");
|
||||||
Boolean,
|
}
|
||||||
{},
|
|
||||||
);
|
|
||||||
|
|
||||||
uploadedFile.coMapDownloaded = true;
|
uploadedFile.coMapDownloaded = true;
|
||||||
|
|
||||||
await BinaryCoStream.loadAsBlob(uploadedFile._refs.file.id, me);
|
await FileStream.loadAsBlob(uploadedFile._refs.file.id, me);
|
||||||
|
|
||||||
return uploadedFile;
|
return uploadedFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Account, BinaryCoStream, Group } from "jazz-tools";
|
import { Account, FileStream, Group } from "jazz-tools";
|
||||||
import { UploadedFile } from "../schema";
|
import { UploadedFile } from "../schema";
|
||||||
|
|
||||||
export async function generateTestFile(me: Account, bytes: number) {
|
export async function generateTestFile(me: Account, bytes: number) {
|
||||||
@@ -8,7 +8,7 @@ export async function generateTestFile(me: Account, bytes: number) {
|
|||||||
const ownership = { owner: group };
|
const ownership = { owner: group };
|
||||||
const testFile = UploadedFile.create(
|
const testFile = UploadedFile.create(
|
||||||
{
|
{
|
||||||
file: await BinaryCoStream.createFromBlob(
|
file: await FileStream.createFromBlob(
|
||||||
new Blob(["1".repeat(bytes)], { type: "image/png" }),
|
new Blob(["1".repeat(bytes)], { type: "image/png" }),
|
||||||
ownership,
|
ownership,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BinaryCoStream, CoMap, co } from "jazz-tools";
|
import { CoMap, FileStream, co } from "jazz-tools";
|
||||||
|
|
||||||
export class UploadedFile extends CoMap {
|
export class UploadedFile extends CoMap {
|
||||||
file = co.ref(BinaryCoStream);
|
file = co.ref(FileStream);
|
||||||
syncCompleted = co.boolean;
|
syncCompleted = co.boolean;
|
||||||
coMapDownloaded = co.boolean;
|
coMapDownloaded = co.boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,94 @@
|
|||||||
# @jazz-e2e/covalues
|
# @jazz-e2e/covalues
|
||||||
|
|
||||||
|
## 0.0.109
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.108
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- cojson@0.8.32
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.107
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [e511d6d]
|
||||||
|
- cojson@0.8.31
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.106
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [0a2fae3]
|
||||||
|
- Updated dependencies [99cda2f]
|
||||||
|
- cojson@0.8.30
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.105
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [dcc9c2e]
|
||||||
|
- Updated dependencies [699553f]
|
||||||
|
- cojson@0.8.29
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.104
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [605734c]
|
||||||
|
- cojson@0.8.28
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.103
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [75fdff4]
|
||||||
|
- cojson@0.8.27
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.102
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.101
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.100
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [6f745be]
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [124bf67]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- cojson@0.8.23
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
|
||||||
## 0.0.99
|
## 0.0.99
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@jazz-e2e/covalues",
|
"name": "@jazz-e2e/covalues",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.99",
|
"version": "0.0.109",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ReactDOM from "react-dom/client";
|
|||||||
import { RouterProvider, createBrowserRouter } from "react-router-dom";
|
import { RouterProvider, createBrowserRouter } from "react-router-dom";
|
||||||
import { AuthAndJazz } from "./jazz";
|
import { AuthAndJazz } from "./jazz";
|
||||||
import { ResumeSyncState } from "./pages/ResumeSyncState";
|
import { ResumeSyncState } from "./pages/ResumeSyncState";
|
||||||
|
import { RetryUnavailable } from "./pages/RetryUnavailable";
|
||||||
import { TestInput } from "./pages/TestInput";
|
import { TestInput } from "./pages/TestInput";
|
||||||
|
|
||||||
const router = createBrowserRouter([
|
const router = createBrowserRouter([
|
||||||
@@ -14,6 +15,10 @@ const router = createBrowserRouter([
|
|||||||
path: "/resume-sync",
|
path: "/resume-sync",
|
||||||
element: <ResumeSyncState />,
|
element: <ResumeSyncState />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/retry-unavailable",
|
||||||
|
element: <RetryUnavailable />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
element: <TestInput />,
|
element: <TestInput />,
|
||||||
|
|||||||
46
e2e/CoValues/src/pages/RetryUnavailable.tsx
Normal file
46
e2e/CoValues/src/pages/RetryUnavailable.tsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import { CoMap, Group, ID, co } from "jazz-tools";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { useAccount, useCoState } from "../jazz";
|
||||||
|
|
||||||
|
export class RetryUnavailableCoMap extends CoMap {
|
||||||
|
value = co.string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIdParam() {
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
return (url.searchParams.get("id") as ID<RetryUnavailableCoMap>) ?? undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RetryUnavailable() {
|
||||||
|
const [id, setId] = useState(getIdParam);
|
||||||
|
const coMap = useCoState(RetryUnavailableCoMap, id);
|
||||||
|
const { me } = useAccount();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (id) {
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
url.searchParams.set("id", id);
|
||||||
|
history.pushState({}, "", url.toString());
|
||||||
|
}
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
const createCoMap = () => {
|
||||||
|
if (!me || id) return;
|
||||||
|
|
||||||
|
const group = Group.create({ owner: me });
|
||||||
|
|
||||||
|
group.addMember("everyone", "writer");
|
||||||
|
|
||||||
|
setId(
|
||||||
|
RetryUnavailableCoMap.create({ value: "Hello!" }, { owner: group }).id,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h1>Retry Unavailable</h1>
|
||||||
|
<p data-testid="id">{coMap?.id}</p>
|
||||||
|
<button onClick={createCoMap}>Create a new value!</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
34
e2e/CoValues/tests/RetryUnavailable.test.ts
Normal file
34
e2e/CoValues/tests/RetryUnavailable.test.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { setTimeout } from "node:timers/promises";
|
||||||
|
import { expect, test } from "@playwright/test";
|
||||||
|
|
||||||
|
test.describe("Retry unavailable states", () => {
|
||||||
|
test("should retry unavailable values", async ({ page, browser }) => {
|
||||||
|
const context = page.context();
|
||||||
|
|
||||||
|
await page.goto("/retry-unavailable?userName=SuperMario");
|
||||||
|
|
||||||
|
await context.setOffline(true);
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: "Create a new value!" }).click();
|
||||||
|
|
||||||
|
const id = await page.getByTestId("id").textContent();
|
||||||
|
|
||||||
|
// Create a new incognito instance and try to load the coValue
|
||||||
|
const newUserPage = await (await browser.newContext()).newPage();
|
||||||
|
await newUserPage.goto(`/retry-unavailable?userName=Luigi&id=${id}`);
|
||||||
|
|
||||||
|
await expect(newUserPage.getByTestId("id")).toBeInViewport({
|
||||||
|
timeout: 20_000,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Make the load fail at least twice
|
||||||
|
await setTimeout(1000);
|
||||||
|
|
||||||
|
// Go back online, the value should be uploaded
|
||||||
|
await context.setOffline(false);
|
||||||
|
|
||||||
|
await expect(newUserPage.getByTestId("id")).toHaveText(id ?? "", {
|
||||||
|
timeout: 20_000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,5 +1,86 @@
|
|||||||
# jazz-example-book-shelf
|
# jazz-example-book-shelf
|
||||||
|
|
||||||
|
## 0.1.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser-media-images@0.8.33
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.1.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
- jazz-browser-media-images@0.8.32
|
||||||
|
|
||||||
|
## 0.1.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
- jazz-browser-media-images@0.8.31
|
||||||
|
|
||||||
|
## 0.1.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
- jazz-browser-media-images@0.8.30
|
||||||
|
|
||||||
|
## 0.1.21
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
- jazz-browser-media-images@0.8.29
|
||||||
|
|
||||||
|
## 0.1.20
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
- jazz-browser-media-images@0.8.28
|
||||||
|
|
||||||
|
## 0.1.19
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
- jazz-browser-media-images@0.8.27
|
||||||
|
|
||||||
|
## 0.1.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.1.17
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser-media-images@0.8.24
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.1.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
- jazz-browser-media-images@0.8.23
|
||||||
|
|
||||||
## 0.1.15
|
## 0.1.15
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-book-shelf",
|
"name": "jazz-example-book-shelf",
|
||||||
"version": "0.1.15",
|
"version": "0.1.25",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@@ -11,9 +11,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"jazz-browser-media-images": "workspace:0.8.22",
|
"jazz-browser-media-images": "workspace:0.8.33",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"next": "14.2.5",
|
"next": "14.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
|
|||||||
@@ -1,5 +1,105 @@
|
|||||||
# jazz-example-chat
|
# jazz-example-chat
|
||||||
|
|
||||||
|
## 0.0.109
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
- jazz-react-auth-clerk@0.8.33
|
||||||
|
|
||||||
|
## 0.0.108
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- Updated dependencies [1a4bda0]
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- cojson@0.8.32
|
||||||
|
- jazz-react-auth-clerk@0.8.32
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.107
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [e511d6d]
|
||||||
|
- cojson@0.8.31
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-react-auth-clerk@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.106
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [0a2fae3]
|
||||||
|
- Updated dependencies [99cda2f]
|
||||||
|
- cojson@0.8.30
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-react-auth-clerk@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.105
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [dcc9c2e]
|
||||||
|
- Updated dependencies [699553f]
|
||||||
|
- cojson@0.8.29
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-react-auth-clerk@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.104
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [605734c]
|
||||||
|
- cojson@0.8.28
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-react-auth-clerk@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.103
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [75fdff4]
|
||||||
|
- cojson@0.8.27
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-react-auth-clerk@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.102
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
- jazz-react-auth-clerk@0.8.26
|
||||||
|
|
||||||
|
## 0.0.101
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
- jazz-react-auth-clerk@0.8.24
|
||||||
|
|
||||||
|
## 0.0.100
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [6f745be]
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [124bf67]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- cojson@0.8.23
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
- jazz-react-auth-clerk@0.8.23
|
||||||
|
|
||||||
## 0.0.99
|
## 0.0.99
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-chat-clerk",
|
"name": "jazz-example-chat-clerk",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.99",
|
"version": "0.0.109",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -17,11 +17,11 @@
|
|||||||
"@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.8.21",
|
"cojson": "workspace:0.8.32",
|
||||||
"hash-slash": "workspace:0.2.1",
|
"hash-slash": "workspace:0.2.1",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-react-auth-clerk": "workspace:0.8.22",
|
"jazz-react-auth-clerk": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
|||||||
{state.errors.map((error) => (
|
{state.errors.map((error) => (
|
||||||
<div key={error}>{error}</div>
|
<div key={error}>{error}</div>
|
||||||
))}
|
))}
|
||||||
{auth ? (
|
{clerk.user && auth ? (
|
||||||
<Jazz.Provider
|
<Jazz.Provider
|
||||||
auth={auth}
|
auth={auth}
|
||||||
peer="wss://cloud.jazz.tools/?key=chat-example-jazz-clerk@gcmp.io"
|
peer="wss://cloud.jazz.tools/?key=chat-example-jazz-clerk@gcmp.io"
|
||||||
|
|||||||
@@ -1,5 +1,91 @@
|
|||||||
# chat-rn-clerk
|
# chat-rn-clerk
|
||||||
|
|
||||||
|
## 1.0.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.33
|
||||||
|
|
||||||
|
## 1.0.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [1a4bda0]
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-react-auth-clerk@0.8.32
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react-native@0.8.32
|
||||||
|
- jazz-react-native-media-images@0.8.24
|
||||||
|
|
||||||
|
## 1.0.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.31
|
||||||
|
- jazz-react-native@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
- jazz-react-native-media-images@0.8.23
|
||||||
|
|
||||||
|
## 1.0.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.30
|
||||||
|
- jazz-react-native@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
- jazz-react-native-media-images@0.8.22
|
||||||
|
|
||||||
|
## 1.0.21
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.8.29
|
||||||
|
- jazz-react-auth-clerk@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
- jazz-react-native-media-images@0.8.21
|
||||||
|
|
||||||
|
## 1.0.20
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.28
|
||||||
|
- jazz-react-native@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
- jazz-react-native-media-images@0.8.20
|
||||||
|
|
||||||
|
## 1.0.19
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.27
|
||||||
|
- jazz-react-native@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
- jazz-react-native-media-images@0.8.19
|
||||||
|
|
||||||
|
## 1.0.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.26
|
||||||
|
|
||||||
|
## 1.0.17
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-auth-clerk@0.8.24
|
||||||
|
|
||||||
|
## 1.0.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react-auth-clerk@0.8.23
|
||||||
|
- jazz-react-native@0.8.23
|
||||||
|
- jazz-react-native-media-images@0.8.18
|
||||||
|
|
||||||
## 1.0.15
|
## 1.0.15
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-rn-clerk",
|
"name": "chat-rn-clerk",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"version": "1.0.15",
|
"version": "1.0.25",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "expo export -p ios",
|
"build": "expo export -p ios",
|
||||||
"start": "expo start",
|
"start": "expo start",
|
||||||
|
|||||||
@@ -1,5 +1,58 @@
|
|||||||
# chat-rn
|
# chat-rn
|
||||||
|
|
||||||
|
## 1.0.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react-native@0.8.32
|
||||||
|
|
||||||
|
## 1.0.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 1.0.21
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 1.0.20
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 1.0.19
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 1.0.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 1.0.17
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react-native@0.8.23
|
||||||
|
|
||||||
## 1.0.16
|
## 1.0.16
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-rn",
|
"name": "chat-rn",
|
||||||
"version": "1.0.16",
|
"version": "1.0.23",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "expo export -p ios",
|
"build": "expo export -p ios",
|
||||||
|
|||||||
@@ -1,5 +1,81 @@
|
|||||||
# chat-vue
|
# chat-vue
|
||||||
|
|
||||||
|
## 0.0.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [3cb27e1]
|
||||||
|
- jazz-browser@0.8.33
|
||||||
|
- jazz-vue@0.8.21
|
||||||
|
|
||||||
|
## 0.0.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-browser@0.8.32
|
||||||
|
- jazz-vue@0.8.20
|
||||||
|
|
||||||
|
## 0.0.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
- jazz-vue@0.8.19
|
||||||
|
|
||||||
|
## 0.0.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
- jazz-vue@0.8.18
|
||||||
|
|
||||||
|
## 0.0.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
- jazz-vue@0.8.17
|
||||||
|
|
||||||
|
## 0.0.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
- jazz-vue@0.8.16
|
||||||
|
|
||||||
|
## 0.0.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
- jazz-vue@0.8.15
|
||||||
|
|
||||||
|
## 0.0.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.24
|
||||||
|
- jazz-vue@0.8.14
|
||||||
|
|
||||||
|
## 0.0.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [e442bb8]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-browser@0.8.23
|
||||||
|
- jazz-vue@0.8.13
|
||||||
|
|
||||||
## 0.0.7
|
## 0.0.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-vue",
|
"name": "chat-vue",
|
||||||
"version": "0.0.7",
|
"version": "0.0.16",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,95 @@
|
|||||||
# jazz-example-chat
|
# jazz-example-chat
|
||||||
|
|
||||||
|
## 0.0.111
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.110
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- cojson@0.8.32
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.109
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [e511d6d]
|
||||||
|
- cojson@0.8.31
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.108
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [0a2fae3]
|
||||||
|
- Updated dependencies [99cda2f]
|
||||||
|
- cojson@0.8.30
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.107
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [dcc9c2e]
|
||||||
|
- Updated dependencies [699553f]
|
||||||
|
- cojson@0.8.29
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.106
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [605734c]
|
||||||
|
- cojson@0.8.28
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.105
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [75fdff4]
|
||||||
|
- cojson@0.8.27
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.104
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 59d37df: add autologin option to DemoAuth to skip login
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.103
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.102
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [6f745be]
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [124bf67]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- cojson@0.8.23
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
|
||||||
## 0.0.101
|
## 0.0.101
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-chat",
|
"name": "jazz-example-chat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.101",
|
"version": "0.0.111",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
"@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.8.21",
|
"cojson": "workspace:0.8.32",
|
||||||
"hash-slash": "workspace:0.2.1",
|
"hash-slash": "workspace:0.2.1",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inIframe, onChatLoad } from "@/util.ts";
|
||||||
import { useIframeHashRouter } from "hash-slash";
|
import { useIframeHashRouter } from "hash-slash";
|
||||||
import { Group, ID } from "jazz-tools";
|
import { Group, ID } from "jazz-tools";
|
||||||
import { ChatScreen } from "./chatScreen.tsx";
|
import { ChatScreen } from "./chatScreen.tsx";
|
||||||
@@ -15,12 +16,16 @@ export function App() {
|
|||||||
group.addMember("everyone", "writer");
|
group.addMember("everyone", "writer");
|
||||||
const chat = Chat.create([], { owner: group });
|
const chat = Chat.create([], { owner: group });
|
||||||
router.navigate("/#/chat/" + chat.id);
|
router.navigate("/#/chat/" + chat.id);
|
||||||
|
|
||||||
|
// for https://jazz.tools marketing site demo only
|
||||||
|
onChatLoad(chat, me);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppContainer>
|
<AppContainer>
|
||||||
<TopBar>
|
<TopBar>
|
||||||
<p>{me?.profile?.name}</p> · <button onClick={logOut}>Log out</button>
|
<p>{me?.profile?.name}</p>
|
||||||
|
{!inIframe && <button onClick={logOut}>Log out</button>}
|
||||||
</TopBar>
|
</TopBar>
|
||||||
{router.route({
|
{router.route({
|
||||||
"/": () => createChat() as never,
|
"/": () => createChat() as never,
|
||||||
|
|||||||
@@ -48,10 +48,11 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
|||||||
|
|
||||||
function ChatBubble(props: { msg: Message }) {
|
function ChatBubble(props: { msg: Message }) {
|
||||||
const lastEdit = props.msg._edits.text;
|
const lastEdit = props.msg._edits.text;
|
||||||
|
const fromMe = lastEdit.by?.isMe;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BubbleContainer fromMe={lastEdit.by?.isMe}>
|
<BubbleContainer fromMe={fromMe}>
|
||||||
<BubbleBody>{props.msg.text}</BubbleBody>
|
<BubbleBody fromMe={fromMe}>{props.msg.text}</BubbleBody>
|
||||||
<BubbleInfo by={lastEdit.by?.profile?.name} madeAt={lastEdit.madeAt} />
|
<BubbleInfo by={lastEdit.by?.profile?.name} madeAt={lastEdit.madeAt} />
|
||||||
</BubbleContainer>
|
</BubbleContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import clsx from "clsx";
|
||||||
import { useId } from "react";
|
import { useId } from "react";
|
||||||
|
|
||||||
export function AppContainer(props: { children: React.ReactNode }) {
|
export function AppContainer(props: { children: React.ReactNode }) {
|
||||||
@@ -10,7 +11,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-end gap-1 text-xs 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-800">
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -29,7 +30,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 md:text-xl">
|
<div className="h-full text-base text-stone-500 flex items-center justify-center px-3 text-lg md:text-2xl">
|
||||||
Start a conversation below.
|
Start a conversation below.
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -41,15 +42,26 @@ export function BubbleContainer(props: {
|
|||||||
}) {
|
}) {
|
||||||
const align = props.fromMe ? "items-end" : "items-start";
|
const align = props.fromMe ? "items-end" : "items-start";
|
||||||
return (
|
return (
|
||||||
<div className={`${align} flex flex-col m-2`} role="row">
|
<div className={`${align} flex flex-col m-3`} role="row">
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BubbleBody(props: { children: React.ReactNode }) {
|
export function BubbleBody(props: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
fromMe: boolean | undefined;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="rounded-2xl text-sm line-clamp-10 text-ellipsis bg-white max-w-full whitespace-pre-wrap dark:bg-stone-700 dark:text-white py-1 px-3 shadow-sm">
|
<div
|
||||||
|
className={clsx(
|
||||||
|
"line-clamp-10 text-ellipsis whitespace-pre-wrap",
|
||||||
|
"rounded-2xl max-w-full py-1 px-3 shadow-sm",
|
||||||
|
props.fromMe
|
||||||
|
? "bg-white dark:bg-stone-700 dark:text-white"
|
||||||
|
: "bg-blue text-white",
|
||||||
|
)}
|
||||||
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -73,7 +85,7 @@ export function ChatInput(props: { onSubmit: (text: string) => void }) {
|
|||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id={inputId}
|
id={inputId}
|
||||||
className="rounded-full py-2 px-4 text-sm border block w-full dark:bg-black dark:text-white dark:border-stone-700"
|
className="rounded-full py-2 px-4 border block w-full dark:bg-black dark:text-white dark:border-stone-700"
|
||||||
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 }) => {
|
||||||
|
|||||||
27
examples/chat/src/util.ts
Normal file
27
examples/chat/src/util.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// This is only for demo purposes for https://jazz.tools
|
||||||
|
// This is NOT needed to make the chat work
|
||||||
|
|
||||||
|
import { Chat } from "@/schema.ts";
|
||||||
|
import { Account, CoValue, ID } from "jazz-tools";
|
||||||
|
|
||||||
|
export function waitForUpload(id: ID<CoValue>, me: Account) {
|
||||||
|
const syncManager = me._raw.core.node.syncManager;
|
||||||
|
const peers = syncManager.getPeers();
|
||||||
|
|
||||||
|
return Promise.all(
|
||||||
|
peers.map((peer) => syncManager.waitForUploadIntoPeer(peer.id, id)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function onChatLoad(chat: Chat, me: Account) {
|
||||||
|
if (window.parent) {
|
||||||
|
waitForUpload(chat.id, me).then(() => {
|
||||||
|
window.parent.postMessage(
|
||||||
|
{ type: "chat-load", id: "/chat/" + chat.id },
|
||||||
|
"*",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const inIframe = window.self !== window.top;
|
||||||
@@ -16,6 +16,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
colors: {
|
||||||
|
blue: {
|
||||||
|
700: "#3313F7",
|
||||||
|
DEFAULT: "#3313F7",
|
||||||
|
},
|
||||||
border: "hsl(var(--border))",
|
border: "hsl(var(--border))",
|
||||||
input: "hsl(var(--input))",
|
input: "hsl(var(--input))",
|
||||||
ring: "hsl(var(--ring))",
|
ring: "hsl(var(--ring))",
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ export class ChatPage {
|
|||||||
await this.messageInput.press("Enter");
|
await this.messageInput.press("Enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
async expectLoaded() {
|
|
||||||
await expect(this.messageInput).toBeVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
async expectMessageRow(message: string) {
|
async expectMessageRow(message: string) {
|
||||||
await expect(this.page.getByText(message)).toBeVisible();
|
await expect(this.page.getByText(message)).toBeVisible();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,64 @@
|
|||||||
# jazz-example-inspector
|
# jazz-example-inspector
|
||||||
|
|
||||||
|
## 0.0.80
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- cojson@0.8.32
|
||||||
|
- cojson-transport-ws@0.8.32
|
||||||
|
|
||||||
|
## 0.0.79
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [e511d6d]
|
||||||
|
- cojson@0.8.31
|
||||||
|
- cojson-transport-ws@0.8.31
|
||||||
|
|
||||||
|
## 0.0.78
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [0a2fae3]
|
||||||
|
- Updated dependencies [99cda2f]
|
||||||
|
- cojson@0.8.30
|
||||||
|
- cojson-transport-ws@0.8.30
|
||||||
|
|
||||||
|
## 0.0.77
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [dcc9c2e]
|
||||||
|
- Updated dependencies [699553f]
|
||||||
|
- cojson-transport-ws@0.8.29
|
||||||
|
- cojson@0.8.29
|
||||||
|
|
||||||
|
## 0.0.76
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [605734c]
|
||||||
|
- cojson@0.8.28
|
||||||
|
- cojson-transport-ws@0.8.28
|
||||||
|
|
||||||
|
## 0.0.75
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [75fdff4]
|
||||||
|
- cojson@0.8.27
|
||||||
|
- cojson-transport-ws@0.8.27
|
||||||
|
|
||||||
|
## 0.0.74
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [6f745be]
|
||||||
|
- Updated dependencies [124bf67]
|
||||||
|
- cojson@0.8.23
|
||||||
|
- cojson-transport-ws@0.8.23
|
||||||
|
|
||||||
## 0.0.73
|
## 0.0.73
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-inspector",
|
"name": "jazz-inspector",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.73",
|
"version": "0.0.80",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
"@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.8.21",
|
"cojson": "workspace:0.8.32",
|
||||||
"cojson-transport-ws": "workspace:0.8.21",
|
"cojson-transport-ws": "workspace:0.8.32",
|
||||||
"hash-slash": "workspace:0.2.1",
|
"hash-slash": "workspace:0.2.1",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
|
|||||||
1
examples/minimal-auth-clerk/.env
Normal file
1
examples/minimal-auth-clerk/.env
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VITE_CLERK_PUBLISHABLE_KEY=pk_test_ZXZpZGVudC1kYW5lLTg5LmNsZXJrLmFjY291bnRzLmRldiQ
|
||||||
24
examples/minimal-auth-clerk/.gitignore
vendored
Normal file
24
examples/minimal-auth-clerk/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
84
examples/minimal-auth-clerk/CHANGELOG.md
Normal file
84
examples/minimal-auth-clerk/CHANGELOG.md
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# minimal-auth-clerk
|
||||||
|
|
||||||
|
## 0.0.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
- jazz-react-auth-clerk@0.8.33
|
||||||
|
|
||||||
|
## 0.0.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [1a4bda0]
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-react-auth-clerk@0.8.32
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-react-auth-clerk@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-react-auth-clerk@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-react-auth-clerk@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-react-auth-clerk@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-react-auth-clerk@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
- jazz-react-auth-clerk@0.8.26
|
||||||
|
|
||||||
|
## 0.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
- jazz-react-auth-clerk@0.8.24
|
||||||
|
|
||||||
|
## 0.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
- jazz-react-auth-clerk@0.8.23
|
||||||
3
examples/minimal-auth-clerk/README.md
Normal file
3
examples/minimal-auth-clerk/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Minimal Jazz Auth Clerk Example
|
||||||
|
|
||||||
|
This is a minimal example of how to use Clerk authentication with Jazz.
|
||||||
16
examples/minimal-auth-clerk/index.html
Normal file
16
examples/minimal-auth-clerk/index.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Minimal Auth Clerk Example | Jazz</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
30
examples/minimal-auth-clerk/package.json
Normal file
30
examples/minimal-auth-clerk/package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "minimal-auth-clerk",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.10",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "tsc -b && vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"format-and-lint": "biome check .",
|
||||||
|
"format-and-lint:fix": "biome check . --write"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@clerk/clerk-react": "^5.4.1",
|
||||||
|
"jazz-tools": "workspace:*",
|
||||||
|
"jazz-react": "workspace:*",
|
||||||
|
"jazz-react-auth-clerk": "workspace:0.8.33",
|
||||||
|
"react": "^18.3.1",
|
||||||
|
"react-dom": "^18.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@biomejs/biome": "1.9.4",
|
||||||
|
"@types/react": "^18.3.12",
|
||||||
|
"@types/react-dom": "^18.3.1",
|
||||||
|
"@vitejs/plugin-react": "^4.3.3",
|
||||||
|
"globals": "^15.11.0",
|
||||||
|
"typescript": "~5.6.2",
|
||||||
|
"vite": "^5.4.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
examples/minimal-auth-clerk/public/vite.svg
Normal file
1
examples/minimal-auth-clerk/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
42
examples/minimal-auth-clerk/src/App.css
Normal file
42
examples/minimal-auth-clerk/src/App.css
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#root {
|
||||||
|
max-width: 1280px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 6em;
|
||||||
|
padding: 1.5em;
|
||||||
|
will-change: filter;
|
||||||
|
transition: filter 300ms;
|
||||||
|
}
|
||||||
|
.logo:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #646cffaa);
|
||||||
|
}
|
||||||
|
.logo.react:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
a:nth-of-type(2) .logo {
|
||||||
|
animation: logo-spin infinite 20s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.read-the-docs {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
16
examples/minimal-auth-clerk/src/App.tsx
Normal file
16
examples/minimal-auth-clerk/src/App.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import "./App.css";
|
||||||
|
import { useAccount } from "./main";
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const { me, logOut } = useAccount();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>You're logged in</h1>
|
||||||
|
<p>Welcome back, {me?.profile?.name}</p>
|
||||||
|
<button onClick={() => logOut()}>Logout</button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
1
examples/minimal-auth-clerk/src/assets/react.svg
Normal file
1
examples/minimal-auth-clerk/src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.0 KiB |
68
examples/minimal-auth-clerk/src/index.css
Normal file
68
examples/minimal-auth-clerk/src/index.css
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
:root {
|
||||||
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
border-color: #646cff;
|
||||||
|
}
|
||||||
|
button:focus,
|
||||||
|
button:focus-visible {
|
||||||
|
outline: 4px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
examples/minimal-auth-clerk/src/main.tsx
Normal file
50
examples/minimal-auth-clerk/src/main.tsx
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { ClerkProvider, SignInButton, useClerk } from "@clerk/clerk-react";
|
||||||
|
import { createJazzReactApp } from "jazz-react";
|
||||||
|
import { useJazzClerkAuth } from "jazz-react-auth-clerk";
|
||||||
|
import { StrictMode } from "react";
|
||||||
|
import { createRoot } from "react-dom/client";
|
||||||
|
import App from "./App.tsx";
|
||||||
|
import "./index.css";
|
||||||
|
|
||||||
|
// Import your publishable key
|
||||||
|
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
|
||||||
|
|
||||||
|
if (!PUBLISHABLE_KEY) {
|
||||||
|
throw new Error("Add your Clerk publishable key to the .env.local file");
|
||||||
|
}
|
||||||
|
|
||||||
|
const Jazz = createJazzReactApp();
|
||||||
|
export const { useAccount, useCoState } = Jazz;
|
||||||
|
|
||||||
|
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||||
|
const clerk = useClerk();
|
||||||
|
const [auth, state] = useJazzClerkAuth(clerk);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{state?.errors?.map((error) => (
|
||||||
|
<div key={error}>{error}</div>
|
||||||
|
))}
|
||||||
|
{clerk.user && auth ? (
|
||||||
|
<Jazz.Provider
|
||||||
|
auth={auth}
|
||||||
|
peer="wss://cloud.jazz.tools/?key=minimal-auth-clerk-example@gcmp.io"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Jazz.Provider>
|
||||||
|
) : (
|
||||||
|
<SignInButton />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
createRoot(document.getElementById("root")!).render(
|
||||||
|
<StrictMode>
|
||||||
|
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
|
||||||
|
<JazzAndAuth>
|
||||||
|
<App />
|
||||||
|
</JazzAndAuth>
|
||||||
|
</ClerkProvider>
|
||||||
|
</StrictMode>,
|
||||||
|
);
|
||||||
1
examples/minimal-auth-clerk/src/vite-env.d.ts
vendored
Normal file
1
examples/minimal-auth-clerk/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
24
examples/minimal-auth-clerk/tsconfig.app.json
Normal file
24
examples/minimal-auth-clerk/tsconfig.app.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
7
examples/minimal-auth-clerk/tsconfig.json
Normal file
7
examples/minimal-auth-clerk/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
22
examples/minimal-auth-clerk/tsconfig.node.json
Normal file
22
examples/minimal-auth-clerk/tsconfig.node.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
7
examples/minimal-auth-clerk/vite.config.ts
Normal file
7
examples/minimal-auth-clerk/vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
});
|
||||||
24
examples/minimal-auth-passkey/.gitignore
vendored
Normal file
24
examples/minimal-auth-passkey/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
63
examples/minimal-auth-passkey/CHANGELOG.md
Normal file
63
examples/minimal-auth-passkey/CHANGELOG.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# minimal-auth-passkey
|
||||||
|
|
||||||
|
## 0.0.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
4
examples/minimal-auth-passkey/README.md
Normal file
4
examples/minimal-auth-passkey/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Minimal Jazz Passkey Auth Example
|
||||||
|
|
||||||
|
This is a minimal example of how to use passkey authentication with Jazz.
|
||||||
|
|
||||||
13
examples/minimal-auth-passkey/index.html
Normal file
13
examples/minimal-auth-passkey/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Jazz | Minimal Auth Passkey Example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
examples/minimal-auth-passkey/package.json
Normal file
28
examples/minimal-auth-passkey/package.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "minimal-auth-passkey",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.9",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "tsc -b && vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"format-and-lint": "biome check .",
|
||||||
|
"format-and-lint:fix": "biome check . --write"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"jazz-tools": "workspace:*",
|
||||||
|
"jazz-react": "workspace:*",
|
||||||
|
"react": "^18.3.1",
|
||||||
|
"react-dom": "^18.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@biomejs/biome": "1.9.4",
|
||||||
|
"@types/react": "^18.3.12",
|
||||||
|
"@types/react-dom": "^18.3.1",
|
||||||
|
"@vitejs/plugin-react": "^4.3.3",
|
||||||
|
"globals": "^15.11.0",
|
||||||
|
"typescript": "~5.6.2",
|
||||||
|
"vite": "^5.4.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
examples/minimal-auth-passkey/public/vite.svg
Normal file
1
examples/minimal-auth-passkey/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
42
examples/minimal-auth-passkey/src/App.css
Normal file
42
examples/minimal-auth-passkey/src/App.css
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#root {
|
||||||
|
max-width: 1280px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 6em;
|
||||||
|
padding: 1.5em;
|
||||||
|
will-change: filter;
|
||||||
|
transition: filter 300ms;
|
||||||
|
}
|
||||||
|
.logo:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #646cffaa);
|
||||||
|
}
|
||||||
|
.logo.react:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
a:nth-of-type(2) .logo {
|
||||||
|
animation: logo-spin infinite 20s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.read-the-docs {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
16
examples/minimal-auth-passkey/src/App.tsx
Normal file
16
examples/minimal-auth-passkey/src/App.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import "./App.css";
|
||||||
|
import { useAccount } from "./main";
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const { me, logOut } = useAccount();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>You're logged in</h1>
|
||||||
|
<p>Welcome back, {me?.profile?.name}</p>
|
||||||
|
<button onClick={() => logOut()}>Logout</button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
1
examples/minimal-auth-passkey/src/assets/react.svg
Normal file
1
examples/minimal-auth-passkey/src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.0 KiB |
68
examples/minimal-auth-passkey/src/index.css
Normal file
68
examples/minimal-auth-passkey/src/index.css
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
:root {
|
||||||
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
border-color: #646cff;
|
||||||
|
}
|
||||||
|
button:focus,
|
||||||
|
button:focus-visible {
|
||||||
|
outline: 4px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
39
examples/minimal-auth-passkey/src/main.tsx
Normal file
39
examples/minimal-auth-passkey/src/main.tsx
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import {
|
||||||
|
PasskeyAuthBasicUI,
|
||||||
|
createJazzReactApp,
|
||||||
|
usePasskeyAuth,
|
||||||
|
} from "jazz-react";
|
||||||
|
import { StrictMode } from "react";
|
||||||
|
import { createRoot } from "react-dom/client";
|
||||||
|
import App from "./App.tsx";
|
||||||
|
import "./index.css";
|
||||||
|
|
||||||
|
const Jazz = createJazzReactApp();
|
||||||
|
|
||||||
|
export const { useAccount, useCoState } = Jazz;
|
||||||
|
|
||||||
|
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||||
|
const [auth, state] = usePasskeyAuth({
|
||||||
|
appName: "Jazz Minimal Auth Passkey Example",
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Jazz.Provider
|
||||||
|
auth={auth}
|
||||||
|
peer="wss://cloud.jazz.tools/?key=minimal-auth-passkey-example@gcmp.io"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Jazz.Provider>
|
||||||
|
<PasskeyAuthBasicUI state={state} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
createRoot(document.getElementById("root")!).render(
|
||||||
|
<StrictMode>
|
||||||
|
<JazzAndAuth>
|
||||||
|
<App />
|
||||||
|
</JazzAndAuth>
|
||||||
|
</StrictMode>,
|
||||||
|
);
|
||||||
1
examples/minimal-auth-passkey/src/vite-env.d.ts
vendored
Normal file
1
examples/minimal-auth-passkey/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
24
examples/minimal-auth-passkey/tsconfig.app.json
Normal file
24
examples/minimal-auth-passkey/tsconfig.app.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
7
examples/minimal-auth-passkey/tsconfig.json
Normal file
7
examples/minimal-auth-passkey/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
22
examples/minimal-auth-passkey/tsconfig.node.json
Normal file
22
examples/minimal-auth-passkey/tsconfig.node.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
7
examples/minimal-auth-passkey/vite.config.ts
Normal file
7
examples/minimal-auth-passkey/vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
});
|
||||||
@@ -1,5 +1,77 @@
|
|||||||
# jazz-example-musicplayer
|
# jazz-example-musicplayer
|
||||||
|
|
||||||
|
## 0.0.31
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.30
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.29
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.28
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.27
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.26
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
|
||||||
## 0.0.21
|
## 0.0.21
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-music-player",
|
"name": "jazz-example-music-player",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.21",
|
"version": "0.0.31",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
"@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",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
import {
|
import { Account, CoList, CoMap, FileStream, Profile, co } from "jazz-tools";
|
||||||
Account,
|
|
||||||
BinaryCoStream,
|
|
||||||
CoList,
|
|
||||||
CoMap,
|
|
||||||
Profile,
|
|
||||||
co,
|
|
||||||
} from "jazz-tools";
|
|
||||||
|
|
||||||
/** Walkthrough: Defining the data model with CoJSON
|
/** Walkthrough: Defining the data model with CoJSON
|
||||||
*
|
*
|
||||||
@@ -36,12 +29,12 @@ export class MusicTrack extends CoMap {
|
|||||||
sourceTrack = co.optional.ref(MusicTrack);
|
sourceTrack = co.optional.ref(MusicTrack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In Jazz you can files using BinaryCoStream.
|
* In Jazz you can upload files using FileStream.
|
||||||
*
|
*
|
||||||
* As for any other coValue the music files we put inside BinaryCoStream
|
* As for any other coValue the music files we put inside FileStream
|
||||||
* is available offline and end-to-end encrypted 😉
|
* is available offline and end-to-end encrypted 😉
|
||||||
*/
|
*/
|
||||||
file = co.ref(BinaryCoStream);
|
file = co.ref(FileStream);
|
||||||
waveform = co.ref(MusicTrackWaveform);
|
waveform = co.ref(MusicTrackWaveform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getAudioFileData } from "@/lib/audio/getAudioFileData";
|
import { getAudioFileData } from "@/lib/audio/getAudioFileData";
|
||||||
import { BinaryCoStream, Group } from "jazz-tools";
|
import { FileStream, Group } from "jazz-tools";
|
||||||
import {
|
import {
|
||||||
ListOfTracks,
|
ListOfTracks,
|
||||||
MusicTrack,
|
MusicTrack,
|
||||||
@@ -35,14 +35,14 @@ export async function uploadMusicTracks(
|
|||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const data = await getAudioFileData(file);
|
const data = await getAudioFileData(file);
|
||||||
|
|
||||||
// We transform the file blob into a BinaryCoStream
|
// We transform the file blob into a FileStream
|
||||||
// making it a collaborative value that is encrypted, easy
|
// making it a collaborative value that is encrypted, easy
|
||||||
// to share across devices and users and available offline!
|
// to share across devices and users and available offline!
|
||||||
const binaryCoStream = await BinaryCoStream.createFromBlob(file, ownership);
|
const fileStream = await FileStream.createFromBlob(file, ownership);
|
||||||
|
|
||||||
const musicTrack = MusicTrack.create(
|
const musicTrack = MusicTrack.create(
|
||||||
{
|
{
|
||||||
file: binaryCoStream,
|
file: fileStream,
|
||||||
duration: data.duration,
|
duration: data.duration,
|
||||||
waveform: MusicTrackWaveform.create({ data: data.waveform }, ownership),
|
waveform: MusicTrackWaveform.create({ data: data.waveform }, ownership),
|
||||||
title: file.name,
|
title: file.name,
|
||||||
@@ -98,7 +98,7 @@ export async function addTrackToPlaylist(
|
|||||||
* won't need to clone values to have this kind of sharing granularity
|
* won't need to clone values to have this kind of sharing granularity
|
||||||
*/
|
*/
|
||||||
const ownership = { owner: playlist._owner };
|
const ownership = { owner: playlist._owner };
|
||||||
const blob = await BinaryCoStream.loadAsBlob(track._refs.file.id, account);
|
const blob = await FileStream.loadAsBlob(track._refs.file.id, account);
|
||||||
const waveform = await MusicTrackWaveform.load(
|
const waveform = await MusicTrackWaveform.load(
|
||||||
track._refs.waveform.id,
|
track._refs.waveform.id,
|
||||||
account,
|
account,
|
||||||
@@ -109,7 +109,7 @@ export async function addTrackToPlaylist(
|
|||||||
|
|
||||||
const trackClone = MusicTrack.create(
|
const trackClone = MusicTrack.create(
|
||||||
{
|
{
|
||||||
file: await BinaryCoStream.createFromBlob(blob, ownership),
|
file: await FileStream.createFromBlob(blob, ownership),
|
||||||
duration: track.duration,
|
duration: track.duration,
|
||||||
waveform: MusicTrackWaveform.create({ data: waveform.data }, ownership),
|
waveform: MusicTrackWaveform.create({ data: waveform.data }, ownership),
|
||||||
title: track.title,
|
title: track.title,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { MusicTrack, Playlist } from "@/1_schema";
|
import { MusicTrack, Playlist } from "@/1_schema";
|
||||||
import { usePlayMedia } from "@/lib/audio/usePlayMedia";
|
import { usePlayMedia } from "@/lib/audio/usePlayMedia";
|
||||||
import { usePlayState } from "@/lib/audio/usePlayState";
|
import { usePlayState } from "@/lib/audio/usePlayState";
|
||||||
import { BinaryCoStream, ID } from "jazz-tools";
|
import { FileStream, ID } from "jazz-tools";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { useAccount } from "./2_main";
|
import { useAccount } from "./2_main";
|
||||||
import { updateActivePlaylist, updateActiveTrack } from "./4_actions";
|
import { updateActivePlaylist, updateActiveTrack } from "./4_actions";
|
||||||
@@ -27,7 +27,7 @@ export function useMediaPlayer() {
|
|||||||
|
|
||||||
setLoading(track.id);
|
setLoading(track.id);
|
||||||
|
|
||||||
const file = await BinaryCoStream.loadAsBlob(track._refs.file.id, me);
|
const file = await FileStream.loadAsBlob(track._refs.file.id, me);
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
setLoading(null);
|
setLoading(null);
|
||||||
|
|||||||
@@ -1,5 +1,86 @@
|
|||||||
# jazz-example-onboarding
|
# jazz-example-onboarding
|
||||||
|
|
||||||
|
## 0.0.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser-media-images@0.8.33
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
- jazz-browser-media-images@0.8.32
|
||||||
|
|
||||||
|
## 0.0.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
- jazz-browser-media-images@0.8.31
|
||||||
|
|
||||||
|
## 0.0.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
- jazz-browser-media-images@0.8.30
|
||||||
|
|
||||||
|
## 0.0.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
- jazz-browser-media-images@0.8.29
|
||||||
|
|
||||||
|
## 0.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
- jazz-browser-media-images@0.8.28
|
||||||
|
|
||||||
|
## 0.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
- jazz-browser-media-images@0.8.27
|
||||||
|
|
||||||
|
## 0.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser-media-images@0.8.24
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
- jazz-browser-media-images@0.8.23
|
||||||
|
|
||||||
## 0.0.2
|
## 0.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-onboarding",
|
"name": "jazz-example-onboarding",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.2",
|
"version": "0.0.12",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default defineConfig({
|
|||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
use: {
|
use: {
|
||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
baseURL: "http://localhost:5173/?peer=ws://localhost:1234",
|
baseURL: "http://localhost:5173/",
|
||||||
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
trace: "on-first-retry",
|
trace: "on-first-retry",
|
||||||
@@ -42,10 +42,5 @@ export default defineConfig({
|
|||||||
url: "http://localhost:5173/",
|
url: "http://localhost:5173/",
|
||||||
reuseExistingServer: !isCI,
|
reuseExistingServer: !isCI,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
command: "pnpm sync --in-memory --port 1234",
|
|
||||||
url: "http://localhost:1234/health",
|
|
||||||
reuseExistingServer: !isCI,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Button } from "@/components/Button.tsx";
|
import { Button } from "@/components/Button.tsx";
|
||||||
import { useAccount, useCoState } from "@/main.tsx";
|
import { useAcceptInvite, useAccount, useCoState } from "@/main.tsx";
|
||||||
import { EmployeeList } from "@/pages/EmployeeList.tsx";
|
import { EmployeeList } from "@/pages/EmployeeList.tsx";
|
||||||
import { EmployeeOnboading } from "@/pages/EmployeeOnboarding.tsx";
|
import { EmployeeOnboading } from "@/pages/EmployeeOnboarding.tsx";
|
||||||
import { NewEmployee } from "@/pages/NewEmployee.tsx";
|
import { NewEmployee } from "@/pages/NewEmployee.tsx";
|
||||||
@@ -8,7 +8,7 @@ import { ID } from "jazz-tools";
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import {
|
import {
|
||||||
RouterProvider,
|
RouterProvider,
|
||||||
createBrowserRouter,
|
createHashRouter,
|
||||||
useNavigate,
|
useNavigate,
|
||||||
useParams,
|
useParams,
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
@@ -36,11 +36,24 @@ function ImportEmployee({
|
|||||||
return <div>Importing Employee ${employeeCoId} ...</div>;
|
return <div>Importing Employee ${employeeCoId} ...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AcceptInvite() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useAcceptInvite({
|
||||||
|
invitedObjectSchema: CoEmployee,
|
||||||
|
onAccept: (employeeCoId) => {
|
||||||
|
navigate(`/import/${employeeCoId}`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return <p>Accepting invite...</p>;
|
||||||
|
}
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { me, logOut } = useAccount();
|
const { me, logOut } = useAccount();
|
||||||
const employeeCoListId = me.profile?._refs.employees.id;
|
const employeeCoListId = me.profile?._refs.employees.id;
|
||||||
|
|
||||||
const router = createBrowserRouter([
|
const router = createHashRouter([
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
element: <EmployeeList employeeListCoId={employeeCoListId} />,
|
element: <EmployeeList employeeListCoId={employeeCoListId} />,
|
||||||
@@ -57,6 +70,10 @@ function App() {
|
|||||||
path: "/import/:employeeCoId",
|
path: "/import/:employeeCoId",
|
||||||
element: <ImportEmployee employeeListCoId={employeeCoListId} />,
|
element: <ImportEmployee employeeListCoId={employeeCoListId} />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/invite/*",
|
||||||
|
element: <AcceptInvite />,
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -10,15 +10,17 @@ const Jazz = createJazzReactApp({
|
|||||||
});
|
});
|
||||||
export const { useAccount, useCoState, useAcceptInvite } = Jazz;
|
export const { useAccount, useCoState, useAcceptInvite } = Jazz;
|
||||||
|
|
||||||
|
const peer =
|
||||||
|
(new URL(window.location.href).searchParams.get(
|
||||||
|
"peer",
|
||||||
|
) as `ws://${string}`) ??
|
||||||
|
"wss://cloud.jazz.tools/?key=onboarding-example-jazz@gcmp.io";
|
||||||
|
|
||||||
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||||
const [auth, authState] = useDemoAuth();
|
const [auth, authState] = useDemoAuth();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Jazz.Provider
|
<Jazz.Provider auth={auth} peer={peer}>
|
||||||
auth={auth}
|
|
||||||
// replace `you@example.com` with your email as a temporary API key
|
|
||||||
peer="wss://cloud.jazz.tools/?key=you@example.com"
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</Jazz.Provider>
|
</Jazz.Provider>
|
||||||
{authState.state !== "signedIn" && (
|
{authState.state !== "signedIn" && (
|
||||||
|
|||||||
@@ -2,13 +2,12 @@ import { Button } from "@/components/Button.tsx";
|
|||||||
import { NavigateBack } from "@/components/NavigateBack.tsx";
|
import { NavigateBack } from "@/components/NavigateBack.tsx";
|
||||||
import { Stack } from "@/components/Stack.tsx";
|
import { Stack } from "@/components/Stack.tsx";
|
||||||
import { TextInput } from "@/components/TextInput.tsx";
|
import { TextInput } from "@/components/TextInput.tsx";
|
||||||
import { useAcceptInvite, useCoState } from "@/main.tsx";
|
import { useCoState } from "@/main.tsx";
|
||||||
import { createImage } from "jazz-browser-media-images";
|
import { createImage } from "jazz-browser-media-images";
|
||||||
import { ProgressiveImg, createInviteLink } from "jazz-react";
|
import { ProgressiveImg, createInviteLink } from "jazz-react";
|
||||||
import { CoMap, ID } from "jazz-tools";
|
import { CoMap, ID } from "jazz-tools";
|
||||||
import { ChangeEvent, ReactNode, useCallback } from "react";
|
import { ChangeEvent, ReactNode, useCallback } from "react";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import {
|
import {
|
||||||
CoDocUploadStep,
|
CoDocUploadStep,
|
||||||
CoEmployee,
|
CoEmployee,
|
||||||
@@ -173,17 +172,9 @@ const ConfirmationCard = ({
|
|||||||
|
|
||||||
export function EmployeeOnboading() {
|
export function EmployeeOnboading() {
|
||||||
const { employeeCoId } = useParams();
|
const { employeeCoId } = useParams();
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const employee = useCoState(CoEmployee, employeeCoId as ID<CoEmployee>, {});
|
const employee = useCoState(CoEmployee, employeeCoId as ID<CoEmployee>, {});
|
||||||
|
|
||||||
useAcceptInvite({
|
|
||||||
invitedObjectSchema: CoEmployee,
|
|
||||||
onAccept: (employeeCoId) => {
|
|
||||||
navigate(`/import/${employeeCoId}`);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleInviteLinkCreation = useCallback(
|
const handleInviteLinkCreation = useCallback(
|
||||||
(role: "reader" | "writer") => {
|
(role: "reader" | "writer") => {
|
||||||
if (!employee) return;
|
if (!employee) return;
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
import { Page, expect, test } from "@playwright/test";
|
import {
|
||||||
|
Browser,
|
||||||
|
BrowserContext,
|
||||||
|
Page,
|
||||||
|
chromium,
|
||||||
|
expect,
|
||||||
|
test,
|
||||||
|
} from "@playwright/test";
|
||||||
import { EmployeeOnboardingPage } from "./pages/EmployeeOnboardingPage";
|
import { EmployeeOnboardingPage } from "./pages/EmployeeOnboardingPage";
|
||||||
import { HomePage } from "./pages/HomePage";
|
import { HomePage } from "./pages/HomePage";
|
||||||
import { LoginPage } from "./pages/LoginPage";
|
import { LoginPage } from "./pages/LoginPage";
|
||||||
@@ -29,60 +36,82 @@ const login = async ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
test.describe("Admin onboarding flow", () => {
|
test.describe("Admin onboarding flow", () => {
|
||||||
test("Create and delete flow", async ({ page }) => {
|
let browser: Browser;
|
||||||
await login({ page, userName: "HR specialist" });
|
let adminContext: BrowserContext;
|
||||||
|
let writerContext: BrowserContext;
|
||||||
|
|
||||||
const homePage = new HomePage(page);
|
test.beforeAll(async () => {
|
||||||
await homePage.createEmployee("Paul");
|
browser = await chromium.launch();
|
||||||
await homePage.createEmployee("Sean");
|
adminContext = await browser.newContext();
|
||||||
await homePage.expectEmployee(["Sean", "admin"]);
|
writerContext = await browser.newContext();
|
||||||
await homePage.expectEmployee(["Paul", "admin"]);
|
|
||||||
await homePage.deleteEmployee("Sean");
|
|
||||||
await homePage.expectEmployeeDeleted("Sean");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Onboard flow", async ({ page }) => {
|
test.afterAll(async () => {
|
||||||
|
await adminContext.close();
|
||||||
|
await writerContext.close();
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Create and delete flow", async () => {
|
||||||
|
const adminPage = await adminContext.newPage();
|
||||||
|
await login({ page: adminPage, userName: "HR specialist" });
|
||||||
|
const adminHomePage = new HomePage(adminPage);
|
||||||
|
await adminHomePage.createEmployee("Paul");
|
||||||
|
await adminHomePage.createEmployee("Sean");
|
||||||
|
await adminHomePage.expectEmployee(["Sean", "admin"]);
|
||||||
|
await adminHomePage.expectEmployee(["Paul", "admin"]);
|
||||||
|
await adminHomePage.deleteEmployee("Sean");
|
||||||
|
await adminHomePage.expectEmployeeDeleted("Sean");
|
||||||
|
|
||||||
|
await adminPage.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Onboard flow", async () => {
|
||||||
|
const adminPage = await adminContext.newPage();
|
||||||
|
const writerPage = await writerContext.newPage();
|
||||||
|
|
||||||
const adminUser = "HR specialist";
|
const adminUser = "HR specialist";
|
||||||
const writerUser = "Invitee";
|
const writerUser = "Invitee";
|
||||||
await login({ page, userName: adminUser });
|
await login({ page: adminPage, userName: adminUser });
|
||||||
|
await login({ page: writerPage, userName: writerUser });
|
||||||
|
|
||||||
const homePage = new HomePage(page);
|
const adminHomePage = new HomePage(adminPage);
|
||||||
await homePage.createEmployee("Paul");
|
await adminHomePage.createEmployee("Paul");
|
||||||
await homePage.expectEmployee(["Paul", "admin"]);
|
await adminHomePage.expectEmployee(["Paul", "admin"]);
|
||||||
await homePage.navigateToEmployeeOnboardingPage("Paul");
|
await adminHomePage.navigateToEmployeeOnboardingPage("Paul");
|
||||||
const onboardingPage = new EmployeeOnboardingPage(page);
|
const adminOnboardingPage = new EmployeeOnboardingPage(adminPage);
|
||||||
|
|
||||||
// create invitation
|
// create invitation
|
||||||
const invitation = await onboardingPage.getShareLink();
|
const invitation = await adminOnboardingPage.getShareLink();
|
||||||
await onboardingPage.logout();
|
|
||||||
|
// Wait for the invitation to be synced
|
||||||
|
await writerPage.waitForTimeout(3000);
|
||||||
|
|
||||||
//fill out by invitee (writer)
|
//fill out by invitee (writer)
|
||||||
await login({ page, userName: writerUser });
|
await writerPage.goto(invitation);
|
||||||
await page.goto(invitation);
|
|
||||||
await page.waitForTimeout(1000);
|
const writerHomePage = new HomePage(writerPage);
|
||||||
await homePage.expectEmployee(["Paul", "write"]);
|
await writerHomePage.expectEmployee(["Paul", "write"]);
|
||||||
await homePage.navigateToEmployeeOnboardingPage("Paul");
|
await writerHomePage.navigateToEmployeeOnboardingPage("Paul");
|
||||||
await onboardingPage.expectEmployeeName("Paul");
|
const writerOnboardingPage = new EmployeeOnboardingPage(writerPage);
|
||||||
await onboardingPage.fillPersonalDetailsCardAndSave(
|
await writerOnboardingPage.expectEmployeeName("Paul");
|
||||||
|
await writerOnboardingPage.fillPersonalDetailsCardAndSave(
|
||||||
"123-45-6789",
|
"123-45-6789",
|
||||||
"123 Elm Street",
|
"123 Elm Street",
|
||||||
);
|
);
|
||||||
await onboardingPage.fillUploadCardAndSave(
|
await writerOnboardingPage.fillUploadCardAndSave(
|
||||||
"./public/jazz-logo-low-res.jpg",
|
"./public/jazz-logo-low-res.jpg",
|
||||||
);
|
);
|
||||||
|
|
||||||
// invitee cannot confirm the onboarding completion
|
// invitee cannot confirm the onboarding completion
|
||||||
expect(onboardingPage.finalConfirmationButton.isDisabled()).toBeTruthy();
|
expect(
|
||||||
|
writerOnboardingPage.finalConfirmationButton.isDisabled(),
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
// final confirmation step by admin
|
// final confirmation step by admin
|
||||||
await onboardingPage.logout();
|
await scrollToBottom(adminPage);
|
||||||
await login({ page, userName: adminUser, loginAs: true });
|
await adminOnboardingPage.finalConfirmationButton.click();
|
||||||
|
await adminOnboardingPage.backButton.click();
|
||||||
await homePage.expectEmployee(["Paul", "admin"]);
|
await adminHomePage.expectOnboardingCompleteForEmployee("Paul");
|
||||||
await homePage.navigateToEmployeeOnboardingPage("Paul");
|
|
||||||
await scrollToBottom(page);
|
|
||||||
await onboardingPage.finalConfirmationButton.click();
|
|
||||||
await onboardingPage.backButton.click();
|
|
||||||
await homePage.expectOnboardingCompleteForEmployee("Paul");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,77 @@
|
|||||||
# jazz-password-manager
|
# jazz-password-manager
|
||||||
|
|
||||||
|
## 0.0.30
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.29
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.28
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.27
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.26
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.21
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
|
||||||
## 0.0.20
|
## 0.0.20
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-password-manager",
|
"name": "jazz-password-manager",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.20",
|
"version": "0.0.30",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hook-form": "^7.41.5",
|
"react-hook-form": "^7.41.5",
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
PasswordList,
|
PasswordList,
|
||||||
PasswordManagerAccount,
|
PasswordManagerAccount,
|
||||||
} from "./1_schema";
|
} from "./1_schema";
|
||||||
import { waitForCoValue } from "./lib/waitForCoValue";
|
|
||||||
import { PasswordItemFormValues } from "./types";
|
import { PasswordItemFormValues } from "./types";
|
||||||
|
|
||||||
export const saveItem = (item: CoMapInit<PasswordItem>): PasswordItem => {
|
export const saveItem = (item: CoMapInit<PasswordItem>): PasswordItem => {
|
||||||
@@ -61,14 +60,16 @@ export async function addSharedFolder(
|
|||||||
me: PasswordManagerAccount,
|
me: PasswordManagerAccount,
|
||||||
) {
|
) {
|
||||||
const [sharedFolder, account] = await Promise.all([
|
const [sharedFolder, account] = await Promise.all([
|
||||||
await waitForCoValue(Folder, sharedFolderId, me, Boolean, {}),
|
Folder.load(sharedFolderId, me, {}),
|
||||||
await waitForCoValue(PasswordManagerAccount, me.id, me, Boolean, {
|
PasswordManagerAccount.load(me.id, me, {
|
||||||
root: {
|
root: {
|
||||||
folders: [],
|
folders: [],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (!sharedFolder || !account) return;
|
||||||
|
|
||||||
if (!account.root?.folders) return;
|
if (!account.root?.folders) return;
|
||||||
|
|
||||||
const found = account.root.folders.some((f) => f?.id === sharedFolder.id);
|
const found = account.root.folders.some((f) => f?.id === sharedFolder.id);
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
import {
|
|
||||||
Account,
|
|
||||||
CoValue,
|
|
||||||
CoValueClass,
|
|
||||||
DepthsIn,
|
|
||||||
ID,
|
|
||||||
subscribeToCoValue,
|
|
||||||
} from "jazz-tools";
|
|
||||||
|
|
||||||
export function waitForCoValue<T extends CoValue>(
|
|
||||||
coMap: CoValueClass<T>,
|
|
||||||
valueId: ID<T>,
|
|
||||||
account: Account,
|
|
||||||
predicate: (value: T) => boolean,
|
|
||||||
depth: DepthsIn<T>,
|
|
||||||
) {
|
|
||||||
return new Promise<T>((resolve) => {
|
|
||||||
function subscribe() {
|
|
||||||
const unsubscribe = subscribeToCoValue(
|
|
||||||
coMap,
|
|
||||||
valueId,
|
|
||||||
account,
|
|
||||||
depth,
|
|
||||||
(value) => {
|
|
||||||
if (predicate(value)) {
|
|
||||||
resolve(value);
|
|
||||||
unsubscribe();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
unsubscribe();
|
|
||||||
setTimeout(subscribe, 100);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
subscribe();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,86 @@
|
|||||||
# jazz-example-pets
|
# jazz-example-pets
|
||||||
|
|
||||||
|
## 0.0.128
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser-media-images@0.8.33
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.127
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
- jazz-browser-media-images@0.8.32
|
||||||
|
|
||||||
|
## 0.0.126
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
- jazz-browser-media-images@0.8.31
|
||||||
|
|
||||||
|
## 0.0.125
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
- jazz-browser-media-images@0.8.30
|
||||||
|
|
||||||
|
## 0.0.124
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
- jazz-browser-media-images@0.8.29
|
||||||
|
|
||||||
|
## 0.0.123
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
- jazz-browser-media-images@0.8.28
|
||||||
|
|
||||||
|
## 0.0.122
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
- jazz-browser-media-images@0.8.27
|
||||||
|
|
||||||
|
## 0.0.121
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.120
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser-media-images@0.8.24
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.119
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
- jazz-browser-media-images@0.8.23
|
||||||
|
|
||||||
## 0.0.118
|
## 0.0.118
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-pets",
|
"name": "jazz-example-pets",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.118",
|
"version": "0.0.128",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
"@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",
|
||||||
"jazz-browser-media-images": "workspace:0.8.22",
|
"jazz-browser-media-images": "workspace:0.8.33",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"is-ci": "^3.0.1",
|
"is-ci": "^3.0.1",
|
||||||
"jazz-run": "workspace:0.8.21",
|
"jazz-run": "workspace:0.8.32",
|
||||||
"postcss": "^8.4.27",
|
"postcss": "^8.4.27",
|
||||||
"tailwindcss": "3.3.2",
|
"tailwindcss": "3.3.2",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
Account,
|
Account,
|
||||||
|
CoFeed,
|
||||||
CoList,
|
CoList,
|
||||||
CoMap,
|
CoMap,
|
||||||
CoStream,
|
|
||||||
ImageDefinition,
|
ImageDefinition,
|
||||||
Profile,
|
Profile,
|
||||||
co,
|
co,
|
||||||
@@ -25,7 +25,7 @@ export const ReactionTypes = [
|
|||||||
] as const;
|
] as const;
|
||||||
export type ReactionType = (typeof ReactionTypes)[number];
|
export type ReactionType = (typeof ReactionTypes)[number];
|
||||||
|
|
||||||
export class PetReactions extends CoStream.Of(co.json<ReactionType>()) {}
|
export class PetReactions extends CoFeed.Of(co.json<ReactionType>()) {}
|
||||||
|
|
||||||
export class PetPost extends CoMap {
|
export class PetPost extends CoMap {
|
||||||
name = co.string;
|
name = co.string;
|
||||||
|
|||||||
@@ -1,5 +1,81 @@
|
|||||||
# todo-vue
|
# todo-vue
|
||||||
|
|
||||||
|
## 0.0.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [3cb27e1]
|
||||||
|
- jazz-browser@0.8.33
|
||||||
|
- jazz-vue@0.8.21
|
||||||
|
|
||||||
|
## 0.0.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-browser@0.8.32
|
||||||
|
- jazz-vue@0.8.20
|
||||||
|
|
||||||
|
## 0.0.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
- jazz-vue@0.8.19
|
||||||
|
|
||||||
|
## 0.0.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
- jazz-vue@0.8.18
|
||||||
|
|
||||||
|
## 0.0.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
- jazz-vue@0.8.17
|
||||||
|
|
||||||
|
## 0.0.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
- jazz-vue@0.8.16
|
||||||
|
|
||||||
|
## 0.0.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
- jazz-vue@0.8.15
|
||||||
|
|
||||||
|
## 0.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.8.24
|
||||||
|
- jazz-vue@0.8.14
|
||||||
|
|
||||||
|
## 0.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [e442bb8]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-browser@0.8.23
|
||||||
|
- jazz-vue@0.8.13
|
||||||
|
|
||||||
## 0.0.5
|
## 0.0.5
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "todo-vue",
|
"name": "todo-vue",
|
||||||
"version": "0.0.5",
|
"version": "0.0.14",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,77 @@
|
|||||||
# jazz-example-todo
|
# jazz-example-todo
|
||||||
|
|
||||||
|
## 0.0.127
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.33
|
||||||
|
|
||||||
|
## 0.0.126
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [df42b2b]
|
||||||
|
- jazz-tools@0.8.32
|
||||||
|
- jazz-react@0.8.32
|
||||||
|
|
||||||
|
## 0.0.125
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.31
|
||||||
|
- jazz-tools@0.8.31
|
||||||
|
|
||||||
|
## 0.0.124
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.30
|
||||||
|
- jazz-tools@0.8.30
|
||||||
|
|
||||||
|
## 0.0.123
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.29
|
||||||
|
- jazz-tools@0.8.29
|
||||||
|
|
||||||
|
## 0.0.122
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.28
|
||||||
|
- jazz-tools@0.8.28
|
||||||
|
|
||||||
|
## 0.0.121
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.27
|
||||||
|
- jazz-tools@0.8.27
|
||||||
|
|
||||||
|
## 0.0.120
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [59d37df]
|
||||||
|
- jazz-react@0.8.26
|
||||||
|
|
||||||
|
## 0.0.119
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.8.24
|
||||||
|
|
||||||
|
## 0.0.118
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [d348c2d]
|
||||||
|
- Updated dependencies [6902b5b]
|
||||||
|
- Updated dependencies [1a0cd3d]
|
||||||
|
- jazz-tools@0.8.23
|
||||||
|
- jazz-react@0.8.23
|
||||||
|
|
||||||
## 0.0.117
|
## 0.0.117
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-todo",
|
"name": "jazz-example-todo",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.117",
|
"version": "0.0.127",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
"@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",
|
||||||
"jazz-react": "workspace:0.8.22",
|
"jazz-react": "workspace:0.8.33",
|
||||||
"jazz-tools": "workspace:0.8.21",
|
"jazz-tools": "workspace:0.8.32",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@evilmartians/harmony": "^1.0.0",
|
"@evilmartians/harmony": "^1.0.0",
|
||||||
"@headlessui/react": "^2.2.0",
|
"@headlessui/react": "^2.2.0",
|
||||||
|
"@icons-pack/react-simple-icons": "^9.1.0",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"lucide-react": "^0.436.0",
|
"lucide-react": "^0.436.0",
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
|
"resend": "^4.0.0",
|
||||||
"tailwind-merge": "^1.14.0",
|
"tailwind-merge": "^1.14.0",
|
||||||
"tailwindcss-animate": "^1.0.7"
|
"tailwindcss-animate": "^1.0.7"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,22 +1,39 @@
|
|||||||
import { clsx } from "clsx";
|
import { clsx } from "clsx";
|
||||||
|
import { LucideIcon } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { Spinner } from "./Spinner";
|
||||||
|
|
||||||
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
variant?: "primary" | "secondary" | "tertiary";
|
variant?: "primary" | "secondary" | "tertiary";
|
||||||
size?: "sm" | "md" | "lg";
|
size?: "sm" | "md" | "lg";
|
||||||
href?: string;
|
href?: string;
|
||||||
|
newTab?: boolean;
|
||||||
|
icon?: LucideIcon;
|
||||||
|
loading?: boolean;
|
||||||
|
loadingText?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ButtonIcon({ icon: Icon, loading }: ButtonProps) {
|
||||||
|
if (!Icon) return null;
|
||||||
|
|
||||||
|
const className = "size-5";
|
||||||
|
|
||||||
|
if (loading) return <Spinner className={className} />;
|
||||||
|
|
||||||
|
return <Icon strokeWidth={1.5} className={className} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Button(props: ButtonProps) {
|
export function Button(props: ButtonProps) {
|
||||||
const {
|
const {
|
||||||
type = "button",
|
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
size = "md",
|
size = "md",
|
||||||
variant = "primary",
|
variant = "primary",
|
||||||
href,
|
href,
|
||||||
disabled,
|
disabled,
|
||||||
|
newTab,
|
||||||
|
loadingText,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const sizeClasses = {
|
const sizeClasses = {
|
||||||
@@ -35,7 +52,8 @@ export function Button(props: ButtonProps) {
|
|||||||
|
|
||||||
const classNames = clsx(
|
const classNames = clsx(
|
||||||
className,
|
className,
|
||||||
"inline-flex items-center gap-2 rounded-lg text-center transition-colors",
|
"inline-flex items-center justify-center gap-2 rounded-lg text-center transition-colors",
|
||||||
|
"disabled:pointer-events-none disabled:opacity-70",
|
||||||
sizeClasses[size],
|
sizeClasses[size],
|
||||||
variantClasses[variant],
|
variantClasses[variant],
|
||||||
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
||||||
@@ -43,15 +61,26 @@ export function Button(props: ButtonProps) {
|
|||||||
|
|
||||||
if (href) {
|
if (href) {
|
||||||
return (
|
return (
|
||||||
<Link href={href} className={classNames}>
|
<Link
|
||||||
|
href={href}
|
||||||
|
target={newTab ? "_blank" : undefined}
|
||||||
|
className={classNames}
|
||||||
|
>
|
||||||
|
<ButtonIcon {...props} />
|
||||||
{children}
|
{children}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className={classNames} {...props}>
|
<button
|
||||||
{children}
|
{...props}
|
||||||
|
disabled={props.disabled || props.loading}
|
||||||
|
className={classNames}
|
||||||
|
>
|
||||||
|
<ButtonIcon {...props} />
|
||||||
|
|
||||||
|
{props.loading && props.loadingText ? props.loadingText : children}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
12
homepage/design-system/src/app/components/atoms/Card.tsx
Normal file
12
homepage/design-system/src/app/components/atoms/Card.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { clsx } from "clsx";
|
||||||
|
|
||||||
|
export function Card({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
}: { children: React.ReactNode; className?: string }) {
|
||||||
|
return (
|
||||||
|
<div className={clsx(className, "border rounded-xl shadow-sm")}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
|
import { Card } from "../atoms/Card";
|
||||||
|
|
||||||
export function GridCard(props: { children: ReactNode; className?: string }) {
|
export function GridCard(props: { children: ReactNode; className?: string }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<Card
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"col-span-2 p-4 [&>h4]:mt-0 [&>h3]:mt-0 [&>:last-child]:mb-0",
|
"col-span-2 p-4 [&>h4]:mt-0 [&>h3]:mt-0 [&>:last-child]:mb-0",
|
||||||
"border rounded-xl shadow-sm",
|
|
||||||
props.className,
|
props.className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
26
homepage/design-system/src/app/components/atoms/Spinner.tsx
Normal file
26
homepage/design-system/src/app/components/atoms/Spinner.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
|
export function Spinner({ className }: { className?: string }) {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
className={clsx(className, "animate-spin")}
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<circle
|
||||||
|
className="opacity-25"
|
||||||
|
cx="12"
|
||||||
|
cy="12"
|
||||||
|
r="10"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="4"
|
||||||
|
></circle>
|
||||||
|
<path
|
||||||
|
className="opacity-75"
|
||||||
|
fill="currentColor"
|
||||||
|
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import clsx from "clsx";
|
||||||
|
import { LucideIcon } from "lucide-react";
|
||||||
|
import { Card } from "../atoms/Card";
|
||||||
|
import { Prose } from "./Prose";
|
||||||
|
|
||||||
|
export function FeatureCard({
|
||||||
|
label,
|
||||||
|
icon: Icon,
|
||||||
|
explanation,
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
label: React.ReactNode;
|
||||||
|
icon?: LucideIcon;
|
||||||
|
explanation?: React.ReactNode;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Card className={clsx(className, "p-4")}>
|
||||||
|
{Icon && (
|
||||||
|
<Icon
|
||||||
|
className="size-8 text-blue p-1.5 rounded-lg bg-blue-50 dark:text-blue-500 dark:bg-stone-900 mb-2.5 md:size-10"
|
||||||
|
strokeWidth={1.5}
|
||||||
|
strokeLinecap="butt"
|
||||||
|
size={80}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="text-stone-900 font-medium md:text-base dark:text-stone-100 mb-2">
|
||||||
|
{label}
|
||||||
|
</div>
|
||||||
|
{explanation && <Prose>{explanation}</Prose>}
|
||||||
|
{children}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,15 +6,23 @@ export function GappedGrid({
|
|||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
title,
|
title,
|
||||||
|
cols = 3,
|
||||||
}: {
|
}: {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
cols?: 3 | 4;
|
||||||
}) {
|
}) {
|
||||||
|
const colsClassName =
|
||||||
|
cols === 3
|
||||||
|
? "grid-cols-2 md:grid-cols-4 lg:grid-cols-6"
|
||||||
|
: "sm:grid-cols-2 lg:grid-cols-4";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 lg:gap-8",
|
"grid gap-4 lg:gap-8",
|
||||||
|
colsClassName,
|
||||||
"items-stretch",
|
"items-stretch",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
import clsx from "clsx";
|
|
||||||
import { LucideIcon } from "lucide-react";
|
|
||||||
import { Prose } from "./Prose";
|
|
||||||
|
|
||||||
export function LabelledFeatureIcon({
|
|
||||||
label,
|
|
||||||
icon: Icon,
|
|
||||||
explanation,
|
|
||||||
className,
|
|
||||||
}: {
|
|
||||||
label: string;
|
|
||||||
icon: LucideIcon;
|
|
||||||
explanation: React.ReactNode;
|
|
||||||
className?: string;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={clsx(
|
|
||||||
className,
|
|
||||||
"text-base",
|
|
||||||
"rounded-xl",
|
|
||||||
"border p-4 shadow-sm",
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
className="size-8 text-blue p-1.5 rounded-lg bg-blue-50 dark:text-blue-500 dark:bg-stone-900 mb-2.5 md:size-10"
|
|
||||||
strokeWidth={1.5}
|
|
||||||
strokeLinecap="butt"
|
|
||||||
size={80}
|
|
||||||
/>
|
|
||||||
<div className="text-stone-900 font-medium md:text-base dark:text-stone-100 mb-2">
|
|
||||||
{label}
|
|
||||||
</div>
|
|
||||||
<Prose>{explanation}</Prose>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ import { Prose } from "./Prose";
|
|||||||
|
|
||||||
function H2Sub({ children }: { children: React.ReactNode }) {
|
function H2Sub({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<Prose size="lg" className="max-w-3xl">
|
<Prose size="lg" className="text-balance max-w-3xl">
|
||||||
{children}
|
{children}
|
||||||
</Prose>
|
</Prose>
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user