appsflyer-capacitor-plugin 6.14.3-rc1 → 6.15.0-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,15 +14,17 @@
14
14
 
15
15
  ### <a id="plugin-build-for"> This plugin is built for
16
16
 
17
- - Android AppsFlyer SDK **6.14.0**
18
- - iOS AppsFlyer SDK **6.14.3**
17
+ - Android AppsFlyer SDK **6.15.0**
18
+ - iOS AppsFlyer SDK **6.15.0**
19
+
20
+ ## <a id="breaking-changes-6-15-0"> ❗❗ Breaking changes when updating to v6.15.0 ❗❗
21
+ Starting from v6.15.0, this plugin works only with Capacitor 6. </br>
22
+ If you are still interested in using Capacitor 5, please follow the instructions [here](/docs/Installation.md#cap5) to install the latest version that supports Capacitor 5.
19
23
 
20
24
  ## <a id="breaking-changes-6-12-1"> ❗❗ Breaking changes when updating to v6.12.1 ❗❗
21
25
  Starting from v6.12.1, this plugin works only with Capacitor 5. </br>
22
26
  If you are still interested in using Capacitor 4, please follow the instructions [here](/docs/Installation.md#cap4) to install the latest version that supports Capacitor 4.
23
27
 
24
-
25
-
26
28
  ## <a id="breaking-changes"> ❗❗ Breaking changes when updating to v6.9.2 ❗❗
27
29
  Starting from v6.9.2, this plugin works only with Capacitor 4. </br>
28
30
  If you are still interested in using Capacitor 3, please follow the instructions [here](/docs/Installation.md#cap3) to install the latest version that supports Capacitor 3.
@@ -99,13 +99,13 @@ ext {
99
99
  }
100
100
 
101
101
  buildscript {
102
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
102
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
103
103
  repositories {
104
104
  google()
105
105
  mavenCentral()
106
106
  }
107
107
  dependencies {
108
- classpath 'com.android.tools.build:gradle:8.0.0'
108
+ classpath 'com.android.tools.build:gradle:8.2.1'
109
109
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
110
110
  classpath 'org.codehaus.groovy:groovy-json:3.0.9'
111
111
  }
@@ -116,10 +116,10 @@ apply plugin: 'kotlin-android'
116
116
 
117
117
  android {
118
118
  namespace "capacitor.plugin.appsflyer.sdk"
119
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
119
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
120
120
  defaultConfig {
121
121
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
122
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
122
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
123
123
  versionCode Integer.parseInt(plugin_build_version)
124
124
  versionName "$plugin_version"
125
125
  buildConfigField "int", "VERSION_CODE", plugin_build_version
@@ -64,4 +64,8 @@ const val AF_MANUAL_START = "manualStart"
64
64
  const val AF_IS_SUBJECTED_TO_GDPR = "isUserSubjectToGDPR"
65
65
  const val AF_CONSENT_FOR_DATA_USAGE = "hasConsentForDataUsage"
66
66
  const val AF_CONSENT_FOR_ADS_PERSONALIZATION = "hasConsentForAdsPersonalization"
67
+ const val AF_MONETIZATION_NETWORK = "monetizationNetwork"
68
+ const val AF_CURRENCY_ISO4217_CODE = "currencyIso4217Code"
69
+ const val AF_REVENUE = "revenue"
70
+ const val AF_MEDIATION_NETWORK = "mediationNetwork"
67
71
 
@@ -561,6 +561,36 @@ class AppsFlyerPlugin : Plugin() {
561
561
  call.resolve()
562
562
  }
563
563
 
564
+ @PluginMethod(returnType = PluginMethod.RETURN_NONE)
565
+ fun logAdRevenue(call: PluginCall) {
566
+ val adRevenueDataJson = call.data ?: return call.reject("adRevenueData is missing, the data mandatory to use this API.")
567
+
568
+ // Parse the fields from the adRevenueDataJson object
569
+ val monetizationNetwork = adRevenueDataJson.getString(AF_MONETIZATION_NETWORK) ?: return call.reject("monetizationNetwork is missing")
570
+ val currencyIso4217Code = adRevenueDataJson.getString(AF_CURRENCY_ISO4217_CODE) ?: return call.reject("currencyIso4217Code is missing")
571
+ val revenue = adRevenueDataJson.getDouble(AF_REVENUE)
572
+ if (revenue.isNaN()) {
573
+ return call.reject("revenue is missing or not a number")
574
+ }
575
+ val additionalParams = AFHelpers.jsonToMap(adRevenueDataJson.getJSObject(AF_ADDITIONAL_PARAMETERS)) // can be nullable
576
+
577
+ // Convert the mediationNetwork string to the MediationNetwork enum
578
+ val mediationNetworkValue = adRevenueDataJson.getString(AF_MEDIATION_NETWORK) ?: return call.reject("mediationNetwork is missing")
579
+ val mediationNetwork = MediationNetwork.entries.find { it.value == mediationNetworkValue } ?: return call.reject("Invalid mediation network")
580
+
581
+ // Create the AFAdRevenueData object
582
+ val adRevenueData = AFAdRevenueData(
583
+ monetizationNetwork = monetizationNetwork,
584
+ mediationNetwork = mediationNetwork,
585
+ currencyIso4217Code = currencyIso4217Code,
586
+ revenue = revenue
587
+ )
588
+
589
+ AppsFlyerLib.getInstance().logAdRevenue(adRevenueData, additionalParams)
590
+
591
+ call.resolve()
592
+ }
593
+
564
594
  private fun getDeepLinkListener(): DeepLinkListener {
565
595
  return DeepLinkListener {
566
596
  if (udl == true) {
@@ -7,3 +7,19 @@ export declare enum AFConstants {
7
7
  OAOA_CALLBACK = "oaoa_callback",
8
8
  UDL_CALLBACK = "udl_callback"
9
9
  }
10
+ export declare enum MediationNetwork {
11
+ IRONSOURCE = "ironsource",
12
+ APPLOVIN_MAX = "applovinmax",
13
+ GOOGLE_ADMOB = "googleadmob",
14
+ FYBER = "fyber",
15
+ APPODEAL = "appodeal",
16
+ ADMOST = "Admost",
17
+ TOPON = "Topon",
18
+ TRADPLUS = "Tradplus",
19
+ YANDEX = "Yandex",
20
+ CHARTBOOST = "chartboost",
21
+ UNITY = "Unity",
22
+ TOPON_PTE = "toponpte",
23
+ CUSTOM_MEDIATION = "customMediation",
24
+ DIRECT_MONETIZATION_NETWORK = "directMonetizationNetwork"
25
+ }
@@ -8,4 +8,21 @@ export var AFConstants;
8
8
  AFConstants["OAOA_CALLBACK"] = "oaoa_callback";
9
9
  AFConstants["UDL_CALLBACK"] = "udl_callback";
10
10
  })(AFConstants || (AFConstants = {}));
11
+ export var MediationNetwork;
12
+ (function (MediationNetwork) {
13
+ MediationNetwork["IRONSOURCE"] = "ironsource";
14
+ MediationNetwork["APPLOVIN_MAX"] = "applovinmax";
15
+ MediationNetwork["GOOGLE_ADMOB"] = "googleadmob";
16
+ MediationNetwork["FYBER"] = "fyber";
17
+ MediationNetwork["APPODEAL"] = "appodeal";
18
+ MediationNetwork["ADMOST"] = "Admost";
19
+ MediationNetwork["TOPON"] = "Topon";
20
+ MediationNetwork["TRADPLUS"] = "Tradplus";
21
+ MediationNetwork["YANDEX"] = "Yandex";
22
+ MediationNetwork["CHARTBOOST"] = "chartboost";
23
+ MediationNetwork["UNITY"] = "Unity";
24
+ MediationNetwork["TOPON_PTE"] = "toponpte";
25
+ MediationNetwork["CUSTOM_MEDIATION"] = "customMediation";
26
+ MediationNetwork["DIRECT_MONETIZATION_NETWORK"] = "directMonetizationNetwork";
27
+ })(MediationNetwork || (MediationNetwork = {}));
11
28
  //# sourceMappingURL=Appsflyer_constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Appsflyer_constants.js","sourceRoot":"","sources":["../../src/Appsflyer_constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACnB,kEAAmD,CAAA;IACnD,4DAA6C,CAAA;IAC7C,4DAA6C,CAAA;IAC7C,4DAA6C,CAAA;IAC7C,0DAA2C,CAAA;IAC3C,8CAA+B,CAAA;IAC/B,4CAA6B,CAAA;AACjC,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB"}
1
+ {"version":3,"file":"Appsflyer_constants.js","sourceRoot":"","sources":["../../src/Appsflyer_constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACnB,kEAAmD,CAAA;IACnD,4DAA6C,CAAA;IAC7C,4DAA6C,CAAA;IAC7C,4DAA6C,CAAA;IAC7C,0DAA2C,CAAA;IAC3C,8CAA+B,CAAA;IAC/B,4CAA6B,CAAA;AACjC,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB;AAGD,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IACxB,6CAAyB,CAAA;IACzB,gDAA4B,CAAA;IAC5B,gDAA4B,CAAA;IAC5B,mCAAe,CAAA;IACf,yCAAqB,CAAA;IACrB,qCAAiB,CAAA;IACjB,mCAAe,CAAA;IACf,yCAAqB,CAAA;IACrB,qCAAiB,CAAA;IACjB,6CAAyB,CAAA;IACzB,mCAAe,CAAA;IACf,0CAAsB,CAAA;IACtB,wDAAoC,CAAA;IACpC,6EAAyD,CAAA;AAC7D,CAAC,EAfW,gBAAgB,KAAhB,gBAAgB,QAe3B"}
@@ -1,3 +1,4 @@
1
+ import type { MediationNetwork } from "./Appsflyer_constants";
1
2
  export interface AFInit {
2
3
  devKey: string;
3
4
  appID: string;
@@ -171,4 +172,11 @@ export declare const AppsFlyerConsent: {
171
172
  export interface AFConsentData {
172
173
  data: IAppsFlyerConsent;
173
174
  }
175
+ export interface AFAdRevenueData {
176
+ monetizationNetwork: string;
177
+ mediationNetwork: MediationNetwork;
178
+ currencyIso4217Code: string;
179
+ revenue: number;
180
+ additionalParameters?: StringMap;
181
+ }
174
182
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"appsflyer_interfaces.js","sourceRoot":"","sources":["../../src/appsflyer_interfaces.ts"],"names":[],"mappings":"AA0HA,MAAM,qBAAqB;IAKvB,YAAoB,mBAA4B,EAAE,sBAAgC,EAAE,+BAAyC;QACzH,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACrD,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;IAC3E,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,sBAA+B,EAAE,+BAAwC;QACxF,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,+BAA+B,CAAC,CAAC;IACpG,CAAC;IAED,MAAM,CAAC,cAAc;QACjB,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,WAAW,EAAE,qBAAqB,CAAC,WAAW;IAC9C,cAAc,EAAE,qBAAqB,CAAC,cAAc;CACvD,CAAC"}
1
+ {"version":3,"file":"appsflyer_interfaces.js","sourceRoot":"","sources":["../../src/appsflyer_interfaces.ts"],"names":[],"mappings":"AA4HA,MAAM,qBAAqB;IAKvB,YAAoB,mBAA4B,EAAE,sBAAgC,EAAE,+BAAyC;QACzH,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACrD,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;IAC3E,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,sBAA+B,EAAE,+BAAwC;QACxF,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,+BAA+B,CAAC,CAAC;IACpG,CAAC;IAED,MAAM,CAAC,cAAc;QACjB,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,WAAW,EAAE,qBAAqB,CAAC,WAAW;IAC9C,cAAc,EAAE,qBAAqB,CAAC,cAAc;CACvD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { PluginListenerHandle } from "@capacitor/core";
2
2
  import type { AFConstants } from "./Appsflyer_constants";
3
- import type { AFAndroidInAppPurchase, AFAnonymizeUser, AFAppendToDeepLink, AFCuid, AFCurrency, AFData, AFDisable, AFEvent, AFFbDAL, AFFilters, AFHost, AFInit, AFIosInAppPurchase, AFIsStopped, AFLink, AFLinkGenerator, AFOnelinkDomain, AFOnelinkID, AFPath, AFPushPayload, AFRes, AFStop, AFUid, AFUninstall, AFUrls, AFLanguage, OnAppOpenAttribution, OnConversionDataResult, OnDeepLink, AFPromotion, AFEmails, AFLatLng, AFPhone, AFPartnerData, AFLogInvite, AFEnableTCFDataCollection, AFConsentData } from "./appsflyer_interfaces";
3
+ import type { AFAndroidInAppPurchase, AFAnonymizeUser, AFAppendToDeepLink, AFCuid, AFCurrency, AFData, AFDisable, AFEvent, AFFbDAL, AFFilters, AFHost, AFInit, AFIosInAppPurchase, AFIsStopped, AFLink, AFLinkGenerator, AFOnelinkDomain, AFOnelinkID, AFPath, AFPushPayload, AFRes, AFStop, AFUid, AFUninstall, AFUrls, AFLanguage, OnAppOpenAttribution, OnConversionDataResult, OnDeepLink, AFPromotion, AFEmails, AFLatLng, AFPhone, AFPartnerData, AFLogInvite, AFEnableTCFDataCollection, AFConsentData, AFAdRevenueData } from "./appsflyer_interfaces";
4
4
  export interface AppsFlyerPlugin {
5
5
  addListener(eventName: AFConstants.CONVERSION_CALLBACK, listenerFunc: (event: OnConversionDataResult) => void): PluginListenerHandle;
6
6
  addListener(eventName: AFConstants.OAOA_CALLBACK, listenerFunc: (event: OnAppOpenAttribution) => void): PluginListenerHandle;
@@ -174,4 +174,11 @@ export interface AppsFlyerPlugin {
174
174
  * @param data: AppsFlyerConsent object.
175
175
  */
176
176
  setConsentData(data: AFConsentData): Promise<void>;
177
+ /**
178
+ * By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI.
179
+ * Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app.
180
+ * You can use this method to log your ad revenue.
181
+ * @param adRevenueData: object used to hold all mandatory parameters of AdRevenue event.
182
+ */
183
+ logAdRevenue(data: AFAdRevenueData): Promise<void>;
177
184
  }
@@ -14,6 +14,23 @@ exports.AFConstants = void 0;
14
14
  AFConstants["OAOA_CALLBACK"] = "oaoa_callback";
15
15
  AFConstants["UDL_CALLBACK"] = "udl_callback";
16
16
  })(exports.AFConstants || (exports.AFConstants = {}));
17
+ exports.MediationNetwork = void 0;
18
+ (function (MediationNetwork) {
19
+ MediationNetwork["IRONSOURCE"] = "ironsource";
20
+ MediationNetwork["APPLOVIN_MAX"] = "applovinmax";
21
+ MediationNetwork["GOOGLE_ADMOB"] = "googleadmob";
22
+ MediationNetwork["FYBER"] = "fyber";
23
+ MediationNetwork["APPODEAL"] = "appodeal";
24
+ MediationNetwork["ADMOST"] = "Admost";
25
+ MediationNetwork["TOPON"] = "Topon";
26
+ MediationNetwork["TRADPLUS"] = "Tradplus";
27
+ MediationNetwork["YANDEX"] = "Yandex";
28
+ MediationNetwork["CHARTBOOST"] = "chartboost";
29
+ MediationNetwork["UNITY"] = "Unity";
30
+ MediationNetwork["TOPON_PTE"] = "toponpte";
31
+ MediationNetwork["CUSTOM_MEDIATION"] = "customMediation";
32
+ MediationNetwork["DIRECT_MONETIZATION_NETWORK"] = "directMonetizationNetwork";
33
+ })(exports.MediationNetwork || (exports.MediationNetwork = {}));
17
34
 
18
35
  class AppsFlyerConsentClass {
19
36
  constructor(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization) {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/Appsflyer_constants.js","esm/appsflyer_interfaces.js","esm/index.js"],"sourcesContent":["export var AFConstants;\n(function (AFConstants) {\n AFConstants[\"onConversionDataSuccess\"] = \"onConversionDataSuccess\";\n AFConstants[\"onConversionDataFail\"] = \"onConversionDataFail\";\n AFConstants[\"onAppOpenAttribution\"] = \"onAppOpenAttribution\";\n AFConstants[\"onAttributionFailure\"] = \"onAttributionFailure\";\n AFConstants[\"CONVERSION_CALLBACK\"] = \"conversion_callback\";\n AFConstants[\"OAOA_CALLBACK\"] = \"oaoa_callback\";\n AFConstants[\"UDL_CALLBACK\"] = \"udl_callback\";\n})(AFConstants || (AFConstants = {}));\n//# sourceMappingURL=Appsflyer_constants.js.map","class AppsFlyerConsentClass {\n constructor(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n this.isUserSubjectToGDPR = isUserSubjectToGDPR;\n this.hasConsentForDataUsage = hasConsentForDataUsage;\n this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization;\n }\n static forGDPRUser(hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n return new AppsFlyerConsentClass(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);\n }\n static forNonGDPRUser() {\n return new AppsFlyerConsentClass(false);\n }\n}\nexport const AppsFlyerConsent = {\n forGDPRUser: AppsFlyerConsentClass.forGDPRUser,\n forNonGDPRUser: AppsFlyerConsentClass.forNonGDPRUser\n};\n//# sourceMappingURL=appsflyer_interfaces.js.map","import { registerPlugin } from '@capacitor/core';\nconst AppsFlyer = registerPlugin('AppsFlyerPlugin', {});\nexport * from './definitions';\nexport * from './Appsflyer_constants';\nexport * from './appsflyer_interfaces';\nexport { AppsFlyer };\n//# sourceMappingURL=index.js.map"],"names":["AFConstants","registerPlugin"],"mappings":";;;;;;AAAWA,6BAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;AACvE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AACjE,IAAI,WAAW,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;AAC/D,IAAI,WAAW,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AACnD,IAAI,WAAW,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AACjD,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACTrC,MAAM,qBAAqB,CAAC;AAC5B,IAAI,WAAW,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,+BAA+B,EAAE;AAC9F,QAAQ,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AACvD,QAAQ,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AAC7D,QAAQ,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;AAC/E,KAAK;AACL,IAAI,OAAO,WAAW,CAAC,sBAAsB,EAAE,+BAA+B,EAAE;AAChF,QAAQ,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,+BAA+B,CAAC,CAAC;AACxG,KAAK;AACL,IAAI,OAAO,cAAc,GAAG;AAC5B,QAAQ,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAChD,KAAK;AACL,CAAC;AACW,MAAC,gBAAgB,GAAG;AAChC,IAAI,WAAW,EAAE,qBAAqB,CAAC,WAAW;AAClD,IAAI,cAAc,EAAE,qBAAqB,CAAC,cAAc;AACxD;;ACfK,MAAC,SAAS,GAAGC,mBAAc,CAAC,iBAAiB,EAAE,EAAE;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/Appsflyer_constants.js","esm/appsflyer_interfaces.js","esm/index.js"],"sourcesContent":["export var AFConstants;\n(function (AFConstants) {\n AFConstants[\"onConversionDataSuccess\"] = \"onConversionDataSuccess\";\n AFConstants[\"onConversionDataFail\"] = \"onConversionDataFail\";\n AFConstants[\"onAppOpenAttribution\"] = \"onAppOpenAttribution\";\n AFConstants[\"onAttributionFailure\"] = \"onAttributionFailure\";\n AFConstants[\"CONVERSION_CALLBACK\"] = \"conversion_callback\";\n AFConstants[\"OAOA_CALLBACK\"] = \"oaoa_callback\";\n AFConstants[\"UDL_CALLBACK\"] = \"udl_callback\";\n})(AFConstants || (AFConstants = {}));\nexport var MediationNetwork;\n(function (MediationNetwork) {\n MediationNetwork[\"IRONSOURCE\"] = \"ironsource\";\n MediationNetwork[\"APPLOVIN_MAX\"] = \"applovinmax\";\n MediationNetwork[\"GOOGLE_ADMOB\"] = \"googleadmob\";\n MediationNetwork[\"FYBER\"] = \"fyber\";\n MediationNetwork[\"APPODEAL\"] = \"appodeal\";\n MediationNetwork[\"ADMOST\"] = \"Admost\";\n MediationNetwork[\"TOPON\"] = \"Topon\";\n MediationNetwork[\"TRADPLUS\"] = \"Tradplus\";\n MediationNetwork[\"YANDEX\"] = \"Yandex\";\n MediationNetwork[\"CHARTBOOST\"] = \"chartboost\";\n MediationNetwork[\"UNITY\"] = \"Unity\";\n MediationNetwork[\"TOPON_PTE\"] = \"toponpte\";\n MediationNetwork[\"CUSTOM_MEDIATION\"] = \"customMediation\";\n MediationNetwork[\"DIRECT_MONETIZATION_NETWORK\"] = \"directMonetizationNetwork\";\n})(MediationNetwork || (MediationNetwork = {}));\n//# sourceMappingURL=Appsflyer_constants.js.map","class AppsFlyerConsentClass {\n constructor(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n this.isUserSubjectToGDPR = isUserSubjectToGDPR;\n this.hasConsentForDataUsage = hasConsentForDataUsage;\n this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization;\n }\n static forGDPRUser(hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n return new AppsFlyerConsentClass(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);\n }\n static forNonGDPRUser() {\n return new AppsFlyerConsentClass(false);\n }\n}\nexport const AppsFlyerConsent = {\n forGDPRUser: AppsFlyerConsentClass.forGDPRUser,\n forNonGDPRUser: AppsFlyerConsentClass.forNonGDPRUser\n};\n//# sourceMappingURL=appsflyer_interfaces.js.map","import { registerPlugin } from '@capacitor/core';\nconst AppsFlyer = registerPlugin('AppsFlyerPlugin', {});\nexport * from './definitions';\nexport * from './Appsflyer_constants';\nexport * from './appsflyer_interfaces';\nexport { AppsFlyer };\n//# sourceMappingURL=index.js.map"],"names":["AFConstants","MediationNetwork","registerPlugin"],"mappings":";;;;;;AAAWA,6BAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;AACvE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AACjE,IAAI,WAAW,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;AAC/D,IAAI,WAAW,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AACnD,IAAI,WAAW,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AACjD,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3BC,kCAAiB;AAC5B,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAClD,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;AACrD,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;AACrD,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACxC,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AAC9C,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAC1C,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACxC,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AAC9C,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAC1C,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAClD,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACxC,IAAI,gBAAgB,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;AAC/C,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,iBAAiB,CAAC;AAC7D,IAAI,gBAAgB,CAAC,6BAA6B,CAAC,GAAG,2BAA2B,CAAC;AAClF,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;AC1B/C,MAAM,qBAAqB,CAAC;AAC5B,IAAI,WAAW,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,+BAA+B,EAAE;AAC9F,QAAQ,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AACvD,QAAQ,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AAC7D,QAAQ,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;AAC/E,KAAK;AACL,IAAI,OAAO,WAAW,CAAC,sBAAsB,EAAE,+BAA+B,EAAE;AAChF,QAAQ,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,+BAA+B,CAAC,CAAC;AACxG,KAAK;AACL,IAAI,OAAO,cAAc,GAAG;AAC5B,QAAQ,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAChD,KAAK;AACL,CAAC;AACW,MAAC,gBAAgB,GAAG;AAChC,IAAI,WAAW,EAAE,qBAAqB,CAAC,WAAW;AAClD,IAAI,cAAc,EAAE,qBAAqB,CAAC,cAAc;AACxD;;ACfK,MAAC,SAAS,GAAGC,mBAAc,CAAC,iBAAiB,EAAE,EAAE;;;;;"}
package/dist/plugin.js CHANGED
@@ -11,6 +11,23 @@ var AppsFlyerCapacitorPlugin = (function (exports, core) {
11
11
  AFConstants["OAOA_CALLBACK"] = "oaoa_callback";
12
12
  AFConstants["UDL_CALLBACK"] = "udl_callback";
13
13
  })(exports.AFConstants || (exports.AFConstants = {}));
14
+ exports.MediationNetwork = void 0;
15
+ (function (MediationNetwork) {
16
+ MediationNetwork["IRONSOURCE"] = "ironsource";
17
+ MediationNetwork["APPLOVIN_MAX"] = "applovinmax";
18
+ MediationNetwork["GOOGLE_ADMOB"] = "googleadmob";
19
+ MediationNetwork["FYBER"] = "fyber";
20
+ MediationNetwork["APPODEAL"] = "appodeal";
21
+ MediationNetwork["ADMOST"] = "Admost";
22
+ MediationNetwork["TOPON"] = "Topon";
23
+ MediationNetwork["TRADPLUS"] = "Tradplus";
24
+ MediationNetwork["YANDEX"] = "Yandex";
25
+ MediationNetwork["CHARTBOOST"] = "chartboost";
26
+ MediationNetwork["UNITY"] = "Unity";
27
+ MediationNetwork["TOPON_PTE"] = "toponpte";
28
+ MediationNetwork["CUSTOM_MEDIATION"] = "customMediation";
29
+ MediationNetwork["DIRECT_MONETIZATION_NETWORK"] = "directMonetizationNetwork";
30
+ })(exports.MediationNetwork || (exports.MediationNetwork = {}));
14
31
 
15
32
  class AppsFlyerConsentClass {
16
33
  constructor(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization) {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/Appsflyer_constants.js","esm/appsflyer_interfaces.js","esm/index.js"],"sourcesContent":["export var AFConstants;\n(function (AFConstants) {\n AFConstants[\"onConversionDataSuccess\"] = \"onConversionDataSuccess\";\n AFConstants[\"onConversionDataFail\"] = \"onConversionDataFail\";\n AFConstants[\"onAppOpenAttribution\"] = \"onAppOpenAttribution\";\n AFConstants[\"onAttributionFailure\"] = \"onAttributionFailure\";\n AFConstants[\"CONVERSION_CALLBACK\"] = \"conversion_callback\";\n AFConstants[\"OAOA_CALLBACK\"] = \"oaoa_callback\";\n AFConstants[\"UDL_CALLBACK\"] = \"udl_callback\";\n})(AFConstants || (AFConstants = {}));\n//# sourceMappingURL=Appsflyer_constants.js.map","class AppsFlyerConsentClass {\n constructor(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n this.isUserSubjectToGDPR = isUserSubjectToGDPR;\n this.hasConsentForDataUsage = hasConsentForDataUsage;\n this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization;\n }\n static forGDPRUser(hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n return new AppsFlyerConsentClass(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);\n }\n static forNonGDPRUser() {\n return new AppsFlyerConsentClass(false);\n }\n}\nexport const AppsFlyerConsent = {\n forGDPRUser: AppsFlyerConsentClass.forGDPRUser,\n forNonGDPRUser: AppsFlyerConsentClass.forNonGDPRUser\n};\n//# sourceMappingURL=appsflyer_interfaces.js.map","import { registerPlugin } from '@capacitor/core';\nconst AppsFlyer = registerPlugin('AppsFlyerPlugin', {});\nexport * from './definitions';\nexport * from './Appsflyer_constants';\nexport * from './appsflyer_interfaces';\nexport { AppsFlyer };\n//# sourceMappingURL=index.js.map"],"names":["AFConstants","registerPlugin"],"mappings":";;;AAAWA,iCAAY;IACvB,CAAC,UAAU,WAAW,EAAE;IACxB,IAAI,WAAW,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;IACvE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IACjE,IAAI,WAAW,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;IAC/D,IAAI,WAAW,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;IACnD,IAAI,WAAW,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;IACjD,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ICTrC,MAAM,qBAAqB,CAAC;IAC5B,IAAI,WAAW,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,+BAA+B,EAAE;IAC9F,QAAQ,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACvD,QAAQ,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IAC7D,QAAQ,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;IAC/E,KAAK;IACL,IAAI,OAAO,WAAW,CAAC,sBAAsB,EAAE,+BAA+B,EAAE;IAChF,QAAQ,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,+BAA+B,CAAC,CAAC;IACxG,KAAK;IACL,IAAI,OAAO,cAAc,GAAG;IAC5B,QAAQ,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,KAAK;IACL,CAAC;AACW,UAAC,gBAAgB,GAAG;IAChC,IAAI,WAAW,EAAE,qBAAqB,CAAC,WAAW;IAClD,IAAI,cAAc,EAAE,qBAAqB,CAAC,cAAc;IACxD;;ACfK,UAAC,SAAS,GAAGC,mBAAc,CAAC,iBAAiB,EAAE,EAAE;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/Appsflyer_constants.js","esm/appsflyer_interfaces.js","esm/index.js"],"sourcesContent":["export var AFConstants;\n(function (AFConstants) {\n AFConstants[\"onConversionDataSuccess\"] = \"onConversionDataSuccess\";\n AFConstants[\"onConversionDataFail\"] = \"onConversionDataFail\";\n AFConstants[\"onAppOpenAttribution\"] = \"onAppOpenAttribution\";\n AFConstants[\"onAttributionFailure\"] = \"onAttributionFailure\";\n AFConstants[\"CONVERSION_CALLBACK\"] = \"conversion_callback\";\n AFConstants[\"OAOA_CALLBACK\"] = \"oaoa_callback\";\n AFConstants[\"UDL_CALLBACK\"] = \"udl_callback\";\n})(AFConstants || (AFConstants = {}));\nexport var MediationNetwork;\n(function (MediationNetwork) {\n MediationNetwork[\"IRONSOURCE\"] = \"ironsource\";\n MediationNetwork[\"APPLOVIN_MAX\"] = \"applovinmax\";\n MediationNetwork[\"GOOGLE_ADMOB\"] = \"googleadmob\";\n MediationNetwork[\"FYBER\"] = \"fyber\";\n MediationNetwork[\"APPODEAL\"] = \"appodeal\";\n MediationNetwork[\"ADMOST\"] = \"Admost\";\n MediationNetwork[\"TOPON\"] = \"Topon\";\n MediationNetwork[\"TRADPLUS\"] = \"Tradplus\";\n MediationNetwork[\"YANDEX\"] = \"Yandex\";\n MediationNetwork[\"CHARTBOOST\"] = \"chartboost\";\n MediationNetwork[\"UNITY\"] = \"Unity\";\n MediationNetwork[\"TOPON_PTE\"] = \"toponpte\";\n MediationNetwork[\"CUSTOM_MEDIATION\"] = \"customMediation\";\n MediationNetwork[\"DIRECT_MONETIZATION_NETWORK\"] = \"directMonetizationNetwork\";\n})(MediationNetwork || (MediationNetwork = {}));\n//# sourceMappingURL=Appsflyer_constants.js.map","class AppsFlyerConsentClass {\n constructor(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n this.isUserSubjectToGDPR = isUserSubjectToGDPR;\n this.hasConsentForDataUsage = hasConsentForDataUsage;\n this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization;\n }\n static forGDPRUser(hasConsentForDataUsage, hasConsentForAdsPersonalization) {\n return new AppsFlyerConsentClass(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);\n }\n static forNonGDPRUser() {\n return new AppsFlyerConsentClass(false);\n }\n}\nexport const AppsFlyerConsent = {\n forGDPRUser: AppsFlyerConsentClass.forGDPRUser,\n forNonGDPRUser: AppsFlyerConsentClass.forNonGDPRUser\n};\n//# sourceMappingURL=appsflyer_interfaces.js.map","import { registerPlugin } from '@capacitor/core';\nconst AppsFlyer = registerPlugin('AppsFlyerPlugin', {});\nexport * from './definitions';\nexport * from './Appsflyer_constants';\nexport * from './appsflyer_interfaces';\nexport { AppsFlyer };\n//# sourceMappingURL=index.js.map"],"names":["AFConstants","MediationNetwork","registerPlugin"],"mappings":";;;AAAWA,iCAAY;IACvB,CAAC,UAAU,WAAW,EAAE;IACxB,IAAI,WAAW,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;IACvE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IACjE,IAAI,WAAW,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IACjE,IAAI,WAAW,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;IAC/D,IAAI,WAAW,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;IACnD,IAAI,WAAW,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;IACjD,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3BC,sCAAiB;IAC5B,CAAC,UAAU,gBAAgB,EAAE;IAC7B,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IAClD,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;IACrD,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;IACrD,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxC,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC9C,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IAC1C,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxC,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC9C,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IAC1C,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IAClD,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxC,IAAI,gBAAgB,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;IAC/C,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,iBAAiB,CAAC;IAC7D,IAAI,gBAAgB,CAAC,6BAA6B,CAAC,GAAG,2BAA2B,CAAC;IAClF,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;IC1B/C,MAAM,qBAAqB,CAAC;IAC5B,IAAI,WAAW,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,+BAA+B,EAAE;IAC9F,QAAQ,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACvD,QAAQ,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IAC7D,QAAQ,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;IAC/E,KAAK;IACL,IAAI,OAAO,WAAW,CAAC,sBAAsB,EAAE,+BAA+B,EAAE;IAChF,QAAQ,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,+BAA+B,CAAC,CAAC;IACxG,KAAK;IACL,IAAI,OAAO,cAAc,GAAG;IAC5B,QAAQ,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,KAAK;IACL,CAAC;AACW,UAAC,gBAAgB,GAAG;IAChC,IAAI,WAAW,EAAE,qBAAqB,CAAC,WAAW;IAClD,IAAI,cAAc,EAAE,qBAAqB,CAAC,cAAc;IACxD;;ACfK,UAAC,SAAS,GAAGC,mBAAc,CAAC,iBAAiB,EAAE,EAAE;;;;;;;;;;;;;"}
@@ -73,4 +73,8 @@ class AppsFlyerConstants {
73
73
  static let AF_IS_SUBJECTED_TO_DGPR = "isUserSubjectToGDPR"
74
74
  static let AF_CONSENT_FOR_DATA_USAGE = "hasConsentForDataUsage"
75
75
  static let AF_CONSENT_FOR_ADS_PERSONALIZATION = "hasConsentForAdsPersonalization"
76
+ static let AF_MONETIZATION_NETWORK = "monetizationNetwork"
77
+ static let AF_CURRENCY_ISO4217_CODE = "currencyIso4217Code"
78
+ static let AF_REVENUE = "revenue"
79
+ static let AF_MEDIATION_NETWORK = "mediationNetwork"
76
80
  }
@@ -41,7 +41,7 @@ CAP_PLUGIN(AppsFlyerPlugin, "AppsFlyerPlugin",
41
41
  CAP_PLUGIN_METHOD(enableTCFDataCollection, CAPPluginReturnNone);
42
42
  CAP_PLUGIN_METHOD(setConsentData, CAPPluginReturnNone);
43
43
  CAP_PLUGIN_METHOD(startSDK, CAPPluginReturnPromise);
44
-
44
+ CAP_PLUGIN_METHOD(logAdRevenue, CAPPluginReturnNone);
45
45
 
46
46
 
47
47
 
@@ -5,7 +5,7 @@ import AppsFlyerLib
5
5
 
6
6
  @objc(AppsFlyerPlugin)
7
7
  public class AppsFlyerPlugin: CAPPlugin {
8
- private let APPSFLYER_PLUGIN_VERSION = "6.14.3-rc1"
8
+ private let APPSFLYER_PLUGIN_VERSION = "6.15.0-rc1"
9
9
  private var conversion = true
10
10
  private var oaoa = true
11
11
  private var udl = false
@@ -70,14 +70,14 @@ public class AppsFlyerPlugin: CAPPlugin {
70
70
  appsflyer.waitForATTUserAuthorization(timeoutInterval: Double(attInterval!))
71
71
  }
72
72
  #endif
73
-
73
+
74
74
  if !manualStart {
75
75
  startSDK(call)
76
76
  } else {
77
77
  call.resolve(["res": "SDK initiated successfully. SDK has NOT started yet"])
78
78
  }
79
79
  }
80
-
80
+
81
81
  @objc func startSDK(_ call: CAPPluginCall) {
82
82
 
83
83
  NotificationCenter.default.addObserver(self, selector: #selector(sendLaunch), name: UIApplication.didBecomeActiveNotification, object: nil)
@@ -108,13 +108,96 @@ public class AppsFlyerPlugin: CAPPlugin {
108
108
  }
109
109
  }
110
110
 
111
- @objc func setCustomerUserId(_ call: CAPPluginCall){
111
+ @objc func setCustomerUserId(_ call: CAPPluginCall) {
112
112
  guard let cuid = call.getString(AppsFlyerConstants.AF_CUID) else {
113
113
  call.reject("Invalid Customer User ID")
114
114
  return
115
115
  }
116
116
  AppsFlyerLib.shared().customerUserID = cuid
117
+ }
118
+
119
+
120
+ @objc func logAdRevenue(_ call: CAPPluginCall) {
121
+ let adRevenueData = call.jsObjectRepresentation
122
+ if adRevenueData.isEmpty {
123
+ call.reject("adRevenueData is missing, the data mandatory to use this API.")
124
+ return
125
+ }
126
+
127
+ // Parse the fields from the adRevenueData object
128
+ guard let myMonetizationNetwork = adRevenueData[AppsFlyerConstants.AF_MONETIZATION_NETWORK] as? String else {
129
+ call.reject("monetizationNetwork is missing")
130
+ return
131
+ }
132
+ guard let myCurrencyIso4217Code = adRevenueData[AppsFlyerConstants.AF_CURRENCY_ISO4217_CODE] as? String else {
133
+ call.reject("currencyIso4217Code is missing")
134
+ return
135
+ }
136
+ guard let revenue = adRevenueData[AppsFlyerConstants.AF_REVENUE] as? NSNumber else {
137
+ call.reject("revenue is missing or not a number")
138
+ return
139
+ }
140
+ guard let mediationNetworkString = adRevenueData[AppsFlyerConstants.AF_MEDIATION_NETWORK] as? String else {
141
+ call.reject("mediationNetwork is missing")
142
+ return
143
+ }
144
+
145
+ let additionalParams = adRevenueData[AppsFlyerConstants.AF_ADDITIONAL_PARAMETERS] as? [String: Any]
146
+
147
+ // Handle the mediation network mapping to AppsFlyer SDK enum
148
+ guard let myMediationNetwork = MediationNetworkType(rawValue: mediationNetworkString) else {
149
+ call.reject("Invalid mediation network")
150
+ return
151
+ }
152
+
153
+ // Create the AFAdRevenueData instance
154
+ let myAdRevenueData = AFAdRevenueData(
155
+ monetizationNetwork: myMonetizationNetwork,
156
+ mediationNetwork: myMediationNetwork,
157
+ currencyIso4217Code: myCurrencyIso4217Code,
158
+ eventRevenue: revenue
159
+ )
160
+
161
+ // Log the ad revenue to the AppsFlyer SDK
162
+ AppsFlyerLib.shared().logAdRevenue(myAdRevenueData, additionalParameters: additionalParams)
117
163
 
164
+ call.resolve()
165
+ }
166
+
167
+ // Helper function to map mediation network string to the AppsFlyer enum
168
+ private func MediationNetworkType(rawValue: String) -> MediationNetworkType? {
169
+ switch rawValue {
170
+ case "googleadmob":
171
+ return .googleAdMob
172
+ case "fyber":
173
+ return .fyber
174
+ case "ironsource":
175
+ return .ironSource
176
+ case "applovinmax":
177
+ return .applovinMax
178
+ case "appodeal":
179
+ return .appodeal
180
+ case "Admost":
181
+ return .admost
182
+ case "Topon":
183
+ return .topon
184
+ case "Tradplus":
185
+ return .tradplus
186
+ case "Yandex":
187
+ return .yandex
188
+ case "chartboost":
189
+ return .chartBoost
190
+ case "Unity":
191
+ return .unity
192
+ case "toponpte":
193
+ return .toponPte
194
+ case "customMediation":
195
+ return .custom
196
+ case "directMonetizationNetwork":
197
+ return .directMonetization
198
+ default:
199
+ return nil
200
+ }
118
201
  }
119
202
 
120
203
  @objc func setCurrencyCode(_ call: CAPPluginCall){
@@ -248,7 +331,7 @@ public class AppsFlyerPlugin: CAPPlugin {
248
331
  @objc func setDisableNetworkData(_ call: CAPPluginCall){
249
332
  call.unavailable("Android only method - has no effact on iOS apps")
250
333
  }
251
-
334
+
252
335
  @objc func enableTCFDataCollection(_ call: CAPPluginCall){
253
336
  guard let shouldEnableTCFDataCollection = call.getBool(AppsFlyerConstants.AF_ENABLE_TCF_DATA_COLLECTION) else {
254
337
  call.reject("Missing boolean value shouldEnableTCFDataCollection")
@@ -256,26 +339,26 @@ public class AppsFlyerPlugin: CAPPlugin {
256
339
  }
257
340
  AppsFlyerLib.shared().enableTCFDataCollection(shouldEnableTCFDataCollection)
258
341
  }
259
-
342
+
260
343
  @objc func setConsentData(_ call: CAPPluginCall) {
261
344
  guard let consentData = call.getObject("data") else {
262
345
  call.reject("Consent data is missing")
263
346
  return
264
- }
347
+ }
265
348
 
266
349
  let isUserSubjectToGDPR = consentData[AppsFlyerConstants.AF_IS_SUBJECTED_TO_DGPR] as? Bool ?? false
267
350
  let hasConsentForDataUsage = consentData[AppsFlyerConstants.AF_CONSENT_FOR_DATA_USAGE] as? Bool ?? false
268
351
  let hasConsentForAdsPersonalization = consentData[AppsFlyerConstants.AF_CONSENT_FOR_ADS_PERSONALIZATION] as? Bool ?? false
269
-
352
+
270
353
  let consentObject: AppsFlyerConsent
271
354
  if isUserSubjectToGDPR {
272
355
  consentObject = AppsFlyerConsent(forGDPRUserWithHasConsentForDataUsage: hasConsentForDataUsage, hasConsentForAdsPersonalization: hasConsentForAdsPersonalization)
273
356
  } else {
274
357
  consentObject = AppsFlyerConsent(nonGDPRUser: ())
275
358
  }
276
-
359
+
277
360
  AppsFlyerLib.shared().setConsentData(consentObject)
278
-
361
+
279
362
  call.resolve()
280
363
  }
281
364
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "appsflyer-capacitor-plugin",
3
- "version": "6.14.3-rc1",
4
- "iosSdkVersion": "6.14.3",
5
- "androidSdkVersion": "6.14.0",
6
- "buildNumber": "87",
3
+ "version": "6.15.0-rc1",
4
+ "iosSdkVersion": "6.15.0",
5
+ "androidSdkVersion": "6.15.0",
6
+ "buildNumber": "94",
7
7
  "description": "AppsFlyer SDK plugin for Capacitor",
8
8
  "main": "dist/plugin.cjs.js",
9
9
  "module": "dist/esm/index.js",
@@ -21,7 +21,7 @@
21
21
  "rollup.config.js",
22
22
  "AppsflyerCapacitorPlugin.podspec"
23
23
  ],
24
- "author": "Paz Lavi",
24
+ "author": "Dani Koza",
25
25
  "license": "MIT",
26
26
  "repository": {
27
27
  "type": "git",
@@ -54,14 +54,15 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@angular/cli": "^12.1.1",
57
- "@capacitor/android": "^5.0.0",
58
- "@capacitor/core": "^5.0.0",
57
+ "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
58
+ "@capacitor/android": "^6.0.0",
59
+ "@capacitor/core": "^6.0.0",
59
60
  "@capacitor/docgen": "^0.2.0",
60
- "@capacitor/ios": "^5.0.0",
61
- "@ionic/eslint-config": "^0.3.0",
61
+ "@capacitor/ios": "^6.0.0",
62
+ "@ionic/eslint-config": "^0.4.0",
62
63
  "@ionic/prettier-config": "^1.0.1",
63
64
  "@ionic/swiftlint-config": "^1.1.2",
64
- "eslint": "^7.11.0",
65
+ "eslint": "^8.57.0",
65
66
  "prettier": "~2.2.0",
66
67
  "prettier-plugin-java": "~1.0.0",
67
68
  "rimraf": "^3.0.2",
@@ -70,7 +71,7 @@
70
71
  "typescript": "~4.0.3"
71
72
  },
72
73
  "peerDependencies": {
73
- "@capacitor/core": "^5.0.0"
74
+ "@capacitor/core": "^6.0.0"
74
75
  },
75
76
  "prettier": "@ionic/prettier-config",
76
77
  "swiftlint": "@ionic/swiftlint-config",
@@ -8,3 +8,20 @@ export enum AFConstants {
8
8
  UDL_CALLBACK = 'udl_callback',
9
9
  }
10
10
 
11
+
12
+ export enum MediationNetwork {
13
+ IRONSOURCE = "ironsource",
14
+ APPLOVIN_MAX = "applovinmax",
15
+ GOOGLE_ADMOB = "googleadmob",
16
+ FYBER = "fyber",
17
+ APPODEAL = "appodeal",
18
+ ADMOST = "Admost",
19
+ TOPON = "Topon",
20
+ TRADPLUS = "Tradplus",
21
+ YANDEX = "Yandex",
22
+ CHARTBOOST = "chartboost",
23
+ UNITY = "Unity",
24
+ TOPON_PTE = "toponpte",
25
+ CUSTOM_MEDIATION = "customMediation",
26
+ DIRECT_MONETIZATION_NETWORK = "directMonetizationNetwork",
27
+ }
@@ -1,3 +1,5 @@
1
+ import type {MediationNetwork} from "./Appsflyer_constants";
2
+
1
3
  export interface AFInit{
2
4
  devKey: string;
3
5
  appID: string;
@@ -148,3 +150,11 @@ export const AppsFlyerConsent = {
148
150
  export interface AFConsentData {
149
151
  data: IAppsFlyerConsent
150
152
  }
153
+
154
+ export interface AFAdRevenueData {
155
+ monetizationNetwork: string;
156
+ mediationNetwork: MediationNetwork;
157
+ currencyIso4217Code: string;
158
+ revenue: number;
159
+ additionalParameters?: StringMap;
160
+ }
@@ -38,7 +38,8 @@ import type {
38
38
  AFPartnerData,
39
39
  AFLogInvite,
40
40
  AFEnableTCFDataCollection,
41
- AFConsentData
41
+ AFConsentData,
42
+ AFAdRevenueData
42
43
 
43
44
  } from "./appsflyer_interfaces";
44
45
 
@@ -262,11 +263,18 @@ export interface AppsFlyerPlugin {
262
263
  enableTCFDataCollection(shouldEnableTCFDataCollection: AFEnableTCFDataCollection): Promise<void>
263
264
 
264
265
  /**
265
- * Use to set user consent data manualy.
266
+ * Use to set user consent data manualy.
266
267
  * if your app doesn't use a CMP compatible with TCF v2.2, use the following method to manualy provide the consent data directly to the SDK.
267
268
  * @param data: AppsFlyerConsent object.
268
269
  */
269
270
  setConsentData(data : AFConsentData): Promise<void>
271
+
272
+ /**
273
+ * By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI.
274
+ * Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app.
275
+ * You can use this method to log your ad revenue.
276
+ * @param adRevenueData: object used to hold all mandatory parameters of AdRevenue event.
277
+ */
278
+ logAdRevenue(data: AFAdRevenueData): Promise<void>
270
279
 
271
280
  }
272
-