appsprint-react-native 0.2.0 → 1.0.4

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 (44) hide show
  1. package/README.md +173 -68
  2. package/android/build.gradle +4 -2
  3. package/android/libs/appsprint-sdk.aar +0 -0
  4. package/android/src/main/AndroidManifest.xml +2 -0
  5. package/android/src/main/kotlin/com/appsprint/AppSprintBridgeModule.kt +125 -29
  6. package/appsprint-react-native.podspec +6 -1
  7. package/ios/AppSprintBridge.m +6 -0
  8. package/ios/AppSprintBridge.swift +92 -16
  9. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/AppSprintSDK +0 -0
  10. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/Info.plist +0 -0
  11. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios.abi.json +4757 -952
  12. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios.package.swiftinterface +102 -30
  13. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +102 -30
  14. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  15. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios.swiftinterface +102 -30
  16. package/ios/AppSprintSDK.xcframework/ios-arm64/AppSprintSDK.framework/PrivacyInfo.xcprivacy +91 -0
  17. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/AppSprintSDK +0 -0
  18. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Info.plist +0 -0
  19. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +4757 -952
  20. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +102 -30
  21. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +102 -30
  22. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +102 -30
  24. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +4757 -952
  25. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +102 -30
  26. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +102 -30
  27. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  28. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/Modules/AppSprintSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +102 -30
  29. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/PrivacyInfo.xcprivacy +91 -0
  30. package/ios/AppSprintSDK.xcframework/ios-arm64_x86_64-simulator/AppSprintSDK.framework/_CodeSignature/CodeResources +1 -1
  31. package/lib/commonjs/AppSprint.js +40 -4
  32. package/lib/commonjs/NativeAppSprint.js +15 -3
  33. package/lib/module/AppSprint.js +40 -4
  34. package/lib/module/NativeAppSprint.js +15 -3
  35. package/lib/typescript/AppSprint.d.ts +6 -4
  36. package/lib/typescript/index.d.ts +1 -1
  37. package/lib/typescript/types.d.ts +53 -7
  38. package/package.json +5 -2
  39. package/plugin/build/index.js +37 -10
  40. package/plugin/src/index.ts +44 -1
  41. package/src/AppSprint.ts +85 -10
  42. package/src/NativeAppSprint.ts +15 -3
  43. package/src/index.ts +1 -0
  44. package/src/types.ts +87 -7
@@ -1,29 +1,70 @@
1
1
  export interface AppSprintConfig {
2
2
  apiKey: string;
3
3
  apiUrl?: string;
4
+ endpointBaseUrl?: string;
4
5
  enableAppleAdsAttribution?: boolean;
5
6
  isDebug?: boolean;
6
7
  logLevel?: 0 | 1 | 2 | 3;
7
8
  customerUserId?: string | null;
9
+ autoTrackSessions?: boolean;
10
+ autoRefreshAttribution?: boolean;
11
+ googleAdsConsent?: GoogleAdsConsent | null;
8
12
  }
13
+ export type AppSprintOptions = Omit<AppSprintConfig, "apiKey">;
9
14
  export type LogLevel = 0 | 1 | 2 | 3;
