@sekyro/react-native 0.1.0-rc.15 → 0.1.0-rc.16

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,15 @@
1
1
  # @sekyro/react-native
2
2
 
3
+ ## 0.1.0-rc.16
4
+
5
+ ### Minor Changes
6
+
7
+ - 6128176: Breaking: the finished result's `displayStatus` is `verified`, `review_pending` or `not_verified` (was `approved`, `review_pending`, `rejected`, `expired`). On `not_verified` the result carries `reason` (`rejected`, `inconclusive`, `unavailable`, `abandoned`, `not_opened`, `policy`, `cancelled` or `superseded`) and `reasonCode` when there is one. A session that expired is `not_verified` with its reason; a superseded session is `not_verified` with `reason: 'superseded'`. A display status this version does not know reads as `not_verified`, never `review_pending`.
8
+
9
+ ### Patch Changes
10
+
11
+ - 66f490f: Pins the native SDKs 0.1.0-rc.15: the session outcome model on the native screens (verified, under review or not verified, with the reason), screen ramp v2 (the full-screen liveness colour flash), the clip frame count on each liveness video, a face match that asks for another try records a new liveness video, and retake screens that teach the fix for their own reason.
12
+
3
13
  ## 0.1.0-rc.15
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -58,9 +58,14 @@ const result = await startSekyro({
58
58
  theme: { colors: { brand: '#0F68B1' }, radius: 12 },
59
59
  onEvent: (e) => console.log(e.type), // step telemetry, no personal data
60
60
  });
