@nuralogix.ai/web-measurement-embedded-app 0.1.0-beta.4 → 0.1.0-beta.5

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/dist/stylex.css CHANGED
@@ -31,8 +31,8 @@
31
31
  margin: auto;
32
32
  }
33
33
 
34
- .padding-x1dvq9d0 {
35
- padding: .75rem 0 1.25rem;
34
+ .padding-x1vy5iyh {
35
+ padding: .75rem 0 3rem;
36
36
  }
37
37
 
38
38
  .padding-xc7ga6q {
@@ -57,12 +57,12 @@
57
57
  border-radius: 4px;
58
58
  }
59
59
 
60
- .gap-x13z6uf9 {
61
- gap: .5rem;
60
+ .gap-xvh977a {
61
+ gap: .25rem;
62
62
  }
63
63
 
64
- .gap-x1uma3xh {
65
- gap: .6rem;
64
+ .gap-x13z6uf9 {
65
+ gap: .5rem;
66
66
  }
67
67
 
68
68
  .overflow-xysyzu8 {
@@ -189,12 +189,12 @@
189
189
  margin-bottom: 8px;
190
190
  }
191
191
 
192
- .marginTop-x1mjqqkp {
193
- margin-top: .5rem;
192
+ .marginTop-x1tbvfm1 {
193
+ margin-top: .25rem;
194
194
  }
195
195
 
196
- .marginTop-xv0uc0e {
197
- margin-top: .6rem;
196
+ .marginTop-x1mjqqkp {
197
+ margin-top: .5rem;
198
198
  }
199
199
 
200
200
  .marginTop-xqui205 {
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var Lt="0.1.0-beta.4";const U={RESULTS:"results",ERROR:"error",APPEVENT:"appEvent",CANCELLED:"cancelled",DESTROYED:"destroyed",LOGS:"logs"};var Ye=(t=>(t.measurement="Measurement",t.collector="Collector",t.camera="Camera",t.app="App",t))(Ye||{});const N={INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},L={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_PREPARED:"MEASUREMENT_PREPARED",ASSETS_DOWNLOADED:"ASSETS_DOWNLOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",MEASUREMENT_CANCELED:"MEASUREMENT_CANCELED",CONSTRAINT_VIOLATION:"CONSTRAINT_VIOLATION",PAGE_UNLOADED:"PAGE_UNLOADED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},Dt={CAMERA_STARTED:{event:L.CAMERA_STARTED,level:N.INFO},APP_LOADED:{event:L.APP_LOADED,level:N.INFO},MEASUREMENT_PREPARED:{event:L.MEASUREMENT_PREPARED,level:N.INFO},ASSETS_DOWNLOADED:{event:L.ASSETS_DOWNLOADED,level:N.INFO},MEASUREMENT_STARTED:{event:L.MEASUREMENT_STARTED,level:N.INFO},MEASUREMENT_COMPLETED:{event:L.MEASUREMENT_COMPLETED,level:N.INFO},CAMERA_PERMISSION_GRANTED:{event:L.CAMERA_PERMISSION_GRANTED,level:N.INFO},INTERMEDIATE_RESULTS:{event:L.INTERMEDIATE_RESULTS,level:N.INFO},RESULTS_RECEIVED:{event:L.RESULTS_RECEIVED,level:N.INFO},MEASUREMENT_CANCELED:{event:L.MEASUREMENT_CANCELED,level:N.WARN},CONSTRAINT_VIOLATION:{event:L.CONSTRAINT_VIOLATION,level:N.ERROR},PAGE_UNLOADED:{event:L.PAGE_UNLOADED,level:N.INFO},PAGE_VISIBILITY_CHANGE:{event:L.PAGE_VISIBILITY_CHANGE,level:N.INFO}},ne={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage",GET_LOGS:"getLogs"};var Je=(t=>(t.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",t.WORKER_ERROR="WORKER_ERROR",t.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",t.NO_DEVICES_FOUND="NO_DEVICES_FOUND",t.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",t.CAMERA_START_FAILED="CAMERA_START_FAILED",t.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",t.COLLECTOR="COLLECTOR",t.WEBSOCKET_DISCONNECTED="WEBSOCKET_DISCONNECTED",t.MEASUREMENT_PREPARE_FAILED="MEASUREMENT_PREPARE_FAILED",t))(Je||{}),Xe="0.1.0-beta.2",J=(t=>(t.DELETE="DELETE",t.GET="GET",t.PATCH="PATCH",t.POST="POST",t.PUT="PUT",t.CONNECT="CONNECT",t))(J||{}),H=(t=>(t.ON_BEFORE_REST_CALL_ERROR="ON_BEFORE_REST_CALL_ERROR",t))(H||{});const ze=typeof DedicatedWorkerGlobalScope<"u",_e=async({baseUrl:t,urlFragment:e,method:i,headers:a,data:c},d)=>{const n=`${t}/${e}`;let r={Code:"",Message:""};try{const u=await fetch(n,{method:i,cache:"no-store",credentials:"include",headers:a,...c!=null&&{body:JSON.stringify(c)}}),h=u.headers.get("content-type"),p=u.status.toString();r={Code:"UNSUPPORTED_RESPONSE_CONTENT_TYPE",Message:"UNSUPPORTED_RESPONSE_CONTENT_TYPE"},p==="503"&&(r={Code:"SERVICE_UNAVAILABLE",Message:"Service unavailable"}),p==="429"&&(r={Code:"TOO_MANY_REQUESTS",Message:"Too many requests"}),h!=null&&(h.startsWith("application/json;")&&(r=await u.json()),h.startsWith("text/plain;")&&(r={data:await u.text()}));let S=u.headers;if(ze){const C={};u.headers.forEach((k,O)=>{C[O]=k}),S=C}try{d(p,p==="200"?void 0:r)}catch(C){console.error("Error running onAfterRESTCall callback",C)}return{status:p,headers:S,body:r}}catch(u){return u instanceof SyntaxError?r={Code:"SYNTAX_ERROR",Message:"SYNTAX_ERROR"}:r={Code:"UNEXPECTED_ERROR",Message:"UNEXPECTED_ERROR"},{status:"UNKNOWN",headers:ze?{}:new Headers,body:r}}},ge=()=>new Headers({"Content-Type":"application/json"});var It=Object.defineProperty,xt=(t,e,i)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ft=(t,e,i)=>xt(t,e+"",i);class Me{constructor(e){Ft(this,"parent"),this.parent=e}async onBeforeRESTCall(){try{return this.parent.onBeforeRESTCall(),{Code:"SUCCESS",Message:"SUCCESS"}}catch{return{Code:H.ON_BEFORE_REST_CALL_ERROR,Message:H.ON_BEFORE_REST_CALL_ERROR}}}getDefaults(e){return{baseUrl:JSON.parse(this.parent.getUrl()).http.slice(0,-1),method:J[e],headers:ge()}}getHeaderWithDeviceToken(){const e=ge();return e.set("Authorization",`Bearer ${this.parent.getSession().deviceToken}`),e}getHeaderWithUserToken(){const e=ge();return e.set("Authorization",`Bearer ${this.parent.getSession().userToken}`),e}getHeaderWithSessionEnabled(){const e=ge();return e.set("x-nura-session","true"),e}}class Mt extends Me{async create(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"measurements",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({lastMeasurementId:n.ID}),{status:d,body:n,headers:r}}}class Pt extends Me{async retrieveSdkConfigData(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"studies/sdkconfig",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({studyCfgData:n.ConfigFile,studyCfgHash:n.MD5Hash}),{status:d,body:n,headers:r}}}class Wt extends Me{async renew(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auths/renew",data:e},this.parent.onAfterRESTCall);if(d==="200"){const u=n.Token,h=n.RefreshToken,p={...i==="user"&&{userToken:u,userRefreshToken:h},...i==="device"&&{deviceToken:u,deviceRefreshToken:h}};this.parent.setSession(p)}return{status:d,body:n,headers:r}}async validate(e){const{Code:i,Message:a}=await this.onBeforeRESTCall();return i===H.ON_BEFORE_REST_CALL_ERROR?{status:i,body:{Code:i,Message:a},headers:new Headers}:await _e({...this.getDefaults(J.GET),headers:e==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auth/v1/validate"},this.parent.onAfterRESTCall)}}var Ut=Object.defineProperty,qe=t=>{throw TypeError(t)},$t=(t,e,i)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pe=(t,e,i)=>$t(t,typeof e!="symbol"?e+"":e,i),Ze=(t,e,i)=>e.has(t)||qe("Cannot "+i),We=(t,e,i)=>(Ze(t,e,"read from private field"),i?i.call(t):e.get(t)),Qe=(t,e,i)=>e.has(t)?qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),we=(t,e,i,a)=>(Ze(t,e,"write to private field"),e.set(t,i),i),oe,X;class Bt{constructor(e){Qe(this,oe,{http:new URL("https://api.deepaffex.ai")}),Qe(this,X),Pe(this,"onBeforeRESTCall"),Pe(this,"onAfterRESTCall"),Pe(this,"http"),we(this,X,{deviceToken:"",deviceRefreshToken:"",userToken:"",userRefreshToken:"",deviceId:"",roleId:"",userId:"",selectedStudy:"",lastMeasurementId:"",studyCfgHash:"",studyCfgData:""}),this.http={measurements:new Mt(this),studies:new Pt(this),auths:new Wt(this)},this.onBeforeRESTCall=e?.onBeforeRESTCall?e.onBeforeRESTCall:()=>{},this.onAfterRESTCall=e?.onAfterRESTCall?e.onAfterRESTCall:()=>{},e?.url!=null&&we(this,oe,e.url)}static new(e){return new this(e??void 0)}getUrl(){return JSON.stringify(We(this,oe))}setUrl(e){we(this,oe,{http:new URL(e)})}getSession(){return We(this,X)}setSession(e){const i=["deviceToken","deviceRefreshToken","userToken","userRefreshToken","deviceId","userId","roleId","selectedStudy","lastMeasurementId","studyCfgHash","studyCfgData"];Object.keys(e).every(d=>i.includes(d)&&typeof e[d]=="string")&&we(this,X,{...We(this,X),...e})}}oe=new WeakMap,X=new WeakMap;const Gt=t=>Bt.new(t);var Ht=Object.defineProperty,et=t=>{throw TypeError(t)},Vt=(t,e,i)=>e in t?Ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Kt=(t,e,i)=>Vt(t,e+"",i),jt=(t,e,i)=>e.has(t)||et("Cannot "+i),Yt=(t,e,i)=>e.has(t)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),Ue=(t,e,i)=>(jt(t,e,"access private method"),i),le,$e,tt;let it=t=>new Int8Array(t);class Jt extends EventTarget{constructor(){super(...arguments),Yt(this,le),Kt(this,"canDecompress",!1)}static init(){return new this}dispatch(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i}))}getBytesDownloadedEvent(e,i,a,c){return new CustomEvent("bytesDownloaded",{detail:{bytes:e,uncompressedSize:i,url:a,done:c}})}getBytesDownloadErrorEvent(e,i){return new CustomEvent("downloadedError",{detail:{url:e,error:i}})}decompressBrotli(e){const i=atob(e),a=new Uint8Array(i.length);for(let n=0;n<i.length;n++)a[n]=i.charCodeAt(n);const c=new Int8Array(a.length);for(let n=0;n<a.length;n++)c[n]=a[n]>=128?a[n]-256:a[n];return it(c).buffer}async fetchAsset(e,i,a,c,d){const n=i+a,r=e.find(h=>h.file===a).uncompressedSize,u=(h,p,S,C)=>Ue(this,le,$e).call(this,this.getBytesDownloadedEvent(h,p,S,C));try{const p=(await fetch(n)).body?.getReader();if(!p)throw new Error("Failed to get reader from response body.");let S=0;const C=new ReadableStream({async start(O){await P();async function P(){const{done:G,value:re}=await p.read();if(G){O.close(),u(S,r,n,!0);return}re&&(O.enqueue(re),S+=re.length,u(S,r,n,!1)),await P()}}}),k=new Response(C);if(c){const O=await k.json(),{base64EncodedValue:P}=O;if(d==="gzip"){await Ue(this,le,tt).call(this,P);return}return this.decompressBrotli(P)}else return await k.arrayBuffer()}catch(h){Ue(this,le,$e).call(this,this.getBytesDownloadErrorEvent(n,h))}}}le=new WeakSet,$e=function(t){this.dispatchEvent(t)},tt=async function(t){const e=Uint8Array.from(atob(t),h=>h.charCodeAt(0)),a=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")),c=await new Response(a).arrayBuffer(),d=new TextDecoder().decode(new Uint8Array(c)),n=new Blob([d],{type:"application/javascript"}),r=URL.createObjectURL(n);it=(await import(r)).BrotliDecode,this.canDecompress=!0,URL.revokeObjectURL(r)};var Xt=Object.defineProperty,zt=(t,e,i)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,st=(t,e,i)=>zt(t,typeof e!="symbol"?e+"":e,i);class qt{constructor(){st(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""}),st(this,"debugLogs",[])}appendLog(e){this.debugLogs.push(e)}transferLogs(){}generateHTMLTable(){return`
1
+ var Lt="0.1.0-beta.5";const U={RESULTS:"results",ERROR:"error",APPEVENT:"appEvent",CANCELLED:"cancelled",DESTROYED:"destroyed",LOGS:"logs"};var Ye=(t=>(t.measurement="Measurement",t.collector="Collector",t.camera="Camera",t.app="App",t))(Ye||{});const N={INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},L={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_PREPARED:"MEASUREMENT_PREPARED",ASSETS_DOWNLOADED:"ASSETS_DOWNLOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",MEASUREMENT_CANCELED:"MEASUREMENT_CANCELED",CONSTRAINT_VIOLATION:"CONSTRAINT_VIOLATION",PAGE_UNLOADED:"PAGE_UNLOADED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},Dt={CAMERA_STARTED:{event:L.CAMERA_STARTED,level:N.INFO},APP_LOADED:{event:L.APP_LOADED,level:N.INFO},MEASUREMENT_PREPARED:{event:L.MEASUREMENT_PREPARED,level:N.INFO},ASSETS_DOWNLOADED:{event:L.ASSETS_DOWNLOADED,level:N.INFO},MEASUREMENT_STARTED:{event:L.MEASUREMENT_STARTED,level:N.INFO},MEASUREMENT_COMPLETED:{event:L.MEASUREMENT_COMPLETED,level:N.INFO},CAMERA_PERMISSION_GRANTED:{event:L.CAMERA_PERMISSION_GRANTED,level:N.INFO},INTERMEDIATE_RESULTS:{event:L.INTERMEDIATE_RESULTS,level:N.INFO},RESULTS_RECEIVED:{event:L.RESULTS_RECEIVED,level:N.INFO},MEASUREMENT_CANCELED:{event:L.MEASUREMENT_CANCELED,level:N.WARN},CONSTRAINT_VIOLATION:{event:L.CONSTRAINT_VIOLATION,level:N.ERROR},PAGE_UNLOADED:{event:L.PAGE_UNLOADED,level:N.INFO},PAGE_VISIBILITY_CHANGE:{event:L.PAGE_VISIBILITY_CHANGE,level:N.INFO}},ne={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage",GET_LOGS:"getLogs"};var Je=(t=>(t.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",t.WORKER_ERROR="WORKER_ERROR",t.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",t.NO_DEVICES_FOUND="NO_DEVICES_FOUND",t.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",t.CAMERA_START_FAILED="CAMERA_START_FAILED",t.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",t.COLLECTOR="COLLECTOR",t.WEBSOCKET_DISCONNECTED="WEBSOCKET_DISCONNECTED",t.MEASUREMENT_PREPARE_FAILED="MEASUREMENT_PREPARE_FAILED",t))(Je||{}),Xe="0.1.0-beta.2",J=(t=>(t.DELETE="DELETE",t.GET="GET",t.PATCH="PATCH",t.POST="POST",t.PUT="PUT",t.CONNECT="CONNECT",t))(J||{}),H=(t=>(t.ON_BEFORE_REST_CALL_ERROR="ON_BEFORE_REST_CALL_ERROR",t))(H||{});const ze=typeof DedicatedWorkerGlobalScope<"u",_e=async({baseUrl:t,urlFragment:e,method:i,headers:a,data:c},d)=>{const n=`${t}/${e}`;let r={Code:"",Message:""};try{const u=await fetch(n,{method:i,cache:"no-store",credentials:"include",headers:a,...c!=null&&{body:JSON.stringify(c)}}),h=u.headers.get("content-type"),p=u.status.toString();r={Code:"UNSUPPORTED_RESPONSE_CONTENT_TYPE",Message:"UNSUPPORTED_RESPONSE_CONTENT_TYPE"},p==="503"&&(r={Code:"SERVICE_UNAVAILABLE",Message:"Service unavailable"}),p==="429"&&(r={Code:"TOO_MANY_REQUESTS",Message:"Too many requests"}),h!=null&&(h.startsWith("application/json;")&&(r=await u.json()),h.startsWith("text/plain;")&&(r={data:await u.text()}));let S=u.headers;if(ze){const C={};u.headers.forEach((k,O)=>{C[O]=k}),S=C}try{d(p,p==="200"?void 0:r)}catch(C){console.error("Error running onAfterRESTCall callback",C)}return{status:p,headers:S,body:r}}catch(u){return u instanceof SyntaxError?r={Code:"SYNTAX_ERROR",Message:"SYNTAX_ERROR"}:r={Code:"UNEXPECTED_ERROR",Message:"UNEXPECTED_ERROR"},{status:"UNKNOWN",headers:ze?{}:new Headers,body:r}}},ge=()=>new Headers({"Content-Type":"application/json"});var It=Object.defineProperty,xt=(t,e,i)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ft=(t,e,i)=>xt(t,e+"",i);class Me{constructor(e){Ft(this,"parent"),this.parent=e}async onBeforeRESTCall(){try{return this.parent.onBeforeRESTCall(),{Code:"SUCCESS",Message:"SUCCESS"}}catch{return{Code:H.ON_BEFORE_REST_CALL_ERROR,Message:H.ON_BEFORE_REST_CALL_ERROR}}}getDefaults(e){return{baseUrl:JSON.parse(this.parent.getUrl()).http.slice(0,-1),method:J[e],headers:ge()}}getHeaderWithDeviceToken(){const e=ge();return e.set("Authorization",`Bearer ${this.parent.getSession().deviceToken}`),e}getHeaderWithUserToken(){const e=ge();return e.set("Authorization",`Bearer ${this.parent.getSession().userToken}`),e}getHeaderWithSessionEnabled(){const e=ge();return e.set("x-nura-session","true"),e}}class Mt extends Me{async create(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"measurements",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({lastMeasurementId:n.ID}),{status:d,body:n,headers:r}}}class Pt extends Me{async retrieveSdkConfigData(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"studies/sdkconfig",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({studyCfgData:n.ConfigFile,studyCfgHash:n.MD5Hash}),{status:d,body:n,headers:r}}}class Wt extends Me{async renew(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auths/renew",data:e},this.parent.onAfterRESTCall);if(d==="200"){const u=n.Token,h=n.RefreshToken,p={...i==="user"&&{userToken:u,userRefreshToken:h},...i==="device"&&{deviceToken:u,deviceRefreshToken:h}};this.parent.setSession(p)}return{status:d,body:n,headers:r}}async validate(e){const{Code:i,Message:a}=await this.onBeforeRESTCall();return i===H.ON_BEFORE_REST_CALL_ERROR?{status:i,body:{Code:i,Message:a},headers:new Headers}:await _e({...this.getDefaults(J.GET),headers:e==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auth/v1/validate"},this.parent.onAfterRESTCall)}}var Ut=Object.defineProperty,qe=t=>{throw TypeError(t)},$t=(t,e,i)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pe=(t,e,i)=>$t(t,typeof e!="symbol"?e+"":e,i),Ze=(t,e,i)=>e.has(t)||qe("Cannot "+i),We=(t,e,i)=>(Ze(t,e,"read from private field"),i?i.call(t):e.get(t)),Qe=(t,e,i)=>e.has(t)?qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),we=(t,e,i,a)=>(Ze(t,e,"write to private field"),e.set(t,i),i),oe,X;class Bt{constructor(e){Qe(this,oe,{http:new URL("https://api.deepaffex.ai")}),Qe(this,X),Pe(this,"onBeforeRESTCall"),Pe(this,"onAfterRESTCall"),Pe(this,"http"),we(this,X,{deviceToken:"",deviceRefreshToken:"",userToken:"",userRefreshToken:"",deviceId:"",roleId:"",userId:"",selectedStudy:"",lastMeasurementId:"",studyCfgHash:"",studyCfgData:""}),this.http={measurements:new Mt(this),studies:new Pt(this),auths:new Wt(this)},this.onBeforeRESTCall=e?.onBeforeRESTCall?e.onBeforeRESTCall:()=>{},this.onAfterRESTCall=e?.onAfterRESTCall?e.onAfterRESTCall:()=>{},e?.url!=null&&we(this,oe,e.url)}static new(e){return new this(e??void 0)}getUrl(){return JSON.stringify(We(this,oe))}setUrl(e){we(this,oe,{http:new URL(e)})}getSession(){return We(this,X)}setSession(e){const i=["deviceToken","deviceRefreshToken","userToken","userRefreshToken","deviceId","userId","roleId","selectedStudy","lastMeasurementId","studyCfgHash","studyCfgData"];Object.keys(e).every(d=>i.includes(d)&&typeof e[d]=="string")&&we(this,X,{...We(this,X),...e})}}oe=new WeakMap,X=new WeakMap;const Gt=t=>Bt.new(t);var Ht=Object.defineProperty,et=t=>{throw TypeError(t)},Vt=(t,e,i)=>e in t?Ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Kt=(t,e,i)=>Vt(t,e+"",i),jt=(t,e,i)=>e.has(t)||et("Cannot "+i),Yt=(t,e,i)=>e.has(t)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),Ue=(t,e,i)=>(jt(t,e,"access private method"),i),le,$e,tt;let it=t=>new Int8Array(t);class Jt extends EventTarget{constructor(){super(...arguments),Yt(this,le),Kt(this,"canDecompress",!1)}static init(){return new this}dispatch(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i}))}getBytesDownloadedEvent(e,i,a,c){return new CustomEvent("bytesDownloaded",{detail:{bytes:e,uncompressedSize:i,url:a,done:c}})}getBytesDownloadErrorEvent(e,i){return new CustomEvent("downloadedError",{detail:{url:e,error:i}})}decompressBrotli(e){const i=atob(e),a=new Uint8Array(i.length);for(let n=0;n<i.length;n++)a[n]=i.charCodeAt(n);const c=new Int8Array(a.length);for(let n=0;n<a.length;n++)c[n]=a[n]>=128?a[n]-256:a[n];return it(c).buffer}async fetchAsset(e,i,a,c,d){const n=i+a,r=e.find(h=>h.file===a).uncompressedSize,u=(h,p,S,C)=>Ue(this,le,$e).call(this,this.getBytesDownloadedEvent(h,p,S,C));try{const p=(await fetch(n)).body?.getReader();if(!p)throw new Error("Failed to get reader from response body.");let S=0;const C=new ReadableStream({async start(O){await P();async function P(){const{done:G,value:re}=await p.read();if(G){O.close(),u(S,r,n,!0);return}re&&(O.enqueue(re),S+=re.length,u(S,r,n,!1)),await P()}}}),k=new Response(C);if(c){const O=await k.json(),{base64EncodedValue:P}=O;if(d==="gzip"){await Ue(this,le,tt).call(this,P);return}return this.decompressBrotli(P)}else return await k.arrayBuffer()}catch(h){Ue(this,le,$e).call(this,this.getBytesDownloadErrorEvent(n,h))}}}le=new WeakSet,$e=function(t){this.dispatchEvent(t)},tt=async function(t){const e=Uint8Array.from(atob(t),h=>h.charCodeAt(0)),a=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")),c=await new Response(a).arrayBuffer(),d=new TextDecoder().decode(new Uint8Array(c)),n=new Blob([d],{type:"application/javascript"}),r=URL.createObjectURL(n);it=(await import(r)).BrotliDecode,this.canDecompress=!0,URL.revokeObjectURL(r)};var Xt=Object.defineProperty,zt=(t,e,i)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,st=(t,e,i)=>zt(t,typeof e!="symbol"?e+"":e,i);class qt{constructor(){st(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""}),st(this,"debugLogs",[])}appendLog(e){this.debugLogs.push(e)}transferLogs(){}generateHTMLTable(){return`
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralogix.ai/web-measurement-embedded-app",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "Web Measurement Embedded App",
5
5
  "homepage": "https://docs.deepaffex.ai/wmea/",
6
6
  "contributors": [