@palbase/web 2.0.1 → 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/README.md +11 -9
- package/dist/{analytics-facade-ChlBRcLZ.d.cts → analytics-facade-DwOtlXPP.d.cts} +13 -103
- package/dist/{analytics-facade-G0il4NrT.d.ts → analytics-facade-Nk6J9Ncm.d.ts} +13 -103
- package/dist/{chunk-VJXFABBW.js → chunk-6VGKMNXO.js} +11 -11
- package/dist/chunk-6VGKMNXO.js.map +1 -0
- package/dist/{chunk-AIPUO4QX.js → chunk-NP4NIY7A.js} +52 -48
- package/dist/chunk-NP4NIY7A.js.map +1 -0
- package/dist/chunk-S7NAY3MW.js +24 -0
- package/dist/chunk-S7NAY3MW.js.map +1 -0
- package/dist/gen/cli.cjs +32 -6
- package/dist/gen/cli.cjs.map +1 -1
- package/dist/gen/cli.js +28 -7
- package/dist/gen/cli.js.map +1 -1
- package/dist/index.cjs +25 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -2
- package/dist/internal.cjs +55 -44
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +4 -16
- package/dist/internal.d.ts +4 -16
- package/dist/internal.js +2 -2
- package/dist/next/client.cjs +72 -58
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +1 -1
- package/dist/next/client.d.ts +1 -1
- package/dist/next/client.js +12 -10
- package/dist/next/client.js.map +1 -1
- package/dist/next/index.cjs +75 -59
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +10 -11
- package/dist/next/index.d.ts +10 -11
- package/dist/next/index.js +14 -13
- package/dist/next/index.js.map +1 -1
- package/dist/{pb-B_6o5p79.d.cts → pb-C9v5dEO6.d.cts} +1 -1
- package/dist/{pb-nPBhqhJr.d.ts → pb-FG_nV7NR.d.ts} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -2
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-AIPUO4QX.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-VJXFABBW.js.map +0 -1
package/dist/internal.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { P as PalbeConfig
|
|
2
|
-
export { e as buildRuntime } from './analytics-facade-
|
|
1
|
+
import { P as PalbeConfig } from './analytics-facade-DwOtlXPP.cjs';
|
|
2
|
+
export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-DwOtlXPP.cjs';
|
|
3
3
|
import { B as BackendError } from './errors-fDoNdTrJ.cjs';
|
|
4
|
-
export { P as PB, c as createBoundClient } from './pb-
|
|
5
|
-
import 'livekit-client';
|
|
4
|
+
export { P as PB, c as createBoundClient } from './pb-C9v5dEO6.cjs';
|
|
6
5
|
import './storage-BPaeSG8K.cjs';
|
|
7
6
|
import './pooled-flags-4GtDtsiu.js';
|
|
8
7
|
|
|
@@ -31,18 +30,7 @@ declare function __registerNamespaces(tree: NamespaceTree): void;
|
|
|
31
30
|
* gen file re-registers its static descriptors right after.
|
|
32
31
|
*/
|
|
33
32
|
declare function __configure(config: PalbeConfig): void;
|
|
34
|
-
/**
|
|
35
|
-
* Register a callback that fires synchronously after every successful
|
|
36
|
-
* `__configure` call (including re-configure / watch-mode regen).
|
|
37
|
-
*
|
|
38
|
-
* Returns an unsubscribe function. Safe to call before the first `__configure`.
|
|
39
|
-
*
|
|
40
|
-
* @internal — consumed by `palbe/react`; not part of the public `palbe` surface.
|
|
41
|
-
*/
|
|
42
|
-
declare function onConfigured(cb: () => void): () => void;
|
|
43
|
-
/** @internal */
|
|
44
|
-
declare function getRuntime(): PalbeRuntime;
|
|
45
33
|
/** Test-only: drop runtime + registered namespaces. */
|
|
46
34
|
declare function __reset(): void;
|
|
47
35
|
|
|
48
|
-
export { type EndpointDescriptor, type NamespaceTree, PalbeConfig,
|
|
36
|
+
export { type EndpointDescriptor, type NamespaceTree, PalbeConfig, __configure, __registerNamespaces, __reset };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { P as PalbeConfig
|
|
2
|
-
export { e as buildRuntime } from './analytics-facade-
|
|
1
|
+
import { P as PalbeConfig } from './analytics-facade-Nk6J9Ncm.js';
|
|
2
|
+
export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-Nk6J9Ncm.js';
|
|
3
3
|
import { B as BackendError } from './errors-fDoNdTrJ.js';
|
|
4
|
-
export { P as PB, c as createBoundClient } from './pb-
|
|
5
|
-
import 'livekit-client';
|
|
4
|
+
export { P as PB, c as createBoundClient } from './pb-FG_nV7NR.js';
|
|
6
5
|
import './storage-BPaeSG8K.js';
|
|
7
6
|
import './pooled-flags-4GtDtsiu.js';
|
|
8
7
|
|
|
@@ -31,18 +30,7 @@ declare function __registerNamespaces(tree: NamespaceTree): void;
|
|
|
31
30
|
* gen file re-registers its static descriptors right after.
|
|
32
31
|
*/
|
|
33
32
|
declare function __configure(config: PalbeConfig): void;
|
|
34
|
-
/**
|
|
35
|
-
* Register a callback that fires synchronously after every successful
|
|
36
|
-
* `__configure` call (including re-configure / watch-mode regen).
|
|
37
|
-
*
|
|
38
|
-
* Returns an unsubscribe function. Safe to call before the first `__configure`.
|
|
39
|
-
*
|
|
40
|
-
* @internal — consumed by `palbe/react`; not part of the public `palbe` surface.
|
|
41
|
-
*/
|
|
42
|
-
declare function onConfigured(cb: () => void): () => void;
|
|
43
|
-
/** @internal */
|
|
44
|
-
declare function getRuntime(): PalbeRuntime;
|
|
45
33
|
/** Test-only: drop runtime + registered namespaces. */
|
|
46
34
|
declare function __reset(): void;
|
|
47
35
|
|
|
48
|
-
export { type EndpointDescriptor, type NamespaceTree, PalbeConfig,
|
|
36
|
+
export { type EndpointDescriptor, type NamespaceTree, PalbeConfig, __configure, __registerNamespaces, __reset };
|
package/dist/internal.js
CHANGED
package/dist/next/client.cjs
CHANGED
|
@@ -40,18 +40,9 @@ var PalbaseError = class extends Error {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
var PALBASE_DEFAULT_HOST = "api.palbase.studio";
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (apiKey.length < 13) return null;
|
|
47
|
-
if (!apiKey.startsWith("pb_")) return null;
|
|
48
|
-
if (apiKey[11] !== "_") return null;
|
|
49
|
-
const ref = apiKey.slice(3, 11);
|
|
50
|
-
if (ref.length !== REF_LEN) return null;
|
|
51
|
-
if (!BASE62_RE.test(ref)) return null;
|
|
52
|
-
const scope = apiKey[12];
|
|
53
|
-
if (scope !== "c") return null;
|
|
54
|
-
return ref;
|
|
43
|
+
var API_KEY_RE = /^pb_([a-z0-9]+)_c[A-Za-z0-9]{20}$/;
|
|
44
|
+
function parseEnvironmentRef(apiKey) {
|
|
45
|
+
return API_KEY_RE.exec(apiKey)?.[1] ?? null;
|
|
55
46
|
}
|
|
56
47
|
var MAX_RETRIES = 3;
|
|
57
48
|
var INITIAL_BACKOFF_MS = 200;
|
|
@@ -81,8 +72,7 @@ var HttpClient = class _HttpClient {
|
|
|
81
72
|
* with the parent at runtime — later changes on the parent propagate to
|
|
82
73
|
* the scope and vice versa.
|
|
83
74
|
*
|
|
84
|
-
* Typical use:
|
|
85
|
-
* gateway can route them to the correct project's data plane.
|
|
75
|
+
* Typical use: adding an Environment-routing header for an admin call.
|
|
86
76
|
*/
|
|
87
77
|
withHeaders(extra) {
|
|
88
78
|
const mergedHeaders = { ...this.options?.headers ?? {}, ...extra };
|
|
@@ -123,10 +113,10 @@ var HttpClient = class _HttpClient {
|
|
|
123
113
|
if (this.options?.url) {
|
|
124
114
|
return this.options.url;
|
|
125
115
|
}
|
|
126
|
-
if (this.apiKey &&
|
|
116
|
+
if (this.apiKey && parseEnvironmentRef(this.apiKey) === null) {
|
|
127
117
|
throw new PalbaseError(
|
|
128
118
|
"invalid_api_key",
|
|
129
|
-
'Invalid API key format. Expected pb_{
|
|
119
|
+
'Invalid API key format. Expected pb_{environment_ref}_c{20_base62_chars}. For dev/staging pass `url: "https://api.dev.palbase.studio"` via options.',
|
|
130
120
|
0
|
|
131
121
|
);
|
|
132
122
|
}
|
|
@@ -139,10 +129,6 @@ var HttpClient = class _HttpClient {
|
|
|
139
129
|
const effectiveKey = this.apiKey;
|
|
140
130
|
if (effectiveKey) {
|
|
141
131
|
headers["apikey"] = effectiveKey;
|
|
142
|
-
const ref = parseProjectRef(effectiveKey);
|
|
143
|
-
if (ref) {
|
|
144
|
-
headers["X-Project-Ref"] = ref;
|
|
145
|
-
}
|
|
146
132
|
}
|
|
147
133
|
const token = this.tokenManager?.getAccessToken();
|
|
148
134
|
if (token) {
|
|
@@ -953,13 +939,6 @@ var AuthClient = class {
|
|
|
953
939
|
}
|
|
954
940
|
};
|
|
955
941
|
|
|
956
|
-
// src/api-key.ts
|
|
957
|
-
var API_KEY_RE = /^pb_([^_]+)_[cs][A-Za-z0-9]{20}$/;
|
|
958
|
-
function endpointRefFromApiKey(apiKey) {
|
|
959
|
-
const m = API_KEY_RE.exec(apiKey);
|
|
960
|
-
return m ? m[1] ?? "" : "";
|
|
961
|
-
}
|
|
962
|
-
|
|
963
942
|
// src/analytics-facade.ts
|
|
964
943
|
var EVENT_NAME_RE = /^[a-zA-Z$][a-zA-Z0-9_.:$-]{0,63}$/;
|
|
965
944
|
var FLUSH_AT = 20;
|
|
@@ -1017,7 +996,7 @@ var AnalyticsState = class {
|
|
|
1017
996
|
idKey;
|
|
1018
997
|
optOutKey;
|
|
1019
998
|
constructor(rt) {
|
|
1020
|
-
const ref =
|
|
999
|
+
const ref = rt.config.environmentRef;
|
|
1021
1000
|
this.idKey = ref ? `palbe.analytics.id.${ref}` : "palbe.analytics.id";
|
|
1022
1001
|
this.optOutKey = ref ? `palbe.analytics.optout.${ref}` : "palbe.analytics.optout";
|
|
1023
1002
|
rt.auth.onAuthEvent((event) => {
|
|
@@ -1231,6 +1210,13 @@ var PalbeAnalytics = class {
|
|
|
1231
1210
|
}
|
|
1232
1211
|
};
|
|
1233
1212
|
|
|
1213
|
+
// src/api-key.ts
|
|
1214
|
+
var PUBLISHABLE_API_KEY_RE = /^pb_([a-z0-9]+)_c[A-Za-z0-9]{20}$/;
|
|
1215
|
+
function environmentRefFromPublishableApiKey(apiKey) {
|
|
1216
|
+
const match = PUBLISHABLE_API_KEY_RE.exec(apiKey);
|
|
1217
|
+
return match ? match[1] ?? "" : "";
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1234
1220
|
// src/auth-wire.ts
|
|
1235
1221
|
function asWireAuthResult(raw) {
|
|
1236
1222
|
if (typeof raw !== "object" || raw === null) return null;
|
|
@@ -1578,19 +1564,29 @@ var PalbeAuth = class {
|
|
|
1578
1564
|
|
|
1579
1565
|
// src/calls/facade.ts
|
|
1580
1566
|
var import_livekit_client = require("livekit-client");
|
|
1581
|
-
var Call = class {
|
|
1567
|
+
var Call = class _Call {
|
|
1582
1568
|
id;
|
|
1583
1569
|
_state = "connecting";
|
|
1584
1570
|
_participants = /* @__PURE__ */ new Map();
|
|
1585
1571
|
_listeners = /* @__PURE__ */ new Set();
|
|
1586
1572
|
_room;
|
|
1587
1573
|
_keyProvider;
|
|
1588
|
-
|
|
1574
|
+
// PRIVATE constructor + `@internal` factory: the media-engine types (`Room`,
|
|
1575
|
+
// `ExternalE2EEKeyProvider`) appear ONLY on a private constructor and an
|
|
1576
|
+
// `@internal` static factory, both of which `stripInternal` (set in this
|
|
1577
|
+
// package's tsconfig) removes from the emitted public `.d.ts`. So no engine type
|
|
1578
|
+
// ever reaches the public API surface — the same "no engine type in the public
|
|
1579
|
+
// interface" contract the iOS SDK enforces. Consumers obtain a `Call` only
|
|
1580
|
+
// through `pb.calls.start()` / `.accept()`.
|
|
1589
1581
|
constructor(callId, room, keyProvider) {
|
|
1590
1582
|
this.id = callId;
|
|
1591
1583
|
this._room = room;
|
|
1592
1584
|
this._keyProvider = keyProvider;
|
|
1593
|
-
this.
|
|
1585
|
+
this._wireMediaEvents();
|
|
1586
|
+
}
|
|
1587
|
+
/** @internal — facade-only factory; stripped from the public `.d.ts`. */
|
|
1588
|
+
static _create(callId, room, keyProvider) {
|
|
1589
|
+
return new _Call(callId, room, keyProvider);
|
|
1594
1590
|
}
|
|
1595
1591
|
// ─── State ──────────────────────────────────────────────────────────────
|
|
1596
1592
|
get state() {
|
|
@@ -1600,9 +1596,9 @@ var Call = class {
|
|
|
1600
1596
|
get participants() {
|
|
1601
1597
|
return Array.from(this._participants.values());
|
|
1602
1598
|
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1599
|
+
// (No `localParticipant` accessor: it would return a raw media-engine participant
|
|
1600
|
+
// object and leak the engine type onto the public API. Local mic/camera control is
|
|
1601
|
+
// exposed engine-agnostically via `mute()` / `setCamera()` below.)
|
|
1606
1602
|
// ─── Subscribe ──────────────────────────────────────────────────────────
|
|
1607
1603
|
/**
|
|
1608
1604
|
* Subscribe to call changes (state + participant updates).
|
|
@@ -1626,7 +1622,7 @@ var Call = class {
|
|
|
1626
1622
|
/**
|
|
1627
1623
|
* Set a raw frame encryption key (ArrayBuffer) for this call.
|
|
1628
1624
|
* Design seam for SP-1.x web-MLS: call this with the MLS exporter secret
|
|
1629
|
-
* to enable frame-level E2EE via
|
|
1625
|
+
* to enable frame-level E2EE via the media engine's external key provider.
|
|
1630
1626
|
*
|
|
1631
1627
|
* NOTE: The room must have been opened with `e2ee` options for this to take
|
|
1632
1628
|
* effect. Currently calls connect WITHOUT e2ee — see module docstring.
|
|
@@ -1636,7 +1632,7 @@ var Call = class {
|
|
|
1636
1632
|
async setMediaKey(key) {
|
|
1637
1633
|
await this._keyProvider.setKey(key);
|
|
1638
1634
|
}
|
|
1639
|
-
/** Leave the call and disconnect from the
|
|
1635
|
+
/** Leave the call and disconnect from the media room. */
|
|
1640
1636
|
async leave() {
|
|
1641
1637
|
await this._room.disconnect();
|
|
1642
1638
|
this._setState("ended");
|
|
@@ -1678,7 +1674,7 @@ var Call = class {
|
|
|
1678
1674
|
}
|
|
1679
1675
|
this._emit();
|
|
1680
1676
|
}
|
|
1681
|
-
|
|
1677
|
+
_wireMediaEvents() {
|
|
1682
1678
|
this._room.on(import_livekit_client.RoomEvent.Connected, () => {
|
|
1683
1679
|
this._setState("active");
|
|
1684
1680
|
}).on(
|
|
@@ -1719,9 +1715,9 @@ var PalbeCalls = class {
|
|
|
1719
1715
|
*
|
|
1720
1716
|
* @param groupId - Messaging group display-id (`grp_<uuidv7>`)
|
|
1721
1717
|
* @param media - Which media tracks to publish (default: audio + video)
|
|
1722
|
-
* @returns A `Call` in `connecting` state; transitions to `active` once
|
|
1718
|
+
* @returns A `Call` in `connecting` state; transitions to `active` once the media room connects.
|
|
1723
1719
|
*
|
|
1724
|
-
* @throws BackendError('network', { code: 'call_service_unavailable' }) if
|
|
1720
|
+
* @throws BackendError('network', { code: 'call_service_unavailable' }) if the SFU is down (503)
|
|
1725
1721
|
* @throws BackendError('forbidden', { code: 'not_group_member' }) if the caller is not a member (403)
|
|
1726
1722
|
* @throws BackendError('conflict', { code: 'call_room_full' }) if the room is full (409)
|
|
1727
1723
|
*/
|
|
@@ -1778,7 +1774,7 @@ var PalbeCalls = class {
|
|
|
1778
1774
|
adaptiveStream: true,
|
|
1779
1775
|
dynacast: true
|
|
1780
1776
|
});
|
|
1781
|
-
const call =
|
|
1777
|
+
const call = Call._create(callId, room, keyProvider);
|
|
1782
1778
|
await room.connect(edgeUrl, token);
|
|
1783
1779
|
if (media.includes("audio")) {
|
|
1784
1780
|
await room.localParticipant.setMicrophoneEnabled(true);
|
|
@@ -2371,7 +2367,7 @@ var PalbeFlags = class {
|
|
|
2371
2367
|
constructor(rt) {
|
|
2372
2368
|
this.transport = new FlagsClient(rt.http);
|
|
2373
2369
|
const browser = typeof document !== "undefined";
|
|
2374
|
-
const ref =
|
|
2370
|
+
const ref = rt.config.environmentRef;
|
|
2375
2371
|
const options = {
|
|
2376
2372
|
auth: palbeAuthAdapter(rt.auth),
|
|
2377
2373
|
...ref ? { storageKey: `palbe.flags.${ref}` } : {},
|
|
@@ -8111,7 +8107,7 @@ var AnonTokenProvider = class {
|
|
|
8111
8107
|
}
|
|
8112
8108
|
/**
|
|
8113
8109
|
* Raw fetch, deliberately NOT through HttpClient/palbeRequest: the mint
|
|
8114
|
-
* must carry the
|
|
8110
|
+
* must carry the Environment API key and NEVER a Bearer (iOS keeps
|
|
8115
8111
|
* `/auth/anonymous` on the unauthenticated-path list), and HttpClient's
|
|
8116
8112
|
* pre-flight would try to refresh a stale session before an anon mint —
|
|
8117
8113
|
* exactly the entanglement this provider exists to avoid.
|
|
@@ -8768,10 +8764,25 @@ function defaultSessionStorage(key) {
|
|
|
8768
8764
|
}
|
|
8769
8765
|
|
|
8770
8766
|
// src/version.ts
|
|
8771
|
-
var VERSION = "
|
|
8767
|
+
var VERSION = "4.0.0";
|
|
8772
8768
|
|
|
8773
8769
|
// src/runtime.ts
|
|
8774
8770
|
function buildRuntime(config) {
|
|
8771
|
+
const keyEnvironmentRef = environmentRefFromPublishableApiKey(config.apiKey);
|
|
8772
|
+
if (keyEnvironmentRef === "") {
|
|
8773
|
+
throw new Error("PalbeConfig.apiKey does not contain a valid publishable Environment identity");
|
|
8774
|
+
} else if (config.environmentRef !== keyEnvironmentRef) {
|
|
8775
|
+
throw new Error("PalbeConfig.environmentRef must match the Environment identity in apiKey");
|
|
8776
|
+
}
|
|
8777
|
+
let runtimeURL;
|
|
8778
|
+
try {
|
|
8779
|
+
runtimeURL = new URL(config.url);
|
|
8780
|
+
} catch {
|
|
8781
|
+
throw new Error("PalbeConfig.url must be a valid URL");
|
|
8782
|
+
}
|
|
8783
|
+
if (runtimeURL.hostname.endsWith(".palbase.studio") && runtimeURL.hostname.split(".")[0] !== config.environmentRef) {
|
|
8784
|
+
throw new Error("PalbeConfig.url must match environmentRef for palbase.studio");
|
|
8785
|
+
}
|
|
8775
8786
|
const http = new HttpClient(config.apiKey, {
|
|
8776
8787
|
url: config.url,
|
|
8777
8788
|
headers: { "X-Client-Info": `palbe-web/${VERSION}`, ...config.headers }
|
|
@@ -8780,7 +8791,7 @@ function buildRuntime(config) {
|
|
|
8780
8791
|
const tokenManager = new TokenManager();
|
|
8781
8792
|
http.tokenManager = tokenManager;
|
|
8782
8793
|
const authClient = new AuthClient(http, tokenManager);
|
|
8783
|
-
const ref =
|
|
8794
|
+
const ref = config.environmentRef;
|
|
8784
8795
|
const storage = config.storage ?? defaultSessionStorage(ref ? `palbe.session.${ref}` : void 0);
|
|
8785
8796
|
const persisted = storage.load();
|
|
8786
8797
|
if (persisted) {
|
|
@@ -8938,11 +8949,11 @@ function getRuntime() {
|
|
|
8938
8949
|
|
|
8939
8950
|
// src/next/cookie-codec.ts
|
|
8940
8951
|
var MAX_COOKIE_VALUE = 3500;
|
|
8941
|
-
function sessionCookieName(
|
|
8942
|
-
return `palbe-session-${
|
|
8952
|
+
function sessionCookieName(environmentRef) {
|
|
8953
|
+
return `palbe-session-${environmentRef}`;
|
|
8943
8954
|
}
|
|
8944
|
-
function encodeSessionCookies(
|
|
8945
|
-
const name = sessionCookieName(
|
|
8955
|
+
function encodeSessionCookies(environmentRef, session) {
|
|
8956
|
+
const name = sessionCookieName(environmentRef);
|
|
8946
8957
|
const value = encodeURIComponent(
|
|
8947
8958
|
JSON.stringify({ a: session.accessToken, r: session.refreshToken, e: session.expiresAt })
|
|
8948
8959
|
);
|
|
@@ -8961,8 +8972,8 @@ function encodeSessionCookies(endpointRef, session) {
|
|
|
8961
8972
|
}
|
|
8962
8973
|
return { set: chunks, clear: [`${name}.${chunks.length}`] };
|
|
8963
8974
|
}
|
|
8964
|
-
function decodeSessionCookies(get,
|
|
8965
|
-
const base = sessionCookieName(
|
|
8975
|
+
function decodeSessionCookies(get, environmentRef) {
|
|
8976
|
+
const base = sessionCookieName(environmentRef);
|
|
8966
8977
|
let encoded = get(base);
|
|
8967
8978
|
if (encoded === void 0) {
|
|
8968
8979
|
let joined = "";
|
|
@@ -8996,8 +9007,8 @@ function parseStoredSession(json) {
|
|
|
8996
9007
|
return null;
|
|
8997
9008
|
}
|
|
8998
9009
|
}
|
|
8999
|
-
function clearedSessionCookieNames(
|
|
9000
|
-
const base = sessionCookieName(
|
|
9010
|
+
function clearedSessionCookieNames(environmentRef, present) {
|
|
9011
|
+
const base = sessionCookieName(environmentRef);
|
|
9001
9012
|
const names = [];
|
|
9002
9013
|
if (present(base)) names.push(base);
|
|
9003
9014
|
for (let i = 0; ; i++) {
|
|
@@ -9024,12 +9035,12 @@ function cookieJar() {
|
|
|
9024
9035
|
function deleteCookie(name) {
|
|
9025
9036
|
document.cookie = `${name}=; ${WRITE_ATTRS}; Max-Age=0`;
|
|
9026
9037
|
}
|
|
9027
|
-
function cookieSessionStorage(
|
|
9038
|
+
function cookieSessionStorage(environmentRef) {
|
|
9028
9039
|
return {
|
|
9029
9040
|
load() {
|
|
9030
9041
|
if (typeof document === "undefined") return null;
|
|
9031
9042
|
const jar = cookieJar();
|
|
9032
|
-
const stored = decodeSessionCookies((name) => jar.get(name),
|
|
9043
|
+
const stored = decodeSessionCookies((name) => jar.get(name), environmentRef);
|
|
9033
9044
|
if (!stored) return null;
|
|
9034
9045
|
return stored.accessToken && stored.expiresAt > 0 ? {
|
|
9035
9046
|
refreshToken: stored.refreshToken,
|
|
@@ -9040,10 +9051,10 @@ function cookieSessionStorage(endpointRef) {
|
|
|
9040
9051
|
save(session) {
|
|
9041
9052
|
if (typeof document === "undefined") return;
|
|
9042
9053
|
const jar = cookieJar();
|
|
9043
|
-
for (const name of clearedSessionCookieNames(
|
|
9054
|
+
for (const name of clearedSessionCookieNames(environmentRef, (n) => jar.has(n))) {
|
|
9044
9055
|
deleteCookie(name);
|
|
9045
9056
|
}
|
|
9046
|
-
const { set, clear } = encodeSessionCookies(
|
|
9057
|
+
const { set, clear } = encodeSessionCookies(environmentRef, {
|
|
9047
9058
|
accessToken: session.accessToken ?? "",
|
|
9048
9059
|
refreshToken: session.refreshToken,
|
|
9049
9060
|
expiresAt: session.expiresAt ?? 0
|
|
@@ -9056,7 +9067,7 @@ function cookieSessionStorage(endpointRef) {
|
|
|
9056
9067
|
clear() {
|
|
9057
9068
|
if (typeof document === "undefined") return;
|
|
9058
9069
|
const jar = cookieJar();
|
|
9059
|
-
for (const name of clearedSessionCookieNames(
|
|
9070
|
+
for (const name of clearedSessionCookieNames(environmentRef, (n) => jar.has(n))) {
|
|
9060
9071
|
deleteCookie(name);
|
|
9061
9072
|
}
|
|
9062
9073
|
}
|
|
@@ -9065,7 +9076,10 @@ function cookieSessionStorage(endpointRef) {
|
|
|
9065
9076
|
function setupPalbeNext() {
|
|
9066
9077
|
if (typeof document === "undefined") return;
|
|
9067
9078
|
const config = getRuntime().config;
|
|
9068
|
-
__configure({
|
|
9079
|
+
__configure({
|
|
9080
|
+
...config,
|
|
9081
|
+
storage: cookieSessionStorage(config.environmentRef)
|
|
9082
|
+
});
|
|
9069
9083
|
}
|
|
9070
9084
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9071
9085
|
0 && (module.exports = {
|