affise-attribution-lib 1.6.34 → 1.6.36

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.
Files changed (185) hide show
  1. package/README.md +66 -13
  2. package/affise-attribution-native.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/lib/commonjs/Export.js +4 -4
  5. package/lib/commonjs/debug/AffiseDebug.js +49 -0
  6. package/lib/commonjs/debug/AffiseDebug.js.map +1 -0
  7. package/lib/commonjs/debug/AffiseDebugApi.js +6 -0
  8. package/lib/commonjs/debug/AffiseDebugApi.js.map +1 -0
  9. package/lib/commonjs/debug/internal.js +28 -0
  10. package/lib/commonjs/debug/internal.js.map +1 -0
  11. package/lib/commonjs/index.js +14 -138
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/module/AffiseHasModule.js +14 -0
  14. package/lib/commonjs/module/AffiseHasModule.js.map +1 -0
  15. package/lib/commonjs/module/AffiseModules.js +2 -0
  16. package/lib/commonjs/module/AffiseModules.js.map +1 -1
  17. package/lib/commonjs/module/appsflyer/AffiseAppsFlyer.js +31 -0
  18. package/lib/commonjs/module/appsflyer/AffiseAppsFlyer.js.map +1 -0
  19. package/lib/commonjs/module/appsflyer/AffiseModuleAppsFlyerApi.js +6 -0
  20. package/lib/commonjs/module/appsflyer/AffiseModuleAppsFlyerApi.js.map +1 -0
  21. package/lib/commonjs/module/attribution/AffiseAndroid.js +30 -0
  22. package/lib/commonjs/module/attribution/AffiseAndroid.js.map +1 -0
  23. package/lib/commonjs/module/attribution/AffiseAndroidApi.js +2 -0
  24. package/lib/commonjs/module/attribution/AffiseAndroidApi.js.map +1 -0
  25. package/lib/commonjs/module/attribution/AffiseIos.js +50 -0
  26. package/lib/commonjs/module/attribution/AffiseIos.js.map +1 -0
  27. package/lib/commonjs/module/attribution/AffiseIosApi.js +6 -0
  28. package/lib/commonjs/module/attribution/AffiseIosApi.js.map +1 -0
  29. package/lib/commonjs/module/attribution/AffiseModule.js +81 -0
  30. package/lib/commonjs/module/attribution/AffiseModule.js.map +1 -0
  31. package/lib/commonjs/module/attribution/AffiseModuleApi.js +6 -0
  32. package/lib/commonjs/module/attribution/AffiseModuleApi.js.map +1 -0
  33. package/lib/commonjs/module/internal.js +72 -0
  34. package/lib/commonjs/module/internal.js.map +1 -0
  35. package/lib/commonjs/module/link/AffiseLink.js +31 -0
  36. package/lib/commonjs/module/link/AffiseLink.js.map +1 -0
  37. package/lib/commonjs/module/link/AffiseModuleLinkApi.js +6 -0
  38. package/lib/commonjs/module/link/AffiseModuleLinkApi.js.map +1 -0
  39. package/lib/commonjs/module/subscription/AffiseModuleSubscriptionApi.js +6 -0
  40. package/lib/commonjs/module/subscription/AffiseModuleSubscriptionApi.js.map +1 -0
  41. package/lib/commonjs/module/subscription/AffiseSubscription.js +41 -0
  42. package/lib/commonjs/module/subscription/AffiseSubscription.js.map +1 -0
  43. package/lib/commonjs/native/AffiseApiMethod.js +1 -0
  44. package/lib/commonjs/native/AffiseApiMethod.js.map +1 -1
  45. package/lib/commonjs/native/AffiseNative.js +9 -0
  46. package/lib/commonjs/native/AffiseNative.js.map +1 -1
  47. package/lib/commonjs/native/data/DataName.js +2 -0
  48. package/lib/commonjs/native/data/DataName.js.map +1 -1
  49. package/lib/commonjs/parameters/ProviderType.js +1 -0
  50. package/lib/commonjs/parameters/ProviderType.js.map +1 -1
  51. package/lib/commonjs/settings/AffiseSettings.js +6 -4
  52. package/lib/commonjs/settings/AffiseSettings.js.map +1 -1
  53. package/lib/commonjs/settings/AffiseSettingsApi.js +6 -0
  54. package/lib/commonjs/settings/AffiseSettingsApi.js.map +1 -0
  55. package/lib/module/Export.js +1 -1
  56. package/lib/module/Export.js.map +1 -1
  57. package/lib/module/debug/AffiseDebug.js +42 -0
  58. package/lib/module/debug/AffiseDebug.js.map +1 -0
  59. package/lib/module/debug/AffiseDebugApi.js +2 -0
  60. package/lib/module/debug/AffiseDebugApi.js.map +1 -0
  61. package/lib/module/debug/internal.js +3 -0
  62. package/lib/module/debug/internal.js.map +1 -0
  63. package/lib/module/index.js +14 -139
  64. package/lib/module/index.js.map +1 -1
  65. package/lib/module/module/AffiseHasModule.js +8 -0
  66. package/lib/module/module/AffiseHasModule.js.map +1 -0
  67. package/lib/module/module/AffiseModules.js +2 -0
  68. package/lib/module/module/AffiseModules.js.map +1 -1
  69. package/lib/module/module/appsflyer/AffiseAppsFlyer.js +24 -0
  70. package/lib/module/module/appsflyer/AffiseAppsFlyer.js.map +1 -0
  71. package/lib/module/module/appsflyer/AffiseModuleAppsFlyerApi.js +2 -0
  72. package/lib/module/module/appsflyer/AffiseModuleAppsFlyerApi.js.map +1 -0
  73. package/lib/module/module/attribution/AffiseAndroid.js +23 -0
  74. package/lib/module/module/attribution/AffiseAndroid.js.map +1 -0
  75. package/lib/module/module/attribution/AffiseAndroidApi.js +2 -0
  76. package/lib/module/module/attribution/AffiseAndroidApi.js.map +1 -0
  77. package/lib/module/module/attribution/AffiseIos.js +43 -0
  78. package/lib/module/module/attribution/AffiseIos.js.map +1 -0
  79. package/lib/module/module/attribution/AffiseIosApi.js +2 -0
  80. package/lib/module/module/attribution/AffiseIosApi.js.map +1 -0
  81. package/lib/module/module/attribution/AffiseModule.js +74 -0
  82. package/lib/module/module/attribution/AffiseModule.js.map +1 -0
  83. package/lib/module/module/attribution/AffiseModuleApi.js +2 -0
  84. package/lib/module/module/attribution/AffiseModuleApi.js.map +1 -0
  85. package/lib/module/module/internal.js +7 -0
  86. package/lib/module/module/internal.js.map +1 -0
  87. package/lib/module/module/link/AffiseLink.js +24 -0
  88. package/lib/module/module/link/AffiseLink.js.map +1 -0
  89. package/lib/module/module/link/AffiseModuleLinkApi.js +2 -0
  90. package/lib/module/module/link/AffiseModuleLinkApi.js.map +1 -0
  91. package/lib/module/module/subscription/AffiseModuleSubscriptionApi.js +2 -0
  92. package/lib/module/module/subscription/AffiseModuleSubscriptionApi.js.map +1 -0
  93. package/lib/module/module/subscription/AffiseSubscription.js +34 -0
  94. package/lib/module/module/subscription/AffiseSubscription.js.map +1 -0
  95. package/lib/module/native/AffiseApiMethod.js +1 -0
  96. package/lib/module/native/AffiseApiMethod.js.map +1 -1
  97. package/lib/module/native/AffiseNative.js +9 -0
  98. package/lib/module/native/AffiseNative.js.map +1 -1
  99. package/lib/module/native/data/DataName.js +2 -0
  100. package/lib/module/native/data/DataName.js.map +1 -1
  101. package/lib/module/parameters/ProviderType.js +1 -0
  102. package/lib/module/parameters/ProviderType.js.map +1 -1
  103. package/lib/module/settings/AffiseSettings.js +7 -5
  104. package/lib/module/settings/AffiseSettings.js.map +1 -1
  105. package/lib/module/settings/AffiseSettingsApi.js +2 -0
  106. package/lib/module/settings/AffiseSettingsApi.js.map +1 -0
  107. package/lib/typescript/Export.d.ts +1 -1
  108. package/lib/typescript/Export.d.ts.map +1 -1
  109. package/lib/typescript/debug/AffiseDebug.d.ts +29 -0
  110. package/lib/typescript/debug/AffiseDebug.d.ts.map +1 -0
  111. package/lib/typescript/debug/AffiseDebugApi.d.ts +25 -0
  112. package/lib/typescript/debug/AffiseDebugApi.d.ts.map +1 -0
  113. package/lib/typescript/debug/internal.d.ts +3 -0
  114. package/lib/typescript/debug/internal.d.ts.map +1 -0
  115. package/lib/typescript/index.d.ts +10 -93
  116. package/lib/typescript/index.d.ts.map +1 -1
  117. package/lib/typescript/module/AffiseHasModule.d.ts +7 -0
  118. package/lib/typescript/module/AffiseHasModule.d.ts.map +1 -0
  119. package/lib/typescript/module/AffiseModules.d.ts +2 -0
  120. package/lib/typescript/module/AffiseModules.d.ts.map +1 -1
  121. package/lib/typescript/module/appsflyer/AffiseAppsFlyer.d.ts +14 -0
  122. package/lib/typescript/module/appsflyer/AffiseAppsFlyer.d.ts.map +1 -0
  123. package/lib/typescript/module/appsflyer/AffiseModuleAppsFlyerApi.d.ts +10 -0
  124. package/lib/typescript/module/appsflyer/AffiseModuleAppsFlyerApi.d.ts.map +1 -0
  125. package/lib/typescript/module/attribution/AffiseAndroid.d.ts +12 -0
  126. package/lib/typescript/module/attribution/AffiseAndroid.d.ts.map +1 -0
  127. package/lib/typescript/module/attribution/AffiseAndroidApi.d.ts +8 -0
  128. package/lib/typescript/module/attribution/AffiseAndroidApi.d.ts.map +1 -0
  129. package/lib/typescript/module/attribution/AffiseIos.d.ts +29 -0
  130. package/lib/typescript/module/attribution/AffiseIos.d.ts.map +1 -0
  131. package/lib/typescript/module/attribution/AffiseIosApi.d.ts +25 -0
  132. package/lib/typescript/module/attribution/AffiseIosApi.d.ts.map +1 -0
  133. package/lib/typescript/module/attribution/AffiseModule.d.ts +58 -0
  134. package/lib/typescript/module/attribution/AffiseModule.d.ts.map +1 -0
  135. package/lib/typescript/module/attribution/AffiseModuleApi.d.ts +54 -0
  136. package/lib/typescript/module/attribution/AffiseModuleApi.d.ts.map +1 -0
  137. package/lib/typescript/module/internal.d.ts +7 -0
  138. package/lib/typescript/module/internal.d.ts.map +1 -0
  139. package/lib/typescript/module/link/AffiseLink.d.ts +15 -0
  140. package/lib/typescript/module/link/AffiseLink.d.ts.map +1 -0
  141. package/lib/typescript/module/link/AffiseModuleLinkApi.d.ts +11 -0
  142. package/lib/typescript/module/link/AffiseModuleLinkApi.d.ts.map +1 -0
  143. package/lib/typescript/module/subscription/AffiseModuleSubscriptionApi.d.ts +22 -0
  144. package/lib/typescript/module/subscription/AffiseModuleSubscriptionApi.d.ts.map +1 -0
  145. package/lib/typescript/module/subscription/AffiseSubscription.d.ts +26 -0
  146. package/lib/typescript/module/subscription/AffiseSubscription.d.ts.map +1 -0
  147. package/lib/typescript/native/AffiseApiMethod.d.ts +1 -0
  148. package/lib/typescript/native/AffiseApiMethod.d.ts.map +1 -1
  149. package/lib/typescript/native/AffiseNative.d.ts +1 -0
  150. package/lib/typescript/native/AffiseNative.d.ts.map +1 -1
  151. package/lib/typescript/native/data/DataName.d.ts +2 -0
  152. package/lib/typescript/native/data/DataName.d.ts.map +1 -1
  153. package/lib/typescript/parameters/ProviderType.d.ts +1 -0
  154. package/lib/typescript/parameters/ProviderType.d.ts.map +1 -1
  155. package/lib/typescript/settings/AffiseSettings.d.ts +14 -11
  156. package/lib/typescript/settings/AffiseSettings.d.ts.map +1 -1
  157. package/lib/typescript/settings/AffiseSettingsApi.d.ts +67 -0
  158. package/lib/typescript/settings/AffiseSettingsApi.d.ts.map +1 -0
  159. package/package.json +1 -1
  160. package/src/Export.ts +3 -3
  161. package/src/debug/AffiseDebug.ts +45 -0
  162. package/src/debug/AffiseDebugApi.ts +29 -0
  163. package/src/debug/internal.ts +2 -0
  164. package/src/index.ts +29 -152
  165. package/src/module/AffiseHasModule.ts +17 -0
  166. package/src/module/AffiseModules.ts +2 -0
  167. package/src/module/appsflyer/AffiseAppsFlyer.ts +25 -0
  168. package/src/module/appsflyer/AffiseModuleAppsFlyerApi.ts +10 -0
  169. package/src/module/attribution/AffiseAndroid.ts +25 -0
  170. package/src/module/attribution/AffiseAndroidApi.ts +8 -0
  171. package/src/module/attribution/AffiseIos.ts +48 -0
  172. package/src/module/attribution/AffiseIosApi.ts +28 -0
  173. package/src/module/attribution/AffiseModule.ts +86 -0
  174. package/src/module/attribution/AffiseModuleApi.ts +61 -0
  175. package/src/module/internal.ts +8 -0
  176. package/src/module/link/AffiseLink.ts +26 -0
  177. package/src/module/link/AffiseModuleLinkApi.ts +11 -0
  178. package/src/module/subscription/AffiseModuleSubscriptionApi.ts +23 -0
  179. package/src/module/subscription/AffiseSubscription.ts +40 -0
  180. package/src/native/AffiseApiMethod.ts +2 -0
  181. package/src/native/AffiseNative.ts +9 -0
  182. package/src/native/data/DataName.ts +3 -0
  183. package/src/parameters/ProviderType.ts +3 -0
  184. package/src/settings/AffiseSettings.ts +18 -15
  185. package/src/settings/AffiseSettingsApi.ts +84 -0
