import { default as default_2 } from 'react';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { ReachFeature } from '@reach/shared-types/features';
import * as React_2 from 'react';
import { SmsRegistrationApplicationType } from '../../../services/sms-registration';
import { SmsUseCaseCategory } from '../../../services/sms-registration';
import { ThemeConfig } from '@reach/shared-types/theme';
import { z } from 'zod';

export declare enum AutomationTriggerType {
    ONE_TIME = "one_time",
    TRIGGER_BASED = "trigger_based",
    DATE_BASED = "date_based"
}

export declare function CreateAutomationDialog({ open, setOpen, onClose, automationType, getExtraMergeFields, replyToSettingsText, replyToSettingsLink, fromNameSettingsText, fromNameSettingsLink, hideSms, }: CreateAutomationDialogProps): JSX_2.Element;

declare interface CreateAutomationDialogProps extends CreateAutomationModalProps {
    /**
     * Control the open state of the dialog
     */
    open: boolean;
    setOpen: (open: boolean) => void;
}

export declare const CreateAutomationModal: default_2.FC<CreateAutomationModalProps & {
    currentStep: CreateAutomationModalStep;
    setCurrentStep: (step: CreateAutomationModalStep) => void;
}>;

declare interface CreateAutomationModalProps {
    /**
     * Optional callback when the segment builder is closed
     * @param createdAutomation - The created automation id or false if the automation was not created, 'error' if there was an error
     */
    onClose?: (createdAutomation: string | false | 'error') => void;
    /**
     * Optionally skip the selection of automation and jump to the automation type
     * Currently only supports one time automation
     *
     * @Note This will remove the ability to select the automation type (e.g. the user will not be able to change the automation type)
     */
    automationType?: AutomationTriggerType.ONE_TIME;
    /**
     * Optional function to return extra merge fields for the automation
     */
    getExtraMergeFields?: () => Promise<ReachMergeField[]>;
    /**
     * Optional function to call prior to scheduling if a user wants to implement custom
     * logic to block scheduling
     *
     * @param args.estimatedEmailRecipients - The estimated number of email recipients
     * @param args.estimatedSmsRecipients - The estimated number of sms recipients
     * @param args.scheduleSendAt - The scheduled send time as an ISO date string, or null if not set
     *
     * @returns true if the automation should be scheduled, string otherwise that will be displayed to the user in a toast notification
     */
    onBeforeSchedule?: (args: {
        estimatedEmailRecipients: number;
        estimatedSmsRecipients: number;
        scheduleSendAt: string | null;
    }) => Promise<true | string>;
    /**
     * Optional text and hyperlink to display for
     * replyTo settings
     */
    replyToSettingsText?: string;
    replyToSettingsLink?: string;
    /**
     * Optional text and hyperlink to display for
     * from name settings
     */
    fromNameSettingsText?: string;
    fromNameSettingsLink?: string;
    /**
     * Optional boolean to hide SMS features
     */
    hideSms?: boolean;
}

/**
 * The steps of the create automation modal
 */
declare enum CreateAutomationModalStep {
    ChooseAutomationType = "choose-automation-type",
    SetAutomationName = "set-automation-name",
    OneTimeWizard = "one-time-wizard"
}

/**
 * dynamic merge field
 */
declare type DynamicMergeField = ReachMergeFieldBase & {
    type: ReachMergeFieldTypeEnum.DYNAMIC;
    /**
     * The merge fields to be used in the dynamic merge field
     */
    mergeFields: {
        displayName: string;
        templateName: string;
        image?: ImageMergeFieldType;
    }[];
    /**
     * The url of the dynamic merge field (e.g. "https://acme.co/id/")
     */
    url: string;
};

export declare const Engage: () => JSX_2.Element;

declare interface EngageTypedOverrides {
    user?: string;
    user_other?: string;
    automation?: string;
    automation_other?: string;
    segment?: string;
    segment_other?: string;
    broadcast?: string;
    broadcast_other?: string;
    trigger_based?: string;
    insight?: string;
    insight_other?: string;
    merge_field?: string;
    merge_field_other?: string;
    extra_merge_field_name?: string;
    extra_merge_field_name_other?: string;
    advanced_merge_field_name?: string;
    advanced_merge_field_name_other?: string;
}

