zh-web-sdk 2.1.0 → 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 +9 -2
- 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 +18 -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
|
@@ -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,7 +170,7 @@ 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>
|
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
|