@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,172 @@
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.ConfettiComponent = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ // Color presets for confetti
40
+ const COLOR_PRESETS = {
41
+ celebration: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8'],
42
+ rainbow: ['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#0000FF', '#4B0082', '#9400D3'],
43
+ metallic: ['#FFD700', '#C0C0C0', '#DAA520', '#B8860B', '#E8E8E8'],
44
+ pastel: ['#FFB3BA', '#BAFFC9', '#BAE1FF', '#FFFFBA', '#FFDFBA'],
45
+ brand: ['#6366F1', '#8B5CF6', '#A855F7', '#D946EF'],
46
+ };
47
+ const ConfettiComponent = ({ component, stateManager, isPreviewMode = false, }) => {
48
+ var _a, _b, _c, _d, _e, _f, _g;
49
+ const props = component.properties;
50
+ const pieceCount = (_a = props.pieceCount) !== null && _a !== void 0 ? _a : 150;
51
+ const trigger = (_b = props.trigger) !== null && _b !== void 0 ? _b : 'onLoad';
52
+ const duration = (_c = props.duration) !== null && _c !== void 0 ? _c : 3000;
53
+ const recycle = (_d = props.recycle) !== null && _d !== void 0 ? _d : false;
54
+ const shape = (_e = props.shape) !== null && _e !== void 0 ? _e : 'mix';
55
+ const gravity = (_f = props.gravity) !== null && _f !== void 0 ? _f : 1;
56
+ const colorPreset = (_g = props.colorPreset) !== null && _g !== void 0 ? _g : 'celebration';
57
+ const customColors = props.customColors;
58
+ const [pieces, setPieces] = (0, react_1.useState)([]);
59
+ const recycleTimerRef = (0, react_1.useRef)(null);
60
+ const { width, height } = react_native_1.Dimensions.get('window');
61
+ // Get colors based on preset or custom
62
+ const getColors = (0, react_1.useCallback)(() => {
63
+ if (colorPreset === 'custom' && customColors) {
64
+ return customColors.split(',').map((c) => c.trim()).filter((c) => c.startsWith('#'));
65
+ }
66
+ return COLOR_PRESETS[colorPreset] || COLOR_PRESETS.celebration;
67
+ }, [colorPreset, customColors]);
68
+ const createPieces = (0, react_1.useCallback)(() => {
69
+ const colors = getColors();
70
+ return Array.from({ length: pieceCount }, (_, i) => ({
71
+ id: i,
72
+ x: new react_native_1.Animated.Value(Math.random() * width),
73
+ y: new react_native_1.Animated.Value(-50 - Math.random() * 100),
74
+ rotation: new react_native_1.Animated.Value(0),
75
+ color: colors[Math.floor(Math.random() * colors.length)],
76
+ size: 8 + Math.random() * 8,
77
+ shape: shape === 'mix'
78
+ ? (Math.random() > 0.5 ? 'square' : 'circle')
79
+ : shape,
80
+ }));
81
+ }, [pieceCount, width, shape, getColors]);
82
+ const fireConfetti = (0, react_1.useCallback)(() => {
83
+ const newPieces = createPieces();
84
+ setPieces(newPieces);
85
+ newPieces.forEach((piece) => {
86
+ const fallDuration = (duration / gravity) * (0.8 + Math.random() * 0.4);
87
+ const drift = (Math.random() - 0.5) * 200;
88
+ react_native_1.Animated.parallel([
89
+ react_native_1.Animated.timing(piece.y, {
90
+ toValue: height + 50,
91
+ duration: fallDuration,
92
+ useNativeDriver: true,
93
+ }),
94
+ react_native_1.Animated.timing(piece.x, {
95
+ toValue: piece.x._value + drift,
96
+ duration: fallDuration,
97
+ useNativeDriver: true,
98
+ }),
99
+ react_native_1.Animated.timing(piece.rotation, {
100
+ toValue: 360 * (2 + Math.random() * 3),
101
+ duration: fallDuration,
102
+ useNativeDriver: true,
103
+ }),
104
+ ]).start();
105
+ });
106
+ if (recycle) {
107
+ recycleTimerRef.current = setTimeout(fireConfetti, duration);
108
+ }
109
+ }, [createPieces, duration, gravity, height, recycle]);
110
+ // Subscribe to manual trigger state changes
111
+ (0, react_1.useEffect)(() => {
112
+ if (!stateManager || trigger !== 'manual')
113
+ return;
114
+ const stateKey = `element:${component.id}.fire`;
115
+ const unsubscribe = stateManager.subscribe(stateKey, (value) => {
116
+ if (value === true) {
117
+ fireConfetti();
118
+ // Reset the state after firing
119
+ setTimeout(() => {
120
+ stateManager.setState(stateKey, false);
121
+ }, 50);
122
+ }
123
+ });
124
+ return () => {
125
+ unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
126
+ };
127
+ }, [stateManager, trigger, component.id, fireConfetti]);
128
+ (0, react_1.useEffect)(() => {
129
+ if (trigger === 'onLoad') {
130
+ const timer = setTimeout(fireConfetti, 100);
131
+ return () => clearTimeout(timer);
132
+ }
133
+ }, [trigger, fireConfetti]);
134
+ (0, react_1.useEffect)(() => {
135
+ return () => {
136
+ if (recycleTimerRef.current) {
137
+ clearTimeout(recycleTimerRef.current);
138
+ }
139
+ };
140
+ }, []);
141
+ return (<react_native_1.View style={styles.container} pointerEvents="none">
142
+ {pieces.map((piece) => (<react_native_1.Animated.View key={piece.id} style={[
143
+ styles.piece,
144
+ {
145
+ width: piece.size,
146
+ height: piece.size,
147
+ backgroundColor: piece.color,
148
+ borderRadius: piece.shape === 'circle' ? piece.size / 2 : 0,
149
+ transform: [
150
+ { translateX: piece.x },
151
+ { translateY: piece.y },
152
+ {
153
+ rotate: piece.rotation.interpolate({
154
+ inputRange: [0, 360],
155
+ outputRange: ['0deg', '360deg'],
156
+ }),
157
+ },
158
+ ],
159
+ },
160
+ ]}/>))}
161
+ </react_native_1.View>);
162
+ };
163
+ exports.ConfettiComponent = ConfettiComponent;
164
+ const styles = react_native_1.StyleSheet.create({
165
+ container: {
166
+ ...react_native_1.StyleSheet.absoluteFillObject,
167
+ overflow: 'hidden',
168
+ },
169
+ piece: {
170
+ position: 'absolute',
171
+ },
172
+ });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Countdown Component - Native React Native implementation
3
+ * Supports variant (boxed/text/digital/flip), styling, and state manager integration
4
+ */
5
+ import React from 'react';
6
+ import { ViewStyle } from 'react-native';
7
+ import { PaywallComponent, PaywallConfiguration } from '../types';
8
+ interface CountdownComponentProps {
9
+ component: PaywallComponent;
10
+ configuration: PaywallConfiguration;
11
+ style?: ViewStyle;
12
+ onComplete?: () => void;
13
+ onStateChange?: (key: string, value: any) => void;
14
+ }
15
+ export declare const CountdownComponent: React.FC<CountdownComponentProps>;
16
+ export default CountdownComponent;
@@ -0,0 +1,414 @@
1
+ "use strict";
2
+ /**
3
+ * Countdown Component - Native React Native implementation
4
+ * Supports variant (boxed/text/digital/flip), styling, and state manager integration
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.CountdownComponent = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const react_native_1 = require("react-native");
43
+ const CountdownComponent = ({ component, configuration, style, onComplete, onStateChange, }) => {
44
+ const properties = component.properties || {};
45
+ // MARK: - Parse Properties
46
+ const endTimeStr = properties.endTime || '';
47
+ const durationSeconds = properties.duration || 0;
48
+ const format = properties.format || 'digital';
49
+ // Determine variant from explicit value or map from format
50
+ const variant = (0, react_1.useMemo)(() => {
51
+ if (properties.variant)
52
+ return properties.variant;
53
+ switch (format) {
54
+ case 'digital':
55
+ case 'digital_full':
56
+ case 'compact':
57
+ return 'boxed';
58
+ case 'short':
59
+ case 'long':
60
+ return 'text';
61
+ default:
62
+ return 'boxed';
63
+ }
64
+ }, [properties.variant, format]);
65
+ const showDays = properties.showDays !== false;
66
+ const showHours = properties.showHours !== false;
67
+ const showMinutes = properties.showMinutes !== false;
68
+ const showSeconds = properties.showSeconds !== false;
69
+ const showLabels = properties.showLabels === true;
70
+ const separator = properties.separator || ':';
71
+ const labelStyle = properties.labelStyle || 'short';
72
+ // MARK: - Styling Properties
73
+ const fontSize = properties.fontSize || 32;
74
+ const textColor = properties.textColor || undefined; // Fixed: use textColor not color
75
+ const backgroundColor = properties.backgroundColor || '#F3F4F6';
76
+ const separatorColor = properties.separatorColor || textColor;
77
+ const hasExplicitSeparatorColor = !!properties.separatorColor;
78
+ const unitColor = properties.unitColor || '#9CA3AF';
79
+ const fontWeight = properties.fontWeight || 'bold';
80
+ const fontFamily = properties.fontFamily || 'monospace';
81
+ const padding = properties.padding || 12;
82
+ const gap = properties.gap || 8;
83
+ const borderRadius = properties.borderRadius || 8;
84
+ const expiredText = properties.expiredText || '00:00:00';
85
+ // MARK: - Calculate Target Time
86
+ const targetTime = (0, react_1.useMemo)(() => {
87
+ const trimmedEndTime = endTimeStr.trim();
88
+ if (trimmedEndTime) {
89
+ // Handle relative time (+7d, +1h, +30m, +60s)
90
+ if (trimmedEndTime.startsWith('+')) {
91
+ const valueStr = trimmedEndTime.slice(1, -1);
92
+ const unit = trimmedEndTime.slice(-1);
93
+ const value = parseInt(valueStr, 10) || 0;
94
+ let multiplier = 1000; // default seconds
95
+ switch (unit) {
96
+ case 'd':
97
+ multiplier = 86400000;
98
+ break;
99
+ case 'h':
100
+ multiplier = 3600000;
101
+ break;
102
+ case 'm':
103
+ multiplier = 60000;
104
+ break;
105
+ case 's':
106
+ multiplier = 1000;
107
+ break;
108
+ }
109
+ return Date.now() + (value * multiplier);
110
+ }
111
+ // Handle ISO date string
112
+ const parsed = Date.parse(trimmedEndTime);
113
+ if (!isNaN(parsed)) {
114
+ return parsed;
115
+ }
116
+ }
117
+ // Use duration if specified
118
+ if (durationSeconds > 0) {
119
+ return Date.now() + (durationSeconds * 1000);
120
+ }
121
+ // Default 1 hour
122
+ return Date.now() + 3600000;
123
+ }, [endTimeStr, durationSeconds]);
124
+ // State for remaining time
125
+ const [timeRemaining, setTimeRemaining] = (0, react_1.useState)(() => calculateTimeRemaining(targetTime));
126
+ // Calculate time remaining
127
+ function calculateTimeRemaining(target) {
128
+ const now = Date.now();
129
+ const diff = Math.max(0, target - now);
130
+ const totalSeconds = Math.floor(diff / 1000);
131
+ return {
132
+ days: Math.floor(totalSeconds / 86400),
133
+ hours: Math.floor((totalSeconds % 86400) / 3600),
134
+ minutes: Math.floor((totalSeconds % 3600) / 60),
135
+ seconds: totalSeconds % 60,
136
+ totalSeconds,
137
+ isExpired: diff <= 0,
138
+ };
139
+ }
140
+ // Timer effect
141
+ (0, react_1.useEffect)(() => {
142
+ const interval = setInterval(() => {
143
+ const remaining = calculateTimeRemaining(targetTime);
144
+ setTimeRemaining(remaining);
145
+ // Publish state changes
146
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(`element:${component.id}.remainingSeconds`, remaining.totalSeconds);
147
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(`element:${component.id}.isExpired`, remaining.isExpired);
148
+ if (remaining.isExpired) {
149
+ clearInterval(interval);
150
+ onComplete === null || onComplete === void 0 ? void 0 : onComplete();
151
+ }
152
+ }, 1000);
153
+ // Publish initial state
154
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(`element:${component.id}.remainingSeconds`, timeRemaining.totalSeconds);
155
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(`element:${component.id}.isExpired`, timeRemaining.isExpired);
156
+ return () => clearInterval(interval);
157
+ }, [targetTime, onComplete, onStateChange, component.id]);
158
+ // MARK: - Label Formatting
159
+ const getLabelForUnit = (0, react_1.useCallback)((unit) => {
160
+ switch (labelStyle) {
161
+ case 'full':
162
+ switch (unit) {
163
+ case 'days': return 'Days';
164
+ case 'hours': return 'Hours';
165
+ case 'minutes': return 'Minutes';
166
+ case 'seconds': return 'Seconds';
167
+ default: return unit;
168
+ }
169
+ case 'none':
170
+ return '';
171
+ default: // 'short'
172
+ switch (unit) {
173
+ case 'days': return 'D';
174
+ case 'hours': return 'H';
175
+ case 'minutes': return 'M';
176
+ case 'seconds': return 'S';
177
+ default: return unit.charAt(0).toUpperCase();
178
+ }
179
+ }
180
+ }, [labelStyle]);
181
+ // Format the display string for digital variant
182
+ const formattedTime = (0, react_1.useMemo)(() => {
183
+ const { days, hours, minutes, seconds, totalSeconds, isExpired } = timeRemaining;
184
+ if (isExpired)
185
+ return expiredText;
186
+ const pad = (n) => n.toString().padStart(2, '0');
187
+ switch (format) {
188
+ case 'digital_full':
189
+ return `${pad(days)}${separator}${pad(hours)}${separator}${pad(minutes)}${separator}${pad(seconds)}`;
190
+ case 'digital':
191
+ if (days > 0) {
192
+ return `${pad(days)}${separator}${pad(hours)}${separator}${pad(minutes)}${separator}${pad(seconds)}`;
193
+ }
194
+ return `${pad(hours)}${separator}${pad(minutes)}${separator}${pad(seconds)}`;
195
+ case 'short': {
196
+ const parts = [];
197
+ if (showDays && days > 0)
198
+ parts.push(`${days}d`);
199
+ if (showHours)
200
+ parts.push(`${hours}h`);
201
+ if (showMinutes)
202
+ parts.push(`${minutes}m`);
203
+ if (showSeconds)
204
+ parts.push(`${seconds}s`);
205
+ return parts.join(' ');
206
+ }
207
+ case 'long': {
208
+ const parts = [];
209
+ if (showDays && days > 0)
210
+ parts.push(`${days} days`);
211
+ if (showHours)
212
+ parts.push(`${hours} hours`);
213
+ if (showMinutes)
214
+ parts.push(`${minutes} minutes`);
215
+ if (showSeconds)
216
+ parts.push(`${seconds} seconds`);
217
+ return parts.join(', ');
218
+ }
219
+ case 'compact':
220
+ return `${days}:${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
221
+ case 'days_only':
222
+ return `${days}`;
223
+ case 'hours_only':
224
+ return `${days * 24 + hours}`;
225
+ case 'minutes_only':
226
+ return `${(days * 24 + hours) * 60 + minutes}`;
227
+ case 'seconds_only':
228
+ return `${totalSeconds}`;
229
+ default:
230
+ return `${pad(hours)}${separator}${pad(minutes)}${separator}${pad(seconds)}`;
231
+ }
232
+ }, [timeRemaining, format, separator, showDays, showHours, showMinutes, showSeconds, expiredText]);
233
+ // MARK: - Font Weight Helper
234
+ const getFontWeight = (0, react_1.useCallback)(() => {
235
+ switch (fontWeight) {
236
+ case '100':
237
+ case 'thin': return '100';
238
+ case '200':
239
+ case 'extraLight': return '200';
240
+ case '300':
241
+ case 'light': return '300';
242
+ case '400':
243
+ case 'normal':
244
+ case 'regular': return '400';
245
+ case '500':
246
+ case 'medium': return '500';
247
+ case '600':
248
+ case 'semibold': return '600';
249
+ case '700':
250
+ case 'bold': return '700';
251
+ case '800':
252
+ case 'extraBold': return '800';
253
+ case '900':
254
+ case 'black': return '900';
255
+ default: return 'bold';
256
+ }
257
+ }, [fontWeight]);
258
+ // MARK: - Render Helpers
259
+ const renderTimeUnitBox = (value, label) => (<react_native_1.View style={styles.unitContainer}>
260
+ <react_native_1.View style={[
261
+ styles.unitBox,
262
+ {
263
+ backgroundColor,
264
+ borderRadius,
265
+ paddingHorizontal: padding,
266
+ paddingVertical: padding * 0.67,
267
+ }
268
+ ]}>
269
+ <react_native_1.Text style={[
270
+ styles.unitValue,
271
+ {
272
+ fontSize,
273
+ fontWeight: getFontWeight(),
274
+ fontFamily,
275
+ ...(textColor && { color: textColor }),
276
+ }
277
+ ]}>
278
+ {value.toString().padStart(2, '0')}
279
+ </react_native_1.Text>
280
+ </react_native_1.View>
281
+ {showLabels && label && (<react_native_1.Text style={[styles.unitLabel, { color: unitColor, fontSize: fontSize * 0.3 }]}>
282
+ {label}
283
+ </react_native_1.Text>)}
284
+ </react_native_1.View>);
285
+ const renderSeparator = () => (<react_native_1.Text style={[
286
+ styles.separator,
287
+ {
288
+ fontSize,
289
+ fontWeight: getFontWeight(),
290
+ fontFamily,
291
+ color: separatorColor || textColor,
292
+ ...(!hasExplicitSeparatorColor && { opacity: 0.6 }),
293
+ }
294
+ ]}>
295
+ {separator}
296
+ </react_native_1.Text>);
297
+ const renderTimeUnitText = (value, label) => (<react_native_1.View style={styles.textUnit}>
298
+ <react_native_1.Text style={[
299
+ styles.textValue,
300
+ {
301
+ fontSize,
302
+ fontWeight: getFontWeight(),
303
+ fontFamily,
304
+ ...(textColor && { color: textColor }),
305
+ }
306
+ ]}>
307
+ {value}
308
+ </react_native_1.Text>
309
+ <react_native_1.Text style={[styles.textLabel, { color: unitColor, fontSize: fontSize * 0.5 }]}>
310
+ {' '}{label}
311
+ </react_native_1.Text>
312
+ </react_native_1.View>);
313
+ // MARK: - Variant Renderers
314
+ const renderBoxedVariant = () => {
315
+ const { days, hours, minutes, seconds } = timeRemaining;
316
+ return (<react_native_1.View style={[styles.boxedContainer, { gap }, style]}>
317
+ {showDays && days > 0 && (<>
318
+ {renderTimeUnitBox(days, getLabelForUnit('days'))}
319
+ {renderSeparator()}
320
+ </>)}
321
+ {showHours && (<>
322
+ {renderTimeUnitBox(hours, getLabelForUnit('hours'))}
323
+ {renderSeparator()}
324
+ </>)}
325
+ {showMinutes && (<>
326
+ {renderTimeUnitBox(minutes, getLabelForUnit('minutes'))}
327
+ {showSeconds && renderSeparator()}
328
+ </>)}
329
+ {showSeconds && renderTimeUnitBox(seconds, getLabelForUnit('seconds'))}
330
+ </react_native_1.View>);
331
+ };
332
+ const renderTextVariant = () => {
333
+ const { days, hours, minutes, seconds } = timeRemaining;
334
+ return (<react_native_1.View style={[styles.textContainer, { gap: gap * 2 }, style]}>
335
+ {showDays && days > 0 && renderTimeUnitText(days, getLabelForUnit('days'))}
336
+ {showHours && renderTimeUnitText(hours, getLabelForUnit('hours'))}
337
+ {showMinutes && renderTimeUnitText(minutes, getLabelForUnit('minutes'))}
338
+ {showSeconds && renderTimeUnitText(seconds, getLabelForUnit('seconds'))}
339
+ </react_native_1.View>);
340
+ };
341
+ const renderDigitalVariant = () => (<react_native_1.View style={[styles.container, style]}>
342
+ <react_native_1.Text style={[
343
+ styles.digitalText,
344
+ {
345
+ fontSize,
346
+ fontWeight: getFontWeight(),
347
+ fontFamily,
348
+ ...(textColor && { color: textColor }),
349
+ }
350
+ ]}>
351
+ {formattedTime}
352
+ </react_native_1.Text>
353
+ </react_native_1.View>);
354
+ // MARK: - Main Render
355
+ switch (variant) {
356
+ case 'boxed':
357
+ return renderBoxedVariant();
358
+ case 'text':
359
+ return renderTextVariant();
360
+ case 'flip':
361
+ // Flip uses boxed layout (full flip animation would need more work)
362
+ return renderBoxedVariant();
363
+ default:
364
+ return renderDigitalVariant();
365
+ }
366
+ };
367
+ exports.CountdownComponent = CountdownComponent;
368
+ const styles = react_native_1.StyleSheet.create({
369
+ container: {
370
+ alignItems: 'center',
371
+ justifyContent: 'center',
372
+ },
373
+ boxedContainer: {
374
+ flexDirection: 'row',
375
+ alignItems: 'center',
376
+ justifyContent: 'center',
377
+ },
378
+ textContainer: {
379
+ flexDirection: 'row',
380
+ alignItems: 'center',
381
+ justifyContent: 'center',
382
+ },
383
+ unitContainer: {
384
+ alignItems: 'center',
385
+ },
386
+ unitBox: {
387
+ alignItems: 'center',
388
+ justifyContent: 'center',
389
+ },
390
+ unitValue: {
391
+ textAlign: 'center',
392
+ },
393
+ unitLabel: {
394
+ marginTop: 4,
395
+ textAlign: 'center',
396
+ },
397
+ separator: {
398
+ marginHorizontal: 2,
399
+ },
400
+ textUnit: {
401
+ flexDirection: 'row',
402
+ alignItems: 'flex-end',
403
+ },
404
+ textValue: {
405
+ textAlign: 'center',
406
+ },
407
+ textLabel: {
408
+ marginBottom: 2,
409
+ },
410
+ digitalText: {
411
+ textAlign: 'center',
412
+ },
413
+ });
414
+ exports.default = exports.CountdownComponent;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { PaywallComponent, PaywallConfiguration } from '../types';
3
+ interface DelayedXComponentProps {
4
+ component: PaywallComponent;
5
+ configuration?: PaywallConfiguration;
6
+ renderChild?: (child: PaywallComponent) => JSX.Element;
7
+ stateManager?: any;
8
+ isPreviewMode?: boolean;
9
+ onButtonPress?: (componentId: string, action: string) => void;
10
+ }
11
+ export declare const DelayedXComponent: React.FC<DelayedXComponentProps>;
12
+ export {};