@nuralogix.ai/web-measurement-embedded-app 0.1.0-alpha.1 → 0.1.0-alpha.2

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/lib/index.mjs CHANGED
@@ -1 +1 @@
1
- const h={RESULTS:"results",ERROR:"error",WEBHOOK:"webhook",CANCEL:"cancel"},O={DESTROY:"destroy",SET_THEME:"setTheme"};var R=s=>{throw TypeError(s)},_=(s,e,n)=>e.has(s)||R("Cannot "+n),t=(s,e,n)=>(_(s,e,"read from private field"),n?n.call(s):e.get(s)),m=(s,e,n)=>e.has(s)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,n),M=(s,e,n,l)=>(_(s,e,"write to private field"),e.set(s,n),n),i,d,c,a;const A=class o{constructor(e){m(this,a),M(this,a,new Int32Array(e))}lock(){for(;;){if(Atomics.compareExchange(t(this,a),t(o,c),t(o,d),t(o,i))==t(o,d))return;Atomics.wait(t(this,a),t(o,c),t(o,i))}}unlock(){if(Atomics.compareExchange(t(this,a),t(o,c),t(o,i),t(o,d))!=t(o,i))throw new Error("Tried to unlock while not holding the mutex");Atomics.notify(t(this,a),t(o,c))}AsyncLock(e){const n=this;async function l(){for(;;){if(Atomics.compareExchange(t(n,a),t(o,c),t(o,d),t(o,i))==t(o,d)){e(),n.unlock();return}await Atomics.waitAsync(t(n,a),t(o,c),t(o,i)).value}}l()}};i=new WeakMap,d=new WeakMap,c=new WeakMap,a=new WeakMap,m(A,i,1),m(A,d,0),m(A,c,0);const I={SEX_NOT_PROVIDED:1,SEX_ASSIGNED_MALE_AT_BIRTH:2,SEX_ASSIGNED_FEMALE_AT_BIRTH:3,DIABETES_NONE:4,DIABETES_TYPE1:5,DIABETES_TYPE2:6,SMOKER_TRUE:0,SMOKER_FALSE:1,BLOOD_PRESSURE_MEDICATION_TRUE:1,BLOOD_PRESSURE_MEDICATION_FALSE:0},$=document.documentElement.style.overflow;class N{#e=document.createElement("div");#t=document.createElement("div");on={results:null,error:null,webhook:null,cancel:null};constructor(){this.#e.style.height="100%"}init(e){const{container:n,appPath:l,settings:S,profile:T,loadError:u,top:y=0}=e;this.#t=n,Object.assign(n.style,{position:"fixed",top:y,left:"0",width:"100vw",height:`calc(100vh - ${y})`}),document.body.appendChild(n);const p=n.attachShadow({mode:"open"});document.documentElement.style.overflow="hidden";const f="app",v=document.createElement("link");v.rel="stylesheet",v.href=`${l}/stylex.css`,p.appendChild(v);const w=document.createElement("link");w.rel="stylesheet",w.href=`${l}/${f}.css`,p.appendChild(w);const k=r=>{this.on.results&&this.on.results({...r.detail})},C=r=>{this.on.error&&this.on.error({...r.detail})},L=r=>{this.on.webhook&&this.on.webhook({...r.detail})},D=()=>{this.on.cancel&&this.on.cancel()};this.#e.addEventListener(h.RESULTS,k),this.#e.addEventListener(h.ERROR,C),this.#e.addEventListener(h.WEBHOOK,L),this.#e.addEventListener(h.CANCEL,D),p.appendChild(this.#e);const E=document.createElement("script");E.type="module",E.src=`${l}/${f}.mjs`,E.onload=()=>{import(E.src).then(r=>{r.app.init(this.#e,S,T)}).catch(()=>{u&&u("Failed to initialize Measurement Embedded React app")})},E.onerror=()=>{u&&u("Failed to load the measurement embedded app script")},p.appendChild(E)}destroy(){const e=new CustomEvent("measurement-embedded-app-action",{detail:{action:O.DESTROY,data:{}}});this.#e.dispatchEvent(e),document.documentElement.style.overflow=$,this.#t&&document.body.contains(this.#t)&&document.body.removeChild(this.#t)}setTheme(e){const n=new CustomEvent("measurement-embedded-app-action",{detail:{action:O.SET_THEME,data:{theme:e}}});this.#e.dispatchEvent(n)}}export{N as default,I as faceAttributeValue,h as measurementEmbeddedAppEvents};
1
+ const h={RESULTS:"results",ERROR:"error",WEBHOOK:"webhook",CANCEL:"cancel"},O={DESTROY:"destroy",SET_THEME:"setTheme"};var R=s=>{throw TypeError(s)},_=(s,e,n)=>e.has(s)||R("Cannot "+n),t=(s,e,n)=>(_(s,e,"read from private field"),n?n.call(s):e.get(s)),m=(s,e,n)=>e.has(s)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,n),M=(s,e,n,r)=>(_(s,e,"write to private field"),e.set(s,n),n),i,l,c,a;const A=class o{constructor(e){m(this,a),M(this,a,new Int32Array(e))}lock(){for(;;){if(Atomics.compareExchange(t(this,a),t(o,c),t(o,l),t(o,i))==t(o,l))return;Atomics.wait(t(this,a),t(o,c),t(o,i))}}unlock(){if(Atomics.compareExchange(t(this,a),t(o,c),t(o,i),t(o,l))!=t(o,i))throw new Error("Tried to unlock while not holding the mutex");Atomics.notify(t(this,a),t(o,c))}AsyncLock(e){const n=this;async function r(){for(;;){if(Atomics.compareExchange(t(n,a),t(o,c),t(o,l),t(o,i))==t(o,l)){e(),n.unlock();return}await Atomics.waitAsync(t(n,a),t(o,c),t(o,i)).value}}r()}};i=new WeakMap,l=new WeakMap,c=new WeakMap,a=new WeakMap,m(A,i,1),m(A,l,0),m(A,c,0);const I={SEX_NOT_PROVIDED:1,SEX_ASSIGNED_MALE_AT_BIRTH:2,SEX_ASSIGNED_FEMALE_AT_BIRTH:3,DIABETES_NONE:4,DIABETES_TYPE1:5,DIABETES_TYPE2:6,SMOKER_TRUE:0,SMOKER_FALSE:1,BLOOD_PRESSURE_MEDICATION_TRUE:1,BLOOD_PRESSURE_MEDICATION_FALSE:0},$=document.documentElement.style.overflow;class N{#e=document.createElement("div");#t=document.createElement("div");on={results:null,error:null,webhook:null,cancel:null};constructor(){this.#e.style.height="100%"}init(e){const{container:n,appPath:r,settings:S,profile:T,loadError:u,top:y=0}=e;this.#t=n,Object.assign(n.style,{position:"fixed",top:y,left:"0",width:"100vw",height:`calc(100vh - ${y})`}),document.body.appendChild(n);const p=n.attachShadow({mode:"open"});document.documentElement.style.overflow="hidden";const f="app",v=document.createElement("link");v.rel="stylesheet",v.href=`${r}/stylex.css`,p.appendChild(v);const w=document.createElement("link");w.rel="stylesheet",w.href=`${r}/${f}.css`,p.appendChild(w);const k=d=>{this.on.results&&this.on.results({...d.detail})},C=d=>{this.on.error&&this.on.error({...d.detail})},L=d=>{this.on.webhook&&this.on.webhook({...d.detail})},D=()=>{this.on.cancel&&this.on.cancel()};this.#e.addEventListener(h.RESULTS,k),this.#e.addEventListener(h.ERROR,C),this.#e.addEventListener(h.WEBHOOK,L),this.#e.addEventListener(h.CANCEL,D),p.appendChild(this.#e);const E=document.createElement("script");E.type="module",E.src=`${r}/${f}.mjs`,E.onload=()=>{import(E.src).then(d=>{d.app.init(this.#e,r,S,T)}).catch(()=>{u&&u("Failed to initialize Measurement Embedded React app")})},E.onerror=()=>{u&&u("Failed to load the measurement embedded app script")},p.appendChild(E)}destroy(){const e=new CustomEvent("measurement-embedded-app-action",{detail:{action:O.DESTROY,data:{}}});this.#e.dispatchEvent(e),document.documentElement.style.overflow=$,this.#t&&document.body.contains(this.#t)&&document.body.removeChild(this.#t)}setTheme(e){const n=new CustomEvent("measurement-embedded-app-action",{detail:{action:O.SET_THEME,data:{theme:e}}});this.#e.dispatchEvent(n)}}export{N as default,I as faceAttributeValue,h as measurementEmbeddedAppEvents};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralogix.ai/web-measurement-embedded-app",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Web Measurement Embedded App",
5
5
  "contributors": [
6
6
  "Hamed Hassanzadeh Amin",