@palbase/web 3.0.0 → 4.0.1

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.
Files changed (45) hide show
  1. package/dist/_mls-wasm.cjs +32 -0
  2. package/dist/_mls-wasm.cjs.map +1 -0
  3. package/dist/_mls-wasm.js +11 -0
  4. package/dist/_mls-wasm.js.map +1 -0
  5. package/dist/{analytics-facade-BOxQ8IP2.d.cts → analytics-facade-DwOtlXPP.d.cts} +5 -87
  6. package/dist/{analytics-facade-yfMJ69vw.d.ts → analytics-facade-Nk6J9Ncm.d.ts} +5 -87
  7. package/dist/{chunk-S7NAY3MW.js → chunk-NXEPAEF5.js} +1 -8
  8. package/dist/{chunk-S7NAY3MW.js.map → chunk-NXEPAEF5.js.map} +1 -1
  9. package/dist/chunk-PZ5AY32C.js +10 -0
  10. package/dist/chunk-PZ5AY32C.js.map +1 -0
  11. package/dist/{chunk-3HVTEZ7N.js → chunk-TGDS6VMT.js} +51 -36
  12. package/dist/chunk-TGDS6VMT.js.map +1 -0
  13. package/dist/gen/cli.js +2 -1
  14. package/dist/gen/cli.js.map +1 -1
  15. package/dist/index.cjs +59 -37
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +3 -4
  18. package/dist/index.d.ts +3 -4
  19. package/dist/index.js +3 -2
  20. package/dist/internal.cjs +56 -34
  21. package/dist/internal.cjs.map +1 -1
  22. package/dist/internal.d.cts +4 -16
  23. package/dist/internal.d.ts +4 -16
  24. package/dist/internal.js +3 -2
  25. package/dist/next/client.cjs +56 -34
  26. package/dist/next/client.cjs.map +1 -1
  27. package/dist/next/client.js +3 -2
  28. package/dist/next/client.js.map +1 -1
  29. package/dist/next/index.cjs +46 -34
  30. package/dist/next/index.cjs.map +1 -1
  31. package/dist/next/index.d.cts +2 -3
  32. package/dist/next/index.d.ts +2 -3
  33. package/dist/next/index.js +3 -2
  34. package/dist/next/index.js.map +1 -1
  35. package/dist/{pb-B3h3NIPE.d.cts → pb-C9v5dEO6.d.cts} +1 -1
  36. package/dist/{pb-QRISxPd1.d.ts → pb-FG_nV7NR.d.ts} +1 -1
  37. package/dist/react/index.cjs +1 -1
  38. package/dist/react/index.cjs.map +1 -1
  39. package/dist/react/index.d.cts +1 -2
  40. package/dist/react/index.d.ts +1 -2
  41. package/dist/react/index.js +3 -2
  42. package/dist/react/index.js.map +1 -1
  43. package/package.json +9 -2
  44. package/dist/chunk-3HVTEZ7N.js.map +0 -1
  45. package/dist/pkg/palbe_mls_bg.wasm +0 -0
package/dist/index.d.cts CHANGED
@@ -1,9 +1,8 @@
1
- export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as UnreadView, V as Unsubscribe } from './analytics-facade-BOxQ8IP2.cjs';
1
+ export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as UnreadView, V as Unsubscribe } from './analytics-facade-DwOtlXPP.cjs';
2
2
  export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.cjs';
3
- export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-B3h3NIPE.cjs';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-C9v5dEO6.cjs';
4
4
  export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.cjs';
5
5
  export { F as FlagValue } from './pooled-flags-4GtDtsiu.js';
6
- import 'livekit-client';
7
6
 
8
7
  /* tslint:disable */
9
8
  /* eslint-disable */
@@ -207,6 +206,6 @@ interface MlsGlue {
207
206
  */
208
207
  declare function initMls(): Promise<MlsGlue>;
209
208
 
210
- declare const VERSION = "3.0.0";
209
+ declare const VERSION = "4.0.1";
211
210
 
212
211
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as UnreadView, V as Unsubscribe } from './analytics-facade-yfMJ69vw.js';
1
+ export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as UnreadView, V as Unsubscribe } from './analytics-facade-Nk6J9Ncm.js';
2
2
  export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.js';
3
- export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-QRISxPd1.js';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-FG_nV7NR.js';
4
4
  export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.js';
5
5
  export { F as FlagValue } from './pooled-flags-4GtDtsiu.js';
6
- import 'livekit-client';
7
6
 
8
7
  /* tslint:disable */
9
8
  /* eslint-disable */