61
- // { status: 'finished', sessionId, displayStatus } | { status: 'cancelled' } | { status: 'failed', code }
61
+ // { status: 'finished', sessionId, displayStatus, reason?, reasonCode? } | { status: 'cancelled' } | { status: 'failed', code }
62
62
  ```
63
63
 
64
+ `displayStatus` is what the person was shown: `verified`, `review_pending` or `not_verified`. On `not_verified`,
65
+ `reason` says why (`rejected`, `inconclusive`, `unavailable`, `abandoned`, `not_opened`, `policy`, `cancelled` or
66
+ `superseded`) and `reasonCode` gives the code behind it when there is one. Read the decision itself server-side
67
+ (webhooks or `sessions.get`).
68
+
64
69
  Or declaratively: `<SekyroFlow clientToken={token} onResult={setResult} />` (renders nothing).
65
70
 
66
71
  Never log the `clientToken`; it is a one-time bearer credential.
@@ -5,7 +5,6 @@ import ai.sekyro.SekyroLocale
5
5
  import ai.sekyro.SekyroResult
6
6
  import ai.sekyro.SekyroTheme
7
7
  import ai.sekyro.SekyroWire
8
- import ai.sekyro.core.DisplayStatus
9
8
  import com.facebook.react.bridge.Arguments
10
9
  import com.facebook.react.bridge.ReadableMap
11
10
  import com.facebook.react.bridge.ReadableType
@@ -65,16 +64,15 @@ internal object ConfigMapper {
65
64
  when (r) {
66
65
  is SekyroResult.Finished -> {
67
66
  putString("status", "finished"); putString("sessionId", r.sessionId)
68
- // EXPIRED is a display status in JS too ({ status: 'finished', displayStatus: 'expired' }), as on iOS.
69
- putString("displayStatus", when (r.displayStatus) {
70
- DisplayStatus.APPROVED -> "approved"; DisplayStatus.REVIEW_PENDING -> "review_pending"
71
- DisplayStatus.REJECTED -> "rejected"; DisplayStatus.EXPIRED -> "expired"
72
- })
73
- // The level and how it was proved when the native SDK reports them (rc.13 on), read from its own wire
74
- // form (so the glue builds against an older pin too).
67
+ // Everything else from the native SDK's own wire form (SekyroWire.result), so the JS side reads the same
68
+ // strings as Flutter: displayStatus verified | review_pending | not_verified, reason and reasonCode on
69
+ // not_verified, level and assurance once decided. Each key only when known: JS reads absent as "none".
75
70
  val wire = SekyroWire.result(r)
71
+ (wire["displayStatus"] as? String)?.let { putString("displayStatus", it) }
76
72
  (wire["level"] as? Int)?.takeIf { it in 0..3 }?.let { putInt("level", it) }
77
- (wire["assurance"] as? String)?.takeIf { it.isNotEmpty() }?.let { putString("assurance", it) }
73
+ for (key in listOf("assurance", "reason", "reasonCode")) {
74
+ (wire[key] as? String)?.takeIf { it.isNotEmpty() }?.let { putString(key, it) }
75
+ }
78
76
  }
79
77
  SekyroResult.Cancelled -> putString("status", "cancelled")
80
78
  is SekyroResult.Failed -> { putString("status", "failed"); putString("code", r.code) }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var O=(e,r)=>{for(var t in r)f(e,t,{get:r[t],enumerable:!0})},b=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of h(r))!C.call(e,n)&&n!==t&&f(e,n,{get:()=>r[n],enumerable:!(s=w(r,n))||s.enumerable});return e};var x=e=>b(f({},"__esModule",{value:!0}),e);var Y={};O(Y,{SDK_VERSION:()=>N,SekyroError:()=>l,SekyroFlow:()=>R,nativeVersion:()=>_,startSekyro:()=>y});module.exports=x(Y);var S=require("react-native"),c=S.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var T=500,I=new Set(["ar","fr","en","es","pt","de"]),D=["brand","brandFg","bg","surface","fg","fgMuted","border"],F=["danger","success","warning"],k=!1,V=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),L=/^#[0-9a-fA-F]{6}$/,M=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function g(e){(typeof e!="object"||e===null)&&a("config");for(let s of Object.keys(e))V.has(s)||a(`unknown key "${s.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__&&M.test(e.apiOrigin))||a("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(I.has(e.locale)||a("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let s={};for(let[n,i]of Object.entries(t.colors))if(i!==void 0){if(F.includes(n)){__DEV__&&!k&&(k=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));continue}(!D.includes(n)||typeof i!="string"||!L.test(i))&&a(`theme.colors.${n.slice(0,32)}`),s[n]=i}r.colors=s}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 s=e.strings[e.locale]??{},n={},i=Object.entries(s).filter(([,o])=>o!==void 0);i.length>T&&a("strings (too many overrides)");for(let[o,p]of i)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||a("strings key"),(typeof p!="string"||p.length>2e3)&&a(`strings.${o}`),n[o]=p;r.strings=n}return r}var $=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function v(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!$.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 A=new Set(["approved","review_pending","rejected","expired"]),P=new Set([0,1,2,3]);function j(e){return typeof e=="string"&&e!==""}function m(e){return e.status==="cancelled"?{status:"cancelled"}:e.status==="failed"?{status:"failed",code:e.code||"unknown_error"}:e.status==="finished"&&e.sessionId&&A.has(e.displayStatus)?{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus,...typeof e.level=="number"&&P.has(e.level)?{level:e.level}:{},...j(e.assurance)?{assurance:e.assurance}:{}}:{status:"failed",code:"unknown_error"}}function E(){if(!c)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return c}var d=!1,K=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function y(e){let r=g(e),t=E();if(d)throw new l("flow_in_progress");d=!0;let s=e.onEvent,n=s?t.onEvent(i=>{let o=v(i);o&&s(o)}):void 0;try{return m(await t.start(r))}catch(i){let o=i?.code;if(typeof o=="string"&&K.has(o))throw new l(o);return{status:"failed",code:"unknown_error"}}finally{n?.remove(),d=!1}}function _(){return E().nativeVersion()}var u=require("react");function R(e){let r=(0,u.useRef)(null),t=(0,u.useRef)(e);return t.current=e,(0,u.useEffect)(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:s,onEvent:n,...i}=t.current;y({...i,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 N="0.1.0-rc.15";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
1
+ "use strict";var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var t in r)d(e,t,{get:r[t],enumerable:!0})},x=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of h(r))!O.call(e,s)&&s!==t&&d(e,s,{get:()=>r[s],enumerable:!(n=C(r,s))||n.enumerable});return e};var T=e=>x(d({},"__esModule",{value:!0}),e);var Y={};b(Y,{SDK_VERSION:()=>w,SekyroError:()=>l,SekyroFlow:()=>N,nativeVersion:()=>R,startSekyro:()=>y});module.exports=T(Y);var k=require("react-native"),p=k.TurboModuleRegistry.get("SekyroReactNative");var l=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var I=500,D=new Set(["ar","fr","en","es","pt","de"]),F=["brand","brandFg","bg","surface","fg","fgMuted","border"],V=["danger","success","warning"],g=!1,L=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),M=/^#[0-9a-fA-F]{6}$/,$=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,a=e=>{throw new l("invalid_config",`invalid config: ${e}`)};function v(e){(typeof e!="object"||e===null)&&a("config");for(let n of Object.keys(e))L.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__&&$.test(e.apiOrigin))||a("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(D.has(e.locale)||a("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[s,i]of Object.entries(t.colors))if(i!==void 0){if(V.includes(s)){__DEV__&&!g&&(g=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));continue}(!F.includes(s)||typeof i!="string"||!M.test(i))&&a(`theme.colors.${s.slice(0,32)}`),n[s]=i}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]??{},s={},i=Object.entries(n).filter(([,o])=>o!==void 0);i.length>I&&a("strings (too many overrides)");for(let[o,f]of i)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||a("strings key"),(typeof f!="string"||f.length>2e3)&&a(`strings.${o}`),s[o]=f;r.strings=s}return r}var A=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function m(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!A.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 P=new Set(["verified","review_pending","not_verified"]),j=new Set([0,1,2,3]);function c(e){return typeof e=="string"&&e!==""}function _(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){let r=P.has(e.displayStatus),t=r?e.displayStatus:"not_verified",n=t==="not_verified";return{status:"finished",sessionId:e.sessionId,displayStatus:t,...typeof e.level=="number"&&j.has(e.level)?{level:e.level}:{},...c(e.assurance)?{assurance:e.assurance}:{},...n&&r&&c(e.reason)?{reason:e.reason}:{},...n&&r&&c(e.reasonCode)?{reasonCode:e.reasonCode}:{}}}return{status:"failed",code:"unknown_error"}}function E(){if(!p)throw new l("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return p}var S=!1,K=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function y(e){let r=v(e),t=E();if(S)throw new l("flow_in_progress");S=!0;let n=e.onEvent,s=n?t.onEvent(i=>{let o=m(i);o&&n(o)}):void 0;try{return _(await t.start(r))}catch(i){let o=i?.code;if(typeof o=="string"&&K.has(o))throw new l(o);return{status:"failed",code:"unknown_error"}}finally{s?.remove(),S=!1}}function R(){return E().nativeVersion()}var u=require("react");function N(e){let r=(0,u.useRef)(null),t=(0,u.useRef)(e);return t.current=e,(0,u.useEffect)(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:s,...i}=t.current;y({...i,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 w="0.1.0-rc.16";0&&(module.exports={SDK_VERSION,SekyroError,SekyroFlow,nativeVersion,startSekyro});
package/dist/index.d.cts CHANGED
@@ -61,11 +61,17 @@ interface SekyroConfig {
61
61
  onEvent?: (event: SekyroEvent) => void;
62
62
  }
