@depay/widgets 8.1.0 → 9.0.1
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 +14 -18
- package/dist/esm/index.bundle.js +16 -24
- package/dist/esm/index.js +860 -708
- package/dist/umd/index.bundle.js +16 -24
- package/dist/umd/index.js +860 -708
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -22,6 +22,18 @@ and load the DePayWidgets package wherever you need it:
|
|
|
22
22
|
import DePayWidgets from '@depay/widgets'
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
Make sure you install DePay widgets peer dependencies, too, in case your project does not have them installed yet:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
yarn add ethers react react-dom
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
npm install ethers react react-dom --save
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Server-side rendering
|
|
36
|
+
|
|
25
37
|
Make sure you load this library as a client-side script for client-side rendering (CSR), in case you are using a server-side rendering (SSR) framework like next.js.
|
|
26
38
|
|
|
27
39
|
Next.js: https://dev.to/elisabethleonhardt/how-to-use-client-side-only-packages-with-ssr-in-gatsby-and-nextjs-3pfa
|
|
@@ -490,7 +502,7 @@ Allows you to stop the payment if this methods returns false.
|
|
|
490
502
|
```javascript
|
|
491
503
|
DePayWidgets.Payment({
|
|
492
504
|
|
|
493
|
-
before: (payment)=> {
|
|
505
|
+
before: async (payment)=> {
|
|
494
506
|
alert('Something went wrong')
|
|
495
507
|
return false // stops payment
|
|
496
508
|
}
|
|
@@ -687,22 +699,6 @@ DePayWidgets.Payment({
|
|
|
687
699
|
})
|
|
688
700
|
```
|
|
689
701
|
|
|
690
|
-
#### event
|
|
691
|
-
|
|
692
|
-
`event`
|
|
693
|
-
|
|
694
|
-
If set to `ifSwapped`, emits a [payment event](https://github.com/depayfi/depay-evm-router#depayrouterv1paymentevent02) if payments are routed through [router smart contract](https://github.com/depayfi/depay-evm-router).
|
|
695
|
-
Payments are routed through the DePayPaymentRouter if swapping tokens is required in order to perform the payment. If payments are not routed through the router, e.g. direct transfer, no event is emited if `event` is set to `ifSwapped`.
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
```javascript
|
|
699
|
-
DePayWidgets.Payment({
|
|
700
|
-
|
|
701
|
-
event: 'ifSwapped'
|
|
702
|
-
|
|
703
|
-
})
|
|
704
|
-
```
|
|
705
|
-
|
|
706
702
|
#### container
|
|
707
703
|
|
|
708
704
|
`container`
|
|
@@ -1974,5 +1970,5 @@ test:cypress:debug
|
|
|
1974
1970
|
Test and debug single cypress file:
|
|
1975
1971
|
|
|
1976
1972
|
```
|
|
1977
|
-
yarn test:cypress:debug --spec "cypress/e2e/Payment/
|
|
1973
|
+
yarn test:cypress:debug --spec "cypress/e2e/Payment/track.js"
|
|
1978
1974
|
```
|