community-jazz-vue 0.18.38 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +22 -0
- package/dist/composables.d.ts +17 -8
- package/dist/index.js +61 -28
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Image.vue +6 -3
- package/src/composables.ts +90 -37
- package/src/tests/proxyBehavior.test.ts +25 -18
- package/src/tests/useAcceptInvite.test.ts +3 -1
- package/src/tests/useAccount.test.ts +12 -6
- package/src/tests/useCoState.test.ts +32 -13
- package/src/tests/useInboxSender.test.ts +3 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> community-jazz-vue@0.
|
|
2
|
+
> community-jazz-vue@0.19.0 build /home/runner/_work/jazz/jazz/packages/community-jazz-vue
|
|
3
3
|
> pnpm typecheck && rm -rf ./dist && vite build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> community-jazz-vue@0.
|
|
6
|
+
> community-jazz-vue@0.19.0 typecheck /home/runner/_work/jazz/jazz/packages/community-jazz-vue
|
|
7
7
|
> vue-tsc --noEmit
|
|
8
8
|
|
|
9
9
|
[36mvite v6.3.5 [32mbuilding for production...[36m[39m
|
|
@@ -15,7 +15,7 @@ rendering chunks...
|
|
|
15
15
|
computing gzip size...
|
|
16
16
|
[2mdist/[22m[36mtesting.js [39m[1m[2m 1.28 kB[22m[1m[22m[2m │ gzip: 0.54 kB[22m[2m │ map: 1.84 kB[22m
|
|
17
17
|
[2mdist/[22m[36mprovider-CCZVJj45.js [39m[1m[2m 4.15 kB[22m[1m[22m[2m │ gzip: 1.25 kB[22m[2m │ map: 7.94 kB[22m
|
|
18
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
19
|
-
[vite:dts] Declaration files built in
|
|
18
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m21.06 kB[22m[1m[22m[2m │ gzip: 5.16 kB[22m[2m │ map: 37.58 kB[22m
|
|
19
|
+
[vite:dts] Declaration files built in 2271ms.
|
|
20
20
|
|
|
21
|
-
[32m✓ built in 2.
|
|
21
|
+
[32m✓ built in 2.40s[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# jazz-react
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 26386d9: Add explicit CoValue loading states:
|
|
8
|
+
- Add `$isLoaded` field to discriminate between loaded and unloaded CoValues
|
|
9
|
+
- Add `$jazz.loadingState` field to provide additional info about the loading state
|
|
10
|
+
- All methods and functions that load CoValues now return a `MaybeLoaded<CoValue>` instead of `CoValue | null | undefined`
|
|
11
|
+
- Rename `$onError: null` to `$onError: "catch"`
|
|
12
|
+
- Split the `useAccount` hook into three separate hooks:
|
|
13
|
+
- `useAccount`: now only returns an Account CoValue
|
|
14
|
+
- `useLogOut`: returns a function for logging out of the current account
|
|
15
|
+
- `useAgent`: returns the current agent
|
|
16
|
+
- Add a `select` option (and an optional `equalityFn`) to `useAccount` and `useCoState`, and remove `useAccountWithSelector` and `useCoStateWithSelector`.
|
|
17
|
+
- Allow specifying resolve queries at the schema level. Those queries will be used when loading CoValues, if no other resolve query is provided.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [26386d9]
|
|
22
|
+
- jazz-tools@0.19.0
|
|
23
|
+
- cojson@0.19.0
|
|
24
|
+
|
|
3
25
|
## 0.18.38
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/composables.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, AccountClass, AnonymousJazzAgent, AnyAccountSchema, AuthSecretStorage, CoValue, CoValueClassOrSchema, JazzContextManager, JazzContextType, Loaded,
|
|
1
|
+
import { Account, AccountClass, AnonymousJazzAgent, AnyAccountSchema, AuthSecretStorage, CoValue, CoValueClassOrSchema, JazzContextManager, JazzContextType, Loaded, MaybeLoaded, ResolveQuery, ResolveQueryStrict } from 'jazz-tools';
|
|
2
2
|
import { ComputedRef, Ref } from 'vue';
|
|
3
3
|
export declare const logoutHandler: Ref<(() => void) | undefined, (() => void) | undefined>;
|
|
4
4
|
export declare function useJazzContext<Acc extends Account>(): Ref<JazzContextType<Acc>, JazzContextType<Acc>>;
|
|
@@ -6,14 +6,23 @@ export declare function useJazzContextManager<Acc extends Account>(): Ref<JazzCo
|
|
|
6
6
|
export declare function useAuthSecretStorage(): AuthSecretStorage;
|
|
7
7
|
export declare function useAccount<A extends AccountClass<Account> | AnyAccountSchema = typeof Account, R extends ResolveQuery<A> = true>(AccountSchema?: A, options?: {
|
|
8
8
|
resolve?: ResolveQueryStrict<A, R>;
|
|
9
|
-
}):
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
}): ComputedRef<MaybeLoaded<Loaded<A, R>>>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a function for logging out the current account.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useLogOut(): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Hook for accessing the current agent. An agent can either be:
|
|
16
|
+
* - an Authenticated Account, if the user is logged in
|
|
17
|
+
* - an Anonymous Account, if the user didn't log in
|
|
18
|
+
* - or an anonymous agent, if in guest mode
|
|
19
|
+
*
|
|
20
|
+
* The agent can be used as the `loadAs` parameter for load and subscribe methods.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useAgent<A extends AccountClass<Account> | AnyAccountSchema = typeof Account>(): AnonymousJazzAgent | Loaded<A, true>;
|
|
23
|
+
export declare function useCoState<S extends CoValueClassOrSchema, const R extends ResolveQuery<S> = true>(Schema: S, id: string | undefined, options?: {
|
|
15
24
|
resolve?: ResolveQueryStrict<S, R>;
|
|
16
|
-
}): Ref<Loaded<S, R
|
|
25
|
+
}): Ref<MaybeLoaded<Loaded<S, R>>>;
|
|
17
26
|
export declare function useAcceptInvite<S extends CoValueClassOrSchema>({ invitedObjectSchema, onAccept, forValueHint, }: {
|
|
18
27
|
invitedObjectSchema: S;
|
|
19
28
|
onAccept: (projectID: string) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Account, subscribeToCoValue, coValueClassFromCoValueClassOrSchema, InboxSender, PassphraseAuth, JazzClerkAuth, KvStoreContext, InMemoryKVStore, ImageDefinition } from "jazz-tools";
|
|
1
|
+
import { Account, createUnloadedCoValue, CoValueLoadingState, subscribeToCoValue, coValueClassFromCoValueClassOrSchema, InboxSender, PassphraseAuth, JazzClerkAuth, KvStoreContext, InMemoryKVStore, ImageDefinition } from "jazz-tools";
|
|
2
2
|
import { consumeInviteLinkFromWindowLocation, BrowserPasskeyAuth, LocalStorageKVStore } from "jazz-tools/browser";
|
|
3
3
|
import { createInviteLink, parseInviteLink } from "jazz-tools/browser";
|
|
4
|
-
import { ref, inject, shallowRef, watch, toRaw,
|
|
4
|
+
import { ref, inject, shallowRef, watch, toRaw, onUnmounted, computed, markRaw, onMounted, watchEffect, defineComponent, h, createElementBlock, unref, openBlock, renderSlot, createElementVNode, createCommentVNode, toDisplayString, withModifiers, withDirectives, vModelText, normalizeStyle, normalizeClass } from "vue";
|
|
5
5
|
import { J as JazzContextSymbol, a as JazzAuthContextSymbol, b as JazzContextManagerSymbol, c as JazzVueProvider } from "./provider-CCZVJj45.js";
|
|
6
6
|
import { d } from "./provider-CCZVJj45.js";
|
|
7
7
|
import { highestResAvailable } from "jazz-tools/media";
|
|
@@ -41,17 +41,11 @@ function useAuthSecretStorage() {
|
|
|
41
41
|
}
|
|
42
42
|
function useAccount(AccountSchema = Account, options) {
|
|
43
43
|
const context = useJazzContext();
|
|
44
|
-
const contextManager = useJazzContextManager();
|
|
45
44
|
if (!context.value) {
|
|
46
45
|
throw new Error("useAccount must be used within a JazzProvider");
|
|
47
46
|
}
|
|
48
|
-
const agent = getCurrentAccountFromContextManager(contextManager.value);
|
|
49
47
|
if (!("me" in context.value)) {
|
|
50
|
-
return
|
|
51
|
-
me: computed(() => null),
|
|
52
|
-
agent,
|
|
53
|
-
logOut: context.value.logOut
|
|
54
|
-
};
|
|
48
|
+
return computed(() => null);
|
|
55
49
|
}
|
|
56
50
|
const contextMe = context.value.me;
|
|
57
51
|
const me = useCoState(
|
|
@@ -59,22 +53,36 @@ function useAccount(AccountSchema = Account, options) {
|
|
|
59
53
|
toRaw(contextMe).$jazz.id,
|
|
60
54
|
options
|
|
61
55
|
);
|
|
62
|
-
return {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
return computed(() => {
|
|
57
|
+
const value = (options == null ? void 0 : options.resolve) === void 0 ? me.value || contextMe : me.value;
|
|
58
|
+
return value ? markRaw(value) : value;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function useLogOut() {
|
|
62
|
+
const context = useJazzContext();
|
|
63
|
+
if (!context.value) {
|
|
64
|
+
throw new Error("useLogOut must be used within a JazzProvider");
|
|
65
|
+
}
|
|
66
|
+
return context.value.logOut;
|
|
67
|
+
}
|
|
68
|
+
function useAgent() {
|
|
69
|
+
const contextManager = useJazzContextManager();
|
|
70
|
+
const agent = getCurrentAccountFromContextManager(contextManager.value);
|
|
71
|
+
return agent;
|
|
70
72
|
}
|
|
71
73
|
function useCoState(Schema, id, options) {
|
|
72
|
-
const state = shallowRef(
|
|
74
|
+
const state = shallowRef(
|
|
75
|
+
createUnloadedCoValue(id ?? "", CoValueLoadingState.LOADING)
|
|
76
|
+
);
|
|
73
77
|
const context = useJazzContext();
|
|
74
78
|
if (!context.value) {
|
|
75
79
|
throw new Error("useCoState must be used within a JazzProvider");
|
|
76
80
|
}
|
|
77
81
|
let unsubscribe;
|
|
82
|
+
const updateState = (value) => {
|
|
83
|
+
if (shouldSkipUpdate(value, state.value)) return;
|
|
84
|
+
state.value = markRaw(value);
|
|
85
|
+
};
|
|
78
86
|
watch(
|
|
79
87
|
[() => id, context],
|
|
80
88
|
([currentId, currentContext]) => {
|
|
@@ -83,12 +91,19 @@ function useCoState(Schema, id, options) {
|
|
|
83
91
|
unsubscribe = void 0;
|
|
84
92
|
}
|
|
85
93
|
if (!currentId || !currentContext) {
|
|
86
|
-
|
|
94
|
+
updateState(
|
|
95
|
+
createUnloadedCoValue(
|
|
96
|
+
currentId ?? "",
|
|
97
|
+
CoValueLoadingState.UNAVAILABLE
|
|
98
|
+
)
|
|
99
|
+
);
|
|
87
100
|
return;
|
|
88
101
|
}
|
|
89
102
|
const loadAsAgent = "me" in currentContext ? currentContext.me : currentContext.guest;
|
|
90
103
|
if (!loadAsAgent) {
|
|
91
|
-
|
|
104
|
+
updateState(
|
|
105
|
+
createUnloadedCoValue(currentId, CoValueLoadingState.UNAVAILABLE)
|
|
106
|
+
);
|
|
92
107
|
return;
|
|
93
108
|
}
|
|
94
109
|
const safeLoadAsAgent = toRaw(loadAsAgent);
|
|
@@ -100,20 +115,32 @@ function useCoState(Schema, id, options) {
|
|
|
100
115
|
resolve: options == null ? void 0 : options.resolve,
|
|
101
116
|
loadAs: safeLoadAsAgent,
|
|
102
117
|
onUnavailable: () => {
|
|
103
|
-
|
|
118
|
+
updateState(
|
|
119
|
+
createUnloadedCoValue(
|
|
120
|
+
currentId,
|
|
121
|
+
CoValueLoadingState.UNAVAILABLE
|
|
122
|
+
)
|
|
123
|
+
);
|
|
104
124
|
},
|
|
105
125
|
onUnauthorized: () => {
|
|
106
|
-
|
|
126
|
+
updateState(
|
|
127
|
+
createUnloadedCoValue(
|
|
128
|
+
currentId,
|
|
129
|
+
CoValueLoadingState.UNAUTHORIZED
|
|
130
|
+
)
|
|
131
|
+
);
|
|
107
132
|
},
|
|
108
133
|
syncResolution: true
|
|
109
134
|
},
|
|
110
135
|
(value) => {
|
|
111
|
-
|
|
136
|
+
updateState(value);
|
|
112
137
|
}
|
|
113
138
|
);
|
|
114
139
|
} catch (error) {
|
|
115
140
|
console.error("Error in useCoState subscription:", error);
|
|
116
|
-
|
|
141
|
+
updateState(
|
|
142
|
+
createUnloadedCoValue(currentId, CoValueLoadingState.UNAVAILABLE)
|
|
143
|
+
);
|
|
117
144
|
}
|
|
118
145
|
},
|
|
119
146
|
{ immediate: true }
|
|
@@ -202,6 +229,10 @@ function experimental_useInboxSender(inboxOwnerID) {
|
|
|
202
229
|
);
|
|
203
230
|
return sendMessage;
|
|
204
231
|
}
|
|
232
|
+
function shouldSkipUpdate(newValue, previousValue) {
|
|
233
|
+
if (previousValue === newValue) return true;
|
|
234
|
+
return previousValue.$jazz.id === newValue.$jazz.id && !previousValue.$isLoaded && !newValue.$isLoaded && previousValue.$jazz.loadingState === newValue.$jazz.loadingState;
|
|
235
|
+
}
|
|
205
236
|
function useIsAuthenticated() {
|
|
206
237
|
const authSecretStorage = useAuthSecretStorage();
|
|
207
238
|
const isAuthenticated = ref(authSecretStorage.isAuthenticated);
|
|
@@ -564,9 +595,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
564
595
|
() => waitingLazyLoading.value ? URL.createObjectURL(emptyPixelBlob) : void 0
|
|
565
596
|
);
|
|
566
597
|
const dimensions = computed(() => {
|
|
567
|
-
|
|
568
|
-
const originalWidth =
|
|
569
|
-
const originalHeight =
|
|
598
|
+
const originalSize = image.value.$isLoaded ? image.value.originalSize : void 0;
|
|
599
|
+
const originalWidth = originalSize == null ? void 0 : originalSize[0];
|
|
600
|
+
const originalHeight = originalSize == null ? void 0 : originalSize[1];
|
|
570
601
|
if (props.width === "original" && props.height === "original") {
|
|
571
602
|
return { width: originalWidth, height: originalHeight };
|
|
572
603
|
}
|
|
@@ -597,7 +628,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
597
628
|
if (waitingLazyLoading.value) {
|
|
598
629
|
return lazyPlaceholder.value;
|
|
599
630
|
}
|
|
600
|
-
if (!image.value) return void 0;
|
|
631
|
+
if (!image.value.$isLoaded) return void 0;
|
|
601
632
|
const bestImage = highestResAvailable(
|
|
602
633
|
image.value,
|
|
603
634
|
dimensions.value.width || dimensions.value.height || 9999,
|
|
@@ -664,12 +695,14 @@ export {
|
|
|
664
695
|
parseInviteLink,
|
|
665
696
|
useAcceptInvite,
|
|
666
697
|
useAccount,
|
|
698
|
+
useAgent,
|
|
667
699
|
useAuthSecretStorage,
|
|
668
700
|
useClerkAuth,
|
|
669
701
|
useCoState,
|
|
670
702
|
useIsAuthenticated,
|
|
671
703
|
useJazzContext,
|
|
672
704
|
useJazzContextManager,
|
|
705
|
+
useLogOut,
|
|
673
706
|
usePasskeyAuth,
|
|
674
707
|
usePassphraseAuth
|
|
675
708
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/composables.ts","../src/auth/useIsAuthenticated.ts","../src/auth/usePassphraseAuth.ts","../src/auth/usePasskeyAuth.ts","../src/auth/useClerkAuth.ts","../src/auth/JazzVueProviderWithClerk.ts","../src/auth/PasskeyAuthBasicUI.vue","../src/Image.vue"],"sourcesContent":["import {\n Account,\n AccountClass,\n AnonymousJazzAgent,\n AnyAccountSchema,\n type AuthSecretStorage,\n type CoValue,\n CoValueClassOrSchema,\n InboxSender,\n InstanceOfSchema,\n type JazzAuthContext,\n JazzContextManager,\n type JazzContextType,\n type Loaded,\n type RefsToResolve,\n ResolveQuery,\n ResolveQueryStrict,\n coValueClassFromCoValueClassOrSchema,\n subscribeToCoValue,\n} from \"jazz-tools\";\nimport { consumeInviteLinkFromWindowLocation } from \"jazz-tools/browser\";\nimport {\n type ComputedRef,\n type Ref,\n type ShallowRef,\n computed,\n inject,\n markRaw,\n nextTick,\n onMounted,\n onUnmounted,\n ref,\n shallowRef,\n toRaw,\n watch,\n} from \"vue\";\n\nimport {\n JazzAuthContextSymbol,\n JazzContextManagerSymbol,\n JazzContextSymbol,\n} from \"./provider.js\";\n\nexport const logoutHandler = ref<() => void>();\n\nfunction getCurrentAccountFromContextManager<Acc extends Account>(\n contextManager: JazzContextManager<Acc, any>,\n) {\n const context = contextManager.getCurrentValue();\n\n if (!context) {\n throw new Error(\"No context found\");\n }\n\n return \"me\" in context ? context.me : context.guest;\n}\n\nexport function useJazzContext<Acc extends Account>(): Ref<\n JazzContextType<Acc>,\n JazzContextType<Acc>\n> {\n const context = inject<Ref<JazzContextType<Acc>>>(JazzContextSymbol);\n if (!context) {\n throw new Error(\"useJazzContext must be used within a JazzProvider\");\n }\n return context;\n}\n\nexport function useJazzContextManager<Acc extends Account>() {\n const context = inject<Ref<JazzContextManager<Acc, {}>>>(\n JazzContextManagerSymbol,\n );\n\n if (!context?.value) {\n throw new Error(\n \"You need to set up a JazzProvider on top of your app to use this hook.\",\n );\n }\n\n return context;\n}\n\nexport function useAuthSecretStorage() {\n const context = inject<AuthSecretStorage>(JazzAuthContextSymbol);\n if (!context) {\n throw new Error(\"useAuthSecretStorage must be used within a JazzProvider\");\n }\n return context;\n}\n\nexport function useAccount<\n A extends AccountClass<Account> | AnyAccountSchema = typeof Account,\n R extends ResolveQuery<A> = true,\n>(\n AccountSchema: A = Account as unknown as A,\n options?: {\n resolve?: ResolveQueryStrict<A, R>;\n },\n): {\n me: ComputedRef<Loaded<A, R> | undefined | null>;\n agent: AnonymousJazzAgent | Loaded<A, true>;\n logOut: () => void;\n} {\n const context = useJazzContext();\n const contextManager = useJazzContextManager<InstanceOfSchema<A>>();\n\n if (!context.value) {\n throw new Error(\"useAccount must be used within a JazzProvider\");\n }\n\n const agent = getCurrentAccountFromContextManager(contextManager.value);\n\n // Handle guest mode - return null for me and the guest agent\n if (!(\"me\" in context.value)) {\n return {\n me: computed(() => null) as any,\n agent: agent,\n logOut: context.value.logOut,\n };\n }\n\n const contextMe = context.value.me as InstanceOfSchema<A>;\n\n const me = useCoState(\n AccountSchema as any,\n toRaw(contextMe).$jazz.id,\n options as any,\n );\n\n return {\n me: computed(() => {\n const value =\n options?.resolve === undefined ? me.value || contextMe : me.value;\n return value ? markRaw(value) : value;\n }) as any,\n agent: agent,\n logOut: context.value.logOut,\n };\n}\n\nexport function useCoState<\n S extends CoValueClassOrSchema,\n const R extends RefsToResolve<S> = true,\n>(\n Schema: S,\n id: string | undefined,\n options?: { resolve?: ResolveQueryStrict<S, R> },\n): Ref<Loaded<S, R> | undefined | null> {\n const state: ShallowRef<Loaded<S, R> | undefined | null> =\n shallowRef(undefined);\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\"useCoState must be used within a JazzProvider\");\n }\n\n let unsubscribe: (() => void) | undefined;\n\n watch(\n [() => id, context],\n ([currentId, currentContext]) => {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n }\n\n if (!currentId || !currentContext) {\n state.value = undefined;\n return;\n }\n\n const loadAsAgent =\n \"me\" in currentContext ? currentContext.me : currentContext.guest;\n if (!loadAsAgent) {\n state.value = undefined;\n return;\n }\n\n const safeLoadAsAgent = toRaw(loadAsAgent);\n\n try {\n unsubscribe = subscribeToCoValue(\n coValueClassFromCoValueClassOrSchema(Schema),\n currentId as any,\n {\n resolve: options?.resolve as any,\n loadAs: safeLoadAsAgent,\n onUnavailable: () => {\n state.value = null;\n },\n onUnauthorized: () => {\n state.value = null;\n },\n syncResolution: true,\n },\n (value: any) => {\n // Use markRaw to prevent Vue from making Jazz objects reactive\n // but still allow property access and mutations\n state.value = value ? markRaw(value) : value;\n },\n );\n } catch (error) {\n console.error(\"Error in useCoState subscription:\", error);\n state.value = null;\n }\n },\n { immediate: true },\n );\n\n onUnmounted(() => {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n }\n });\n\n return state;\n}\n\nexport function useAcceptInvite<S extends CoValueClassOrSchema>({\n invitedObjectSchema,\n onAccept,\n forValueHint,\n}: {\n invitedObjectSchema: S;\n onAccept: (projectID: string) => void;\n forValueHint?: string;\n}): void {\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\"useAcceptInvite must be used within a JazzProvider\");\n }\n\n if (!(\"me\" in context.value)) {\n throw new Error(\n \"useAcceptInvite can't be used in a JazzProvider with auth === 'guest'.\",\n );\n }\n\n const handleInvite = () => {\n const result = consumeInviteLinkFromWindowLocation({\n as: toRaw((context.value as JazzAuthContext<Account>).me),\n invitedObjectSchema,\n forValueHint,\n });\n\n result\n .then((res) => res && onAccept(res.valueID))\n .catch((e) => {\n console.error(\"Failed to accept invite\", e);\n });\n };\n\n onMounted(() => {\n handleInvite();\n window.addEventListener(\"hashchange\", handleInvite);\n });\n\n onUnmounted(() => {\n window.removeEventListener(\"hashchange\", handleInvite);\n });\n\n watch(\n () => onAccept,\n (newOnAccept, oldOnAccept) => {\n if (newOnAccept !== oldOnAccept) {\n handleInvite();\n }\n },\n );\n}\n\nexport function experimental_useInboxSender<\n I extends CoValue,\n O extends CoValue | undefined,\n>(inboxOwnerID: string | undefined) {\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\n \"experimental_useInboxSender must be used within a JazzProvider\",\n );\n }\n\n if (!(\"me\" in context.value)) {\n throw new Error(\n \"experimental_useInboxSender can't be used in a JazzProvider with auth === 'guest'.\",\n );\n }\n\n const me = computed(() => (context.value as JazzAuthContext<Account>).me);\n const inboxRef = ref<Promise<InboxSender<I, O>> | undefined>(undefined);\n\n const sendMessage = async (message: I) => {\n if (!inboxOwnerID) throw new Error(\"Inbox owner ID is required\");\n\n if (!inboxRef.value) {\n const inbox = InboxSender.load<I, O>(inboxOwnerID, toRaw(me.value));\n inboxRef.value = inbox;\n }\n\n let inbox = await inboxRef.value;\n\n if (inbox.owner.id !== inboxOwnerID) {\n const req = InboxSender.load<I, O>(inboxOwnerID, toRaw(me.value));\n inboxRef.value = req;\n inbox = await req;\n }\n\n return inbox.sendMessage(message);\n };\n\n watch(\n () => inboxOwnerID,\n () => {\n inboxRef.value = undefined;\n },\n );\n\n return sendMessage;\n}\n\n// useAccountOrGuest has been removed in v0.15.4 to match React library.\n// It has been merged into useAccount which now handles both authenticated and guest scenarios.\n// This change maintains 1:1 API compatibility with the React Jazz library.\n// If you were using useAccountOrGuest, please migrate to useAccount.\n","import { onUnmounted, ref } from \"vue\";\nimport { useAuthSecretStorage } from \"../composables.js\";\n\nexport function useIsAuthenticated() {\n const authSecretStorage = useAuthSecretStorage();\n const isAuthenticated = ref(authSecretStorage.isAuthenticated);\n\n const handleUpdate = (newIsAuthenticated: boolean) => {\n isAuthenticated.value = newIsAuthenticated;\n };\n\n // Set up the listener immediately, not waiting for onMounted\n // This ensures we catch auth state changes that happen before mounting\n const cleanup = authSecretStorage.onUpdate(handleUpdate);\n\n onUnmounted(() => {\n cleanup();\n });\n\n return isAuthenticated;\n}\n","import { PassphraseAuth } from \"jazz-tools\";\nimport { computed, markRaw, ref, watchEffect } from \"vue\";\nimport { useAuthSecretStorage, useJazzContext } from \"../composables.js\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated.js\";\n\n/**\n * `usePassphraseAuth` composable provides a `JazzAuth` object for passphrase authentication.\n *\n * @example\n * ```ts\n * const auth = usePassphraseAuth({ wordlist });\n * ```\n *\n * @category Auth Providers\n */\nexport function usePassphraseAuth({ wordlist }: { wordlist: string[] }) {\n const context = useJazzContext();\n const authSecretStorage = useAuthSecretStorage();\n const isAuthenticated = useIsAuthenticated();\n\n if (\"guest\" in context.value) {\n throw new Error(\"Passphrase auth is not supported in guest mode\");\n }\n\n const authMethod = computed(() => {\n return markRaw(\n new PassphraseAuth(\n context.value.node.crypto,\n context.value.authenticate,\n context.value.register,\n authSecretStorage,\n wordlist,\n ),\n );\n });\n\n const passphrase = ref(authMethod.value.passphrase);\n\n watchEffect((onCleanup) => {\n authMethod.value.loadCurrentAccountPassphrase();\n\n const unsubscribe = authMethod.value.subscribe(() => {\n passphrase.value = authMethod.value.passphrase;\n });\n\n onCleanup(unsubscribe);\n });\n\n return computed(() => ({\n state: isAuthenticated.value ? \"signedIn\" : \"anonymous\",\n logIn: authMethod.value.logIn,\n signUp: authMethod.value.signUp,\n registerNewAccount: authMethod.value.registerNewAccount,\n generateRandomPassphrase: authMethod.value.generateRandomPassphrase,\n passphrase: passphrase.value,\n }));\n}\n","import { BrowserPasskeyAuth } from \"jazz-tools/browser\";\nimport { computed, markRaw } from \"vue\";\nimport { useAuthSecretStorage, useJazzContext } from \"../composables.js\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated.js\";\n\n/**\n * `usePasskeyAuth` composable provides a `JazzAuth` object for passkey authentication.\n *\n * @example\n * ```ts\n * const auth = usePasskeyAuth({ appName, appHostname });\n * ```\n *\n * @category Auth Providers\n */\nexport function usePasskeyAuth({\n appName,\n appHostname,\n}: {\n appName: string;\n appHostname?: string;\n}) {\n const context = useJazzContext();\n const authSecretStorage = useAuthSecretStorage();\n const isAuthenticated = useIsAuthenticated();\n\n if (\"guest\" in context.value) {\n throw new Error(\"Passkey auth is not supported in guest mode\");\n }\n\n const authMethod = computed(() => {\n return markRaw(\n new BrowserPasskeyAuth(\n context.value.node.crypto,\n context.value.authenticate,\n authSecretStorage,\n appName,\n appHostname,\n ),\n );\n });\n\n return computed(() => ({\n state: isAuthenticated.value ? \"signedIn\" : \"anonymous\",\n logIn: authMethod.value.logIn,\n signUp: authMethod.value.signUp,\n }));\n}\n","import { JazzClerkAuth, type MinimalClerkClient } from \"jazz-tools\";\nimport { computed, markRaw, onMounted, onUnmounted } from \"vue\";\nimport { useAuthSecretStorage, useJazzContext } from \"../composables.js\";\n\nexport function useClerkAuth(clerk: MinimalClerkClient) {\n const context = useJazzContext();\n const authSecretStorage = useAuthSecretStorage();\n\n if (\"guest\" in context.value) {\n throw new Error(\"Clerk auth is not supported in guest mode\");\n }\n\n // Create auth method similar to React's useMemo pattern\n const authMethod = computed(() => {\n return markRaw(\n new JazzClerkAuth(\n context.value.authenticate,\n context.value.logOut,\n authSecretStorage,\n ),\n );\n });\n\n onMounted(() => {\n const cleanup = authMethod.value.registerListener(clerk) as\n | (() => void)\n | void;\n\n onUnmounted(() => {\n // Clerk's addListener returns a cleanup function, but the type says void\n // Handle both cases for type safety\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n });\n });\n\n return authMethod.value;\n}\n","import type {\n Account,\n AccountClass,\n AnyAccountSchema,\n CoValueFromRaw,\n SyncConfig,\n} from \"jazz-tools\";\nimport {\n InMemoryKVStore,\n JazzClerkAuth,\n KvStoreContext,\n type MinimalClerkClient,\n} from \"jazz-tools\";\nimport { LocalStorageKVStore } from \"jazz-tools/browser\";\nimport { type PropType, defineComponent, h, onMounted, ref } from \"vue\";\nimport { JazzVueProvider } from \"../provider.js\";\nimport { useClerkAuth } from \"./useClerkAuth.js\";\n\nfunction setupKvStore() {\n KvStoreContext.getInstance().initialize(\n typeof window === \"undefined\"\n ? new InMemoryKVStore()\n : new LocalStorageKVStore(),\n );\n}\n\nconst RegisterClerkAuth = defineComponent({\n name: \"RegisterClerkAuth\",\n props: {\n clerk: {\n type: Object as PropType<MinimalClerkClient>,\n required: true,\n },\n },\n setup(props, { slots }) {\n useClerkAuth(props.clerk);\n return () => slots.default?.();\n },\n});\n\nexport const JazzVueProviderWithClerk = defineComponent({\n name: \"JazzVueProviderWithClerk\",\n props: {\n clerk: {\n type: Object as PropType<MinimalClerkClient>,\n required: true,\n },\n AccountSchema: {\n type: [Function, Object] as unknown as PropType<\n (AccountClass<Account> & CoValueFromRaw<Account>) | AnyAccountSchema\n >,\n required: false,\n },\n guestMode: {\n type: Boolean,\n default: false,\n },\n sync: {\n type: Object as PropType<SyncConfig>,\n required: true,\n },\n storage: {\n type: String as PropType<\"indexedDB\">,\n default: undefined,\n },\n defaultProfileName: {\n type: String,\n required: false,\n },\n onLogOut: {\n type: Function as PropType<() => void>,\n required: false,\n },\n onAnonymousAccountDiscarded: {\n type: Function as PropType<(anonymousAccount: Account) => Promise<void>>,\n required: false,\n },\n enableSSR: {\n type: Boolean,\n default: false,\n },\n },\n setup(props, { slots }) {\n const isLoaded = ref(false);\n\n onMounted(async () => {\n try {\n setupKvStore();\n await JazzClerkAuth.initializeAuth(props.clerk);\n isLoaded.value = true;\n } catch (error) {\n console.error(\"Jazz + Clerk initialization error:\", error);\n // Still render even if auth init fails\n isLoaded.value = true;\n }\n });\n\n return () => {\n if (!isLoaded.value) {\n return null;\n }\n\n // Destructure props to exclude 'clerk' which JazzVueProvider doesn't accept\n const { clerk, ...jazzProviderProps } = props;\n\n return h(\n JazzVueProvider,\n {\n ...jazzProviderProps,\n logOutReplacement: clerk.signOut,\n },\n {\n default: () =>\n h(\n RegisterClerkAuth,\n { clerk },\n { default: () => slots.default?.() },\n ),\n },\n );\n };\n },\n});\n","<template>\n <div v-if=\"auth.state === 'signedIn'\">\n <slot />\n </div>\n <div v-else :style=\"containerStyle\">\n <div :style=\"cardStyle\">\n <h1 :style=\"headingStyle\">{{ appName }}</h1>\n \n <div v-if=\"error\" :style=\"errorStyle\">\n {{ error }}\n </div>\n\n <form @submit.prevent=\"handleSignUp\" :style=\"formStyle\">\n <input\n v-model=\"username\"\n type=\"text\"\n placeholder=\"Display name\"\n autocomplete=\"name\"\n :style=\"inputStyle\"\n />\n <button type=\"submit\" :style=\"primaryButtonStyle\">\n Sign up\n </button>\n </form>\n\n <button @click=\"handleLogIn\" :style=\"secondaryButtonStyle\">\n Log in with existing account\n </button>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { usePasskeyAuth } from \"./usePasskeyAuth.js\";\n\ninterface Props {\n appName: string;\n appHostname?: string;\n}\n\nconst props = defineProps<Props>();\n\nconst username = ref(\"\");\nconst error = ref<string | null>(null);\n\nconst auth = usePasskeyAuth({\n appName: props.appName,\n appHostname: props.appHostname,\n});\n\nfunction handleError(err: Error) {\n if (err.cause instanceof Error) {\n error.value = err.cause.message;\n } else {\n error.value = err.message;\n }\n}\n\nconst handleSignUp = async () => {\n if (!username.value.trim()) {\n error.value = \"Name is required\";\n return;\n }\n\n error.value = null;\n try {\n await auth.value.signUp(username.value.trim());\n } catch (err) {\n handleError(err as Error);\n }\n};\n\nconst handleLogIn = async () => {\n error.value = null;\n try {\n await auth.value.logIn();\n } catch (err) {\n handleError(err as Error);\n }\n};\n\n// Styles (matching React version)\nconst containerStyle = {\n width: \"100vw\",\n height: \"100vh\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"#f3f4f6\",\n padding: \"1rem\",\n};\n\nconst cardStyle = {\n backgroundColor: \"white\",\n padding: \"2rem\",\n borderRadius: \"0.5rem\",\n boxShadow: \"0 10px 15px -3px rgba(0, 0, 0, 0.1)\",\n width: \"100%\",\n maxWidth: \"18rem\",\n display: \"flex\",\n flexDirection: \"column\" as const,\n gap: \"2rem\",\n};\n\nconst headingStyle = {\n fontSize: \"1.5rem\",\n fontWeight: \"bold\",\n textAlign: \"center\" as const,\n margin: \"0\",\n};\n\nconst errorStyle = {\n color: \"red\",\n fontSize: \"0.875rem\",\n textAlign: \"center\" as const,\n};\n\nconst formStyle = {\n display: \"flex\",\n flexDirection: \"column\" as const,\n gap: \"0.5rem\",\n};\n\nconst inputStyle = {\n padding: \"0.75rem\",\n border: \"1px solid #d1d5db\",\n borderRadius: \"0.375rem\",\n fontSize: \"1rem\",\n};\n\nconst primaryButtonStyle = {\n backgroundColor: \"#3b82f6\",\n color: \"white\",\n padding: \"0.75rem 1rem\",\n border: \"none\",\n borderRadius: \"0.375rem\",\n cursor: \"pointer\",\n fontSize: \"1rem\",\n fontWeight: \"500\",\n};\n\nconst secondaryButtonStyle = {\n backgroundColor: \"#e5e7eb\",\n color: \"#374151\",\n padding: \"0.75rem 1rem\",\n border: \"none\",\n borderRadius: \"0.375rem\",\n cursor: \"pointer\",\n fontSize: \"1rem\",\n fontWeight: \"500\",\n};\n</script>\n","<script setup lang=\"ts\">\nimport { ImageDefinition } from \"jazz-tools\";\nimport { highestResAvailable } from \"jazz-tools/media\";\nimport { onUnmounted, ref, watch, computed } from \"vue\";\nimport { useCoState } from \"./composables.js\";\n\nexport interface ImageProps {\n /** The ID of the ImageDefinition to display */\n imageId: string;\n /**\n * The desired width of the image. Can be a number in pixels or \"original\" to use the image's original width.\n * When set to a number, the component will select the best available resolution and maintain aspect ratio.\n */\n width?: number | \"original\";\n /**\n * The desired height of the image. Can be a number in pixels or \"original\" to use the image's original height.\n * When set to a number, the component will select the best available resolution and maintain aspect ratio.\n */\n height?: number | \"original\";\n /** Alt text for the image */\n alt?: string;\n /** CSS classes to apply to the image */\n classNames?: string;\n /** CSS styles to apply to the image */\n style?: string | Record<string, string>;\n /** Loading strategy for the image */\n loading?: \"lazy\" | \"eager\";\n}\n\nconst props = withDefaults(defineProps<ImageProps>(), {\n loading: \"eager\",\n});\n\nconst image = useCoState(ImageDefinition, props.imageId, {});\nlet lastBestImage: [string, string] | null = null;\n\n/**\n * For lazy loading, we use the browser's strategy for images with loading=\"lazy\".\n * We use an empty image, and when the browser triggers the load event, we load the best available image.\n */\nconst waitingLazyLoading = ref(props.loading === \"lazy\");\nconst lazyPlaceholder = computed(() =>\n waitingLazyLoading.value ? URL.createObjectURL(emptyPixelBlob) : undefined,\n);\n\nconst dimensions = computed(() => {\n const originalWidth = image.value?.originalSize?.[0];\n const originalHeight = image.value?.originalSize?.[1];\n\n // Both width and height are \"original\"\n if (props.width === \"original\" && props.height === \"original\") {\n return { width: originalWidth, height: originalHeight };\n }\n\n // Width is \"original\", height is a number\n if (props.width === \"original\" && typeof props.height === \"number\") {\n if (originalWidth && originalHeight) {\n return {\n width: Math.round((props.height * originalWidth) / originalHeight),\n height: props.height,\n };\n }\n return { width: undefined, height: props.height };\n }\n\n // Height is \"original\", width is a number\n if (props.height === \"original\" && typeof props.width === \"number\") {\n if (originalWidth && originalHeight) {\n return {\n width: props.width,\n height: Math.round((props.width * originalHeight) / originalWidth),\n };\n }\n return { width: props.width, height: undefined };\n }\n\n // In all other cases, use the property value:\n return {\n width: props.width === \"original\" ? originalWidth : props.width,\n height: props.height === \"original\" ? originalHeight : props.height,\n };\n});\n\nconst src = computed(() => {\n if (waitingLazyLoading.value) {\n return lazyPlaceholder.value;\n }\n\n if (!image.value) return undefined;\n\n const bestImage = highestResAvailable(\n image.value,\n dimensions.value.width || dimensions.value.height || 9999,\n dimensions.value.height || dimensions.value.width || 9999,\n );\n\n if (!bestImage) return image.value.placeholderDataURL;\n if (lastBestImage?.[0] === bestImage.image.$jazz.id)\n return lastBestImage?.[1];\n\n const blob = bestImage.image.toBlob();\n\n if (blob) {\n const url = URL.createObjectURL(blob);\n revokeObjectURL(lastBestImage?.[1]);\n lastBestImage = [bestImage.image.$jazz.id, url];\n return url;\n }\n\n return image.value.placeholderDataURL;\n});\n\nconst onThresholdReached = () => {\n waitingLazyLoading.value = false;\n};\n\n// Cleanup object URL on component destroy\nonUnmounted(() => {\n revokeObjectURL(lastBestImage?.[1]);\n});\n\nfunction revokeObjectURL(url: string | undefined) {\n if (url && url.startsWith(\"blob:\")) {\n URL.revokeObjectURL(url);\n }\n}\n\nconst emptyPixelBlob = new Blob(\n [\n Uint8Array.from(\n atob(\n \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\",\n ),\n (c) => c.charCodeAt(0),\n ),\n ],\n { type: \"image/png\" },\n);\n</script>\n\n<template>\n <img\n :src=\"src\"\n :width=\"dimensions.width\"\n :height=\"dimensions.height\"\n :alt=\"alt\"\n :class=\"classNames\"\n :style=\"style\"\n :loading=\"loading\"\n @load=\"waitingLazyLoading ? onThresholdReached() : undefined\"\n />\n</template>\n"],"names":["inbox"],"mappings":";;;;;;;;AA2CO,MAAM,gBAAgB,IAAgB;AAE7C,SAAS,oCACP,gBACA;AACM,QAAA,UAAU,eAAe,gBAAgB;AAE/C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,kBAAkB;AAAA,EAAA;AAGpC,SAAO,QAAQ,UAAU,QAAQ,KAAK,QAAQ;AAChD;AAEO,SAAS,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MAAM,SAAS;AAAA,MACvD;AAEA,UAAI,CAAC,UAAkB,QAAA,MAAM,MAAM;AACnC,WAAI,+CAAgB,QAAO,UAAU,MAAM,MAAM;AAC/C,eAAO,+CAAgB;AAEnB,YAAA,OAAO,UAAU,MAAM,OAAO;AAEpC,UAAI,MAAM;AACF,cAAA,MAAM,IAAI,gBAAgB,IAAI;AACpB,wBAAA,+CAAgB,EAAE;AAClC,wBAAgB,CAAC,UAAU,MAAM,MAAM,IAAI,GAAG;AACvC,eAAA;AAAA,MAAA;AAGT,aAAO,MAAM,MAAM;AAAA,IAAA,CACpB;AAED,UAAM,qBAAqB,MAAM;AAC/B,yBAAmB,QAAQ;AAAA,IAC7B;AAGA,gBAAY,MAAM;AACA,sBAAA,+CAAgB,EAAE;AAAA,IAAA,CACnC;AAED,aAAS,gBAAgB,KAAyB;AAChD,UAAI,OAAO,IAAI,WAAW,OAAO,GAAG;AAClC,YAAI,gBAAgB,GAAG;AAAA,MAAA;AAAA,IACzB;AAGF,UAAM,iBAAiB,IAAI;AAAA,MACzB;AAAA,QACE,WAAW;AAAA,UACT;AAAA,YACE;AAAA,UACF;AAAA,UACA,CAAC,MAAM,EAAE,WAAW,CAAC;AAAA,QAAA;AAAA,MAEzB;AAAA,MACA,EAAE,MAAM,YAAY;AAAA,IACtB;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/composables.ts","../src/auth/useIsAuthenticated.ts","../src/auth/usePassphraseAuth.ts","../src/auth/usePasskeyAuth.ts","../src/auth/useClerkAuth.ts","../src/auth/JazzVueProviderWithClerk.ts","../src/auth/PasskeyAuthBasicUI.vue","../src/Image.vue"],"sourcesContent":["import {\n Account,\n AccountClass,\n AnonymousJazzAgent,\n AnyAccountSchema,\n type AuthSecretStorage,\n type CoValue,\n CoValueClassOrSchema,\n InboxSender,\n InstanceOfSchema,\n type JazzAuthContext,\n JazzContextManager,\n type JazzContextType,\n type Loaded,\n type MaybeLoaded,\n CoValueLoadingState,\n type ResolveQuery,\n ResolveQueryStrict,\n coValueClassFromCoValueClassOrSchema,\n subscribeToCoValue,\n createUnloadedCoValue,\n} from \"jazz-tools\";\nimport { consumeInviteLinkFromWindowLocation } from \"jazz-tools/browser\";\nimport {\n type ComputedRef,\n type Ref,\n type ShallowRef,\n computed,\n inject,\n markRaw,\n nextTick,\n onMounted,\n onUnmounted,\n ref,\n shallowRef,\n toRaw,\n watch,\n} from \"vue\";\n\nimport {\n JazzAuthContextSymbol,\n JazzContextManagerSymbol,\n JazzContextSymbol,\n} from \"./provider.js\";\n\nexport const logoutHandler = ref<() => void>();\n\nfunction getCurrentAccountFromContextManager<Acc extends Account>(\n contextManager: JazzContextManager<Acc, any>,\n) {\n const context = contextManager.getCurrentValue();\n\n if (!context) {\n throw new Error(\"No context found\");\n }\n\n return \"me\" in context ? context.me : context.guest;\n}\n\nexport function useJazzContext<Acc extends Account>(): Ref<\n JazzContextType<Acc>,\n JazzContextType<Acc>\n> {\n const context = inject<Ref<JazzContextType<Acc>>>(JazzContextSymbol);\n if (!context) {\n throw new Error(\"useJazzContext must be used within a JazzProvider\");\n }\n return context;\n}\n\nexport function useJazzContextManager<Acc extends Account>() {\n const context = inject<Ref<JazzContextManager<Acc, {}>>>(\n JazzContextManagerSymbol,\n );\n\n if (!context?.value) {\n throw new Error(\n \"You need to set up a JazzProvider on top of your app to use this hook.\",\n );\n }\n\n return context;\n}\n\nexport function useAuthSecretStorage() {\n const context = inject<AuthSecretStorage>(JazzAuthContextSymbol);\n if (!context) {\n throw new Error(\"useAuthSecretStorage must be used within a JazzProvider\");\n }\n return context;\n}\n\nexport function useAccount<\n A extends AccountClass<Account> | AnyAccountSchema = typeof Account,\n R extends ResolveQuery<A> = true,\n>(\n AccountSchema: A = Account as unknown as A,\n options?: {\n resolve?: ResolveQueryStrict<A, R>;\n },\n): ComputedRef<MaybeLoaded<Loaded<A, R>>> {\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\"useAccount must be used within a JazzProvider\");\n }\n\n // Handle guest mode - return null for the account data\n if (!(\"me\" in context.value)) {\n return computed(() => null) as any;\n }\n\n const contextMe = context.value.me as InstanceOfSchema<A>;\n\n const me = useCoState(\n AccountSchema as any,\n toRaw(contextMe).$jazz.id,\n options as any,\n );\n\n return computed(() => {\n const value =\n options?.resolve === undefined ? me.value || contextMe : me.value;\n return value ? markRaw(value) : value;\n }) as any;\n}\n\n/**\n * Returns a function for logging out the current account.\n */\nexport function useLogOut(): () => void {\n const context = useJazzContext();\n if (!context.value) {\n throw new Error(\"useLogOut must be used within a JazzProvider\");\n }\n return context.value.logOut;\n}\n\n/**\n * Hook for accessing the current agent. An agent can either be:\n * - an Authenticated Account, if the user is logged in\n * - an Anonymous Account, if the user didn't log in\n * - or an anonymous agent, if in guest mode\n *\n * The agent can be used as the `loadAs` parameter for load and subscribe methods.\n */\nexport function useAgent<\n A extends AccountClass<Account> | AnyAccountSchema = typeof Account,\n>(): AnonymousJazzAgent | Loaded<A, true> {\n const contextManager = useJazzContextManager<InstanceOfSchema<A>>();\n const agent = getCurrentAccountFromContextManager(contextManager.value);\n return agent as AnonymousJazzAgent | Loaded<A, true>;\n}\n\nexport function useCoState<\n S extends CoValueClassOrSchema,\n const R extends ResolveQuery<S> = true,\n>(\n Schema: S,\n id: string | undefined,\n options?: { resolve?: ResolveQueryStrict<S, R> },\n): Ref<MaybeLoaded<Loaded<S, R>>> {\n const state: ShallowRef<MaybeLoaded<Loaded<S, R>>> = shallowRef(\n createUnloadedCoValue(id ?? \"\", CoValueLoadingState.LOADING),\n );\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\"useCoState must be used within a JazzProvider\");\n }\n\n let unsubscribe: (() => void) | undefined;\n\n const updateState = (value: MaybeLoaded<Loaded<S, R>>) => {\n if (shouldSkipUpdate(value, state.value)) return;\n // Use markRaw to prevent Vue from making Jazz objects reactive\n // but still allow property access and mutations\n state.value = markRaw(value);\n };\n\n watch(\n [() => id, context],\n ([currentId, currentContext]) => {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n }\n\n if (!currentId || !currentContext) {\n updateState(\n createUnloadedCoValue(\n currentId ?? \"\",\n CoValueLoadingState.UNAVAILABLE,\n ),\n );\n return;\n }\n\n const loadAsAgent =\n \"me\" in currentContext ? currentContext.me : currentContext.guest;\n if (!loadAsAgent) {\n updateState(\n createUnloadedCoValue(currentId, CoValueLoadingState.UNAVAILABLE),\n );\n return;\n }\n\n const safeLoadAsAgent = toRaw(loadAsAgent);\n\n try {\n unsubscribe = subscribeToCoValue(\n coValueClassFromCoValueClassOrSchema(Schema),\n currentId as any,\n {\n resolve: options?.resolve as any,\n loadAs: safeLoadAsAgent,\n onUnavailable: () => {\n updateState(\n createUnloadedCoValue(\n currentId,\n CoValueLoadingState.UNAVAILABLE,\n ),\n );\n },\n onUnauthorized: () => {\n updateState(\n createUnloadedCoValue(\n currentId,\n CoValueLoadingState.UNAUTHORIZED,\n ),\n );\n },\n syncResolution: true,\n },\n (value: any) => {\n updateState(value);\n },\n );\n } catch (error) {\n console.error(\"Error in useCoState subscription:\", error);\n updateState(\n createUnloadedCoValue(currentId, CoValueLoadingState.UNAVAILABLE),\n );\n }\n },\n { immediate: true },\n );\n\n onUnmounted(() => {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n }\n });\n\n return state;\n}\n\nexport function useAcceptInvite<S extends CoValueClassOrSchema>({\n invitedObjectSchema,\n onAccept,\n forValueHint,\n}: {\n invitedObjectSchema: S;\n onAccept: (projectID: string) => void;\n forValueHint?: string;\n}): void {\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\"useAcceptInvite must be used within a JazzProvider\");\n }\n\n if (!(\"me\" in context.value)) {\n throw new Error(\n \"useAcceptInvite can't be used in a JazzProvider with auth === 'guest'.\",\n );\n }\n\n const handleInvite = () => {\n const result = consumeInviteLinkFromWindowLocation({\n as: toRaw((context.value as JazzAuthContext<Account>).me),\n invitedObjectSchema,\n forValueHint,\n });\n\n result\n .then((res) => res && onAccept(res.valueID))\n .catch((e) => {\n console.error(\"Failed to accept invite\", e);\n });\n };\n\n onMounted(() => {\n handleInvite();\n window.addEventListener(\"hashchange\", handleInvite);\n });\n\n onUnmounted(() => {\n window.removeEventListener(\"hashchange\", handleInvite);\n });\n\n watch(\n () => onAccept,\n (newOnAccept, oldOnAccept) => {\n if (newOnAccept !== oldOnAccept) {\n handleInvite();\n }\n },\n );\n}\n\nexport function experimental_useInboxSender<\n I extends CoValue,\n O extends CoValue | undefined,\n>(inboxOwnerID: string | undefined) {\n const context = useJazzContext();\n\n if (!context.value) {\n throw new Error(\n \"experimental_useInboxSender must be used within a JazzProvider\",\n );\n }\n\n if (!(\"me\" in context.value)) {\n throw new Error(\n \"experimental_useInboxSender can't be used in a JazzProvider with auth === 'guest'.\",\n );\n }\n\n const me = computed(() => (context.value as JazzAuthContext<Account>).me);\n const inboxRef = ref<Promise<InboxSender<I, O>> | undefined>(undefined);\n\n const sendMessage = async (message: I) => {\n if (!inboxOwnerID) throw new Error(\"Inbox owner ID is required\");\n\n if (!inboxRef.value) {\n const inbox = InboxSender.load<I, O>(inboxOwnerID, toRaw(me.value));\n inboxRef.value = inbox;\n }\n\n let inbox = await inboxRef.value;\n\n if (inbox.owner.id !== inboxOwnerID) {\n const req = InboxSender.load<I, O>(inboxOwnerID, toRaw(me.value));\n inboxRef.value = req;\n inbox = await req;\n }\n\n return inbox.sendMessage(message);\n };\n\n watch(\n () => inboxOwnerID,\n () => {\n inboxRef.value = undefined;\n },\n );\n\n return sendMessage;\n}\n\n// useAccountOrGuest has been removed in v0.15.4 to match React library.\n// It has been merged into useAccount which now handles both authenticated and guest scenarios.\n// This change maintains 1:1 API compatibility with the React Jazz library.\n// If you were using useAccountOrGuest, please migrate to useAccount.\n\nfunction shouldSkipUpdate(\n newValue: MaybeLoaded<CoValue>,\n previousValue: MaybeLoaded<CoValue>,\n) {\n if (previousValue === newValue) return true;\n // Avoid re-renders if the value is not loaded and didn't change\n return (\n previousValue.$jazz.id === newValue.$jazz.id &&\n !previousValue.$isLoaded &&\n !newValue.$isLoaded &&\n previousValue.$jazz.loadingState === newValue.$jazz.loadingState\n );\n}\n","import { onUnmounted, ref } from \"vue\";\nimport { useAuthSecretStorage } from \"../composables.js\";\n\nexport function useIsAuthenticated() {\n const authSecretStorage = useAuthSecretStorage();\n const isAuthenticated = ref(authSecretStorage.isAuthenticated);\n\n const handleUpdate = (newIsAuthenticated: boolean) => {\n isAuthenticated.value = newIsAuthenticated;\n };\n\n // Set up the listener immediately, not waiting for onMounted\n // This ensures we catch auth state changes that happen before mounting\n const cleanup = authSecretStorage.onUpdate(handleUpdate);\n\n onUnmounted(() => {\n cleanup();\n });\n\n return isAuthenticated;\n}\n","import { PassphraseAuth } from \"jazz-tools\";\nimport { computed, markRaw, ref, watchEffect } from \"vue\";\nimport { useAuthSecretStorage, useJazzContext } from \"../composables.js\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated.js\";\n\n/**\n * `usePassphraseAuth` composable provides a `JazzAuth` object for passphrase authentication.\n *\n * @example\n * ```ts\n * const auth = usePassphraseAuth({ wordlist });\n * ```\n *\n * @category Auth Providers\n */\nexport function usePassphraseAuth({ wordlist }: { wordlist: string[] }) {\n const context = useJazzContext();\n const authSecretStorage = useAuthSecretStorage();\n const isAuthenticated = useIsAuthenticated();\n\n if (\"guest\" in context.value) {\n throw new Error(\"Passphrase auth is not supported in guest mode\");\n }\n\n const authMethod = computed(() => {\n return markRaw(\n new PassphraseAuth(\n context.value.node.crypto,\n context.value.authenticate,\n context.value.register,\n authSecretStorage,\n wordlist,\n ),\n );\n });\n\n const passphrase = ref(authMethod.value.passphrase);\n\n watchEffect((onCleanup) => {\n authMethod.value.loadCurrentAccountPassphrase();\n\n const unsubscribe = authMethod.value.subscribe(() => {\n passphrase.value = authMethod.value.passphrase;\n });\n\n onCleanup(unsubscribe);\n });\n\n return computed(() => ({\n state: isAuthenticated.value ? \"signedIn\" : \"anonymous\",\n logIn: authMethod.value.logIn,\n signUp: authMethod.value.signUp,\n registerNewAccount: authMethod.value.registerNewAccount,\n generateRandomPassphrase: authMethod.value.generateRandomPassphrase,\n passphrase: passphrase.value,\n }));\n}\n","import { BrowserPasskeyAuth } from \"jazz-tools/browser\";\nimport { computed, markRaw } from \"vue\";\nimport { useAuthSecretStorage, useJazzContext } from \"../composables.js\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated.js\";\n\n/**\n * `usePasskeyAuth` composable provides a `JazzAuth` object for passkey authentication.\n *\n * @example\n * ```ts\n * const auth = usePasskeyAuth({ appName, appHostname });\n * ```\n *\n * @category Auth Providers\n */\nexport function usePasskeyAuth({\n appName,\n appHostname,\n}: {\n appName: string;\n appHostname?: string;\n}) {\n const context = useJazzContext();\n const authSecretStorage = useAuthSecretStorage();\n const isAuthenticated = useIsAuthenticated();\n\n if (\"guest\" in context.value) {\n throw new Error(\"Passkey auth is not supported in guest mode\");\n }\n\n const authMethod = computed(() => {\n return markRaw(\n new BrowserPasskeyAuth(\n context.value.node.crypto,\n context.value.authenticate,\n authSecretStorage,\n appName,\n appHostname,\n ),\n );\n });\n\n return computed(() => ({\n state: isAuthenticated.value ? \"signedIn\" : \"anonymous\",\n logIn: authMethod.value.logIn,\n signUp: authMethod.value.signUp,\n }));\n}\n","import { JazzClerkAuth, type MinimalClerkClient } from \"jazz-tools\";\nimport { computed, markRaw, onMounted, onUnmounted } from \"vue\";\nimport { useAuthSecretStorage, useJazzContext } from \"../composables.js\";\n\nexport function useClerkAuth(clerk: MinimalClerkClient) {\n const context = useJazzContext();\n const authSecretStorage = useAuthSecretStorage();\n\n if (\"guest\" in context.value) {\n throw new Error(\"Clerk auth is not supported in guest mode\");\n }\n\n // Create auth method similar to React's useMemo pattern\n const authMethod = computed(() => {\n return markRaw(\n new JazzClerkAuth(\n context.value.authenticate,\n context.value.logOut,\n authSecretStorage,\n ),\n );\n });\n\n onMounted(() => {\n const cleanup = authMethod.value.registerListener(clerk) as\n | (() => void)\n | void;\n\n onUnmounted(() => {\n // Clerk's addListener returns a cleanup function, but the type says void\n // Handle both cases for type safety\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n });\n });\n\n return authMethod.value;\n}\n","import type {\n Account,\n AccountClass,\n AnyAccountSchema,\n CoValueFromRaw,\n SyncConfig,\n} from \"jazz-tools\";\nimport {\n InMemoryKVStore,\n JazzClerkAuth,\n KvStoreContext,\n type MinimalClerkClient,\n} from \"jazz-tools\";\nimport { LocalStorageKVStore } from \"jazz-tools/browser\";\nimport { type PropType, defineComponent, h, onMounted, ref } from \"vue\";\nimport { JazzVueProvider } from \"../provider.js\";\nimport { useClerkAuth } from \"./useClerkAuth.js\";\n\nfunction setupKvStore() {\n KvStoreContext.getInstance().initialize(\n typeof window === \"undefined\"\n ? new InMemoryKVStore()\n : new LocalStorageKVStore(),\n );\n}\n\nconst RegisterClerkAuth = defineComponent({\n name: \"RegisterClerkAuth\",\n props: {\n clerk: {\n type: Object as PropType<MinimalClerkClient>,\n required: true,\n },\n },\n setup(props, { slots }) {\n useClerkAuth(props.clerk);\n return () => slots.default?.();\n },\n});\n\nexport const JazzVueProviderWithClerk = defineComponent({\n name: \"JazzVueProviderWithClerk\",\n props: {\n clerk: {\n type: Object as PropType<MinimalClerkClient>,\n required: true,\n },\n AccountSchema: {\n type: [Function, Object] as unknown as PropType<\n (AccountClass<Account> & CoValueFromRaw<Account>) | AnyAccountSchema\n >,\n required: false,\n },\n guestMode: {\n type: Boolean,\n default: false,\n },\n sync: {\n type: Object as PropType<SyncConfig>,\n required: true,\n },\n storage: {\n type: String as PropType<\"indexedDB\">,\n default: undefined,\n },\n defaultProfileName: {\n type: String,\n required: false,\n },\n onLogOut: {\n type: Function as PropType<() => void>,\n required: false,\n },\n onAnonymousAccountDiscarded: {\n type: Function as PropType<(anonymousAccount: Account) => Promise<void>>,\n required: false,\n },\n enableSSR: {\n type: Boolean,\n default: false,\n },\n },\n setup(props, { slots }) {\n const isLoaded = ref(false);\n\n onMounted(async () => {\n try {\n setupKvStore();\n await JazzClerkAuth.initializeAuth(props.clerk);\n isLoaded.value = true;\n } catch (error) {\n console.error(\"Jazz + Clerk initialization error:\", error);\n // Still render even if auth init fails\n isLoaded.value = true;\n }\n });\n\n return () => {\n if (!isLoaded.value) {\n return null;\n }\n\n // Destructure props to exclude 'clerk' which JazzVueProvider doesn't accept\n const { clerk, ...jazzProviderProps } = props;\n\n return h(\n JazzVueProvider,\n {\n ...jazzProviderProps,\n logOutReplacement: clerk.signOut,\n },\n {\n default: () =>\n h(\n RegisterClerkAuth,\n { clerk },\n { default: () => slots.default?.() },\n ),\n },\n );\n };\n },\n});\n","<template>\n <div v-if=\"auth.state === 'signedIn'\">\n <slot />\n </div>\n <div v-else :style=\"containerStyle\">\n <div :style=\"cardStyle\">\n <h1 :style=\"headingStyle\">{{ appName }}</h1>\n \n <div v-if=\"error\" :style=\"errorStyle\">\n {{ error }}\n </div>\n\n <form @submit.prevent=\"handleSignUp\" :style=\"formStyle\">\n <input\n v-model=\"username\"\n type=\"text\"\n placeholder=\"Display name\"\n autocomplete=\"name\"\n :style=\"inputStyle\"\n />\n <button type=\"submit\" :style=\"primaryButtonStyle\">\n Sign up\n </button>\n </form>\n\n <button @click=\"handleLogIn\" :style=\"secondaryButtonStyle\">\n Log in with existing account\n </button>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { usePasskeyAuth } from \"./usePasskeyAuth.js\";\n\ninterface Props {\n appName: string;\n appHostname?: string;\n}\n\nconst props = defineProps<Props>();\n\nconst username = ref(\"\");\nconst error = ref<string | null>(null);\n\nconst auth = usePasskeyAuth({\n appName: props.appName,\n appHostname: props.appHostname,\n});\n\nfunction handleError(err: Error) {\n if (err.cause instanceof Error) {\n error.value = err.cause.message;\n } else {\n error.value = err.message;\n }\n}\n\nconst handleSignUp = async () => {\n if (!username.value.trim()) {\n error.value = \"Name is required\";\n return;\n }\n\n error.value = null;\n try {\n await auth.value.signUp(username.value.trim());\n } catch (err) {\n handleError(err as Error);\n }\n};\n\nconst handleLogIn = async () => {\n error.value = null;\n try {\n await auth.value.logIn();\n } catch (err) {\n handleError(err as Error);\n }\n};\n\n// Styles (matching React version)\nconst containerStyle = {\n width: \"100vw\",\n height: \"100vh\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"#f3f4f6\",\n padding: \"1rem\",\n};\n\nconst cardStyle = {\n backgroundColor: \"white\",\n padding: \"2rem\",\n borderRadius: \"0.5rem\",\n boxShadow: \"0 10px 15px -3px rgba(0, 0, 0, 0.1)\",\n width: \"100%\",\n maxWidth: \"18rem\",\n display: \"flex\",\n flexDirection: \"column\" as const,\n gap: \"2rem\",\n};\n\nconst headingStyle = {\n fontSize: \"1.5rem\",\n fontWeight: \"bold\",\n textAlign: \"center\" as const,\n margin: \"0\",\n};\n\nconst errorStyle = {\n color: \"red\",\n fontSize: \"0.875rem\",\n textAlign: \"center\" as const,\n};\n\nconst formStyle = {\n display: \"flex\",\n flexDirection: \"column\" as const,\n gap: \"0.5rem\",\n};\n\nconst inputStyle = {\n padding: \"0.75rem\",\n border: \"1px solid #d1d5db\",\n borderRadius: \"0.375rem\",\n fontSize: \"1rem\",\n};\n\nconst primaryButtonStyle = {\n backgroundColor: \"#3b82f6\",\n color: \"white\",\n padding: \"0.75rem 1rem\",\n border: \"none\",\n borderRadius: \"0.375rem\",\n cursor: \"pointer\",\n fontSize: \"1rem\",\n fontWeight: \"500\",\n};\n\nconst secondaryButtonStyle = {\n backgroundColor: \"#e5e7eb\",\n color: \"#374151\",\n padding: \"0.75rem 1rem\",\n border: \"none\",\n borderRadius: \"0.375rem\",\n cursor: \"pointer\",\n fontSize: \"1rem\",\n fontWeight: \"500\",\n};\n</script>\n","<script setup lang=\"ts\">\nimport { ImageDefinition } from \"jazz-tools\";\nimport { highestResAvailable } from \"jazz-tools/media\";\nimport { onUnmounted, ref, watch, computed } from \"vue\";\nimport { useCoState } from \"./composables.js\";\n\nexport interface ImageProps {\n /** The ID of the ImageDefinition to display */\n imageId: string;\n /**\n * The desired width of the image. Can be a number in pixels or \"original\" to use the image's original width.\n * When set to a number, the component will select the best available resolution and maintain aspect ratio.\n */\n width?: number | \"original\";\n /**\n * The desired height of the image. Can be a number in pixels or \"original\" to use the image's original height.\n * When set to a number, the component will select the best available resolution and maintain aspect ratio.\n */\n height?: number | \"original\";\n /** Alt text for the image */\n alt?: string;\n /** CSS classes to apply to the image */\n classNames?: string;\n /** CSS styles to apply to the image */\n style?: string | Record<string, string>;\n /** Loading strategy for the image */\n loading?: \"lazy\" | \"eager\";\n}\n\nconst props = withDefaults(defineProps<ImageProps>(), {\n loading: \"eager\",\n});\n\nconst image = useCoState(ImageDefinition, props.imageId, {});\nlet lastBestImage: [string, string] | null = null;\n\n/**\n * For lazy loading, we use the browser's strategy for images with loading=\"lazy\".\n * We use an empty image, and when the browser triggers the load event, we load the best available image.\n */\nconst waitingLazyLoading = ref(props.loading === \"lazy\");\nconst lazyPlaceholder = computed(() =>\n waitingLazyLoading.value ? URL.createObjectURL(emptyPixelBlob) : undefined,\n);\n\nconst dimensions = computed(() => {\n const originalSize = image.value.$isLoaded\n ? image.value.originalSize\n : undefined;\n const originalWidth = originalSize?.[0];\n const originalHeight = originalSize?.[1];\n\n // Both width and height are \"original\"\n if (props.width === \"original\" && props.height === \"original\") {\n return { width: originalWidth, height: originalHeight };\n }\n\n // Width is \"original\", height is a number\n if (props.width === \"original\" && typeof props.height === \"number\") {\n if (originalWidth && originalHeight) {\n return {\n width: Math.round((props.height * originalWidth) / originalHeight),\n height: props.height,\n };\n }\n return { width: undefined, height: props.height };\n }\n\n // Height is \"original\", width is a number\n if (props.height === \"original\" && typeof props.width === \"number\") {\n if (originalWidth && originalHeight) {\n return {\n width: props.width,\n height: Math.round((props.width * originalHeight) / originalWidth),\n };\n }\n return { width: props.width, height: undefined };\n }\n\n // In all other cases, use the property value:\n return {\n width: props.width === \"original\" ? originalWidth : props.width,\n height: props.height === \"original\" ? originalHeight : props.height,\n };\n});\n\nconst src = computed(() => {\n if (waitingLazyLoading.value) {\n return lazyPlaceholder.value;\n }\n\n if (!image.value.$isLoaded) return undefined;\n\n const bestImage = highestResAvailable(\n image.value,\n dimensions.value.width || dimensions.value.height || 9999,\n dimensions.value.height || dimensions.value.width || 9999,\n );\n\n if (!bestImage) return image.value.placeholderDataURL;\n if (lastBestImage?.[0] === bestImage.image.$jazz.id)\n return lastBestImage?.[1];\n\n const blob = bestImage.image.toBlob();\n\n if (blob) {\n const url = URL.createObjectURL(blob);\n revokeObjectURL(lastBestImage?.[1]);\n lastBestImage = [bestImage.image.$jazz.id, url];\n return url;\n }\n\n return image.value.placeholderDataURL;\n});\n\nconst onThresholdReached = () => {\n waitingLazyLoading.value = false;\n};\n\n// Cleanup object URL on component destroy\nonUnmounted(() => {\n revokeObjectURL(lastBestImage?.[1]);\n});\n\nfunction revokeObjectURL(url: string | undefined) {\n if (url && url.startsWith(\"blob:\")) {\n URL.revokeObjectURL(url);\n }\n}\n\nconst emptyPixelBlob = new Blob(\n [\n Uint8Array.from(\n atob(\n \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\",\n ),\n (c) => c.charCodeAt(0),\n ),\n ],\n { type: \"image/png\" },\n);\n</script>\n\n<template>\n <img\n :src=\"src\"\n :width=\"dimensions.width\"\n :height=\"dimensions.height\"\n :alt=\"alt\"\n :class=\"classNames\"\n :style=\"style\"\n :loading=\"loading\"\n @load=\"waitingLazyLoading ? onThresholdReached() : undefined\"\n />\n</template>\n"],"names":["inbox"],"mappings":";;;;;;;;AA6CO,MAAM,gBAAgB,IAAgB;AAE7C,SAAS,oCACP,gBACA;AACM,QAAA,UAAU,eAAe,gBAAgB;AAE/C,MAAI,CAAC,SAAS;AACN,UAAA,IAAI,MAAM,kBAAkB;AAAA,EAAA;AAGpC,SAAO,QAAQ,UAAU,QAAQ,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gB,GAAG;AAAA,MAAA;AAAA,IACzB;AAGF,UAAM,iBAAiB,IAAI;AAAA,MACzB;AAAA,QACE,WAAW;AAAA,UACT;AAAA,YACE;AAAA,UACF;AAAA,UACA,CAAC,MAAM,EAAE,WAAW,CAAC;AAAA,QAAA;AAAA,MAEzB;AAAA,MACA,EAAE,MAAM,YAAY;AAAA,IACtB;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "community-jazz-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"cojson": "0.
|
|
28
|
-
"jazz-tools": "0.
|
|
27
|
+
"cojson": "0.19.0",
|
|
28
|
+
"jazz-tools": "0.19.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/plugin-syntax-jsx": "^7.25.0",
|
package/src/Image.vue
CHANGED
|
@@ -44,8 +44,11 @@ const lazyPlaceholder = computed(() =>
|
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
const dimensions = computed(() => {
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const originalSize = image.value.$isLoaded
|
|
48
|
+
? image.value.originalSize
|
|
49
|
+
: undefined;
|
|
50
|
+
const originalWidth = originalSize?.[0];
|
|
51
|
+
const originalHeight = originalSize?.[1];
|
|
49
52
|
|
|
50
53
|
// Both width and height are "original"
|
|
51
54
|
if (props.width === "original" && props.height === "original") {
|
|
@@ -86,7 +89,7 @@ const src = computed(() => {
|
|
|
86
89
|
return lazyPlaceholder.value;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
if (!image.value) return undefined;
|
|
92
|
+
if (!image.value.$isLoaded) return undefined;
|
|
90
93
|
|
|
91
94
|
const bestImage = highestResAvailable(
|
|
92
95
|
image.value,
|
package/src/composables.ts
CHANGED
|
@@ -12,11 +12,13 @@ import {
|
|
|
12
12
|
JazzContextManager,
|
|
13
13
|
type JazzContextType,
|
|
14
14
|
type Loaded,
|
|
15
|
-
type
|
|
16
|
-
|
|
15
|
+
type MaybeLoaded,
|
|
16
|
+
CoValueLoadingState,
|
|
17
|
+
type ResolveQuery,
|
|
17
18
|
ResolveQueryStrict,
|
|
18
19
|
coValueClassFromCoValueClassOrSchema,
|
|
19
20
|
subscribeToCoValue,
|
|
21
|
+
createUnloadedCoValue,
|
|
20
22
|
} from "jazz-tools";
|
|
21
23
|
import { consumeInviteLinkFromWindowLocation } from "jazz-tools/browser";
|
|
22
24
|
import {
|
|
@@ -96,27 +98,16 @@ export function useAccount<
|
|
|
96
98
|
options?: {
|
|
97
99
|
resolve?: ResolveQueryStrict<A, R>;
|
|
98
100
|
},
|
|
99
|
-
): {
|
|
100
|
-
me: ComputedRef<Loaded<A, R> | undefined | null>;
|
|
101
|
-
agent: AnonymousJazzAgent | Loaded<A, true>;
|
|
102
|
-
logOut: () => void;
|
|
103
|
-
} {
|
|
101
|
+
): ComputedRef<MaybeLoaded<Loaded<A, R>>> {
|
|
104
102
|
const context = useJazzContext();
|
|
105
|
-
const contextManager = useJazzContextManager<InstanceOfSchema<A>>();
|
|
106
103
|
|
|
107
104
|
if (!context.value) {
|
|
108
105
|
throw new Error("useAccount must be used within a JazzProvider");
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// Handle guest mode - return null for me and the guest agent
|
|
108
|
+
// Handle guest mode - return null for the account data
|
|
114
109
|
if (!("me" in context.value)) {
|
|
115
|
-
return
|
|
116
|
-
me: computed(() => null) as any,
|
|
117
|
-
agent: agent,
|
|
118
|
-
logOut: context.value.logOut,
|
|
119
|
-
};
|
|
110
|
+
return computed(() => null) as any;
|
|
120
111
|
}
|
|
121
112
|
|
|
122
113
|
const contextMe = context.value.me as InstanceOfSchema<A>;
|
|
@@ -127,27 +118,51 @@ export function useAccount<
|
|
|
127
118
|
options as any,
|
|
128
119
|
);
|
|
129
120
|
|
|
130
|
-
return {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
return computed(() => {
|
|
122
|
+
const value =
|
|
123
|
+
options?.resolve === undefined ? me.value || contextMe : me.value;
|
|
124
|
+
return value ? markRaw(value) : value;
|
|
125
|
+
}) as any;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Returns a function for logging out the current account.
|
|
130
|
+
*/
|
|
131
|
+
export function useLogOut(): () => void {
|
|
132
|
+
const context = useJazzContext();
|
|
133
|
+
if (!context.value) {
|
|
134
|
+
throw new Error("useLogOut must be used within a JazzProvider");
|
|
135
|
+
}
|
|
136
|
+
return context.value.logOut;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Hook for accessing the current agent. An agent can either be:
|
|
141
|
+
* - an Authenticated Account, if the user is logged in
|
|
142
|
+
* - an Anonymous Account, if the user didn't log in
|
|
143
|
+
* - or an anonymous agent, if in guest mode
|
|
144
|
+
*
|
|
145
|
+
* The agent can be used as the `loadAs` parameter for load and subscribe methods.
|
|
146
|
+
*/
|
|
147
|
+
export function useAgent<
|
|
148
|
+
A extends AccountClass<Account> | AnyAccountSchema = typeof Account,
|
|
149
|
+
>(): AnonymousJazzAgent | Loaded<A, true> {
|
|
150
|
+
const contextManager = useJazzContextManager<InstanceOfSchema<A>>();
|
|
151
|
+
const agent = getCurrentAccountFromContextManager(contextManager.value);
|
|
152
|
+
return agent as AnonymousJazzAgent | Loaded<A, true>;
|
|
139
153
|
}
|
|
140
154
|
|
|
141
155
|
export function useCoState<
|
|
142
156
|
S extends CoValueClassOrSchema,
|
|
143
|
-
const R extends
|
|
157
|
+
const R extends ResolveQuery<S> = true,
|
|
144
158
|
>(
|
|
145
159
|
Schema: S,
|
|
146
160
|
id: string | undefined,
|
|
147
161
|
options?: { resolve?: ResolveQueryStrict<S, R> },
|
|
148
|
-
): Ref<Loaded<S, R
|
|
149
|
-
const state: ShallowRef<Loaded<S, R
|
|
150
|
-
|
|
162
|
+
): Ref<MaybeLoaded<Loaded<S, R>>> {
|
|
163
|
+
const state: ShallowRef<MaybeLoaded<Loaded<S, R>>> = shallowRef(
|
|
164
|
+
createUnloadedCoValue(id ?? "", CoValueLoadingState.LOADING),
|
|
165
|
+
);
|
|
151
166
|
const context = useJazzContext();
|
|
152
167
|
|
|
153
168
|
if (!context.value) {
|
|
@@ -156,6 +171,13 @@ export function useCoState<
|
|
|
156
171
|
|
|
157
172
|
let unsubscribe: (() => void) | undefined;
|
|
158
173
|
|
|
174
|
+
const updateState = (value: MaybeLoaded<Loaded<S, R>>) => {
|
|
175
|
+
if (shouldSkipUpdate(value, state.value)) return;
|
|
176
|
+
// Use markRaw to prevent Vue from making Jazz objects reactive
|
|
177
|
+
// but still allow property access and mutations
|
|
178
|
+
state.value = markRaw(value);
|
|
179
|
+
};
|
|
180
|
+
|
|
159
181
|
watch(
|
|
160
182
|
[() => id, context],
|
|
161
183
|
([currentId, currentContext]) => {
|
|
@@ -165,14 +187,21 @@ export function useCoState<
|
|
|
165
187
|
}
|
|
166
188
|
|
|
167
189
|
if (!currentId || !currentContext) {
|
|
168
|
-
|
|
190
|
+
updateState(
|
|
191
|
+
createUnloadedCoValue(
|
|
192
|
+
currentId ?? "",
|
|
193
|
+
CoValueLoadingState.UNAVAILABLE,
|
|
194
|
+
),
|
|
195
|
+
);
|
|
169
196
|
return;
|
|
170
197
|
}
|
|
171
198
|
|
|
172
199
|
const loadAsAgent =
|
|
173
200
|
"me" in currentContext ? currentContext.me : currentContext.guest;
|
|
174
201
|
if (!loadAsAgent) {
|
|
175
|
-
|
|
202
|
+
updateState(
|
|
203
|
+
createUnloadedCoValue(currentId, CoValueLoadingState.UNAVAILABLE),
|
|
204
|
+
);
|
|
176
205
|
return;
|
|
177
206
|
}
|
|
178
207
|
|
|
@@ -186,22 +215,32 @@ export function useCoState<
|
|
|
186
215
|
resolve: options?.resolve as any,
|
|
187
216
|
loadAs: safeLoadAsAgent,
|
|
188
217
|
onUnavailable: () => {
|
|
189
|
-
|
|
218
|
+
updateState(
|
|
219
|
+
createUnloadedCoValue(
|
|
220
|
+
currentId,
|
|
221
|
+
CoValueLoadingState.UNAVAILABLE,
|
|
222
|
+
),
|
|
223
|
+
);
|
|
190
224
|
},
|
|
191
225
|
onUnauthorized: () => {
|
|
192
|
-
|
|
226
|
+
updateState(
|
|
227
|
+
createUnloadedCoValue(
|
|
228
|
+
currentId,
|
|
229
|
+
CoValueLoadingState.UNAUTHORIZED,
|
|
230
|
+
),
|
|
231
|
+
);
|
|
193
232
|
},
|
|
194
233
|
syncResolution: true,
|
|
195
234
|
},
|
|
196
235
|
(value: any) => {
|
|
197
|
-
|
|
198
|
-
// but still allow property access and mutations
|
|
199
|
-
state.value = value ? markRaw(value) : value;
|
|
236
|
+
updateState(value);
|
|
200
237
|
},
|
|
201
238
|
);
|
|
202
239
|
} catch (error) {
|
|
203
240
|
console.error("Error in useCoState subscription:", error);
|
|
204
|
-
|
|
241
|
+
updateState(
|
|
242
|
+
createUnloadedCoValue(currentId, CoValueLoadingState.UNAVAILABLE),
|
|
243
|
+
);
|
|
205
244
|
}
|
|
206
245
|
},
|
|
207
246
|
{ immediate: true },
|
|
@@ -325,3 +364,17 @@ export function experimental_useInboxSender<
|
|
|
325
364
|
// It has been merged into useAccount which now handles both authenticated and guest scenarios.
|
|
326
365
|
// This change maintains 1:1 API compatibility with the React Jazz library.
|
|
327
366
|
// If you were using useAccountOrGuest, please migrate to useAccount.
|
|
367
|
+
|
|
368
|
+
function shouldSkipUpdate(
|
|
369
|
+
newValue: MaybeLoaded<CoValue>,
|
|
370
|
+
previousValue: MaybeLoaded<CoValue>,
|
|
371
|
+
) {
|
|
372
|
+
if (previousValue === newValue) return true;
|
|
373
|
+
// Avoid re-renders if the value is not loaded and didn't change
|
|
374
|
+
return (
|
|
375
|
+
previousValue.$jazz.id === newValue.$jazz.id &&
|
|
376
|
+
!previousValue.$isLoaded &&
|
|
377
|
+
!newValue.$isLoaded &&
|
|
378
|
+
previousValue.$jazz.loadingState === newValue.$jazz.loadingState
|
|
379
|
+
);
|
|
380
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// @vitest-environment happy-dom
|
|
2
2
|
|
|
3
3
|
import { Group, co, z } from "jazz-tools";
|
|
4
|
+
import { assertLoaded } from "jazz-tools/testing";
|
|
4
5
|
import { beforeAll, describe, expect, it } from "vitest";
|
|
5
6
|
import { isProxy, nextTick, toRaw } from "vue";
|
|
6
|
-
import { useAccount, useCoState } from "../composables.js";
|
|
7
|
+
import { useAccount, useAgent, useCoState, useLogOut } from "../composables.js";
|
|
7
8
|
import { createJazzTestAccount } from "../testing.js";
|
|
8
9
|
import { withJazzTestSetup } from "./testUtils.js";
|
|
9
10
|
|
|
@@ -70,9 +71,8 @@ describe("Proxy Behavior Verification", () => {
|
|
|
70
71
|
expect(isProxy(result.value)).toBe(false);
|
|
71
72
|
|
|
72
73
|
// Properties should also not be proxies
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
74
|
+
assertLoaded(result.value);
|
|
75
|
+
expect(isProxy(result.value.content)).toBe(false);
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
it("should handle nested object access without proxy issues", async () => {
|
|
@@ -102,8 +102,8 @@ describe("Proxy Behavior Verification", () => {
|
|
|
102
102
|
await nextTick();
|
|
103
103
|
|
|
104
104
|
// Should be able to access deeply nested properties without proxy issues
|
|
105
|
-
const me = accountResult.
|
|
106
|
-
|
|
105
|
+
const me = accountResult.value;
|
|
106
|
+
assertLoaded(me);
|
|
107
107
|
expect(me?.root).toBeDefined();
|
|
108
108
|
expect(me?.root?.testMap).toBeDefined();
|
|
109
109
|
expect(me?.root?.testMap?.content).toBe("nested content");
|
|
@@ -132,6 +132,7 @@ describe("Proxy Behavior Verification", () => {
|
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
// Initial state
|
|
135
|
+
assertLoaded(result.value);
|
|
135
136
|
expect(result.value?.content).toBe("initial content");
|
|
136
137
|
expect(isProxy(result.value)).toBe(false);
|
|
137
138
|
|
|
@@ -165,7 +166,7 @@ describe("Proxy Behavior Verification", () => {
|
|
|
165
166
|
|
|
166
167
|
// User should be able to use the object directly without toRaw()
|
|
167
168
|
const jazzObject = result.value;
|
|
168
|
-
|
|
169
|
+
assertLoaded(jazzObject);
|
|
169
170
|
|
|
170
171
|
// Should be able to call Jazz methods directly
|
|
171
172
|
expect(() => {
|
|
@@ -174,34 +175,39 @@ describe("Proxy Behavior Verification", () => {
|
|
|
174
175
|
}).not.toThrow();
|
|
175
176
|
|
|
176
177
|
// Should not need toRaw() to access properties
|
|
177
|
-
expect(jazzObject
|
|
178
|
+
expect(jazzObject.content).toBe("test content");
|
|
178
179
|
});
|
|
179
180
|
|
|
180
181
|
it("should handle context manager objects without proxy issues", async () => {
|
|
181
182
|
const account = await createJazzTestAccount();
|
|
182
183
|
|
|
183
|
-
const [
|
|
184
|
+
const [loadedAccount] = withJazzTestSetup(() => useAccount(), {
|
|
185
|
+
account,
|
|
186
|
+
});
|
|
187
|
+
const [agent] = withJazzTestSetup(() => useAgent(), {
|
|
188
|
+
account,
|
|
189
|
+
});
|
|
190
|
+
const [logOut] = withJazzTestSetup(() => useLogOut(), {
|
|
184
191
|
account,
|
|
185
192
|
});
|
|
186
193
|
|
|
187
194
|
// The account object should not be a proxy
|
|
188
|
-
expect(isProxy(
|
|
195
|
+
expect(isProxy(loadedAccount.value)).toBe(false);
|
|
189
196
|
|
|
190
197
|
// The agent should be accessible and usable without toRaw() calls
|
|
191
|
-
expect(
|
|
192
|
-
expect(typeof result.agent).toBe("object");
|
|
198
|
+
expect(typeof agent).toBe("object");
|
|
193
199
|
|
|
194
200
|
// Should be able to access agent properties without proxy issues
|
|
195
201
|
expect(() => {
|
|
196
|
-
const agentType =
|
|
202
|
+
const agentType = agent.$type$; // Access agent property
|
|
197
203
|
expect(agentType).toBeDefined();
|
|
198
204
|
}).not.toThrow();
|
|
199
205
|
|
|
200
206
|
// LogOut function should work without proxy issues
|
|
201
|
-
expect(typeof
|
|
207
|
+
expect(typeof logOut).toBe("function");
|
|
202
208
|
expect(() => {
|
|
203
209
|
// Should be able to call without toRaw()
|
|
204
|
-
|
|
210
|
+
logOut.toString(); // Safe way to test function access
|
|
205
211
|
}).not.toThrow();
|
|
206
212
|
});
|
|
207
213
|
|
|
@@ -264,11 +270,12 @@ describe("Proxy Behavior Verification", () => {
|
|
|
264
270
|
await nextTick();
|
|
265
271
|
|
|
266
272
|
// Both account and project should work without proxy issues
|
|
267
|
-
expect(isProxy(accountResult.
|
|
273
|
+
expect(isProxy(accountResult.value)).toBe(false);
|
|
268
274
|
expect(isProxy(projectResult.value)).toBe(false);
|
|
269
275
|
|
|
270
276
|
// Should be able to access properties without toRaw()
|
|
271
|
-
expect(accountResult.
|
|
272
|
-
|
|
277
|
+
expect(accountResult.value?.$jazz.id).toBeDefined();
|
|
278
|
+
assertLoaded(projectResult.value);
|
|
279
|
+
expect(projectResult.value.content).toBe("new project");
|
|
273
280
|
});
|
|
274
281
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @vitest-environment happy-dom
|
|
2
2
|
|
|
3
3
|
import { Group, type ID, co, z } from "jazz-tools";
|
|
4
|
+
import { assertLoaded } from "jazz-tools/testing";
|
|
4
5
|
import { describe, expect, it } from "vitest";
|
|
5
6
|
import { createInviteLink, useAcceptInvite } from "../index.js";
|
|
6
7
|
import { createJazzTestAccount, linkAccounts } from "../testing.js";
|
|
@@ -50,6 +51,7 @@ describe("useAcceptInvite", () => {
|
|
|
50
51
|
loadAs: account,
|
|
51
52
|
});
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
assertLoaded(accepted);
|
|
55
|
+
expect(accepted.value).toEqual("hello");
|
|
54
56
|
});
|
|
55
57
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Group, co, z } from "jazz-tools";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
|
-
import { useAccount } from "../composables.js";
|
|
5
|
+
import { useAccount, useAgent, useLogOut } from "../composables.js";
|
|
6
6
|
import { createJazzTestAccount, createJazzTestGuest } from "../testing.js";
|
|
7
7
|
import { withJazzTestSetup } from "./testUtils.js";
|
|
8
8
|
|
|
@@ -38,19 +38,25 @@ describe("useAccount", () => {
|
|
|
38
38
|
account,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
expect(result.
|
|
41
|
+
expect(result.value).toEqual(account);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
it("should handle guest mode correctly", async () => {
|
|
45
45
|
const guestAccount = await createJazzTestGuest();
|
|
46
46
|
|
|
47
|
-
const [
|
|
47
|
+
const [account] = withJazzTestSetup(() => useAccount(), {
|
|
48
|
+
account: guestAccount,
|
|
49
|
+
});
|
|
50
|
+
const [agent] = withJazzTestSetup(() => useAgent(), {
|
|
51
|
+
account: guestAccount,
|
|
52
|
+
});
|
|
53
|
+
const [logOut] = withJazzTestSetup(() => useLogOut(), {
|
|
48
54
|
account: guestAccount,
|
|
49
55
|
});
|
|
50
56
|
|
|
51
57
|
// In guest mode, me should be null and agent should be the guest
|
|
52
|
-
expect(
|
|
53
|
-
expect(
|
|
54
|
-
expect(typeof
|
|
58
|
+
expect(account.value).toBe(null);
|
|
59
|
+
expect(agent.$type$).toBe("Anonymous");
|
|
60
|
+
expect(typeof logOut).toBe("function");
|
|
55
61
|
});
|
|
56
62
|
});
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
// @vitest-environment happy-dom
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
type CoValue,
|
|
5
|
+
type ID,
|
|
6
|
+
type MaybeLoaded,
|
|
7
|
+
CoValueLoadingState,
|
|
8
|
+
co,
|
|
9
|
+
cojsonInternals,
|
|
10
|
+
z,
|
|
11
|
+
} from "jazz-tools";
|
|
12
|
+
import {
|
|
13
|
+
assertLoaded,
|
|
14
|
+
createJazzTestAccount,
|
|
15
|
+
setupJazzTestSync,
|
|
16
|
+
} from "jazz-tools/testing";
|
|
5
17
|
import { beforeEach, describe, expect, expectTypeOf, it } from "vitest";
|
|
6
18
|
import type { ComputedRef, Ref, ShallowRef } from "vue";
|
|
7
19
|
import { useCoState } from "../index.js";
|
|
@@ -35,7 +47,8 @@ describe("useCoState", () => {
|
|
|
35
47
|
},
|
|
36
48
|
);
|
|
37
49
|
|
|
38
|
-
|
|
50
|
+
assertLoaded(result.value);
|
|
51
|
+
expect(result.value.content).toBe("123");
|
|
39
52
|
});
|
|
40
53
|
|
|
41
54
|
it("should update the value when the coValue changes", async () => {
|
|
@@ -59,11 +72,12 @@ describe("useCoState", () => {
|
|
|
59
72
|
},
|
|
60
73
|
);
|
|
61
74
|
|
|
62
|
-
|
|
75
|
+
assertLoaded(result.value);
|
|
76
|
+
expect(result.value.content).toBe("123");
|
|
63
77
|
|
|
64
78
|
map.$jazz.set("content", "456");
|
|
65
79
|
|
|
66
|
-
expect(result.value
|
|
80
|
+
expect(result.value.content).toBe("456");
|
|
67
81
|
});
|
|
68
82
|
|
|
69
83
|
it("should load nested values if requested", async () => {
|
|
@@ -103,8 +117,9 @@ describe("useCoState", () => {
|
|
|
103
117
|
},
|
|
104
118
|
);
|
|
105
119
|
|
|
106
|
-
|
|
107
|
-
expect(result.value
|
|
120
|
+
assertLoaded(result.value);
|
|
121
|
+
expect(result.value.content).toBe("123");
|
|
122
|
+
expect(result.value.nested.content).toBe("456");
|
|
108
123
|
});
|
|
109
124
|
|
|
110
125
|
it("should load nested values on access even if not requested", async () => {
|
|
@@ -139,11 +154,13 @@ describe("useCoState", () => {
|
|
|
139
154
|
},
|
|
140
155
|
);
|
|
141
156
|
|
|
142
|
-
|
|
143
|
-
expect(result.value
|
|
157
|
+
assertLoaded(result.value);
|
|
158
|
+
expect(result.value.content).toBe("123");
|
|
159
|
+
assertLoaded(result.value.nested);
|
|
160
|
+
expect(result.value.nested.content).toBe("456");
|
|
144
161
|
});
|
|
145
162
|
|
|
146
|
-
it("should return
|
|
163
|
+
it("should return a 'unavailable' value if the coValue is not found", async () => {
|
|
147
164
|
const TestMap = co.map({
|
|
148
165
|
content: z.string(),
|
|
149
166
|
});
|
|
@@ -156,10 +173,12 @@ describe("useCoState", () => {
|
|
|
156
173
|
useCoState(TestMap, "co_z123" as ID<co.loaded<typeof TestMap>>, {}),
|
|
157
174
|
);
|
|
158
175
|
|
|
159
|
-
expect(result.value).
|
|
176
|
+
expect(result.value.$jazz.loadingState).toBe(CoValueLoadingState.LOADING);
|
|
160
177
|
|
|
161
178
|
await waitFor(() => {
|
|
162
|
-
expect(result.value).
|
|
179
|
+
expect(result.value.$jazz.loadingState).toBe(
|
|
180
|
+
CoValueLoadingState.UNAVAILABLE,
|
|
181
|
+
);
|
|
163
182
|
});
|
|
164
183
|
});
|
|
165
184
|
|
|
@@ -178,7 +197,7 @@ describe("useCoState", () => {
|
|
|
178
197
|
}),
|
|
179
198
|
);
|
|
180
199
|
expectTypeOf(result).toEqualTypeOf<
|
|
181
|
-
Ref<co.loaded<typeof TestMap
|
|
200
|
+
Ref<MaybeLoaded<co.loaded<typeof TestMap>>>
|
|
182
201
|
>();
|
|
183
202
|
});
|
|
184
203
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @vitest-environment happy-dom
|
|
2
2
|
|
|
3
3
|
import { CoMap, Group, Inbox, type Loaded, co, z } from "jazz-tools";
|
|
4
|
+
import { assertLoaded } from "jazz-tools/testing";
|
|
4
5
|
import { describe, expect, it } from "vitest";
|
|
5
6
|
import { experimental_useInboxSender } from "../composables.js";
|
|
6
7
|
import { createJazzTestAccount, linkAccounts } from "../testing.js";
|
|
@@ -56,6 +57,7 @@ describe("useInboxSender", () => {
|
|
|
56
57
|
loadAs: account,
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
assertLoaded(responseMap);
|
|
61
|
+
expect(responseMap.value).toEqual("got it");
|
|
60
62
|
});
|
|
61
63
|
});
|