Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,6 @@ Session.vim

#mise local
mise.local.toml

# npmrc
.npmrc
6 changes: 6 additions & 0 deletions packages/analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @microblink/analytics

## 1.0.1

### Patch Changes

- Added `logErrorEvent(...)` to standardize error and crash pinglets with formatted error messages and optional stack traces.

## 1.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microblink/analytics",
"private": true,
"version": "1.0.0",
"version": "1.0.1",
"scripts": {
"build": "tsc",
"build:publish": "tsc",
Expand Down
43 changes: 43 additions & 0 deletions packages/analytics/src/AnalyticService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,49 @@ describe("AnalyticsService", () => {
});
});

describe("logErrorEvent", () => {
it("queues error pinglets with origin-prefixed messages", async () => {
const error = new Error("aborted");

await analyticsService.logErrorEvent({
origin: "worker.onAbort",
error,
errorType: "Crash",
sessionNumber: 7,
});

expect(mockPingFn).toHaveBeenCalledWith({
schemaName: "ping.error",
schemaVersion: "1.0.0",
sessionNumber: 7,
data: {
errorType: "Crash",
errorMessage: "worker.onAbort: aborted",
stackTrace: error.stack,
},
});
});

it("serializes non-Error objects to JSON", async () => {
await analyticsService.logErrorEvent({
origin: "worker.onerror",
error: { code: "E_FAIL" },
errorType: "NonFatal",
});

expect(mockPingFn).toHaveBeenCalledWith({
schemaName: "ping.error",
schemaVersion: "1.0.0",
sessionNumber: undefined,
data: {
errorType: "NonFatal",
errorMessage: 'worker.onerror: {"code":"E_FAIL"}',
stackTrace: undefined,
},
});
});
});

describe("camera events", () => {
it("should log camera started event", async () => {
await analyticsService.logCameraStartedEvent();
Expand Down
40 changes: 40 additions & 0 deletions packages/analytics/src/AnalyticService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
PingBrowserDeviceInfoData,
PingCameraPermissionData,
PingCameraPermission,
PingErrorData,
} from "./ping";

/**
Expand Down Expand Up @@ -87,6 +88,22 @@ export class AnalyticService {
};
}

#formatErrorMessage(error: unknown): string {
if (error instanceof Error) {
return error.message;
}

if (typeof error === "object" && error !== null) {
try {
return JSON.stringify(error);
} catch {
return String(error);
}
}

return String(error);
}

logCameraStartedEvent() {
return this.#safePing(
this.#createUxEventPing({
Expand Down Expand Up @@ -257,4 +274,27 @@ export class AnalyticService {
data: pingData,
});
}

logErrorEvent({
origin,
error,
errorType,
sessionNumber,
}: {
origin: string;
error: unknown;
errorType: PingErrorData["errorType"];
sessionNumber?: number;
}) {
return this.#safePing({
schemaName: "ping.error",
schemaVersion: "1.0.0",
sessionNumber,
data: {
errorType,
errorMessage: `${origin}: ${this.#formatErrorMessage(error)}`,
stackTrace: error instanceof Error ? error.stack : undefined,
},
});
}
}
10 changes: 10 additions & 0 deletions packages/blinkcard-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @microblink/blinkcard-core

## 3000.0.3

### Patch Changes

- Surfaces worker frame-transfer failures as explicit `FrameTransferError`s through the proxy-worker layer, improving diagnostics for invalid or detached frame buffers.
- Updated dependencies
- @microblink/core-common@1.0.1
- @microblink/blinkcard-worker@3000.0.3
- @microblink/blinkcard-wasm@3000.0.3

## 3000.0.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/blinkcard-core/docs/classes/BlinkCardWorker.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ This method initializes the BlinkCard Wasm module.

### reportPinglet()

> **reportPinglet**(`__namedParameters`): `void`
> **reportPinglet**(`pinglet`): `void`

#### Parameters

##### \_\_namedParameters
##### pinglet

`Ping`

Expand Down
2 changes: 1 addition & 1 deletion packages/blinkcard-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microblink/blinkcard-core",
"description": "BlinkCard Core SDK",
"version": "3000.0.2",
"version": "3000.0.3",
"author": "Microblink",
"scripts": {
"build": "concurrently pnpm:build:js pnpm:build:types",
Expand Down
17 changes: 17 additions & 0 deletions packages/blinkcard-ux-manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @microblink/blinkcard-ux-manager

## 3000.0.3

### Patch Changes

- Keeps the feedback overlay visible whenever no SDK modal is open, preventing it from disappearing during intro, transition, and success states.
- Added non-fatal analytics reporting for UX-manager creation failures, frame-capture failures, `CameraManager` frame-loop errors, and session result retrieval failures.
- Updated dependencies
- @microblink/camera-manager@7.3.1
- @microblink/analytics@1.0.1
- @microblink/blinkcard-core@3000.0.3

## 3000.0.2

### Patch Changes
Expand All @@ -19,6 +30,12 @@
- Adds `destroy()` to `BlinkCardUxManager` for explicit teardown.
- Deprecates `rawUiStateKey` and replaces it with two explicit getters: `uiStateKey` returns the stabilized, visible state key (what the UI shows); `mappedUiStateKey` returns the latest raw candidate key from the detector before stabilization (useful for debugging).
- Introduces automatic chained UI state transitions after `FIRST_SIDE_CAPTURED`: the manager advances through `FLIP_CARD` to `INTRO_BACK`, then resumes capture for the back side. Integrations that depend on exact UI-state keys or transition timing should account for these new intermediate states.
- Renames several UI state keys. Integrations that reference state keys by name should update accordingly. Each `SENSING_*` state has been split into a framing-feedback state (`CARD_NOT_IN_FRAME_*`) and a new intro guidance state (`INTRO_*`). The old `FLIP_CARD` capture event is now `FIRST_SIDE_CAPTURED`; `FLIP_CARD` continues to exist as a page-transition state:
| Old key | New key(s) |
|---|---|
| `SENSING_FRONT` | `CARD_NOT_IN_FRAME_FRONT`, `INTRO_FRONT` |
| `SENSING_BACK` | `CARD_NOT_IN_FRAME_BACK`, `INTRO_BACK` |
| `FLIP_CARD` (capture event) | `FIRST_SIDE_CAPTURED` |
- Updated dependencies
- @microblink/camera-manager@7.3.0
- @microblink/blinkcard-core@3000.0.1
Expand Down
2 changes: 1 addition & 1 deletion packages/blinkcard-ux-manager/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microblink/blinkcard-ux-manager",
"description": "BlinkCard UX Manager provides user feedback based on the blinkcard process results.",
"version": "3000.0.2",
"version": "3000.0.3",
"author": "Microblink",
"scripts": {
"build": "concurrently pnpm:build:js pnpm:build:types",
Expand Down
Loading
Loading