@ai-matrx/meet 0.7.81 → 0.7.83

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.cjs CHANGED
@@ -468,22 +468,45 @@ function normalizeDeviceError(error, operation) {
468
468
  );
469
469
  }
470
470
  }
471
- function isScreenShareCancel(error) {
472
- const named = (value) => typeof value?.name === "string" ? value.name : "";
471
+ var SYSTEM_BLOCK = /by system|permissions?[- ]policy|display-capture|disallowed|not allowed by the system/i;
472
+ function classifyScreenShareError(error) {
473
+ const read = (value, key) => {
474
+ const v = value?.[key];
475
+ return typeof v === "string" ? v : "";
476
+ };
473
477
  const cause = error instanceof MeetError ? error.cause : void 0;
474
- const names = [named(error), named(cause)];
475
- if (names.some((name) => name === "NotAllowedError" || name === "AbortError")) return true;
476
- return error instanceof MeetError && error.code === "permission-denied";
478
+ const denied = [error, cause].some((value) => {
479
+ const name = read(value, "name");
480
+ return name === "NotAllowedError" || name === "AbortError" || name === "SecurityError";
481
+ });
482
+ if (denied) {
483
+ const text3 = [read(error, "message"), read(cause, "message")].join(" ");
484
+ return SYSTEM_BLOCK.test(text3) || [error, cause].some((v) => read(v, "name") === "SecurityError") ? "blocked" : "ambiguous";
485
+ }
486
+ if (error instanceof MeetError && error.code === "permission-denied" && cause === void 0) {
487
+ return "ambiguous";
488
+ }
489
+ return "other";
477
490
  }
491
+ var SCREEN_SHARE_BLOCKED_REMEDY = "Your browser or computer is blocking screen sharing. On a Mac, open System Settings > Privacy & Security > Screen Recording, turn it on for your browser, then restart the browser. On a work computer, ask your administrator. You are still in the call.";
478
492
  function normalizeScreenShareError(error, operation) {
479
493
  if (error instanceof MeetError) return error;
480
494
  const raw = error ?? {};
481
495
  const message = typeof raw.message === "string" ? raw.message : String(error);
482
- if (isScreenShareCancel(error)) {
496
+ const kind = classifyScreenShareError(error);
497
+ if (kind === "blocked") {
498
+ return new MeetError(
499
+ "permission-denied",
500
+ `${operation}: screen sharing is blocked (${message})`,
501
+ SCREEN_SHARE_BLOCKED_REMEDY,
502
+ error
503
+ );
504
+ }
505
+ if (kind === "ambiguous") {
483
506
  return new MeetError(
484
507
  "permission-denied",
485
- `${operation}: screen sharing was cancelled`,
486
- "Choose a screen, window or tab in the picker to share it.",
508
+ `${operation}: screen sharing was cancelled or refused`,
509
+ "Choose a screen, window or tab in the picker to share it. If no picker appeared, " + SCREEN_SHARE_BLOCKED_REMEDY,
487
510
  error
488
511
  );
489
512
  }
@@ -4347,6 +4370,7 @@ function createRoomEngine(options) {
4347
4370
  function report(level, message, remedy) {
4348
4371
  options.onDiagnostic?.(remedy === void 0 ? { level, message } : { level, message, remedy });
4349
4372
  }
4373
+ let ambiguousShareDenials = 0;
4350
4374
  function fail(error, operation) {
4351
4375
  const normalized = normalizeMeetError(error, operation);
4352
4376
  store.patch({
@@ -4737,17 +4761,17 @@ function createRoomEngine(options) {
4737
4761
  if (driver === null) return;
4738
4762
  try {
4739
4763
  await driver.setScreenShareEnabled(enabled);
4764
+ ambiguousShareDenials = 0;
4740
4765
  } catch (error) {
4741
- if (isScreenShareCancel(error)) return;
4766
+ const kind = classifyScreenShareError(error);
4767
+ if (kind === "ambiguous") {
4768
+ ambiguousShareDenials += 1;
4769
+ if (ambiguousShareDenials < 2) return;
4770
+ }
4742
4771
  const normalized = normalizeScreenShareError(error, "meet.setScreenShareEnabled");
4743
4772
  report("warn", normalized.message, normalized.remedy);
4744
- store.patch({
4745
- actionNotice: {
4746
- text: `Screen sharing is not available. ${normalized.remedy}`,
4747
- failed: true,
4748
- at: now()
4749
- }
4750
- });
4773
+ const text3 = kind === "other" ? `Screen sharing is not available. ${normalized.remedy}` : `Screen sharing did not start. ${SCREEN_SHARE_BLOCKED_REMEDY}`;
4774
+ store.patch({ actionNotice: { text: text3, failed: true, at: now() } });
4751
4775
  }
4752
4776
  },
4753
4777
  async raiseHand(raised) {