@arkyc/widget 1.2.2 → 1.2.4

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/client.d.mts CHANGED
@@ -115,7 +115,15 @@ declare class WidgetApiError extends Error {
115
115
  interface ArkycClientOptions {
116
116
  /** Short-lived client token minted for this session. */
117
117
  token: string;
118
- /** API origin (defaults to the same origin the widget is served from). */
118
+ /**
119
+ * The Client API **base** the widget appends each endpoint to — `{baseUrl}/session`,
120
+ * `{baseUrl}/document/front`, etc. (no version prefix is added; `baseUrl` owns it).
121
+ *
122
+ * **Optional** — defaults to the hosted Arkyc API ({@link DEFAULT_CLIENT_BASE_URL}),
123
+ * so the hosted product needs no config. Override only to self-host or proxy: a
124
+ * relative path resolves against the current origin (same-origin, no CORS); an
125
+ * absolute URL is used as-is (the API must allow your origin via CORS).
126
+ */
119
127
  baseUrl?: string;
120
128
  /** Injectable for testing; defaults to the global `fetch`. */
121
129
  fetch?: typeof fetch;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;UAWiB,aAAA;EACf,EAAA;EACA,MAAA,EAAQ,kBAAA;EACR,UAAA;EADQ;EAGR,aAAA,GAAgB,YAAA;EAEM;EAAtB,mBAAA,GAAsB,iBAAA;EAIX;EAFX,OAAA,GAAU,aAAA;EAMC;EAJX,QAAA,GAAW,cAAA;EAIc;EAFzB,QAAA,GAAW,eAAA;EAXX;EAaA,QAAA,GAAW,cAAA;AAAA;;;;;;;;UAUI,cAAA;EACf,SAAA;EAbW;EAeX,OAAA;EAbW;EAeX,KAAA;EAAA,CACC,KAAA;AAAA;;UAIc,aAAA;EACf,OAAA;EAVA;EAYA,aAAA;EARA;EAUA,GAAA;AAAA;AATc;AAIhB;;;AAJgB,UAgBC,mBAAA;EACf,aAAA;EACA,cAAA;EACA,OAAA;EACA,cAAA;EACA,eAAA;EACA,cAAA;EACA,eAAA;EACA,iBAAA;EACA,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AAA,GAAO,YAAA;EAnBC;EAqBR,UAAA,GAAa,iBAAA;EACb,OAAA,GAAU,mBAAA;AAAA;;UAIK,aAAA;EACf,OAAA,GAAU,mBAAmB;AAAA;AApB/B;;;AAAA,cA0Ba,cAAA,SAAuB,KAAK;EAAA,SAC9B,MAAA;EAAA,SACA,IAAA;cAEG,OAAA,UAAiB,MAAA,UAAgB,IAAA;AAAA;;UAS9B,kBAAA;EApCY;EAsC3B,KAAA;EAlC4B;;;;;;;;;EA4C5B,OAAA;EA3CS;EA6CT,KAAA,UAAe,KAAK;AAAA;;AAjCS;AAM/B;;;cA8Ea,WAAA;EAAA,iBACM,KAAA;EAAA,iBACA,OAAA;EAAA,iBACA,SAAA;cAEL,OAAA,EAAS,kBAAA;EA/ET;;;;AAA8C;EA6F1D,UAAA,IAAc,OAAA,CAAQ,aAAA;EApFW;;;;;;EA8FjC,mBAAA,CAAoB,KAAA,EAAO,kBAAA,GAAqB,OAAA,CAAQ,aAAA;EAhFpC;AAAA;AAmDtB;;;;EA4CE,kBAAA,CAAmB,KAAA,EAAO,iBAAA,GAAoB,OAAA,CAAQ,aAAA;EAzBxC;;;;;;EAuCd,cAAA,CAAe,KAAA,EAAO,aAAA,GAAgB,OAAA,CAAQ,aAAA;EAAxB;;;;;;;EAiBtB,aAAA,CAAc,KAAA,EAAO,YAAA,GAAe,OAAA,CAAQ,aAAA;EA0BP;;;;;;EAArC,QAAA,CAAS,KAAA,GAAO,aAAA,GAAqB,OAAA,CAAQ,aAAA;EAAA,QAI/B,OAAA;AAAA"}
package/dist/client.mjs CHANGED
@@ -12,6 +12,22 @@ var WidgetApiError = class extends Error {
12
12
  this.code = code;
13
13
  }
14
14
  };
15
+ const DEFAULT_CLIENT_BASE_URL = "https://api.arkyc.toneflix.net/api/v1/client";
16
+ /**
17
+ * Resolve the request base: an explicit `baseUrl` overrides the build-time
18
+ * {@link DEFAULT_CLIENT_BASE_URL}. The chosen value is used as-is when absolute
19
+ * (cross-origin, CORS); a relative path resolves against the current origin
20
+ * (same-origin proxy, no CORS).
21
+ *
22
+ * @param baseUrl
23
+ * @returns
24
+ */
25
+ function resolveClientBaseUrl(baseUrl) {
26
+ const raw = (baseUrl ?? "").trim().replace(/\/$/, "");
27
+ if (!raw) return DEFAULT_CLIENT_BASE_URL;
28
+ if (/^https?:\/\//i.test(raw)) return raw;
29
+ return `${(globalThis.location?.origin ?? "").replace(/\/$/, "")}${raw.startsWith("/") ? "" : "/"}${raw}`;
30
+ }
15
31
  function appendSignals(form, signals) {
16
32
  if (!signals) return;
17
33
  for (const [key, value] of Object.entries(signals)) {
@@ -31,7 +47,7 @@ var ArkycClient = class {
31
47
  constructor(options) {
32
48
  if (!options.token) throw new Error("ArkycClient requires a client `token`.");
33
49
  this.token = options.token;
34
- this.baseUrl = (options.baseUrl ?? "").replace(/\/$/, "");
50
+ this.baseUrl = resolveClientBaseUrl(options.baseUrl);
35
51
  const f = options.fetch ?? globalThis.fetch;
36
52
  if (!f) throw new Error("No `fetch` implementation available.");
37
53
  this.fetchImpl = f.bind(globalThis);
@@ -42,7 +58,7 @@ var ArkycClient = class {
42
58
  * @returns
43
59
  */
44
60
  getSession() {
45
- return this.request("GET", "/v1/client/session");
61
+ return this.request("GET", "/session");
46
62
  }
47
63
  /**
48
64
  * Submit the document front image (triggers OCR + portrait extraction).
@@ -56,7 +72,7 @@ var ArkycClient = class {
56
72
  if (input.country) form.append("country", input.country);
57
73
  if (input.documentType) form.append("document_type", input.documentType);
58
74
  appendSignals(form, input.signals);
59
- return this.request("POST", "/v1/client/document/front", form);
75
+ return this.request("POST", "/document/front", form);
60
76
  }
61
77
  /**
62
78
  * Submit the document back image.
@@ -69,7 +85,7 @@ var ArkycClient = class {
69
85
  if (input.image) form.append("image", input.image, "document-back.jpg");
70
86
  if (input.country) form.append("country", input.country);
71
87
  if (input.documentType) form.append("document_type", input.documentType);
72
- return this.request("POST", "/v1/client/document/back", form);
88
+ return this.request("POST", "/document/back", form);
73
89
  }
74
90
  /**
75
91
  * Submit the selfie for the liveness check.
@@ -84,7 +100,7 @@ var ArkycClient = class {
84
100
  if (input.mode) form.append("mode", input.mode);
85
101
  if (input.challenges) form.append("challenges", JSON.stringify(input.challenges));
86
102
  appendSignals(form, input.signals);
87
- return this.request("POST", "/v1/client/liveness", form);
103
+ return this.request("POST", "/liveness", form);
88
104
  }
89
105
  /**
90
106
  * Submit address verification (opt-in stage). Sends the claimed address plus
@@ -108,7 +124,7 @@ var ArkycClient = class {
108
124
  if (input.latitude != null) form.append("latitude", String(input.latitude));
109
125
  if (input.longitude != null) form.append("longitude", String(input.longitude));
110
126
  appendSignals(form, input.signals);
111
- return this.request("POST", "/v1/client/address", form);
127
+ return this.request("POST", "/address", form);
112
128
  }
113
129
  /**
114
130
  * Finalise the session (runs face-match + the decision engine).
@@ -117,7 +133,7 @@ var ArkycClient = class {
117
133
  * @returns
118
134
  */
119
135
  complete(input = {}) {
120
- return this.request("POST", "/v1/client/complete", input.signals ?? {});
136
+ return this.request("POST", "/complete", input.signals ?? {});
121
137
  }
122
138
  async request(method, path, body) {
123
139
  const headers = { "X-Client-Token": this.token };
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type {\n CaptureModel,\n DocumentType,\n LivenessChallenge,\n LivenessMode,\n ProjectBranding,\n VerificationStatus,\n WorkflowConfig,\n} from '@arkyc/types'\n\n/** The session view exposed by the Client/Widget API (`GET /v1/client/session`). */\nexport interface ClientSession {\n id: string\n status: VerificationStatus\n expires_at: string\n /** The capture flow this session runs (Phase 17). */\n capture_model?: CaptureModel\n /** The active-liveness challenge sequence to prompt the user through. */\n liveness_challenges?: LivenessChallenge[]\n /** Cross-device handoff config resolved from the project setting. */\n handoff?: ClientHandoff\n /** How to watch this session live (push transport params or `polling`). */\n realtime?: ClientRealtime\n /** Project branding (colours/logo/name) so the widget themes itself at runtime. */\n branding?: ProjectBranding | null\n /** The applied workflow (ordered, toggleable stages + skip_ocr), or null for the default flow. */\n workflow?: WorkflowConfig | null\n}\n\n/**\n * Realtime connection info for this session (Phase 16). `transport` selects how\n * the widget watches the session: `pusher`/`firebase` subscribe to `channel`;\n * `polling` (and `off`/`memory`) mean poll the session endpoint instead. The\n * remaining fields carry the active transport's public connection params; `token`\n * is a per-session Firebase custom token when applicable.\n */\nexport interface ClientRealtime {\n transport: 'pusher' | 'firebase' | 'polling' | 'off' | 'memory'\n /** The private channel this session's events publish to. */\n channel: string\n /** Per-session Firebase custom token (firebase transport only). */\n token?: string | null\n [param: string]: unknown\n}\n\n/** Whether (and where) the widget may offer cross-device handoff. */\nexport interface ClientHandoff {\n enabled: boolean\n /** Whether a desktop user may continue on the desktop device instead of handing off. */\n allow_desktop: boolean\n /** First-party hosted page the QR points to (the phone resumes the session there). */\n url: string\n}\n\n/**\n * Mock-driver signal hints. Real provider drivers ignore these; the `mock`\n * drivers use them to make the demo/playground flow deterministic.\n */\nexport interface ProviderSignalHints {\n quality_score?: number\n ocr_confidence?: number\n expired?: boolean\n liveness_score?: number\n liveness_passed?: boolean\n multiple_faces?: boolean\n face_similarity?: number\n face_match_passed?: boolean\n address_score?: number\n address_passed?: boolean\n}\n\n/** Input for the address-verification submission (opt-in stage). */\nexport interface AddressInput {\n /** The claimed address the user entered. */\n line1?: string | null\n line2?: string | null\n city?: string | null\n region?: string | null\n postalCode?: string | null\n /** ISO 3166-1 alpha-2 country code. */\n country?: string | null\n /** Proof-of-address document image. */\n poa?: Blob | null\n /** Captured device coordinates. */\n latitude?: number | null\n longitude?: number | null\n signals?: ProviderSignalHints\n}\n\n/** Input for the document-front submission. */\nexport interface DocumentFrontInput {\n image?: Blob | null\n country?: string | null\n documentType?: DocumentType | null\n signals?: ProviderSignalHints\n}\n\n/** Input for the document-back submission. */\nexport interface DocumentBackInput {\n image?: Blob | null\n country?: string | null\n documentType?: DocumentType | null\n}\n\n/** Input for the liveness submission (passive selfie or active challenge video). */\nexport interface LivenessInput {\n selfie?: Blob | null\n /** Recorded challenge video (active mode). */\n video?: Blob | null\n /** Passive (selfie) or active (challenge video). Defaults to passive. */\n mode?: LivenessMode\n /** The challenge sequence the user performed, in order (active mode). */\n challenges?: LivenessChallenge[]\n signals?: ProviderSignalHints\n}\n\n/** Input for completing the session (runs face-match + decision). */\nexport interface CompleteInput {\n signals?: ProviderSignalHints\n}\n\n/**\n * Raised when the Client API returns a non-2xx response.\n */\nexport class WidgetApiError extends Error {\n readonly status: number\n readonly code?: string\n\n constructor(message: string, status: number, code?: string) {\n super(message)\n this.name = 'WidgetApiError'\n this.status = status\n this.code = code\n }\n}\n\n/** Options for {@link ArkycClient}. */\nexport interface ArkycClientOptions {\n /** Short-lived client token minted for this session. */\n token: string\n /** API origin (defaults to the same origin the widget is served from). */\n baseUrl?: string\n /** Injectable for testing; defaults to the global `fetch`. */\n fetch?: typeof fetch\n}\n\ntype EnvelopeNumber = number | boolean\n\nfunction appendSignals(form: FormData, signals?: ProviderSignalHints): void {\n if (!signals) return\n for (const [key, value] of Object.entries(signals)) {\n if (value == null) continue\n form.append(key, String(value as EnvelopeNumber))\n }\n}\n\n/**\n * A thin, framework-agnostic client for the Arkyc Client/Widget API. Drives a\n * single verification session with a short-lived client token. All responses\n * are unwrapped from the standard `{ status, message, data }` envelope.\n */\nexport class ArkycClient {\n private readonly token: string\n private readonly baseUrl: string\n private readonly fetchImpl: typeof fetch\n\n constructor(options: ArkycClientOptions) {\n if (!options.token) throw new Error('ArkycClient requires a client `token`.')\n this.token = options.token\n this.baseUrl = (options.baseUrl ?? '').replace(/\\/$/, '')\n const f = options.fetch ?? globalThis.fetch\n if (!f) throw new Error('No `fetch` implementation available.')\n this.fetchImpl = f.bind(globalThis)\n }\n\n /**\n * Load the current session (marks it `started` on first call).\n *\n * @returns\n */\n getSession(): Promise<ClientSession> {\n return this.request('GET', '/v1/client/session')\n }\n\n /**\n * Submit the document front image (triggers OCR + portrait extraction).\n *\n * @param input\n * @returns\n */\n submitDocumentFront(input: DocumentFrontInput): Promise<ClientSession> {\n const form = new FormData()\n if (input.image) form.append('image', input.image, 'document-front.jpg')\n if (input.country) form.append('country', input.country)\n if (input.documentType) form.append('document_type', input.documentType)\n appendSignals(form, input.signals)\n return this.request('POST', '/v1/client/document/front', form)\n }\n\n /**\n * Submit the document back image.\n *\n * @param input\n * @returns\n */\n submitDocumentBack(input: DocumentBackInput): Promise<ClientSession> {\n const form = new FormData()\n if (input.image) form.append('image', input.image, 'document-back.jpg')\n if (input.country) form.append('country', input.country)\n if (input.documentType) form.append('document_type', input.documentType)\n return this.request('POST', '/v1/client/document/back', form)\n }\n\n /**\n * Submit the selfie for the liveness check.\n *\n * @param input\n * @returns\n */\n submitLiveness(input: LivenessInput): Promise<ClientSession> {\n const form = new FormData()\n if (input.selfie) form.append('selfie', input.selfie, 'selfie.jpg')\n if (input.video) form.append('video', input.video, 'liveness.webm')\n if (input.mode) form.append('mode', input.mode)\n if (input.challenges) form.append('challenges', JSON.stringify(input.challenges))\n appendSignals(form, input.signals)\n return this.request('POST', '/v1/client/liveness', form)\n }\n\n /**\n * Submit address verification (opt-in stage). Sends the claimed address plus\n * whichever evidence was gathered (proof-of-address image, device coordinates).\n *\n * @param input\n * @returns\n */\n submitAddress(input: AddressInput): Promise<ClientSession> {\n const form = new FormData()\n const fields: Record<string, string | null | undefined> = {\n line1: input.line1,\n line2: input.line2,\n city: input.city,\n region: input.region,\n postal_code: input.postalCode,\n country: input.country,\n }\n for (const [key, value] of Object.entries(fields)) {\n if (value) form.append(key, value)\n }\n if (input.poa) form.append('poa', input.poa, 'proof-of-address.jpg')\n if (input.latitude != null) form.append('latitude', String(input.latitude))\n if (input.longitude != null) form.append('longitude', String(input.longitude))\n appendSignals(form, input.signals)\n return this.request('POST', '/v1/client/address', form)\n }\n\n /**\n * Finalise the session (runs face-match + the decision engine).\n *\n * @param input\n * @returns\n */\n complete(input: CompleteInput = {}): Promise<ClientSession> {\n return this.request('POST', '/v1/client/complete', input.signals ?? {})\n }\n\n private async request(method: string, path: string, body?: FormData | object): Promise<ClientSession> {\n const headers: Record<string, string> = { 'X-Client-Token': this.token }\n let payload: BodyInit | undefined\n\n if (body instanceof FormData) {\n payload = body\n } else if (body) {\n headers['Content-Type'] = 'application/json'\n payload = JSON.stringify(body)\n }\n\n const res = await this.fetchImpl(`${this.baseUrl}${path}`, { method, headers, body: payload })\n const text = await res.text()\n const json = text ? (JSON.parse(text) as { message?: string; data?: ClientSession }) : {}\n\n if (!res.ok) {\n throw new WidgetApiError(json.message ?? `Request failed (${res.status})`, res.status)\n }\n return json.data as ClientSession\n }\n}\n"],"mappings":";;;;AA4HA,IAAa,iBAAb,cAAoC,MAAM;CACxC;CACA;CAEA,YAAY,SAAiB,QAAgB,MAAe;EAC1D,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,OAAO;CACd;AACF;AAcA,SAAS,cAAc,MAAgB,SAAqC;CAC1E,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,GAAG;EAClD,IAAI,SAAS,MAAM;EACnB,KAAK,OAAO,KAAK,OAAO,KAAuB,CAAC;CAClD;AACF;;;;;;AAOA,IAAa,cAAb,MAAyB;CACvB;CACA;CACA;CAEA,YAAY,SAA6B;EACvC,IAAI,CAAC,QAAQ,OAAO,MAAM,IAAI,MAAM,wCAAwC;EAC5E,KAAK,QAAQ,QAAQ;EACrB,KAAK,WAAW,QAAQ,WAAW,GAAA,CAAI,QAAQ,OAAO,EAAE;EACxD,MAAM,IAAI,QAAQ,SAAS,WAAW;EACtC,IAAI,CAAC,GAAG,MAAM,IAAI,MAAM,sCAAsC;EAC9D,KAAK,YAAY,EAAE,KAAK,UAAU;CACpC;;;;;;CAOA,aAAqC;EACnC,OAAO,KAAK,QAAQ,OAAO,oBAAoB;CACjD;;;;;;;CAQA,oBAAoB,OAAmD;EACrE,MAAM,OAAO,IAAI,SAAS;EAC1B,IAAI,MAAM,OAAO,KAAK,OAAO,SAAS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,KAAK,sBAAsB;EACnE,IAAI,MAAM,YAAY,MAAM,KAAK,OAAO,YAAY,OAAO,MAAM,QAAQ,CAAC;EAC1E,IAAI,MAAM,aAAa,MAAM,KAAK,OAAO,aAAa,OAAO,MAAM,SAAS,CAAC;EAC7E,cAAc,MAAM,MAAM,OAAO;EACjC,OAAO,KAAK,QAAQ,QAAQ,sBAAsB,IAAI;CACxD;;;;;;;CAQA,SAAS,QAAuB,CAAC,GAA2B;EAC1D,OAAO,KAAK,QAAQ,QAAQ,uBAAuB,MAAM,WAAW,CAAC,CAAC;CACxE;CAEA,MAAc,QAAQ,QAAgB,MAAc,MAAkD;EACpG,MAAM,UAAkC,EAAE,kBAAkB,KAAK,MAAM;EACvE,IAAI;EAEJ,IAAI,gBAAgB,UAClB,UAAU;OACL,IAAI,MAAM;GACf,QAAQ,kBAAkB;GAC1B,UAAU,KAAK,UAAU,IAAI;EAC/B;EAEA,MAAM,MAAM,MAAM,KAAK,UAAU,GAAG,KAAK,UAAU,QAAQ;GAAE;GAAQ;GAAS,MAAM;EAAQ,CAAC;EAC7F,MAAM,OAAO,MAAM,IAAI,KAAK;EAC5B,MAAM,OAAO,OAAQ,KAAK,MAAM,IAAI,IAAmD,CAAC;EAExF,IAAI,CAAC,IAAI,IACP,MAAM,IAAI,eAAe,KAAK,WAAW,mBAAmB,IAAI,OAAO,IAAI,IAAI,MAAM;EAEvF,OAAO,KAAK;CACd;AACF"}
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type {\n CaptureModel,\n DocumentType,\n LivenessChallenge,\n LivenessMode,\n ProjectBranding,\n VerificationStatus,\n WorkflowConfig,\n} from '@arkyc/types'\n\n/** The session view exposed by the Client/Widget API (`GET /v1/client/session`). */\nexport interface ClientSession {\n id: string\n status: VerificationStatus\n expires_at: string\n /** The capture flow this session runs (Phase 17). */\n capture_model?: CaptureModel\n /** The active-liveness challenge sequence to prompt the user through. */\n liveness_challenges?: LivenessChallenge[]\n /** Cross-device handoff config resolved from the project setting. */\n handoff?: ClientHandoff\n /** How to watch this session live (push transport params or `polling`). */\n realtime?: ClientRealtime\n /** Project branding (colours/logo/name) so the widget themes itself at runtime. */\n branding?: ProjectBranding | null\n /** The applied workflow (ordered, toggleable stages + skip_ocr), or null for the default flow. */\n workflow?: WorkflowConfig | null\n}\n\n/**\n * Realtime connection info for this session (Phase 16). `transport` selects how\n * the widget watches the session: `pusher`/`firebase` subscribe to `channel`;\n * `polling` (and `off`/`memory`) mean poll the session endpoint instead. The\n * remaining fields carry the active transport's public connection params; `token`\n * is a per-session Firebase custom token when applicable.\n */\nexport interface ClientRealtime {\n transport: 'pusher' | 'firebase' | 'polling' | 'off' | 'memory'\n /** The private channel this session's events publish to. */\n channel: string\n /** Per-session Firebase custom token (firebase transport only). */\n token?: string | null\n [param: string]: unknown\n}\n\n/** Whether (and where) the widget may offer cross-device handoff. */\nexport interface ClientHandoff {\n enabled: boolean\n /** Whether a desktop user may continue on the desktop device instead of handing off. */\n allow_desktop: boolean\n /** First-party hosted page the QR points to (the phone resumes the session there). */\n url: string\n}\n\n/**\n * Mock-driver signal hints. Real provider drivers ignore these; the `mock`\n * drivers use them to make the demo/playground flow deterministic.\n */\nexport interface ProviderSignalHints {\n quality_score?: number\n ocr_confidence?: number\n expired?: boolean\n liveness_score?: number\n liveness_passed?: boolean\n multiple_faces?: boolean\n face_similarity?: number\n face_match_passed?: boolean\n address_score?: number\n address_passed?: boolean\n}\n\n/** Input for the address-verification submission (opt-in stage). */\nexport interface AddressInput {\n /** The claimed address the user entered. */\n line1?: string | null\n line2?: string | null\n city?: string | null\n region?: string | null\n postalCode?: string | null\n /** ISO 3166-1 alpha-2 country code. */\n country?: string | null\n /** Proof-of-address document image. */\n poa?: Blob | null\n /** Captured device coordinates. */\n latitude?: number | null\n longitude?: number | null\n signals?: ProviderSignalHints\n}\n\n/** Input for the document-front submission. */\nexport interface DocumentFrontInput {\n image?: Blob | null\n country?: string | null\n documentType?: DocumentType | null\n signals?: ProviderSignalHints\n}\n\n/** Input for the document-back submission. */\nexport interface DocumentBackInput {\n image?: Blob | null\n country?: string | null\n documentType?: DocumentType | null\n}\n\n/** Input for the liveness submission (passive selfie or active challenge video). */\nexport interface LivenessInput {\n selfie?: Blob | null\n /** Recorded challenge video (active mode). */\n video?: Blob | null\n /** Passive (selfie) or active (challenge video). Defaults to passive. */\n mode?: LivenessMode\n /** The challenge sequence the user performed, in order (active mode). */\n challenges?: LivenessChallenge[]\n signals?: ProviderSignalHints\n}\n\n/** Input for completing the session (runs face-match + decision). */\nexport interface CompleteInput {\n signals?: ProviderSignalHints\n}\n\n/**\n * Raised when the Client API returns a non-2xx response.\n */\nexport class WidgetApiError extends Error {\n readonly status: number\n readonly code?: string\n\n constructor(message: string, status: number, code?: string) {\n super(message)\n this.name = 'WidgetApiError'\n this.status = status\n this.code = code\n }\n}\n\n/** Options for {@link ArkycClient}. */\nexport interface ArkycClientOptions {\n /** Short-lived client token minted for this session. */\n token: string\n /**\n * The Client API **base** the widget appends each endpoint to — `{baseUrl}/session`,\n * `{baseUrl}/document/front`, etc. (no version prefix is added; `baseUrl` owns it).\n *\n * **Optional** — defaults to the hosted Arkyc API ({@link DEFAULT_CLIENT_BASE_URL}),\n * so the hosted product needs no config. Override only to self-host or proxy: a\n * relative path resolves against the current origin (same-origin, no CORS); an\n * absolute URL is used as-is (the API must allow your origin via CORS).\n */\n baseUrl?: string\n /** Injectable for testing; defaults to the global `fetch`. */\n fetch?: typeof fetch\n}\n\n/**\n * The default Client API base, used when no `baseUrl` is passed — so the hosted\n * product is zero-config: the browser calls it cross-origin with the client\n * token (the API allows it via CORS).\n *\n * Baked at **build time** from the `ARKYC_API_URL` env (via the tsdown `define`),\n * falling back to the hosted Arkyc API. Self-hosters set `ARKYC_API_URL` when\n * building the widget; integrators on the published package override per call\n * with `baseUrl`. Referenced through `typeof` so running the source directly\n * (tests) without the define is safe.\n */\ndeclare const __ARKYC_API_BASE__: string | undefined\nexport const DEFAULT_CLIENT_BASE_URL =\n (typeof __ARKYC_API_BASE__ === 'string' ? __ARKYC_API_BASE__ : '') ||\n 'https://api.arkyc.toneflix.net/api/v1/client'\n\n/**\n * Resolve the request base: an explicit `baseUrl` overrides the build-time\n * {@link DEFAULT_CLIENT_BASE_URL}. The chosen value is used as-is when absolute\n * (cross-origin, CORS); a relative path resolves against the current origin\n * (same-origin proxy, no CORS).\n *\n * @param baseUrl\n * @returns\n */\nexport function resolveClientBaseUrl(baseUrl?: string): string {\n const raw = (baseUrl ?? '').trim().replace(/\\/$/, '')\n if (!raw) return DEFAULT_CLIENT_BASE_URL\n if (/^https?:\\/\\//i.test(raw)) return raw\n const origin = (globalThis.location?.origin ?? '').replace(/\\/$/, '')\n return `${origin}${raw.startsWith('/') ? '' : '/'}${raw}`\n}\n\ntype EnvelopeNumber = number | boolean\n\nfunction appendSignals(form: FormData, signals?: ProviderSignalHints): void {\n if (!signals) return\n for (const [key, value] of Object.entries(signals)) {\n if (value == null) continue\n form.append(key, String(value as EnvelopeNumber))\n }\n}\n\n/**\n * A thin, framework-agnostic client for the Arkyc Client/Widget API. Drives a\n * single verification session with a short-lived client token. All responses\n * are unwrapped from the standard `{ status, message, data }` envelope.\n */\nexport class ArkycClient {\n private readonly token: string\n private readonly baseUrl: string\n private readonly fetchImpl: typeof fetch\n\n constructor(options: ArkycClientOptions) {\n if (!options.token) throw new Error('ArkycClient requires a client `token`.')\n this.token = options.token\n this.baseUrl = resolveClientBaseUrl(options.baseUrl)\n const f = options.fetch ?? globalThis.fetch\n if (!f) throw new Error('No `fetch` implementation available.')\n this.fetchImpl = f.bind(globalThis)\n }\n\n /**\n * Load the current session (marks it `started` on first call).\n *\n * @returns\n */\n getSession(): Promise<ClientSession> {\n return this.request('GET', '/session')\n }\n\n /**\n * Submit the document front image (triggers OCR + portrait extraction).\n *\n * @param input\n * @returns\n */\n submitDocumentFront(input: DocumentFrontInput): Promise<ClientSession> {\n const form = new FormData()\n if (input.image) form.append('image', input.image, 'document-front.jpg')\n if (input.country) form.append('country', input.country)\n if (input.documentType) form.append('document_type', input.documentType)\n appendSignals(form, input.signals)\n return this.request('POST', '/document/front', form)\n }\n\n /**\n * Submit the document back image.\n *\n * @param input\n * @returns\n */\n submitDocumentBack(input: DocumentBackInput): Promise<ClientSession> {\n const form = new FormData()\n if (input.image) form.append('image', input.image, 'document-back.jpg')\n if (input.country) form.append('country', input.country)\n if (input.documentType) form.append('document_type', input.documentType)\n return this.request('POST', '/document/back', form)\n }\n\n /**\n * Submit the selfie for the liveness check.\n *\n * @param input\n * @returns\n */\n submitLiveness(input: LivenessInput): Promise<ClientSession> {\n const form = new FormData()\n if (input.selfie) form.append('selfie', input.selfie, 'selfie.jpg')\n if (input.video) form.append('video', input.video, 'liveness.webm')\n if (input.mode) form.append('mode', input.mode)\n if (input.challenges) form.append('challenges', JSON.stringify(input.challenges))\n appendSignals(form, input.signals)\n return this.request('POST', '/liveness', form)\n }\n\n /**\n * Submit address verification (opt-in stage). Sends the claimed address plus\n * whichever evidence was gathered (proof-of-address image, device coordinates).\n *\n * @param input\n * @returns\n */\n submitAddress(input: AddressInput): Promise<ClientSession> {\n const form = new FormData()\n const fields: Record<string, string | null | undefined> = {\n line1: input.line1,\n line2: input.line2,\n city: input.city,\n region: input.region,\n postal_code: input.postalCode,\n country: input.country,\n }\n for (const [key, value] of Object.entries(fields)) {\n if (value) form.append(key, value)\n }\n if (input.poa) form.append('poa', input.poa, 'proof-of-address.jpg')\n if (input.latitude != null) form.append('latitude', String(input.latitude))\n if (input.longitude != null) form.append('longitude', String(input.longitude))\n appendSignals(form, input.signals)\n return this.request('POST', '/address', form)\n }\n\n /**\n * Finalise the session (runs face-match + the decision engine).\n *\n * @param input\n * @returns\n */\n complete(input: CompleteInput = {}): Promise<ClientSession> {\n return this.request('POST', '/complete', input.signals ?? {})\n }\n\n private async request(method: string, path: string, body?: FormData | object): Promise<ClientSession> {\n const headers: Record<string, string> = { 'X-Client-Token': this.token }\n let payload: BodyInit | undefined\n\n if (body instanceof FormData) {\n payload = body\n } else if (body) {\n headers['Content-Type'] = 'application/json'\n payload = JSON.stringify(body)\n }\n\n const res = await this.fetchImpl(`${this.baseUrl}${path}`, { method, headers, body: payload })\n const text = await res.text()\n const json = text ? (JSON.parse(text) as { message?: string; data?: ClientSession }) : {}\n\n if (!res.ok) {\n throw new WidgetApiError(json.message ?? `Request failed (${res.status})`, res.status)\n }\n return json.data as ClientSession\n }\n}\n"],"mappings":";;;;AA4HA,IAAa,iBAAb,cAAoC,MAAM;CACxC;CACA;CAEA,YAAY,SAAiB,QAAgB,MAAe;EAC1D,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,OAAO;CACd;AACF;AAgCA,MAAa,0BAEX;;;;;;;;;;AAWF,SAAgB,qBAAqB,SAA0B;CAC7D,MAAM,OAAO,WAAW,GAAA,CAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;CACpD,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,gBAAgB,KAAK,GAAG,GAAG,OAAO;CAEtC,OAAO,IADS,WAAW,UAAU,UAAU,GAAA,CAAI,QAAQ,OAAO,EACnD,IAAI,IAAI,WAAW,GAAG,IAAI,KAAK,MAAM;AACtD;AAIA,SAAS,cAAc,MAAgB,SAAqC;CAC1E,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,GAAG;EAClD,IAAI,SAAS,MAAM;EACnB,KAAK,OAAO,KAAK,OAAO,KAAuB,CAAC;CAClD;AACF;;;;;;AAOA,IAAa,cAAb,MAAyB;CACvB;CACA;CACA;CAEA,YAAY,SAA6B;EACvC,IAAI,CAAC,QAAQ,OAAO,MAAM,IAAI,MAAM,wCAAwC;EAC5E,KAAK,QAAQ,QAAQ;EACrB,KAAK,UAAU,qBAAqB,QAAQ,OAAO;EACnD,MAAM,IAAI,QAAQ,SAAS,WAAW;EACtC,IAAI,CAAC,GAAG,MA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Endpoint: `${apiBase}/v1/client/realtime/auth`,
216
+ authEndpoint: `${apiBase}/realtime/auth`,
217
217
  token: this.config.token
218
218
  });
219
219
  } catch {
@@ -1 +1 @@
1
- {"version":3,"file":"controller.mjs","names":[],"sources":["../src/controller.ts"],"sourcesContent":["import type {\n DocumentType,\n LivenessChallenge,\n LivenessMode,\n SessionTransitionEvent,\n VerificationStatus,\n WidgetResult,\n WidgetStep,\n WorkflowConfig,\n} from '@arkyc/types'\nimport { REALTIME_EVENT, workflowAddressConfig } from '@arkyc/types'\nimport { ArkycClient, type ClientHandoff, type ClientRealtime, type ClientSession, WidgetApiError } from './client'\nimport { Flow } from './flow'\nimport { Theme } from './theme'\nimport { WidgetView, type AddressFormData } from './ui'\nimport { isDesktopDevice } from './device'\nimport { renderQrSvg } from './qr'\nimport { createWidgetRealtimeClient, type WidgetRealtimeClient } from './realtime'\nimport type { BaseWidgetOptions, ViewHandlers, WidgetControllerConfig, WidgetEventListener } from './types'\n\n/** Per-step lead-in copy shown before each capture/liveness step. */\nconst STEP_INSTRUCTIONS: Partial<Record<WidgetStep, { title: string; body: string; cta?: string }>> = {\n front_capture: {\n title: 'Front of your document',\n body: 'Place the front of your ID flat and fully inside the frame. We’ll capture it automatically.',\n },\n back_capture: {\n title: 'Back of your document',\n body: 'Now turn your ID over and show the back, fully inside the frame.',\n },\n selfie_capture: {\n title: 'Take a selfie',\n body: 'Look straight at the camera in good light and hold still — we’ll capture it automatically.',\n },\n active_liveness: {\n title: 'Quick liveness check',\n body: 'Follow the on-screen prompts (such as turn your head, blink or smile). This confirms you’re really here.',\n },\n}\n\n/**\n * Drives the full verification flow: renders each screen via {@link WidgetView},\n * advances through {@link flow}, and calls the Client API at each step. Cosmetic\n * processing screens auto-advance; capture screens wait for an image. On a\n * terminal result it surfaces the outcome and (in hosted mode) posts\n * `arkyc:complete` / `arkyc:error` / `arkyc:close` to the parent window.\n */\n/**\n * Re-base the server-resolved project logo onto the API origin the widget is\n * actually talking to. The stored `logo_url` carries the API's own host, which a\n * handed-off phone cannot reach — it reaches the API through the absolute\n * `baseUrl` passed in the handoff link. Rewriting the origin (keeping the path)\n * makes the logo load on whatever device runs the widget. Only applied when\n * `baseUrl` is absolute; the integrator's own branding is never re-based.\n */\nfunction rebaseBrandingLogo<T extends { logo_url?: string | null }>(branding: T, baseUrl: string | undefined): T {\n const logo = branding.logo_url\n if (!logo || !baseUrl || !/^https?:\\/\\//i.test(baseUrl)) return branding\n try {\n const base = new URL(baseUrl)\n const resolved = new URL(logo, base)\n if (resolved.origin === base.origin) return branding\n return { ...branding, logo_url: `${base.origin}${resolved.pathname}${resolved.search}${resolved.hash}` }\n } catch {\n return branding\n }\n}\n\nexport class WidgetController {\n private readonly client: ArkycClient\n private readonly view: WidgetView\n private readonly win: Window\n private readonly nav: Navigator\n private readonly postToParent: boolean\n private readonly scheduler: (fn: () => void, ms: number) => void\n private readonly transientMs: number\n private readonly pollMs: number\n private readonly maxPolls: number\n private readonly maxHandoffPolls: number\n\n /** Cross-device handoff: project config + whether the offer/QR is showing. */\n private handoffConfig: ClientHandoff = { enabled: false, allow_desktop: true, url: '' }\n private handoffReady = false\n private handoffActive = false\n\n /** This session's id + how to watch it live (push transport vs. polling). */\n private sessionId = ''\n private realtimeConfig: ClientRealtime | null = null\n private rtClient: WidgetRealtimeClient | null = null\n private rtResolved = false\n /** The last status observed, so a transition only emits once per change. */\n private lastStatus: VerificationStatus | null = null\n /** Per-name event listeners registered via {@link on}. */\n private listeners = new Map<string, Set<WidgetEventListener>>()\n /** Cancels the active session watch (e.g. continue-on-this-device). */\n private stopWatch: (() => void) | undefined\n\n private step: WidgetStep = 'welcome'\n private documentType: DocumentType | null = null\n private country: string | null = null\n private selfie: Blob | null = null\n private livenessMode: LivenessMode = 'passive'\n /** The session's capture model; `active` mandates a live camera (no fallback). */\n private captureModel: 'passive' | 'active' | 'both' = 'passive'\n private livenessChallenges: LivenessChallenge[] = []\n /** The address-entry form data, captured before the address submission. */\n private addressData: AddressFormData | null = null\n /** Device coordinates resolved on the address step (when the user opts in). */\n private addressCoords: { latitude: number; longitude: number } | null = null\n /** The applied workflow (orders/toggles stages, skip_ocr), or null for the default flow. */\n private workflow: WorkflowConfig | null = null\n private result: WidgetResult | null = null\n /** The session was already terminal when the widget loaded (show a close-only notice). */\n private terminalOnLoad = false\n /** Whether the current step's instruction interstitial has been acknowledged. */\n private instructionAcked = false\n private pendingError: Error | null = null\n private settled = false\n\n constructor(private readonly config: WidgetControllerConfig) {\n const doc = config.doc ?? globalThis.document\n const win = config.win ?? globalThis.window\n if (!doc || !win) throw new Error('The Arkyc widget must run in a browser environment.')\n this.win = win\n this.nav = config.nav ?? globalThis.navigator\n\n this.client = new ArkycClient({\n token: config.token,\n baseUrl: config.baseUrl,\n fetch: config.fetch,\n })\n const theme = new Theme(config.branding)\n this.view = new WidgetView(\n doc,\n theme,\n this.handlers(),\n config.nav ?? globalThis.navigator,\n config.faceAnalyzer,\n config.faceTuning,\n config.documentAnalyzer,\n config.documentTuning,\n )\n\n this.postToParent = config.postToParent ?? (!!win.parent && win.parent !== win)\n this.scheduler = config.scheduler ?? ((fn, ms) => setTimeout(fn, ms))\n this.transientMs = config.transientMs ?? 700\n this.pollMs = config.pollMs ?? 1500\n this.maxPolls = config.maxPolls ?? 40\n // A handed-off session is bounded by its TTL (~15 min); poll generously.\n this.maxHandoffPolls = config.maxHandoffPolls ?? 600\n }\n\n /** The widget's root element — append it to an overlay or inline container. */\n get element(): HTMLElement {\n return this.view.element\n }\n\n /** Connect to the session, then route to the result, the QR, or the welcome flow. */\n start(): void {\n this.view.renderLoading()\n void this.run(() => this.bootstrap())\n }\n\n /** Tear down the view and release the camera (does not fire callbacks). */\n destroy(): void {\n this.view.destroy()\n }\n\n /** Close the widget as if the user dismissed it (fires `onClose`/`onSettle`). */\n close(): void {\n this.finishClose()\n }\n\n /**\n * Subscribe to a named widget event; returns an unsubscribe function. Having a\n * listener (here or via `onEvent`) is what activates the event stream.\n */\n on(event: string, listener: WidgetEventListener): () => void {\n const set = this.listeners.get(event) ?? new Set<WidgetEventListener>()\n set.add(listener)\n this.listeners.set(event, set)\n\n return () => set.delete(listener)\n }\n\n /** Whether anyone is listening for `name` (the firehose or a named listener). */\n private hasListener(name: string): boolean {\n if (this.config.onEvent) return true\n const set = this.listeners.get(name)\n\n return !!set && set.size > 0\n }\n\n /**\n * Surface an event: to local listeners (firehose + `on`), and — in hosted\n * iframe mode — to the embedding parent as `arkyc:event` so the SDK's\n * `handle.on(...)` works across the frame.\n */\n private dispatch(name: string, data?: unknown): void {\n this.emit(name, data)\n // The parent window is the consumer in iframe mode, so forwarding there isn't\n // gated on a local listener (post() already no-ops when not embedding).\n this.post('arkyc:event', { name, data })\n }\n\n /** Emit an event to the firehose + named listeners — but only if one is active. */\n private emit(name: string, data?: unknown): void {\n if (!this.hasListener(name)) return\n try {\n this.config.onEvent?.({ name, data })\n } catch {\n // A consumer callback threw — never let it break the flow.\n }\n const set = this.listeners.get(name)\n if (set) {\n for (const listener of [...set]) {\n try {\n listener(data)\n } catch {\n // ditto\n }\n }\n }\n }\n\n /** Record an observed status, emitting `session.transition` on a real change. */\n private observe(status: VerificationStatus): void {\n if (status === this.lastStatus) return\n const previous = this.lastStatus\n this.lastStatus = status\n this.dispatch(REALTIME_EVENT.sessionTransition, {\n session_id: this.sessionId,\n status,\n previous_status: previous,\n } satisfies Partial<SessionTransitionEvent>)\n }\n\n /**\n * Lazily connect the push transport for this session (once). Returns null for\n * `polling`/`off`/`memory` or when the transport SDK can't load — the caller\n * then polls instead.\n */\n private async resolveRealtime(): Promise<WidgetRealtimeClient | null> {\n if (this.rtResolved) return this.rtClient\n this.rtResolved = true\n const cfg = this.realtimeConfig\n if (!cfg || cfg.transport === 'polling' || cfg.transport === 'off' || cfg.transport === 'memory') return null\n\n const factory = this.config.realtimeFactory ?? createWidgetRealtimeClient\n const apiBase = (this.config.baseUrl ?? '').replace(/\\/$/, '')\n try {\n this.rtClient = await factory(cfg, {\n authEndpoint: `${apiBase}/v1/client/realtime/auth`,\n token: this.config.token,\n })\n } catch {\n this.rtClient = null\n }\n\n return this.rtClient\n }\n\n private handlers(): ViewHandlers {\n return {\n onClose: () => this.finishClose(),\n // The session was already fetched + resolved during bootstrap; just advance.\n onStart: () => void this.run(() => this.enter(this.next())),\n onDocumentSelected: (type, country) => {\n this.documentType = type\n this.country = country || null\n void this.run(() => this.enter('front_capture'))\n },\n onImage: (blob) => void this.run(() => this.onImage(blob)),\n onActiveLiveness: (video, performed, selfie) =>\n void this.run(async () => {\n await this.client.submitLiveness({\n selfie,\n video,\n mode: 'active',\n challenges: performed,\n signals: this.config.signals,\n })\n await this.enter(this.next())\n }),\n onAddress: (data) => void this.run(() => this.onAddress(data)),\n onShareLocation: () => this.shareLocation(),\n onAcknowledge: () => this.finishResult(),\n onUsePhone: () => void this.run(() => this.startHandoff()),\n onContinueHere: () => {\n this.handoffActive = false\n this.stopWatch?.()\n this.step = 'welcome'\n this.render()\n },\n }\n }\n\n /**\n * Fetch the session and route: an already-terminal session (e.g. a stale handoff\n * link, or one finished on another device) shows a close-only notice; on a\n * desktop with handoff enabled we lead with the QR; otherwise the welcome flow.\n */\n private async bootstrap(): Promise<void> {\n if (this.settled) return\n const session = await this.client.getSession()\n if (this.settled) return\n this.sessionId = session.id\n this.realtimeConfig = session.realtime ?? null\n this.workflow = session.workflow ?? null\n // Theme from the project's branding (server-resolved) unless the integrator\n // passed branding explicitly — their value wins.\n if (this.config.branding == null && session.branding)\n this.view.applyBranding(rebaseBrandingLogo(session.branding, this.config.baseUrl))\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) return this.showTerminal(session.status)\n this.resolveLiveness(session)\n if (session.handoff) this.handoffConfig = session.handoff\n const canHandoff =\n this.config.handoff !== false && isDesktopDevice(this.nav) && this.handoffConfig.enabled && !!this.handoffTarget()\n if (canHandoff) {\n this.handoffReady = true\n await this.startHandoff()\n } else {\n this.step = 'welcome'\n this.render()\n }\n }\n\n /** The hosted handoff page URL: a consumer override, else the server-provided one. */\n private handoffTarget(): string {\n return (this.config.handoffUrl ?? this.handoffConfig.url ?? '').trim()\n }\n\n /** Render the QR for this session and wait for the other device to finish. */\n private async startHandoff(): Promise<void> {\n const target = this.handoffTarget()\n if (!target) return\n this.handoffActive = true\n // Offer \"continue on this device\" only when the project permits it.\n this.view.renderHandoff(renderQrSvg(this.buildHandoffUrl(target)), this.handoffConfig.allow_desktop)\n await this.pollHandoff()\n }\n\n /** Build the hosted-page URL the QR encodes (carries the session token).\n *\n * @param target\n * @returns\n */\n private buildHandoffUrl(target: string): string {\n const sep = target.includes('?') ? '&' : '?'\n let url = `${target}${sep}token=${encodeURIComponent(this.config.token)}`\n // The hosted page supplies its own API base; only pass one when ours is\n // absolute, so a custom cross-origin host can still reach the right API.\n const apiBase = (this.config.baseUrl ?? '').trim()\n if (/^https?:\\/\\//i.test(apiBase)) url += `&baseUrl=${encodeURIComponent(apiBase)}`\n return url\n }\n\n /**\n * Watch the session while the user verifies on the other\n * device; mirror the result.\n *\n * @returns\n */\n private async pollHandoff(): Promise<void> {\n const rt = await this.resolveRealtime()\n if (rt) {\n const status = await this.pushWatch(rt, this.maxHandoffPolls, () => this.handoffActive && !this.settled)\n if (status) {\n this.handoffActive = false\n return this.showResult(status)\n }\n\n return // cancelled (continue here) or budget elapsed → the QR persists\n }\n\n let errors = 0\n for (let i = 0; i < this.maxHandoffPolls && this.handoffActive && !this.settled; i++) {\n await this.delay(this.pollMs)\n if (!this.handoffActive || this.settled) return\n try {\n const session = await this.client.getSession()\n errors = 0\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) {\n this.handoffActive = false\n return this.showResult(session.status)\n }\n } catch (error) {\n // The session/token can expire mid-wait (401) — stop and reflect that.\n if (error instanceof WidgetApiError && error.status === 401) {\n this.handoffActive = false\n return this.showResult('expired')\n }\n if (++errors >= 5) return\n }\n }\n }\n\n /**\n * Await a terminal status over the push transport. Resolves to the terminal\n * status, or null if `active()` went false or the tick budget elapsed (push can\n * miss events / disconnect; the budget bounds the wait). An initial fetch\n * catches a session that finished before we subscribed.\n *\n * @param rt\n * @param budget\n * @param active\n * @returns\n */\n private pushWatch(\n rt: WidgetRealtimeClient,\n budget: number,\n active: () => boolean,\n ): Promise<VerificationStatus | null> {\n return new Promise((resolve) => {\n let done = false\n const finish = (status: VerificationStatus | null) => {\n if (done) return\n done = true\n this.stopWatch = undefined\n unsubscribe()\n resolve(status)\n }\n const channel = this.realtimeConfig!.channel\n const unsubscribe = rt.subscribe(channel, (event, data) => {\n if (event !== REALTIME_EVENT.sessionTransition) return\n const status = (data as SessionTransitionEvent).status\n this.observe(status)\n if (Flow.isTerminal(status)) finish(status)\n })\n this.stopWatch = () => finish(null)\n // Catch a race where the session already finished before we subscribed.\n void this.client\n .getSession()\n .then((session) => {\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) finish(session.status)\n })\n .catch((error) => {\n if (error instanceof WidgetApiError && error.status === 401) finish('expired')\n })\n // Bound the wait by the same tick budget the poller would use.\n const countdown = async (n: number): Promise<void> => {\n if (done) return\n if (!active() || n >= budget) return finish(null)\n await this.delay(this.pollMs)\n void countdown(n + 1)\n }\n void countdown(0)\n })\n }\n\n /**\n * Resolve which liveness flow to run from the session's capture model.\n *\n * @param session\n */\n private resolveLiveness(session: ClientSession): void {\n this.livenessChallenges = session.liveness_challenges ?? []\n const model = session.capture_model ?? 'passive'\n this.captureModel = model\n const wantsActive = model === 'active' || model === 'both'\n // `active` is honoured even without a live camera — the active-liveness\n // screen then shows the device as unsupported (no fallback). `both` falls\n // back to passive when the camera/recorder isn't available.\n this.livenessMode = wantsActive && (model === 'active' || this.view.cameraSupported) ? 'active' : 'passive'\n }\n\n private async onImage(blob: Blob | null): Promise<void> {\n const signals = this.config.signals\n switch (this.step) {\n case 'front_capture':\n await this.client.submitDocumentFront({\n image: blob,\n country: this.country,\n documentType: this.documentType,\n signals,\n })\n return this.enter(this.next())\n case 'back_capture':\n await this.client.submitDocumentBack({\n image: blob,\n country: this.country,\n documentType: this.documentType,\n })\n return this.enter('ocr_processing')\n case 'selfie_capture':\n this.selfie = blob\n return this.enter('passive_liveness')\n }\n }\n\n /**\n * Enter a step: render it, and drive any automatic (processing) work.\n *\n * @param step\n * @returns\n */\n private async enter(step: WidgetStep): Promise<void> {\n if (this.settled) return\n this.step = step\n\n // Lead each capture/liveness step with an instruction screen so the user\n // knows what's next and starts it deliberately. The Continue button re-enters\n // the same step with the instruction acknowledged.\n const instruction = STEP_INSTRUCTIONS[step]\n if (instruction && !this.instructionAcked) {\n this.view.renderInstruction(step, instruction.title, instruction.body, instruction.cta ?? 'Continue', () => {\n this.instructionAcked = true\n void this.run(() => this.enter(step))\n })\n return\n }\n this.instructionAcked = false\n this.render()\n\n switch (step) {\n case 'ocr_processing':\n await this.delay(this.transientMs)\n return this.enter(this.next())\n case 'address_processing':\n await this.submitAddress()\n return this.enter(this.next())\n case 'passive_liveness':\n await this.client.submitLiveness({ selfie: this.selfie, signals: this.config.signals })\n return this.enter(this.next())\n case 'face_match':\n await this.client.complete({ signals: this.config.signals })\n return this.enter(this.next())\n case 'processing':\n return this.poll()\n }\n }\n\n /** Watch the session until it reaches a terminal status (then show the result).\n *\n * @returns\n */\n private async poll(): Promise<void> {\n const rt = await this.resolveRealtime()\n if (rt) {\n const status = await this.pushWatch(rt, this.maxPolls, () => !this.settled)\n\n return this.showResult(status ?? 'requires_review')\n }\n\n for (let i = 0; i < this.maxPolls && !this.settled; i++) {\n const session = await this.client.getSession()\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) return this.showResult(session.status)\n await this.delay(this.pollMs)\n }\n // Still processing after the poll budget — surface as pending review.\n this.showResult('requires_review')\n }\n\n private showResult(status: VerificationStatus): void {\n this.result = { status, decision: Flow.statusToDecision(status) }\n this.step = 'result'\n this.render()\n }\n\n /**\n * A session that was already terminal on load: a notice with only a Close button.\n *\n * @param status\n */\n private showTerminal(status: VerificationStatus): void {\n this.result = { status, decision: Flow.statusToDecision(status) }\n this.step = 'result'\n this.terminalOnLoad = true\n this.render()\n }\n\n private render(): void {\n this.view.render({\n step: this.step,\n documentType: this.documentType,\n decision: this.result?.decision,\n status: this.result?.status,\n terminalNotice: this.terminalOnLoad,\n allowSkip: !!this.config.signals,\n livenessChallenges: this.livenessChallenges,\n requireLiveCamera: this.captureModel === 'active',\n // The active flow is strict end-to-end: documents must be detected, not\n // manually waved through.\n strictCapture: this.livenessMode === 'active',\n handoffAvailable: this.handoffReady,\n addressMethods: workflowAddressConfig(this.workflow)?.methods ?? [],\n })\n }\n\n /**\n * Store the entered address, resolve device location if opted in, then verify.\n *\n * @param data\n * @returns\n */\n private async onAddress(data: AddressFormData): Promise<void> {\n this.addressData = data\n // Coordinates are normally resolved up front by `shareLocation` when the user\n // ticks \"use my location\" (so the prompt is immediate); geolocate here only as\n // a fallback, and clear them if they opted out.\n if (!data.useLocation) this.addressCoords = null\n else if (!this.addressCoords) this.addressCoords = await this.geolocate()\n\n return this.enter('address_processing')\n }\n\n /** Request the device's location (from the address-entry \"use my location\" opt-in). */\n private async shareLocation(): Promise<boolean> {\n this.addressCoords = await this.geolocate()\n\n return !!this.addressCoords\n }\n\n /**\n * Submit the captured address evidence to the Client API.\n *\n * @returns\n */\n private async submitAddress(): Promise<void> {\n const data = this.addressData\n if (!data) return\n\n await this.client.submitAddress({\n line1: data.line1,\n line2: data.line2,\n city: data.city,\n region: data.region,\n postalCode: data.postalCode,\n country: data.country,\n poa: data.poa,\n latitude: this.addressCoords?.latitude ?? null,\n longitude: this.addressCoords?.longitude ?? null,\n signals: this.config.signals,\n })\n }\n\n /**\n * Resolve the device's coordinates via the Geolocation API. Resolves to `null`\n * on denial/unavailability/timeout — the `device_location` method then simply\n * has no coordinates to check (routing the session to review).\n *\n * @returns\n */\n private geolocate(): Promise<{ latitude: number; longitude: number } | null> {\n const geo = this.nav?.geolocation\n if (!geo) return Promise.resolve(null)\n\n return new Promise((resolve) => {\n geo.getCurrentPosition(\n (pos) => resolve({ latitude: pos.coords.latitude, longitude: pos.coords.longitude }),\n () => resolve(null),\n { enableHighAccuracy: false, timeout: 10_000, maximumAge: 60_000 },\n )\n })\n }\n\n private next(): WidgetStep {\n return Flow.nextStep(this.step, {\n documentType: this.documentType,\n livenessMode: this.livenessMode,\n workflow: this.workflow,\n })\n }\n\n private delay(ms: number): Promise<void> {\n return new Promise((resolve) => this.scheduler(resolve, ms))\n }\n\n /** Run an async step, routing any failure to the error screen. */\n private async run(fn: () => Promise<void> | void): Promise<void> {\n try {\n await fn()\n } catch (error) {\n this.fail(error)\n }\n }\n\n private fail(error: unknown): void {\n if (this.settled) return\n const err = error instanceof Error ? error : new Error(String(error))\n this.step = 'result'\n\n this.view.render({\n step: 'result',\n documentType: this.documentType,\n errorMessage: err.message,\n })\n\n this.pendingError = err\n }\n\n private finishResult(): void {\n if (this.settled) return\n this.settled = true\n this.teardownRealtime()\n\n if (this.pendingError) {\n this.post('arkyc:error', { error: serializeError(this.pendingError) })\n this.dispatch('error', { message: this.pendingError.message })\n this.config.onError?.(this.pendingError)\n } else if (this.result) {\n this.post('arkyc:complete', { payload: this.result })\n this.dispatch('complete', this.result)\n this.config.onComplete?.(this.result)\n }\n\n this.destroy()\n this.config.onSettle?.()\n }\n\n private finishClose(): void {\n if (this.settled) return\n\n this.settled = true\n this.teardownRealtime()\n this.post('arkyc:close', {})\n this.dispatch('close')\n this.config.onClose?.()\n this.destroy()\n this.config.onSettle?.()\n }\n\n /** Stop any active session watch + disconnect the push transport. */\n private teardownRealtime(): void {\n this.stopWatch?.()\n this.rtClient?.disconnect()\n this.rtClient = null\n }\n\n private post(type: string, extra: Record<string, unknown>): void {\n if (!this.postToParent) return\n try {\n this.win.parent?.postMessage({ type, ...extra }, '*')\n } catch {\n // Cross-origin parent without access — nothing more we can do.\n }\n }\n}\n\nfunction serializeError(error: Error): { message: string; name: string } {\n return { message: error.message, name: error.name }\n}\n\nexport const resolveContainer = (container: string | HTMLElement, doc: Document): HTMLElement => {\n const el = typeof container === 'string' ? doc.querySelector<HTMLElement>(container) : container\n if (!el) throw new Error(`ArkycWidget.mount: container \"${String(container)}\" not found.`)\n return el\n}\n\nexport const buildController = (options: BaseWidgetOptions, onSettle: () => void): WidgetController => {\n if (!options.token) throw new Error('ArkycWidget requires a client `token`.')\n return new WidgetController({\n token: options.token,\n baseUrl: options.baseUrl,\n handoff: options.handoff,\n handoffUrl: options.handoffUrl,\n branding: options.branding,\n signals: options.signals,\n onComplete: options.onComplete,\n onError: options.onError,\n onClose: options.onClose,\n onEvent: options.onEvent,\n onSettle,\n fetch: options.fetch,\n doc: options.doc,\n win: options.win,\n nav: options.nav,\n faceAnalyzer: options.faceAnalyzer,\n faceTuning: options.faceTuning,\n documentAnalyzer: options.documentAnalyzer,\n documentTuning: options.documentTuning,\n })\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,oBAAgG;CACpG,eAAe;EACb,OAAO;EACP,MAAM;CACR;CACA,cAAc;EACZ,OAAO;EACP,MAAM;CACR;CACA,gBAAgB;EACd,OAAO;EACP,MAAM;CACR;CACA,iBAAiB;EACf,OAAO;EACP,MAAM;CACR;AACF;;;;;;;;;;;;;;;;AAiBA,SAAS,mBAA2D,UAAa,SAAgC;CAC/G,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,gBAAgB,KAAK,OAAO,GAAG,OAAO;CAChE,IAAI;EACF,MAAM,OAAO,IAAI,IAAI,OAAO;EAC5B,MAAM,WAAW,IAAI,IAAI,MAAM,IAAI;EACnC,IAAI,SAAS,WAAW,KAAK,QAAQ,OAAO;EAC5C,OAAO;GAAE,GAAG;GAAU,UAAU,GAAG,KAAK,SAAS,SAAS,WAAW,SAAS,SAAS,SAAS;EAAO;CACzG,QAAQ;EACN,OAAO;CACT;AACF;AAEA,IAAa,mBAAb,MAA8B;CAmDC;CAlD7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;CAGA,gBAAuC;EAAE,SAAS;EAAO,eAAe;EAAM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pB,kBAAkB,QAAQ;EAC1B,gBAAgB,QAAQ;CAC1B,CAAC;AACH"}
1
+ {"version":3,"file":"controller.mjs","names":[],"sources":["../src/controller.ts"],"sourcesContent":["import type {\n DocumentType,\n LivenessChallenge,\n LivenessMode,\n SessionTransitionEvent,\n VerificationStatus,\n WidgetResult,\n WidgetStep,\n WorkflowConfig,\n} from '@arkyc/types'\nimport { REALTIME_EVENT, workflowAddressConfig } from '@arkyc/types'\nimport { ArkycClient, type ClientHandoff, type ClientRealtime, type ClientSession, WidgetApiError } from './client'\nimport { Flow } from './flow'\nimport { Theme } from './theme'\nimport { WidgetView, type AddressFormData } from './ui'\nimport { isDesktopDevice } from './device'\nimport { renderQrSvg } from './qr'\nimport { createWidgetRealtimeClient, type WidgetRealtimeClient } from './realtime'\nimport type { BaseWidgetOptions, ViewHandlers, WidgetControllerConfig, WidgetEventListener } from './types'\n\n/** Per-step lead-in copy shown before each capture/liveness step. */\nconst STEP_INSTRUCTIONS: Partial<Record<WidgetStep, { title: string; body: string; cta?: string }>> = {\n front_capture: {\n title: 'Front of your document',\n body: 'Place the front of your ID flat and fully inside the frame. We’ll capture it automatically.',\n },\n back_capture: {\n title: 'Back of your document',\n body: 'Now turn your ID over and show the back, fully inside the frame.',\n },\n selfie_capture: {\n title: 'Take a selfie',\n body: 'Look straight at the camera in good light and hold still — we’ll capture it automatically.',\n },\n active_liveness: {\n title: 'Quick liveness check',\n body: 'Follow the on-screen prompts (such as turn your head, blink or smile). This confirms you’re really here.',\n },\n}\n\n/**\n * Drives the full verification flow: renders each screen via {@link WidgetView},\n * advances through {@link flow}, and calls the Client API at each step. Cosmetic\n * processing screens auto-advance; capture screens wait for an image. On a\n * terminal result it surfaces the outcome and (in hosted mode) posts\n * `arkyc:complete` / `arkyc:error` / `arkyc:close` to the parent window.\n */\n/**\n * Re-base the server-resolved project logo onto the API origin the widget is\n * actually talking to. The stored `logo_url` carries the API's own host, which a\n * handed-off phone cannot reach — it reaches the API through the absolute\n * `baseUrl` passed in the handoff link. Rewriting the origin (keeping the path)\n * makes the logo load on whatever device runs the widget. Only applied when\n * `baseUrl` is absolute; the integrator's own branding is never re-based.\n */\nfunction rebaseBrandingLogo<T extends { logo_url?: string | null }>(branding: T, baseUrl: string | undefined): T {\n const logo = branding.logo_url\n if (!logo || !baseUrl || !/^https?:\\/\\//i.test(baseUrl)) return branding\n try {\n const base = new URL(baseUrl)\n const resolved = new URL(logo, base)\n if (resolved.origin === base.origin) return branding\n return { ...branding, logo_url: `${base.origin}${resolved.pathname}${resolved.search}${resolved.hash}` }\n } catch {\n return branding\n }\n}\n\nexport class WidgetController {\n private readonly client: ArkycClient\n private readonly view: WidgetView\n private readonly win: Window\n private readonly nav: Navigator\n private readonly postToParent: boolean\n private readonly scheduler: (fn: () => void, ms: number) => void\n private readonly transientMs: number\n private readonly pollMs: number\n private readonly maxPolls: number\n private readonly maxHandoffPolls: number\n\n /** Cross-device handoff: project config + whether the offer/QR is showing. */\n private handoffConfig: ClientHandoff = { enabled: false, allow_desktop: true, url: '' }\n private handoffReady = false\n private handoffActive = false\n\n /** This session's id + how to watch it live (push transport vs. polling). */\n private sessionId = ''\n private realtimeConfig: ClientRealtime | null = null\n private rtClient: WidgetRealtimeClient | null = null\n private rtResolved = false\n /** The last status observed, so a transition only emits once per change. */\n private lastStatus: VerificationStatus | null = null\n /** Per-name event listeners registered via {@link on}. */\n private listeners = new Map<string, Set<WidgetEventListener>>()\n /** Cancels the active session watch (e.g. continue-on-this-device). */\n private stopWatch: (() => void) | undefined\n\n private step: WidgetStep = 'welcome'\n private documentType: DocumentType | null = null\n private country: string | null = null\n private selfie: Blob | null = null\n private livenessMode: LivenessMode = 'passive'\n /** The session's capture model; `active` mandates a live camera (no fallback). */\n private captureModel: 'passive' | 'active' | 'both' = 'passive'\n private livenessChallenges: LivenessChallenge[] = []\n /** The address-entry form data, captured before the address submission. */\n private addressData: AddressFormData | null = null\n /** Device coordinates resolved on the address step (when the user opts in). */\n private addressCoords: { latitude: number; longitude: number } | null = null\n /** The applied workflow (orders/toggles stages, skip_ocr), or null for the default flow. */\n private workflow: WorkflowConfig | null = null\n private result: WidgetResult | null = null\n /** The session was already terminal when the widget loaded (show a close-only notice). */\n private terminalOnLoad = false\n /** Whether the current step's instruction interstitial has been acknowledged. */\n private instructionAcked = false\n private pendingError: Error | null = null\n private settled = false\n\n constructor(private readonly config: WidgetControllerConfig) {\n const doc = config.doc ?? globalThis.document\n const win = config.win ?? globalThis.window\n if (!doc || !win) throw new Error('The Arkyc widget must run in a browser environment.')\n this.win = win\n this.nav = config.nav ?? globalThis.navigator\n\n this.client = new ArkycClient({\n token: config.token,\n baseUrl: config.baseUrl,\n fetch: config.fetch,\n })\n const theme = new Theme(config.branding)\n this.view = new WidgetView(\n doc,\n theme,\n this.handlers(),\n config.nav ?? globalThis.navigator,\n config.faceAnalyzer,\n config.faceTuning,\n config.documentAnalyzer,\n config.documentTuning,\n )\n\n this.postToParent = config.postToParent ?? (!!win.parent && win.parent !== win)\n this.scheduler = config.scheduler ?? ((fn, ms) => setTimeout(fn, ms))\n this.transientMs = config.transientMs ?? 700\n this.pollMs = config.pollMs ?? 1500\n this.maxPolls = config.maxPolls ?? 40\n // A handed-off session is bounded by its TTL (~15 min); poll generously.\n this.maxHandoffPolls = config.maxHandoffPolls ?? 600\n }\n\n /** The widget's root element — append it to an overlay or inline container. */\n get element(): HTMLElement {\n return this.view.element\n }\n\n /** Connect to the session, then route to the result, the QR, or the welcome flow. */\n start(): void {\n this.view.renderLoading()\n void this.run(() => this.bootstrap())\n }\n\n /** Tear down the view and release the camera (does not fire callbacks). */\n destroy(): void {\n this.view.destroy()\n }\n\n /** Close the widget as if the user dismissed it (fires `onClose`/`onSettle`). */\n close(): void {\n this.finishClose()\n }\n\n /**\n * Subscribe to a named widget event; returns an unsubscribe function. Having a\n * listener (here or via `onEvent`) is what activates the event stream.\n */\n on(event: string, listener: WidgetEventListener): () => void {\n const set = this.listeners.get(event) ?? new Set<WidgetEventListener>()\n set.add(listener)\n this.listeners.set(event, set)\n\n return () => set.delete(listener)\n }\n\n /** Whether anyone is listening for `name` (the firehose or a named listener). */\n private hasListener(name: string): boolean {\n if (this.config.onEvent) return true\n const set = this.listeners.get(name)\n\n return !!set && set.size > 0\n }\n\n /**\n * Surface an event: to local listeners (firehose + `on`), and — in hosted\n * iframe mode — to the embedding parent as `arkyc:event` so the SDK's\n * `handle.on(...)` works across the frame.\n */\n private dispatch(name: string, data?: unknown): void {\n this.emit(name, data)\n // The parent window is the consumer in iframe mode, so forwarding there isn't\n // gated on a local listener (post() already no-ops when not embedding).\n this.post('arkyc:event', { name, data })\n }\n\n /** Emit an event to the firehose + named listeners — but only if one is active. */\n private emit(name: string, data?: unknown): void {\n if (!this.hasListener(name)) return\n try {\n this.config.onEvent?.({ name, data })\n } catch {\n // A consumer callback threw — never let it break the flow.\n }\n const set = this.listeners.get(name)\n if (set) {\n for (const listener of [...set]) {\n try {\n listener(data)\n } catch {\n // ditto\n }\n }\n }\n }\n\n /** Record an observed status, emitting `session.transition` on a real change. */\n private observe(status: VerificationStatus): void {\n if (status === this.lastStatus) return\n const previous = this.lastStatus\n this.lastStatus = status\n this.dispatch(REALTIME_EVENT.sessionTransition, {\n session_id: this.sessionId,\n status,\n previous_status: previous,\n } satisfies Partial<SessionTransitionEvent>)\n }\n\n /**\n * Lazily connect the push transport for this session (once). Returns null for\n * `polling`/`off`/`memory` or when the transport SDK can't load — the caller\n * then polls instead.\n */\n private async resolveRealtime(): Promise<WidgetRealtimeClient | null> {\n if (this.rtResolved) return this.rtClient\n this.rtResolved = true\n const cfg = this.realtimeConfig\n if (!cfg || cfg.transport === 'polling' || cfg.transport === 'off' || cfg.transport === 'memory') return null\n\n const factory = this.config.realtimeFactory ?? createWidgetRealtimeClient\n const apiBase = (this.config.baseUrl ?? '').replace(/\\/$/, '')\n try {\n this.rtClient = await factory(cfg, {\n authEndpoint: `${apiBase}/realtime/auth`,\n token: this.config.token,\n })\n } catch {\n this.rtClient = null\n }\n\n return this.rtClient\n }\n\n private handlers(): ViewHandlers {\n return {\n onClose: () => this.finishClose(),\n // The session was already fetched + resolved during bootstrap; just advance.\n onStart: () => void this.run(() => this.enter(this.next())),\n onDocumentSelected: (type, country) => {\n this.documentType = type\n this.country = country || null\n void this.run(() => this.enter('front_capture'))\n },\n onImage: (blob) => void this.run(() => this.onImage(blob)),\n onActiveLiveness: (video, performed, selfie) =>\n void this.run(async () => {\n await this.client.submitLiveness({\n selfie,\n video,\n mode: 'active',\n challenges: performed,\n signals: this.config.signals,\n })\n await this.enter(this.next())\n }),\n onAddress: (data) => void this.run(() => this.onAddress(data)),\n onShareLocation: () => this.shareLocation(),\n onAcknowledge: () => this.finishResult(),\n onUsePhone: () => void this.run(() => this.startHandoff()),\n onContinueHere: () => {\n this.handoffActive = false\n this.stopWatch?.()\n this.step = 'welcome'\n this.render()\n },\n }\n }\n\n /**\n * Fetch the session and route: an already-terminal session (e.g. a stale handoff\n * link, or one finished on another device) shows a close-only notice; on a\n * desktop with handoff enabled we lead with the QR; otherwise the welcome flow.\n */\n private async bootstrap(): Promise<void> {\n if (this.settled) return\n const session = await this.client.getSession()\n if (this.settled) return\n this.sessionId = session.id\n this.realtimeConfig = session.realtime ?? null\n this.workflow = session.workflow ?? null\n // Theme from the project's branding (server-resolved) unless the integrator\n // passed branding explicitly — their value wins.\n if (this.config.branding == null && session.branding)\n this.view.applyBranding(rebaseBrandingLogo(session.branding, this.config.baseUrl))\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) return this.showTerminal(session.status)\n this.resolveLiveness(session)\n if (session.handoff) this.handoffConfig = session.handoff\n const canHandoff =\n this.config.handoff !== false && isDesktopDevice(this.nav) && this.handoffConfig.enabled && !!this.handoffTarget()\n if (canHandoff) {\n this.handoffReady = true\n await this.startHandoff()\n } else {\n this.step = 'welcome'\n this.render()\n }\n }\n\n /** The hosted handoff page URL: a consumer override, else the server-provided one. */\n private handoffTarget(): string {\n return (this.config.handoffUrl ?? this.handoffConfig.url ?? '').trim()\n }\n\n /** Render the QR for this session and wait for the other device to finish. */\n private async startHandoff(): Promise<void> {\n const target = this.handoffTarget()\n if (!target) return\n this.handoffActive = true\n // Offer \"continue on this device\" only when the project permits it.\n this.view.renderHandoff(renderQrSvg(this.buildHandoffUrl(target)), this.handoffConfig.allow_desktop)\n await this.pollHandoff()\n }\n\n /** Build the hosted-page URL the QR encodes (carries the session token).\n *\n * @param target\n * @returns\n */\n private buildHandoffUrl(target: string): string {\n const sep = target.includes('?') ? '&' : '?'\n let url = `${target}${sep}token=${encodeURIComponent(this.config.token)}`\n // The hosted page supplies its own API base; only pass one when ours is\n // absolute, so a custom cross-origin host can still reach the right API.\n const apiBase = (this.config.baseUrl ?? '').trim()\n if (/^https?:\\/\\//i.test(apiBase)) url += `&baseUrl=${encodeURIComponent(apiBase)}`\n return url\n }\n\n /**\n * Watch the session while the user verifies on the other\n * device; mirror the result.\n *\n * @returns\n */\n private async pollHandoff(): Promise<void> {\n const rt = await this.resolveRealtime()\n if (rt) {\n const status = await this.pushWatch(rt, this.maxHandoffPolls, () => this.handoffActive && !this.settled)\n if (status) {\n this.handoffActive = false\n return this.showResult(status)\n }\n\n return // cancelled (continue here) or budget elapsed → the QR persists\n }\n\n let errors = 0\n for (let i = 0; i < this.maxHandoffPolls && this.handoffActive && !this.settled; i++) {\n await this.delay(this.pollMs)\n if (!this.handoffActive || this.settled) return\n try {\n const session = await this.client.getSession()\n errors = 0\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) {\n this.handoffActive = false\n return this.showResult(session.status)\n }\n } catch (error) {\n // The session/token can expire mid-wait (401) — stop and reflect that.\n if (error instanceof WidgetApiError && error.status === 401) {\n this.handoffActive = false\n return this.showResult('expired')\n }\n if (++errors >= 5) return\n }\n }\n }\n\n /**\n * Await a terminal status over the push transport. Resolves to the terminal\n * status, or null if `active()` went false or the tick budget elapsed (push can\n * miss events / disconnect; the budget bounds the wait). An initial fetch\n * catches a session that finished before we subscribed.\n *\n * @param rt\n * @param budget\n * @param active\n * @returns\n */\n private pushWatch(\n rt: WidgetRealtimeClient,\n budget: number,\n active: () => boolean,\n ): Promise<VerificationStatus | null> {\n return new Promise((resolve) => {\n let done = false\n const finish = (status: VerificationStatus | null) => {\n if (done) return\n done = true\n this.stopWatch = undefined\n unsubscribe()\n resolve(status)\n }\n const channel = this.realtimeConfig!.channel\n const unsubscribe = rt.subscribe(channel, (event, data) => {\n if (event !== REALTIME_EVENT.sessionTransition) return\n const status = (data as SessionTransitionEvent).status\n this.observe(status)\n if (Flow.isTerminal(status)) finish(status)\n })\n this.stopWatch = () => finish(null)\n // Catch a race where the session already finished before we subscribed.\n void this.client\n .getSession()\n .then((session) => {\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) finish(session.status)\n })\n .catch((error) => {\n if (error instanceof WidgetApiError && error.status === 401) finish('expired')\n })\n // Bound the wait by the same tick budget the poller would use.\n const countdown = async (n: number): Promise<void> => {\n if (done) return\n if (!active() || n >= budget) return finish(null)\n await this.delay(this.pollMs)\n void countdown(n + 1)\n }\n void countdown(0)\n })\n }\n\n /**\n * Resolve which liveness flow to run from the session's capture model.\n *\n * @param session\n */\n private resolveLiveness(session: ClientSession): void {\n this.livenessChallenges = session.liveness_challenges ?? []\n const model = session.capture_model ?? 'passive'\n this.captureModel = model\n const wantsActive = model === 'active' || model === 'both'\n // `active` is honoured even without a live camera — the active-liveness\n // screen then shows the device as unsupported (no fallback). `both` falls\n // back to passive when the camera/recorder isn't available.\n this.livenessMode = wantsActive && (model === 'active' || this.view.cameraSupported) ? 'active' : 'passive'\n }\n\n private async onImage(blob: Blob | null): Promise<void> {\n const signals = this.config.signals\n switch (this.step) {\n case 'front_capture':\n await this.client.submitDocumentFront({\n image: blob,\n country: this.country,\n documentType: this.documentType,\n signals,\n })\n return this.enter(this.next())\n case 'back_capture':\n await this.client.submitDocumentBack({\n image: blob,\n country: this.country,\n documentType: this.documentType,\n })\n return this.enter('ocr_processing')\n case 'selfie_capture':\n this.selfie = blob\n return this.enter('passive_liveness')\n }\n }\n\n /**\n * Enter a step: render it, and drive any automatic (processing) work.\n *\n * @param step\n * @returns\n */\n private async enter(step: WidgetStep): Promise<void> {\n if (this.settled) return\n this.step = step\n\n // Lead each capture/liveness step with an instruction screen so the user\n // knows what's next and starts it deliberately. The Continue button re-enters\n // the same step with the instruction acknowledged.\n const instruction = STEP_INSTRUCTIONS[step]\n if (instruction && !this.instructionAcked) {\n this.view.renderInstruction(step, instruction.title, instruction.body, instruction.cta ?? 'Continue', () => {\n this.instructionAcked = true\n void this.run(() => this.enter(step))\n })\n return\n }\n this.instructionAcked = false\n this.render()\n\n switch (step) {\n case 'ocr_processing':\n await this.delay(this.transientMs)\n return this.enter(this.next())\n case 'address_processing':\n await this.submitAddress()\n return this.enter(this.next())\n case 'passive_liveness':\n await this.client.submitLiveness({ selfie: this.selfie, signals: this.config.signals })\n return this.enter(this.next())\n case 'face_match':\n await this.client.complete({ signals: this.config.signals })\n return this.enter(this.next())\n case 'processing':\n return this.poll()\n }\n }\n\n /** Watch the session until it reaches a terminal status (then show the result).\n *\n * @returns\n */\n private async poll(): Promise<void> {\n const rt = await this.resolveRealtime()\n if (rt) {\n const status = await this.pushWatch(rt, this.maxPolls, () => !this.settled)\n\n return this.showResult(status ?? 'requires_review')\n }\n\n for (let i = 0; i < this.maxPolls && !this.settled; i++) {\n const session = await this.client.getSession()\n this.observe(session.status)\n if (Flow.isTerminal(session.status)) return this.showResult(session.status)\n await this.delay(this.pollMs)\n }\n // Still processing after the poll budget — surface as pending review.\n this.showResult('requires_review')\n }\n\n private showResult(status: VerificationStatus): void {\n this.result = { status, decision: Flow.statusToDecision(status) }\n this.step = 'result'\n this.render()\n }\n\n /**\n * A session that was already terminal on load: a notice with only a Close button.\n *\n * @param status\n */\n private showTerminal(status: VerificationStatus): void {\n this.result = { status, decision: Flow.statusToDecision(status) }\n this.step = 'result'\n this.terminalOnLoad = true\n this.render()\n }\n\n private render(): void {\n this.view.render({\n step: this.step,\n documentType: this.documentType,\n decision: this.result?.decision,\n status: this.result?.status,\n terminalNotice: this.terminalOnLoad,\n allowSkip: !!this.config.signals,\n livenessChallenges: this.livenessChallenges,\n requireLiveCamera: this.captureModel === 'active',\n // The active flow is strict end-to-end: documents must be detected, not\n // manually waved through.\n strictCapture: this.livenessMode === 'active',\n handoffAvailable: this.handoffReady,\n addressMethods: workflowAddressConfig(this.workflow)?.methods ?? [],\n })\n }\n\n /**\n * Store the entered address, resolve device location if opted in, then verify.\n *\n * @param data\n * @returns\n */\n private async onAddress(data: AddressFormData): Promise<void> {\n this.addressData = data\n // Coordinates are normally resolved up front by `shareLocation` when the user\n // ticks \"use my location\" (so the prompt is immediate); geolocate here only as\n // a fallback, and clear them if they opted out.\n if (!data.useLocation) this.addressCoords = null\n else if (!this.addressCoords) this.addressCoords = await this.geolocate()\n\n return this.enter('address_processing')\n }\n\n /** Request the device's location (from the address-entry \"use my location\" opt-in). */\n private async shareLocation(): Promise<boolean> {\n this.addressCoords = await this.geolocate()\n\n return !!this.addressCoords\n }\n\n /**\n * Submit the captured address evidence to the Client API.\n *\n * @returns\n */\n private async submitAddress(): Promise<void> {\n const data = this.addressData\n if (!data) return\n\n await this.client.submitAddress({\n line1: data.line1,\n line2: data.line2,\n city: data.city,\n region: data.region,\n postalCode: data.postalCode,\n country: data.country,\n poa: data.poa,\n latitude: this.addressCoords?.latitude ?? null,\n longitude: this.addressCoords?.longitude ?? null,\n signals: this.config.signals,\n })\n }\n\n /**\n * Resolve the device's coordinates via the Geolocation API. Resolves to `null`\n * on denial/unavailability/timeout — the `device_location` method then simply\n * has no coordinates to check (routing the session to review).\n *\n * @returns\n */\n private geolocate(): Promise<{ latitude: number; longitude: number } | null> {\n const geo = this.nav?.geolocation\n if (!geo) return Promise.resolve(null)\n\n return new Promise((resolve) => {\n geo.getCurrentPosition(\n (pos) => resolve({ latitude: pos.coords.latitude, longitude: pos.coords.longitude }),\n () => resolve(null),\n { enableHighAccuracy: false, timeout: 10_000, maximumAge: 60_000 },\n )\n })\n }\n\n private next(): WidgetStep {\n return Flow.nextStep(this.step, {\n documentType: this.documentType,\n livenessMode: this.livenessMode,\n workflow: this.workflow,\n })\n }\n\n private delay(ms: number): Promise<void> {\n return new Promise((resolve) => this.scheduler(resolve, ms))\n }\n\n /** Run an async step, routing any failure to the error screen. */\n private async run(fn: () => Promise<void> | void): Promise<void> {\n try {\n await fn()\n } catch (error) {\n this.fail(error)\n }\n }\n\n private fail(error: unknown): void {\n if (this.settled) return\n const err = error instanceof Error ? error : new Error(String(error))\n this.step = 'result'\n\n this.view.render({\n step: 'result',\n documentType: this.documentType,\n errorMessage: err.message,\n })\n\n this.pendingError = err\n }\n\n private finishResult(): void {\n if (this.settled) return\n this.settled = true\n this.teardownRealtime()\n\n if (this.pendingError) {\n this.post('arkyc:error', { error: serializeError(this.pendingError) })\n this.dispatch('error', { message: this.pendingError.message })\n this.config.onError?.(this.pendingError)\n } else if (this.result) {\n this.post('arkyc:complete', { payload: this.result })\n this.dispatch('complete', this.result)\n this.config.onComplete?.(this.result)\n }\n\n this.destroy()\n this.config.onSettle?.()\n }\n\n private finishClose(): void {\n if (this.settled) return\n\n this.settled = true\n this.teardownRealtime()\n this.post('arkyc:close', {})\n this.dispatch('close')\n this.config.onClose?.()\n this.destroy()\n this.config.onSettle?.()\n }\n\n /** Stop any active session watch + disconnect the push transport. */\n private teardownRealtime(): void {\n this.stopWatch?.()\n this.rtClient?.disconnect()\n this.rtClient = null\n }\n\n private post(type: string, extra: Record<string, unknown>): void {\n if (!this.postToParent) return\n try {\n this.win.parent?.postMessage({ type, ...extra }, '*')\n } catch {\n // Cross-origin parent without access — nothing more we can do.\n }\n }\n}\n\nfunction serializeError(error: Error): { message: string; name: string } {\n return { message: error.message, name: error.name }\n}\n\nexport const resolveContainer = (container: string | HTMLElement, doc: Document): HTMLElement => {\n const el = typeof container === 'string' ? doc.querySelector<HTMLElement>(container) : container\n if (!el) throw new Error(`ArkycWidget.mount: container \"${String(container)}\" not found.`)\n return el\n}\n\nexport const buildController = (options: BaseWidgetOptions, onSettle: () => void): WidgetController => {\n if (!options.token) throw new Error('ArkycWidget requires a client `token`.')\n return new WidgetController({\n token: options.token,\n baseUrl: options.baseUrl,\n handoff: options.handoff,\n handoffUrl: options.handoffUrl,\n branding: options.branding,\n signals: options.signals,\n onComplete: options.onComplete,\n onError: options.onError,\n onClose: options.onClose,\n onEvent: options.onEvent,\n onSettle,\n fetch: options.fetch,\n doc: options.doc,\n win: options.win,\n nav: options.nav,\n faceAnalyzer: options.faceAnalyzer,\n faceTuning: options.faceTuning,\n documentAnalyzer: options.documentAnalyzer,\n documentTuning: options.documentTuning,\n })\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,oBAAgG;CACpG,eAAe;EACb,OAAO;EACP,MAAM;CACR;CACA,cAAc;EACZ,OAAO;EACP,MAAM;CACR;CACA,gBAAgB;EACd,OAAO;EACP,MAAM;CACR;CACA,iBAAiB;EACf,OAAO;EACP,MAAM;CACR;AACF;;;;;;;;;;;;;;;;AAiBA,SAAS,mBAA2D,UAAa,SAAgC;CAC/G,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,gBAAgB,KAAK,OAAO,GAAG,OAAO;CAChE,IAAI;EACF,MAAM,OAAO,IAAI,IAAI,OAAO;EAC5B,MAAM,WAAW,IAAI,IAAI,MAAM,IAAI;EACnC,IAAI,SAAS,WAAW,KAAK,QAAQ,OAAO;EAC5C,OAAO;GAAE,GAAG;GAAU,UAAU,GAAG,KAAK,SAAS,SAAS,WAAW,SAAS,SAAS,SAAS;EAAO;CACzG,QAAQ;EACN,OAAO;CACT;AACF;AAEA,IAAa,mBAAb,MAA8B;CAmDC;CAlD7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;CAGA,gBAAuC;EAAE,SAAS;EAAO,eAAe;EAAM,KAAK;CAAG;CACtF,eAAuB;CACvB,gBAAwB;;CAGxB,YAAoB;CACp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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyc/widget",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Embeddable, framework-agnostic Arkyc identity-verification widget",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "qrcode-generator": "^1.4.4",
43
- "@arkyc/types": "^1.2.2"
43
+ "@arkyc/types": "^1.2.4"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "firebase": "^11.0.0",