@billdog.io/react-native 1.0.0-beta.2

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 (309) hide show
  1. package/BillDogReactNative.podspec +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +330 -0
  4. package/android/build.gradle +99 -0
  5. package/android/src/main/AndroidManifest.xml +1 -0
  6. package/android/src/main/kotlin/io/billdog/reactnative/BillDogABTestModule.kt +317 -0
  7. package/android/src/main/kotlin/io/billdog/reactnative/BillDogAnalyticsModule.kt +389 -0
  8. package/android/src/main/kotlin/io/billdog/reactnative/BillDogModule.kt +817 -0
  9. package/android/src/main/kotlin/io/billdog/reactnative/BillDogPaywallViewManager.kt +383 -0
  10. package/android/src/main/kotlin/io/billdog/reactnative/BillDogSurveyModule.kt +427 -0
  11. package/android/src/main/kotlin/io/billdog/reactnative/BillDogVirtualCurrencyModule.kt +407 -0
  12. package/android/src/main/kotlin/io/billdog/virtualcurrency/BillDogVirtualCurrencyPackage.kt +44 -0
  13. package/dist/AdvancedPaywallCache.d.ts +70 -0
  14. package/dist/AdvancedPaywallCache.js +344 -0
  15. package/dist/BillDog.d.ts +255 -0
  16. package/dist/BillDog.js +918 -0
  17. package/dist/BillDogConfiguration.d.ts +145 -0
  18. package/dist/BillDogConfiguration.js +229 -0
  19. package/dist/ComponentRenderer.d.ts +17 -0
  20. package/dist/ComponentRenderer.js +886 -0
  21. package/dist/LayoutEngine.d.ts +101 -0
  22. package/dist/LayoutEngine.js +394 -0
  23. package/dist/LocalizationResolver.d.ts +99 -0
  24. package/dist/LocalizationResolver.js +266 -0
  25. package/dist/NativePaywallView.d.ts +36 -0
  26. package/dist/NativePaywallView.js +59 -0
  27. package/dist/PaywallCache.d.ts +74 -0
  28. package/dist/PaywallCache.js +293 -0
  29. package/dist/PaywallStateManager.d.ts +62 -0
  30. package/dist/PaywallStateManager.js +147 -0
  31. package/dist/PaywallView.d.ts +42 -0
  32. package/dist/PaywallView.js +275 -0
  33. package/dist/ProductVariableProvider.d.ts +60 -0
  34. package/dist/ProductVariableProvider.js +239 -0
  35. package/dist/VariableResolver.d.ts +120 -0
  36. package/dist/VariableResolver.js +379 -0
  37. package/dist/WebViewPaywall.d.ts +75 -0
  38. package/dist/WebViewPaywall.js +360 -0
  39. package/dist/animations/presets.d.ts +49 -0
  40. package/dist/animations/presets.js +367 -0
  41. package/dist/components/AccoladeCpsComponent.d.ts +13 -0
  42. package/dist/components/AccoladeCpsComponent.js +248 -0
  43. package/dist/components/AccordionComponent.d.ts +10 -0
  44. package/dist/components/AccordionComponent.js +187 -0
  45. package/dist/components/AnimatedWrapper.d.ts +35 -0
  46. package/dist/components/AnimatedWrapper.js +277 -0
  47. package/dist/components/CarouselComponent.d.ts +23 -0
  48. package/dist/components/CarouselComponent.js +484 -0
  49. package/dist/components/ChartCurveComponent.d.ts +13 -0
  50. package/dist/components/ChartCurveComponent.js +333 -0
  51. package/dist/components/CheckboxComponent.d.ts +9 -0
  52. package/dist/components/CheckboxComponent.js +172 -0
  53. package/dist/components/ConfettiComponent.d.ts +9 -0
  54. package/dist/components/ConfettiComponent.js +172 -0
  55. package/dist/components/CountdownComponent.d.ts +16 -0
  56. package/dist/components/CountdownComponent.js +414 -0
  57. package/dist/components/DelayedXComponent.d.ts +12 -0
  58. package/dist/components/DelayedXComponent.js +240 -0
  59. package/dist/components/DrawerModalComponent.d.ts +20 -0
  60. package/dist/components/DrawerModalComponent.js +286 -0
  61. package/dist/components/GradientView.d.ts +38 -0
  62. package/dist/components/GradientView.js +126 -0
  63. package/dist/components/HapticFeedbackComponent.d.ts +16 -0
  64. package/dist/components/HapticFeedbackComponent.js +64 -0
  65. package/dist/components/HorizontalProductsComponent.d.ts +17 -0
  66. package/dist/components/HorizontalProductsComponent.js +284 -0
  67. package/dist/components/MultiChoiceGridComponent.d.ts +13 -0
  68. package/dist/components/MultiChoiceGridComponent.js +234 -0
  69. package/dist/components/NPSScaleComponent.d.ts +16 -0
  70. package/dist/components/NPSScaleComponent.js +260 -0
  71. package/dist/components/NavigationComponent.d.ts +26 -0
  72. package/dist/components/NavigationComponent.js +302 -0
  73. package/dist/components/OAuthButtonComponent.d.ts +20 -0
  74. package/dist/components/OAuthButtonComponent.js +237 -0
  75. package/dist/components/ProgressLoaderComponent.d.ts +13 -0
  76. package/dist/components/ProgressLoaderComponent.js +308 -0
  77. package/dist/components/ProgressStepperComponent.d.ts +18 -0
  78. package/dist/components/ProgressStepperComponent.js +228 -0
  79. package/dist/components/SegmentedPickerComponent.d.ts +10 -0
  80. package/dist/components/SegmentedPickerComponent.js +221 -0
  81. package/dist/components/ShareButtonsComponent.d.ts +21 -0
  82. package/dist/components/ShareButtonsComponent.js +265 -0
  83. package/dist/components/ShareCodeComponent.d.ts +16 -0
  84. package/dist/components/ShareCodeComponent.js +274 -0
  85. package/dist/components/SingleChoiceGridComponent.d.ts +13 -0
  86. package/dist/components/SingleChoiceGridComponent.js +210 -0
  87. package/dist/components/SliderComponent.d.ts +9 -0
  88. package/dist/components/SliderComponent.js +263 -0
  89. package/dist/components/StarRatingInputComponent.d.ts +20 -0
  90. package/dist/components/StarRatingInputComponent.js +198 -0
  91. package/dist/components/StickerCompositeComponent.d.ts +13 -0
  92. package/dist/components/StickerCompositeComponent.js +136 -0
  93. package/dist/components/TabsComponent.d.ts +19 -0
  94. package/dist/components/TabsComponent.js +431 -0
  95. package/dist/components/TextInputComponent.d.ts +18 -0
  96. package/dist/components/TextInputComponent.js +227 -0
  97. package/dist/components/TimelineComponent.d.ts +19 -0
  98. package/dist/components/TimelineComponent.js +104 -0
  99. package/dist/components/ToggleComponent.d.ts +14 -0
  100. package/dist/components/ToggleComponent.js +132 -0
  101. package/dist/components/VerticalProductsComponent.d.ts +17 -0
  102. package/dist/components/VerticalProductsComponent.js +311 -0
  103. package/dist/dynamicValues.d.ts +36 -0
  104. package/dist/dynamicValues.js +142 -0
  105. package/dist/filters/dateFilters.d.ts +50 -0
  106. package/dist/filters/dateFilters.js +390 -0
  107. package/dist/filters/index.d.ts +18 -0
  108. package/dist/filters/index.js +253 -0
  109. package/dist/hooks/useOfferings.d.ts +76 -0
  110. package/dist/hooks/useOfferings.js +99 -0
  111. package/dist/hooks/usePaywall.d.ts +27 -0
  112. package/dist/hooks/usePaywall.js +114 -0
  113. package/dist/hooks/usePlacement.d.ts +34 -0
  114. package/dist/hooks/usePlacement.js +89 -0
  115. package/dist/hooks/useSubscription.d.ts +40 -0
  116. package/dist/hooks/useSubscription.js +97 -0
  117. package/dist/index.d.ts +98 -0
  118. package/dist/index.js +198 -0
  119. package/dist/models/BillDogError.d.ts +40 -0
  120. package/dist/models/BillDogError.js +11 -0
  121. package/dist/models/CacheFetchPolicy.d.ts +8 -0
  122. package/dist/models/CacheFetchPolicy.js +4 -0
  123. package/dist/models/CustomProduct.d.ts +32 -0
  124. package/dist/models/CustomProduct.js +15 -0
  125. package/dist/models/CustomerInfo.d.ts +17 -0
  126. package/dist/models/CustomerInfo.js +11 -0
  127. package/dist/models/Delegate.d.ts +20 -0
  128. package/dist/models/Delegate.js +11 -0
  129. package/dist/models/EntitlementInfo.d.ts +19 -0
  130. package/dist/models/EntitlementInfo.js +2 -0
  131. package/dist/models/Placement.d.ts +54 -0
  132. package/dist/models/Placement.js +15 -0
  133. package/dist/models/PurchaseParams.d.ts +39 -0
  134. package/dist/models/PurchaseParams.js +60 -0
  135. package/dist/models/PurchaseResult.d.ts +30 -0
  136. package/dist/models/PurchaseResult.js +15 -0
  137. package/dist/models/RestoreResult.d.ts +30 -0
  138. package/dist/models/RestoreResult.js +22 -0
  139. package/dist/models/RestoredItem.d.ts +26 -0
  140. package/dist/models/RestoredItem.js +13 -0
  141. package/dist/modules/ABTest.d.ts +65 -0
  142. package/dist/modules/ABTest.js +113 -0
  143. package/dist/modules/Analytics.d.ts +91 -0
  144. package/dist/modules/Analytics.js +182 -0
  145. package/dist/modules/Survey.d.ts +65 -0
  146. package/dist/modules/Survey.js +82 -0
  147. package/dist/modules/VirtualCurrency.d.ts +63 -0
  148. package/dist/modules/VirtualCurrency.js +147 -0
  149. package/dist/murmur.d.ts +23 -0
  150. package/dist/murmur.js +104 -0
  151. package/dist/notifications/LiveActivitiesManager.d.ts +47 -0
  152. package/dist/notifications/LiveActivitiesManager.js +106 -0
  153. package/dist/notifications/NotificationScheduler.d.ts +55 -0
  154. package/dist/notifications/NotificationScheduler.js +199 -0
  155. package/dist/notifications/PurchaseNotificationHandler.d.ts +24 -0
  156. package/dist/notifications/PurchaseNotificationHandler.js +55 -0
  157. package/dist/notifications/useDeviceToken.d.ts +36 -0
  158. package/dist/notifications/useDeviceToken.js +97 -0
  159. package/dist/notifications/useLiveActivity.d.ts +39 -0
  160. package/dist/notifications/useLiveActivity.js +104 -0
  161. package/dist/review/ReviewAnalytics.d.ts +34 -0
  162. package/dist/review/ReviewAnalytics.js +73 -0
  163. package/dist/review/ReviewManager.d.ts +83 -0
  164. package/dist/review/ReviewManager.js +339 -0
  165. package/dist/review/ReviewTimingManager.d.ts +82 -0
  166. package/dist/review/ReviewTimingManager.js +224 -0
  167. package/dist/survey-core/types.d.ts +215 -0
  168. package/dist/survey-core/types.js +8 -0
  169. package/dist/types.d.ts +438 -0
  170. package/dist/types.js +158 -0
  171. package/dist/utils/ApiClient.d.ts +65 -0
  172. package/dist/utils/ApiClient.js +132 -0
  173. package/dist/utils/CSSConverter.d.ts +49 -0
  174. package/dist/utils/CSSConverter.js +470 -0
  175. package/dist/utils/animations.d.ts +41 -0
  176. package/dist/utils/animations.js +194 -0
  177. package/dist/utils/calendarIntegration.d.ts +36 -0
  178. package/dist/utils/calendarIntegration.js +89 -0
  179. package/dist/utils/configurationResolver.d.ts +23 -0
  180. package/dist/utils/configurationResolver.js +78 -0
  181. package/dist/utils/deviceDetection.d.ts +38 -0
  182. package/dist/utils/deviceDetection.js +59 -0
  183. package/dist/utils/hapticFeedback.d.ts +17 -0
  184. package/dist/utils/hapticFeedback.js +53 -0
  185. package/dist/utils/iconMapper.d.ts +26 -0
  186. package/dist/utils/iconMapper.js +113 -0
  187. package/dist/utils/notificationPermissions.d.ts +13 -0
  188. package/dist/utils/notificationPermissions.js +51 -0
  189. package/dist/utils/priceFormatting.d.ts +19 -0
  190. package/dist/utils/priceFormatting.js +99 -0
  191. package/dist/utils/shareSheet.d.ts +17 -0
  192. package/dist/utils/shareSheet.js +42 -0
  193. package/dist/utils/subscriptionUpgrade.d.ts +84 -0
  194. package/dist/utils/subscriptionUpgrade.js +100 -0
  195. package/dist/valueUtils.d.ts +48 -0
  196. package/dist/valueUtils.js +129 -0
  197. package/dist/xFlowTags.d.ts +18 -0
  198. package/dist/xFlowTags.js +385 -0
  199. package/ios/BillDogABTest.m +50 -0
  200. package/ios/BillDogABTest.swift +188 -0
  201. package/ios/BillDogAnalytics.m +105 -0
  202. package/ios/BillDogAnalytics.swift +324 -0
  203. package/ios/BillDogBridge.m +222 -0
  204. package/ios/BillDogBridge.swift +715 -0
  205. package/ios/BillDogLiveActivities.m +41 -0
  206. package/ios/BillDogLiveActivities.swift +104 -0
  207. package/ios/BillDogPaywallViewManager.m +39 -0
  208. package/ios/BillDogPaywallViewManager.swift +361 -0
  209. package/ios/BillDogSurvey.m +34 -0
  210. package/ios/BillDogSurvey.swift +257 -0
  211. package/ios/BillDogVirtualCurrencyBridge.m +63 -0
  212. package/ios/BillDogVirtualCurrencyBridge.swift +511 -0
  213. package/junit.xml +25 -0
  214. package/package.json +61 -0
  215. package/react-native.config.js +13 -0
  216. package/src/AdvancedPaywallCache.ts +433 -0
  217. package/src/BillDog.ts +983 -0
  218. package/src/BillDogConfiguration.ts +318 -0
  219. package/src/ComponentRenderer.tsx +1325 -0
  220. package/src/LayoutEngine.ts +459 -0
  221. package/src/LocalizationResolver.ts +311 -0
  222. package/src/NativePaywallView.tsx +132 -0
  223. package/src/PaywallCache.ts +358 -0
  224. package/src/PaywallStateManager.ts +154 -0
  225. package/src/PaywallView.tsx +328 -0
  226. package/src/ProductVariableProvider.ts +282 -0
  227. package/src/VariableResolver.ts +516 -0
  228. package/src/WebViewPaywall.tsx +454 -0
  229. package/src/animations/presets.ts +421 -0
  230. package/src/components/AccoladeCpsComponent.tsx +259 -0
  231. package/src/components/AccordionComponent.tsx +213 -0
  232. package/src/components/AnimatedWrapper.tsx +316 -0
  233. package/src/components/CarouselComponent.tsx +615 -0
  234. package/src/components/ChartCurveComponent.tsx +452 -0
  235. package/src/components/CheckboxComponent.tsx +185 -0
  236. package/src/components/ConfettiComponent.tsx +178 -0
  237. package/src/components/CountdownComponent.tsx +454 -0
  238. package/src/components/DelayedXComponent.tsx +266 -0
  239. package/src/components/DrawerModalComponent.tsx +324 -0
  240. package/src/components/GradientView.tsx +129 -0
  241. package/src/components/HapticFeedbackComponent.tsx +39 -0
  242. package/src/components/HorizontalProductsComponent.tsx +329 -0
  243. package/src/components/MultiChoiceGridComponent.tsx +265 -0
  244. package/src/components/NPSScaleComponent.tsx +294 -0
  245. package/src/components/NavigationComponent.tsx +329 -0
  246. package/src/components/OAuthButtonComponent.tsx +266 -0
  247. package/src/components/ProgressLoaderComponent.tsx +366 -0
  248. package/src/components/ProgressStepperComponent.tsx +250 -0
  249. package/src/components/SegmentedPickerComponent.tsx +245 -0
  250. package/src/components/ShareButtonsComponent.tsx +299 -0
  251. package/src/components/ShareCodeComponent.tsx +303 -0
  252. package/src/components/SingleChoiceGridComponent.tsx +229 -0
  253. package/src/components/SliderComponent.tsx +280 -0
  254. package/src/components/StarRatingInputComponent.tsx +223 -0
  255. package/src/components/StickerCompositeComponent.tsx +168 -0
  256. package/src/components/TabsComponent.tsx +496 -0
  257. package/src/components/TextInputComponent.tsx +258 -0
  258. package/src/components/TimelineComponent.tsx +129 -0
  259. package/src/components/ToggleComponent.tsx +142 -0
  260. package/src/components/VerticalProductsComponent.tsx +357 -0
  261. package/src/dynamicValues.ts +180 -0
  262. package/src/filters/dateFilters.ts +411 -0
  263. package/src/filters/index.ts +281 -0
  264. package/src/hooks/useOfferings.ts +192 -0
  265. package/src/hooks/usePaywall.ts +154 -0
  266. package/src/hooks/usePlacement.ts +143 -0
  267. package/src/hooks/useSubscription.ts +154 -0
  268. package/src/index.ts +245 -0
  269. package/src/models/BillDogError.ts +24 -0
  270. package/src/models/CacheFetchPolicy.ts +13 -0
  271. package/src/models/CustomProduct.ts +33 -0
  272. package/src/models/CustomerInfo.ts +26 -0
  273. package/src/models/Delegate.ts +22 -0
  274. package/src/models/EntitlementInfo.ts +27 -0
  275. package/src/models/Placement.ts +50 -0
  276. package/src/models/PurchaseParams.ts +81 -0
  277. package/src/models/PurchaseResult.ts +32 -0
  278. package/src/models/RestoreResult.ts +27 -0
  279. package/src/models/RestoredItem.ts +25 -0
  280. package/src/modules/ABTest.ts +131 -0
  281. package/src/modules/Analytics.ts +227 -0
  282. package/src/modules/Survey.ts +126 -0
  283. package/src/modules/VirtualCurrency.ts +223 -0
  284. package/src/murmur.ts +102 -0
  285. package/src/notifications/LiveActivitiesManager.ts +140 -0
  286. package/src/notifications/NotificationScheduler.ts +292 -0
  287. package/src/notifications/PurchaseNotificationHandler.ts +67 -0
  288. package/src/notifications/useDeviceToken.ts +116 -0
  289. package/src/notifications/useLiveActivity.ts +125 -0
  290. package/src/review/ReviewAnalytics.ts +89 -0
  291. package/src/review/ReviewManager.ts +355 -0
  292. package/src/review/ReviewTimingManager.ts +265 -0
  293. package/src/survey-core/types.ts +244 -0
  294. package/src/types/ambient.d.ts +9 -0
  295. package/src/types.ts +680 -0
  296. package/src/utils/ApiClient.ts +163 -0
  297. package/src/utils/CSSConverter.ts +552 -0
  298. package/src/utils/animations.ts +232 -0
  299. package/src/utils/calendarIntegration.ts +113 -0
  300. package/src/utils/configurationResolver.ts +106 -0
  301. package/src/utils/deviceDetection.ts +83 -0
  302. package/src/utils/hapticFeedback.ts +55 -0
  303. package/src/utils/iconMapper.ts +102 -0
  304. package/src/utils/notificationPermissions.ts +48 -0
  305. package/src/utils/priceFormatting.ts +119 -0
  306. package/src/utils/shareSheet.ts +55 -0
  307. package/src/utils/subscriptionUpgrade.ts +183 -0
  308. package/src/valueUtils.ts +108 -0
  309. package/src/xFlowTags.ts +463 -0
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * CustomProduct — Superwall-style non-StoreKit / non-Play product.
4
+ *
5
+ * Spec: PUR-363, PUR-364
6
+ *
7
+ * Used to describe products that don't live in the App Store or Play Console
8
+ * (Stripe SKUs, Paddle plans, in-house entitlements). Routing is **only**
9
+ * dispatched through a host-provided PurchaseController; the bundled internal
10
+ * controller will reject custom products.
11
+ *
12
+ * Field names are kept identical to the native iOS (CustomProduct.swift) and
13
+ * Android (CustomProduct.kt) models so the contract is the same across SDKs.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import type { EntitlementInfo } from './EntitlementInfo';
2
+ /**
3
+ * Server-authoritative CustomerInfo (PUR-120, PUR-121, PUR-123).
4
+ */
5
+ export interface CustomerInfo {
6
+ userId: string;
7
+ entitlements: EntitlementInfo[];
8
+ activeSubscriptions: string[];
9
+ originalAppUserId?: string;
10
+ isInTrial?: boolean;
11
+ isInGracePeriod?: boolean;
12
+ hasExpiredSubscription?: boolean;
13
+ /** PUR-121: instant local resolution before backend confirms. */
14
+ productEntitlementMapping: Record<string, string[]>;
15
+ }
16
+ /** PUR-121: resolve entitlements unlocked by a product ID without a server hop. */
17
+ export declare function entitlementsByProductId(info: CustomerInfo, productId: string): EntitlementInfo[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.entitlementsByProductId = entitlementsByProductId;
4
+ /** PUR-121: resolve entitlements unlocked by a product ID without a server hop. */
5
+ function entitlementsByProductId(info, productId) {
6
+ var _a;
7
+ const ids = (_a = info.productEntitlementMapping) === null || _a === void 0 ? void 0 : _a[productId];
8
+ if (!ids || ids.length === 0)
9
+ return [];
10
+ return info.entitlements.filter((e) => ids.includes(e.identifier));
11
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * BillDogDelegate — typed lifecycle callbacks (Android parity:
3
+ * `BillDog.delegate` at BillDog.kt:71, BillDogDelegate interface).
4
+ *
5
+ * Consumers set a delegate via `BillDog.setDelegate(d)`. All callbacks are
6
+ * optional; the SDK fires the ones that are defined. The contract is
7
+ * intentionally flat so each platform can implement it as a class, plain
8
+ * object, or function set as the host conventions dictate.
9
+ */
10
+ import type { SkipReason } from './Placement';
11
+ export interface BillDogDelegate {
12
+ onPaywallPresented?: (paywallId: string) => void;
13
+ onPaywallDismissed?: (paywallId: string) => void;
14
+ onPaywallSkipped?: (placementId: string, reason: SkipReason) => void;
15
+ onPurchaseStarted?: (productId: string) => void;
16
+ onPurchaseCompleted?: (productId: string) => void;
17
+ onPurchaseFailed?: (productId: string, error: string) => void;
18
+ onRestoreCompleted?: (itemCount: number) => void;
19
+ onSubscriptionStatusChanged?: (status: string) => void;
20
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * BillDogDelegate — typed lifecycle callbacks (Android parity:
4
+ * `BillDog.delegate` at BillDog.kt:71, BillDogDelegate interface).
5
+ *
6
+ * Consumers set a delegate via `BillDog.setDelegate(d)`. All callbacks are
7
+ * optional; the SDK fires the ones that are defined. The contract is
8
+ * intentionally flat so each platform can implement it as a class, plain
9
+ * object, or function set as the host conventions dictate.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Entitlement lifecycle state — 6 canonical cases (PUR-122).
3
+ */
4
+ export type EntitlementState = 'ACTIVE' | 'TRIAL' | 'GRACE_PERIOD' | 'BILLING_RETRY' | 'EXPIRED' | 'REVOKED' | 'UNKNOWN';
5
+ export interface EntitlementInfo {
6
+ identifier: string;
7
+ isActive: boolean;
8
+ expiresAt?: string;
9
+ store?: string;
10
+ grantedAt?: string;
11
+ displayName?: string;
12
+ willRenew?: boolean;
13
+ isLifetime?: boolean;
14
+ state?: EntitlementState;
15
+ productIds?: string[];
16
+ startsAt?: string;
17
+ renewedAt?: string;
18
+ latestProductId?: string;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Placement-registration types — Android parity contract.
3
+ *
4
+ * Reference: native-sdks/android/billdog-core/src/main/java/com/billdog/core/BillDog.kt
5
+ * - register() at line 981 / 990
6
+ * - hasAccessForPlacement() at line 1024
7
+ * - getPresentationResult() at line 1938
8
+ * - PlacementResult sealed class (PlacementManager.kt)
9
+ * - PaywallPresentationHandler (PaywallPresentationHandler.kt)
10
+ * - PresentationResult sealed class (BillDog.kt:2059)
11
+ * - SkipReason enum (BillDogDelegate.kt)
12
+ * - PaywallLoadingState enum
13
+ */
14
+ /** Outcome of a placement registration call. */
15
+ export type PlacementResult = {
16
+ type: 'entitled';
17
+ } | {
18
+ type: 'purchased';
19
+ productId: string;
20
+ } | {
21
+ type: 'dismissed';
22
+ } | {
23
+ type: 'restored';
24
+ } | {
25
+ type: 'error';
26
+ message: string;
27
+ };
28
+ /** Synchronous "what would happen if I registered this placement?" answer. */
29
+ export type PresentationResult = {
30
+ type: 'paywall';
31
+ } | {
32
+ type: 'userSubscribed';
33
+ } | {
34
+ type: 'noPaywall';
35
+ reason: string;
36
+ } | {
37
+ type: 'holdout';
38
+ } | {
39
+ type: 'error';
40
+ message: string;
41
+ };
42
+ export type PaywallLoadingState = 'loading' | 'ready' | 'failed';
43
+ export type SkipReason = 'user_has_entitlement' | 'holdout' | 'no_paywall_configured' | 'error';
44
+ export type PostPurchaseBehavior = 'close' | 'keep_open';
45
+ /** Optional lifecycle callbacks for `register()`. All callbacks are optional. */
46
+ export interface PaywallPresentationHandler {
47
+ onPresent?: (paywallId: string) => void;
48
+ onDismiss?: (paywallId: string) => void;
49
+ onError?: (error: Error) => void;
50
+ onSkip?: (reason: SkipReason) => void;
51
+ onPurchaseSuccess?: (productId: string) => PostPurchaseBehavior | void;
52
+ onFinish?: (paywallId: string, shouldDismiss: boolean) => boolean;
53
+ onLoadingStateChange?: (state: PaywallLoadingState) => void;
54
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * Placement-registration types — Android parity contract.
4
+ *
5
+ * Reference: native-sdks/android/billdog-core/src/main/java/com/billdog/core/BillDog.kt
6
+ * - register() at line 981 / 990
7
+ * - hasAccessForPlacement() at line 1024
8
+ * - getPresentationResult() at line 1938
9
+ * - PlacementResult sealed class (PlacementManager.kt)
10
+ * - PaywallPresentationHandler (PaywallPresentationHandler.kt)
11
+ * - PresentationResult sealed class (BillDog.kt:2059)
12
+ * - SkipReason enum (BillDogDelegate.kt)
13
+ * - PaywallLoadingState enum
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,39 @@
1
+ /**
2
+ * PurchaseParams — RN bridge mirror of iOS/Android `PurchaseParams.Builder`.
3
+ *
4
+ * Spec: PUR-314, PUR-350, PUR-364
5
+ * Standard: mem://architecture/purchase-conformance-standard
6
+ *
7
+ * Cross-platform typed parameters for `BillDog.purchase(params)`. All fields
8
+ * other than `productId` are optional. Use the static `builder()` for fluent
9
+ * construction matching the native SDKs.
10
+ */
11
+ export type GoogleReplacementMode = 'WITH_TIME_PRORATION' | 'CHARGE_PRORATED_PRICE' | 'WITHOUT_PRORATION' | 'CHARGE_FULL_PRICE' | 'DEFERRED';
12
+ export interface PurchaseParams {
13
+ productId: string;
14
+ offerToken?: string;
15
+ promoOfferId?: string;
16
+ winBackOfferId?: string;
17
+ appAccountToken?: string;
18
+ obfuscatedProfileId?: string;
19
+ quantity?: number;
20
+ isPersonalizedOffer?: boolean;
21
+ replacementMode?: GoogleReplacementMode;
22
+ }
23
+ export declare class PurchaseParamsBuilder {
24
+ private params;
25
+ constructor(productId: string);
26
+ offerToken(value: string | undefined): this;
27
+ promoOfferId(value: string | undefined): this;
28
+ winBackOfferId(value: string | undefined): this;
29
+ appAccountToken(value: string | undefined): this;
30
+ obfuscatedProfileId(value: string | undefined): this;
31
+ quantity(value: number): this;
32
+ isPersonalizedOffer(value: boolean | undefined): this;
33
+ replacementMode(value: GoogleReplacementMode | undefined): this;
34
+ build(): PurchaseParams;
35
+ }
36
+ export declare const PurchaseParams: {
37
+ /** Fluent builder — mirrors RevenueCat 5.x `PurchaseParams.Builder`. */
38
+ builder(productId: string): PurchaseParamsBuilder;
39
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /**
3
+ * PurchaseParams — RN bridge mirror of iOS/Android `PurchaseParams.Builder`.
4
+ *
5
+ * Spec: PUR-314, PUR-350, PUR-364
6
+ * Standard: mem://architecture/purchase-conformance-standard
7
+ *
8
+ * Cross-platform typed parameters for `BillDog.purchase(params)`. All fields
9
+ * other than `productId` are optional. Use the static `builder()` for fluent
10
+ * construction matching the native SDKs.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.PurchaseParams = exports.PurchaseParamsBuilder = void 0;
14
+ class PurchaseParamsBuilder {
15
+ constructor(productId) {
16
+ this.params = { productId, quantity: 1 };
17
+ }
18
+ offerToken(value) {
19
+ this.params.offerToken = value;
20
+ return this;
21
+ }
22
+ promoOfferId(value) {
23
+ this.params.promoOfferId = value;
24
+ return this;
25
+ }
26
+ winBackOfferId(value) {
27
+ this.params.winBackOfferId = value;
28
+ return this;
29
+ }
30
+ appAccountToken(value) {
31
+ this.params.appAccountToken = value;
32
+ return this;
33
+ }
34
+ obfuscatedProfileId(value) {
35
+ this.params.obfuscatedProfileId = value;
36
+ return this;
37
+ }
38
+ quantity(value) {
39
+ this.params.quantity = value < 1 ? 1 : value;
40
+ return this;
41
+ }
42
+ isPersonalizedOffer(value) {
43
+ this.params.isPersonalizedOffer = value;
44
+ return this;
45
+ }
46
+ replacementMode(value) {
47
+ this.params.replacementMode = value;
48
+ return this;
49
+ }
50
+ build() {
51
+ return { ...this.params };
52
+ }
53
+ }
54
+ exports.PurchaseParamsBuilder = PurchaseParamsBuilder;
55
+ exports.PurchaseParams = {
56
+ /** Fluent builder — mirrors RevenueCat 5.x `PurchaseParams.Builder`. */
57
+ builder(productId) {
58
+ return new PurchaseParamsBuilder(productId);
59
+ },
60
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * PurchaseResult — canonical 5-case discriminated union for any purchase op.
3
+ *
4
+ * Spec: PUR-180, PUR-181, PUR-182, PUR-058, PUR-059, PUR-364
5
+ * Standard: mem://architecture/purchase-authoritative-standard
6
+ *
7
+ * Mirrored byte-identically with iOS/Android. User cancellation MUST surface
8
+ * as `cancelled` (never `failed`); Ask-to-Buy / Android PENDING MUST surface
9
+ * as `pending`.
10
+ */
11
+ import type { BillDogError } from './BillDogError';
12
+ export type PurchaseResult = {
13
+ type: 'purchased';
14
+ transactionId: string;
15
+ productId: string;
16
+ originalTransactionId?: string;
17
+ } | {
18
+ type: 'cancelled';
19
+ } | {
20
+ type: 'pending';
21
+ } | {
22
+ type: 'failed';
23
+ error: BillDogError;
24
+ } | {
25
+ type: 'restored';
26
+ transactionId: string;
27
+ productId: string;
28
+ originalTransactionId?: string;
29
+ };
30
+ export declare const isSuccess: (r: PurchaseResult) => boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * PurchaseResult — canonical 5-case discriminated union for any purchase op.
4
+ *
5
+ * Spec: PUR-180, PUR-181, PUR-182, PUR-058, PUR-059, PUR-364
6
+ * Standard: mem://architecture/purchase-authoritative-standard
7
+ *
8
+ * Mirrored byte-identically with iOS/Android. User cancellation MUST surface
9
+ * as `cancelled` (never `failed`); Ask-to-Buy / Android PENDING MUST surface
10
+ * as `pending`.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.isSuccess = void 0;
14
+ const isSuccess = (r) => r.type === 'purchased' || r.type === 'restored';
15
+ exports.isSuccess = isSuccess;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Canonical RestoreResult — 2-case discriminated union for restore operations.
3
+ *
4
+ * Spec: PUR-080, PUR-081, PUR-082 (.lovable/purchase-conformance-spec.md)
5
+ * Standard: mem://architecture/purchase-authoritative-standard
6
+ * mem://architecture/react-native/sdk-unified-standard
7
+ *
8
+ * Mirrored byte-identically across iOS/Android/Flutter.
9
+ *
10
+ * - `restored` : restore succeeded; `items` MAY be empty (= nothing
11
+ * to restore, PUR-080). Callers MUST NOT treat empty
12
+ * as failure.
13
+ * - `failed` : global failure (network, store sync threw).
14
+ * Per-transaction failures live in `RestoredItem.status`,
15
+ * never here.
16
+ */
17
+ import type { BillDogError } from './BillDogError';
18
+ import type { RestoredItem } from './RestoredItem';
19
+ export type RestoreResult = {
20
+ type: 'restored';
21
+ items: RestoredItem[];
22
+ } | {
23
+ type: 'failed';
24
+ error: BillDogError;
25
+ };
26
+ /** Convenience: was the restore globally successful? */
27
+ export declare const isRestoreOk: (r: RestoreResult) => r is {
28
+ type: "restored";
29
+ items: RestoredItem[];
30
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Canonical RestoreResult — 2-case discriminated union for restore operations.
4
+ *
5
+ * Spec: PUR-080, PUR-081, PUR-082 (.lovable/purchase-conformance-spec.md)
6
+ * Standard: mem://architecture/purchase-authoritative-standard
7
+ * mem://architecture/react-native/sdk-unified-standard
8
+ *
9
+ * Mirrored byte-identically across iOS/Android/Flutter.
10
+ *
11
+ * - `restored` : restore succeeded; `items` MAY be empty (= nothing
12
+ * to restore, PUR-080). Callers MUST NOT treat empty
13
+ * as failure.
14
+ * - `failed` : global failure (network, store sync threw).
15
+ * Per-transaction failures live in `RestoredItem.status`,
16
+ * never here.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.isRestoreOk = void 0;
20
+ /** Convenience: was the restore globally successful? */
21
+ const isRestoreOk = (r) => r.type === 'restored';
22
+ exports.isRestoreOk = isRestoreOk;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * RestoredItem & RestoreItemStatus — canonical per-transaction restore record.
3
+ *
4
+ * Spec: PUR-081, PUR-082 (.lovable/purchase-conformance-spec.md)
5
+ * Standard: mem://architecture/purchase-authoritative-standard
6
+ * mem://architecture/react-native/sdk-unified-standard
7
+ *
8
+ * Mirrored byte-identically across iOS/Android/Flutter. Per-transaction
9
+ * failure MUST be reported in `status` — never collapsed into a global
10
+ * `RestoreResult.failed`.
11
+ */
12
+ import type { BillDogError } from './BillDogError';
13
+ export type RestoreItemStatus = {
14
+ type: 'restored';
15
+ } | {
16
+ type: 'expired';
17
+ } | {
18
+ type: 'failed';
19
+ error: BillDogError;
20
+ };
21
+ export interface RestoredItem {
22
+ productId: string;
23
+ transactionId: string;
24
+ originalTransactionId?: string;
25
+ status: RestoreItemStatus;
26
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * RestoredItem & RestoreItemStatus — canonical per-transaction restore record.
4
+ *
5
+ * Spec: PUR-081, PUR-082 (.lovable/purchase-conformance-spec.md)
6
+ * Standard: mem://architecture/purchase-authoritative-standard
7
+ * mem://architecture/react-native/sdk-unified-standard
8
+ *
9
+ * Mirrored byte-identically across iOS/Android/Flutter. Per-transaction
10
+ * failure MUST be reported in `status` — never collapsed into a global
11
+ * `RestoreResult.failed`.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @billdog.io/react-native — A/B Testing Module
3
+ *
4
+ * Native bridge to BillDogABTest (iOS) / billdog-abtest (Android).
5
+ * Provides experiment assignment, variant retrieval, and conversion tracking.
6
+ *
7
+ * Types and methods align 1:1 with the native SDK surface.
8
+ */
9
+ export interface ExperimentAssignment {
10
+ experimentId: string;
11
+ variantId: string;
12
+ variantName: string;
13
+ config: Record<string, any>;
14
+ isControl: boolean;
15
+ }
16
+ export declare class ABTestManager {
17
+ private static instance;
18
+ private initialized;
19
+ private constructor();
20
+ static getInstance(): ABTestManager;
21
+ /**
22
+ * Initialize the A/B Testing module.
23
+ */
24
+ initialize(): Promise<void>;
25
+ /**
26
+ * Get the variant assignment for an experiment.
27
+ * Returns the cached assignment if available, otherwise fetches from the server.
28
+ */
29
+ getVariant(experimentId: string): Promise<ExperimentAssignment | null>;
30
+ /**
31
+ * Track a conversion event for an experiment.
32
+ */
33
+ trackConversion(experimentId: string, value?: number, metadata?: Record<string, any>): Promise<void>;
34
+ /**
35
+ * Track an impression event for an experiment.
36
+ */
37
+ trackImpression(experimentId: string): Promise<void>;
38
+ /**
39
+ * Set the user ID for server-side experiment assignment.
40
+ * Triggers automatic experiment refresh (matching native behavior).
41
+ */
42
+ setUserId(id: string): Promise<void>;
43
+ /**
44
+ * Set user attributes for experiment targeting.
45
+ */
46
+ setAttributes(attributes: Record<string, any>): Promise<void>;
47
+ /**
48
+ * Get a feature flag value.
49
+ */
50
+ getFeatureFlag(key: string): Promise<any>;
51
+ /**
52
+ * Refresh experiment assignments from the server.
53
+ */
54
+ refreshExperiments(): Promise<void>;
55
+ /**
56
+ * Reset all experiment state and cached assignments.
57
+ */
58
+ reset(): Promise<void>;
59
+ /**
60
+ * Listen to assignment changes (e.g., after refresh).
61
+ */
62
+ onAssignmentChanged(callback: (assignment: ExperimentAssignment) => void): import("react-native").EmitterSubscription | undefined;
63
+ }
64
+ declare const _default: ABTestManager;
65
+ export default _default;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /**
3
+ * @billdog.io/react-native — A/B Testing Module
4
+ *
5
+ * Native bridge to BillDogABTest (iOS) / billdog-abtest (Android).
6
+ * Provides experiment assignment, variant retrieval, and conversion tracking.
7
+ *
8
+ * Types and methods align 1:1 with the native SDK surface.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ABTestManager = void 0;
12
+ const react_native_1 = require("react-native");
13
+ const { BillDogABTest } = react_native_1.NativeModules;
14
+ const eventEmitter = BillDogABTest ? new react_native_1.NativeEventEmitter(BillDogABTest) : null;
15
+ // MARK: - A/B Test Manager
16
+ class ABTestManager {
17
+ constructor() {
18
+ this.initialized = false;
19
+ }
20
+ static getInstance() {
21
+ if (!ABTestManager.instance) {
22
+ ABTestManager.instance = new ABTestManager();
23
+ }
24
+ return ABTestManager.instance;
25
+ }
26
+ /**
27
+ * Initialize the A/B Testing module.
28
+ */
29
+ async initialize() {
30
+ if (!BillDogABTest) {
31
+ console.warn('[BillDogABTest] Native module not linked. A/B Testing will be no-op.');
32
+ return;
33
+ }
34
+ await BillDogABTest.initialize();
35
+ this.initialized = true;
36
+ }
37
+ /**
38
+ * Get the variant assignment for an experiment.
39
+ * Returns the cached assignment if available, otherwise fetches from the server.
40
+ */
41
+ async getVariant(experimentId) {
42
+ if (!this.initialized || !BillDogABTest)
43
+ return null;
44
+ return await BillDogABTest.getVariant(experimentId);
45
+ }
46
+ /**
47
+ * Track a conversion event for an experiment.
48
+ */
49
+ async trackConversion(experimentId, value, metadata) {
50
+ if (!this.initialized || !BillDogABTest)
51
+ return;
52
+ await BillDogABTest.trackConversion(experimentId, value !== null && value !== void 0 ? value : 1, metadata !== null && metadata !== void 0 ? metadata : {});
53
+ }
54
+ /**
55
+ * Track an impression event for an experiment.
56
+ */
57
+ async trackImpression(experimentId) {
58
+ if (!this.initialized || !BillDogABTest)
59
+ return;
60
+ await BillDogABTest.trackImpression(experimentId);
61
+ }
62
+ /**
63
+ * Set the user ID for server-side experiment assignment.
64
+ * Triggers automatic experiment refresh (matching native behavior).
65
+ */
66
+ async setUserId(id) {
67
+ if (!BillDogABTest)
68
+ return;
69
+ await BillDogABTest.setUserId(id);
70
+ }
71
+ /**
72
+ * Set user attributes for experiment targeting.
73
+ */
74
+ async setAttributes(attributes) {
75
+ if (!BillDogABTest)
76
+ return;
77
+ await BillDogABTest.setAttributes(attributes);
78
+ }
79
+ /**
80
+ * Get a feature flag value.
81
+ */
82
+ async getFeatureFlag(key) {
83
+ if (!this.initialized || !BillDogABTest)
84
+ return null;
85
+ return await BillDogABTest.getFeatureFlag(key);
86
+ }
87
+ /**
88
+ * Refresh experiment assignments from the server.
89
+ */
90
+ async refreshExperiments() {
91
+ if (!this.initialized || !BillDogABTest)
92
+ return;
93
+ await BillDogABTest.refreshExperiments();
94
+ }
95
+ /**
96
+ * Reset all experiment state and cached assignments.
97
+ */
98
+ async reset() {
99
+ if (!BillDogABTest)
100
+ return;
101
+ await BillDogABTest.reset();
102
+ this.initialized = false;
103
+ }
104
+ /**
105
+ * Listen to assignment changes (e.g., after refresh).
106
+ */
107
+ onAssignmentChanged(callback) {
108
+ return eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener('onExperimentAssignmentChanged', callback);
109
+ }
110
+ }
111
+ exports.ABTestManager = ABTestManager;
112
+ ABTestManager.instance = null;
113
+ exports.default = ABTestManager.getInstance();