@depay/widgets 7.14.2 → 7.14.3

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  You can either load the `@depay/widgets` package via CDN:
4
4
 
5
5
  ```
6
- <script src="https://integrate.depay.fi/widgets/v7.js"></script>
6
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"></script>
7
7
  ```
8
8
 
9
9
  or you install `@depay/widgets` via the package manager of your choice and ship it as part of your application bundle:
@@ -74,7 +74,7 @@ In order to receive decentralized payments on any blockchain you need to have yo
74
74
  ### Quick start (DePay Payments)
75
75
 
76
76
  ```
77
- <script src="https://integrate.depay.fi/widgets/v7.js"/>
77
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"/>
78
78
  ```
79
79
 
80
80
  ```
@@ -818,7 +818,7 @@ In order to sell tokens in a decentralized way, that token needs to have a liqui
818
818
  ### Quick start (DePay Sales)
819
819
 
820
820
  ```
821
- <script src="https://integrate.depay.fi/widgets/v7.js"/>
821
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"/>
822
822
  ```
823
823
 
824
824
  ```javascript
@@ -1216,7 +1216,7 @@ In order to receive decentralized donation payments on any blockchain you need t
1216
1216
  ### Quick start (DePay Donations)
1217
1217
 
1218
1218
  ```
1219
- <script src="https://integrate.depay.fi/widgets/v7.js"/>
1219
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"/>
1220
1220
  ```
1221
1221
 
1222
1222
  ```javascript
@@ -1642,7 +1642,7 @@ DePay Connect allows you to have your users connect their crypto wallet to your
1642
1642
  Returns connected `account`, `accounts` and `wallet` in return.
1643
1643
 
1644
1644
  ```
1645
- <script src="https://integrate.depay.fi/widgets/v7.js"/>
1645
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"/>
1646
1646
  ```
1647
1647
 
1648
1648
  ```javascript
@@ -1670,7 +1670,7 @@ DePay Login allows you to perform web3 wallet logins with ease.
1670
1670
  Returns `account` if succesfully signed and recovered log in message.
1671
1671
 
1672
1672
  ```
1673
- <script src="https://integrate.depay.fi/widgets/v7.js"/>
1673
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"/>
1674
1674
  ```
1675
1675
 
1676
1676
  ```javascript
@@ -1747,7 +1747,7 @@ DePay Select widget allows you to open a dialog that allows you to select things
1747
1747
  Resolves with what has been selected by the user:
1748
1748
 
1749
1749
  ```
1750
- <script src="https://integrate.depay.fi/widgets/v7.js"/>
1750
+ <script defer async src="https://integrate.depay.fi/widgets/v7.js"/>
1751
1751
  ```
1752
1752
 
1753
1753
  ```javascript
@@ -1764,6 +1764,44 @@ let token = await DePayWidgets.Select({ what: 'token' })
1764
1764
  // }
1765
1765
  ```
1766
1766
 
1767
+ ## Examples
1768
+
1769
+ ### React
1770
+
1771
+ #### DePay Payments
1772
+
1773
+ ```javascript
1774
+
1775
+ import React from 'react'
1776
+ import DePayWidgets from '@depay/widgets'
1777
+
1778
+ export default (props)=>{
1779
+
1780
+ let unmount
1781
+
1782
+ const openPaymentWidget = ()=>{
1783
+ (
1784
+ { unmount } = DePayWidgets.Payment({...})
1785
+ )
1786
+ }
1787
+
1788
+ useEffect(() => {
1789
+ return ()=>{
1790
+ // make sure an open widgets gets closed/unmounted as part of this component
1791
+ if(unmount) { unmount() }
1792
+ }
1793
+ }, [])
1794
+
1795
+ return(
1796
+ <button onClick={ openPaymentWidget } type="button">
1797
+ Pay
1798
+ </button>
1799
+ )
1800
+ }
1801
+
1802
+ ```
1803
+
1804
+
1767
1805
  ## Development
1768
1806
 
1769
1807
  ### Quick start