/// <reference types="node" />

export declare function authorizeUser(username: string): void;

declare type BackdropConfig = (BackdropConfigBase & BackdropConfigActive) | (BackdropConfigBase & {
    showBackdrop: false;
}) | {
    showBackdrop?: undefined;
};

declare interface BackdropConfigActive {
    showBackdrop: true;
    backdropText: string;
    backdropDelay?: number;
}

declare interface BackdropConfigBase {
    showBackdrop?: boolean;
    backdropText?: string;
    backdropDelay?: number;
}

declare type BellConfig = {
    showBell?: undefined;
} | (BellConfigBase & {
    showBell: true;
    popUpText?: string;
    position?: PushPositionConfig;
}) | (BellConfigBase & {
    showBell: false;
});

declare interface BellConfigBase {
    showBell?: boolean;
    popUpText?: string;
    position?: PushPositionConfig;
}

export declare type ConfirmPushState = 'subscribed' | 'blocked' | 'closed';

export declare function deauthorizeUser(): void;

declare interface EventAttributes {
    [key: string]: string;
}

declare interface GeneralPushManagerConfig {
    enabled: boolean;
    publicKey?: VapidKeys['publicKey'];
    hasSW?: boolean;
}

declare interface GeoLocationOptions {
    enabled?: boolean;
}

export declare const getPushSubscription: () => Promise<PushSubscriptionJSON | undefined>;

export declare function init(appId: string, apiKey: string, config?: SDKConfig): void;

export declare function newEvent(slug: string, customAttributes?: EventAttributes, onsuccess?: () => void): void;

export declare function newEventByName(name: string, customAttributes?: EventAttributes, onsuccess?: () => void): void;

export declare function newRevenue(slug: string, revenue: number, currency?: RevenueCurrency, onsuccess?: () => void): void;

export declare function notificationPermissionState(): NotificationPermission | undefined;

export declare const onAutomationUserIdReceived: () => Promise<string>;

export declare const onMetrixUserIdReceived: () => Promise<string>;

export declare const onPushStateResolved: () => Promise<ConfirmPushState>;

declare interface OnSiteMessageConfig {
    enabled: boolean;
}

export declare function openPushConfirmBackdrop(backdropConfig: Omit<BackdropConfig, 'showBackdrop'>): Promise<ConfirmPushState>;

declare type PushConfig = BackdropConfig & BellConfig & PushManagerConfig;

declare type PushManagerConfig = (GeneralPushManagerConfig & {
    enabled: true;
    publicKey: VapidKeys['publicKey'];
}) | (GeneralPushManagerConfig & {
    enabled: false;
});

declare type PushPositionConfig = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';

declare type RevenueCurrency = 'IRR' | 'USD' | 'EUR';

export declare interface SDKConfig {
    location?: GeoLocationOptions;
    push?: PushConfig;
    onSiteMessaging?: OnSiteMessageConfig;
    sessionTracking?: SessionTrackingConfig;
}

declare interface SessionTrackingConfig {
    enabled: boolean;
    packageName?: string;
}

export declare function setBirthday(birthday: number, onsuccess?: () => void): void;

export declare function setCity(city: string, onsuccess?: () => void): void;

export declare function setCountry(country: string, onsuccess?: () => void): void;

export declare function setCustomAttribute(key: string, value: string, onsuccess?: () => void): void;

export declare function setEmail(email: string, onsuccess?: () => void): void;

export declare function setFcmToken(token: string, onsuccess?: () => void): void;

export declare function setFirstName(firstName: string, onsuccess?: () => void): void;

export declare function setGender(gender: UserGender, onsuccess?: () => void): void;

export declare function setHashedEmail(hashedEmail: string, onsuccess?: () => void): void;

export declare function setHashedPhoneNumber(hashedPhoneNumber: string, onsuccess?: () => void): void;

export declare function setLastName(lastName: string, onsuccess?: () => void): void;

export declare function setLocality(locality: string, onsuccess?: () => void): void;

export declare function setPhoneNumber(phoneNumber: string, onsuccess?: () => void): void;

export declare function setRegion(region: string, onsuccess?: () => void): void;

export declare function subscribePush(): Promise<ConfirmPushState>;

declare type UserGender = 'male' | 'female' | 'other';

declare interface VapidKeys {
    publicKey: string;
    privateKey: string;
}

export { }
