@app-swiss-knife/react-native-sdk 0.1.0

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 (218) hide show
  1. package/README.md +182 -0
  2. package/SwissKnifePurchases.podspec +40 -0
  3. package/android/build.gradle +89 -0
  4. package/android/gradle.properties +3 -0
  5. package/android/src/main/AndroidManifest.xml +26 -0
  6. package/android/src/main/java/com/swissknife/crashreporting/SKCrashReportingModule.kt +216 -0
  7. package/android/src/main/java/com/swissknife/crashreporting/SKCrashReportingPackage.kt +17 -0
  8. package/android/src/main/java/com/swissknife/purchases/Conversions.kt +15 -0
  9. package/android/src/main/java/com/swissknife/purchases/SwissKnifeJson.kt +371 -0
  10. package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesModule.kt +497 -0
  11. package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesPackage.kt +25 -0
  12. package/android/vendor/GENERATED.md +10 -0
  13. package/android/vendor/java/com/appswissknife/SwissKnife.kt +533 -0
  14. package/android/vendor/java/com/appswissknife/analytics/EventQueueStore.kt +326 -0
  15. package/android/vendor/java/com/appswissknife/analytics/FlushEventsWorker.kt +296 -0
  16. package/android/vendor/java/com/appswissknife/analytics/SKAnalytics.kt +503 -0
  17. package/android/vendor/java/com/appswissknife/attributes/AttributesClient.kt +188 -0
  18. package/android/vendor/java/com/appswissknife/attributes/SetAttributesWorker.kt +204 -0
  19. package/android/vendor/java/com/appswissknife/attribution/Attribution.kt +447 -0
  20. package/android/vendor/java/com/appswissknife/context/AppLifecycle.kt +120 -0
  21. package/android/vendor/java/com/appswissknife/context/Clock.kt +70 -0
  22. package/android/vendor/java/com/appswissknife/context/DeviceContext.kt +138 -0
  23. package/android/vendor/java/com/appswissknife/context/IDs.kt +55 -0
  24. package/android/vendor/java/com/appswissknife/context/Reachability.kt +145 -0
  25. package/android/vendor/java/com/appswissknife/context/Session.kt +192 -0
  26. package/android/vendor/java/com/appswissknife/crashreporting/SKCrashReporting.kt +945 -0
  27. package/android/vendor/java/com/appswissknife/crashreporting/SKScreenshot.kt +201 -0
  28. package/android/vendor/java/com/appswissknife/device/DeviceID.kt +172 -0
  29. package/android/vendor/java/com/appswissknife/diagnostics/SKLog.kt +97 -0
  30. package/android/vendor/java/com/appswissknife/entitlements/EntitlementsRepository.kt +495 -0
  31. package/android/vendor/java/com/appswissknife/identity/Identity.kt +522 -0
  32. package/android/vendor/java/com/appswissknife/models/CustomerInfo.kt +67 -0
  33. package/android/vendor/java/com/appswissknife/models/Enums.kt +35 -0
  34. package/android/vendor/java/com/appswissknife/models/Offerings.kt +80 -0
  35. package/android/vendor/java/com/appswissknife/models/PurchasesError.kt +89 -0
  36. package/android/vendor/java/com/appswissknife/models/StoreTransaction.kt +17 -0
  37. package/android/vendor/java/com/appswissknife/net/BackendHttpClient.kt +507 -0
  38. package/android/vendor/java/com/appswissknife/net/ExponentialBackoff.kt +69 -0
  39. package/android/vendor/java/com/appswissknife/net/IngestClient.kt +582 -0
  40. package/android/vendor/java/com/appswissknife/net/OfflineQueueStore.kt +320 -0
  41. package/android/vendor/java/com/appswissknife/offerings/OfferingsRepository.kt +219 -0
  42. package/android/vendor/java/com/appswissknife/performance/SKFrameTracker.kt +94 -0
  43. package/android/vendor/java/com/appswissknife/performance/SKPerformance.kt +428 -0
  44. package/android/vendor/java/com/appswissknife/purchases/BillingClientGateway.kt +560 -0
  45. package/android/vendor/java/com/appswissknife/purchases/PlayPriceEnrichmentProvider.kt +100 -0
  46. package/android/vendor/java/com/appswissknife/purchases/PriceEnrichmentProvider.kt +36 -0
  47. package/android/vendor/java/com/appswissknife/purchases/PurchasesGateway.kt +120 -0
  48. package/android/vendor/res/xml/swissknife_data_extraction_rules.xml +20 -0
  49. package/ios/SwissKnifeCrashReporting.m +32 -0
  50. package/ios/SwissKnifeCrashReporting.swift +186 -0
  51. package/ios/SwissKnifeJSON.swift +347 -0
  52. package/ios/SwissKnifePurchases.m +124 -0
  53. package/ios/SwissKnifePurchases.swift +523 -0
  54. package/ios/vendor/GENERATED.md +10 -0
  55. package/ios/vendor/SwissKnifeiOS/Analytics/SKAnalytics.swift +488 -0
  56. package/ios/vendor/SwissKnifeiOS/AttributesClient.swift +460 -0
  57. package/ios/vendor/SwissKnifeiOS/Attribution/Attribution.swift +307 -0
  58. package/ios/vendor/SwissKnifeiOS/Attribution/AttributionNetwork.swift +92 -0
  59. package/ios/vendor/SwissKnifeiOS/Attribution/AttributionState.swift +141 -0
  60. package/ios/vendor/SwissKnifeiOS/Context/AppLifecycle.swift +130 -0
  61. package/ios/vendor/SwissKnifeiOS/Context/Clock.swift +100 -0
  62. package/ios/vendor/SwissKnifeiOS/Context/DeviceContext.swift +190 -0
  63. package/ios/vendor/SwissKnifeiOS/Context/IDs.swift +64 -0
  64. package/ios/vendor/SwissKnifeiOS/Context/Reachability.swift +121 -0
  65. package/ios/vendor/SwissKnifeiOS/Context/Session.swift +223 -0
  66. package/ios/vendor/SwissKnifeiOS/CrashReporting/SKCrashReporting.swift +1287 -0
  67. package/ios/vendor/SwissKnifeiOS/CrashReporting/SKScreenshot.swift +175 -0
  68. package/ios/vendor/SwissKnifeiOS/DeviceID.swift +161 -0
  69. package/ios/vendor/SwissKnifeiOS/Diagnostics/SKLog.swift +128 -0
  70. package/ios/vendor/SwissKnifeiOS/Identity/Identity.swift +323 -0
  71. package/ios/vendor/SwissKnifeiOS/Identity/IdentityNetwork.swift +70 -0
  72. package/ios/vendor/SwissKnifeiOS/Net/BackendHttpClient.swift +329 -0
  73. package/ios/vendor/SwissKnifeiOS/Net/ExponentialBackoff.swift +87 -0
  74. package/ios/vendor/SwissKnifeiOS/Net/IngestClient.swift +681 -0
  75. package/ios/vendor/SwissKnifeiOS/Net/OfflineQueueStore.swift +409 -0
  76. package/ios/vendor/SwissKnifeiOS/Performance/SKFrameTracker.swift +89 -0
  77. package/ios/vendor/SwissKnifeiOS/Performance/SKPerformance.swift +440 -0
  78. package/ios/vendor/SwissKnifeiOS/Performance/SKURLSessionDelegate.swift +87 -0
  79. package/ios/vendor/SwissKnifeiOS/Services/EntitlementsService.swift +646 -0
  80. package/ios/vendor/SwissKnifeiOS/Services/OfferingsService.swift +458 -0
  81. package/ios/vendor/SwissKnifeiOS/Services/PurchaseService.swift +374 -0
  82. package/ios/vendor/SwissKnifeiOS/SwissKnife+Analytics.swift +46 -0
  83. package/ios/vendor/SwissKnifeiOS/SwissKnife+DeviceID.swift +30 -0
  84. package/ios/vendor/SwissKnifeiOS/SwissKnife+Session.swift +47 -0
  85. package/ios/vendor/SwissKnifeiOS/SwissKnife.swift +417 -0
  86. package/ios/vendor/SwissKnifeiOS/Types.swift +496 -0
  87. package/lib/commonjs/attribution.js +55 -0
  88. package/lib/commonjs/attribution.js.map +1 -0
  89. package/lib/commonjs/identity.js +126 -0
  90. package/lib/commonjs/identity.js.map +1 -0
  91. package/lib/commonjs/index.js +118 -0
  92. package/lib/commonjs/index.js.map +1 -0
  93. package/lib/commonjs/modules/analytics.js +646 -0
  94. package/lib/commonjs/modules/analytics.js.map +1 -0
  95. package/lib/commonjs/modules/attachments.js +169 -0
  96. package/lib/commonjs/modules/attachments.js.map +1 -0
  97. package/lib/commonjs/modules/crash-reporting.js +1327 -0
  98. package/lib/commonjs/modules/crash-reporting.js.map +1 -0
  99. package/lib/commonjs/modules/ids.js +50 -0
  100. package/lib/commonjs/modules/ids.js.map +1 -0
  101. package/lib/commonjs/modules/log.js +59 -0
  102. package/lib/commonjs/modules/log.js.map +1 -0
  103. package/lib/commonjs/modules/offline-store.js +44 -0
  104. package/lib/commonjs/modules/offline-store.js.map +1 -0
  105. package/lib/commonjs/modules/performance.js +494 -0
  106. package/lib/commonjs/modules/performance.js.map +1 -0
  107. package/lib/commonjs/native/module.js +41 -0
  108. package/lib/commonjs/native/module.js.map +1 -0
  109. package/lib/commonjs/native/spec.js +26 -0
  110. package/lib/commonjs/native/spec.js.map +1 -0
  111. package/lib/commonjs/package.json +1 -0
  112. package/lib/commonjs/purchases.js +194 -0
  113. package/lib/commonjs/purchases.js.map +1 -0
  114. package/lib/commonjs/types.js +236 -0
  115. package/lib/commonjs/types.js.map +1 -0
  116. package/lib/module/attribution.js +51 -0
  117. package/lib/module/attribution.js.map +1 -0
  118. package/lib/module/identity.js +122 -0
  119. package/lib/module/identity.js.map +1 -0
  120. package/lib/module/index.js +36 -0
  121. package/lib/module/index.js.map +1 -0
  122. package/lib/module/modules/analytics.js +642 -0
  123. package/lib/module/modules/analytics.js.map +1 -0
  124. package/lib/module/modules/attachments.js +162 -0
  125. package/lib/module/modules/attachments.js.map +1 -0
  126. package/lib/module/modules/crash-reporting.js +1320 -0
  127. package/lib/module/modules/crash-reporting.js.map +1 -0
  128. package/lib/module/modules/ids.js +44 -0
  129. package/lib/module/modules/ids.js.map +1 -0
  130. package/lib/module/modules/log.js +54 -0
  131. package/lib/module/modules/log.js.map +1 -0
  132. package/lib/module/modules/offline-store.js +39 -0
  133. package/lib/module/modules/offline-store.js.map +1 -0
  134. package/lib/module/modules/performance.js +491 -0
  135. package/lib/module/modules/performance.js.map +1 -0
  136. package/lib/module/native/module.js +34 -0
  137. package/lib/module/native/module.js.map +1 -0
  138. package/lib/module/native/spec.js +22 -0
  139. package/lib/module/native/spec.js.map +1 -0
  140. package/lib/module/package.json +1 -0
  141. package/lib/module/purchases.js +187 -0
  142. package/lib/module/purchases.js.map +1 -0
  143. package/lib/module/types.js +230 -0
  144. package/lib/module/types.js.map +1 -0
  145. package/lib/typescript/commonjs/attribution.d.ts +24 -0
  146. package/lib/typescript/commonjs/attribution.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/identity.d.ts +37 -0
  148. package/lib/typescript/commonjs/identity.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/index.d.ts +15 -0
  150. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/modules/analytics.d.ts +127 -0
  152. package/lib/typescript/commonjs/modules/analytics.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/modules/attachments.d.ts +50 -0
  154. package/lib/typescript/commonjs/modules/attachments.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/modules/crash-reporting.d.ts +175 -0
  156. package/lib/typescript/commonjs/modules/crash-reporting.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/modules/ids.d.ts +17 -0
  158. package/lib/typescript/commonjs/modules/ids.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/modules/log.d.ts +12 -0
  160. package/lib/typescript/commonjs/modules/log.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/modules/offline-store.d.ts +9 -0
  162. package/lib/typescript/commonjs/modules/offline-store.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/modules/performance.d.ts +75 -0
  164. package/lib/typescript/commonjs/modules/performance.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/native/module.d.ts +6 -0
  166. package/lib/typescript/commonjs/native/module.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/native/spec.d.ts +119 -0
  168. package/lib/typescript/commonjs/native/spec.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/package.json +1 -0
  170. package/lib/typescript/commonjs/purchases.d.ts +68 -0
  171. package/lib/typescript/commonjs/purchases.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/types.d.ts +384 -0
  173. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  174. package/lib/typescript/module/attribution.d.ts +24 -0
  175. package/lib/typescript/module/attribution.d.ts.map +1 -0
  176. package/lib/typescript/module/identity.d.ts +37 -0
  177. package/lib/typescript/module/identity.d.ts.map +1 -0
  178. package/lib/typescript/module/index.d.ts +15 -0
  179. package/lib/typescript/module/index.d.ts.map +1 -0
  180. package/lib/typescript/module/modules/analytics.d.ts +127 -0
  181. package/lib/typescript/module/modules/analytics.d.ts.map +1 -0
  182. package/lib/typescript/module/modules/attachments.d.ts +50 -0
  183. package/lib/typescript/module/modules/attachments.d.ts.map +1 -0
  184. package/lib/typescript/module/modules/crash-reporting.d.ts +175 -0
  185. package/lib/typescript/module/modules/crash-reporting.d.ts.map +1 -0
  186. package/lib/typescript/module/modules/ids.d.ts +17 -0
  187. package/lib/typescript/module/modules/ids.d.ts.map +1 -0
  188. package/lib/typescript/module/modules/log.d.ts +12 -0
  189. package/lib/typescript/module/modules/log.d.ts.map +1 -0
  190. package/lib/typescript/module/modules/offline-store.d.ts +9 -0
  191. package/lib/typescript/module/modules/offline-store.d.ts.map +1 -0
  192. package/lib/typescript/module/modules/performance.d.ts +75 -0
  193. package/lib/typescript/module/modules/performance.d.ts.map +1 -0
  194. package/lib/typescript/module/native/module.d.ts +6 -0
  195. package/lib/typescript/module/native/module.d.ts.map +1 -0
  196. package/lib/typescript/module/native/spec.d.ts +119 -0
  197. package/lib/typescript/module/native/spec.d.ts.map +1 -0
  198. package/lib/typescript/module/package.json +1 -0
  199. package/lib/typescript/module/purchases.d.ts +68 -0
  200. package/lib/typescript/module/purchases.d.ts.map +1 -0
  201. package/lib/typescript/module/types.d.ts +384 -0
  202. package/lib/typescript/module/types.d.ts.map +1 -0
  203. package/package.json +115 -0
  204. package/react-native.config.js +23 -0
  205. package/src/attribution.ts +56 -0
  206. package/src/identity.ts +133 -0
  207. package/src/index.ts +54 -0
  208. package/src/modules/analytics.ts +689 -0
  209. package/src/modules/attachments.ts +222 -0
  210. package/src/modules/crash-reporting.ts +1577 -0
  211. package/src/modules/ids.ts +41 -0
  212. package/src/modules/log.ts +56 -0
  213. package/src/modules/offline-store.ts +51 -0
  214. package/src/modules/performance.ts +589 -0
  215. package/src/native/module.ts +47 -0
  216. package/src/native/spec.ts +183 -0
  217. package/src/purchases.ts +214 -0
  218. package/src/types.ts +470 -0
