@ai-matrx/meet 0.11.37 → 0.11.39

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/index.js CHANGED
@@ -687,6 +687,12 @@ var MEET_ROUTES = {
687
687
  state: "/api/v1/meet/state",
688
688
  /** S4: `withdraw` (stop waiting) or `leave` (close this tab); the pass may ride in the body. */
689
689
  leave: "/api/v1/meet/leave",
690
+ /**
691
+ * S8: a host's browser just called an admission DOOR (`meet_admit` · `meet_deny` ·
692
+ * `meet_undeny` · `meet_admit_all`). Payload-free: the server republishes the room's
693
+ * replicated state (the People badge's waiting count) from the database truth.
694
+ */
695
+ admissionChanged: "/api/v1/meet/admission/changed",
690
696
  /** S4: a pass holder (guests included) saw the recording notice, for this run. */
691
697
  consent: "/api/v1/meet/consent"
692
698
  };
@@ -4986,6 +4992,34 @@ function createMeetingSession(options) {
4986
4992
  function hint() {
4987
4993
  channel?.send(MEET_EVENTS.stateChanged, { v: null });
4988
4994
  }
4995
+ async function tellServerAdmissionChanged(operation) {
4996
+ const meeting = store.snapshot().meeting;
4997
+ if (meeting === null) return;
4998
+ const pass = options.resolvePass?.() ?? null;
4999
+ try {
5000
+ const response = await options.api.request({
5001
+ path: MEET_ROUTES.admissionChanged,
5002
+ method: "POST",
5003
+ requireAuth: false,
5004
+ operation,
5005
+ body: { meeting_id: meeting.id },
5006
+ ...pass !== null ? { headers: { [MEETING_PASS_HEADER]: pass } } : {}
5007
+ });
5008
+ if (!response.ok) {
5009
+ report(
5010
+ "warn",
5011
+ `${operation}: the server answered ${response.status} when told about the admission change`,
5012
+ "The decision was saved. The waiting count in the room may lag until the next change."
5013
+ );
5014
+ }
5015
+ } catch (error) {
5016
+ report(
5017
+ "warn",
5018
+ `${operation}: ${String(error)}`,
5019
+ "The decision was saved. The waiting count in the room may lag until the next change."
5020
+ );
5021
+ }
5022
+ }
4989
5023
  async function refreshQueue() {
4990
5024
  const meeting = store.snapshot().meeting;
4991
5025
  if (meeting === null || isGuest(identity) || !isHostRole(effectiveRole(store.snapshot()))) return;
@@ -5141,6 +5175,7 @@ function createMeetingSession(options) {
5141
5175
  decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
5142
5176
  decidedBy: by
5143
5177
  });
5178
+ await tellServerAdmissionChanged("meet.admit");
5144
5179
  hint();
5145
5180
  },
5146
5181
  async undeny(entry) {
@@ -5153,6 +5188,7 @@ function createMeetingSession(options) {
5153
5188
  byUserId: by
5154
5189
  });
5155
5190
  store.upsertLobby({ ...entry, state: decidedState(row.admissionState), decidedAt: (/* @__PURE__ */ new Date()).toISOString(), decidedBy: by });
5191
+ await tellServerAdmissionChanged("meet.undeny");
5156
5192
  hint();
5157
5193
  },
5158
5194
  async admitAll() {
@@ -5162,6 +5198,7 @@ function createMeetingSession(options) {
5162
5198
  for (const row of rows) {
5163
5199
  store.setAdmission(row.identity, row.admissionState, by);
5164
5200
  }
5201
+ await tellServerAdmissionChanged("meet.admitAll");
5165
5202
  hint();
5166
5203
  },
5167
5204
  startWaiting() {
@@ -7117,7 +7154,22 @@ function createInRoomClient(options) {
7117
7154
  function refusal2(response, operation, remedy) {
7118
7155
  return refusalFromResponse(response, operation, remedy);
7119
7156
  }
7120
- return {
7157
+ let toldPresenting = false;
7158
+ let tellChain = Promise.resolve();
7159
+ store.subscribe(() => {
7160
+ const local = store.snapshot().participants.find((p) => p.isLocal);
7161
+ const sharing = local?.screenSharing === true;
7162
+ if (sharing === toldPresenting || local === void 0) return;
7163
+ toldPresenting = sharing;
7164
+ const on = sharing;
7165
+ tellChain = tellChain.then(() => client.moderate({ action: "present", on })).then(
7166
+ () => void 0,
7167
+ (error) => {
7168
+ console.warn(`[meet] the server did not take presenter=${String(on)}: ${String(error)}`);
7169
+ }
7170
+ );
7171
+ });
7172
+ const client = {
7121
7173
  async moderate(request) {
7122
7174
  const operation = `meet.moderate(${request.action})`;
7123
7175
  const hdrs = headers();
@@ -7322,6 +7374,7 @@ function createInRoomClient(options) {
7322
7374
  });
7323
7375
  }
7324
7376
  };
7377
+ return client;
7325
7378
  }
7326
7379
 
7327
7380
  // src/core/record.ts