@palbase/web 1.10.0 → 2.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/README.md +3 -2
- package/dist/{analytics-facade-CHh5EGC2.d.ts → analytics-facade-DMtGDGfd.d.ts} +2 -18
- package/dist/{analytics-facade-B7vujhPJ.d.cts → analytics-facade-ovP0pF2P.d.cts} +2 -18
- package/dist/{chunk-4ZJHHXD3.js → chunk-V6VTX65P.js} +20 -31
- package/dist/chunk-V6VTX65P.js.map +1 -0
- package/dist/gen/cli.cjs +20 -12
- package/dist/gen/cli.cjs.map +1 -1
- package/dist/gen/cli.js +20 -12
- package/dist/gen/cli.js.map +1 -1
- package/dist/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +19 -30
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +16 -29
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +19 -30
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +1 -1
- package/dist/{pb-ChNq987M.d.ts → pb-CvpcQero.d.ts} +1 -1
- package/dist/{pb-6965XULp.d.cts → pb-DDM_mCQB.d.cts} +1 -1
- package/dist/react/index.cjs +12 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-4ZJHHXD3.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-ovP0pF2P.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-
|
|
3
|
+
export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-DDM_mCQB.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-Bwq4usn0.js';
|
|
6
6
|
import 'livekit-client';
|
|
@@ -207,6 +207,6 @@ interface MlsGlue {
|
|
|
207
207
|
*/
|
|
208
208
|
declare function initMls(): Promise<MlsGlue>;
|
|
209
209
|
|
|
210
|
-
declare const VERSION = "
|
|
210
|
+
declare const VERSION = "2.0.0";
|
|
211
211
|
|
|
212
212
|
export { VERSION, initMls };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-DMtGDGfd.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-
|
|
3
|
+
export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-CvpcQero.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-Bwq4usn0.js';
|
|
6
6
|
import 'livekit-client';
|
|
@@ -207,6 +207,6 @@ interface MlsGlue {
|
|
|
207
207
|
*/
|
|
208
208
|
declare function initMls(): Promise<MlsGlue>;
|
|
209
209
|
|
|
210
|
-
declare const VERSION = "
|
|
210
|
+
declare const VERSION = "2.0.0";
|
|
211
211
|
|
|
212
212
|
export { VERSION, initMls };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -448,12 +448,6 @@ async function palbeRequest(rt, method, path, spec = {}) {
|
|
|
448
448
|
if (MUTATING.has(method) && !callerHasKey) {
|
|
449
449
|
headers["Idempotency-Key"] = crypto.randomUUID();
|
|
450
450
|
}
|
|
451
|
-
if (rt.appIdentifier !== "") {
|
|
452
|
-
const callerHasBundle = Object.keys(headers).some(
|
|
453
|
-
(k) => k.toLowerCase() === "x-palbase-bundle"
|
|
454
|
-
);
|
|
455
|
-
if (!callerHasBundle) headers["X-Palbase-Bundle"] = rt.appIdentifier;
|
|
456
|
-
}
|
|
457
451
|
const attempt = async () => {
|
|
458
452
|
try {
|
|
459
453
|
return await rt.http.request(method, path, {
|
|
@@ -1437,23 +1431,6 @@ var PalbeAnalytics = class {
|
|
|
1437
1431
|
}
|
|
1438
1432
|
};
|
|
1439
1433
|
|
|
1440
|
-
// src/app-config.ts
|
|
1441
|
-
function loadAppConfig(raw) {
|
|
1442
|
-
if (typeof raw !== "object" || raw === null) {
|
|
1443
|
-
throw new Error("app_config_invalid: expected a JSON object");
|
|
1444
|
-
}
|
|
1445
|
-
const r = raw;
|
|
1446
|
-
const str = (k) => typeof r[k] === "string" ? r[k] : "";
|
|
1447
|
-
return { appId: str("app_id"), identifier: str("identifier"), envPreset: str("env_preset") };
|
|
1448
|
-
}
|
|
1449
|
-
function assertOriginMatches(cfg, runtimeOrigin) {
|
|
1450
|
-
if (cfg.identifier === "") return;
|
|
1451
|
-
if (runtimeOrigin === "") return;
|
|
1452
|
-
if (runtimeOrigin !== cfg.identifier) {
|
|
1453
|
-
throw new Error(`app_config_mismatch: expected origin ${cfg.identifier}, got ${runtimeOrigin}`);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
1434
|
// src/auth-wire.ts
|
|
1458
1435
|
function asWireAuthResult(raw) {
|
|
1459
1436
|
if (typeof raw !== "object" || raw === null) return null;
|
|
@@ -8263,6 +8240,14 @@ function observeWebVitals(record) {
|
|
|
8263
8240
|
};
|
|
8264
8241
|
}
|
|
8265
8242
|
|
|
8243
|
+
// src/runtime-metadata.ts
|
|
8244
|
+
var APP_METADATA_HEADER = "X-Palbase-Bundle";
|
|
8245
|
+
function applyBrowserOriginHeader(headers) {
|
|
8246
|
+
if (Object.keys(headers).some((key) => key.toLowerCase() === "x-palbase-bundle")) return;
|
|
8247
|
+
const origin = typeof window !== "undefined" && typeof window.location !== "undefined" ? window.location.origin : "";
|
|
8248
|
+
if (origin !== "") headers[APP_METADATA_HEADER] = origin;
|
|
8249
|
+
}
|
|
8250
|
+
|
|
8266
8251
|
// src/realtime/anon-token.ts
|
|
8267
8252
|
var REFRESH_SKEW_MS = 6e4;
|
|
8268
8253
|
var AnonTokenProvider = class {
|
|
@@ -8305,11 +8290,16 @@ var AnonTokenProvider = class {
|
|
|
8305
8290
|
*/
|
|
8306
8291
|
async mint() {
|
|
8307
8292
|
const base = this.rt.config.url.replace(/\/+$/, "");
|
|
8293
|
+
const headers = {
|
|
8294
|
+
apikey: this.rt.config.apiKey,
|
|
8295
|
+
...this.rt.config.headers
|
|
8296
|
+
};
|
|
8297
|
+
applyBrowserOriginHeader(headers);
|
|
8308
8298
|
let response;
|
|
8309
8299
|
try {
|
|
8310
8300
|
response = await fetch(`${base}/auth/anonymous`, {
|
|
8311
8301
|
method: "POST",
|
|
8312
|
-
headers
|
|
8302
|
+
headers
|
|
8313
8303
|
});
|
|
8314
8304
|
} catch (e) {
|
|
8315
8305
|
throw new BackendError("network", {
|
|
@@ -8950,17 +8940,15 @@ function defaultSessionStorage(key) {
|
|
|
8950
8940
|
}
|
|
8951
8941
|
|
|
8952
8942
|
// src/version.ts
|
|
8953
|
-
var VERSION = "
|
|
8943
|
+
var VERSION = "2.0.0";
|
|
8954
8944
|
|
|
8955
8945
|
// src/runtime.ts
|
|
8956
8946
|
function buildRuntime(config) {
|
|
8957
|
-
const appIdentifier = config.identifier ?? "";
|
|
8958
|
-
const runtimeOrigin = typeof window !== "undefined" && typeof window.location !== "undefined" ? window.location.origin : "";
|
|
8959
|
-
assertOriginMatches(loadAppConfig({ identifier: appIdentifier }), runtimeOrigin);
|
|
8960
8947
|
const http = new HttpClient(config.apiKey, {
|
|
8961
8948
|
url: config.url,
|
|
8962
8949
|
headers: { "X-Client-Info": `palbe-web/${VERSION}`, ...config.headers }
|
|
8963
8950
|
});
|
|
8951
|
+
http.addInterceptor(({ headers }) => applyBrowserOriginHeader(headers));
|
|
8964
8952
|
const tokenManager = new TokenManager();
|
|
8965
8953
|
http.tokenManager = tokenManager;
|
|
8966
8954
|
const authClient = new AuthClient(http, tokenManager);
|
|
@@ -9009,7 +8997,6 @@ function buildRuntime(config) {
|
|
|
9009
8997
|
let perf;
|
|
9010
8998
|
const rt = {
|
|
9011
8999
|
config,
|
|
9012
|
-
appIdentifier,
|
|
9013
9000
|
http,
|
|
9014
9001
|
tokenManager,
|
|
9015
9002
|
authClient,
|
|
@@ -9168,7 +9155,9 @@ async function buildHeaders(rt, extra) {
|
|
|
9168
9155
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
9169
9156
|
const callerHasKey = Object.keys(extra ?? {}).some((k) => k.toLowerCase() === "idempotency-key");
|
|
9170
9157
|
if (!callerHasKey) headers["Idempotency-Key"] = crypto.randomUUID();
|
|
9171
|
-
|
|
9158
|
+
const merged = { ...headers, ...extra };
|
|
9159
|
+
applyBrowserOriginHeader(merged);
|
|
9160
|
+
return merged;
|
|
9172
9161
|
}
|
|
9173
9162
|
function buildForm(options) {
|
|
9174
9163
|
const form = new FormData();
|