@tef-novum/webview-bridge
Version:
JavaScript library to access to native functionality. Requires a webview with a postMessage bridge.
63 lines (62 loc) • 2.99 kB
TypeScript
/** @deprecated */
export declare type CustomDimensionIdx = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 26;
/** @deprecated */
export declare const CD_WEBAPP_INSTALLED = 4;
/** @deprecated */
export declare const CD_NOVUM_UID = 7;
/** @deprecated */
export declare const CD_EVENT_VALUE = 8;
declare type LegacyAnalyticsEvent = {
/** Typically the object that was interacted with (e.g. 'Video') */
category: string;
/** The type of interaction (e.g. 'play') */
action: string;
/** Useful for categorizing events (e.g. 'Fall Campaign') */
label?: string;
/** A numeric value associated with the event (e.g. 43) */
value?: number;
/**
* Screen name where the event happened.
* If not specified, native app will use value from the latest setScreenName() call
*/
screenName?: string;
/** Other properties are allowed */
[key: string]: any;
};
declare type FirebaseValue = string | number | undefined | {
[key: string]: FirebaseValue;
} | Array<FirebaseValue>;
declare type FirebaseEvent = {
name: string;
component_type?: string;
component_copy?: string;
[key: string]: FirebaseValue;
};
export declare type TrackingEvent = Readonly<LegacyAnalyticsEvent | FirebaseEvent>;
export declare const sanitizeAnalyticsParam: (str: string) => string;
export declare const sanitizeAnalyticsParams: (params: {
[key: string]: FirebaseValue;
}) => {
[key: string]: FirebaseValue;
};
declare type LogEventOptions = {
/** Whether to sanitize the event params, this only affects to FirebaseEvents. true by default. */
sanitize?: boolean;
};
export declare const logEvent: (event: TrackingEvent, options?: LogEventOptions | undefined) => Promise<void>;
export declare const logEcommerceEvent: (name: string, params: {
[key: string]: any;
}) => Promise<void>;
export declare const logTiming: ({ category, variable, value, label, }: Readonly<{
category?: string | undefined;
variable: string;
value: number;
label?: string | undefined;
}>) => Promise<void>;
export declare const setScreenName: (screenName: string, params?: {
[key: string]: any;
}, options?: LogEventOptions | undefined) => Promise<void>;
declare type KnownUserPropertyName = 'obIds' | 'paymentModels' | 'serviceWorkerStatus' | 'isAdmin' | 'hasIpComms' | 'af_source' | 'af_campaign' | 'novum_uid_session' | 'user_logged' | 'currentSubscriptionId' | 'currentSubscriptionType' | 'currentPaymentModel' | 'webviewBrowserVersion' | 'activatedRoles' | 'appInstanceId' | 'experimentflag' | 'friendsApps' | 'accountLineSelector' | 'OneClickDisplayed';
export declare const setUserProperty: (name: KnownUserPropertyName | string, value: string) => Promise<void>;
export declare const setTrackingProperty: (system: 'palitagem' | 'medallia', name: string, value?: string | undefined) => Promise<void>;
export {};