@esigncomply/react 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -114,7 +114,7 @@ Points that matter:
114
114
  - Start the ceremony when the form mounts, not on submit.
115
115
  - A resolved `complete()` is not proof. Your server confirms the record with `GET /v1/records/{id}` before it creates the account.
116
116
 
117
- Everything else is on the ceremony itself: `ceremony.verify.start(...)`, `ceremony.reviewPresented(...)`, `ceremony.cancel()` and the rest are described in the `@esigncomply/browser` README.
117
+ Everything else is on the ceremony itself: `ceremony.reviewPresented(...)`, `ceremony.cancel()` and the rest are described in the `@esigncomply/browser` README. So is the optional code step, `ceremony.verify.start(...)`, for L2 profiles on Unlimited and Enterprise.
118
118
 
119
119
  ## Development
120
120
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- /*! @esigncomply/react 1.0.0 */
2
+ /*! @esigncomply/react 1.0.1 */
3
3
  /* eslint-disable */
4
4
  import{useCallback as T,useEffect as x,useMemo as D,useState as E}from"react";import{EsignComply as _,EsignComplyError as h}from"@esigncomply/browser";import{EsignComplyError as O}from"@esigncomply/browser";var d=new Map;function b(e,s,t){let o=d.get(e);if(!o){let u={promise:_.attach({clientToken:s,apiUrl:t}),users:0};o=u,d.set(e,u),u.promise.catch(()=>{d.get(e)===u&&d.delete(e)})}return clearTimeout(o.timer),o.users++,o}function w(e,s){s.users--,!(s.users>0)&&(s.timer=setTimeout(()=>{s.users>0||(d.get(e)===s&&d.delete(e),s.promise.then(t=>t.destroy(),()=>{}))},0))}var R=e=>e instanceof h?e:new h({code:"internal_error",type:"api_error",message:e instanceof Error?e.message:String(e)}),C=[],S=[];function v({clientToken:e,apiUrl:s}){let t=e?`${e}
5
5
  ${s??""}`:null,[o,u]=E(null);return x(()=>{if(!t||!e)return;let n=!0,m=[],p=b(t,e,s);return p.promise.then(r=>{if(!n)return;let l=new Map,f=(i,a)=>`${i??""}:${a??""}`,c=(i={})=>u(a=>{let y=a&&a.key===t?a:{key:t,ceremony:r,status:"ready",remainingSteps:C,findings:S,error:null},g=r.session.status==="completed"?"completed":i.status??y.status;return{...y,...i,ceremony:r,status:g,remainingSteps:r.remainingSteps(),findings:Array.from(l.values()).flat()}});m.push(r.on("change",()=>c()),r.on("finding",i=>{let a=f(i.event_type,i.version_id),y=g=>`${g.rule}:${String(g.measurement?.slot??"")}`;l.set(a,[...(l.get(a)??[]).filter(g=>y(g)!==y(i)),i]),c()}),r.on("stepRecorded",i=>{l.set(f(i.type,i.versionId),i.findings.filter(a=>a.status!=="pass")),c()}),r.on("error",i=>c({error:i})),r.on("expired",()=>c({status:"error",error:new h({code:"client_token_expired",type:"authentication_error",message:"This session has expired.",fix:"Create a new session on your server and pass its client token."})}))),c({status:"ready",error:null})},r=>{n&&u({key:t,ceremony:null,status:"error",remainingSteps:C,findings:S,error:R(r)})}),()=>{n=!1,m.forEach(r=>r()),w(t,p)}},[t,e,s]),D(()=>{let n=o&&o.key===t?o:null,m=n?n.status:t?"attaching":"idle",p=n?n.remainingSteps:C;return{ceremony:n?n.ceremony:null,status:m,remainingSteps:p,findings:n?n.findings:S,error:n?n.error:null,canComplete:m==="ready"&&p.length>0&&p.every(r=>r==="signature.applied")}},[o,t])}function A(e,{versionId:s,mode:t}){let[o,u]=E(null),[n,m]=E(null),p=T(l=>u(l),[]);x(()=>{if(!e||!o||!s)return;let l=!0,f={ceremony:e,element:o,versionId:s,mode:t};return e.presentDocument(t==="hyperlink"?{versionId:s,mode:t,link:o}:{versionId:s,mode:t,container:o}).then(()=>{l&&m({...f,presented:!0,error:null})},c=>{l&&m({...f,presented:!1,error:R(c)})}),()=>{l=!1}},[e,o,s,t]);let r=n&&n.ceremony===e&&n.element===o&&n.versionId===s&&n.mode===t?n:null;return{ref:p,presented:r?r.presented:!1,error:r?r.error:null}}export{O as EsignComplyError,v as useCeremony,A as useDocument};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esigncomply/react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React hooks for the Esign Comply browser SDK. Hooks only: you build every element the signer sees.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -25,7 +25,7 @@
25
25
  "react": ">=18"
26
26
  },
27
27
  "devDependencies": {
28
- "@esigncomply/browser": "^1.0.0"
28
+ "@esigncomply/browser": "^1.0.1"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"