UNPKG

@notifi-network/notifi-react

Version:

React components to access Notifi core services

1,187 lines (1,145 loc) 43.1 kB
import * as _notifi_network_notifi_frontend_client from '@notifi-network/notifi-frontend-client'; import { NotifiFrontendClient, WalletWithSignParams, NotifiEnvironment, NotifiFrontendConfiguration, InputObject, FusionFilterOptions, LabelUiConfig, LabelEventTypeItem, FusionToggleEventTypeItem, TopicUiConfig, EventTypeItem, FusionEventTopic, TopicMetadata, UserInputParam, UiType, FusionEventMetadata, AlertFilter, Filter, FrequencyFilter, ValueType, CardConfigItemV1, CardConfigItemV2, AuthParams, SmartLinkAction as SmartLinkAction$1, NotifiSmartLinkClient, ActionInputParamsCheckBox as ActionInputParamsCheckBox$1, ActionInputParamsTextBox as ActionInputParamsTextBox$1 } from '@notifi-network/notifi-frontend-client'; import React, { FC, PropsWithChildren } from 'react'; type FrontendClientStatus = { isExpired: boolean; isInitialized: boolean; isAuthenticated: boolean; }; /** * @param nonce - The signature signed by any type of transaction with this nonce can be used with the following login method for authentication. NOTE: Nonce is refreshed every 10 minutes, and expires in 15 minutes. So, If a tx process takes more than 5 minutes, it could potentially failed to login due to nonce expiration. * @param login - By passing above signature, the user can be authenticated; * */ type LoginViaTransaction = { nonce: string; login: (signatureSignedWithNotifiNonce: string) => Promise<NotifiFrontendClient | undefined>; }; type NotifiFrontendClientContextType = { frontendClient: NotifiFrontendClient; frontendClientStatus: FrontendClientStatus; isLoading: boolean; error: Error | null; login: () => Promise<NotifiFrontendClient | undefined>; logout: () => Promise<void>; loginViaHardwareWallet: () => Promise<NotifiFrontendClient | undefined>; loginViaTransaction: LoginViaTransaction | null; walletWithSignParams: WalletWithSignParams; }; declare const NotifiFrontendClientContext: React.Context<NotifiFrontendClientContextType>; type NotifiFrontendClientProviderProps = { tenantId: string; env?: NotifiEnvironment; storageOption?: NotifiFrontendConfiguration['storageOption']; isEnabledLoginViaTransaction?: boolean; } & WalletWithSignParams; declare const NotifiFrontendClientContextProvider: React.FC<React.PropsWithChildren<NotifiFrontendClientProviderProps>>; declare const useNotifiFrontendClientContext: () => NotifiFrontendClientContextType; type Maybe<T> = T | undefined; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: { input: string; output: string; }; String: { input: string; output: string; }; Boolean: { input: boolean; output: boolean; }; Int: { input: number; output: number; }; Float: { input: number; output: number; }; /** The `DateTime` scalar represents an ISO-8601 compliant date time type. */ DateTime: { input: string; output: string; }; /** The `Decimal` scalar type represents a decimal floating-point number. */ Decimal: { input: number; output: number; }; JSON: { input: any; output: any; }; /** The `Long` scalar type represents non-fractional signed whole 64-bit numeric values. Long can represent values between -(2^63) and 2^63 - 1. */ Long: { input: any; output: any; }; }; type AccountBalanceChangeDirection = 'INCOMING' | 'OUTGOING'; type BlockchainType = 'ABSTRACT' | 'ACALA' | 'AGORIC' | 'APTOS' | 'ARBITRUM' | 'ARCH' | 'ARCHWAY' | 'AVALANCHE' | 'AXELAR' | 'BASE' | 'BERACHAIN' | 'BINANCE' | 'BITCOIN' | 'BLAST' | 'BOB' | 'BOTANIX' | 'CELESTIA' | 'CELO' | 'COSMOS' | 'DYDX' | 'DYMENSION' | 'ELYS' | 'ETHEREUM' | 'EVMOS' | 'HYPEREVM' | 'INJECTIVE' | 'KAVA' | 'LINEA' | 'MANTA' | 'MANTLE' | 'MONAD' | 'MOVEMENT' | 'NEAR' | 'NEUTRON' | 'NIBIRU' | 'OFF_CHAIN' | 'OPTIMISM' | 'ORAI' | 'OSMOSIS' | 'PERSISTENCE' | 'POLYGON' | 'ROME' | 'SCROLL' | 'SEI' | 'SOLANA' | 'SONIC' | 'SUI' | 'SWELLCHAIN' | 'THE_ROOT_NETWORK' | 'UNICHAIN' | 'UNSPECIFIED' | 'XION' | 'ZKSYNC'; type DiscordTargetStatus = 'COMPLETE' | 'DISCORD_SERVER_NOT_JOINED' | 'UNVERIFIED'; type GenericEventIconHint = 'CHART' | 'CHECKMARK' | 'CLOCK' | 'DAO' | 'DOWN_ARROW' | 'FLAG' | 'GRAPH' | 'INFO' | 'MEGAPHONE' | 'PERCENT' | 'STAR' | 'SWAP' | 'UP_ARROW' | 'URGENT' | 'WATCH'; type NftCollectionsReportType = 'HOT' | 'MOST_TRADED'; type NotificationCategory = 'BALANCE_CHANGE' | 'CHAT' | 'COIN_PRICE_CHANGE' | 'CREATOR_MESSAGE' | 'DAO_PROPOSAL' | 'NFT_AUCTION'; type SlackTargetStatus = 'MISSING_CHANNEL' | 'MISSING_PERMISSIONS' | 'UNVERIFIED' | 'VERIFIED'; type TargetType = 'BROWSER_PUSH' | 'DISCORD' | 'EMAIL' | 'FCM' | 'PLATFORM' | 'SLACK_CHANNEL' | 'SMS' | 'TELEGRAM' | 'WEB3' | 'WEBHOOK'; type WalletBlockchain = 'ABSTRACT' | 'ACALA' | 'AGORIC' | 'APTOS' | 'ARBITRUM' | 'ARCH' | 'ARCHWAY' | 'AVALANCHE' | 'AXELAR' | 'BASE' | 'BERACHAIN' | 'BINANCE' | 'BITCOIN' | 'BLAST' | 'BOB' | 'BOTANIX' | 'CELESTIA' | 'CELO' | 'COSMOS' | 'DYDX' | 'DYMENSION' | 'ELYS' | 'ETHEREUM' | 'EVMOS' | 'HYPEREVM' | 'INJECTIVE' | 'KAVA' | 'LINEA' | 'MANTA' | 'MANTLE' | 'MONAD' | 'MOVEMENT' | 'NEAR' | 'NEUTRON' | 'NIBIRU' | 'OFF_CHAIN' | 'OPTIMISM' | 'ORAI' | 'OSMOSIS' | 'PERSISTENCE' | 'POLYGON' | 'ROME' | 'SCROLL' | 'SEI' | 'SOLANA' | 'SONIC' | 'SUI' | 'SWELLCHAIN' | 'THE_ROOT_NETWORK' | 'UNICHAIN' | 'XION' | 'ZKSYNC'; type WalletsActivityReportType = 'MOST_ACTIVE'; /** Web3 Target */ type Web3Target = { __typename?: 'Web3Target'; accountId?: Maybe<Scalars['String']['output']>; createdDate: Scalars['DateTime']['output']; id: Scalars['String']['output']; isConfirmed: Scalars['Boolean']['output']; name?: Maybe<Scalars['String']['output']>; senderAddress?: Maybe<Scalars['String']['output']>; targetProtocol: Web3TargetProtocol; updatedDate: Scalars['DateTime']['output']; walletBlockchain: WalletBlockchain; }; type Web3TargetProtocol = 'XMTP'; type DiscordTargetFragmentFragment = { __typename?: 'DiscordTarget'; id: string; discordAccountId?: string | undefined; discriminator?: string | undefined; isConfirmed: boolean; username?: string | undefined; name?: string | undefined; userStatus: DiscordTargetStatus; verificationLink?: string | undefined; discordServerInviteLink?: string | undefined; }; type NotificationHistoryEntryFragmentFragment = { __typename: 'NotificationHistoryEntry'; id: string; createdDate: string; eventId: string; read: boolean; sourceAddress?: string | undefined; category?: NotificationCategory | undefined; transactionSignature?: string | undefined; targets: Array<{ __typename?: 'NotificationTarget'; type: TargetType; name?: string | undefined; }>; detail?: { __typename: 'AccountBalanceChangedEventDetails'; walletBlockchain: WalletBlockchain; direction: AccountBalanceChangeDirection; newValue: number; previousValue: number; tokenSymbol: string; isWhaleWatch: boolean; } | { __typename: 'BroadcastMessageEventDetails'; subject?: string | undefined; message?: string | undefined; messageHtml?: string | undefined; messageType: string; } | { __typename: 'ChatMessageReceivedEventDetails'; } | { __typename: 'DAOProposalChangedEventDetails'; tenantName: string; description: string; state?: string | undefined; daoUrl?: string | undefined; proposalUrl?: string | undefined; proposalTitle?: string | undefined; } | { __typename: 'DirectTenantMessageEventDetails'; tenantName: string; targetTemplatesJson?: string | undefined; templateVariablesJson?: string | undefined; } | { __typename: 'GenericEventDetails'; sourceName: string; notificationTypeName: string; eventDetailsJson?: string | undefined; icon: GenericEventIconHint; genericMessage: string; genericMessageHtml?: string | undefined; action?: { __typename?: 'GenericEventAction'; name: string; url: string; } | undefined; } | { __typename: 'HealthValueOverThresholdEventDetails'; name: string; value: string; threshold: string; url: string; } | { __typename: 'NftAuctionChangedEventDetails'; auctionUrl?: string | undefined; walletBlockchain: WalletBlockchain; highBidAmount: number; highBidSymbol?: string | undefined; imageUrl?: string | undefined; auctionTitle: string; } | { __typename: 'NftCollectionsReportEventDetails'; type: NftCollectionsReportType; providerName: string; sourceLink: string; collections: Array<{ __typename?: 'NftCollectionStats'; collectionId: string; name: string; imgUrl?: string | undefined; volume1Day?: string | undefined; volume1DayChange?: string | undefined; }>; } | { __typename: 'WalletsActivityReportEventDetails'; providerName: string; sourceLink: string; walletActivityType: WalletsActivityReportType; wallets: Array<{ __typename?: 'WalletsActivityReportWallet'; address: string; volume1Day: string; maxPurchase1Day?: string | undefined; maxPurchaseName?: string | undefined; maxPurchaseImgUrl?: string | undefined; maxPurchaseTokenAddress?: string | undefined; }>; } | undefined; }; type SlackChannelTargetFragmentFragment = { __typename?: 'SlackChannelTarget'; id: string; name?: string | undefined; slackChannelName?: string | undefined; slackWorkspaceName?: string | undefined; verificationLink?: string | undefined; webhookVerificationLink?: string | undefined; verificationStatus: SlackTargetStatus; }; type TargetGroupFragmentFragment = { __typename?: 'TargetGroup'; id: string; name?: string | undefined; emailTargets?: Array<{ __typename?: 'EmailTarget'; emailAddress?: string | undefined; id: string; isConfirmed: boolean; name?: string | undefined; } | undefined> | undefined; smsTargets?: Array<{ __typename?: 'SmsTarget'; id: string; isConfirmed: boolean; name?: string | undefined; phoneNumber?: string | undefined; } | undefined> | undefined; telegramTargets?: Array<{ __typename?: 'TelegramTarget'; id: string; isConfirmed: boolean; name?: string | undefined; telegramId: string; confirmationUrl?: string | undefined; } | undefined> | undefined; discordTargets?: Array<{ __typename?: 'DiscordTarget'; id: string; discordAccountId?: string | undefined; discriminator?: string | undefined; isConfirmed: boolean; username?: string | undefined; name?: string | undefined; userStatus: DiscordTargetStatus; verificationLink?: string | undefined; discordServerInviteLink?: string | undefined; } | undefined> | undefined; slackChannelTargets?: Array<{ __typename?: 'SlackChannelTarget'; id: string; name?: string | undefined; slackChannelName?: string | undefined; slackWorkspaceName?: string | undefined; verificationLink?: string | undefined; webhookVerificationLink?: string | undefined; verificationStatus: SlackTargetStatus; } | undefined> | undefined; web3Targets?: Array<{ __typename?: 'Web3Target'; id: string; name?: string | undefined; accountId?: string | undefined; walletBlockchain: WalletBlockchain; targetProtocol: Web3TargetProtocol; isConfirmed: boolean; senderAddress?: string | undefined; } | undefined> | undefined; }; type TelegramTargetFragmentFragment = { __typename?: 'TelegramTarget'; id: string; isConfirmed: boolean; name?: string | undefined; telegramId: string; confirmationUrl?: string | undefined; }; type Web3TargetFragmentFragment = { __typename?: 'Web3Target'; id: string; name?: string | undefined; accountId?: string | undefined; walletBlockchain: WalletBlockchain; targetProtocol: Web3TargetProtocol; isConfirmed: boolean; senderAddress?: string | undefined; }; type CompleteLogInWithWeb3Mutation = { __typename?: 'NotifiMutation'; completeLogInWithWeb3: { __typename?: 'CompleteLogInWithWeb3Payload'; user?: { __typename?: 'User'; email?: string | undefined; emailConfirmed?: boolean | undefined; roles?: Array<string | undefined> | undefined; authorization?: { __typename?: 'Authorization'; token: string; expiry: string; } | undefined; } | undefined; }; }; type SignCoinbaseSignature = (frontendClient: NotifiFrontendClient, web3TargetId: Web3Target['id'], senderAddress: string) => Promise<Web3TargetFragmentFragment | undefined>; type NotifiWalletTargetContextType = { isLoading: boolean; error: Error | null; signCoinbaseSignature: SignCoinbaseSignature; }; declare const defaultCopy: { connect: { title: string; description: string; hardwareWalletLabel: string; buttonText: string; }; poweredByNotifi: string; inputFields: { email: string; phoneNumber: string; }; ftu: { headerTitles: { ftuTargetEdit: string; ftuAlertEdit: string; }; }; ftuTargetEdit: { description: string; headerTitle: string; buttonText: string; }; ftuTargetList: { headerTitle: string; buttonText: string; }; ftuAlertEdit: { headerTitle: string; buttonText: string; }; targetList: { email: string; phoneNumber: string; telegram: string; discord: string; slack: string; wallet: string; emailVerifyMessage: string; discordVerifiedMessage: string; discordVerifiedPromptTooltip: string; walletVerifyMessage: string; walletVerifyTooltip: string; walletVerifiedMessage: string; walletVerifiedTooltip: string; walletVerifiedTooltipLink: { text: string; url: string; }; }; topicOptions: { customInputPlaceholder: string; }; subscriptionValueInput: { dropdownPlaceholder: string; }; topicStackRowInput: { buttonContent: string; }; topicStackRow: { cta: string; }; historyRow: { legacyTopic: string; }; inboxHistoryList: { headerTitle: string; buttonText: string; }; inboxHistoryDetail: { headerTitle: string; }; historyList: { inboxEmptyTitle: string; inboxEmptyDescription: string; }; inboxConfigTopic: { header: string; title: string; }; targetStateBanner: { verify: { title: string; description: string; }; verifyInHistory: { title: string; ctaText: string; }; Signup: { textInHistory: string; ctaInHistory: string; textInConfig: string; }; }; inboxConfigTargetList: { header: string; buttonText: string; }; errorGlobal: { header: string; title: string; detail: string; }; targetInputField: { inValidErrorMessage: (target: Target) => string; }; }; type LabelWithSubTopicsEventTypeItem = (LabelUiConfig | LabelEventTypeItem) & { subTopics: Array<FusionToggleEventTypeItem | TopicUiConfig>; }; declare const categorizeTopics: (topics: ReadonlyArray<EventTypeItem | LabelEventTypeItem | TopicUiConfig | LabelUiConfig>, unCategorizedTopicsLabelName?: string) => { categorizedTopics: LabelWithSubTopicsEventTypeItem[]; uncategorizedTopics: LabelWithSubTopicsEventTypeItem; }; declare const getUserInputParams: (topic: FusionEventTopic | TopicMetadata) => UserInputParam<UiType>[]; declare const getUiConfigOverride: (topic: FusionEventTopic | TopicMetadata) => FusionEventMetadata["uiConfigOverride"]; declare const getFusionEventMetadata: (topic: FusionEventTopic | TopicMetadata) => FusionEventMetadata | null; declare const getFusionFilter: (topic: FusionEventTopic | TopicMetadata) => AlertFilter | null; declare const isTopicGroupValid: (topics: (FusionEventTopic | TopicMetadata)[]) => boolean; /** * @description * Compares two userInputParams by `name`, `defaultValue`, and `options` for strict equality. */ declare const areUserInputParamsStrictlyEqual: (a: UserInputParam<UiType>[], b: UserInputParam<UiType>[]) => boolean; declare const isFusionEventMetadata: (metadata: unknown) => metadata is FusionEventMetadata; declare const isAlertFilter: (filter: Filter) => filter is AlertFilter; declare const isFrequencyFilter: (filter: Filter) => filter is FrequencyFilter; declare const isFusionFilterOptions: (filterOptions: unknown) => filterOptions is FusionFilterOptions; declare const getUpdatedAlertFilterOptions: (filterName: string, alertFilterOptions: FusionFilterOptions, inputParmName: string, value: string | number) => { input: { [x: string]: _notifi_network_notifi_frontend_client.UserInputOptions | { [x: string]: string | number; }; }; version: 1; }; type AlertMetadataBase = { fusionEventTypeId: string; }; type AlertMetadataForTopicStack = AlertMetadataBase & { subscriptionValue: string; subscriptionLabel: string; timestamp: string; }; declare const isAlertMetadataForTopicStack: (alertMetadata: AlertMetadata) => alertMetadata is AlertMetadataForTopicStack; type AlertMetadata = AlertMetadataBase | AlertMetadataForTopicStack; declare const resolveAlertName: (alertName: string) => AlertMetadata; /** TopicStackRow related */ type TopicStackAlert = { alertName: string; id: string; subscriptionValueInfo: InputObject; filterOptions: FusionFilterOptions; }; declare const composeTopicStackAlertName: (fusionEventTypeId: string, subscriptionValue: string, subscriptionLabel: string) => string; /** * ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ * ⬇ ⬇ Deprecated functions ⬇ ⬇ * ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ ⬇ */ /** @deprecated no longer need this, use "value" directly. Reason: to simplify and show the values without any conversion. If the developer needs to convert the 50% to .5, then they can normalize their values by converting from .5 to 50. We give flexibility to the developers to pass any values from parsers */ declare const convertOptionValue: (value: string | number, type: ValueType, direction?: ConvertOptionDirection) => string | number; /** @deprecated - conversion logic is handled by BE */ declare enum ConvertOptionDirection { /**Note: Convert the value rendered in browser to notifi backend acceptable format */ FtoB = "frontendToBackend", /**Note: Convert the value received from notifi backend to frontend renderable format */ BtoF = "BackendToFrontend" } /** @deprecated - Use resolveAlertName instead */ declare const resolveTopicStackAlertName: (alertName: string) => { fusionEventTypeId: string; subscriptionValue: string; subscriptionLabel: string; timestamp: string; }; /** @deprecated use `userInputParam.prefixAndSuffix` */ declare const derivePrefixAndSuffixFromValueType: (kind: ValueType) => { prefix: string; suffix: string; }; declare const formTargets: readonly ["email", "phoneNumber"]; declare const toggleTargets: readonly ["discord", "slack", "telegram", "wallet"]; declare const hasTarget: (targetData: TargetData) => boolean; declare const hasValidTargetMoreThan: (targetData: TargetData, moreThan: number) => boolean; declare const isTargetCta: (targetInfoPrompt: TargetInfoPrompt | undefined) => targetInfoPrompt is CtaInfo; declare const isTargetVerified: (targetInfoPrompt: TargetInfoPrompt | undefined) => targetInfoPrompt is MessageInfo; declare const isFormTarget: (target: Target) => target is FormTarget; declare const isToggleTarget: (target: Target) => target is ToggleTarget; declare const getTargetValidateRegex: (target: FormTarget) => RegExp | undefined; declare const loginViaSolanaHardwareWallet: (frontendClient: NotifiFrontendClient, walletWithSignParams: WalletWithSignParams) => Promise<CompleteLogInWithWeb3Mutation>; declare function isEqual(value: any, other: any): boolean; type TargetGroupInput = { name: string; emailAddress?: string; phoneNumber?: string; telegramId?: string; discordId?: string; slackId?: string; walletId?: string; }; type TargetDocument = { targetGroupId: string | null; targetInputs: TargetInputs; targetInfoPrompts: Partial<Record<Target, TargetInfo>>; targetData: TargetData; }; type Target = FormTarget | ToggleTarget; type FormTarget = (typeof formTargets)[number]; type ToggleTarget = (typeof toggleTargets)[number]; type TargetInputFromValue = { value: string; error?: string; }; type TargetInputForm = Record<FormTarget, TargetInputFromValue>; type TargetInputToggles = Record<ToggleTarget, boolean>; type TargetInputs = TargetInputForm & TargetInputToggles; type TargetInfo = { target: Target; infoPrompt: TargetInfoPrompt; }; type TargetInfoPrompt = CtaInfo | MessageInfo; declare const isCtaInfo: (info: TargetInfoPrompt) => info is CtaInfo; type CtaInfo = { type: 'cta'; message: string; onClick: () => void; }; type MessageInfo = { type: 'error' | 'message'; message: string; }; type TargetData = { email: string; phoneNumber: string; telegram: { useTelegram: boolean; data?: TelegramTargetFragmentFragment; isAvailable: boolean; }; discord: { useDiscord: boolean; data?: DiscordTargetFragmentFragment; isAvailable: boolean; }; slack: { useSlack: boolean; data?: SlackChannelTargetFragmentFragment; isAvailable: boolean; }; wallet: { useWallet: boolean; data?: Web3TargetFragmentFragment; isAvailable?: boolean; }; }; type UpdateTargetInputs = <T extends 'form' | 'toggle'>(target: T extends 'form' ? FormTarget : ToggleTarget, value: T extends 'form' ? TargetInputFromValue : boolean) => void; type FormTargetRenewArgs = { target: FormTarget; value: string; }; type ToggleTargetRenewArgs = { target: ToggleTarget; value: boolean; }; type TargetRenewArgs = FormTargetRenewArgs | ToggleTargetRenewArgs; type TargetPlugin = { walletTarget: NotifiWalletTargetContextType; }; type NotifiTargetContextType = { isLoading: boolean; error: Error | null; updateTargetInputs: UpdateTargetInputs; renewTargetGroup: (singleTargetRenewArgs?: TargetRenewArgs) => Promise<TargetGroupFragmentFragment | null>; isChangingTargets: Record<Target, boolean>; targetDocument: TargetDocument; unVerifiedTargets: Target[]; plugin?: TargetPlugin; }; type NotifiTargetContextProviderProps = { toggleTargetAvailability?: Partial<Record<ToggleTarget, boolean>>; plugin?: TargetPlugin; }; declare const NotifiTargetContextProvider: FC<PropsWithChildren<NotifiTargetContextProviderProps>>; declare const useNotifiTargetContext: () => NotifiTargetContextType; type NotifiTenantConfigContextType = { cardConfig: CardConfigItemV1 | CardConfigItemV2 | null; fusionEventTopics: ReadonlyArray<FusionEventTopic | TopicMetadata>; inputs: Record<string, unknown>; isLoading: boolean; error: Error | null; getFusionTopic: (fusionEventId: string) => FusionEventTopic | TopicMetadata | undefined; }; type NotifiTenantConfigProps = { inputs?: Record<string, unknown>; cardId: string; }; declare const NotifiTenantConfigContextProvider: FC<PropsWithChildren<NotifiTenantConfigProps>>; declare const useNotifiTenantConfigContext: () => NotifiTenantConfigContextType; type TopicWithFilterOption = { topic: FusionEventTopic | TopicMetadata; filterOptions: FusionFilterOptions; subscriptionValue?: string; customAlertName?: string; }; type NotifiTopicContextType = { isLoading: boolean; error: Error | null; subscribeAlertsWithFilterOptions: (topicWithFilterOptionsList: ReadonlyArray<TopicWithFilterOption>, targetGroupId: string) => Promise<void>; subscribeAlertsDefault: (topics: ReadonlyArray<FusionEventTopic | TopicMetadata>, targetGroupId: string) => Promise<void>; unsubscribeAlerts: (topicNames: string[]) => void; isAlertSubscribed: (topicName: string) => boolean; getAlertFilterOptions: (topicName: string) => FusionFilterOptions | null; getTopicStackAlerts: (fusionEventTypeId: string) => TopicStackAlert[]; /**@deprecated Use unsubscribeAlerts instead */ unsubscribeAlert: (topicName: string) => void; /**@deprecated Use getTopicStackAlerts instead */ getTopicStackAlertsFromTopicName: (topicName: string) => TopicStackAlert[]; }; /** * @description Two important Notifi concepts: `Topic` and `Alert`. * - `Topic` is the event allowed to be subscribed (Tenant specific). => FusionEventTopic * - `Alert` is the subscription of the `Topic` (User specific). => Types.AlertFragmentFragment * Once a user subscribes to a `Topic`, he/she will has an `Alert` object. */ declare const NotifiTopicContextProvider: FC<PropsWithChildren>; declare const useNotifiTopicContext: () => NotifiTopicContextType; type HistoryItem = { id: string; timestamp: string; icon: string; topic: string; subject: string; message: string; read: boolean; customIconUrl: string; fusionEventId: string; }; type NotifiHistoryContextType = { isLoading: boolean; error: Error | null; getHistoryItems: (initialLoad?: boolean) => Promise<void>; markAsRead: (ids?: string[]) => Promise<void>; historyItems: HistoryItem[]; unreadCount: number; hasNextPage: boolean; isIncludeRead: boolean; setIsIncludeRead: React.Dispatch<React.SetStateAction<boolean>>; }; type NotifiHistoryProviderProps = { notificationCountPerPage?: number; unreadCountScope?: 'tenant' | 'card'; }; declare const NotifiHistoryContextProvider: FC<PropsWithChildren<NotifiHistoryProviderProps>>; declare const useNotifiHistoryContext: () => NotifiHistoryContextType; type ValidEventDetail = Extract<NotificationHistoryEntryFragmentFragment['detail'], { __typename: 'GenericEventDetails'; }>; declare const validateEventDetails: (details: { __typename: string; }) => details is ValidEventDetail; type NotifiContextProviderProps = NotifiFrontendClientProviderProps & NotifiTenantConfigProps & NotifiHistoryProviderProps & NotifiTargetContextProviderProps; declare const NotifiContextProvider: FC<PropsWithChildren<NotifiContextProviderProps>>; declare enum FtuStage { Destination = 3, Alerts = 2, Done = 1 } type NotifiUserSettingContextType = { ftuStage: FtuStage | null; updateFtuStage: (ftuConfigStep: FtuStage) => Promise<void>; isLoading: boolean; error: Error | null; }; declare const NotifiUserSettingContextProvider: FC<PropsWithChildren>; declare const useNotifiUserSettingContext: () => NotifiUserSettingContextType; type SmartLinkActionUserInput = ActionInputTextBox | ActionInputCheckBox; type ActionInputBase = { id: string; }; type ActionInputTextBox = ActionInputBase & { type: 'TEXTBOX'; value: string | number; }; type ActionInputCheckBox = ActionInputBase & { type: 'CHECKBOX'; value: boolean; }; type ActivateSmartLinkActionResponse = { successMessage: string; failureMessage: string; transactions?: [BlockchainTransaction]; }; type BlockchainTransaction = { blockchainType: BlockchainType; UnsignedTransaction: string; }; type SmartLinkConfig = { id: string; icon: string; tenantName: string; bannerImgUrl: string; blockchainType: BlockchainType; name: string; description: string; title: string; subtitle: string; components: (SmartLinkAction | SmartLinkTxt | SmartLinkImg)[]; }; type SmartLinkTxt = { type: 'TEXT'; text: string; }; type SmartLinkImg = { type: 'IMAGE'; src: string; alt: string; }; type SmartLinkAction = { type: 'ACTION'; id: string; inputs: ActionInputParams[]; label: string /** This is the label that will be displayed on Action button */; }; type ActionInputParams = ActionInputParamsTextBox<'NUMBER'> | ActionInputParamsTextBox<'TEXT'> | ActionInputParamsCheckBox; type ActionInputBaseParams = { isRequired: boolean; id: string; }; type ActionInputParamsTextBox<T extends 'TEXT' | 'NUMBER'> = ActionInputBaseParams & { type: 'TEXTBOX'; inputType: T; placeholder: T extends 'NUMBER' ? number : string; default: T extends 'NUMBER' ? number : string; constraintType?: T extends 'NUMBER' ? NumberConstraint : StringConstraint; prefix?: string; suffix?: string; }; type ActionInputParamsCheckBox = ActionInputBaseParams & { type: 'CHECKBOX'; title: string; }; type NumberConstraint = { min?: number; max?: number; }; type StringConstraint = { minLength?: number; maxLength?: number; pattern?: string /** Regex pattern */; }; type SmartLinkConfigWithIsActive = { smartLinkConfig: SmartLinkConfig; isActive: boolean; }; type NotifiSmartLinkContextType = { authParams?: AuthParams; smartLinkConfigDictionary: SmartLinkConfigDictionary; actionDictionary: ActionDictionary; isLoading: boolean; error: Error | null; renewSmartLinkConfigAndActionDictionary: (smartLinkId: string) => Promise<void>; updateActionUserInputs: (smartLinkIdWithActionId: SmartLinkIdWithActionId, userInput?: { [userInputId: number]: ActionUserInputWithValidation; }) => void; executeSmartLinkAction: (args: Parameters<NotifiSmartLinkClient['activateSmartLinkAction']>[0] & { execute: ActionHandler; }) => Promise<void>; }; type ActionHandlerArgs = { smartLinkId: string; actionId: string; payload: ActivateSmartLinkActionResponse; }; type ActionHandler = (args: ActionHandlerArgs) => Promise<void>; type SmartLinkConfigDictionary = Record<string, SmartLinkConfigWithIsActive>; type ActionDictionary = Record<SmartLinkIdWithActionId, { action: SmartLinkAction$1; userInputs: Record<number, ActionUserInputWithValidation>; }>; type SmartLinkIdWithActionId = `${string}:;:${string}`; type ActionUserInputWithValidation = { userInput: SmartLinkActionUserInput; isValid: boolean; }; type NotifiSmartLinkContextProps = { env?: NotifiEnvironment; authParams?: AuthParams; }; declare const NotifiSmartLinkContextProvider: FC<PropsWithChildren<NotifiSmartLinkContextProps>>; declare const useNotifiSmartLinkContext: () => NotifiSmartLinkContextType; type Cta = 'onClose'; type GlobalCtas = Record<Cta, () => void>; type IconType = GenericEventIconHint | 'connect' | 'check' | 'email' | 'sms' | 'telegram' | 'arrow-back' | 'discord' | 'slack' | 'info' | 'bin' | 'gear' | 'gear-fill' | 'bell' | 'bell-fill' | 'empty-box' | 'round-bell' | 'chevron-right' | 'bell-circle' | 'check-circle' | 'bell-thin' | 'close' | 'triangle-down'; type NavHeaderCta = { icon: IconType; action: () => void; }; type NavHeaderRightCta = { icon: IconType; globalCtaType: Cta; }; type NavHeaderProps = { leftCta?: NavHeaderCta; rightCta?: NavHeaderRightCta; classNames?: { container?: string; }; }; type PoweredByNotifiProps = { copy?: string; classNames?: { container?: string; content?: string; notifiLogo?: string; notifiText?: string; }; }; type FooterContentText = { type: 'plain-text'; text: string; }; type FooterContentHyperlink = { type: 'hyperlink'; text: string; url: string; }; type FooterContent = (FooterContentText | FooterContentHyperlink)[]; type ConnectProps = { iconType?: IconType; setCardModalView: React.Dispatch<React.SetStateAction<CardModalView | null>>; loginWithoutSubscription?: boolean; copy?: { title?: string; hardwareWalletLabel?: string; buttonText?: string; description?: string; footerContent?: FooterContent; }; classNames?: { container?: string; main?: string; icon?: string; button?: string; footer?: string; PoweredByNotifi?: PoweredByNotifiProps['classNames']; loadingSpinner?: React.CSSProperties; title?: string; description?: string; alertsContainer?: string; alert?: string; hardwareWallet?: string; hardwareWalletLabel?: string; buttonText?: string; footerContent?: string; }; navHeaderRightCta?: NavHeaderRightCta; }; type ErrorViewProps = { title?: string; detail?: string; cta?: NavHeaderCta; navHeaderRightCta?: NavHeaderRightCta; copy?: { header: string; }; classNames?: { container?: string; title?: string; main?: string; detail?: string; footer?: string; PoweredByNotifi?: PoweredByNotifiProps['classNames']; }; }; type FtuAlertEditProps = { onClickNext: () => void; onClickBack?: () => void; classNames?: { container?: string; main?: string; button?: string; loadingSpinner?: React.CSSProperties; buttonContainer?: string; }; copy?: { headerTitle?: string; buttonText?: string; }; navHeaderRightCta?: NavHeaderRightCta; }; type FtuTargetListProps = { onClickNext: () => void; classNames?: { container?: string; main?: string; button?: string; loadingSpinner?: React.CSSProperties; buttonContainer?: string; NavHeader?: NavHeaderProps['classNames']; }; copy?: { headerTitle?: string; buttonText?: string; }; navHeaderRightCta?: NavHeaderRightCta; }; type FtuProps = { onComplete: () => void; copy?: { FtuTargetList?: FtuTargetListProps['copy']; FtuAlertEdit?: FtuAlertEditProps['copy']; }; classNames?: { container?: string; footer?: string; ftuViews?: string; FtuTargetList?: FtuTargetListProps['classNames']; FtuAlertEdit?: FtuAlertEditProps['classNames']; PoweredByNotifi?: PoweredByNotifiProps['classNames']; }; navHeaderRightCta?: NavHeaderRightCta; }; type InboxConfigTargetListProps = { classNames?: { container?: string; main?: string; button?: string; loadingSpinner?: React.CSSProperties; NavHeader?: NavHeaderProps['classNames']; }; copy?: { header?: string; buttonText?: string; }; setInboxView: React.Dispatch<React.SetStateAction<InboxView>>; navHeaderRightCta?: NavHeaderRightCta; }; type TargetStateBannerProps = { classNames?: { container?: string; verifyBanner?: string; verifyBannerIcon?: string; verifyBannerContent?: string; verifyBannerTitle?: string; verifyBannerDescription?: string; verifyBannerCta?: string; signupBanner?: string; signupBannerContent?: string; signupBannerIcon?: string; signupBannerText?: string; signupBannerCta?: string; }; copy?: { verify?: { title?: string; description?: string; }; signup?: { text?: string; cta?: string; textInConfig?: string; }; }; onClickCta?: () => void; parentComponent?: 'history' | 'config'; }; type InboxConfigTopicProps = { classNames?: { container?: string; main?: string; TargetStateBanner?: TargetStateBannerProps['classNames']; banner?: string; title?: string; NavHeader?: NavHeaderProps['classNames']; }; copy?: { header?: string; title?: string; }; setInboxView: React.Dispatch<React.SetStateAction<InboxView>>; navHeaderRightCta?: NavHeaderRightCta; }; type InboxHistoryProps = { isHidden: boolean; classNames?: { container?: string; }; setInboxView: React.Dispatch<React.SetStateAction<InboxView>>; navHeaderRightCta?: NavHeaderRightCta; }; type InboxNavTabsProps = { setInboxView: React.Dispatch<React.SetStateAction<InboxView>>; inboxView: InboxView; classNames?: { container?: string; }; }; type InboxProps = { classNames?: { container?: string; footer?: string; inboxViews?: string; InboxNavTabs?: InboxNavTabsProps['classNames']; InboxConfigTargetList?: InboxConfigTargetListProps['classNames']; InboxConfigTopic?: InboxConfigTopicProps['classNames']; InboxHistory?: InboxHistoryProps['classNames']; }; copy?: { InboxConfigTargetList?: InboxConfigTargetListProps['copy']; InboxConfigTopic?: InboxConfigTopicProps['copy']; }; navHeaderRightCta?: NavHeaderRightCta; }; declare enum InboxView { InboxHistory = "inbox-history", InboxConfigTopic = "inbox-config-topic", InboxConfigTargetList = "inbox-config-target-list" } type LoadingGlobalProps = { copy?: { header: string; }; }; type NotifiCardModalProps = Readonly<{ copy?: { ErrorGlobal?: ErrorViewProps['copy']; LoadingGlobal?: LoadingGlobalProps['copy']; Connect?: ConnectProps['copy']; Ftu?: FtuProps['copy']; Inbox?: InboxProps['copy']; }; classNames?: Readonly<{ container?: string; Connect?: ConnectProps['classNames']; Ftu?: FtuProps['classNames']; Inbox?: InboxProps['classNames']; }>; darkMode?: boolean; globalCtas?: GlobalCtas; }>; type CardModalView = 'connect' | 'expiry' | 'ftu' | 'Inbox'; declare const NotifiCardModal: React.FC<NotifiCardModalProps>; type ActionInputCheckBoxProps = { input: ActionInputParamsCheckBox$1; smartLinkIdWithActionId: SmartLinkIdWithActionId; userInputId: number; classNames?: { container?: string; inputContainer?: string; input?: string; }; }; type ActionInputTextBoxNumberProps = { input: ActionInputParamsTextBox$1<'NUMBER'>; smartLinkIdWithActionId: SmartLinkIdWithActionId; userInputId: number; classNames?: { container?: string; constraintPrompt?: string; inputContainer?: string; input?: string; }; }; type ActionInputTextBoxStringProps = { input: ActionInputParamsTextBox$1<'TEXT'>; smartLinkIdWithActionId: SmartLinkIdWithActionId; userInputId: number; classNames?: { container?: string; inputContainer?: string; input?: string; }; }; type PreAction = { disabled: boolean; label: string; onClick: () => Promise<void>; onError?: (e: Error) => void; }; type SmartLinkActionProps = { smartLinkIdWithActionId: SmartLinkIdWithActionId; preAction?: PreAction; actionHandler: ActionHandler; copy?: { inactiveLabel: string; }; classNames?: { container?: string; textInputContainer?: string; checkboxContainer?: string; ActionInputTextBoxNumber?: ActionInputTextBoxNumberProps['classNames']; ActionInputTextBoxString?: ActionInputTextBoxStringProps['classNames']; ActionInputCheckBox?: ActionInputCheckBoxProps['classNames']; }; }; type NotifiSmartLinkProps = { smartLinkId: string; actionHandler: ActionHandler; theme?: 'light'; preAction?: PreAction; copy?: { SmartLinkAction?: SmartLinkActionProps['copy']; }; classNames?: { container?: string; image?: string; name?: string; nameLogo?: string; title?: string; subtitle?: string; componentContainer?: string; smartLinkText?: string; smartLinkImage?: string; SmartLinkAction?: SmartLinkActionProps['classNames']; ErrorView?: ErrorViewProps['classNames']; }; }; declare const NotifiSmartLink: React.FC<NotifiSmartLinkProps>; export { type ActionHandler, type ActionHandlerArgs, type AlertMetadata, type AlertMetadataBase, type AlertMetadataForTopicStack, type CardModalView, ConvertOptionDirection, type CtaInfo, type FormTarget, type FrontendClientStatus, FtuStage, type HistoryItem, type LabelWithSubTopicsEventTypeItem, type LoginViaTransaction, type MessageInfo, NotifiCardModal, type NotifiCardModalProps, NotifiContextProvider, type NotifiContextProviderProps, NotifiFrontendClientContext, NotifiFrontendClientContextProvider, type NotifiFrontendClientContextType, type NotifiFrontendClientProviderProps, NotifiHistoryContextProvider, type NotifiHistoryContextType, type NotifiHistoryProviderProps, NotifiSmartLink, type NotifiSmartLinkContextProps, NotifiSmartLinkContextProvider, type NotifiSmartLinkProps, NotifiTargetContextProvider, type NotifiTargetContextProviderProps, type NotifiTargetContextType, NotifiTenantConfigContextProvider, type NotifiTenantConfigContextType, type NotifiTenantConfigProps, NotifiTopicContextProvider, type NotifiTopicContextType, NotifiUserSettingContextProvider, type NotifiUserSettingContextType, type SmartLinkIdWithActionId, type Target, type TargetData, type TargetDocument, type TargetGroupInput, type TargetInfo, type TargetInfoPrompt, type TargetInputFromValue, type TargetInputToggles, type TargetInputs, type ToggleTarget, type TopicStackAlert, type TopicWithFilterOption, type UpdateTargetInputs, type ValidEventDetail, areUserInputParamsStrictlyEqual, categorizeTopics, composeTopicStackAlertName, convertOptionValue, defaultCopy, derivePrefixAndSuffixFromValueType, formTargets, getFusionEventMetadata, getFusionFilter, getTargetValidateRegex, getUiConfigOverride, getUpdatedAlertFilterOptions, getUserInputParams, hasTarget, hasValidTargetMoreThan, isAlertFilter, isAlertMetadataForTopicStack, isCtaInfo, isEqual, isFormTarget, isFrequencyFilter, isFusionEventMetadata, isFusionFilterOptions, isTargetCta, isTargetVerified, isToggleTarget, isTopicGroupValid, loginViaSolanaHardwareWallet, resolveAlertName, resolveTopicStackAlertName, toggleTargets, useNotifiFrontendClientContext, useNotifiHistoryContext, useNotifiSmartLinkContext, useNotifiTargetContext, useNotifiTenantConfigContext, useNotifiTopicContext, useNotifiUserSettingContext, validateEventDetails };