/**
 * Represents the available features in our application.
 * Each feature corresponds to a specific section of the marketing hub.
 */
declare type FeatureKey = ReachFeature.MEASURE | `${ReachFeature.MEASURE}-setup` | `${ReachFeature.ACQUIRE}-setup` | ReachFeature.ACQUIRE | `${ReachFeature.REPUTATION}-setup` | ReachFeature.REPUTATION | `${ReachFeature.ENGAGE}-segment-builder` | `${ReachFeature.ENGAGE}-automations-create-modal` | `${ReachFeature.ENGAGE}-automations-view-modal` | ReachFeature.ENGAGE | ReachFeature.VOICE;

declare type ImageMergeFieldType = {
    placeholderUrl: string;
    maxSize: number;
};

declare interface LanguageConfig {
    /** Initial language code (e.g., 'en', 'es', 'fr') */
    default: string;
    /**
     * Optionally provide custom verbs to override the default ones
     * For example if you call your 'users' -> 'contacts', or 'automations' -> 'flows'
     */
    overrides?: {
        [ReachFeature.ENGAGE]: {
            en?: EngageTypedOverrides;
            es?: EngageTypedOverrides;
        };
        [ReachFeature.MEASURE]: {
            en?: MeasureTypedOverrides;
            es?: MeasureTypedOverrides;
        };
    };
}

declare interface MeasureTypedOverrides {
    transaction_table_id_header?: string;
    transaction_table_created_header?: string;
}

declare interface _PrivateProps {
    clientEntryPoint?: ReachClientEnum;
}

declare enum ReachClientEnum {
    ReactComponent = "React Component",
    Iframe = "Iframe",
    MagicLink = "Magic Link"
}

/**
 * Complete SDK configuration interface
 * @interface ReachConfig
 */
export declare interface ReachConfig {
    authToken: string;
    theme?: ThemeConfig;
    /** Event callbacks */
    callbacks: SDKCallbacks;
    /** Initial feature to load */
    feature?: FeatureKey;
    /** Debug configuration */
    debug?: boolean;
    language?: LanguageConfig;
    sandbox?: boolean;
    children?: default_2.ReactNode;
    /**
     * Features to hide
     */
    hideFeature?: {
        [ReachFeature.ENGAGE]: {
            sms?: boolean;
            sales?: boolean;
        };
    };
    /**
     * Features to engage
     */
    enableFeature?: {
        [ReachFeature.ENGAGE]: {
            onboarding?: boolean;
        };
    };
}

export declare type ReachMergeField = StaticMergeField | DynamicMergeField;

export declare type ReachMergeFieldBase = {
    /**
     * The type of the merge field
     */
    type: ReachMergeFieldTypeEnum;
    /**
     * The id of the merge field. This will be used when updating merge field contents
     */
    id: string;
};

export declare enum ReachMergeFieldTypeEnum {
    STATIC = "static",
    DYNAMIC = "dynamic"
}

export declare const ReachProvider: ({ authToken, language, children, theme, debug, callbacks, feature, sandbox, clientEntryPoint, hideFeature, enableFeature, }: ReachConfig & _PrivateProps) => JSX_2.Element;

/**
 * Callback function for requesting new token from parent
 * @callback ReauthCallback@callback ReauthCallback
 * @returns {Promise<string>} New JWT token
 */
declare type ReauthCallback = () => Promise<string>;

/**
 * Callback configuration for SDK events
 * @interface SDKCallbacks
 *
 * to register a new callback see all steps in 'Adding New Callbacks' section of the README
 * @see {@link https://github.com/EmbedReach/conversion-tracking/blob/main/apps/web/sdk-reach-admin/src/iframe/README.md#adding-new-callbacks}
 */
declare interface SDKCallbacks {
    /** Called when reauthentication is required */
    onReauthRequested: ReauthCallback;
    onTenantInformationRequested?: () => void;
}

