capacitor-axa-mobile-sdk-plugin
Version:
CA App Experience Analytic native SDK's capacitor supplement for using custom metrics
457 lines (456 loc) • 16 kB
TypeScript
import type { PluginListenerHandle } from '@capacitor/core';
export interface CapacitorAxaMobileSdkPlugin {
/**
* Use this API to enable SDK.
* The SDK is enabled by default. You need to call this API
* only if you called disableSDK earlier.
*
*/
enableSDK(): Promise<void>;
/**
* Use this API to disable the SDK.
* When disabled, the SDK no longer does any tracking of the application,
* or user interaction.
*
*/
disableSDK(): Promise<void>;
/**
* Use this API to determine if the SDK is enabled or not.
*
* Returns a boolean value
*
*/
isSDKEnabled(): Promise<{
value: boolean;
}>;
/**
* Use this API to get the unique device ID generated by the SDK
*
* Returns a device id value
*
*/
getDeviceId(): Promise<{
value: string;
}>;
/**
* Use this API to get the customer ID for this session.
* Returns a customerId value. If the customer ID is not set, this API returns a null value.
*
*/
getCustomerId(): Promise<{
value: string | null;
}>;
/**
* Use this API to set the customer ID for this session.
*
* @param customerId is a string containing the customer ID
* If an empty string is passed, the customer iD is reset.
* callback is a function which expects an (SDKError value)
*
*/
setCustomerId(options: {
customerId: string;
}): Promise<{
error: SDKError;
}>;
/**
* Use this API to set a custom session attribute.
*
* @param name is a string containing the attribute name
* @param value is string containing the attribute value
* callback is a function which expects an (SDKError value)
*
*/
setSessionAttribute(options: {
name: string;
value: string;
}): Promise<{
error: SDKError;
}>;
/**
* Use this API to stop collecting potentially sensitive data.
*
* The following data is not collected when the app enters a private zone
* - Screenshots
* - Location information including GPS and IP addresses
* - Value in the text entry fields
*
*/
enterPrivateZone(): Promise<void>;
/**
* Use this API to start collecting all data again
*/
exitPrivateZone(): Promise<void>;
/**
* Use this API to determine if the SDK is in a private zone.
*
* Returns a boolean value
*
*/
isInPrivateZone(): Promise<{
value: boolean;
}>;
/**
* Use this API to get the SDK computed APM header in key value format.
* Returns dictionary or map of key, value pairs
* Returns an empty string if apm header cannot be computed
*
*/
getAPMHeaders(): Promise<{
value: object | null;
}>;
/**
* Use this API to add custom data to the SDK computed APM header.
* @param data is a non-empty string in the form of "key=value".
* data will be appended to the APM header separated by a semicolon (;).
*
*/
addToAPMHeader(options: {
data: string;
}): Promise<void>;
/**
* Use this API to set the ssl pinning mode and array of pinned values.
* This method expects array of values depending on the pinningMode
*
* @param pinningMode is one of the CAMDOSSLPinning modes described below
* @param pinnedValues is an array as required by the pinning mode
*
* Supported pinning modes:
* CAMDOSSLPinningModePublicKey OR CAMDOSSLPinningModeCertificate
* - array of certificate data (NSData from SeccertificateRef)
* - or, certificate files(.cer) to be present in the resource bundle
*
* CAMDOSSLPinningModeFingerPrintSHA1Signature
* - array of SHA1 fingerprint values
*
* CAMDOSSLPinningModePublicKeyHash
* - array of PublicKeyHashValues
*/
setSSLPinningMode(options: {
pinningMode: CAMDOSSLPinningMode;
pinnedValues: string[];
}): Promise<void>;
/**
* Use this API to stop the current session.
* No data will be logged until the startSession API is called
*
*/
stopCurrentSession(): Promise<void>;
/**
* Use this API to start a new session.
* If a session is already in progress, it will be stopped and new session is started
*
*/
startNewSession(): Promise<void>;
/**
* Convenience API to stop the current session in progress and start a new session
* Equivalent to calling stopCurrentSession() and startNewSession()
*/
stopCurrentAndStartNewSession(): Promise<void>;
/**
* Use this API to start a transaction with a specific name
*
* @param transactionName is a string to indicate the transaction being processed
* @param serviceName is a string to indicate the service or application being applied
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
startApplicationTransaction(options: {
transactionName: string;
serviceName?: string;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to stop a transaction with a specific name and an optional failure string
*
* @param transactionName is a string to indicate the transaction being processed
* @param failureString is a string to indicate the failure name, message or type
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
stopApplicationTransaction(options: {
transactionName: string;
failure?: string;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to provide feedback from the user after a crash
*
* @param feedback is a string containing any customer feedback for the crash
*
* The App has to register for CAMAA_CRASH_OCCURRED notification
* and collect the feedback from the user while handling the notification
*
*/
setCustomerFeedback(options: {
feedback: string;
}): Promise<void>;
/**
* Use this API to set Location of the Customer/User
* using postalCode and countryCode.
*
* @param postalCode is the country's postal code, e.g. zip code in the US
* @param countryCode is the two letter international code for the country
*
*/
setCustomerLocation(options: {
postalCode: string;
countryCode: string;
}): Promise<void>;
/**
* Use this API to send a screen shot of the current screen
*
* @param name is a string to indicate the desired name for the screen
* @param quality is a CAMDOSDKImageQualityType indicating the quality of the image
* The following values for imageQuality are defined:
* - CAMAA_SCREENSHOT_QUALITY_HIGH
* - CAMAA_SCREENSHOT_QUALITY_MEDIUM
* - CAMAA_SCREENSHOT_QUALITY_LOW
* - CAMAA_SCREENSHOT_QUALITY_DEFAULT
*
* The default value is CAMAA_SCREENSHOT_QUALITY_LOW.
*
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
sendScreenShot(options: {
name: string;
quality: CAMDOSDKImageQualityType;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to create a custom app flow with dynamic views
*
* @param viewName is the name of the view that was loaded
* @param loadTime is the time it took to load the view
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
viewLoaded(options: {
viewName: string;
loadTime: number;
screenShot?: boolean;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to set the name of a view to be ignored
* @param viewName is Name of the view to be ignored
* Screenshots and transitions of the views that are in ignore list are not captured
*
*/
ignoreView(options: {
viewName: string;
}): Promise<void>;
/**
* Use this API to provide a list of view names to be ignored.
* @param viewNames is a list (an array) of names of the views to be ignored.
* Screenshots and transitions of the views that are in the
* ignore list are not captured
*
*/
ignoreViews(options: {
viewNames: string[];
}): Promise<void>;
/**
* Use this API to determine if automatic screenshots are enabled by policy.
*
* Returns a boolean value
* Returns YES if screenshots are enabled by policy. Otherwise returns NO
*
*/
isScreenshotPolicyEnabled(): Promise<{
value: boolean;
}>;
/**
* Use this API to add a custom network event in the current session
*
* @param url is a string reprentation of the network URL to be logged
* @param status is an integer value indicating the status, e.g. 200, 404, etc.
* @param responseTime is an integer value representing the response time
* @param inBytes is an integer value representing the number of bytes input
* @param outBytes is an integer value representing the number of bytes output
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
logNetworkEvent(options: {
url: string;
status: number;
responseTime: number;
inBytes: number;
outBytes: number;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to add a custom text metric in the current session
*
* @param textMetricName is a string to indicate a text metric name
* @param textMetricValue is a string to indicate a text metric value
* @param attributes is a Map or Dictionary used to send any extra parameters
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
logTextMetric(options: {
textMetricName: string;
value: string;
attributes?: object;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to add a custom numeric metric value in the current session
*
* @param numericMetricName is a string to indicate a numeric metric name
* @param numericMetricValue is a numeric value, e.g. 3.14159, 2048.95, or 42, etc.
* @param attributes is a Map or Dictionary used to send any extra parameters
* Returns a callback
*
* If successful, completed = YES and error is nil.
* In case of failure, completed = NO and error will have NSError object with
* domain, code and localizedDescription.
*
*/
logNumericMetric(options: {
numericMetricName: string;
value: number;
attributes?: object;
}): Promise<{
completed: boolean;
error: string | null;
}>;
/**
* Use this API to force an upload event.
* This is bulk/resource consuming operation and should be used with caution
*
* @param callback is a function which expects a response object and an error object
*
* Returns:
* - response is a key,value paired map or dictionary object
* the Key 'CAMDOResponseKey' holds any URLResponse information
* the key 'CAMDOTotalUploadedEvents' holds the total number of events uploaded
* - error is nil if the API call is successful, otherwise is an NSError object
* with domain, code and localizedDescription.
*
*/
uploadEvents(): Promise<{
response: object;
error: string | null;
}>;
addListener(eventName: CAMAA_NOTIFICATION_TYPE.CAMAA_CRASH_OCCURRED, listenerFunc: () => void): Promise<PluginListenerHandle> & PluginListenerHandle;
addListener(eventName: CAMAA_NOTIFICATION_TYPE.CAMAA_UPLOAD_INITIATED, listenerFunc: () => void): Promise<PluginListenerHandle> & PluginListenerHandle;
logUIEvent(options: {
eventType: CAMDOUIEventType;
value: string;
}): Promise<void>;
/**
* Use this API to set your delegate instance to handle auth challenges.
* Use it when using SDKUseNetworkProtocolSwizzling option
*
* @param delegate is an iOS native object or module which responds to the NSURLSessionDelegate protocols.
*
*/
setNSURLSessionDelegate(options: {
delegate: string;
}): Promise<void>;
/**
* Use this API to set Geographic or GPS Location of the Customer
*
* @param latitude is the geographic latitude from -90.0 to 90.0 degrees
* @param logitude is the geographic longitude from -180.0 to 180.0 degrees
*
*/
setLocation(options: {
latitude: number;
longitude: number;
}): Promise<void>;
/**
* Use this API to programmatically enable or disable automatic screen captures.
*
* @param captureScreen is a boolean value to enable/disable automatic screen captures.
*
* Normally the policy determines whether automatic screen captures are performed.
* Use this API to override the policy, or the current setting of this flag.
*
*/
enableScreenShots(captureScreen: boolean): Promise<void>;
/**
* This is a SDK Dev API
*/
induceNativeCrash(options: {
crashType: string;
}): void;
}
export declare enum SDKError {
ErrorNone = 0,
ErrorNoTransactionName = 1,
ErrorTransactionInProgress = 2,
ErrorFailedToTakeScreenshot = 3,
ErrorInvalidValuesPassed = 4
}
export declare enum CAMDOSSLPinningMode {
CAMDOSSLPinningModeNone = 0,
CAMDOSSLPinningModePublicKey = 1,
CAMDOSSLPinningModeCertificate = 2,
CAMDOSSLPinningModeFingerPrintSHA1Signature = 3,
CAMDOSSLPinningModePublicKeyHash = 4
}
export declare enum CAMDOSDKImageQualityType {
CAMAA_SCREENSHOT_QUALITY_HIGH = "CAMAA_SCREENSHOT_QUALITY_HIGH",
CAMAA_SCREENSHOT_QUALITY_MEDIUM = "CAMAA_SCREENSHOT_QUALITY_MEDIUM",
CAMAA_SCREENSHOT_QUALITY_LOW = "CAMAA_SCREENSHOT_QUALITY_LOW",
CAMAA_SCREENSHOT_QUALITY_DEFAULT = "CAMAA_SCREENSHOT_QUALITY_DEFAULT"
}
export declare enum CAMDOUIEventType {
CAMAA_EVENT_BUTTON_PRESSED = "button_pressed",
CAMAA_AI_START = "ai_start",
CAMAA_AI_END = "ai_end",
CAMAA_EVENT_DATE_PICKER_VIEW_SELECTED = "date_picker_selected",
CAMAA_EVENT_PAGE_CHANGED = "page_changed",
CAMAA_EVENT_SEGMENTED_CONTROL_PRESSED = "segment_control_pressed",
CAMAA_EVENT_SLIDER_MOVED = "slider_moved",
CAMAA_EVENT_STEPPER_PRESSED = "stepper_pressed",
CAMAA_EVENT_SWITCH_PRESSED = "switch_pressed",
CAMAA_EVENT_RADIO_BUTTON_PRESS = "radio_button_pressed",
CAMAA_EVENT_CHECK_BOX_PRESS = "check_box_pressed",
CAMAA_EVENT_SPINNER_ITEM_SELECTED = "spinner_item_selected",
CAMAA_EVENT_TOGGLE_PRESS = "switch_pressed",
CAMAA_EVENT_UNSUPPORTED = "unknow_action"
}
export declare enum CAMAA_NOTIFICATION_TYPE {
CAMAA_UPLOAD_INITIATED = "CAMAA_UPLOAD_INITIATED",
CAMAA_CRASH_OCCURRED = "CAMAA_CRASH_OCCURRED"
}