@vanira/sdk 0.0.95 → 0.0.96

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.
@@ -1029,7 +1029,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
1029
1029
  <svg width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" viewBox="0 0 24 24"><polyline points="20 6 9 17 4 12"/></svg>
1030
1030
  Submit
1031
1031
  </button>
1032
- `,p.appendChild(B);const x=B.querySelector(".vnr-confirm-btn"),y=new Set,C=()=>{x.disabled=y.size===0},T=()=>{v.querySelectorAll(".vnr-mcq-option").forEach(E=>{const U=E.dataset.optionId;E.classList.toggle("vnr-mcq-sel",!!U&&y.has(U))}),C(),w.style.display="none"};o.forEach(E=>{const U=document.createElement("button");U.type="button",U.className="vnr-mcq-option",U.dataset.optionId=E.id;const P=document.createElement("span");P.className="vnr-mcq-option-id",P.textContent=`${E.id}.`;const L=document.createElement("span");L.className="vnr-mcq-option-label",L.textContent=E.label,U.appendChild(P),U.appendChild(L),U.addEventListener("click",()=>{A?y.has(E.id)?y.delete(E.id):y.add(E.id):(y.clear(),y.add(E.id)),T()}),v.appendChild(U)}),B.querySelector(".vnr-cancel-btn").addEventListener("click",()=>{this.dismiss(),s("User cancelled")}),x.addEventListener("click",()=>{if(y.size===0){w.textContent="Please select an answer.",w.style.display="block";return}x.disabled=!0,x.innerHTML='<div class="vnr-spinner"></div>';const E=yS(a,o,[...y],{allow_multiple:A,image_url:c,question_id:l});setTimeout(()=>{this.dismiss(),i(E)},200)})}renderKycCapture(e,t,n,i,s){const a=e==="document"?I.KycDocumentCapture:I.KycSelfieCapture;this.bindActiveModalPreset(t,a,n,i);const o=m=>{this.clearActiveModalPreset(),n({status:"success",preset_id:a,...m})},A=(m,v="cancelled")=>{this.clearActiveModalPreset(),i(m,{status:v})},c=String(t.args.document_side??t.clientFields.document_side??"front").toLowerCase()==="back"?"back":"front",l=e==="document"?c==="back"?"Scan back of ID":"Scan your ID":"Verify it's you",d=e==="document"?c==="back"?"Hold the back of your ID in the frame. We'll capture automatically when edges are clear.":"Hold your ID in the frame. On desktop, use your webcam; on mobile, we use the rear camera.":"Center your face in the oval. Blink or turn slightly when prompted — we'll capture automatically.",u=String(t.args.reason??t.clientFields.reason??(e==="document"?"kyc_document":"kyc_selfie")).trim();this.stopCaptureCamera();const h=this,p=cO({mode:e,presetId:a,title:String(t.clientFields.title??t.args.title??l),description:String(t.clientFields.description??t.args.description??d),reason:u,documentSide:c,toolCallId:t.toolCallId,host:{setCaptureActive:m=>{h.captureActive=m},setCaptureStream:m=>{h.captureStream=m},createOverlay:()=>h.createOverlay(),dismiss:()=>h.dismiss(),getBrowserPermissionHint:()=>h.getBrowserPermissionHint(),fillCameraPermissionPrompt:(m,v)=>h.fillCameraPermissionPrompt(m,v),notifyCameraPermissionDenied:(m,v)=>h.notifyCameraPermissionDenied(m,v)},client:s,onComplete:m=>{h.kycCaptureStop=null,o(m)},onCancel:m=>{h.kycCaptureStop=null,A(m)},isActive:()=>h.captureActive});this.kycCaptureStop=p.stop}renderKycSignatureCapture(e,t,n,i){const s=I.KycSignatureCapture;this.bindActiveModalPreset(e,s,t,n);const a=l=>{this.clearActiveModalPreset(),t({status:"success",preset_id:s,...l})},o=(l,d="cancelled")=>{this.clearActiveModalPreset(),n(l,{status:d})},A=String(e.args.reason??e.clientFields.reason??"kyc_signature").trim(),c=dO({presetId:s,title:String(e.clientFields.title??e.args.title??"Sign here"),description:String(e.clientFields.description??e.args.description??"Draw your signature in the box below, then submit."),reason:A,host:{createOverlay:()=>this.createOverlay(),dismiss:()=>this.dismiss()},client:i,onComplete:a,onCancel:l=>o(l)});this.kycCaptureStop=c.stop}renderCamera(e,t,n,i){this.bindActiveModalPreset(e,I.Camera,t,n);const s=oe=>{this.clearActiveModalPreset(),t({status:"success",preset_id:I.Camera,...oe})},a=(oe,Be="cancelled")=>{this.clearActiveModalPreset(),n(oe,{status:Be})},o=this,A=e.clientFields.title||"Take a Photo",c=e.clientFields.description||"Point your camera at the subject, then tap capture.";let l=D4(e.clientFields.facing_mode||e.args.facing_mode,"environment");const d=N4(e.clientFields,e.args),u=e.clientFields.reason||"camera_capture",h=e.clientFields.liveness_check===!0||e.clientFields.liveness_check==="true"||e.args.liveness_check===!0||e.args.liveness_check==="true";let p=null,m=null;this.stopCaptureCamera(),this.captureActive=!0;const v=this.createOverlay(),w=document.createElement("div");w.className="vnr-modal",w.style.cssText="position:relative;max-width:480px;width:100%",w.innerHTML=`
1032
+ `,p.appendChild(B);const x=B.querySelector(".vnr-confirm-btn"),y=new Set,C=()=>{x.disabled=y.size===0},T=()=>{v.querySelectorAll(".vnr-mcq-option").forEach(E=>{const U=E.dataset.optionId;E.classList.toggle("vnr-mcq-sel",!!U&&y.has(U))}),C(),w.style.display="none"};o.forEach(E=>{const U=document.createElement("button");U.type="button",U.className="vnr-mcq-option",U.dataset.optionId=E.id;const P=document.createElement("span");P.className="vnr-mcq-option-id",P.textContent=`${E.id}.`;const L=document.createElement("span");L.className="vnr-mcq-option-label",L.textContent=E.label,U.appendChild(P),U.appendChild(L),U.addEventListener("click",()=>{A?y.has(E.id)?y.delete(E.id):y.add(E.id):(y.clear(),y.add(E.id)),T()}),v.appendChild(U)}),B.querySelector(".vnr-cancel-btn").addEventListener("click",()=>{this.dismiss(),s("User cancelled")}),x.addEventListener("click",()=>{if(y.size===0){w.textContent="Please select an answer.",w.style.display="block";return}x.disabled=!0,x.innerHTML='<div class="vnr-spinner"></div>';const E=yS(a,o,[...y],{allow_multiple:A,image_url:c,question_id:l});setTimeout(()=>{this.dismiss(),i(E)},200)})}renderKycCapture(e,t,n,i,s){const a=e==="document"?I.KycDocumentCapture:I.KycSelfieCapture;this.bindActiveModalPreset(t,a,n,i);const o=m=>{this.clearActiveModalPreset(),n({status:"success",preset_id:a,...m})},A=(m,v="cancelled")=>{this.clearActiveModalPreset(),i(m,{status:v})},c=String(t.args.document_side??t.clientFields.document_side??"front").toLowerCase()==="back"?"back":"front",l=e==="document"?c==="back"?"Scan back of ID":"Scan your ID":"Verify it's you",d=e==="document"?c==="back"?"Hold the back of your ID in the frame. We'll capture automatically when edges are clear.":"Hold your ID in the frame. On desktop, use your webcam; on mobile, we use the rear camera.":"Center your face in the oval. Blink or turn slightly when prompted — we'll capture automatically.",u=String(t.args.reason??t.clientFields.reason??(e==="document"?"kyc_document":"kyc_selfie")).trim();this.stopCaptureCamera();const h=this,p=cO({mode:e,presetId:a,title:String(t.clientFields.title??t.args.title??l),description:String(t.clientFields.description??t.args.description??t.clientFields.instructions??t.args.instructions??d),reason:u,documentSide:c,toolCallId:t.toolCallId,host:{setCaptureActive:m=>{h.captureActive=m},setCaptureStream:m=>{h.captureStream=m},createOverlay:()=>h.createOverlay(),dismiss:()=>h.dismiss(),getBrowserPermissionHint:()=>h.getBrowserPermissionHint(),fillCameraPermissionPrompt:(m,v)=>h.fillCameraPermissionPrompt(m,v),notifyCameraPermissionDenied:(m,v)=>h.notifyCameraPermissionDenied(m,v)},client:s,onComplete:m=>{h.kycCaptureStop=null,o(m)},onCancel:m=>{h.kycCaptureStop=null,A(m)},isActive:()=>h.captureActive});this.kycCaptureStop=p.stop}renderKycSignatureCapture(e,t,n,i){const s=I.KycSignatureCapture;this.bindActiveModalPreset(e,s,t,n);const a=l=>{this.clearActiveModalPreset(),t({status:"success",preset_id:s,...l})},o=(l,d="cancelled")=>{this.clearActiveModalPreset(),n(l,{status:d})},A=String(e.args.reason??e.clientFields.reason??"kyc_signature").trim(),c=dO({presetId:s,title:String(e.clientFields.title??e.args.title??"Sign here"),description:String(e.clientFields.description??e.args.description??e.clientFields.instructions??e.args.instructions??"Draw your signature in the box below, then submit."),reason:A,host:{createOverlay:()=>this.createOverlay(),dismiss:()=>this.dismiss()},client:i,onComplete:a,onCancel:l=>o(l)});this.kycCaptureStop=c.stop}renderCamera(e,t,n,i){this.bindActiveModalPreset(e,I.Camera,t,n);const s=oe=>{this.clearActiveModalPreset(),t({status:"success",preset_id:I.Camera,...oe})},a=(oe,Be="cancelled")=>{this.clearActiveModalPreset(),n(oe,{status:Be})},o=this,A=e.clientFields.title||"Take a Photo",c=e.clientFields.description||"Point your camera at the subject, then tap capture.";let l=D4(e.clientFields.facing_mode||e.args.facing_mode,"environment");const d=N4(e.clientFields,e.args),u=e.clientFields.reason||"camera_capture",h=e.clientFields.liveness_check===!0||e.clientFields.liveness_check==="true"||e.args.liveness_check===!0||e.args.liveness_check==="true";let p=null,m=null;this.stopCaptureCamera(),this.captureActive=!0;const v=this.createOverlay(),w=document.createElement("div");w.className="vnr-modal",w.style.cssText="position:relative;max-width:480px;width:100%",w.innerHTML=`
1033
1033
  <button class="vnr-close-btn" aria-label="Close">
1034
1034
  <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
1035
1035
  </button>
@@ -46074,7 +46074,9 @@ class xO {
46074
46074
  mode: e,
46075
46075
  presetId: a,
46076
46076
  title: String(t.clientFields.title ?? t.args.title ?? l),
46077
- description: String(t.clientFields.description ?? t.args.description ?? d),
46077
+ description: String(
46078
+ t.clientFields.description ?? t.args.description ?? t.clientFields.instructions ?? t.args.instructions ?? d
46079
+ ),
46078
46080
  reason: u,
46079
46081
  documentSide: c,
46080
46082
  toolCallId: t.toolCallId,
@@ -46115,7 +46117,7 @@ class xO {
46115
46117
  presetId: s,
46116
46118
  title: String(e.clientFields.title ?? e.args.title ?? "Sign here"),
46117
46119
  description: String(
46118
- e.clientFields.description ?? e.args.description ?? "Draw your signature in the box below, then submit."
46120
+ e.clientFields.description ?? e.args.description ?? e.clientFields.instructions ?? e.args.instructions ?? "Draw your signature in the box below, then submit."
46119
46121
  ),
46120
46122
  reason: A,
46121
46123
  host: {