@soyio/soyio-widget 2.11.1 → 2.11.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/dist/index.js CHANGED
@@ -62,7 +62,7 @@ class ln {
62
62
  }
63
63
  createTooltipElement() {
64
64
  const f = document.querySelector(`.${this.tooltipClass}`);
65
- f == null || f.remove(), this.tooltipElement = document.createElement("div"), this.tooltipElement.className = this.tooltipClass, this.tooltipElement.style.cssText = `
65
+ this.tooltipElement = f || document.createElement("div"), this.tooltipElement.className = this.tooltipClass, this.tooltipElement.style.cssText = `
66
66
  position: fixed;
67
67
  z-index: 99999;
68
68
  background: white;
@@ -78,7 +78,9 @@ class ln {
78
78
  transition: opacity 0.2s ease-in-out;
79
79
  transform: translateX(-50%) translateY(-100%);
80
80
  margin-top: -8px;
81
- `, this.tooltipContent = document.createElement("div"), this.tooltipContent.style.cssText = "text-align: center;", this.tooltipElement.appendChild(this.tooltipContent), document.body.appendChild(this.tooltipElement);
81
+ `;
82
+ const h = this.tooltipElement.children[0];
83
+ this.tooltipContent = h || document.createElement("div"), this.tooltipContent.style.cssText = "text-align: left;", this.tooltipElement.appendChild(this.tooltipContent), document.body.appendChild(this.tooltipElement);
82
84
  }
83
85
  setupGlobalListeners() {
84
86
  window.addEventListener("scroll", () => this.hide(), !0), window.addEventListener("resize", () => this.hide()), window.addEventListener("orientationchange", () => this.hide());
@@ -1,4 +1,4 @@
1
- (function(I,P){typeof exports=="object"&&typeof module!="undefined"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(I=typeof globalThis!="undefined"?globalThis:I||self,P(I["soyio-widget"]={}))})(this,function(I){"use strict";var Yn=Object.defineProperty;var jt=Object.getOwnPropertySymbols,Jn=Object.getPrototypeOf,Zn=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable,Kn=Reflect.get;var Qn=(I,P,O)=>P in I?Yn(I,P,{enumerable:!0,configurable:!0,writable:!0,value:O}):I[P]=O;var kt=(I,P)=>{var O={};for(var F in I)Zn.call(I,F)&&P.indexOf(F)<0&&(O[F]=I[F]);if(I!=null&&jt)for(var F of jt(I))P.indexOf(F)<0&&Xn.call(I,F)&&(O[F]=I[F]);return O};var L=(I,P,O)=>(Qn(I,typeof P!="symbol"?P+"":P,O),O),er=(I,P,O)=>{if(!P.has(I))throw TypeError("Cannot "+O)};var Ut=(I,P,O)=>{if(P.has(I))throw TypeError("Cannot add the same private member more than once");P instanceof WeakSet?P.add(I):P.set(I,O)};var Ft=(I,P,O)=>(er(I,P,"access private method"),O),Ht=(I,P,O)=>Kn(Jn(I),O,P);var $=(I,P,O)=>new Promise((F,ce)=>{var Ne=Q=>{try{de(O.next(Q))}catch(fe){ce(fe)}},De=Q=>{try{de(O.throw(Q))}catch(fe){ce(fe)}},de=Q=>Q.done?F(Q.value):Promise.resolve(Q.value).then(Ne,De);de((O=O.apply(I,P)).next())});var Ie,_t;function P(h,p){for(var g=0;g<p.length;g++){const l=p[g];if(typeof l!="string"&&!Array.isArray(l)){for(const w in l)if(w!=="default"&&!(w in h)){const y=Object.getOwnPropertyDescriptor(l,w);y&&Object.defineProperty(h,w,y.get?y:{enumerable:!0,get:()=>l[w]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}class O{constructor(){L(this,"tooltipElement",null);L(this,"tooltipContent",null);L(this,"tooltipClass","soyio-tooltip");L(this,"hideTimeout",null);this.createTooltipElement(),this.setupGlobalListeners()}createTooltipElement(){const p=document.querySelector(`.${this.tooltipClass}`);p==null||p.remove(),this.tooltipElement=document.createElement("div"),this.tooltipElement.className=this.tooltipClass,this.tooltipElement.style.cssText=`
1
+ (function(I,P){typeof exports=="object"&&typeof module!="undefined"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(I=typeof globalThis!="undefined"?globalThis:I||self,P(I["soyio-widget"]={}))})(this,function(I){"use strict";var Yn=Object.defineProperty;var jt=Object.getOwnPropertySymbols,Jn=Object.getPrototypeOf,Zn=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable,Kn=Reflect.get;var Qn=(I,P,O)=>P in I?Yn(I,P,{enumerable:!0,configurable:!0,writable:!0,value:O}):I[P]=O;var kt=(I,P)=>{var O={};for(var F in I)Zn.call(I,F)&&P.indexOf(F)<0&&(O[F]=I[F]);if(I!=null&&jt)for(var F of jt(I))P.indexOf(F)<0&&Xn.call(I,F)&&(O[F]=I[F]);return O};var L=(I,P,O)=>(Qn(I,typeof P!="symbol"?P+"":P,O),O),er=(I,P,O)=>{if(!P.has(I))throw TypeError("Cannot "+O)};var Ut=(I,P,O)=>{if(P.has(I))throw TypeError("Cannot add the same private member more than once");P instanceof WeakSet?P.add(I):P.set(I,O)};var Ft=(I,P,O)=>(er(I,P,"access private method"),O),Ht=(I,P,O)=>Kn(Jn(I),O,P);var $=(I,P,O)=>new Promise((F,ce)=>{var Ne=Q=>{try{de(O.next(Q))}catch(fe){ce(fe)}},De=Q=>{try{de(O.throw(Q))}catch(fe){ce(fe)}},de=Q=>Q.done?F(Q.value):Promise.resolve(Q.value).then(Ne,De);de((O=O.apply(I,P)).next())});var Ie,_t;function P(h,p){for(var g=0;g<p.length;g++){const l=p[g];if(typeof l!="string"&&!Array.isArray(l)){for(const w in l)if(w!=="default"&&!(w in h)){const y=Object.getOwnPropertyDescriptor(l,w);y&&Object.defineProperty(h,w,y.get?y:{enumerable:!0,get:()=>l[w]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}class O{constructor(){L(this,"tooltipElement",null);L(this,"tooltipContent",null);L(this,"tooltipClass","soyio-tooltip");L(this,"hideTimeout",null);this.createTooltipElement(),this.setupGlobalListeners()}createTooltipElement(){const p=document.querySelector(`.${this.tooltipClass}`);this.tooltipElement=p||document.createElement("div"),this.tooltipElement.className=this.tooltipClass,this.tooltipElement.style.cssText=`
2
2
  position: fixed;
3
3
  z-index: 99999;
4
4
  background: white;
@@ -14,7 +14,7 @@
14
14
  transition: opacity 0.2s ease-in-out;
15
15
  transform: translateX(-50%) translateY(-100%);
16
16
  margin-top: -8px;
17
- `,this.tooltipContent=document.createElement("div"),this.tooltipContent.style.cssText="text-align: center;",this.tooltipElement.appendChild(this.tooltipContent),document.body.appendChild(this.tooltipElement)}setupGlobalListeners(){window.addEventListener("scroll",()=>this.hide(),!0),window.addEventListener("resize",()=>this.hide()),window.addEventListener("orientationchange",()=>this.hide())}show(p,g,l){!this.tooltipElement||!this.tooltipContent||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=p,this.tooltipElement.style.left=`${g}px`,this.tooltipElement.style.top=`${l}px`,this.tooltipElement.style.opacity="1")}hide(){this.tooltipElement&&(this.tooltipElement.style.opacity="0")}destroy(){var p;(p=this.tooltipElement)==null||p.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}const F="https://app.soyio.id",ce="https://sandbox.soyio.id",Ne="https://privacy.soyio.id",De="https://privacy-sandbox.soyio.id",de=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],Q="WIDGET_CLOSED",fe=420,qt=720,Bt=500,Gt={minWidth:"375px",maxWidth:"50rem"},$t={minWidth:"375px",maxWidth:"36rem"},Vt={minWidth:"375px",maxWidth:"50rem"};function Yt(h,p,g){return $(this,null,function*(){if(!h.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const l=yield Promise.resolve().then(()=>ke);try{yield l.send(h.contentWindow,"SET_APPEARANCE",{appearance:p,identifier:g})}catch(w){console.error("Failed to send appearance config:",w)}})}const Jt="IFRAME_READY",Zt="IFRAME_HEIGHT_CHANGE",Xt="TOOLTIP_STATE_CHANGE",Kt="INFO_EVENT",Qt="CONSENT_STATE_CHANGE",U={onHeightChange:{},onIframeReady:{},onTooltipChange:{},onInfo:{},onStateChange:{}};let Ze,Xe,Ke,Qe,et;function en(){return $(this,null,function*(){const h=yield Promise.resolve().then(()=>ke);Ze||Xe||Ke||Qe||et||(Ze=h.on(Zt,p=>$(this,null,function*(){const g=p.data,l=U.onHeightChange[g.identifier];l&&l(g.height)})),Xe=h.on(Jt,p=>$(this,null,function*(){const g=p.data,l=U.onIframeReady[g.identifier];l&&l()})),Ke=h.on(Xt,p=>$(this,null,function*(){const g=p.data,l=U.onTooltipChange[g.identifier];l&&l(g)})),Qe=h.on(Qt,p=>$(this,null,function*(){const g=p.data,l=U.onStateChange[g.identifier];l&&l(g)})),et=h.on(Kt,g=>$(this,[g],function*({data:p}){const E=p,{identifier:l}=E,w=kt(E,["identifier"]),y=U.onInfo[l];y&&y(w)})))})}function tt(h,p){const{onHeightChange:g,onIframeReady:l,onTooltipChange:w,onStateChange:y,onInfo:E}=p;g&&(U.onHeightChange[h]=g),l&&(U.onIframeReady[h]=l),w&&(U.onTooltipChange[h]=w),y&&(U.onStateChange[h]=y),E&&(U.onInfo[h]=E)}function tn(h){delete U.onHeightChange[h],delete U.onIframeReady[h],delete U.onTooltipChange[h],delete U.onStateChange[h],delete U.onInfo[h]}function nn(h){const p=document.getElementById(h);p&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),p.remove())}function rn(h){const p=document.querySelector(h);if(!p)throw new Error(`Iframe div container with id '${h}' not found`);if(p.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${h}' must be a <div> element`);const g=p;return g.style.position="relative",g.style.cssText+=`
17
+ `;const g=this.tooltipElement.children[0];this.tooltipContent=g||document.createElement("div"),this.tooltipContent.style.cssText="text-align: left;",this.tooltipElement.appendChild(this.tooltipContent),document.body.appendChild(this.tooltipElement)}setupGlobalListeners(){window.addEventListener("scroll",()=>this.hide(),!0),window.addEventListener("resize",()=>this.hide()),window.addEventListener("orientationchange",()=>this.hide())}show(p,g,l){!this.tooltipElement||!this.tooltipContent||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=p,this.tooltipElement.style.left=`${g}px`,this.tooltipElement.style.top=`${l}px`,this.tooltipElement.style.opacity="1")}hide(){this.tooltipElement&&(this.tooltipElement.style.opacity="0")}destroy(){var p;(p=this.tooltipElement)==null||p.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}const F="https://app.soyio.id",ce="https://sandbox.soyio.id",Ne="https://privacy.soyio.id",De="https://privacy-sandbox.soyio.id",de=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],Q="WIDGET_CLOSED",fe=420,qt=720,Bt=500,Gt={minWidth:"375px",maxWidth:"50rem"},$t={minWidth:"375px",maxWidth:"36rem"},Vt={minWidth:"375px",maxWidth:"50rem"};function Yt(h,p,g){return $(this,null,function*(){if(!h.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const l=yield Promise.resolve().then(()=>ke);try{yield l.send(h.contentWindow,"SET_APPEARANCE",{appearance:p,identifier:g})}catch(w){console.error("Failed to send appearance config:",w)}})}const Jt="IFRAME_READY",Zt="IFRAME_HEIGHT_CHANGE",Xt="TOOLTIP_STATE_CHANGE",Kt="INFO_EVENT",Qt="CONSENT_STATE_CHANGE",U={onHeightChange:{},onIframeReady:{},onTooltipChange:{},onInfo:{},onStateChange:{}};let Ze,Xe,Ke,Qe,et;function en(){return $(this,null,function*(){const h=yield Promise.resolve().then(()=>ke);Ze||Xe||Ke||Qe||et||(Ze=h.on(Zt,p=>$(this,null,function*(){const g=p.data,l=U.onHeightChange[g.identifier];l&&l(g.height)})),Xe=h.on(Jt,p=>$(this,null,function*(){const g=p.data,l=U.onIframeReady[g.identifier];l&&l()})),Ke=h.on(Xt,p=>$(this,null,function*(){const g=p.data,l=U.onTooltipChange[g.identifier];l&&l(g)})),Qe=h.on(Qt,p=>$(this,null,function*(){const g=p.data,l=U.onStateChange[g.identifier];l&&l(g)})),et=h.on(Kt,g=>$(this,[g],function*({data:p}){const E=p,{identifier:l}=E,w=kt(E,["identifier"]),y=U.onInfo[l];y&&y(w)})))})}function tt(h,p){const{onHeightChange:g,onIframeReady:l,onTooltipChange:w,onStateChange:y,onInfo:E}=p;g&&(U.onHeightChange[h]=g),l&&(U.onIframeReady[h]=l),w&&(U.onTooltipChange[h]=w),y&&(U.onStateChange[h]=y),E&&(U.onInfo[h]=E)}function tn(h){delete U.onHeightChange[h],delete U.onIframeReady[h],delete U.onTooltipChange[h],delete U.onStateChange[h],delete U.onInfo[h]}function nn(h){const p=document.getElementById(h);p&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),p.remove())}function rn(h){const p=document.querySelector(h);if(!p)throw new Error(`Iframe div container with id '${h}' not found`);if(p.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${h}' must be a <div> element`);const g=p;return g.style.position="relative",g.style.cssText+=`
18
18
  padding: 0 !important;
19
19
  margin: 0 !important;
20
20
  display: flex !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soyio/soyio-widget",
3
- "version": "2.11.1",
3
+ "version": "2.11.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",