PageSourceSearch

https://myka.ng/assets/PartnerAuditPage-CmGGY9_e.js

js myka.ng collected 2026-10-09 22:44:20 UTC 7,244 bytes, 1 lines download raw bytes

1import{j as t,d as K,r as p,u as G,N as Y}from"./vendor-react-DfYGAhtm.js";import{m as a,g as A,k as X}from"./index-DsBgCU7r.js";import{b as J,I as Q,a as Z}from"./InspectionUploadProgress-C_qrTx_q.js";import{b8 as I}from"./vendor-icons-1odZwi-b.js";import{a as m,V as k,v as M,T as l,h as y}from"./vendor-ui-DA_r9yXk.js";import{a as C,P as E,u as ee}from"./index-CCvS5amz.js";import{c as te,p as oe}from"./inspectionAnalysis.runtime-CbjBTDqp.js";import{u as re}from"./useUploader-CBNPOY8T.js";import{b as ne,d as ie,g as se}from"./errors-BYKXB8DF.js";import{a as ae}from"./partnerInspectionApi-6HtjnS1z.js";import"./vendor-state-BsBVN-fX.js";import"./vendor-forms-BP-7CbAP.js";import"./WitnessFlowLayout-sXdBrCkv.js";import"./device-DbCxnG1h.js";import"./sseStream-C28FcIBw.js";const ce=({reason:e,categoryRows:o,onRecordAgain:s})=>t.jsxs(t.Fragment,{children:[t.jsxs(m,{flex:1,px:5,overflowY:"auto",children:[t.jsxs(k,{gap:3,pb:5,pt:2,align:"center",children:[t.jsx(m,{bg:"orange.50",borderRadius:"full",p:3,children:t.jsx(M,{as:I,boxSize:8,color:a.orange[500],"aria-hidden":!0})}),t.jsx(l,{fontSize:"xl",fontWeight:"bold",color:a.text.primary,textAlign:"center",children:"Inspection needs another go"}),t.jsx(l,{fontSize:"sm",color:a.text.info,textAlign:"center",maxW:"360px",lineHeight:"1.6",children:"Review the results below, then record the inspection again."})]}),o.length>0?t.jsxs(y,{gap:3,pb:4,children:[t.jsx(l,{fontSize:"xs",fontWeight:"bold",color:a.text.info,textTransform:"uppercase",letterSpacing:"wider",children:"Inspection Results"}),o.map(r=>t.jsx(J,{row:r},r.id))]}):null,e.trim()?t.jsx(m,{bg:"orange.50",borderRadius:"2xl",px:5,py:4,children:t.jsxs(y,{gap:1.5,children:[t.jsx(l,{fontSize:"10px",fontWeight:"bold",color:"orange.500",letterSpacing:"widest",textTransform:"uppercase",children:"Why it failed"}),t.jsx(l,{fontSize:"sm",color:a.text.primary,lineHeight:"1.7",children:e})]})}):null]}),t.jsx(m,{px:5,pt:6,children:t.jsx(A,{text:"Record Again",onClick:s,fullWidth:!0})})]}),v=({title:e,message:o,onRecordAgain:s,onRetry:r})=>t.jsxs(t.Fragment,{children:[t.jsxs(y,{flex:1,align:"center",justify:"center",px:6,gap:4,children:[t.jsx(M,{as:I,boxSize:12,color:a.orange[500],"aria-hidden":!0}),t.jsx(l,{fontSize:"lg",fontWeight:"bold",color:a.text.primary,textAlign:"center",children:e}),t.jsx(l,{fontSize:"sm",color:a.text.info,textAlign:"center",maxW:"320px",children:o})]}),t.jsxs(k,{px:5,pt:6,gap:3,align:"stretch",children:[r?t.jsx(A,{text:"Try Again",onClick:r,fullWidth:!0}):null,t.jsx(A,{buttonType:r?"outline":"primary",text:"Record Again",onClick:s,fullWidth:!0,...r?{border:`.5px solid ${a.border.primary}`}:{}})]})]}),le="gadgets_verification",de=15e3,ue=["Opening your recording…","Checking the video quality…","Scanning the footage frame by frame…","Looking for the IMEI dialog…","Verifying the IMEI details…","Reviewing the back of the device…","Reviewing the front of the device…","Cross-checking each inspection step…","Making sure nothing was missed…","Validating the results…","Almost there…","Finalizing your results…"],w=new Set(["PASS","PASSED","SUCCESS","SUCCEEDED","APPROVED","ACCEPTED"]),pe="This inspection did not meet our requirements. Please record it again.",x=(...e)=>{for(const o of e)if(typeof o=="string"&&o.trim())return o.trim();return null},U=e=>typeof e.inspectionPassed=="boolean"?e.inspectionPassed:typeof e.verdict=="boolean"?e.verdict:typeof e.verdict=="string"?w.has(e.verdict.trim().toUpperCase()):typeof e.status=="string"?w.has(e.status.trim().toUpperCase()):!1,ge=e=>x(e.requiredFix,e.reason,e.verdictReason)??pe,he=e=>!!x(e?.imei_sim1_primary,e?.imei_sim2),fe=e=>e===!0,me=[{id:"imei",label:"IMEI Verification",status:!1,note:"",score:null},{id:"screen_health",label:"Screen Health",status:!1,note:"",score:null},{id:"policy_association",label:"Policy Match",status:!1,note:"",score:null}],xe=e=>{const o=[];return e.capturedImeis!==void 0&&o.push({id:"imei",label:"IMEI Verification",status:he(e.capturedImeis),note:x(e.capturedImeisNote)??"",score:null}),e.screenHealth!==void 0&&o.push({id:"screen_health",label:"Screen Health",status:fe(e.screenHealth),note:x(e.screenHealthNote)??"",score:null}),e.policyAssociated!==void 0&&o.push({id:"policy_association",label:"Policy Match",status:!!e.policyAssociated,note:x(e.policyAssociationNote)??"",score:null}),o.length===0&&!U(e)?me:o},ye="We could not upload your recording. Please check your connection and try again.",Se="We could not verify this inspection. Please record the inspection again.",Re=({sessionId:e,videoUrl:o})=>
1{const s=K(),[r,d]=p.useState("uploading"),[g,c]=p.useState(""),[S,u]=p.useState(null),b=p.useRef(!1),R=p.useRef("upload"),{uploadFile:L,getUploadUrl:F,resetUploaderState:O,progress:W}=re({compress:!1,requireAccessToken:!1,...e?{headers:{Authorization:`Bearer ${e}`}}:{}}),j=()=>{o&&URL.revokeObjectURL(o)},N=async()=>{if(!o?.trim())throw new Error("No recording available to submit.");const n=new AbortController,i=await te({promiseFactory:()=>fetch(o,{signal:n.signal}),timeoutMs:de,timeoutMessage:"Reading the recording took too long. Please record the inspection again.",onTimeout:()=>n.abort()});if(!i.ok)throw new Error("Could not read the recording. Please record the inspection again.");const h=await i.blob();if(h.size===0)throw new Error("The recording is empty. Please record the inspection again.");const f=h.type.split(";")[0]?.trim()||"video/webm",V=oe({mimeType:f}),T=`partner-inspection-${e}-${Date.now()}.${V}`,B=new File([h],T,{type:f}),{key:$,url:_}=await L({file:B,filename:T,mimeType:f,contextType:le,contextId:e});if(_.trim())return _;const{url:q}=await F($);return q},D=n=>{const i=R.current,h=ne(n);console.error("[partner-inspection] submission failed",{stage:i,sessionId:e,status:h,code:ie(n),error:n});const f=i==="audit"?Se:ye;c(se(n)??f),d(i==="audit"?"audit-failed":"upload-error")},P=async()=>{try{R.current="upload",u(null),d("uploading");const n=await N();R.current="audit",d("auditing");const i=await ae({sessionId:e,videoUrl:n});if(!U(i)){u(i),c(ge(i)),d("audit-failed");return}j(),sessionStorage.removeItem(C),s(E.success(e),{replace:!0})}catch(n){D(n)}};p.useEffect(()=>{b.current||!o?.trim()||(b.current=!0,P())},[o]);const H=()=>{O(),c(""),P()},z=()=>{j(),sessionStorage.removeItem(C),s(E.recording(e),{replace:!0})};return{phase:r,progressPercent:W?.percent??0,errorMessage:g,auditResult:S,onRetry:H,onRecordAgain:z}},Fe=()=>{const e=G(),{sessionId:o}=ee(),{videoUrl:s}=e.state??{},{phase:r,progressPercent:d,errorMessage:g,auditResult:c,onRetry:S,onRecordAgain:u}=Re({sessionId:o,videoUrl:s});return s?.trim()?t.jsxs(y,{gap:0,minH:"100dvh",pb:8,children:[t.jsx(m,{display:"flex",justifyContent:"center",pt:8,pb:4,children:t.jsx(X,{variant:"light",alt:"Myka",h:"36px"})}),r==="uploading"?t.jsx(Q,{percent:d}):null,r==="auditing"?t.jsx(Z,{messages:ue}):null,r==="upload-error"?t.jsx(v,{title:"We couldn't upload your recording",message:g,onRetry:S,onRecordAgain:u}):null,r==="audit-failed"&&c?t.jsx(ce,{reason:g,categoryRows:xe(c),onRecordAgain:u}):null,r==="audit-failed"&&!c?t.jsx(v,{title:"We couldn't review your inspection",message:g,onRecordAgain:u}):null]}):t.jsx(Y,{to:E.recording(o),replace:!0})};export{Fe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.