zh-web-sdk 2.16.1 → 2.17.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 +225 -32
- package/package.json +6 -1
- package/.eslintrc.js +0 -12
- package/.github/CHANGELOG_TEMPLATE.md +0 -73
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
- package/.github/backup/publish-tag.yaml +0 -14
- package/.github/workflows/build.yaml +0 -13
- package/.github/workflows/pr.yaml +0 -14
- package/.github/workflows/publish.yaml +0 -13
- package/.github/workflows/security.yml +0 -15
- package/.github/workflows/tag.yaml +0 -14
- package/RELEASING.md +0 -39
- package/jest.config.js +0 -8
- package/jest.setup.js +0 -24
- package/scripts/build.js +0 -34
- package/scripts/zip.js +0 -49
- package/src/__tests__/jwt-auth-detection.test.ts +0 -96
- package/src/api/convert-token.ts +0 -23
- package/src/constants.ts +0 -2
- package/src/hooks/__tests__/use-window-size.test.tsx +0 -26
- package/src/hooks/use-window-size.ts +0 -19
- package/src/iframe-container/AppContainer.tsx +0 -495
- package/src/iframe-container/__tests__/AppContainer.test.tsx +0 -300
- package/src/iframe-container/hooks/__tests__/use-style-updates.test.ts +0 -430
- package/src/iframe-container/hooks/use-style-updates.ts +0 -82
- package/src/index.tsx +0 -645
- package/src/redux/actions/index.ts +0 -27
- package/src/redux/reducers/constants.ts +0 -10
- package/src/redux/reducers/crypto-account-link-payouts.ts +0 -60
- package/src/redux/reducers/crypto-account-link.ts +0 -60
- package/src/redux/reducers/crypto-buy.ts +0 -75
- package/src/redux/reducers/crypto-sell.ts +0 -64
- package/src/redux/reducers/crypto-withdrawals.ts +0 -64
- package/src/redux/reducers/fiat-account-link.ts +0 -60
- package/src/redux/reducers/fiat-deposits.ts +0 -64
- package/src/redux/reducers/fiat-withdrawals.ts +0 -64
- package/src/redux/reducers/fund.ts +0 -75
- package/src/redux/reducers/index.ts +0 -35
- package/src/redux/reducers/onboarding.ts +0 -74
- package/src/redux/reducers/pay.ts +0 -64
- package/src/redux/reducers/payouts.ts +0 -64
- package/src/redux/reducers/profile.ts +0 -63
- package/src/redux/store/index.ts +0 -10
- package/src/styles.ts +0 -108
- package/src/types.ts +0 -578
- package/src/utils/auth-to-fund-mapper.ts +0 -174
- package/src/utils/strings.ts +0 -19
- package/src/utils/test-utils.tsx +0 -36
- package/src/utils/world-app-utils.ts +0 -8
- package/src/utils.ts +0 -27
- package/tsconfig.json +0 -26
package/src/types.ts
DELETED
|
@@ -1,578 +0,0 @@
|
|
|
1
|
-
import { MiniKit } from "@worldcoin/minikit-js";
|
|
2
|
-
import type { CSSProperties } from "react";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
-
zerohash: any,
|
|
8
|
-
/**
|
|
9
|
-
* WorldApp is a global object that is set if the zh-web-sdk is running
|
|
10
|
-
* inside the World App environment.
|
|
11
|
-
*/
|
|
12
|
-
WorldApp: unknown,
|
|
13
|
-
MiniKit: typeof MiniKit,
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* IInitializeParameters describes the parameters
|
|
19
|
-
* required for initializing the platform SDK
|
|
20
|
-
*/
|
|
21
|
-
export interface IInitializeParameters {
|
|
22
|
-
/**
|
|
23
|
-
* zeroHashOnboardingURL should be set to the URL of
|
|
24
|
-
* the webapp for onboarding users onto the ZeroHash
|
|
25
|
-
* platform.
|
|
26
|
-
* @deprecated please use zeroHashAppsURL.
|
|
27
|
-
*/
|
|
28
|
-
zeroHashOnboardingURL?: string
|
|
29
|
-
/**
|
|
30
|
-
* rootQuerySelector is a query selector string that
|
|
31
|
-
* allows creating the ZeroHash UI subtree under a
|
|
32
|
-
* custom element.
|
|
33
|
-
*
|
|
34
|
-
* The default #zh-root query selector will be used
|
|
35
|
-
* instead otherwise. #zh-root will be a <div> appended
|
|
36
|
-
* as a child of the body in no specified order.
|
|
37
|
-
*/
|
|
38
|
-
rootQuerySelector?: string
|
|
39
|
-
/**
|
|
40
|
-
* userOnboardingJWT is the JWT that you received from
|
|
41
|
-
* the ZeroHash HTTP API that pertains to the customer
|
|
42
|
-
* to be onboarded.
|
|
43
|
-
*
|
|
44
|
-
* This is optional in the constructor and can be
|
|
45
|
-
* deferred to setUserOnboardingJWT() at a later time
|
|
46
|
-
* but must be provided before opening the onboarding
|
|
47
|
-
* UI in order for the onboarding UI to be loaded.
|
|
48
|
-
*/
|
|
49
|
-
userOnboardingJWT?: string
|
|
50
|
-
/**
|
|
51
|
-
* cryptoWithdrawalsJWT is the JWT that you received from
|
|
52
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
53
|
-
* perform crypto withdrawals.
|
|
54
|
-
*/
|
|
55
|
-
cryptoWithdrawalsJWT?: string
|
|
56
|
-
/**
|
|
57
|
-
* fiatDepositsJWT is the JWT that you received from
|
|
58
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
59
|
-
* perform Fiat Deposits.
|
|
60
|
-
*/
|
|
61
|
-
fiatDepositsJWT?: string
|
|
62
|
-
/**
|
|
63
|
-
* fiatWithdrawalsJWT is the JWT that you received from
|
|
64
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
65
|
-
* perform Fiat Withdrawals.
|
|
66
|
-
*/
|
|
67
|
-
fiatWithdrawalsJWT?: string
|
|
68
|
-
/**
|
|
69
|
-
* cryptoBuyJWT is the JWT that you received from
|
|
70
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
71
|
-
* perform Crypto Buy.
|
|
72
|
-
*/
|
|
73
|
-
cryptoBuyJWT?: string
|
|
74
|
-
/**
|
|
75
|
-
* cryptoSellJWT is the JWT that you received from
|
|
76
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
77
|
-
* perform Crypto Sell.
|
|
78
|
-
*/
|
|
79
|
-
cryptoSellJWT?: string
|
|
80
|
-
/**
|
|
81
|
-
* fundJWT is the JWT that you received from
|
|
82
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
83
|
-
* perform Fund operations.
|
|
84
|
-
*/
|
|
85
|
-
fundJWT?: string
|
|
86
|
-
/**
|
|
87
|
-
* profileJWT is the JWT that you received from
|
|
88
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
89
|
-
* perform Profile operations.
|
|
90
|
-
*/
|
|
91
|
-
profileJWT?: string
|
|
92
|
-
/**
|
|
93
|
-
* cryptoAccountLinkJWT is the JWT that you received from
|
|
94
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
95
|
-
* create a new Crypto Account.
|
|
96
|
-
*/
|
|
97
|
-
cryptoAccountLinkJWT?: string
|
|
98
|
-
/**
|
|
99
|
-
* cryptoAccountLinkPayoutsJWT is the JWT that you received from
|
|
100
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
101
|
-
* create a new Crypto Account for payouts.
|
|
102
|
-
*/
|
|
103
|
-
cryptoAccountLinkPayoutsJWT?: string
|
|
104
|
-
/**
|
|
105
|
-
* payoutsJWT is the JWT that you received from
|
|
106
|
-
* the ZeroHash HTTP API and have specific permissions
|
|
107
|
-
* to perform payouts.
|
|
108
|
-
*/
|
|
109
|
-
payoutsJWT?: string
|
|
110
|
-
/**
|
|
111
|
-
* payJWT is the JWT that you received from
|
|
112
|
-
* the ZeroHash HTTP API and have specific permissions
|
|
113
|
-
* to perform pay.
|
|
114
|
-
*/
|
|
115
|
-
payJWT?: string
|
|
116
|
-
/**
|
|
117
|
-
* fiatAccountLinkJWT is the JWT that you received from
|
|
118
|
-
* the ZeroHash HTTP API and have specific permissions to
|
|
119
|
-
* create a new Fiat Account.
|
|
120
|
-
*/
|
|
121
|
-
fiatAccountLinkJWT?: string
|
|
122
|
-
/**
|
|
123
|
-
* zeroHashAppsURL is the base URL for all our Apps.
|
|
124
|
-
* It defaults to https://web-sdk.zerohash.com/ and will
|
|
125
|
-
* be a replacement for zeroHashOnboardingURL.
|
|
126
|
-
*/
|
|
127
|
-
zeroHashAppsURL: string
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* ISetUserOnboardingJWTParameters describes the
|
|
132
|
-
* parameters required for setting the user onboarding
|
|
133
|
-
* JWT.
|
|
134
|
-
*/
|
|
135
|
-
export interface ISetUserOnboardingJWTParameters {
|
|
136
|
-
/**
|
|
137
|
-
* userOnboardingJWT is the JWT that you received from
|
|
138
|
-
* the ZeroHash HTTP API that pertains to the customer
|
|
139
|
-
* to be onboarded.
|
|
140
|
-
*/
|
|
141
|
-
userOnboardingJWT: string
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface IOpenOnboardingModalParameters {
|
|
145
|
-
/**
|
|
146
|
-
* userOnboardingJWT is the JWT that you received from
|
|
147
|
-
* the ZeroHash HTTP API that pertains to the customer
|
|
148
|
-
* to be onboarded.
|
|
149
|
-
*/
|
|
150
|
-
userOnboardingJWT?: string
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* AuthSettings are optional configuration settings for
|
|
155
|
-
* the Connect Auth component
|
|
156
|
-
*/
|
|
157
|
-
export interface AuthSettings {
|
|
158
|
-
/**
|
|
159
|
-
* theme for the Auth component
|
|
160
|
-
* Can be 'dark', 'light', or 'auto'
|
|
161
|
-
*/
|
|
162
|
-
theme?: 'dark' | 'light' | 'auto'
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* IncomingMessageType are enums of message types that
|
|
167
|
-
* are registered that the host can handle.
|
|
168
|
-
*/
|
|
169
|
-
export enum IncomingMessageType {
|
|
170
|
-
/**
|
|
171
|
-
* OnboardingAppLoaded is received when the onboarding
|
|
172
|
-
* app has initialized.
|
|
173
|
-
*/
|
|
174
|
-
OnboardingAppLoaded = "ONBOARDING_APP_LOADED",
|
|
175
|
-
/**
|
|
176
|
-
* OnboardingCloseButtonClicked is received when the close button
|
|
177
|
-
* has been clicked in the onboarding app
|
|
178
|
-
*/
|
|
179
|
-
OnboardingCloseButtonClicked = "ONBOARDING_CLOSE_BUTTON_CLICKED",
|
|
180
|
-
/**
|
|
181
|
-
* OnboardingCompleted is received when the onboarding flow has completed
|
|
182
|
-
* successfully with participant approved and webview can be closed.
|
|
183
|
-
*/
|
|
184
|
-
OnboardingCompleted = "ONBOARDING_COMPLETED",
|
|
185
|
-
/**
|
|
186
|
-
* OnboardingFailed is received when the onboarding
|
|
187
|
-
* flow has failed.
|
|
188
|
-
*/
|
|
189
|
-
OnboardingFailed = "ONBOARDING_FAILED",
|
|
190
|
-
/**
|
|
191
|
-
* OnboardingPendingApproval is received when the onboarding
|
|
192
|
-
* flow has completed successfully but the participant is pending approval.
|
|
193
|
-
*/
|
|
194
|
-
OnboardingPendingApproval = "ONBOARDING_PENDING_APPROVAL",
|
|
195
|
-
/**
|
|
196
|
-
* CryptoWithdrawalsAppLoaded is received when the crypto
|
|
197
|
-
* withdrawals app has initialized.
|
|
198
|
-
*/
|
|
199
|
-
CryptoWithdrawalsAppLoaded = "CRYPTO_WITHDRAWALS_APP_LOADED",
|
|
200
|
-
/**
|
|
201
|
-
* CryptoWithdrawalsCloseButtonClicked is received when the close button
|
|
202
|
-
* has been clicked in the Crypto Withdrawals app
|
|
203
|
-
*/
|
|
204
|
-
CryptoWithdrawalsCloseButtonClicked = "CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED",
|
|
205
|
-
/**
|
|
206
|
-
* CryptoWithdrawalsCompleted is received when the Crypto
|
|
207
|
-
* withdrawals flow has completed successfully.
|
|
208
|
-
*/
|
|
209
|
-
CryptoWithdrawalsCompleted = "CRYPTO_WITHDRAWALS_COMPLETED",
|
|
210
|
-
/**
|
|
211
|
-
* CryptoWithdrawalsFailed is received when the Crypto
|
|
212
|
-
* withdrawals flow has failed.
|
|
213
|
-
*/
|
|
214
|
-
CryptoWithdrawalsFailed = "CRYPTO_WITHDRAWALS_FAILED",
|
|
215
|
-
/**
|
|
216
|
-
* FiatDepositsAppLoaded is received when the Fiat
|
|
217
|
-
* deposits app has initialized.
|
|
218
|
-
*/
|
|
219
|
-
FiatDepositsAppLoaded = "FIAT_DEPOSITS_APP_LOADED",
|
|
220
|
-
/**
|
|
221
|
-
* FiatDepositsCloseButtonClicked is received when the close button
|
|
222
|
-
* has been clicked in the Fiat Deposits app
|
|
223
|
-
*/
|
|
224
|
-
FiatDepositsCloseButtonClicked = "FIAT_DEPOSITS_CLOSE_BUTTON_CLICKED",
|
|
225
|
-
/**
|
|
226
|
-
* FiatDepositsCompleted is received when the Fiat
|
|
227
|
-
* deposits flow has completed successfully.
|
|
228
|
-
*/
|
|
229
|
-
FiatDepositsCompleted = "FIAT_DEPOSITS_COMPLETED",
|
|
230
|
-
/**
|
|
231
|
-
* FiatDepositsFailed is received when the Fiat
|
|
232
|
-
* deposits flow has failed.
|
|
233
|
-
*/
|
|
234
|
-
FiatDepositsFailed = "FIAT_DEPOSITS_FAILED",
|
|
235
|
-
/**
|
|
236
|
-
* FiatWithdrawalsAppLoaded is received when the Fiat
|
|
237
|
-
* withdrawals app has initialized.
|
|
238
|
-
*/
|
|
239
|
-
FiatWithdrawalsAppLoaded = "FIAT_WITHDRAWALS_APP_LOADED",
|
|
240
|
-
/**
|
|
241
|
-
* FiatWithdrawalsCloseButtonClicked is received when the close button
|
|
242
|
-
* has been clicked in the Fiat Withdrawals app
|
|
243
|
-
*/
|
|
244
|
-
FiatWithdrawalsCloseButtonClicked = "FIAT_WITHDRAWALS_CLOSE_BUTTON_CLICKED",
|
|
245
|
-
/**
|
|
246
|
-
* FiatWithdrawalsCompleted is received when the Fiat
|
|
247
|
-
* withdrawals flow has completed successfully.
|
|
248
|
-
*/
|
|
249
|
-
FiatWithdrawalsCompleted = "FIAT_WITHDRAWALS_COMPLETED",
|
|
250
|
-
/**
|
|
251
|
-
* FiatWithdrawalsFailed is received when the Fiat
|
|
252
|
-
* withdrawals flow has failed.
|
|
253
|
-
*/
|
|
254
|
-
FiatWithdrawalsFailed = "FIAT_WITHDRAWALS_FAILED",
|
|
255
|
-
/**
|
|
256
|
-
* CryptoBuyAppLoaded is received when the Crypto
|
|
257
|
-
* buy app has initialized.
|
|
258
|
-
*/
|
|
259
|
-
CryptoBuyAppLoaded = "CRYPTO_BUY_APP_LOADED",
|
|
260
|
-
/**
|
|
261
|
-
* CryptoBuyCloseButtonClicked is received when the close button
|
|
262
|
-
* has been clicked in the Crypto buy app
|
|
263
|
-
*/
|
|
264
|
-
CryptoBuyCloseButtonClicked = "CRYPTO_BUY_CLOSE_BUTTON_CLICKED",
|
|
265
|
-
/**
|
|
266
|
-
* CryptoBuyCompleted is received when the Crypto
|
|
267
|
-
* buy flow flow has completed successfully.
|
|
268
|
-
*/
|
|
269
|
-
CryptoBuyCompleted = "CRYPTO_BUY_COMPLETED",
|
|
270
|
-
/**
|
|
271
|
-
* CryptoBuyFailed is received when the Crypto
|
|
272
|
-
* buy flow has failed.
|
|
273
|
-
*/
|
|
274
|
-
CryptoBuyFailed = "CRYPTO_BUY_FAILED",
|
|
275
|
-
/**
|
|
276
|
-
* CryptoSellAppLoaded is received when the Crypto
|
|
277
|
-
* sell app has initialized.
|
|
278
|
-
*/
|
|
279
|
-
CryptoSellAppLoaded = "CRYPTO_SELL_APP_LOADED",
|
|
280
|
-
/**
|
|
281
|
-
* CryptoSellCloseButtonClicked is received when the close button
|
|
282
|
-
* has been clicked in the Crypto sell app
|
|
283
|
-
*/
|
|
284
|
-
CryptoSellCloseButtonClicked = "CRYPTO_SELL_CLOSE_BUTTON_CLICKED",
|
|
285
|
-
/**
|
|
286
|
-
* CryptoSellCompleted is received when the Crypto
|
|
287
|
-
* sell flow has completed successfully.
|
|
288
|
-
*/
|
|
289
|
-
CryptoSellCompleted = "CRYPTO_SELL_COMPLETED",
|
|
290
|
-
/**
|
|
291
|
-
* CryptoSellFailed is received when the Crypto
|
|
292
|
-
* sell flow has failed.
|
|
293
|
-
*/
|
|
294
|
-
CryptoSellFailed = "CRYPTO_SELL_FAILED",
|
|
295
|
-
/**
|
|
296
|
-
* FundAppLoaded is received when the Fund
|
|
297
|
-
* app has initialized.
|
|
298
|
-
*/
|
|
299
|
-
FundAppLoaded = "FUND_APP_LOADED",
|
|
300
|
-
/**
|
|
301
|
-
* FundCloseButtonClicked is received when the close button
|
|
302
|
-
* has been clicked in the Fund app
|
|
303
|
-
*/
|
|
304
|
-
FundCloseButtonClicked = "FUND_CLOSE_BUTTON_CLICKED",
|
|
305
|
-
/**
|
|
306
|
-
* FundCompleted is received when the
|
|
307
|
-
* Fund flow has completed successfully.
|
|
308
|
-
*/
|
|
309
|
-
FundCompleted = "FUND_COMPLETED",
|
|
310
|
-
/**
|
|
311
|
-
* FundFailed is received when the
|
|
312
|
-
* Fund flow has failed.
|
|
313
|
-
*/
|
|
314
|
-
FundFailed = "FUND_FAILED",
|
|
315
|
-
/**
|
|
316
|
-
* FundError is received when an error occurs
|
|
317
|
-
* in the Fund flow (from Auth onError callback).
|
|
318
|
-
*/
|
|
319
|
-
FundError = "FUND_ERROR",
|
|
320
|
-
/**
|
|
321
|
-
* FundDepositSubmitted is received when a deposit
|
|
322
|
-
* is submitted in the Fund flow.
|
|
323
|
-
*/
|
|
324
|
-
FundDepositSubmitted = "FUND_DEPOSIT_SUBMITTED",
|
|
325
|
-
/**
|
|
326
|
-
* FundConnectDeposit is received when Connect Auth component
|
|
327
|
-
* calls onDeposit (exclusive to Connect Auth, not from iframe).
|
|
328
|
-
*/
|
|
329
|
-
FundConnectDeposit = "FUND_CONNECT_DEPOSIT",
|
|
330
|
-
/**
|
|
331
|
-
* FundConnectEvent is received when Connect Auth component
|
|
332
|
-
* calls onEvent with any event type (catch-all for Auth events).
|
|
333
|
-
*/
|
|
334
|
-
FundConnectEvent = "FUND_CONNECT_EVENT",
|
|
335
|
-
/**
|
|
336
|
-
* ProfileAppLoaded is received when the Profile
|
|
337
|
-
* app has initialized.
|
|
338
|
-
*/
|
|
339
|
-
ProfileAppLoaded = "PROFILE_APP_LOADED",
|
|
340
|
-
/**
|
|
341
|
-
* ProfileCloseButtonClicked is received when the close button
|
|
342
|
-
* has been clicked in the Profile app
|
|
343
|
-
*/
|
|
344
|
-
ProfileCloseButtonClicked = "PROFILE_CLOSE_BUTTON_CLICKED",
|
|
345
|
-
/**
|
|
346
|
-
* ProfileFailed is received when the
|
|
347
|
-
* Profile flow has failed.
|
|
348
|
-
*/
|
|
349
|
-
ProfileFailed = "PROFILE_FAILED",
|
|
350
|
-
/**
|
|
351
|
-
* CryptoAccountLinkAppLoaded is received when the Crypto Account Link
|
|
352
|
-
* app has initialized.
|
|
353
|
-
*/
|
|
354
|
-
CryptoAccountLinkAppLoaded = "CRYPTO_ACCOUNT_LINK_APP_LOADED",
|
|
355
|
-
/**
|
|
356
|
-
* CryptoAccountLinkCloseButtonClicked is received when the close button
|
|
357
|
-
* has been clicked in the Crypto Account Link app
|
|
358
|
-
*/
|
|
359
|
-
CryptoAccountLinkCloseButtonClicked = "CRYPTO_ACCOUNT_LINK_CLOSE_BUTTON_CLICKED",
|
|
360
|
-
/**
|
|
361
|
-
* CryptoAccountLinkFailed is received when the
|
|
362
|
-
* Crypto Account Link flow has failed.
|
|
363
|
-
*/
|
|
364
|
-
CryptoAccountLinkFailed = "CRYPTO_ACCOUNT_LINK_FAILED",
|
|
365
|
-
/**
|
|
366
|
-
* CryptoAccountLinkCompleted is received when the
|
|
367
|
-
* Crypto Account Link flow is completed.
|
|
368
|
-
*/
|
|
369
|
-
CryptoAccountLinkCompleted = "CRYPTO_ACCOUNT_LINK_COMPLETED",
|
|
370
|
-
/**
|
|
371
|
-
* CryptoAccountLinkPayoutsAppLoaded is received when the
|
|
372
|
-
* Crypto Account Link Payouts has initialized.
|
|
373
|
-
*/
|
|
374
|
-
CryptoAccountLinkPayoutsAppLoaded = "CRYPTO_ACCOUNT_LINK_PAYOUTS_APP_LOADED",
|
|
375
|
-
/**
|
|
376
|
-
* CryptoAccountLinkPayoutsCloseButtonClicked is received when the close button
|
|
377
|
-
* has been clicked in the Crypto Account Link Payouts app
|
|
378
|
-
*/
|
|
379
|
-
CryptoAccountLinkPayoutsCloseButtonClicked = "CRYPTO_ACCOUNT_LINK_PAYOUTS_CLOSE_BUTTON_CLICKED",
|
|
380
|
-
/**
|
|
381
|
-
* CryptoAccountLinkPayoutsFailed is received when the
|
|
382
|
-
* Crypto Account Link Payouts flow has failed.
|
|
383
|
-
*/
|
|
384
|
-
CryptoAccountLinkPayoutsFailed = "CRYPTO_ACCOUNT_LINK_PAYOUTS_FAILED",
|
|
385
|
-
/**
|
|
386
|
-
* CryptoAccountLinkPayoutsCompleted is received when the
|
|
387
|
-
* Crypto Account Link Payouts flow is completed.
|
|
388
|
-
*/
|
|
389
|
-
CryptoAccountLinkPayoutsCompleted = "CRYPTO_ACCOUNT_LINK_PAYOUTS_COMPLETED",
|
|
390
|
-
/**
|
|
391
|
-
* PayoutsAppLoaded is received when the Payouts app has initialized.
|
|
392
|
-
*/
|
|
393
|
-
PayoutsAppLoaded = "PAYOUTS_APP_LOADED",
|
|
394
|
-
/**
|
|
395
|
-
* PayoutsCloseButtonClicked is received when the close button
|
|
396
|
-
* has been clicked in the Payouts app
|
|
397
|
-
*/
|
|
398
|
-
PayoutsCloseButtonClicked = "PAYOUTS_CLOSE_BUTTON_CLICKED",
|
|
399
|
-
/**
|
|
400
|
-
* PayoutsCompleted is received when the Payouts flow has completed successfully.
|
|
401
|
-
*/
|
|
402
|
-
PayoutsCompleted = "PAYOUTS_COMPLETED",
|
|
403
|
-
/**
|
|
404
|
-
* PayoutsFailed is received when the Payouts flow has failed.
|
|
405
|
-
*/
|
|
406
|
-
PayoutsFailed = "PAYOUTS_FAILED",
|
|
407
|
-
/**
|
|
408
|
-
* PayAppLoaded is received when the Pay app has initialized.
|
|
409
|
-
*/
|
|
410
|
-
PayAppLoaded = "PAY_APP_LOADED",
|
|
411
|
-
/**
|
|
412
|
-
* PayCloseButtonClicked is received when the close button
|
|
413
|
-
* has been clicked in the Pay app
|
|
414
|
-
*/
|
|
415
|
-
PayCloseButtonClicked = "PAY_CLOSE_BUTTON_CLICKED",
|
|
416
|
-
/**
|
|
417
|
-
* PayCompleted is received when the Pay flow has completed successfully.
|
|
418
|
-
*/
|
|
419
|
-
PayCompleted = "PAY_COMPLETED",
|
|
420
|
-
/**
|
|
421
|
-
* PayFailed is received when the Pay flow has failed.
|
|
422
|
-
*/
|
|
423
|
-
PayFailed = "PAY_FAILED",
|
|
424
|
-
/**
|
|
425
|
-
* FiatAccountLinkAppLoaded is received when the Fiat Account Link
|
|
426
|
-
* app has initialized.
|
|
427
|
-
*/
|
|
428
|
-
FiatAccountLinkAppLoaded = "FIAT_ACCOUNT_LINK_APP_LOADED",
|
|
429
|
-
/**
|
|
430
|
-
* FiatAccountLinkCloseButtonClicked is received when the close button
|
|
431
|
-
* has been clicked in the Fiat Account Link app
|
|
432
|
-
*/
|
|
433
|
-
FiatAccountLinkCloseButtonClicked = "FIAT_ACCOUNT_LINK_CLOSE_BUTTON_CLICKED",
|
|
434
|
-
/**
|
|
435
|
-
* FiatAccountLinkFailed is received when the
|
|
436
|
-
* Fiat Account Link flow has failed.
|
|
437
|
-
*/
|
|
438
|
-
FiatAccountLinkFailed = "FIAT_ACCOUNT_LINK_FAILED",
|
|
439
|
-
/**
|
|
440
|
-
* FiatAccountLinkCompleted is received when the
|
|
441
|
-
* Fiat Account Link flow is completed.
|
|
442
|
-
*/
|
|
443
|
-
FiatAccountLinkCompleted = "FIAT_ACCOUNT_LINK_COMPLETED",
|
|
444
|
-
/**
|
|
445
|
-
* StyleConfig is used to load the style configuration when the app loads.
|
|
446
|
-
*/
|
|
447
|
-
StyleConfig = "STYLE_CONFIG"
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* IncomingMessage defines the structure of an incoming
|
|
452
|
-
* message
|
|
453
|
-
*/
|
|
454
|
-
export interface IncomingMessage {
|
|
455
|
-
/**
|
|
456
|
-
* type is the type of message that is used for routing
|
|
457
|
-
* the request to the appropriate handler
|
|
458
|
-
*/
|
|
459
|
-
type: IncomingMessageType
|
|
460
|
-
/**
|
|
461
|
-
* payload is any freeform value that pertains to the
|
|
462
|
-
* request
|
|
463
|
-
*/
|
|
464
|
-
payload: unknown
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
export type IncomingMessageHandler = (payload: unknown) => void;
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* IZeroHashSDK is the interface that you may use to interact with the ZeroHash SDK.
|
|
471
|
-
*/
|
|
472
|
-
export interface IZeroHashSDK {
|
|
473
|
-
setUserOnboardingJWT(params: ISetUserOnboardingJWTParameters): void
|
|
474
|
-
isOnboardingModalOpen(): boolean
|
|
475
|
-
openOnboardingModal(params: IOpenOnboardingModalParameters): void
|
|
476
|
-
closeOnboardingModal(): void
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* App identifier used to identify to which App we want to perform
|
|
481
|
-
* the requested action, i.e. sdk.setJWT(AppIdentifier.ONBOARDING)
|
|
482
|
-
*/
|
|
483
|
-
export enum AppIdentifier {
|
|
484
|
-
ONBOARDING = "onboarding",
|
|
485
|
-
CRYPTO_WITHDRAWALS = "crypto-withdrawals",
|
|
486
|
-
FIAT_DEPOSITS = "fiat-deposits",
|
|
487
|
-
FIAT_WITHDRAWALS = "fiat-withdrawals",
|
|
488
|
-
CRYPTO_BUY = "crypto-buy",
|
|
489
|
-
CRYPTO_SELL = "crypto-sell",
|
|
490
|
-
CSP_CRYPTO_WITHDRAWALS = "csp-crypto-withdrawals",
|
|
491
|
-
CSP_FIAT_WITHDRAWALS = "csp-fiat-withdrawals",
|
|
492
|
-
CSP_CRYPTO_SELL = "csp-crypto-sell",
|
|
493
|
-
FUND = "fund",
|
|
494
|
-
PROFILE = "profile",
|
|
495
|
-
CRYPTO_ACCOUNT_LINK = "crypto-account-link",
|
|
496
|
-
CRYPTO_ACCOUNT_LINK_PAYOUTS = "crypto-account-link-payouts",
|
|
497
|
-
PAYOUTS = "payouts",
|
|
498
|
-
PAY = "pay",
|
|
499
|
-
FIAT_ACCOUNT_LINK = "fiat-account-link"
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Map that maps the app AppIdentifier to the redux action prefix
|
|
504
|
-
*/
|
|
505
|
-
export const appIdentifierToActionPrefixMap = new Map(
|
|
506
|
-
[
|
|
507
|
-
[AppIdentifier.ONBOARDING, "ONBOARDING_"],
|
|
508
|
-
[AppIdentifier.CRYPTO_WITHDRAWALS, "CRYPTO_WITHDRAWALS_"],
|
|
509
|
-
[AppIdentifier.FIAT_DEPOSITS, "FIAT_DEPOSITS_"],
|
|
510
|
-
[AppIdentifier.FIAT_WITHDRAWALS, "FIAT_WITHDRAWALS_"],
|
|
511
|
-
[AppIdentifier.CRYPTO_BUY, "CRYPTO_BUY_"],
|
|
512
|
-
[AppIdentifier.CRYPTO_SELL, "CRYPTO_SELL_"],
|
|
513
|
-
[AppIdentifier.CSP_CRYPTO_WITHDRAWALS, "CRYPTO_WITHDRAWALS_"], // CSP apps uses the same events as "regular" flow
|
|
514
|
-
[AppIdentifier.CSP_FIAT_WITHDRAWALS, "FIAT_WITHDRAWALS_"], // CSP apps uses the same events as "regular" flow
|
|
515
|
-
[AppIdentifier.CSP_CRYPTO_SELL, "CRYPTO_SELL_"],
|
|
516
|
-
[AppIdentifier.CSP_CRYPTO_SELL, "CRYPTO_SELL_"],
|
|
517
|
-
[AppIdentifier.FUND, "FUND_"],
|
|
518
|
-
[AppIdentifier.PROFILE, "PROFILE_"],
|
|
519
|
-
[AppIdentifier.CRYPTO_ACCOUNT_LINK, "CRYPTO_ACCOUNT_LINK_"],
|
|
520
|
-
[AppIdentifier.CRYPTO_ACCOUNT_LINK_PAYOUTS, "CRYPTO_ACCOUNT_LINK_PAYOUTS_"],
|
|
521
|
-
[AppIdentifier.PAYOUTS, "PAYOUTS_"],
|
|
522
|
-
[AppIdentifier.PAY, "PAY_"],
|
|
523
|
-
[AppIdentifier.FIAT_ACCOUNT_LINK, "FIAT_ACCOUNT_LINK_"]
|
|
524
|
-
])
|
|
525
|
-
|
|
526
|
-
export interface ISetJWTParameters {
|
|
527
|
-
jwt: string;
|
|
528
|
-
appIdentifier: AppIdentifier;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
export interface Filters {
|
|
532
|
-
getAssets?: {
|
|
533
|
-
deposit_address_creation?: string
|
|
534
|
-
stablecoin?: boolean
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
export interface IOpenModalParameters {
|
|
539
|
-
jwt?: string;
|
|
540
|
-
appIdentifier: AppIdentifier;
|
|
541
|
-
filters?: Filters;
|
|
542
|
-
navigate?: Page;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
export interface ISetFiltersParameters {
|
|
546
|
-
appIdentifier: AppIdentifier;
|
|
547
|
-
filters?: Filters;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
export interface EditAddress {
|
|
551
|
-
to: "edit-address";
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Since we may extend this in the future, we use a union type to make it easy
|
|
555
|
-
* to allow for example a new CryptoBuyPage type to be added in the future or
|
|
556
|
-
* new pages for the Onboarding App with specialized props.
|
|
557
|
-
* Page is expected to be a union of "AppPage" and each App shall have it's own
|
|
558
|
-
* union of pages, such as EditAddress.
|
|
559
|
-
*/
|
|
560
|
-
export type OnboardingPage = EditAddress;
|
|
561
|
-
export type Page = OnboardingPage;
|
|
562
|
-
export interface ISetNavigateParameters {
|
|
563
|
-
appIdentifier: AppIdentifier;
|
|
564
|
-
navigate: Page;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* StyleConfigMessage defines the structure of a style configuration message
|
|
569
|
-
* received from postMessage events. All style properties are optional to allow
|
|
570
|
-
* partial style updates.
|
|
571
|
-
*/
|
|
572
|
-
export interface StyleConfigMessage {
|
|
573
|
-
type: 'STYLE_CONFIG';
|
|
574
|
-
appWrapperStyle?: CSSProperties;
|
|
575
|
-
modalStyle?: CSSProperties;
|
|
576
|
-
iframeWrapperStyle?: CSSProperties;
|
|
577
|
-
iframeStyle?: CSSProperties;
|
|
578
|
-
}
|