@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,496 @@
1
+ // packages/swiss-knife-ios/Sources/SwissKnifeiOS/Types.swift
2
+ //
3
+ // Phase 5 — own type definitions replacing the RevenueCat typealiases that
4
+ // lived here previously. Public type shape mirrors RC's
5
+ // (`CustomerInfo`, `Offerings`, `Package`, `StoreProduct`, `StoreTransaction`,
6
+ // `PurchasesError`, `LogLevel`, `EntitlementInfo`, `EntitlementInfos`,
7
+ // `VerificationResult`, etc.) so call sites — including the React Native
8
+ // bridge — see the same field names and semantics. Implementation is ours,
9
+ // backed by StoreKit 2 + our backend rather than RC.
10
+ //
11
+ // Why mirror RC's shape rather than introduce a fresh API?
12
+ // - Backward compatibility for the Phase 4 parity test suite (30 cases) and
13
+ // anyone already wrapping these types in app code. RC's names are also
14
+ // the well-trodden vocabulary in the iOS subscriptions community.
15
+ // - Our `SwissKnife.swift` public surface, the RN bridge, and the parity
16
+ // contract all reference these field names directly. A type rename would
17
+ // ripple far beyond what Phase 5 is meant to cover.
18
+ //
19
+ // Where we intentionally narrow from RC:
20
+ // - We do NOT re-implement RC-internal helpers that aren't used by the
21
+ // SDK's public surface (e.g. `RawDataContainer`, RC's `Codable`
22
+ // internal conformances). Just the public field/enum shape.
23
+ // - Some optional metadata fields (e.g. `nonSubscriptionTransactions`)
24
+ // are kept but always empty for now — non-subscription IAP support
25
+ // can land later without breaking the public surface.
26
+ // - `EntitlementInfo.identifierVerification` and similarly RC-niche fields
27
+ // are omitted; tests do not rely on them.
28
+
29
+ import Foundation
30
+
31
+ // MARK: - Verification result
32
+
33
+ /// Result of an `AppTransaction` / `Transaction` JWS verification, mirroring
34
+ /// `StoreKit.VerificationResult` semantics. RC uses an analogous enum on
35
+ /// `EntitlementInfos` to surface whether the active entitlement set was
36
+ /// cryptographically verified end-to-end.
37
+ public enum VerificationResult: String, Sendable, Codable {
38
+ /// JWS signature verified by StoreKit 2 (or backend equivalent).
39
+ case verified
40
+ /// Verification was attempted but failed (tampered or bad signature).
41
+ case failed
42
+ /// Verification was not attempted (e.g. backend short-circuited the check).
43
+ case notRequested = "not_requested"
44
+ }
45
+
46
+ // MARK: - Store / period type / ownership / package type
47
+
48
+ /// Source store that produced a transaction or entitlement.
49
+ public enum Store: String, Sendable, Codable {
50
+ case appStore = "app_store"
51
+ case playStore = "play_store"
52
+ /// Fallback for unknown stores (e.g. an older backend response we don't
53
+ /// recognize). We surface it rather than reject the row so the SDK keeps
54
+ /// rendering an entitlement even if a new store lands server-side first.
55
+ case unknownStore = "unknown_store"
56
+ }
57
+
58
+ /// Whether the entitlement is currently in an intro period, trial, or normal.
59
+ /// Names match `RevenueCat.PeriodType` exactly.
60
+ public enum PeriodType: String, Sendable, Codable {
61
+ case intro
62
+ case normal
63
+ case trial
64
+ }
65
+
66
+ /// Who owns the entitlement on the user's account — direct purchase or
67
+ /// inherited from Family Sharing. Matches `RevenueCat.PurchaseOwnershipType`.
68
+ public enum OwnershipType: String, Sendable, Codable {
69
+ case purchased
70
+ case familyShared = "family_shared"
71
+ }
72
+
73
+ /// Standard package shapes RC surfaces on an `Offering`. We mirror the same
74
+ /// raw values so backend payloads encoded for RC-compatible consumers
75
+ /// transparently round-trip.
76
+ public enum PackageType: String, Sendable, Codable {
77
+ case unknown
78
+ case custom
79
+ case lifetime
80
+ case annual
81
+ case sixMonth = "six_month"
82
+ case threeMonth = "three_month"
83
+ case twoMonth = "two_month"
84
+ case monthly
85
+ case weekly
86
+ }
87
+
88
+ // MARK: - LogLevel
89
+
90
+ /// SDK log level. Mirrors `RevenueCat.LogLevel` names so the wire-string
91
+ /// parser in `SwissKnife.configure(logLevel:)` keeps the same vocabulary
92
+ /// across the cut-over.
93
+ public enum LogLevel: String, Sendable, Codable {
94
+ case verbose
95
+ case debug
96
+ case info
97
+ case warn
98
+ case error
99
+ }
100
+
101
+ // MARK: - Subscription period / discounts
102
+
103
+ /// Length of one billing cycle on a subscription product.
104
+ public struct SubscriptionPeriod: Sendable, Codable, Equatable {
105
+
106
+ /// Unit of one billing cycle.
107
+ public enum Unit: String, Sendable, Codable {
108
+ case day
109
+ case week
110
+ case month
111
+ case year
112
+ }
113
+
114
+ public let value: Int
115
+ public let unit: Unit
116
+
117
+ public init(value: Int, unit: Unit) {
118
+ self.value = value
119
+ self.unit = unit
120
+ }
121
+ }
122
+
123
+ /// Intro / promotional offer details surfaced on a `StoreProduct`.
124
+ public struct StoreProductDiscount: Sendable, Codable, Equatable {
125
+
126
+ public enum PaymentMode: String, Sendable, Codable {
127
+ case payAsYouGo = "pay_as_you_go"
128
+ case payUpFront = "pay_up_front"
129
+ case freeTrial = "free_trial"
130
+ }
131
+
132
+ public enum DiscountType: String, Sendable, Codable {
133
+ case introductory
134
+ case promotional
135
+ }
136
+
137
+ public let offerIdentifier: String?
138
+ public let price: Decimal
139
+ public let paymentMode: PaymentMode
140
+ public let subscriptionPeriod: SubscriptionPeriod
141
+ public let numberOfPeriods: Int
142
+ public let type: DiscountType
143
+
144
+ public init(
145
+ offerIdentifier: String?,
146
+ price: Decimal,
147
+ paymentMode: PaymentMode,
148
+ subscriptionPeriod: SubscriptionPeriod,
149
+ numberOfPeriods: Int,
150
+ type: DiscountType
151
+ ) {
152
+ self.offerIdentifier = offerIdentifier
153
+ self.price = price
154
+ self.paymentMode = paymentMode
155
+ self.subscriptionPeriod = subscriptionPeriod
156
+ self.numberOfPeriods = numberOfPeriods
157
+ self.type = type
158
+ }
159
+ }
160
+
161
+ // MARK: - StoreProduct
162
+
163
+ /// A single product as returned by the App Store. We populate this directly
164
+ /// from StoreKit 2's `Product` type at the boundary, so consumers can read
165
+ /// localized titles / prices without importing StoreKit themselves.
166
+ public struct StoreProduct: Sendable, Equatable {
167
+
168
+ public let productIdentifier: String
169
+ public let localizedTitle: String
170
+ public let localizedDescription: String
171
+ public let price: Decimal
172
+ public let currencyCode: String
173
+ /// Pre-formatted display price (e.g. `"$9.99"`) — passes through StoreKit's
174
+ /// localized formatter so we don't re-derive the locale ourselves.
175
+ public let displayPrice: String
176
+ public let subscriptionPeriod: SubscriptionPeriod?
177
+ public let introductoryDiscount: StoreProductDiscount?
178
+ public let discounts: [StoreProductDiscount]
179
+
180
+ /// Number formatter pre-configured for this product's currency. Recreating
181
+ /// it on demand is cheap; we surface it so consumers can format derived
182
+ /// values (per-month price, etc.) in the same currency / locale.
183
+ public var priceFormatter: NumberFormatter {
184
+ let f = NumberFormatter()
185
+ f.numberStyle = .currency
186
+ f.currencyCode = currencyCode
187
+ return f
188
+ }
189
+
190
+ public init(
191
+ productIdentifier: String,
192
+ localizedTitle: String,
193
+ localizedDescription: String,
194
+ price: Decimal,
195
+ currencyCode: String,
196
+ displayPrice: String,
197
+ subscriptionPeriod: SubscriptionPeriod?,
198
+ introductoryDiscount: StoreProductDiscount?,
199
+ discounts: [StoreProductDiscount]
200
+ ) {
201
+ self.productIdentifier = productIdentifier
202
+ self.localizedTitle = localizedTitle
203
+ self.localizedDescription = localizedDescription
204
+ self.price = price
205
+ self.currencyCode = currencyCode
206
+ self.displayPrice = displayPrice
207
+ self.subscriptionPeriod = subscriptionPeriod
208
+ self.introductoryDiscount = introductoryDiscount
209
+ self.discounts = discounts
210
+ }
211
+ }
212
+
213
+ // MARK: - StoreTransaction
214
+
215
+ /// A single completed transaction surfaced to the consumer after a purchase
216
+ /// or restore. The `jwsRepresentation` is the StoreKit 2 JWS — the same
217
+ /// payload we POST to `/api/sdk/subscriptions/validate`.
218
+ public struct StoreTransaction: Sendable, Equatable {
219
+
220
+ public let productIdentifier: String
221
+ public let transactionIdentifier: String
222
+ public let purchaseDate: Date
223
+ /// StoreKit 2 JWS representation of the verified transaction, when
224
+ /// available. Nil for tests or legacy paths that didn't carry one.
225
+ public let jwsRepresentation: String?
226
+ public let quantity: Int
227
+
228
+ public init(
229
+ productIdentifier: String,
230
+ transactionIdentifier: String,
231
+ purchaseDate: Date,
232
+ jwsRepresentation: String?,
233
+ quantity: Int
234
+ ) {
235
+ self.productIdentifier = productIdentifier
236
+ self.transactionIdentifier = transactionIdentifier
237
+ self.purchaseDate = purchaseDate
238
+ self.jwsRepresentation = jwsRepresentation
239
+ self.quantity = quantity
240
+ }
241
+ }
242
+
243
+ // MARK: - EntitlementInfo / EntitlementInfos
244
+
245
+ /// Per-entitlement state, mirroring `RevenueCat.EntitlementInfo` field names.
246
+ public struct EntitlementInfo: Sendable, Codable, Equatable {
247
+
248
+ public let identifier: String
249
+ public let isActive: Bool
250
+ public let willRenew: Bool
251
+ public let latestPurchaseDate: Date
252
+ public let expirationDate: Date?
253
+ public let productIdentifier: String
254
+ public let productPlanIdentifier: String?
255
+ public let isSandbox: Bool
256
+ public let unsubscribeDetectedAt: Date?
257
+ public let billingIssueDetectedAt: Date?
258
+ public let periodType: PeriodType
259
+ public let store: Store
260
+ public let ownershipType: OwnershipType
261
+
262
+ public init(
263
+ identifier: String,
264
+ isActive: Bool,
265
+ willRenew: Bool,
266
+ latestPurchaseDate: Date,
267
+ expirationDate: Date?,
268
+ productIdentifier: String,
269
+ productPlanIdentifier: String?,
270
+ isSandbox: Bool,
271
+ unsubscribeDetectedAt: Date?,
272
+ billingIssueDetectedAt: Date?,
273
+ periodType: PeriodType,
274
+ store: Store,
275
+ ownershipType: OwnershipType
276
+ ) {
277
+ self.identifier = identifier
278
+ self.isActive = isActive
279
+ self.willRenew = willRenew
280
+ self.latestPurchaseDate = latestPurchaseDate
281
+ self.expirationDate = expirationDate
282
+ self.productIdentifier = productIdentifier
283
+ self.productPlanIdentifier = productPlanIdentifier
284
+ self.isSandbox = isSandbox
285
+ self.unsubscribeDetectedAt = unsubscribeDetectedAt
286
+ self.billingIssueDetectedAt = billingIssueDetectedAt
287
+ self.periodType = periodType
288
+ self.store = store
289
+ self.ownershipType = ownershipType
290
+ }
291
+ }
292
+
293
+ /// Container for a customer's entitlement set. RC surfaces both `all` and
294
+ /// `active` — we keep both for parity even though `active` is a derived view
295
+ /// (active = `all.filter { $0.value.isActive }`), since consumers grep for
296
+ /// `entitlements.active` heavily.
297
+ public struct EntitlementInfos: Sendable, Codable, Equatable {
298
+
299
+ public let all: [String: EntitlementInfo]
300
+ public let active: [String: EntitlementInfo]
301
+ /// Verification status of the underlying source payload. For backend-
302
+ /// driven entitlements this defaults to `.verified` (server validated the
303
+ /// receipt). For purely-local StoreKit 2 derived entitlements (offline
304
+ /// grace path) we record whatever StoreKit reported.
305
+ public var verification: VerificationResult
306
+
307
+ public init(
308
+ all: [String: EntitlementInfo],
309
+ verification: VerificationResult = .verified
310
+ ) {
311
+ self.all = all
312
+ self.active = all.filter { $0.value.isActive }
313
+ self.verification = verification
314
+ }
315
+ }
316
+
317
+ // MARK: - CustomerInfo
318
+
319
+ /// Top-level user-level state. Mirrors `RevenueCat.CustomerInfo`.
320
+ public struct CustomerInfo: Sendable, Codable, Equatable {
321
+
322
+ public let entitlements: EntitlementInfos
323
+ public let originalAppUserId: String
324
+ public let firstSeen: Date
325
+ public let originalPurchaseDate: Date?
326
+ public let latestExpirationDate: Date?
327
+ /// Map of productIdentifier → most-recent purchase date.
328
+ public let allPurchaseDates: [String: Date]
329
+ /// Convenience surface used by the parity test for restore — set of all
330
+ /// product identifiers the user has ever purchased on this account.
331
+ public let allPurchasedProductIdentifiers: [String]
332
+ /// Active subscription product identifiers (subset of
333
+ /// `allPurchasedProductIdentifiers` that are currently in an active
334
+ /// entitlement). RC exposes this as a Set; we keep [String] for Codable.
335
+ public let activeSubscriptions: [String]
336
+ public let managementURL: URL?
337
+
338
+ public init(
339
+ entitlements: EntitlementInfos,
340
+ originalAppUserId: String,
341
+ firstSeen: Date,
342
+ originalPurchaseDate: Date?,
343
+ latestExpirationDate: Date?,
344
+ allPurchaseDates: [String: Date],
345
+ activeSubscriptions: [String],
346
+ managementURL: URL?
347
+ ) {
348
+ self.entitlements = entitlements
349
+ self.originalAppUserId = originalAppUserId
350
+ self.firstSeen = firstSeen
351
+ self.originalPurchaseDate = originalPurchaseDate
352
+ self.latestExpirationDate = latestExpirationDate
353
+ self.allPurchaseDates = allPurchaseDates
354
+ self.allPurchasedProductIdentifiers = Array(allPurchaseDates.keys)
355
+ self.activeSubscriptions = activeSubscriptions
356
+ self.managementURL = managementURL
357
+ }
358
+
359
+ /// Empty / "anonymous, no entitlements" instance — used as the bootstrap
360
+ /// value before the first backend refresh has landed.
361
+ public static func empty(originalAppUserId: String) -> CustomerInfo {
362
+ CustomerInfo(
363
+ entitlements: EntitlementInfos(all: [:]),
364
+ originalAppUserId: originalAppUserId,
365
+ firstSeen: Date(),
366
+ originalPurchaseDate: nil,
367
+ latestExpirationDate: nil,
368
+ allPurchaseDates: [:],
369
+ activeSubscriptions: [],
370
+ managementURL: nil
371
+ )
372
+ }
373
+ }
374
+
375
+ // MARK: - Package / Offering / Offerings
376
+
377
+ /// A single purchasable package within an offering. RC's `Package` carries
378
+ /// both a `storeProduct` and identifiers for the owning offering — we mirror
379
+ /// that exactly.
380
+ public struct Package: Sendable, Equatable {
381
+
382
+ public let identifier: String
383
+ public let packageType: PackageType
384
+ public let storeProduct: StoreProduct
385
+ public let offeringIdentifier: String
386
+
387
+ public init(
388
+ identifier: String,
389
+ packageType: PackageType,
390
+ storeProduct: StoreProduct,
391
+ offeringIdentifier: String
392
+ ) {
393
+ self.identifier = identifier
394
+ self.packageType = packageType
395
+ self.storeProduct = storeProduct
396
+ self.offeringIdentifier = offeringIdentifier
397
+ }
398
+ }
399
+
400
+ /// A logical group of packages a paywall can render. RC surfaces convenience
401
+ /// accessors for the standard package types (monthly, annual, etc.); we
402
+ /// preserve them so existing paywall code keeps working.
403
+ public struct Offering: Sendable, Equatable {
404
+
405
+ public let identifier: String
406
+ public let serverDescription: String
407
+ /// Free-form metadata supplied by the backend — we type as
408
+ /// `[String: String]` rather than `[String: Any]` to keep the value
409
+ /// `Sendable` / `Equatable`. Backends should JSON-encode richer values
410
+ /// into the string fields if needed.
411
+ public let metadata: [String: String]
412
+ public let availablePackages: [Package]
413
+
414
+ public init(
415
+ identifier: String,
416
+ serverDescription: String,
417
+ metadata: [String: String],
418
+ availablePackages: [Package]
419
+ ) {
420
+ self.identifier = identifier
421
+ self.serverDescription = serverDescription
422
+ self.metadata = metadata
423
+ self.availablePackages = availablePackages
424
+ }
425
+
426
+ // MARK: Convenience accessors (mirror RC's `Offering` shape)
427
+
428
+ public var monthly: Package? { availablePackages.first { $0.packageType == .monthly } }
429
+ public var annual: Package? { availablePackages.first { $0.packageType == .annual } }
430
+ public var weekly: Package? { availablePackages.first { $0.packageType == .weekly } }
431
+ public var lifetime: Package? { availablePackages.first { $0.packageType == .lifetime } }
432
+ public var sixMonth: Package? { availablePackages.first { $0.packageType == .sixMonth } }
433
+ public var threeMonth: Package? { availablePackages.first { $0.packageType == .threeMonth } }
434
+ public var twoMonth: Package? { availablePackages.first { $0.packageType == .twoMonth } }
435
+ }
436
+
437
+ /// Top-level offerings container.
438
+ public struct Offerings: Sendable, Equatable {
439
+
440
+ public let all: [String: Offering]
441
+ public let current: Offering?
442
+
443
+ public init(all: [String: Offering], current: Offering?) {
444
+ self.all = all
445
+ self.current = current
446
+ }
447
+ }
448
+
449
+ // MARK: - PurchasesError
450
+
451
+ /// Typed error returned from purchase / restore / identity calls. Cases
452
+ /// mirror RC's `ErrorCode` taxonomy at the level the parity tests reach for —
453
+ /// we don't enumerate every internal RC code, only the ones the public API
454
+ /// can produce.
455
+ public enum PurchasesError: Error, Equatable, Sendable {
456
+
457
+ /// User dismissed the purchase sheet.
458
+ case purchaseCancelled
459
+ /// Payment is pending (Ask to Buy, slow processing).
460
+ case paymentPending
461
+ /// Product not available on the current store/storefront.
462
+ case productNotAvailable
463
+ /// Network unreachable or the call timed out.
464
+ case networkError(underlying: String)
465
+ /// Receipt already attached to a different account.
466
+ case receiptAlreadyInUse
467
+ /// JWS verification of the StoreKit 2 transaction failed.
468
+ case verificationFailed(reason: String)
469
+ /// Backend rejected the receipt (4xx) — non-retriable on the SDK side.
470
+ case backendRejected(statusCode: Int, message: String?)
471
+ /// Backend returned 5xx or transport error — retriable.
472
+ case backendUnavailable(statusCode: Int?, message: String?)
473
+ /// Caller invoked an API before `SwissKnife.configure(...)`.
474
+ case notConfigured
475
+ /// Catch-all — keep a stable case so callers can still pattern-match
476
+ /// without us breaking the enum every time StoreKit adds a new error.
477
+ case unknown(message: String)
478
+
479
+ public var localizedDescription: String {
480
+ switch self {
481
+ case .purchaseCancelled: return "Purchase was cancelled by the user."
482
+ case .paymentPending: return "Payment is pending (e.g. Ask to Buy)."
483
+ case .productNotAvailable: return "Product is not available on the current store."
484
+ case .networkError(let u): return "Network error: \(u)"
485
+ case .receiptAlreadyInUse: return "Receipt is already in use by another account."
486
+ case .verificationFailed(let r): return "JWS verification failed: \(r)"
487
+ case .backendRejected(let code, let msg):
488
+ return "Backend rejected the receipt (HTTP \(code))" + (msg.map { ": \($0)" } ?? "")
489
+ case .backendUnavailable(let code, let msg):
490
+ let codeStr = code.map { "HTTP \($0)" } ?? "transport error"
491
+ return "Backend unavailable (\(codeStr))" + (msg.map { ": \($0)" } ?? "")
492
+ case .notConfigured: return "SwissKnife.configure(...) must be called before this API."
493
+ case .unknown(let m): return "Unknown error: \(m)"
494
+ }
495
+ }
496
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Attribution = void 0;
7
+ var _module = require("./native/module.js");
8
+ // packages/react-native-sdk/src/attribution.ts
9
+ //
10
+ // Wave 2 — unified Attribution JS surface. Mirror of
11
+ // `SwissKnife.Attribution` (iOS, Swift) and
12
+ // `com.appswissknife.attribution.Attribution` (Android, Kotlin). All
13
+ // logic lives natively — this module is a thin passthrough.
14
+ //
15
+ // Why JS doesn't keep its own state
16
+ // ---------------------------------
17
+ // Same rationale as Identity: native is the single source of truth for
18
+ // the resolved attribution. JS reads via `resolved()` (cached snapshot
19
+ // from the native disk-backed cache) and writes via
20
+ // `requestAndRegister()` or `registerInstall(...)`. Idempotency lives
21
+ // natively — a second JS call to `registerInstall(...)` returns the
22
+ // cached value from the native cache without a second POST.
23
+ //
24
+ // ATT prompt orchestration is iOS-only and happens natively. JS callers
25
+ // just await `requestAndRegister()` — the native side handles
26
+ // `ATTrackingManager` (iOS) or the no-op Android path.
27
+
28
+ const Attribution = exports.Attribution = {
29
+ /**
30
+ * The most recent resolved attribution from the native disk-backed
31
+ * cache. Returns `null` when no install POST has succeeded yet.
32
+ * Cheap — does not hit the network.
33
+ */
34
+ async resolved() {
35
+ return (0, _module.getNativeModule)().attributionResolved();
36
+ },
37
+ /**
38
+ * Auto-collect (ATT prompt + IDFA on iOS; advertising_id +
39
+ * install_referrer on Android) and POST `/api/sdk/attribution/install`.
40
+ * Idempotent — second call returns the cached resolution WITHOUT
41
+ * re-prompting or re-POSTing.
42
+ */
43
+ async requestAndRegister() {
44
+ return (0, _module.getNativeModule)().attributionRequestAndRegister();
45
+ },
46
+ /**
47
+ * Manual install registration for hosts that prompt for tracking
48
+ * consent themselves or collect the advertising id outside the SDK.
49
+ * Pass `null` when consent was denied. Idempotent.
50
+ */
51
+ async registerInstall(advertisingId) {
52
+ return (0, _module.getNativeModule)().attributionRegisterInstall(advertisingId ?? null);
53
+ }
54
+ };
55
+ //# sourceMappingURL=attribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_module","require","Attribution","exports","resolved","getNativeModule","attributionResolved","requestAndRegister","attributionRequestAndRegister","registerInstall","advertisingId","attributionRegisterInstall"],"sourceRoot":"../../src","sources":["attribution.ts"],"mappings":";;;;;;AAoBA,IAAAA,OAAA,GAAAC,OAAA;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzB;AACF;AACA;AACA;AACA;EACE,MAAME,QAAQA,CAAA,EAAwC;IACpD,OAAO,IAAAC,uBAAe,EAAC,CAAC,CAACC,mBAAmB,CAAC,CAAC;EAChD,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,kBAAkBA,CAAA,EAAwC;IAC9D,OAAO,IAAAF,uBAAe,EAAC,CAAC,CAACG,6BAA6B,CAAC,CAAC;EAC1D,CAAC;EAED;AACF;AACA;AACA;AACA;EACE,MAAMC,eAAeA,CACnBC,aAA6B,EACQ;IACrC,OAAO,IAAAL,uBAAe,EAAC,CAAC,CAACM,0BAA0B,CAACD,aAAa,IAAI,IAAI,CAAC;EAC5E;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Identity = void 0;
7
+ var _module = require("./native/module.js");
8
+ // packages/react-native-sdk/src/identity.ts
9
+ //
10
+ // Wave 1 — unified `Identity` JS surface. Mirror of `SwissKnife.Identity`
11
+ // on iOS (Swift) and `com.appswissknife.identity.Identity` on Android
12
+ // (Kotlin). All logic lives natively — this module is a thin
13
+ // passthrough.
14
+ //
15
+ // Why JS doesn't keep its own state
16
+ // ---------------------------------
17
+ // Before Wave 1, `modules/analytics.ts` kept a JS-local `_userId` that
18
+ // drifted from the native state. After `Purchases.logIn("u_42")`, an
19
+ // immediate `Analytics.track(...)` emitted with `user_id: ""` because
20
+ // the JS module never heard about the new user id. The fix is to make
21
+ // native the single source of truth and have JS derive `user_id` from
22
+ // the native `Identity.current()` snapshot at event-build time. See
23
+ // `modules/analytics.ts` for that derivation.
24
+ //
25
+ // Observers
26
+ // ---------
27
+ // Native does NOT currently emit identity-change events over a
28
+ // `NativeEventEmitter` channel (would require another bridge plumbing
29
+ // pass). For now JS-side observers fire on the next `logIn` / `logOut`
30
+ // / `reset` / `wipe` call that originates from JS — they are NOT
31
+ // notified about identity changes triggered natively (e.g. silent push
32
+ // rebinding). When we need that, add a `Purchases-IdentityChanged`
33
+ // event to the native event emitter and subscribe here.
34
+
35
+ const observers = new Map();
36
+ let lastSnapshot = null;
37
+ function generateToken() {
38
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
39
+ const r = Math.random() * 16 | 0;
40
+ const v = c === "x" ? r : r & 0x3 | 0x8;
41
+ return v.toString(16);
42
+ });
43
+ }
44
+ async function snapshotAndNotify(reason) {
45
+ const previous = lastSnapshot;
46
+ const current = await (0, _module.getNativeModule)().identityCurrent();
47
+ lastSnapshot = current;
48
+ if (previous && observers.size > 0) {
49
+ const change = {
50
+ previous,
51
+ current
52
+ };
53
+ // Fire observers off the awaited stack so a slow observer doesn't
54
+ // delay the caller's promise resolution.
55
+ void Promise.resolve().then(() => {
56
+ for (const observer of observers.values()) {
57
+ try {
58
+ observer(change);
59
+ } catch (e) {
60
+ console.warn(`[SwissKnife Identity] observer threw during ${reason}:`, e);
61
+ }
62
+ }
63
+ });
64
+ }
65
+ return current;
66
+ }
67
+ const Identity = exports.Identity = {
68
+ /**
69
+ * Latest known identity snapshot. The first call hits the bridge;
70
+ * subsequent calls return the cached value updated by
71
+ * `logIn` / `logOut` / `reset` / `wipe`. Returns `null` only before
72
+ * the bridge has resolved.
73
+ */
74
+ async current() {
75
+ const current = await (0, _module.getNativeModule)().identityCurrent();
76
+ lastSnapshot = current;
77
+ return current;
78
+ },
79
+ /**
80
+ * Identify this device as a known user. Native posts the
81
+ * `(anonymous_id, user_id)` pair to `/api/sdk/users/identify` (the
82
+ * Wave 1 bug-fix; pre-Wave-1 Android did NOT post). Resolves once
83
+ * the backend ack + post-identify entitlements refresh complete.
84
+ */
85
+ async logIn(userId) {
86
+ const result = await (0, _module.getNativeModule)().identityLogIn(userId);
87
+ await snapshotAndNotify("logIn");
88
+ return result;
89
+ },
90
+ /** Revert to anonymous. DeviceID stays stable across logout. */
91
+ async logOut() {
92
+ await (0, _module.getNativeModule)().identityLogOut();
93
+ await snapshotAndNotify("logOut");
94
+ },
95
+ /**
96
+ * Rotate in-memory state but keep persistent storage. Matches the
97
+ * "switch test user" UX semantic.
98
+ */
99
+ async reset() {
100
+ await (0, _module.getNativeModule)().identityReset();
101
+ await snapshotAndNotify("reset");
102
+ },
103
+ /**
104
+ * Hard wipe: clear Keychain (iOS) / EncryptedSharedPreferences
105
+ * (Android) DeviceID. GDPR-delete / test-build cleanup.
106
+ */
107
+ async wipe() {
108
+ await (0, _module.getNativeModule)().identityWipe();
109
+ await snapshotAndNotify("wipe");
110
+ },
111
+ /** Subscribe to identity changes. Returns an unsubscribe token. */
112
+ addObserver(block) {
113
+ const token = generateToken();
114
+ observers.set(token, block);
115
+ return token;
116
+ },
117
+ removeObserver(token) {
118
+ observers.delete(token);
119
+ },
120
+ /** @internal Test seam — reset the cached snapshot + observers. */
121
+ __resetForTests() {
122
+ lastSnapshot = null;
123
+ observers.clear();
124
+ }
125
+ };
126
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_module","require","observers","Map","lastSnapshot","generateToken","replace","c","r","Math","random","v","toString","snapshotAndNotify","reason","previous","current","getNativeModule","identityCurrent","size","change","Promise","resolve","then","observer","values","e","console","warn","Identity","exports","logIn","userId","result","identityLogIn","logOut","identityLogOut","reset","identityReset","wipe","identityWipe","addObserver","block","token","set","removeObserver","delete","__resetForTests","clear"],"sourceRoot":"../../src","sources":["identity.ts"],"mappings":"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","ignoreList":[]}