63
63
  /**
64
- * What the end user was shown; not the decision. `expired`: the session expired before it finished (the person was
65
- * asked to start again from your app), as on the native SDKs. @public
64
+ * What the end user was shown; not the decision. `not_verified` comes with a {@link SekyroSessionReason}. @public
66
65
  */
67
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
68
- /** The verification level a finished session proved (0 = rejected). @public */
66
+ type SekyroDisplayStatus = 'verified' | 'review_pending' | 'not_verified';
67
+ /**
68
+ * Why a session ended `not_verified`: `rejected` (a check failed), `inconclusive` (no verdict could be reached),
69
+ * `unavailable` (a check could not run), `abandoned` (the person left before a result), `not_opened` (nobody opened the
70
+ * link), `policy` (a flow rule stopped it), `cancelled` (your organization cancelled it) or `superseded` (a newer session
71
+ * of the same person took over). A newer server may add one; it is passed through as its string. @public
72
+ */
73
+ type SekyroSessionReason = 'rejected' | 'inconclusive' | 'unavailable' | 'abandoned' | 'not_opened' | 'policy' | 'cancelled' | 'superseded';
74
+ /** The verification level a finished session proved (0 = not verified). @public */
69
75
  type SekyroLevel = 0 | 1 | 2 | 3;
