@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,187 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AccordionComponent = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ // Enable LayoutAnimation on Android
40
+ if (react_native_1.Platform.OS === 'android' && react_native_1.UIManager.setLayoutAnimationEnabledExperimental) {
41
+ react_native_1.UIManager.setLayoutAnimationEnabledExperimental(true);
42
+ }
43
+ const AccordionComponent = ({ component, renderChild, stateManager, isPreviewMode = false, }) => {
44
+ var _a, _b, _c, _d, _e, _f, _g;
45
+ const props = component.properties;
46
+ const allowMultiple = (_a = props.allowMultiple) !== null && _a !== void 0 ? _a : false;
47
+ const defaultExpanded = (_b = props.defaultExpandedIndex) !== null && _b !== void 0 ? _b : -1;
48
+ const animated = props.animated !== false;
49
+ const gap = (_c = props.gap) !== null && _c !== void 0 ? _c : 4;
50
+ const headerPadding = (_d = props.headerPadding) !== null && _d !== void 0 ? _d : 12;
51
+ const contentPadding = (_e = props.contentPadding) !== null && _e !== void 0 ? _e : 12;
52
+ const opacity = (_f = props.opacity) !== null && _f !== void 0 ? _f : 1;
53
+ const headerBackground = (_g = props.headerBackground) !== null && _g !== void 0 ? _g : '#f5f5f5';
54
+ const [expandedIndexes, setExpandedIndexes] = (0, react_1.useState)(defaultExpanded >= 0 ? [defaultExpanded] : []);
55
+ // Get items from children only
56
+ const items = component.children || [];
57
+ // Register initial state
58
+ (0, react_1.useEffect)(() => {
59
+ if (stateManager) {
60
+ const currentIndex = expandedIndexes.length > 0 ? expandedIndexes[0] : -1;
61
+ stateManager.updateState(`element:${component.id}.currentIndex`, currentIndex);
62
+ stateManager.updateState(`element:${component.id}.expandedIndexes`, expandedIndexes);
63
+ stateManager.updateState(`element:${component.id}.totalItems`, items.length);
64
+ }
65
+ }, []);
66
+ // Subscribe to external state changes
67
+ (0, react_1.useEffect)(() => {
68
+ if (stateManager) {
69
+ const unsubscribe = stateManager.subscribeToState(`element:${component.id}.currentIndex`, (value) => {
70
+ const current = expandedIndexes.length > 0 ? expandedIndexes[0] : -1;
71
+ if (value !== current) {
72
+ if (animated) {
73
+ react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
74
+ }
75
+ setExpandedIndexes(value >= 0 ? [value] : []);
76
+ }
77
+ });
78
+ const unsubscribeMultiple = stateManager.subscribeToState(`element:${component.id}.expandedIndexes`, (value) => {
79
+ if (Array.isArray(value) && allowMultiple) {
80
+ if (animated) {
81
+ react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
82
+ }
83
+ setExpandedIndexes(value);
84
+ }
85
+ });
86
+ return () => {
87
+ unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
88
+ unsubscribeMultiple === null || unsubscribeMultiple === void 0 ? void 0 : unsubscribeMultiple();
89
+ };
90
+ }
91
+ }, [component.id, stateManager, allowMultiple]);
92
+ const toggleItem = (index) => {
93
+ if (animated) {
94
+ react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
95
+ }
96
+ let newExpandedIndexes;
97
+ if (allowMultiple) {
98
+ newExpandedIndexes = expandedIndexes.includes(index)
99
+ ? expandedIndexes.filter(i => i !== index)
100
+ : [...expandedIndexes, index];
101
+ }
102
+ else {
103
+ newExpandedIndexes = expandedIndexes.includes(index) ? [] : [index];
104
+ }
105
+ setExpandedIndexes(newExpandedIndexes);
106
+ if (stateManager) {
107
+ const currentIndex = newExpandedIndexes.length > 0 ? newExpandedIndexes[0] : -1;
108
+ stateManager.updateState(`element:${component.id}.currentIndex`, currentIndex);
109
+ stateManager.updateState(`element:${component.id}.expandedIndexes`, newExpandedIndexes);
110
+ }
111
+ };
112
+ return (<react_native_1.View style={[styles.container, { opacity, gap }]}>
113
+ {items.map((item, index) => {
114
+ var _a, _b, _c, _d;
115
+ const isExpanded = expandedIndexes.includes(index);
116
+ const itemProps = item.properties;
117
+ const header = (_a = item.children) === null || _a === void 0 ? void 0 : _a.find((c) => { var _a; return ((_a = c.properties) === null || _a === void 0 ? void 0 : _a.role) === 'header' || c.type === 'accordion-header'; });
118
+ const contentChildren = ((_b = item.children) === null || _b === void 0 ? void 0 : _b.filter((c) => { var _a; return ((_a = c.properties) === null || _a === void 0 ? void 0 : _a.role) !== 'header' && c.type !== 'accordion-header'; })) || [];
119
+ return (<react_native_1.View key={item.id} style={styles.item}>
120
+ {/* Header */}
121
+ <react_native_1.TouchableOpacity onPress={() => toggleItem(index)} style={[
122
+ styles.header,
123
+ {
124
+ backgroundColor: (_c = itemProps === null || itemProps === void 0 ? void 0 : itemProps.headerBackground) !== null && _c !== void 0 ? _c : headerBackground,
125
+ padding: headerPadding,
126
+ }
127
+ ]} activeOpacity={0.7}>
128
+ <react_native_1.View style={styles.headerContent}>
129
+ {header ? (renderChild(header)) : (<react_native_1.Text style={styles.headerText}>
130
+ {(_d = itemProps === null || itemProps === void 0 ? void 0 : itemProps.title) !== null && _d !== void 0 ? _d : `Item ${index + 1}`}
131
+ </react_native_1.Text>)}
132
+ </react_native_1.View>
133
+ <react_native_1.Text style={[
134
+ styles.chevron,
135
+ isExpanded && styles.chevronExpanded
136
+ ]}>
137
+
138
+ </react_native_1.Text>
139
+ </react_native_1.TouchableOpacity>
140
+
141
+ {/* Content */}
142
+ {isExpanded && (<react_native_1.View style={[styles.content, { padding: contentPadding }]}>
143
+ {contentChildren.length > 0
144
+ ? contentChildren.map((child) => (<react_native_1.View key={child.id}>
145
+ {renderChild(child)}
146
+ </react_native_1.View>))
147
+ : (itemProps === null || itemProps === void 0 ? void 0 : itemProps.content) && <react_native_1.Text>{itemProps.content}</react_native_1.Text>}
148
+ </react_native_1.View>)}
149
+ </react_native_1.View>);
150
+ })}
151
+ </react_native_1.View>);
152
+ };
153
+ exports.AccordionComponent = AccordionComponent;
154
+ const styles = react_native_1.StyleSheet.create({
155
+ container: {
156
+ width: '100%',
157
+ },
158
+ item: {
159
+ backgroundColor: '#f5f5f5',
160
+ borderRadius: 8,
161
+ overflow: 'hidden',
162
+ },
163
+ header: {
164
+ flexDirection: 'row',
165
+ alignItems: 'center',
166
+ justifyContent: 'space-between',
167
+ },
168
+ headerContent: {
169
+ flex: 1,
170
+ },
171
+ headerText: {
172
+ fontSize: 16,
173
+ fontWeight: '600',
174
+ },
175
+ chevron: {
176
+ fontSize: 12,
177
+ color: '#666',
178
+ marginLeft: 8,
179
+ },
180
+ chevronExpanded: {
181
+ transform: [{ rotate: '180deg' }],
182
+ },
183
+ content: {
184
+ borderTopWidth: 1,
185
+ borderTopColor: '#e0e0e0',
186
+ },
187
+ });
@@ -0,0 +1,35 @@
1
+ /**
2
+ * AnimatedWrapper - React Native animation component
3
+ * Wraps children with animations based on preset configurations
4
+ */
5
+ import React from 'react';
6
+ import { Animated, ViewStyle } from 'react-native';
7
+ import { EasingType } from '../animations/presets';
8
+ interface AnimatedWrapperProps {
9
+ preset?: string;
10
+ trigger?: 'enter' | 'loop' | 'tap';
11
+ duration?: number;
12
+ delay?: number;
13
+ easing?: EasingType;
14
+ iterations?: number;
15
+ children: React.ReactNode;
16
+ style?: ViewStyle;
17
+ onAnimationComplete?: () => void;
18
+ }
19
+ export declare const AnimatedWrapper: React.FC<AnimatedWrapperProps>;
20
+ /**
21
+ * Hook to get animation style without wrapper component
22
+ */
23
+ export declare function usePaywallAnimation(preset?: string, customParams?: {
24
+ duration?: number;
25
+ delay?: number;
26
+ easing?: EasingType;
27
+ iterations?: number;
28
+ }): {
29
+ animatedValue: Animated.Value;
30
+ start: () => void;
31
+ stop: () => void;
32
+ reset: () => void;
33
+ presetConfig: import("../animations/presets").AnimationPresetConfig | undefined;
34
+ };
35
+ export default AnimatedWrapper;
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ /**
3
+ * AnimatedWrapper - React Native animation component
4
+ * Wraps children with animations based on preset configurations
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.AnimatedWrapper = void 0;
41
+ exports.usePaywallAnimation = usePaywallAnimation;
42
+ const react_1 = __importStar(require("react"));
43
+ const react_native_1 = require("react-native");
44
+ // Local copy of packages/core/src/animations/presets (see src/animations/presets.ts).
45
+ // Imported locally because ANIMATION_PRESETS is a runtime value and tsc rootDir
46
+ // cannot span files outside this package.
47
+ const presets_1 = require("../animations/presets");
48
+ /**
49
+ * Map easing type to React Native Easing function
50
+ */
51
+ function getEasingFunction(easing) {
52
+ switch (easing) {
53
+ case 'linear':
54
+ return react_native_1.Easing.linear;
55
+ case 'ease':
56
+ return react_native_1.Easing.ease;
57
+ case 'ease-in':
58
+ return react_native_1.Easing.in(react_native_1.Easing.ease);
59
+ case 'ease-out':
60
+ return react_native_1.Easing.out(react_native_1.Easing.ease);
61
+ case 'ease-in-out':
62
+ return react_native_1.Easing.inOut(react_native_1.Easing.ease);
63
+ case 'spring':
64
+ return react_native_1.Easing.elastic(1);
65
+ default:
66
+ return react_native_1.Easing.ease;
67
+ }
68
+ }
69
+ /**
70
+ * Calculate interpolated value at a specific progress point
71
+ */
72
+ function interpolateKeyframes(keyframes, property, progress) {
73
+ if (keyframes.length === 0)
74
+ return undefined;
75
+ // Find surrounding keyframes
76
+ let prevFrame = keyframes[0];
77
+ let nextFrame = keyframes[keyframes.length - 1];
78
+ for (let i = 0; i < keyframes.length - 1; i++) {
79
+ if (keyframes[i].offset <= progress && keyframes[i + 1].offset >= progress) {
80
+ prevFrame = keyframes[i];
81
+ nextFrame = keyframes[i + 1];
82
+ break;
83
+ }
84
+ }
85
+ const prevValue = prevFrame[property];
86
+ const nextValue = nextFrame[property];
87
+ if (prevValue === undefined || nextValue === undefined)
88
+ return undefined;
89
+ if (typeof prevValue !== 'number' || typeof nextValue !== 'number')
90
+ return undefined;
91
+ // Linear interpolation between keyframes
92
+ const range = nextFrame.offset - prevFrame.offset;
93
+ if (range === 0)
94
+ return prevValue;
95
+ const localProgress = (progress - prevFrame.offset) / range;
96
+ return prevValue + (nextValue - prevValue) * localProgress;
97
+ }
98
+ const AnimatedWrapper = ({ preset, trigger = 'enter', duration: customDuration, delay: customDelay, easing: customEasing, iterations: customIterations, children, style, onAnimationComplete, }) => {
99
+ const animatedValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
100
+ // Get preset configuration
101
+ const presetConfig = preset ? presets_1.ANIMATION_PRESETS[preset] : undefined;
102
+ // Merge custom parameters with preset defaults
103
+ const animationParams = (0, react_1.useMemo)(() => {
104
+ if (!presetConfig) {
105
+ return { duration: 300, delay: 0, easing: 'ease-out', iterations: 1 };
106
+ }
107
+ return {
108
+ duration: customDuration !== null && customDuration !== void 0 ? customDuration : presetConfig.defaultDuration,
109
+ delay: customDelay !== null && customDelay !== void 0 ? customDelay : presetConfig.defaultDelay,
110
+ easing: customEasing !== null && customEasing !== void 0 ? customEasing : presetConfig.defaultEasing,
111
+ iterations: customIterations !== null && customIterations !== void 0 ? customIterations : presetConfig.defaultIterations,
112
+ };
113
+ }, [presetConfig, customDuration, customDelay, customEasing, customIterations]);
114
+ // Run animation on mount or when trigger changes
115
+ (0, react_1.useEffect)(() => {
116
+ if (!presetConfig)
117
+ return;
118
+ const isLooping = animationParams.iterations === -1 || trigger === 'loop';
119
+ const runAnimation = () => {
120
+ animatedValue.setValue(0);
121
+ const animation = react_native_1.Animated.timing(animatedValue, {
122
+ toValue: 1,
123
+ duration: animationParams.duration,
124
+ delay: animationParams.delay,
125
+ easing: getEasingFunction(animationParams.easing),
126
+ useNativeDriver: true,
127
+ });
128
+ if (isLooping) {
129
+ react_native_1.Animated.loop(animation).start();
130
+ }
131
+ else {
132
+ animation.start(({ finished }) => {
133
+ if (finished && onAnimationComplete) {
134
+ onAnimationComplete();
135
+ }
136
+ });
137
+ }
138
+ };
139
+ runAnimation();
140
+ return () => {
141
+ animatedValue.stopAnimation();
142
+ };
143
+ }, [preset, trigger, animationParams]);
144
+ // Build animated style from keyframes
145
+ const animatedStyle = (0, react_1.useMemo)(() => {
146
+ if (!presetConfig)
147
+ return {};
148
+ const { keyframes } = presetConfig;
149
+ const transforms = [];
150
+ // Extract unique offsets for input range
151
+ const offsets = keyframes.map(kf => kf.offset);
152
+ // Opacity interpolation
153
+ const opacityValues = keyframes.map(kf => kf.opacity).filter(v => v !== undefined);
154
+ const hasOpacity = opacityValues.length > 0;
155
+ // Scale interpolation
156
+ const scaleValues = keyframes.map(kf => { var _a; return (_a = kf.scale) !== null && _a !== void 0 ? _a : 1; });
157
+ const hasScale = keyframes.some(kf => kf.scale !== undefined);
158
+ // TranslateX interpolation
159
+ const translateXValues = keyframes.map(kf => {
160
+ const val = kf.translateX;
161
+ if (typeof val === 'string' && val.includes('%')) {
162
+ // Convert percentage to pixels (approximate with 300px width)
163
+ return parseFloat(val) * 3;
164
+ }
165
+ return typeof val === 'number' ? val : 0;
166
+ });
167
+ const hasTranslateX = keyframes.some(kf => kf.translateX !== undefined);
168
+ // TranslateY interpolation
169
+ const translateYValues = keyframes.map(kf => {
170
+ const val = kf.translateY;
171
+ if (typeof val === 'string' && val.includes('%')) {
172
+ return parseFloat(val) * 5; // Approximate with 500px height
173
+ }
174
+ return typeof val === 'number' ? val : 0;
175
+ });
176
+ const hasTranslateY = keyframes.some(kf => kf.translateY !== undefined);
177
+ // Rotate interpolation
178
+ const rotateValues = keyframes.map(kf => { var _a; return (_a = kf.rotate) !== null && _a !== void 0 ? _a : 0; });
179
+ const hasRotate = keyframes.some(kf => kf.rotate !== undefined);
180
+ // Build style object
181
+ const animStyle = {};
182
+ if (hasOpacity) {
183
+ animStyle.opacity = animatedValue.interpolate({
184
+ inputRange: offsets,
185
+ outputRange: keyframes.map(kf => { var _a; return (_a = kf.opacity) !== null && _a !== void 0 ? _a : 1; }),
186
+ });
187
+ }
188
+ if (hasScale) {
189
+ transforms.push({
190
+ scale: animatedValue.interpolate({
191
+ inputRange: offsets,
192
+ outputRange: scaleValues,
193
+ }),
194
+ });
195
+ }
196
+ if (hasTranslateX) {
197
+ transforms.push({
198
+ translateX: animatedValue.interpolate({
199
+ inputRange: offsets,
200
+ outputRange: translateXValues,
201
+ }),
202
+ });
203
+ }
204
+ if (hasTranslateY) {
205
+ transforms.push({
206
+ translateY: animatedValue.interpolate({
207
+ inputRange: offsets,
208
+ outputRange: translateYValues,
209
+ }),
210
+ });
211
+ }
212
+ if (hasRotate) {
213
+ transforms.push({
214
+ rotate: animatedValue.interpolate({
215
+ inputRange: offsets,
216
+ outputRange: rotateValues.map(r => `${r}deg`),
217
+ }),
218
+ });
219
+ }
220
+ if (transforms.length > 0) {
221
+ animStyle.transform = transforms;
222
+ }
223
+ return animStyle;
224
+ }, [presetConfig, animatedValue]);
225
+ // If no preset, render children without animation
226
+ if (!presetConfig) {
227
+ return <react_native_1.Animated.View style={style}>{children}</react_native_1.Animated.View>;
228
+ }
229
+ return (<react_native_1.Animated.View style={[style, animatedStyle]}>
230
+ {children}
231
+ </react_native_1.Animated.View>);
232
+ };
233
+ exports.AnimatedWrapper = AnimatedWrapper;
234
+ /**
235
+ * Hook to get animation style without wrapper component
236
+ */
237
+ function usePaywallAnimation(preset, customParams) {
238
+ const animatedValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
239
+ const presetConfig = preset ? presets_1.ANIMATION_PRESETS[preset] : undefined;
240
+ const params = (0, react_1.useMemo)(() => {
241
+ var _a, _b, _c, _d;
242
+ if (!presetConfig)
243
+ return null;
244
+ return {
245
+ duration: (_a = customParams === null || customParams === void 0 ? void 0 : customParams.duration) !== null && _a !== void 0 ? _a : presetConfig.defaultDuration,
246
+ delay: (_b = customParams === null || customParams === void 0 ? void 0 : customParams.delay) !== null && _b !== void 0 ? _b : presetConfig.defaultDelay,
247
+ easing: (_c = customParams === null || customParams === void 0 ? void 0 : customParams.easing) !== null && _c !== void 0 ? _c : presetConfig.defaultEasing,
248
+ iterations: (_d = customParams === null || customParams === void 0 ? void 0 : customParams.iterations) !== null && _d !== void 0 ? _d : presetConfig.defaultIterations,
249
+ };
250
+ }, [presetConfig, customParams]);
251
+ const start = () => {
252
+ if (!params)
253
+ return;
254
+ animatedValue.setValue(0);
255
+ const animation = react_native_1.Animated.timing(animatedValue, {
256
+ toValue: 1,
257
+ duration: params.duration,
258
+ delay: params.delay,
259
+ easing: getEasingFunction(params.easing),
260
+ useNativeDriver: true,
261
+ });
262
+ if (params.iterations === -1) {
263
+ react_native_1.Animated.loop(animation).start();
264
+ }
265
+ else {
266
+ animation.start();
267
+ }
268
+ };
269
+ const stop = () => {
270
+ animatedValue.stopAnimation();
271
+ };
272
+ const reset = () => {
273
+ animatedValue.setValue(0);
274
+ };
275
+ return { animatedValue, start, stop, reset, presetConfig };
276
+ }
277
+ exports.default = exports.AnimatedWrapper;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Native React Native Carousel with swipe, pagination, and axis support
3
+ * Supports horizontal, vertical, and layered modes
4
+ */
5
+ import React from 'react';
6
+ import { ViewStyle } from 'react-native';
7
+ import { PaywallComponent, PaywallConfiguration } from '../types';
8
+ interface StateManager {
9
+ setState: (key: string, value: any) => void;
10
+ getState: (key: string) => any;
11
+ subscribe: (key: string, callback: (value: any) => void) => () => void;
12
+ }
13
+ interface CarouselComponentProps {
14
+ component: PaywallComponent;
15
+ configuration: PaywallConfiguration;
16
+ style?: ViewStyle;
17
+ onButtonPress?: (componentId: string, action: string) => void;
18
+ onPageChange?: (page: number) => void;
19
+ stateManager?: StateManager;
20
+ renderChild?: (child: PaywallComponent) => React.ReactNode;
21
+ }
22
+ export declare const CarouselComponent: React.FC<CarouselComponentProps>;
23
+ export {};