@busha/ramp-web-sdk 0.1.11 → 0.1.12
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/helper.d.ts +3 -3
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/helper.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export declare function createContainerEl(): HTMLDivElement;
|
|
|
5
5
|
export declare function createCloseBtnEl(): HTMLButtonElement;
|
|
6
6
|
export declare function createSpinnerEl(): HTMLDivElement;
|
|
7
7
|
export declare function createIframeEl(): HTMLIFrameElement;
|
|
8
|
-
type FormPayload = Omit<QuotePayload, "onClose" | "onSuccess" | "
|
|
9
|
-
export declare function createFormEl({
|
|
10
|
-
|
|
8
|
+
type FormPayload = Omit<QuotePayload, "onClose" | "onSuccess" | "sandboxMode">;
|
|
9
|
+
export declare function createFormEl({ sandboxMode, ...payload }: FormPayload & {
|
|
10
|
+
sandboxMode?: boolean;
|
|
11
11
|
}): HTMLFormElement;
|
|
12
12
|
export {};
|
package/dist/index.es.js
CHANGED
|
@@ -1580,7 +1580,7 @@ function vt() {
|
|
|
1580
1580
|
const r = document.createElement("iframe");
|
|
1581
1581
|
return r.dataset.testid = L, r.name = L, r.id = L, r.allow = `clipboard-write self ${re}`, r;
|
|
1582
1582
|
}
|
|
1583
|
-
function _t({
|
|
1583
|
+
function _t({ sandboxMode: r, ...e }) {
|
|
1584
1584
|
const t = r ?? !1, n = t ? ge : re, s = t ? Ee : xe, a = e.side === "buy" ? n : s, i = document.createElement("form");
|
|
1585
1585
|
i.target = L, i.dataset.testid = De, i.action = a ?? "", i.method = "GET", i.style.display = "none", ((f) => {
|
|
1586
1586
|
const h = process.env.NODE_ENV === "production", p = ["onSuccess", "onClose"];
|
package/dist/index.umd.js
CHANGED
|
@@ -32,4 +32,4 @@ attempted value: ${i}
|
|
|
32
32
|
border-radius: 24px;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
`}function mt(r){Se({fiatAmount:j().optional(),fiatCurrency:j().optional(),cryptoAmount:j().optional(),cryptoCurrency:j().optional(),publicKey:j().optional(),redirectUrl:j().optional(),side:j().oneOf(["buy","sell"]).required()}).validateSync(r,{abortEarly:!1})}function yt(){const r=document.createElement("div");return r.id=w,r.dataset.testid=w,r.style.position="fixed",r.style.top="0px",r.style.left="0px",r.style.width="100%",r.style.height="100%",r.style.zIndex="999999999",r.style.backgroundColor="rgba(0, 0, 0, 0.4)",r}function bt(){const r=document.createElement("button");return r.id=W,r.dataset.testid=W,r.setAttribute("type","button"),r.style.width="40px",r.style.height="40px",r.style.position="absolute",r.style.right="0",r.style.zIndex="40",r.style.backgroundColor="transparent",r.style.border="none",r.innerHTML=ht,r}function xt(){const r=document.createElement("div");return r.id=k,r.dataset.testid=k,r.style.width="40px",r.style.height="40px",r.style.backgroundColor="transparent",r.style.border=`2px solid ${dt}`,r.style.borderLeftColor="transparent",r.style.borderBottomColor="transparent",r.style.borderRadius="100%",r.animate&&r.animate([{transform:"rotate(0)"},{transform:"rotate(360deg)"}],{duration:300,iterations:1/0}),r}function gt(){const r=document.createElement("iframe");return r.dataset.testid=q,r.name=q,r.id=q,r.allow=`clipboard-write self ${Q}`,r}function Et({
|
|
35
|
+
`}function mt(r){Se({fiatAmount:j().optional(),fiatCurrency:j().optional(),cryptoAmount:j().optional(),cryptoCurrency:j().optional(),publicKey:j().optional(),redirectUrl:j().optional(),side:j().oneOf(["buy","sell"]).required()}).validateSync(r,{abortEarly:!1})}function yt(){const r=document.createElement("div");return r.id=w,r.dataset.testid=w,r.style.position="fixed",r.style.top="0px",r.style.left="0px",r.style.width="100%",r.style.height="100%",r.style.zIndex="999999999",r.style.backgroundColor="rgba(0, 0, 0, 0.4)",r}function bt(){const r=document.createElement("button");return r.id=W,r.dataset.testid=W,r.setAttribute("type","button"),r.style.width="40px",r.style.height="40px",r.style.position="absolute",r.style.right="0",r.style.zIndex="40",r.style.backgroundColor="transparent",r.style.border="none",r.innerHTML=ht,r}function xt(){const r=document.createElement("div");return r.id=k,r.dataset.testid=k,r.style.width="40px",r.style.height="40px",r.style.backgroundColor="transparent",r.style.border=`2px solid ${dt}`,r.style.borderLeftColor="transparent",r.style.borderBottomColor="transparent",r.style.borderRadius="100%",r.animate&&r.animate([{transform:"rotate(0)"},{transform:"rotate(360deg)"}],{duration:300,iterations:1/0}),r}function gt(){const r=document.createElement("iframe");return r.dataset.testid=q,r.name=q,r.id=q,r.allow=`clipboard-write self ${Q}`,r}function Et({sandboxMode:r,...e}){const t=r??!1,n=t?oe:Q,s=t?le:ue,a=e.side==="buy"?n:s,i=document.createElement("form");i.target=q,i.dataset.testid=Ce,i.action=a??"",i.method="GET",i.style.display="none",(f=>{const h=process.env.NODE_ENV==="production",p=["onSuccess","onClose"];h&&p.push("side");for(const y in f){if(!Object.prototype.hasOwnProperty.call(f,y)||p.includes(y))continue;const b=f[y],E=document.createElement("input");E.name=y,E.value=String(b),i.appendChild(E)}})(e);const o="POPUP",d=document.createElement("input");d.name="displayMode",d.value=o;const l=document.createElement("input");return l.name="parentOrigin",l.value=window.location.origin,i.appendChild(d),i.appendChild(l),i}class wt{constructor(e){Z(this,"payload");Z(this,"container",null);Z(this,"boundClose");Z(this,"onMessage",e=>{const t=process.env.NODE_ENV==="test",n=this.payload.sandboxMode??!1,s=n?oe:Q,a=n?le:ue,i=this.payload.side==="buy"?s:a;if(t){if(e.source!==window)return}else{if(!i)return;const u=new URL(i);if(e.origin!==u.origin)return}if(this.payload){if(e.data.status===De){const u=document.getElementById(k);u&&u.remove()}e.data.status===ce&&(this.payload.onClose&&this.payload.onClose(e.data),this.cleanup()),e.data.status===Ae&&(this.payload.onSuccess&&this.payload.onSuccess(e.data),this.cleanup())}});pt(),mt(e),this.payload=e,this.boundClose=this.close.bind(this)}show(){this.container=yt();const e=xt(),t=bt();t.addEventListener("click",this.boundClose),this.container.appendChild(e),this.container.appendChild(t);const n=gt();this.container.appendChild(n),document.body.appendChild(this.container);const s=Et(this.payload);this.container.appendChild(s),s.submit(),window.addEventListener("message",this.onMessage)}close(){this.payload.onClose&&this.payload.onClose({status:ce,data:{reference:""}}),this.cleanup()}cleanup(){const e=document.getElementById(w),t=document.getElementById(W);t&&t.removeEventListener("click",this.boundClose),window.removeEventListener("message",this.onMessage),e&&document.body.removeChild(e)}}$.BushaRampWidget=wt,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED