zh-web-sdk 2.1.5 → 2.3.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 CHANGED
@@ -92,6 +92,15 @@ We forward events that come from the UI to the Native App using the `postMessage
92
92
  - **ACH Deposits:**
93
93
  - `ACH_DEPOSITS_APP_LOADED` Sent when the App is loaded
94
94
  - `ACH_DEPOSITS_CLOSE_BUTTON_CLICKED` Sent when the user clicks the Close button on the top-right corner
95
+ - **Fiat Withdrawals:**
96
+ - `FIAT_WITHDRAWALS_APP_LOADED` Sent when the App is loaded
97
+ - `FIAT_WITHDRAWALS_CLOSE_BUTTON_CLICKED` Sent when the user clicks the Close button on the top-right corner
98
+ - **Crypto Buy:**
99
+ - `CRYPTO_BUY_APP_LOADED` Sent when the App is loaded
100
+ - `CRYPTO_BUY_CLOSE_BUTTON_CLICKED` Sent when the user clicks the Close button on the top-right corner
101
+ - **Crypto Sell:**
102
+ - `CRYPTO_SELL_APP_LOADED` Sent when the App is loaded
103
+ - `CRYPTO_SELL_CLOSE_BUTTON_CLICKED` Sent when the user clicks the Close button on the top-right corner
95
104
 
96
105
  #### Messages
97
106
  To control the `WebView` you can also send messages *down*, using the `postMessage` API. Currently the accepted messages are for the respective Apps are:
@@ -104,6 +113,15 @@ To control the `WebView` you can also send messages *down*, using the `postMessa
104
113
  - **ACH Deposits**
105
114
  - `{type: "OPEN_MODAL", payload:{jwt: "<JWT_HERE>", appIdentifier: "ach-deposits"} }`: It will open the ACH Deposits modal with the JWT provided
106
115
  - `{type: "CLOSE_MODAL", payload:{appIdentifier: "ach-deposits"}}`: It will close the ACH Deposits modal
116
+ - **Fiat Withdrawals**
117
+ - `{type: "OPEN_MODAL", payload:{jwt: "<JWT_HERE>", appIdentifier: "fiat-withdrawals"} }`: It will open the Fiat withdrawals modal with the JWT provided
118
+ - `{type: "CLOSE_MODAL", payload:{appIdentifier: "fiat-withdrawals"}}`: It will close the Fiat withdrawals modal
119
+ - **Crypto Buy**
120
+ - `{type: "OPEN_MODAL", payload:{jwt: "<JWT_HERE>", appIdentifier: "crypto-buy"} }`: It will open the Crypto buy modal with the JWT provided
121
+ - `{type: "CLOSE_MODAL", payload:{appIdentifier: "crypto-buy"}}`: It will close the Crypto buy modal
122
+ - **Crypto Sell**
123
+ - `{type: "OPEN_MODAL", payload:{jwt: "<JWT_HERE>", appIdentifier: "crypto-sell"} }`: It will open the Crypto sell modal with the JWT provided
124
+ - `{type: "CLOSE_MODAL", payload:{appIdentifier: "crypto-sell"}}`: It will close the Crypto sell modal
107
125
 
108
126
  The example below shows how you can implement the mentioned methods in a `react-native` project
109
127
 
@@ -118,6 +136,9 @@ const App = () => {
118
136
  "ONBOARDING_APP_LOADED", "ONBOARDING_CLOSE_BUTTON_CLICKED",
119
137
  "CRYPTO_WITHDRAWALS_APP_LOADED", "CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED",
120
138
  "ACH_DEPOSITS_APP_LOADED", "ACH_DEPOSITS_CLOSE_BUTTON_CLICKED",
139
+ "FIAT_WITHDRAWALS_APP_LOADED", "FIAT_WITHDRAWALS_CLOSE_BUTTON_CLICKED",
140
+ "CRYPTO_BUY_APP_LOADED", "CRYPTO_BUY_CLOSE_BUTTON_CLICKED",
141
+ "CRYPTO_SELL_APP_LOADED", "CRYPTO_SELL_CLOSE_BUTTON_CLICKED",
121
142
  you should be able to take action based on these events.
122
143
  */
123
144
  const handleMessage = (event: WebViewMessageEvent) => {
@@ -170,6 +191,9 @@ const App = () => {
170
191
  onMessage={handleMessage}
171
192
  source={{
172
193
  uri: `${sdkMobileServer}?
194
+ cryptoSellJWT=${cryptoSellJWT}&
195
+ cryptoBuyJWT=${cryptoBuyJWT}&
196
+ fiatWithdrawalsJWT=${fiatWithdrawalsJWT}&
173
197
  achDepositsJWT=${achDepositsJWT}&cryptoWithdrawalsJWT=${cwJWT}userOnboardingJWT=${jwt}&zeroHashAppsURL=${zeroHashOnboardingURL}`,
174
198
  }}
175
199
  />
@@ -7,7 +7,7 @@ interface AppContainerProps {
7
7
  zeroHashAppURL: string;
8
8
  appIdentifier: AppIdentifier;
9
9
  }
10
- declare const _default: import("react-redux").ConnectedComponent<({ isAppActive, isAppLoaded, jwt, zeroHashAppURL, appIdentifier, }: AppContainerProps) => import("react/jsx-runtime").JSX.Element, {
10
+ declare const _default: import("react-redux").ConnectedComponent<({ isAppActive, isAppLoaded, jwt, zeroHashAppURL, appIdentifier }: AppContainerProps) => import("react/jsx-runtime").JSX.Element, {
11
11
  zeroHashAppURL: string;
12
12
  appIdentifier: AppIdentifier;
13
13
  isAppActive?: boolean | undefined;
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, achDepositsJWT, zeroHashAppsURL, }: IInitializeParameters);
15
+ constructor({ zeroHashOnboardingURL, rootQuerySelector, userOnboardingJWT, cryptoWithdrawalsJWT, achDepositsJWT, fiatWithdrawalsJWT, cryptoBuyJWT, cryptoSellJWT, 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