A set of blocking callback functions that are called at the appropriate time.

Example

<SuperfluidWidget callbacks={{
validatePersonalData: async (props) => { fetch('https://example.com', { method: 'POST', body: props?.data }) }},
}} />
interface Callbacks {
    onButtonClick?: ((props?) => void);
    onPaymentOptionUpdate?: ((paymentOption?) => void);
    onPersonalDataUpdate?: ((props?) => void);
    onRouteChange?: ((props?) => void);
    onSuccess?: (() => void);
    onSuccessButtonClick?: (() => void);
    onTransactionSent?: ((props?) => void);
    validatePersonalData?: ((data) => void | Errors | Promise<void | Errors>);
}

Hierarchy (view full)

Properties

onButtonClick?: ((props?) => void)

Called when a button is pressed. Usually a call to action (CTA).

Type declaration

    • (props?): void
    • Called when a button is pressed. Usually a call to action (CTA).

      Parameters

      • Optional props: {
            type: "next_step" | "skip_step" | "step_label" | "connect_wallet" | "switch_network" | "invoke_transaction" | "back_transactions" | "success_button" | "superfluid_dashboard" | "retry_gas_estimation" | "force_invoke_transaction" | "skip_to_next" | "copy_account_address" | "view_transaction_on_block_explorer";
        }
        • type: "next_step" | "skip_step" | "step_label" | "connect_wallet" | "switch_network" | "invoke_transaction" | "back_transactions" | "success_button" | "superfluid_dashboard" | "retry_gas_estimation" | "force_invoke_transaction" | "skip_to_next" | "copy_account_address" | "view_transaction_on_block_explorer"

      Returns void

onPaymentOptionUpdate?: ((paymentOption?) => void)

Called when the payment option is initialized or changed by the user.

Type declaration

    • (paymentOption?): void
    • Called when the payment option is initialized or changed by the user.

      Parameters

      Returns void

onPersonalDataUpdate?: ((props?) => void)

Called when any personalData fields update.

Type declaration

    • (props?): void
    • Called when any personalData fields update.

      Parameters

      • Optional props: {
            data?: Record<string, string>;
        }
        • Optional data?: Record<string, string>

      Returns void

onRouteChange?: ((props?) => void)

Called when the widget route changes. "Route" is a term to define the view the user sees.

Type declaration

    • (props?): void
    • Called when the widget route changes. "Route" is a term to define the view the user sees.

      Parameters

      • Optional props: {
            data?: Record<string, string>;
            route: "transactions" | "step_payment_option" | "step_wrap" | "step_review" | "step_personal_data" | "success_summary";
        }
        • Optional data?: Record<string, string>
        • route: "transactions" | "step_payment_option" | "step_wrap" | "step_review" | "step_personal_data" | "success_summary"

      Returns void

onSuccess?: (() => void)

Called when the checkout is successfully finished.

Type declaration

    • (): void
    • Called when the checkout is successfully finished.

      Returns void

      Deprecated

      Use onTransactionSent instead (filter for functionName === 'createFlow | 'updateFlow').

Deprecated

Use onTransactionSent instead (filter for functionName === 'createFlow | 'updateFlow').

onSuccessButtonClick?: (() => void)

Called when the merchant's success button is defined in the schema and it's clicked.

Type declaration

    • (): void
    • Called when the merchant's success button is defined in the schema and it's clicked.

      Returns void

onTransactionSent?: ((props?) => void)

Called when a transaction is executed.

Type declaration

    • (props?): void
    • Called when a transaction is executed.

      Parameters

      • Optional props: {
            functionName?: "createFlow" | "deleteFlow" | "grantPermissions" | "revokePermissions" | "setFlowrate" | "setFlowrateFrom" | "updateFlow" | "updateFlowOperatorPermissions";
            hash?: `0x${string}`;
        }
        • Optional functionName?: "createFlow" | "deleteFlow" | "grantPermissions" | "revokePermissions" | "setFlowrate" | "setFlowrateFrom" | "updateFlow" | "updateFlowOperatorPermissions"
        • Optional hash?: `0x${string}`

      Returns void

validatePersonalData?: ((data) => void | Errors | Promise<void | Errors>)

Called when the user clicks the "Continue" button in the personal data step.

Type declaration

    • (data): void | Errors | Promise<void | Errors>
    • Called when the user clicks the "Continue" button in the personal data step.

      Parameters

      Returns void | Errors | Promise<void | Errors>

Generated using TypeDoc