@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,30 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ # Bundles ALL RN iOS bridge modules (paywall, analytics, survey, A/B, live
7
+ # activities, virtual currency) via the source_files glob below — the pod is
8
+ # NOT virtual-currency-specific, so it carries the package name.
9
+ s.name = "BillDogReactNative"
10
+ s.version = package["version"]
11
+ s.summary = package["description"]
12
+ s.homepage = "https://billdog.app"
13
+ s.license = package["license"]
14
+ s.authors = package["author"]
15
+ # iOS 15 to match the native BillDog pod's deployment target (was 13.0).
16
+ s.platforms = { :ios => "15.0" }
17
+ # Informational only — React Native autolinking installs this pod via :path
18
+ # into the consumer's node_modules; :source is used only for standalone
19
+ # `pod install` from git.
20
+ s.source = { :git => "https://github.com/billdogai/billdog.git", :tag => "react-native-#{s.version}" }
21
+
22
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
23
+
24
+ s.dependency "React-Core"
25
+ # Native BillDog iOS SDK (Full subspec). Thin-bridge architecture: every RN native
26
+ # module delegates to `BillDog.shared` instead of reimplementing logic. Phase 0.
27
+ s.dependency "BillDog"
28
+
29
+ s.swift_version = "5.0"
30
+ end
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 BillDog
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # @billdog.io/react-native
2
+
3
+ React Native library for rendering BillDog paywalls with native components.
4
+
5
+ ## What's New in 1.4 — Purchase Parity APIs
6
+
7
+ The RN bridge now exposes the full purchase parity surface (PurchaseParams,
8
+ PurchaseController, CustomProduct, attribution setters, setProxyURL, eligibility,
9
+ canMakePayments, presentCodeRedemptionSheet, storefront observer):
10
+
11
+ ```typescript
12
+ import { BillDog, PurchaseParams } from '@billdog.io/react-native';
13
+
14
+ const result = await BillDog.purchase(
15
+ PurchaseParams.builder('pro_yearly')
16
+ .promoOfferId('intro_2024')
17
+ .appAccountToken(uuid)
18
+ .isPersonalizedOffer(true)
19
+ .build()
20
+ );
21
+ // result.kind: 'purchased' | 'cancelled' | 'pending' | 'failed' | 'restored'
22
+
23
+ await BillDog.setAdjustID(adid);
24
+ await BillDog.setAppsflyerID(appsflyerId);
25
+ await BillDog.setProxyURL('https://billdog-edge.example.com');
26
+ ```
27
+
28
+ Full guides: [Custom Purchases](https://billdog.io/docs/custom-purchases) ·
29
+ [Attribution](https://billdog.io/docs/attribution) ·
30
+ [Self-Hosted Proxy](https://billdog.io/docs/self-hosted-proxy)
31
+
32
+
33
+ ## Features
34
+
35
+ ✨ **AI-Generated Paywalls** - Create paywalls using AI prompts or templates
36
+ ⚡ **Smart Caching** - Instant display with <100ms load time (Phase 3)
37
+ 🎨 **Cross-Platform** - Works on iOS and Android
38
+ 📊 **Real-time Analytics** - Track conversions and revenue
39
+ 🔌 **Offline Support** - Cached paywalls work without network
40
+ 🎯 **A/B Testing** - Run experiments without app updates
41
+ 📱 **Dynamic Updates** - Update paywalls remotely
42
+
43
+ ## Advanced Caching System
44
+
45
+ BillDog SDK includes a production-grade caching system that dramatically improves performance:
46
+
47
+ ⚡ **60% Storage Reduction** - GZIP compression automatically reduces cache size
48
+ 🚀 **Sub-50ms Load Times** - Multi-level caching (memory + AsyncStorage)
49
+ 🧠 **Intelligent Prefetching** - Learns user patterns and preloads paywalls
50
+ 📊 **Real-time Analytics** - Monitor cache performance and hit rates
51
+ 🔄 **Background Updates** - Silent version checking keeps content fresh
52
+ 📴 **Offline Support** - Cached paywalls work without network
53
+
54
+ ### Quick Start with Caching
55
+
56
+ ```typescript
57
+ import { PaywallView } from '@billdog.io/react-native';
58
+
59
+ function MyPaywall() {
60
+ return (
61
+ <PaywallView
62
+ paywallIdentifier="premium_offer"
63
+ apiKey="your_api_key"
64
+ projectUrl="https://yourproject.supabase.co"
65
+ cacheConfig={{
66
+ enabled: true, // Enable caching (default: true)
67
+ compressionEnabled: true, // Enable GZIP (default: true)
68
+ memoryCacheEnabled: true, // Memory cache (default: true)
69
+ maxAge: 24 * 60 * 60 * 1000, // 24 hours (default: 7 days)
70
+ prefetchEnabled: true, // Smart prefetching (default: false)
71
+ }}
72
+ onButtonPress={(id, action) => handlePurchase(id, action)}
73
+ />
74
+ );
75
+ }
76
+ ```
77
+
78
+ ### Cache Analytics
79
+
80
+ ```typescript
81
+ import { AdvancedPaywallCache } from '@billdog.io/react-native';
82
+
83
+ const cache = new AdvancedPaywallCache({
84
+ enabled: true,
85
+ compressionEnabled: true,
86
+ });
87
+
88
+ // Get real-time analytics
89
+ const analytics = await cache.getAnalytics();
90
+ console.log(`Hit Rate: ${(analytics.hitRate * 100).toFixed(1)}%`);
91
+ console.log(`Avg Load Time: ${analytics.avgLoadTime.toFixed(0)}ms`);
92
+ console.log(`Storage Saved: ${(analytics.compressionRatio * 100).toFixed(0)}%`);
93
+ ```
94
+
95
+ 📖 **Full Caching Guide**: See [CACHING_GUIDE.md](../CACHING_GUIDE.md) for advanced configuration, platform comparison, and best practices.
96
+
97
+ ## Installation
98
+
99
+ ```bash
100
+ npm install @billdog.io/react-native
101
+ # or
102
+ yarn add @billdog.io/react-native
103
+ ```
104
+
105
+ ## Usage
106
+
107
+ ### Basic Usage
108
+
109
+ ```tsx
110
+ import { PaywallView } from '@billdog.io/react-native';
111
+
112
+ function App() {
113
+ return (
114
+ <PaywallView
115
+ paywallIdentifier="premium_offer"
116
+ apiKey="your_api_key"
117
+ projectUrl="https://yourproject.supabase.co"
118
+ onButtonPress={(componentId, action) => {
119
+ console.log('Button pressed:', componentId, action);
120
+ // Handle purchase flow
121
+ }}
122
+ onDismiss={() => {
123
+ console.log('Paywall dismissed');
124
+ }}
125
+ />
126
+ );
127
+ }
128
+ ```
129
+
130
+ ### With Direct Configuration
131
+
132
+ ```tsx
133
+ import { PaywallView, PaywallConfiguration } from '@billdog.io/react-native';
134
+
135
+ const config: PaywallConfiguration = {
136
+ components: [
137
+ {
138
+ id: 'title',
139
+ type: 'text',
140
+ name: 'Title',
141
+ position: { x: 0, y: 0 },
142
+ size: { width: '100%', height: 'auto' },
143
+ layout: { width: 'fill', height: 'hug' },
144
+ appearance: {},
145
+ properties: {
146
+ text: 'Unlock Premium Features',
147
+ fontSize: 24,
148
+ fontWeight: 'bold',
149
+ textAlign: 'center',
150
+ },
151
+ },
152
+ // ... more components
153
+ ],
154
+ };
155
+
156
+ function App() {
157
+ return (
158
+ <PaywallView
159
+ configuration={config}
160
+ onButtonPress={(id, action) => {
161
+ // Handle purchase
162
+ }}
163
+ />
164
+ );
165
+ }
166
+ ```
167
+
168
+ ### Custom Loading and Error Components
169
+
170
+ ```tsx
171
+ import { PaywallView } from '@billdog.io/react-native';
172
+ import { Text, View } from 'react-native';
173
+
174
+ function LoadingPaywall() {
175
+ return (
176
+ <View>
177
+ <Text>Loading your offers...</Text>
178
+ </View>
179
+ );
180
+ }
181
+
182
+ function ErrorPaywall({ error }: { error: Error }) {
183
+ return (
184
+ <View>
185
+ <Text>Failed to load: {error.message}</Text>
186
+ </View>
187
+ );
188
+ }
189
+
190
+ function App() {
191
+ return (
192
+ <PaywallView
193
+ paywallIdentifier="premium_offer"
194
+ apiKey="your_api_key"
195
+ projectUrl="https://yourproject.supabase.co"
196
+ LoadingComponent={LoadingPaywall}
197
+ ErrorComponent={ErrorPaywall}
198
+ />
199
+ );
200
+ }
201
+ ```
202
+
203
+ ## API Reference
204
+
205
+ ### PaywallView Props
206
+
207
+ | Prop | Type | Required | Description |
208
+ |------|------|----------|-------------|
209
+ | `paywallIdentifier` | `string` | No | Paywall identifier to fetch from API |
210
+ | `configuration` | `PaywallConfiguration` | No | Direct configuration (skips API fetch) |
211
+ | `apiKey` | `string` | No | API key for authentication |
212
+ | `projectUrl` | `string` | No | Project URL (e.g., https://yourproject.supabase.co) |
213
+ | `onButtonPress` | `(id: string, action: string) => void` | No | Called when user presses buttons |
214
+ | `onDismiss` | `() => void` | No | Called when paywall is dismissed |
215
+ | `LoadingComponent` | `ComponentType` | No | Custom loading component |
216
+ | `ErrorComponent` | `ComponentType<{ error: Error }>` | No | Custom error component |
217
+
218
+ ### usePaywall Hook
219
+
220
+ ```tsx
221
+ import { usePaywall } from '@billdog.io/react-native';
222
+
223
+ const { configuration, loading, error, refetch } = usePaywall({
224
+ paywallIdentifier: 'premium_offer',
225
+ apiKey: 'your_api_key',
226
+ projectUrl: 'https://yourproject.supabase.co',
227
+ userContext: {
228
+ app_user_id: 'user_123',
229
+ country: 'US',
230
+ platform: 'ios',
231
+ },
232
+ });
233
+ ```
234
+
235
+ ### useOfferings Hook
236
+
237
+ Fetch a list of offerings with filtering, pagination, and expansion options:
238
+
239
+ ```tsx
240
+ import { useOfferings } from '@billdog.io/react-native';
241
+
242
+ const { offerings, pagination, loading, error, refetch } = useOfferings({
243
+ apiKey: 'your_api_key',
244
+ projectUrl: 'https://yourproject.supabase.co',
245
+ limit: 10,
246
+ offset: 0,
247
+ is_current: true,
248
+ expand: 'packages,products,paywall',
249
+ sort_by: 'display_name',
250
+ sort_order: 'asc',
251
+ });
252
+
253
+ // offerings is an array of offering objects
254
+ // pagination contains: { total, limit, offset, has_more }
255
+ ```
256
+
257
+ #### useOfferings Options
258
+
259
+ - `apiKey` (required): Your API key
260
+ - `projectUrl` (required): Your project URL
261
+ - `limit`: Number of offerings to fetch (default: 20)
262
+ - `offset`: Pagination offset (default: 0)
263
+ - `is_current`: Filter by current offerings only
264
+ - `is_default`: Filter by default offerings only
265
+ - `identifier`: Search by identifier substring
266
+ - `expand`: Comma-separated list of relations to include: 'packages', 'products', 'paywall'
267
+ - `sort_by`: Sort field - 'created_at', 'display_name', or 'identifier' (default: 'created_at')
268
+ - `sort_order`: 'asc' or 'desc' (default: 'desc')
269
+ - `skipFetch`: Skip automatic fetching (default: false)
270
+
271
+ ## Supported Component Types
272
+
273
+ - `text` - Text labels and headings
274
+ - `image` - Images and icons
275
+ - `button` - Call-to-action buttons
276
+ - `stack` - Container for layout (vertical/horizontal)
277
+ - `package` - Subscription package display
278
+ - `feature-list` - List of features with checkmarks
279
+ - `price` - Price display with currency
280
+ - `badge` - Small labels (e.g., "Popular")
281
+ - `divider` - Visual separator
282
+ - `spacer` - Empty space for layout
283
+ - `icon` - Icon components
284
+ - `video` - Video players
285
+
286
+ ## Theme Support
287
+
288
+ Paywalls support custom themes with colors and fonts:
289
+
290
+ ```tsx
291
+ const config: PaywallConfiguration = {
292
+ components: [...],
293
+ theme: {
294
+ colors: {
295
+ primary: '#007AFF',
296
+ background: '#FFFFFF',
297
+ text: '#000000',
298
+ },
299
+ fonts: {
300
+ body: 'System',
301
+ heading: 'System-Bold',
302
+ },
303
+ },
304
+ };
305
+ ```
306
+
307
+ ## Variable Substitution
308
+
309
+ Use `{{variableName}}` in text to inject dynamic values:
310
+
311
+ ```tsx
312
+ const config: PaywallConfiguration = {
313
+ components: [
314
+ {
315
+ id: 'welcome',
316
+ type: 'text',
317
+ properties: {
318
+ text: 'Welcome, {{userName}}!',
319
+ },
320
+ },
321
+ ],
322
+ variables: {
323
+ userName: 'John Doe',
324
+ },
325
+ };
326
+ ```
327
+
328
+ ## License
329
+
330
+ MIT
@@ -0,0 +1,99 @@
1
+ // Android native module for @billdog.io/react-native.
2
+ // Thin-bridge architecture: this module delegates to the native BillDog Android SDK
3
+ // (io.billdog:billdog-core) rather than reimplementing logic in JS. See thin-bridge plan.
4
+ //
5
+ // Local dev: the native BillDog artifacts may not be on Maven Central yet. To resolve
6
+ // them locally, run once: cd native-sdks/android && ./gradlew publishToMavenLocal
7
+ // (mavenLocal() below picks them up).
8
+
9
+ buildscript {
10
+ // Must match the native BillDog Android SDK's Kotlin version (2.0.21) — its
11
+ // published artifacts carry Kotlin 2.0 metadata that a 1.8 compiler cannot read
12
+ // ("incompatible version of Kotlin … metadata is 2.0.0"). Prefer the app-wide
13
+ // `android.kotlinVersion` gradle property (set by RN/Expo), then the legacy
14
+ // `kotlinVersion` ext, then the native-SDK-matched default.
15
+ ext.billdog_kotlin_version = project.hasProperty('android.kotlinVersion') ? project.property('android.kotlinVersion')
16
+ : (project.hasProperty('kotlinVersion') ? project.kotlinVersion : '2.0.21')
17
+ repositories {
18
+ google()
19
+ mavenCentral()
20
+ }
21
+ dependencies {
22
+ classpath 'com.android.tools.build:gradle:7.4.2'
23
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$billdog_kotlin_version"
24
+ }
25
+ }
26
+
27
+ def safeExtGet(prop, fallback) {
28
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
29
+ }
30
+
31
+ apply plugin: 'com.android.library'
32
+ apply plugin: 'kotlin-android'
33
+
34
+ android {
35
+ namespace 'io.billdog.virtualcurrency'
36
+ compileSdkVersion safeExtGet('compileSdkVersion', 34)
37
+
38
+ defaultConfig {
39
+ minSdkVersion safeExtGet('minSdkVersion', 24)
40
+ targetSdkVersion safeExtGet('targetSdkVersion', 34)
41
+ }
42
+
43
+ // React Native 0.73+ (and the Expo prebuild toolchain) build with JDK 17 and
44
+ // force sourceCompatibility 17 on subprojects. Kotlin's jvmTarget must match or
45
+ // AGP fails compileDebugKotlin with a jvm-target mismatch. Align both to 17.
46
+ compileOptions {
47
+ sourceCompatibility JavaVersion.VERSION_17
48
+ targetCompatibility JavaVersion.VERSION_17
49
+ }
50
+
51
+ kotlinOptions {
52
+ jvmTarget = '17'
53
+ // The native BillDog Android SDK ships Kotlin 2.0 metadata. When the host app
54
+ // pins an older Kotlin (e.g. Expo SDK 50 / RN 0.73 cap at 1.9, since Kotlin 2.0
55
+ // breaks expo-modules-core), this bridge still needs to read those 2.0 classes.
56
+ // Skip the metadata-version gate for THIS module only. Remove once the app
57
+ // toolchain is Kotlin 2.0+ (Expo SDK 51+ / RN 0.74+).
58
+ freeCompilerArgs += ['-Xskip-metadata-version-check']
59
+ }
60
+
61
+ sourceSets {
62
+ main.java.srcDirs += 'src/main/kotlin'
63
+ }
64
+ }
65
+
66
+ repositories {
67
+ google()
68
+ mavenCentral()
69
+ mavenLocal() // resolves locally-published BillDog artifacts during development
70
+ }
71
+
72
+ dependencies {
73
+ implementation "com.facebook.react:react-native:+" // provided by the host app
74
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$billdog_kotlin_version"
75
+
76
+ // The native modules bridge the SDK's suspend APIs on a coroutine scope.
77
+ // billdog-core declares coroutines as `implementation` (not `api`), so declare
78
+ // them here explicitly (pinned to billdog-core's version).
79
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
80
+
81
+ // Native BillDog Android SDK — the delegation target for this bridge.
82
+ def billdogVersion = safeExtGet('billdogVersion', '1.0.0-beta.2')
83
+ implementation "io.billdog:billdog-core:$billdogVersion"
84
+ // Concrete satellite managers, resolved via BillDog.getModules() and cast by the
85
+ // BillDogAnalytics / BillDogABTest / BillDogSurvey RN modules.
86
+ implementation "io.billdog:billdog-analytics:$billdogVersion"
87
+ implementation "io.billdog:billdog-ab-test:$billdogVersion"
88
+ implementation "io.billdog:billdog-survey:$billdogVersion"
89
+ // billdog-compose provides @Composable PaywallScreen for the native BDPaywallView
90
+ // (SimpleViewManager hosting a ComposeView) — inline paywall rendering.
91
+ implementation "io.billdog:billdog-compose:$billdogVersion"
92
+
93
+ // Compose runtime for hosting PaywallScreen inside a ComposeView in the ViewManager.
94
+ def composeBom = platform('androidx.compose:compose-bom:2023.10.01')
95
+ implementation composeBom
96
+ implementation 'androidx.compose.ui:ui'
97
+ implementation 'androidx.activity:activity-compose:1.7.2'
98
+ // billdog-compose (PaywallScreen) is added with the native paywall ViewManager increment.
99
+ }
@@ -0,0 +1 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" />