@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
package/src/index.ts ADDED
@@ -0,0 +1,245 @@
1
+ /**
2
+ * BillDog React Native Paywalls SDK
3
+ *
4
+ * Usage:
5
+ * import { PaywallView } from '@billdog.io/react-native';
6
+ *
7
+ * <PaywallView
8
+ * paywallIdentifier="premium_offer"
9
+ * onButtonPress={(id, action) => console.log('Button pressed', id, action)}
10
+ * />
11
+ */
12
+
13
+ export { PaywallView } from './PaywallView';
14
+ export { ComponentRenderer } from './ComponentRenderer';
15
+ export { PaywallStateManager, paywallStateManager } from './PaywallStateManager';
16
+ export type { StateListener, Unsubscribe } from './PaywallStateManager';
17
+ // Optional WebView-based paywall — alternative to the native PaywallView
18
+ // that loads the unified renderer bundle iOS/Android/Flutter use.
19
+ // Requires react-native-webview peer dep (already listed). See
20
+ // docs/webview-implementation/04-react-native-implementation.md.
21
+ export { WebViewPaywall } from './WebViewPaywall';
22
+ export type { WebViewPaywallProps } from './WebViewPaywall';
23
+ // Option 2 inline path: embeds the NATIVE paywall view via the `BDPaywallView`
24
+ // native component (BillDogPaywallViewManager on iOS/Android).
25
+ export {
26
+ NativePaywallView,
27
+ isNativePaywallAvailable,
28
+ } from './NativePaywallView';
29
+ export type { NativePaywallViewProps } from './NativePaywallView';
30
+ export { ProgressLoaderComponent } from './components/ProgressLoaderComponent';
31
+ export { ChartCurveComponent } from './components/ChartCurveComponent';
32
+ export { SingleChoiceGridComponent } from './components/SingleChoiceGridComponent';
33
+ export { MultiChoiceGridComponent } from './components/MultiChoiceGridComponent';
34
+ export { DrawerModalComponent } from './components/DrawerModalComponent';
35
+ export { TimelineComponent } from './components/TimelineComponent';
36
+ export { TextInputComponent } from './components/TextInputComponent';
37
+ export { StarRatingInputComponent } from './components/StarRatingInputComponent';
38
+ export { NPSScaleComponent } from './components/NPSScaleComponent';
39
+ export { OAuthButtonComponent } from './components/OAuthButtonComponent';
40
+ export { ProgressStepperComponent } from './components/ProgressStepperComponent';
41
+ export { ShareCodeComponent } from './components/ShareCodeComponent';
42
+ export { ShareButtonsComponent } from './components/ShareButtonsComponent';
43
+ export { LayoutEngine } from './LayoutEngine';
44
+ export { usePaywall } from './hooks/usePaywall';
45
+ export { useOfferings } from './hooks/useOfferings';
46
+ export { usePlacement } from './hooks/usePlacement';
47
+
48
+ // Configuration
49
+ export { BillDog } from './BillDog';
50
+ // Custom purchase / PurchaseController surface (PUR-363/364) — the types a host
51
+ // app needs to implement a controller and define non-store products.
52
+ export type { PurchaseController } from './BillDog';
53
+ export type { CustomProduct } from './models/CustomProduct';
54
+ export type { PurchaseResult } from './models/PurchaseResult';
55
+ export type { RestoreResult } from './models/RestoreResult';
56
+ export { BillDogConfiguration, DEFAULT_API_BASE_URL } from './BillDogConfiguration';
57
+ export type { BillDogConfig } from './BillDogConfiguration';
58
+
59
+ // Export cache classes
60
+ export { PaywallCache } from './PaywallCache';
61
+ export { AdvancedPaywallCache } from './AdvancedPaywallCache';
62
+
63
+ // Export device detection and configuration resolver
64
+ export { detectDeviceCategory, getDeviceInfo, isTablet } from './utils/deviceDetection';
65
+ export { resolveConfiguration, findNearestConfig } from './utils/configurationResolver';
66
+
67
+ // Export haptic feedback
68
+ export { triggerHaptic, isHapticAvailable } from './utils/hapticFeedback';
69
+
70
+ // Export review functionality
71
+ export {
72
+ requestReview,
73
+ canRequestReview,
74
+ initializeReviewTiming,
75
+ recordReviewSession,
76
+ recordSignificantEvent,
77
+ shouldRequestReview,
78
+ } from './review/ReviewManager';
79
+ export { ReviewAnalytics } from './review/ReviewAnalytics';
80
+ export type { ReviewAnalyticsEvent } from './review/ReviewAnalytics';
81
+ export { ReviewTimingManager } from './review/ReviewTimingManager';
82
+ export type { ReviewTimingConfig } from './review/ReviewTimingManager';
83
+
84
+ export type {
85
+ PaywallComponent,
86
+ PaywallConfiguration,
87
+ ComponentType,
88
+ Layout,
89
+ Appearance,
90
+ Size,
91
+ Position,
92
+ LayoutType,
93
+ Product,
94
+ OfferingPackage,
95
+ } from './types';
96
+
97
+ // Export Variable and Localization Resolvers
98
+ export { VariableResolver } from './VariableResolver';
99
+ export type { DeviceInfo } from './VariableResolver';
100
+ export { LocalizationResolver } from './LocalizationResolver';
101
+
102
+ // Re-export locale override API for convenience
103
+ export const setLocaleOverride = (locale: string | undefined) => {
104
+ BillDogConfiguration.setLocaleOverride(locale);
105
+ };
106
+ export const getLocaleOverride = (): string | undefined => {
107
+ return BillDogConfiguration.getLocaleOverride();
108
+ };
109
+
110
+ // Import for re-export
111
+ import { BillDogConfiguration } from './BillDogConfiguration';
112
+
113
+ export * from './utils/priceFormatting';
114
+
115
+ // Export CSS conversion and gradient utilities
116
+ export {
117
+ convertCSSToReactNative,
118
+ validateCSSForNative,
119
+ angleToGradientPoints,
120
+ } from './utils/CSSConverter';
121
+ export type {
122
+ CSSConversionResult,
123
+ GradientConfig,
124
+ GradientStop
125
+ } from './utils/CSSConverter';
126
+
127
+ // Export GradientView component
128
+ export {
129
+ GradientView,
130
+ isGradientSupported,
131
+ getGradientStyleOrFallback
132
+ } from './components/GradientView';
133
+ export type { GradientViewProps } from './components/GradientView';
134
+
135
+ // Export hook types for better TypeScript support
136
+ export type { UseOfferingsOptions, UseOfferingsResult } from './hooks/useOfferings';
137
+ export type { UsePaywallOptions, UsePaywallResult } from './hooks/usePaywall';
138
+ export type { UsePlacementResult } from './hooks/usePlacement';
139
+
140
+ // Export cache types
141
+ export type { AdvancedCacheConfig } from './AdvancedPaywallCache';
142
+ export type { CacheConfig } from './PaywallCache';
143
+
144
+ // Export device detection types
145
+ export type { DeviceCategory, DeviceCategoryInfo } from './utils/deviceDetection';
146
+ export type { MultiPaywallConfig } from './utils/configurationResolver';
147
+
148
+ // Notification utilities
149
+ export {
150
+ NotificationScheduler,
151
+ requestNotificationPermissions,
152
+ checkNotificationPermissions,
153
+ scheduleTrialNotification,
154
+ cancelTrialNotification,
155
+ getScheduledNotifications,
156
+ } from './notifications/NotificationScheduler';
157
+ export type { NotificationConfig, Subscription } from './notifications/NotificationScheduler';
158
+ export { useDeviceToken, registerDeviceToken } from './notifications/useDeviceToken';
159
+ export { PurchaseNotificationHandler } from './notifications/PurchaseNotificationHandler';
160
+ export type { PurchaseNotificationConfig, PurchaseDetails } from './notifications/PurchaseNotificationHandler';
161
+
162
+ export {
163
+ requestNotificationPermission,
164
+ checkNotificationPermission,
165
+ isNotificationSupported,
166
+ } from './utils/notificationPermissions';
167
+ export type { NotificationPermissionStatus } from './utils/notificationPermissions';
168
+
169
+ // Export share sheet utilities
170
+ export { share, isShareSupported } from './utils/shareSheet';
171
+ export type { ShareData, ShareResult } from './utils/shareSheet';
172
+
173
+ // Export calendar integration utilities
174
+ export {
175
+ requestCalendarPermission,
176
+ checkCalendarPermission,
177
+ addCalendarEvent,
178
+ isCalendarSupported,
179
+ } from './utils/calendarIntegration';
180
+ export type {
181
+ CalendarEvent,
182
+ CalendarPermissionStatus,
183
+ CalendarResult,
184
+ } from './utils/calendarIntegration';
185
+
186
+ // Export Live Activities (iOS 16.1+)
187
+ export { LiveActivitiesManager, liveActivities } from './notifications/LiveActivitiesManager';
188
+ export { useLiveActivity } from './notifications/useLiveActivity';
189
+ export type {
190
+ LiveActivityConfig,
191
+ LiveActivityUpdate
192
+ } from './notifications/LiveActivitiesManager';
193
+ export type {
194
+ UseLiveActivityOptions,
195
+ UseLiveActivityReturn
196
+ } from './notifications/useLiveActivity';
197
+
198
+ // Export subscription upgrade utilities
199
+ export { useSubscription } from './hooks/useSubscription';
200
+ export type { UseSubscriptionOptions, UseSubscriptionReturn } from './hooks/useSubscription';
201
+ export {
202
+ previewSubscriptionUpgrade,
203
+ upgradeSubscription,
204
+ downgradeSubscription,
205
+ } from './utils/subscriptionUpgrade';
206
+ export type {
207
+ SubscriptionUpgradeOptions,
208
+ ProrationPreview,
209
+ SubscriptionUpgradeResult,
210
+ ProrationBehavior,
211
+ BillingCycleAnchor,
212
+ } from './utils/subscriptionUpgrade';
213
+
214
+ // Modules — Analytics, A/B Testing, Survey, Virtual Currency
215
+ export { AnalyticsManager } from './modules/Analytics';
216
+ export type { AnalyticsEvent, RevenueEvent, UserProperties, UserPropertyOperation } from './modules/Analytics';
217
+
218
+ export { ABTestManager } from './modules/ABTest';
219
+ export type { ExperimentAssignment } from './modules/ABTest';
220
+
221
+ export { SurveyManager } from './modules/Survey';
222
+ export type {
223
+ Survey,
224
+ SurveyPage,
225
+ SurveyQuestion,
226
+ SurveyChoice,
227
+ SurveyAnswer,
228
+ SurveyResponse,
229
+ SurveyPresentationOptions,
230
+ } from './modules/Survey';
231
+
232
+ export { VirtualCurrencyManager } from './modules/VirtualCurrency';
233
+ export type {
234
+ VirtualCurrency,
235
+ VirtualCurrencyTransaction,
236
+ ExchangeResult,
237
+ VirtualCurrencyConfig,
238
+ } from './modules/VirtualCurrency';
239
+
240
+ // Internal components are rendered by ComponentRenderer and intentionally NOT exported:
241
+ // AccoladeCpsComponent, AccordionComponent, AnimatedWrapper, CarouselComponent,
242
+ // CheckboxComponent, ConfettiComponent, CountdownComponent, DelayedXComponent,
243
+ // HorizontalProductsComponent, NavigationComponent, SegmentedPickerComponent,
244
+ // SliderComponent, StickerCompositeComponent, TabsComponent, ToggleComponent,
245
+ // VerticalProductsComponent
@@ -0,0 +1,24 @@
1
+ /**
2
+ * BillDogError — canonical typed error model (RN mirror).
3
+ *
4
+ * Spec: PUR-200, PUR-201, PUR-202 (.lovable/purchase-conformance-spec.md)
5
+ * Standard: mem://architecture/purchase-authoritative-standard
6
+ *
7
+ * Discriminated union; raw strings are NEVER surfaced across the public
8
+ * boundary. `category` is stable for analytics / logs.
9
+ */
10
+
11
+ export type BillDogError =
12
+ | { category: 'network'; message: string }
13
+ | { category: 'store'; message: string; code?: number }
14
+ | { category: 'storeUnavailable'; message: string }
15
+ | { category: 'configuration'; message: string }
16
+ | { category: 'productNotFound'; message: string; productId: string }
17
+ | { category: 'receiptValidation'; message: string }
18
+ | { category: 'userCancelled'; message: string }
19
+ | { category: 'unknown'; message: string };
20
+
21
+ /**
22
+ * PUR-262: SDK-wide log levels. Canonical 5-level set, parity with iOS/Android.
23
+ */
24
+ export type BillDogLogLevel = 'verbose' | 'debug' | 'info' | 'warn' | 'error';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Fetch policy for CustomerInfo — canonical 4 cases (PUR-140).
3
+ *
4
+ * Spec: `.lovable/purchase-conformance-spec.md`
5
+ * Default: `CACHED_OR_FETCHED` (PUR-141).
6
+ */
7
+ export type CacheFetchPolicy =
8
+ | 'FROM_CACHE_ONLY'
9
+ | 'FETCH_CURRENT'
10
+ | 'CACHED_OR_FETCHED'
11
+ | 'NOT_STALE_CACHED_OR_CURRENT';
12
+
13
+ export const DEFAULT_CACHE_FETCH_POLICY: CacheFetchPolicy = 'CACHED_OR_FETCHED';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * CustomProduct — Superwall-style non-StoreKit / non-Play product.
3
+ *
4
+ * Spec: PUR-363, PUR-364
5
+ *
6
+ * Used to describe products that don't live in the App Store or Play Console
7
+ * (Stripe SKUs, Paddle plans, in-house entitlements). Routing is **only**
8
+ * dispatched through a host-provided PurchaseController; the bundled internal
9
+ * controller will reject custom products.
10
+ *
11
+ * Field names are kept identical to the native iOS (CustomProduct.swift) and
12
+ * Android (CustomProduct.kt) models so the contract is the same across SDKs.
13
+ */
14
+
15
+ export interface CustomProduct {
16
+ /** Stable BillDog-side identifier for this product. */
17
+ id: string;
18
+ displayName: string;
19
+ /** Localized, ready-to-render price, e.g. "$89.99". */
20
+ priceString: string;
21
+ /** Numeric price in `currency`. */
22
+ price: number;
23
+ /** ISO 4217 currency code, e.g. "USD". */
24
+ currency: string;
25
+ /** External billing provider, e.g. "stripe", "paddle", "in_house". */
26
+ provider: string;
27
+ /** The id your PurchaseController charges (e.g. a Stripe price id). */
28
+ providerProductId: string;
29
+ /** Optional ISO 8601 duration (e.g. "P1M", "P1Y") for subscription products. */
30
+ period?: string;
31
+ /** Free-form metadata forwarded to your PurchaseController. */
32
+ metadata?: Record<string, string>;
33
+ }
@@ -0,0 +1,26 @@
1
+ import type { EntitlementInfo } from './EntitlementInfo';
2
+
3
+ /**
4
+ * Server-authoritative CustomerInfo (PUR-120, PUR-121, PUR-123).
5
+ */
6
+ export interface CustomerInfo {
7
+ userId: string;
8
+ entitlements: EntitlementInfo[];
9
+ activeSubscriptions: string[];
10
+ originalAppUserId?: string;
11
+ isInTrial?: boolean;
12
+ isInGracePeriod?: boolean;
13
+ hasExpiredSubscription?: boolean;
14
+ /** PUR-121: instant local resolution before backend confirms. */
15
+ productEntitlementMapping: Record<string, string[]>;
16
+ }
17
+
18
+ /** PUR-121: resolve entitlements unlocked by a product ID without a server hop. */
19
+ export function entitlementsByProductId(
20
+ info: CustomerInfo,
21
+ productId: string,
22
+ ): EntitlementInfo[] {
23
+ const ids = info.productEntitlementMapping?.[productId];
24
+ if (!ids || ids.length === 0) return [];
25
+ return info.entitlements.filter((e) => ids.includes(e.identifier));
26
+ }
@@ -0,0 +1,22 @@
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
+
11
+ import type { SkipReason } from './Placement';
12
+
13
+ export interface BillDogDelegate {
14
+ onPaywallPresented?: (paywallId: string) => void;
15
+ onPaywallDismissed?: (paywallId: string) => void;
16
+ onPaywallSkipped?: (placementId: string, reason: SkipReason) => void;
17
+ onPurchaseStarted?: (productId: string) => void;
18
+ onPurchaseCompleted?: (productId: string) => void;
19
+ onPurchaseFailed?: (productId: string, error: string) => void;
20
+ onRestoreCompleted?: (itemCount: number) => void;
21
+ onSubscriptionStatusChanged?: (status: string) => void;
22
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Entitlement lifecycle state — 6 canonical cases (PUR-122).
3
+ */
4
+ export type EntitlementState =
5
+ | 'ACTIVE'
6
+ | 'TRIAL'
7
+ | 'GRACE_PERIOD'
8
+ | 'BILLING_RETRY'
9
+ | 'EXPIRED'
10
+ | 'REVOKED'
11
+ | 'UNKNOWN';
12
+
13
+ export interface EntitlementInfo {
14
+ identifier: string;
15
+ isActive: boolean;
16
+ expiresAt?: string;
17
+ store?: string;
18
+ grantedAt?: string;
19
+ displayName?: string;
20
+ willRenew?: boolean;
21
+ isLifetime?: boolean;
22
+ state?: EntitlementState;
23
+ productIds?: string[];
24
+ startsAt?: string;
25
+ renewedAt?: string;
26
+ latestProductId?: string;
27
+ }
@@ -0,0 +1,50 @@
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
+
15
+ /** Outcome of a placement registration call. */
16
+ export type PlacementResult =
17
+ | { type: 'entitled' }
18
+ | { type: 'purchased'; productId: string }
19
+ | { type: 'dismissed' }
20
+ | { type: 'restored' }
21
+ | { type: 'error'; message: string };
22
+
23
+ /** Synchronous "what would happen if I registered this placement?" answer. */
24
+ export type PresentationResult =
25
+ | { type: 'paywall' }
26
+ | { type: 'userSubscribed' }
27
+ | { type: 'noPaywall'; reason: string }
28
+ | { type: 'holdout' }
29
+ | { type: 'error'; message: string };
30
+
31
+ export type PaywallLoadingState = 'loading' | 'ready' | 'failed';
32
+
33
+ export type SkipReason =
34
+ | 'user_has_entitlement'
35
+ | 'holdout'
36
+ | 'no_paywall_configured'
37
+ | 'error';
38
+
39
+ export type PostPurchaseBehavior = 'close' | 'keep_open';
40
+
41
+ /** Optional lifecycle callbacks for `register()`. All callbacks are optional. */
42
+ export interface PaywallPresentationHandler {
43
+ onPresent?: (paywallId: string) => void;
44
+ onDismiss?: (paywallId: string) => void;
45
+ onError?: (error: Error) => void;
46
+ onSkip?: (reason: SkipReason) => void;
47
+ onPurchaseSuccess?: (productId: string) => PostPurchaseBehavior | void;
48
+ onFinish?: (paywallId: string, shouldDismiss: boolean) => boolean;
49
+ onLoadingStateChange?: (state: PaywallLoadingState) => void;
50
+ }
@@ -0,0 +1,81 @@
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
+
12
+ export type GoogleReplacementMode =
13
+ | 'WITH_TIME_PRORATION'
14
+ | 'CHARGE_PRORATED_PRICE'
15
+ | 'WITHOUT_PRORATION'
16
+ | 'CHARGE_FULL_PRICE'
17
+ | 'DEFERRED';
18
+
19
+ export interface PurchaseParams {
20
+ productId: string;
21
+ offerToken?: string;
22
+ promoOfferId?: string;
23
+ winBackOfferId?: string;
24
+ appAccountToken?: string;
25
+ obfuscatedProfileId?: string;
26
+ quantity?: number;
27
+ isPersonalizedOffer?: boolean;
28
+ replacementMode?: GoogleReplacementMode;
29
+ }
30
+
31
+ export class PurchaseParamsBuilder {
32
+ private params: PurchaseParams;
33
+
34
+ constructor(productId: string) {
35
+ this.params = { productId, quantity: 1 };
36
+ }
37
+
38
+ offerToken(value: string | undefined): this {
39
+ this.params.offerToken = value;
40
+ return this;
41
+ }
42
+ promoOfferId(value: string | undefined): this {
43
+ this.params.promoOfferId = value;
44
+ return this;
45
+ }
46
+ winBackOfferId(value: string | undefined): this {
47
+ this.params.winBackOfferId = value;
48
+ return this;
49
+ }
50
+ appAccountToken(value: string | undefined): this {
51
+ this.params.appAccountToken = value;
52
+ return this;
53
+ }
54
+ obfuscatedProfileId(value: string | undefined): this {
55
+ this.params.obfuscatedProfileId = value;
56
+ return this;
57
+ }
58
+ quantity(value: number): this {
59
+ this.params.quantity = value < 1 ? 1 : value;
60
+ return this;
61
+ }
62
+ isPersonalizedOffer(value: boolean | undefined): this {
63
+ this.params.isPersonalizedOffer = value;
64
+ return this;
65
+ }
66
+ replacementMode(value: GoogleReplacementMode | undefined): this {
67
+ this.params.replacementMode = value;
68
+ return this;
69
+ }
70
+
71
+ build(): PurchaseParams {
72
+ return { ...this.params };
73
+ }
74
+ }
75
+
76
+ export const PurchaseParams = {
77
+ /** Fluent builder — mirrors RevenueCat 5.x `PurchaseParams.Builder`. */
78
+ builder(productId: string): PurchaseParamsBuilder {
79
+ return new PurchaseParamsBuilder(productId);
80
+ },
81
+ };
@@ -0,0 +1,32 @@
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
+
12
+ import type { BillDogError } from './BillDogError';
13
+
14
+ export type PurchaseResult =
15
+ | {
16
+ type: 'purchased';
17
+ transactionId: string;
18
+ productId: string;
19
+ originalTransactionId?: string;
20
+ }
21
+ | { type: 'cancelled' }
22
+ | { type: 'pending' }
23
+ | { type: 'failed'; error: BillDogError }
24
+ | {
25
+ type: 'restored';
26
+ transactionId: string;
27
+ productId: string;
28
+ originalTransactionId?: string;
29
+ };
30
+
31
+ export const isSuccess = (r: PurchaseResult): boolean =>
32
+ r.type === 'purchased' || r.type === 'restored';
@@ -0,0 +1,27 @@
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
+
18
+ import type { BillDogError } from './BillDogError';
19
+ import type { RestoredItem } from './RestoredItem';
20
+
21
+ export type RestoreResult =
22
+ | { type: 'restored'; items: RestoredItem[] }
23
+ | { type: 'failed'; error: BillDogError };
24
+
25
+ /** Convenience: was the restore globally successful? */
26
+ export const isRestoreOk = (r: RestoreResult): r is { type: 'restored'; items: RestoredItem[] } =>
27
+ r.type === 'restored';
@@ -0,0 +1,25 @@
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
+
13
+ import type { BillDogError } from './BillDogError';
14
+
15
+ export type RestoreItemStatus =
16
+ | { type: 'restored' }
17
+ | { type: 'expired' }
18
+ | { type: 'failed'; error: BillDogError };
19
+
20
+ export interface RestoredItem {
21
+ productId: string;
22
+ transactionId: string;
23
+ originalTransactionId?: string;
24
+ status: RestoreItemStatus;
25
+ }