@incodetech/core 2.3.0-rc.9 → 2.3.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/dist/{BrowserDiagnosticsCryptoProvider-HO8YXP4h.esm.js → BrowserDiagnosticsCryptoProvider-BuzqvbhN.esm.js} +6 -24
- package/dist/{FaceDetectionProvider-C7bUZsH9.esm.js → FaceDetectionProvider-Lb6i4Ilt.esm.js} +7 -7
- package/dist/{MotionSensorProvider-BgTYwg9L.esm.js → MotionSensorProvider-DyhbM4Si.esm.js} +1 -1
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-BWlcyGbw.esm.js → apiError-Dkl9_HOx.esm.js} +1 -1
- package/dist/authentication.d.ts +2 -2
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-DcTHmYmL.d.ts → authenticationManager-B23V74p7.d.ts} +1 -1
- package/dist/{authenticationManager-B321A87w.esm.js → authenticationManager-C7BaQC99.esm.js} +4 -4
- package/dist/{authenticationStateMachine-CSJtf13E.esm.js → authenticationStateMachine-CW7a9qpV.esm.js} +3 -3
- package/dist/camera.esm.js +1 -1
- package/dist/{createCameraCycleOwnership-CX3hJGKc.esm.js → createCameraCycleOwnership-DnwTl1ad.esm.js} +6 -1
- package/dist/{deepsightLoader-FOktaF-9.esm.js → deepsightLoader-DgaaacGJ.esm.js} +6 -6
- package/dist/document-capture.esm.js +2 -2
- package/dist/{documentCaptureManager-pprJUhsN.esm.js → documentCaptureManager-BRPxqYD2.esm.js} +1 -1
- package/dist/{documentCaptureStateMachine-DN2YOxdu.esm.js → documentCaptureStateMachine-D312sSIu.esm.js} +2 -2
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-Pj67RmHb.esm.js → dynamicFormsManager-Cm33oGqC.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-B00MVHEa.esm.js → dynamicFormsStateMachine-4EVsg15i.esm.js} +1 -1
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-CovxKSIS.esm.js → ekybManager-CgjQ2Thl.esm.js} +1 -1
- package/dist/{ekybStateMachine-DHCg1B5d.esm.js → ekybStateMachine-Dwgt5Dqa.esm.js} +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-BnlLBzH6.esm.js → electronicSignatureManager-DGEUq9nY.esm.js} +1 -1
- package/dist/extensibility.d.ts +6 -6
- package/dist/extensibility.esm.js +12 -12
- package/dist/{faceCaptureManagerFactory-DTqP1t1a.esm.js → faceCaptureManagerFactory-3x7qaM76.esm.js} +3 -3
- package/dist/{faceCaptureManagerFactory-Cx-8SqRy.d.ts → faceCaptureManagerFactory-DMLstvui.d.ts} +35 -3
- package/dist/{faceCaptureSetup-DfetEHJm.esm.js → faceCaptureSetup-CJzsvv1I.esm.js} +10 -9
- package/dist/{feature-management-BjROP6fF.esm.js → feature-management-BG6sf4O4.esm.js} +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-iyH7fw8r.esm.js → flowCompletionService-BusrkMdp.esm.js} +1 -1
- package/dist/{flowServices-C8CBt9j3.esm.js → flowServices-pIc1cq8q.esm.js} +5 -5
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-DQ5tHq5k.esm.js → geolocationManager-BbgMboZ-.esm.js} +1 -1
- package/dist/{geolocationStateMachine-BfNIvTHA.esm.js → geolocationStateMachine-Bixn87pI.esm.js} +1 -1
- package/dist/id-selfie-flow.d.ts +1 -1
- package/dist/id-selfie-flow.esm.js +9 -10
- package/dist/id.d.ts +1 -1
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureDefaults-DCmwAxkz.esm.js → idCaptureDefaults-BmnsDgZZ.esm.js} +3 -3
- package/dist/{idCaptureManager-De7O0TOD.d.ts → idCaptureManager-BaHEyQyr.d.ts} +0 -1
- package/dist/{idCaptureManager-C4gJNe18.esm.js → idCaptureManager-BpdRLyqZ.esm.js} +5 -5
- package/dist/{idCaptureServices-CPh--aZR.esm.js → idCaptureServices-Di_APvz_.esm.js} +9 -8
- package/dist/{idCaptureStateMachine-Du4Q40uJ.esm.js → idCaptureStateMachine-hY-RpDH_.esm.js} +14 -14
- package/dist/identity-reuse.d.ts +1 -1
- package/dist/{identityReuseManager-v2TH5g7e.d.ts → identityReuseManager-BFDI7iFK.d.ts} +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/mandatory-consent.d.ts +1 -1
- package/dist/{mandatoryConsentManager-2O5wztkg.d.ts → mandatoryConsentManager-Csfl7_XQ.d.ts} +4 -4
- package/dist/{multipartRecordingService-DDAOXQKm.esm.js → multipartRecordingService-mwKFTlhR.esm.js} +730 -8
- package/dist/{permissionGuards-uYZYFu4J.esm.js → permissionGuards-D6TfVop2.esm.js} +1 -1
- package/dist/{permissionServices-Bj_fyWtv.esm.js → permissionServices-EY3_Vx6c.esm.js} +2 -2
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{runChildModule-CHjWYSMf.esm.js → runChildModule-kZQwHJ21.esm.js} +1 -1
- package/dist/{safeStorage-B-trhxg6.esm.js → safeStorage-BdU9_m2E.esm.js} +1 -1
- package/dist/{sdkVersion-DCLQtexS.esm.js → sdkVersion-KY79FtZx.esm.js} +1 -1
- package/dist/selfie.d.ts +2 -2
- package/dist/selfie.esm.js +7 -7
- package/dist/{selfieManager-ys-X4hkv.esm.js → selfieManager-Bjane9c3.esm.js} +4 -4
- package/dist/{selfieManager-jXqwqosi.d.ts → selfieManager-CDCTOrcg.d.ts} +1 -1
- package/dist/{selfieStateMachine-BhzbXmKN.esm.js → selfieStateMachine-OsbjyRR6.esm.js} +3 -3
- package/dist/{session-oKiwoHdR.esm.js → session-D4EAR74k.esm.js} +3 -3
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-DSf0jyab.esm.js → sessionInitializer-BqGb0lFN.esm.js} +3 -3
- package/dist/{setup-BttZ27hw.esm.js → setup-Cc6MzR5Q.esm.js} +7 -57
- package/dist/{setup-CLfBztP0.d.ts → setup-Cyko6cAn.d.ts} +4 -17
- package/dist/{trueSightService-C1JG8gAU.esm.js → trueSightService-Di5RGIls.esm.js} +16 -554
- package/dist/video-selfie.d.ts +61 -3
- package/dist/video-selfie.esm.js +60 -14
- package/dist/{videoSelfieCameraWarmer-BpaLtLvD.esm.js → videoSelfieCameraWarmer-PV8PLwmD.esm.js} +5 -5
- package/dist/{videoSelfieStepDetector-Co0Gu2k2.d.ts → videoSelfieStepDetector-CAqAG2G3.d.ts} +49 -0
- package/dist/{warmup-CUUnwYxe.esm.js → warmup-ChDwHSel.esm.js} +5 -0
- package/dist/wasm.d.ts +1 -1
- package/dist/wasm.esm.js +3 -3
- package/dist/{wasmDsFlagSync-B2e8p268.esm.js → wasmDsFlagSync-DYrLUEII.esm.js} +1 -1
- package/dist/workflow.d.ts +4 -4
- package/dist/workflow.esm.js +15 -15
- package/package.json +2 -7
- package/dist/FaceDetectionProvider-LdZ47bWy.d.ts +0 -36
- package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +0 -42
- package/dist/personhood.d.ts +0 -538
- package/dist/personhood.esm.js +0 -1574
- package/dist/types-BT_Oalip.d.ts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as setWebApiHttpTransport, f as deriveSiblingJsPath, i as initializeWasmWebClient, o as setupWasmConnection, p as WASM_MODEL_FILES, r as executeWasmRequest, t as WasmWebClientError, v as buildModelVariantSources } from "./wasmWebClient-B7baE-Wf.esm.js";
|
|
2
2
|
import { t as getTimestamp } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
|
|
3
3
|
import { i as isApiConfigured, n as getApi, o as setClient, r as getToken, t as api } from "./api-Bx3gKW_y.esm.js";
|
|
4
|
-
import {
|
|
5
|
-
import { t as SDK_VERSION } from "./sdkVersion-
|
|
4
|
+
import { n as eventModuleNames } from "./events-ijlbX_Wx.esm.js";
|
|
5
|
+
import { t as SDK_VERSION } from "./sdkVersion-KY79FtZx.esm.js";
|
|
6
6
|
import { t as endpoints } from "./endpoints-B-3Q-LUw.esm.js";
|
|
7
7
|
//#region ../infra/src/wasm/wasmDefaults.ts
|
|
8
8
|
const WASM_CDN_BASE_URL = "https://cdn.incodesmile.com/ml-wasm-kit-release";
|
|
@@ -688,8 +688,6 @@ async function withHandshakeFailureContext(wantsEncryption, fn) {
|
|
|
688
688
|
throw error;
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
/** Dirty-timer half of the interrupted-snapshot rebuild debounce (module boundaries + timer). */
|
|
692
|
-
const SNAPSHOT_DIRTY_INTERVAL_MS = 15e3;
|
|
693
691
|
/** Hard cap per log message, UTF-8 bytes (contract). */
|
|
694
692
|
const MESSAGE_MAX_BYTES = 8 * 1024;
|
|
695
693
|
const TRUESIGHT_SDK_ID = "IncdOnboarding";
|
|
@@ -770,92 +768,6 @@ function truncateUtf8(value, maxBytes) {
|
|
|
770
768
|
}
|
|
771
769
|
return result + TRUNCATION_SUFFIX;
|
|
772
770
|
}
|
|
773
|
-
const EVICTION_ORDER = [
|
|
774
|
-
"verbose",
|
|
775
|
-
"debug",
|
|
776
|
-
"info"
|
|
777
|
-
];
|
|
778
|
-
function createLogBuffer(options = {}) {
|
|
779
|
-
const flushThresholdBytes = options.flushThresholdBytes ?? 6e5;
|
|
780
|
-
const maxEntries = options.maxEntries ?? 5e3;
|
|
781
|
-
const { onOverflow } = options;
|
|
782
|
-
const entries = [];
|
|
783
|
-
let mode = onOverflow ? "flush" : "evict";
|
|
784
|
-
let nextIndex = 0;
|
|
785
|
-
let bytes = 0;
|
|
786
|
-
let dropped = 0;
|
|
787
|
-
let overflowPending = false;
|
|
788
|
-
function entryCost(entry) {
|
|
789
|
-
return utf8ByteLength(entry.message) + utf8ByteLength(entry.subsystem) + 120;
|
|
790
|
-
}
|
|
791
|
-
function removeAt(position) {
|
|
792
|
-
const [removed] = entries.splice(position, 1);
|
|
793
|
-
bytes -= entryCost(removed);
|
|
794
|
-
dropped += 1;
|
|
795
|
-
}
|
|
796
|
-
/** Lowest level first (oldest within it); warning+ only as the last resort. */
|
|
797
|
-
function evictOne() {
|
|
798
|
-
for (const level of EVICTION_ORDER) {
|
|
799
|
-
const position = entries.findIndex((entry) => entry.level === level);
|
|
800
|
-
if (position !== -1) {
|
|
801
|
-
removeAt(position);
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
removeAt(0);
|
|
806
|
-
}
|
|
807
|
-
function copyOf(entry) {
|
|
808
|
-
return { ...entry };
|
|
809
|
-
}
|
|
810
|
-
return {
|
|
811
|
-
append(level, subsystem, category, message) {
|
|
812
|
-
const entry = {
|
|
813
|
-
index: nextIndex,
|
|
814
|
-
timestampMs: getTimestamp(),
|
|
815
|
-
level,
|
|
816
|
-
subsystem,
|
|
817
|
-
category,
|
|
818
|
-
message: sanitizeMessage(message)
|
|
819
|
-
};
|
|
820
|
-
nextIndex += 1;
|
|
821
|
-
entries.push(entry);
|
|
822
|
-
bytes += entryCost(entry);
|
|
823
|
-
if (mode === "flush" && onOverflow) {
|
|
824
|
-
if (!overflowPending && bytes >= flushThresholdBytes) {
|
|
825
|
-
overflowPending = true;
|
|
826
|
-
onOverflow(entries.map(copyOf));
|
|
827
|
-
}
|
|
828
|
-
} else while (bytes > flushThresholdBytes && entries.length > 1) evictOne();
|
|
829
|
-
while (entries.length > maxEntries) evictOne();
|
|
830
|
-
},
|
|
831
|
-
snapshot() {
|
|
832
|
-
return entries.map(copyOf);
|
|
833
|
-
},
|
|
834
|
-
sliceSince(index) {
|
|
835
|
-
return entries.filter((entry) => entry.index > index).map(copyOf);
|
|
836
|
-
},
|
|
837
|
-
markFlushed(uptoIndex) {
|
|
838
|
-
let removedBytes = 0;
|
|
839
|
-
let keepFrom = 0;
|
|
840
|
-
while (keepFrom < entries.length && entries[keepFrom].index <= uptoIndex) {
|
|
841
|
-
removedBytes += entryCost(entries[keepFrom]);
|
|
842
|
-
keepFrom += 1;
|
|
843
|
-
}
|
|
844
|
-
entries.splice(0, keepFrom);
|
|
845
|
-
bytes -= removedBytes;
|
|
846
|
-
overflowPending = false;
|
|
847
|
-
},
|
|
848
|
-
setOverflowMode(next) {
|
|
849
|
-
mode = next;
|
|
850
|
-
},
|
|
851
|
-
get droppedCount() {
|
|
852
|
-
return dropped;
|
|
853
|
-
},
|
|
854
|
-
get byteEstimate() {
|
|
855
|
-
return bytes;
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
771
|
//#endregion
|
|
860
772
|
//#region ../infra/src/crypto/randomUUID.ts
|
|
861
773
|
/**
|
|
@@ -972,14 +884,6 @@ function toContractEntry(entry) {
|
|
|
972
884
|
category: entry.category
|
|
973
885
|
};
|
|
974
886
|
}
|
|
975
|
-
//#endregion
|
|
976
|
-
//#region src/internal/trueSight/sessionMetadata.ts
|
|
977
|
-
/**
|
|
978
|
-
* Hosts that match this pattern are non-prod by heuristic. Known failure modes
|
|
979
|
-
* (customer CNAMEs, devMode left on in prod) are documented for the planned
|
|
980
|
-
* P1 team review — see plan §Operating decisions (B6).
|
|
981
|
-
*/
|
|
982
|
-
const NON_PROD_HOST_PATTERN = /stage|demo|saas-dev|localhost/i;
|
|
983
887
|
function createInitialState() {
|
|
984
888
|
return {
|
|
985
889
|
sessionId: null,
|
|
@@ -1003,67 +907,16 @@ function createInitialState() {
|
|
|
1003
907
|
}
|
|
1004
908
|
let state = createInitialState();
|
|
1005
909
|
let sources = {};
|
|
1006
|
-
function stampStartedAtOnce() {
|
|
1007
|
-
if (state.startedAtMs === null) state.startedAtMs = getTimestamp();
|
|
1008
|
-
}
|
|
1009
910
|
/** Tap for `createSession` — sessionId comes from the returned `interviewId`. */
|
|
1010
|
-
function noteSessionCreated(session, options = {}) {
|
|
1011
|
-
|
|
1012
|
-
stampStartedAtOnce();
|
|
1013
|
-
state.sdkLanguage = options.language ?? state.sdkLanguage;
|
|
1014
|
-
state.hasConfigurationId = state.hasConfigurationId || options.configurationId !== void 0;
|
|
1015
|
-
state.hasExternalCustomerId = state.hasExternalCustomerId || options.externalCustomerId !== void 0;
|
|
1016
|
-
state.hasProvidedSessionId = state.hasProvidedSessionId || options.interviewId !== void 0;
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* Fallback sessionId for host-minted-token integrations that never called
|
|
1020
|
-
* `createSession`: `Features.sessionIdentifier` — used only when no
|
|
1021
|
-
* `interviewId` was observed.
|
|
1022
|
-
*/
|
|
1023
|
-
function noteFeatureConfig(features) {
|
|
1024
|
-
if (!state.sessionId && features.sessionIdentifier) {
|
|
1025
|
-
state.sessionId = features.sessionIdentifier;
|
|
1026
|
-
stampStartedAtOnce();
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* Entry-surface discriminator. `startOnboardingSection` is the default (weakest
|
|
1031
|
-
* signal — standalone module managers); richer surfaces upgrade it and are never
|
|
1032
|
-
* downgraded back.
|
|
1033
|
-
*/
|
|
1034
|
-
function noteIntegrationSurface(integrationType) {
|
|
1035
|
-
if (integrationType === "startOnboardingSection") return;
|
|
1036
|
-
state.integrationType = integrationType;
|
|
1037
|
-
}
|
|
1038
|
-
function noteEnvironment(environment) {
|
|
1039
|
-
state.browser = environment.browser ?? state.browser;
|
|
1040
|
-
state.osVersion = environment.osVersion ?? state.osVersion;
|
|
1041
|
-
state.osLanguage = environment.osLanguage ?? state.osLanguage;
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* WRITE-ONCE orchestrator identity (determinism guarantee for debugging):
|
|
1045
|
-
* a session is a flow or a workflow from its first orchestrator observation
|
|
1046
|
-
* and can never flip mid-session — a record labeled `flow` must always point
|
|
1047
|
-
* at a real flow. First non-null value wins for each of flowType/flowId/
|
|
1048
|
-
* workflowId; later calls are ignored (the service logs a self-health line
|
|
1049
|
-
* when a CONFLICTING orchestrator kind shows up).
|
|
1050
|
-
*/
|
|
1051
|
-
function noteFlowContext(context) {
|
|
1052
|
-
state.flowType = state.flowType ?? context.flowType;
|
|
1053
|
-
state.flowId = state.flowId ?? context.flowId ?? null;
|
|
1054
|
-
state.workflowId = state.workflowId ?? context.workflowId ?? null;
|
|
1055
|
-
}
|
|
911
|
+
function noteSessionCreated(session, options = {}) {}
|
|
912
|
+
function noteEnvironment(environment) {}
|
|
1056
913
|
/**
|
|
1057
914
|
* `testing` heuristic: devMode OR non-prod API host pattern. Always a boolean —
|
|
1058
915
|
* the contract requires the field present on every record. Signals MERGE across
|
|
1059
916
|
* calls (a later apiUrl-only call must not erase an earlier devMode signal);
|
|
1060
917
|
* `testing` is recomputed from the merged pair.
|
|
1061
918
|
*/
|
|
1062
|
-
function noteTestingSignals(signals) {
|
|
1063
|
-
state.devModeSignal = signals.devMode ?? state.devModeSignal;
|
|
1064
|
-
state.apiUrlSignal = signals.apiUrl ?? state.apiUrlSignal;
|
|
1065
|
-
state.testing = state.devModeSignal === true || state.apiUrlSignal !== void 0 && NON_PROD_HOST_PATTERN.test(state.apiUrlSignal);
|
|
1066
|
-
}
|
|
919
|
+
function noteTestingSignals(signals) {}
|
|
1067
920
|
/**
|
|
1068
921
|
* Live read of the merged testing signal (devMode OR non-prod host). Used to
|
|
1069
922
|
* gate host-console self-health noise so production host pages stay quiet while
|
|
@@ -1074,25 +927,12 @@ function isTrueSightTesting() {
|
|
|
1074
927
|
return state.testing;
|
|
1075
928
|
}
|
|
1076
929
|
/**
|
|
1077
|
-
* Tap for `initializeSession({ token })` with a host-minted token — records
|
|
1078
|
-
* only the presence fact ("this token came from outside the SDK"), never the
|
|
1079
|
-
* token itself.
|
|
1080
|
-
*/
|
|
1081
|
-
function noteExternalTokenProvided() {
|
|
1082
|
-
state.hasExternalToken = true;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
930
|
* Wiring tap for every `initializeSession({ token })`: a token activated
|
|
1086
931
|
* before any `createSession` was observed on this page is host-minted, i.e.
|
|
1087
932
|
* external. (The exact `token`/`externalToken` web-semantics are a pending
|
|
1088
933
|
* Phase 0 contract ask — this inference is the interim mapping.)
|
|
1089
934
|
*/
|
|
1090
|
-
function noteTokenActivated() {
|
|
1091
|
-
if (state.sessionId === null) noteExternalTokenProvided();
|
|
1092
|
-
}
|
|
1093
|
-
function configureTrueSightMetadataSources(next) {
|
|
1094
|
-
sources = next;
|
|
1095
|
-
}
|
|
935
|
+
function noteTokenActivated() {}
|
|
1096
936
|
/** Explicit literal — the metadata half handed to the record builder. */
|
|
1097
937
|
function buildSessionMetadata() {
|
|
1098
938
|
return {
|
|
@@ -1267,100 +1107,10 @@ async function fetchFeatureConfig(signal) {
|
|
|
1267
1107
|
function resetFeatureConfigCache() {
|
|
1268
1108
|
cachedFeatures = null;
|
|
1269
1109
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
* lowercase dotted string per SDK area. The raw `eventModuleNames` wire
|
|
1275
|
-
* values are inconsistent (`SELFIE`, `datasharingconsent`, `AdSign`…), four
|
|
1276
|
-
* keys collapse into `ID`, and `workflow` doubles as a module name — this
|
|
1277
|
-
* table is the single normalization point, snapshot-frozen in tests so the
|
|
1278
|
-
* dashboard facet stays bounded (~70 strings) forever.
|
|
1279
|
-
*/
|
|
1280
|
-
const MODULE_SUBSYSTEMS = {
|
|
1281
|
-
[eventModuleNames.selfie]: "module.selfie",
|
|
1282
|
-
[eventModuleNames.faceCapture]: "module.face-capture",
|
|
1283
|
-
[eventModuleNames.authentication]: "module.authentication",
|
|
1284
|
-
[eventModuleNames.authFace]: "module.auth-face",
|
|
1285
|
-
[eventModuleNames.mlConsent]: "module.ml-consent",
|
|
1286
|
-
[eventModuleNames.combinedConsent]: "module.combined-consent",
|
|
1287
|
-
[eventModuleNames.curpValidation]: "module.curp",
|
|
1288
|
-
[eventModuleNames.faceMatch]: "module.face-match",
|
|
1289
|
-
[eventModuleNames.qr]: "module.qr",
|
|
1290
|
-
[eventModuleNames.videoSelfie]: "module.video-selfie",
|
|
1291
|
-
[eventModuleNames.id]: "module.id",
|
|
1292
|
-
[eventModuleNames.idCapture]: "module.id-capture",
|
|
1293
|
-
[eventModuleNames.idVerification]: "module.id-verification",
|
|
1294
|
-
[eventModuleNames.idOcr]: "module.id-ocr",
|
|
1295
|
-
[eventModuleNames.document]: "module.document-capture",
|
|
1296
|
-
[eventModuleNames.creditCard]: "module.credit-card-front",
|
|
1297
|
-
[eventModuleNames.creditCardBack]: "module.credit-card-back",
|
|
1298
|
-
[eventModuleNames.conference]: "module.conference",
|
|
1299
|
-
[eventModuleNames.otp]: "module.otp",
|
|
1300
|
-
[eventModuleNames.signature]: "module.e-sign",
|
|
1301
|
-
[eventModuleNames.ekyc]: "module.e-kyc",
|
|
1302
|
-
[eventModuleNames.watchlist]: "module.watchlist",
|
|
1303
|
-
[eventModuleNames.globalWatchList]: "module.global-watchlist",
|
|
1304
|
-
[eventModuleNames.customWatchList]: "module.custom-watchlist",
|
|
1305
|
-
[eventModuleNames.email]: "module.email",
|
|
1306
|
-
[eventModuleNames.phone]: "module.phone-number",
|
|
1307
|
-
[eventModuleNames.instantVerifyEmail]: "module.instant-verify-email",
|
|
1308
|
-
[eventModuleNames.instantVerifyConsent]: "module.instant-verify-consent",
|
|
1309
|
-
[eventModuleNames.forms]: "module.forms",
|
|
1310
|
-
[eventModuleNames.customModule]: "module.custom-module",
|
|
1311
|
-
[eventModuleNames.geolocation]: "module.geolocation",
|
|
1312
|
-
[eventModuleNames.ekyb]: "module.e-kyb",
|
|
1313
|
-
[eventModuleNames.identityReuse]: "module.identity-reuse",
|
|
1314
|
-
[eventModuleNames.antifraud]: "module.antifraud",
|
|
1315
|
-
[eventModuleNames.aeSignature]: "module.ae-signature",
|
|
1316
|
-
[eventModuleNames.qeSignature]: "module.qe-signature",
|
|
1317
|
-
[eventModuleNames.crossDocumentDataMatch]: "module.cross-document-data-match",
|
|
1318
|
-
[eventModuleNames.customFields]: "module.custom-fields",
|
|
1319
|
-
[eventModuleNames.fieldComparison]: "module.field-comparison",
|
|
1320
|
-
[eventModuleNames.personhood]: "module.personhood",
|
|
1321
|
-
[eventModuleNames.watchlistForBusiness]: "module.watchlist-for-business",
|
|
1322
|
-
[eventModuleNames.trustGraph]: "module.trust-graph",
|
|
1323
|
-
[eventModuleNames.certificateIssuance]: "module.certificate-issuance",
|
|
1324
|
-
[eventModuleNames.governmentValidation]: "module.government-validation",
|
|
1325
|
-
[eventModuleNames.documentUpload]: "module.document-upload",
|
|
1326
|
-
[eventModuleNames.home]: "module.home",
|
|
1327
|
-
[eventModuleNames.workflow]: "module.workflow",
|
|
1328
|
-
[eventModuleNames.fiscalQr]: "module.fiscal-qr"
|
|
1329
|
-
};
|
|
1330
|
-
const CUSTOM_SUBSYSTEM_MAX_CHARS = 40;
|
|
1331
|
-
/**
|
|
1332
|
-
* Canonical `module.<kebab>` for a raw wire module name. Unknown/integrator-
|
|
1333
|
-
* custom names get a sanitized lowercase fallback (capped) — custom SDK 2
|
|
1334
|
-
* integrations get real per-module detail, not a lumped `other`.
|
|
1335
|
-
*/
|
|
1336
|
-
function normalizeSubsystem(rawModule) {
|
|
1337
|
-
if (rawModule === void 0) return "module.unknown";
|
|
1338
|
-
const canonical = MODULE_SUBSYSTEMS[rawModule];
|
|
1339
|
-
if (canonical !== void 0) return canonical;
|
|
1340
|
-
const sanitized = rawModule.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, CUSTOM_SUBSYSTEM_MAX_CHARS).replace(/-+$/g, "");
|
|
1341
|
-
return `module.${sanitized === "" ? "unknown" : sanitized}`;
|
|
1342
|
-
}
|
|
1343
|
-
const ID_SCAN_MODULES = /* @__PURE__ */ new Set([
|
|
1344
|
-
eventModuleNames.id,
|
|
1345
|
-
eventModuleNames.idCapture,
|
|
1346
|
-
eventModuleNames.idVerification,
|
|
1347
|
-
eventModuleNames.idOcr,
|
|
1348
|
-
eventModuleNames.document,
|
|
1349
|
-
eventModuleNames.documentUpload,
|
|
1350
|
-
eventModuleNames.creditCard,
|
|
1351
|
-
eventModuleNames.creditCardBack,
|
|
1352
|
-
eventModuleNames.curpValidation
|
|
1353
|
-
]);
|
|
1354
|
-
const FACE_SCAN_MODULES = /* @__PURE__ */ new Set([
|
|
1355
|
-
eventModuleNames.selfie,
|
|
1356
|
-
eventModuleNames.faceCapture,
|
|
1357
|
-
eventModuleNames.authentication,
|
|
1358
|
-
eventModuleNames.authFace,
|
|
1359
|
-
eventModuleNames.faceMatch,
|
|
1360
|
-
eventModuleNames.videoSelfie,
|
|
1361
|
-
eventModuleNames.personhood
|
|
1362
|
-
]);
|
|
1363
|
-
const ORCHESTRATION_MODULES = /* @__PURE__ */ new Set([eventModuleNames.home, eventModuleNames.workflow]);
|
|
1110
|
+
eventModuleNames.selfie, eventModuleNames.faceCapture, eventModuleNames.authentication, eventModuleNames.authFace, eventModuleNames.mlConsent, eventModuleNames.combinedConsent, eventModuleNames.curpValidation, eventModuleNames.faceMatch, eventModuleNames.qr, eventModuleNames.videoSelfie, eventModuleNames.id, eventModuleNames.idCapture, eventModuleNames.idVerification, eventModuleNames.idOcr, eventModuleNames.document, eventModuleNames.creditCard, eventModuleNames.creditCardBack, eventModuleNames.conference, eventModuleNames.otp, eventModuleNames.signature, eventModuleNames.ekyc, eventModuleNames.watchlist, eventModuleNames.globalWatchList, eventModuleNames.customWatchList, eventModuleNames.email, eventModuleNames.phone, eventModuleNames.instantVerifyEmail, eventModuleNames.instantVerifyConsent, eventModuleNames.forms, eventModuleNames.customModule, eventModuleNames.geolocation, eventModuleNames.ekyb, eventModuleNames.identityReuse, eventModuleNames.antifraud, eventModuleNames.aeSignature, eventModuleNames.qeSignature, eventModuleNames.crossDocumentDataMatch, eventModuleNames.customFields, eventModuleNames.fieldComparison, eventModuleNames.personhood, eventModuleNames.watchlistForBusiness, eventModuleNames.trustGraph, eventModuleNames.certificateIssuance, eventModuleNames.governmentValidation, eventModuleNames.documentUpload, eventModuleNames.home, eventModuleNames.workflow, eventModuleNames.fiscalQr;
|
|
1111
|
+
eventModuleNames.id, eventModuleNames.idCapture, eventModuleNames.idVerification, eventModuleNames.idOcr, eventModuleNames.document, eventModuleNames.documentUpload, eventModuleNames.creditCard, eventModuleNames.creditCardBack, eventModuleNames.curpValidation;
|
|
1112
|
+
eventModuleNames.selfie, eventModuleNames.faceCapture, eventModuleNames.authentication, eventModuleNames.authFace, eventModuleNames.faceMatch, eventModuleNames.videoSelfie, eventModuleNames.personhood;
|
|
1113
|
+
eventModuleNames.home, eventModuleNames.workflow;
|
|
1364
1114
|
/**
|
|
1365
1115
|
* Coarse category for HTTP-failure entries, from the endpoint path (event
|
|
1366
1116
|
* map row 23: "by endpoint"). A conservative token heuristic — the category
|
|
@@ -1373,101 +1123,6 @@ function categoryForEndpoint(endpoint) {
|
|
|
1373
1123
|
if (/start|flow|workflow|feature-config|onboarding|finish-status/.test(endpoint)) return "orchestration";
|
|
1374
1124
|
return "other";
|
|
1375
1125
|
}
|
|
1376
|
-
/** Coarse contract category from the RAW `event.module` value (plan rule). */
|
|
1377
|
-
function categoryForModule(rawModule) {
|
|
1378
|
-
if (rawModule === void 0) return "other";
|
|
1379
|
-
if (ID_SCAN_MODULES.has(rawModule)) return "idScan";
|
|
1380
|
-
if (FACE_SCAN_MODULES.has(rawModule)) return "faceScan";
|
|
1381
|
-
if (ORCHESTRATION_MODULES.has(rawModule)) return "orchestration";
|
|
1382
|
-
return "other";
|
|
1383
|
-
}
|
|
1384
|
-
/** `verb key=value` line: undefined values drop their pair entirely. */
|
|
1385
|
-
function formatLine(verb, pairs = []) {
|
|
1386
|
-
const parts = [verb];
|
|
1387
|
-
for (const [key, value] of pairs) if (value !== void 0 && value !== null && value !== "") parts.push(`${key}=${String(value)}`);
|
|
1388
|
-
return parts.join(" ");
|
|
1389
|
-
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Analytics event → contract log tuple, or `null` for codes the taxonomy
|
|
1392
|
-
* does not cover (deny-by-default: nothing rides into the record unreviewed).
|
|
1393
|
-
* Levels/subsystems/categories per the plan's event map rows 5–6 and 16–20.
|
|
1394
|
-
*/
|
|
1395
|
-
function mapAnalyticsEventToLog(event) {
|
|
1396
|
-
const payload = event.payload ?? {};
|
|
1397
|
-
const subsystem = normalizeSubsystem(event.module);
|
|
1398
|
-
const category = categoryForModule(event.module);
|
|
1399
|
-
switch (event.code) {
|
|
1400
|
-
case "moduleOpened":
|
|
1401
|
-
case "moduleClosed": return {
|
|
1402
|
-
level: "info",
|
|
1403
|
-
subsystem,
|
|
1404
|
-
category,
|
|
1405
|
-
message: formatLine(event.code === "moduleOpened" ? "module opened" : "module closed", [["screen", event.screen]])
|
|
1406
|
-
};
|
|
1407
|
-
case "screenOpened":
|
|
1408
|
-
case "screenClosed": return {
|
|
1409
|
-
level: "debug",
|
|
1410
|
-
subsystem,
|
|
1411
|
-
category,
|
|
1412
|
-
message: formatLine(event.code === "screenOpened" ? "screen opened" : "screen closed", [["screen", event.screen]])
|
|
1413
|
-
};
|
|
1414
|
-
case "errorTriggered": return {
|
|
1415
|
-
level: "error",
|
|
1416
|
-
subsystem,
|
|
1417
|
-
category,
|
|
1418
|
-
message: formatLine("errorTriggered", [
|
|
1419
|
-
["errorName", stringOrUndefined(payload.errorName) ?? "unknown"],
|
|
1420
|
-
["errorCode", stringOrUndefined(payload.errorCode)],
|
|
1421
|
-
["reason", stringOrUndefined(payload.reason)]
|
|
1422
|
-
])
|
|
1423
|
-
};
|
|
1424
|
-
case "captureAttemptFinished": return {
|
|
1425
|
-
level: "debug",
|
|
1426
|
-
subsystem,
|
|
1427
|
-
category,
|
|
1428
|
-
message: formatLine("capture attempt finished", [["logs", stringOrUndefined(payload.logs)]])
|
|
1429
|
-
};
|
|
1430
|
-
case "background":
|
|
1431
|
-
case "foreground": return {
|
|
1432
|
-
level: "debug",
|
|
1433
|
-
subsystem,
|
|
1434
|
-
category,
|
|
1435
|
-
message: `visibility ${event.code}`
|
|
1436
|
-
};
|
|
1437
|
-
case "elementClicked": return {
|
|
1438
|
-
level: "debug",
|
|
1439
|
-
subsystem,
|
|
1440
|
-
category,
|
|
1441
|
-
message: formatLine("element clicked", [["element", stringOrUndefined(payload.element)], ["action", stringOrUndefined(payload.action)]])
|
|
1442
|
-
};
|
|
1443
|
-
case "browser": {
|
|
1444
|
-
const browser = nameVersion(payload.browser);
|
|
1445
|
-
const os = nameVersion(payload.os);
|
|
1446
|
-
const device = typeof payload.device === "object" && payload.device !== null ? stringOrUndefined(payload.device.type) : void 0;
|
|
1447
|
-
return {
|
|
1448
|
-
level: "info",
|
|
1449
|
-
subsystem: "session",
|
|
1450
|
-
category: "other",
|
|
1451
|
-
message: formatLine("browser info", [
|
|
1452
|
-
["browser", browser],
|
|
1453
|
-
["os", os],
|
|
1454
|
-
["device", device],
|
|
1455
|
-
["webrtc", typeof payload.isWebRtcSupported === "boolean" ? payload.isWebRtcSupported : void 0]
|
|
1456
|
-
])
|
|
1457
|
-
};
|
|
1458
|
-
}
|
|
1459
|
-
default: return null;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
function stringOrUndefined(value) {
|
|
1463
|
-
return typeof value === "string" ? value : void 0;
|
|
1464
|
-
}
|
|
1465
|
-
function nameVersion(value) {
|
|
1466
|
-
if (typeof value !== "object" || value === null) return;
|
|
1467
|
-
const { name, version } = value;
|
|
1468
|
-
const joined = [name, version].filter((part) => typeof part === "string" && part !== "").join(" ");
|
|
1469
|
-
return joined === "" ? void 0 : joined;
|
|
1470
|
-
}
|
|
1471
1126
|
//#endregion
|
|
1472
1127
|
//#region src/internal/trueSight/uploader.ts
|
|
1473
1128
|
let cryptoProviderPromise = null;
|
|
@@ -1477,7 +1132,7 @@ let cryptoProviderPromise = null;
|
|
|
1477
1132
|
* the service's prewarm).
|
|
1478
1133
|
*/
|
|
1479
1134
|
function loadDiagnosticsCryptoProvider() {
|
|
1480
|
-
cryptoProviderPromise ??= import("./BrowserDiagnosticsCryptoProvider-
|
|
1135
|
+
cryptoProviderPromise ??= import("./BrowserDiagnosticsCryptoProvider-BuzqvbhN.esm.js").then((module) => new module.BrowserDiagnosticsCryptoProvider());
|
|
1481
1136
|
return cryptoProviderPromise;
|
|
1482
1137
|
}
|
|
1483
1138
|
/**
|
|
@@ -1486,35 +1141,7 @@ function loadDiagnosticsCryptoProvider() {
|
|
|
1486
1141
|
* rebuild ONCE with the oldest half of the logs dropped; still over → drop
|
|
1487
1142
|
* the upload entirely rather than send an invalid envelope.
|
|
1488
1143
|
*/
|
|
1489
|
-
async function uploadDiagnostics(record, options) {
|
|
1490
|
-
const warn = options.warn ?? defaultWarn;
|
|
1491
|
-
try {
|
|
1492
|
-
const sealer = await (options.loadCrypto ?? loadDiagnosticsCryptoProvider)();
|
|
1493
|
-
let envelope = await sealer.seal(JSON.stringify(record));
|
|
1494
|
-
let envelopeBytes = utf8ByteLength(JSON.stringify(envelope));
|
|
1495
|
-
if (envelopeBytes > 1e6) {
|
|
1496
|
-
const trimmed = {
|
|
1497
|
-
...record,
|
|
1498
|
-
logs: record.logs.slice(Math.floor(record.logs.length / 2))
|
|
1499
|
-
};
|
|
1500
|
-
warn(`[TrueSight] envelope ${envelopeBytes}B over the 1MB cap — rebuilt with the oldest ${record.logs.length - trimmed.logs.length} logs dropped`);
|
|
1501
|
-
envelope = await sealer.seal(JSON.stringify(trimmed));
|
|
1502
|
-
envelopeBytes = utf8ByteLength(JSON.stringify(envelope));
|
|
1503
|
-
if (envelopeBytes > 1e6) {
|
|
1504
|
-
warn("[TrueSight] envelope still over the cap after trim — upload dropped");
|
|
1505
|
-
return;
|
|
1506
|
-
}
|
|
1507
|
-
} else if (envelopeBytes > 9e5) warn(`[TrueSight] envelope ${envelopeBytes}B is approaching the 1MB cap`);
|
|
1508
|
-
const keepalive = options.keepalive === true && envelopeBytes <= 6e4;
|
|
1509
|
-
if (isForwardedFalse((await options.post(endpoints.diagnosticsData, envelope, keepalive ? { keepalive: true } : {})).data)) warn("[TrueSight] proxy accepted the record but did not forward it (forwarded:false)");
|
|
1510
|
-
} catch (error) {
|
|
1511
|
-
warn(`[TrueSight] diagnostics upload failed (no retry): ${String(error)}`);
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
function isForwardedFalse(data) {
|
|
1515
|
-
return typeof data === "object" && data !== null && "forwarded" in data && data.forwarded === false;
|
|
1516
|
-
}
|
|
1517
|
-
function defaultWarn() {}
|
|
1144
|
+
async function uploadDiagnostics(record, options) {}
|
|
1518
1145
|
//#endregion
|
|
1519
1146
|
//#region src/internal/trueSight/trueSightService.ts
|
|
1520
1147
|
let active = false;
|
|
@@ -1531,21 +1158,15 @@ let options = defaultOptions();
|
|
|
1531
1158
|
let observedManagerKind = null;
|
|
1532
1159
|
let orchestratorConflictLogged = false;
|
|
1533
1160
|
let snapshotRecordId = null;
|
|
1534
|
-
let cachedPendingEnvelope = null;
|
|
1535
1161
|
let snapshotDirty = false;
|
|
1536
1162
|
let captureActive = false;
|
|
1537
1163
|
let rebuildInFlight = false;
|
|
1538
1164
|
let sealFailureLogged = false;
|
|
1539
1165
|
let pendingSlotRegistered = false;
|
|
1540
1166
|
let recoveryStarted = false;
|
|
1541
|
-
let bridgeFailureCount = 0;
|
|
1542
|
-
let envSnapshotLogged = false;
|
|
1543
1167
|
let hintTransitionCount = 0;
|
|
1544
1168
|
let hintSuppressedCount = 0;
|
|
1545
1169
|
let lastHintStatus = null;
|
|
1546
|
-
let overflowBatchCount = 0;
|
|
1547
|
-
let lastFlushRecordId = null;
|
|
1548
|
-
let overflowDormant = false;
|
|
1549
1170
|
let overflowFlushInFlightUpTo = null;
|
|
1550
1171
|
let dirtyTimerHandle = null;
|
|
1551
1172
|
let unsubscribePageHide = null;
|
|
@@ -1563,25 +1184,7 @@ function defaultOptions() {
|
|
|
1563
1184
|
* encryption lock); `reset()` → `resetTrueSight()` starts a new one.
|
|
1564
1185
|
* `enabled:false` is a no-op by design: zero subscriptions, zero state.
|
|
1565
1186
|
*/
|
|
1566
|
-
function initializeTrueSightDiagnostics(serviceOptions) {
|
|
1567
|
-
if (!serviceOptions.enabled || active) return;
|
|
1568
|
-
active = true;
|
|
1569
|
-
options = {
|
|
1570
|
-
...defaultOptions(),
|
|
1571
|
-
...pickDefined(serviceOptions)
|
|
1572
|
-
};
|
|
1573
|
-
buffer = createLogBuffer({ onOverflow: handleBufferOverflow });
|
|
1574
|
-
configureTrueSightMetadataSources({
|
|
1575
|
-
getHasToken: () => getToken() !== null,
|
|
1576
|
-
getE2eEncryptionEnabled: isHttpEncrypted
|
|
1577
|
-
});
|
|
1578
|
-
unsubscribeEvents = subscribeEvent(handleAnalyticsEvent);
|
|
1579
|
-
trueSightLog("debug", "diagnostics", "other", "diagnostics initialized");
|
|
1580
|
-
if (options.pageLifecycle && options.storage) unsubscribePageHide = options.pageLifecycle.onPageHide(handlePageHide);
|
|
1581
|
-
if (options.timer && options.storage) dirtyTimerHandle = options.timer.setInterval(() => {
|
|
1582
|
-
maybeRebuildSnapshot();
|
|
1583
|
-
}, SNAPSHOT_DIRTY_INTERVAL_MS);
|
|
1584
|
-
}
|
|
1187
|
+
function initializeTrueSightDiagnostics(serviceOptions) {}
|
|
1585
1188
|
/**
|
|
1586
1189
|
* Session-time entry, called from `initializeSession` once feature config is
|
|
1587
1190
|
* known. Collection is already running by then (buffering starts at
|
|
@@ -1596,7 +1199,6 @@ function startTrueSightCollection(features) {
|
|
|
1596
1199
|
prewarmCrypto();
|
|
1597
1200
|
}
|
|
1598
1201
|
if (features) {
|
|
1599
|
-
noteFeatureConfig(features);
|
|
1600
1202
|
if (!flagResolutionStarted) {
|
|
1601
1203
|
flagResolutionStarted = true;
|
|
1602
1204
|
applyFeatureResolution(features, false);
|
|
@@ -1604,7 +1206,6 @@ function startTrueSightCollection(features) {
|
|
|
1604
1206
|
} else if (!flagResolutionStarted) {
|
|
1605
1207
|
flagResolutionStarted = true;
|
|
1606
1208
|
options.fetchFeatures().then((fetched) => {
|
|
1607
|
-
noteFeatureConfig(fetched);
|
|
1608
1209
|
applyFeatureResolution(fetched, false);
|
|
1609
1210
|
}, () => {
|
|
1610
1211
|
applyFeatureResolution(null, true);
|
|
@@ -1617,10 +1218,7 @@ function startTrueSightCollection(features) {
|
|
|
1617
1218
|
* snapshot rebuilds are suppressed — the collector must never compete with
|
|
1618
1219
|
* 30 fps capture. Deactivation flushes the deferred rebuild.
|
|
1619
1220
|
*/
|
|
1620
|
-
function noteTrueSightCaptureActivity(activityActive) {
|
|
1621
|
-
captureActive = activityActive;
|
|
1622
|
-
if (!activityActive) maybeRebuildSnapshot();
|
|
1623
|
-
}
|
|
1221
|
+
function noteTrueSightCaptureActivity(activityActive) {}
|
|
1624
1222
|
/**
|
|
1625
1223
|
* Seals and uploads the one final record per session. The upload-relevant
|
|
1626
1224
|
* state — transport, metadata (live token/E2EE getters read NOW), buffered
|
|
@@ -1638,7 +1236,6 @@ function finalizeTrueSight(outcome, failureReason) {
|
|
|
1638
1236
|
if (transport === null || cryptoUnsupported) return Promise.resolve();
|
|
1639
1237
|
const record = buildDiagnosticsRecord(metadata, logs, outcome, failureReason);
|
|
1640
1238
|
if (record === null) return Promise.resolve();
|
|
1641
|
-
cachedPendingEnvelope = null;
|
|
1642
1239
|
if (options.storage && metadata.sessionId) clearPending(metadata.sessionId, { storage: options.storage });
|
|
1643
1240
|
return options.upload(record, {
|
|
1644
1241
|
post: transport,
|
|
@@ -1670,12 +1267,6 @@ function trueSightHintTransition(subsystem, category, status) {
|
|
|
1670
1267
|
}
|
|
1671
1268
|
trueSightLog("debug", subsystem, category, `hint changed status=${status}`);
|
|
1672
1269
|
}
|
|
1673
|
-
function resetHintBudget() {
|
|
1674
|
-
if (hintSuppressedCount > 0) trueSightLog("debug", "diagnostics", "other", `hint transitions suppressed count=${hintSuppressedCount}`);
|
|
1675
|
-
hintTransitionCount = 0;
|
|
1676
|
-
hintSuppressedCount = 0;
|
|
1677
|
-
lastHintStatus = null;
|
|
1678
|
-
}
|
|
1679
1270
|
/** Buffer tap for wiring points and self-health lines. No-op when inactive. */
|
|
1680
1271
|
function trueSightLog(level, subsystem, category, message) {
|
|
1681
1272
|
if (buffer === null) return;
|
|
@@ -1698,11 +1289,7 @@ function notifyTrueSightFlowEvent(event, managerKind) {
|
|
|
1698
1289
|
trueSightLog("info", managerKind, "orchestration", "flow.started");
|
|
1699
1290
|
break;
|
|
1700
1291
|
case "flow.ready":
|
|
1701
|
-
if (identityAccepted)
|
|
1702
|
-
flowType: managerKind,
|
|
1703
|
-
flowId: managerKind === "flow" ? event.flowId ?? null : null,
|
|
1704
|
-
workflowId: managerKind === "workflow" ? event.flowId ?? null : null
|
|
1705
|
-
});
|
|
1292
|
+
if (identityAccepted) managerKind === "flow" && event.flowId, managerKind === "workflow" && event.flowId;
|
|
1706
1293
|
trueSightLog("info", managerKind, "orchestration", `flow.ready ${managerKind === "workflow" ? "workflowId" : "flowId"}=${event.flowId ?? "unknown"}`);
|
|
1707
1294
|
break;
|
|
1708
1295
|
case "flow.module.started":
|
|
@@ -1760,8 +1347,6 @@ function stampOrchestratorIdentity(managerKind) {
|
|
|
1760
1347
|
}
|
|
1761
1348
|
return false;
|
|
1762
1349
|
}
|
|
1763
|
-
noteIntegrationSurface(managerKind === "workflow" ? "startWorkflow" : "startFlow");
|
|
1764
|
-
noteFlowContext({ flowType: managerKind });
|
|
1765
1350
|
return true;
|
|
1766
1351
|
}
|
|
1767
1352
|
/** Full teardown, called from `reset()` AFTER finalize captured its snapshot. */
|
|
@@ -1785,51 +1370,19 @@ function resetTrueSight() {
|
|
|
1785
1370
|
observedManagerKind = null;
|
|
1786
1371
|
orchestratorConflictLogged = false;
|
|
1787
1372
|
snapshotRecordId = null;
|
|
1788
|
-
cachedPendingEnvelope = null;
|
|
1789
1373
|
snapshotDirty = false;
|
|
1790
1374
|
captureActive = false;
|
|
1791
1375
|
rebuildInFlight = false;
|
|
1792
1376
|
sealFailureLogged = false;
|
|
1793
1377
|
pendingSlotRegistered = false;
|
|
1794
1378
|
recoveryStarted = false;
|
|
1795
|
-
bridgeFailureCount = 0;
|
|
1796
|
-
envSnapshotLogged = false;
|
|
1797
1379
|
hintTransitionCount = 0;
|
|
1798
1380
|
hintSuppressedCount = 0;
|
|
1799
1381
|
lastHintStatus = null;
|
|
1800
|
-
overflowBatchCount = 0;
|
|
1801
|
-
lastFlushRecordId = null;
|
|
1802
|
-
overflowDormant = false;
|
|
1803
1382
|
overflowFlushInFlightUpTo = null;
|
|
1804
1383
|
options = defaultOptions();
|
|
1805
1384
|
resetTrueSightMetadata();
|
|
1806
1385
|
}
|
|
1807
|
-
function handleAnalyticsEvent(event) {
|
|
1808
|
-
if (finalized) return;
|
|
1809
|
-
try {
|
|
1810
|
-
const mapped = mapAnalyticsEventToLog(event);
|
|
1811
|
-
if (mapped === null) return;
|
|
1812
|
-
trueSightLog(mapped.level, mapped.subsystem, mapped.category, mapped.message);
|
|
1813
|
-
if (mapped.level === "error" || mapped.level === "severe") logEnvironmentSnapshotOnce();
|
|
1814
|
-
if (event.code === "captureAttemptFinished") resetHintBudget();
|
|
1815
|
-
} catch {
|
|
1816
|
-
bridgeFailureCount += 1;
|
|
1817
|
-
if (bridgeFailureCount === 1) trueSightLog("warning", "diagnostics", "other", "bridge mapping failed");
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Environment-snapshot-on-first-error (event map 19d): the "conditions at
|
|
1822
|
-
* the moment of failure" line — logged once per session, right after the
|
|
1823
|
-
* first error-level entry. The snapshot closure is injected (navigator
|
|
1824
|
-
* facts live behind the L0 environment provider).
|
|
1825
|
-
*/
|
|
1826
|
-
function logEnvironmentSnapshotOnce() {
|
|
1827
|
-
if (envSnapshotLogged || options.getEnvironmentSnapshot === void 0) return;
|
|
1828
|
-
envSnapshotLogged = true;
|
|
1829
|
-
try {
|
|
1830
|
-
trueSightLog("info", "session", "other", `environment at first error ${options.getEnvironmentSnapshot()}`);
|
|
1831
|
-
} catch {}
|
|
1832
|
-
}
|
|
1833
1386
|
function applyFeatureResolution(features, unresolvable) {
|
|
1834
1387
|
if (!active || remoteKilled || finalized) return;
|
|
1835
1388
|
const entry = features?.features?.find((candidate) => candidate.feature === "TRUESIGHT_DIAGNOSTICS");
|
|
@@ -1846,67 +1399,6 @@ function remoteKill() {
|
|
|
1846
1399
|
unsubscribeEvents = null;
|
|
1847
1400
|
}
|
|
1848
1401
|
/**
|
|
1849
|
-
* Size-limit overflow flush (plan §1.3, event map 10b): the buffer crossed
|
|
1850
|
-
* ~600 KB mid-session — ship the slice as its OWN contract-valid record
|
|
1851
|
-
* (fresh id, same sessionId, index continuity ties the records together)
|
|
1852
|
-
* and keep logging. **STAGING-ONLY until BE ships `inProgress`/`flushReason`
|
|
1853
|
-
* (hard gate B2)**: outside staging (`testing !== true`) the machinery goes
|
|
1854
|
-
* dormant and the buffer falls back to eviction. Interim outcome marker is
|
|
1855
|
-
* the sanctioned `failure/interrupted` pair; the terminal record supersedes.
|
|
1856
|
-
*/
|
|
1857
|
-
function handleBufferOverflow(slice) {
|
|
1858
|
-
dispatchOverflowSlice(slice);
|
|
1859
|
-
}
|
|
1860
|
-
async function dispatchOverflowSlice(slice) {
|
|
1861
|
-
if (!active || remoteKilled || finalized || overflowDormant || slice.length === 0) return;
|
|
1862
|
-
const metadata = buildSessionMetadata();
|
|
1863
|
-
if (metadata.testing !== true) {
|
|
1864
|
-
goOverflowDormant("overflowFlush dormant reason=prod");
|
|
1865
|
-
return;
|
|
1866
|
-
}
|
|
1867
|
-
if (cryptoUnsupported) {
|
|
1868
|
-
goOverflowDormant("overflowFlush dormant reason=cryptoUnsupported");
|
|
1869
|
-
return;
|
|
1870
|
-
}
|
|
1871
|
-
const transport = safeCaptureTransport();
|
|
1872
|
-
if (transport === null) {
|
|
1873
|
-
goOverflowDormant("overflowFlush dormant reason=noTransport");
|
|
1874
|
-
return;
|
|
1875
|
-
}
|
|
1876
|
-
overflowBatchCount += 1;
|
|
1877
|
-
const record = buildDiagnosticsRecord(metadata, [{
|
|
1878
|
-
index: slice[0].index,
|
|
1879
|
-
timestampMs: getTimestamp(),
|
|
1880
|
-
level: "info",
|
|
1881
|
-
subsystem: "diagnostics",
|
|
1882
|
-
category: "other",
|
|
1883
|
-
message: `sizeLimitFlush batch=${overflowBatchCount} prevRecordId=${lastFlushRecordId ?? "none"}`
|
|
1884
|
-
}, ...slice], "failure", "interrupted");
|
|
1885
|
-
if (record === null) {
|
|
1886
|
-
goOverflowDormant("overflowFlush dormant reason=unbuildable");
|
|
1887
|
-
return;
|
|
1888
|
-
}
|
|
1889
|
-
lastFlushRecordId = record.id;
|
|
1890
|
-
const upToIndex = slice[slice.length - 1].index;
|
|
1891
|
-
overflowFlushInFlightUpTo = upToIndex;
|
|
1892
|
-
await options.upload(record, {
|
|
1893
|
-
post: transport,
|
|
1894
|
-
loadCrypto: options.loadCrypto,
|
|
1895
|
-
warn: selfHealthWarn
|
|
1896
|
-
});
|
|
1897
|
-
buffer?.markFlushed(upToIndex);
|
|
1898
|
-
overflowFlushInFlightUpTo = null;
|
|
1899
|
-
snapshotDirty = true;
|
|
1900
|
-
trueSightLog("info", "diagnostics", "other", `sizeLimitFlush dispatched batch=${overflowBatchCount} recordId=${record.id} entries=${slice.length}`);
|
|
1901
|
-
}
|
|
1902
|
-
/** B2 fallback: machinery dormant, eviction takes over — logged exactly once. */
|
|
1903
|
-
function goOverflowDormant(message) {
|
|
1904
|
-
if (overflowDormant) return;
|
|
1905
|
-
overflowDormant = true;
|
|
1906
|
-
trueSightLog("warning", "diagnostics", "other", message);
|
|
1907
|
-
buffer?.setOverflowMode("evict");
|
|
1908
|
-
}
|
|
1909
|
-
/**
|
|
1910
1402
|
* Debounced interrupted-snapshot rebuild (plan §1.8): triggered by module
|
|
1911
1403
|
* boundaries and the dirty-interval tick, suppressed while a capture loop is
|
|
1912
1404
|
* active (C7). Seals the CURRENT state as a `failure/interrupted` record
|
|
@@ -1925,7 +1417,6 @@ function maybeRebuildSnapshot() {
|
|
|
1925
1417
|
snapshotDirty = false;
|
|
1926
1418
|
rebuildInFlight = true;
|
|
1927
1419
|
options.loadCrypto().then((sealer) => sealer.seal(JSON.stringify(record))).then(async (envelope) => {
|
|
1928
|
-
cachedPendingEnvelope = envelope;
|
|
1929
1420
|
if (!pendingSlotRegistered) {
|
|
1930
1421
|
pendingSlotRegistered = true;
|
|
1931
1422
|
await registerPendingSlot(sessionId, { storage });
|
|
@@ -1946,22 +1437,6 @@ function maybeRebuildSnapshot() {
|
|
|
1946
1437
|
});
|
|
1947
1438
|
}
|
|
1948
1439
|
/**
|
|
1949
|
-
* Page-hide = persist only, NEVER send (locked decision): one synchronous-
|
|
1950
|
-
* effective write of the freshest pre-sealed snapshot. Building or posting
|
|
1951
|
-
* here is forbidden — a hidden tab is frequently a user who returns.
|
|
1952
|
-
*/
|
|
1953
|
-
function handlePageHide() {
|
|
1954
|
-
if (!active || remoteKilled || finalized || cachedPendingEnvelope === null || options.storage === void 0) return;
|
|
1955
|
-
const sessionId = buildSessionMetadata().sessionId;
|
|
1956
|
-
if (!sessionId) return;
|
|
1957
|
-
writePendingEnvelope(sessionId, {
|
|
1958
|
-
v: 1,
|
|
1959
|
-
persistedAt: getTimestamp(),
|
|
1960
|
-
envelope: cachedPendingEnvelope
|
|
1961
|
-
}, { storage: options.storage });
|
|
1962
|
-
trueSightLog("debug", "diagnostics", "other", "snapshot persisted on pagehide");
|
|
1963
|
-
}
|
|
1964
|
-
/**
|
|
1965
1440
|
* Next-load recovery off the first-token-observed hook (A1) — runs once per
|
|
1966
1441
|
* lifecycle, fire-and-forget, and reports the A5 loss counters as a
|
|
1967
1442
|
* self-health line when there was anything to report.
|
|
@@ -2026,19 +1501,6 @@ function selfHealthWarn(message) {
|
|
|
2026
1501
|
if (isTrueSightTesting()) console.warn(message);
|
|
2027
1502
|
trueSightLog("warning", "diagnostics", "other", message);
|
|
2028
1503
|
}
|
|
2029
|
-
/** Spread-safe subset: injected seams only, `undefined` values dropped. */
|
|
2030
|
-
function pickDefined(serviceOptions) {
|
|
2031
|
-
const picked = {};
|
|
2032
|
-
if (serviceOptions.fetchFeatures) picked.fetchFeatures = serviceOptions.fetchFeatures;
|
|
2033
|
-
if (serviceOptions.captureTransport) picked.captureTransport = serviceOptions.captureTransport;
|
|
2034
|
-
if (serviceOptions.upload) picked.upload = serviceOptions.upload;
|
|
2035
|
-
if (serviceOptions.loadCrypto) picked.loadCrypto = serviceOptions.loadCrypto;
|
|
2036
|
-
if (serviceOptions.pageLifecycle) picked.pageLifecycle = serviceOptions.pageLifecycle;
|
|
2037
|
-
if (serviceOptions.timer) picked.timer = serviceOptions.timer;
|
|
2038
|
-
if (serviceOptions.storage) picked.storage = serviceOptions.storage;
|
|
2039
|
-
if (serviceOptions.getEnvironmentSnapshot) picked.getEnvironmentSnapshot = serviceOptions.getEnvironmentSnapshot;
|
|
2040
|
-
return picked;
|
|
2041
|
-
}
|
|
2042
1504
|
/** ` index=i total=n` suffix when the flow event carries module positioning. */
|
|
2043
1505
|
function modulePosition(payload) {
|
|
2044
1506
|
if (typeof payload !== "object" || payload === null) return "";
|
|
@@ -2046,4 +1508,4 @@ function modulePosition(payload) {
|
|
|
2046
1508
|
return `${typeof moduleIndex === "number" ? ` index=${moduleIndex}` : ""}${typeof totalModules === "number" ? ` total=${totalModules}` : ""}`;
|
|
2047
1509
|
}
|
|
2048
1510
|
//#endregion
|
|
2049
|
-
export {
|
|
1511
|
+
export { DEFAULT_WASM_VERSION as C, resolveWasmConfig as D, getBarcodeEnhanceModelUrl as E, upgradeToWasmHttpClient as S, buildWasmConfigFromBasePath as T, noteTestingSignals as _, notifyTrueSightManagerStopped as a, installFreshHttpClient as b, trueSightHintTransition as c, fetchFeatureConfig as d, isFeatureEnabled as f, noteSessionCreated as g, noteEnvironment as h, notifyTrueSightFlowEvent as i, trueSightLog as l, isTrueSightTesting as m, initializeTrueSightDiagnostics as n, resetTrueSight as o, resetFeatureConfigCache as p, noteTrueSightCaptureActivity as r, startTrueSightCollection as s, finalizeTrueSight as t, categoryForEndpoint as u, noteTokenActivated as v, buildDefaultWasmConfig as w, resetHttpClientState as x, getStoredHttpConfig as y };
|