zh-web-sdk 2.0.1 → 2.1.2
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 +13 -6
- package/dist/iframe-container/constants.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +4 -4
- package/dist/redux/reducers/ach-deposits.d.ts +13 -0
- package/dist/redux/reducers/index.d.ts +1 -0
- package/dist/redux/store/index.d.ts +1 -0
- package/dist/types.d.ts +19 -2
- package/package.json +1 -1
- package/src/iframe-container/AppContainer.tsx +19 -2
- package/src/iframe-container/constants.ts +7 -2
- package/src/index.tsx +15 -0
- package/src/redux/reducers/ach-deposits.ts +64 -0
- package/src/redux/reducers/index.ts +2 -0
- package/src/types.ts +19 -1
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@ using a single instance of `ZeroHashSDK`.
|
|
|
8
8
|
On SDK v2 we added some new methods that will replace the ones marked with deprecated
|
|
9
9
|
on future releases, if you update our SDK to v2 but don't do the below changes,
|
|
10
10
|
your App should still work fine as we ensured everything is backwards compatible, but
|
|
11
|
-
we
|
|
12
|
-
is up to date with our SDK.
|
|
11
|
+
we recommend that when updating to v2 you follow the steps below to ensure your App
|
|
12
|
+
is kept up to date with our SDK.
|
|
13
13
|
### Instantiating the SDK
|
|
14
14
|
- `zeroHashOnboardingURL` was renamed to `zeroHashAppsURL`. Please replace `zeroHashOnboardingURL` with `zeroHashAppsURL`.
|
|
15
15
|
### SDK Methods
|
|
@@ -48,7 +48,7 @@ const sdk = new ZeroHashSDK({
|
|
|
48
48
|
|
|
49
49
|
// Set the JWT retrieved for a particular App (each App requires a specific JWT,
|
|
50
50
|
// i.e. you should not use your Onboarding JWT for Crypto Witdhrawals)
|
|
51
|
-
// before the user can proceed with the flow.
|
|
51
|
+
// before the user can proceed with the flow.
|
|
52
52
|
sdk.openModal({
|
|
53
53
|
appIdentifier: AppIdentifier.ONBOARDING,
|
|
54
54
|
jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." +
|
|
@@ -89,6 +89,9 @@ We forward events that come from the UI to the Native App using the `postMessage
|
|
|
89
89
|
- **Crypto Withdrawals:**
|
|
90
90
|
- `CRYPTO_WITHDRAWALS_APP_LOADED` Sent when the App is loaded
|
|
91
91
|
- `CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED` Sent when the user clicks the Close button on the top-right corner
|
|
92
|
+
- **ACH Deposits:**
|
|
93
|
+
- `ACH_DEPOSITS_APP_LOADED` Sent when the App is loaded
|
|
94
|
+
- `ACH_DEPOSITS_CLOSE_BUTTON_CLICKED` Sent when the user clicks the Close button on the top-right corner
|
|
92
95
|
|
|
93
96
|
#### Messages
|
|
94
97
|
To control the `WebView` you can also send messages *down*, using the `postMessage` API. Currently the accepted messages are for the respective Apps are:
|
|
@@ -98,6 +101,9 @@ To control the `WebView` you can also send messages *down*, using the `postMessa
|
|
|
98
101
|
- **Crypto Withdrawals**
|
|
99
102
|
- `{type: "OPEN_MODAL", payload:{jwt: "<JWT_HERE>", appIdentifier: "crypto-withdrawals"} }`: It will open the Crypto Withdrawals modal with the JWT provided
|
|
100
103
|
- `{type: "CLOSE_MODAL", payload:{appIdentifier: "crypto-withdrawals"}}`: It will close the Crypto Withdrawals modal
|
|
104
|
+
- **ACH Deposits**
|
|
105
|
+
- `{type: "OPEN_MODAL", payload:{jwt: "<JWT_HERE>", appIdentifier: "ach-deposits"} }`: It will open the ACH Deposits modal with the JWT provided
|
|
106
|
+
- `{type: "CLOSE_MODAL", payload:{appIdentifier: "ach-deposits"}}`: It will close the ACH Deposits modal
|
|
101
107
|
|
|
102
108
|
The example below shows how you can implement the mentioned methods in a `react-native` project
|
|
103
109
|
|
|
@@ -110,7 +116,8 @@ const App = () => {
|
|
|
110
116
|
/*
|
|
111
117
|
Receive messages from sdk-mobile. Currently we expose the following event types:
|
|
112
118
|
"ONBOARDING_APP_LOADED", "ONBOARDING_CLOSE_BUTTON_CLICKED",
|
|
113
|
-
"CRYPTO_WITHDRAWALS_APP_LOADED", "CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED"
|
|
119
|
+
"CRYPTO_WITHDRAWALS_APP_LOADED", "CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED",
|
|
120
|
+
"ACH_DEPOSITS_APP_LOADED", "ACH_DEPOSITS_CLOSE_BUTTON_CLICKED",
|
|
114
121
|
you should be able to take action based on these events.
|
|
115
122
|
*/
|
|
116
123
|
const handleMessage = (event: WebViewMessageEvent) => {
|
|
@@ -163,11 +170,11 @@ const App = () => {
|
|
|
163
170
|
onMessage={handleMessage}
|
|
164
171
|
source={{
|
|
165
172
|
uri: `${sdkMobileServer}?
|
|
166
|
-
cryptoWithdrawalsJWT=${cwJWT}userOnboardingJWT=${jwt}&zeroHashAppsURL=${zeroHashOnboardingURL}`,
|
|
173
|
+
achDepositsJWT=${achDepositsJWT}&cryptoWithdrawalsJWT=${cwJWT}userOnboardingJWT=${jwt}&zeroHashAppsURL=${zeroHashOnboardingURL}`,
|
|
167
174
|
}}
|
|
168
175
|
/>
|
|
169
176
|
</SafeAreaView>
|
|
170
177
|
</SafeAreaProvider>
|
|
171
178
|
)
|
|
172
179
|
}
|
|
173
|
-
```
|
|
180
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class ZeroHashSDK implements IZeroHashSDK {
|
|
|
12
12
|
*
|
|
13
13
|
* For more information, see {@code IInitializeParameters}
|
|
14
14
|
*/
|
|
15
|
-
constructor({ zeroHashOnboardingURL, rootQuerySelector, userOnboardingJWT, cryptoWithdrawalsJWT, zeroHashAppsURL, }: IInitializeParameters);
|
|
15
|
+
constructor({ zeroHashOnboardingURL, rootQuerySelector, userOnboardingJWT, cryptoWithdrawalsJWT, achDepositsJWT, zeroHashAppsURL, }: IInitializeParameters);
|
|
16
16
|
/**
|
|
17
17
|
* setJWT sets the JWT for the appIdentifier provided.
|
|
18
18
|
* The JWT should be the JWT provided by ZeroHash via the platform
|