package/src/index.ts CHANGED
@@ -4,22 +4,28 @@ import type {
4
4
  AffiseInitProperties,
5
5
  // AutoCatchingType,
6
6
  ReferrerKey,
7
- CoarseValue,
8
7
  AffiseModules,
9
8
  ReferrerCallback,
10
9
  OnKeyValueCallback,
11
- ErrorCallback,
12
10
  OnDeeplinkCallback,
13
- DebugOnValidateCallback,
14
- DebugOnNetworkCallback,
15
11
  OnSendSuccessCallback,
16
12
  OnSendFailedCallback,
17
- AffiseLinkCallback,
18
- AffiseResultCallback,
19
13
  } from "./Export";
20
- import {AffiseNative} from "./native/AffiseNative";
21
- import {Platform} from "react-native";
22
- import {AffiseProduct, AffiseProductsResult, AffiseProductType, AffisePurchasedInfo, AffiseSettings} from "./Export";
14
+ import { AffiseNative } from "./native/AffiseNative";
15
+ import { AffiseSettings } from "./settings/AffiseSettings";
16
+ import type { AffiseSettingsApi } from "./Export";
17
+ import {
18
+ AffiseDebug,
19
+ AffiseDebugApi,
20
+ } from "./debug/internal";
21
+ import {
22
+ AffiseModuleApi,
23
+ AffiseModule,
24
+ AffiseIos,
25
+ AffiseIosApi,
26
+ AffiseAndroid,
27
+ AffiseAndroidApi
28
+ } from "./module/internal";
23
29
 
