capacitor-amplitude
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -1,3 +0,3 @@ | ||
declare type PropertiesObject = Record<string, any>; | ||
declare type RevenueProperties = { | ||
type PropertiesObject = Record<string, any>; | ||
type RevenueProperties = { | ||
price: number; | ||
@@ -11,75 +11,54 @@ productId?: string; | ||
}; | ||
type AmplitudeInstance = { | ||
instanceName: string; | ||
}; | ||
export interface AmplitudePlugin { | ||
initialize(options: { | ||
instanceName: string; | ||
initialize(options: AmplitudeInstance & { | ||
apiKey: string; | ||
libraryName?: string; | ||
libraryVersion?: string; | ||
}): Promise<void>; | ||
logEvent(options: { | ||
instanceName: string; | ||
logEvent(options: AmplitudeInstance & { | ||
eventType: string; | ||
}): Promise<void>; | ||
logEventWithProperties(options: { | ||
instanceName: string; | ||
logEventWithProperties(options: AmplitudeInstance & { | ||
eventType: string; | ||
eventProperties: PropertiesObject; | ||
}): Promise<void>; | ||
enableCoppaControl(options: { | ||
instanceName: string; | ||
enableCoppaControl(options: AmplitudeInstance): Promise<void>; | ||
disableCoppaControl(options: AmplitudeInstance): Promise<void>; | ||
regenerateDeviceId(options: AmplitudeInstance): Promise<void>; | ||
setDeviceId(options: AmplitudeInstance & { | ||
deviceId: string; | ||
}): Promise<void>; | ||
disableCoppaControl(options: { | ||
instanceName: string; | ||
}): Promise<void>; | ||
regenerateDeviceId(options: { | ||
instanceName: string; | ||
}): Promise<void>; | ||
setDeviceId(options: { | ||
instanceName: string; | ||
getDeviceId(options: AmplitudeInstance): Promise<{ | ||
deviceId: string; | ||
}): Promise<void>; | ||
getDeviceId(options: { | ||
instanceName: string; | ||
}): Promise<string>; | ||
setOptOut(options: { | ||
instanceName: string; | ||
}>; | ||
useAdvertisingIdForDeviceId(options: AmplitudeInstance): Promise<void>; | ||
setOptOut(options: AmplitudeInstance & { | ||
optOut: boolean; | ||
}): Promise<void>; | ||
setLibraryName(options: { | ||
instanceName: string; | ||
libraryName: string; | ||
}): Promise<void>; | ||
setLibraryVersion(options: { | ||
instanceName: string; | ||
libraryVersion: string; | ||
}): Promise<void>; | ||
trackingSessionEvents(options: { | ||
instanceName: string; | ||
trackingSessionEvents(options: AmplitudeInstance & { | ||
trackingSessionEvents: boolean; | ||
}): Promise<void>; | ||
setUseDynamicConfig(options: { | ||
instanceName: string; | ||
setUseDynamicConfig(options: AmplitudeInstance & { | ||
useDynamicConfig: boolean; | ||
}): Promise<void>; | ||
setUserId(options: { | ||
instanceName: string; | ||
setUserId(options: AmplitudeInstance & { | ||
userId: string | null; | ||
}): Promise<void>; | ||
setServerUrl(options: { | ||
instanceName: string; | ||
setServerUrl(options: AmplitudeInstance & { | ||
serverUrl: string; | ||
}): Promise<void>; | ||
logRevenueV2(options: { | ||
instanceName: string; | ||
logRevenueV2(options: AmplitudeInstance & { | ||
userProperties: RevenueProperties; | ||
}): Promise<void>; | ||
identify(options: { | ||
instanceName: string; | ||
identify(options: AmplitudeInstance & { | ||
userProperties: PropertiesObject; | ||
}): Promise<void>; | ||
setGroup(options: { | ||
instanceName: string; | ||
setGroup(options: AmplitudeInstance & { | ||
groupType: string; | ||
groupName: string | string[]; | ||
}): Promise<void>; | ||
groupIdentify(options: { | ||
instanceName: string; | ||
groupIdentify(options: AmplitudeInstance & { | ||
groupType: string; | ||
@@ -89,37 +68,53 @@ groupName: string | string[]; | ||
}): Promise<void>; | ||
setUserProperties(options: { | ||
instanceName: string; | ||
setUserProperties(options: AmplitudeInstance & { | ||
userProperties: PropertiesObject; | ||
}): Promise<void>; | ||
clearUserProperties(options: { | ||
instanceName: string; | ||
}): Promise<void>; | ||
uploadEvents(options: { | ||
instanceName: string; | ||
}): Promise<void>; | ||
getSessionId(options: { | ||
instanceName: string; | ||
}): Promise<number>; | ||
setMinTimeBetweenSessionsMillis(options: { | ||
instanceName: string; | ||
clearUserProperties(options: AmplitudeInstance): Promise<void>; | ||
uploadEvents(options: AmplitudeInstance): Promise<void>; | ||
getSessionId(options: AmplitudeInstance): Promise<number>; | ||
setMinTimeBetweenSessionsMillis(options: AmplitudeInstance & { | ||
minTimeBetweenSessionsMillis: number; | ||
}): Promise<void>; | ||
setServerZone(options: { | ||
instanceName: string; | ||
setServerZone(options: AmplitudeInstance & { | ||
serverZone: string; | ||
updateServerUrl: boolean; | ||
}): Promise<void>; | ||
setEventUploadMaxBatchSize(options: { | ||
instanceName: string; | ||
setEventUploadMaxBatchSize(options: AmplitudeInstance & { | ||
eventUploadMaxBatchSize: number; | ||
}): Promise<void>; | ||
setEventUploadPeriodMillis(options: { | ||
instanceName: string; | ||
setEventUploadPeriodMillis(options: AmplitudeInstance & { | ||
eventUploadPeriodMillis: number; | ||
}): Promise<void>; | ||
setEventUploadThreshold(options: { | ||
instanceName: string; | ||
setEventUploadThreshold(options: AmplitudeInstance & { | ||
eventUploadThreshold: number; | ||
}): Promise<void>; | ||
setPlan(options: AmplitudeInstance & { | ||
plan: Plan; | ||
}): Promise<void>; | ||
setIngestionMetadata(options: AmplitudeInstance & { | ||
ingestionMetadata: IngestionMetadata; | ||
}): Promise<void>; | ||
} | ||
/** | ||
* Tracking plan | ||
*/ | ||
export type Plan = { | ||
/** The tracking plan branch name e.g. "main" */ | ||
branch?: string; | ||
/** The tracking plan source e.g. "web", "mobile" */ | ||
source?: string; | ||
/** The tracking plan version e.g. "1", "15" */ | ||
version?: string; | ||
/** The tracking plan version Id e.g. "9ec23ba0-275f-468f-80d1-66b88bff9529" */ | ||
versionId?: string; | ||
}; | ||
/** | ||
* Ingestion metadata | ||
*/ | ||
export type IngestionMetadata = { | ||
/** The source name of ingestion metadata e.g. "ampli" */ | ||
sourceName?: string; | ||
/** The source version of ingestion metadata e.g. "2.0.0" */ | ||
sourceVersion?: string; | ||
}; | ||
export {}; |
@@ -0,8 +1,21 @@ | ||
export declare enum IdentifyOperation { | ||
SET = "$set", | ||
SET_ONCE = "$setOnce", | ||
ADD = "$add", | ||
APPEND = "$append", | ||
PREINSERT = "$preInsert", | ||
POSTINSERT = "$postInsert", | ||
UNSET = "$unset" | ||
} | ||
export interface IdentifyPayload { | ||
[IdentifyOperation.ADD]?: Record<string, number>; | ||
[IdentifyOperation.UNSET]?: Record<string, unknown>; | ||
[IdentifyOperation.SET]?: Record<string, unknown>; | ||
[IdentifyOperation.SET_ONCE]?: Record<string, unknown>; | ||
[IdentifyOperation.APPEND]?: Record<string, unknown>; | ||
[IdentifyOperation.PREINSERT]?: Record<string, unknown>; | ||
[IdentifyOperation.POSTINSERT]?: Record<string, unknown>; | ||
} | ||
export declare class Identify { | ||
payload: Record<string, Record<string, unknown>>; | ||
private static OP_SET; | ||
private static OP_SET_ONCE; | ||
private static OP_ADD; | ||
private static OP_APPEND; | ||
private static OP_UNSET; | ||
payload: IdentifyPayload; | ||
private static ALL_OPS; | ||
@@ -15,4 +28,6 @@ constructor(); | ||
append(key: string, value: unknown): void; | ||
preInsert(key: string, value: unknown): void; | ||
postInsert(key: string, value: unknown): void; | ||
private addOp; | ||
private opMap; | ||
} |
@@ -0,1 +1,11 @@ | ||
export var IdentifyOperation; | ||
(function (IdentifyOperation) { | ||
IdentifyOperation["SET"] = "$set"; | ||
IdentifyOperation["SET_ONCE"] = "$setOnce"; | ||
IdentifyOperation["ADD"] = "$add"; | ||
IdentifyOperation["APPEND"] = "$append"; | ||
IdentifyOperation["PREINSERT"] = "$preInsert"; | ||
IdentifyOperation["POSTINSERT"] = "$postInsert"; | ||
IdentifyOperation["UNSET"] = "$unset"; | ||
})(IdentifyOperation || (IdentifyOperation = {})); | ||
export class Identify { | ||
@@ -6,16 +16,22 @@ constructor() { | ||
set(key, value) { | ||
this.addOp(Identify.OP_SET, key, value); | ||
this.addOp(IdentifyOperation.SET, key, value); | ||
} | ||
setOnce(key, value) { | ||
this.addOp(Identify.OP_SET_ONCE, key, value); | ||
this.addOp(IdentifyOperation.SET_ONCE, key, value); | ||
} | ||
add(key, value) { | ||
this.addOp(Identify.OP_ADD, key, value); | ||
this.addOp(IdentifyOperation.ADD, key, value); | ||
} | ||
unset(key) { | ||
this.addOp(Identify.OP_UNSET, key, '-'); | ||
this.addOp(IdentifyOperation.UNSET, key, '-'); | ||
} | ||
append(key, value) { | ||
this.addOp(Identify.OP_APPEND, key, value); | ||
this.addOp(IdentifyOperation.APPEND, key, value); | ||
} | ||
preInsert(key, value) { | ||
this.addOp(IdentifyOperation.PREINSERT, key, value); | ||
} | ||
postInsert(key, value) { | ||
this.addOp(IdentifyOperation.POSTINSERT, key, value); | ||
} | ||
addOp(op, key, value) { | ||
@@ -27,21 +43,18 @@ if (!Identify.ALL_OPS.includes(op)) { | ||
} | ||
opMap(key) { | ||
if (!Object.prototype.hasOwnProperty.call(this.payload, key)) { | ||
this.payload[key] = {}; | ||
opMap(op) { | ||
if (!Object.prototype.hasOwnProperty.call(this.payload, op)) { | ||
this.payload[op] = {}; | ||
} | ||
return this.payload[key]; | ||
return this.payload[op]; | ||
} | ||
} | ||
Identify.OP_SET = '$set'; | ||
Identify.OP_SET_ONCE = '$setOnce'; | ||
Identify.OP_ADD = '$add'; | ||
Identify.OP_APPEND = '$append'; | ||
Identify.OP_UNSET = '$unset'; | ||
Identify.ALL_OPS = [ | ||
Identify.OP_SET, | ||
Identify.OP_SET_ONCE, | ||
Identify.OP_ADD, | ||
Identify.OP_APPEND, | ||
Identify.OP_UNSET, | ||
IdentifyOperation.SET, | ||
IdentifyOperation.SET_ONCE, | ||
IdentifyOperation.ADD, | ||
IdentifyOperation.APPEND, | ||
IdentifyOperation.PREINSERT, | ||
IdentifyOperation.POSTINSERT, | ||
IdentifyOperation.UNSET, | ||
]; | ||
//# sourceMappingURL=identify.js.map |
@@ -0,3 +1,5 @@ | ||
import type { IngestionMetadata, Plan } from './definitions'; | ||
import { Identify } from './identify'; | ||
export * from './definitions'; | ||
export * from './identify'; | ||
export declare class Amplitude { | ||
@@ -47,2 +49,7 @@ private static _instances; | ||
/** | ||
* Use the Advertising ID on Android if available from Google Play Services. | ||
* Must be called before init. | ||
*/ | ||
useAdvertisingIdForDeviceId(): Promise<void>; | ||
/** | ||
* Enables tracking opt out. | ||
@@ -185,2 +192,14 @@ * | ||
setEventUploadThreshold(eventUploadThreshold: number): Promise<void>; | ||
/** | ||
* Sets tracking plan information. | ||
* | ||
* @param plan Plan object | ||
*/ | ||
setPlan(plan: Plan): Promise<void>; | ||
/** | ||
* Sets ingestion metadata information. | ||
* | ||
* @param ingestionMetadata IngestionMetadata object | ||
*/ | ||
setIngestionMetadata(ingestionMetadata: IngestionMetadata): Promise<void>; | ||
} |
import { registerPlugin } from '@capacitor/core'; | ||
import { PACKAGE_SOURCE_NAME, PACKAGE_VERSION } from './constants'; | ||
const CapacitorAmplitude = registerPlugin('Amplitude', { | ||
@@ -6,2 +7,3 @@ // web: () => import('./web').then(m => new m.AmplitudeWeb()), | ||
export * from './definitions'; | ||
export * from './identify'; | ||
export class Amplitude { | ||
@@ -26,2 +28,4 @@ constructor(instanceName = Amplitude._defaultInstanceName) { | ||
apiKey, | ||
libraryName: PACKAGE_SOURCE_NAME, | ||
libraryVersion: PACKAGE_VERSION, | ||
}); | ||
@@ -94,5 +98,16 @@ } | ||
getDeviceId() { | ||
return CapacitorAmplitude.getDeviceId({ instanceName: this.instanceName }); | ||
return CapacitorAmplitude.getDeviceId({ | ||
instanceName: this.instanceName, | ||
}).then(({ deviceId }) => deviceId); | ||
} | ||
/** | ||
* Use the Advertising ID on Android if available from Google Play Services. | ||
* Must be called before init. | ||
*/ | ||
useAdvertisingIdForDeviceId() { | ||
return CapacitorAmplitude.useAdvertisingIdForDeviceId({ | ||
instanceName: this.instanceName, | ||
}); | ||
} | ||
/** | ||
* Enables tracking opt out. | ||
@@ -312,4 +327,26 @@ * | ||
} | ||
/** | ||
* Sets tracking plan information. | ||
* | ||
* @param plan Plan object | ||
*/ | ||
setPlan(plan) { | ||
return CapacitorAmplitude.setPlan({ | ||
instanceName: this.instanceName, | ||
plan, | ||
}); | ||
} | ||
/** | ||
* Sets ingestion metadata information. | ||
* | ||
* @param ingestionMetadata IngestionMetadata object | ||
*/ | ||
setIngestionMetadata(ingestionMetadata) { | ||
return CapacitorAmplitude.setIngestionMetadata({ | ||
instanceName: this.instanceName, | ||
ingestionMetadata, | ||
}); | ||
} | ||
} | ||
Amplitude._defaultInstanceName = '$default_instance'; | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,63 @@ 'use strict'; | ||
const PACKAGE_SOURCE_NAME = 'capacitor-amplitude'; | ||
const PACKAGE_VERSION = '2.0.0'; | ||
exports.IdentifyOperation = void 0; | ||
(function (IdentifyOperation) { | ||
IdentifyOperation["SET"] = "$set"; | ||
IdentifyOperation["SET_ONCE"] = "$setOnce"; | ||
IdentifyOperation["ADD"] = "$add"; | ||
IdentifyOperation["APPEND"] = "$append"; | ||
IdentifyOperation["PREINSERT"] = "$preInsert"; | ||
IdentifyOperation["POSTINSERT"] = "$postInsert"; | ||
IdentifyOperation["UNSET"] = "$unset"; | ||
})(exports.IdentifyOperation || (exports.IdentifyOperation = {})); | ||
class Identify { | ||
constructor() { | ||
this.payload = {}; | ||
} | ||
set(key, value) { | ||
this.addOp(exports.IdentifyOperation.SET, key, value); | ||
} | ||
setOnce(key, value) { | ||
this.addOp(exports.IdentifyOperation.SET_ONCE, key, value); | ||
} | ||
add(key, value) { | ||
this.addOp(exports.IdentifyOperation.ADD, key, value); | ||
} | ||
unset(key) { | ||
this.addOp(exports.IdentifyOperation.UNSET, key, '-'); | ||
} | ||
append(key, value) { | ||
this.addOp(exports.IdentifyOperation.APPEND, key, value); | ||
} | ||
preInsert(key, value) { | ||
this.addOp(exports.IdentifyOperation.PREINSERT, key, value); | ||
} | ||
postInsert(key, value) { | ||
this.addOp(exports.IdentifyOperation.POSTINSERT, key, value); | ||
} | ||
addOp(op, key, value) { | ||
if (!Identify.ALL_OPS.includes(op)) { | ||
throw new Error(`Unknown Identify operation: ${op} called with key: ${key} value: ${String(value)}`); | ||
} | ||
this.opMap(op)[key] = value; | ||
} | ||
opMap(op) { | ||
if (!Object.prototype.hasOwnProperty.call(this.payload, op)) { | ||
this.payload[op] = {}; | ||
} | ||
return this.payload[op]; | ||
} | ||
} | ||
Identify.ALL_OPS = [ | ||
exports.IdentifyOperation.SET, | ||
exports.IdentifyOperation.SET_ONCE, | ||
exports.IdentifyOperation.ADD, | ||
exports.IdentifyOperation.APPEND, | ||
exports.IdentifyOperation.PREINSERT, | ||
exports.IdentifyOperation.POSTINSERT, | ||
exports.IdentifyOperation.UNSET, | ||
]; | ||
const CapacitorAmplitude = core.registerPlugin('Amplitude', { | ||
@@ -30,2 +91,4 @@ // web: () => import('./web').then(m => new m.AmplitudeWeb()), | ||
apiKey, | ||
libraryName: PACKAGE_SOURCE_NAME, | ||
libraryVersion: PACKAGE_VERSION, | ||
}); | ||
@@ -98,5 +161,16 @@ } | ||
getDeviceId() { | ||
return CapacitorAmplitude.getDeviceId({ instanceName: this.instanceName }); | ||
return CapacitorAmplitude.getDeviceId({ | ||
instanceName: this.instanceName, | ||
}).then(({ deviceId }) => deviceId); | ||
} | ||
/** | ||
* Use the Advertising ID on Android if available from Google Play Services. | ||
* Must be called before init. | ||
*/ | ||
useAdvertisingIdForDeviceId() { | ||
return CapacitorAmplitude.useAdvertisingIdForDeviceId({ | ||
instanceName: this.instanceName, | ||
}); | ||
} | ||
/** | ||
* Enables tracking opt out. | ||
@@ -316,2 +390,24 @@ * | ||
} | ||
/** | ||
* Sets tracking plan information. | ||
* | ||
* @param plan Plan object | ||
*/ | ||
setPlan(plan) { | ||
return CapacitorAmplitude.setPlan({ | ||
instanceName: this.instanceName, | ||
plan, | ||
}); | ||
} | ||
/** | ||
* Sets ingestion metadata information. | ||
* | ||
* @param ingestionMetadata IngestionMetadata object | ||
*/ | ||
setIngestionMetadata(ingestionMetadata) { | ||
return CapacitorAmplitude.setIngestionMetadata({ | ||
instanceName: this.instanceName, | ||
ingestionMetadata, | ||
}); | ||
} | ||
} | ||
@@ -321,2 +417,3 @@ Amplitude._defaultInstanceName = '$default_instance'; | ||
exports.Amplitude = Amplitude; | ||
exports.Identify = Identify; | ||
//# sourceMappingURL=plugin.cjs.js.map |
var capacitorAmplitude = (function (exports, core) { | ||
'use strict'; | ||
const PACKAGE_SOURCE_NAME = 'capacitor-amplitude'; | ||
const PACKAGE_VERSION = '2.0.0'; | ||
exports.IdentifyOperation = void 0; | ||
(function (IdentifyOperation) { | ||
IdentifyOperation["SET"] = "$set"; | ||
IdentifyOperation["SET_ONCE"] = "$setOnce"; | ||
IdentifyOperation["ADD"] = "$add"; | ||
IdentifyOperation["APPEND"] = "$append"; | ||
IdentifyOperation["PREINSERT"] = "$preInsert"; | ||
IdentifyOperation["POSTINSERT"] = "$postInsert"; | ||
IdentifyOperation["UNSET"] = "$unset"; | ||
})(exports.IdentifyOperation || (exports.IdentifyOperation = {})); | ||
class Identify { | ||
constructor() { | ||
this.payload = {}; | ||
} | ||
set(key, value) { | ||
this.addOp(exports.IdentifyOperation.SET, key, value); | ||
} | ||
setOnce(key, value) { | ||
this.addOp(exports.IdentifyOperation.SET_ONCE, key, value); | ||
} | ||
add(key, value) { | ||
this.addOp(exports.IdentifyOperation.ADD, key, value); | ||
} | ||
unset(key) { | ||
this.addOp(exports.IdentifyOperation.UNSET, key, '-'); | ||
} | ||
append(key, value) { | ||
this.addOp(exports.IdentifyOperation.APPEND, key, value); | ||
} | ||
preInsert(key, value) { | ||
this.addOp(exports.IdentifyOperation.PREINSERT, key, value); | ||
} | ||
postInsert(key, value) { | ||
this.addOp(exports.IdentifyOperation.POSTINSERT, key, value); | ||
} | ||
addOp(op, key, value) { | ||
if (!Identify.ALL_OPS.includes(op)) { | ||
throw new Error(`Unknown Identify operation: ${op} called with key: ${key} value: ${String(value)}`); | ||
} | ||
this.opMap(op)[key] = value; | ||
} | ||
opMap(op) { | ||
if (!Object.prototype.hasOwnProperty.call(this.payload, op)) { | ||
this.payload[op] = {}; | ||
} | ||
return this.payload[op]; | ||
} | ||
} | ||
Identify.ALL_OPS = [ | ||
exports.IdentifyOperation.SET, | ||
exports.IdentifyOperation.SET_ONCE, | ||
exports.IdentifyOperation.ADD, | ||
exports.IdentifyOperation.APPEND, | ||
exports.IdentifyOperation.PREINSERT, | ||
exports.IdentifyOperation.POSTINSERT, | ||
exports.IdentifyOperation.UNSET, | ||
]; | ||
const CapacitorAmplitude = core.registerPlugin('Amplitude', { | ||
@@ -26,2 +87,4 @@ // web: () => import('./web').then(m => new m.AmplitudeWeb()), | ||
apiKey, | ||
libraryName: PACKAGE_SOURCE_NAME, | ||
libraryVersion: PACKAGE_VERSION, | ||
}); | ||
@@ -94,5 +157,16 @@ } | ||
getDeviceId() { | ||
return CapacitorAmplitude.getDeviceId({ instanceName: this.instanceName }); | ||
return CapacitorAmplitude.getDeviceId({ | ||
instanceName: this.instanceName, | ||
}).then(({ deviceId }) => deviceId); | ||
} | ||
/** | ||
* Use the Advertising ID on Android if available from Google Play Services. | ||
* Must be called before init. | ||
*/ | ||
useAdvertisingIdForDeviceId() { | ||
return CapacitorAmplitude.useAdvertisingIdForDeviceId({ | ||
instanceName: this.instanceName, | ||
}); | ||
} | ||
/** | ||
* Enables tracking opt out. | ||
@@ -312,2 +386,24 @@ * | ||
} | ||
/** | ||
* Sets tracking plan information. | ||
* | ||
* @param plan Plan object | ||
*/ | ||
setPlan(plan) { | ||
return CapacitorAmplitude.setPlan({ | ||
instanceName: this.instanceName, | ||
plan, | ||
}); | ||
} | ||
/** | ||
* Sets ingestion metadata information. | ||
* | ||
* @param ingestionMetadata IngestionMetadata object | ||
*/ | ||
setIngestionMetadata(ingestionMetadata) { | ||
return CapacitorAmplitude.setIngestionMetadata({ | ||
instanceName: this.instanceName, | ||
ingestionMetadata, | ||
}); | ||
} | ||
} | ||
@@ -317,2 +413,3 @@ Amplitude._defaultInstanceName = '$default_instance'; | ||
exports.Amplitude = Amplitude; | ||
exports.Identify = Identify; | ||
@@ -319,0 +416,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "capacitor-amplitude", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Amplitude plugin for capacitor", | ||
@@ -20,6 +20,6 @@ "main": "dist/plugin.cjs.js", | ||
"type": "git", | ||
"url": "git+https://github.com/rediska1114/capacitor-amplitude.git.git" | ||
"url": "git+https://github.com/rediska1114/capacitor-amplitude.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/rediska1114/capacitor-amplitude.git/issues" | ||
"url": "https://github.com/rediska1114/capacitor-amplitude/issues" | ||
}, | ||
@@ -47,6 +47,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@capacitor/android": "^3.0.0", | ||
"@capacitor/core": "^3.0.0", | ||
"@capacitor/docgen": "^0.0.18", | ||
"@capacitor/ios": "^3.0.0", | ||
"@capacitor/android": "^5.0.0", | ||
"@capacitor/core": "^5.0.0", | ||
"@capacitor/docgen": "0.2.1", | ||
"@capacitor/ios": "^5.0.0", | ||
"@ionic/eslint-config": "^0.3.0", | ||
@@ -56,11 +56,11 @@ "@ionic/prettier-config": "^1.0.1", | ||
"eslint": "^7.11.0", | ||
"prettier": "~2.2.0", | ||
"prettier-plugin-java": "~1.0.0", | ||
"prettier": "2.8.8", | ||
"prettier-plugin-java": "1.6.2", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.32.0", | ||
"swiftlint": "^1.0.1", | ||
"typescript": "~4.0.3" | ||
"typescript": "4.9.5" | ||
}, | ||
"peerDependencies": { | ||
"@capacitor/core": "^3.0.0" | ||
"@capacitor/core": "^5.0.0" | ||
}, | ||
@@ -67,0 +67,0 @@ "prettier": "@ionic/prettier-config", |
@@ -7,6 +7,31 @@ # Capacitor amplitude plugin | ||
- logEvent | ||
- setUserProfileID | ||
- reportUserProfile | ||
- getDeviceID | ||
- `getInstance(instanceName: string): Amplitude` - Retrieve an instance of the Amplitude class. | ||
- `init(apiKey: string): Promise<void>` - Initialize the Amplitude instance with a given API key. | ||
- `logEvent(eventType: string, eventProperties?: Record<string, unknown>): Promise<void>` - Log an event with the given type and optional properties. | ||
- `enableCoppaControl(): Promise<void>` - Enable COPPA (Children's Online Privacy Protection Act) restrictions. | ||
- `disableCoppaControl(): Promise<void>` - Disable COPPA restrictions. | ||
- `regenerateDeviceId(): Promise<void>` - Generate a new DeviceId. | ||
- `setDeviceId(deviceId: string): Promise<void>` - Manually set the DeviceId. | ||
- `getDeviceId(): Promise<string>` - Retrieve the current DeviceId. | ||
- `useAdvertisingIdForDeviceId(): Promise<void>` - Use the Advertising ID for the DeviceId. | ||
- `setOptOut(optOut: boolean): Promise<void>` - Enable or disable tracking opt-out. | ||
- `trackingSessionEvents(trackingSessionEvents: boolean): Promise<void>` - Enable or disable the automatic logging of session start and end events. | ||
- `setUserId(userId: string | null): Promise<void>` - Set the UserId. | ||
- `setServerUrl(serverUrl: string): Promise<void>` - Set the server URL for event uploads. | ||
- `setUseDynamicConfig(useDynamicConfig: boolean): Promise<void>` - Enable or disable dynamic server URL configuration. | ||
- `logRevenue(userProperties: {...}): Promise<void>` - Log revenue data with provided properties. | ||
- `identify(identifyInstance: Identify): Promise<void>` - Send user property operations to the Amplitude servers. | ||
- `setGroup(groupType: string, groupName: string | string[]): Promise<void>` - Add a user to a group or groups. | ||
- `groupIdentify(groupType: string, groupName: string | string[], identifyInstance: Identify): Promise<void>` - Update properties of particular groups. | ||
- `setUserProperties(userProperties: Record<string, unknown>): Promise<void>` - Set properties that are tracked at the user level. | ||
- `clearUserProperties(): Promise<void>` - Clear all properties that are tracked at the user level. | ||
- `uploadEvents(): Promise<void>` - Upload all unsent events to the server. | ||
- `getSessionId(): Promise<number>` - Retrieve the current session ID. | ||
- `setMinTimeBetweenSessionsMillis(minTimeBetweenSessionsMillis: number): Promise<void>` - Set the minimum time between sessions. | ||
- `setServerZone(serverZone: string, updateServerUrl: boolean = true): Promise<void>` - Set the server zone and optionally update the server URL. | ||
- `setEventUploadMaxBatchSize(eventUploadMaxBatchSize: number): Promise<void>` - Set the maximum number of events sent per upload request. | ||
- `setEventUploadPeriodMillis(eventUploadPeriodMillis: number): Promise<void>` - Sets the period in milliseconds for batch uploading unsent events. | ||
- `setEventUploadThreshold(eventUploadThreshold: number): Promise<void>` - Sets the threshold number of unsent events that will trigger a batch upload. | ||
- `setPlan(plan: Plan): Promise<void>` - Sets the tracking plan information. | ||
- `setIngestionMetadata(ingestionMetadata: IngestionMetadata): Promise<void>` - Sets the ingestion metadata information. | ||
@@ -25,3 +50,3 @@ # Usage example: | ||
... | ||
Amplitude, | ||
{ provide: Amplitude, useFactory: () => Amplitude.getInstance() }, | ||
], | ||
@@ -67,4 +92,8 @@ }) | ||
## BREAKING CHANGES in 2.x.x version | ||
- Added support for Capacitor 5 | ||
## BREAKING CHANGES in 1.x.x version | ||
- Added full support for Capacitor 3 and removed compatibility with Capacitor 2 |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
156479
28
1580
0
97