@sekyro/react-native 0.1.0-rc.1 → 0.1.0-rc.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sekyro/react-native
2
2
 
3
+ ## 0.1.0-rc.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b474b43: Pins the native SDKs 0.1.0-rc.3 (Android `ai.sekyro:sekyro-bom`, iOS `sekyro-ios-dist`): the session's capture mode decides the camera (front only for a self capture, the back camera with a flip control for an assisted one), the liveness screen is portrait-locked on phones with a hold-upright guard, and the capture reports `mode`, `facingMode` and `formFactor`.
8
+
9
+ ## 0.1.0-rc.2
10
+
11
+ ### Minor Changes
12
+
13
+ - dd1af94: An expired session now resolves `{ status: 'finished', sessionId, displayStatus: 'expired' }`, as on the native Android and iOS SDKs, instead of `{ status: 'failed', code: 'session_expired' }`. `SekyroDisplayStatus` gains `'expired'`. On Android, `theme.colors.border` and `theme.fontFamily` (a `res/font` resource name or a system family) are now applied (they were validated and ignored); this needs the native Android SDK release after `0.1.0-rc.2`. **Migration:** code that handled `code: 'session_expired'` on `failed` should handle `displayStatus: 'expired'` on `finished`; TypeScript code that switches exhaustively over `SekyroDisplayStatus` must add an `'expired'` branch.
14
+
3
15
  ## 0.1.0-rc.1
4
16
 
5
17
  ### Minor Changes