@@ -0,0 +1,384 @@
1
+ /**
2
+ * SDK log level. String values match `RC.LogLevel` so the native bridge keeps
3
+ * parsing the same vocabulary on iOS and Android.
4
+ */
5
+ export declare const LOG_LEVEL: {
6
+ readonly VERBOSE: "VERBOSE";
7
+ readonly DEBUG: "DEBUG";
8
+ readonly INFO: "INFO";
9
+ readonly WARN: "WARN";
10
+ readonly ERROR: "ERROR";
11
+ };
12
+ export type LOG_LEVEL = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL];
13
+ /** Subscription package shape — same names as RC's `PACKAGE_TYPE`. */
14
+ export declare const PACKAGE_TYPE: {
15
+ readonly UNKNOWN: "UNKNOWN";
16
+ readonly CUSTOM: "CUSTOM";
17
+ readonly LIFETIME: "LIFETIME";
18
+ readonly ANNUAL: "ANNUAL";
19
+ readonly SIX_MONTH: "SIX_MONTH";
20
+ readonly THREE_MONTH: "THREE_MONTH";
21
+ readonly TWO_MONTH: "TWO_MONTH";
22
+ readonly MONTHLY: "MONTHLY";
23
+ readonly WEEKLY: "WEEKLY";
24
+ };
25
+ export type PACKAGE_TYPE = (typeof PACKAGE_TYPE)[keyof typeof PACKAGE_TYPE];
26
+ /**
27
+ * StoreKit version selection on iOS. We only support StoreKit 2 in Phase 5+,
28
+ * but the enum stays for source compatibility — `configure({ storeKitVersion:
29
+ * STOREKIT_VERSION.STOREKIT_2 })` is a no-op now.
30
+ */
31
+ export declare const STOREKIT_VERSION: {
32
+ readonly DEFAULT: "DEFAULT";
33
+ readonly STOREKIT_1: "STOREKIT_1";
34
+ readonly STOREKIT_2: "STOREKIT_2";
35
+ };
36
+ export type STOREKIT_VERSION = (typeof STOREKIT_VERSION)[keyof typeof STOREKIT_VERSION];
37
+ /** JWS / signed-response verification status. RC parity. */
38
+ export declare const VERIFICATION_RESULT: {
39
+ readonly NOT_REQUESTED: "NOT_REQUESTED";
40
+ readonly VERIFIED: "VERIFIED";
41
+ readonly FAILED: "FAILED";
42
+ readonly VERIFIED_ON_DEVICE: "VERIFIED_ON_DEVICE";
43
+ };
44
+ export type VERIFICATION_RESULT = (typeof VERIFICATION_RESULT)[keyof typeof VERIFICATION_RESULT];
45
+ /**
46
+ * Public error-code catalog. Values are string-numeric ("0", "1", "10", …)
47
+ * so they match what RC's TS package previously emitted. The native bridges
48
+ * `reject(code, ...)` with these stringified numeric codes and the JS mapper
49
+ * picks them up by string compare — DO NOT renumber.
50
+ *
51
+ * Code → name mapping is the RC catalog the platform-native sealed classes
52
+ * already mirror (see `PurchasesError.kt`/`Types.swift`). New codes go at the
53
+ * end, never reorder.
54
+ */
55
+ export declare const PURCHASES_ERROR_CODE: {
56
+ readonly UNKNOWN_ERROR: "0";
57
+ readonly PURCHASE_CANCELLED_ERROR: "1";
58
+ readonly STORE_PROBLEM_ERROR: "2";
59
+ readonly PURCHASE_NOT_ALLOWED_ERROR: "3";
60
+ readonly PURCHASE_INVALID_ERROR: "4";
61
+ readonly PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR: "5";
62
+ readonly PRODUCT_ALREADY_PURCHASED_ERROR: "6";
63
+ readonly RECEIPT_ALREADY_IN_USE_ERROR: "7";
64
+ readonly INVALID_RECEIPT_ERROR: "8";
65
+ readonly MISSING_RECEIPT_FILE_ERROR: "9";
66
+ readonly NETWORK_ERROR: "10";
67
+ readonly INVALID_CREDENTIALS_ERROR: "11";
68
+ readonly UNEXPECTED_BACKEND_RESPONSE_ERROR: "12";
69
+ readonly RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR: "13";
70
+ readonly INVALID_APP_USER_ID_ERROR: "14";
71
+ readonly OPERATION_ALREADY_IN_PROGRESS_ERROR: "15";
72
+ readonly UNKNOWN_BACKEND_ERROR: "16";
73
+ readonly INVALID_APPLE_SUBSCRIPTION_KEY_ERROR: "17";
74
+ readonly INELIGIBLE_ERROR: "18";
75
+ readonly INSUFFICIENT_PERMISSIONS_ERROR: "19";
76
+ readonly PAYMENT_PENDING_ERROR: "20";
77
+ readonly INVALID_SUBSCRIBER_ATTRIBUTES_ERROR: "21";
78
+ readonly LOG_OUT_ANONYMOUS_USER_ERROR: "22";
79
+ readonly CONFIGURATION_ERROR: "23";
80
+ readonly UNSUPPORTED_ERROR: "24";
81
+ readonly EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR: "25";
82
+ readonly CUSTOMER_INFO_ERROR: "28";
83
+ };
84
+ export type PURCHASES_ERROR_CODE = (typeof PURCHASES_ERROR_CODE)[keyof typeof PURCHASES_ERROR_CODE];
85
+ /**
86
+ * Thrown by `Purchases.<method>()` when called before `Purchases.configure(...)`.
87
+ * Matches the name + shape of RC's `UninitializedPurchasesError` so callers
88
+ * catching by class name keep working.
89
+ */
90
+ export declare class UninitializedPurchasesError extends Error {
91
+ constructor(message?: string);
92
+ }
93
+ /**
94
+ * Thrown when an API is called on an unsupported platform (e.g. web). Kept
95
+ * for source compatibility with RC.
96
+ */
97
+ export declare class UnsupportedPlatformError extends Error {
98
+ constructor(message?: string);
99
+ }
100
+ /**
101
+ * Plain-object error contract used on callback args and rejected promises.
102
+ * NOT an Error subclass — RC surfaces this as a value, not something thrown
103
+ * as a JS Error. Promise rejections from the native bridge come through as
104
+ * `Error` objects whose `code` and `message` fields match this shape.
105
+ */
106
+ export interface PurchasesError {
107
+ code: PURCHASES_ERROR_CODE;
108
+ message: string;
109
+ underlyingErrorMessage?: string;
110
+ readableErrorCode?: string;
111
+ }
112
+ /**
113
+ * Per-entitlement state. Field names match RC's `PurchasesEntitlementInfo`
114
+ * 1:1; populated by the native bridge from our own `EntitlementInfo` Swift /
115
+ * Kotlin types (see `packages/swiss-knife-{ios,android}`).
116
+ *
117
+ * Dates are ISO-8601 strings on the wire — JS doesn't get a native `Date`
118
+ * across the RN bridge.
119
+ */
120
+ export interface PurchasesEntitlementInfo {
121
+ identifier: string;
122
+ isActive: boolean;
123
+ willRenew: boolean;
124
+ latestPurchaseDate: string;
125
+ /** ms-since-epoch convenience field; some RC consumers grep for `_millis`. */
126
+ latestPurchaseDateMillis: number;
127
+ originalPurchaseDate: string | null;
128
+ originalPurchaseDateMillis: number | null;
129
+ expirationDate: string | null;
130
+ expirationDateMillis: number | null;
131
+ productIdentifier: string;
132
+ productPlanIdentifier: string | null;
133
+ isSandbox: boolean;
134
+ unsubscribeDetectedAt: string | null;
135
+ unsubscribeDetectedAtMillis: number | null;
136
+ billingIssueDetectedAt: string | null;
137
+ billingIssueDetectedAtMillis: number | null;
138
+ periodType: "NORMAL" | "INTRO" | "TRIAL" | "PREPAID";
139
+ store: "APP_STORE" | "MAC_APP_STORE" | "PLAY_STORE" | "STRIPE" | "PROMOTIONAL" | "AMAZON" | "RUSTORE" | "UNKNOWN_STORE";
140
+ ownershipType: "PURCHASED" | "FAMILY_SHARED" | "UNKNOWN";
141
+ verification: VERIFICATION_RESULT;
142
+ }
143
+ /** All entitlements the user has ever owned + the currently-active subset. */
144
+ export interface PurchasesEntitlementInfos {
145
+ all: {
146
+ [key: string]: PurchasesEntitlementInfo;
147
+ };
148
+ active: {
149
+ [key: string]: PurchasesEntitlementInfo;
150
+ };
151
+ verification: VERIFICATION_RESULT;
152
+ }
153
+ /** Subscription-only state per product (renewal status, period, etc.). */
154
+ export interface PurchasesSubscriptionInfo {
155
+ productIdentifier: string;
156
+ purchaseDate: string | null;
157
+ originalPurchaseDate: string | null;
158
+ expiresDate: string | null;
159
+ store: PurchasesEntitlementInfo["store"];
160
+ unsubscribeDetectedAt: string | null;
161
+ isSandbox: boolean;
162
+ billingIssuesDetectedAt: string | null;
163
+ gracePeriodExpiresDate: string | null;
164
+ ownershipType: PurchasesEntitlementInfo["ownershipType"];
165
+ periodType: PurchasesEntitlementInfo["periodType"];
166
+ refundedAt: string | null;
167
+ storeTransactionId: string | null;
168
+ isActive: boolean;
169
+ willRenew: boolean;
170
+ }
171
+ /** One non-subscription IAP transaction (consumable/non-consumable). */
172
+ export interface PurchasesStoreTransaction {
173
+ productIdentifier: string;
174
+ revenueCatId: string;
175
+ purchaseDate: string;
176
+ /** Raw store transaction id (App Store `transactionIdentifier` or Play `orderId`). */
177
+ storeTransactionId: string;
178
+ }
179
+ /**
180
+ * Top-level user-level state, populated from our own `CustomerInfo` types on
181
+ * the native side. Field names track RC's `CustomerInfo` shape.
182
+ */
183
+ export interface CustomerInfo {
184
+ entitlements: PurchasesEntitlementInfos;
185
+ /** Active entitlement identifiers — convenience accessor. */
186
+ activeSubscriptions: string[];
187
+ allPurchasedProductIdentifiers: string[];
188
+ /** Product id → most recent purchase date (ISO-8601). */
189
+ allPurchaseDates: {
190
+ [key: string]: string | null;
191
+ };
192
+ /** Per-product subscription info, keyed by product id. */
193
+ subscriptionsByProductIdentifier: {
194
+ [key: string]: PurchasesSubscriptionInfo;
195
+ };
196
+ /** Non-subscription IAPs (consumables, one-time non-consumables). */
197
+ nonSubscriptionTransactions: PurchasesStoreTransaction[];
198
+ firstSeen: string;
199
+ /** ms-since-epoch convenience field. */
200
+ firstSeenMillis: number;
201
+ originalAppUserId: string;
202
+ requestDate: string;
203
+ requestDateMillis: number;
204
+ latestExpirationDate: string | null;
205
+ latestExpirationDateMillis: number | null;
206
+ originalPurchaseDate: string | null;
207
+ originalPurchaseDateMillis: number | null;
208
+ originalApplicationVersion: string | null;
209
+ managementURL: string | null;
210
+ }
211
+ /** Localized price + currency on a store product. Mirror of RC's `PurchasesStoreProductPrice`. */
212
+ export interface PurchasesStoreProductPrice {
213
+ /** Pre-formatted, localized price string from the store. */
214
+ formatted: string;
215
+ /** Numeric amount in the smallest unit of the currency. */
216
+ amountMicros: number;
217
+ /** ISO-4217 currency code. */
218
+ currencyCode: string;
219
+ }
220
+ /** Subscription period on a store product. */
221
+ export interface PurchasesSubscriptionPeriod {
222
+ unit: "DAY" | "WEEK" | "MONTH" | "YEAR";
223
+ value: number;
224
+ }
225
+ /** Intro / promotional offer on a store product. */
226
+ export interface PurchasesStoreProductDiscount {
227
+ identifier: string | null;
228
+ price: number;
229
+ priceString: string;
230
+ cycles: number;
231
+ period: PurchasesSubscriptionPeriod;
232
+ periodUnit: PurchasesSubscriptionPeriod["unit"];
233
+ periodNumberOfUnits: number;
234
+ }
235
+ /** One store product (subscription or non-subscription). */
236
+ export interface PurchasesStoreProduct {
237
+ identifier: string;
238
+ title: string;
239
+ description: string;
240
+ priceString: string;
241
+ price: number;
242
+ currencyCode: string;
243
+ productCategory: "SUBSCRIPTION" | "NON_SUBSCRIPTION";
244
+ productType: "AUTO_RENEWABLE_SUBSCRIPTION" | "NON_RENEWABLE_SUBSCRIPTION" | "NON_CONSUMABLE" | "CONSUMABLE" | "UNKNOWN";
245
+ subscriptionPeriod: string | null;
246
+ defaultOption: string | null;
247
+ subscriptionOptions: unknown[] | null;
248
+ presentedOfferingContext: PresentedOfferingContext | null;
249
+ introPrice: PurchasesStoreProductDiscount | null;
250
+ discounts: PurchasesStoreProductDiscount[] | null;
251
+ pricePerWeek: PurchasesStoreProductPrice | null;
252
+ pricePerMonth: PurchasesStoreProductPrice | null;
253
+ pricePerYear: PurchasesStoreProductPrice | null;
254
+ pricePerWeekString: string | null;
255
+ pricePerMonthString: string | null;
256
+ pricePerYearString: string | null;
257
+ }
258
+ /**
259
+ * The offering / package / target context surfaced when a package is presented.
260
+ * `targetingContext` is RC-server-driven A/B test metadata; preserved for parity.
261
+ */
262
+ export interface PresentedOfferingContext {
263
+ offeringIdentifier: string;
264
+ placementIdentifier: string | null;
265
+ targetingContext: {
266
+ revision: number;
267
+ ruleId: string;
268
+ } | null;
269
+ }
270
+ /** A purchasable package inside an offering. */
271
+ export interface PurchasesPackage {
272
+ identifier: string;
273
+ packageType: PACKAGE_TYPE;
274
+ product: PurchasesStoreProduct;
275
+ presentedOfferingContext: PresentedOfferingContext;
276
+ /** RC legacy: same as `presentedOfferingContext.offeringIdentifier`. */
277
+ offeringIdentifier: string;
278
+ }
279
+ /** A named group of packages — a paywall variant. */
280
+ export interface PurchasesOffering {
281
+ identifier: string;
282
+ serverDescription: string;
283
+ metadata: {
284
+ [key: string]: unknown;
285
+ };
286
+ availablePackages: PurchasesPackage[];
287
+ lifetime: PurchasesPackage | null;
288
+ annual: PurchasesPackage | null;
289
+ sixMonth: PurchasesPackage | null;
290
+ threeMonth: PurchasesPackage | null;
291
+ twoMonth: PurchasesPackage | null;
292
+ monthly: PurchasesPackage | null;
293
+ weekly: PurchasesPackage | null;
294
+ paywall: unknown | null;
295
+ paywallComponents: unknown | null;
296
+ }
297
+ /** Top-level offerings container. */
298
+ export interface PurchasesOfferings {
299
+ all: {
300
+ [key: string]: PurchasesOffering;
301
+ };
302
+ current: PurchasesOffering | null;
303
+ }
304
+ /** Returned by `Purchases.logIn(appUserID)`. */
305
+ export interface LogInResult {
306
+ customerInfo: CustomerInfo;
307
+ /** Whether the backend treated this as a brand-new user record. */
308
+ created: boolean;
309
+ }
310
+ /**
311
+ * Immutable snapshot of the current identity. Mirrors
312
+ * `SwissKnife.Identity.Snapshot` (iOS) and
313
+ * `com.appswissknife.identity.Identity.Snapshot` (Android).
314
+ *
315
+ * The `anonymousId` carries the unified `$SKAnonymousID:` prefix as of
316
+ * Wave 1 (was `$RCAnonymousID:` on Android pre-Wave-1).
317
+ */
318
+ export interface IdentitySnapshot {
319
+ anonymousId: string;
320
+ userId: string | null;
321
+ isAnonymous: boolean;
322
+ }
323
+ /** Delivered to `Identity.addObserver` callbacks on every transition. */
324
+ export interface IdentityChange {
325
+ previous: IdentitySnapshot;
326
+ current: IdentitySnapshot;
327
+ }
328
+ /**
329
+ * Resolved attribution for the install. Mirrors
330
+ * `SwissKnife.Attribution.ResolvedAttribution` (iOS) and
331
+ * `Attribution.ResolvedAttribution` (Android).
332
+ */
333
+ export interface ResolvedAttribution {
334
+ /** One of `"advertising_id" | "referrer" | "fingerprint" | "organic"`. */
335
+ method: string;
336
+ /** Backend campaign id when the install matched a campaign; `null` otherwise. */
337
+ campaignId: string | null;
338
+ /** Epoch milliseconds when the SDK persisted the resolution. */
339
+ resolvedAt: number;
340
+ }
341
+ /** Returned by `Purchases.purchasePackage(...)` / `purchaseStoreProduct(...)`. */
342
+ export interface MakePurchaseResult {
343
+ productIdentifier: string;
344
+ customerInfo: CustomerInfo;
345
+ transaction: PurchasesStoreTransaction | null;
346
+ }
347
+ /** Options accepted by `Purchases.configure(...)`. Mirror of `PurchasesConfiguration`. */
348
+ export interface PurchasesConfiguration {
349
+ apiKey: string;
350
+ appUserID?: string | null;
351
+ /** Override the backend host — primarily used in our own configuration to point at our backend rather than RC's. */
352
+ proxyURL?: string | null;
353
+ /** Whether to phone home diagnostics. DEFAULTS TO FALSE in our SDK. */
354
+ diagnosticsEnabled?: boolean;
355
+ storeKitVersion?: STOREKIT_VERSION;
356
+ /**
357
+ * iOS App Tracking Transparency. When `true`, the SDK shows the system ATT
358
+ * prompt on first launch (requires `NSUserTrackingUsageDescription` in
359
+ * Info.plist). **Defaults to `false`** — the SDK never prompts for tracking
360
+ * unless you opt in. iOS-only; ignored on Android.
361
+ */
362
+ autoPromptATT?: boolean;
363
+ /**
364
+ * Register an organic install on first launch (no IDFA, no prompt) so
365
+ * attribution still resolves without ATT. Default `true`. iOS-only.
366
+ */
367
+ sendInstallOnFirstLaunch?: boolean;
368
+ /** Reserved for the Amazon flavor — ignored on iOS / Play Android. */
369
+ useAmazon?: boolean;
370
+ /** Reserved for the legacy bridge; ignored. */
371
+ usesStoreKit2IfAvailable?: boolean;
372
+ /** RC-shim — kept so configs the consumer copied from RC docs still compile. */
373
+ userDefaultsSuiteName?: string;
374
+ shouldShowInAppMessagesAutomatically?: boolean;
375
+ entitlementVerificationMode?: string;
376
+ pendingTransactionsForPrepaidPlansEnabled?: boolean;
377
+ }
378
+ /**
379
+ * Callback signature for `Purchases.addCustomerInfoUpdateListener(fn)`. Fires
380
+ * on every CustomerInfo refresh (post-purchase, post-restore, dashboard-grant
381
+ * silent-push, etc.).
382
+ */
383
+ export type CustomerInfoUpdateListener = (customerInfo: CustomerInfo) => void;
384
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,sEAAsE;AACtE,eAAO,MAAM,YAA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AAG,IAAI,CAAC;CAC/C;AAID,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oHAAoH;IACpH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,gBAAgB,CAAC;IACnC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oCAAoC,CAAC,EAAE,OAAO,CAAC;IAC/C,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,yCAAyC,CAAC,EAAE,OAAO,CAAC;CACrD;AAID;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ResolvedAttribution } from "./types.js";
2
+ export declare const Attribution: {
3
+ /**
4
+ * The most recent resolved attribution from the native disk-backed
5
+ * cache. Returns `null` when no install POST has succeeded yet.
6
+ * Cheap — does not hit the network.
7
+ */
8
+ resolved(): Promise<ResolvedAttribution | null>;
9
+ /**
10
+ * Auto-collect (ATT prompt + IDFA on iOS; advertising_id +
11
+ * install_referrer on Android) and POST `/api/sdk/attribution/install`.
12
+ * Idempotent — second call returns the cached resolution WITHOUT
13
+ * re-prompting or re-POSTing.
14
+ */
15
+ requestAndRegister(): Promise<ResolvedAttribution | null>;
16
+ /**
17
+ * Manual install registration for hosts that prompt for tracking
18
+ * consent themselves or collect the advertising id outside the SDK.
19
+ * Pass `null` when consent was denied. Idempotent.
20
+ */
21
+ registerInstall(advertisingId?: string | null): Promise<ResolvedAttribution | null>;
22
+ };
23
+ export type { ResolvedAttribution } from "./types.js";
24
+ //# sourceMappingURL=attribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribution.d.ts","sourceRoot":"","sources":["../../../src/attribution.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC;AAEnD,eAAO,MAAM,WAAW;IACtB;;;;OAIG;gBACe,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAIrD;;;;;OAKG;0BACyB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAI/D;;;;OAIG;oCAEe,MAAM,GAAG,IAAI,GAC5B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAGvC,CAAC;AAEF,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { IdentityChange, IdentitySnapshot, LogInResult } from "./types.js";
2
+ type Observer = (change: IdentityChange) => void;
3
+ export declare const Identity: {
4
+ /**
5
+ * Latest known identity snapshot. The first call hits the bridge;
6
+ * subsequent calls return the cached value updated by
7
+ * `logIn` / `logOut` / `reset` / `wipe`. Returns `null` only before
8
+ * the bridge has resolved.
9
+ */
10
+ current(): Promise<IdentitySnapshot>;
11
+ /**
12
+ * Identify this device as a known user. Native posts the
13
+ * `(anonymous_id, user_id)` pair to `/api/sdk/users/identify` (the
14
+ * Wave 1 bug-fix; pre-Wave-1 Android did NOT post). Resolves once
15
+ * the backend ack + post-identify entitlements refresh complete.
16
+ */
17
+ logIn(userId: string): Promise<LogInResult>;
18
+ /** Revert to anonymous. DeviceID stays stable across logout. */
19
+ logOut(): Promise<void>;
20
+ /**
21
+ * Rotate in-memory state but keep persistent storage. Matches the
22
+ * "switch test user" UX semantic.
23
+ */
24
+ reset(): Promise<void>;
25
+ /**
26
+ * Hard wipe: clear Keychain (iOS) / EncryptedSharedPreferences
27
+ * (Android) DeviceID. GDPR-delete / test-build cleanup.
28
+ */
29
+ wipe(): Promise<void>;
30
+ /** Subscribe to identity changes. Returns an unsubscribe token. */
31
+ addObserver(block: Observer): string;
32
+ removeObserver(token: string): void;
33
+ /** @internal Test seam — reset the cached snapshot + observers. */
34
+ __resetForTests(): void;
35
+ };
36
+ export type { IdentitySnapshot, IdentityChange } from "./types.js";
37
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/identity.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAE7E,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;AAmCjD,eAAO,MAAM,QAAQ;IACnB;;;;;OAKG;eACc,OAAO,CAAC,gBAAgB,CAAC;IAM1C;;;;;OAKG;kBACiB,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMjD,gEAAgE;cAChD,OAAO,CAAC,IAAI,CAAC;IAK7B;;;OAGG;aACY,OAAO,CAAC,IAAI,CAAC;IAK5B;;;OAGG;YACW,OAAO,CAAC,IAAI,CAAC;IAK3B,mEAAmE;uBAChD,QAAQ,GAAG,MAAM;0BAMd,MAAM,GAAG,IAAI;IAInC,mEAAmE;uBAChD,IAAI;CAIxB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ import Purchases from "./purchases.js";
2
+ export default Purchases;
3
+ export { Purchases };
4
+ export * from "./types.js";
5
+ export { Identity } from "./identity.js";
6
+ export type { IdentitySnapshot, IdentityChange } from "./identity.js";
7
+ export { Attribution } from "./attribution.js";
8
+ export type { ResolvedAttribution } from "./attribution.js";
9
+ export { Analytics, SKIdentify, SKRevenue } from "./modules/analytics.js";
10
+ export type { SKAnalyticsConfig, SKEvent } from "./modules/analytics.js";
11
+ export { CrashReporting, SKErrorBoundary, parseStackTrace, } from "./modules/crash-reporting.js";
12
+ export type { CrashReportingConfig, SKCrashEvent, SKCrashBreadcrumb, SKCrashUser, } from "./modules/crash-reporting.js";
13
+ export { Performance } from "./modules/performance.js";
14
+ export type { PerformanceConfig, SKTransaction, SKSpan, SKStallMeasurements, } from "./modules/performance.js";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAa,CAAC;AAGpC,eAAe,SAAS,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,CAAC;AAKrB,cAAc,YAAS,CAAC;AAOxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAY,CAAC;AAOnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAe,CAAC;AAMzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAqB,CAAC;AACvE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,wBAAqB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,8BAA2B,CAAC;AACnC,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,8BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAAuB,CAAC;AACpD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,mBAAmB,GACpB,MAAM,0BAAuB,CAAC"}
@@ -0,0 +1,127 @@
1
+ export interface SKAnalyticsConfig {
2
+ apiKey: string;
3
+ serverURL?: string;
4
+ flushQueueSize?: number;
5
+ flushIntervalMs?: number;
6
+ optOut?: boolean;
7
+ trackingSessionEvents?: boolean;
8
+ }
9
+ export interface SKEvent {
10
+ /**
11
+ * Client-supplied idempotency key (UUID). Generated in JS at event-create
12
+ * time so the key is stable across bridge crashes and the backend dedupes
13
+ * via the `(app_project_id, event_id)` unique index. See the module
14
+ * doc-comment for the rationale.
15
+ */
16
+ event_id: string;
17
+ event_type: string;
18
+ event_properties?: Record<string, unknown>;
19
+ user_id?: string;
20
+ /**
21
+ * Wave 1: derived from the native Identity snapshot at event-build
22
+ * time. Carries the unified `$SKAnonymousID:` prefix on both iOS and
23
+ * Android.
24
+ */
25
+ anonymous_id?: string;
26
+ device_id?: string;
27
+ /**
28
+ * Post-#136 audit: now a UUID string sourced from the native
29
+ * `Session.shared` primitive (was `Date.now()` number which diverged
30
+ * from envelope-level `ContextSnapshot.session_id`). Optional so
31
+ * synthetic events constructed by callers (tests / overrides) can
32
+ * still omit it without a typecheck error.
33
+ */
34
+ session_id?: string;
35
+ time?: number;
36
+ platform?: string;
37
+ os_name?: string;
38
+ user_properties?: Record<string, unknown>;
39
+ groups?: Record<string, unknown>;
40
+ }
41
+ export declare class SKIdentify {
42
+ private operations;
43
+ set(property: string, value: unknown): this;
44
+ setOnce(property: string, value: unknown): this;
45
+ unset(property: string): this;
46
+ add(property: string, value: number): this;
47
+ append(property: string, value: unknown): this;
48
+ prepend(property: string, value: unknown): this;
49
+ remove(property: string, value: unknown): this;
50
+ union(property: string, values: unknown[]): this;
51
+ clearAll(): this;
52
+ /** @internal */
53
+ _getOperations(): {
54
+ op: string;
55
+ key?: string;
56
+ value?: unknown;
57
+ }[];
58
+ }
59
+ export declare class SKRevenue {
60
+ productId: string;
61
+ quantity: number;
62
+ price: number;
63
+ revenueType?: string;
64
+ receipt?: string;
65
+ eventProperties?: Record<string, unknown>;
66
+ }
67
+ export declare const Analytics: {
68
+ /**
69
+ * Configure the analytics SDK. Kicks off (but does not block on) the native
70
+ * `device_id` fetch — callers do not need to `await init()`. Events tracked
71
+ * before the native promise resolves are still sent with `device_id`
72
+ * stamped because `track()` internally awaits the native promise before
73
+ * crossing the bridge.
74
+ */
75
+ init(config: SKAnalyticsConfig): Promise<void>;
76
+ track(eventType: string, eventProperties?: Record<string, unknown>): void;
77
+ trackScreen(name: string, properties?: Record<string, unknown>): void;
78
+ setUserId(userId: string | undefined): void;
79
+ getUserId(): string | undefined;
80
+ /**
81
+ * Override the device id. Useful for tests and for consumers who want to
82
+ * tie analytics to an external identity. Once called, the native bridge
83
+ * value is ignored for the lifetime of this Analytics module (until
84
+ * `reset()`).
85
+ */
86
+ setDeviceId(deviceId: string): void;
87
+ /**
88
+ * Returns the resolved device id, or `null` if the native bridge has not yet
89
+ * resolved AND no explicit override has been set. Most callers should await
90
+ * `init()` first.
91
+ */
92
+ getDeviceId(): string | null;
93
+ /**
94
+ * Current session id from the native `Session.shared` primitive.
95
+ * Returns `null` until the first `track()` (or explicit await on
96
+ * `init()`'s session warm) has resolved the native call. Pre-audit
97
+ * this returned a `Date.now()` number; the new return type is `string |
98
+ * null` reflecting both the native UUID format and the lazy resolution.
99
+ */
100
+ getSessionId(): string | null;
101
+ identify(identify: SKIdentify): void;
102
+ registerSuperProperties(properties: Record<string, unknown>): void;
103
+ registerSuperPropertiesOnce(properties: Record<string, unknown>): void;
104
+ getSuperProperties(): Record<string, unknown>;
105
+ unregisterSuperProperty(property: string): void;
106
+ clearSuperProperties(): void;
107
+ timeEvent(eventName: string): void;
108
+ addGroup(groupType: string, groupName: string): void;
109
+ reset(): void;
110
+ setGroup(groupType: string, groupName: string | string[]): void;
111
+ groupIdentify(groupType: string, groupName: string, identify: SKIdentify): void;
112
+ revenue(revenue: SKRevenue): void;
113
+ trackCharge(amount: number, properties?: Record<string, unknown>): void;
114
+ /**
115
+ * Ask the native side to flush its disk-backed queue. Fire-and-forget — the
116
+ * actual HTTP work runs natively (iOS GCD with back-off; Android
117
+ * WorkManager). This promise resolves as soon as the flush job is scheduled.
118
+ *
119
+ * No-op when the bridge is not linked (we don't keep a JS-side queue any
120
+ * more — there's nothing to send). Errors are swallowed with a single warning
121
+ * so background flushers don't crash the host app.
122
+ */
123
+ flush(): Promise<void>;
124
+ setOptOut(optOut: boolean): void;
125
+ shutdown(): void;
126
+ };
127
+ //# sourceMappingURL=analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../../src/modules/analytics.ts"],"names":[],"mappings":"AAuEA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,OAAO;IACtB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAA4D;IAE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