@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,421 @@
1
+ /**
2
+ * Shared Animation Preset Definitions
3
+ * Platform-agnostic animation configurations that can be executed on any SDK
4
+ */
5
+
6
+ export interface AnimationKeyframe {
7
+ offset: number; // 0 to 1
8
+ opacity?: number;
9
+ scale?: number;
10
+ scaleX?: number;
11
+ scaleY?: number;
12
+ translateX?: number | string;
13
+ translateY?: number | string;
14
+ rotate?: number; // degrees
15
+ skewX?: number;
16
+ skewY?: number;
17
+ }
18
+
19
+ export interface AnimationPresetConfig {
20
+ name: string;
21
+ category: 'enter' | 'exit' | 'loop' | 'attention' | 'interaction';
22
+ keyframes: AnimationKeyframe[];
23
+ defaultDuration: number; // milliseconds
24
+ defaultDelay: number;
25
+ defaultEasing: EasingType;
26
+ defaultIterations: number; // -1 for infinite
27
+ defaultDirection: AnimationDirection;
28
+ description: string;
29
+ }
30
+
31
+ export type EasingType =
32
+ | 'linear'
33
+ | 'ease'
34
+ | 'ease-in'
35
+ | 'ease-out'
36
+ | 'ease-in-out'
37
+ | 'spring';
38
+
39
+ export type AnimationDirection = 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
40
+
41
+ /**
42
+ * Animation Presets - Shared across all SDKs
43
+ */
44
+ export const ANIMATION_PRESETS: Record<string, AnimationPresetConfig> = {
45
+ // ============ ENTER ANIMATIONS ============
46
+ 'fade-in': {
47
+ name: 'Fade In',
48
+ category: 'enter',
49
+ keyframes: [
50
+ { offset: 0, opacity: 0 },
51
+ { offset: 1, opacity: 1 }
52
+ ],
53
+ defaultDuration: 300,
54
+ defaultDelay: 0,
55
+ defaultEasing: 'ease-out',
56
+ defaultIterations: 1,
57
+ defaultDirection: 'normal',
58
+ description: 'Fades element in from transparent'
59
+ },
60
+
61
+ 'fade-in-up': {
62
+ name: 'Fade In Up',
63
+ category: 'enter',
64
+ keyframes: [
65
+ { offset: 0, opacity: 0, translateY: 20 },
66
+ { offset: 1, opacity: 1, translateY: 0 }
67
+ ],
68
+ defaultDuration: 400,
69
+ defaultDelay: 0,
70
+ defaultEasing: 'ease-out',
71
+ defaultIterations: 1,
72
+ defaultDirection: 'normal',
73
+ description: 'Fades in while sliding up'
74
+ },
75
+
76
+ 'fade-in-down': {
77
+ name: 'Fade In Down',
78
+ category: 'enter',
79
+ keyframes: [
80
+ { offset: 0, opacity: 0, translateY: -20 },
81
+ { offset: 1, opacity: 1, translateY: 0 }
82
+ ],
83
+ defaultDuration: 400,
84
+ defaultDelay: 0,
85
+ defaultEasing: 'ease-out',
86
+ defaultIterations: 1,
87
+ defaultDirection: 'normal',
88
+ description: 'Fades in while sliding down'
89
+ },
90
+
91
+ 'slide-in-left': {
92
+ name: 'Slide In Left',
93
+ category: 'enter',
94
+ keyframes: [
95
+ { offset: 0, translateX: '-100%', opacity: 0 },
96
+ { offset: 1, translateX: 0, opacity: 1 }
97
+ ],
98
+ defaultDuration: 400,
99
+ defaultDelay: 0,
100
+ defaultEasing: 'ease-out',
101
+ defaultIterations: 1,
102
+ defaultDirection: 'normal',
103
+ description: 'Slides in from the left'
104
+ },
105
+
106
+ 'slide-in-right': {
107
+ name: 'Slide In Right',
108
+ category: 'enter',
109
+ keyframes: [
110
+ { offset: 0, translateX: '100%', opacity: 0 },
111
+ { offset: 1, translateX: 0, opacity: 1 }
112
+ ],
113
+ defaultDuration: 400,
114
+ defaultDelay: 0,
115
+ defaultEasing: 'ease-out',
116
+ defaultIterations: 1,
117
+ defaultDirection: 'normal',
118
+ description: 'Slides in from the right'
119
+ },
120
+
121
+ 'slide-in-up': {
122
+ name: 'Slide In Up',
123
+ category: 'enter',
124
+ keyframes: [
125
+ { offset: 0, translateY: '100%', opacity: 0 },
126
+ { offset: 1, translateY: 0, opacity: 1 }
127
+ ],
128
+ defaultDuration: 400,
129
+ defaultDelay: 0,
130
+ defaultEasing: 'ease-out',
131
+ defaultIterations: 1,
132
+ defaultDirection: 'normal',
133
+ description: 'Slides in from the bottom'
134
+ },
135
+
136
+ 'slide-in-down': {
137
+ name: 'Slide In Down',
138
+ category: 'enter',
139
+ keyframes: [
140
+ { offset: 0, translateY: '-100%', opacity: 0 },
141
+ { offset: 1, translateY: 0, opacity: 1 }
142
+ ],
143
+ defaultDuration: 400,
144
+ defaultDelay: 0,
145
+ defaultEasing: 'ease-out',
146
+ defaultIterations: 1,
147
+ defaultDirection: 'normal',
148
+ description: 'Slides in from the top'
149
+ },
150
+
151
+ 'scale-in': {
152
+ name: 'Scale In',
153
+ category: 'enter',
154
+ keyframes: [
155
+ { offset: 0, scale: 0.8, opacity: 0 },
156
+ { offset: 1, scale: 1, opacity: 1 }
157
+ ],
158
+ defaultDuration: 300,
159
+ defaultDelay: 0,
160
+ defaultEasing: 'ease-out',
161
+ defaultIterations: 1,
162
+ defaultDirection: 'normal',
163
+ description: 'Scales up while fading in'
164
+ },
165
+
166
+ 'bounce-in': {
167
+ name: 'Bounce In',
168
+ category: 'enter',
169
+ keyframes: [
170
+ { offset: 0, scale: 0.3, opacity: 0 },
171
+ { offset: 0.5, scale: 1.05 },
172
+ { offset: 0.7, scale: 0.9 },
173
+ { offset: 1, scale: 1, opacity: 1 }
174
+ ],
175
+ defaultDuration: 500,
176
+ defaultDelay: 0,
177
+ defaultEasing: 'ease-out',
178
+ defaultIterations: 1,
179
+ defaultDirection: 'normal',
180
+ description: 'Bounces in with elastic effect'
181
+ },
182
+
183
+ // ============ EXIT ANIMATIONS ============
184
+ 'fade-out': {
185
+ name: 'Fade Out',
186
+ category: 'exit',
187
+ keyframes: [
188
+ { offset: 0, opacity: 1 },
189
+ { offset: 1, opacity: 0 }
190
+ ],
191
+ defaultDuration: 300,
192
+ defaultDelay: 0,
193
+ defaultEasing: 'ease-in',
194
+ defaultIterations: 1,
195
+ defaultDirection: 'normal',
196
+ description: 'Fades element out to transparent'
197
+ },
198
+
199
+ 'scale-out': {
200
+ name: 'Scale Out',
201
+ category: 'exit',
202
+ keyframes: [
203
+ { offset: 0, scale: 1, opacity: 1 },
204
+ { offset: 1, scale: 0.8, opacity: 0 }
205
+ ],
206
+ defaultDuration: 300,
207
+ defaultDelay: 0,
208
+ defaultEasing: 'ease-in',
209
+ defaultIterations: 1,
210
+ defaultDirection: 'normal',
211
+ description: 'Scales down while fading out'
212
+ },
213
+
214
+ // ============ LOOP ANIMATIONS ============
215
+ 'pulse': {
216
+ name: 'Pulse',
217
+ category: 'loop',
218
+ keyframes: [
219
+ { offset: 0, scale: 1 },
220
+ { offset: 0.5, scale: 1.05 },
221
+ { offset: 1, scale: 1 }
222
+ ],
223
+ defaultDuration: 1000,
224
+ defaultDelay: 0,
225
+ defaultEasing: 'ease-in-out',
226
+ defaultIterations: -1, // infinite
227
+ defaultDirection: 'normal',
228
+ description: 'Gentle pulsing scale effect'
229
+ },
230
+
231
+ 'breathe': {
232
+ name: 'Breathe',
233
+ category: 'loop',
234
+ keyframes: [
235
+ { offset: 0, scale: 1, opacity: 1 },
236
+ { offset: 0.5, scale: 1.03, opacity: 0.9 },
237
+ { offset: 1, scale: 1, opacity: 1 }
238
+ ],
239
+ defaultDuration: 2000,
240
+ defaultDelay: 0,
241
+ defaultEasing: 'ease-in-out',
242
+ defaultIterations: -1,
243
+ defaultDirection: 'normal',
244
+ description: 'Subtle breathing effect'
245
+ },
246
+
247
+ 'float': {
248
+ name: 'Float',
249
+ category: 'loop',
250
+ keyframes: [
251
+ { offset: 0, translateY: 0 },
252
+ { offset: 0.5, translateY: -10 },
253
+ { offset: 1, translateY: 0 }
254
+ ],
255
+ defaultDuration: 2000,
256
+ defaultDelay: 0,
257
+ defaultEasing: 'ease-in-out',
258
+ defaultIterations: -1,
259
+ defaultDirection: 'normal',
260
+ description: 'Floating up and down effect'
261
+ },
262
+
263
+ 'wiggle': {
264
+ name: 'Wiggle',
265
+ category: 'loop',
266
+ keyframes: [
267
+ { offset: 0, rotate: 0 },
268
+ { offset: 0.25, rotate: -3 },
269
+ { offset: 0.5, rotate: 0 },
270
+ { offset: 0.75, rotate: 3 },
271
+ { offset: 1, rotate: 0 }
272
+ ],
273
+ defaultDuration: 500,
274
+ defaultDelay: 0,
275
+ defaultEasing: 'ease-in-out',
276
+ defaultIterations: -1,
277
+ defaultDirection: 'normal',
278
+ description: 'Gentle rotation wiggle'
279
+ },
280
+
281
+ 'spin': {
282
+ name: 'Spin',
283
+ category: 'loop',
284
+ keyframes: [
285
+ { offset: 0, rotate: 0 },
286
+ { offset: 1, rotate: 360 }
287
+ ],
288
+ defaultDuration: 1000,
289
+ defaultDelay: 0,
290
+ defaultEasing: 'linear',
291
+ defaultIterations: -1,
292
+ defaultDirection: 'normal',
293
+ description: 'Continuous rotation'
294
+ },
295
+
296
+ // ============ ATTENTION ANIMATIONS ============
297
+ 'bounce': {
298
+ name: 'Bounce',
299
+ category: 'attention',
300
+ keyframes: [
301
+ { offset: 0, translateY: 0 },
302
+ { offset: 0.2, translateY: 0 },
303
+ { offset: 0.4, translateY: -15 },
304
+ { offset: 0.5, translateY: 0 },
305
+ { offset: 0.6, translateY: -7 },
306
+ { offset: 0.8, translateY: 0 },
307
+ { offset: 1, translateY: 0 }
308
+ ],
309
+ defaultDuration: 800,
310
+ defaultDelay: 0,
311
+ defaultEasing: 'ease-out',
312
+ defaultIterations: 1,
313
+ defaultDirection: 'normal',
314
+ description: 'Bouncing attention getter'
315
+ },
316
+
317
+ 'shake': {
318
+ name: 'Shake',
319
+ category: 'attention',
320
+ keyframes: [
321
+ { offset: 0, translateX: 0 },
322
+ { offset: 0.1, translateX: -10 },
323
+ { offset: 0.2, translateX: 10 },
324
+ { offset: 0.3, translateX: -10 },
325
+ { offset: 0.4, translateX: 10 },
326
+ { offset: 0.5, translateX: -5 },
327
+ { offset: 0.6, translateX: 5 },
328
+ { offset: 0.7, translateX: -2 },
329
+ { offset: 0.8, translateX: 2 },
330
+ { offset: 1, translateX: 0 }
331
+ ],
332
+ defaultDuration: 600,
333
+ defaultDelay: 0,
334
+ defaultEasing: 'ease-out',
335
+ defaultIterations: 1,
336
+ defaultDirection: 'normal',
337
+ description: 'Horizontal shake effect'
338
+ },
339
+
340
+ 'flash': {
341
+ name: 'Flash',
342
+ category: 'attention',
343
+ keyframes: [
344
+ { offset: 0, opacity: 1 },
345
+ { offset: 0.25, opacity: 0 },
346
+ { offset: 0.5, opacity: 1 },
347
+ { offset: 0.75, opacity: 0 },
348
+ { offset: 1, opacity: 1 }
349
+ ],
350
+ defaultDuration: 800,
351
+ defaultDelay: 0,
352
+ defaultEasing: 'ease-in-out',
353
+ defaultIterations: 1,
354
+ defaultDirection: 'normal',
355
+ description: 'Flashing opacity effect'
356
+ },
357
+
358
+ // ============ INTERACTION ANIMATIONS ============
359
+ 'shrink': {
360
+ name: 'Shrink',
361
+ category: 'interaction',
362
+ keyframes: [
363
+ { offset: 0, scale: 1 },
364
+ { offset: 1, scale: 0.95 }
365
+ ],
366
+ defaultDuration: 100,
367
+ defaultDelay: 0,
368
+ defaultEasing: 'ease-out',
369
+ defaultIterations: 1,
370
+ defaultDirection: 'alternate',
371
+ description: 'Button press shrink effect'
372
+ },
373
+
374
+ 'grow': {
375
+ name: 'Grow',
376
+ category: 'interaction',
377
+ keyframes: [
378
+ { offset: 0, scale: 1 },
379
+ { offset: 1, scale: 1.05 }
380
+ ],
381
+ defaultDuration: 200,
382
+ defaultDelay: 0,
383
+ defaultEasing: 'ease-out',
384
+ defaultIterations: 1,
385
+ defaultDirection: 'alternate',
386
+ description: 'Hover grow effect'
387
+ },
388
+ };
389
+
390
+ /**
391
+ * Get preset by name
392
+ */
393
+ export function getAnimationPreset(name: string): AnimationPresetConfig | undefined {
394
+ return ANIMATION_PRESETS[name];
395
+ }
396
+
397
+ /**
398
+ * Get all presets by category
399
+ */
400
+ export function getPresetsByCategory(category: AnimationPresetConfig['category']): AnimationPresetConfig[] {
401
+ return Object.values(ANIMATION_PRESETS).filter(preset => preset.category === category);
402
+ }
403
+
404
+ /**
405
+ * List all available preset names
406
+ */
407
+ export function getAvailablePresetNames(): string[] {
408
+ return Object.keys(ANIMATION_PRESETS);
409
+ }
410
+
411
+ /**
412
+ * Easing cubic-bezier mappings for CSS/platform conversion
413
+ */
414
+ export const EASING_CURVES: Record<EasingType, [number, number, number, number]> = {
415
+ 'linear': [0, 0, 1, 1],
416
+ 'ease': [0.25, 0.1, 0.25, 1],
417
+ 'ease-in': [0.42, 0, 1, 1],
418
+ 'ease-out': [0, 0, 0.58, 1],
419
+ 'ease-in-out': [0.42, 0, 0.58, 1],
420
+ 'spring': [0.175, 0.885, 0.32, 1.275], // Approximation
421
+ };
@@ -0,0 +1,259 @@
1
+ /**
2
+ * AccoladeCpsComponent - Native React Native implementation
3
+ * Award badge with 6 variants: medal, trophy, ribbon, star, badge, certificate
4
+ */
5
+
6
+ import React, { useEffect, useRef } from 'react';
7
+ import {
8
+ View,
9
+ Text,
10
+ StyleSheet,
11
+ Animated,
12
+ Easing,
13
+ } from 'react-native';
14
+ import { PaywallComponent } from '../types';
15
+
16
+ interface AccoladeCpsComponentProps {
17
+ component: PaywallComponent;
18
+ stateManager?: any;
19
+ isPreviewMode?: boolean;
20
+ }
21
+
22
+ type AccoladeVariant = 'medal' | 'trophy' | 'ribbon' | 'star' | 'badge' | 'certificate';
23
+
24
+ // Icon mapping for variants
25
+ const VARIANT_ICONS: Record<AccoladeVariant, string> = {
26
+ medal: '🏅',
27
+ trophy: '🏆',
28
+ ribbon: '🎀',
29
+ star: '⭐',
30
+ badge: '🏷️',
31
+ certificate: '📜',
32
+ };
33
+
34
+ // Icon mapping for custom icon names
35
+ const ICON_MAP: Record<string, string> = {
36
+ star: '⭐',
37
+ trophy: '🏆',
38
+ medal: '🏅',
39
+ crown: '👑',
40
+ diamond: '💎',
41
+ heart: '❤️',
42
+ check: '✅',
43
+ };
44
+
45
+ const getColorFromValue = (value: any, fallback: string): string => {
46
+ if (!value) return fallback;
47
+ if (typeof value === 'string') return value;
48
+ if (typeof value === 'object' && value.color) return value.color;
49
+ return fallback;
50
+ };
51
+
52
+ export const AccoladeCpsComponent: React.FC<AccoladeCpsComponentProps> = ({
53
+ component,
54
+ stateManager,
55
+ isPreviewMode = false,
56
+ }) => {
57
+ const props = component.properties as any;
58
+
59
+ // Properties
60
+ const variant = (props.variant as AccoladeVariant) || 'medal';
61
+ const title = (props.title as string) || 'Award';
62
+ const subtitle = props.subtitle as string | undefined;
63
+ const iconName = props.iconName as string | undefined;
64
+ const primaryColor = getColorFromValue(props.primaryColor, '#FFD700');
65
+ const secondaryColor = getColorFromValue(props.secondaryColor, '#FFA500');
66
+ const textColor = getColorFromValue(props.textColor, '#1F2937');
67
+ const animated = props.animated !== false;
68
+ const size = (props.size as number) ?? 80;
69
+ const showGlow = props.showGlow !== false;
70
+ const glowColor = props.glowColor ? getColorFromValue(props.glowColor, primaryColor) : primaryColor;
71
+
72
+ // Animation values
73
+ const scaleAnim = useRef(new Animated.Value(0)).current;
74
+ const rotateAnim = useRef(new Animated.Value(-0.1)).current;
75
+
76
+ useEffect(() => {
77
+ if (animated) {
78
+ Animated.parallel([
79
+ Animated.spring(scaleAnim, {
80
+ toValue: 1,
81
+ friction: 4,
82
+ tension: 40,
83
+ useNativeDriver: true,
84
+ }),
85
+ Animated.timing(rotateAnim, {
86
+ toValue: 0,
87
+ duration: 500,
88
+ easing: Easing.out(Easing.quad),
89
+ useNativeDriver: true,
90
+ }),
91
+ ]).start();
92
+ } else {
93
+ scaleAnim.setValue(1);
94
+ rotateAnim.setValue(0);
95
+ }
96
+ }, [animated, scaleAnim, rotateAnim]);
97
+
98
+ // Get icon
99
+ const icon = iconName
100
+ ? (ICON_MAP[iconName.toLowerCase()] || VARIANT_ICONS[variant])
101
+ : VARIANT_ICONS[variant];
102
+
103
+ const isRibbon = variant === 'ribbon';
104
+
105
+ const rotate = rotateAnim.interpolate({
106
+ inputRange: [-0.1, 0],
107
+ outputRange: ['-10deg', '0deg'],
108
+ });
109
+
110
+ return (
111
+ <Animated.View
112
+ style={[
113
+ styles.container,
114
+ {
115
+ transform: [
116
+ { scale: scaleAnim },
117
+ { rotate },
118
+ ],
119
+ },
120
+ ]}
121
+ >
122
+ {/* Icon container */}
123
+ <View style={styles.iconContainer}>
124
+ {/* Glow effect */}
125
+ {showGlow && (
126
+ <View
127
+ style={[
128
+ styles.glow,
129
+ {
130
+ width: size + 20,
131
+ height: size + 20,
132
+ backgroundColor: glowColor,
133
+ borderRadius: isRibbon ? 8 : (size + 20) / 2,
134
+ },
135
+ ]}
136
+ />
137
+ )}
138
+
139
+ {/* Main badge */}
140
+ <View
141
+ style={[
142
+ styles.badge,
143
+ {
144
+ width: size,
145
+ height: size,
146
+ borderRadius: isRibbon ? 8 : size / 2,
147
+ backgroundColor: primaryColor,
148
+ },
149
+ ]}
150
+ >
151
+ {/* Gradient overlay simulation */}
152
+ <View
153
+ style={[
154
+ styles.gradientOverlay,
155
+ {
156
+ borderRadius: isRibbon ? 8 : size / 2,
157
+ },
158
+ ]}
159
+ />
160
+
161
+ {/* Icon */}
162
+ <Text style={[styles.icon, { fontSize: size * 0.45 }]}>
163
+ {icon}
164
+ </Text>
165
+ </View>
166
+
167
+ {/* Ribbon decoration for medal variant */}
168
+ {variant === 'medal' && (
169
+ <View style={[styles.ribbonContainer, { top: size * 0.7 }]}>
170
+ <View
171
+ style={[
172
+ styles.ribbonStrip,
173
+ styles.ribbonLeft,
174
+ { backgroundColor: secondaryColor },
175
+ ]}
176
+ />
177
+ <View style={{ width: size * 0.4 }} />
178
+ <View
179
+ style={[
180
+ styles.ribbonStrip,
181
+ styles.ribbonRight,
182
+ { backgroundColor: secondaryColor },
183
+ ]}
184
+ />
185
+ </View>
186
+ )}
187
+ </View>
188
+
189
+ {/* Title */}
190
+ <Text style={[styles.title, { color: textColor }]}>
191
+ {title}
192
+ </Text>
193
+
194
+ {/* Subtitle */}
195
+ {subtitle && (
196
+ <Text style={[styles.subtitle, { color: textColor }]}>
197
+ {subtitle}
198
+ </Text>
199
+ )}
200
+ </Animated.View>
201
+ );
202
+ };
203
+
204
+ const styles = StyleSheet.create({
205
+ container: {
206
+ alignItems: 'center',
207
+ },
208
+ iconContainer: {
209
+ alignItems: 'center',
210
+ justifyContent: 'center',
211
+ marginBottom: 12,
212
+ },
213
+ glow: {
214
+ position: 'absolute',
215
+ opacity: 0.4,
216
+ },
217
+ badge: {
218
+ alignItems: 'center',
219
+ justifyContent: 'center',
220
+ overflow: 'hidden',
221
+ },
222
+ gradientOverlay: {
223
+ ...StyleSheet.absoluteFillObject,
224
+ backgroundColor: 'rgba(255,255,255,0.15)',
225
+ },
226
+ icon: {
227
+ textAlign: 'center',
228
+ },
229
+ ribbonContainer: {
230
+ position: 'absolute',
231
+ flexDirection: 'row',
232
+ alignItems: 'flex-start',
233
+ },
234
+ ribbonStrip: {
235
+ width: 12,
236
+ height: 24,
237
+ borderBottomLeftRadius: 4,
238
+ borderBottomRightRadius: 4,
239
+ },
240
+ ribbonLeft: {
241
+ transform: [{ rotate: '15deg' }],
242
+ },
243
+ ribbonRight: {
244
+ transform: [{ rotate: '-15deg' }],
245
+ },
246
+ title: {
247
+ fontSize: 16,
248
+ fontWeight: 'bold',
249
+ textAlign: 'center',
250
+ },
251
+ subtitle: {
252
+ fontSize: 12,
253
+ opacity: 0.7,
254
+ textAlign: 'center',
255
+ marginTop: 4,
256
+ },
257
+ });
258
+
259
+ export default AccoladeCpsComponent;