@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,50 @@
1
+ /**
2
+ * Decode a base64 string into a Uint8Array without relying on `atob` or
3
+ * `Buffer` (neither is guaranteed across RN JS engines). Whitespace and
4
+ * padding are tolerated; any other non-alphabet character is skipped.
5
+ */
6
+ export declare function base64ToUint8Array(base64: string): Uint8Array;
7
+ /**
8
+ * Minimal UTF-8 encoder — `TextEncoder` is not available on every RN
9
+ * JS engine version, and the multipart headers must be byte-exact.
10
+ */
11
+ export declare function encodeUtf8(text: string): Uint8Array;
12
+ export interface MultipartTextField {
13
+ name: string;
14
+ value: string;
15
+ }
16
+ export interface MultipartFilePart {
17
+ name: string;
18
+ filename: string;
19
+ contentType: string;
20
+ data: Uint8Array;
21
+ }
22
+ /**
23
+ * Serialize a multipart/form-data body: text fields first, then the file
24
+ * part with raw binary content, closed with the terminal boundary.
25
+ */
26
+ export declare function buildMultipartBody(boundary: string, fields: MultipartTextField[], file: MultipartFilePart): Uint8Array;
27
+ export interface AttachmentUploadOptions {
28
+ serverURL: string;
29
+ apiKey: string;
30
+ /** Error event this attachment belongs to. */
31
+ eventId: string;
32
+ kind: "screenshot" | "view_hierarchy" | "log";
33
+ contentType: string;
34
+ data: Uint8Array;
35
+ /** Bypass fetch patches (breadcrumb/perf instrumentation). */
36
+ fetchFn?: typeof fetch;
37
+ }
38
+ /**
39
+ * - "ok" → 2xx, attachment stored
40
+ * - "transient" → network error / 429 / 5xx — worth one retry
41
+ * - "permanent" → other 4xx (validation, over-limit) — do not retry
42
+ */
43
+ export type AttachmentUploadResult = "ok" | "transient" | "permanent";
44
+ export declare function uploadAttachment(options: AttachmentUploadOptions): Promise<AttachmentUploadResult>;
45
+ /**
46
+ * Fire the upload with AT MOST one retry (transient failures only).
47
+ * Never throws — attachment delivery must never block event delivery.
48
+ */
49
+ export declare function uploadAttachmentWithRetry(options: AttachmentUploadOptions): Promise<AttachmentUploadResult>;
50
+ //# sourceMappingURL=attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../../src/modules/attachments.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAe7D;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAyBnD;AAID,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;CAClB;AAgBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,kBAAkB,EAAE,EAC5B,IAAI,EAAE,iBAAiB,GACtB,UAAU,CAqBZ;AAID,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,YAAY,GAAG,gBAAgB,GAAG,KAAK,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC;AAEtE,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAyCjC;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAIjC"}
@@ -0,0 +1,175 @@
1
+ import React from "react";
2
+ export interface CrashReportingConfig {
3
+ apiKey: string;
4
+ serverURL?: string;
5
+ environment?: string;
6
+ release?: string;
7
+ /** Distribution identifier (e.g. build number). Sent top-level on every
8
+ * event and mirrored into `contexts.app.dist`. */
9
+ dist?: string;
10
+ maxBreadcrumbs?: number;
11
+ enableAutoBreadcrumbs?: boolean;
12
+ /** Called before sending each event. Return null to drop the event. */
13
+ beforeSend?: (event: SKCrashEvent) => SKCrashEvent | null;
14
+ /**
15
+ * Called for EVERY breadcrumb (manual and auto-instrumented) before it is
16
+ * buffered. Return null to drop the crumb; return a (possibly mutated)
17
+ * crumb to keep it. A throwing hook drops the crumb.
18
+ */
19
+ beforeBreadcrumb?: (breadcrumb: SKCrashBreadcrumb) => SKCrashBreadcrumb | null;
20
+ /** Error event sample rate (0.0 to 1.0, default 1.0). */
21
+ sampleRate?: number;
22
+ /** Performance transaction sample rate (0.0 to 1.0, default 1.0). */
23
+ tracesSampleRate?: number;
24
+ /**
25
+ * Cap on items persisted to the offline store (events + fatal-path
26
+ * screenshots each count as one item). Drop-oldest. Default 30.
27
+ */
28
+ maxCacheItems?: number;
29
+ /** Attach a synthetic stacktrace (current call stack) to captureMessage
30
+ * events. Default false. */
31
+ attachStacktrace?: boolean;
32
+ /**
33
+ * Capture a masked screenshot via the native bridge on captureException
34
+ * and on the fatal path, and upload it as an event attachment after the
35
+ * event has been delivered. No-op when the native module (or its
36
+ * captureScreenshot method) is absent. Default false.
37
+ */
38
+ attachScreenshot?: boolean;
39
+ }
40
+ export interface SKCrashBreadcrumb {
41
+ category?: string;
42
+ message?: string;
43
+ data?: Record<string, unknown>;
44
+ level?: string;
45
+ timestamp?: number;
46
+ }
47
+ export interface SKCrashUser {
48
+ id?: string;
49
+ email?: string;
50
+ username?: string;
51
+ }
52
+ export interface SKParsedFrame {
53
+ filename?: string;
54
+ function?: string;
55
+ lineno?: number;
56
+ colno?: number;
57
+ inApp: boolean;
58
+ }
59
+ export interface SKCrashEvent {
60
+ eventId: string;
61
+ timestamp: number;
62
+ level: "debug" | "info" | "warning" | "error" | "fatal";
63
+ message?: string;
64
+ exceptionType?: string;
65
+ exceptionValue?: string;
66
+ stacktrace?: SKParsedFrame[];
67
+ breadcrumbs?: SKCrashBreadcrumb[];
68
+ tags?: Record<string, string>;
69
+ extra?: Record<string, unknown>;
70
+ user?: SKCrashUser | null;
71
+ environment?: string;
72
+ release?: string;
73
+ dist?: string;
74
+ platform: string;
75
+ mechanism?: string;
76
+ /** `false` for events captured by the SDK's global hooks (fatal errors,
77
+ * unhandled promise rejections); unset for manual captures. */
78
+ handled?: boolean;
79
+ contexts?: Record<string, unknown>;
80
+ }
81
+ interface SKCrashScope {
82
+ setTag: (key: string, value: string) => void;
83
+ setExtra: (key: string, value: unknown) => void;
84
+ setUser: (user: SKCrashUser | null) => void;
85
+ }
86
+ /**
87
+ * Parse a JS Error stack string into structured frames.
88
+ * Handles both V8/Hermes formats:
89
+ * at functionName (filename.js:line:col)
90
+ * at filename.js:line:col
91
+ */
92
+ export declare function parseStackTrace(stack: string): SKParsedFrame[];
93
+ interface RNPlatformConstants {
94
+ systemName?: string;
95
+ osVersion?: string;
96
+ Release?: string;
97
+ Model?: string;
98
+ Brand?: string;
99
+ Manufacturer?: string;
100
+ Fingerprint?: string;
101
+ }
102
+ export interface PlatformLike {
103
+ OS: string;
104
+ Version?: string | number;
105
+ isTesting?: boolean;
106
+ constants?: RNPlatformConstants;
107
+ }
108
+ /**
109
+ * Derive `contexts.device` / `contexts.os` from react-native's Platform.
110
+ * JS-only — iOS exposes no device model over Platform, so `model` is
111
+ * Android-only; simulator detection uses the Android build fingerprint
112
+ * (with `Platform.isTesting` as the cross-platform fallback).
113
+ */
114
+ export declare function buildStaticContexts(platform: PlatformLike): Record<string, unknown>;
115
+ export declare const CrashReporting: {
116
+ init(config: CrashReportingConfig): void;
117
+ captureException(error: Error, options?: {
118
+ tags?: Record<string, string>;
119
+ }): {
120
+ eventId: string;
121
+ };
122
+ captureEvent(partial: Partial<SKCrashEvent>): {
123
+ eventId: string;
124
+ };
125
+ captureMessage(message: string, level?: "debug" | "info" | "warning" | "error" | "fatal"): void;
126
+ captureUserFeedback(feedback: {
127
+ eventId: string;
128
+ name?: string;
129
+ email?: string;
130
+ comments: string;
131
+ }): void;
132
+ addBreadcrumb(breadcrumb: SKCrashBreadcrumb): void;
133
+ setUser(user: SKCrashUser | null): void;
134
+ setTag(key: string, value: string): void;
135
+ setExtra(key: string, value: unknown): void;
136
+ configureScope(callback: (scope: SKCrashScope) => void): void;
137
+ flush(options?: {
138
+ timeoutMs?: number;
139
+ }): Promise<void>;
140
+ _reset(): void;
141
+ _snapshotBreadcrumbs(): SKCrashBreadcrumb[];
142
+ _snapshotPendingEvents(): SKCrashEvent[];
143
+ _snapshotBackoff(): {
144
+ backoffMs: number;
145
+ backoffUntil: number;
146
+ };
147
+ _snapshotSessionId(): string | null;
148
+ _restorePromiseForTests(): Promise<void> | null;
149
+ /** Test seam: override native screenshot capture (offline-store pattern).
150
+ * `null` = native absent; `undefined` = resolve from NativeModules. */
151
+ _setScreenshotCaptureForTests(fn: (() => Promise<string | null>) | null | undefined): void;
152
+ _snapshotOfflineScreenshots(): Array<{
153
+ eventId: string;
154
+ base64: string;
155
+ }>;
156
+ _pendingScreenshotCountForTests(): number;
157
+ _simulateAppState(nextState: string): void;
158
+ };
159
+ export interface SKErrorBoundaryProps {
160
+ children: React.ReactNode;
161
+ fallback?: React.ReactNode;
162
+ onError?: (error: Error, info: React.ErrorInfo) => void;
163
+ }
164
+ export interface SKErrorBoundaryState {
165
+ hasError: boolean;
166
+ error: Error | null;
167
+ }
168
+ export declare class SKErrorBoundary extends React.Component<SKErrorBoundaryProps, SKErrorBoundaryState> {
169
+ constructor(props: SKErrorBoundaryProps);
170
+ static getDerivedStateFromError(error: Error): SKErrorBoundaryState;
171
+ componentDidCatch(error: Error, info: React.ErrorInfo): void;
172
+ render(): React.ReactNode;
173
+ }
174
+ export {};
175
+ //# sourceMappingURL=crash-reporting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crash-reporting.d.ts","sourceRoot":"","sources":["../../../../src/modules/crash-reporting.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,MAAM,OAAO,CAAC;AAyD1B,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM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0 +1,17 @@
1
+ /**
2
+ * RFC 4122 v4 UUID generator. Cryptographically weak (uses
3
+ * `Math.random()`), suitable for analytics idempotency keys and trace
4
+ * correlation; do NOT use for security tokens.
5
+ */
6
+ export declare function generateUUID(): string;
7
+ /**
8
+ * Sentry-style 32-hex-char trace id (UUIDv4 with dashes stripped).
9
+ * Used by `SKTransaction` to correlate spans within a transaction.
10
+ */
11
+ export declare function generateTraceId(): string;
12
+ /**
13
+ * Sentry-style 16-hex-char span id (first half of a UUIDv4 with dashes
14
+ * stripped). Used by `SKSpan` and `SKTransaction.spanId`.
15
+ */
16
+ export declare function generateSpanId(): string;
17
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../../src/modules/ids.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAMrC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
@@ -0,0 +1,12 @@
1
+ type LogLevel = "debug" | "info" | "warn" | "error";
2
+ /** Override the JS-side threshold. Mirrors `SKLog.setLevel(...)` on
3
+ * native. Hosts that want chatty logs in dev set `"debug"` here. */
4
+ export declare function setLogLevel(level: LogLevel): void;
5
+ export declare const SKLog: {
6
+ debug(category: string, message: string): void;
7
+ info(category: string, message: string): void;
8
+ warn(category: string, message: string): void;
9
+ error(category: string, message: string): void;
10
+ };
11
+ export {};
12
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/modules/log.ts"],"names":[],"mappings":"AAiBA,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAepD;qEACqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAEjD;AAED,eAAO,MAAM,KAAK;oBACA,MAAM,WAAW,MAAM,GAAG,IAAI;mBAI/B,MAAM,WAAW,MAAM,GAAG,IAAI;mBAI9B,MAAM,WAAW,MAAM,GAAG,IAAI;oBAI7B,MAAM,WAAW,MAAM,GAAG,IAAI;CAI/C,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface SKKeyValueStorage {
2
+ getItem(key: string): Promise<string | null>;
3
+ setItem(key: string, value: string): Promise<void>;
4
+ removeItem(key: string): Promise<void>;
5
+ }
6
+ export declare function getOfflineStorage(): SKKeyValueStorage | null;
7
+ /** Test seam: inject a fake storage. Pass `undefined` to force re-resolution. */
8
+ export declare function _setOfflineStorageForTests(storage: SKKeyValueStorage | null | undefined): void;
9
+ //# sourceMappingURL=offline-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offline-store.d.ts","sourceRoot":"","sources":["../../../../src/modules/offline-store.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAKD,wBAAgB,iBAAiB,IAAI,iBAAiB,GAAG,IAAI,CAkB5D;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC5C,IAAI,CAEN"}
@@ -0,0 +1,75 @@
1
+ export interface PerformanceConfig {
2
+ apiKey: string;
3
+ serverURL?: string;
4
+ environment?: string;
5
+ release?: string;
6
+ enableAutoHTTP?: boolean;
7
+ /** Transaction sample rate (0.0 to 1.0, default 1.0). */
8
+ tracesSampleRate?: number;
9
+ /**
10
+ * Per-transaction sampler, called at `startTransaction` time. Overrides
11
+ * `tracesSampleRate` for that transaction. The returned rate is clamped
12
+ * to 0..1; a non-finite return value or a throw falls back to
13
+ * `tracesSampleRate`.
14
+ */
15
+ tracesSampler?: (context: {
16
+ name: string;
17
+ op?: string;
18
+ }) => number;
19
+ }
20
+ /** Stall aggregation attached to the transaction payload as `measurements`. */
21
+ export interface SKStallMeasurements {
22
+ stallCount: number;
23
+ stallTotalMs: number;
24
+ stallLongestMs: number;
25
+ }
26
+ export interface SKTransaction {
27
+ traceId: string;
28
+ spanId: string;
29
+ name: string;
30
+ op: string;
31
+ startChild(op: string, description?: string): SKSpan;
32
+ finish(status?: string): void;
33
+ setTag(key: string, value: string): void;
34
+ setData(key: string, value: unknown): void;
35
+ }
36
+ export interface SKSpan {
37
+ spanId: string;
38
+ parentSpanId: string;
39
+ op: string;
40
+ description?: string;
41
+ startChild(op: string, description?: string): SKSpan;
42
+ finish(status?: string): void;
43
+ setTag(key: string, value: string): void;
44
+ setData(key: string, value: unknown): void;
45
+ }
46
+ /**
47
+ * Creates an onStateChange handler for React Navigation that automatically
48
+ * tracks screen transitions as transactions.
49
+ *
50
+ * Usage:
51
+ * ```
52
+ * const onStateChange = Performance.createNavigationTracker();
53
+ * <NavigationContainer onStateChange={onStateChange}>
54
+ * ```
55
+ */
56
+ declare function createNavigationTracker(): (state: unknown) => void;
57
+ export declare const Performance: {
58
+ init(config: PerformanceConfig): void;
59
+ startTransaction(name: string, op: string): SKTransaction;
60
+ /**
61
+ * Returns the current trace propagation headers for the active transaction.
62
+ * Add these to outbound HTTP requests to correlate spans across services.
63
+ */
64
+ traceHeaders(): Record<string, string>;
65
+ createNavigationTracker: typeof createNavigationTracker;
66
+ /** Drain the queued transactions immediately (skips the debounce). */
67
+ flush(): Promise<void>;
68
+ _reset(): void;
69
+ /** Drive the stall-tick handler with an explicit clock (tests only). */
70
+ _recordStallTickForTests(nowMs: number): void;
71
+ _stallTimerRunningForTests(): boolean;
72
+ _openTransactionCountForTests(): number;
73
+ };
74
+ export {};
75
+ //# sourceMappingURL=performance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../../../src/modules/performance.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;CACpE;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrD,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrD,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5C;AA0YD;;;;;;;;;GASG;AACH,iBAAS,uBAAuB,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAsC3D;AAID,eAAO,MAAM,WAAW;iBACT,iBAAiB,GAAG,IAAI;2BAYd,MAAM,MAAM,MAAM,GAAG,aAAa;IASzD;;;OAGG;oBACa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;IAYtC,sEAAsE;aACvD,OAAO,CAAC,IAAI,CAAC;cAUlB,IAAI;IAmBd,wEAAwE;oCACxC,MAAM,GAAG,IAAI;kCAIf,OAAO;qCAIJ,MAAM;CAGxC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { NativeEventEmitter } from "react-native";
2
+ import type { SwissKnifePurchasesNativeModule } from "./spec";
3
+ export declare function getNativeModule(): SwissKnifePurchasesNativeModule;
4
+ export declare function getEventEmitter(): NativeEventEmitter;
5
+ export declare function __resetNativeModuleForTests(): void;
6
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/native/module.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAsB9D,wBAAgB,eAAe,IAAI,+BAA+B,CAMjE;AAED,wBAAgB,eAAe,IAAI,kBAAkB,CAIpD;AAGD,wBAAgB,2BAA2B,IAAI,IAAI,CAGlD"}
@@ -0,0 +1,119 @@
1
+ import type { TurboModule } from "react-native";
2
+ import type { CustomerInfo, PurchasesOfferings, PurchasesPackage, PurchasesStoreProduct, MakePurchaseResult, LogInResult, IdentitySnapshot, ResolvedAttribution } from "../types";
3
+ export interface NativeConfigureOptions {
4
+ apiKey: string;
5
+ appUserID?: string | null;
6
+ proxyURL?: string | null;
7
+ diagnosticsEnabled?: boolean;
8
+ storeKitVersion?: string;
9
+ useAmazon?: boolean;
10
+ autoPromptATT?: boolean;
11
+ sendInstallOnFirstLaunch?: boolean;
12
+ logLevel?: string;
13
+ }
14
+ export declare const CUSTOMER_INFO_UPDATED_EVENT = "Purchases-CustomerInfoUpdated";
15
+ export interface SwissKnifePurchasesNativeModule extends TurboModule {
16
+ configure(options: NativeConfigureOptions): Promise<void>;
17
+ isConfigured(): Promise<boolean>;
18
+ getCustomerInfo(): Promise<CustomerInfo>;
19
+ getOfferings(): Promise<PurchasesOfferings>;
20
+ purchasePackage(packageIdentifier: string, presentedOfferingIdentifier: string): Promise<MakePurchaseResult>;
21
+ purchaseStoreProduct(productIdentifier: string): Promise<MakePurchaseResult>;
22
+ restorePurchases(): Promise<CustomerInfo>;
23
+ logIn(appUserID: string): Promise<LogInResult>;
24
+ logOut(): Promise<CustomerInfo>;
25
+ getAppUserID(): Promise<string>;
26
+ isAnonymous(): Promise<boolean>;
27
+ /** Single source of truth for "who is this device pretending to be?" */
28
+ identityCurrent(): Promise<IdentitySnapshot>;
29
+ /**
30
+ * Identify this device as a known user. Native posts the
31
+ * (anonymous_id, user_id) pair to /api/sdk/users/identify (the
32
+ * bug-fixed behaviour on Android — pre-Wave-1 Android did NOT POST)
33
+ * and rebinds entitlements + analytics user_id from the same callsite.
34
+ */
35
+ identityLogIn(userId: string): Promise<LogInResult>;
36
+ /** Revert to anonymous. DeviceID stays stable across logout. */
37
+ identityLogOut(): Promise<void>;
38
+ /** Rotate in-memory identity state; keep persistent storage. */
39
+ identityReset(): Promise<void>;
40
+ /** Hard wipe: clear Keychain/EncryptedSharedPreferences DeviceID. */
41
+ identityWipe(): Promise<void>;
42
+ /**
43
+ * Current session snapshot from the native canonical `Session.shared`
44
+ * primitive — the same source that stamps envelope-level
45
+ * `ContextSnapshot.session_id` on every ingested item. JS uses this
46
+ * for analytics' legacy `session_id` field so it agrees with the
47
+ * envelope. Replaces the JS-side `Date.now()` fallback that diverged
48
+ * from native truth.
49
+ *
50
+ * `startedAt` is unix-millis-epoch; `sessionNumber` is the monotonic
51
+ * counter persisted across launches (1, 2, 3, …).
52
+ */
53
+ sessionCurrent(): Promise<{
54
+ id: string;
55
+ sessionNumber: number;
56
+ startedAt: number;
57
+ }>;
58
+ /** Most recent resolved attribution from the native cache. Null if no install POST has succeeded yet. */
59
+ attributionResolved(): Promise<ResolvedAttribution | null>;
60
+ /**
61
+ * Auto-prompt ATT (iOS) / auto-collect signals (Android) and POST
62
+ * `/api/sdk/attribution/install`. Idempotent — second call returns
63
+ * the cached resolution.
64
+ */
65
+ attributionRequestAndRegister(): Promise<ResolvedAttribution | null>;
66
+ /**
67
+ * Manual install registration. Pass the IDFA / advertising_id the
68
+ * host already collected, or null when consent was denied.
69
+ */
70
+ attributionRegisterInstall(advertisingId: string | null): Promise<ResolvedAttribution | null>;
71
+ setAttributes(attributes: Record<string, string | null>): Promise<void>;
72
+ setEmail(email: string | null): Promise<void>;
73
+ setDisplayName(displayName: string | null): Promise<void>;
74
+ setPhoneNumber(phoneNumber: string | null): Promise<void>;
75
+ setPushToken(pushToken: string | null): Promise<void>;
76
+ setLogLevel(level: string): Promise<void>;
77
+ /**
78
+ * Persistent per-device identifier, sourced from the native SDK (iOS Keychain
79
+ * / Android EncryptedSharedPreferences). Survives process restart so analytics
80
+ * `device_id` stays stable across app cold starts. JS MUST NOT generate this —
81
+ * an in-memory UUID would fragment every user's analytics timeline on every
82
+ * launch. See `packages/react-native-sdk/src/modules/analytics.ts`.
83
+ */
84
+ getDeviceId(): Promise<string>;
85
+ /**
86
+ * Persist a pre-built analytics event onto the native disk-backed queue.
87
+ *
88
+ * Phase 2.3 of the RC rip-and-replace: JS owns the payload shape (event_id,
89
+ * device_id, super properties, timed-event duration, identify merges) and
90
+ * native owns the queue (disk persistence on iOS Caches / Android cacheDir,
91
+ * exponential back-off, dead-letter on permanent failure). Once this
92
+ * promise resolves the event has hit disk and survives process kill.
93
+ *
94
+ * The event MUST already carry an `event_id` (UUID idempotency key) and a
95
+ * `device_id` — the backend dedupes on `(app_project_id, event_id)`.
96
+ */
97
+ /**
98
+ * Wire the observability backend (analytics/crash/perf ingest) WITHOUT the
99
+ * purchase engine, so a non-SDK-store build (e.g. RuStore, where
100
+ * `Purchases.configure` is never called) still sends analytics. Idempotent.
101
+ *
102
+ * OPTIONAL: implemented on Android (the platform that needs it); absent on
103
+ * iOS, where the backend is wired by `Purchases.configure`. Call via optional
104
+ * chaining so the iOS-absent case is a safe no-op.
105
+ */
106
+ configureObservability?(apiKey: string, serverURL: string): Promise<void>;
107
+ trackEvent(event: Record<string, unknown>): Promise<void>;
108
+ /**
109
+ * Kick off a flush of the native disk-backed queue. Fire-and-forget — the
110
+ * actual HTTP work runs asynchronously on the native side (iOS GCD queue
111
+ * with back-off; Android WorkManager OneTimeWorkRequest). Resolves as soon
112
+ * as the flush job is scheduled.
113
+ */
114
+ flushEvents(): Promise<void>;
115
+ addListener(eventType: string): void;
116
+ removeListeners(count: number): void;
117
+ }
118
+ export type { PurchasesPackage, PurchasesStoreProduct };
119
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/native/spec.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EACl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CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;;;;OAMG;IACH,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;;;;;;;OAWG;IACH;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1E,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D;;;;;OAKG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAG7B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAID,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,68 @@
1
+ import type { PurchasesConfiguration, LOG_LEVEL, CustomerInfo, PurchasesOfferings, PurchasesPackage, PurchasesStoreProduct, MakePurchaseResult, LogInResult, CustomerInfoUpdateListener } from "./types";
2
+ declare function throwIfNotConfigured(): void;
3
+ /**
4
+ * RC-compatible subscriptions SDK entry point. Process-wide singleton; call
5
+ * `Purchases.configure(...)` once at app start, then use the static methods.
6
+ */
7
+ export declare class Purchases {
8
+ /**
9
+ * Configure the SDK. Must be called before any other method. Calling again
10
+ * with the same API key is a no-op (matches the common "configure once" guard);
11
+ * the native layer owns full reconfiguration.
12
+ */
13
+ static configure(options: PurchasesConfiguration & {
14
+ logLevel?: LOG_LEVEL;
15
+ }): void;
16
+ /** Whether the SDK has been configured. Delegates to native. */
17
+ static isConfigured(): Promise<boolean>;
18
+ /** Latest CustomerInfo (entitlements + subscriptions), computed server-side. */
19
+ static getCustomerInfo(): Promise<CustomerInfo>;
20
+ /** Current + all offerings configured for this app. */
21
+ static getOfferings(): Promise<PurchasesOfferings>;
22
+ /** Purchase a package from an offering. Drives the native store payment sheet. */
23
+ static purchasePackage(pkg: PurchasesPackage): Promise<MakePurchaseResult>;
24
+ /** Purchase a store product directly by its store SKU. */
25
+ static purchaseStoreProduct(product: PurchasesStoreProduct): Promise<MakePurchaseResult>;
26
+ /** Restore purchases tied to the underlying store account. */
27
+ static restorePurchases(): Promise<CustomerInfo>;
28
+ /**
29
+ * Identify the user. Aliases/merges anonymous purchases server-side.
30
+ *
31
+ * @deprecated Wave 1 — prefer `Identity.logIn(userId)`. Routes through
32
+ * the unified Identity surface natively, so the bug fix (Android now
33
+ * POSTs `/api/sdk/users/identify`) applies whether you call this or
34
+ * `Identity.logIn(...)`.
35
+ */
36
+ static logIn(appUserID: string): Promise<LogInResult>;
37
+ /**
38
+ * Log out the current user and revert to anonymous.
39
+ *
40
+ * @deprecated Wave 1 — prefer `Identity.logOut()`.
41
+ */
42
+ static logOut(): Promise<CustomerInfo>;
43
+ /** The current app user id (anonymous or identified). */
44
+ static getAppUserID(): Promise<string>;
45
+ /** Whether the current user id is an SDK-generated anonymous id. */
46
+ static isAnonymous(): Promise<boolean>;
47
+ /** Set arbitrary subscriber attributes. null clears an attribute. */
48
+ static setAttributes(attributes: Record<string, string | null>): Promise<void>;
49
+ /** Reserved attribute: email. */
50
+ static setEmail(email: string | null): Promise<void>;
51
+ /** Reserved attribute: display name. */
52
+ static setDisplayName(displayName: string | null): Promise<void>;
53
+ /** Reserved attribute: phone number. */
54
+ static setPhoneNumber(phoneNumber: string | null): Promise<void>;
55
+ /** Reserved attribute: push token. */
56
+ static setPushToken(pushToken: string | null): Promise<void>;
57
+ /** Set the native log level. Accepts a LOG_LEVEL enum value. */
58
+ static setLogLevel(level: LOG_LEVEL): Promise<void>;
59
+ /** Subscribe to CustomerInfo changes (purchase, renewal, dashboard grant). */
60
+ static addCustomerInfoUpdateListener(listener: CustomerInfoUpdateListener): void;
61
+ /** Remove a previously-registered CustomerInfo update listener. */
62
+ static removeCustomerInfoUpdateListener(listener: CustomerInfoUpdateListener): void;
63
+ /** @internal Test seam: reset singleton state between tests. */
64
+ static __resetForTests(): void;
65
+ }
66
+ export { throwIfNotConfigured as __throwIfNotConfigured };
67
+ export default Purchases;
68
+ //# sourceMappingURL=purchases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purchases.d.ts","sourceRoot":"","sources":["../../../src/purchases.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAYjB,iBAAS,oBAAoB,IAAI,IAAI,CAIpC;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CACd,OAAO,EAAE,sBAAsB,GAAG;QAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,GACzD,IAAI;IA0BP,gEAAgE;IAChE,MAAM,CAAC,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAKvC,gFAAgF;WACnE,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC;IAKrD,uDAAuD;WAC1C,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAKxD,kFAAkF;WACrE,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAMhF,0DAA0D;WAC7C,oBAAoB,CAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC;IAK9B,8DAA8D;WACjD,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC;IAKtD;;;;;;;OAOG;WACU,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAK3D;;;;OAIG;WACU,MAAM,IAAI,OAAO,CA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