export declare function SegmentBuilderDialog({ open, setOpen, segmentId, onSegmentUpdated, viewOnly, }: SegmentBuilderDialogProps): JSX_2.Element;

declare interface SegmentBuilderDialogProps {
    /**
     * Control the open state of the dialog
     */
    open: boolean;
    setOpen: (open: boolean) => void;
    /**
     * Optional callback when the segment builder is closed
     * @param createdSegment - The created segment id or false if the segment was not created, 'error' if there was an error
     */
    onSegmentUpdated?: (createdSegment: string | false | 'error') => void;
    /**
     * Optionally pass in a segmentId to edit an existing segment
     */
    segmentId?: string;
    /**
     * Whether the segment builder should be in view-only mode (read-only)
     * @default false
     */
    viewOnly?: boolean;
}

declare interface SMSChannelSettingsProps {
    hideSubmitButton?: boolean;
    formRef?: React_2.RefObject<SMSSetupBusinessFormRef>;
    onNeedsApplicationChange?: (needsApplication: boolean) => void;
    onApplicationSubmit?: (data: SMSSetupBusinessFormData) => Promise<void>;
    onFormVisibilityChange?: (isFormVisible: boolean) => void;
}

export declare const SMSOnboarding: ({ hideSubmitButton, formRef, onNeedsApplicationChange, onApplicationSubmit, onFormVisibilityChange, }: SMSChannelSettingsProps) => JSX_2.Element;

export declare type SMSSetupBusinessFormData = z.infer<typeof SMSSetupBusinessFormSchema>;

declare interface SMSSetupBusinessFormRef {
    submit: () => void;
}

/**
 * Schema for the SMS Setup Business Form
 * Maps to the AWS Toll Free Number application data structure
 */
declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
    type: z.ZodLiteral<SmsRegistrationApplicationType>;
    tollFreeNumber: z.ZodString;
    company: z.ZodEffects<z.ZodEffects<z.ZodObject<{
        name: z.ZodString;
        address1: z.ZodString;
        address2: z.ZodOptional<z.ZodString>;
        city: z.ZodString;
        stateProvince: z.ZodString;
        zipCode: z.ZodString;
        country: z.ZodString;
        businessRegistrationNumber: z.ZodOptional<z.ZodString>;
        businessRegistrationAuthority: z.ZodOptional<z.ZodEnum<["EIN", "DUNS", "CCN", "CN"]>>;
        businessRegistrationCountry: z.ZodOptional<z.ZodString>;
        businessType: z.ZodOptional<z.ZodEnum<["SOLE_PROPRIETOR", "PRIVATE_PROFIT", "PUBLIC_PROFIT", "NON_PROFIT", "GOVERNMENT"]>>;
    }, "strip", z.ZodTypeAny, {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    }, {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    }>, {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    }, {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    }>, {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    }, {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    }>;
    contact: z.ZodObject<{
        firstName: z.ZodString;
        lastName: z.ZodString;
        email: z.ZodString;
        phoneNumber: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        email: string;
        firstName: string;
        lastName: string;
        phoneNumber: string;
    }, {
        email: string;
        firstName: string;
        lastName: string;
        phoneNumber: string;
    }>;
    messagingUseCase: z.ZodObject<{
        monthlyVolume: z.ZodOptional<z.ZodNumber>;
        category: z.ZodOptional<z.ZodNativeEnum<SmsUseCaseCategory>>;
        useCaseDetails: z.ZodOptional<z.ZodString>;
    }, "strip", z.ZodTypeAny, {
        category?: SmsUseCaseCategory | undefined;
        monthlyVolume?: number | undefined;
        useCaseDetails?: string | undefined;
    }, {
        category?: SmsUseCaseCategory | undefined;
        monthlyVolume?: number | undefined;
        useCaseDetails?: string | undefined;
    }>;
    messageSamples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
    doingBusinessAs: z.ZodOptional<z.ZodString>;
    optInConfirmationMessage: z.ZodOptional<z.ZodString>;
    helpMessageSample: z.ZodOptional<z.ZodString>;
    optInKeywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
    type: SmsRegistrationApplicationType;
    company: {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    };
    contact: {
        email: string;
        firstName: string;
        lastName: string;
        phoneNumber: string;
    };
    tollFreeNumber: string;
    messagingUseCase: {
        category?: SmsUseCaseCategory | undefined;
        monthlyVolume?: number | undefined;
        useCaseDetails?: string | undefined;
    };
    messageSamples?: string[] | undefined;
    doingBusinessAs?: string | undefined;
    optInConfirmationMessage?: string | undefined;
    helpMessageSample?: string | undefined;
    optInKeywords?: string[] | undefined;
}, {
    type: SmsRegistrationApplicationType;
    company: {
        name: string;
        country: string;
        address1: string;
        city: string;
        stateProvince: string;
        zipCode: string;
        address2?: string | undefined;
        businessRegistrationNumber?: string | undefined;
        businessRegistrationAuthority?: "CN" | "EIN" | "DUNS" | "CCN" | undefined;
        businessRegistrationCountry?: string | undefined;
        businessType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT" | undefined;
    };
    contact: {
        email: string;
        firstName: string;
        lastName: string;
        phoneNumber: string;
    };
    tollFreeNumber: string;
    messagingUseCase: {
        category?: SmsUseCaseCategory | undefined;
        monthlyVolume?: number | undefined;
        useCaseDetails?: string | undefined;
    };
    messageSamples?: string[] | undefined;
    doingBusinessAs?: string | undefined;
    optInConfirmationMessage?: string | undefined;
    helpMessageSample?: string | undefined;
    optInKeywords?: string[] | undefined;
}>]>;

