@splitin/verification-react 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +32 -0
  3. package/README.md +14 -0
  4. package/dist/appeal.cjs +63 -0
  5. package/dist/appeal.cjs.map +1 -0
  6. package/dist/appeal.d.cts +21 -0
  7. package/dist/appeal.d.ts +21 -0
  8. package/dist/appeal.d.ts.map +1 -0
  9. package/dist/appeal.js +61 -0
  10. package/dist/appeal.js.map +1 -0
  11. package/dist/index.cjs +126 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +49 -0
  14. package/dist/index.d.ts +49 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +118 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/launcher.cjs +501 -0
  19. package/dist/launcher.cjs.map +1 -0
  20. package/dist/launcher.d.cts +39 -0
  21. package/dist/launcher.d.ts +39 -0
  22. package/dist/launcher.d.ts.map +1 -0
  23. package/dist/launcher.js +499 -0
  24. package/dist/launcher.js.map +1 -0
  25. package/dist/operations.cjs +225 -0
  26. package/dist/operations.cjs.map +1 -0
  27. package/dist/operations.d.cts +37 -0
  28. package/dist/operations.d.ts +37 -0
  29. package/dist/operations.d.ts.map +1 -0
  30. package/dist/operations.js +223 -0
  31. package/dist/operations.js.map +1 -0
  32. package/dist/retry.cjs +16 -0
  33. package/dist/retry.cjs.map +1 -0
  34. package/dist/retry.d.cts +9 -0
  35. package/dist/retry.d.ts +9 -0
  36. package/dist/retry.d.ts.map +1 -0
  37. package/dist/retry.js +14 -0
  38. package/dist/retry.js.map +1 -0
  39. package/dist/status.cjs +27 -0
  40. package/dist/status.cjs.map +1 -0
  41. package/dist/status.d.cts +8 -0
  42. package/dist/status.d.ts +8 -0
  43. package/dist/status.d.ts.map +1 -0
  44. package/dist/status.js +25 -0
  45. package/dist/status.js.map +1 -0
  46. package/dist/support.cjs +12 -0
  47. package/dist/support.cjs.map +1 -0
  48. package/dist/support.d.cts +8 -0
  49. package/dist/support.d.ts +8 -0
  50. package/dist/support.d.ts.map +1 -0
  51. package/dist/support.js +10 -0
  52. package/dist/support.js.map +1 -0
  53. package/package.json +92 -0
  54. package/src/styles.css +71 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SplitInTech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,32 @@
