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.umd.js
CHANGED
|
@@ -39095,7 +39095,7 @@ var __publicField = (obj, key, value) => {
|
|
|
39095
39095
|
this.connectPromise = new Promise((resolve, reject) => {
|
|
39096
39096
|
this.connectResolve = resolve;
|
|
39097
39097
|
this.connectReject = reject;
|
|
39098
|
-
const sdkVersion = "2.2.2
|
|
39098
|
+
const sdkVersion = "2.2.2";
|
|
39099
39099
|
const platform2 = typeof window !== "undefined" ? "browser" : "nodejs";
|
|
39100
39100
|
const wrapperName = this.configOptions?.wrapper?.name || "native-js";
|
|
39101
39101
|
const wrapperVersion = this.configOptions?.wrapper?.version || "none";
|
|
@@ -41875,7 +41875,6 @@ var __publicField = (obj, key, value) => {
|
|
|
41875
41875
|
}
|
|
41876
41876
|
const PII_VALUE_ENCODING = "hmac-v1";
|
|
41877
41877
|
const textEncoder = new TextEncoder();
|
|
41878
|
-
const HASH_HEX_PATTERN = /^[0-9a-f]{64}$/;
|
|
41879
41878
|
function normalizePiiString(value) {
|
|
41880
41879
|
return value.trim().toLowerCase();
|
|
41881
41880
|
}
|
|
@@ -41903,6 +41902,11 @@ var __publicField = (obj, key, value) => {
|
|
|
41903
41902
|
}
|
|
41904
41903
|
return false;
|
|
41905
41904
|
}
|
|
41905
|
+
function payloadHasExplicitPiiFields(payload) {
|
|
41906
|
+
if (!payload)
|
|
41907
|
+
return false;
|
|
41908
|
+
return payload.piiSalt !== void 0 || payload.piiAttributes !== void 0 || payload.piiValueEncoding !== void 0;
|
|
41909
|
+
}
|
|
41906
41910
|
function piiWireOptionsFromPayload(payload) {
|
|
41907
41911
|
if (!payload)
|
|
41908
41912
|
return null;
|
|
@@ -41919,18 +41923,30 @@ var __publicField = (obj, key, value) => {
|
|
|
41919
41923
|
piiValueEncoding: PII_VALUE_ENCODING
|
|
41920
41924
|
};
|
|
41921
41925
|
}
|
|
41922
|
-
function
|
|
41926
|
+
function resolvePiiWireForDelta(previous, action) {
|
|
41927
|
+
if (!payloadHasExplicitPiiFields(action)) {
|
|
41928
|
+
return previous;
|
|
41929
|
+
}
|
|
41930
|
+
const merged = {
|
|
41931
|
+
piiSalt: action.piiSalt !== void 0 ? action.piiSalt : previous?.piiSalt,
|
|
41932
|
+
piiAttributes: action.piiAttributes !== void 0 ? action.piiAttributes : previous?.piiAttributes,
|
|
41933
|
+
piiValueEncoding: action.piiValueEncoding !== void 0 ? action.piiValueEncoding : previous?.piiValueEncoding
|
|
41934
|
+
};
|
|
41935
|
+
return piiWireOptionsFromPayload(merged);
|
|
41936
|
+
}
|
|
41937
|
+
function applyPiiHashToFlatContext(context, options, mode) {
|
|
41923
41938
|
if (!options || !options.piiSalt || !options.piiAttributes.length || options.piiValueEncoding !== PII_VALUE_ENCODING) {
|
|
41924
41939
|
return context;
|
|
41925
41940
|
}
|
|
41941
|
+
if (mode?.alreadyHashed) {
|
|
41942
|
+
return context;
|
|
41943
|
+
}
|
|
41926
41944
|
let changed = false;
|
|
41927
41945
|
const out = { ...context };
|
|
41928
41946
|
for (const [key2, value] of Object.entries(context)) {
|
|
41929
41947
|
if (!isPiiAttribute(key2, options.piiAttributes))
|
|
41930
41948
|
continue;
|
|
41931
41949
|
if (typeof value === "string") {
|
|
41932
|
-
if (HASH_HEX_PATTERN.test(value))
|
|
41933
|
-
continue;
|
|
41934
41950
|
out[key2] = hashPiiValue(value, options.piiSalt);
|
|
41935
41951
|
changed = true;
|
|
41936
41952
|
continue;
|
|
@@ -41940,8 +41956,6 @@ var __publicField = (obj, key, value) => {
|
|
|
41940
41956
|
const next = value.map((entry) => {
|
|
41941
41957
|
if (typeof entry !== "string")
|
|
41942
41958
|
return entry;
|
|
41943
|
-
if (HASH_HEX_PATTERN.test(entry))
|
|
41944
|
-
return entry;
|
|
41945
41959
|
arrayChanged = true;
|
|
41946
41960
|
return hashPiiValue(entry, options.piiSalt);
|
|
41947
41961
|
});
|
|
@@ -42022,7 +42036,7 @@ var __publicField = (obj, key, value) => {
|
|
|
42022
42036
|
if (flag?.key)
|
|
42023
42037
|
flags.set(flag.key, flag);
|
|
42024
42038
|
}
|
|
42025
|
-
const nextPii =
|
|
42039
|
+
const nextPii = resolvePiiWireForDelta(state.piiWire, action);
|
|
42026
42040
|
return {
|
|
42027
42041
|
version: action.toVersion,
|
|
42028
42042
|
expiresAt: typeof action.expiresAt === "number" ? action.expiresAt : state.expiresAt,
|
|
@@ -42436,7 +42450,7 @@ var __publicField = (obj, key, value) => {
|
|
|
42436
42450
|
function toComparableString(value) {
|
|
42437
42451
|
if (value === null || value === void 0)
|
|
42438
42452
|
return "";
|
|
42439
|
-
return String(value);
|
|
42453
|
+
return String(value).trim().toLowerCase();
|
|
42440
42454
|
}
|
|
42441
42455
|
function toComparableArray(value) {
|
|
42442
42456
|
if (Array.isArray(value)) {
|