@frak-labs/components
Version:
Frak Wallet components, helping any person to interact with the Frak wallet.
87 lines (86 loc) • 2.31 kB
TypeScript
import { InteractionTypeKey } from "@frak-labs/core-sdk";
import * as _$preact from "preact";
//#region src/components/ButtonWallet/types.d.ts
/**
* The props type for {@link ButtonWallet}.
* @inline
*/
type ButtonWalletProps = {
placement?: string;
/**
* Classname to apply to the button
*/
classname?: string;
/**
* Do we display the reward on the button?
* @defaultValue `false`
*/
useReward?: boolean;
/**
* Target interaction behind this sharing action (will be used to get the right reward to display)
*/
targetInteraction?: InteractionTypeKey;
};
//#endregion
//#region src/components/ButtonWallet/ButtonWallet.d.ts
/**
* Button to open wallet modal
*
* @param args
* @returns The wallet button with `<button>` tag
*
* @group components
*
* @example
* Basic usage:
* ```html
* <frak-button-wallet></frak-button-wallet>
* ```
*
* @example
* Using a custom class:
* ```html
* <frak-button-wallet classname="button button-primary"></frak-button-wallet>
* ```
*
* @example
* Using reward information:
* ```html
* <frak-button-wallet use-reward></frak-button-wallet>
* ```
*
* @example
* Using reward information for specific reward:
* ```html
* <frak-button-wallet use-reward target-interaction="custom.customerMeeting"></frak-button-wallet>
* ```
*
* @example
* Using placement:
* ```html
* <frak-button-wallet placement="hero-wallet"></frak-button-wallet>
* ```
*
* @see {@link @frak-labs/core-sdk!actions.modalBuilder | `modalBuilder()`} for more info about the modal display
* @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
*/
declare function ButtonWallet({
placement: placementId,
classname,
useReward: rawUseReward,
targetInteraction
}: ButtonWalletProps): _$preact.JSX.Element | null;
//#endregion
//#region src/components/ButtonWallet/index.d.ts
/**
* Custom element interface for `<frak-button-wallet>`.
* Combines standard {@link HTMLElement} with {@link ButtonWalletProps}.
*/
interface ButtonWalletElement extends HTMLElement, ButtonWalletProps {}
declare global {
interface HTMLElementTagNameMap {
"frak-button-wallet": ButtonWalletElement;
}
}
//#endregion
export { ButtonWallet, ButtonWalletElement };