heraldex-onramp-sdk 2.0.0 → 3.0.0
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/Readme.md +55 -38
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/Readme.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Herald Exchange Onramp SDK Widget
|
|
2
2
|
|
|
3
|
-
Herald Exchange Onramp SDK
|
|
3
|
+
Herald Exchange Onramp SDK is a simple component for React applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
You can install Herald Exchange Onramp SDK
|
|
7
|
+
You can install Herald Exchange Onramp SDK via npm:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install
|
|
10
|
+
npm install heraldex-onramp-sdk
|
|
11
11
|
# or
|
|
12
|
-
yarn add
|
|
12
|
+
yarn add heraldex-onramp-sdk
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
@@ -17,20 +17,21 @@ yarn add herald-exchange-onramp-widget
|
|
|
17
17
|
To use widget in your React application, follow these steps:
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
|
-
import { BuyCryptoWidget } from "
|
|
20
|
+
import { BuyCryptoWidget } from "heraldex-onramp-sdk";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Initialize the widget:
|
|
24
24
|
|
|
25
|
-
> To Generate API Key Please Visit : [Herald Exchange](https://app.herald.exchange/
|
|
25
|
+
> To Generate API Key Please Visit : [Herald Exchange](https://app.herald.exchange/signin).
|
|
26
26
|
> Supported Token Types : ["USDT", "USDC", "ETH", "BNB", "MATIC", "SOL", "TRX"]
|
|
27
27
|
|
|
28
28
|
```tsx
|
|
29
29
|
<BuyCryptoWidget
|
|
30
|
-
clientReferenceID={
|
|
30
|
+
clientReferenceID={YOUR_SALT_KEY}
|
|
31
31
|
apiKey={YOUR_API_KEY}
|
|
32
32
|
redirectUrl={REDIRECT_URL}
|
|
33
33
|
buyParameters={{ from_amount: "25", token_type: "TRX" }}
|
|
34
|
+
callback={(data) => alert(JSON.stringify(data))}
|
|
34
35
|
/>
|
|
35
36
|
```
|
|
36
37
|
|
|
@@ -53,23 +54,7 @@ Initialize the widget:
|
|
|
53
54
|
|
|
54
55
|
- This key is used to authenticate and authorize the widget.
|
|
55
56
|
|
|
56
|
-
- Example: `
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
### `mode` (optional)
|
|
61
|
-
|
|
62
|
-
- Type: string
|
|
63
|
-
|
|
64
|
-
- Allowed Values: "development" | "production"
|
|
65
|
-
|
|
66
|
-
- Default: "development"
|
|
67
|
-
|
|
68
|
-
- Description: Specifies the environment in which the widget runs.
|
|
69
|
-
|
|
70
|
-
- "development" is used for testing and debugging purposes.
|
|
71
|
-
|
|
72
|
-
- "production" should be used in live environments for optimized performance.
|
|
57
|
+
- Example: `4bb06e2fdbfb8e392a0ab49e4d9819.ae072dcef82d79af7893625a5ff1416f`
|
|
73
58
|
|
|
74
59
|
---
|
|
75
60
|
|
|
@@ -81,19 +66,7 @@ Initialize the widget:
|
|
|
81
66
|
|
|
82
67
|
- Helps track user activity and transaction flow.
|
|
83
68
|
|
|
84
|
-
- Example: `
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
### `redirectUrl` (optional)
|
|
89
|
-
|
|
90
|
-
- **Type**: `string`
|
|
91
|
-
|
|
92
|
-
- **Description**: The URL to which the user will be redirected **after completing the transaction**.
|
|
93
|
-
|
|
94
|
-
- A **callback** will be made to this URL along with the **transaction result or status** as query parameters or payload (depending on the integration).
|
|
95
|
-
|
|
96
|
-
- Example: `https://yourapp.com/transaction-complete`
|
|
69
|
+
- Example: `34edd6d6eb12422fbd0e63c5733527`
|
|
97
70
|
|
|
98
71
|
---
|
|
99
72
|
|
|
@@ -109,7 +82,6 @@ Initialize the widget:
|
|
|
109
82
|
```
|
|
110
83
|
|
|
111
84
|
- **Description**: Defines the default configuration for the buy flow.
|
|
112
|
-
|
|
113
85
|
- from_amount: A string representing the default amount to be displayed in the input field (e.g., "25").
|
|
114
86
|
|
|
115
87
|
- token_type: The token that should be selected by default for purchase (e.g., "USDC").
|
|
@@ -118,6 +90,51 @@ Initialize the widget:
|
|
|
118
90
|
|
|
119
91
|
---
|
|
120
92
|
|
|
93
|
+
### `callback` (required)
|
|
94
|
+
|
|
95
|
+
- **Type**:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
(data: {
|
|
99
|
+
status: string;
|
|
100
|
+
message?: string;
|
|
101
|
+
transaction_id?: string;
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
}) => void
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **Description**: A callback function that is triggered whenever the widget returns a response or status update.
|
|
108
|
+
|
|
109
|
+
status: Represents the current state of the action (e.g., "success", "failed", "pending").
|
|
110
|
+
message: Optional message returned from the widget response.
|
|
111
|
+
transaction_id: Optional unique transaction identifier.
|
|
112
|
+
Additional response fields may be included depending on the event type.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### `redirect` (optinal)
|
|
117
|
+
|
|
118
|
+
- **Type**: `boolean`
|
|
119
|
+
|
|
120
|
+
- **Description**: Determines whether redirection should be enabled after the action is completed.
|
|
121
|
+
|
|
122
|
+
- Example: `false | true`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### `redirectUrl` (optional)
|
|
127
|
+
|
|
128
|
+
- **Type**: `string`
|
|
129
|
+
|
|
130
|
+
- **Description**: The URL to which the user will be redirected **after completing the transaction**.
|
|
131
|
+
|
|
132
|
+
- A **callback** will be made to this URL along with the **transaction result or status** as query parameters or payload (depending on the integration).
|
|
133
|
+
|
|
134
|
+
- Example: `https://yourapp.com/transaction-complete`
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
121
138
|
## License
|
|
122
139
|
|
|
123
140
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
package/dist/index.js
CHANGED
|
@@ -32,5 +32,5 @@ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();functio
|
|
|
32
32
|
|
|
33
33
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
34
|
*/
|
|
35
|
-
return function(){var t=e,n=t.lib,i=n.WordArray,o=n.Hasher,r=t.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),s=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),d=i.create([1352829926,1548603684,1836072691,2053994217,0]),g=r.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,o=e[i];e[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var r,g,v,x,y,C,B,G,_,A,w,F=this._hash.words,X=u.words,R=d.words,Q=a.words,W=l.words,N=s.words,Z=c.words;for(C=r=F[0],B=g=F[1],G=v=F[2],_=x=F[3],A=y=F[4],n=0;n<80;n+=1)w=r+e[t+Q[n]]|0,w+=n<16?b(g,v,x)+X[0]:n<32?p(g,v,x)+X[1]:n<48?m(g,v,x)+X[2]:n<64?f(g,v,x)+X[3]:I(g,v,x)+X[4],w=(w=h(w|=0,N[n]))+y|0,r=y,y=x,x=h(v,10),v=g,g=w,w=C+e[t+W[n]]|0,w+=n<16?I(B,G,_)+R[0]:n<32?f(B,G,_)+R[1]:n<48?m(B,G,_)+R[2]:n<64?p(B,G,_)+R[3]:b(B,G,_)+R[4],w=(w=h(w|=0,Z[n]))+A|0,C=A,A=_,_=h(G,10),G=B,B=w;w=F[1]+v+_|0,F[1]=F[2]+x+A|0,F[2]=F[3]+y+C|0,F[3]=F[4]+r+B|0,F[4]=F[0]+g+G|0,F[0]=w},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,r=o.words,a=0;a<5;a++){var l=r[a];r[a]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function b(e,t,n){return e^t^n}function p(e,t,n){return e&t|~e&n}function m(e,t,n){return(e|~t)^n}function f(e,t,n){return e&n|t&~n}function I(e,t,n){return e^(t|~n)}function h(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(g),t.HmacRIPEMD160=o._createHmacHelper(g)}(),e.RIPEMD160}(eo())),So(),Ho||(Ho=1,Uo.exports=function(e){return i=(n=(t=e).lib).Base,o=n.WordArray,a=(r=t.algo).SHA256,l=r.HMAC,s=r.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=l.create(n.hasher,e),r=o.create(),a=o.create([1]),s=r.words,c=a.words,u=n.keySize,d=n.iterations;s.length<u;){var g=i.update(t).finalize(a);i.reset();for(var b=g.words,p=b.length,m=g,f=1;f<d;f++){m=i.finalize(m),i.reset();for(var I=m.words,h=0;h<p;h++)b[h]^=I[h]}r.concat(g),c[0]++}return r.sigBytes=4*u,r}}),t.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},e.PBKDF2;var t,n,i,o,r,a,l,s}(eo(),_o(),So())),Oo(),To(),Ko(),er(),ir(),ar(),lr||(lr=1,sr.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(eo(),To())),cr||(cr=1,ur.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,i=4*t,o=i-n%i,r=n+o-1;e.clamp(),e.words[r>>>2]|=o<<24-r%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(eo(),To())),dr||(dr=1,gr.exports=function(e){return e.pad.Iso10126={pad:function(t,n){var i=4*n,o=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(eo(),To())),br||(br=1,pr.exports=function(e){return e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(eo(),To())),mr||(mr=1,fr.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding}(eo(),To())),Ir||(Ir=1,hr.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(eo(),To())),vr||(vr=1,xr.exports=function(e){return n=(t=e).lib.CipherParams,i=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return n.create({ciphertext:t})}},e.format.Hex;var t,n,i}(eo(),To())),yr||(yr=1,Cr.exports=function(e){return function(){var t=e,n=t.lib.BlockCipher,i=t.algo,o=[],r=[],a=[],l=[],s=[],c=[],u=[],d=[],g=[],b=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,o[n]=p,r[p]=n;var m=e[n],f=e[m],I=e[f],h=257*e[p]^16843008*p;a[n]=h<<24|h>>>8,l[n]=h<<16|h>>>16,s[n]=h<<8|h>>>24,c[n]=h,h=16843009*I^65537*f^257*m^16843008*n,u[p]=h<<24|h>>>8,d[p]=h<<16|h>>>16,g[p]=h<<8|h>>>24,b[p]=h,n?(n=m^e[e[e[I^m]]],i^=e[e[i]]):n=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,i=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],a=0;a<i;a++)a<n?r[a]=t[a]:(c=r[a-1],a%n?n>6&&a%n==4&&(c=o[c>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c]):(c=o[(c=c<<8|c>>>24)>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c],c^=p[a/n|0]<<24),r[a]=r[a-n]^c);for(var l=this._invKeySchedule=[],s=0;s<i;s++){if(a=i-s,s%4)var c=r[a];else c=r[a-4];l[s]=s<4||a<=4?c:u[o[c>>>24]]^d[o[c>>>16&255]]^g[o[c>>>8&255]]^b[o[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,l,s,c,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,g,b,r),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,o,r,a,l){for(var s=this._nRounds,c=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],g=e[t+3]^n[3],b=4,p=1;p<s;p++){var m=i[c>>>24]^o[u>>>16&255]^r[d>>>8&255]^a[255&g]^n[b++],f=i[u>>>24]^o[d>>>16&255]^r[g>>>8&255]^a[255&c]^n[b++],I=i[d>>>24]^o[g>>>16&255]^r[c>>>8&255]^a[255&u]^n[b++],h=i[g>>>24]^o[c>>>16&255]^r[u>>>8&255]^a[255&d]^n[b++];c=m,u=f,d=I,g=h}m=(l[c>>>24]<<24|l[u>>>16&255]<<16|l[d>>>8&255]<<8|l[255&g])^n[b++],f=(l[u>>>24]<<24|l[d>>>16&255]<<16|l[g>>>8&255]<<8|l[255&c])^n[b++],I=(l[d>>>24]<<24|l[g>>>16&255]<<16|l[c>>>8&255]<<8|l[255&u])^n[b++],h=(l[g>>>24]<<24|l[c>>>16&255]<<16|l[u>>>8&255]<<8|l[255&d])^n[b++],e[t]=m,e[t+1]=f,e[t+2]=I,e[t+3]=h},keySize:8});t.AES=n._createHelper(m)}(),e.AES}(eo(),bo(),vo(),Oo(),To())),_r(),Ar||(Ar=1,wr.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,i=t.algo,o=i.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,i=this._S=[],o=0;o<256;o++)i[o]=o;o=0;for(var r=0;o<256;o++){var a=o%n,l=t[a>>>2]>>>24-a%4*8&255;r=(r+i[o]+l)%256;var s=i[o];i[o]=i[r],i[r]=s}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var e=this._S,t=this._i,n=this._j,i=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var r=e[t];e[t]=e[n],e[n]=r,i|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,i}t.RC4=n._createHelper(o);var a=i.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)r.call(this)}});t.RC4Drop=n._createHelper(a)}(),e.RC4}(eo(),bo(),vo(),Oo(),To())),Fr||(Fr=1,Xr.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,i=t.algo,o=[],r=[],a=[],l=i.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)s.call(this);for(n=0;n<8;n++)o[n]^=i[n+4&7];if(t){var r=t.words,a=r[0],l=r[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),d=c>>>16|4294901760&u,g=u<<16|65535&c;for(o[0]^=c,o[1]^=d,o[2]^=u,o[3]^=g,o[4]^=c,o[5]^=d,o[6]^=u,o[7]^=g,n=0;n<4;n++)s.call(this)}},_doProcessBlock:function(e,t){var n=this._X;s.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)o[i]=16711935&(o[i]<<8|o[i]>>>24)|4278255360&(o[i]<<24|o[i]>>>8),e[t+i]^=o[i]},blockSize:4,ivSize:2});function s(){for(var e=this._X,t=this._C,n=0;n<8;n++)r[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<r[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<r[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<r[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<r[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<r[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<r[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<r[6]>>>0?1:0)|0,this._b=t[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],o=65535&i,l=i>>>16,s=((o*o>>>17)+o*l>>>15)+l*l,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[n]=s^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=n._createHelper(l)}(),e.Rabbit}(eo(),bo(),vo(),Oo(),To())),Rr||(Rr=1,Qr.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,i=t.algo,o=[],r=[],a=[],l=i.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)s.call(this);for(o=0;o<8;o++)i[o]^=n[o+4&7];if(t){var r=t.words,a=r[0],l=r[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),d=c>>>16|4294901760&u,g=u<<16|65535&c;for(i[0]^=c,i[1]^=d,i[2]^=u,i[3]^=g,i[4]^=c,i[5]^=d,i[6]^=u,i[7]^=g,o=0;o<4;o++)s.call(this)}},_doProcessBlock:function(e,t){var n=this._X;s.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)o[i]=16711935&(o[i]<<8|o[i]>>>24)|4278255360&(o[i]<<24|o[i]>>>8),e[t+i]^=o[i]},blockSize:4,ivSize:2});function s(){for(var e=this._X,t=this._C,n=0;n<8;n++)r[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<r[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<r[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<r[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<r[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<r[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<r[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<r[6]>>>0?1:0)|0,this._b=t[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],o=65535&i,l=i>>>16,s=((o*o>>>17)+o*l>>>15)+l*l,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[n]=s^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=n._createHelper(l)}(),e.RabbitLegacy}(eo(),bo(),vo(),Oo(),To())),Zr())),Ki.exports),Lr=r(Vr);function Dr(e,t){var n=Lr.enc.Base64.parse(t);if(32!==n.sigBytes)throw new Error("Invalid key length: ".concat(n.sigBytes,". Expected 32 bytes."));var i=Lr.lib.WordArray.random(16),o=Lr.AES.encrypt(e,n,{iv:i,mode:Lr.mode.CBC,padding:Lr.pad.Pkcs7}),r=Lr.enc.Base64.stringify(i),a=Lr.enc.Base64.stringify(o.ciphertext),l={iv:r,value:a,mac:Lr.HmacSHA256(r+a,n).toString(Lr.enc.Hex)},s=JSON.stringify(l);return Lr.enc.Base64.stringify(Lr.enc.Utf8.parse(s))}var Yr=function(e){return f(void 0,[e],void 0,(function(e){var t,n,i,o,r,a,l,s,c=e.apiEndpoint,u=e.timestamp,d=e.requestType,g=e.apiKey,b=e.saltKey;return I(this,(function(e){switch(e.label){case 0:return t="/".concat(c),n=u,i=null==d?void 0:d.toUpperCase(),o=g&&(null==g?void 0:g.split(".")[0]),[4,Dr(u,o)];case 1:return r=e.sent(),a=Lr.HmacSHA256(n,b),l=Lr.HmacSHA256(t,a),s=Lr.HmacSHA256(i,l),[2,"".concat(s.toString(Lr.enc.Hex),".").concat(r)]}}))}))},Sr=function(e){return f(void 0,[e],void 0,(function(e){var t,n,i,o,r,a=e.url,l=e.body,s=e.headers,c=e.method,u=e.apikey,d=e.saltKey,g=e.onError,b=e.onSuccess;return I(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),t={method:c||"GET"},[4,Yr({apiEndpoint:a.substring(a.lastIndexOf("/")+1),timestamp:Math.floor(Date.now()/1e3).toString(),requestType:(null==c?void 0:c.toUpperCase())||"GET",apiKey:u,saltKey:d})];case 1:return n=e.sent(),s&&(t=m(m({},t),{headers:m(m({},s),{"x-api-signature":n})})),l&&(t=m(m({},t),{body:l})),[4,fetch(a,t)];case 2:return[4,null==(i=e.sent())?void 0:i.json()];case 3:return o=e.sent(),[2,b(o)];case 4:return r=e.sent(),[2,g(r)];case 5:return[2]}}))}))},Hr=function(t){var n,i,o=t.setSandboxStep,r=t.data,a=t.setSandboxData,l=t.callback,s=t.apiKey,c=t.clientReferenceID,u=C().addToast,d=e.useState(!1),g=d[0],f=d[1];return b.jsxs("div",{className:p.details_frame,children:[b.jsxs("div",{className:p.avater_head,children:[b.jsx("img",{src:window.location.origin+"/img/bannk.png"}),b.jsx("div",{className:p.f_details_titles,children:"Overview Details"})]}),b.jsxs("div",{className:p.f_details_info_box,children:[b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"You pay"}),b.jsxs("span",{children:[null==r?void 0:r.from_amount," ",null==r?void 0:r.selectedFiat]})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Rate"}),b.jsxs("span",{children:["1 ",null==r?void 0:r.selectedFiat," =",null===(n=parseFloat(null==r?void 0:r.exchangeRateForThisUser))||void 0===n?void 0:n.toFixed(8)," ",null==r?void 0:r.selectedCrypto," ",(null==r?void 0:r.network_type)?"(".concat(null==r?void 0:r.network_type,")"):""]})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"You Receive"}),b.jsxs("span",{children:[null===(i=parseFloat(null==r?void 0:r.userReceivableCryptoValue))||void 0===i?void 0:i.toFixed(8)," ",null==r?void 0:r.selectedCrypto," ",(null==r?void 0:r.network_type)?"(".concat(null==r?void 0:r.network_type,")"):""]})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Transaction Ref ID"}),b.jsx("span",{children:null==r?void 0:r.transaction_ref_id})]})]}),b.jsx("div",{className:p.onRampAction,children:b.jsxs("button",{type:"button",onClick:function(){var e,t;f(!0);var n={status:"failed",message:"Error while Buying Tokens",data:{transaction_id:null===(t=null===(e=null==r?void 0:r.apiResponse)||void 0===e?void 0:e.onramp_transaction)||void 0===t?void 0:t.unique_id,from_currency:(null==r?void 0:r.selectedFiat)||"",to_currency:(null==r?void 0:r.selectedCrypto)||"",network_type:(null==r?void 0:r.network_type)||"",from_value:null==r?void 0:r.from_amount,to_value:null==r?void 0:r.userReceivableCryptoValue,wallet_address:null==r?void 0:r.wallet_address,exchange_rate:null==r?void 0:r.exchangeRateForThisUser}};Sr({url:"https://herald-retail-api-dev.heraldex.com/api/v1/gateway/onramp",method:"POST",headers:{"Content-Type":"application/json","X-API-KEY":s},apikey:s,saltKey:c,body:JSON.stringify({payment_id:null==r?void 0:r.transaction_ref_id,admin_bank_account_id:1,from_amount:null==r?void 0:r.from_amount,from_token:null==r?void 0:r.selectedFiat,to_token:null==r?void 0:r.selectedCrypto,to_network:(null==r?void 0:r.network_type)||"",exchange_rate:null==r?void 0:r.exchangeRateForThisUser}),onSuccess:function(e){(null==e?void 0:e.success)?(n=m(m({},n),{message:null==r?void 0:r.message,status:"success"}),a(m(m({},r),{transactionDetails:null==e?void 0:e.data,callBackData:n})),u("".concat(null==e?void 0:e.message),"success"),l(n),o(3)):(n=m(m({},n),{message:(null==r?void 0:r.message)||"Error in Buy Tokens"}),a(m(m({},r),{transactionDetails:null==e?void 0:e.data,callBackData:n})),u("".concat(null==e?void 0:e.message),"error"),l(n)),f(!1)},onError:function(e){u("".concat(e),"error"),f(!1),n=m(m({},n),{message:(null==e?void 0:e.message)||"Error in Buy Tokens"}),l(n)}})},className:"".concat(p.actionBtn," ").concat(p.primary),children:["Confirm ",g&&b.jsx(ji,{})]})})]})},Ur=function(t){var n,i,o,r,a,l,s=t.data,c=t.redirect,u=t.redirectUrl,d=e.useState(4),g=d[0],m=d[1];return e.useEffect((function(){if(c){var e=setInterval((function(){m((function(t){var n,i,o;if(t<=0){clearInterval(e);var r=u+"?transaction_id=".concat(null===(i=null===(n=null==s?void 0:s.callBackData)||void 0===n?void 0:n.data)||void 0===i?void 0:i.transaction_id,"&status=").concat(null===(o=null==s?void 0:s.callBackData)||void 0===o?void 0:o.status);return c&&(window.location.href=r),0}return t-1}))}),1e3);return function(){return clearInterval(e)}}}),[]),b.jsxs("div",{className:p.details_frame,children:[b.jsxs("div",{className:p.avater_head,children:[b.jsx("img",{src:window.location.origin+"/img/swap-modal.png"}),b.jsxs("div",{className:p.f_details_titles,children:["Buy ",(null===(n=null==s?void 0:s.transactionDetails)||void 0===n?void 0:n.from_amount_formatted)||"0"," @"," ",(null===(i=null==s?void 0:s.transactionDetails)||void 0===i?void 0:i.to_amount_formatted)||"0"," ",(null==s?void 0:s.network_type)?"(".concat(null==s?void 0:s.network_type,")"):""]})]}),b.jsxs("div",{className:p.f_details_info_box,children:[b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Order Status"}),b.jsx("span",{children:null===(o=null==s?void 0:s.transactionDetails)||void 0===o?void 0:o.status_formatted})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Order Id"}),b.jsx("span",{children:null===(r=null==s?void 0:s.transactionDetails)||void 0===r?void 0:r.order_id})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Order Date"}),b.jsx("span",{children:null===(a=null==s?void 0:s.transactionDetails)||void 0===a?void 0:a.created_at_formatted})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Exchange Rate"}),b.jsxs("span",{children:[null===(l=null==s?void 0:s.transactionDetails)||void 0===l?void 0:l.exchange_rate_formatted," ",(null==s?void 0:s.network_type)?"(".concat(null==s?void 0:s.network_type,")"):""]})]}),c&&b.jsx("div",{className:p.f_details_card,children:b.jsxs("span",{children:["Redirecting in ",g," "]})})]})]})},Jr=function(e){return e.replace(/([A-Z])/g," $1").replace(/^./,(function(e){return e.toUpperCase()}))},Er=function(t){var n=t.setSandboxStep,i=t.setSandboxData,o=t.data,r=t.apiKey,a=t.clientReferenceID,l=C().addToast,s=e.useState({transaction_ref_id:null==o?void 0:o.transaction_ref_id}),c=s[0],u=s[1],d=e.useState({}),g=d[0],f=d[1],I=e.useState({}),h=I[0],v=I[1],x=e.useState(""),y=x[0],B=x[1],G=function(e){return e?/^[A-Za-z0-9]{8,20}$/.test(e)?"":"Must be 8-20 alphanumeric characters":"Transaction ID is required"};e.useEffect((function(){Sr({url:"https://herald-retail-api-dev.heraldex.com/api/v1/gateway/get_admin_accounts",method:"POST",headers:{"Content-Type":"application/json","X-API-KEY":r},apikey:r,saltKey:a,body:JSON.stringify({currency_type:null==o?void 0:o.selectedFiat}),onSuccess:function(e){var t,n,i,r,a,l,s,c,u,d,g,b;(null==e?void 0:e.success)&&("EUR"===(null==o?void 0:o.selectedFiat)?v({bankName:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.bank_name,accountNumber:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.account_number,IBAN:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.iban,accountHolderName:null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.account_holder_name,accountType:null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.account_type,ReferenceNumber:null===(l=null==e?void 0:e.data)||void 0===l?void 0:l.reference_number}):"USD"===(null==o?void 0:o.selectedFiat)&&f({bankName:null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.bank_name,accountNumber:null===(c=null==e?void 0:e.data)||void 0===c?void 0:c.account_number,swiftBic:null===(u=null==e?void 0:e.data)||void 0===u?void 0:u.swift_bic,accountHolderName:null===(d=null==e?void 0:e.data)||void 0===d?void 0:d.account_holder_name,accountType:null===(g=null==e?void 0:e.data)||void 0===g?void 0:g.account_type,ReferenceNumber:null===(b=null==e?void 0:e.data)||void 0===b?void 0:b.reference_number}))},onError:function(){l("Error fetching comission","error")}})}),[]);return b.jsxs("div",{className:p.details_frame,children:[b.jsxs("div",{className:p.avater_head,children:[b.jsx("img",{src:window.location.origin+"/img/bannk.png"}),b.jsx("div",{className:p.f_details_titles,children:"Bank Details"})]}),b.jsx("div",{className:p.f_details_info_box,children:Object.entries("EUR"===(null==o?void 0:o.selectedFiat)?h:"USD"===(null==o?void 0:o.selectedFiat)?g:{}).map((function(e){var t=e[0],n=e[1];return b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:Jr(t)}),b.jsx("span",{children:n})]},t)}))}),b.jsxs("div",{className:p.onRampNewBankLabel,children:["Transaction Reference ID ",b.jsx("span",{className:p.required,children:"*"})]})," ",b.jsxs("div",{className:p.onRampNewBankFields,children:[b.jsx("input",{type:"text",placeholder:"Enter Transaction Reference ID",value:c.transaction_ref_id,onChange:function(e){var t=e.target.value;u(m(m({},c),{transaction_ref_id:t})),B(G(t))},className:p.inputControl}),y&&b.jsx("span",{className:p.error,children:y})]}),b.jsx("div",{className:p.onRampAction,children:b.jsx("button",{type:"button",onClick:function(e){return function(e){e.preventDefault();var t=G(c.transaction_ref_id);t?B(t):(i(m(m({},o),{transaction_ref_id:c.transaction_ref_id})),n(2))}(e)},className:"".concat(p.actionBtn," ").concat(p.primary),disabled:!c.transaction_ref_id,children:"Confirm"})})]})},Or=function(t){var n=t.data,i=t.apiKey,o=t.clientReferenceID,r=t.setSandboxData,a=t.callback,l=t.redirect,s=t.redirectUrl,c=t.setBuyStep,u=e.useState(1),d=u[0],g=u[1];return b.jsxs("div",{children:[3!==d&&b.jsxs("div",{className:p.on_ramp_bank_head,onClick:function(){return 1===d?c(1):g(d-1)},children:[b.jsx("div",{children:b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",fill:"#0000",children:b.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),b.jsx("div",{className:p.on_bank_titles,children:"Back"})]}),1===d&&b.jsx(Er,{setSandboxStep:g,data:n,setSandboxData:r,apiKey:i,clientReferenceID:o}),2===d&&b.jsx(Hr,{apiKey:i,clientReferenceID:o,data:n,setSandboxStep:g,setSandboxData:r,callback:a}),3===d&&b.jsxs(b.Fragment,{children:[" ",b.jsx(Ur,{data:n,redirect:l,redirectUrl:s}),b.jsx("div",{className:p.onRampAction,children:b.jsxs("button",{type:"button",onClick:function(){return c(1),r({})},className:"".concat(p.actionBtn," ").concat(p.primary),children:[b.jsx("div",{children:b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"15",height:"15",viewBox:"0 0 240.823 240.823",fill:"#000000",children:b.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),"Create New Transaction"]})})]})]})},Mr=function(t){var n,i,o,r=t.apiKey,a=t.redirectUrl,l=t.parameters,s=t.clientReferenceID,c=t.mode,u=t.callback,d=t.redirect,g=C().addToast,h=e.useState(!1),v=h[0],x=h[1],y=e.useState([]),B=y[0],G=y[1],_=e.useState([]),A=_[0],w=_[1],F=e.useState(null),X=F[0],R=F[1],Q=e.useState(null),W=Q[0],N=Q[1],Z=e.useState(0),k=Z[0],V=Z[1],L=e.useState(0);L[0],L[1];var D=e.useState(null),Y=D[0],S=D[1],H=e.useState(null),U=H[0],J=H[1],E=e.useState({min:!1,max:!1}),O=E[0],M=E[1],z=e.useState(0),T=z[0],j=z[1],P=e.useState(!0),K=P[0],q=P[1],$=e.useState(1),ee=$[0],te=$[1],ne=e.useState(),ie=ne[0],oe=ne[1],re=e.useState(""),ae=re[0],le=re[1],se=e.useState({from_amount:(null==l?void 0:l.from_amount)&&parseFloat(null==l?void 0:l.from_amount)>0?l.from_amount:"0",selectedCrypto:(null==l?void 0:l.token_type)||"",selectedFiat:"",minAmount:"0.0000001",maxAmount:"1000.00000"}),ce=se[0],ue=se[1],de=e.useState(null),ge=de[0],be=de[1];e.useEffect((function(){pe(),me()}),[]);var pe=function(){Sr({url:"https://herald-retail-api-dev.heraldex.com/api/v1/gateway/get_currencies",headers:{"Content-Type":"application/json","X-API-KEY":r},method:"GET",apikey:r,saltKey:s,onSuccess:function(e){(null==e?void 0:e.success)&&J(null==e?void 0:e.data)},onError:function(){g("Error fetching currency","error")}})},me=function(){Sr({url:"https://herald-retail-api-dev.heraldex.com/api/lookup/commissions",headers:{"Content-Type":"application/json","X-API-KEY":r},method:"GET",apikey:r,saltKey:s,onSuccess:function(e){var t,n,i,o;if(null==e?void 0:e.success){var r=(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.rules)||void 0===n?void 0:n.find((function(e){return"onramp"===(null==e?void 0:e.service)})))||null;S(r),r&&ue(m(m({},ce),{minAmount:null===(i=null==r?void 0:r.schema)||void 0===i?void 0:i.min,maxAmount:null===(o=null==r?void 0:r.schema)||void 0===o?void 0:o.max}))}},onError:function(){g("Error fetching comission","error")}})};e.useEffect((function(){var e,t,n,i,o,r,a,s,c;if(U){var u=null===(t=null===(e=null==U?void 0:U.supported_currency)||void 0===e?void 0:e.filter((function(e){return"FOREX"===(null==e?void 0:e.type)})))||void 0===t?void 0:t.map((function(e){return{label:null==e?void 0:e.name,value:null==e?void 0:e.name,icon:null==e?void 0:e.icon}}));G(u);var d=(null==ce?void 0:ce.selectedFiat)?(null==U?void 0:U.supported_currency.find((function(e){return(null==e?void 0:e.name)===(null==ce?void 0:ce.selectedFiat)})))||(null===(n=null==U?void 0:U.supported_currency)||void 0===n?void 0:n.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==u?void 0:u[0])||void 0===t?void 0:t.label)}))):null===(i=null==U?void 0:U.supported_currency)||void 0===i?void 0:i.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==u?void 0:u[0])||void 0===t?void 0:t.label)})),g=ce.selectedFiat&&u.find((function(e){return e.label===ce.selectedFiat}))||(null==u?void 0:u[0]);N(g);var b=(null===(r=null===(o=null==U?void 0:U.supported_currency)||void 0===o?void 0:o.filter((function(e){return"CRYPTO"===(null==e?void 0:e.type)})))||void 0===r?void 0:r.map((function(e){return{label:null==e?void 0:e.name,value:null==e?void 0:e.name,icon:null==e?void 0:e.icon}})))||[];w(b);var p=(null==l?void 0:l.token_type)?(null===(a=null==U?void 0:U.supported_currency)||void 0===a?void 0:a.find((function(e){return(null==e?void 0:e.name)===(null==l?void 0:l.token_type)})))||(null===(s=null==U?void 0:U.supported_currency)||void 0===s?void 0:s.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==b?void 0:b[0])||void 0===t?void 0:t.label)}))):null===(c=null==U?void 0:U.supported_currency)||void 0===c?void 0:c.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==b?void 0:b[0])||void 0===t?void 0:t.label)}));R((null==l?void 0:l.token_type)?b.find((function(e){return e.label===(null==l?void 0:l.token_type)}))||(null==b?void 0:b[0]):(null==b?void 0:b[0])||[]),ue((function(e){return m(m({},e),{selectedCrypto:(null==p?void 0:p.name)||"",selectedFiat:(null==d?void 0:d.name)||""})}))}}),[U]);e.useEffect((function(){var e=setTimeout((function(){W&&X&&fe()}),300);return function(){return clearTimeout(e)}}),[W,X,ce]);var fe=function(){return f(void 0,void 0,void 0,(function(){var e;return I(this,(function(t){switch(t.label){case 0:if(q(!0),V(0),j(0),!("string"==typeof ce.from_amount?parseFloat(null==ce?void 0:ce.from_amount)>0:ce.from_amount>0))return[3,6];t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,fetch("https://herald-retail-api-dev.heraldex.com/api/v1/exchange_rates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:null==ce?void 0:ce.from_amount,from_currency:(null==ce?void 0:ce.selectedFiat)||(null==W?void 0:W.label),to_currency:(null==ce?void 0:ce.selectedCrypto)||(null==X?void 0:X.label),side:"buy"})}).then((function(e){return e.json()})).then((function(e){if(Object.keys(e.data).length>0){var t=e.data,n=(null==ce?void 0:ce.selectedFiat)||(null==W?void 0:W.label),i=(null==ce?void 0:ce.selectedCrypto)||(null==X?void 0:X.label),o=["USDT","USDC"].includes(i)&&"USD"==n?1/Number(null==t?void 0:t.exchange_rate):Number(null==t?void 0:t.exchange_rate);V(o),j(Number(o)*Number(null==ce?void 0:ce.from_amount))}else g(null==e?void 0:e.message,"error")})).catch((function(e){g(e,"error")}))];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),g(e,"error"),[3,5];case 4:return q(!1),[7];case 5:return[3,7];case 6:g("Please enter valid amount","error"),q(!1),t.label=7;case 7:return[2]}}))}))};e.useEffect((function(){M({min:parseFloat(ce.from_amount)<parseFloat(ce.minAmount)||""===ce.from_amount||parseFloat(ce.from_amount)<=0,max:parseFloat(ce.from_amount)>parseFloat(ce.maxAmount)})}),[k,ce]);return b.jsx(b.Fragment,{children:1===ee?b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:p.onRampFieldCard,children:[b.jsxs("div",{className:p.onRampFieldBox,children:[b.jsx("div",{className:p.onRampFieldLabel,children:"You Pay"}),b.jsxs("div",{className:p.onRampFieldForm,children:[b.jsx("input",{type:"text",value:null==ce?void 0:ce.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(Y&&!function(e,t){if(!/^\d*\.?\d*$/.test(e))return!1;var n=e.split(".");return 2!==n.length||n[1].length<=t}(e,null===(t=null==Y?void 0:Y.schema)||void 0===t?void 0:t.decimal))return void g("You can input upto ".concat(null===(n=null==Y?void 0:Y.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?ue(m(m({},ce),{from_amount:""})):isNaN(Number(e))||ue(m(m({},ce),{from_amount:e}))}else""===e?ue(m(m({},ce),{from_amount:""})):isNaN(Number(e))||ue(m(m({},ce),{from_amount:e}))}(e.target.value)},className:p.inputControl}),(null==O?void 0:O.min)&&b.jsxs("p",{className:p.errorMsg,children:["Invalid, Min : ",null===(n=parseFloat(null==ce?void 0:ce.minAmount))||void 0===n?void 0:n.toFixed(8)]}),(null==O?void 0:O.max)&&b.jsxs("p",{className:p.errorMsg,children:["Invalid, Max : ",null===(i=parseFloat(null==ce?void 0:ce.maxAmount))||void 0===i?void 0:i.toString()]})]})]}),b.jsx("div",{className:p.onRampFieldSelectCard,children:b.jsx("div",{className:p.onRampFieldSelect,children:(null==B?void 0:B.length)>0?b.jsx(zi,{backgroundColor:"#ffffff70",borderColor:"#efefef",placeholder:"Select an option",image:!1,singleicons:!0,options:B,isSearchable:!1,value:W||(null==B?void 0:B.find((function(e){return e.value===(null==ce?void 0:ce.selectedFiat)}))),onChange:function(e){return function(e){var t,n=null===(t=null==U?void 0:U.supported_currency)||void 0===t?void 0:t.find((function(t){return t.name===(null==e?void 0:e.value)}));ue(m(m({},ce),{selectedFiat:(null==n?void 0:n.name)||""})),N(e)}(e)},isDisabled:K}):b.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:b.jsx(Ti,{})})})})]}),b.jsxs("div",{className:p.onRampInfoBox,children:[b.jsxs("div",{className:"".concat(p.onRampLabelCard," ").concat(p.onRampSpace),children:[b.jsx("div",{className:p.onRampLabelIcons,children:b.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",fill:"var( --on-black-white)",children:[b.jsx("path",{d:"M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5","data-original":"#000000"}),b.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),b.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),b.jsxs("div",{className:p.onRampLabelValue,children:[b.jsx("span",{style:{marginRight:10},children:"Rate :"}),K?b.jsx(Pi,{}):"1\n ".concat((null==W?void 0:W.label)||"N/A","\n = ").concat(k>0?null===(o=Number(k))||void 0===o?void 0:o.toFixed(8):0," ").concat(null==X?void 0:X.label)]})]}),b.jsxs("div",{className:p.onRampSpaceTop,children:[b.jsx("div",{className:p.onRampLabelDots}),b.jsxs("div",{className:p.onRampDetails,children:[b.jsx("div",{className:p.onRampHead,children:"Payment Method"}),b.jsx("div",{className:p.offPaymentBox,children:b.jsxs("div",{className:p.offPaymentCheckCard,children:[b.jsx("div",{children:"Bank Payment"}),b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 408.576 408.576",children:b.jsx("g",{children:b.jsx("path",{d:"M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z",fill:"#494949"})})})]})})]})]})]}),b.jsxs("div",{className:p.onRampFieldCard,children:[b.jsxs("div",{className:p.onRampFieldBox,children:[b.jsx("div",{className:p.onRampFieldLabel,children:"You Receive (estimate)"}),b.jsx("div",{className:p.onRampFieldForm,children:K?b.jsx(Pi,{size:20}):b.jsx("input",{type:"text",value:(null==O?void 0:O.min)||(null==O?void 0:O.max)?0:Number(T).toFixed(8)||0,className:p.inputControl,disabled:!0})})]}),b.jsx("div",{className:p.onRampFieldSelectCard,children:b.jsx("div",{className:p.onRampFieldSelect,children:(null==A?void 0:A.length)>0?b.jsx(zi,{backgroundColor:"#ffffff70",borderColor:"#efefef",placeholder:"Select",image:!1,singleicons:!0,options:A,isSearchable:!1,value:X,onChange:function(e){e&&(V(0),le(""),function(e){var t,n=null===(t=null==U?void 0:U.supported_currency)||void 0===t?void 0:t.find((function(t){return(null==t?void 0:t.name)===e.value}));ue(m(m({},ce),{selectedCrypto:(null==n?void 0:n.name)||""})),R(e)}(e),be(m(m({},ge),{wallet_address:""})))},isDisabled:K}):b.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:b.jsx(Ti,{})})})})]}),b.jsx("div",{className:p.onRampAction,children:b.jsxs("button",{disabled:k<=0||K||v,className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(){return f(void 0,void 0,void 0,(function(){return I(this,(function(e){return oe(""),x(!1),be(m(m({},ce),{userReceivableCryptoValue:T,exchangeRateForThisUser:k,wallet_address:ae})),te(2),[2]}))}))},children:["Continue ",v&&b.jsx(ji,{})]})})]}):b.jsx(b.Fragment,{children:"development"===c?b.jsx(Or,{apiKey:r,clientReferenceID:s,data:ge,setSandboxData:be,callback:u,redirect:d,redirectUrl:a,setBuyStep:te}):b.jsx("iframe",{title:"Buy Crypto",id:"chat-widget",src:ie,style:{width:"100%",minHeight:"calc(100vh - 400px)",border:"none",zIndex:"9999",overflow:"auto"}})})})};exports.BuyCryptoWidget=function(e){var t=e.apiKey,n=e.redirectUrl,i=e.buyParameters,o=e.clientReferenceID,r=e.mode,a=void 0===r?"development":r,l=e.callback,s=e.redirect;return b.jsx("div",{className:p.widgetComponent,id:"widget-container",children:b.jsx(y,{children:b.jsx(Mr,{apiKey:t,parameters:i,clientReferenceID:o,mode:a,callback:l,redirect:s,redirectUrl:n})})})};
|
|
35
|
+
return function(){var t=e,n=t.lib,i=n.WordArray,o=n.Hasher,r=t.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),s=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),d=i.create([1352829926,1548603684,1836072691,2053994217,0]),g=r.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,o=e[i];e[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var r,g,v,x,y,C,B,G,_,A,w,F=this._hash.words,X=u.words,R=d.words,Q=a.words,W=l.words,N=s.words,Z=c.words;for(C=r=F[0],B=g=F[1],G=v=F[2],_=x=F[3],A=y=F[4],n=0;n<80;n+=1)w=r+e[t+Q[n]]|0,w+=n<16?b(g,v,x)+X[0]:n<32?p(g,v,x)+X[1]:n<48?m(g,v,x)+X[2]:n<64?f(g,v,x)+X[3]:I(g,v,x)+X[4],w=(w=h(w|=0,N[n]))+y|0,r=y,y=x,x=h(v,10),v=g,g=w,w=C+e[t+W[n]]|0,w+=n<16?I(B,G,_)+R[0]:n<32?f(B,G,_)+R[1]:n<48?m(B,G,_)+R[2]:n<64?p(B,G,_)+R[3]:b(B,G,_)+R[4],w=(w=h(w|=0,Z[n]))+A|0,C=A,A=_,_=h(G,10),G=B,B=w;w=F[1]+v+_|0,F[1]=F[2]+x+A|0,F[2]=F[3]+y+C|0,F[3]=F[4]+r+B|0,F[4]=F[0]+g+G|0,F[0]=w},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,r=o.words,a=0;a<5;a++){var l=r[a];r[a]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function b(e,t,n){return e^t^n}function p(e,t,n){return e&t|~e&n}function m(e,t,n){return(e|~t)^n}function f(e,t,n){return e&n|t&~n}function I(e,t,n){return e^(t|~n)}function h(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(g),t.HmacRIPEMD160=o._createHmacHelper(g)}(),e.RIPEMD160}(eo())),So(),Ho||(Ho=1,Uo.exports=function(e){return i=(n=(t=e).lib).Base,o=n.WordArray,a=(r=t.algo).SHA256,l=r.HMAC,s=r.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=l.create(n.hasher,e),r=o.create(),a=o.create([1]),s=r.words,c=a.words,u=n.keySize,d=n.iterations;s.length<u;){var g=i.update(t).finalize(a);i.reset();for(var b=g.words,p=b.length,m=g,f=1;f<d;f++){m=i.finalize(m),i.reset();for(var I=m.words,h=0;h<p;h++)b[h]^=I[h]}r.concat(g),c[0]++}return r.sigBytes=4*u,r}}),t.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},e.PBKDF2;var t,n,i,o,r,a,l,s}(eo(),_o(),So())),Oo(),To(),Ko(),er(),ir(),ar(),lr||(lr=1,sr.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(eo(),To())),cr||(cr=1,ur.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,i=4*t,o=i-n%i,r=n+o-1;e.clamp(),e.words[r>>>2]|=o<<24-r%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(eo(),To())),dr||(dr=1,gr.exports=function(e){return e.pad.Iso10126={pad:function(t,n){var i=4*n,o=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(eo(),To())),br||(br=1,pr.exports=function(e){return e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(eo(),To())),mr||(mr=1,fr.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding}(eo(),To())),Ir||(Ir=1,hr.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(eo(),To())),vr||(vr=1,xr.exports=function(e){return n=(t=e).lib.CipherParams,i=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return n.create({ciphertext:t})}},e.format.Hex;var t,n,i}(eo(),To())),yr||(yr=1,Cr.exports=function(e){return function(){var t=e,n=t.lib.BlockCipher,i=t.algo,o=[],r=[],a=[],l=[],s=[],c=[],u=[],d=[],g=[],b=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,o[n]=p,r[p]=n;var m=e[n],f=e[m],I=e[f],h=257*e[p]^16843008*p;a[n]=h<<24|h>>>8,l[n]=h<<16|h>>>16,s[n]=h<<8|h>>>24,c[n]=h,h=16843009*I^65537*f^257*m^16843008*n,u[p]=h<<24|h>>>8,d[p]=h<<16|h>>>16,g[p]=h<<8|h>>>24,b[p]=h,n?(n=m^e[e[e[I^m]]],i^=e[e[i]]):n=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,i=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],a=0;a<i;a++)a<n?r[a]=t[a]:(c=r[a-1],a%n?n>6&&a%n==4&&(c=o[c>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c]):(c=o[(c=c<<8|c>>>24)>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c],c^=p[a/n|0]<<24),r[a]=r[a-n]^c);for(var l=this._invKeySchedule=[],s=0;s<i;s++){if(a=i-s,s%4)var c=r[a];else c=r[a-4];l[s]=s<4||a<=4?c:u[o[c>>>24]]^d[o[c>>>16&255]]^g[o[c>>>8&255]]^b[o[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,l,s,c,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,g,b,r),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,o,r,a,l){for(var s=this._nRounds,c=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],g=e[t+3]^n[3],b=4,p=1;p<s;p++){var m=i[c>>>24]^o[u>>>16&255]^r[d>>>8&255]^a[255&g]^n[b++],f=i[u>>>24]^o[d>>>16&255]^r[g>>>8&255]^a[255&c]^n[b++],I=i[d>>>24]^o[g>>>16&255]^r[c>>>8&255]^a[255&u]^n[b++],h=i[g>>>24]^o[c>>>16&255]^r[u>>>8&255]^a[255&d]^n[b++];c=m,u=f,d=I,g=h}m=(l[c>>>24]<<24|l[u>>>16&255]<<16|l[d>>>8&255]<<8|l[255&g])^n[b++],f=(l[u>>>24]<<24|l[d>>>16&255]<<16|l[g>>>8&255]<<8|l[255&c])^n[b++],I=(l[d>>>24]<<24|l[g>>>16&255]<<16|l[c>>>8&255]<<8|l[255&u])^n[b++],h=(l[g>>>24]<<24|l[c>>>16&255]<<16|l[u>>>8&255]<<8|l[255&d])^n[b++],e[t]=m,e[t+1]=f,e[t+2]=I,e[t+3]=h},keySize:8});t.AES=n._createHelper(m)}(),e.AES}(eo(),bo(),vo(),Oo(),To())),_r(),Ar||(Ar=1,wr.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,i=t.algo,o=i.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,i=this._S=[],o=0;o<256;o++)i[o]=o;o=0;for(var r=0;o<256;o++){var a=o%n,l=t[a>>>2]>>>24-a%4*8&255;r=(r+i[o]+l)%256;var s=i[o];i[o]=i[r],i[r]=s}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var e=this._S,t=this._i,n=this._j,i=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var r=e[t];e[t]=e[n],e[n]=r,i|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,i}t.RC4=n._createHelper(o);var a=i.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)r.call(this)}});t.RC4Drop=n._createHelper(a)}(),e.RC4}(eo(),bo(),vo(),Oo(),To())),Fr||(Fr=1,Xr.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,i=t.algo,o=[],r=[],a=[],l=i.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)s.call(this);for(n=0;n<8;n++)o[n]^=i[n+4&7];if(t){var r=t.words,a=r[0],l=r[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),d=c>>>16|4294901760&u,g=u<<16|65535&c;for(o[0]^=c,o[1]^=d,o[2]^=u,o[3]^=g,o[4]^=c,o[5]^=d,o[6]^=u,o[7]^=g,n=0;n<4;n++)s.call(this)}},_doProcessBlock:function(e,t){var n=this._X;s.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)o[i]=16711935&(o[i]<<8|o[i]>>>24)|4278255360&(o[i]<<24|o[i]>>>8),e[t+i]^=o[i]},blockSize:4,ivSize:2});function s(){for(var e=this._X,t=this._C,n=0;n<8;n++)r[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<r[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<r[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<r[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<r[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<r[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<r[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<r[6]>>>0?1:0)|0,this._b=t[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],o=65535&i,l=i>>>16,s=((o*o>>>17)+o*l>>>15)+l*l,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[n]=s^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=n._createHelper(l)}(),e.Rabbit}(eo(),bo(),vo(),Oo(),To())),Rr||(Rr=1,Qr.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,i=t.algo,o=[],r=[],a=[],l=i.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)s.call(this);for(o=0;o<8;o++)i[o]^=n[o+4&7];if(t){var r=t.words,a=r[0],l=r[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),d=c>>>16|4294901760&u,g=u<<16|65535&c;for(i[0]^=c,i[1]^=d,i[2]^=u,i[3]^=g,i[4]^=c,i[5]^=d,i[6]^=u,i[7]^=g,o=0;o<4;o++)s.call(this)}},_doProcessBlock:function(e,t){var n=this._X;s.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)o[i]=16711935&(o[i]<<8|o[i]>>>24)|4278255360&(o[i]<<24|o[i]>>>8),e[t+i]^=o[i]},blockSize:4,ivSize:2});function s(){for(var e=this._X,t=this._C,n=0;n<8;n++)r[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<r[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<r[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<r[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<r[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<r[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<r[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<r[6]>>>0?1:0)|0,this._b=t[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],o=65535&i,l=i>>>16,s=((o*o>>>17)+o*l>>>15)+l*l,c=((4294901760&i)*i|0)+((65535&i)*i|0);a[n]=s^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=n._createHelper(l)}(),e.RabbitLegacy}(eo(),bo(),vo(),Oo(),To())),Zr())),Ki.exports),Lr=r(Vr);function Dr(e,t){var n=Lr.enc.Base64.parse(t);if(32!==n.sigBytes)throw new Error("Invalid key length: ".concat(n.sigBytes,". Expected 32 bytes."));var i=Lr.lib.WordArray.random(16),o=Lr.AES.encrypt(e,n,{iv:i,mode:Lr.mode.CBC,padding:Lr.pad.Pkcs7}),r=Lr.enc.Base64.stringify(i),a=Lr.enc.Base64.stringify(o.ciphertext),l={iv:r,value:a,mac:Lr.HmacSHA256(r+a,n).toString(Lr.enc.Hex)},s=JSON.stringify(l);return Lr.enc.Base64.stringify(Lr.enc.Utf8.parse(s))}var Yr=function(e){return f(void 0,[e],void 0,(function(e){var t,n,i,o,r,a,l,s,c=e.apiEndpoint,u=e.timestamp,d=e.requestType,g=e.apiKey,b=e.saltKey;return I(this,(function(e){switch(e.label){case 0:return t="/".concat(c),n=u,i=null==d?void 0:d.toUpperCase(),o=g&&(null==g?void 0:g.split(".")[0]),[4,Dr(u,o)];case 1:return r=e.sent(),a=Lr.HmacSHA256(n,b),l=Lr.HmacSHA256(t,a),s=Lr.HmacSHA256(i,l),[2,"".concat(s.toString(Lr.enc.Hex),".").concat(r)]}}))}))},Sr=function(e){return f(void 0,[e],void 0,(function(e){var t,n,i,o,r,a=e.url,l=e.body,s=e.headers,c=e.method,u=e.apikey,d=e.saltKey,g=e.onError,b=e.onSuccess;return I(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),t={method:c||"GET"},[4,Yr({apiEndpoint:a.substring(a.lastIndexOf("/")+1),timestamp:Math.floor(Date.now()/1e3).toString(),requestType:(null==c?void 0:c.toUpperCase())||"GET",apiKey:u,saltKey:d})];case 1:return n=e.sent(),s&&(t=m(m({},t),{headers:m(m({},s),{"x-api-signature":n})})),l&&(t=m(m({},t),{body:l})),[4,fetch(a,t)];case 2:return[4,null==(i=e.sent())?void 0:i.json()];case 3:return o=e.sent(),[2,b(o)];case 4:return r=e.sent(),[2,g(r)];case 5:return[2]}}))}))},Hr=function(t){var n,i,o=t.setSandboxStep,r=t.data,a=t.setSandboxData,l=t.callback,s=t.apiKey,c=t.clientReferenceID,u=C().addToast,d=e.useState(!1),g=d[0],f=d[1];return b.jsxs("div",{className:p.details_frame,children:[b.jsxs("div",{className:p.avater_head,children:[b.jsx("img",{src:window.location.origin+"/img/bannk.png"}),b.jsx("div",{className:p.f_details_titles,children:"Overview Details"})]}),b.jsxs("div",{className:p.f_details_info_box,children:[b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"You pay"}),b.jsxs("span",{children:[null==r?void 0:r.from_amount," ",null==r?void 0:r.selectedFiat]})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Rate"}),b.jsxs("span",{children:["1 ",null==r?void 0:r.selectedFiat," =",null===(n=parseFloat(null==r?void 0:r.exchangeRateForThisUser))||void 0===n?void 0:n.toFixed(8)," ",null==r?void 0:r.selectedCrypto," ",(null==r?void 0:r.network_type)?"(".concat(null==r?void 0:r.network_type,")"):""]})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"You Receive"}),b.jsxs("span",{children:[null===(i=parseFloat(null==r?void 0:r.userReceivableCryptoValue))||void 0===i?void 0:i.toFixed(8)," ",null==r?void 0:r.selectedCrypto," ",(null==r?void 0:r.network_type)?"(".concat(null==r?void 0:r.network_type,")"):""]})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Transaction Ref ID"}),b.jsx("span",{children:null==r?void 0:r.transaction_ref_id})]})]}),b.jsx("div",{className:p.onRampAction,children:b.jsxs("button",{type:"button",onClick:function(){var e,t;f(!0);var n={status:"failed",message:"Error while Buying Tokens",data:{transaction_id:null===(t=null===(e=null==r?void 0:r.apiResponse)||void 0===e?void 0:e.onramp_transaction)||void 0===t?void 0:t.unique_id,from_currency:(null==r?void 0:r.selectedFiat)||"",to_currency:(null==r?void 0:r.selectedCrypto)||"",network_type:(null==r?void 0:r.network_type)||"",from_value:null==r?void 0:r.from_amount,to_value:null==r?void 0:r.userReceivableCryptoValue,wallet_address:null==r?void 0:r.wallet_address,exchange_rate:null==r?void 0:r.exchangeRateForThisUser}};Sr({url:"https://herald-retail-api-qa.heraldex.com/api/v1/gateway/onramp",method:"POST",headers:{"Content-Type":"application/json","X-API-KEY":s},apikey:s,saltKey:c,body:JSON.stringify({payment_id:null==r?void 0:r.transaction_ref_id,admin_bank_account_id:1,from_amount:null==r?void 0:r.from_amount,from_token:null==r?void 0:r.selectedFiat,to_token:null==r?void 0:r.selectedCrypto,to_network:(null==r?void 0:r.network_type)||"",exchange_rate:null==r?void 0:r.exchangeRateForThisUser}),onSuccess:function(e){(null==e?void 0:e.success)?(n=m(m({},n),{message:null==r?void 0:r.message,status:"success"}),a(m(m({},r),{transactionDetails:null==e?void 0:e.data,callBackData:n})),u("".concat(null==e?void 0:e.message),"success"),l(n),o(3)):(n=m(m({},n),{message:(null==r?void 0:r.message)||"Error in Buy Tokens"}),a(m(m({},r),{transactionDetails:null==e?void 0:e.data,callBackData:n})),u("".concat(null==e?void 0:e.message),"error"),l(n)),f(!1)},onError:function(e){u("".concat(e),"error"),f(!1),n=m(m({},n),{message:(null==e?void 0:e.message)||"Error in Buy Tokens"}),l(n)}})},className:"".concat(p.actionBtn," ").concat(p.primary),children:["Confirm ",g&&b.jsx(ji,{})]})})]})},Ur=function(t){var n,i,o,r,a,l,s=t.data,c=t.redirect,u=t.redirectUrl,d=e.useState(4),g=d[0],m=d[1];return e.useEffect((function(){if(c){var e=setInterval((function(){m((function(t){var n,i,o;if(t<=0){clearInterval(e);var r=u+"?transaction_id=".concat(null===(i=null===(n=null==s?void 0:s.callBackData)||void 0===n?void 0:n.data)||void 0===i?void 0:i.transaction_id,"&status=").concat(null===(o=null==s?void 0:s.callBackData)||void 0===o?void 0:o.status);return c&&(window.location.href=r),0}return t-1}))}),1e3);return function(){return clearInterval(e)}}}),[]),b.jsxs("div",{className:p.details_frame,children:[b.jsxs("div",{className:p.avater_head,children:[b.jsx("img",{src:window.location.origin+"/img/swap-modal.png"}),b.jsxs("div",{className:p.f_details_titles,children:["Buy ",(null===(n=null==s?void 0:s.transactionDetails)||void 0===n?void 0:n.from_amount_formatted)||"0"," @"," ",(null===(i=null==s?void 0:s.transactionDetails)||void 0===i?void 0:i.to_amount_formatted)||"0"," ",(null==s?void 0:s.network_type)?"(".concat(null==s?void 0:s.network_type,")"):""]})]}),b.jsxs("div",{className:p.f_details_info_box,children:[b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Order Status"}),b.jsx("span",{children:null===(o=null==s?void 0:s.transactionDetails)||void 0===o?void 0:o.status_formatted})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Order Id"}),b.jsx("span",{children:null===(r=null==s?void 0:s.transactionDetails)||void 0===r?void 0:r.order_id})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Order Date"}),b.jsx("span",{children:null===(a=null==s?void 0:s.transactionDetails)||void 0===a?void 0:a.created_at_formatted})]}),b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:"Exchange Rate"}),b.jsxs("span",{children:[null===(l=null==s?void 0:s.transactionDetails)||void 0===l?void 0:l.exchange_rate_formatted," ",(null==s?void 0:s.network_type)?"(".concat(null==s?void 0:s.network_type,")"):""]})]}),c&&b.jsx("div",{className:p.f_details_card,children:b.jsxs("span",{children:["Redirecting in ",g," "]})})]})]})},Jr=function(e){return e.replace(/([A-Z])/g," $1").replace(/^./,(function(e){return e.toUpperCase()}))},Er=function(t){var n=t.setSandboxStep,i=t.setSandboxData,o=t.data,r=t.apiKey,a=t.clientReferenceID,l=C().addToast,s=e.useState({transaction_ref_id:null==o?void 0:o.transaction_ref_id}),c=s[0],u=s[1],d=e.useState({}),g=d[0],f=d[1],I=e.useState({}),h=I[0],v=I[1],x=e.useState(""),y=x[0],B=x[1],G=function(e){return e?/^[A-Za-z0-9]{8,20}$/.test(e)?"":"Must be 8-20 alphanumeric characters":"Transaction ID is required"};e.useEffect((function(){Sr({url:"https://herald-retail-api-qa.heraldex.com/api/v1/gateway/get_admin_accounts",method:"POST",headers:{"Content-Type":"application/json","X-API-KEY":r},apikey:r,saltKey:a,body:JSON.stringify({currency_type:null==o?void 0:o.selectedFiat}),onSuccess:function(e){var t,n,i,r,a,l,s,c,u,d,g,b;(null==e?void 0:e.success)&&("EUR"===(null==o?void 0:o.selectedFiat)?v({bankName:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.bank_name,accountNumber:null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.account_number,IBAN:null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.iban,accountHolderName:null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.account_holder_name,accountType:null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.account_type,ReferenceNumber:null===(l=null==e?void 0:e.data)||void 0===l?void 0:l.reference_number}):"USD"===(null==o?void 0:o.selectedFiat)&&f({bankName:null===(s=null==e?void 0:e.data)||void 0===s?void 0:s.bank_name,accountNumber:null===(c=null==e?void 0:e.data)||void 0===c?void 0:c.account_number,swiftBic:null===(u=null==e?void 0:e.data)||void 0===u?void 0:u.swift_bic,accountHolderName:null===(d=null==e?void 0:e.data)||void 0===d?void 0:d.account_holder_name,accountType:null===(g=null==e?void 0:e.data)||void 0===g?void 0:g.account_type,ReferenceNumber:null===(b=null==e?void 0:e.data)||void 0===b?void 0:b.reference_number}))},onError:function(){l("Error fetching comission","error")}})}),[]);return b.jsxs("div",{className:p.details_frame,children:[b.jsxs("div",{className:p.avater_head,children:[b.jsx("img",{src:window.location.origin+"/img/bannk.png"}),b.jsx("div",{className:p.f_details_titles,children:"Bank Details"})]}),b.jsx("div",{className:p.f_details_info_box,children:Object.entries("EUR"===(null==o?void 0:o.selectedFiat)?h:"USD"===(null==o?void 0:o.selectedFiat)?g:{}).map((function(e){var t=e[0],n=e[1];return b.jsxs("div",{className:p.f_details_card,children:[b.jsx("span",{children:Jr(t)}),b.jsx("span",{children:n})]},t)}))}),b.jsxs("div",{className:p.onRampNewBankLabel,children:["Transaction Reference ID ",b.jsx("span",{className:p.required,children:"*"})]})," ",b.jsxs("div",{className:p.onRampNewBankFields,children:[b.jsx("input",{type:"text",placeholder:"Enter Transaction Reference ID",value:c.transaction_ref_id,onChange:function(e){var t=e.target.value;u(m(m({},c),{transaction_ref_id:t})),B(G(t))},className:p.inputControl}),y&&b.jsx("span",{className:p.error,children:y})]}),b.jsx("div",{className:p.onRampAction,children:b.jsx("button",{type:"button",onClick:function(e){return function(e){e.preventDefault();var t=G(c.transaction_ref_id);t?B(t):(i(m(m({},o),{transaction_ref_id:c.transaction_ref_id})),n(2))}(e)},className:"".concat(p.actionBtn," ").concat(p.primary),disabled:!c.transaction_ref_id,children:"Confirm"})})]})},Or=function(t){var n=t.data,i=t.apiKey,o=t.clientReferenceID,r=t.setSandboxData,a=t.callback,l=t.redirect,s=t.redirectUrl,c=t.setBuyStep,u=e.useState(1),d=u[0],g=u[1];return b.jsxs("div",{children:[3!==d&&b.jsxs("div",{className:p.on_ramp_bank_head,onClick:function(){return 1===d?c(1):g(d-1)},children:[b.jsx("div",{children:b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",fill:"#0000",children:b.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),b.jsx("div",{className:p.on_bank_titles,children:"Back"})]}),1===d&&b.jsx(Er,{setSandboxStep:g,data:n,setSandboxData:r,apiKey:i,clientReferenceID:o}),2===d&&b.jsx(Hr,{apiKey:i,clientReferenceID:o,data:n,setSandboxStep:g,setSandboxData:r,callback:a}),3===d&&b.jsxs(b.Fragment,{children:[" ",b.jsx(Ur,{data:n,redirect:l,redirectUrl:s}),b.jsx("div",{className:p.onRampAction,children:b.jsxs("button",{type:"button",onClick:function(){return c(1),r({})},className:"".concat(p.actionBtn," ").concat(p.primary),children:[b.jsx("div",{children:b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"15",height:"15",viewBox:"0 0 240.823 240.823",fill:"#000000",children:b.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),"Create New Transaction"]})})]})]})},Mr=function(t){var n,i,o,r=t.apiKey,a=t.redirectUrl,l=t.parameters,s=t.clientReferenceID,c=t.mode,u=t.callback,d=t.redirect,g=C().addToast,h=e.useState(!1),v=h[0],x=h[1],y=e.useState([]),B=y[0],G=y[1],_=e.useState([]),A=_[0],w=_[1],F=e.useState(null),X=F[0],R=F[1],Q=e.useState(null),W=Q[0],N=Q[1],Z=e.useState(0),k=Z[0],V=Z[1],L=e.useState(0);L[0],L[1];var D=e.useState(null),Y=D[0],S=D[1],H=e.useState(null),U=H[0],J=H[1],E=e.useState({min:!1,max:!1}),O=E[0],M=E[1],z=e.useState(0),T=z[0],j=z[1],P=e.useState(!0),K=P[0],q=P[1],$=e.useState(1),ee=$[0],te=$[1],ne=e.useState(),ie=ne[0],oe=ne[1],re=e.useState(""),ae=re[0],le=re[1],se=e.useState({from_amount:(null==l?void 0:l.from_amount)&&parseFloat(null==l?void 0:l.from_amount)>0?l.from_amount:"0",selectedCrypto:(null==l?void 0:l.token_type)||"",selectedFiat:"",minAmount:"0.0000001",maxAmount:"1000.00000"}),ce=se[0],ue=se[1],de=e.useState(null),ge=de[0],be=de[1];e.useEffect((function(){pe(),me()}),[]);var pe=function(){Sr({url:"https://herald-retail-api-qa.heraldex.com/api/v1/gateway/get_currencies",headers:{"Content-Type":"application/json","X-API-KEY":r},method:"GET",apikey:r,saltKey:s,onSuccess:function(e){(null==e?void 0:e.success)&&J(null==e?void 0:e.data)},onError:function(){g("Error fetching currency","error")}})},me=function(){Sr({url:"https://herald-retail-api-qa.heraldex.com/api/lookup/commissions",headers:{"Content-Type":"application/json","X-API-KEY":r},method:"GET",apikey:r,saltKey:s,onSuccess:function(e){var t,n,i,o;if(null==e?void 0:e.success){var r=(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.rules)||void 0===n?void 0:n.find((function(e){return"onramp"===(null==e?void 0:e.service)})))||null;S(r),r&&ue(m(m({},ce),{minAmount:null===(i=null==r?void 0:r.schema)||void 0===i?void 0:i.min,maxAmount:null===(o=null==r?void 0:r.schema)||void 0===o?void 0:o.max}))}},onError:function(){g("Error fetching comission","error")}})};e.useEffect((function(){var e,t,n,i,o,r,a,s,c;if(U){var u=null===(t=null===(e=null==U?void 0:U.supported_currency)||void 0===e?void 0:e.filter((function(e){return"FOREX"===(null==e?void 0:e.type)})))||void 0===t?void 0:t.map((function(e){return{label:null==e?void 0:e.name,value:null==e?void 0:e.name,icon:null==e?void 0:e.icon}}));G(u);var d=(null==ce?void 0:ce.selectedFiat)?(null==U?void 0:U.supported_currency.find((function(e){return(null==e?void 0:e.name)===(null==ce?void 0:ce.selectedFiat)})))||(null===(n=null==U?void 0:U.supported_currency)||void 0===n?void 0:n.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==u?void 0:u[0])||void 0===t?void 0:t.label)}))):null===(i=null==U?void 0:U.supported_currency)||void 0===i?void 0:i.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==u?void 0:u[0])||void 0===t?void 0:t.label)})),g=ce.selectedFiat&&u.find((function(e){return e.label===ce.selectedFiat}))||(null==u?void 0:u[0]);N(g);var b=(null===(r=null===(o=null==U?void 0:U.supported_currency)||void 0===o?void 0:o.filter((function(e){return"CRYPTO"===(null==e?void 0:e.type)})))||void 0===r?void 0:r.map((function(e){return{label:null==e?void 0:e.name,value:null==e?void 0:e.name,icon:null==e?void 0:e.icon}})))||[];w(b);var p=(null==l?void 0:l.token_type)?(null===(a=null==U?void 0:U.supported_currency)||void 0===a?void 0:a.find((function(e){return(null==e?void 0:e.name)===(null==l?void 0:l.token_type)})))||(null===(s=null==U?void 0:U.supported_currency)||void 0===s?void 0:s.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==b?void 0:b[0])||void 0===t?void 0:t.label)}))):null===(c=null==U?void 0:U.supported_currency)||void 0===c?void 0:c.find((function(e){var t;return(null==e?void 0:e.name)===(null===(t=null==b?void 0:b[0])||void 0===t?void 0:t.label)}));R((null==l?void 0:l.token_type)?b.find((function(e){return e.label===(null==l?void 0:l.token_type)}))||(null==b?void 0:b[0]):(null==b?void 0:b[0])||[]),ue((function(e){return m(m({},e),{selectedCrypto:(null==p?void 0:p.name)||"",selectedFiat:(null==d?void 0:d.name)||""})}))}}),[U]);e.useEffect((function(){var e=setTimeout((function(){W&&X&&fe()}),300);return function(){return clearTimeout(e)}}),[W,X,ce]);var fe=function(){return f(void 0,void 0,void 0,(function(){var e;return I(this,(function(t){switch(t.label){case 0:if(q(!0),V(0),j(0),!("string"==typeof ce.from_amount?parseFloat(null==ce?void 0:ce.from_amount)>0:ce.from_amount>0))return[3,6];t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,fetch("https://herald-retail-api-qa.heraldex.com/api/v1/exchange_rates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:null==ce?void 0:ce.from_amount,from_currency:(null==ce?void 0:ce.selectedFiat)||(null==W?void 0:W.label),to_currency:(null==ce?void 0:ce.selectedCrypto)||(null==X?void 0:X.label),side:"buy"})}).then((function(e){return e.json()})).then((function(e){if(Object.keys(e.data).length>0){var t=e.data,n=(null==ce?void 0:ce.selectedFiat)||(null==W?void 0:W.label),i=(null==ce?void 0:ce.selectedCrypto)||(null==X?void 0:X.label),o=["USDT","USDC"].includes(i)&&"USD"==n?1/Number(null==t?void 0:t.exchange_rate):Number(null==t?void 0:t.exchange_rate);V(o),j(Number(o)*Number(null==ce?void 0:ce.from_amount))}else g(null==e?void 0:e.message,"error")})).catch((function(e){g(e,"error")}))];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),g(e,"error"),[3,5];case 4:return q(!1),[7];case 5:return[3,7];case 6:g("Please enter valid amount","error"),q(!1),t.label=7;case 7:return[2]}}))}))};e.useEffect((function(){M({min:parseFloat(ce.from_amount)<parseFloat(ce.minAmount)||""===ce.from_amount||parseFloat(ce.from_amount)<=0,max:parseFloat(ce.from_amount)>parseFloat(ce.maxAmount)})}),[k,ce]);return b.jsx(b.Fragment,{children:1===ee?b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:p.onRampFieldCard,children:[b.jsxs("div",{className:p.onRampFieldBox,children:[b.jsx("div",{className:p.onRampFieldLabel,children:"You Pay"}),b.jsxs("div",{className:p.onRampFieldForm,children:[b.jsx("input",{type:"text",value:null==ce?void 0:ce.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(Y&&!function(e,t){if(!/^\d*\.?\d*$/.test(e))return!1;var n=e.split(".");return 2!==n.length||n[1].length<=t}(e,null===(t=null==Y?void 0:Y.schema)||void 0===t?void 0:t.decimal))return void g("You can input upto ".concat(null===(n=null==Y?void 0:Y.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?ue(m(m({},ce),{from_amount:""})):isNaN(Number(e))||ue(m(m({},ce),{from_amount:e}))}else""===e?ue(m(m({},ce),{from_amount:""})):isNaN(Number(e))||ue(m(m({},ce),{from_amount:e}))}(e.target.value)},className:p.inputControl}),(null==O?void 0:O.min)&&b.jsxs("p",{className:p.errorMsg,children:["Invalid, Min : ",null===(n=parseFloat(null==ce?void 0:ce.minAmount))||void 0===n?void 0:n.toFixed(8)]}),(null==O?void 0:O.max)&&b.jsxs("p",{className:p.errorMsg,children:["Invalid, Max : ",null===(i=parseFloat(null==ce?void 0:ce.maxAmount))||void 0===i?void 0:i.toString()]})]})]}),b.jsx("div",{className:p.onRampFieldSelectCard,children:b.jsx("div",{className:p.onRampFieldSelect,children:(null==B?void 0:B.length)>0?b.jsx(zi,{backgroundColor:"#ffffff70",borderColor:"#efefef",placeholder:"Select an option",image:!1,singleicons:!0,options:B,isSearchable:!1,value:W||(null==B?void 0:B.find((function(e){return e.value===(null==ce?void 0:ce.selectedFiat)}))),onChange:function(e){return function(e){var t,n=null===(t=null==U?void 0:U.supported_currency)||void 0===t?void 0:t.find((function(t){return t.name===(null==e?void 0:e.value)}));ue(m(m({},ce),{selectedFiat:(null==n?void 0:n.name)||""})),N(e)}(e)},isDisabled:K}):b.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:b.jsx(Ti,{})})})})]}),b.jsxs("div",{className:p.onRampInfoBox,children:[b.jsxs("div",{className:"".concat(p.onRampLabelCard," ").concat(p.onRampSpace),children:[b.jsx("div",{className:p.onRampLabelIcons,children:b.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",fill:"var( --on-black-white)",children:[b.jsx("path",{d:"M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5","data-original":"#000000"}),b.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),b.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),b.jsxs("div",{className:p.onRampLabelValue,children:[b.jsx("span",{style:{marginRight:10},children:"Rate :"}),K?b.jsx(Pi,{}):"1\n ".concat((null==W?void 0:W.label)||"N/A","\n = ").concat(k>0?null===(o=Number(k))||void 0===o?void 0:o.toFixed(8):0," ").concat(null==X?void 0:X.label)]})]}),b.jsxs("div",{className:p.onRampSpaceTop,children:[b.jsx("div",{className:p.onRampLabelDots}),b.jsxs("div",{className:p.onRampDetails,children:[b.jsx("div",{className:p.onRampHead,children:"Payment Method"}),b.jsx("div",{className:p.offPaymentBox,children:b.jsxs("div",{className:p.offPaymentCheckCard,children:[b.jsx("div",{children:"Bank Payment"}),b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 408.576 408.576",children:b.jsx("g",{children:b.jsx("path",{d:"M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z",fill:"#494949"})})})]})})]})]})]}),b.jsxs("div",{className:p.onRampFieldCard,children:[b.jsxs("div",{className:p.onRampFieldBox,children:[b.jsx("div",{className:p.onRampFieldLabel,children:"You Receive (estimate)"}),b.jsx("div",{className:p.onRampFieldForm,children:K?b.jsx(Pi,{size:20}):b.jsx("input",{type:"text",value:(null==O?void 0:O.min)||(null==O?void 0:O.max)?0:Number(T).toFixed(8)||0,className:p.inputControl,disabled:!0})})]}),b.jsx("div",{className:p.onRampFieldSelectCard,children:b.jsx("div",{className:p.onRampFieldSelect,children:(null==A?void 0:A.length)>0?b.jsx(zi,{backgroundColor:"#ffffff70",borderColor:"#efefef",placeholder:"Select",image:!1,singleicons:!0,options:A,isSearchable:!1,value:X,onChange:function(e){e&&(V(0),le(""),function(e){var t,n=null===(t=null==U?void 0:U.supported_currency)||void 0===t?void 0:t.find((function(t){return(null==t?void 0:t.name)===e.value}));ue(m(m({},ce),{selectedCrypto:(null==n?void 0:n.name)||""})),R(e)}(e),be(m(m({},ge),{wallet_address:""})))},isDisabled:K}):b.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:b.jsx(Ti,{})})})})]}),b.jsx("div",{className:p.onRampAction,children:b.jsxs("button",{disabled:k<=0||K||v,className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(){return f(void 0,void 0,void 0,(function(){return I(this,(function(e){return oe(""),x(!1),be(m(m({},ce),{userReceivableCryptoValue:T,exchangeRateForThisUser:k,wallet_address:ae})),te(2),[2]}))}))},children:["Continue ",v&&b.jsx(ji,{})]})})]}):b.jsx(b.Fragment,{children:"development"===c?b.jsx(Or,{apiKey:r,clientReferenceID:s,data:ge,setSandboxData:be,callback:u,redirect:d,redirectUrl:a,setBuyStep:te}):b.jsx("iframe",{title:"Buy Crypto",id:"chat-widget",src:ie,style:{width:"100%",minHeight:"calc(100vh - 400px)",border:"none",zIndex:"9999",overflow:"auto"}})})})};exports.BuyCryptoWidget=function(e){var t=e.apiKey,n=e.redirectUrl,i=e.buyParameters,o=e.clientReferenceID,r=e.mode,a=void 0===r?"development":r,l=e.callback,s=e.redirect;return b.jsx("div",{className:p.widgetComponent,id:"widget-container",children:b.jsx(y,{children:b.jsx(Mr,{apiKey:t,parameters:i,clientReferenceID:o,mode:a,callback:l,redirect:s,redirectUrl:n})})})};
|
|
36
36
|
//# sourceMappingURL=index.js.map
|