appsflyer-capacitor-plugin 6.17.7 → 6.17.8-rc2

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
@@ -13,8 +13,8 @@ To do so, please follow [this article](https://support.appsflyer.com/hc/en-us/ar
13
13
 
14
14
  ### <a id="plugin-build-for"> This plugin is built for:
15
15
 
16
- <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/android/android.png" width="18" height="18"> Android AppsFlyer SDK **6.17.3**</br>
17
- <img src="https://icon.icepanel.io/Technology/svg/Apple.svg" width="18" height="18"> iOS AppsFlyer SDK **6.17.7**</br>
16
+ <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/android/android.png" width="18" height="18"> Android AppsFlyer SDK **6.17.5**</br>
17
+ <img src="https://icon.icepanel.io/Technology/svg/Apple.svg" width="18" height="18"> iOS AppsFlyer SDK **6.17.8**</br>
18
18
  <img src="https://icon.icepanel.io/Technology/svg/Capacitor.svg" width="18" height="18"> Capacitor 7</br>
19
19
 
20
20
  ## <a id="breaking-changes-6-17-0"> ❗❗ Breaking changes when updating to v6.17.0 ❗❗
@@ -399,6 +399,7 @@ class AppsFlyerPlugin : Plugin() {
399
399
  linkGenerator.generateLink(context, listener)
400
400
  }
401
401
 
402
+ @Deprecated("Use validateAndLogInAppPurchaseV2 instead")
402
403
  @PluginMethod
403
404
  fun validateAndLogInAppPurchaseAndroid(call: PluginCall) {
404
405
  val currency = call.getString(AF_CURRENCY)
@@ -439,6 +440,7 @@ class AppsFlyerPlugin : Plugin() {
439
440
  }
440
441
  }
441
442
 
443
+ @Deprecated("Use validateAndLogInAppPurchaseV2 instead")
442
444
  @PluginMethod
443
445
  fun validateAndLogInAppPurchaseIos(call: PluginCall) {
444
446
  call.unavailable()
@@ -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, AFAdRevenueData, AFConsentOptions, AFIsStarted } 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, AFPurchaseDetailsV2, AFEnableTCFDataCollection, AFConsentData, AFAdRevenueData, AFConsentOptions, AFIsStarted } 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;
@@ -110,8 +110,12 @@ export interface AppsFlyerPlugin {
110
110
  generateInviteLink(params: AFLinkGenerator): Promise<AFLink>;
111
111
  /**
112
112
  * API for server verification of in-app purchases. An af_purchase event with the relevant values will be automatically logged if the validation is successful.
113
+ * @deprecated deprecated since 6.17.7.
113
114
  */
114
115
  validateAndLogInAppPurchaseAndroid(purchaseData: AFAndroidInAppPurchase): Promise<AFRes>;
116
+ /**
117
+ * @deprecated deprecated since 6.17.7.
118
+ */
115
119
  validateAndLogInAppPurchaseIos(purchaseData: AFIosInAppPurchase): Promise<AFRes>;
116
120
  /**
117
121
  * Get the AppsFlyer SDK version used in app.
@@ -202,4 +206,14 @@ export interface AppsFlyerPlugin {
202
206
  * Android only.
203
207
  */
204
208
  disableAppSetId(): Promise<void>;
209
+ /**
210
+ * API for server verification of in-app purchases V2.
211
+ * An af_purchase event with the relevant values will be automatically logged if the validation is successful.
212
+ *
213
+ * @param data - Object containing purchaseDetails and optional additionalParameters
214
+ * @returns Promise that resolves with validation result
215
+ */
216
+ validateAndLogInAppPurchaseV2(data: AFPurchaseDetailsV2): Promise<{
217
+ [key: string]: any;
218
+ }>;
205
219
  }
@@ -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.17.7"
8
+ private let APPSFLYER_PLUGIN_VERSION = "6.17.8-rc2"
9
9
  private var conversion = true
10
10
  private var oaoa = true
11
11
  private var udl = false
@@ -557,10 +557,12 @@ public class AppsFlyerPlugin: CAPPlugin {
557
557
  )
558
558
 
559
559
  }
560
+ @available(*, deprecated, message: "Use validateAndLogInAppPurchaseV2 instead")
560
561
  @objc func validateAndLogInAppPurchaseAndroid(_ call: CAPPluginCall){
561
562
  call.unavailable()
562
563
  }
563
564
 