@@ -30,7 +30,8 @@ internal object ConfigMapper {
30
30
  val radius = if (m.hasKey("radius") && !m.isNull("radius")) m.getDouble("radius") else null
31
31
  require(radius == null || radius in 0.0..32.0) { "invalid_config" }
32
32
  val darkMode = m.str("darkMode")
33
- val hasTheme = colors != null || radius != null || darkMode != null
33
+ val fontFamily = m.str("fontFamily")
34
+ val hasTheme = colors != null || radius != null || darkMode != null || fontFamily != null
34
35
  val theme = if (!hasTheme) null else SekyroTheme(
35
36
  brand = color(colors, "brand"), brandFg = color(colors, "brandFg"),
36
37
  radiusDp = radius?.toInt(),
@@ -40,7 +41,8 @@ internal object ConfigMapper {
40
41
  bg = color(colors, "bg"), surface = color(colors, "surface"), fg = color(colors, "fg"),
41
42
  fgMuted = color(colors, "fgMuted"), danger = color(colors, "danger"),
42
43
  success = color(colors, "success"), warning = color(colors, "warning"),
43
- ).also { color(colors, "border") } // `border` (validated) and `fontFamily`: not themable on Android in 0.1 (README).
44
+ border = color(colors, "border"), fontFamily = fontFamily,
45
+ )
44
46
  val strings = if (m.hasKey("strings") && !m.isNull("strings")) {
45
47
  m.getMap("strings")?.toHashMap().orEmpty().mapNotNull { (k, v) -> (v as? String)?.let { k to it } }.toMap()
46
48
  } else emptyMap()
@@ -60,7 +62,7 @@ internal object ConfigMapper {
60
62
  when (r) {
61
63
  is SekyroResult.Finished -> {
62
64
  putString("status", "finished"); putString("sessionId", r.sessionId)
63
- // EXPIRED stays on the wire; the JS layer maps it to { status: 'failed', code: 'session_expired' } (iOS parity).
65
+ // EXPIRED is a display status in JS too ({ status: 'finished', displayStatus: 'expired' }), as on iOS.
64
66
  putString("displayStatus", when (r.displayStatus) {
65
67
  DisplayStatus.APPROVED -> "approved"; DisplayStatus.REVIEW_PENDING -> "review_pending"
66
68
  DisplayStatus.REJECTED -> "rejected"; DisplayStatus.EXPIRED -> "expired"
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var t in r)u(e,t,{get:r[t],enumerable:!0})},O=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of w(r))!h.call(e,i)&&i!==t&&u(e,i,{get:()=>r[i],enumerable:!(n=N(r,i))||n.enumerable});return e};var x=e=>O(u({},"__esModule",{value:!0}),e);var A={};C(A,{SDK_VERSION:()=>R,SekyroError:()=>l,SekyroFlow:()=>E,nativeVersion:()=>_,startSekyro:()=>f});module.exports=x(A);var S=require("react-native"),d=S.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var b=500,T=new Set(["ar","fr","en"]),F=["brand","brandFg","bg","surface","fg","fgMuted","border","danger","success","warning"],I=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),D=/^#[0-9a-fA-F]{6}$/,V=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function k(e){(typeof e!="object"||e===null)&&a("config");for(let n of Object.keys(e))I.has(n)||a(`unknown key "${n.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&a("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&V.test(e.apiOrigin))||a("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(T.has(e.locale)||a("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[i,s]of Object.entries(t.colors))s!==void 0&&((!F.includes(i)||typeof s!="string"||!D.test(s))&&a(`theme.colors.${i.slice(0,32)}`),n[i]=s);r.colors=n}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&a("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&a("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||a("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||a("strings need locale");let n=e.strings[e.locale]??{},i={},s=Object.entries(n).filter(([,o])=>o!==void 0);s.length>b&&a("strings (too many overrides)");for(let[o,y]of s)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||a("strings key"),(typeof y!="string"||y.length>2e3)&&a(`strings.${o}`),i[o]=y;r.strings=i}return r}var M=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function g(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!M.has(e.step))return null;let r=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:r,retryReason:t}:{type:"step",step:r}}var $=new Set(["approved","review_pending","rejected"]);function m(e){if(e.status==="cancelled")return{status:"cancelled"};if(e.status==="failed")return{status:"failed",code:e.code||"unknown_error"};if(e.status==="finished"&&e.sessionId){if(e.displayStatus==="expired")return{status:"failed",code:"session_expired"};if($.has(e.displayStatus))return{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus}}return{status:"failed",code:"unknown_error"}}function v(){if(!d)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return d}var c=!1,j=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function f(e){let r=k(e),t=v();if(c)throw new l("flow_in_progress");c=!0;let n=e.onEvent,i=n?t.onEvent(s=>{let o=g(s);o&&n(o)}):void 0;try{return m(await t.start(r))}catch(s){let o=s?.code;if(typeof o=="string"&&j.has(o))throw new l(o);return{status:"failed",code:"unknown_error"}}finally{i?.remove(),c=!1}}function _(){return v().nativeVersion()}var p=require("react");function E(e){let r=(0,p.useRef)(null),t=(0,p.useRef)(e);return t.current=e,(0,p.useEffect)(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:i,...s}=t.current;f({...s,onEvent:o=>t.current.onEvent?.(o)}).then(o=>t.current.onResult(o),o=>t.current.onResult({status:"failed",code:o instanceof l?o.code:"unknown_error"}))},[e.clientToken]),null}var R="0.1.0-rc.1";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
1
+ "use strict";var u=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var t in r)u(e,t,{get:r[t],enumerable:!0})},O=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of w(r))!h.call(e,i)&&i!==t&&u(e,i,{get:()=>r[i],enumerable:!(n=N(r,i))||n.enumerable});return e};var x=e=>O(u({},"__esModule",{value:!0}),e);var j={};C(j,{SDK_VERSION:()=>R,SekyroError:()=>l,SekyroFlow:()=>E,nativeVersion:()=>_,startSekyro:()=>y});module.exports=x(j);var S=require("react-native"),d=S.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var b=500,T=new Set(["ar","fr","en"]),I=["brand","brandFg","bg","surface","fg","fgMuted","border","danger","success","warning"],F=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),D=/^#[0-9a-fA-F]{6}$/,V=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function k(e){(typeof e!="object"||e===null)&&a("config");for(let n of Object.keys(e))F.has(n)||a(`unknown key "${n.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&a("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&V.test(e.apiOrigin))||a("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(T.has(e.locale)||a("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[i,s]of Object.entries(t.colors))s!==void 0&&((!I.includes(i)||typeof s!="string"||!D.test(s))&&a(`theme.colors.${i.slice(0,32)}`),n[i]=s);r.colors=n}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&a("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&a("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||a("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||a("strings need locale");let n=e.strings[e.locale]??{},i={},s=Object.entries(n).filter(([,o])=>o!==void 0);s.length>b&&a("strings (too many overrides)");for(let[o,f]of s)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||a("strings key"),(typeof f!="string"||f.length>2e3)&&a(`strings.${o}`),i[o]=f;r.strings=i}return r}var M=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function g(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!M.has(e.step))return null;let r=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:r,retryReason:t}:{type:"step",step:r}}var $=new Set(["approved","review_pending","rejected","expired"]);function m(e){return e.status==="cancelled"?{status:"cancelled"}:e.status==="failed"?{status:"failed",code:e.code||"unknown_error"}:e.status==="finished"&&e.sessionId&&$.has(e.displayStatus)?{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus}:{status:"failed",code:"unknown_error"}}function v(){if(!d)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return d}var c=!1,A=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function y(e){let r=k(e),t=v();if(c)throw new l("flow_in_progress");c=!0;let n=e.onEvent,i=n?t.onEvent(s=>{let o=g(s);o&&n(o)}):void 0;try{return m(await t.start(r))}catch(s){let o=s?.code;if(typeof o=="string"&&A.has(o))throw new l(o);return{status:"failed",code:"unknown_error"}}finally{i?.remove(),c=!1}}function _(){return v().nativeVersion()}var p=require("react");function E(e){let r=(0,p.useRef)(null),t=(0,p.useRef)(e);return t.current=e,(0,p.useEffect)(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:i,...s}=t.current;y({...s,onEvent:o=>t.current.onEvent?.(o)}).then(o=>t.current.onResult(o),o=>t.current.onResult({status:"failed",code:o instanceof l?o.code:"unknown_error"}))},[e.clientToken]),null}var R="0.1.0-rc.3";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
package/dist/index.d.cts CHANGED
@@ -8,7 +8,11 @@ interface SekyroTheme {
8
8
  colors?: Partial<Record<SekyroColorRole, string>>;
9
9
  /** Corner radius in dp / pt, 0–32. */
10
10
  radius?: number;
11
- /** iOS only in 0.1 (Android ignores it). */
11
+ /**
12
+ * Font family of every text role. iOS: a font registered in your app (`UIAppFonts`). Android: a font resource
13
+ * your app bundles (`res/font/<name>`) or a system family (`'sans-serif'`, `'serif'`, `'monospace'`). An unknown
14
+ * name falls back to the Sekyro faces.
15
+ */
12
16
  fontFamily?: string;
13
17
  /** Colour scheme; `'system'` follows the device. */
14
18
  darkMode?: 'system' | 'light' | 'dark';
@@ -43,8 +47,11 @@ interface SekyroConfig {
43
47
  /** Step telemetry of this flow only (no personal data). */
44
48
  onEvent?: (event: SekyroEvent) => void;
45
49
  }
46
- /** What the end user was shown; not the decision. @public */
47
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected';
50
+ /**
51
+ * What the end user was shown; not the decision. `expired`: the session expired before it finished (the person was
52
+ * asked to start again from your app), as on the native SDKs. @public
53
+ */
54
+ type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
48
55
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
49
56
  type SekyroResult = {
50
57
  status: 'finished';
@@ -64,7 +71,7 @@ type SekyroResult = {
64
71
  */
65
72
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
66
73
  /**
67
- * Version of the bundled native core: `'android 0.1.0-rc.2'` / `'ios 0.1.0-rc.2'`.
74
+ * Version of the bundled native core: `'android 0.1.0-rc.3'` / `'ios 0.1.0-rc.3'`.
68
75
  * @public
69
76
  */
70
77
  declare function nativeVersion(): string;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,11 @@ interface SekyroTheme {
8
8
  colors?: Partial<Record<SekyroColorRole, string>>;
9
9
  /** Corner radius in dp / pt, 0–32. */
10
10
  radius?: number;
11
- /** iOS only in 0.1 (Android ignores it). */
11
+ /**
12
+ * Font family of every text role. iOS: a font registered in your app (`UIAppFonts`). Android: a font resource
13
+ * your app bundles (`res/font/<name>`) or a system family (`'sans-serif'`, `'serif'`, `'monospace'`). An unknown
14
+ * name falls back to the Sekyro faces.
15
+ */
12
16
  fontFamily?: string;
13
17
  /** Colour scheme; `'system'` follows the device. */
14
18
  darkMode?: 'system' | 'light' | 'dark';
@@ -43,8 +47,11 @@ interface SekyroConfig {
43
47
  /** Step telemetry of this flow only (no personal data). */
44
48
  onEvent?: (event: SekyroEvent) => void;
45
49
  }
46
- /** What the end user was shown; not the decision. @public */
47
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected';
50
+ /**
51
+ * What the end user was shown; not the decision. `expired`: the session expired before it finished (the person was
52
+ * asked to start again from your app), as on the native SDKs. @public
53
+ */
54
+ type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
48
55
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
49
56
  type SekyroResult = {
50
57
  status: 'finished';
@@ -64,7 +71,7 @@ type SekyroResult = {
64
71
  */
65
72
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
66
73
  /**
67
- * Version of the bundled native core: `'android 0.1.0-rc.2'` / `'ios 0.1.0-rc.2'`.
74
+ * Version of the bundled native core: `'android 0.1.0-rc.3'` / `'ios 0.1.0-rc.3'`.
68
75
  * @public
69
76
  */
70
77
  declare function nativeVersion(): string;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{TurboModuleRegistry as m}from"react-native";var f=m.get("SekyroReactNative");var a=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var v=500,_=new Set(["ar","fr","en"]),E=["brand","brandFg","bg","surface","fg","fgMuted","border","danger","success","warning"],R=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),N=/^#[0-9a-fA-F]{6}$/,w=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,i=e=>{throw new a("invalid_config",`invalid config: ${e}`)};function d(e){(typeof e!="object"||e===null)&&i("config");for(let s of Object.keys(e))R.has(s)||i(`unknown key "${s.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&i("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&w.test(e.apiOrigin))||i("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(_.has(e.locale)||i("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let s={};for(let[l,n]of Object.entries(t.colors))n!==void 0&&((!E.includes(l)||typeof n!="string"||!N.test(n))&&i(`theme.colors.${l.slice(0,32)}`),s[l]=n);r.colors=s}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&i("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&i("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||i("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||i("strings need locale");let s=e.strings[e.locale]??{},l={},n=Object.entries(s).filter(([,o])=>o!==void 0);n.length>v&&i("strings (too many overrides)");for(let[o,p]of n)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||i("strings key"),(typeof p!="string"||p.length>2e3)&&i(`strings.${o}`),l[o]=p;r.strings=l}return r}var h=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function c(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!h.has(e.step))return null;let r=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:r,retryReason:t}:{type:"step",step:r}}var C=new Set(["approved","review_pending","rejected"]);function S(e){if(e.status==="cancelled")return{status:"cancelled"};if(e.status==="failed")return{status:"failed",code:e.code||"unknown_error"};if(e.status==="finished"&&e.sessionId){if(e.displayStatus==="expired")return{status:"failed",code:"session_expired"};if(C.has(e.displayStatus))return{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus}}return{status:"failed",code:"unknown_error"}}function k(){if(!f)throw new a("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return f}var y=!1,O=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function u(e){let r=d(e),t=k();if(y)throw new a("flow_in_progress");y=!0;let s=e.onEvent,l=s?t.onEvent(n=>{let o=c(n);o&&s(o)}):void 0;try{return S(await t.start(r))}catch(n){let o=n?.code;if(typeof o=="string"&&O.has(o))throw new a(o);return{status:"failed",code:"unknown_error"}}finally{l?.remove(),y=!1}}function x(){return k().nativeVersion()}import{useEffect as b,useRef as g}from"react";function T(e){let r=g(null),t=g(e);return t.current=e,b(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:s,onEvent:l,...n}=t.current;u({...n,onEvent:o=>t.current.onEvent?.(o)}).then(o=>t.current.onResult(o),o=>t.current.onResult({status:"failed",code:o instanceof a?o.code:"unknown_error"}))},[e.clientToken]),null}var F="0.1.0-rc.1";export{F as SDK_VERSION,a as SekyroError,T as SekyroFlow,x as nativeVersion,u as startSekyro};
1
+ import{TurboModuleRegistry as m}from"react-native";var y=m.get("SekyroReactNative");var a=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var v=500,_=new Set(["ar","fr","en"]),E=["brand","brandFg","bg","surface","fg","fgMuted","border","danger","success","warning"],R=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),N=/^#[0-9a-fA-F]{6}$/,w=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,i=e=>{throw new a("invalid_config",`invalid config: ${e}`)};function d(e){(typeof e!="object"||e===null)&&i("config");for(let s of Object.keys(e))R.has(s)||i(`unknown key "${s.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&i("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&w.test(e.apiOrigin))||i("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(_.has(e.locale)||i("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let s={};for(let[l,n]of Object.entries(t.colors))n!==void 0&&((!E.includes(l)||typeof n!="string"||!N.test(n))&&i(`theme.colors.${l.slice(0,32)}`),s[l]=n);r.colors=s}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&i("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&i("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||i("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||i("strings need locale");let s=e.strings[e.locale]??{},l={},n=Object.entries(s).filter(([,o])=>o!==void 0);n.length>v&&i("strings (too many overrides)");for(let[o,p]of n)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||i("strings key"),(typeof p!="string"||p.length>2e3)&&i(`strings.${o}`),l[o]=p;r.strings=l}return r}var h=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function c(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!h.has(e.step))return null;let r=e.step,t=typeof e.retryReason=="string"&&/^[a-z0-9_]{1,64}$/.test(e.retryReason)?e.retryReason:void 0;return t?{type:"step",step:r,retryReason:t}:{type:"step",step:r}}var C=new Set(["approved","review_pending","rejected","expired"]);function S(e){return e.status==="cancelled"?{status:"cancelled"}:e.status==="failed"?{status:"failed",code:e.code||"unknown_error"}:e.status==="finished"&&e.sessionId&&C.has(e.displayStatus)?{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus}:{status:"failed",code:"unknown_error"}}function k(){if(!y)throw new a("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return y}var f=!1,O=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function u(e){let r=d(e),t=k();if(f)throw new a("flow_in_progress");f=!0;let s=e.onEvent,l=s?t.onEvent(n=>{let o=c(n);o&&s(o)}):void 0;try{return S(await t.start(r))}catch(n){let o=n?.code;if(typeof o=="string"&&O.has(o))throw new a(o);return{status:"failed",code:"unknown_error"}}finally{l?.remove(),f=!1}}function x(){return k().nativeVersion()}import{useEffect as b,useRef as g}from"react";function T(e){let r=g(null),t=g(e);return t.current=e,b(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:s,onEvent:l,...n}=t.current;u({...n,onEvent:o=>t.current.onEvent?.(o)}).then(o=>t.current.onResult(o),o=>t.current.onResult({status:"failed",code:o instanceof a?o.code:"unknown_error"}))},[e.clientToken]),null}var I="0.1.0-rc.3";export{I as SDK_VERSION,a as SekyroError,T as SekyroFlow,x as nativeVersion,u as startSekyro};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/react-native",
3
- "version": "0.1.0-rc.1",
3
+ "version": "0.1.0-rc.3",
4
4
  "private": false,
5
5
  "description": "Sekyro AI eKYC for React Native — glue over the binary Android and iOS SDKs (New Architecture)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -99,7 +99,7 @@
99
99
  }
100
100
  },
101
101
  "sekyro": {
102
- "android": "0.1.0-rc.2",
103
- "ios": "0.1.0-rc.2"
102
+ "android": "0.1.0-rc.3",
103
+ "ios": "0.1.0-rc.3"
104
104
  }
105
105
  }
package/sbom.cdx.json CHANGED
@@ -97,8 +97,8 @@
97
97
  "type": "application",
98
98
  "name": "react-native",
99
99
  "group": "@sekyro",
100
- "version": "0.1.0-rc.1",
101
- "bom-ref": "@sekyro/react-native@0.1.0-rc.1",
100
+ "version": "0.1.0-rc.3",
101
+ "bom-ref": "@sekyro/react-native@0.1.0-rc.3",
102
102
  "description": "Sekyro AI eKYC for React Native — glue over the binary Android and iOS SDKs (New Architecture)",
103
103
  "licenses": [
104
104
  {
@@ -108,7 +108,7 @@
108
108
  }
109
109
  }
110
110
  ],
111
- "purl": "pkg:npm/%40sekyro/react-native@0.1.0-rc.1?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23sekyro-mobile%2Freact-native",
111
+ "purl": "pkg:npm/%40sekyro/react-native@0.1.0-rc.3?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23sekyro-mobile%2Freact-native",
112
112
  "externalReferences": [
113
113
  {
114
114
  "url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
@@ -147,7 +147,7 @@
147
147
  "components": [],
148
148
  "dependencies": [
149
149
  {
150
- "ref": "@sekyro/react-native@0.1.0-rc.1"
150
+ "ref": "@sekyro/react-native@0.1.0-rc.3"
151
151
  }
152
152
  ]
153
153
  }