diff --git a/src/@awesome-cordova-plugins/plugins/adjust/index.ts b/src/@awesome-cordova-plugins/plugins/adjust/index.ts index 1ea2175f2..e321ad3e4 100644 --- a/src/@awesome-cordova-plugins/plugins/adjust/index.ts +++ b/src/@awesome-cordova-plugins/plugins/adjust/index.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; export class AdjustConfig { + // common private appToken: string; private environment: AdjustEnvironment; private sdkPrefix: string; @@ -17,6 +18,15 @@ export class AdjustConfig { private urlStrategyDomains: string[] = []; private useSubdomains: boolean = null; private isDataResidency: boolean = null; + private isFirstSessionDelayEnabled: boolean = null; + private storeInfo: AdjustStoreInfo = null; + + private attributionCallback: (attribution: AdjustAttribution) => void = null; + private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null; + private eventTrackingFailedCallback: (event: AdjustEventFailure) => void = null; + private sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void = null; + private sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void = null; + private deferredDeeplinkCallback: (deeplink: string) => void = null; // android only private processName: string = null; @@ -32,16 +42,10 @@ export class AdjustConfig { private isSkanAttributionEnabled: boolean = null; private isLinkMeEnabled: boolean = null; private attConsentWaitingInterval: number = null; - - // callbacks - private attributionCallback: (attribution: AdjustAttribution) => void = null; - private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null; - private eventTrackingFailedCallback: (event: AdjustEventFailure) => void = null; - private sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void = null; - private sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void = null; - private deferredDeeplinkCallback: (deeplink: string) => void = null; + private isAppTrackingTransparencyUsageEnabled: boolean = null; private skanUpdatedCallback: (skanData: AdjustSkanData) => void = null; + // common constructor(appToken: string, environment: AdjustEnvironment) { this.appToken = appToken; this.environment = environment; @@ -60,7 +64,9 @@ export class AdjustConfig { } setUrlStrategy(urlStrategyDomains: string[], useSubdomains: boolean, isDataResidency: boolean): void { - this.urlStrategy = urlStrategy; + this.urlStrategyDomains = urlStrategyDomains; + this.useSubdomains = useSubdomains; + this.isDataResidency = isDataResidency; } enableSendingInBackground(): void { @@ -87,44 +93,12 @@ export class AdjustConfig { this.isCostDataInAttributionEnabled = true; } - setProcessName(processName: string) { - this.processName = processName; + enableFirstSessionDelay(): void { + this.isFirstSessionDelayEnabled = true; } - enablePreinstallTracking(): void { - this.isPreinstallTrackingEnabled = true; - } - - setPreinstallFilePath(preinstallFilePath: string): void { - this.preinstallFilePath = preinstallFilePath; - } - - setFbAppId(fbAppId: string): void { - this.fbAppId = fbAppId; - } - - disableIdfaReading(): void { - this.isIdfaReadingEnabled = false; - } - - disableIdfvReading(): void { - this.isIdfvReadingEnabled = false; - } - - disableAdServices(): void { - this.isAdServicesEnabled = false; - } - - enableLinkMe(): void { - this.isLinkMeEnabled = true; - } - - disableSkanAttribution(): void { - this.isSkanAttributionEnabled = false; - } - - setAttConsentWaitingInterval(attConsentWaitingInterval: number): void { - this.attConsentWaitingInterval = attConsentWaitingInterval; + setStoreInfo(storeInfo: AdjustStoreInfo): void { + this.storeInfo = storeInfo; } setAttributionCallback(attributionCallback: (attribution: AdjustAttribution) => void): void { @@ -151,63 +125,109 @@ export class AdjustConfig { this.deferredDeeplinkCallback = deferredDeeplinkCallback; } + private getAttributionCallback(): ((attribution: AdjustAttribution) => void) | null { + return this.attributionCallback; + } + + private getEventTrackingSucceededCallback(): ((event: AdjustEventSuccess) => void) | null { + return this.eventTrackingSucceededCallback; + } + + private getEventTrackingFailedCallback(): ((event: AdjustEventFailure) => void) | null { + return this.eventTrackingFailedCallback; + } + + private getSessionTrackingSucceededCallback(): ((session: AdjustSessionSuccess) => void) | null { + return this.sessionTrackingSucceededCallback; + } + + private getSessionTrackingFailedCallback(): ((session: AdjustSessionFailure) => void) | null { + return this.sessionTrackingFailedCallback; + } + + private getDeferredDeeplinkCallback(): ((deeplink: string) => void) | null { + return this.deferredDeeplinkCallback; + } + + private hasAttributionCallback(): boolean { + return this.attributionCallback !== null; + } + + private hasEventTrackingSucceededCallback(): boolean { + return this.eventTrackingSucceededCallback !== null; + } + + private hasEventTrackingFailedCallback(): boolean { + return this.eventTrackingFailedCallback !== null; + } + + private hasSessionTrackingSucceededCallback(): boolean { + return this.sessionTrackingSucceededCallback !== null; + } + + private hasSessionTrackingFailedCallback(): boolean { + return this.sessionTrackingFailedCallback !== null; + } + + private hasDeferredDeeplinkCallback(): boolean { + return this.deferredDeeplinkCallback !== null; + } + + // android only + setProcessName(processName: string): void { + this.processName = processName; + } + + enablePreinstallTracking(): void { + this.isPreinstallTrackingEnabled = true; + } + + setPreinstallFilePath(preinstallFilePath: string): void { + this.preinstallFilePath = preinstallFilePath; + } + + setFbAppId(fbAppId: string): void { + this.fbAppId = fbAppId; + } + + // ios only + disableIdfaReading(): void { + this.isIdfaReadingEnabled = false; + } + + disableIdfvReading(): void { + this.isIdfvReadingEnabled = false; + } + + disableAdServices(): void { + this.isAdServicesEnabled = false; + } + + enableLinkMe(): void { + this.isLinkMeEnabled = true; + } + + disableSkanAttribution(): void { + this.isSkanAttributionEnabled = false; + } + + setAttConsentWaitingInterval(attConsentWaitingInterval: number): void { + this.attConsentWaitingInterval = attConsentWaitingInterval; + } + + disableAppTrackingTransparencyUsage(): void { + this.isAppTrackingTransparencyUsageEnabled = false; + } + setSkanUpdatedCallback(skanUpdatedCallback: (skanData: AdjustSkanData) => void): void { this.skanUpdatedCallback = skanUpdatedCallback; } - private getAttributionCallback(): void { - return this.attributionCallback; - } - - private getEventTrackingSucceededCallback(): void { - return this.eventTrackingSucceededCallback; - } - - private getEventTrackingFailedCallback(): void { - return this.eventTrackingFailedCallback; - } - - private getSessionTrackingSucceededCallback(): void { - return this.sessionTrackingSucceededCallback; - } - - private getSessionTrackingFailedCallback(): void { - return this.sessionTrackingFailedCallback; - } - - private getDeferredDeeplinkCallback(): void { - return this.deferredDeeplinkCallback; - } - - private getSkanUpdatedCallback(): void { + private getSkanUpdatedCallback(): ((skanData: AdjustSkanData) => void) | null { return this.skanUpdatedCallback; } - private hasAttributionCallback(): void { - return this.attributionCallback !== null; - } - - private hasEventTrackingSucceededCallback(): void { - return this.eventTrackingSucceededCallback !== null; - } - - private hasEventTrackingFailedCallback(): void { - return this.eventTrackingFailedCallback !== null; - } - - private hasSessionTrackingSucceededCallback(): void { - return this.sessionTrackingSucceededCallback !== null; - } - - private hasSessionTrackingFailedCallback(): void { - return this.sessionTrackingFailedCallback !== null; - } - - private hasDeferredDeeplinkCallback(): void { - return this.deferredDeeplinkCallback !== null; - } - - private hasSkanUpdatedCallback(): void { + private hasSkanUpdatedCallback(): boolean { return this.skanUpdatedCallback !== null; } } @@ -424,10 +444,28 @@ export class AdjustPlayStorePurchase { export class AdjustDeeplink { private deeplink: string; + private referrer: string; constructor(deeplink: string) { this.deeplink = deeplink; } + + setReferrer(referrer: string): void { + this.referrer = referrer; + } +} + +export class AdjustStoreInfo { + private storeName: string; + private storeAppId: string; + + constructor(storeName: string) { + this.storeName = storeName; + } + + setStoreAppId(storeAppId: string): void { + this.storeAppId = storeAppId; + } } export interface AdjustAttribution { @@ -443,6 +481,7 @@ export interface AdjustAttribution { costAmount: string; costCurrency: string; fbInstallReferrer: string; // android only + jsonResponse: string; } export interface AdjustSessionSuccess { @@ -546,6 +585,7 @@ export enum AdjustLogLevel { * AdjustAppStorePurchase * AdjustPlayStorePurchase * AdjustDeeplink + * AdjustStoreInfo * @enums * AdjustEnvironment * AdjustLogLevel @@ -562,7 +602,7 @@ export class Adjust extends AwesomeCordovaNativePlugin { /** * This method initializes Adjust SDK * - * @param {AdjustConig} adjustConfig Adjust config object used as starting options + * @param {AdjustConfig} adjustConfig Adjust config object used as starting options */ @Cordova({ sync: true }) initSdk(adjustConfig: AdjustConfig): void {} @@ -863,4 +903,42 @@ export class Adjust extends AwesomeCordovaNativePlugin { verifyPlayStorePurchase(adjustPlayStorePurchase: AdjustPlayStorePurchase): Promise { return; } -} \ No newline at end of file + + /** + * This method ends first session delay + */ + @Cordova({ sync: true }) + endFirstSessionDelay(): void {} + + /** + * This method enables COPPA compliance while in first session delay + */ + @Cordova({ sync: true }) + enableCoppaComplianceInDelay(): void {} + + /** + * This method disables COPPA compliance while in first session delay + */ + @Cordova({ sync: true }) + disableCoppaComplianceInDelay(): void {} + + /** + * This method enables Play Store Kids compliance while in first session delay + */ + @Cordova({ sync: true }) + enablePlayStoreKidsComplianceInDelay(): void {} + + /** + * This method disables Play Store Kids compliance while in first session delay + */ + @Cordova({ sync: true }) + disablePlayStoreKidsComplianceInDelay(): void {} + + /** + * This method allows you to set external device ID while in first session delay + * + * @param {string} externalDeviceId External device ID value + */ + @Cordova({ sync: true }) + setExternalDeviceIdInDelay(externalDeviceId: string): void {} +}