import * as Hackle from "@hackler/javascript-sdk"; import { Decision, FeatureFlagDecision, HackleClient, HackleEvent, HackleRemoteConfig, HackleUserExplorerBase, HackleSessionPolicy, PageView, HacklePage, User, PropertyOperations, HackleInAppMessageListener, Properties, HackleSubscriptionOperations, EvaluationMode } from "@hackler/javascript-sdk"; import { Emitter } from "./emitter"; interface Config { user?: User; debug?: boolean; auto_track_page_view?: boolean; pollingIntervalMillis?: number; exposureEventDedupIntervalMillis?: number; /** @deprecated Use sessionPolicy.timeoutMillis instead */ sessionTimeoutMillis?: number; sessionPolicy?: HackleSessionPolicy; devTool?: { userExplorer(userExplorer: HackleUserExplorerBase): void; close(): void; }; autoOpenDevTool?: boolean; optOutTracking?: boolean; /** Evaluation mode: 'local' (default, on-device workspace) or 'remote' (server pre-evaluation). */ evaluationMode?: EvaluationMode; [key: string]: any; } interface HackleReactSDKClientEventMap { /** * The hooks must re-evaluate. Carries nothing — the Provider treats all emission sites the same. * If logic ever needs to distinguish them, Source it from the javascript-sdk instead. */ evaluate: void; } export declare class HackleReactSDKClient extends Emitter implements HackleClient { private client; private _currentUser; constructor(sdkKey: string, config?: Config); getSessionId(): string; getUser(): User; setUser(user: User): Promise; setUserId(userId: string | null | undefined): Promise; setDeviceId(deviceId: string): Promise; setUserProperty(key: string, value: any): Promise; setUserProperties(properties: Properties): Promise; /** * Updates the user's properties. * * @param operations Property operations to update user properties. * */ updateUserProperties(operations: PropertyOperations): Promise; updatePushSubscriptions(operations: HackleSubscriptionOperations): Promise; updateSmsSubscriptions(operations: HackleSubscriptionOperations): Promise; updateKakaoSubscriptions(operations: HackleSubscriptionOperations): Promise; resetUser(): Promise; /** * Determine the variation to expose to the user for experiment. * * This method returns the control variation {"A"} if: * - The experiment key is invalid * - The experiment has not started yet * - The user is not allocated to the experiment * - The determined variation has been dropped * * @param experimentKey the unique key of the experiment. * @param user the user to participate in the experiment. MUST NOT be null. * * @return string the decided variation for the user, or the control variation. */ variation(experimentKey: number, user?: User | string | null): string; /** * Determine the variation to expose to the user for experiment, and returns an object that * describes the way the variation was determined. * * @param experimentKey the unique key of the experiment. * @param user the user to participate in the experiment. MUST NOT be null. (e.g. { id: "userId"} ) * * @return {Decision} object */ variationDetail(experimentKey: number, user?: User | string | null): Decision; /** * Determine whether the feature is turned on to the user. * * @param featureKey the unique key for the feature. * @param user the user requesting the feature. * * @return boolean True if the feature is on. False if the feature is off. * * @since 2.0.0 */ isFeatureOn(featureKey: number, user?: User | string | null): boolean; /** * Determine whether the feature is turned on to the user, and returns an object that * describes the way the value was determined. * * @param featureKey the unique key for the feature. * @param user the identifier of user. * * @return {FeatureFlagDecision} * * @since 2.0.0 */ featureFlagDetail(featureKey: number, user?: User | string | null): FeatureFlagDecision; /** * Records the event performed by the user. * * @param event the unique key of the event. MUST NOT be null. * @param user the identifier of user that performed the event. id MUST NOT be null. (e.g. { id: "userId"} ) */ track(event: string | HackleEvent, user?: User | string | null): void; trackPageView(option?: PageView): void; setCurrentPage(page: HacklePage): void; /** * Return a instance of Hackle Remote Config. * * @param user the identifier of user. */ remoteConfig(user?: User | string | null): HackleRemoteConfig; onReady(cb: any, timeout?: number): void; onInitialized(config?: { timeout: number; }): Promise<{ success: boolean; }>; /** Tells the hooks to re-evaluate. */ private signalEvaluate; private signalIfUserChanged; /** * In remote mode the workspace is the evaluation and the server resolves it per user, so a new * user has nothing to evaluate against until the request returns. The first signal re-evaluates * against the previous user's evaluation; the second corrects it. In local mode the workspace is * already on the device and the second signal merely follows the cohort and user target sync. * * `synchronized` is that workspace update — the mutation methods resolve only after it completes. */ private emitUserChange; showUserExplorer(): void; hideUserExplorer(): void; fetch(): Promise; setInAppMessageListener(listener: HackleInAppMessageListener | null): void; close(): void; /** * Set user's phone number. Existing value will be replaced by new value if you call this method again. * * @param phoneNumber String satisfying valid E.164 format is accepted. */ setPhoneNumber(phoneNumber: string): Promise; /** * Reset user's phone number to be an empty value. */ unsetPhoneNumber(): Promise; getDisplayedInAppMessageView(): Hackle.HackleInAppMessageView | null; isOptOutTracking(): boolean; setOptOutTracking(optOut: boolean): void; } export declare function createInstance(sdkKey: string, config?: Config): HackleReactSDKClient; export {}; //# sourceMappingURL=client.d.ts.map