import { MiniKit } from "@worldcoin/minikit-js"; import type { CSSProperties } from "react"; declare global { interface Window { zerohash: any; /** * WorldApp is a global object that is set if the zh-web-sdk is running * inside the World App environment. */ WorldApp: unknown; MiniKit: typeof MiniKit; } } /** * IInitializeParameters describes the parameters * required for initializing the platform SDK */ export interface IInitializeParameters { /** * zeroHashOnboardingURL should be set to the URL of * the webapp for onboarding users onto the ZeroHash * platform. * @deprecated please use zeroHashAppsURL. */ zeroHashOnboardingURL?: string; /** * rootQuerySelector is a query selector string that * allows creating the ZeroHash UI subtree under a * custom element. * * The default #zh-root query selector will be used * instead otherwise. #zh-root will be a
appended * as a child of the body in no specified order. */ rootQuerySelector?: string; /** * userOnboardingJWT is the JWT that you received from * the ZeroHash HTTP API that pertains to the customer * to be onboarded. * * This is optional in the constructor and can be * deferred to setUserOnboardingJWT() at a later time * but must be provided before opening the onboarding * UI in order for the onboarding UI to be loaded. */ userOnboardingJWT?: string; /** * cryptoWithdrawalsJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform crypto withdrawals. */ cryptoWithdrawalsJWT?: string; /** * fiatDepositsJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform Fiat Deposits. */ fiatDepositsJWT?: string; /** * fiatWithdrawalsJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform Fiat Withdrawals. */ fiatWithdrawalsJWT?: string; /** * cryptoBuyJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform Crypto Buy. */ cryptoBuyJWT?: string; /** * cryptoSellJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform Crypto Sell. */ cryptoSellJWT?: string; /** * fundJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform Fund operations. */ fundJWT?: string; /** * profileJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * perform Profile operations. */ profileJWT?: string; /** * cryptoAccountLinkJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * create a new Crypto Account. */ cryptoAccountLinkJWT?: string; /** * cryptoAccountLinkPayoutsJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * create a new Crypto Account for payouts. */ cryptoAccountLinkPayoutsJWT?: string; /** * payoutsJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions * to perform payouts. */ payoutsJWT?: string; /** * payJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions * to perform pay. */ payJWT?: string; /** * fiatAccountLinkJWT is the JWT that you received from * the ZeroHash HTTP API and have specific permissions to * create a new Fiat Account. */ fiatAccountLinkJWT?: string; /** * zeroHashAppsURL is the base URL for all our Apps. * It defaults to https://web-sdk.zerohash.com/ and will * be a replacement for zeroHashOnboardingURL. */ zeroHashAppsURL: string; } /** * ISetUserOnboardingJWTParameters describes the * parameters required for setting the user onboarding * JWT. */ export interface ISetUserOnboardingJWTParameters { /** * userOnboardingJWT is the JWT that you received from * the ZeroHash HTTP API that pertains to the customer * to be onboarded. */ userOnboardingJWT: string; } export interface IOpenOnboardingModalParameters { /** * userOnboardingJWT is the JWT that you received from * the ZeroHash HTTP API that pertains to the customer * to be onboarded. */ userOnboardingJWT?: string; } /** * AuthSettings are optional configuration settings for * the Connect Auth component */ export interface AuthSettings { /** * theme for the Auth component * Can be 'dark', 'light', or 'auto' */ theme?: 'dark' | 'light' | 'auto'; } /** * IncomingMessageType are enums of message types that * are registered that the host can handle. */ export declare enum IncomingMessageType { /** * OnboardingAppLoaded is received when the onboarding * app has initialized. */ OnboardingAppLoaded = "ONBOARDING_APP_LOADED", /** * OnboardingCloseButtonClicked is received when the close button * has been clicked in the onboarding app */ OnboardingCloseButtonClicked = "ONBOARDING_CLOSE_BUTTON_CLICKED", /** * OnboardingCompleted is received when the onboarding flow has completed * successfully with participant approved and webview can be closed. */ OnboardingCompleted = "ONBOARDING_COMPLETED", /** * OnboardingFailed is received when the onboarding * flow has failed. */ OnboardingFailed = "ONBOARDING_FAILED", /** * OnboardingPendingApproval is received when the onboarding * flow has completed successfully but the participant is pending approval. */ OnboardingPendingApproval = "ONBOARDING_PENDING_APPROVAL", /** * CryptoWithdrawalsAppLoaded is received when the crypto * withdrawals app has initialized. */ CryptoWithdrawalsAppLoaded = "CRYPTO_WITHDRAWALS_APP_LOADED", /** * CryptoWithdrawalsCloseButtonClicked is received when the close button * has been clicked in the Crypto Withdrawals app */ CryptoWithdrawalsCloseButtonClicked = "CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED", /** * CryptoWithdrawalsCompleted is received when the Crypto * withdrawals flow has completed successfully. */ CryptoWithdrawalsCompleted = "CRYPTO_WITHDRAWALS_COMPLETED", /** * CryptoWithdrawalsFailed is received when the Crypto * withdrawals flow has failed. */ CryptoWithdrawalsFailed = "CRYPTO_WITHDRAWALS_FAILED", /** * FiatDepositsAppLoaded is received when the Fiat * deposits app has initialized. */ FiatDepositsAppLoaded = "FIAT_DEPOSITS_APP_LOADED", /** * FiatDepositsCloseButtonClicked is received when the close button * has been clicked in the Fiat Deposits app */ FiatDepositsCloseButtonClicked = "FIAT_DEPOSITS_CLOSE_BUTTON_CLICKED", /** * FiatDepositsCompleted is received when the Fiat * deposits flow has completed successfully. */ FiatDepositsCompleted = "FIAT_DEPOSITS_COMPLETED", /** * FiatDepositsFailed is received when the Fiat * deposits flow has failed. */ FiatDepositsFailed = "FIAT_DEPOSITS_FAILED", /** * FiatWithdrawalsAppLoaded is received when the Fiat * withdrawals app has initialized. */ FiatWithdrawalsAppLoaded = "FIAT_WITHDRAWALS_APP_LOADED", /** * FiatWithdrawalsCloseButtonClicked is received when the close button * has been clicked in the Fiat Withdrawals app */ FiatWithdrawalsCloseButtonClicked = "FIAT_WITHDRAWALS_CLOSE_BUTTON_CLICKED", /** * FiatWithdrawalsCompleted is received when the Fiat * withdrawals flow has completed successfully. */ FiatWithdrawalsCompleted = "FIAT_WITHDRAWALS_COMPLETED", /** * FiatWithdrawalsFailed is received when the Fiat * withdrawals flow has failed. */ FiatWithdrawalsFailed = "FIAT_WITHDRAWALS_FAILED", /** * CryptoBuyAppLoaded is received when the Crypto * buy app has initialized. */ CryptoBuyAppLoaded = "CRYPTO_BUY_APP_LOADED", /** * CryptoBuyCloseButtonClicked is received when the close button * has been clicked in the Crypto buy app */ CryptoBuyCloseButtonClicked = "CRYPTO_BUY_CLOSE_BUTTON_CLICKED", /** * CryptoBuyCompleted is received when the Crypto * buy flow flow has completed successfully. */ CryptoBuyCompleted = "CRYPTO_BUY_COMPLETED", /** * CryptoBuyFailed is received when the Crypto * buy flow has failed. */ CryptoBuyFailed = "CRYPTO_BUY_FAILED", /** * CryptoSellAppLoaded is received when the Crypto * sell app has initialized. */ CryptoSellAppLoaded = "CRYPTO_SELL_APP_LOADED", /** * CryptoSellCloseButtonClicked is received when the close button * has been clicked in the Crypto sell app */ CryptoSellCloseButtonClicked = "CRYPTO_SELL_CLOSE_BUTTON_CLICKED", /** * CryptoSellCompleted is received when the Crypto * sell flow has completed successfully. */ CryptoSellCompleted = "CRYPTO_SELL_COMPLETED", /** * CryptoSellFailed is received when the Crypto * sell flow has failed. */ CryptoSellFailed = "CRYPTO_SELL_FAILED", /** * FundAppLoaded is received when the Fund * app has initialized. */ FundAppLoaded = "FUND_APP_LOADED", /** * FundCloseButtonClicked is received when the close button * has been clicked in the Fund app */ FundCloseButtonClicked = "FUND_CLOSE_BUTTON_CLICKED", /** * FundCompleted is received when the * Fund flow has completed successfully. */ FundCompleted = "FUND_COMPLETED", /** * FundFailed is received when the * Fund flow has failed. */ FundFailed = "FUND_FAILED", /** * FundError is received when an error occurs * in the Fund flow (from Auth onError callback). */ FundError = "FUND_ERROR", /** * FundDepositSubmitted is received when a deposit * is submitted in the Fund flow. */ FundDepositSubmitted = "FUND_DEPOSIT_SUBMITTED", /** * FundConnectDeposit is received when Connect Auth component * calls onDeposit (exclusive to Connect Auth, not from iframe). */ FundConnectDeposit = "FUND_CONNECT_DEPOSIT", /** * FundConnectEvent is received when Connect Auth component * calls onEvent with any event type (catch-all for Auth events). */ FundConnectEvent = "FUND_CONNECT_EVENT", /** * ProfileAppLoaded is received when the Profile * app has initialized. */ ProfileAppLoaded = "PROFILE_APP_LOADED", /** * ProfileCloseButtonClicked is received when the close button * has been clicked in the Profile app */ ProfileCloseButtonClicked = "PROFILE_CLOSE_BUTTON_CLICKED", /** * ProfileFailed is received when the * Profile flow has failed. */ ProfileFailed = "PROFILE_FAILED", /** * CryptoAccountLinkAppLoaded is received when the Crypto Account Link * app has initialized. */ CryptoAccountLinkAppLoaded = "CRYPTO_ACCOUNT_LINK_APP_LOADED", /** * CryptoAccountLinkCloseButtonClicked is received when the close button * has been clicked in the Crypto Account Link app */ CryptoAccountLinkCloseButtonClicked = "CRYPTO_ACCOUNT_LINK_CLOSE_BUTTON_CLICKED", /** * CryptoAccountLinkFailed is received when the * Crypto Account Link flow has failed. */ CryptoAccountLinkFailed = "CRYPTO_ACCOUNT_LINK_FAILED", /** * CryptoAccountLinkCompleted is received when the * Crypto Account Link flow is completed. */ CryptoAccountLinkCompleted = "CRYPTO_ACCOUNT_LINK_COMPLETED", /** * CryptoAccountLinkPayoutsAppLoaded is received when the * Crypto Account Link Payouts has initialized. */ CryptoAccountLinkPayoutsAppLoaded = "CRYPTO_ACCOUNT_LINK_PAYOUTS_APP_LOADED", /** * CryptoAccountLinkPayoutsCloseButtonClicked is received when the close button * has been clicked in the Crypto Account Link Payouts app */ CryptoAccountLinkPayoutsCloseButtonClicked = "CRYPTO_ACCOUNT_LINK_PAYOUTS_CLOSE_BUTTON_CLICKED", /** * CryptoAccountLinkPayoutsFailed is received when the * Crypto Account Link Payouts flow has failed. */ CryptoAccountLinkPayoutsFailed = "CRYPTO_ACCOUNT_LINK_PAYOUTS_FAILED", /** * CryptoAccountLinkPayoutsCompleted is received when the * Crypto Account Link Payouts flow is completed. */ CryptoAccountLinkPayoutsCompleted = "CRYPTO_ACCOUNT_LINK_PAYOUTS_COMPLETED", /** * PayoutsAppLoaded is received when the Payouts app has initialized. */ PayoutsAppLoaded = "PAYOUTS_APP_LOADED", /** * PayoutsCloseButtonClicked is received when the close button * has been clicked in the Payouts app */ PayoutsCloseButtonClicked = "PAYOUTS_CLOSE_BUTTON_CLICKED", /** * PayoutsCompleted is received when the Payouts flow has completed successfully. */ PayoutsCompleted = "PAYOUTS_COMPLETED", /** * PayoutsFailed is received when the Payouts flow has failed. */ PayoutsFailed = "PAYOUTS_FAILED", /** * PayAppLoaded is received when the Pay app has initialized. */ PayAppLoaded = "PAY_APP_LOADED", /** * PayCloseButtonClicked is received when the close button * has been clicked in the Pay app */ PayCloseButtonClicked = "PAY_CLOSE_BUTTON_CLICKED", /** * PayCompleted is received when the Pay flow has completed successfully. */ PayCompleted = "PAY_COMPLETED", /** * PayFailed is received when the Pay flow has failed. */ PayFailed = "PAY_FAILED", /** * FiatAccountLinkAppLoaded is received when the Fiat Account Link * app has initialized. */ FiatAccountLinkAppLoaded = "FIAT_ACCOUNT_LINK_APP_LOADED", /** * FiatAccountLinkCloseButtonClicked is received when the close button * has been clicked in the Fiat Account Link app */ FiatAccountLinkCloseButtonClicked = "FIAT_ACCOUNT_LINK_CLOSE_BUTTON_CLICKED", /** * FiatAccountLinkFailed is received when the * Fiat Account Link flow has failed. */ FiatAccountLinkFailed = "FIAT_ACCOUNT_LINK_FAILED", /** * FiatAccountLinkCompleted is received when the * Fiat Account Link flow is completed. */ FiatAccountLinkCompleted = "FIAT_ACCOUNT_LINK_COMPLETED", /** * StyleConfig is used to load the style configuration when the app loads. */ StyleConfig = "STYLE_CONFIG" } /** * IncomingMessage defines the structure of an incoming * message */ export interface IncomingMessage { /** * type is the type of message that is used for routing * the request to the appropriate handler */ type: IncomingMessageType; /** * payload is any freeform value that pertains to the * request */ payload: unknown; } export type IncomingMessageHandler = (payload: unknown) => void; /** * IZeroHashSDK is the interface that you may use to interact with the ZeroHash SDK. */ export interface IZeroHashSDK { setUserOnboardingJWT(params: ISetUserOnboardingJWTParameters): void; isOnboardingModalOpen(): boolean; openOnboardingModal(params: IOpenOnboardingModalParameters): void; closeOnboardingModal(): void; } /** * App identifier used to identify to which App we want to perform * the requested action, i.e. sdk.setJWT(AppIdentifier.ONBOARDING) */ export declare enum AppIdentifier { ONBOARDING = "onboarding", CRYPTO_WITHDRAWALS = "crypto-withdrawals", FIAT_DEPOSITS = "fiat-deposits", FIAT_WITHDRAWALS = "fiat-withdrawals", CRYPTO_BUY = "crypto-buy", CRYPTO_SELL = "crypto-sell", CSP_CRYPTO_WITHDRAWALS = "csp-crypto-withdrawals", CSP_FIAT_WITHDRAWALS = "csp-fiat-withdrawals", CSP_CRYPTO_SELL = "csp-crypto-sell", FUND = "fund", PROFILE = "profile", CRYPTO_ACCOUNT_LINK = "crypto-account-link", CRYPTO_ACCOUNT_LINK_PAYOUTS = "crypto-account-link-payouts", PAYOUTS = "payouts", PAY = "pay", FIAT_ACCOUNT_LINK = "fiat-account-link" } /** * Map that maps the app AppIdentifier to the redux action prefix */ export declare const appIdentifierToActionPrefixMap: Map; export interface ISetJWTParameters { jwt: string; appIdentifier: AppIdentifier; } export interface Filters { getAssets?: { deposit_address_creation?: string; stablecoin?: boolean; }; } export interface IOpenModalParameters { jwt?: string; appIdentifier: AppIdentifier; filters?: Filters; navigate?: Page; } export interface ISetFiltersParameters { appIdentifier: AppIdentifier; filters?: Filters; } export interface EditAddress { to: "edit-address"; } /** * Since we may extend this in the future, we use a union type to make it easy * to allow for example a new CryptoBuyPage type to be added in the future or * new pages for the Onboarding App with specialized props. * Page is expected to be a union of "AppPage" and each App shall have it's own * union of pages, such as EditAddress. */ export type OnboardingPage = EditAddress; export type Page = OnboardingPage; export interface ISetNavigateParameters { appIdentifier: AppIdentifier; navigate: Page; } /** * StyleConfigMessage defines the structure of a style configuration message * received from postMessage events. All style properties are optional to allow * partial style updates. */ export interface StyleConfigMessage { type: 'STYLE_CONFIG'; appWrapperStyle?: CSSProperties; modalStyle?: CSSProperties; iframeWrapperStyle?: CSSProperties; iframeStyle?: CSSProperties; }