flagmint-js-sdk 2.2.2-rc.0 → 2.2.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.
- package/README.md +1 -1
- package/dist/flagmint.cjs.js +23 -9
- package/dist/flagmint.cjs.js.map +1 -1
- package/dist/flagmint.es.js +23 -9
- package/dist/flagmint.es.js.map +1 -1
- package/dist/flagmint.umd.js +23 -9
- package/dist/flagmint.umd.js.map +1 -1
- package/dist/sdk/core/config-sync/index.d.ts +2 -2
- package/dist/sdk/core/config-sync/piiHash.d.ts +40 -6
- package/package.json +1 -1
package/dist/flagmint.es.js
CHANGED
|
@@ -39091,7 +39091,7 @@ class SseTransport {
|
|
|
39091
39091
|
this.connectPromise = new Promise((resolve, reject) => {
|
|
39092
39092
|
this.connectResolve = resolve;
|
|
39093
39093
|
this.connectReject = reject;
|
|
39094
|
-
const sdkVersion = "2.2.2
|
|
39094
|
+
const sdkVersion = "2.2.2";
|
|
39095
39095
|
const platform2 = typeof window !== "undefined" ? "browser" : "nodejs";
|
|
39096
39096
|
const wrapperName = this.configOptions?.wrapper?.name || "native-js";
|
|
39097
39097
|
const wrapperVersion = this.configOptions?.wrapper?.version || "none";
|
|
@@ -41871,7 +41871,6 @@ function isConfigPayloadExpired(expiresAt, now = Date.now()) {
|
|
|
41871
41871
|
}
|
|
41872
41872
|
const PII_VALUE_ENCODING = "hmac-v1";
|
|
41873
41873
|
const textEncoder = new TextEncoder();
|
|
41874
|
-
const HASH_HEX_PATTERN = /^[0-9a-f]{64}$/;
|
|
41875
41874
|
function normalizePiiString(value) {
|
|
41876
41875
|
return value.trim().toLowerCase();
|
|
41877
41876
|
}
|
|
@@ -41899,6 +41898,11 @@ function isPiiAttribute(attribute, piiAttributes) {
|
|
|
41899
41898
|
}
|
|
41900
41899
|
return false;
|
|
41901
41900
|
}
|
|
41901
|
+
function payloadHasExplicitPiiFields(payload) {
|
|
41902
|
+
if (!payload)
|
|
41903
|
+
return false;
|
|
41904
|
+
return payload.piiSalt !== void 0 || payload.piiAttributes !== void 0 || payload.piiValueEncoding !== void 0;
|
|
41905
|
+
}
|
|
41902
41906
|
function piiWireOptionsFromPayload(payload) {
|
|
41903
41907
|
if (!payload)
|
|
41904
41908
|
return null;
|
|
@@ -41915,18 +41919,30 @@ function piiWireOptionsFromPayload(payload) {
|
|
|
41915
41919
|
piiValueEncoding: PII_VALUE_ENCODING
|
|
41916
41920
|
};
|
|
41917
41921
|
}
|
|
41918
|
-
function
|
|
41922
|
+
function resolvePiiWireForDelta(previous, action) {
|
|
41923
|
+
if (!payloadHasExplicitPiiFields(action)) {
|
|
41924
|
+
return previous;
|
|
41925
|
+
}
|
|
41926
|
+
const merged = {
|
|
41927
|
+
piiSalt: action.piiSalt !== void 0 ? action.piiSalt : previous?.piiSalt,
|
|
41928
|
+
piiAttributes: action.piiAttributes !== void 0 ? action.piiAttributes : previous?.piiAttributes,
|
|
41929
|
+
piiValueEncoding: action.piiValueEncoding !== void 0 ? action.piiValueEncoding : previous?.piiValueEncoding
|
|
41930
|
+
};
|
|
41931
|
+
return piiWireOptionsFromPayload(merged);
|
|
41932
|
+
}
|
|
41933
|
+
function applyPiiHashToFlatContext(context, options, mode) {
|
|
41919
41934
|
if (!options || !options.piiSalt || !options.piiAttributes.length || options.piiValueEncoding !== PII_VALUE_ENCODING) {
|
|
41920
41935
|
return context;
|
|
41921
41936
|
}
|
|
41937
|
+
if (mode?.alreadyHashed) {
|
|
41938
|
+
return context;
|
|
41939
|
+
}
|
|
41922
41940
|
let changed = false;
|
|
41923
41941
|
const out = { ...context };
|
|
41924
41942
|
for (const [key2, value] of Object.entries(context)) {
|
|
41925
41943
|
if (!isPiiAttribute(key2, options.piiAttributes))
|
|
41926
41944
|
continue;
|
|
41927
41945
|
if (typeof value === "string") {
|
|
41928
|
-
if (HASH_HEX_PATTERN.test(value))
|
|
41929
|
-
continue;
|
|
41930
41946
|
out[key2] = hashPiiValue(value, options.piiSalt);
|
|
41931
41947
|
changed = true;
|
|
41932
41948
|
continue;
|
|
@@ -41936,8 +41952,6 @@ function applyPiiHashToFlatContext(context, options) {
|
|
|
41936
41952
|
const next = value.map((entry) => {
|
|
41937
41953
|
if (typeof entry !== "string")
|
|
41938
41954
|
return entry;
|
|
41939
|
-
if (HASH_HEX_PATTERN.test(entry))
|
|
41940
|
-
return entry;
|
|
41941
41955
|
arrayChanged = true;
|
|
41942
41956
|
return hashPiiValue(entry, options.piiSalt);
|
|
41943
41957
|
});
|
|
@@ -42018,7 +42032,7 @@ function applyPatch(state, action) {
|
|
|
42018
42032
|
if (flag?.key)
|
|
42019
42033
|
flags.set(flag.key, flag);
|
|
42020
42034
|
}
|
|
42021
|
-
const nextPii =
|
|
42035
|
+
const nextPii = resolvePiiWireForDelta(state.piiWire, action);
|
|
42022
42036
|
return {
|
|
42023
42037
|
version: action.toVersion,
|
|
42024
42038
|
expiresAt: typeof action.expiresAt === "number" ? action.expiresAt : state.expiresAt,
|
|
@@ -42432,7 +42446,7 @@ function flattenEvaluationContext(context) {
|
|
|
42432
42446
|
function toComparableString(value) {
|
|
42433
42447
|
if (value === null || value === void 0)
|
|
42434
42448
|
return "";
|
|
42435
|
-
return String(value);
|
|
42449
|
+
return String(value).trim().toLowerCase();
|
|
42436
42450
|
}
|
|
42437
42451
|
function toComparableArray(value) {
|
|
42438
42452
|
if (Array.isArray(value)) {
|