565
+ @available(*, deprecated, message: "Use validateAndLogInAppPurchaseV2 instead")
564
566
  @objc func validateAndLogInAppPurchaseIos(_ call: CAPPluginCall){
565
567
  let currency = call.getString(AppsFlyerConstants.AF_CURRENCY)
566
568
  let price = call.getString(AppsFlyerConstants.AF_PRICE)
@@ -809,8 +811,9 @@ public class AppsFlyerPlugin: CAPPlugin {
809
811
  if let nsError = error as NSError? {
810
812
  errorDict["error"] = nsError.localizedDescription
811
813
  errorDict["code"] = nsError.code
812
- errorDict["userInfo"] = nsError.userInfo
813
- errorDict["domain"] = nsError.domain // optional, often useful
814
+ errorDict["domain"] = nsError.domain
815
+ // Convert userInfo to JSON-safe values (userInfo may contain non-serializable objects like NSError)
816
+ errorDict["userInfo"] = nsError.userInfo.jsonSafeRepresentation()
814
817
  }
815
818
  call.reject("Validation failed", errorDict.jsonStringRepresentation ?? "")
816
819
  }
@@ -42,6 +42,35 @@ extension Dictionary {
42
42
  }
43
43
  }
44
44
 
45
+ extension Dictionary where Key == String, Value == Any {
46
+ /// Converts dictionary values to JSON-safe types.
47
+ /// Non-serializable objects (like NSError) are converted to their string description.
48
+ func jsonSafeRepresentation() -> [String: Any] {
49
+ var result: [String: Any] = [:]
50
+ for (key, value) in self {
51
+ if let dict = value as? [String: Any] {
52
+ result[key] = dict.jsonSafeRepresentation()
53
+ } else if let array = value as? [Any] {
54
+ result[key] = array.map { item -> Any in
55
+ if let dict = item as? [String: Any] {
56
+ return dict.jsonSafeRepresentation()
57
+ } else if JSONSerialization.isValidJSONObject([item]) {
58
+ return item
59
+ } else {
60
+ return "\(item)"
61
+ }
62
+ }
63
+ } else if JSONSerialization.isValidJSONObject([value]) {
64
+ result[key] = value
65
+ } else {
66
+ // Convert non-serializable objects (NSError, etc.) to string
67
+ result[key] = "\(value)"
68
+ }
69
+ }
70
+ return result
71
+ }
72
+ }
73
+
45
74
  extension Notification.Name{
46
75
  public static let appsflyerBridge = Notification.Name(AppsFlyerConstants.AF_BRIDGE_SET)
47
76
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "appsflyer-capacitor-plugin",
3
- "version": "6.17.7",
4
- "iosSdkVersion": "6.17.7",
5
- "androidSdkVersion": "6.17.3",
6
- "buildNumber": "28",
3
+ "version": "6.17.8-rc2",
4
+ "iosSdkVersion": "6.17.8",
5
+ "androidSdkVersion": "6.17.5",
6
+ "buildNumber": "125",
7
7
  "description": "AppsFlyer SDK plugin for Capacitor",
8
8
  "main": "dist/plugin.cjs.js",
9
9
  "module": "dist/esm/index.js",
@@ -37,6 +37,7 @@ import type {
37
37
  AFPhone,
38
38
  AFPartnerData,
39
39
  AFLogInvite,
40
+ AFPurchaseDetailsV2,
40
41
  AFEnableTCFDataCollection,
41
42
  AFConsentData,
42
43
  AFAdRevenueData,
@@ -191,9 +192,13 @@ export interface AppsFlyerPlugin {
191
192
 
192
193
  /**
193
194
  * API for server verification of in-app purchases. An af_purchase event with the relevant values will be automatically logged if the validation is successful.
195
+ * @deprecated deprecated since 6.17.7.
194
196
  */
195
197
  validateAndLogInAppPurchaseAndroid(purchaseData: AFAndroidInAppPurchase): Promise<AFRes>;
196
198
 
199
+ /**
200
+ * @deprecated deprecated since 6.17.7.
201
+ */
197
202
  validateAndLogInAppPurchaseIos(purchaseData: AFIosInAppPurchase): Promise<AFRes>;
198
203
 
199
204
  /**
@@ -303,16 +308,12 @@ export interface AppsFlyerPlugin {
303
308
  */
304
309
  disableAppSetId(): Promise<void>
305
310
 
306
- // TODO: Uncomment this once the API is stable
307
- // /**
308
- // * API for server verification of in-app purchases V2 (Beta).
309
- // * An af_purchase event with the relevant values will be automatically logged if the validation is successful.
310
- // *
311
- // * @param data - Object containing purchaseDetails and optional additionalParameters
312
- // * @returns Promise that resolves with validation result
313
- // *
314
- // * ⚠️ **BETA Feature**: This API is currently in beta. While it's stable and recommended for new implementations,
315
- // * please test thoroughly in your environment before production use.
316
- // */
317
- // validateAndLogInAppPurchaseV2(data: AFPurchaseDetailsV2): Promise<{ [key: string]: any }>;
311
+ /**
312
+ * API for server verification of in-app purchases V2.
313
+ * An af_purchase event with the relevant values will be automatically logged if the validation is successful.
314
+ *
315
+ * @param data - Object containing purchaseDetails and optional additionalParameters
316
+ * @returns Promise that resolves with validation result
317
+ */
318
+ validateAndLogInAppPurchaseV2(data: AFPurchaseDetailsV2): Promise<{ [key: string]: any }>;
318
319
  }