@types/marvelapp__react-ab-test
TypeScript icon, indicating that this package has built-in type declarations

3.1.4 • Public • Published

Installation

npm install --save @types/marvelapp__react-ab-test

Summary

This package contains type definitions for @marvelapp/react-ab-test (https://github.com/marvelapp/react-ab-test#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/marvelapp__react-ab-test.

index.d.ts

import { JSX } from "react";

export type ListenerCallback = (experimentName: string, variantName: string) => void;
export interface Subscription {
    remove(): void;
    listener: ListenerCallback;
    eventType: string;
}

export namespace emitter {
    function emitWin(experimentName: string): void;
    function addActiveVariantListener(eventName: string | ListenerCallback, callback?: ListenerCallback): Subscription;
    function addPlayListener(eventName: string | ListenerCallback, callback?: ListenerCallback): Subscription;
    function addWinListener(eventName: string | ListenerCallback, callback?: ListenerCallback): Subscription;
    function defineVariants(experimentName: string, variantNames: string[], variantWeights?: number[]): void;
    function setActiveVariant(experimentName: string, variantName: string): void;
    function getActiveVariant(experimentName: string): string;
    function calculateActiveVariant(
        experimentName: string,
        userIdentifier?: string,
        defaultVariantName?: string,
    ): string;
    function getSortedVariants(experimentName: string): string[];
    function setCustomDistributionAlgorithm(
        customAlgorithm: (experimentName: string, userIdentifier: string, defaultVariantName?: string) => void,
    ): void;
}

export interface ExperimentProps {
    name: string;
    defaultVariantName?: string;
    userIdentifier?: string;
    children: React.ReactNode;
}

export function Experiment({
    name,
    defaultVariantName,
    userIdentifier,
    children,
}: ExperimentProps): JSX.Element;

export function Variant({
    name,
    children,
}: { name: string; children: React.ReactNode }): JSX.Element;

export namespace experimentDebugger {
    function setDebuggerAvailable(isAvailable: boolean): void;
    function enable(): void;
    function disable(): void;
}

export namespace mixpanelHelper {
    function enable(): void;
    function disable(): void;
}

export namespace segmentHelper {
    function enable(): void;
    function disable(): void;
}

Additional Details

  • Last updated: Mon, 04 Dec 2023 17:35:44 GMT
  • Dependencies: @types/react

Credits

These definitions were written by mtayllan.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/marvelapp__react-ab-test

Weekly Downloads

2,404

Version

3.1.4

License

MIT

Unpacked Size

6.82 kB

Total Files

5

Last publish

Collaborators

  • types