10
- export type EventType = "login" | "sign_up" | "register" | "purchase" | "subscribe" | "start_trial" | "add_to_cart" | "add_to_wishlist" | "initiate_checkout" | "view_content" | "view_item" | "search" | "share" | "tutorial_complete" | "level_start" | "level_complete" | "custom";
15
+ export type EventType = "session_start" | "SESSION_START" | "login" | "LOGIN" | "sign_up" | "SIGN_UP" | "register" | "REGISTER" | "purchase" | "PURCHASE" | "subscribe" | "SUBSCRIBE" | "start_trial" | "START_TRIAL" | "add_payment_info" | "ADD_PAYMENT_INFO" | "add_to_cart" | "ADD_TO_CART" | "add_to_wishlist" | "ADD_TO_WISHLIST" | "initiate_checkout" | "INITIATE_CHECKOUT" | "view_content" | "VIEW_CONTENT" | "view_item" | "VIEW_ITEM" | "search" | "SEARCH" | "share" | "SHARE" | "tutorial_complete" | "TUTORIAL_COMPLETE" | "achieve_level" | "ACHIEVE_LEVEL" | "level_start" | "LEVEL_START" | "level_complete" | "LEVEL_COMPLETE" | "custom" | "CUSTOM";
16
+ export type GoogleAdsConsentStatus = "GRANTED" | "DENIED" | "UNSPECIFIED" | "granted" | "denied" | "unspecified";
17
+ export interface GoogleAdsConsent {
18
+ adUserData: GoogleAdsConsentStatus;
19
+ }
11
20
  export interface EventParams {
12
21
  revenue?: number;
22
+ price?: number | string;
13
23
  currency?: string;
24
+ googleAdsConsent?: GoogleAdsConsent | null;
25
+ googleAdsAdUserDataConsent?: GoogleAdsConsentStatus;
26
+ email?: string;
27
+ name?: string;
28
+ phone_number?: string;
29
+ date_of_birth?: string;
14
30
  [key: string]: unknown;
15
31
  }
32
+ export type AttributionParams = Record<string, string>;
33
+ export interface AttributionLink {
34
+ id: string;
35
+ name: string;
36
+ }
37
+ export interface AppleAdsAttribution {
38
+ campaignId: string;
39
+ orgId?: string | null;
40
+ adGroupId?: string | null;
41
+ keywordId?: string | null;
42
+ adId?: string | null;
43
+ countryOrRegion?: string | null;
44
+ claimType?: string | null;
45
+ clickDate?: string | null;
46
+ impressionDate?: string | null;
47
+ conversionType?: string | null;
48
+ supplyPlacement?: string | null;
49
+ }
16
50
  export interface AttributionResult {
17
- source: "apple_ads" | "fingerprint" | "organic";
18
- confidence: number;
19
- campaignName?: string;
51
+ isAttributed?: boolean;
52
+ source?: "tracking_link" | "apple_ads" | "organic" | "fingerprint" | string;
53
+ matchType?: "idfa" | "idfv" | "ip_user_agent" | "apple_ads" | "organic" | string;
54
+ link?: AttributionLink | null;
55
+ appleAds?: AppleAdsAttribution | null;
56
+ confidence?: number;
57
+ campaignName?: string | null;
20
58
  utmSource?: string;
21
59
  utmMedium?: string;
22
60
  utmCampaign?: string;
61
+ utmContent?: string | null;
62
+ utmTerm?: string | null;
23
63
  }
24
64
  export interface InstallResponse {
25
65
  appsprintId: string;
26
66
  attribution: AttributionResult;
67
+ attributionParams?: AttributionParams;
27
68
  }