70
76
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
71
77
  type SekyroResult = {
@@ -73,8 +79,8 @@ type SekyroResult = {
73
79
  sessionId: string;
74
80
  displayStatus: SekyroDisplayStatus;
75
81
  /**
76
- * What the session proved (0 to 3, 0 = rejected), when the native SDK reports it (native 0.1.0-rc.13 on). Absent on
77
- * an expired session and on older servers.
82
+ * What the session proved (0 to 3, 0 = not verified), when the native SDK reports it. Absent when the session
83
+ * closed without one (for example a link nobody opened).
78
84
  */
79
85
  level?: SekyroLevel;
80
86
  /**
@@ -82,6 +88,13 @@ type SekyroResult = {
82
88
  * `supplied_biometric` or `eid_authenticated` (a newer server may add one). Absent when the server reports none.
83
89
  */
84
90
  assurance?: string;
91
+ /**
92
+ * `not_verified` only: why, when the native SDK reports it. Absent on `verified` and `review_pending`, and when the
93
+ * session did not say.
94
+ */
95
+ reason?: SekyroSessionReason | (string & {});
96
+ /** `not_verified` only: the machine-readable code behind `reason` (for example `device_cooldown`), when there is one. */
97
+ reasonCode?: string;
85
98
  } | {
86
99
  status: 'cancelled';
87
100
  } | {
@@ -96,7 +109,7 @@ type SekyroResult = {
96
109
  */
97
110
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
98
111
  /**
99
- * Version of the bundled native core: `'android 0.1.0-rc.14'` / `'ios 0.1.0-rc.14'`.
112
+ * Version of the bundled native core: `'android 0.1.0-rc.15'` / `'ios 0.1.0-rc.15'`.
100
113
  * @public
101
114
  */
102
115
  declare function nativeVersion(): string;
@@ -128,4 +141,4 @@ declare class SekyroError extends Error {
128
141
  */
129
142
  declare const SDK_VERSION: string;
130
143
 
131
- export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
144
+ export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, type SekyroSessionReason, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
package/dist/index.d.ts CHANGED
@@ -61,11 +61,17 @@ interface SekyroConfig {
61
61
  onEvent?: (event: SekyroEvent) => void;
62
62
  }
63
63
  /**
64
- * What the end user was shown; not the decision. `expired`: the session expired before it finished (the person was
65
- * asked to start again from your app), as on the native SDKs. @public
64
+ * What the end user was shown; not the decision. `not_verified` comes with a {@link SekyroSessionReason}. @public
66
65
  */
67
- type SekyroDisplayStatus = 'approved' | 'review_pending' | 'rejected' | 'expired';
68
- /** The verification level a finished session proved (0 = rejected). @public */
66
+ type SekyroDisplayStatus = 'verified' | 'review_pending' | 'not_verified';
67
+ /**
68
+ * Why a session ended `not_verified`: `rejected` (a check failed), `inconclusive` (no verdict could be reached),
69
+ * `unavailable` (a check could not run), `abandoned` (the person left before a result), `not_opened` (nobody opened the
70
+ * link), `policy` (a flow rule stopped it), `cancelled` (your organization cancelled it) or `superseded` (a newer session
71
+ * of the same person took over). A newer server may add one; it is passed through as its string. @public
72
+ */
73
+ type SekyroSessionReason = 'rejected' | 'inconclusive' | 'unavailable' | 'abandoned' | 'not_opened' | 'policy' | 'cancelled' | 'superseded';
74
+ /** The verification level a finished session proved (0 = not verified). @public */
69
75
  type SekyroLevel = 0 | 1 | 2 | 3;
70
76
  /** Display-only outcome; read the decision server-side (webhooks / `sessions.get`). @public */
71
77
  type SekyroResult = {
@@ -73,8 +79,8 @@ type SekyroResult = {
73
79
  sessionId: string;
74
80
  displayStatus: SekyroDisplayStatus;
75
81
  /**
76
- * What the session proved (0 to 3, 0 = rejected), when the native SDK reports it (native 0.1.0-rc.13 on). Absent on
77
- * an expired session and on older servers.
82
+ * What the session proved (0 to 3, 0 = not verified), when the native SDK reports it. Absent when the session
83
+ * closed without one (for example a link nobody opened).
78
84
  */
79
85
  level?: SekyroLevel;
80
86
  /**
@@ -82,6 +88,13 @@ type SekyroResult = {
82
88
  * `supplied_biometric` or `eid_authenticated` (a newer server may add one). Absent when the server reports none.
83
89
  */
84
90
  assurance?: string;
91
+ /**
92
+ * `not_verified` only: why, when the native SDK reports it. Absent on `verified` and `review_pending`, and when the
93
+ * session did not say.
94
+ */
95
+ reason?: SekyroSessionReason | (string & {});
96
+ /** `not_verified` only: the machine-readable code behind `reason` (for example `device_cooldown`), when there is one. */
97
+ reasonCode?: string;
85
98
  } | {
86
99
  status: 'cancelled';
87
100
  } | {
@@ -96,7 +109,7 @@ type SekyroResult = {
96
109
  */
97
110
  declare function startSekyro(config: SekyroConfig): Promise<SekyroResult>;
98
111
  /**
99
- * Version of the bundled native core: `'android 0.1.0-rc.14'` / `'ios 0.1.0-rc.14'`.
112
+ * Version of the bundled native core: `'android 0.1.0-rc.15'` / `'ios 0.1.0-rc.15'`.
100
113
  * @public
101
114
  */
102
115
  declare function nativeVersion(): string;
@@ -128,4 +141,4 @@ declare class SekyroError extends Error {
128
141
  */
129
142
  declare const SDK_VERSION: string;
130
143
 
131
- export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
144
+ export { SDK_VERSION, type SekyroColorRole, type SekyroConfig, type SekyroDisplayStatus, SekyroError, type SekyroErrorCode, type SekyroEvent, SekyroFlow, type SekyroFlowProps, type SekyroLevel, type SekyroLocale, type SekyroResult, type SekyroSessionReason, type SekyroStep, type SekyroTheme, nativeVersion, startSekyro };
package/dist/index.js CHANGED
@@ -1 +1 @@
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 E=500,_=new Set(["ar","fr","en","es","pt","de"]),R=["brand","brandFg","bg","surface","fg","fgMuted","border"],N=["danger","success","warning"],c=!1,w=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),h=/^#[0-9a-fA-F]{6}$/,C=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,s=e=>{throw new a("invalid_config",`invalid config: ${e}`)};function d(e){(typeof e!="object"||e===null)&&s("config");for(let i of Object.keys(e))w.has(i)||s(`unknown key "${i.slice(0,32)}"`);(typeof e.clientToken!="string"||e.clientToken.length===0)&&s("clientToken");let r={clientToken:e.clientToken};e.apiOrigin!==void 0&&(typeof e.apiOrigin=="string"&&(/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(e.apiOrigin)||__DEV__&&C.test(e.apiOrigin))||s("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(_.has(e.locale)||s("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let i={};for(let[l,n]of Object.entries(t.colors))if(n!==void 0){if(N.includes(l)){__DEV__&&!c&&(c=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));continue}(!R.includes(l)||typeof n!="string"||!h.test(n))&&s(`theme.colors.${l.slice(0,32)}`),i[l]=n}r.colors=i}t.radius!==void 0&&((typeof t.radius!="number"||!Number.isFinite(t.radius)||t.radius<0||t.radius>32)&&s("theme.radius"),r.radius=t.radius),t.fontFamily!==void 0&&((typeof t.fontFamily!="string"||!/^[\w .-]{1,64}$/.test(t.fontFamily))&&s("theme.fontFamily"),r.fontFamily=t.fontFamily),t.darkMode!==void 0&&(["system","light","dark"].includes(t.darkMode)||s("theme.darkMode"),r.darkMode=t.darkMode)}if(e.strings){e.locale||s("strings need locale");let i=e.strings[e.locale]??{},l={},n=Object.entries(i).filter(([,o])=>o!==void 0);n.length>E&&s("strings (too many overrides)");for(let[o,u]of n)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||s("strings key"),(typeof u!="string"||u.length>2e3)&&s(`strings.${o}`),l[o]=u;r.strings=l}return r}var O=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function S(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!O.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 b=new Set(["approved","review_pending","rejected","expired"]),x=new Set([0,1,2,3]);function T(e){return typeof e=="string"&&e!==""}function k(e){return e.status==="cancelled"?{status:"cancelled"}:e.status==="failed"?{status:"failed",code:e.code||"unknown_error"}:e.status==="finished"&&e.sessionId&&b.has(e.displayStatus)?{status:"finished",sessionId:e.sessionId,displayStatus:e.displayStatus,...typeof e.level=="number"&&x.has(e.level)?{level:e.level}:{},...T(e.assurance)?{assurance:e.assurance}:{}}:{status:"failed",code:"unknown_error"}}function g(){if(!y)throw new a("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return y}var p=!1,I=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function f(e){let r=d(e),t=g();if(p)throw new a("flow_in_progress");p=!0;let i=e.onEvent,l=i?t.onEvent(n=>{let o=S(n);o&&i(o)}):void 0;try{return k(await t.start(r))}catch(n){let o=n?.code;if(typeof o=="string"&&I.has(o))throw new a(o);return{status:"failed",code:"unknown_error"}}finally{l?.remove(),p=!1}}function D(){return g().nativeVersion()}import{useEffect as F,useRef as v}from"react";function V(e){let r=v(null),t=v(e);return t.current=e,F(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:i,onEvent:l,...n}=t.current;f({...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 L="0.1.0-rc.15";export{L as SDK_VERSION,a as SekyroError,V as SekyroFlow,D as nativeVersion,f as startSekyro};
1
+ import{TurboModuleRegistry as _}from"react-native";var y=_.get("SekyroReactNative");var a=class extends Error{code;constructor(r,t=r){super(t),this.name="SekyroError",this.code=r}};var E=500,R=new Set(["ar","fr","en","es","pt","de"]),N=["brand","brandFg","bg","surface","fg","fgMuted","border"],w=["danger","success","warning"],c=!1,C=new Set(["clientToken","apiOrigin","locale","theme","strings","onEvent"]),h=/^#[0-9a-fA-F]{6}$/,O=/^http:\/\/(localhost|127\.0\.0\.1|10\.0\.2\.2)(:\d+)?$/,i=e=>{throw new a("invalid_config",`invalid config: ${e}`)};function S(e){(typeof e!="object"||e===null)&&i("config");for(let n of Object.keys(e))C.has(n)||i(`unknown key "${n.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__&&O.test(e.apiOrigin))||i("apiOrigin"),r.apiOrigin=e.apiOrigin),e.locale!==void 0&&(R.has(e.locale)||i("locale"),r.locale=e.locale);let t=e.theme;if(t){if(t.colors){let n={};for(let[l,s]of Object.entries(t.colors))if(s!==void 0){if(w.includes(l)){__DEV__&&!c&&(c=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));continue}(!N.includes(l)||typeof s!="string"||!h.test(s))&&i(`theme.colors.${l.slice(0,32)}`),n[l]=s}r.colors=n}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 n=e.strings[e.locale]??{},l={},s=Object.entries(n).filter(([,o])=>o!==void 0);s.length>E&&i("strings (too many overrides)");for(let[o,u]of s)/^[a-zA-Z0-9_.]{1,96}$/.test(o)||i("strings key"),(typeof u!="string"||u.length>2e3)&&i(`strings.${o}`),l[o]=u;r.strings=l}return r}var b=new Set(["method","phone_otp","email_otp","registry","document","nfc","liveness","processing","result","update_required","eid","contact_choice","identity_summary","portrait"]);function k(e){if(e.type==="waiting_for_network")return{type:"waiting_for_network"};if(e.type!=="step"||!b.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 x=new Set(["verified","review_pending","not_verified"]),T=new Set([0,1,2,3]);function f(e){return typeof e=="string"&&e!==""}function g(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){let r=x.has(e.displayStatus),t=r?e.displayStatus:"not_verified",n=t==="not_verified";return{status:"finished",sessionId:e.sessionId,displayStatus:t,...typeof e.level=="number"&&T.has(e.level)?{level:e.level}:{},...f(e.assurance)?{assurance:e.assurance}:{},...n&&r&&f(e.reason)?{reason:e.reason}:{},...n&&r&&f(e.reasonCode)?{reasonCode:e.reasonCode}:{}}}return{status:"failed",code:"unknown_error"}}function v(){if(!y)throw new a("unsupported_platform","the SekyroReactNative native module is not linked (New Architecture app, pod install / Gradle sync)");return y}var d=!1,I=new Set(["no_activity","unsupported_platform","flow_in_progress","invalid_config"]);async function p(e){let r=S(e),t=v();if(d)throw new a("flow_in_progress");d=!0;let n=e.onEvent,l=n?t.onEvent(s=>{let o=k(s);o&&n(o)}):void 0;try{return g(await t.start(r))}catch(s){let o=s?.code;if(typeof o=="string"&&I.has(o))throw new a(o);return{status:"failed",code:"unknown_error"}}finally{l?.remove(),d=!1}}function D(){return v().nativeVersion()}import{useEffect as F,useRef as m}from"react";function V(e){let r=m(null),t=m(e);return t.current=e,F(()=>{if(r.current===e.clientToken)return;r.current=e.clientToken;let{onResult:n,onEvent:l,...s}=t.current;p({...s,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 L="0.1.0-rc.16";export{L as SDK_VERSION,a as SekyroError,V as SekyroFlow,D as nativeVersion,p as startSekyro};
@@ -52,8 +52,9 @@ public final class SekyroRNBridge: NSObject {
52
52
  return SekyroConfig(clientToken: token, apiOrigin: origin, locale: locale, theme: theme)
53
53
  }
54
54
 
55
- /// The native SDK's own wire form (`SekyroWire.dictionary`): status, session id, display status, code, and the
56
- /// person ids when the native SDK reports them (rc.13 on), without matching the result's associated values here.
55
+ /// The native SDK's own wire form (`SekyroWire.dictionary`): status, session id, display status (`verified`,
56
+ /// `review_pending`, `not_verified`), `reason` and `reasonCode` on `not_verified`, `level` and `assurance` when known,
57
+ /// and the failure code, without matching the result's associated values here.
57
58
  static func wire(_ result: SekyroResult) -> NSDictionary {
58
59
  SekyroWire.dictionary(result) as NSDictionary
59
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sekyro/react-native",
3
- "version": "0.1.0-rc.15",
3
+ "version": "0.1.0-rc.16",
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.14",
103
- "ios": "0.1.0-rc.14"
102
+ "android": "0.1.0-rc.15",
103
+ "ios": "0.1.0-rc.15"
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.15",
101
- "bom-ref": "@sekyro/react-native@0.1.0-rc.15",
100
+ "version": "0.1.0-rc.16",
101
+ "bom-ref": "@sekyro/react-native@0.1.0-rc.16",
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.15?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.16?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.15"
150
+ "ref": "@sekyro/react-native@0.1.0-rc.16"
151
151
  }
152
152
  ]
153
153
  }
@@ -38,6 +38,8 @@ export type NativeResult = {
38
38
  code?: string;
39
39
  level?: Int32;
40
40
  assurance?: string;
41
+ reason?: string;
42
+ reasonCode?: string;
41
43
  };
42
44
 
43
45
  export type NativeEvent = { type: string; step?: string; retryReason?: string; seq: Int32 };