@palbase/web 3.0.0 → 4.0.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/index.cjs CHANGED
@@ -765,19 +765,29 @@ var PalbeAuth = class {
765
765
 
766
766
  // src/calls/facade.ts
767
767
  var import_livekit_client = require("livekit-client");
768
- var Call = class {
768
+ var Call = class _Call {
769
769
  id;
770
770
  _state = "connecting";
771
771
  _participants = /* @__PURE__ */ new Map();
772
772
  _listeners = /* @__PURE__ */ new Set();
773
773
  _room;
774
774
  _keyProvider;
775
- /** @internal obtain via PalbeCalls.start() / .accept() */
775
+ // PRIVATE constructor + `@internal` factory: the media-engine types (`Room`,
776
+ // `ExternalE2EEKeyProvider`) appear ONLY on a private constructor and an
777
+ // `@internal` static factory, both of which `stripInternal` (set in this
778
+ // package's tsconfig) removes from the emitted public `.d.ts`. So no engine type
779
+ // ever reaches the public API surface — the same "no engine type in the public
780
+ // interface" contract the iOS SDK enforces. Consumers obtain a `Call` only
781
+ // through `pb.calls.start()` / `.accept()`.
776
782
  constructor(callId, room, keyProvider) {
777
783
  this.id = callId;
778
784
  this._room = room;
779
785
  this._keyProvider = keyProvider;
780
- this._wireRoomEvents();
786
+ this._wireMediaEvents();
787
+ }
788
+ /** @internal — facade-only factory; stripped from the public `.d.ts`. */
789
+ static _create(callId, room, keyProvider) {
790
+ return new _Call(callId, room, keyProvider);
781
791
  }
782
792
  // ─── State ──────────────────────────────────────────────────────────────
783
793
  get state() {
@@ -787,9 +797,9 @@ var Call = class {
787
797
  get participants() {
788
798
  return Array.from(this._participants.values());
789
799
  }
790
- get localParticipant() {
791
- return this._room.localParticipant;
792
- }
800
+ // (No `localParticipant` accessor: it would return a raw media-engine participant
801
+ // object and leak the engine type onto the public API. Local mic/camera control is
802
+ // exposed engine-agnostically via `mute()` / `setCamera()` below.)
793
803
  // ─── Subscribe ──────────────────────────────────────────────────────────
794
804
  /**
795
805
  * Subscribe to call changes (state + participant updates).
@@ -813,7 +823,7 @@ var Call = class {
813
823
  /**
814
824
  * Set a raw frame encryption key (ArrayBuffer) for this call.
815
825
  * Design seam for SP-1.x web-MLS: call this with the MLS exporter secret
816
- * to enable frame-level E2EE via ExternalE2EEKeyProvider.
826
+ * to enable frame-level E2EE via the media engine's external key provider.
817
827
  *
818
828
  * NOTE: The room must have been opened with `e2ee` options for this to take
819
829
  * effect. Currently calls connect WITHOUT e2ee — see module docstring.
@@ -823,7 +833,7 @@ var Call = class {
823
833
  async setMediaKey(key) {
824
834
  await this._keyProvider.setKey(key);
825
835
  }
826
- /** Leave the call and disconnect from the LiveKit room. */
836
+ /** Leave the call and disconnect from the media room. */
827
837
  async leave() {
828
838
  await this._room.disconnect();
829
839
  this._setState("ended");
@@ -865,7 +875,7 @@ var Call = class {
865
875
  }
866
876
  this._emit();
867
877
  }
868
- _wireRoomEvents() {
878
+ _wireMediaEvents() {
869
879
  this._room.on(import_livekit_client.RoomEvent.Connected, () => {
870
880
  this._setState("active");
871
881
  }).on(
@@ -906,9 +916,9 @@ var PalbeCalls = class {
906
916
  *
907
917
  * @param groupId - Messaging group display-id (`grp_<uuidv7>`)
908
918
  * @param media - Which media tracks to publish (default: audio + video)
909
- * @returns A `Call` in `connecting` state; transitions to `active` once LiveKit connects.
919
+ * @returns A `Call` in `connecting` state; transitions to `active` once the media room connects.
910
920
  *
911
- * @throws BackendError('network', { code: 'call_service_unavailable' }) if LiveKit SFU is down (503)
921
+ * @throws BackendError('network', { code: 'call_service_unavailable' }) if the SFU is down (503)
912
922
  * @throws BackendError('forbidden', { code: 'not_group_member' }) if the caller is not a member (403)
913
923
  * @throws BackendError('conflict', { code: 'call_room_full' }) if the room is full (409)
914
924
  */
@@ -965,7 +975,7 @@ var PalbeCalls = class {
965
975
  adaptiveStream: true,
966
976
  dynacast: true
967
977
  });
968
- const call = new Call(callId, room, keyProvider);
978
+ const call = Call._create(callId, room, keyProvider);
969
979
  await room.connect(edgeUrl, token);
970
980
  if (media.includes("audio")) {
971
981
  await room.localParticipant.setMicrophoneEnabled(true);
@@ -7611,7 +7621,7 @@ function localStorageSessionStorage(key = DEFAULT_KEY) {
7611
7621
  }
7612
7622
 
7613
7623
  // src/version.ts
7614
- var VERSION = "3.0.0";
7624
+ var VERSION = "4.0.0";
7615
7625
 
7616
7626
  // src/internal.ts
7617
7627
  function getRuntime() {