@solidgate/react-sdk 1.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 +94 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Solid react-sdk
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install --save @solidgate/react-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Minimal example
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import React from 'react'
|
|
13
|
+
import ReactDOM from 'react-dom';
|
|
14
|
+
import Payment from "@solidgate/react-sdk"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Configuration, as it described here
|
|
18
|
+
* https://dev.solidgate.com/developers/documentation/solid-payment-form
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const merchantData = {
|
|
22
|
+
merchant: '<<--YOUR MERCHANT ID-->>',
|
|
23
|
+
signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
|
|
24
|
+
paymentIntent: '<<--YOUR PAYMENT INTENT-->>'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const App = () => {
|
|
28
|
+
|
|
29
|
+
const appleContainerRef = useRef(null)
|
|
30
|
+
const googleContainerRef = useRef(null)
|
|
31
|
+
|
|
32
|
+
const handleOnError = (e: SdkMessage[MessageType.Error]) => {}
|
|
33
|
+
|
|
34
|
+
const handleOnFail = (e: SdkMessage[MessageType.Fail]) => {}
|
|
35
|
+
|
|
36
|
+
const handleOnMounted = (e: SdkMessage[MessageType.Mounted]) => {}
|
|
37
|
+
|
|
38
|
+
const handleOrderStatus = (e: SdkMessage[MessageType.OrderStatus]) => {}
|
|
39
|
+
|
|
40
|
+
const handleOnResize = (e: SdkMessage[MessageType.Resize]) => {}
|
|
41
|
+
|
|
42
|
+
const handleOnSuccess = (e: SdkMessage[MessageType.Success]) => {}
|
|
43
|
+
|
|
44
|
+
const handleOnSubmit = (e: SdkMessage[MessageType.Submit]) => {}
|
|
45
|
+
|
|
46
|
+
const handleOnInteraction = (e: SdkMessage[MessageType.Interaction]) => {}
|
|
47
|
+
|
|
48
|
+
const handleOnVerify = (e: SdkMessage[MessageType.Verify]) => {}
|
|
49
|
+
|
|
50
|
+
const handleOnRedirectMessage = (e: SdkMessage[MessageType.Redirect]) => {}
|
|
51
|
+
|
|
52
|
+
const handleOnCustomStylesAppended = (e: SdkMessage[MessageType.CustomStylesAppended]) => {}
|
|
53
|
+
|
|
54
|
+
const handleOnReadyPaymentInstance = (form: ClientSdkInstance) => {
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.log('form', form)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div>
|
|
61
|
+
<div ref={appleContainerRef} />
|
|
62
|
+
<Payment
|
|
63
|
+
googlePayButtonParams={googlePayButtonParams}
|
|
64
|
+
applePayButtonParams={applePayButtonParams}
|
|
65
|
+
googlePayContainerRef={googleContainerRef}
|
|
66
|
+
applePayContainerRef={appleContainerRef}
|
|
67
|
+
merchantData={merchantData}
|
|
68
|
+
styles={customFormStyles}
|
|
69
|
+
formParams={formParams}
|
|
70
|
+
onError={handleOnError}
|
|
71
|
+
onFail={handleOnFail}
|
|
72
|
+
onMounted={handleOnMounted}
|
|
73
|
+
onOrderStatus={handleOrderStatus}
|
|
74
|
+
onResize={handleOnResize}
|
|
75
|
+
onSuccess={handleOnSuccess}
|
|
76
|
+
onSubmit={handleOnSubmit}
|
|
77
|
+
onInteraction={handleOnInteraction}
|
|
78
|
+
onVerify={handleOnVerify}
|
|
79
|
+
onFormRedirect={handleOnRedirectMessage}
|
|
80
|
+
onCustomStylesAppended={handleOnCustomStylesAppended}
|
|
81
|
+
onReadyPaymentInstance={handleOnReadyPaymentInstance}
|
|
82
|
+
/>
|
|
83
|
+
<div ref={googleContainerRef} />
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
ReactDOM.render(<App />, document.body);
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## TypeScript support
|
|
93
|
+
|
|
94
|
+
All TypeScript declarations you can find in ``` @solidgate/react-sdk ```
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solidgate/react-sdk",
|
|
3
|
+
"repository": "https://bitbucket.org/solidgate/react-sdk",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": "Solidgate",
|
|
6
|
+
"description": "Solidgate react sdk loader",
|
|
7
|
+
"main": "dist/cjs/index.js",
|
|
8
|
+
"module": "dist/esm/index.js",
|
|
9
|
+
"typings": "dist/esm/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@solidgate/client-sdk-loader": "1.0.0",
|
|
15
|
+
"react-scripts": "5.0.0",
|
|
16
|
+
"styled-components": "^5.3.3"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "rm -rf ./dist",
|
|
20
|
+
"start": "react-scripts start",
|
|
21
|
+
"prepublishonly": "npm run build",
|
|
22
|
+
"build": "npm run clean && npm run build:esm && npm run build:cjs ",
|
|
23
|
+
"build:esm": "tsc",
|
|
24
|
+
"build:cjs": "tsc --module CommonJS --outDir dist/cjs",
|
|
25
|
+
"test": "react-scripts test",
|
|
26
|
+
"eject": "react-scripts eject",
|
|
27
|
+
"i-all": "npm i && cd playground && npm i"
|
|
28
|
+
},
|
|
29
|
+
"eslintConfig": {
|
|
30
|
+
"extends": [
|
|
31
|
+
"react-app",
|
|
32
|
+
"react-app/jest"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"browserslist": {
|
|
36
|
+
"production": [
|
|
37
|
+
">0.2%",
|
|
38
|
+
"not dead",
|
|
39
|
+
"not op_mini all"
|
|
40
|
+
],
|
|
41
|
+
"development": [
|
|
42
|
+
"last 1 chrome version",
|
|
43
|
+
"last 1 firefox version",
|
|
44
|
+
"last 1 safari version"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@babel/cli": "^7.17.0",
|
|
49
|
+
"@babel/core": "^7.17.0",
|
|
50
|
+
"@babel/preset-env": "^7.16.11",
|
|
51
|
+
"@babel/preset-react": "^7.16.7",
|
|
52
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
53
|
+
"@testing-library/react": "^12.0.0",
|
|
54
|
+
"@testing-library/user-event": "^13.2.1",
|
|
55
|
+
"@types/jest": "^27.0.1",
|
|
56
|
+
"@types/node": "^16.7.13",
|
|
57
|
+
"@types/react": "^17.0.20",
|
|
58
|
+
"@types/react-dom": "^17.0.9",
|
|
59
|
+
"@types/styled-components": "^5.1.22",
|
|
60
|
+
"cross-env": "^7.0.3",
|
|
61
|
+
"typescript": "^4.4.2"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": "^17.0.2",
|
|
65
|
+
"react-dom": "^17.0.2"
|
|
66
|
+
}
|
|
67
|
+
}
|