24
30
  export * from "./Export";
25
31
 
@@ -37,12 +43,12 @@ export class Affise {
37
43
  * @param affiseAppId - your app id
38
44
  * @param secretKey - your SDK secretKey
39
45
  */
40
- static settings({affiseAppId, secretKey}: { affiseAppId: string, secretKey: string }): AffiseSettings {
41
- return new AffiseSettings(affiseAppId, secretKey);
46
+ static settings({affiseAppId, secretKey}: { affiseAppId: string, secretKey: string }): AffiseSettingsApi {
47
+ return new AffiseSettings(this.native, affiseAppId, secretKey);
42
48
  }
43
49
 
44
50
  /**
45
- * Use Affise.settings({affiseAppId, secretKey}).start()
51
+ * @deprecated Use Affise.settings({affiseAppId, secretKey}).start()
46
52
  * @param initProperties
47
53
  */
48
54
  static start(
@@ -158,7 +164,7 @@ export class Affise {
158
164
  * @param callback status response
159
165
  */
160
166
  static getStatus(module: AffiseModules, callback: OnKeyValueCallback) {
161
- Affise.module.getStatus(module, callback);
167
+ this.module.getStatus(module, callback);
162
168
  }
163
169
 
164
170
  /**
@@ -167,7 +173,7 @@ export class Affise {
167
173
  * @param module module name
168
174
  */
169
175
  static moduleStart(module: AffiseModules): Promise<boolean> {
170
- return Affise.module.moduleStart(module);
176
+ return this.module.moduleStart(module);
171
177
  }
172
178
 
173
179
  /**
@@ -175,7 +181,7 @@ export class Affise {
175
181
  * Get installed modules
176
182
  */
177
183
  static getModulesInstalled(): Promise<AffiseModules[]> {
178
- return Affise.module.getModulesInstalled();
184
+ return this.module.getModulesInstalled();
179
185
  }
180
186
 
181
187
  /**
@@ -241,7 +247,7 @@ export class Affise {
241
247
  * Get referrer on server
242
248
  */
243
249
  static getReferrerOnServer(callback: ReferrerCallback) {
244
- Affise.getDeferredDeeplink(callback);
250
+ this.getDeferredDeeplink(callback);
245
251
  }
246
252
 
247
253
  /**
@@ -249,7 +255,7 @@ export class Affise {
249
255
  * Get referrer on server value
250
256
  */
251
257
  static getReferrerOnServerValue(key: ReferrerKey, callback: ReferrerCallback) {
252
- Affise.getDeferredDeeplinkValue(key, callback);
258
+ this.getDeferredDeeplinkValue(key, callback);
253
259
  }
254
260
 
255
261
  /**
@@ -276,139 +282,10 @@ export class Affise {
276
282
  // this.native.setEnabledMetrics(enabled);
277
283
  // }
278
284
 
279
- static android = class {
280
- /**
281
- * Erases all user data from mobile and sends [GDPREvent]
282
- */
283
- static forget(userData: string) {
284
- Affise.native.forget(userData);
285
- }
286
-
287
- static crashApplication() {
288
- Affise.native.crashApplication();
289
- }
290
- };
291
-
292
- static ios = class {
293
- /**
294
- * SKAd register app
295
- */
296
- static registerAppForAdNetworkAttribution(completionHandler: ErrorCallback) {
297
- if (Platform.OS !== 'ios') return;
298
- Affise.native.registerAppForAdNetworkAttribution(completionHandler);
299
- }
300
-
301
- /**
302
- * SKAd updatePostbackConversionValue
303
- */
304
- static updatePostbackConversionValue(fineValue: bigint, coarseValue: CoarseValue, completionHandler: ErrorCallback) {
305
- if (Platform.OS !== 'ios') return;
306
- Affise.native.updatePostbackConversionValue(fineValue, coarseValue, completionHandler);
307
- }
308
-
309
- /**
310
- * @deprecated use Affise.getDeferredDeeplink(callback)
311
- * Get referrer on server
312
- */
313
- static getReferrerOnServer(callback: ReferrerCallback) {
314
- Affise.native.getDeferredDeeplink(callback);
315
- }
316
-
317
- /**
318
- * @deprecated use Affise.getDeferredDeeplinkValue(key, callback)
319
- * Get referrer on server value
320
- */
321
- static getReferrerOnServerValue(key: ReferrerKey, callback: ReferrerCallback) {
322
- Affise.native.getDeferredDeeplinkValue(key, callback);
323
- }
324
- };
325
-
326
- static module = class {
327
-
328
- /**
329
- * Get module status
330
- * @param module module name
331
- * @param callback status response
332
- */
333
- static getStatus(module: AffiseModules, callback: OnKeyValueCallback) {
334
- Affise.native.getStatus(module, callback);
335
- }
336
-
337
- /**
338
- * Manual module start
339
- * @param module module name
340
- */
341
- static moduleStart(module: AffiseModules): Promise<boolean> {
342
- return Affise.native.moduleStart(module);
343
- }
344
-
345
- /**
346
- * Get installed modules
347
- */
348
- static getModulesInstalled(): Promise<AffiseModules[]> {
349
- return Affise.native.getModulesInstalled();
350
- }
351
-
352
- /**
353
- * Module Link url Resolve
354
- * @param url url
355
- * @param callback redirected url
356
- */
357
- static linkResolve(url: string, callback: AffiseLinkCallback) {
358
- Affise.native.linkResolve(url, callback);
359
- }
360
-
361
- /**
362
- * Module subscription fetchProducts
363
- * @param ids list of product ids
364
- * @param callback result callback
365
- */
366
- static fetchProducts(ids: string[], callback: AffiseResultCallback<AffiseProductsResult>) {
367
- Affise.native.fetchProducts(ids, callback);
368
- }
369
-
370
- /**
371
- * Module subscription purchase
372
- * @param product product
373
- * @param type product type
374
- * @param callback result callback
375
- */
376
- static purchase(product: AffiseProduct, type: AffiseProductType, callback: AffiseResultCallback<AffisePurchasedInfo>) {
377
- Affise.native.purchase(product, type, callback);
378
- }
379
- };
380
-
381
- static debug = class {
382
- /**
383
- * Won't work on Production
384
- *
385
- * Validate credentials
386
- */
387
- static validate(callback: DebugOnValidateCallback) {
388
- Affise.native.validate(callback);
389
- }
390
-
391
- /**
392
- * Won't work on Production
393
- *
394
- * Show request/response data
395
- */
396
- static network(callback: DebugOnNetworkCallback) {
397
- Affise.native.network(callback);
398
- }
399
-
400
- /**
401
- * Debug get version of flutter library
402
- */
403
- static version(): string {
404
- return "1.6.34";
405
- }
406
-
407
- /**
408
- * Debug get version of native library Android/iOS
409
- */
410
- static versionNative(): Promise<string> {
411
- return Affise.native.versionNative();
412
- }
413
- };
285
+ static android: AffiseAndroidApi = new AffiseAndroid(this.native);
286
+ static ios: AffiseIosApi = new AffiseIos(this.native);
287
+
288
+ static module: AffiseModuleApi = new AffiseModule(this.native);
289
+
290
+ static debug: AffiseDebugApi = new AffiseDebug(this.native);
414
291
  }
@@ -0,0 +1,17 @@
1
+ import type { AffiseNative } from "../native/AffiseNative"
2
+ import { AffiseModules } from "./AffiseModules"
3
+
4
+ export interface AffiseHasModule {
5
+ hasModule(): Promise<boolean>;
6
+ }
7
+
8
+ export function isModuleInit(native: AffiseNative, module: AffiseModules): Promise<boolean> {
9
+ return new Promise((resolve, reject) => {
10
+ native
11
+ .getModulesInstalled()
12
+ .then((modules) => {
13
+ resolve(modules.includes(module))
14
+ })
15
+ .catch(reject);
16
+ })
17
+ }
@@ -1,7 +1,9 @@
1
1
  export enum AffiseModules {
2
2
  ADVERTISING = "Advertising",
3
3
  ANDROIDID = "AndroidId",
4
+ APPSFLYER = "AppsFlyer",
4
5
  LINK = "Link",
6
+ META = "Meta",
5
7
  NETWORK = "Network",
6
8
  PERSISTENT = "Persistent",
7
9
  PHONE = "Phone",
@@ -0,0 +1,25 @@
1
+ import type { AffiseNative } from "../../native/AffiseNative";
2
+ import { isModuleInit } from "../AffiseHasModule";
3
+ import { AffiseModules } from "../AffiseModules";
4
+ import type { AffiseModuleAppsFlyerApi } from "./AffiseModuleAppsFlyerApi";
5
+
6
+ export class AffiseAppsFlyer implements AffiseModuleAppsFlyerApi {
7
+ private native: AffiseNative
8
+
9
+ constructor(native: AffiseNative) {
10
+ this.native = native
11
+ }
12
+
13
+ /**
14
+ * Send Appflyer event data to affise
15
+ * @param eventName event name
16
+ * @param eventValues event data
17
+ */
18
+ logEvent(eventName: string, eventValues: Record<string, any>) {
19
+ this.native.logEvent(eventName, eventValues)
20
+ }
21
+
22
+ hasModule(): Promise<boolean> {
23
+ return isModuleInit(this.native, AffiseModules.APPSFLYER)
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ import type { AffiseHasModule } from "../AffiseHasModule";
2
+
3
+ export interface AffiseModuleAppsFlyerApi extends AffiseHasModule {
4
+ /**
5
+ * Send Appflyer event data to affise
6
+ * @param eventName event name
7
+ * @param eventValues event data
8
+ */
9
+ logEvent(eventName: string, eventValues: Record<string, any>): void;
10
+ }
@@ -0,0 +1,25 @@
1
+ import { Platform } from "react-native";
2
+ import type { AffiseNative } from "../../native/AffiseNative";
3
+ import type { AffiseAndroidApi } from "./AffiseAndroidApi";
4
+
5
+ export class AffiseAndroid implements AffiseAndroidApi {
6
+
7
+ private native: AffiseNative
8
+
9
+ constructor(native: AffiseNative) {
10
+ this.native = native
11
+ }
12
+
13
+ /**
14
+ * Erases all user data from mobile and sends [GDPREvent]
15
+ */
16
+ forget(userData: string) {
17
+ if (Platform.OS !== 'android') return;
18
+ this.native.forget(userData);
19
+ }
20
+
21
+ crashApplication() {
22
+ if (Platform.OS !== 'android') return;
23
+ this.native.crashApplication();
24
+ }
25
+ }
@@ -0,0 +1,8 @@
1
+ export interface AffiseAndroidApi {
2
+ /**
3
+ * Erases all user data from mobile and sends [GDPREvent]
4
+ */
5
+ forget(userData: string): void;
6
+
7
+ crashApplication(): void;
8
+ }
@@ -0,0 +1,48 @@
1
+ import { Platform } from "react-native";
2
+ import type { AffiseNative } from "../../native/AffiseNative";
3
+ import type { AffiseIosApi } from "./AffiseIosApi";
4
+ import type { ErrorCallback } from "../../callback/ErrorCallback";
5
+ import type { CoarseValue } from "../../skad/CoarseValue";
6
+ import type { ReferrerKey } from "../../referrer/ReferrerKey";
7
+ import type { ReferrerCallback } from "../../referrer/ReferrerCallback";
8
+
9
+ export class AffiseIos implements AffiseIosApi {
10
+
11
+ private native: AffiseNative
12
+
13
+ constructor(native: AffiseNative) {
14
+ this.native = native
15
+ }
16
+
17
+ /**
18
+ * SKAd register app
19
+ */
20
+ registerAppForAdNetworkAttribution(completionHandler: ErrorCallback) {
21
+ if (Platform.OS !== 'ios') return;
22
+ this.native.registerAppForAdNetworkAttribution(completionHandler);
23
+ }
24
+
25
+ /**
26
+ * SKAd updatePostbackConversionValue
27
+ */
28
+ updatePostbackConversionValue(fineValue: bigint, coarseValue: CoarseValue, completionHandler: ErrorCallback) {
29
+ if (Platform.OS !== 'ios') return;
30
+ this.native.updatePostbackConversionValue(fineValue, coarseValue, completionHandler);
31
+ }
32
+
33
+ /**
34
+ * @deprecated use Affise.getDeferredDeeplink(callback)
35
+ * Get referrer on server
36
+ */
37
+ getReferrerOnServer(callback: ReferrerCallback) {
38
+ this.native.getDeferredDeeplink(callback);
39
+ }
40
+
41
+ /**
42
+ * @deprecated use Affise.getDeferredDeeplinkValue(key, callback)
43
+ * Get referrer on server value
44
+ */
45
+ getReferrerOnServerValue(key: ReferrerKey, callback: ReferrerCallback) {
46
+ this.native.getDeferredDeeplinkValue(key, callback);
47
+ }
48
+ }
@@ -0,0 +1,28 @@
1
+ import type { ErrorCallback } from "../../callback/ErrorCallback";
2
+ import type { CoarseValue } from "../../skad/CoarseValue";
3
+ import type { ReferrerKey } from "../../referrer/ReferrerKey";
4
+ import type { ReferrerCallback } from "../../referrer/ReferrerCallback";
5
+
6
+ export interface AffiseIosApi {
7
+ /**
8
+ * SKAd register app
9
+ */
10
+ registerAppForAdNetworkAttribution(completionHandler: ErrorCallback): void;
11
+
12
+ /**
13
+ * SKAd updatePostbackConversionValue
14
+ */
15
+ updatePostbackConversionValue(fineValue: bigint, coarseValue: CoarseValue, completionHandler: ErrorCallback): void;
16
+
17
+ /**
18
+ * @deprecated use Affise.getDeferredDeeplink(callback)
19
+ * Get referrer on server
20
+ */
21
+ getReferrerOnServer(callback: ReferrerCallback): void;
22
+
23
+ /**
24
+ * @deprecated use Affise.getDeferredDeeplinkValue(key, callback)
25
+ * Get referrer on server value
26
+ */
27
+ getReferrerOnServerValue(key: ReferrerKey, callback: ReferrerCallback): void;
28
+ }
@@ -0,0 +1,86 @@
1
+ import type { AffiseNative } from "../../native/AffiseNative";
2
+ import type { AffiseModuleApi } from "./AffiseModuleApi";
3
+ import type { AffiseModules } from "../AffiseModules";
4
+ import type { OnKeyValueCallback } from "../OnKeyValueCallback";
5
+ import type { AffiseProduct } from "../subscription/AffiseProduct";
6
+ import type { AffiseProductType } from "../subscription/AffiseProductType";
7
+ import type { AffisePurchasedInfo } from "../subscription/AffisePurchasedInfo";
8
+ import type { AffiseProductsResult } from "../subscription/AffiseProductsResult";
9
+ import type { AffiseResultCallback } from "../subscription/AffiseResultCallback";
10
+ import { AffiseLink} from "../link/AffiseLink"
11
+ import type { AffiseModuleLinkApi} from "../link/AffiseModuleLinkApi"
12
+ import type { AffiseLinkCallback} from "../link/AffiseLinkCallback"
13
+ import { AffiseSubscription } from "../subscription/AffiseSubscription";
14
+ import { AffiseModuleSubscriptionApi } from "../subscription/AffiseModuleSubscriptionApi";
15
+ import { AffiseAppsFlyer } from "../appsflyer/AffiseAppsFlyer";
16
+ import type { AffiseModuleAppsFlyerApi } from "../appsflyer/AffiseModuleAppsFlyerApi";
17
+
18
+ export class AffiseModule implements AffiseModuleApi {
19
+ private native: AffiseNative
20
+
21
+ appsFlyer: AffiseModuleAppsFlyerApi
22
+ link: AffiseModuleLinkApi
23
+ subscription: AffiseModuleSubscriptionApi
24
+
25
+ constructor(native: AffiseNative) {
26
+ this.native = native
27
+ this.appsFlyer = new AffiseAppsFlyer(native)
28
+ this.link = new AffiseLink(native)
29
+ this.subscription = new AffiseSubscription(native)
30
+ }
31
+
32
+ /**
33
+ * Get module status
34
+ * @param module module name
35
+ * @param callback status response
36
+ */
37
+ getStatus(module: AffiseModules, callback: OnKeyValueCallback) {
38
+ this.native.getStatus(module, callback);
39
+ }
40
+
41
+ /**
42
+ * Manual module start
43
+ * @param module module name
44
+ */
45
+ moduleStart(module: AffiseModules): Promise<boolean> {
46
+ return this.native.moduleStart(module);
47
+ }
48
+
49
+ /**
50
+ * Get installed modules
51
+ */
52
+ getModulesInstalled(): Promise<AffiseModules[]> {
53
+ return this.native.getModulesInstalled();
54
+ }
55
+
56
+ /**
57
+ * @deprecated use Affise.module.link.resolve(url, callback)
58
+ * Module Link url Resolve
59
+ * @param url url
60
+ * @param callback redirected url
61
+ */
62
+ linkResolve(url: string, callback: AffiseLinkCallback) {
63
+ this.link.resolve(url, callback);
64
+ }
65
+
66
+ /**
67
+ * @deprecated use Affise.module.subscription.fetchProducts(ids, callback)
68
+ * Module subscription fetchProducts
69
+ * @param ids list of product ids
70
+ * @param callback result callback
71
+ */
72
+ fetchProducts(ids: string[], callback: AffiseResultCallback<AffiseProductsResult>) {
73
+ this.subscription.fetchProducts(ids, callback);
74
+ }
75
+
76
+ /**
77
+ * @deprecated use Affise.module.subscription.purchase(product, type, callback)
78
+ * Module subscription purchase
79
+ * @param product product
80
+ * @param type product type
81
+ * @param callback result callback
82
+ */
83
+ purchase(product: AffiseProduct, type: AffiseProductType, callback: AffiseResultCallback<AffisePurchasedInfo>) {
84
+ this.subscription.purchase(product, type, callback);
85
+ }
86
+ }
@@ -0,0 +1,61 @@
1
+ import { AffiseModules } from "../AffiseModules";
2
+ import type { OnKeyValueCallback } from "../OnKeyValueCallback";
3
+ import type { AffiseModuleLinkApi} from "../link/AffiseModuleLinkApi"
4
+ import type { AffiseLinkCallback} from "../link/AffiseLinkCallback"
5
+ import type { AffiseProduct } from "../subscription/AffiseProduct";
6
+ import type { AffiseModuleSubscriptionApi } from "../subscription/AffiseModuleSubscriptionApi";
7
+ import type { AffiseProductType } from "../subscription/AffiseProductType";
8
+ import type { AffisePurchasedInfo } from "../subscription/AffisePurchasedInfo";
9
+ import type { AffiseProductsResult } from "../subscription/AffiseProductsResult";
10
+ import type { AffiseResultCallback } from "../subscription/AffiseResultCallback";
11
+ import type { AffiseModuleAppsFlyerApi } from "../appsflyer/AffiseModuleAppsFlyerApi";
12
+
13
+ export interface AffiseModuleApi {
14
+
15
+ appsFlyer: AffiseModuleAppsFlyerApi;
16
+ link: AffiseModuleLinkApi;
17
+ subscription: AffiseModuleSubscriptionApi;
18
+
19
+ /**
20
+ * Get module status
21
+ * @param module module name
22
+ * @param callback status response
23
+ */
24
+ getStatus(module: AffiseModules, callback: OnKeyValueCallback): void;
25
+
26
+ /**
27
+ * Manual module start
28
+ * @param module module name
29
+ */
30
+ moduleStart(module: AffiseModules): Promise<boolean>
31
+
32
+ /**
33
+ * Get installed modules
34
+ */
35
+ getModulesInstalled(): Promise<AffiseModules[]>
36
+
37
+ /**
38
+ * @deprecated use Affise.module.link.resolve(url, callback)
39
+ * Module Link url Resolve
40
+ * @param url url
41
+ * @param callback redirected url
42
+ */
43
+ linkResolve(url: string, callback: AffiseLinkCallback): void;
44
+
45
+ /**
46
+ * @deprecated use Affise.module.subscription.fetchProducts(ids, callback)
47
+ * Module subscription fetchProducts
48
+ * @param ids list of product ids
49
+ * @param callback result callback
50
+ */
51
+ fetchProducts(ids: string[], callback: AffiseResultCallback<AffiseProductsResult>): void;
52
+
53
+ /**
54
+ * @deprecated use Affise.module.subscription.purchase(product, type, callback)
55
+ * Module subscription purchase
56
+ * @param product product
57
+ * @param type product type
58
+ * @param callback result callback
59
+ */
60
+ purchase(product: AffiseProduct, type: AffiseProductType, callback: AffiseResultCallback<AffisePurchasedInfo>): void;
61
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./attribution/AffiseModule";
2
+ export * from "./attribution/AffiseModuleApi";
3
+
4
+ export * from "./attribution/AffiseIos";
5
+ export * from "./attribution/AffiseIosApi";
6
+
7
+ export * from "./attribution/AffiseAndroid";
8
+ export * from "./attribution/AffiseAndroidApi";
@@ -0,0 +1,26 @@
1
+ import type { AffiseNative } from "../../native/AffiseNative";
2
+ import type { AffiseLinkCallback } from "./AffiseLinkCallback";
3
+ import type { AffiseModuleLinkApi } from "./AffiseModuleLinkApi";
4
+ import { isModuleInit } from "../AffiseHasModule";
5
+ import { AffiseModules } from "../AffiseModules";
6
+
7
+ export class AffiseLink implements AffiseModuleLinkApi {
8
+ private native: AffiseNative
9
+
10
+ constructor(native: AffiseNative) {
11
+ this.native = native
12
+ }
13
+
14
+ /**
15
+ * Module Link url Resolve
16
+ * @param url url
17
+ * @param callback redirected url
18
+ */
19
+ resolve(url: string, callback: AffiseLinkCallback): void {
20
+ this.native.linkResolve(url, callback);
21
+ }
22
+
23
+ hasModule(): Promise<boolean> {
24
+ return isModuleInit(this.native, AffiseModules.LINK)
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ import type { AffiseLinkCallback } from "./AffiseLinkCallback";
2
+ import type { AffiseHasModule } from "../AffiseHasModule";
3
+
4
+ export interface AffiseModuleLinkApi extends AffiseHasModule {
5
+ /**
6
+ * Module Link url Resolve
7
+ * @param url url
8
+ * @param callback redirected url
9
+ */
10
+ resolve(url: string, callback: AffiseLinkCallback): void;
11
+ }
@@ -0,0 +1,23 @@
1
+ import type { AffiseProduct } from "./AffiseProduct";
2
+ import type { AffiseProductType } from "./AffiseProductType";
3
+ import type { AffisePurchasedInfo } from "./AffisePurchasedInfo";
4
+ import type { AffiseProductsResult } from "./AffiseProductsResult";
5
+ import type { AffiseResultCallback } from "./AffiseResultCallback";
6
+ import type { AffiseHasModule } from "../AffiseHasModule";
7
+
8
+ export interface AffiseModuleSubscriptionApi extends AffiseHasModule {
9
+ /**
10
+ * Module subscription fetchProducts
11
+ * @param ids list of product ids
12
+ * @param callback result callback
13
+ */
14
+ fetchProducts(ids: string[], callback: AffiseResultCallback<AffiseProductsResult>): void;
15
+
16
+ /**
17
+ * Module subscription purchase
18
+ * @param product product
19
+ * @param type product type
20
+ * @param callback result callback
21
+ */
22
+ purchase(product: AffiseProduct, type: AffiseProductType, callback: AffiseResultCallback<AffisePurchasedInfo>): void;
23
+ }