@ai-matrx/meet 0.7.85 → 0.8.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/dist/react.js CHANGED
@@ -1,19 +1,8 @@
1
1
  "use client";
2
2
  "use client";
3
3
 
4
- // src/core/slot.ts
5
- var NAMESPACE = "ai-matrx.meet";
6
- function globalSlot(name, create) {
7
- const key = /* @__PURE__ */ Symbol.for(`${NAMESPACE}.${name}`);
8
- const host = globalThis;
9
- const existing = host[key];
10
- if (existing !== void 0) return existing;
11
- const created = create();
12
- host[key] = created;
13
- return created;
14
- }
15
-
16
4
  // src/react/provider.tsx
5
+ import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
17
6
  import {
18
7
  createContext,
19
8
  useCallback,
@@ -913,8 +902,9 @@ function fileDownloadPath(fileId) {
913
902
 
914
903
  // src/core/channels.ts
915
904
  import { defineChannelNamespace } from "@ai-matrx/realtime";
905
+ import { globalSlot } from "@ai-matrx/kit/global-slot";
916
906
  function namespaces() {
917
- return globalSlot("channel-namespaces", () => ({
907
+ return globalSlot("ai-matrx.meet.channel-namespaces", () => ({
918
908
  user: defineChannelNamespace({
919
909
  namespace: "meet-user",
920
910
  parts: ["userId"],
@@ -3497,87 +3487,22 @@ function snippetRuns(snippet) {
3497
3487
  }
3498
3488
 
3499
3489
  // src/core/session-identity.ts
3500
- var RESOLVING = Object.freeze({
3501
- state: "resolving",
3502
- userId: null
3503
- });
3504
- var SERVER_SESSION_IDENTITY = RESOLVING;
3505
- function authOf(client) {
3506
- const candidate = client.auth;
3507
- if (candidate === null || typeof candidate !== "object") return null;
3508
- const auth = candidate;
3509
- if (typeof auth.getSession !== "function") return null;
3510
- if (typeof auth.onAuthStateChange !== "function") return null;
3511
- return auth;
3512
- }
3513
- function userIdOf(session) {
3514
- const id = session?.user?.id;
3515
- return typeof id === "string" && id.length > 0 ? asUserId(id) : null;
3516
- }
3517
- function createSessionIdentity(options) {
3518
- const { client, onDiagnostic } = options;
3519
- const listeners = /* @__PURE__ */ new Set();
3520
- let current = RESOLVING;
3521
- let disposed = false;
3522
- const publish = (state, userId) => {
3523
- if (disposed) return;
3524
- if (current.state === state && current.userId === userId) return;
3525
- current = Object.freeze({ state, userId });
3526
- for (const listener of [...listeners]) listener();
3527
- };
3528
- const auth = authOf(client);
3529
- if (auth === null) {
3530
- onDiagnostic?.({
3531
- level: "error",
3532
- message: "Meet cannot tell who is signed in: the Supabase client it was given has no auth session source.",
3533
- remedy: "Pass your app's browser Supabase client to <MeetProvider client={...}> \u2014 the same client it signs in with. Meet reads the acting user from that client's session; there is no prop for a user id, on purpose."
3534
- });
3535
- current = Object.freeze({ state: "resolved", userId: null });
3536
- return {
3537
- snapshot: () => current,
3538
- subscribe: (listener) => {
3539
- listeners.add(listener);
3540
- return () => listeners.delete(listener);
3541
- },
3542
- dispose: () => {
3543
- disposed = true;
3544
- listeners.clear();
3545
- }
3546
- };
3547
- }
3548
- void (async () => {
3549
- try {
3550
- const result = await auth.getSession();
3551
- publish("resolved", userIdOf(result?.data?.session));
3552
- } catch (error) {
3553
- onDiagnostic?.({
3554
- level: "warn",
3555
- message: `Meet could not read the signed-in session: ${String(
3556
- error?.message ?? error
3557
- )}`,
3558
- remedy: "Calls and meetings stay unavailable on this device until the session can be read. Reload the page; if it persists, sign in again."
3559
- });
3560
- publish("resolved", null);
3561
- }
3562
- })();
3563
- const subscription = auth.onAuthStateChange((_event, session) => {
3564
- publish("resolved", userIdOf(session));
3490
+ import {
3491
+ createSessionIdentity as createDataSessionIdentity
3492
+ } from "@ai-matrx/data/session-identity";
3493
+ import { authOf, SERVER_SESSION_IDENTITY } from "@ai-matrx/data/session-identity";
3494
+ var MEET_SESSION_WORDS = {
3495
+ product: "Meet",
3496
+ noAuthSourceRemedy: "Pass your app's browser Supabase client to <MeetProvider client={...}> \u2014 the same client it signs in with. Meet reads the acting user from that client's session; there is no prop for a user id, on purpose.",
3497
+ unreadableRemedy: "Calls and meetings stay unavailable on this device until the session can be read. Reload the page; if it persists, sign in again."
3498
+ };
3499
+ function createMeetSessionIdentity(options) {
3500
+ return createDataSessionIdentity({
3501
+ client: options.client,
3502
+ words: MEET_SESSION_WORDS,
3503
+ toUserId: asUserId,
3504
+ onDiagnostic: options.onDiagnostic
3565
3505
  });
3566
- return {
3567
- snapshot: () => current,
3568
- subscribe: (listener) => {
3569
- listeners.add(listener);
3570
- return () => listeners.delete(listener);
3571
- },
3572
- dispose: () => {
3573
- disposed = true;
3574
- listeners.clear();
3575
- try {
3576
- subscription.data.subscription.unsubscribe();
3577
- } catch {
3578
- }
3579
- }
3580
- };
3581
3506
  }
3582
3507
 
3583
3508
  // src/core/room-events.ts
@@ -5221,7 +5146,7 @@ async function createCameraPreview(deviceId2, effect) {
5221
5146
 
5222
5147
  // src/react/provider.tsx
5223
5148
  import { jsx } from "react/jsx-runtime";
5224
- var MeetContext = globalSlot("react.context", () => createContext(null));
5149
+ var MeetContext = globalSlot2("ai-matrx.meet.react.context", () => createContext(null));
5225
5150
  function defaultDiagnostics(event) {
5226
5151
  const line = `[@ai-matrx/meet] ${event.message}${event.remedy !== void 0 ? `
5227
5152
  \u2192 ${event.remedy}` : ""}`;
@@ -5249,7 +5174,7 @@ function useSessionIdentity(client, report) {
5249
5174
  setSnapshot(SERVER_SESSION_IDENTITY);
5250
5175
  return void 0;
5251
5176
  }
5252
- const identity = createSessionIdentity({ client, onDiagnostic: report });
5177
+ const identity = createMeetSessionIdentity({ client, onDiagnostic: report });
5253
5178
  setSnapshot(identity.snapshot());
5254
5179
  const unsubscribe = identity.subscribe(() => setSnapshot(identity.snapshot()));
5255
5180
  return () => {