@convai/web-sdk 2.0.1 → 2.0.2

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.
@@ -1369,7 +1369,7 @@ export class ConvaiClient extends EventEmitter {
1369
1369
  // cannot leave a reused client in published-session mode.
1370
1370
  this._isPublishedChatSession = false;
1371
1371
  const stored = this._storedConfig ?? {};
1372
- const url = stored.url ?? "https://realtime-api.convai.com";
1372
+ const url = stored.url || "https://realtime-api.convai.com";
1373
1373
  if (!stored.apiKey && !stored.authToken) {
1374
1374
  throw new Error("Either apiKey or authToken is required to join a room");
1375
1375
  }
@@ -1441,10 +1441,12 @@ export class ConvaiClient extends EventEmitter {
1441
1441
  */
1442
1442
  applyConfigDefaults(finalConfig, opts = {}) {
1443
1443
  const { requireCredential = true } = opts;
1444
- // Add default URL if not provided
1444
+ // Default the URL when it is missing, undefined or empty. A spread
1445
+ // default would be overwritten by `url: undefined`, which is what
1446
+ // `url: import.meta.env.X` gives when X is unset.
1445
1447
  const configWithDefaults = {
1446
- url: "https://realtime-api.convai.com",
1447
1448
  ...finalConfig,
1449
+ url: finalConfig.url || "https://realtime-api.convai.com",
1448
1450
  };
1449
1451
  this._logRtviMessages = configWithDefaults.logRtviMessages !== false;
1450
1452
  this._messageHandler.setRtviMessageLogging(this._logRtviMessages);
@@ -1764,7 +1766,7 @@ export class ConvaiClient extends EventEmitter {
1764
1766
  const disconnectOnAbort = () => {
1765
1767
  abortDisconnect ?? (abortDisconnect = this.disconnect().catch(() => undefined));
1766
1768
  };
1767
- const apiUrl = (options.url ?? "https://realtime-api.convai.com").replace(/\/+$/, "");
1769
+ const apiUrl = (options.url || "https://realtime-api.convai.com").replace(/\/+$/, "");
1768
1770
  const connectAttemptId = options.connectAttemptId ??
1769
1771
  (typeof crypto !== "undefined" && "randomUUID" in crypto
1770
1772
  ? `published_${crypto.randomUUID().replace(/-/g, "")}`
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.1";
1
+ export declare const SDK_VERSION = "2.0.2";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // GENERATED by scripts/sync-version.mjs — do not edit by hand.
2
2
  // Regenerated from package.json on every build.
3
- export const SDK_VERSION = "2.0.1";
3
+ export const SDK_VERSION = "2.0.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convai/web-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Build web apps with lifelike AI characters. The Convai Web SDK gives you real-time voice, lipsync, emotions, and dynamic context — with first-class support for React and vanilla TypeScript.",
5
5
  "private": false,
6
6
  "type": "module",