@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,484 @@
1
+ "use strict";
2
+ /**
3
+ * Native React Native Carousel with swipe, pagination, and axis support
4
+ * Supports horizontal, vertical, and layered modes
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.CarouselComponent = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const react_native_1 = require("react-native");
43
+ const ComponentRenderer_1 = require("../ComponentRenderer");
44
+ // Enable LayoutAnimation on Android
45
+ if (react_native_1.Platform.OS === 'android' && react_native_1.UIManager.setLayoutAnimationEnabledExperimental) {
46
+ react_native_1.UIManager.setLayoutAnimationEnabledExperimental(true);
47
+ }
48
+ const CarouselComponent = ({ component, configuration, style, onButtonPress, onPageChange, stateManager, renderChild, }) => {
49
+ var _a, _b, _c, _d;
50
+ const props = component.properties || {};
51
+ const containerLayout = component.containerLayout;
52
+ // Properties
53
+ const showPagination = props.showPagination !== false;
54
+ const showArrows = props.showArrows === true;
55
+ const loop = props.loop === true;
56
+ const dragEnabled = props.dragEnabled !== false;
57
+ const animated = props.animated !== false;
58
+ const defaultIndex = (_a = props.defaultIndex) !== null && _a !== void 0 ? _a : 0;
59
+ const paginationColor = props.paginationColor || '#007AFF';
60
+ const paginationInactiveColor = props.paginationInactiveColor || '#CCCCCC';
61
+ // Slide display settings
62
+ const slideDisplay = props.slideDisplay || 'full'; // 'full' | 'peek'
63
+ const peekAmount = (_b = props.peekAmount) !== null && _b !== void 0 ? _b : 15; // percentage 5-40
64
+ // Transition settings (new)
65
+ const transition = props.transition || 'scroll'; // 'scroll' | 'fade' | 'slide' | 'push' | 'none'
66
+ const transitionDuration = (_c = props.transitionDuration) !== null && _c !== void 0 ? _c : 300; // milliseconds
67
+ const keyboardEnabled = props.keyboardEnabled !== false; // keyboard navigation
68
+ // Auto scroll settings
69
+ const autoScrollEnabled = props.autoScrollEnabled === true;
70
+ const autoScrollInterval = (_d = props.autoScrollInterval) !== null && _d !== void 0 ? _d : 3000;
71
+ const autoScrollDirection = props.autoScrollDirection || 'forward';
72
+ const pauseOnTouch = props.pauseOnHover !== false; // pauseOnHover maps to touch on mobile
73
+ // Axis support: horizontal (default), vertical, or layered
74
+ const axis = (containerLayout === null || containerLayout === void 0 ? void 0 : containerLayout.axis) || props.axis || 'horizontal';
75
+ const children = component.children || [];
76
+ const itemCount = children.length;
77
+ const [currentIndex, setCurrentIndex] = (0, react_1.useState)(Math.min(defaultIndex, Math.max(0, itemCount - 1)));
78
+ const [containerWidth, setContainerWidth] = (0, react_1.useState)(react_native_1.Dimensions.get('window').width);
79
+ const [containerHeight, setContainerHeight] = (0, react_1.useState)(200);
80
+ const scrollViewRef = (0, react_1.useRef)(null);
81
+ const isInitialized = (0, react_1.useRef)(false);
82
+ const isDragging = (0, react_1.useRef)(false);
83
+ const autoScrollTimerRef = (0, react_1.useRef)(null);
84
+ // Calculate slide width for peek mode
85
+ const slideWidth = slideDisplay === 'peek'
86
+ ? containerWidth * (1 - peekAmount / 100)
87
+ : containerWidth;
88
+ // Initialize scroll position on mount
89
+ (0, react_1.useEffect)(() => {
90
+ if (scrollViewRef.current && !isInitialized.current && axis !== 'layered') {
91
+ isInitialized.current = true;
92
+ const offset = axis === 'vertical'
93
+ ? { x: 0, y: currentIndex * containerHeight }
94
+ : { x: currentIndex * slideWidth, y: 0 };
95
+ setTimeout(() => {
96
+ var _a;
97
+ (_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ ...offset, animated: false });
98
+ }, 100);
99
+ }
100
+ }, [containerWidth, containerHeight, currentIndex, axis, slideWidth]);
101
+ // Auto scroll effect
102
+ (0, react_1.useEffect)(() => {
103
+ if (!autoScrollEnabled || itemCount <= 1) {
104
+ return;
105
+ }
106
+ const startAutoScroll = () => {
107
+ if (autoScrollTimerRef.current) {
108
+ clearInterval(autoScrollTimerRef.current);
109
+ }
110
+ autoScrollTimerRef.current = setInterval(() => {
111
+ if (isDragging.current && pauseOnTouch) {
112
+ return;
113
+ }
114
+ setCurrentIndex((prevIndex) => {
115
+ let nextIndex;
116
+ if (autoScrollDirection === 'reverse') {
117
+ nextIndex = prevIndex - 1;
118
+ if (nextIndex < 0) {
119
+ nextIndex = loop ? itemCount - 1 : 0;
120
+ }
121
+ }
122
+ else {
123
+ nextIndex = prevIndex + 1;
124
+ if (nextIndex >= itemCount) {
125
+ nextIndex = loop ? 0 : itemCount - 1;
126
+ }
127
+ }
128
+ return nextIndex;
129
+ });
130
+ }, autoScrollInterval);
131
+ };
132
+ startAutoScroll();
133
+ return () => {
134
+ if (autoScrollTimerRef.current) {
135
+ clearInterval(autoScrollTimerRef.current);
136
+ }
137
+ };
138
+ }, [autoScrollEnabled, autoScrollInterval, autoScrollDirection, loop, itemCount, pauseOnTouch]);
139
+ // Update state manager when index changes (SDK parity)
140
+ (0, react_1.useEffect)(() => {
141
+ if (stateManager) {
142
+ stateManager.setState(`element:${component.id}.currentIndex`, currentIndex);
143
+ stateManager.setState(`element:${component.id}.totalPages`, itemCount);
144
+ }
145
+ }, [stateManager, component.id, currentIndex, itemCount]);
146
+ // Create custom LayoutAnimation based on transition type and duration
147
+ const getTransitionAnimation = (0, react_1.useCallback)(() => {
148
+ if (transition === 'none' || !animated) {
149
+ return null;
150
+ }
151
+ const duration = transitionDuration;
152
+ switch (transition) {
153
+ case 'fade':
154
+ return react_native_1.LayoutAnimation.create(duration, react_native_1.LayoutAnimation.Types.easeInEaseOut, react_native_1.LayoutAnimation.Properties.opacity);
155
+ case 'slide':
156
+ case 'push':
157
+ return react_native_1.LayoutAnimation.create(duration, react_native_1.LayoutAnimation.Types.easeInEaseOut, react_native_1.LayoutAnimation.Properties.scaleXY);
158
+ case 'scroll':
159
+ default:
160
+ return react_native_1.LayoutAnimation.create(duration, react_native_1.LayoutAnimation.Types.easeInEaseOut, react_native_1.LayoutAnimation.Properties.opacity);
161
+ }
162
+ }, [transition, transitionDuration, animated]);
163
+ const handleScroll = (0, react_1.useCallback)((event) => {
164
+ const offset = axis === 'vertical'
165
+ ? event.nativeEvent.contentOffset.y
166
+ : event.nativeEvent.contentOffset.x;
167
+ const size = axis === 'vertical' ? containerHeight : slideWidth;
168
+ const newIndex = Math.round(offset / size);
169
+ if (newIndex !== currentIndex && newIndex >= 0 && newIndex < itemCount) {
170
+ const transitionAnim = getTransitionAnimation();
171
+ if (transitionAnim) {
172
+ react_native_1.LayoutAnimation.configureNext(transitionAnim);
173
+ }
174
+ setCurrentIndex(newIndex);
175
+ onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(newIndex);
176
+ onButtonPress === null || onButtonPress === void 0 ? void 0 : onButtonPress(component.id, `page_changed:${newIndex}`);
177
+ }
178
+ }, [axis, slideWidth, containerHeight, currentIndex, itemCount, onPageChange, onButtonPress, component.id, getTransitionAnimation]);
179
+ const handleScrollBeginDrag = (0, react_1.useCallback)(() => {
180
+ isDragging.current = true;
181
+ }, []);
182
+ const handleScrollEndDrag = (0, react_1.useCallback)(() => {
183
+ isDragging.current = false;
184
+ }, []);
185
+ const scrollToIndex = (0, react_1.useCallback)((index) => {
186
+ var _a;
187
+ let targetIndex = index;
188
+ if (loop) {
189
+ if (index < 0) {
190
+ targetIndex = itemCount - 1;
191
+ }
192
+ else if (index >= itemCount) {
193
+ targetIndex = 0;
194
+ }
195
+ }
196
+ else {
197
+ targetIndex = Math.max(0, Math.min(itemCount - 1, index));
198
+ }
199
+ if (axis === 'layered') {
200
+ // For layered, just update the index with transition animation
201
+ const transitionAnim = getTransitionAnimation();
202
+ if (transitionAnim) {
203
+ react_native_1.LayoutAnimation.configureNext(transitionAnim);
204
+ }
205
+ setCurrentIndex(targetIndex);
206
+ }
207
+ else {
208
+ const offset = axis === 'vertical'
209
+ ? { x: 0, y: targetIndex * containerHeight }
210
+ : { x: targetIndex * slideWidth, y: 0 };
211
+ // Use animated based on transition type
212
+ const shouldAnimate = transition !== 'none' && animated;
213
+ (_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
214
+ ...offset,
215
+ animated: shouldAnimate,
216
+ });
217
+ }
218
+ onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(targetIndex);
219
+ onButtonPress === null || onButtonPress === void 0 ? void 0 : onButtonPress(component.id, `page_changed:${targetIndex}`);
220
+ }, [loop, itemCount, axis, slideWidth, containerHeight, animated, transition, onPageChange, onButtonPress, component.id, getTransitionAnimation]);
221
+ // Listen for external state changes via state manager (placed after scrollToIndex)
222
+ (0, react_1.useEffect)(() => {
223
+ if (!stateManager)
224
+ return;
225
+ const unsubscribe = stateManager.subscribe(`element:${component.id}.currentIndex`, (value) => {
226
+ if (typeof value === 'number' && value !== currentIndex && value >= 0 && value < itemCount) {
227
+ scrollToIndex(value);
228
+ }
229
+ });
230
+ return unsubscribe;
231
+ }, [stateManager, component.id, currentIndex, itemCount, scrollToIndex]);
232
+ const goToPrevious = (0, react_1.useCallback)(() => {
233
+ scrollToIndex(currentIndex - 1);
234
+ }, [currentIndex, scrollToIndex]);
235
+ const goToNext = (0, react_1.useCallback)(() => {
236
+ scrollToIndex(currentIndex + 1);
237
+ }, [currentIndex, scrollToIndex]);
238
+ // Keyboard navigation for web platform
239
+ const handleKeyDown = (0, react_1.useCallback)((event) => {
240
+ var _a, _b, _c, _d, _e;
241
+ if (!keyboardEnabled || itemCount <= 1)
242
+ return;
243
+ const key = ((_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.key) || event.key;
244
+ const isVertical = axis === 'vertical';
245
+ if (isVertical) {
246
+ if (key === 'ArrowUp') {
247
+ (_b = event.preventDefault) === null || _b === void 0 ? void 0 : _b.call(event);
248
+ goToPrevious();
249
+ }
250
+ else if (key === 'ArrowDown') {
251
+ (_c = event.preventDefault) === null || _c === void 0 ? void 0 : _c.call(event);
252
+ goToNext();
253
+ }
254
+ }
255
+ else {
256
+ if (key === 'ArrowLeft') {
257
+ (_d = event.preventDefault) === null || _d === void 0 ? void 0 : _d.call(event);
258
+ goToPrevious();
259
+ }
260
+ else if (key === 'ArrowRight') {
261
+ (_e = event.preventDefault) === null || _e === void 0 ? void 0 : _e.call(event);
262
+ goToNext();
263
+ }
264
+ }
265
+ }, [keyboardEnabled, itemCount, axis, goToPrevious, goToNext]);
266
+ // Empty placeholder
267
+ if (itemCount === 0) {
268
+ return (<react_native_1.View style={[styles.emptyContainer, style]}>
269
+ <react_native_1.Text style={styles.emptyText}>Add slides to the carousel</react_native_1.Text>
270
+ </react_native_1.View>);
271
+ }
272
+ const isVertical = axis === 'vertical';
273
+ const isLayered = axis === 'layered';
274
+ // Render layered carousel
275
+ if (isLayered) {
276
+ // Web keyboard props
277
+ const webKeyboardProps = react_native_1.Platform.OS === 'web' && keyboardEnabled ? {
278
+ tabIndex: 0,
279
+ onKeyDown: handleKeyDown,
280
+ style: { outline: 'none' },
281
+ } : {};
282
+ return (<react_native_1.Pressable style={[styles.container, style]} onLayout={(e) => {
283
+ setContainerWidth(e.nativeEvent.layout.width);
284
+ setContainerHeight(e.nativeEvent.layout.height);
285
+ }} {...webKeyboardProps}>
286
+ <react_native_1.View style={styles.layeredContainer}>
287
+ {children.map((child, index) => (<react_native_1.View key={child.id} style={[
288
+ styles.layeredItem,
289
+ { opacity: index === currentIndex ? 1 : 0 },
290
+ ]}>
291
+ {renderChild ? renderChild(child) : (<ComponentRenderer_1.ComponentRenderer component={child} configuration={configuration} onButtonPress={onButtonPress} stateManager={stateManager}/>)}
292
+ </react_native_1.View>))}
293
+ </react_native_1.View>
294
+
295
+ {showPagination && itemCount > 1 && (<react_native_1.View style={styles.pagination}>
296
+ {children.map((_, index) => (<react_native_1.TouchableOpacity key={index} onPress={() => scrollToIndex(index)}>
297
+ <react_native_1.View style={[
298
+ styles.dot,
299
+ {
300
+ backgroundColor: index === currentIndex ? paginationColor : paginationInactiveColor,
301
+ transform: [{ scale: index === currentIndex ? 1.2 : 1 }],
302
+ },
303
+ ]}/>
304
+ </react_native_1.TouchableOpacity>))}
305
+ </react_native_1.View>)}
306
+ </react_native_1.Pressable>);
307
+ }
308
+ // Web keyboard props for horizontal/vertical carousels
309
+ const webKeyboardProps = react_native_1.Platform.OS === 'web' && keyboardEnabled ? {
310
+ tabIndex: 0,
311
+ onKeyDown: handleKeyDown,
312
+ style: { outline: 'none' },
313
+ } : {};
314
+ return (<react_native_1.Pressable style={[styles.container, style]} onLayout={(e) => {
315
+ setContainerWidth(e.nativeEvent.layout.width);
316
+ setContainerHeight(e.nativeEvent.layout.height);
317
+ }} {...webKeyboardProps}>
318
+ {/* Carousel content */}
319
+ <react_native_1.View style={styles.carouselContainer}>
320
+ <react_native_1.ScrollView ref={scrollViewRef} horizontal={!isVertical} pagingEnabled={slideDisplay !== 'peek'} showsHorizontalScrollIndicator={false} showsVerticalScrollIndicator={false} onMomentumScrollEnd={handleScroll} onScrollBeginDrag={handleScrollBeginDrag} onScrollEndDrag={handleScrollEndDrag} scrollEventThrottle={16} decelerationRate="fast" bounces={false} scrollEnabled={dragEnabled} snapToInterval={slideDisplay === 'peek' ? slideWidth : undefined} snapToAlignment={slideDisplay === 'peek' ? 'start' : undefined}>
321
+ {children.map((child) => (<react_native_1.View key={child.id} style={isVertical
322
+ ? { height: containerHeight, width: containerWidth }
323
+ : { width: slideWidth }}>
324
+ {renderChild ? renderChild(child) : (<ComponentRenderer_1.ComponentRenderer component={child} configuration={configuration} onButtonPress={onButtonPress} stateManager={stateManager}/>)}
325
+ </react_native_1.View>))}
326
+ </react_native_1.ScrollView>
327
+
328
+ {/* Navigation arrows */}
329
+ {showArrows && itemCount > 1 && (<>
330
+ <react_native_1.TouchableOpacity style={[
331
+ styles.arrow,
332
+ isVertical ? styles.topArrow : styles.leftArrow,
333
+ ]} onPress={goToPrevious} disabled={!loop && currentIndex === 0}>
334
+ <react_native_1.View style={[
335
+ styles.arrowButton,
336
+ { opacity: (!loop && currentIndex === 0) ? 0.3 : 1 }
337
+ ]}>
338
+ <react_native_1.View style={[
339
+ styles.arrowIcon,
340
+ isVertical ? styles.upArrowIcon : styles.leftArrowIcon
341
+ ]}/>
342
+ </react_native_1.View>
343
+ </react_native_1.TouchableOpacity>
344
+
345
+ <react_native_1.TouchableOpacity style={[
346
+ styles.arrow,
347
+ isVertical ? styles.bottomArrow : styles.rightArrow,
348
+ ]} onPress={goToNext} disabled={!loop && currentIndex === itemCount - 1}>
349
+ <react_native_1.View style={[
350
+ styles.arrowButton,
351
+ { opacity: (!loop && currentIndex === itemCount - 1) ? 0.3 : 1 }
352
+ ]}>
353
+ <react_native_1.View style={[
354
+ styles.arrowIcon,
355
+ isVertical ? styles.downArrowIcon : styles.rightArrowIcon
356
+ ]}/>
357
+ </react_native_1.View>
358
+ </react_native_1.TouchableOpacity>
359
+ </>)}
360
+ </react_native_1.View>
361
+
362
+ {/* Pagination dots */}
363
+ {showPagination && itemCount > 1 && (<react_native_1.View style={[
364
+ styles.pagination,
365
+ isVertical && styles.verticalPagination,
366
+ ]}>
367
+ {children.map((_, index) => (<react_native_1.TouchableOpacity key={index} onPress={() => scrollToIndex(index)}>
368
+ <react_native_1.View style={[
369
+ styles.dot,
370
+ {
371
+ backgroundColor: index === currentIndex
372
+ ? paginationColor
373
+ : paginationInactiveColor,
374
+ transform: [{ scale: index === currentIndex ? 1.2 : 1 }],
375
+ },
376
+ ]}/>
377
+ </react_native_1.TouchableOpacity>))}
378
+ </react_native_1.View>)}
379
+ </react_native_1.Pressable>);
380
+ };
381
+ exports.CarouselComponent = CarouselComponent;
382
+ const styles = react_native_1.StyleSheet.create({
383
+ container: {
384
+ width: '100%',
385
+ },
386
+ carouselContainer: {
387
+ position: 'relative',
388
+ overflow: 'hidden',
389
+ },
390
+ emptyContainer: {
391
+ height: 100,
392
+ backgroundColor: 'rgba(128, 128, 128, 0.1)',
393
+ borderRadius: 8,
394
+ borderWidth: 1,
395
+ borderColor: 'rgba(128, 128, 128, 0.3)',
396
+ borderStyle: 'dashed',
397
+ justifyContent: 'center',
398
+ alignItems: 'center',
399
+ },
400
+ emptyText: {
401
+ color: '#888',
402
+ fontSize: 12,
403
+ },
404
+ layeredContainer: {
405
+ position: 'relative',
406
+ },
407
+ layeredItem: {
408
+ position: 'absolute',
409
+ top: 0,
410
+ left: 0,
411
+ right: 0,
412
+ },
413
+ pagination: {
414
+ flexDirection: 'row',
415
+ justifyContent: 'center',
416
+ alignItems: 'center',
417
+ paddingVertical: 12,
418
+ gap: 8,
419
+ },
420
+ verticalPagination: {
421
+ position: 'absolute',
422
+ right: 8,
423
+ top: '50%',
424
+ flexDirection: 'column',
425
+ paddingVertical: 0,
426
+ paddingHorizontal: 8,
427
+ },
428
+ dot: {
429
+ width: 8,
430
+ height: 8,
431
+ borderRadius: 4,
432
+ },
433
+ arrow: {
434
+ position: 'absolute',
435
+ zIndex: 10,
436
+ },
437
+ leftArrow: {
438
+ left: 8,
439
+ top: '50%',
440
+ marginTop: -20,
441
+ },
442
+ rightArrow: {
443
+ right: 8,
444
+ top: '50%',
445
+ marginTop: -20,
446
+ },
447
+ topArrow: {
448
+ top: 8,
449
+ left: '50%',
450
+ marginLeft: -20,
451
+ },
452
+ bottomArrow: {
453
+ bottom: 8,
454
+ left: '50%',
455
+ marginLeft: -20,
456
+ },
457
+ arrowButton: {
458
+ width: 40,
459
+ height: 40,
460
+ borderRadius: 20,
461
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
462
+ justifyContent: 'center',
463
+ alignItems: 'center',
464
+ },
465
+ arrowIcon: {
466
+ width: 12,
467
+ height: 12,
468
+ borderTopWidth: 2,
469
+ borderRightWidth: 2,
470
+ borderColor: '#FFFFFF',
471
+ },
472
+ leftArrowIcon: {
473
+ transform: [{ rotate: '-135deg' }, { translateX: 2 }],
474
+ },
475
+ rightArrowIcon: {
476
+ transform: [{ rotate: '45deg' }, { translateX: -2 }],
477
+ },
478
+ upArrowIcon: {
479
+ transform: [{ rotate: '-45deg' }, { translateY: 2 }],
480
+ },
481
+ downArrowIcon: {
482
+ transform: [{ rotate: '135deg' }, { translateY: -2 }],
483
+ },
484
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ChartCurveComponent - Native React Native implementation
3
+ * Supports 6 curve types: ascending, descending, dip, rise, flat-end, s-curve
4
+ */
5
+ import React from 'react';
6
+ import { PaywallComponent } from '../types';
7
+ interface ChartCurveComponentProps {
8
+ component: PaywallComponent;
9
+ stateManager?: any;
10
+ isPreviewMode?: boolean;
11
+ }
12
+ export declare const ChartCurveComponent: React.FC<ChartCurveComponentProps>;
13
+ export {};