@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/dist/types.js ADDED
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions matching the web PaywallComponent structure
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getEffectiveBackgroundColor = getEffectiveBackgroundColor;
7
+ exports.hasGradientBackground = hasGradientBackground;
8
+ exports.getGradientConfig = getGradientConfig;
9
+ exports.getEffectiveTypographyColor = getEffectiveTypographyColor;
10
+ exports.hasTransform = hasTransform;
11
+ exports.getEffectiveBorderColor = getEffectiveBorderColor;
12
+ exports.getEffectiveShadowColor = getEffectiveShadowColor;
13
+ exports.normalizeThemeColors = normalizeThemeColors;
14
+ /**
15
+ * Get effective background color from appearance
16
+ * Priority: fill.color → backgroundColorObj.resolvedColor → backgroundColor
17
+ */
18
+ function getEffectiveBackgroundColor(appearance) {
19
+ var _a, _b, _c, _d, _e;
20
+ // Check fill first
21
+ if (appearance.fill) {
22
+ if (typeof appearance.fill === 'string') {
23
+ return appearance.fill;
24
+ }
25
+ if (appearance.fill.color) {
26
+ return appearance.fill.color;
27
+ }
28
+ if ((_c = (_b = (_a = appearance.fill.gradient) === null || _a === void 0 ? void 0 : _a.stops) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.color) {
29
+ return appearance.fill.gradient.stops[0].color;
30
+ }
31
+ }
32
+ // Check backgroundColorObj
33
+ if ((_d = appearance.backgroundColorObj) === null || _d === void 0 ? void 0 : _d.resolvedColor) {
34
+ return appearance.backgroundColorObj.resolvedColor;
35
+ }
36
+ // Fallback to backgroundColor
37
+ if (appearance.backgroundColor) {
38
+ if (typeof appearance.backgroundColor === 'string') {
39
+ return appearance.backgroundColor;
40
+ }
41
+ return (_e = appearance.backgroundColor.resolvedColor) !== null && _e !== void 0 ? _e : appearance.backgroundColor.color;
42
+ }
43
+ return undefined;
44
+ }
45
+ /**
46
+ * Check if appearance has a gradient background
47
+ */
48
+ function hasGradientBackground(appearance) {
49
+ var _a;
50
+ if (appearance.fill && typeof appearance.fill === 'object' && appearance.fill.type === 'gradient') {
51
+ return true;
52
+ }
53
+ if (((_a = appearance.backgroundColorObj) === null || _a === void 0 ? void 0 : _a.type) === 'gradient') {
54
+ return true;
55
+ }
56
+ if (appearance.backgroundColor && typeof appearance.backgroundColor === 'object' && appearance.backgroundColor.type === 'gradient') {
57
+ return true;
58
+ }
59
+ return false;
60
+ }
61
+ /**
62
+ * Get gradient config from appearance
63
+ */
64
+ function getGradientConfig(appearance) {
65
+ var _a;
66
+ if (appearance.fill && typeof appearance.fill === 'object' && appearance.fill.gradient) {
67
+ return appearance.fill.gradient;
68
+ }
69
+ if ((_a = appearance.backgroundColorObj) === null || _a === void 0 ? void 0 : _a.gradient) {
70
+ return appearance.backgroundColorObj.gradient;
71
+ }
72
+ if (appearance.backgroundColor && typeof appearance.backgroundColor === 'object' && appearance.backgroundColor.gradient) {
73
+ return appearance.backgroundColor.gradient;
74
+ }
75
+ return undefined;
76
+ }
77
+ // Helper functions for Phase 4 types
78
+ /** Get effective typography color */
79
+ function getEffectiveTypographyColor(typography) {
80
+ var _a, _b, _c;
81
+ return (_c = (_a = typography.resolvedColor) !== null && _a !== void 0 ? _a : (_b = typography.textColorObj) === null || _b === void 0 ? void 0 : _b.resolvedColor) !== null && _c !== void 0 ? _c : typography.color;
82
+ }
83
+ /** Check if transform has any transformation applied */
84
+ function hasTransform(transform) {
85
+ return transform.rotation != null ||
86
+ transform.rotationX != null ||
87
+ transform.rotationY != null ||
88
+ transform.scaleX != null ||
89
+ transform.scaleY != null ||
90
+ transform.translateX != null ||
91
+ transform.translateY != null ||
92
+ transform.skewX != null ||
93
+ transform.skewY != null;
94
+ }
95
+ /** Get effective border color */
96
+ function getEffectiveBorderColor(border) {
97
+ var _a;
98
+ return (_a = border.resolvedColor) !== null && _a !== void 0 ? _a : border.color;
99
+ }
100
+ /** Get effective shadow color */
101
+ function getEffectiveShadowColor(shadow) {
102
+ var _a;
103
+ return (_a = shadow.resolvedColor) !== null && _a !== void 0 ? _a : shadow.color;
104
+ }
105
+ /** Default dark theme colors */
106
+ const DARK_DEFAULTS = {
107
+ primary: '#3B82F6', primaryForeground: '#FFFFFF',
108
+ secondary: '#22C55E', secondaryForeground: '#FFFFFF',
109
+ background: '#141421', foreground: '#FAFAFA',
110
+ card: '#1E1E35', cardForeground: '#FAFAFA',
111
+ muted: '#1E1E35', mutedForeground: '#8B8BA3',
112
+ border: '#2A2A45',
113
+ accent: '#8B5CF6', accentForeground: '#FFFFFF',
114
+ destructive: '#EF4444', destructiveForeground: '#FFFFFF',
115
+ input: '#2A2A45', ring: '#3B82F6',
116
+ popover: '#1E1E35', popoverForeground: '#FAFAFA',
117
+ success: '#22C55E', successForeground: '#FFFFFF',
118
+ warning: '#F59E0B', warningForeground: '#FFFFFF',
119
+ info: '#3B82F6', infoForeground: '#FFFFFF',
120
+ };
121
+ /**
122
+ * Normalize any theme config (legacy or canonical) into the 26-field ThemeColors.
123
+ * Maps legacy field names (primaryColor, backgroundColor, etc.) to canonical names.
124
+ */
125
+ function normalizeThemeColors(config) {
126
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35;
127
+ if (!config)
128
+ return { ...DARK_DEFAULTS };
129
+ const colors = (_a = config.colors) !== null && _a !== void 0 ? _a : {};
130
+ const resolved = (_b = config.resolvedColors) !== null && _b !== void 0 ? _b : {};
131
+ return {
132
+ primary: (_e = (_d = (_c = colors.primary) !== null && _c !== void 0 ? _c : resolved['primary']) !== null && _d !== void 0 ? _d : config.primaryColor) !== null && _e !== void 0 ? _e : DARK_DEFAULTS.primary,
133
+ primaryForeground: (_g = (_f = colors.primaryForeground) !== null && _f !== void 0 ? _f : resolved['primary-foreground']) !== null && _g !== void 0 ? _g : DARK_DEFAULTS.primaryForeground,
134
+ secondary: (_k = (_j = (_h = colors.secondary) !== null && _h !== void 0 ? _h : resolved['secondary']) !== null && _j !== void 0 ? _j : config.secondaryColor) !== null && _k !== void 0 ? _k : DARK_DEFAULTS.secondary,
135
+ secondaryForeground: (_m = (_l = colors.secondaryForeground) !== null && _l !== void 0 ? _l : resolved['secondary-foreground']) !== null && _m !== void 0 ? _m : DARK_DEFAULTS.secondaryForeground,
136
+ background: (_q = (_p = (_o = colors.background) !== null && _o !== void 0 ? _o : resolved['background']) !== null && _p !== void 0 ? _p : config.backgroundColor) !== null && _q !== void 0 ? _q : DARK_DEFAULTS.background,
137
+ foreground: (_t = (_s = (_r = colors.foreground) !== null && _r !== void 0 ? _r : resolved['foreground']) !== null && _s !== void 0 ? _s : config.textColor) !== null && _t !== void 0 ? _t : DARK_DEFAULTS.foreground,
138
+ card: (_w = (_v = (_u = colors.card) !== null && _u !== void 0 ? _u : resolved['card']) !== null && _v !== void 0 ? _v : config.cardColor) !== null && _w !== void 0 ? _w : DARK_DEFAULTS.card,
139
+ cardForeground: (_y = (_x = colors.cardForeground) !== null && _x !== void 0 ? _x : resolved['card-foreground']) !== null && _y !== void 0 ? _y : DARK_DEFAULTS.cardForeground,
140
+ muted: (_1 = (_0 = (_z = colors.muted) !== null && _z !== void 0 ? _z : resolved['muted']) !== null && _0 !== void 0 ? _0 : config.mutedColor) !== null && _1 !== void 0 ? _1 : DARK_DEFAULTS.muted,
141
+ mutedForeground: (_3 = (_2 = colors.mutedForeground) !== null && _2 !== void 0 ? _2 : resolved['muted-foreground']) !== null && _3 !== void 0 ? _3 : DARK_DEFAULTS.mutedForeground,
142
+ border: (_6 = (_5 = (_4 = colors.border) !== null && _4 !== void 0 ? _4 : resolved['border']) !== null && _5 !== void 0 ? _5 : config.borderColor) !== null && _6 !== void 0 ? _6 : DARK_DEFAULTS.border,
143
+ accent: (_9 = (_8 = (_7 = colors.accent) !== null && _7 !== void 0 ? _7 : resolved['accent']) !== null && _8 !== void 0 ? _8 : config.accentColor) !== null && _9 !== void 0 ? _9 : DARK_DEFAULTS.accent,
144
+ accentForeground: (_11 = (_10 = colors.accentForeground) !== null && _10 !== void 0 ? _10 : resolved['accent-foreground']) !== null && _11 !== void 0 ? _11 : DARK_DEFAULTS.accentForeground,
145
+ destructive: (_13 = (_12 = colors.destructive) !== null && _12 !== void 0 ? _12 : resolved['destructive']) !== null && _13 !== void 0 ? _13 : DARK_DEFAULTS.destructive,
146
+ destructiveForeground: (_15 = (_14 = colors.destructiveForeground) !== null && _14 !== void 0 ? _14 : resolved['destructive-foreground']) !== null && _15 !== void 0 ? _15 : DARK_DEFAULTS.destructiveForeground,
147
+ input: (_17 = (_16 = colors.input) !== null && _16 !== void 0 ? _16 : resolved['input']) !== null && _17 !== void 0 ? _17 : DARK_DEFAULTS.input,
148
+ ring: (_19 = (_18 = colors.ring) !== null && _18 !== void 0 ? _18 : resolved['ring']) !== null && _19 !== void 0 ? _19 : DARK_DEFAULTS.ring,
149
+ popover: (_21 = (_20 = colors.popover) !== null && _20 !== void 0 ? _20 : resolved['popover']) !== null && _21 !== void 0 ? _21 : DARK_DEFAULTS.popover,
150
+ popoverForeground: (_23 = (_22 = colors.popoverForeground) !== null && _22 !== void 0 ? _22 : resolved['popover-foreground']) !== null && _23 !== void 0 ? _23 : DARK_DEFAULTS.popoverForeground,
151
+ success: (_25 = (_24 = colors.success) !== null && _24 !== void 0 ? _24 : resolved['success']) !== null && _25 !== void 0 ? _25 : DARK_DEFAULTS.success,
152
+ successForeground: (_27 = (_26 = colors.successForeground) !== null && _26 !== void 0 ? _26 : resolved['success-foreground']) !== null && _27 !== void 0 ? _27 : DARK_DEFAULTS.successForeground,
153
+ warning: (_29 = (_28 = colors.warning) !== null && _28 !== void 0 ? _28 : resolved['warning']) !== null && _29 !== void 0 ? _29 : DARK_DEFAULTS.warning,
154
+ warningForeground: (_31 = (_30 = colors.warningForeground) !== null && _30 !== void 0 ? _30 : resolved['warning-foreground']) !== null && _31 !== void 0 ? _31 : DARK_DEFAULTS.warningForeground,
155
+ info: (_33 = (_32 = colors.info) !== null && _32 !== void 0 ? _32 : resolved['info']) !== null && _33 !== void 0 ? _33 : DARK_DEFAULTS.info,
156
+ infoForeground: (_35 = (_34 = colors.infoForeground) !== null && _34 !== void 0 ? _34 : resolved['info-foreground']) !== null && _35 !== void 0 ? _35 : DARK_DEFAULTS.infoForeground,
157
+ };
158
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Unified API Client for BillDog React Native SDK
3
+ *
4
+ * Centralizes all `fetch()` calls to BillDog edge functions with:
5
+ * - Automatic `api_key` injection into every JSON body
6
+ * - Endpoint resolution via `BillDogConfiguration.resolveEndpoint()`
7
+ * - Consistent `Content-Type: application/json` header
8
+ * - Error handling with structured exceptions
9
+ *
10
+ * This eliminates the previous fragmentation where 7 files independently
11
+ * constructed URLs, resolved auth, and called `fetch()` with inconsistent
12
+ * header/body patterns.
13
+ */
14
+ export interface ApiClientResponse<T = any> {
15
+ data: T;
16
+ status: number;
17
+ }
18
+ export declare class ApiClientError extends Error {
19
+ readonly status: number;
20
+ readonly responseBody: any;
21
+ constructor(message: string, status: number, responseBody?: any);
22
+ }
23
+ /**
24
+ * Resolve endpoint URL — delegates to `BillDogConfiguration.resolveEndpoint()`
25
+ * (the single branded base, `https://api.billdog.io/v1`).
26
+ */
27
+ declare function resolveEndpoint(functionName: string): string;
28
+ /**
29
+ * Resolve the API key.
30
+ * If a deprecated `apiKey` override is provided, it takes precedence.
31
+ * Otherwise reads from `BillDogConfiguration`.
32
+ */
33
+ declare function resolveApiKey(apiKeyOverride?: string): string | undefined;
34
+ export declare const ApiClient: {
35
+ /**
36
+ * POST to a BillDog edge function.
37
+ *
38
+ * - Injects `api_key` into the JSON body (standard auth contract).
39
+ * - Resolves endpoint via configuration.
40
+ * - Throws `ApiClientError` on non-2xx responses.
41
+ *
42
+ * @param functionName - Edge function name (e.g. 'fetch-paywall')
43
+ * @param body - Request body (api_key will be injected automatically)
44
+ * @param options - Optional overrides for backward compatibility
45
+ */
46
+ post<T = any>(functionName: string, body?: Record<string, any>, options?: {
47
+ /** @deprecated Use BillDogConfiguration.configure({ apiKey }) */
48
+ apiKey?: string;
49
+ }): Promise<T>;
50
+ /**
51
+ * GET request to a raw URL (e.g. version check endpoints).
52
+ * Does NOT inject api_key — use only for unauthenticated endpoints.
53
+ */
54
+ get<T = any>(url: string): Promise<T>;
55
+ /**
56
+ * Convenience: resolve an API key for external use (e.g. hooks that need
57
+ * to check if a key is available before calling).
58
+ */
59
+ resolveApiKey: typeof resolveApiKey;
60
+ /**
61
+ * Convenience: resolve an endpoint URL for external use.
62
+ */
63
+ resolveEndpoint: typeof resolveEndpoint;
64
+ };
65
+ export {};
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ /**
3
+ * Unified API Client for BillDog React Native SDK
4
+ *
5
+ * Centralizes all `fetch()` calls to BillDog edge functions with:
6
+ * - Automatic `api_key` injection into every JSON body
7
+ * - Endpoint resolution via `BillDogConfiguration.resolveEndpoint()`
8
+ * - Consistent `Content-Type: application/json` header
9
+ * - Error handling with structured exceptions
10
+ *
11
+ * This eliminates the previous fragmentation where 7 files independently
12
+ * constructed URLs, resolved auth, and called `fetch()` with inconsistent
13
+ * header/body patterns.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ApiClient = exports.ApiClientError = void 0;
17
+ const BillDogConfiguration_1 = require("../BillDogConfiguration");
18
+ class ApiClientError extends Error {
19
+ constructor(message, status, responseBody) {
20
+ super(message);
21
+ this.name = 'ApiClientError';
22
+ this.status = status;
23
+ this.responseBody = responseBody;
24
+ }
25
+ }
26
+ exports.ApiClientError = ApiClientError;
27
+ /**
28
+ * Resolve endpoint URL — delegates to `BillDogConfiguration.resolveEndpoint()`
29
+ * (the single branded base, `https://api.billdog.io/v1`).
30
+ */
31
+ function resolveEndpoint(functionName) {
32
+ return BillDogConfiguration_1.BillDogConfiguration.resolveEndpoint(functionName);
33
+ }
34
+ /**
35
+ * Worker-less fallback endpoint — `direct.billdog.io/functions/v1/<fn>`.
36
+ * `direct.billdog.io` is a Supabase custom domain with NO Cloudflare Worker,
37
+ * so it uses the native Supabase `/functions/v1/` path (not the Worker's
38
+ * `/v1/` alias). Used when `api.billdog.io` is unreachable.
39
+ */
40
+ function directEndpoint(functionName) {
41
+ return `https://direct.billdog.io/functions/v1/${functionName}`;
42
+ }
43
+ /**
44
+ * Resolve the API key.
45
+ * If a deprecated `apiKey` override is provided, it takes precedence.
46
+ * Otherwise reads from `BillDogConfiguration`.
47
+ */
48
+ function resolveApiKey(apiKeyOverride) {
49
+ if (apiKeyOverride)
50
+ return apiKeyOverride;
51
+ if (BillDogConfiguration_1.BillDogConfiguration.isConfigured()) {
52
+ return BillDogConfiguration_1.BillDogConfiguration.getApiKey();
53
+ }
54
+ return undefined;
55
+ }
56
+ exports.ApiClient = {
57
+ /**
58
+ * POST to a BillDog edge function.
59
+ *
60
+ * - Injects `api_key` into the JSON body (standard auth contract).
61
+ * - Resolves endpoint via configuration.
62
+ * - Throws `ApiClientError` on non-2xx responses.
63
+ *
64
+ * @param functionName - Edge function name (e.g. 'fetch-paywall')
65
+ * @param body - Request body (api_key will be injected automatically)
66
+ * @param options - Optional overrides for backward compatibility
67
+ */
68
+ async post(functionName, body = {}, options) {
69
+ const apiKey = resolveApiKey(options === null || options === void 0 ? void 0 : options.apiKey);
70
+ const fullBody = {
71
+ ...body,
72
+ ...(apiKey ? { api_key: apiKey } : {}),
73
+ };
74
+ const init = {
75
+ method: 'POST',
76
+ headers: {
77
+ 'Content-Type': 'application/json',
78
+ },
79
+ body: JSON.stringify(fullBody),
80
+ };
81
+ let response;
82
+ try {
83
+ response = await fetch(resolveEndpoint(functionName), init);
84
+ // A gateway error means the api.billdog.io edge / Worker is unhealthy —
85
+ // retry once against the Worker-less direct path.
86
+ if (response.status === 502 || response.status === 503 || response.status === 504) {
87
+ try {
88
+ response = await fetch(directEndpoint(functionName), init);
89
+ }
90
+ catch {
91
+ /* keep the gateway response — surfaced as the error below */
92
+ }
93
+ }
94
+ }
95
+ catch {
96
+ // Transport failure — api.billdog.io is unreachable (Cloudflare Worker
97
+ // outage). Fall back to direct.billdog.io (plain DNS → Supabase, no Worker).
98
+ response = await fetch(directEndpoint(functionName), init);
99
+ }
100
+ if (!response.ok) {
101
+ const errorBody = await response.json().catch(() => ({ error: response.statusText }));
102
+ throw new ApiClientError(errorBody.error || `Request to ${functionName} failed: ${response.statusText}`, response.status, errorBody);
103
+ }
104
+ return response.json();
105
+ },
106
+ /**
107
+ * GET request to a raw URL (e.g. version check endpoints).
108
+ * Does NOT inject api_key — use only for unauthenticated endpoints.
109
+ */
110
+ async get(url) {
111
+ const response = await fetch(url, {
112
+ method: 'GET',
113
+ headers: {
114
+ 'Content-Type': 'application/json',
115
+ },
116
+ });
117
+ if (!response.ok) {
118
+ const errorBody = await response.json().catch(() => ({ error: response.statusText }));
119
+ throw new ApiClientError(`GET ${url} failed: ${response.statusText}`, response.status, errorBody);
120
+ }
121
+ return response.json();
122
+ },
123
+ /**
124
+ * Convenience: resolve an API key for external use (e.g. hooks that need
125
+ * to check if a key is available before calling).
126
+ */
127
+ resolveApiKey,
128
+ /**
129
+ * Convenience: resolve an endpoint URL for external use.
130
+ */
131
+ resolveEndpoint,
132
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * CSS to React Native Style Converter
3
+ * Converts CSS strings to React Native StyleSheet-compatible objects
4
+ * Enhanced with gradient detection and unified style generation
5
+ */
6
+ import { ViewStyle, TextStyle, ImageStyle } from 'react-native';
7
+ export interface GradientStop {
8
+ color: string;
9
+ position: number;
10
+ }
11
+ export interface GradientConfig {
12
+ type: 'linear' | 'radial';
13
+ angle?: number;
14
+ stops: GradientStop[];
15
+ }
16
+ export interface CSSConversionResult {
17
+ style: ViewStyle | TextStyle | ImageStyle;
18
+ warnings: string[];
19
+ /** If true, the component requires a LinearGradient wrapper */
20
+ requiresGradient?: boolean;
21
+ /** Gradient configuration for LinearGradient component */
22
+ gradient?: GradientConfig;
23
+ /** Fallback solid color if gradient can't be rendered */
24
+ fallbackColor?: string;
25
+ }
26
+ /**
27
+ * Convert CSS string to React Native styles
28
+ * Now with gradient detection and extraction
29
+ */
30
+ export declare function convertCSSToReactNative(css: string): CSSConversionResult;
31
+ /**
32
+ * Validate CSS for native compatibility
33
+ */
34
+ export declare function validateCSSForNative(css: string): string[];
35
+ /**
36
+ * Convert gradient angle to LinearGradient start/end points
37
+ * CSS angle: 0deg = bottom to top, 90deg = left to right
38
+ * LinearGradient: start/end are {x, y} where 0,0 is top-left
39
+ */
40
+ export declare function angleToGradientPoints(angle: number): {
41
+ start: {
42
+ x: number;
43
+ y: number;
44
+ };
45
+ end: {
46
+ x: number;
47
+ y: number;
48
+ };
49
+ };