/**
 * Static merge field
 */
declare type StaticMergeField = ReachMergeFieldBase & {
    type: ReachMergeFieldTypeEnum.STATIC;
    /**
     * The static value of the merge field (e.g. "BLACKFRIDAYSALE50")
     */
    staticValue: string;
    /**
     * The display name of the merge field (e.g. "Black Friday Sale 50% off")
     */
    displayName: string;
    /**
     * Merge field template to display in the editor (e.g. {{dogs owned}})
     */
    templateName: string;
};

export { ThemeConfig }

export declare const ViewAutomationModal: default_2.FC<ViewAutomationProps & {
    inRouter?: boolean;
}>;

export declare type ViewAutomationProps = {
    /**
     * The id of the automation to view
     */
    automationId?: string;
    /**
     * Optional keys to override the default show back button
     */
    showBackButton?: boolean;
    /**
     * Optional function to return extra merge fields for the automation
     */
    getExtraMergeFields?: () => Promise<ReachMergeField[]>;
    /**
     * Optional callback when a duplication is created
     */
    onDuplicationCreated?: (duplicationId: string) => void;
    /**
     * Optional function to call prior to scheduling if a user wants to implement custom
     * logic to block scheduling
     *
     * @param args.estimatedEmailRecipients - The estimated number of email recipients
     * @param args.estimatedSmsRecipients - The estimated number of sms recipients
     * @param args.scheduleSendAt - The scheduled send time as an ISO date string, or null if not set
     *
     * @returns true if the automation should be scheduled, string otherwise that will be displayed to the user in a toast notification
     */
    onBeforeSchedule?: (args: {
        estimatedEmailRecipients: number;
        estimatedSmsRecipients: number;
        scheduleSendAt: string | null;
    }) => Promise<true | string>;
    /**
     * Optional boolean to hide features
     */
    hideSms?: boolean;
    hideSales?: boolean;
    /**
     * Optional text and hyperlink to display for
     * replyTo settings
     */
    replyToSettingsText?: string;
    replyToSettingsLink?: string;
    /**
     * Optional text and hyperlink to display for
     * from name settings
     */
    fromNameSettingsText?: string;
    fromNameSettingsLink?: string;
};

export { }


declare module 'i18next' {
    interface CustomTypeOptions {
        defaultNS: 'common';
        resources: typeof defaultTranslations;
    }
}