1
+ Verification Adapter SDK
2
+ Copyright (c) 2026 SplitInTech
3
+
4
+ This product is licensed under the MIT License. See LICENSE.
5
+
6
+ Third-party notices
7
+ ===================
8
+
9
+ This project redistributes no vendor identity SDKs in its core or server
10
+ packages. Optional peer dependencies used by browser plugins:
11
+
12
+ - `@stripe/stripe-js` — Stripe, Inc. (MIT). Used only by the Stripe Identity
13
+ browser plugin via dynamic import. Stripe is a trademark of Stripe, Inc.
14
+ - `persona` — Persona Identities, Inc. Used only by the Persona browser plugin
15
+ via dynamic import.
16
+ - `react-plaid-link` — Plaid Inc. (MIT). Used only by the Plaid Identity
17
+ Verification browser plugin via dynamic import. Plaid is a trademark of
18
+ Plaid Inc.
19
+
20
+ Server adapters speak HTTPS to provider APIs with an injected Fetch
21
+ implementation. They do not bundle Stripe, Persona, or Plaid Node SDKs.
22
+
23
+ Runtime and tooling (declared in package.json; not vendored):
24
+
25
+ - `ajv` — MIT
26
+ - `jose` — MIT (Plaid webhook JWT verification)
27
+ - `pg` — MIT (optional PostgreSQL executor)
28
+ - TypeScript, tsup, vitest, Changesets — Apache-2.0 / MIT as published by
29
+ their authors
30
+
31
+ This project provides engineering primitives. It is not a legal, KYC, KYB, or
32
+ regulatory compliance certification.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # `@splitin/verification-react`
2
+
3
+ Accessible React 18/19 hooks and CSS-variable components for verification.
4
+ Provider SDKs load through `import()` so unused vendors stay out of the initial
5
+ bundle. Browser `onComplete` only refreshes authoritative server status.
6
+
7
+ ```ts
8
+ import { useVerificationSession } from '@splitin/verification-react';
9
+ import { VerificationLauncher } from '@splitin/verification-react/launcher';
10
+ ```
11
+
12
+ Operations UI lives at `@splitin/verification-react/operations` and always
13
+ sends CSRF and idempotency headers; separation-of-duties is enforced by the
14
+ server even if the console hides a button.
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ // src/appeal/AppealForm.tsx
7
+ function AppealForm({ attemptId, onSubmit, onSubmitted, onCancel }) {
8
+ const [reasonCode, setReasonCode] = react.useState("non_biometric_alternative");
9
+ const [busy, setBusy] = react.useState(false);
10
+ const [result, setResult] = react.useState(null);
11
+ const [error, setError] = react.useState(null);
12
+ return /* @__PURE__ */ jsxRuntime.jsxs(
13
+ "form",
14
+ {
15
+ className: "siv siv-dialog",
16
+ "aria-labelledby": "siv-appeal-title",
17
+ onSubmit: (event) => {
18
+ event.preventDefault();
19
+ if (!onSubmit) {
20
+ setError("Appeal submission is not configured.");
21
+ return;
22
+ }
23
+ setBusy(true);
24
+ void onSubmit({
25
+ attemptId,
26
+ reasonCode,
27
+ nonBiometricPathRequested: reasonCode === "non_biometric_alternative"
28
+ }).then((next) => {
29
+ setResult(next);
30
+ onSubmitted?.(next);
31
+ }).catch((cause) => {
32
+ setError(cause instanceof Error ? cause.message : "Verification review could not be requested.");
33
+ }).finally(() => setBusy(false));
34
+ },
35
+ children: [
36
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "siv-title", id: "siv-appeal-title", children: "Request a verification review" }),
37
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "siv-copy", children: "Support sees only a safe review reference. Identity documents remain with the verification provider." }),
38
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "siv-field", children: [
39
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "What do you need?" }),
40
+ /* @__PURE__ */ jsxRuntime.jsxs("select", { className: "siv-select", value: reasonCode, onChange: (event) => setReasonCode(event.target.value), children: [
41
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "non_biometric_alternative", children: "Cannot use a selfie" }),
42
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "decision_appeal", children: "Appeal a decision" }),
43
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "accessibility_support", children: "Accessibility support" })
44
+ ] })
45
+ ] }),
46
+ result ? /* @__PURE__ */ jsxRuntime.jsxs("p", { role: "status", children: [
47
+ "Your review is open. Reference ",
48
+ result.appealId.slice(0, 8),
49
+ "."
50
+ ] }) : null,
51
+ error ? /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", children: error }) : null,
52
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "siv-actions", children: [
53
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "siv-button", onClick: onCancel, children: "Close" }),
54
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", className: "siv-button", "data-variant": "primary", disabled: busy || !onSubmit, children: "Submit review request" })
55
+ ] })
56
+ ]
57
+ }
58
+ );
59
+ }
60
+
61
+ exports.AppealForm = AppealForm;
62
+ //# sourceMappingURL=appeal.cjs.map
63
+ //# sourceMappingURL=appeal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/appeal/AppealForm.tsx"],"names":["useState","jsxs","jsx"],"mappings":";;;;;;AAaO,SAAS,WAAW,EAAE,SAAA,EAAW,QAAA,EAAU,WAAA,EAAa,UAAS,EAAoB;AAC1F,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAIA,eAAoF,2BAA2B,CAAA;AACnJ,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIA,eAAS,KAAK,CAAA;AACtC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAIA,eAAsD,IAAI,CAAA;AACtF,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,eAAwB,IAAI,CAAA;AAEtD,EAAA,uBACEC,eAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,gBAAA;AAAA,MACV,iBAAA,EAAgB,kBAAA;AAAA,MAChB,QAAA,EAAU,CAAC,KAAA,KAAU;AACnB,QAAA,KAAA,CAAM,cAAA,EAAe;AACrB,QAAA,IAAI,CAAC,QAAA,EAAU;AACb,UAAA,QAAA,CAAS,sCAAsC,CAAA;AAC/C,UAAA;AAAA,QACF;AACA,QAAA,OAAA,CAAQ,IAAI,CAAA;AACZ,QAAA,KAAK,QAAA,CAAS;AAAA,UACZ,SAAA;AAAA,UACA,UAAA;AAAA,UACA,2BAA2B,UAAA,KAAe;AAAA,SAC3C,CAAA,CAAE,IAAA,CAAK,CAAC,IAAA,KAAS;AAChB,UAAA,SAAA,CAAU,IAAI,CAAA;AACd,UAAA,WAAA,GAAc,IAAI,CAAA;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E,IAAA,EAAK,QAAA,EAAS,QAAA,EAAA;AAAA,UAAA,iCAAA;AAAA,UAAgC,MAAA,CAAO,QAAA,CAAS,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA;AAAA,UAAE;AAAA,SAAA,EAAC,CAAA,GAAO,IAAA;AAAA,QAC9F,wBAAQC,cAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAK,OAAA,EAAS,iBAAM,CAAA,GAAO,IAAA;AAAA,wBACvCD,eAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,aAAA,EACb,QAAA,EAAA;AAAA,0BAAAC,cAAA,CAAC,YAAO,IAAA,EAAK,QAAA,EAAS,WAAU,YAAA,EAAa,OAAA,EAAS,UAAU,QAAA,EAAA,OAAA,EAAK,CAAA;AAAA,0BACrEA,cAAA,CAAC,QAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,SAAA,EAAU,YAAA,EAAa,cAAA,EAAa,SAAA,EAAU,QAAA,EAAU,IAAA,IAAQ,CAAC,QAAA,EAAU,QAAA,EAAA,uBAAA,EAAqB;AAAA,SAAA,EACxH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"appeal.cjs","sourcesContent":["import { useState } from 'react';\n\nexport interface AppealFormProps {\n attemptId?: string;\n onSubmit?: (input: {\n attemptId?: string;\n reasonCode: 'non_biometric_alternative' | 'decision_appeal' | 'accessibility_support';\n nonBiometricPathRequested: boolean;\n }) => Promise<{ appealId: string; status: string }>;\n onSubmitted?: (result: { appealId: string; status: string }) => void;\n onCancel?: () => void;\n}\n\nexport function AppealForm({ attemptId, onSubmit, onSubmitted, onCancel }: AppealFormProps) {\n const [reasonCode, setReasonCode] = useState<'non_biometric_alternative' | 'decision_appeal' | 'accessibility_support'>('non_biometric_alternative');\n const [busy, setBusy] = useState(false);\n const [result, setResult] = useState<{ appealId: string; status: string } | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n return (\n <form\n className=\"siv siv-dialog\"\n aria-labelledby=\"siv-appeal-title\"\n onSubmit={(event) => {\n event.preventDefault();\n if (!onSubmit) {\n setError('Appeal submission is not configured.');\n return;\n }\n setBusy(true);\n void onSubmit({\n attemptId,\n reasonCode,\n nonBiometricPathRequested: reasonCode === 'non_biometric_alternative',\n }).then((next) => {\n setResult(next);\n onSubmitted?.(next);\n }).catch((cause) => {\n setError(cause instanceof Error ? cause.message : 'Verification review could not be requested.');\n }).finally(() => setBusy(false));\n }}\n >\n <h2 className=\"siv-title\" id=\"siv-appeal-title\">Request a verification review</h2>\n <p className=\"siv-copy\">Support sees only a safe review reference. Identity documents remain with the verification provider.</p>\n <label className=\"siv-field\">\n <span>What do you need?</span>\n <select className=\"siv-select\" value={reasonCode} onChange={(event) => setReasonCode(event.target.value as typeof reasonCode)}>\n <option value=\"non_biometric_alternative\">Cannot use a selfie</option>\n <option value=\"decision_appeal\">Appeal a decision</option>\n <option value=\"accessibility_support\">Accessibility support</option>\n </select>\n </label>\n {result ? <p role=\"status\">Your review is open. Reference {result.appealId.slice(0, 8)}.</p> : null}\n {error ? <p role=\"alert\">{error}</p> : null}\n <div className=\"siv-actions\">\n <button type=\"button\" className=\"siv-button\" onClick={onCancel}>Close</button>\n <button type=\"submit\" className=\"siv-button\" data-variant=\"primary\" disabled={busy || !onSubmit}>Submit review request</button>\n </div>\n </form>\n );\n}\n\nexport default AppealForm;\n"]}
@@ -0,0 +1,21 @@
1
+ import * as react from 'react';
2
+
3
+ interface AppealFormProps {
4
+ attemptId?: string;
5
+ onSubmit?: (input: {
6
+ attemptId?: string;
7
+ reasonCode: 'non_biometric_alternative' | 'decision_appeal' | 'accessibility_support';
8
+ nonBiometricPathRequested: boolean;
9
+ }) => Promise<{
10
+ appealId: string;
11
+ status: string;
12
+ }>;
13
+ onSubmitted?: (result: {
14
+ appealId: string;
15
+ status: string;
16
+ }) => void;
17
+ onCancel?: () => void;
18
+ }
19
+ declare function AppealForm({ attemptId, onSubmit, onSubmitted, onCancel }: AppealFormProps): react.JSX.Element;
20
+
21
+ export { AppealForm, type AppealFormProps };
@@ -0,0 +1,21 @@
1
+ import * as react from 'react';
2
+
3
+ interface AppealFormProps {
4
+ attemptId?: string;
5
+ onSubmit?: (input: {
6
+ attemptId?: string;
7
+ reasonCode: 'non_biometric_alternative' | 'decision_appeal' | 'accessibility_support';
8
+ nonBiometricPathRequested: boolean;
9
+ }) => Promise<{
10
+ appealId: string;
11
+ status: string;
12
+ }>;
13
+ onSubmitted?: (result: {
14
+ appealId: string;
15
+ status: string;
16
+ }) => void;
17
+ onCancel?: () => void;
18
+ }
19
+ declare function AppealForm({ attemptId, onSubmit, onSubmitted, onCancel }: AppealFormProps): react.JSX.Element;
20
+
21
+ export { AppealForm, type AppealFormProps };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appeal.d.ts","sources":["appeal.d.ts"],"names":[],"mappings":"AAAA"}
package/dist/appeal.js ADDED
@@ -0,0 +1,61 @@
1
+ import { useState } from 'react';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+
4
+ // src/appeal/AppealForm.tsx
5
+ function AppealForm({ attemptId, onSubmit, onSubmitted, onCancel }) {
6
+ const [reasonCode, setReasonCode] = useState("non_biometric_alternative");
7
+ const [busy, setBusy] = useState(false);
8
+ const [result, setResult] = useState(null);
9
+ const [error, setError] = useState(null);
10
+ return /* @__PURE__ */ jsxs(
11
+ "form",
12
+ {
13
+ className: "siv siv-dialog",
14
+ "aria-labelledby": "siv-appeal-title",
15
+ onSubmit: (event) => {
16
+ event.preventDefault();
17
+ if (!onSubmit) {
18
+ setError("Appeal submission is not configured.");
19
+ return;
20
+ }
21
+ setBusy(true);
22
+ void onSubmit({
23
+ attemptId,
24
+ reasonCode,
25
+ nonBiometricPathRequested: reasonCode === "non_biometric_alternative"
26
+ }).then((next) => {
27
+ setResult(next);
28
+ onSubmitted?.(next);
29
+ }).catch((cause) => {
30
+ setError(cause instanceof Error ? cause.message : "Verification review could not be requested.");
31
+ }).finally(() => setBusy(false));
32
+ },
33
+ children: [
34
+ /* @__PURE__ */ jsx("h2", { className: "siv-title", id: "siv-appeal-title", children: "Request a verification review" }),
35
+ /* @__PURE__ */ jsx("p", { className: "siv-copy", children: "Support sees only a safe review reference. Identity documents remain with the verification provider." }),
36
+ /* @__PURE__ */ jsxs("label", { className: "siv-field", children: [
37
+ /* @__PURE__ */ jsx("span", { children: "What do you need?" }),
38
+ /* @__PURE__ */ jsxs("select", { className: "siv-select", value: reasonCode, onChange: (event) => setReasonCode(event.target.value), children: [
39
+ /* @__PURE__ */ jsx("option", { value: "non_biometric_alternative", children: "Cannot use a selfie" }),
40
+ /* @__PURE__ */ jsx("option", { value: "decision_appeal", children: "Appeal a decision" }),
41
+ /* @__PURE__ */ jsx("option", { value: "accessibility_support", children: "Accessibility support" })
42
+ ] })
43
+ ] }),
44
+ result ? /* @__PURE__ */ jsxs("p", { role: "status", children: [
45
+ "Your review is open. Reference ",
46
+ result.appealId.slice(0, 8),
47
+ "."
48
+ ] }) : null,
49
+ error ? /* @__PURE__ */ jsx("p", { role: "alert", children: error }) : null,
50
+ /* @__PURE__ */ jsxs("div", { className: "siv-actions", children: [
51
+ /* @__PURE__ */ jsx("button", { type: "button", className: "siv-button", onClick: onCancel, children: "Close" }),
52
+ /* @__PURE__ */ jsx("button", { type: "submit", className: "siv-button", "data-variant": "primary", disabled: busy || !onSubmit, children: "Submit review request" })
53
+ ] })
54
+ ]
55
+ }
56
+ );
57
+ }
58
+
59
+ export { AppealForm };
60
+ //# sourceMappingURL=appeal.js.map
61
+ //# sourceMappingURL=appeal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/appeal/AppealForm.tsx"],"names":[],"mappings":";;;;AAaO,SAAS,WAAW,EAAE,SAAA,EAAW,QAAA,EAAU,WAAA,EAAa,UAAS,EAAoB;AAC1F,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAoF,2BAA2B,CAAA;AACnJ,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,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,IAAA,EAAK,QAAA,EAAS,SAAA,EAAU,YAAA,EAAa,cAAA,EAAa,SAAA,EAAU,QAAA,EAAU,IAAA,IAAQ,CAAC,QAAA,EAAU,QAAA,EAAA,uBAAA,EAAqB;AAAA,SAAA,EACxH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"appeal.js","sourcesContent":["import { useState } from 'react';\n\nexport interface AppealFormProps {\n attemptId?: string;\n onSubmit?: (input: {\n attemptId?: string;\n reasonCode: 'non_biometric_alternative' | 'decision_appeal' | 'accessibility_support';\n nonBiometricPathRequested: boolean;\n }) => Promise<{ appealId: string; status: string }>;\n onSubmitted?: (result: { appealId: string; status: string }) => void;\n onCancel?: () => void;\n}\n\nexport function AppealForm({ attemptId, onSubmit, onSubmitted, onCancel }: AppealFormProps) {\n const [reasonCode, setReasonCode] = useState<'non_biometric_alternative' | 'decision_appeal' | 'accessibility_support'>('non_biometric_alternative');\n const [busy, setBusy] = useState(false);\n const [result, setResult] = useState<{ appealId: string; status: string } | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n return (\n <form\n className=\"siv siv-dialog\"\n aria-labelledby=\"siv-appeal-title\"\n onSubmit={(event) => {\n event.preventDefault();\n if (!onSubmit) {\n setError('Appeal submission is not configured.');\n return;\n }\n setBusy(true);\n void onSubmit({\n attemptId,\n reasonCode,\n nonBiometricPathRequested: reasonCode === 'non_biometric_alternative',\n }).then((next) => {\n setResult(next);\n onSubmitted?.(next);\n }).catch((cause) => {\n setError(cause instanceof Error ? cause.message : 'Verification review could not be requested.');\n }).finally(() => setBusy(false));\n }}\n >\n <h2 className=\"siv-title\" id=\"siv-appeal-title\">Request a verification review</h2>\n <p className=\"siv-copy\">Support sees only a safe review reference. Identity documents remain with the verification provider.</p>\n <label className=\"siv-field\">\n <span>What do you need?</span>\n <select className=\"siv-select\" value={reasonCode} onChange={(event) => setReasonCode(event.target.value as typeof reasonCode)}>\n <option value=\"non_biometric_alternative\">Cannot use a selfie</option>\n <option value=\"decision_appeal\">Appeal a decision</option>\n <option value=\"accessibility_support\">Accessibility support</option>\n </select>\n </label>\n {result ? <p role=\"status\">Your review is open. Reference {result.appealId.slice(0, 8)}.</p> : null}\n {error ? <p role=\"alert\">{error}</p> : null}\n <div className=\"siv-actions\">\n <button type=\"button\" className=\"siv-button\" onClick={onCancel}>Close</button>\n <button type=\"submit\" className=\"siv-button\" data-variant=\"primary\" disabled={busy || !onSubmit}>Submit review request</button>\n </div>\n </form>\n );\n}\n\nexport default AppealForm;\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,126 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var verificationWeb = require('@splitin/verification-web');
5
+
6
+ // src/hooks/session.ts
7
+ function useVerificationSession(options) {
8
+ const [envelope, setEnvelope] = react.useState(options.envelope);
9
+ const [message, setMessage] = react.useState(null);
10
+ const refreshStatus = options.refreshStatus;
11
+ const refreshRef = react.useRef(refreshStatus);
12
+ refreshRef.current = refreshStatus;
13
+ const controller = react.useMemo(() => verificationWeb.createVerificationWebController({
14
+ plugins: options.plugins,
15
+ pause: options.pause,
16
+ resume: options.resume,
17
+ retry: options.retry,
18
+ cancel: options.cancel,
19
+ createContinuationUrl: options.createContinuationUrl,
20
+ refreshStatus: (attemptId) => refreshRef.current(attemptId)
21
+ }), [options.plugins, options.pause, options.resume, options.retry, options.cancel, options.createContinuationUrl]);
22
+ const refresh = react.useCallback(async () => {
23
+ if (!envelope) return false;
24
+ const next = await controller.refresh(envelope.attemptId);
25
+ setEnvelope(next);
26
+ return next.status === "verified";
27
+ }, [controller, envelope]);
28
+ return {
29
+ envelope,
30
+ setEnvelope,
31
+ message,
32
+ setMessage,
33
+ controller,
34
+ refresh,
35
+ onComplete: refresh
36
+ };
37
+ }
38
+
39
+ // src/hooks/status.ts
40
+ function useVerificationStatus(envelope) {
41
+ const blocked = envelope?.status === "processing" || envelope?.status === "manual_review_required";
42
+ const unavailable = envelope?.status === "provider_unavailable";
43
+ const terminal = envelope != null && ["verified", "declined", "failed", "expired", "canceled", "redacted"].includes(envelope.status);
44
+ return { blocked, unavailable, terminal, status: envelope?.status ?? "created", disclosure: envelope?.providerDisclosure ?? null };
45
+ }
46
+ function useOnlineStatus() {
47
+ const [online, setOnline] = react.useState(verificationWeb.isBrowserOnline);
48
+ react.useEffect(() => verificationWeb.subscribeOnlineStatus(setOnline), []);
49
+ return online;
50
+ }
51
+ function useFocusRecovery(active) {
52
+ react.useEffect(() => {
53
+ if (!active || typeof document === "undefined") return;
54
+ const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
55
+ return () => {
56
+ previous?.focus();
57
+ };
58
+ }, [active]);
59
+ }
60
+ function useBusy() {
61
+ const [busy, setBusy] = react.useState(null);
62
+ const run = react.useCallback(async (key, task) => {
63
+ if (busy) return;
64
+ setBusy(key);
65
+ try {
66
+ await task();
67
+ } finally {
68
+ setBusy(null);
69
+ }
70
+ }, [busy]);
71
+ return [busy, run];
72
+ }
73
+
74
+ // src/css.ts
75
+ var styles = `
76
+ :where(.siv){color:var(--siv-fg,#111827);background:var(--siv-bg,#fff);font-family:var(--siv-font,system-ui,sans-serif)}
77
+ `;
78
+ var injected = false;
79
+ function injectDefaultStyles() {
80
+ if (injected || typeof document === "undefined") return;
81
+ const style = document.createElement("style");
82
+ style.dataset.siv = "verification-react";
83
+ style.textContent = styles;
84
+ document.head.appendChild(style);
85
+ injected = true;
86
+ }
87
+
88
+ // src/copy.ts
89
+ function verificationCopy(packageCode) {
90
+ switch (packageCode) {
91
+ case "business_kyb":
92
+ return {
93
+ title: "Secure business verification",
94
+ description: "The legal business is verified separately from your identity. You can pause and resume without starting over.",
95
+ reviewTitle: "Business review is in progress"
96
+ };
97
+ case "ownership_review":
98
+ return {
99
+ title: "Ownership and authority review",
100
+ description: "We are reviewing authority for this organization. Your action stays saved.",
101
+ reviewTitle: "Ownership review is in progress"
102
+ };
103
+ case "associated_person_idv":
104
+ return {
105
+ title: "Associated person verification",
106
+ description: "This identity check supports a separate business relationship review.",
107
+ reviewTitle: "Relationship review is in progress"
108
+ };
109
+ default:
110
+ return {
111
+ title: "Secure identity verification",
112
+ description: "You can pause and resume without starting over. Your action stays saved.",
113
+ reviewTitle: "Identity review is in progress"
114
+ };
115
+ }
116
+ }
117
+
118
+ exports.injectDefaultStyles = injectDefaultStyles;
119
+ exports.useBusy = useBusy;
120
+ exports.useFocusRecovery = useFocusRecovery;
121
+ exports.useOnlineStatus = useOnlineStatus;
122
+ exports.useVerificationSession = useVerificationSession;
123
+ exports.useVerificationStatus = useVerificationStatus;
124
+ exports.verificationCopy = verificationCopy;
125
+ //# sourceMappingURL=index.cjs.map
126
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/session.ts","../src/hooks/status.ts","../src/hooks/runtime.ts","../src/css.ts","../src/copy.ts"],"names":["useState","useRef","useMemo","createVerificationWebController","useCallback","isBrowserOnline","useEffect","subscribeOnlineStatus"],"mappings":";;;;;;AAeO,SAAS,uBAAuB,OAAA,EAAwC;AAC7E,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAIA,cAAA,CAAS,QAAQ,QAAQ,CAAA;AACzD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAIA,eAAwB,IAAI,CAAA;AAC1D,EAAA,MAAM,gBAAgB,OAAA,CAAQ,aAAA;AAC9B,EAAA,MAAM,UAAA,GAAaC,aAAO,aAAa,CAAA;AACvC,EAAA,UAAA,CAAW,OAAA,GAAU,aAAA;AAErB,EAAA,MAAM,UAAA,GAAaC,aAAA,CAAQ,MAAMC,+CAAA,CAAgC;AAAA,IAC/D,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,uBAAuB,OAAA,CAAQ,qBAAA;A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S,aAAA,CAAc,OAAO,CAAA;AAC5C,EAAA,KAAA,CAAM,QAAQ,GAAA,GAAM,oBAAA;AACpB,EAAA,KAAA,CAAM,WAAA,GAAc,MAAA;AACpB,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,KAAK,CAAA;AAC/B,EAAA,QAAA,GAAW,IAAA;AACb;;;ACXO,SAAS,iBAAiB,WAAA,EAI/B;AACA,EAAA,QAAQ,WAAA;AAAa,IACnB,KAAK,cAAA;AACH,MAAA,OAAO;AAAA,QACL,KAAA,EAAO,8BAAA;AAAA,QACP,WAAA,EAAa,+GAAA;AAAA,QACb,WAAA,EAAa;AAAA,OACf;AAAA,IACF,KAAK,kBAAA;AACH,MAAA,OAAO;AAAA,QACL,KAAA,EAAO,gCAAA;AAAA,QACP,WAAA,EAAa,4EAAA;AAAA,QACb,WAAA,EAAa;AAAA,OACf;AAAA,IACF,KAAK,uBAAA;AACH,MAAA,OAAO;AAAA,QACL,KAAA,EAAO,gCAAA;AAAA,QACP,WAAA,EAAa,uEAAA;AAAA,QACb,WAAA,EAAa;AAAA,OACf;AAAA,IACF;AACE,MAAA,OAAO;AAAA,QACL,KAAA,EAAO,8BAAA;AAAA,QACP,WAAA,EAAa,0EAAA;AAAA,QACb,WAAA,EAAa;AAAA,OACf;AAAA;AAEN","file":"index.cjs","sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n createVerificationWebController,\n type VerificationStatusEnvelope,\n type VerificationWebControllerOptions,\n} from '@splitin/verification-web';\n\nexport interface UseVerificationSessionOptions extends Omit<VerificationWebControllerOptions, 'refreshStatus'> {\n envelope: VerificationStatusEnvelope | null;\n refreshStatus: (attemptId: string) => Promise<VerificationStatusEnvelope>;\n}\n\n/**\n * Headless session controller. Browser completion must only call refreshStatus.\n */\nexport function useVerificationSession(options: UseVerificationSessionOptions) {\n const [envelope, setEnvelope] = useState(options.envelope);\n const [message, setMessage] = useState<string | null>(null);\n const refreshStatus = options.refreshStatus;\n const refreshRef = useRef(refreshStatus);\n refreshRef.current = refreshStatus;\n\n const controller = useMemo(() => createVerificationWebController({\n plugins: options.plugins,\n pause: options.pause,\n resume: options.resume,\n retry: options.retry,\n cancel: options.cancel,\n createContinuationUrl: options.createContinuationUrl,\n refreshStatus: (attemptId) => refreshRef.current(attemptId),\n }), [options.plugins, options.pause, options.resume, options.retry, options.cancel, options.createContinuationUrl]);\n\n const refresh = useCallback(async () => {\n if (!envelope) return false;\n const next = await controller.refresh(envelope.attemptId);\n setEnvelope(next);\n return next.status === 'verified';\n }, [controller, envelope]);\n\n return {\n envelope,\n setEnvelope,\n message,\n setMessage,\n controller,\n refresh,\n onComplete: refresh,\n };\n}\n\n","import type { VerificationStatusEnvelope } from '@splitin/verification-web';\n\nexport function useVerificationStatus(envelope: VerificationStatusEnvelope | null) {\n const blocked = envelope?.status === 'processing' || envelope?.status === 'manual_review_required';\n const unavailable = envelope?.status === 'provider_unavailable';\n const terminal = envelope != null && ['verified', 'declined', 'failed', 'expired', 'canceled', 'redacted'].includes(envelope.status);\n return { blocked, unavailable, terminal, status: envelope?.status ?? 'created', disclosure: envelope?.providerDisclosure ?? null };\n}\n","import { useCallback, useEffect, useState } from 'react';\nimport { isBrowserOnline, subscribeOnlineStatus } from '@splitin/verification-web';\n\nexport function useOnlineStatus(): boolean {\n const [online, setOnline] = useState(isBrowserOnline);\n useEffect(() => subscribeOnlineStatus(setOnline), []);\n return online;\n}\n\nexport function useFocusRecovery(active: boolean): void {\n useEffect(() => {\n if (!active || typeof document === 'undefined') return;\n const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n return () => { previous?.focus(); };\n }, [active]);\n}\n\nexport function useBusy<T extends string>(): [T | null, (key: T, task: () => Promise<void>) => Promise<void>] {\n const [busy, setBusy] = useState<T | null>(null);\n const run = useCallback(async (key: T, task: () => Promise<void>) => {\n if (busy) return;\n setBusy(key);\n try { await task(); } finally { setBusy(null); }\n }, [busy]);\n return [busy, run];\n}\n","export const styles = `\n:where(.siv){color:var(--siv-fg,#111827);background:var(--siv-bg,#fff);font-family:var(--siv-font,system-ui,sans-serif)}\n`;\n\nlet injected = false;\n\nexport function injectDefaultStyles(): void {\n if (injected || typeof document === 'undefined') return;\n const style = document.createElement('style');\n style.dataset.siv = 'verification-react';\n style.textContent = styles;\n document.head.appendChild(style);\n injected = true;\n}\n","import type { VerificationPackageCode } from '@splitin/verification-adapter-sdk';\n\nexport function verificationCopy(packageCode: VerificationPackageCode | string): {\n title: string;\n description: string;\n reviewTitle: string;\n} {\n switch (packageCode) {\n case 'business_kyb':\n return {\n title: 'Secure business verification',\n description: 'The legal business is verified separately from your identity. You can pause and resume without starting over.',\n reviewTitle: 'Business review is in progress',\n };\n case 'ownership_review':\n return {\n title: 'Ownership and authority review',\n description: 'We are reviewing authority for this organization. Your action stays saved.',\n reviewTitle: 'Ownership review is in progress',\n };\n case 'associated_person_idv':\n return {\n title: 'Associated person verification',\n description: 'This identity check supports a separate business relationship review.',\n reviewTitle: 'Relationship review is in progress',\n };\n default:\n return {\n title: 'Secure identity verification',\n description: 'You can pause and resume without starting over. Your action stays saved.',\n reviewTitle: 'Identity review is in progress',\n };\n }\n}\n\nexport const CAMERA_HELP = [\n 'Allow camera access in browser settings, close other camera apps, then retry.',\n 'Use an up-to-date Safari, Chrome, Firefox, or Edge browser. If an in-app browser blocks the camera, open the continuation link in your main browser.',\n];\n"]}
@@ -0,0 +1,49 @@
1
+ import * as _splitin_verification_web from '@splitin/verification-web';
2
+ import { VerificationWebControllerOptions, VerificationStatusEnvelope } from '@splitin/verification-web';
3
+ import * as react from 'react';
4
+ import { VerificationPackageCode } from '@splitin/verification-adapter-sdk';
5
+
6
+ interface UseVerificationSessionOptions extends Omit<VerificationWebControllerOptions, 'refreshStatus'> {
7
+ envelope: VerificationStatusEnvelope | null;
8
+ refreshStatus: (attemptId: string) => Promise<VerificationStatusEnvelope>;
9
+ }
10
+ /**
11
+ * Headless session controller. Browser completion must only call refreshStatus.
12
+ */
13
+ declare function useVerificationSession(options: UseVerificationSessionOptions): {
14
+ envelope: VerificationStatusEnvelope | null;
15
+ setEnvelope: react.Dispatch<react.SetStateAction<VerificationStatusEnvelope | null>>;
16
+ message: string | null;
17
+ setMessage: react.Dispatch<react.SetStateAction<string | null>>;
18
+ controller: {
19
+ refresh: (attemptId: string) => Promise<VerificationStatusEnvelope>;
20
+ present: (input: _splitin_verification_web.PresentSessionInput) => Promise<_splitin_verification_web.PresentedSession>;
21
+ isOnline: typeof _splitin_verification_web.isBrowserOnline;
22
+ isInstalledPwa: typeof _splitin_verification_web.isInstalledPwa;
23
+ peekSecret: typeof _splitin_verification_web.peekTransientSecret;
24
+ };
25
+ refresh: () => Promise<boolean>;
26
+ onComplete: () => Promise<boolean>;
27
+ };
28
+
29
+ declare function useVerificationStatus(envelope: VerificationStatusEnvelope | null): {
30
+ blocked: boolean;
31
+ unavailable: boolean;
32
+ terminal: boolean;
33
+ status: "created" | "pending_user_input" | "paused" | "processing" | "manual_review_required" | "verified" | "declined" | "failed" | "expired" | "canceled" | "provider_unavailable" | "redacted";
34
+ disclosure: string | null;
35
+ };
36
+
37
+ declare function useOnlineStatus(): boolean;
38
+ declare function useFocusRecovery(active: boolean): void;
39
+ declare function useBusy<T extends string>(): [T | null, (key: T, task: () => Promise<void>) => Promise<void>];
40
+
41
+ declare function injectDefaultStyles(): void;
42
+
43
+ declare function verificationCopy(packageCode: VerificationPackageCode | string): {
44
+ title: string;
45
+ description: string;
46
+ reviewTitle: string;
47
+ };
48
+
49
+ export { type UseVerificationSessionOptions, injectDefaultStyles, useBusy, useFocusRecovery, useOnlineStatus, useVerificationSession, useVerificationStatus, verificationCopy };
@@ -0,0 +1,49 @@
1
+ import * as _splitin_verification_web from '@splitin/verification-web';
2
+ import { VerificationWebControllerOptions, VerificationStatusEnvelope } from '@splitin/verification-web';
3
+ import * as react from 'react';
4
+ import { VerificationPackageCode } from '@splitin/verification-adapter-sdk';
5
+
6
+ interface UseVerificationSessionOptions extends Omit<VerificationWebControllerOptions, 'refreshStatus'> {
7
+ envelope: VerificationStatusEnvelope | null;
8
+ refreshStatus: (attemptId: string) => Promise<VerificationStatusEnvelope>;
9
+ }
10
+ /**
11
+ * Headless session controller. Browser completion must only call refreshStatus.
12
+ */
13
+ declare function useVerificationSession(options: UseVerificationSessionOptions): {
14
+ envelope: VerificationStatusEnvelope | null;
15
+ setEnvelope: react.Dispatch<react.SetStateAction<VerificationStatusEnvelope | null>>;
16
+ message: string | null;
17
+ setMessage: react.Dispatch<react.SetStateAction<string | null>>;
18
+ controller: {
19
+ refresh: (attemptId: string) => Promise<VerificationStatusEnvelope>;
20
+ present: (input: _splitin_verification_web.PresentSessionInput) => Promise<_splitin_verification_web.PresentedSession>;
21
+ isOnline: typeof _splitin_verification_web.isBrowserOnline;
22
+ isInstalledPwa: typeof _splitin_verification_web.isInstalledPwa;
23
+ peekSecret: typeof _splitin_verification_web.peekTransientSecret;
24
+ };
25
+ refresh: () => Promise<boolean>;
26
+ onComplete: () => Promise<boolean>;
27
+ };
28
+
29
+ declare function useVerificationStatus(envelope: VerificationStatusEnvelope | null): {
30
+ blocked: boolean;
31
+ unavailable: boolean;
32
+ terminal: boolean;
33
+ status: "created" | "pending_user_input" | "paused" | "processing" | "manual_review_required" | "verified" | "declined" | "failed" | "expired" | "canceled" | "provider_unavailable" | "redacted";
34
+ disclosure: string | null;
35
+ };
36
+
37
+ declare function useOnlineStatus(): boolean;
38
+ declare function useFocusRecovery(active: boolean): void;
39
+ declare function useBusy<T extends string>(): [T | null, (key: T, task: () => Promise<void>) => Promise<void>];
40
+
41
+ declare function injectDefaultStyles(): void;
42
+
43
+ declare function verificationCopy(packageCode: VerificationPackageCode | string): {
44
+ title: string;
45
+ description: string;
46
+ reviewTitle: string;
47
+ };
48
+
49
+ export { type UseVerificationSessionOptions, injectDefaultStyles, useBusy, useFocusRecovery, useOnlineStatus, useVerificationSession, useVerificationStatus, verificationCopy };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["index.d.ts"],"names":[],"mappings":"AAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,118 @@
1
+ import { useState, useRef, useMemo, useCallback, useEffect } from 'react';
2
+ import { createVerificationWebController, isBrowserOnline, subscribeOnlineStatus } from '@splitin/verification-web';
3
+
4
+ // src/hooks/session.ts
5
+ function useVerificationSession(options) {
6
+ const [envelope, setEnvelope] = useState(options.envelope);
7
+ const [message, setMessage] = useState(null);
8
+ const refreshStatus = options.refreshStatus;
9
+ const refreshRef = useRef(refreshStatus);
10
+ refreshRef.current = refreshStatus;
11
+ const controller = useMemo(() => createVerificationWebController({
12
+ plugins: options.plugins,
13
+ pause: options.pause,
14
+ resume: options.resume,
15
+ retry: options.retry,
16
+ cancel: options.cancel,
17
+ createContinuationUrl: options.createContinuationUrl,
18
+ refreshStatus: (attemptId) => refreshRef.current(attemptId)
19
+ }), [options.plugins, options.pause, options.resume, options.retry, options.cancel, options.createContinuationUrl]);
20
+ const refresh = useCallback(async () => {
21
+ if (!envelope) return false;
22
+ const next = await controller.refresh(envelope.attemptId);
23
+ setEnvelope(next);
24
+ return next.status === "verified";
25
+ }, [controller, envelope]);
26
+ return {
27
+ envelope,
28
+ setEnvelope,
29
+ message,
30
+ setMessage,
31
+ controller,
32
+ refresh,
33
+ onComplete: refresh
34
+ };
35
+ }
36
+
37
+ // src/hooks/status.ts
38
+ function useVerificationStatus(envelope) {
39
+ const blocked = envelope?.status === "processing" || envelope?.status === "manual_review_required";
40
+ const unavailable = envelope?.status === "provider_unavailable";
41
+ const terminal = envelope != null && ["verified", "declined", "failed", "expired", "canceled", "redacted"].includes(envelope.status);
42
+ return { blocked, unavailable, terminal, status: envelope?.status ?? "created", disclosure: envelope?.providerDisclosure ?? null };
43
+ }
44
+ function useOnlineStatus() {
45
+ const [online, setOnline] = useState(isBrowserOnline);
46
+ useEffect(() => subscribeOnlineStatus(setOnline), []);
47
+ return online;
48
+ }
49
+ function useFocusRecovery(active) {
50
+ useEffect(() => {
51
+ if (!active || typeof document === "undefined") return;
52
+ const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
53
+ return () => {
54
+ previous?.focus();
55
+ };
56
+ }, [active]);
57
+ }
58
+ function useBusy() {
59
+ const [busy, setBusy] = useState(null);
60
+ const run = useCallback(async (key, task) => {
61
+ if (busy) return;
62
+ setBusy(key);
63
+ try {
64
+ await task();
65
+ } finally {
66
+ setBusy(null);
67
+ }
68
+ }, [busy]);
69
+ return [busy, run];
70
+ }
71
+
72
+ // src/css.ts
73
+ var styles = `
74
+ :where(.siv){color:var(--siv-fg,#111827);background:var(--siv-bg,#fff);font-family:var(--siv-font,system-ui,sans-serif)}
75
+ `;
76
+ var injected = false;
77
+ function injectDefaultStyles() {
78
+ if (injected || typeof document === "undefined") return;
79
+ const style = document.createElement("style");
80
+ style.dataset.siv = "verification-react";
81
+ style.textContent = styles;
82
+ document.head.appendChild(style);
83
+ injected = true;
84
+ }
85
+
86
+ // src/copy.ts
87
+ function verificationCopy(packageCode) {
88
+ switch (packageCode) {
89
+ case "business_kyb":
90
+ return {
91
+ title: "Secure business verification",
92
+ description: "The legal business is verified separately from your identity. You can pause and resume without starting over.",
93
+ reviewTitle: "Business review is in progress"
94
+ };
95
+ case "ownership_review":
96
+ return {
97
+ title: "Ownership and authority review",
98
+ description: "We are reviewing authority for this organization. Your action stays saved.",
99
+ reviewTitle: "Ownership review is in progress"
100
+ };
101
+ case "associated_person_idv":
102
+ return {
103
+ title: "Associated person verification",
104
+ description: "This identity check supports a separate business relationship review.",
105
+ reviewTitle: "Relationship review is in progress"
106
+ };
107
+ default:
108
+ return {
109
+ title: "Secure identity verification",
110
+ description: "You can pause and resume without starting over. Your action stays saved.",
111
+ reviewTitle: "Identity review is in progress"
112
+ };
113
+ }
114
+ }
115
+
116
+ export { injectDefaultStyles, useBusy, useFocusRecovery, useOnlineStatus, useVerificationSession, useVerificationStatus, verificationCopy };
117
+ //# sourceMappingURL=index.js.map
118
+ //# sourceMappingURL=index.js.map