@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,240 @@
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.DelayedXComponent = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ const DelayedXComponent = ({ component, configuration, renderChild, stateManager, isPreviewMode = false, onButtonPress, }) => {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
41
+ const props = component.properties;
42
+ // Properties with full parity
43
+ const delay = (_a = props.delay) !== null && _a !== void 0 ? _a : 3;
44
+ const showCountdown = (_b = props.showCountdown) !== null && _b !== void 0 ? _b : false;
45
+ const countdownStyle = (_c = props.countdownStyle) !== null && _c !== void 0 ? _c : 'circular';
46
+ const animationType = (_d = props.animationType) !== null && _d !== void 0 ? _d : 'scale';
47
+ const disabled = (_e = props.disabled) !== null && _e !== void 0 ? _e : false;
48
+ const position = (_f = props.position) !== null && _f !== void 0 ? _f : 'top-right';
49
+ const buttonSize = (_g = props.buttonSize) !== null && _g !== void 0 ? _g : 32;
50
+ const backgroundColor = (_h = props.backgroundColor) !== null && _h !== void 0 ? _h : 'rgba(0, 0, 0, 0.3)';
51
+ const iconColor = (_j = props.iconColor) !== null && _j !== void 0 ? _j : '#FFFFFF';
52
+ const iconSize = (_k = props.iconSize) !== null && _k !== void 0 ? _k : 14;
53
+ const [isVisible, setIsVisible] = (0, react_1.useState)(!isPreviewMode);
54
+ const [remainingTime, setRemainingTime] = (0, react_1.useState)(delay);
55
+ const [hasError, setHasError] = (0, react_1.useState)(false);
56
+ const fadeAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
57
+ const scaleAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0.8)).current;
58
+ const slideAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(-50)).current;
59
+ // Expose state to state manager
60
+ (0, react_1.useEffect)(() => {
61
+ var _a, _b;
62
+ if (stateManager) {
63
+ (_a = stateManager.setState) === null || _a === void 0 ? void 0 : _a.call(stateManager, `element:${component.id}.isVisible`, isVisible);
64
+ (_b = stateManager.setState) === null || _b === void 0 ? void 0 : _b.call(stateManager, `element:${component.id}.remainingTime`, remainingTime);
65
+ }
66
+ }, [isVisible, remainingTime, component.id, stateManager]);
67
+ (0, react_1.useEffect)(() => {
68
+ // If disabled, never show
69
+ if (disabled) {
70
+ setIsVisible(false);
71
+ return;
72
+ }
73
+ // In builder mode, always show content
74
+ if (!isPreviewMode) {
75
+ setIsVisible(true);
76
+ fadeAnim.setValue(1);
77
+ scaleAnim.setValue(1);
78
+ slideAnim.setValue(0);
79
+ return;
80
+ }
81
+ setIsVisible(false);
82
+ setRemainingTime(delay);
83
+ fadeAnim.setValue(0);
84
+ scaleAnim.setValue(0.8);
85
+ slideAnim.setValue(-50);
86
+ let countdownInterval;
87
+ let showTimeout;
88
+ try {
89
+ // Countdown timer
90
+ countdownInterval = setInterval(() => {
91
+ setRemainingTime((prev) => {
92
+ if (prev <= 1) {
93
+ clearInterval(countdownInterval);
94
+ return 0;
95
+ }
96
+ return prev - 1;
97
+ });
98
+ }, 1000);
99
+ // Show after delay with animation
100
+ showTimeout = setTimeout(() => {
101
+ setIsVisible(true);
102
+ runAppearAnimation();
103
+ }, delay * 1000);
104
+ }
105
+ catch (error) {
106
+ // Error handling: show immediately if timer fails
107
+ console.warn('DelayedXComponent timer error, showing immediately:', error);
108
+ setHasError(true);
109
+ setIsVisible(true);
110
+ fadeAnim.setValue(1);
111
+ scaleAnim.setValue(1);
112
+ slideAnim.setValue(0);
113
+ }
114
+ return () => {
115
+ clearInterval(countdownInterval);
116
+ clearTimeout(showTimeout);
117
+ };
118
+ }, [delay, isPreviewMode, disabled]);
119
+ const runAppearAnimation = () => {
120
+ const animations = [];
121
+ if (animationType === 'fade' || animationType === 'scale') {
122
+ animations.push(react_native_1.Animated.timing(fadeAnim, {
123
+ toValue: 1,
124
+ duration: 200,
125
+ useNativeDriver: true,
126
+ }));
127
+ }
128
+ if (animationType === 'scale') {
129
+ animations.push(react_native_1.Animated.spring(scaleAnim, {
130
+ toValue: 1,
131
+ useNativeDriver: true,
132
+ tension: 50,
133
+ friction: 8,
134
+ }));
135
+ }
136
+ if (animationType === 'slide') {
137
+ animations.push(react_native_1.Animated.timing(slideAnim, {
138
+ toValue: 0,
139
+ duration: 200,
140
+ useNativeDriver: true,
141
+ }));
142
+ animations.push(react_native_1.Animated.timing(fadeAnim, {
143
+ toValue: 1,
144
+ duration: 200,
145
+ useNativeDriver: true,
146
+ }));
147
+ }
148
+ if (animationType === 'none') {
149
+ fadeAnim.setValue(1);
150
+ scaleAnim.setValue(1);
151
+ slideAnim.setValue(0);
152
+ }
153
+ else {
154
+ react_native_1.Animated.parallel(animations).start();
155
+ }
156
+ };
157
+ const getAnimatedStyle = () => {
158
+ switch (animationType) {
159
+ case 'fade':
160
+ return { opacity: fadeAnim };
161
+ case 'scale':
162
+ return {
163
+ opacity: fadeAnim,
164
+ transform: [{ scale: scaleAnim }],
165
+ };
166
+ case 'slide':
167
+ return {
168
+ opacity: fadeAnim,
169
+ transform: [{ translateY: slideAnim }],
170
+ };
171
+ case 'none':
172
+ default:
173
+ return {};
174
+ }
175
+ };
176
+ const getPositionStyle = () => {
177
+ const base = { position: 'absolute' };
178
+ switch (position) {
179
+ case 'top-left':
180
+ return { ...base, top: 16, left: 16 };
181
+ case 'top-right':
182
+ return { ...base, top: 16, right: 16 };
183
+ case 'bottom-left':
184
+ return { ...base, bottom: 16, left: 16 };
185
+ case 'bottom-right':
186
+ return { ...base, bottom: 16, right: 16 };
187
+ default:
188
+ return { ...base, top: 16, right: 16 };
189
+ }
190
+ };
191
+ const handlePress = () => {
192
+ onButtonPress === null || onButtonPress === void 0 ? void 0 : onButtonPress(component.id, 'close');
193
+ };
194
+ // If disabled, render nothing
195
+ if (disabled) {
196
+ return null;
197
+ }
198
+ // In builder mode, always render children
199
+ if (!isPreviewMode) {
200
+ return (<react_native_1.View style={styles.container}>
201
+ {(_l = component.children) === null || _l === void 0 ? void 0 : _l.map((child) => renderChild ? renderChild(child) : null)}
202
+ </react_native_1.View>);
203
+ }
204
+ if (isVisible) {
205
+ return (<react_native_1.Animated.View style={[styles.container, getAnimatedStyle()]}>
206
+ {(_m = component.children) === null || _m === void 0 ? void 0 : _m.map((child) => renderChild ? renderChild(child) : null)}
207
+ </react_native_1.Animated.View>);
208
+ }
209
+ // Render countdown based on style
210
+ if (showCountdown && countdownStyle !== 'none') {
211
+ if (countdownStyle === 'circular') {
212
+ return (<react_native_1.View style={[styles.countdownContainer, { width: buttonSize, height: buttonSize, borderRadius: buttonSize / 2, backgroundColor }]}>
213
+ <react_native_1.Text style={[styles.countdownText, { color: iconColor, fontSize: iconSize }]}>{remainingTime}</react_native_1.Text>
214
+ </react_native_1.View>);
215
+ }
216
+ if (countdownStyle === 'text') {
217
+ return (<react_native_1.Text style={[styles.countdownTextOnly, { color: iconColor, fontSize: iconSize }]}>
218
+ {remainingTime}s
219
+ </react_native_1.Text>);
220
+ }
221
+ }
222
+ return null;
223
+ };
224
+ exports.DelayedXComponent = DelayedXComponent;
225
+ const styles = react_native_1.StyleSheet.create({
226
+ container: {
227
+ // Container inherits layout from parent
228
+ },
229
+ countdownContainer: {
230
+ alignItems: 'center',
231
+ justifyContent: 'center',
232
+ },
233
+ countdownText: {
234
+ fontWeight: '600',
235
+ },
236
+ countdownTextOnly: {
237
+ fontWeight: '600',
238
+ opacity: 0.6,
239
+ },
240
+ });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * DrawerModalComponent - React Native
3
+ *
4
+ * Slide-in drawer/modal with overlay, animation, and gesture support.
5
+ * Features:
6
+ * - State integration for open/close control
7
+ * - Overlay tap to dismiss
8
+ * - Pan gesture to dismiss
9
+ * - Smooth animations
10
+ */
11
+ import React from 'react';
12
+ import { PaywallComponent } from '../types';
13
+ interface DrawerModalComponentProps {
14
+ component: PaywallComponent;
15
+ stateManager?: any;
16
+ isPreviewMode?: boolean;
17
+ renderComponent?: (component: PaywallComponent) => React.ReactNode;
18
+ }
19
+ export declare const DrawerModalComponent: React.FC<DrawerModalComponentProps>;
20
+ export {};
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ /**
3
+ * DrawerModalComponent - React Native
4
+ *
5
+ * Slide-in drawer/modal with overlay, animation, and gesture support.
6
+ * Features:
7
+ * - State integration for open/close control
8
+ * - Overlay tap to dismiss
9
+ * - Pan gesture to dismiss
10
+ * - Smooth animations
11
+ */
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
25
+ }) : function(o, v) {
26
+ o["default"] = v;
27
+ });
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.DrawerModalComponent = void 0;
47
+ const react_1 = __importStar(require("react"));
48
+ const react_native_1 = require("react-native");
49
+ const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = react_native_1.Dimensions.get('window');
50
+ const DrawerModalComponent = ({ component, stateManager, isPreviewMode = false, renderComponent, }) => {
51
+ var _a, _b, _c, _d, _e, _f, _g, _h;
52
+ const props = component.properties;
53
+ const componentId = component.id;
54
+ // Configuration
55
+ const direction = props.direction || 'bottom';
56
+ const showOverlay = props.showOverlay !== false;
57
+ const overlayColor = props.overlayColor || '#000000';
58
+ const overlayOpacity = ((_a = props.overlayOpacity) !== null && _a !== void 0 ? _a : 50) / 100;
59
+ const closeOnOverlayClick = props.closeOnOverlayClick !== false;
60
+ const dismissType = props.dismissType || 'interactive';
61
+ // Animation settings
62
+ const animationDuration = props.animationDuration || 300;
63
+ // Sizing
64
+ const drawerWidthValue = ((_b = props.drawerWidth) === null || _b === void 0 ? void 0 : _b.value) || 85;
65
+ const drawerWidthUnit = ((_c = props.drawerWidth) === null || _c === void 0 ? void 0 : _c.unit) || '%';
66
+ const drawerHeightValue = ((_d = props.drawerHeight) === null || _d === void 0 ? void 0 : _d.value) || 400;
67
+ const drawerHeightUnit = ((_e = props.drawerHeight) === null || _e === void 0 ? void 0 : _e.unit) || 'px';
68
+ // Calculate actual dimensions
69
+ const drawerWidth = drawerWidthUnit === '%'
70
+ ? (SCREEN_WIDTH * drawerWidthValue / 100)
71
+ : drawerWidthValue;
72
+ const drawerHeight = drawerHeightUnit === '%'
73
+ ? (SCREEN_HEIGHT * drawerHeightValue / 100)
74
+ : drawerHeightValue;
75
+ // Corner radius
76
+ const cornerRadius = ((_f = props.cornerRadius) === null || _f === void 0 ? void 0 : _f.value) || 16;
77
+ // Background
78
+ const backgroundColor = ((_g = props.backgroundColor) === null || _g === void 0 ? void 0 : _g.color) || '#FFFFFF';
79
+ // State
80
+ const [isOpen, setIsOpen] = (0, react_1.useState)(props.isOpen !== false);
81
+ const animatedValue = (0, react_1.useRef)(new react_native_1.Animated.Value(isOpen ? 1 : 0)).current;
82
+ const panValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
83
+ // Get translation values based on direction
84
+ const getTranslation = (0, react_1.useCallback)(() => {
85
+ const isHorizontal = direction === 'left' || direction === 'right';
86
+ const size = isHorizontal ? drawerWidth : drawerHeight;
87
+ const multiplier = direction === 'right' || direction === 'bottom' ? 1 : -1;
88
+ return {
89
+ isHorizontal,
90
+ size,
91
+ multiplier,
92
+ closedValue: size * multiplier,
93
+ };
94
+ }, [direction, drawerWidth, drawerHeight]);
95
+ // Subscribe to state manager
96
+ (0, react_1.useEffect)(() => {
97
+ if (stateManager) {
98
+ // Initialize state
99
+ stateManager.updateState(`element:${componentId}.isOpen`, isOpen);
100
+ return stateManager.subscribeToState(`element:${componentId}.isOpen`, (value) => {
101
+ if (value !== isOpen) {
102
+ setIsOpen(value);
103
+ }
104
+ });
105
+ }
106
+ }, [componentId, stateManager]);
107
+ // Animate when isOpen changes
108
+ (0, react_1.useEffect)(() => {
109
+ react_native_1.Animated.timing(animatedValue, {
110
+ toValue: isOpen ? 1 : 0,
111
+ duration: animationDuration,
112
+ useNativeDriver: true,
113
+ }).start();
114
+ if (stateManager) {
115
+ stateManager.updateState(`element:${componentId}.isOpen`, isOpen);
116
+ stateManager.updateState(`element:${componentId}.direction`, direction);
117
+ }
118
+ }, [isOpen, animationDuration, animatedValue, componentId, stateManager, direction]);
119
+ // Handle close
120
+ const handleClose = (0, react_1.useCallback)(() => {
121
+ setIsOpen(false);
122
+ if (stateManager) {
123
+ stateManager.updateState(`element:${componentId}.isOpen`, false);
124
+ }
125
+ }, [componentId, stateManager]);
126
+ // Pan responder for interactive dismiss
127
+ const panResponder = (0, react_1.useRef)(react_native_1.PanResponder.create({
128
+ onStartShouldSetPanResponder: () => dismissType === 'interactive',
129
+ onMoveShouldSetPanResponder: (_, gestureState) => {
130
+ if (dismissType !== 'interactive')
131
+ return false;
132
+ const { dx, dy } = gestureState;
133
+ const { isHorizontal, multiplier } = getTranslation();
134
+ // Only respond if dragging in the correct direction
135
+ if (isHorizontal) {
136
+ return Math.abs(dx) > Math.abs(dy) && dx * multiplier > 0;
137
+ }
138
+ else {
139
+ return Math.abs(dy) > Math.abs(dx) && dy * multiplier > 0;
140
+ }
141
+ },
142
+ onPanResponderMove: (_, gestureState) => {
143
+ const { isHorizontal, multiplier } = getTranslation();
144
+ const delta = isHorizontal ? gestureState.dx : gestureState.dy;
145
+ // Only allow dragging in dismiss direction
146
+ if (delta * multiplier > 0) {
147
+ panValue.setValue(delta);
148
+ }
149
+ },
150
+ onPanResponderRelease: (_, gestureState) => {
151
+ const { isHorizontal, size, multiplier } = getTranslation();
152
+ const delta = isHorizontal ? gestureState.dx : gestureState.dy;
153
+ const velocity = isHorizontal ? gestureState.vx : gestureState.vy;
154
+ // Dismiss if dragged more than 30% or with sufficient velocity
155
+ if ((Math.abs(delta) > size * 0.3) || (Math.abs(velocity) > 0.5 && delta * multiplier > 0)) {
156
+ // Animate out then close
157
+ react_native_1.Animated.timing(panValue, {
158
+ toValue: size * multiplier,
159
+ duration: 200,
160
+ useNativeDriver: true,
161
+ }).start(() => {
162
+ panValue.setValue(0);
163
+ handleClose();
164
+ });
165
+ }
166
+ else {
167
+ // Snap back
168
+ react_native_1.Animated.spring(panValue, {
169
+ toValue: 0,
170
+ useNativeDriver: true,
171
+ }).start();
172
+ }
173
+ },
174
+ })).current;
175
+ // Calculate animated styles
176
+ const { isHorizontal, closedValue } = getTranslation();
177
+ const overlayAnimatedStyle = {
178
+ opacity: animatedValue.interpolate({
179
+ inputRange: [0, 1],
180
+ outputRange: [0, overlayOpacity],
181
+ }),
182
+ };
183
+ const drawerBaseTranslate = animatedValue.interpolate({
184
+ inputRange: [0, 1],
185
+ outputRange: [closedValue, 0],
186
+ });
187
+ const drawerTransform = isHorizontal
188
+ ? { translateX: react_native_1.Animated.add(drawerBaseTranslate, panValue) }
189
+ : { translateY: react_native_1.Animated.add(drawerBaseTranslate, panValue) };
190
+ // Position styles based on direction
191
+ const getPositionStyle = () => {
192
+ switch (direction) {
193
+ case 'left':
194
+ return { left: 0, top: 0, bottom: 0, width: drawerWidth };
195
+ case 'right':
196
+ return { right: 0, top: 0, bottom: 0, width: drawerWidth };
197
+ case 'top':
198
+ return { top: 0, left: 0, right: 0, height: drawerHeight };
199
+ case 'bottom':
200
+ default:
201
+ return { bottom: 0, left: 0, right: 0, height: drawerHeight };
202
+ }
203
+ };
204
+ // Border radius based on direction
205
+ const getBorderRadius = () => {
206
+ switch (direction) {
207
+ case 'left':
208
+ return { borderTopRightRadius: cornerRadius, borderBottomRightRadius: cornerRadius };
209
+ case 'right':
210
+ return { borderTopLeftRadius: cornerRadius, borderBottomLeftRadius: cornerRadius };
211
+ case 'top':
212
+ return { borderBottomLeftRadius: cornerRadius, borderBottomRightRadius: cornerRadius };
213
+ case 'bottom':
214
+ default:
215
+ return { borderTopLeftRadius: cornerRadius, borderTopRightRadius: cornerRadius };
216
+ }
217
+ };
218
+ // Don't render if not open and animation complete
219
+ if (!isOpen && animatedValue._value === 0) {
220
+ return null;
221
+ }
222
+ return (<react_native_1.Modal visible={isOpen} transparent animationType="none" onRequestClose={handleClose}>
223
+ <react_native_1.View style={styles.container}>
224
+ {/* Overlay */}
225
+ {showOverlay && (<react_native_1.TouchableWithoutFeedback onPress={closeOnOverlayClick ? handleClose : undefined}>
226
+ <react_native_1.Animated.View style={[
227
+ styles.overlay,
228
+ { backgroundColor: overlayColor },
229
+ overlayAnimatedStyle,
230
+ ]}/>
231
+ </react_native_1.TouchableWithoutFeedback>)}
232
+
233
+ {/* Drawer */}
234
+ <react_native_1.Animated.View style={[
235
+ styles.drawer,
236
+ getPositionStyle(),
237
+ getBorderRadius(),
238
+ { backgroundColor },
239
+ { transform: [drawerTransform] },
240
+ ]} {...panResponder.panHandlers}>
241
+ {/* Drag handle for bottom/top drawers */}
242
+ {dismissType === 'interactive' && (direction === 'bottom' || direction === 'top') && (<react_native_1.View style={styles.dragHandleContainer}>
243
+ <react_native_1.View style={styles.dragHandle}/>
244
+ </react_native_1.View>)}
245
+
246
+ {/* Children */}
247
+ <react_native_1.View style={styles.content}>
248
+ {(_h = component.children) === null || _h === void 0 ? void 0 : _h.map((child, index) => (<react_native_1.View key={child.id || index}>
249
+ {renderComponent === null || renderComponent === void 0 ? void 0 : renderComponent(child)}
250
+ </react_native_1.View>))}
251
+ </react_native_1.View>
252
+ </react_native_1.Animated.View>
253
+ </react_native_1.View>
254
+ </react_native_1.Modal>);
255
+ };
256
+ exports.DrawerModalComponent = DrawerModalComponent;
257
+ const styles = react_native_1.StyleSheet.create({
258
+ container: {
259
+ flex: 1,
260
+ },
261
+ overlay: {
262
+ ...react_native_1.StyleSheet.absoluteFillObject,
263
+ },
264
+ drawer: {
265
+ position: 'absolute',
266
+ shadowColor: '#000',
267
+ shadowOffset: { width: 0, height: -4 },
268
+ shadowOpacity: 0.25,
269
+ shadowRadius: 12,
270
+ elevation: 16,
271
+ },
272
+ dragHandleContainer: {
273
+ alignItems: 'center',
274
+ paddingVertical: 8,
275
+ },
276
+ dragHandle: {
277
+ width: 36,
278
+ height: 4,
279
+ backgroundColor: '#D1D5DB',
280
+ borderRadius: 2,
281
+ },
282
+ content: {
283
+ flex: 1,
284
+ padding: 16,
285
+ },
286
+ });
@@ -0,0 +1,38 @@
1
+ /**
2
+ * GradientView Component
3
+ * Wraps content with a gradient background using LinearGradient
4
+ * Falls back to solid color if LinearGradient is not available
5
+ */
6
+ import React from 'react';
7
+ import { ViewStyle, StyleProp } from 'react-native';
8
+ import { GradientConfig } from '../utils/CSSConverter';
9
+ export interface GradientViewProps {
10
+ gradient: GradientConfig;
11
+ fallbackColor?: string;
12
+ style?: StyleProp<ViewStyle>;
13
+ children?: React.ReactNode;
14
+ /** Border radius to apply to gradient */
15
+ borderRadius?: number;
16
+ /** Border width */
17
+ borderWidth?: number;
18
+ /** Border color */
19
+ borderColor?: string;
20
+ }
21
+ /**
22
+ * GradientView renders a gradient background
23
+ * Uses LinearGradient if available, falls back to first stop color otherwise
24
+ */
25
+ export declare const GradientView: React.FC<GradientViewProps>;
26
+ /**
27
+ * Check if LinearGradient is available
28
+ */
29
+ export declare function isGradientSupported(): boolean;
30
+ /**
31
+ * Get gradient background style or fallback color
32
+ * Use this when you need to decide between GradientView or regular View
33
+ */
34
+ export declare function getGradientStyleOrFallback(gradient: GradientConfig | undefined, fallbackColor?: string): {
35
+ useGradient: boolean;
36
+ backgroundColor: string;
37
+ gradient?: GradientConfig;
38
+ };