@palbase/web 5.0.1 → 7.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 +15 -15
- package/dist/{analytics-facade-Cp3d4QI-.d.ts → analytics-facade-CdTK9Y0s.d.ts} +42 -1
- package/dist/{analytics-facade-CaluA4bW.d.cts → analytics-facade-TB-D4ww8.d.cts} +42 -1
- package/dist/{chunk-QKFPPZLF.js → chunk-7SNSLY5M.js} +20 -3
- package/dist/chunk-7SNSLY5M.js.map +1 -0
- package/dist/{chunk-BNAGRUIQ.js → chunk-ACCJV6FV.js} +32 -2
- package/dist/chunk-ACCJV6FV.js.map +1 -0
- package/dist/{chunk-OWLTZG2V.js → chunk-ZC6Q3GPX.js} +2 -2
- package/dist/index.cjs +18 -1
- 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 +2 -2
- package/dist/internal.cjs +49 -2
- 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 +2 -2
- package/dist/next/client.cjs +49 -2
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +2 -2
- package/dist/next/index.cjs +49 -2
- 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 +3 -3
- package/dist/next/{middleware.cjs → proxy.cjs} +11 -11
- package/dist/next/proxy.cjs.map +1 -0
- package/dist/next/{middleware.d.cts → proxy.d.cts} +32 -31
- package/dist/next/{middleware.d.ts → proxy.d.ts} +32 -31
- package/dist/next/{middleware.js → proxy.js} +8 -8
- package/dist/next/proxy.js.map +1 -0
- package/dist/{pb-DUK5qy81.d.ts → pb-B6ZcZy8v.d.ts} +1 -1
- package/dist/{pb-DvV6ftmf.d.cts → pb-CiSj4lM3.d.cts} +1 -1
- package/dist/react/index.cjs +1 -1
- 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 +2 -2
- package/package.json +8 -8
- package/dist/chunk-BNAGRUIQ.js.map +0 -1
- package/dist/chunk-QKFPPZLF.js.map +0 -1
- package/dist/next/middleware.cjs.map +0 -1
- package/dist/next/middleware.js.map +0 -1
- /package/dist/{chunk-OWLTZG2V.js.map → chunk-ZC6Q3GPX.js.map} +0 -0
package/dist/next/client.js
CHANGED
package/dist/next/index.cjs
CHANGED
|
@@ -166,6 +166,27 @@ var PalbaseError = class extends Error {
|
|
|
166
166
|
this.details = details;
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
+
function detectPlatform() {
|
|
170
|
+
if (typeof Deno !== "undefined") {
|
|
171
|
+
return "deno";
|
|
172
|
+
}
|
|
173
|
+
if (process?.versions) {
|
|
174
|
+
if ("bun" in process.versions) {
|
|
175
|
+
return "bun";
|
|
176
|
+
}
|
|
177
|
+
if ("node" in process.versions) {
|
|
178
|
+
return "node";
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
182
|
+
return "react-native";
|
|
183
|
+
}
|
|
184
|
+
return "browser";
|
|
185
|
+
}
|
|
186
|
+
function wirePlatform() {
|
|
187
|
+
const host = detectPlatform();
|
|
188
|
+
return host === "browser" ? "web" : host;
|
|
189
|
+
}
|
|
169
190
|
var PALBASE_DEFAULT_HOST = "api.palbase.studio";
|
|
170
191
|
var API_KEY_RE2 = /^pb_([a-z0-9]{4,24})_c[A-Za-z0-9]{20}$/;
|
|
171
192
|
function parseEnvironmentRef(apiKey) {
|
|
@@ -251,8 +272,17 @@ var HttpClient = class _HttpClient {
|
|
|
251
272
|
}
|
|
252
273
|
buildHeaders(options) {
|
|
253
274
|
const headers = {
|
|
254
|
-
"Content-Type": "application/json"
|
|
275
|
+
"Content-Type": "application/json",
|
|
276
|
+
// Client identity, the web counterpart of the iOS SDK's
|
|
277
|
+
// ClientInfo.augment(). The server reads these to resolve flag targeting
|
|
278
|
+
// conditions and to label telemetry, so an app declares nothing and calls
|
|
279
|
+
// nothing — whatever the SDK can know, it sends.
|
|
280
|
+
"X-Platform": wirePlatform()
|
|
255
281
|
};
|
|
282
|
+
const appVersion = this.options?.appVersion?.trim();
|
|
283
|
+
if (appVersion) {
|
|
284
|
+
headers["X-Palbase-Client-Version"] = appVersion;
|
|
285
|
+
}
|
|
256
286
|
const effectiveKey = this.apiKey;
|
|
257
287
|
if (effectiveKey) {
|
|
258
288
|
headers["apikey"] = effectiveKey;
|
|
@@ -1593,6 +1623,23 @@ var PalbeAuth = class {
|
|
|
1593
1623
|
const raw = await palbeRequest(this.rt, "GET", "/auth/user");
|
|
1594
1624
|
return mapWireUser(raw);
|
|
1595
1625
|
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Which credentials this account actually has.
|
|
1628
|
+
*
|
|
1629
|
+
* An account reached through Google has no password, so showing it a
|
|
1630
|
+
* "current password" field gives the user something they can never fill —
|
|
1631
|
+
* and `getUser()` cannot tell you, because GET /auth/user carries no
|
|
1632
|
+
* credential information. Read this before rendering any re-auth or
|
|
1633
|
+
* change-password form.
|
|
1634
|
+
*/
|
|
1635
|
+
async getSignInMethods() {
|
|
1636
|
+
const raw = await palbeRequest(this.rt, "GET", "/auth/me");
|
|
1637
|
+
return {
|
|
1638
|
+
password: raw.has_password,
|
|
1639
|
+
mfa: raw.has_mfa,
|
|
1640
|
+
providers: raw.providers ?? null
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1596
1643
|
async refreshUser() {
|
|
1597
1644
|
const user = await this.getUser();
|
|
1598
1645
|
const changed = !usersEqual(user, this.cachedUser);
|
|
@@ -9037,7 +9084,7 @@ function defaultSessionStorage(key) {
|
|
|
9037
9084
|
}
|
|
9038
9085
|
|
|
9039
9086
|
// src/version.ts
|
|
9040
|
-
var VERSION = "
|
|
9087
|
+
var VERSION = "7.0.0";
|
|
9041
9088
|
|
|
9042
9089
|
// src/runtime.ts
|
|
9043
9090
|
function buildRuntime(config) {
|