28
69
  export interface TestEventResult {
29
70
  success: boolean;
@@ -36,20 +77,25 @@ export interface DeviceInfo {
36
77
  locale?: string;
37
78
  timezone?: string;
38
79
  osVersion?: string;
80
+ appVersion?: string;
81
+ gaid?: string;
39
82
  idfv?: string;
40
83
  idfa?: string;
41
84
  adServicesToken?: string;
85
+ attStatus?: "not_determined" | "restricted" | "denied" | "authorized";
42
86
  }
43
87
  export interface NativeAppSprintModule {
44
- configure(config: Record<string, unknown>): Promise<void>;
45
- sendEvent(eventType: string, name: string | null, revenue: number | null, currency: string | null, parameters: Record<string, unknown> | null): Promise<void>;
88
+ configure(config: Record<string, unknown>): Promise<boolean>;
89
+ sendEvent(eventType: string, name: string | null, revenue: number | null, currency: string | null, parameters: Record<string, unknown> | null): Promise<boolean>;
46
90
  sendTestEvent(): Promise<TestEventResult>;
47
91
  flush(): Promise<void>;
48
92
  clearData(): Promise<void>;
49
93
  setCustomerUserId(userId: string): Promise<void>;
50
- enableAppleAdsAttribution(): Promise<void>;
94
+ refreshAttribution(): Promise<AttributionResult | null>;
95
+ enableAppleAdsAttribution(): Promise<boolean>;
51
96
  getAppSprintId(): Promise<string | null>;
52
97
  getAttribution(): Promise<AttributionResult | null>;
98
+ getAttributionParams(): Promise<AttributionParams>;
53
99
  isInitialized(): Promise<boolean>;
54
100
  isSdkDisabled(): Promise<boolean>;
55
101
  destroy(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appsprint-react-native",
3
- "version": "0.2.0",
3
+ "version": "1.0.4",
4
4
  "description": "AppSprint mobile attribution SDK for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -30,7 +30,10 @@
30
30
  "prepack": "npm run validate:release"
31
31
  },
32
32
  "keywords": ["react-native", "attribution", "mobile", "analytics", "appsprint"],
33
- "repository": "https://github.com/app-sprint/appsprint-react-native",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/getappsprint/appsprint-react-native.git"
36
+ },
34
37
  "author": "AppSprint",
35
38
  "license": "MIT",
36
39
  "homepage": "https://appsprint.app",
@@ -1,22 +1,49 @@
1
1
  "use strict";
2
2
 
3
- const { withInfoPlist } = require("@expo/config-plugins");
3
+ const { withAndroidManifest, withInfoPlist } = require("@expo/config-plugins");
4
4
 
5
5
  const DEFAULT_TRACKING_DESCRIPTION =
6
6
  "This identifier will be used to deliver personalized ads to you.";
7
7
 
8
+ const ANDROID_PERMISSIONS = [
9
+ "android.permission.INTERNET",
10
+ "com.google.android.gms.permission.AD_ID",
11
+ ];
12
+
13
+ function ensureAndroidPermission(androidManifest, permissionName) {
14
+ const permissions = androidManifest.manifest["uses-permission"] ?? [];
15
+ const alreadyDeclared = permissions.some(
16
+ (permission) => permission.$?.["android:name"] === permissionName
17
+ );
18
+
19
+ if (!alreadyDeclared) {
20
+ permissions.push({ $: { "android:name": permissionName } });
21
+ }
22
+
23
+ androidManifest.manifest["uses-permission"] = permissions;
24
+ }
25
+
8
26
  const withAppSprint = (config, props) =>
9
- withInfoPlist(config, (expoConfig) => {
10
- expoConfig.modResults.NSUserTrackingUsageDescription =
11
- props?.trackingDescription ?? DEFAULT_TRACKING_DESCRIPTION;
27
+ withAndroidManifest(
28
+ withInfoPlist(config, (expoConfig) => {
29
+ expoConfig.modResults.NSUserTrackingUsageDescription =
30
+ props?.trackingDescription ?? DEFAULT_TRACKING_DESCRIPTION;
12
31
 
13
- if (props?.advertisingAttributionEndpoint) {
14
- expoConfig.modResults.NSAdvertisingAttributionReportEndpoint =
15
- props.advertisingAttributionEndpoint;
16
- }
32
+ if (props?.advertisingAttributionEndpoint) {
33
+ expoConfig.modResults.NSAdvertisingAttributionReportEndpoint =
34
+ props.advertisingAttributionEndpoint;
35
+ }
36
+
37
+ return expoConfig;
38
+ }),
39
+ (expoConfig) => {
40
+ for (const permission of ANDROID_PERMISSIONS) {
41
+ ensureAndroidPermission(expoConfig.modResults, permission);
42
+ }
17
43
 
18
- return expoConfig;
19
- });
44
+ return expoConfig;
45
+ }
46
+ );
20
47
 
21
48
  module.exports = withAppSprint;
22
49
  module.exports.default = withAppSprint;
@@ -1,4 +1,39 @@
1
- import { ConfigPlugin, withInfoPlist } from "@expo/config-plugins";
1
+ import {
2
+ ConfigPlugin,
3
+ withAndroidManifest,
4
+ withInfoPlist,
5
+ } from "@expo/config-plugins";
6
+
7
+ type AndroidManifest = {
8
+ manifest: {
9
+ "uses-permission"?: Array<{
10
+ $?: {
11
+ "android:name"?: string;
12
+ };
13
+ }>;
14
+ };
15
+ };
16
+
17
+ const ANDROID_PERMISSIONS = [
18
+ "android.permission.INTERNET",
19
+ "com.google.android.gms.permission.AD_ID",
20
+ ];
21
+
22
+ function ensureAndroidPermission(
23
+ androidManifest: AndroidManifest,
24
+ permissionName: string
25
+ ) {
26
+ const permissions = androidManifest.manifest["uses-permission"] ?? [];
27
+ const alreadyDeclared = permissions.some(
28
+ (permission) => permission.$?.["android:name"] === permissionName
29
+ );
30
+
31
+ if (!alreadyDeclared) {
32
+ permissions.push({ $: { "android:name": permissionName } });
33
+ }
34
+
35
+ androidManifest.manifest["uses-permission"] = permissions;
36
+ }
2
37
 
3
38
  const withAppSprint: ConfigPlugin<{
4
39
  trackingDescription?: string;
@@ -21,6 +56,14 @@ const withAppSprint: ConfigPlugin<{
21
56
  return config;
22
57
  });
23
58
 
59
+ config = withAndroidManifest(config, (config) => {
60
+ for (const permission of ANDROID_PERMISSIONS) {
61
+ ensureAndroidPermission(config.modResults as AndroidManifest, permission);
62
+ }
63
+
64
+ return config;
65
+ });
66
+
24
67
  return config;
25
68
  };
