@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,302 @@
1
+ "use strict";
2
+ /**
3
+ * NavigationComponent - React Native
4
+ *
5
+ * Multi-screen paywall navigation with state management.
6
+ * Features:
7
+ * - Page stack navigation
8
+ * - State integration for current page tracking
9
+ * - Transition animations (slide, fade, push, none)
10
+ * - Swipe gesture navigation
11
+ * - Forward/back navigation
12
+ * - Entry/exit condition support
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.NavigationComponent = void 0;
49
+ const react_1 = __importStar(require("react"));
50
+ const react_native_1 = require("react-native");
51
+ const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = react_native_1.Dimensions.get('window');
52
+ const NavigationComponent = ({ component, stateManager, isPreviewMode = false, renderComponent, }) => {
53
+ const props = component.properties;
54
+ const componentId = component.id;
55
+ // Configuration
56
+ const transition = props.transition || 'slide';
57
+ const transitionDirection = props.transitionDirection || 'horizontal';
58
+ const transitionDuration = props.transitionDuration || 300;
59
+ const swipeEnabled = props.swipeEnabled !== false;
60
+ const swipeThreshold = props.swipeThreshold || 0.3;
61
+ const initialPage = props.initialPage || 0;
62
+ // Get pages from children
63
+ const pages = component.children || [];
64
+ const totalPages = pages.length;
65
+ // State
66
+ const [currentIndex, setCurrentIndex] = (0, react_1.useState)(initialPage);
67
+ const [history, setHistory] = (0, react_1.useState)([initialPage]);
68
+ const animatedValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
69
+ const panValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
70
+ // State manager integration
71
+ (0, react_1.useEffect)(() => {
72
+ if (stateManager) {
73
+ // Initialize state
74
+ stateManager.updateState(`element:${componentId}.currentIndex`, currentIndex);
75
+ stateManager.updateState(`element:${componentId}.totalPages`, totalPages);
76
+ stateManager.updateState(`element:${componentId}.canGoBack`, history.length > 1);
77
+ stateManager.updateState(`element:${componentId}.history`, history);
78
+ // Subscribe to external navigation commands
79
+ const unsubscribe = stateManager.subscribeToState(`element:${componentId}.navigateTo`, (value) => {
80
+ if (value !== null && value >= 0 && value < totalPages && value !== currentIndex) {
81
+ navigateToPage(value);
82
+ }
83
+ });
84
+ return unsubscribe;
85
+ }
86
+ }, [componentId, stateManager, currentIndex, totalPages, history]);
87
+ // Update state manager when current index changes
88
+ (0, react_1.useEffect)(() => {
89
+ if (stateManager) {
90
+ stateManager.updateState(`element:${componentId}.currentIndex`, currentIndex);
91
+ stateManager.updateState(`element:${componentId}.canGoBack`, history.length > 1);
92
+ stateManager.updateState(`element:${componentId}.history`, history);
93
+ }
94
+ }, [currentIndex, history, componentId, stateManager]);
95
+ // Navigate to a specific page
96
+ const navigateToPage = (0, react_1.useCallback)((pageIndex, options) => {
97
+ if (pageIndex < 0 || pageIndex >= totalPages || pageIndex === currentIndex)
98
+ return;
99
+ const direction = pageIndex > currentIndex ? 1 : -1;
100
+ // Animate transition
101
+ react_native_1.Animated.timing(animatedValue, {
102
+ toValue: direction,
103
+ duration: transitionDuration,
104
+ useNativeDriver: true,
105
+ }).start(() => {
106
+ setCurrentIndex(pageIndex);
107
+ // Update history
108
+ if (options === null || options === void 0 ? void 0 : options.replace) {
109
+ setHistory(prev => [...prev.slice(0, -1), pageIndex]);
110
+ }
111
+ else {
112
+ setHistory(prev => [...prev, pageIndex]);
113
+ }
114
+ animatedValue.setValue(0);
115
+ });
116
+ }, [currentIndex, totalPages, transitionDuration, animatedValue]);
117
+ // Go back in history
118
+ const goBack = (0, react_1.useCallback)(() => {
119
+ if (history.length <= 1)
120
+ return;
121
+ const newHistory = [...history];
122
+ newHistory.pop();
123
+ const previousPage = newHistory[newHistory.length - 1];
124
+ react_native_1.Animated.timing(animatedValue, {
125
+ toValue: -1,
126
+ duration: transitionDuration,
127
+ useNativeDriver: true,
128
+ }).start(() => {
129
+ setCurrentIndex(previousPage);
130
+ setHistory(newHistory);
131
+ animatedValue.setValue(0);
132
+ });
133
+ if (stateManager) {
134
+ stateManager.updateState(`element:${componentId}.currentIndex`, previousPage);
135
+ }
136
+ }, [history, transitionDuration, animatedValue, componentId, stateManager]);
137
+ // Go to next page
138
+ const goNext = (0, react_1.useCallback)(() => {
139
+ if (currentIndex < totalPages - 1) {
140
+ navigateToPage(currentIndex + 1);
141
+ }
142
+ }, [currentIndex, totalPages, navigateToPage]);
143
+ // Go to previous page
144
+ const goPrevious = (0, react_1.useCallback)(() => {
145
+ if (currentIndex > 0) {
146
+ navigateToPage(currentIndex - 1);
147
+ }
148
+ }, [currentIndex, navigateToPage]);
149
+ // Pan responder for swipe navigation
150
+ const panResponder = (0, react_1.useRef)(react_native_1.PanResponder.create({
151
+ onStartShouldSetPanResponder: () => false,
152
+ onMoveShouldSetPanResponder: (_, gestureState) => {
153
+ if (!swipeEnabled)
154
+ return false;
155
+ const { dx, dy } = gestureState;
156
+ const isHorizontal = transitionDirection === 'horizontal';
157
+ if (isHorizontal) {
158
+ return Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 10;
159
+ }
160
+ else {
161
+ return Math.abs(dy) > Math.abs(dx) && Math.abs(dy) > 10;
162
+ }
163
+ },
164
+ onPanResponderMove: (_, gestureState) => {
165
+ const { dx, dy } = gestureState;
166
+ const isHorizontal = transitionDirection === 'horizontal';
167
+ const delta = isHorizontal ? dx : dy;
168
+ const size = isHorizontal ? SCREEN_WIDTH : SCREEN_HEIGHT;
169
+ // Normalize pan value between -1 and 1
170
+ const normalizedDelta = delta / size;
171
+ // Check boundaries
172
+ if (normalizedDelta > 0 && currentIndex === 0) {
173
+ panValue.setValue(normalizedDelta * 0.2); // Resistance at start
174
+ }
175
+ else if (normalizedDelta < 0 && currentIndex === totalPages - 1) {
176
+ panValue.setValue(normalizedDelta * 0.2); // Resistance at end
177
+ }
178
+ else {
179
+ panValue.setValue(normalizedDelta);
180
+ }
181
+ },
182
+ onPanResponderRelease: (_, gestureState) => {
183
+ const { dx, dy, vx, vy } = gestureState;
184
+ const isHorizontal = transitionDirection === 'horizontal';
185
+ const delta = isHorizontal ? dx : dy;
186
+ const velocity = isHorizontal ? vx : vy;
187
+ const size = isHorizontal ? SCREEN_WIDTH : SCREEN_HEIGHT;
188
+ const normalizedDelta = delta / size;
189
+ // Determine if we should navigate
190
+ if (Math.abs(normalizedDelta) > swipeThreshold || Math.abs(velocity) > 0.5) {
191
+ if (normalizedDelta > 0 && currentIndex > 0) {
192
+ // Swipe right/down - go back
193
+ react_native_1.Animated.timing(panValue, {
194
+ toValue: 1,
195
+ duration: 200,
196
+ useNativeDriver: true,
197
+ }).start(() => {
198
+ panValue.setValue(0);
199
+ goPrevious();
200
+ });
201
+ }
202
+ else if (normalizedDelta < 0 && currentIndex < totalPages - 1) {
203
+ // Swipe left/up - go forward
204
+ react_native_1.Animated.timing(panValue, {
205
+ toValue: -1,
206
+ duration: 200,
207
+ useNativeDriver: true,
208
+ }).start(() => {
209
+ panValue.setValue(0);
210
+ goNext();
211
+ });
212
+ }
213
+ else {
214
+ // Snap back
215
+ react_native_1.Animated.spring(panValue, {
216
+ toValue: 0,
217
+ useNativeDriver: true,
218
+ }).start();
219
+ }
220
+ }
221
+ else {
222
+ // Snap back
223
+ react_native_1.Animated.spring(panValue, {
224
+ toValue: 0,
225
+ useNativeDriver: true,
226
+ }).start();
227
+ }
228
+ },
229
+ })).current;
230
+ // Calculate animated transform based on transition type
231
+ const getTransformStyle = (pageOffset) => {
232
+ const isHorizontal = transitionDirection === 'horizontal';
233
+ const size = isHorizontal ? SCREEN_WIDTH : SCREEN_HEIGHT;
234
+ const combinedOffset = react_native_1.Animated.add(animatedValue, panValue);
235
+ switch (transition) {
236
+ case 'slide':
237
+ const translateX = isHorizontal
238
+ ? react_native_1.Animated.multiply(combinedOffset, new react_native_1.Animated.Value(-size)).interpolate({
239
+ inputRange: [-1, 0, 1],
240
+ outputRange: [size + pageOffset * size, pageOffset * size, -size + pageOffset * size],
241
+ })
242
+ : 0;
243
+ const translateY = !isHorizontal
244
+ ? react_native_1.Animated.multiply(combinedOffset, new react_native_1.Animated.Value(-size)).interpolate({
245
+ inputRange: [-1, 0, 1],
246
+ outputRange: [size + pageOffset * size, pageOffset * size, -size + pageOffset * size],
247
+ })
248
+ : 0;
249
+ return { transform: [{ translateX }, { translateY }] };
250
+ case 'fade':
251
+ return {
252
+ opacity: combinedOffset.interpolate({
253
+ inputRange: [-1, 0, 1],
254
+ outputRange: pageOffset === 0 ? [0, 1, 0] : [1, 0, 1],
255
+ }),
256
+ };
257
+ case 'push':
258
+ const pushTranslate = isHorizontal
259
+ ? combinedOffset.interpolate({
260
+ inputRange: [-1, 0, 1],
261
+ outputRange: [size * 0.3, pageOffset * size, -size * 0.3],
262
+ })
263
+ : combinedOffset.interpolate({
264
+ inputRange: [-1, 0, 1],
265
+ outputRange: [size * 0.3, pageOffset * size, -size * 0.3],
266
+ });
267
+ const scale = combinedOffset.interpolate({
268
+ inputRange: [-1, 0, 1],
269
+ outputRange: pageOffset === 0 ? [0.9, 1, 0.9] : [1, 0.9, 1],
270
+ });
271
+ return {
272
+ transform: [
273
+ isHorizontal ? { translateX: pushTranslate } : { translateY: pushTranslate },
274
+ { scale },
275
+ ],
276
+ };
277
+ case 'none':
278
+ default:
279
+ return {};
280
+ }
281
+ };
282
+ // Render current page
283
+ const currentPage = pages[currentIndex];
284
+ if (!currentPage) {
285
+ return null;
286
+ }
287
+ return (<react_native_1.View style={styles.container} {...panResponder.panHandlers}>
288
+ <react_native_1.Animated.View style={[styles.page, getTransformStyle(0)]}>
289
+ {renderComponent === null || renderComponent === void 0 ? void 0 : renderComponent(currentPage)}
290
+ </react_native_1.Animated.View>
291
+ </react_native_1.View>);
292
+ };
293
+ exports.NavigationComponent = NavigationComponent;
294
+ const styles = react_native_1.StyleSheet.create({
295
+ container: {
296
+ flex: 1,
297
+ overflow: 'hidden',
298
+ },
299
+ page: {
300
+ ...react_native_1.StyleSheet.absoluteFillObject,
301
+ },
302
+ });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * OAuthButtonComponent - React Native
3
+ *
4
+ * Social login button with provider branding.
5
+ * Features:
6
+ * - Provider-specific branding (Google, Apple, Facebook)
7
+ * - Loading, success, and error states
8
+ * - Native bridge delegation for OAuth flow
9
+ */
10
+ import React from 'react';
11
+ import { PaywallComponent } from '../types';
12
+ type OAuthProvider = 'google' | 'apple' | 'facebook';
13
+ interface OAuthButtonComponentProps {
14
+ component: PaywallComponent;
15
+ stateManager?: any;
16
+ isPreviewMode?: boolean;
17
+ onOAuthRequest?: (provider: OAuthProvider, componentId: string) => void;
18
+ }
19
+ export declare const OAuthButtonComponent: React.FC<OAuthButtonComponentProps>;
20
+ export {};
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ /**
3
+ * OAuthButtonComponent - React Native
4
+ *
5
+ * Social login button with provider branding.
6
+ * Features:
7
+ * - Provider-specific branding (Google, Apple, Facebook)
8
+ * - Loading, success, and error states
9
+ * - Native bridge delegation for OAuth flow
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.OAuthButtonComponent = void 0;
46
+ const react_1 = __importStar(require("react"));
47
+ const react_native_1 = require("react-native");
48
+ // Provider branding
49
+ const PROVIDER_BRANDING = {
50
+ google: {
51
+ bg: '#FFFFFF',
52
+ text: '#1F1F1F',
53
+ icon: 'G',
54
+ },
55
+ apple: {
56
+ bg: '#000000',
57
+ text: '#FFFFFF',
58
+ icon: '',
59
+ },
60
+ facebook: {
61
+ bg: '#1877F2',
62
+ text: '#FFFFFF',
63
+ icon: 'f',
64
+ },
65
+ };
66
+ const OAuthButtonComponent = ({ component, stateManager, isPreviewMode = false, onOAuthRequest, }) => {
67
+ const props = component.properties;
68
+ const componentId = component.id;
69
+ // Configuration
70
+ const provider = props.provider || 'google';
71
+ const buttonText = props.buttonText || `Continue with ${provider.charAt(0).toUpperCase() + provider.slice(1)}`;
72
+ const showIcon = props.showIcon !== false;
73
+ const iconPosition = props.iconPosition || 'left';
74
+ const buttonStyle = props.buttonStyle || 'branded';
75
+ const customBackgroundColor = props.backgroundColor;
76
+ const customTextColor = props.textColor;
77
+ const borderColor = props.borderColor || '#D1D5DB';
78
+ const borderWidth = props.borderWidth || 1;
79
+ const borderRadius = props.borderRadius || 8;
80
+ const buttonHeight = props.buttonHeight || 48;
81
+ const iconSize = props.iconSize || 20;
82
+ const iconGap = props.iconGap || 12;
83
+ const fontSize = props.fontSize || 16;
84
+ const fontWeight = props.fontWeight || '500';
85
+ const loadingText = props.loadingText || 'Signing in...';
86
+ const showLoadingSpinner = props.showLoadingSpinner !== false;
87
+ const errorText = props.errorText || 'Sign in failed. Try again.';
88
+ const successText = props.successText || 'Signed in!';
89
+ const [buttonState, setButtonState] = (0, react_1.useState)('idle');
90
+ const [error, setError] = (0, react_1.useState)(null);
91
+ // Get provider branding
92
+ const branding = PROVIDER_BRANDING[provider];
93
+ // Compute button colors
94
+ const computedColors = (0, react_1.useMemo)(() => {
95
+ if (buttonStyle === 'branded') {
96
+ return {
97
+ bg: branding.bg,
98
+ text: branding.text,
99
+ border: branding.bg,
100
+ };
101
+ }
102
+ if (buttonStyle === 'outline') {
103
+ return {
104
+ bg: 'transparent',
105
+ text: customTextColor || '#1F2937',
106
+ border: borderColor,
107
+ };
108
+ }
109
+ return {
110
+ bg: customBackgroundColor || branding.bg,
111
+ text: customTextColor || branding.text,
112
+ border: borderColor,
113
+ };
114
+ }, [buttonStyle, branding, customBackgroundColor, customTextColor, borderColor]);
115
+ // Handle button press
116
+ const handlePress = (0, react_1.useCallback)(() => {
117
+ if (buttonState !== 'idle')
118
+ return;
119
+ setButtonState('loading');
120
+ setError(null);
121
+ // Call native OAuth handler
122
+ if (onOAuthRequest) {
123
+ onOAuthRequest(provider, componentId);
124
+ }
125
+ // Simulate success in preview mode
126
+ if (isPreviewMode) {
127
+ setTimeout(() => {
128
+ setButtonState('success');
129
+ if (stateManager) {
130
+ stateManager.updateState(`element:${componentId}.authenticated`, true);
131
+ stateManager.updateState(`element:${componentId}.authResult`, {
132
+ userId: 'preview_user_123',
133
+ email: 'user@example.com',
134
+ displayName: 'Preview User',
135
+ });
136
+ }
137
+ // Reset after success
138
+ setTimeout(() => setButtonState('idle'), 2000);
139
+ }, 1500);
140
+ }
141
+ }, [buttonState, provider, componentId, isPreviewMode, onOAuthRequest, stateManager]);
142
+ // External method to set result (called by native bridge)
143
+ (0, react_1.useEffect)(() => {
144
+ if (stateManager) {
145
+ // Subscribe to auth result events
146
+ return stateManager.subscribeToState(`element:${componentId}.authComplete`, (result) => {
147
+ if (result.success) {
148
+ setButtonState('success');
149
+ stateManager.updateState(`element:${componentId}.authenticated`, true);
150
+ stateManager.updateState(`element:${componentId}.authResult`, result.data);
151
+ setTimeout(() => setButtonState('idle'), 2000);
152
+ }
153
+ else {
154
+ setButtonState('error');
155
+ setError(result.error || errorText);
156
+ stateManager.updateState(`element:${componentId}.authenticated`, false);
157
+ stateManager.updateState(`element:${componentId}.authError`, result.error);
158
+ setTimeout(() => {
159
+ setButtonState('idle');
160
+ setError(null);
161
+ }, 3000);
162
+ }
163
+ });
164
+ }
165
+ }, [componentId, stateManager, errorText]);
166
+ // Get current display text
167
+ const currentText = (0, react_1.useMemo)(() => {
168
+ switch (buttonState) {
169
+ case 'loading':
170
+ return loadingText;
171
+ case 'success':
172
+ return successText;
173
+ case 'error':
174
+ return error || errorText;
175
+ default:
176
+ return buttonText;
177
+ }
178
+ }, [buttonState, loadingText, successText, errorText, error, buttonText]);
179
+ // Render provider icon
180
+ const renderIcon = () => {
181
+ if (!showIcon || buttonState !== 'idle')
182
+ return null;
183
+ // Use text-based icons (in real app, use actual SVG or Icon components)
184
+ const iconText = provider === 'google' ? '🔵' : provider === 'apple' ? '🍎' : '📘';
185
+ return (<react_native_1.Text style={{ fontSize: iconSize }}>
186
+ {iconText}
187
+ </react_native_1.Text>);
188
+ };
189
+ return (<react_native_1.TouchableOpacity onPress={handlePress} disabled={buttonState === 'loading' || buttonState === 'success'} activeOpacity={0.8} style={[
190
+ styles.button,
191
+ {
192
+ height: buttonHeight,
193
+ backgroundColor: computedColors.bg,
194
+ borderColor: buttonState === 'error' ? '#EF4444' : computedColors.border,
195
+ borderWidth,
196
+ borderRadius,
197
+ flexDirection: iconPosition === 'right' ? 'row-reverse' : 'row',
198
+ gap: iconGap,
199
+ opacity: buttonState === 'loading' ? 0.8 : 1,
200
+ },
201
+ ]}>
202
+ {/* Loading Spinner */}
203
+ {buttonState === 'loading' && showLoadingSpinner && (<react_native_1.ActivityIndicator size="small" color={computedColors.text}/>)}
204
+
205
+ {/* Success Check */}
206
+ {buttonState === 'success' && (<react_native_1.Text style={{ fontSize: iconSize, color: '#10B981' }}>✓</react_native_1.Text>)}
207
+
208
+ {/* Error Icon */}
209
+ {buttonState === 'error' && (<react_native_1.Text style={{ fontSize: iconSize, color: '#EF4444' }}>⚠</react_native_1.Text>)}
210
+
211
+ {/* Provider Icon */}
212
+ {buttonState === 'idle' && renderIcon()}
213
+
214
+ {/* Button Text */}
215
+ <react_native_1.Text style={[
216
+ styles.buttonText,
217
+ {
218
+ fontSize,
219
+ fontWeight: fontWeight,
220
+ color: buttonState === 'error' ? '#EF4444' : computedColors.text,
221
+ },
222
+ ]}>
223
+ {currentText}
224
+ </react_native_1.Text>
225
+ </react_native_1.TouchableOpacity>);
226
+ };
227
+ exports.OAuthButtonComponent = OAuthButtonComponent;
228
+ const styles = react_native_1.StyleSheet.create({
229
+ button: {
230
+ width: '100%',
231
+ alignItems: 'center',
232
+ justifyContent: 'center',
233
+ },
234
+ buttonText: {
235
+ textAlign: 'center',
236
+ },
237
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ProgressLoaderComponent - Native React Native implementation
3
+ * Supports 5 display modes: spinner, loading-text, bar, circular, loader-set
4
+ */
5
+ import React from 'react';
6
+ import { PaywallComponent } from '../types';
7
+ interface ProgressLoaderComponentProps {
8
+ component: PaywallComponent;
9
+ stateManager?: any;
10
+ isPreviewMode?: boolean;
11
+ }
12
+ export declare const ProgressLoaderComponent: React.FC<ProgressLoaderComponentProps>;
13
+ export {};