UNPKG

@promotedai/react-introspection

Version:

Promoted Introspection integration for React web apps

41 lines (40 loc) 1.34 kB
import React from 'react'; import { ByLogUserIdResult } from './PromotedIntrospection'; export declare enum REQUEST_ERRORS { DATA_NOT_FOUND = "DATA_NOT_FOUND", INVALID_RESPONSE = "INVALID_RESPONSE", FETCH_FAILED = "FETCH_FAILED" } declare type ErrorType = typeof REQUEST_ERRORS[keyof typeof REQUEST_ERRORS]; interface PromotedIntrospectionContextType { logUserId: string; experimentDetails?: { label: string; value: string; }[]; introspectionPayload?: ByLogUserIdResult[]; metadata?: { label: string; value: string; }[]; isIntrospectionEnabled: boolean; error?: ErrorType; errorPayload?: string; } export declare const PromotedIntrospectionContext: React.Context<PromotedIntrospectionContextType>; export interface PromotedIntrospectionProviderArgs { children: React.ReactNode; endpoint: string; logUserId: string; experimentDetails?: { label: string; value: string; }[]; metadata?: { label: string; value: string; }[]; isIntrospectionEnabled: boolean; } export declare const PromotedIntrospectionProvider: ({ children, endpoint, logUserId, experimentDetails, metadata, isIntrospectionEnabled, }: PromotedIntrospectionProviderArgs) => JSX.Element; export {};