@transak/transak-sdk
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -1,2 +0,2 @@ | ||
import u from"events";var E=(t=>(t.DEVELOPMENT="DEVELOPMENT",t.STAGING="STAGING",t.PRODUCTION="PRODUCTION",t))(E||{});var s=(a=>(a.TRANSAK_WIDGET_INITIALISED="TRANSAK_WIDGET_INITIALISED",a.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",a.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",a.TRANSAK_ORDER_CANCELLED="TRANSAK_ORDER_CANCELLED",a.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED",a.TRANSAK_WALLET_REDIRECTION="TRANSAK_WALLET_REDIRECTION",a.TRANSAK_WIDGET_CLOSE_REQUEST="TRANSAK_WIDGET_CLOSE_REQUEST",a.TRANSAK_WIDGET_CLOSE="TRANSAK_WIDGET_CLOSE",a.TRANSAK_USER_INFO_RECEIVED="TRANSAK_USER_INFO_RECEIVED",a.TRANSAK_GET_USER_REQUEST="TRANSAK_GET_USER_REQUEST",a.TRANSAK_LOGOUT_USER_REQUEST="TRANSAK_LOGOUT_USER_REQUEST",a))(s||{});import h from"query-string";import C from"pako";var T={DEVELOPMENT:"https://localhost:5005/",STAGING:"https://global-stg.transak.com",PRODUCTION:"https://global.transak.com"};function m(e){let{environment:n="STAGING"}=e,r={},t="";return Object.keys(e).forEach(o=>{if(!["environment","widgetWidth","widgetHeight"].includes(o)){if(["walletAddressesData","userData"].includes(o)){try{r[o]=JSON.stringify(e[o])}catch{}return}if(["nftData","sourceTokenData","cryptoCurrencyData","tokenData"].includes(o)){try{r[o]=btoa(JSON.stringify(e[o]))}catch{}return}if(["calldata"].includes(o)){try{r[o]=btoa(String.fromCharCode.apply(null,C.deflate(e[o])))}catch{}return}r[o]=e[o]}}),t=h.stringify(r,{arrayFormat:"comma"}),`${T[n]}?${t}`}function l(e){let n=document.createElement("iframe");return Object.assign(n,{id:"transakIframe",allow:"camera;microphone;payment",src:e}),n}function R(){return` | ||
import O from"events";var m=(t=>(t.DEVELOPMENT="DEVELOPMENT",t.STAGING="STAGING",t.PRODUCTION="PRODUCTION",t))(m||{});var i=(s=>(s.TRANSAK_WIDGET_INITIALISED="TRANSAK_WIDGET_INITIALISED",s.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",s.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",s.TRANSAK_ORDER_CANCELLED="TRANSAK_ORDER_CANCELLED",s.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED",s.TRANSAK_WALLET_REDIRECTION="TRANSAK_WALLET_REDIRECTION",s.TRANSAK_WIDGET_CLOSE_REQUEST="TRANSAK_WIDGET_CLOSE_REQUEST",s.TRANSAK_WIDGET_CLOSE="TRANSAK_WIDGET_CLOSE",s.TRANSAK_USER_INFO_RECEIVED="TRANSAK_USER_INFO_RECEIVED",s.TRANSAK_GET_USER_REQUEST="TRANSAK_GET_USER_REQUEST",s.TRANSAK_LOGOUT_USER_REQUEST="TRANSAK_LOGOUT_USER_REQUEST",s))(i||{});import D from"query-string";import k from"pako";var R={DEVELOPMENT:"https://localhost:5005/",STAGING:"https://global-stg.transak.com",PRODUCTION:"https://global.transak.com"};var A={name:"@transak/transak-sdk",version:"3.1.2",description:"Transak SDK that allows you to easily integrate fiat on/off ramp",type:"module",types:"lib/index.d.ts",main:"lib/index.cjs",exports:{".":{import:{types:"./lib/index.d.ts",default:"./lib/index.js"},require:{types:"./lib/index.d.cts",default:"./lib/index.cjs"}}},engines:{node:">=18.0.0"},packageManager:"pnpm@9.5.0+sha256.fc4a49bd609550a41e14d20efbce802a4b892aa4cac877322de2f0924f122991",files:["lib/**/*"],scripts:{eslint:"eslint . --ext .ts","eslint:fix":"pnpm eslint --fix",build:"tsc && tsup",prepack:"pnpm build",packDev:"pnpm pack"},author:"Transak",license:"ISC",homepage:"https://docs.transak.com/docs/web-integration#transak-sdk-reactvueangularts",repository:{type:"git",url:"https://github.com/Transak/transak-sdk"},dependencies:{events:"^3.3.0",pako:"^2.1.0","query-string":"^8.2.0"},devDependencies:{"@types/events":"^3.0.3","@types/pako":"^2.0.3",eslint:"^8.56.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-airbnb-typescript":"^17.1.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.29.1","eslint-plugin-no-relative-import-paths":"^1.5.3","eslint-plugin-prettier":"^5.1.3","eslint-plugin-promise":"^6.1.1",prettier:"^3.2.5",tsup:"^8.0.2",typescript:"^5.3.3"},keywords:["crypto","cryptocurrency","fiat","on","off","ramp","sdk","ts","js"]};function E(e){let{name:n,version:r}=A,{environment:t="STAGING"}=e,a={sdkName:n,sdkVersion:r},l="";return Object.keys(e).forEach(o=>{if(!["environment","widgetWidth","widgetHeight"].includes(o)){if(["walletAddressesData","userData"].includes(o)){try{a[o]=JSON.stringify(e[o])}catch{}return}if(["nftData","sourceTokenData","cryptoCurrencyData","tokenData"].includes(o)){try{a[o]=btoa(JSON.stringify(e[o]))}catch{}return}if(["calldata"].includes(o)){try{a[o]=btoa(String.fromCharCode.apply(null,k.deflate(e[o])))}catch{}return}a[o]=e[o]}}),l=D.stringify(a,{arrayFormat:"comma"}),`${R[t]}?${l}`}function c(e){let n=document.createElement("iframe");return Object.assign(n,{id:"transakIframe",allow:"camera;microphone;payment",src:e}),n}function f(){return` | ||
#transakIframe{ | ||
@@ -7,3 +7,3 @@ width: 100%; | ||
} | ||
`}function A(){let e=document.createElement("style");return e.innerHTML=R(),document.getElementsByTagName("head")[0]?.appendChild(e),e}function _(e){let n=A(),r=l(m(e));if(e.containerId){let t=document.getElementById(e.containerId);if(t)t.appendChild(r);else throw new Error("[Transak SDK] => Please enter a valid containerId")}return{styleElement:n,iframeElement:r}}function S(e,n){return function(t){if(t?.data?.event_id)switch(t.data.event_id){case"TRANSAK_WIDGET_INITIALISED":{e.emit("TRANSAK_WIDGET_INITIALISED",{eventName:"TRANSAK_WIDGET_INITIALISED",status:!0});break}case"TRANSAK_ORDER_CREATED":{e.emit("TRANSAK_ORDER_CREATED",{eventName:"TRANSAK_ORDER_CREATED",status:t.data.data});break}case"TRANSAK_ORDER_SUCCESSFUL":{e.emit("TRANSAK_ORDER_SUCCESSFUL",{eventName:"TRANSAK_ORDER_SUCCESSFUL",status:t.data.data});break}case"TRANSAK_ORDER_CANCELLED":{e.emit("TRANSAK_ORDER_CANCELLED",{eventName:"TRANSAK_ORDER_CANCELLED",status:t.data.data});break}case"TRANSAK_ORDER_FAILED":{e.emit("TRANSAK_ORDER_FAILED",{eventName:"TRANSAK_ORDER_FAILED",status:t.data.data});break}case"TRANSAK_WALLET_REDIRECTION":{e.emit("TRANSAK_WALLET_REDIRECTION",{eventName:"TRANSAK_WALLET_REDIRECTION",status:t.data.data});break}case"TRANSAK_WIDGET_CLOSE":{e.emit("TRANSAK_WIDGET_CLOSE",{eventName:"TRANSAK_WIDGET_CLOSE",status:!0}),n();break}case"TRANSAK_USER_INFO_RECEIVED":{e.emit("TRANSAK_USER_INFO_RECEIVED",{eventName:"TRANSAK_USER_INFO_RECEIVED",status:t.data.data});break}}}}var I=` | ||
`}function _(){let e=document.createElement("style");return e.innerHTML=f(),document.getElementsByTagName("head")[0]?.appendChild(e),e}function S(e){let n=_(),r=c(E(e));if(e.containerId){let t=document.getElementById(e.containerId);if(t)t.appendChild(r);else throw new Error("[Transak SDK] => Please enter a valid containerId")}return{styleElement:n,iframeElement:r}}function I(e,n){return function(t){if(t?.data?.event_id)switch(t.data.event_id){case"TRANSAK_WIDGET_INITIALISED":{e.emit("TRANSAK_WIDGET_INITIALISED",{eventName:"TRANSAK_WIDGET_INITIALISED",status:!0});break}case"TRANSAK_ORDER_CREATED":{e.emit("TRANSAK_ORDER_CREATED",{eventName:"TRANSAK_ORDER_CREATED",status:t.data.data});break}case"TRANSAK_ORDER_SUCCESSFUL":{e.emit("TRANSAK_ORDER_SUCCESSFUL",{eventName:"TRANSAK_ORDER_SUCCESSFUL",status:t.data.data});break}case"TRANSAK_ORDER_CANCELLED":{e.emit("TRANSAK_ORDER_CANCELLED",{eventName:"TRANSAK_ORDER_CANCELLED",status:t.data.data});break}case"TRANSAK_ORDER_FAILED":{e.emit("TRANSAK_ORDER_FAILED",{eventName:"TRANSAK_ORDER_FAILED",status:t.data.data});break}case"TRANSAK_WALLET_REDIRECTION":{e.emit("TRANSAK_WALLET_REDIRECTION",{eventName:"TRANSAK_WALLET_REDIRECTION",status:t.data.data});break}case"TRANSAK_WIDGET_CLOSE":{e.emit("TRANSAK_WIDGET_CLOSE",{eventName:"TRANSAK_WIDGET_CLOSE",status:!0}),n();break}case"TRANSAK_USER_INFO_RECEIVED":{e.emit("TRANSAK_USER_INFO_RECEIVED",{eventName:"TRANSAK_USER_INFO_RECEIVED",status:t.data.data});break}}}}var u=` | ||
<svg id="transakCloseIcon" viewBox="0 0 612 612" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> | ||
@@ -16,3 +16,3 @@ <path d="M306,0C136.992,0,0,136.992,0,306s136.992,306,306,306c168.988,0,306-137.012,306-306S475.008,0,306,0z M414.19,387.147 | ||
</svg> | ||
`;function f(e,n,r){return` | ||
`;function h(e,n,r){return` | ||
#transakRoot { | ||
@@ -77,3 +77,3 @@ z-index: 9997; | ||
} | ||
`}function p(e){let{themeColor:n="1461db",widgetWidth:r="480px",widgetHeight:t="650px"}=e,o=document.createElement("style");return o.innerHTML=f(n,r,t),document.getElementsByTagName("head")[0]?.appendChild(o),o}function N(e,n){let r=p(e),t=document.createElement("div"),o=document.createElement("div"),i=l(m(e));return Object.assign(o,{id:"transakModal",innerHTML:I}),o.appendChild(i),Object.assign(t,{id:"transakRoot",onclick:()=>n()}),t.appendChild(o),document.getElementsByTagName("body")[0].appendChild(t),document.getElementById("transakCloseIcon")?.addEventListener("click",()=>n()),{styleElement:r,rootElement:t,iframeElement:i}}var c=new u.EventEmitter,d=class{#t;#n;#a;#e;#o;#r=!1;static ENVIRONMENTS=E;static EVENTS=s;constructor(n){if(!n?.apiKey)throw new Error("[Transak SDK] => Please enter your API Key");this.#t=n,this.#o=S(c,this.close)}static on=(n,r)=>{n==="*"?Object.keys(s).forEach(t=>{c.on(s[t],r)}):s[n]&&c.on(n,r)};init=()=>{this.#r||(this.#i(),this.#r=!0)};cleanup=()=>{this.#n?.remove(),this.#s(),this.#e?.remove(),this.#r=!1};close=()=>{this.#n?.remove(),this.#a?.remove(),this.#s(),this.#e=void 0,this.#r=!1};getUser=()=>{this.#e?.contentWindow?.postMessage({event_id:"TRANSAK_GET_USER_REQUEST"},"*")};logoutUser=()=>{this.#e?.contentWindow?.postMessage({event_id:"TRANSAK_LOGOUT_USER_REQUEST"},"*")};#i=()=>{if(window.addEventListener("message",this.#o),this.#t.containerId){let{styleElement:n,iframeElement:r}=_(this.#t);this.#n=n,this.#e=r}else{let{styleElement:n,rootElement:r,iframeElement:t}=N(this.#t,this.#E);this.#n=n,this.#a=r,this.#e=t}};#E=()=>{this.#e?.contentWindow?.postMessage({event_id:"TRANSAK_WIDGET_CLOSE_REQUEST"},"*")};#s=()=>{c.removeAllListeners(),window.removeEventListener("message",this.#o)}};export{d as Transak}; | ||
`}function g(e){let{themeColor:n="1461db",widgetWidth:r="480px",widgetHeight:t="650px"}=e,a=document.createElement("style");return a.innerHTML=h(n,r,t),document.getElementsByTagName("head")[0]?.appendChild(a),a}function N(e,n){let r=g(e),t=document.createElement("div"),a=document.createElement("div"),l=c(E(e));return Object.assign(a,{id:"transakModal",innerHTML:u}),a.appendChild(l),Object.assign(t,{id:"transakRoot",onclick:()=>n()}),t.appendChild(a),document.getElementsByTagName("body")[0].appendChild(t),document.getElementById("transakCloseIcon")?.addEventListener("click",()=>n()),{styleElement:r,rootElement:t,iframeElement:l}}var d=new O.EventEmitter,p=class{#t;#n;#o;#e;#a;#r=!1;static ENVIRONMENTS=m;static EVENTS=i;constructor(n){if(!n?.apiKey)throw new Error("[Transak SDK] => Please enter your API Key");this.#t=n,this.#a=I(d,this.close)}static on=(n,r)=>{n==="*"?Object.keys(i).forEach(t=>{d.on(i[t],r)}):i[n]&&d.on(n,r)};init=()=>{this.#r||(this.#i(),this.#r=!0)};cleanup=()=>{this.#n?.remove(),this.#s(),this.#e?.remove(),this.#r=!1};close=()=>{this.#n?.remove(),this.#o?.remove(),this.#s(),this.#e=void 0,this.#r=!1};getUser=()=>{this.#e?.contentWindow?.postMessage({event_id:"TRANSAK_GET_USER_REQUEST"},"*")};logoutUser=()=>{this.#e?.contentWindow?.postMessage({event_id:"TRANSAK_LOGOUT_USER_REQUEST"},"*")};#i=()=>{if(window.addEventListener("message",this.#a),this.#t.containerId){let{styleElement:n,iframeElement:r}=S(this.#t);this.#n=n,this.#e=r}else{let{styleElement:n,rootElement:r,iframeElement:t}=N(this.#t,this.#l);this.#n=n,this.#o=r,this.#e=t}};#l=()=>{this.#e?.contentWindow?.postMessage({event_id:"TRANSAK_WIDGET_CLOSE_REQUEST"},"*")};#s=()=>{d.removeAllListeners(),window.removeEventListener("message",this.#a)}};export{p as Transak}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@transak/transak-sdk", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Transak SDK that allows you to easily integrate fiat on/off ramp", | ||
@@ -23,3 +23,3 @@ "type": "module", | ||
}, | ||
"packageManager": "pnpm@8.15.3+sha256.fc4a49bd609550a41e14d20efbce802a4b892aa4cac877322de2f0924f122991", | ||
"packageManager": "pnpm@9.5.0+sha256.fc4a49bd609550a41e14d20efbce802a4b892aa4cac877322de2f0924f122991", | ||
"files": [ | ||
@@ -26,0 +26,0 @@ "lib/**/*" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
78411
328