@palbase/web 2.0.0 → 2.0.1
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/{analytics-facade-ovP0pF2P.d.cts → analytics-facade-ChlBRcLZ.d.cts} +13 -4
- package/dist/{analytics-facade-DMtGDGfd.d.ts → analytics-facade-G0il4NrT.d.ts} +13 -4
- package/dist/{chunk-V6VTX65P.js → chunk-AIPUO4QX.js} +52 -24
- package/dist/chunk-AIPUO4QX.js.map +1 -0
- package/dist/gen/cli.cjs +4 -5
- package/dist/gen/cli.cjs.map +1 -1
- package/dist/gen/cli.js +4 -5
- package/dist/gen/cli.js.map +1 -1
- package/dist/index.cjs +51 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/internal.cjs +51 -23
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +4 -4
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +51 -23
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +51 -23
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +3 -3
- package/dist/next/index.d.ts +3 -3
- package/dist/next/index.js +1 -1
- package/dist/{pb-DDM_mCQB.d.cts → pb-B_6o5p79.d.cts} +1 -1
- package/dist/{pb-CvpcQero.d.ts → pb-nPBhqhJr.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 +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-V6VTX65P.js.map +0 -1
package/dist/next/client.js
CHANGED
package/dist/next/index.cjs
CHANGED
|
@@ -2007,6 +2007,19 @@ var PalbeCalls = class {
|
|
|
2007
2007
|
|
|
2008
2008
|
// ../modules/flags/dist/index.js
|
|
2009
2009
|
var FLAG_NAME_RE = /^[a-zA-Z0-9_-]+$/;
|
|
2010
|
+
function flagEnabled(value) {
|
|
2011
|
+
if (typeof value === "boolean") return value;
|
|
2012
|
+
return value != null && value !== 0 && value !== "";
|
|
2013
|
+
}
|
|
2014
|
+
function flagVariant(value) {
|
|
2015
|
+
return typeof value === "string" ? { name: value } : null;
|
|
2016
|
+
}
|
|
2017
|
+
function mapResponse(res, fn) {
|
|
2018
|
+
if (res.error || res.data == null) {
|
|
2019
|
+
return { ...res, data: null };
|
|
2020
|
+
}
|
|
2021
|
+
return { ...res, data: fn(res.data) };
|
|
2022
|
+
}
|
|
2010
2023
|
var FlagsClient = class {
|
|
2011
2024
|
httpClient;
|
|
2012
2025
|
getCurrentUserId;
|
|
@@ -2026,10 +2039,11 @@ var FlagsClient = class {
|
|
|
2026
2039
|
`Invalid flag name: "${flagName}". Flag names must match ${FLAG_NAME_RE.source}`
|
|
2027
2040
|
);
|
|
2028
2041
|
}
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2042
|
+
const res = await this.httpClient.request(
|
|
2043
|
+
"GET",
|
|
2044
|
+
this.mergedPath(context)
|
|
2045
|
+
);
|
|
2046
|
+
return mapResponse(res, (snap) => flagEnabled(snap.values?.[flagName]));
|
|
2033
2047
|
}
|
|
2034
2048
|
async getVariant(flagName, context) {
|
|
2035
2049
|
if (!FLAG_NAME_RE.test(flagName)) {
|
|
@@ -2037,16 +2051,29 @@ var FlagsClient = class {
|
|
|
2037
2051
|
`Invalid flag name: "${flagName}". Flag names must match ${FLAG_NAME_RE.source}`
|
|
2038
2052
|
);
|
|
2039
2053
|
}
|
|
2040
|
-
const
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2054
|
+
const res = await this.httpClient.request(
|
|
2055
|
+
"GET",
|
|
2056
|
+
this.mergedPath(context)
|
|
2057
|
+
);
|
|
2058
|
+
if (res.error || res.data == null) {
|
|
2059
|
+
return { ...res, data: null };
|
|
2060
|
+
}
|
|
2061
|
+
return { ...res, data: flagVariant(res.data.values?.[flagName]) };
|
|
2044
2062
|
}
|
|
2045
2063
|
async getAll(context) {
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2064
|
+
const res = await this.httpClient.request(
|
|
2065
|
+
"GET",
|
|
2066
|
+
this.mergedPath(context)
|
|
2067
|
+
);
|
|
2068
|
+
return mapResponse(res, (snap) => {
|
|
2069
|
+
const values = snap.values ?? {};
|
|
2070
|
+
return Object.keys(values).map((name) => {
|
|
2071
|
+
const value = values[name];
|
|
2072
|
+
const flag = { name, enabled: flagEnabled(value) };
|
|
2073
|
+
if (typeof value === "string") flag.variant = { name: value };
|
|
2074
|
+
return flag;
|
|
2075
|
+
});
|
|
2076
|
+
});
|
|
2050
2077
|
}
|
|
2051
2078
|
/**
|
|
2052
2079
|
* Cold-start read: the full merged flag set for the current auth identity.
|
|
@@ -2145,15 +2172,16 @@ var FlagsClient = class {
|
|
|
2145
2172
|
}
|
|
2146
2173
|
};
|
|
2147
2174
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2175
|
+
/**
|
|
2176
|
+
* Resolve the merged-read path for a context. With `context.userId` present the
|
|
2177
|
+
* read targets that specific user's merged view (`/v1/user-flags/users/{id}`, a
|
|
2178
|
+
* privileged cross-user read); otherwise the current auth user's view
|
|
2179
|
+
* (`/v1/user-flags`). `context.properties` has no server-side targeting support
|
|
2180
|
+
* in the user-flags module and is ignored.
|
|
2181
|
+
*/
|
|
2182
|
+
mergedPath(context) {
|
|
2183
|
+
const uid = context?.userId;
|
|
2184
|
+
return uid ? `/v1/user-flags/users/${encodeURIComponent(uid)}` : "/v1/user-flags";
|
|
2157
2185
|
}
|
|
2158
2186
|
};
|
|
2159
2187
|
var DEFAULT_POLL_MS = 3e4;
|
|
@@ -2615,7 +2643,7 @@ var PalbeFlags = class {
|
|
|
2615
2643
|
*
|
|
2616
2644
|
* DEVIATION from iOS sync-cache parity: the platform does not propagate
|
|
2617
2645
|
* variant metadata into the user-flags snapshot/delta cache, so this is an
|
|
2618
|
-
* ASYNC transport read (`GET /v1/flags
|
|
2646
|
+
* ASYNC transport read (derived from `GET /v1/user-flags`), not a cache lookup.
|
|
2619
2647
|
*/
|
|
2620
2648
|
async getVariant(key) {
|
|
2621
2649
|
let res;
|
|
@@ -8955,7 +8983,7 @@ function defaultSessionStorage(key) {
|
|
|
8955
8983
|
}
|
|
8956
8984
|
|
|
8957
8985
|
// src/version.ts
|
|
8958
|
-
var VERSION = "2.0.
|
|
8986
|
+
var VERSION = "2.0.1";
|
|
8959
8987
|
|
|
8960
8988
|
// src/runtime.ts
|
|
8961
8989
|
function buildRuntime(config) {
|