@switchlabs/verify-ai-react-native 2.4.16 → 2.4.18
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/lib/client/index.js +11 -0
- package/lib/components/VerifyAIScanner.js +11 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +9 -0
- package/src/components/VerifyAIScanner.tsx +12 -4
- package/src/version.ts +1 -1
package/lib/client/index.js
CHANGED
|
@@ -121,10 +121,21 @@ export class VerifyAIClient {
|
|
|
121
121
|
const telemetryError = eventType === 'request_timeout'
|
|
122
122
|
? `${normalized.message} [${context.method} ${context.path}; timeout=${this.timeout}ms]`
|
|
123
123
|
: normalized;
|
|
124
|
+
const metadata = {
|
|
125
|
+
method: context.method,
|
|
126
|
+
path: context.path,
|
|
127
|
+
status: normalized.status,
|
|
128
|
+
timeout_ms: this.timeout,
|
|
129
|
+
};
|
|
130
|
+
if (normalized.code)
|
|
131
|
+
metadata.code = normalized.code;
|
|
132
|
+
if (normalized.requestId)
|
|
133
|
+
metadata.request_id = normalized.requestId;
|
|
124
134
|
this.telemetry.track(eventType, {
|
|
125
135
|
component: 'client',
|
|
126
136
|
error: telemetryError,
|
|
127
137
|
errorCode,
|
|
138
|
+
metadata,
|
|
128
139
|
});
|
|
129
140
|
}
|
|
130
141
|
throw normalized;
|
|
@@ -340,6 +340,16 @@ export function VerifyAIScanner({ onCapture, policy, onResult, onError, onClose,
|
|
|
340
340
|
}
|
|
341
341
|
catch (err) {
|
|
342
342
|
const error = normalizeScannerError(err);
|
|
343
|
+
const message = error.message || '';
|
|
344
|
+
const isMissingModule = error.code === 'MODULE_NOT_FOUND' ||
|
|
345
|
+
/cannot find module/i.test(message) ||
|
|
346
|
+
/unable to resolve module/i.test(message) ||
|
|
347
|
+
/requireNativeModule/i.test(message);
|
|
348
|
+
if (isMissingModule) {
|
|
349
|
+
// expo-sensors is an optional peer dep. Host apps that don't bundle it
|
|
350
|
+
// simply lose Android orientation tracking — that's expected, not a failure.
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
343
353
|
lastAndroidOrientationErrorAtRef.current = new Date().toISOString();
|
|
344
354
|
lastAndroidOrientationErrorRef.current = error.message;
|
|
345
355
|
trackAndroidOrientationEvent('camera_android_accelerometer_start_failure', error);
|
|
@@ -348,7 +358,7 @@ export function VerifyAIScanner({ onCapture, policy, onResult, onError, onClose,
|
|
|
348
358
|
if (cancelled)
|
|
349
359
|
return;
|
|
350
360
|
if (!Accelerometer) {
|
|
351
|
-
|
|
361
|
+
// Module loaded but no Accelerometer export — same expected-absence case.
|
|
352
362
|
return;
|
|
353
363
|
}
|
|
354
364
|
const startedAt = new Date().toISOString();
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.4.
|
|
1
|
+
export declare const SDK_VERSION = "2.4.18";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '2.4.
|
|
1
|
+
export const SDK_VERSION = '2.4.18';
|
package/package.json
CHANGED
package/src/client/index.ts
CHANGED
|
@@ -178,12 +178,21 @@ export class VerifyAIClient {
|
|
|
178
178
|
const telemetryError = eventType === 'request_timeout'
|
|
179
179
|
? `${normalized.message} [${context.method} ${context.path}; timeout=${this.timeout}ms]`
|
|
180
180
|
: normalized;
|
|
181
|
+
const metadata: Record<string, string | number> = {
|
|
182
|
+
method: context.method,
|
|
183
|
+
path: context.path,
|
|
184
|
+
status: normalized.status,
|
|
185
|
+
timeout_ms: this.timeout,
|
|
186
|
+
};
|
|
187
|
+
if (normalized.code) metadata.code = normalized.code;
|
|
188
|
+
if (normalized.requestId) metadata.request_id = normalized.requestId;
|
|
181
189
|
this.telemetry.track(
|
|
182
190
|
eventType,
|
|
183
191
|
{
|
|
184
192
|
component: 'client',
|
|
185
193
|
error: telemetryError,
|
|
186
194
|
errorCode,
|
|
195
|
+
metadata,
|
|
187
196
|
},
|
|
188
197
|
);
|
|
189
198
|
}
|
|
@@ -460,6 +460,17 @@ export function VerifyAIScanner({
|
|
|
460
460
|
Accelerometer = mod?.Accelerometer ?? null;
|
|
461
461
|
} catch (err) {
|
|
462
462
|
const error = normalizeScannerError(err);
|
|
463
|
+
const message = error.message || '';
|
|
464
|
+
const isMissingModule =
|
|
465
|
+
(error as { code?: string }).code === 'MODULE_NOT_FOUND' ||
|
|
466
|
+
/cannot find module/i.test(message) ||
|
|
467
|
+
/unable to resolve module/i.test(message) ||
|
|
468
|
+
/requireNativeModule/i.test(message);
|
|
469
|
+
if (isMissingModule) {
|
|
470
|
+
// expo-sensors is an optional peer dep. Host apps that don't bundle it
|
|
471
|
+
// simply lose Android orientation tracking — that's expected, not a failure.
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
463
474
|
lastAndroidOrientationErrorAtRef.current = new Date().toISOString();
|
|
464
475
|
lastAndroidOrientationErrorRef.current = error.message;
|
|
465
476
|
trackAndroidOrientationEvent('camera_android_accelerometer_start_failure', error);
|
|
@@ -467,10 +478,7 @@ export function VerifyAIScanner({
|
|
|
467
478
|
}
|
|
468
479
|
if (cancelled) return;
|
|
469
480
|
if (!Accelerometer) {
|
|
470
|
-
|
|
471
|
-
'camera_android_accelerometer_start_failure',
|
|
472
|
-
'expo-sensors Accelerometer is unavailable',
|
|
473
|
-
);
|
|
481
|
+
// Module loaded but no Accelerometer export — same expected-absence case.
|
|
474
482
|
return;
|
|
475
483
|
}
|
|
476
484
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '2.4.
|
|
1
|
+
export const SDK_VERSION = '2.4.18';
|