@@ -207,6 +206,6 @@ interface MlsGlue {
207
206
  */
208
207
  declare function initMls(): Promise<MlsGlue>;
209
208
 
210
- declare const VERSION = "3.0.0";
209
+ declare const VERSION = "4.0.1";
211
210
 
212
211
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -13,8 +13,9 @@ import {
13
13
  localStorageSessionStorage,
14
14
  memorySessionStorage,
15
15
  pb
16
- } from "./chunk-3HVTEZ7N.js";
17
- import "./chunk-S7NAY3MW.js";
16
+ } from "./chunk-TGDS6VMT.js";
17
+ import "./chunk-NXEPAEF5.js";
18
+ import "./chunk-PZ5AY32C.js";
18
19
  export {
19
20
  BackendError,
20
21
  PalbeAnalytics,
package/dist/internal.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/internal.ts
@@ -1764,19 +1774,29 @@ var PalbeAuth = class {
1764
1774
 
1765
1775
  // src/calls/facade.ts
1766
1776
  var import_livekit_client = require("livekit-client");
1767
- var Call = class {
1777
+ var Call = class _Call {
1768
1778
  id;
1769
1779
  _state = "connecting";
1770
1780
  _participants = /* @__PURE__ */ new Map();
1771
1781
  _listeners = /* @__PURE__ */ new Set();
1772
1782
  _room;
1773
1783
  _keyProvider;
1774
- /** @internal obtain via PalbeCalls.start() / .accept() */
1784
+ // PRIVATE constructor + `@internal` factory: the media-engine types (`Room`,
1785
+ // `ExternalE2EEKeyProvider`) appear ONLY on a private constructor and an
1786
+ // `@internal` static factory, both of which `stripInternal` (set in this
1787
+ // package's tsconfig) removes from the emitted public `.d.ts`. So no engine type
1788
+ // ever reaches the public API surface — the same "no engine type in the public
1789
+ // interface" contract the iOS SDK enforces. Consumers obtain a `Call` only
1790
+ // through `pb.calls.start()` / `.accept()`.
1775
1791
  constructor(callId, room, keyProvider) {
1776
1792
  this.id = callId;
1777
1793
  this._room = room;
1778
1794
  this._keyProvider = keyProvider;
1779
- this._wireRoomEvents();
1795
+ this._wireMediaEvents();
1796
+ }
1797
+ /** @internal — facade-only factory; stripped from the public `.d.ts`. */
1798
+ static _create(callId, room, keyProvider) {
1799
+ return new _Call(callId, room, keyProvider);
1780
1800
  }
1781
1801
  // ─── State ──────────────────────────────────────────────────────────────
1782
1802
  get state() {
@@ -1786,9 +1806,9 @@ var Call = class {
1786
1806
  get participants() {
1787
1807
  return Array.from(this._participants.values());
1788
1808
  }
1789
- get localParticipant() {
1790
- return this._room.localParticipant;
1791
- }
1809
+ // (No `localParticipant` accessor: it would return a raw media-engine participant
1810
+ // object and leak the engine type onto the public API. Local mic/camera control is
1811
+ // exposed engine-agnostically via `mute()` / `setCamera()` below.)
1792
1812
  // ─── Subscribe ──────────────────────────────────────────────────────────
1793
1813
  /**
1794
1814
  * Subscribe to call changes (state + participant updates).
@@ -1812,7 +1832,7 @@ var Call = class {
1812
1832
  /**
1813
1833
  * Set a raw frame encryption key (ArrayBuffer) for this call.
1814
1834
  * Design seam for SP-1.x web-MLS: call this with the MLS exporter secret
1815
- * to enable frame-level E2EE via ExternalE2EEKeyProvider.
1835
+ * to enable frame-level E2EE via the media engine's external key provider.
1816
1836
  *
1817
1837
  * NOTE: The room must have been opened with `e2ee` options for this to take
1818
1838
  * effect. Currently calls connect WITHOUT e2ee — see module docstring.
@@ -1822,7 +1842,7 @@ var Call = class {
1822
1842
  async setMediaKey(key) {
1823
1843
  await this._keyProvider.setKey(key);
1824
1844
  }
1825
- /** Leave the call and disconnect from the LiveKit room. */
1845
+ /** Leave the call and disconnect from the media room. */
1826
1846
  async leave() {
1827
1847
  await this._room.disconnect();
1828
1848
  this._setState("ended");
@@ -1864,7 +1884,7 @@ var Call = class {
1864
1884
  }
1865
1885
  this._emit();
1866
1886
  }
1867
- _wireRoomEvents() {
1887
+ _wireMediaEvents() {
1868
1888
  this._room.on(import_livekit_client.RoomEvent.Connected, () => {
1869
1889
  this._setState("active");
1870
1890
  }).on(
@@ -1905,9 +1925,9 @@ var PalbeCalls = class {
1905
1925
  *
1906
1926
  * @param groupId - Messaging group display-id (`grp_<uuidv7>`)
1907
1927
  * @param media - Which media tracks to publish (default: audio + video)
1908
- * @returns A `Call` in `connecting` state; transitions to `active` once LiveKit connects.
1928
+ * @returns A `Call` in `connecting` state; transitions to `active` once the media room connects.
1909
1929
  *
1910
- * @throws BackendError('network', { code: 'call_service_unavailable' }) if LiveKit SFU is down (503)
1930
+ * @throws BackendError('network', { code: 'call_service_unavailable' }) if the SFU is down (503)
1911
1931
  * @throws BackendError('forbidden', { code: 'not_group_member' }) if the caller is not a member (403)
1912
1932
  * @throws BackendError('conflict', { code: 'call_room_full' }) if the room is full (409)
1913
1933
  */
@@ -1964,7 +1984,7 @@ var PalbeCalls = class {
1964
1984
  adaptiveStream: true,
1965
1985
  dynacast: true
1966
1986
  });
1967
- const call = new Call(callId, room, keyProvider);
1987
+ const call = Call._create(callId, room, keyProvider);
1968
1988
  await room.connect(edgeUrl, token);
1969
1989
  if (media.includes("audio")) {
1970
1990
  await room.localParticipant.setMicrophoneEnabled(true);
@@ -6447,31 +6467,29 @@ function date_now() {
6447
6467
  }
6448
6468
 
6449
6469
  // src/messaging/wasm/loader.ts
6450
- var import_meta = {};
6451
6470
  var GLUE_MODULE = "./palbe_mls_bg.js";
6452
6471
  var SNIPPET_MODULE = "./snippets/mls-rs-core-f99cdecbb456b09c/inline0.js";
6453
6472
  var inflight = null;
6454
6473
  var ready = null;
6455
- async function loadWasmModule() {
6456
- const wasmUrl = new URL("./pkg/palbe_mls_bg.wasm", import_meta.url);
6457
- if (wasmUrl.protocol === "file:") {
6458
- const fsSpecifier = ["node", "fs/promises"].join(":");
6459
- const { readFile } = await import(
6460
- /* webpackIgnore: true */
6461
- fsSpecifier
6462
- );
6463
- const bytes = await readFile(wasmUrl);
6464
- return WebAssembly.compile(bytes);
6474
+ function decodeBase64(encoded) {
6475
+ if (typeof encoded !== "string" || encoded.length === 0 || typeof globalThis.atob !== "function") {
6476
+ throw new Error("palbe-mls WASM asset is invalid");
6465
6477
  }
6466
- const response = await fetch(wasmUrl);
6467
- if (typeof WebAssembly.compileStreaming === "function") {
6468
- try {
6469
- return await WebAssembly.compileStreaming(Promise.resolve(response));
6470
- } catch {
6471
- }
6478
+ let binary;
6479
+ try {
6480
+ binary = globalThis.atob(encoded);
6481
+ } catch {
6482
+ throw new Error("palbe-mls WASM asset is invalid");
6483
+ }
6484
+ const bytes = new Uint8Array(binary.length);
6485
+ for (let index = 0; index < binary.length; index += 1) {
6486
+ bytes[index] = binary.charCodeAt(index);
6472
6487
  }
6473
- const buffer = await response.arrayBuffer();
6474
- return WebAssembly.compile(buffer);
6488
+ return bytes.buffer;
6489
+ }
6490
+ async function loadWasmModule() {
6491
+ const asset = await import("#palbase-mls-wasm");
6492
+ return WebAssembly.compile(decodeBase64(asset.default));
6475
6493
  }
6476
6494
  function buildImports() {
6477
6495
  return {
@@ -6482,7 +6500,7 @@ function buildImports() {
6482
6500
  function initMls() {
6483
6501
  if (ready) return Promise.resolve(ready);
6484
6502
  if (inflight) return inflight;
6485
- inflight = (async () => {
6503
+ const attempt = (async () => {
6486
6504
  const module2 = await loadWasmModule();
6487
6505
  const instance = await WebAssembly.instantiate(module2, buildImports());
6488
6506
  const setWasm = __wbg_set_wasm;
@@ -6501,7 +6519,11 @@ function initMls() {
6501
6519
  ready = g;
6502
6520
  return g;
6503
6521
  })();
6504
- return inflight;
6522
+ inflight = attempt;
6523
+ void attempt.catch(() => {
6524
+ if (inflight === attempt) inflight = null;
6525
+ });
6526
+ return attempt;
6505
6527
  }
6506
6528
  function requireMls() {
6507
6529
  if (!ready) {
@@ -8954,7 +8976,7 @@ function defaultSessionStorage(key) {
8954
8976
  }
8955
8977
 
8956
8978
  // src/version.ts
8957
- var VERSION = "3.0.0";
8979
+ var VERSION = "4.0.1";
8958
8980
 
8959
8981
  // src/runtime.ts
8960
8982
  function buildRuntime(config) {