@korajs/auth 0.5.0 → 1.0.0-beta.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/LICENSE +21 -0
- package/dist/chunk-MPMXJ62R.js +203 -0
- package/dist/chunk-MPMXJ62R.js.map +1 -0
- package/dist/{org-client-q2u55qod.d.cts → create-org-session-RsDj9cl4.d.cts} +58 -1
- package/dist/{org-client-q2u55qod.d.ts → create-org-session-RsDj9cl4.d.ts} +58 -1
- package/dist/index.cjs +168 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -19
- package/dist/index.d.ts +9 -19
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +294 -258
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +15 -215
- package/dist/react.d.ts +15 -215
- package/dist/react.js +135 -288
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +42 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +24 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +42 -5
- package/dist/server.js.map +1 -1
- package/dist/svelte.cjs +512 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +100 -0
- package/dist/svelte.d.ts +100 -0
- package/dist/svelte.js +278 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +565 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +136 -0
- package/dist/vue.d.ts +136 -0
- package/dist/vue.js +338 -0
- package/dist/vue.js.map +1 -0
- package/package.json +40 -6
- package/src/svelte/AuthProvider.svelte +37 -0
- package/src/svelte/OrgProvider.svelte +22 -0
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/vue.ts
|
|
21
|
+
var vue_exports = {};
|
|
22
|
+
__export(vue_exports, {
|
|
23
|
+
AuthProvider: () => AuthProvider,
|
|
24
|
+
OrgProvider: () => OrgProvider,
|
|
25
|
+
authContextKey: () => authContextKey,
|
|
26
|
+
useAuth: () => useAuth,
|
|
27
|
+
useAuthContext: () => useAuthContext,
|
|
28
|
+
useAuthStatus: () => useAuthStatus,
|
|
29
|
+
useCurrentUser: () => useCurrentUser,
|
|
30
|
+
useOrg: () => useOrg,
|
|
31
|
+
useOrgContext: () => useOrgContext,
|
|
32
|
+
useOrgMembers: () => useOrgMembers,
|
|
33
|
+
usePermission: () => usePermission
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(vue_exports);
|
|
36
|
+
|
|
37
|
+
// src/vue/auth-provider.ts
|
|
38
|
+
var import_vue = require("vue");
|
|
39
|
+
|
|
40
|
+
// src/bindings/create-auth-session.ts
|
|
41
|
+
function createAuthSession(client) {
|
|
42
|
+
let state = client.state;
|
|
43
|
+
let isLoading = true;
|
|
44
|
+
let initError = null;
|
|
45
|
+
let lastError = null;
|
|
46
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
47
|
+
let snapshot = buildSnapshot2();
|
|
48
|
+
const refreshSnapshot = () => {
|
|
49
|
+
snapshot = buildSnapshot2();
|
|
50
|
+
};
|
|
51
|
+
const notify = () => {
|
|
52
|
+
refreshSnapshot();
|
|
53
|
+
for (const listener of listeners) {
|
|
54
|
+
listener();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function buildSnapshot2() {
|
|
58
|
+
return {
|
|
59
|
+
state,
|
|
60
|
+
user: client.currentUser,
|
|
61
|
+
isAuthenticated: state === "authenticated",
|
|
62
|
+
isLoading,
|
|
63
|
+
initError,
|
|
64
|
+
error: lastError
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const captureError = (error) => {
|
|
68
|
+
lastError = error instanceof Error ? error.message : String(error);
|
|
69
|
+
notify();
|
|
70
|
+
};
|
|
71
|
+
const run = async (action) => {
|
|
72
|
+
lastError = null;
|
|
73
|
+
try {
|
|
74
|
+
await action();
|
|
75
|
+
} catch (error) {
|
|
76
|
+
captureError(error);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const runWithResult = async (action) => {
|
|
80
|
+
lastError = null;
|
|
81
|
+
try {
|
|
82
|
+
return await action();
|
|
83
|
+
} catch (error) {
|
|
84
|
+
captureError(error);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const unsubscribeAuth = client.onAuthChange((nextState) => {
|
|
89
|
+
state = nextState;
|
|
90
|
+
notify();
|
|
91
|
+
});
|
|
92
|
+
void client.initialize().then(() => {
|
|
93
|
+
state = client.state;
|
|
94
|
+
isLoading = false;
|
|
95
|
+
notify();
|
|
96
|
+
}).catch((error) => {
|
|
97
|
+
initError = error instanceof Error ? error : new Error(String(error));
|
|
98
|
+
isLoading = false;
|
|
99
|
+
notify();
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
client,
|
|
103
|
+
getSnapshot: () => snapshot,
|
|
104
|
+
subscribe(listener) {
|
|
105
|
+
listeners.add(listener);
|
|
106
|
+
return () => {
|
|
107
|
+
listeners.delete(listener);
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
signUp: (params) => run(async () => {
|
|
111
|
+
await client.signUp(params);
|
|
112
|
+
}),
|
|
113
|
+
signIn: (params) => run(async () => {
|
|
114
|
+
await client.signIn(params);
|
|
115
|
+
}),
|
|
116
|
+
signInWithOAuth: async (provider, options) => {
|
|
117
|
+
lastError = null;
|
|
118
|
+
try {
|
|
119
|
+
return await client.signInWithOAuth(provider, options);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
captureError(error);
|
|
122
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
completeOAuthSignIn: (provider, params) => run(async () => {
|
|
126
|
+
await client.completeOAuthSignIn(provider, params);
|
|
127
|
+
}),
|
|
128
|
+
getOAuthAuthorizationUrl: async (provider, options) => {
|
|
129
|
+
lastError = null;
|
|
130
|
+
try {
|
|
131
|
+
return await client.getOAuthAuthorizationUrl(provider, options);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
captureError(error);
|
|
134
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
linkOAuth: (provider, params) => runWithResult(async () => client.linkOAuth(provider, params)),
|
|
138
|
+
listLinkedAccounts: () => runWithResult(async () => client.listLinkedAccounts()).then((value) => value ?? []),
|
|
139
|
+
unlinkOAuth: (provider) => run(async () => {
|
|
140
|
+
await client.unlinkOAuth(provider);
|
|
141
|
+
}),
|
|
142
|
+
signOut: () => run(async () => {
|
|
143
|
+
await client.signOut();
|
|
144
|
+
}),
|
|
145
|
+
destroy() {
|
|
146
|
+
unsubscribeAuth();
|
|
147
|
+
listeners.clear();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/vue/auth-context.ts
|
|
153
|
+
var authContextKey = /* @__PURE__ */ Symbol("korajs-auth-context");
|
|
154
|
+
|
|
155
|
+
// src/vue/auth-provider.ts
|
|
156
|
+
var AuthProvider = (0, import_vue.defineComponent)({
|
|
157
|
+
name: "AuthProvider",
|
|
158
|
+
props: {
|
|
159
|
+
client: {
|
|
160
|
+
type: Object,
|
|
161
|
+
required: true
|
|
162
|
+
},
|
|
163
|
+
fallback: {
|
|
164
|
+
type: [Object, String],
|
|
165
|
+
default: null
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setup(props, { slots }) {
|
|
169
|
+
const session = createAuthSession(props.client);
|
|
170
|
+
const snapshot = (0, import_vue.shallowRef)(session.getSnapshot());
|
|
171
|
+
const unsubscribe = session.subscribe(() => {
|
|
172
|
+
snapshot.value = session.getSnapshot();
|
|
173
|
+
});
|
|
174
|
+
(0, import_vue.onScopeDispose)(() => {
|
|
175
|
+
unsubscribe();
|
|
176
|
+
session.destroy();
|
|
177
|
+
});
|
|
178
|
+
const contextValue = {
|
|
179
|
+
client: props.client,
|
|
180
|
+
get state() {
|
|
181
|
+
return snapshot.value.state;
|
|
182
|
+
},
|
|
183
|
+
get isLoading() {
|
|
184
|
+
return snapshot.value.isLoading;
|
|
185
|
+
},
|
|
186
|
+
session
|
|
187
|
+
};
|
|
188
|
+
(0, import_vue.provide)(authContextKey, contextValue);
|
|
189
|
+
return () => {
|
|
190
|
+
const current = snapshot.value;
|
|
191
|
+
if (current.initError) {
|
|
192
|
+
return (0, import_vue.h)(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
style: { color: "red", padding: "1rem", fontFamily: "monospace" },
|
|
196
|
+
role: "alert"
|
|
197
|
+
},
|
|
198
|
+
[(0, import_vue.h)("strong", null, "Kora Auth initialization error: "), current.initError.message]
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
if (current.isLoading && props.fallback !== null) {
|
|
202
|
+
return props.fallback;
|
|
203
|
+
}
|
|
204
|
+
return slots.default?.();
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
function useAuthContext() {
|
|
209
|
+
const context = (0, import_vue.inject)(authContextKey);
|
|
210
|
+
if (!context) {
|
|
211
|
+
throw new Error(
|
|
212
|
+
"useAuth must be used within <AuthProvider>. Wrap your app with <AuthProvider client={authClient}>."
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
return context;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/vue/use-auth.ts
|
|
219
|
+
var import_vue2 = require("vue");
|
|
220
|
+
function useAuth() {
|
|
221
|
+
const { session } = useAuthContext();
|
|
222
|
+
const state = (0, import_vue2.reactive)({ ...session.getSnapshot() });
|
|
223
|
+
const sync = () => {
|
|
224
|
+
Object.assign(state, session.getSnapshot());
|
|
225
|
+
};
|
|
226
|
+
const unsubscribe = session.subscribe(sync);
|
|
227
|
+
sync();
|
|
228
|
+
(0, import_vue2.onScopeDispose)(unsubscribe);
|
|
229
|
+
return {
|
|
230
|
+
get user() {
|
|
231
|
+
return state.user;
|
|
232
|
+
},
|
|
233
|
+
get isAuthenticated() {
|
|
234
|
+
return state.isAuthenticated;
|
|
235
|
+
},
|
|
236
|
+
get isLoading() {
|
|
237
|
+
return state.isLoading;
|
|
238
|
+
},
|
|
239
|
+
get error() {
|
|
240
|
+
return state.error;
|
|
241
|
+
},
|
|
242
|
+
signUp: (params) => session.signUp(params).then(sync),
|
|
243
|
+
signIn: (params) => session.signIn(params).then(sync),
|
|
244
|
+
signInWithOAuth: (provider, options) => session.signInWithOAuth(provider, options).then((result) => {
|
|
245
|
+
sync();
|
|
246
|
+
return result;
|
|
247
|
+
}),
|
|
248
|
+
completeOAuthSignIn: (provider, params) => session.completeOAuthSignIn(provider, params).then(sync),
|
|
249
|
+
getOAuthAuthorizationUrl: (provider, options) => session.getOAuthAuthorizationUrl(provider, options).then((result) => {
|
|
250
|
+
sync();
|
|
251
|
+
return result;
|
|
252
|
+
}),
|
|
253
|
+
linkOAuth: (provider, params) => session.linkOAuth(provider, params).then((result) => {
|
|
254
|
+
sync();
|
|
255
|
+
return result;
|
|
256
|
+
}),
|
|
257
|
+
listLinkedAccounts: () => session.listLinkedAccounts().then((result) => {
|
|
258
|
+
sync();
|
|
259
|
+
return result;
|
|
260
|
+
}),
|
|
261
|
+
unlinkOAuth: (provider) => session.unlinkOAuth(provider).then(sync),
|
|
262
|
+
signOut: () => session.signOut().then(sync)
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function useCurrentUser() {
|
|
266
|
+
const { session } = useAuthContext();
|
|
267
|
+
const state = (0, import_vue2.reactive)({ user: session.getSnapshot().user });
|
|
268
|
+
const sync = () => {
|
|
269
|
+
state.user = session.getSnapshot().user;
|
|
270
|
+
};
|
|
271
|
+
const unsubscribe = session.subscribe(sync);
|
|
272
|
+
(0, import_vue2.onScopeDispose)(unsubscribe);
|
|
273
|
+
return (0, import_vue2.computed)(() => state.user);
|
|
274
|
+
}
|
|
275
|
+
function useAuthStatus() {
|
|
276
|
+
const { session } = useAuthContext();
|
|
277
|
+
const state = (0, import_vue2.reactive)({
|
|
278
|
+
state: session.getSnapshot().state,
|
|
279
|
+
isAuthenticated: session.getSnapshot().isAuthenticated,
|
|
280
|
+
isLoading: session.getSnapshot().isLoading
|
|
281
|
+
});
|
|
282
|
+
const sync = () => {
|
|
283
|
+
const snapshot = session.getSnapshot();
|
|
284
|
+
state.state = snapshot.state;
|
|
285
|
+
state.isAuthenticated = snapshot.isAuthenticated;
|
|
286
|
+
state.isLoading = snapshot.isLoading;
|
|
287
|
+
};
|
|
288
|
+
const unsubscribe = session.subscribe(sync);
|
|
289
|
+
sync();
|
|
290
|
+
(0, import_vue2.onScopeDispose)(unsubscribe);
|
|
291
|
+
return state;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/vue/org-provider.ts
|
|
295
|
+
var import_vue3 = require("vue");
|
|
296
|
+
|
|
297
|
+
// src/bindings/create-org-session.ts
|
|
298
|
+
var ROLE_LEVELS = {
|
|
299
|
+
viewer: 10,
|
|
300
|
+
billing: 15,
|
|
301
|
+
member: 20,
|
|
302
|
+
admin: 30,
|
|
303
|
+
owner: 40
|
|
304
|
+
};
|
|
305
|
+
function checkOrgPermission(currentRole, requiredRole) {
|
|
306
|
+
if (!currentRole) return false;
|
|
307
|
+
const currentLevel = ROLE_LEVELS[currentRole] ?? 0;
|
|
308
|
+
const requiredLevel = ROLE_LEVELS[requiredRole] ?? 0;
|
|
309
|
+
return currentLevel >= requiredLevel;
|
|
310
|
+
}
|
|
311
|
+
function createOrgSession(client) {
|
|
312
|
+
let snapshot = buildSnapshot(client);
|
|
313
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
314
|
+
const notify = () => {
|
|
315
|
+
snapshot = buildSnapshot(client);
|
|
316
|
+
for (const listener of listeners) {
|
|
317
|
+
listener();
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
const unsubscribeOrgChange = client.onOrgChange(notify);
|
|
321
|
+
return {
|
|
322
|
+
client,
|
|
323
|
+
getSnapshot: () => snapshot,
|
|
324
|
+
subscribe(listener) {
|
|
325
|
+
listeners.add(listener);
|
|
326
|
+
return () => {
|
|
327
|
+
listeners.delete(listener);
|
|
328
|
+
};
|
|
329
|
+
},
|
|
330
|
+
checkPermission(requiredRole) {
|
|
331
|
+
return checkOrgPermission(snapshot.role, requiredRole);
|
|
332
|
+
},
|
|
333
|
+
destroy() {
|
|
334
|
+
unsubscribeOrgChange();
|
|
335
|
+
listeners.clear();
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function buildSnapshot(client) {
|
|
340
|
+
return {
|
|
341
|
+
orgId: client.activeOrgId,
|
|
342
|
+
org: client.activeOrg,
|
|
343
|
+
role: client.activeRole
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function createOrgMembersActions(client, orgId, onError) {
|
|
347
|
+
return {
|
|
348
|
+
async refresh() {
|
|
349
|
+
await client.listMembers(orgId);
|
|
350
|
+
},
|
|
351
|
+
async invite(email, role) {
|
|
352
|
+
try {
|
|
353
|
+
return await client.inviteMember(orgId, { email, role });
|
|
354
|
+
} catch (error) {
|
|
355
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
356
|
+
onError(message);
|
|
357
|
+
throw error;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
async removeMember(userId) {
|
|
361
|
+
try {
|
|
362
|
+
await client.removeMember(orgId, userId);
|
|
363
|
+
} catch (error) {
|
|
364
|
+
onError(error instanceof Error ? error.message : String(error));
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
async updateRole(userId, role) {
|
|
368
|
+
try {
|
|
369
|
+
await client.updateMemberRole(orgId, userId, role);
|
|
370
|
+
} catch (error) {
|
|
371
|
+
onError(error instanceof Error ? error.message : String(error));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
async function loadOrgMembers(client, orgId) {
|
|
377
|
+
return client.listMembers(orgId);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/vue/org-provider.ts
|
|
381
|
+
var orgContextKey = /* @__PURE__ */ Symbol("korajs-org-context");
|
|
382
|
+
var OrgProvider = (0, import_vue3.defineComponent)({
|
|
383
|
+
name: "OrgProvider",
|
|
384
|
+
props: {
|
|
385
|
+
client: {
|
|
386
|
+
type: Object,
|
|
387
|
+
required: true
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
setup(props, { slots }) {
|
|
391
|
+
const session = createOrgSession(props.client);
|
|
392
|
+
(0, import_vue3.onScopeDispose)(() => {
|
|
393
|
+
session.destroy();
|
|
394
|
+
});
|
|
395
|
+
const contextValue = {
|
|
396
|
+
client: props.client,
|
|
397
|
+
session
|
|
398
|
+
};
|
|
399
|
+
(0, import_vue3.provide)(orgContextKey, contextValue);
|
|
400
|
+
return () => slots.default?.();
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
function useOrgContext() {
|
|
404
|
+
const context = (0, import_vue3.inject)(orgContextKey);
|
|
405
|
+
if (!context) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
'useOrg / useOrgMembers / usePermission must be used within an <OrgProvider>. Wrap your component tree with <OrgProvider :client="orgClient">.'
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
return context;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/vue/org-hooks.ts
|
|
414
|
+
var import_vue4 = require("vue");
|
|
415
|
+
function useOrgSnapshot(session) {
|
|
416
|
+
const state = (0, import_vue4.reactive)({ ...session.getSnapshot() });
|
|
417
|
+
const sync = () => {
|
|
418
|
+
Object.assign(state, session.getSnapshot());
|
|
419
|
+
};
|
|
420
|
+
const unsubscribe = session.subscribe(sync);
|
|
421
|
+
sync();
|
|
422
|
+
(0, import_vue4.onScopeDispose)(unsubscribe);
|
|
423
|
+
return state;
|
|
424
|
+
}
|
|
425
|
+
function useOrg() {
|
|
426
|
+
const { client, session } = useOrgContext();
|
|
427
|
+
const snapshot = useOrgSnapshot(session);
|
|
428
|
+
const error = (0, import_vue4.ref)(null);
|
|
429
|
+
const switchOrg = async (orgId) => {
|
|
430
|
+
error.value = null;
|
|
431
|
+
try {
|
|
432
|
+
await client.switchOrg(orgId);
|
|
433
|
+
} catch (err) {
|
|
434
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const createOrg = async (params) => {
|
|
438
|
+
error.value = null;
|
|
439
|
+
try {
|
|
440
|
+
return await client.createOrg(params);
|
|
441
|
+
} catch (err) {
|
|
442
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
443
|
+
error.value = message;
|
|
444
|
+
throw err;
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
const leaveOrg = async () => {
|
|
448
|
+
if (!snapshot.orgId) return;
|
|
449
|
+
error.value = null;
|
|
450
|
+
try {
|
|
451
|
+
await client.leaveOrg(snapshot.orgId);
|
|
452
|
+
} catch (err) {
|
|
453
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
const clearOrg = () => {
|
|
457
|
+
client.clearActiveOrg();
|
|
458
|
+
};
|
|
459
|
+
const listOrgs = async () => {
|
|
460
|
+
try {
|
|
461
|
+
return await client.listOrgs();
|
|
462
|
+
} catch (err) {
|
|
463
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
464
|
+
return [];
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
return {
|
|
468
|
+
get org() {
|
|
469
|
+
return snapshot.org;
|
|
470
|
+
},
|
|
471
|
+
get role() {
|
|
472
|
+
return snapshot.role;
|
|
473
|
+
},
|
|
474
|
+
get orgId() {
|
|
475
|
+
return snapshot.orgId;
|
|
476
|
+
},
|
|
477
|
+
switchOrg,
|
|
478
|
+
createOrg,
|
|
479
|
+
leaveOrg,
|
|
480
|
+
clearOrg,
|
|
481
|
+
listOrgs,
|
|
482
|
+
get error() {
|
|
483
|
+
return error.value;
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
function useOrgMembers(orgId) {
|
|
488
|
+
const { client } = useOrgContext();
|
|
489
|
+
const members = (0, import_vue4.ref)([]);
|
|
490
|
+
const isLoading = (0, import_vue4.ref)(true);
|
|
491
|
+
const error = (0, import_vue4.ref)(null);
|
|
492
|
+
const refresh = async () => {
|
|
493
|
+
isLoading.value = true;
|
|
494
|
+
error.value = null;
|
|
495
|
+
try {
|
|
496
|
+
members.value = await loadOrgMembers(client, orgId);
|
|
497
|
+
} catch (err) {
|
|
498
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
499
|
+
} finally {
|
|
500
|
+
isLoading.value = false;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
(0, import_vue4.watch)(
|
|
504
|
+
() => orgId,
|
|
505
|
+
() => {
|
|
506
|
+
void refresh();
|
|
507
|
+
},
|
|
508
|
+
{ immediate: true }
|
|
509
|
+
);
|
|
510
|
+
const actions = createOrgMembersActions(client, orgId, (message) => {
|
|
511
|
+
error.value = message;
|
|
512
|
+
});
|
|
513
|
+
const invite = async (email, role) => {
|
|
514
|
+
const result = await actions.invite(email, role);
|
|
515
|
+
await refresh();
|
|
516
|
+
return result;
|
|
517
|
+
};
|
|
518
|
+
const removeMember = async (userId) => {
|
|
519
|
+
await actions.removeMember(userId);
|
|
520
|
+
await refresh();
|
|
521
|
+
};
|
|
522
|
+
const updateRole = async (userId, role) => {
|
|
523
|
+
await actions.updateRole(userId, role);
|
|
524
|
+
await refresh();
|
|
525
|
+
};
|
|
526
|
+
return {
|
|
527
|
+
get members() {
|
|
528
|
+
return members.value;
|
|
529
|
+
},
|
|
530
|
+
get isLoading() {
|
|
531
|
+
return isLoading.value;
|
|
532
|
+
},
|
|
533
|
+
refresh,
|
|
534
|
+
invite,
|
|
535
|
+
removeMember,
|
|
536
|
+
updateRole,
|
|
537
|
+
get error() {
|
|
538
|
+
return error.value;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function usePermission(requiredRole) {
|
|
543
|
+
const { session } = useOrgContext();
|
|
544
|
+
const allowed = (0, import_vue4.ref)(session.checkPermission(requiredRole));
|
|
545
|
+
const unsubscribe = session.subscribe(() => {
|
|
546
|
+
allowed.value = session.checkPermission(requiredRole);
|
|
547
|
+
});
|
|
548
|
+
(0, import_vue4.onScopeDispose)(unsubscribe);
|
|
549
|
+
return (0, import_vue4.readonly)(allowed);
|
|
550
|
+
}
|
|
551
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
552
|
+
0 && (module.exports = {
|
|
553
|
+
AuthProvider,
|
|
554
|
+
OrgProvider,
|
|
555
|
+
authContextKey,
|
|
556
|
+
useAuth,
|
|
557
|
+
useAuthContext,
|
|
558
|
+
useAuthStatus,
|
|
559
|
+
useCurrentUser,
|
|
560
|
+
useOrg,
|
|
561
|
+
useOrgContext,
|
|
562
|
+
useOrgMembers,
|
|
563
|
+
usePermission
|
|
564
|
+
});
|
|
565
|
+
//# sourceMappingURL=vue.cjs.map
|
package/dist/vue.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vue.ts","../src/vue/auth-provider.ts","../src/bindings/create-auth-session.ts","../src/vue/auth-context.ts","../src/vue/use-auth.ts","../src/vue/org-provider.ts","../src/bindings/create-org-session.ts","../src/vue/org-hooks.ts"],"sourcesContent":["export { AuthProvider, useAuthContext } from './vue/auth-provider'\nexport type { AuthProviderProps } from './vue/auth-provider-types'\nexport { useAuth, useCurrentUser, useAuthStatus } from './vue/use-auth'\nexport type { UseAuthResult, AuthStatus } from './vue/use-auth'\nexport { authContextKey } from './vue/auth-context'\nexport type { AuthContextValue } from './vue/auth-context'\nexport { OrgProvider, useOrgContext } from './vue/org-provider'\nexport type { OrgContextValue } from './vue/org-provider'\nexport { useOrg, useOrgMembers, usePermission } from './vue/org-hooks'\nexport type { UseOrgResult, UseOrgMembersResult } from './vue/org-hooks'\n","import type { PropType, VNode } from 'vue'\nimport { defineComponent, h, inject, onScopeDispose, provide, shallowRef } from 'vue'\nimport { type AuthSessionSnapshot, createAuthSession } from '../bindings/create-auth-session'\nimport type { AuthClient } from '../client/auth-client'\nimport { type AuthContextValue, authContextKey } from './auth-context'\n\nexport const AuthProvider = defineComponent({\n\tname: 'AuthProvider',\n\tprops: {\n\t\tclient: {\n\t\t\ttype: Object as PropType<AuthClient>,\n\t\t\trequired: true,\n\t\t},\n\t\tfallback: {\n\t\t\ttype: [Object, String] as PropType<VNode | string | null>,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\tconst session = createAuthSession(props.client)\n\t\tconst snapshot = shallowRef<AuthSessionSnapshot>(session.getSnapshot())\n\n\t\tconst unsubscribe = session.subscribe(() => {\n\t\t\tsnapshot.value = session.getSnapshot()\n\t\t})\n\n\t\tonScopeDispose(() => {\n\t\t\tunsubscribe()\n\t\t\tsession.destroy()\n\t\t})\n\n\t\tconst contextValue: AuthContextValue = {\n\t\t\tclient: props.client,\n\t\t\tget state() {\n\t\t\t\treturn snapshot.value.state\n\t\t\t},\n\t\t\tget isLoading() {\n\t\t\t\treturn snapshot.value.isLoading\n\t\t\t},\n\t\t\tsession,\n\t\t}\n\n\t\tprovide(authContextKey, contextValue)\n\n\t\treturn () => {\n\t\t\tconst current = snapshot.value\n\n\t\t\tif (current.initError) {\n\t\t\t\treturn h(\n\t\t\t\t\t'div',\n\t\t\t\t\t{\n\t\t\t\t\t\tstyle: { color: 'red', padding: '1rem', fontFamily: 'monospace' },\n\t\t\t\t\t\trole: 'alert',\n\t\t\t\t\t},\n\t\t\t\t\t[h('strong', null, 'Kora Auth initialization error: '), current.initError.message],\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (current.isLoading && props.fallback !== null) {\n\t\t\t\treturn props.fallback\n\t\t\t}\n\n\t\t\treturn slots.default?.()\n\t\t}\n\t},\n})\n\nexport function useAuthContext(): AuthContextValue {\n\tconst context = inject<AuthContextValue | undefined>(authContextKey)\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'useAuth must be used within <AuthProvider>. Wrap your app with <AuthProvider client={authClient}>.',\n\t\t)\n\t}\n\treturn context\n}\n","import type {\n\tAuthClient,\n\tAuthState,\n\tAuthUser,\n\tLinkedOAuthAccount,\n\tOAuthAuthorizationOptions,\n\tOAuthAuthorizationResult,\n\tOAuthCallbackParams,\n} from '../client/auth-client'\n\nexport interface AuthSessionSnapshot {\n\tstate: AuthState\n\tuser: AuthUser | null\n\tisAuthenticated: boolean\n\tisLoading: boolean\n\tinitError: Error | null\n\terror: string | null\n}\n\nexport interface AuthSession {\n\treadonly client: AuthClient\n\tgetSnapshot(): AuthSessionSnapshot\n\tsubscribe(listener: () => void): () => void\n\tsignUp(params: {\n\t\temail: string\n\t\tpassword: string\n\t\tname?: string\n\t\tdeviceId?: string\n\t\tdevicePublicKey?: string\n\t}): Promise<void>\n\tsignIn(params: {\n\t\temail: string\n\t\tpassword: string\n\t\tdeviceId?: string\n\t\tdevicePublicKey?: string\n\t}): Promise<void>\n\tsignInWithOAuth(\n\t\tprovider: string,\n\t\toptions?: OAuthAuthorizationOptions,\n\t): Promise<OAuthAuthorizationResult>\n\tcompleteOAuthSignIn(provider: string, params: OAuthCallbackParams): Promise<void>\n\tgetOAuthAuthorizationUrl(\n\t\tprovider: string,\n\t\toptions?: OAuthAuthorizationOptions,\n\t): Promise<OAuthAuthorizationResult>\n\tlinkOAuth(provider: string, params: OAuthCallbackParams): Promise<LinkedOAuthAccount | null>\n\tlistLinkedAccounts(): Promise<LinkedOAuthAccount[]>\n\tunlinkOAuth(provider: string): Promise<void>\n\tsignOut(): Promise<void>\n\tdestroy(): void\n}\n\n/**\n * Framework-agnostic auth session: initialization, reactive snapshot, and client methods.\n */\nexport function createAuthSession(client: AuthClient): AuthSession {\n\tlet state: AuthState = client.state\n\tlet isLoading = true\n\tlet initError: Error | null = null\n\tlet lastError: string | null = null\n\n\tconst listeners = new Set<() => void>()\n\tlet snapshot = buildSnapshot()\n\n\tconst refreshSnapshot = (): void => {\n\t\tsnapshot = buildSnapshot()\n\t}\n\n\tconst notify = (): void => {\n\t\trefreshSnapshot()\n\t\tfor (const listener of listeners) {\n\t\t\tlistener()\n\t\t}\n\t}\n\n\tfunction buildSnapshot(): AuthSessionSnapshot {\n\t\treturn {\n\t\t\tstate,\n\t\t\tuser: client.currentUser,\n\t\t\tisAuthenticated: state === 'authenticated',\n\t\t\tisLoading,\n\t\t\tinitError,\n\t\t\terror: lastError,\n\t\t}\n\t}\n\n\tconst captureError = (error: unknown): void => {\n\t\tlastError = error instanceof Error ? error.message : String(error)\n\t\tnotify()\n\t}\n\n\tconst run = async (action: () => Promise<void>): Promise<void> => {\n\t\tlastError = null\n\t\ttry {\n\t\t\tawait action()\n\t\t} catch (error) {\n\t\t\tcaptureError(error)\n\t\t}\n\t}\n\n\tconst runWithResult = async <T>(action: () => Promise<T>): Promise<T | null> => {\n\t\tlastError = null\n\t\ttry {\n\t\t\treturn await action()\n\t\t} catch (error) {\n\t\t\tcaptureError(error)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tconst unsubscribeAuth = client.onAuthChange((nextState) => {\n\t\tstate = nextState\n\t\tnotify()\n\t})\n\n\tvoid client\n\t\t.initialize()\n\t\t.then(() => {\n\t\t\tstate = client.state\n\t\t\tisLoading = false\n\t\t\tnotify()\n\t\t})\n\t\t.catch((error: unknown) => {\n\t\t\tinitError = error instanceof Error ? error : new Error(String(error))\n\t\t\tisLoading = false\n\t\t\tnotify()\n\t\t})\n\n\treturn {\n\t\tclient,\n\t\tgetSnapshot: () => snapshot,\n\t\tsubscribe(listener) {\n\t\t\tlisteners.add(listener)\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener)\n\t\t\t}\n\t\t},\n\t\tsignUp: (params) =>\n\t\t\trun(async () => {\n\t\t\t\tawait client.signUp(params)\n\t\t\t}),\n\t\tsignIn: (params) =>\n\t\t\trun(async () => {\n\t\t\t\tawait client.signIn(params)\n\t\t\t}),\n\t\tsignInWithOAuth: async (provider, options) => {\n\t\t\tlastError = null\n\t\t\ttry {\n\t\t\t\treturn await client.signInWithOAuth(provider, options)\n\t\t\t} catch (error) {\n\t\t\t\tcaptureError(error)\n\t\t\t\tthrow error instanceof Error ? error : new Error(String(error))\n\t\t\t}\n\t\t},\n\t\tcompleteOAuthSignIn: (provider, params) =>\n\t\t\trun(async () => {\n\t\t\t\tawait client.completeOAuthSignIn(provider, params)\n\t\t\t}),\n\t\tgetOAuthAuthorizationUrl: async (provider, options) => {\n\t\t\tlastError = null\n\t\t\ttry {\n\t\t\t\treturn await client.getOAuthAuthorizationUrl(provider, options)\n\t\t\t} catch (error) {\n\t\t\t\tcaptureError(error)\n\t\t\t\tthrow error instanceof Error ? error : new Error(String(error))\n\t\t\t}\n\t\t},\n\t\tlinkOAuth: (provider, params) => runWithResult(async () => client.linkOAuth(provider, params)),\n\t\tlistLinkedAccounts: () =>\n\t\t\trunWithResult(async () => client.listLinkedAccounts()).then((value) => value ?? []),\n\t\tunlinkOAuth: (provider) =>\n\t\t\trun(async () => {\n\t\t\t\tawait client.unlinkOAuth(provider)\n\t\t\t}),\n\t\tsignOut: () =>\n\t\t\trun(async () => {\n\t\t\t\tawait client.signOut()\n\t\t\t}),\n\t\tdestroy() {\n\t\t\tunsubscribeAuth()\n\t\t\tlisteners.clear()\n\t\t},\n\t}\n}\n","import type { AuthClient, AuthState } from '../client/auth-client'\n\nexport interface AuthContextValue {\n\tclient: AuthClient\n\tstate: AuthState\n\tisLoading: boolean\n\tsession: import('../bindings/create-auth-session').AuthSession\n}\n\nexport const authContextKey = Symbol('korajs-auth-context')\n","import { computed, onScopeDispose, reactive } from 'vue'\nimport type {\n\tAuthUser,\n\tLinkedOAuthAccount,\n\tOAuthAuthorizationOptions,\n\tOAuthAuthorizationResult,\n\tOAuthCallbackParams,\n} from '../client/auth-client'\nimport { useAuthContext } from './auth-provider'\n\nexport interface UseAuthResult {\n\tuser: AuthUser | null\n\tisAuthenticated: boolean\n\tisLoading: boolean\n\tsignUp: (params: {\n\t\temail: string\n\t\tpassword: string\n\t\tname?: string\n\t\tdeviceId?: string\n\t\tdevicePublicKey?: string\n\t}) => Promise<void>\n\tsignIn: (params: {\n\t\temail: string\n\t\tpassword: string\n\t\tdeviceId?: string\n\t\tdevicePublicKey?: string\n\t}) => Promise<void>\n\tsignInWithOAuth: (\n\t\tprovider: string,\n\t\toptions?: OAuthAuthorizationOptions,\n\t) => Promise<OAuthAuthorizationResult>\n\tcompleteOAuthSignIn: (provider: string, params: OAuthCallbackParams) => Promise<void>\n\tgetOAuthAuthorizationUrl: (\n\t\tprovider: string,\n\t\toptions?: OAuthAuthorizationOptions,\n\t) => Promise<OAuthAuthorizationResult>\n\tlinkOAuth: (provider: string, params: OAuthCallbackParams) => Promise<LinkedOAuthAccount | null>\n\tlistLinkedAccounts: () => Promise<LinkedOAuthAccount[]>\n\tunlinkOAuth: (provider: string) => Promise<void>\n\tsignOut: () => Promise<void>\n\terror: string | null\n}\n\nexport interface AuthStatus {\n\tstate: import('../client/auth-client').AuthState\n\tisAuthenticated: boolean\n\tisLoading: boolean\n}\n\nexport function useAuth(): UseAuthResult {\n\tconst { session } = useAuthContext()\n\tconst state = reactive({ ...session.getSnapshot() })\n\n\tconst sync = (): void => {\n\t\tObject.assign(state, session.getSnapshot())\n\t}\n\n\tconst unsubscribe = session.subscribe(sync)\n\tsync()\n\n\tonScopeDispose(unsubscribe)\n\n\treturn {\n\t\tget user() {\n\t\t\treturn state.user\n\t\t},\n\t\tget isAuthenticated() {\n\t\t\treturn state.isAuthenticated\n\t\t},\n\t\tget isLoading() {\n\t\t\treturn state.isLoading\n\t\t},\n\t\tget error() {\n\t\t\treturn state.error\n\t\t},\n\t\tsignUp: (params) => session.signUp(params).then(sync),\n\t\tsignIn: (params) => session.signIn(params).then(sync),\n\t\tsignInWithOAuth: (provider, options) =>\n\t\t\tsession.signInWithOAuth(provider, options).then((result) => {\n\t\t\t\tsync()\n\t\t\t\treturn result\n\t\t\t}),\n\t\tcompleteOAuthSignIn: (provider, params) =>\n\t\t\tsession.completeOAuthSignIn(provider, params).then(sync),\n\t\tgetOAuthAuthorizationUrl: (provider, options) =>\n\t\t\tsession.getOAuthAuthorizationUrl(provider, options).then((result) => {\n\t\t\t\tsync()\n\t\t\t\treturn result\n\t\t\t}),\n\t\tlinkOAuth: (provider, params) =>\n\t\t\tsession.linkOAuth(provider, params).then((result) => {\n\t\t\t\tsync()\n\t\t\t\treturn result\n\t\t\t}),\n\t\tlistLinkedAccounts: () =>\n\t\t\tsession.listLinkedAccounts().then((result) => {\n\t\t\t\tsync()\n\t\t\t\treturn result\n\t\t\t}),\n\t\tunlinkOAuth: (provider) => session.unlinkOAuth(provider).then(sync),\n\t\tsignOut: () => session.signOut().then(sync),\n\t}\n}\n\nexport function useCurrentUser() {\n\tconst { session } = useAuthContext()\n\tconst state = reactive({ user: session.getSnapshot().user })\n\n\tconst sync = (): void => {\n\t\tstate.user = session.getSnapshot().user\n\t}\n\n\tconst unsubscribe = session.subscribe(sync)\n\tonScopeDispose(unsubscribe)\n\n\treturn computed(() => state.user)\n}\n\nexport function useAuthStatus(): AuthStatus {\n\tconst { session } = useAuthContext()\n\tconst state = reactive({\n\t\tstate: session.getSnapshot().state,\n\t\tisAuthenticated: session.getSnapshot().isAuthenticated,\n\t\tisLoading: session.getSnapshot().isLoading,\n\t})\n\n\tconst sync = (): void => {\n\t\tconst snapshot = session.getSnapshot()\n\t\tstate.state = snapshot.state\n\t\tstate.isAuthenticated = snapshot.isAuthenticated\n\t\tstate.isLoading = snapshot.isLoading\n\t}\n\n\tconst unsubscribe = session.subscribe(sync)\n\tsync()\n\tonScopeDispose(unsubscribe)\n\n\treturn state\n}\n","import type { InjectionKey } from 'vue'\nimport type { PropType } from 'vue'\nimport { defineComponent, inject, onScopeDispose, provide } from 'vue'\nimport { type OrgSession, createOrgSession } from '../bindings/create-org-session'\nimport type { OrgClient } from '../client/org-client'\n\nexport interface OrgContextValue {\n\tclient: OrgClient\n\tsession: OrgSession\n}\n\nexport const orgContextKey: InjectionKey<OrgContextValue> = Symbol('korajs-org-context')\n\nexport const OrgProvider = defineComponent({\n\tname: 'OrgProvider',\n\tprops: {\n\t\tclient: {\n\t\t\ttype: Object as PropType<OrgClient>,\n\t\t\trequired: true,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\tconst session = createOrgSession(props.client)\n\n\t\tonScopeDispose(() => {\n\t\t\tsession.destroy()\n\t\t})\n\n\t\tconst contextValue: OrgContextValue = {\n\t\t\tclient: props.client,\n\t\t\tsession,\n\t\t}\n\n\t\tprovide(orgContextKey, contextValue)\n\n\t\treturn () => slots.default?.()\n\t},\n})\n\nexport function useOrgContext(): OrgContextValue {\n\tconst context = inject(orgContextKey)\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'useOrg / useOrgMembers / usePermission must be used within an <OrgProvider>. ' +\n\t\t\t\t'Wrap your component tree with <OrgProvider :client=\"orgClient\">.',\n\t\t)\n\t}\n\treturn context\n}\n","import type {\n\tClientInvitation,\n\tClientMembership,\n\tClientOrganization,\n\tOrgClient,\n} from '../client/org-client'\n\nexport interface OrgSnapshot {\n\torgId: string | null\n\torg: ClientOrganization | null\n\trole: string | null\n}\n\nexport interface OrgSession {\n\treadonly client: OrgClient\n\tgetSnapshot(): OrgSnapshot\n\tsubscribe(listener: () => void): () => void\n\tcheckPermission(requiredRole: string): boolean\n\tdestroy(): void\n}\n\nconst ROLE_LEVELS: Record<string, number> = {\n\tviewer: 10,\n\tbilling: 15,\n\tmember: 20,\n\tadmin: 30,\n\towner: 40,\n}\n\nexport function checkOrgPermission(currentRole: string | null, requiredRole: string): boolean {\n\tif (!currentRole) return false\n\tconst currentLevel = ROLE_LEVELS[currentRole] ?? 0\n\tconst requiredLevel = ROLE_LEVELS[requiredRole] ?? 0\n\treturn currentLevel >= requiredLevel\n}\n\n/**\n * Framework-agnostic org session with reactive snapshot subscription.\n */\nexport function createOrgSession(client: OrgClient): OrgSession {\n\tlet snapshot = buildSnapshot(client)\n\tconst listeners = new Set<() => void>()\n\n\tconst notify = (): void => {\n\t\tsnapshot = buildSnapshot(client)\n\t\tfor (const listener of listeners) {\n\t\t\tlistener()\n\t\t}\n\t}\n\n\tconst unsubscribeOrgChange = client.onOrgChange(notify)\n\n\treturn {\n\t\tclient,\n\t\tgetSnapshot: () => snapshot,\n\t\tsubscribe(listener: () => void): () => void {\n\t\t\tlisteners.add(listener)\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener)\n\t\t\t}\n\t\t},\n\t\tcheckPermission(requiredRole: string): boolean {\n\t\t\treturn checkOrgPermission(snapshot.role, requiredRole)\n\t\t},\n\t\tdestroy(): void {\n\t\t\tunsubscribeOrgChange()\n\t\t\tlisteners.clear()\n\t\t},\n\t}\n}\n\nfunction buildSnapshot(client: OrgClient): OrgSnapshot {\n\treturn {\n\t\torgId: client.activeOrgId,\n\t\torg: client.activeOrg,\n\t\trole: client.activeRole,\n\t}\n}\n\nexport interface UseOrgMembersActions {\n\trefresh: () => Promise<void>\n\tinvite: (email: string, role: string) => Promise<ClientInvitation>\n\tremoveMember: (userId: string) => Promise<void>\n\tupdateRole: (userId: string, role: string) => Promise<void>\n}\n\n/**\n * Shared org member management actions (loading state remains framework-specific).\n */\nexport function createOrgMembersActions(\n\tclient: OrgClient,\n\torgId: string,\n\tonError: (message: string) => void,\n): UseOrgMembersActions {\n\treturn {\n\t\tasync refresh(): Promise<void> {\n\t\t\tawait client.listMembers(orgId)\n\t\t},\n\t\tasync invite(email: string, role: string): Promise<ClientInvitation> {\n\t\t\ttry {\n\t\t\t\treturn await client.inviteMember(orgId, { email, role })\n\t\t\t} catch (error) {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error)\n\t\t\t\tonError(message)\n\t\t\t\tthrow error\n\t\t\t}\n\t\t},\n\t\tasync removeMember(userId: string): Promise<void> {\n\t\t\ttry {\n\t\t\t\tawait client.removeMember(orgId, userId)\n\t\t\t} catch (error) {\n\t\t\t\tonError(error instanceof Error ? error.message : String(error))\n\t\t\t}\n\t\t},\n\t\tasync updateRole(userId: string, role: string): Promise<void> {\n\t\t\ttry {\n\t\t\t\tawait client.updateMemberRole(orgId, userId, role)\n\t\t\t} catch (error) {\n\t\t\t\tonError(error instanceof Error ? error.message : String(error))\n\t\t\t}\n\t\t},\n\t}\n}\n\nexport async function loadOrgMembers(\n\tclient: OrgClient,\n\torgId: string,\n): Promise<ClientMembership[]> {\n\treturn client.listMembers(orgId)\n}\n","import { onScopeDispose, reactive, readonly, ref, watch } from 'vue'\nimport {\n\ttype OrgSnapshot,\n\tcreateOrgMembersActions,\n\tloadOrgMembers,\n} from '../bindings/create-org-session'\nimport type { ClientInvitation, ClientMembership, ClientOrganization } from '../client/org-client'\nimport { useOrgContext } from './org-provider'\n\nexport interface UseOrgResult {\n\torg: ClientOrganization | null\n\trole: string | null\n\torgId: string | null\n\tswitchOrg: (orgId: string) => Promise<void>\n\tcreateOrg: (params: { name: string; slug?: string }) => Promise<ClientOrganization>\n\tleaveOrg: () => Promise<void>\n\tclearOrg: () => void\n\tlistOrgs: () => Promise<ClientOrganization[]>\n\terror: string | null\n}\n\nexport interface UseOrgMembersResult {\n\tmembers: ClientMembership[]\n\tisLoading: boolean\n\trefresh: () => Promise<void>\n\tinvite: (email: string, role: string) => Promise<ClientInvitation>\n\tremoveMember: (userId: string) => Promise<void>\n\tupdateRole: (userId: string, role: string) => Promise<void>\n\terror: string | null\n}\n\nfunction useOrgSnapshot(session: ReturnType<typeof useOrgContext>['session']): OrgSnapshot {\n\tconst state = reactive({ ...session.getSnapshot() })\n\n\tconst sync = (): void => {\n\t\tObject.assign(state, session.getSnapshot())\n\t}\n\n\tconst unsubscribe = session.subscribe(sync)\n\tsync()\n\n\tonScopeDispose(unsubscribe)\n\n\treturn state\n}\n\nexport function useOrg(): UseOrgResult {\n\tconst { client, session } = useOrgContext()\n\tconst snapshot = useOrgSnapshot(session)\n\tconst error = ref<string | null>(null)\n\n\tconst switchOrg = async (orgId: string): Promise<void> => {\n\t\terror.value = null\n\t\ttry {\n\t\t\tawait client.switchOrg(orgId)\n\t\t} catch (err) {\n\t\t\terror.value = err instanceof Error ? err.message : String(err)\n\t\t}\n\t}\n\n\tconst createOrg = async (params: {\n\t\tname: string\n\t\tslug?: string\n\t}): Promise<ClientOrganization> => {\n\t\terror.value = null\n\t\ttry {\n\t\t\treturn await client.createOrg(params)\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err)\n\t\t\terror.value = message\n\t\t\tthrow err\n\t\t}\n\t}\n\n\tconst leaveOrg = async (): Promise<void> => {\n\t\tif (!snapshot.orgId) return\n\t\terror.value = null\n\t\ttry {\n\t\t\tawait client.leaveOrg(snapshot.orgId)\n\t\t} catch (err) {\n\t\t\terror.value = err instanceof Error ? err.message : String(err)\n\t\t}\n\t}\n\n\tconst clearOrg = (): void => {\n\t\tclient.clearActiveOrg()\n\t}\n\n\tconst listOrgs = async (): Promise<ClientOrganization[]> => {\n\t\ttry {\n\t\t\treturn await client.listOrgs()\n\t\t} catch (err) {\n\t\t\terror.value = err instanceof Error ? err.message : String(err)\n\t\t\treturn []\n\t\t}\n\t}\n\n\treturn {\n\t\tget org() {\n\t\t\treturn snapshot.org\n\t\t},\n\t\tget role() {\n\t\t\treturn snapshot.role\n\t\t},\n\t\tget orgId() {\n\t\t\treturn snapshot.orgId\n\t\t},\n\t\tswitchOrg,\n\t\tcreateOrg,\n\t\tleaveOrg,\n\t\tclearOrg,\n\t\tlistOrgs,\n\t\tget error() {\n\t\t\treturn error.value\n\t\t},\n\t}\n}\n\nexport function useOrgMembers(orgId: string): UseOrgMembersResult {\n\tconst { client } = useOrgContext()\n\tconst members = ref<ClientMembership[]>([])\n\tconst isLoading = ref(true)\n\tconst error = ref<string | null>(null)\n\n\tconst refresh = async (): Promise<void> => {\n\t\tisLoading.value = true\n\t\terror.value = null\n\t\ttry {\n\t\t\tmembers.value = await loadOrgMembers(client, orgId)\n\t\t} catch (err) {\n\t\t\terror.value = err instanceof Error ? err.message : String(err)\n\t\t} finally {\n\t\t\tisLoading.value = false\n\t\t}\n\t}\n\n\twatch(\n\t\t() => orgId,\n\t\t() => {\n\t\t\tvoid refresh()\n\t\t},\n\t\t{ immediate: true },\n\t)\n\n\tconst actions = createOrgMembersActions(client, orgId, (message) => {\n\t\terror.value = message\n\t})\n\n\tconst invite = async (email: string, role: string): Promise<ClientInvitation> => {\n\t\tconst result = await actions.invite(email, role)\n\t\tawait refresh()\n\t\treturn result\n\t}\n\n\tconst removeMember = async (userId: string): Promise<void> => {\n\t\tawait actions.removeMember(userId)\n\t\tawait refresh()\n\t}\n\n\tconst updateRole = async (userId: string, role: string): Promise<void> => {\n\t\tawait actions.updateRole(userId, role)\n\t\tawait refresh()\n\t}\n\n\treturn {\n\t\tget members() {\n\t\t\treturn members.value\n\t\t},\n\t\tget isLoading() {\n\t\t\treturn isLoading.value\n\t\t},\n\t\trefresh,\n\t\tinvite,\n\t\tremoveMember,\n\t\tupdateRole,\n\t\tget error() {\n\t\t\treturn error.value\n\t\t},\n\t}\n}\n\nexport function usePermission(requiredRole: string): Readonly<{ value: boolean }> {\n\tconst { session } = useOrgContext()\n\tconst allowed = ref(session.checkPermission(requiredRole))\n\n\tconst unsubscribe = session.subscribe(() => {\n\t\tallowed.value = session.checkPermission(requiredRole)\n\t})\n\n\tonScopeDispose(unsubscribe)\n\n\treturn readonly(allowed)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,iBAAgF;;;ACsDzE,SAAS,kBAAkB,QAAiC;AAClE,MAAI,QAAmB,OAAO;AAC9B,MAAI,YAAY;AAChB,MAAI,YAA0B;AAC9B,MAAI,YAA2B;AAE/B,QAAM,YAAY,oBAAI,IAAgB;AACtC,MAAI,WAAWA,eAAc;AAE7B,QAAM,kBAAkB,MAAY;AACnC,eAAWA,eAAc;AAAA,EAC1B;AAEA,QAAM,SAAS,MAAY;AAC1B,oBAAgB;AAChB,eAAW,YAAY,WAAW;AACjC,eAAS;AAAA,IACV;AAAA,EACD;AAEA,WAASA,iBAAqC;AAC7C,WAAO;AAAA,MACN;AAAA,MACA,MAAM,OAAO;AAAA,MACb,iBAAiB,UAAU;AAAA,MAC3B;AAAA,MACA;AAAA,MACA,OAAO;AAAA,IACR;AAAA,EACD;AAEA,QAAM,eAAe,CAAC,UAAyB;AAC9C,gBAAY,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,WAAO;AAAA,EACR;AAEA,QAAM,MAAM,OAAO,WAA+C;AACjE,gBAAY;AACZ,QAAI;AACH,YAAM,OAAO;AAAA,IACd,SAAS,OAAO;AACf,mBAAa,KAAK;AAAA,IACnB;AAAA,EACD;AAEA,QAAM,gBAAgB,OAAU,WAAgD;AAC/E,gBAAY;AACZ,QAAI;AACH,aAAO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