capacitor-appmetrica
Advanced tools
Comparing version 0.3.1 to 1.0.0-beta.0
@@ -0,1 +1,2 @@ | ||
import type { UserProfileUpdate } from './profile'; | ||
declare module '@capacitor/core' { | ||
@@ -7,2 +8,21 @@ interface PluginRegistry { | ||
export interface AppmetricaPlugin { | ||
activate(options: AppmetricaActivateOptions & { | ||
apiKey: string; | ||
}): Promise<void>; | ||
pauseSession(): Promise<void>; | ||
sendEventsBuffer(): Promise<void>; | ||
resumeSession(): Promise<void>; | ||
setLocationTracking(options: { | ||
enabled: boolean; | ||
}): Promise<void>; | ||
setStatisticsSending(options: { | ||
enabled: boolean; | ||
}): Promise<void>; | ||
setLocation(options: { | ||
location: AppmetricaLocation; | ||
}): Promise<void>; | ||
reportAppOpen(options: { | ||
url: string; | ||
}): Promise<void>; | ||
reportError(options: AppmetricaReportErrorOptions): Promise<void>; | ||
reportEvent(options: { | ||
@@ -12,2 +32,5 @@ name: string; | ||
}): Promise<void>; | ||
reportReferralUrl(options: { | ||
referralUrl: string; | ||
}): Promise<void>; | ||
setUserProfileID(options: { | ||
@@ -23,82 +46,36 @@ id: string; | ||
} | ||
export declare enum Gender { | ||
MALE = 0, | ||
FEMALE = 1, | ||
OTHER = 2 | ||
export interface AppmetricaActivateOptions { | ||
appVersion?: string; | ||
crashReporting?: boolean; | ||
activationAsSessionStart?: boolean; | ||
firstActivationAsUpdate?: boolean; | ||
location?: AppmetricaLocation; | ||
locationTracking?: boolean; | ||
userProfileID?: string; | ||
appOpenTrackingEnabled?: boolean; | ||
revenueAutoTrackingEnabled?: boolean; | ||
logs?: boolean; | ||
preloadInfo?: AppmetricaPreloadInfo; | ||
sessionsAutoTracking?: boolean; | ||
sessionTimeout?: number; | ||
statisticsSending?: boolean; | ||
} | ||
export declare class UserProfile { | ||
updates: UserProfileUpdate[]; | ||
apply(update: UserProfileUpdate): this; | ||
applyFromArray(updatesArray: UserProfileUpdate[]): this; | ||
export interface AppmetricaReportErrorOptions { | ||
identifier: string; | ||
parameters?: object; | ||
message?: string; | ||
} | ||
export declare class UserProfileUpdate { | ||
attributeName: string; | ||
methodName: string; | ||
key: string | null; | ||
values: any[]; | ||
constructor(attributeName: string, methodName: string, key: string | null, ...values: any[]); | ||
export interface AppmetricaLocation { | ||
latitude: number; | ||
longitude: number; | ||
altitude: number; | ||
accuracy: number; | ||
verticalAccuracy: number; | ||
course: number; | ||
speed: number; | ||
timestamp?: number; | ||
} | ||
export declare class BirthDateAttribute { | ||
private attributeName; | ||
withAge(age: number): UserProfileUpdate; | ||
withBirthDate(date: Date): UserProfileUpdate; | ||
withBirthDate(year: number): UserProfileUpdate; | ||
withBirthDate(year: number, month: number): UserProfileUpdate; | ||
withBirthDate(year: number, month: number, day: number): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class GenderAttribute { | ||
private attributeName; | ||
withValue(value: Gender): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class NameAttribute { | ||
private attributeName; | ||
withValue(value: string): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class NotificationsEnabledAttribute { | ||
private attributeName; | ||
withValue(value: boolean): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class CustomBooleanAttribute { | ||
private attributeName; | ||
key: string; | ||
constructor(key: string); | ||
withValue(value: boolean): UserProfileUpdate; | ||
withValueIfUndefined(value: boolean): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class CustomCounterAttribute { | ||
private attributeName; | ||
private key; | ||
constructor(key: string); | ||
withDelta(value: number): UserProfileUpdate; | ||
} | ||
export declare class CustomNumberAttribute { | ||
private attributeName; | ||
private key; | ||
constructor(key: string); | ||
withValue(value: number): UserProfileUpdate; | ||
withValueIfUndefined(value: number): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class CustomStringAttribute { | ||
private attributeName; | ||
private key; | ||
constructor(key: string); | ||
withValue(value: string): UserProfileUpdate; | ||
withValueIfUndefined(value: string): UserProfileUpdate; | ||
withValueReset(): UserProfileUpdate; | ||
} | ||
export declare class ProfileAttribute { | ||
static BirthDate(): BirthDateAttribute; | ||
static Gender(): GenderAttribute; | ||
static Name(): NameAttribute; | ||
static NotificationsEnabled(): NotificationsEnabledAttribute; | ||
static CustomBool(key: string): CustomBooleanAttribute; | ||
static CustomCounter(key: string): CustomCounterAttribute; | ||
static CustomNumber(key: string): CustomNumberAttribute; | ||
static CustomString(key: string): CustomStringAttribute; | ||
} | ||
export declare type AppmetricaPreloadInfo = { | ||
trackingId: string; | ||
additionalInfo?: Record<string, string>; | ||
}; |
@@ -1,166 +0,2 @@ | ||
export var Gender; | ||
(function (Gender) { | ||
Gender[Gender["MALE"] = 0] = "MALE"; | ||
Gender[Gender["FEMALE"] = 1] = "FEMALE"; | ||
Gender[Gender["OTHER"] = 2] = "OTHER"; | ||
})(Gender || (Gender = {})); | ||
export class UserProfile { | ||
constructor() { | ||
this.updates = []; | ||
} | ||
apply(update) { | ||
this.updates.push(update); | ||
return this; | ||
} | ||
applyFromArray(updatesArray) { | ||
this.updates.push(...updatesArray); | ||
return this; | ||
} | ||
} | ||
export class UserProfileUpdate { | ||
constructor(attributeName, methodName, key, ...values) { | ||
this.attributeName = attributeName; | ||
this.methodName = methodName; | ||
this.key = key; | ||
this.values = values; | ||
} | ||
} | ||
export class BirthDateAttribute { | ||
constructor() { | ||
this.attributeName = 'birthDate'; | ||
} | ||
withAge(age) { | ||
return new UserProfileUpdate(this.attributeName, 'withAge', null, age); | ||
} | ||
withBirthDate(yearOrDate, month, day) { | ||
const args = []; | ||
if (typeof yearOrDate !== 'number') { | ||
args.push(yearOrDate.getDate(), yearOrDate.getMonth(), yearOrDate.getFullYear()); | ||
} | ||
else { | ||
args.push(yearOrDate); | ||
if (month !== undefined) | ||
args.push(month); | ||
if (day !== undefined) | ||
args.push(day); | ||
} | ||
return new UserProfileUpdate(this.attributeName, 'withBirthDate', null, ...args); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
export class GenderAttribute { | ||
constructor() { | ||
this.attributeName = 'gender'; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', null, value.toString()); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
export class NameAttribute { | ||
constructor() { | ||
this.attributeName = 'name'; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', null, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
export class NotificationsEnabledAttribute { | ||
constructor() { | ||
this.attributeName = 'notificationsEnabled'; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', null, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
export class CustomBooleanAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customBoolean'; | ||
this.key = key; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value); | ||
} | ||
withValueIfUndefined(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key); | ||
} | ||
} | ||
export class CustomCounterAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customCounter'; | ||
this.key = key; | ||
} | ||
withDelta(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withDelta', this.key, value); | ||
} | ||
} | ||
export class CustomNumberAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customNumber'; | ||
this.key = key; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value); | ||
} | ||
withValueIfUndefined(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key); | ||
} | ||
} | ||
export class CustomStringAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customString'; | ||
this.key = key; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value); | ||
} | ||
withValueIfUndefined(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key); | ||
} | ||
} | ||
export class ProfileAttribute { | ||
static BirthDate() { | ||
return new BirthDateAttribute(); | ||
} | ||
static Gender() { | ||
return new GenderAttribute(); | ||
} | ||
static Name() { | ||
return new NameAttribute(); | ||
} | ||
static NotificationsEnabled() { | ||
return new NotificationsEnabledAttribute(); | ||
} | ||
static CustomBool(key) { | ||
return new CustomBooleanAttribute(key); | ||
} | ||
static CustomCounter(key) { | ||
return new CustomCounterAttribute(key); | ||
} | ||
static CustomNumber(key) { | ||
return new CustomNumberAttribute(key); | ||
} | ||
static CustomString(key) { | ||
return new CustomStringAttribute(key); | ||
} | ||
} | ||
export {}; | ||
//# sourceMappingURL=definitions.js.map |
@@ -1,5 +0,16 @@ | ||
import { UserProfile } from '.'; | ||
import { AppmetricaActivateOptions, AppmetricaLocation } from './definitions'; | ||
import { UserProfile } from './profile'; | ||
export declare class Appmetrica { | ||
private appmetrica; | ||
activate(apiKey: string, options?: AppmetricaActivateOptions): Promise<void>; | ||
pauseSession(): Promise<void>; | ||
sendEventsBuffer(): Promise<void>; | ||
resumeSession(): Promise<void>; | ||
setLocationTracking(enabled: boolean): Promise<void>; | ||
setStatisticsSending(enabled: boolean): Promise<void>; | ||
setLocation(location: AppmetricaLocation): Promise<void>; | ||
reportAppOpen(url: string): Promise<void>; | ||
reportError(identifier: string, message?: string, parameters?: Object): Promise<void>; | ||
reportEvent(name: string, parameters?: Object): Promise<void>; | ||
reportReferralUrl(referralUrl: string): Promise<void>; | ||
setUserProfileID(id: string): Promise<void>; | ||
@@ -6,0 +17,0 @@ getDeviceID(): Promise<string>; |
@@ -7,5 +7,35 @@ import { Plugins } from '@capacitor/core'; | ||
} | ||
activate(apiKey, options = {}) { | ||
return this.appmetrica.activate(Object.assign({ apiKey }, options)); | ||
} | ||
pauseSession() { | ||
return this.appmetrica.pauseSession(); | ||
} | ||
sendEventsBuffer() { | ||
return this.appmetrica.sendEventsBuffer(); | ||
} | ||
resumeSession() { | ||
return this.appmetrica.resumeSession(); | ||
} | ||
setLocationTracking(enabled) { | ||
return this.appmetrica.setLocationTracking({ enabled }); | ||
} | ||
setStatisticsSending(enabled) { | ||
return this.appmetrica.setStatisticsSending({ enabled }); | ||
} | ||
setLocation(location) { | ||
return this.appmetrica.setLocation({ location }); | ||
} | ||
reportAppOpen(url) { | ||
return this.appmetrica.reportAppOpen({ url }); | ||
} | ||
reportError(identifier, message, parameters) { | ||
return this.appmetrica.reportError({ identifier, message, parameters }); | ||
} | ||
reportEvent(name, parameters) { | ||
return this.appmetrica.reportEvent({ name, parameters }); | ||
} | ||
reportReferralUrl(referralUrl) { | ||
return this.appmetrica.reportReferralUrl({ referralUrl }); | ||
} | ||
setUserProfileID(id) { | ||
@@ -12,0 +42,0 @@ return this.appmetrica.setUserProfileID({ id }); |
{ | ||
"name": "capacitor-appmetrica", | ||
"version": "0.3.1", | ||
"version": "1.0.0-beta.0", | ||
"description": "Capacitor plugin for Appmetrica", | ||
@@ -46,2 +46,5 @@ "main": "plugin.js", | ||
"src": "ios" | ||
}, | ||
"android": { | ||
"src": "android" | ||
} | ||
@@ -48,0 +51,0 @@ }, |
186
plugin.js
import { Plugins } from '@capacitor/core'; | ||
var Gender; | ||
(function (Gender) { | ||
Gender[Gender["MALE"] = 0] = "MALE"; | ||
Gender[Gender["FEMALE"] = 1] = "FEMALE"; | ||
Gender[Gender["OTHER"] = 2] = "OTHER"; | ||
})(Gender || (Gender = {})); | ||
class UserProfile { | ||
const AppmetricaPlugin = Plugins.Appmetrica; | ||
class Appmetrica { | ||
constructor() { | ||
this.updates = []; | ||
this.appmetrica = AppmetricaPlugin; | ||
} | ||
apply(update) { | ||
this.updates.push(update); | ||
return this; | ||
activate(apiKey, options = {}) { | ||
return this.appmetrica.activate(Object.assign({ apiKey }, options)); | ||
} | ||
applyFromArray(updatesArray) { | ||
this.updates.push(...updatesArray); | ||
return this; | ||
pauseSession() { | ||
return this.appmetrica.pauseSession(); | ||
} | ||
} | ||
class UserProfileUpdate { | ||
constructor(attributeName, methodName, key, ...values) { | ||
this.attributeName = attributeName; | ||
this.methodName = methodName; | ||
this.key = key; | ||
this.values = values; | ||
sendEventsBuffer() { | ||
return this.appmetrica.sendEventsBuffer(); | ||
} | ||
} | ||
class BirthDateAttribute { | ||
constructor() { | ||
this.attributeName = 'birthDate'; | ||
resumeSession() { | ||
return this.appmetrica.resumeSession(); | ||
} | ||
withAge(age) { | ||
return new UserProfileUpdate(this.attributeName, 'withAge', null, age); | ||
setLocationTracking(enabled) { | ||
return this.appmetrica.setLocationTracking({ enabled }); | ||
} | ||
withBirthDate(yearOrDate, month, day) { | ||
const args = []; | ||
if (typeof yearOrDate !== 'number') { | ||
args.push(yearOrDate.getDate(), yearOrDate.getMonth(), yearOrDate.getFullYear()); | ||
} | ||
else { | ||
args.push(yearOrDate); | ||
if (month !== undefined) | ||
args.push(month); | ||
if (day !== undefined) | ||
args.push(day); | ||
} | ||
return new UserProfileUpdate(this.attributeName, 'withBirthDate', null, ...args); | ||
setStatisticsSending(enabled) { | ||
return this.appmetrica.setStatisticsSending({ enabled }); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
setLocation(location) { | ||
return this.appmetrica.setLocation({ location }); | ||
} | ||
} | ||
class GenderAttribute { | ||
constructor() { | ||
this.attributeName = 'gender'; | ||
reportAppOpen(url) { | ||
return this.appmetrica.reportAppOpen({ url }); | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', null, value.toString()); | ||
reportError(identifier, message, parameters) { | ||
return this.appmetrica.reportError({ identifier, message, parameters }); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
class NameAttribute { | ||
constructor() { | ||
this.attributeName = 'name'; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', null, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
class NotificationsEnabledAttribute { | ||
constructor() { | ||
this.attributeName = 'notificationsEnabled'; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', null, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', null); | ||
} | ||
} | ||
class CustomBooleanAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customBoolean'; | ||
this.key = key; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value); | ||
} | ||
withValueIfUndefined(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key); | ||
} | ||
} | ||
class CustomCounterAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customCounter'; | ||
this.key = key; | ||
} | ||
withDelta(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withDelta', this.key, value); | ||
} | ||
} | ||
class CustomNumberAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customNumber'; | ||
this.key = key; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value); | ||
} | ||
withValueIfUndefined(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key); | ||
} | ||
} | ||
class CustomStringAttribute { | ||
constructor(key) { | ||
this.attributeName = 'customString'; | ||
this.key = key; | ||
} | ||
withValue(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value); | ||
} | ||
withValueIfUndefined(value) { | ||
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value); | ||
} | ||
withValueReset() { | ||
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key); | ||
} | ||
} | ||
class ProfileAttribute { | ||
static BirthDate() { | ||
return new BirthDateAttribute(); | ||
} | ||
static Gender() { | ||
return new GenderAttribute(); | ||
} | ||
static Name() { | ||
return new NameAttribute(); | ||
} | ||
static NotificationsEnabled() { | ||
return new NotificationsEnabledAttribute(); | ||
} | ||
static CustomBool(key) { | ||
return new CustomBooleanAttribute(key); | ||
} | ||
static CustomCounter(key) { | ||
return new CustomCounterAttribute(key); | ||
} | ||
static CustomNumber(key) { | ||
return new CustomNumberAttribute(key); | ||
} | ||
static CustomString(key) { | ||
return new CustomStringAttribute(key); | ||
} | ||
} | ||
const AppmetricaPlugin = Plugins.Appmetrica; | ||
class Appmetrica { | ||
constructor() { | ||
this.appmetrica = AppmetricaPlugin; | ||
} | ||
reportEvent(name, parameters) { | ||
return this.appmetrica.reportEvent({ name, parameters }); | ||
} | ||
reportReferralUrl(referralUrl) { | ||
return this.appmetrica.reportReferralUrl({ referralUrl }); | ||
} | ||
setUserProfileID(id) { | ||
@@ -194,3 +58,3 @@ return this.appmetrica.setUserProfileID({ id }); | ||
export { Appmetrica, BirthDateAttribute, CustomBooleanAttribute, CustomCounterAttribute, CustomNumberAttribute, CustomStringAttribute, Gender, GenderAttribute, NameAttribute, NotificationsEnabledAttribute, ProfileAttribute, UserProfile, UserProfileUpdate }; | ||
export { Appmetrica }; | ||
//# sourceMappingURL=plugin.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162934
46
460
1