26
69
 
package/src/AppSprint.ts CHANGED
@@ -1,30 +1,97 @@
1
1
  import { NativeAppSprint } from "./NativeAppSprint";
2
2
  import type {
3
3
  AppSprintConfig,
4
+ AppSprintOptions,
5
+ AttributionParams,
4
6
  AttributionResult,
5
7
  EventParams,
6
8
  EventType,
7
9
  TestEventResult,
8
10
  } from "./types";
9
11
 
12
+ function normalizeEventType(eventType: EventType | string): string {
13
+ return eventType.toLowerCase().replace(/-/g, "_");
14
+ }
15
+
16
+ const STANDARD_EVENT_TYPES = new Set([
17
+ "session_start",
18
+ "login",
19
+ "sign_up",
20
+ "register",
21
+ "purchase",
22
+ "subscribe",
23
+ "start_trial",
24
+ "add_payment_info",
25
+ "add_to_cart",
26
+ "add_to_wishlist",
27
+ "initiate_checkout",
28
+ "view_content",
29
+ "view_item",
30
+ "search",
31
+ "share",
32
+ "tutorial_complete",
33
+ "achieve_level",
34
+ "level_start",
35
+ "level_complete",
36
+ "custom",
37
+ ]);
38
+
39
+ function numericValue(value: unknown): number | null {
40
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
41
+ if (typeof value === "string" && value.trim().length > 0) {
42
+ const parsed = Number(value);
43
+ return Number.isFinite(parsed) ? parsed : null;
44
+ }
45
+ return null;
46
+ }
47
+
48
+ function revenueValue(params?: EventParams): number | null {
49
+ return numericValue(params?.revenue) ?? numericValue(params?.price);
50
+ }
51
+
52
+ function normalizeConfig(
53
+ configOrApiKey: AppSprintConfig | string,
54
+ options: AppSprintOptions = {}
55
+ ): AppSprintConfig {
56
+ const config =
57
+ typeof configOrApiKey === "string"
58
+ ? { ...options, apiKey: configOrApiKey }
59
+ : configOrApiKey;
60
+ const apiUrl = config.apiUrl ?? config.endpointBaseUrl;
61
+ return apiUrl ? { ...config, apiUrl } : config;
62
+ }
63
+
10
64
  class AppSprintSDK {
11
- async configure(config: AppSprintConfig): Promise<void> {
65
+ async configure(
66
+ configOrApiKey: AppSprintConfig | string,
67
+ options: AppSprintOptions = {}
68
+ ): Promise<boolean> {
69
+ const config = normalizeConfig(configOrApiKey, options);
12
70
  if (typeof config.apiKey !== "string" || config.apiKey.trim().length === 0) {
13
71
  throw new Error("AppSprint.configure requires a non-empty apiKey.");
14
72
  }
15
73
 
16
- await NativeAppSprint.configure(config as unknown as Record<string, unknown>);
74
+ return NativeAppSprint.configure(config as unknown as Record<string, unknown>);
17
75
  }
18
76
 
19
77
  async sendEvent(
20
- eventType: EventType,
78
+ eventType: EventType | string,
21
79
  name?: string | null,
22
80
  params?: EventParams
23
- ): Promise<void> {
24
- await NativeAppSprint.sendEvent(
25
- eventType,
26
- name ?? null,
27
- params?.revenue ?? null,
81
+ ): Promise<boolean> {
82
+ const normalizedEventType = normalizeEventType(eventType);
83
+ const nativeEventType = STANDARD_EVENT_TYPES.has(normalizedEventType)
84
+ ? normalizedEventType
85
+ : "custom";
86
+ const nativeName =
87
+ nativeEventType === "custom" && normalizedEventType !== "custom"
88
+ ? name ?? normalizedEventType
89
+ : name ?? null;
90
+
91
+ return NativeAppSprint.sendEvent(
92
+ nativeEventType,
93
+ nativeName,
94
+ revenueValue(params),
28
95
  params?.currency ?? null,
29
96
  params ?? null
30
97
  );
@@ -46,8 +113,12 @@ class AppSprintSDK {
46
113
  await NativeAppSprint.setCustomerUserId(userId);
47
114
  }
48
115
 
49
- async enableAppleAdsAttribution(): Promise<void> {
50
- await NativeAppSprint.enableAppleAdsAttribution();
116
+ async refreshAttribution(): Promise<AttributionResult | null> {
117
+ return NativeAppSprint.refreshAttribution();
118
+ }
119
+
120
+ async enableAppleAdsAttribution(): Promise<boolean> {
121
+ return NativeAppSprint.enableAppleAdsAttribution();
51
122
  }
52
123
 
53
124
  async getAppSprintId(): Promise<string | null> {
@@ -58,6 +129,10 @@ class AppSprintSDK {
58
129
  return NativeAppSprint.getAttribution();
59
130
  }
60
131
 
132
+ async getAttributionParams(): Promise<AttributionParams> {
133
+ return NativeAppSprint.getAttributionParams();
134
+ }
135
+
61
136
  async isInitialized(): Promise<boolean> {
62
137
  return NativeAppSprint.isInitialized();
63
138
  }
@@ -6,21 +6,33 @@ const LINKING_ERROR =
6
6
  "Make sure you have run 'pod install' and rebuilt the app.";
7
7
 
8
8
  const unsupportedPlatformModule: NativeAppSprintModule = {
9
- async configure() {},
10
- async sendEvent() {},
9
+ async configure() {
10
+ return false;
11
+ },
12
+ async sendEvent() {
13
+ return false;
14
+ },
11
15
  async sendTestEvent() {
12
16
  return { success: false, message: "Unsupported platform" };
13
17
  },
14
18
  async flush() {},
15
19
  async clearData() {},
16
20
  async setCustomerUserId() {},
17
- async enableAppleAdsAttribution() {},
21
+ async refreshAttribution() {
22
+ return null;
23
+ },
24
+ async enableAppleAdsAttribution() {
25
+ return false;
26
+ },
18
27
  async getAppSprintId() {
19
28
  return null;
20
29
  },
21
30
  async getAttribution() {
22
31
  return null;
23
32
  },
33
+ async getAttributionParams() {
34
+ return {};
35
+ },
24
36
  async isInitialized() {
25
37
  return false;
26
38
  },
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export { AppSprint } from "./AppSprint";
2
2
  export { NativeAppSprint } from "./NativeAppSprint";
3
3
  export type {
4
4
  AppSprintConfig,
5
+ AppSprintOptions,
5
6
  EventType,
6
7
  EventParams,
7
8
  AttributionResult,
package/src/types.ts CHANGED
@@ -1,51 +1,126 @@
1
1
  export interface AppSprintConfig {
2
2
  apiKey: string;
3
3
  apiUrl?: string; // defaults to https://api.appsprint.app
4
+ endpointBaseUrl?: string; // Appstack-compatible alias for apiUrl
4
5
  enableAppleAdsAttribution?: boolean;
5
6
  isDebug?: boolean;
6
7
  logLevel?: 0 | 1 | 2 | 3; // 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR
7
8
  customerUserId?: string | null;
9
+ autoTrackSessions?: boolean;
10
+ autoRefreshAttribution?: boolean;
11
+ googleAdsConsent?: GoogleAdsConsent | null;
8
12
  }
9
13
 
14
+ export type AppSprintOptions = Omit<AppSprintConfig, "apiKey">;
10
15
  export type LogLevel = 0 | 1 | 2 | 3;
11
16
 
12
17
  export type EventType =
18
+ | "session_start"
19
+ | "SESSION_START"
13
20
  | "login"
21
+ | "LOGIN"
14
22
  | "sign_up"
23
+ | "SIGN_UP"
15
24
  | "register"
25
+ | "REGISTER"
16
26
  | "purchase"
27
+ | "PURCHASE"
17
28
  | "subscribe"
29
+ | "SUBSCRIBE"
18
30
  | "start_trial"
31
+ | "START_TRIAL"
32
+ | "add_payment_info"
33
+ | "ADD_PAYMENT_INFO"
19
34
  | "add_to_cart"
35
+ | "ADD_TO_CART"
20
36
  | "add_to_wishlist"
37
+ | "ADD_TO_WISHLIST"
21
38
  | "initiate_checkout"
39
+ | "INITIATE_CHECKOUT"
22
40
  | "view_content"
41
+ | "VIEW_CONTENT"
23
42
  | "view_item"
43
+ | "VIEW_ITEM"
24
44
  | "search"
45
+ | "SEARCH"
25
46
  | "share"
47
+ | "SHARE"
26
48
  | "tutorial_complete"
49
+ | "TUTORIAL_COMPLETE"
50
+ | "achieve_level"
51
+ | "ACHIEVE_LEVEL"
27
52
  | "level_start"
53
+ | "LEVEL_START"
28
54
  | "level_complete"
29
- | "custom";
55
+ | "LEVEL_COMPLETE"
56
+ | "custom"
57
+ | "CUSTOM";
58
+
59
+ export type GoogleAdsConsentStatus =
60
+ | "GRANTED"
61
+ | "DENIED"
62
+ | "UNSPECIFIED"
63
+ | "granted"
64
+ | "denied"
65
+ | "unspecified";
66
+
67
+ export interface GoogleAdsConsent {
68
+ adUserData: GoogleAdsConsentStatus;
69
+ }
30
70
 
31
71
  export interface EventParams {
32
72
  revenue?: number;
73
+ price?: number | string;
33
74
  currency?: string;
75
+ googleAdsConsent?: GoogleAdsConsent | null;
76
+ googleAdsAdUserDataConsent?: GoogleAdsConsentStatus;
77
+ email?: string;
78
+ name?: string;
79
+ phone_number?: string;
80
+ date_of_birth?: string;
34
81
  [key: string]: unknown;
35
82
  }
36
83
 
84
+ export type AttributionParams = Record<string, string>;
85
+
86
+ export interface AttributionLink {
87
+ id: string;
88
+ name: string;
89
+ }
90
+
91
+ export interface AppleAdsAttribution {
92
+ campaignId: string;
93
+ orgId?: string | null;
94
+ adGroupId?: string | null;
95
+ keywordId?: string | null;
96
+ adId?: string | null;
97
+ countryOrRegion?: string | null;
98
+ claimType?: string | null;
99
+ clickDate?: string | null;
100
+ impressionDate?: string | null;
101
+ conversionType?: string | null;
102
+ supplyPlacement?: string | null;
103
+ }
104
+
37
105
  export interface AttributionResult {
38
- source: "apple_ads" | "fingerprint" | "organic";
39
- confidence: number;
40
- campaignName?: string;
106
+ isAttributed?: boolean;
107
+ source?: "tracking_link" | "apple_ads" | "organic" | "fingerprint" | string;
108
+ matchType?: "idfa" | "idfv" | "ip_user_agent" | "apple_ads" | "organic" | string;
109
+ link?: AttributionLink | null;
110
+ appleAds?: AppleAdsAttribution | null;
111
+ confidence?: number;
112
+ campaignName?: string | null;
41
113
  utmSource?: string;
42
114
  utmMedium?: string;
43
115
  utmCampaign?: string;
116
+ utmContent?: string | null;
117
+ utmTerm?: string | null;
44
118
  }
45
119
 
46
120
  export interface InstallResponse {
47
121
  appsprintId: string;
48
122
  attribution: AttributionResult;
123
+ attributionParams?: AttributionParams;
49
124
  }
50
125
 
51
126
  export interface TestEventResult {
@@ -60,28 +135,33 @@ export interface DeviceInfo {
60
135
  locale?: string;
61
136
  timezone?: string;
62
137
  osVersion?: string;
138
+ appVersion?: string;
139
+ gaid?: string;
63
140
  idfv?: string;
64
141
  idfa?: string;
65
142
  adServicesToken?: string;
143
+ attStatus?: "not_determined" | "restricted" | "denied" | "authorized";
66
144
  }
67
145
 
68
146
  export interface NativeAppSprintModule {
69
147
  // Core SDK (delegates to precompiled binary)
70
- configure(config: Record<string, unknown>): Promise<void>;
148
+ configure(config: Record<string, unknown>): Promise<boolean>;
71
149
  sendEvent(
72
150
  eventType: string,
73
151
  name: string | null,
74
152
  revenue: number | null,
75
153
  currency: string | null,
76
154
  parameters: Record<string, unknown> | null
77
- ): Promise<void>;
155
+ ): Promise<boolean>;
78
156
  sendTestEvent(): Promise<TestEventResult>;
79
157
  flush(): Promise<void>;
80
158
  clearData(): Promise<void>;
81
159
  setCustomerUserId(userId: string): Promise<void>;
82
- enableAppleAdsAttribution(): Promise<void>;
160
+ refreshAttribution(): Promise<AttributionResult | null>;
161
+ enableAppleAdsAttribution(): Promise<boolean>;
83
162
  getAppSprintId(): Promise<string | null>;
84
163
  getAttribution(): Promise<AttributionResult | null>;
164
+ getAttributionParams(): Promise<AttributionParams>;
85
165
  isInitialized(): Promise<boolean>;
86
166
  isSdkDisabled(): Promise<boolean>;
87
167
  destroy(): Promise<void>;