@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,274 @@
1
+ "use strict";
2
+ /**
3
+ * ShareCodeComponent - React Native
4
+ *
5
+ * Hybrid component with child-based architecture.
6
+ * Uses component.properties for styling; children arrive fully styled with selectedAppearance.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.ShareCodeComponent = void 0;
43
+ const react_1 = __importStar(require("react"));
44
+ const react_native_1 = require("react-native");
45
+ // Helper to extract color from fill value
46
+ const getColorFromFill = (fill, fallback) => {
47
+ if (!fill)
48
+ return fallback;
49
+ if (typeof fill === 'string')
50
+ return fill;
51
+ if (fill.type === 'color' && fill.color)
52
+ return fill.color;
53
+ if (fill.resolvedColor)
54
+ return fill.resolvedColor;
55
+ return fallback;
56
+ };
57
+ const ShareCodeComponent = ({ component, stateManager, isPreviewMode = false, renderChild, }) => {
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
59
+ const props = component.properties;
60
+ // Children arrive fully styled with selectedAppearance for state changes
61
+ const children = component.children || [];
62
+ const componentId = component.id;
63
+ // Properties from schema
64
+ const code = (_a = props.code) !== null && _a !== void 0 ? _a : 'SAVE20';
65
+ const codeLabel = (_b = props.codeLabel) !== null && _b !== void 0 ? _b : '';
66
+ const codeDescription = (_c = props.codeDescription) !== null && _c !== void 0 ? _c : '';
67
+ const showCopyButton = props.showCopyButton !== false;
68
+ const showShareButton = (_d = props.showShareButton) !== null && _d !== void 0 ? _d : false;
69
+ const showQRCode = (_e = props.showQRCode) !== null && _e !== void 0 ? _e : false;
70
+ const layout = (_f = props.layout) !== null && _f !== void 0 ? _f : 'vertical';
71
+ const copyButtonText = (_g = props.copyButtonText) !== null && _g !== void 0 ? _g : 'Copy Code';
72
+ const copiedFeedback = (_h = props.copiedFeedback) !== null && _h !== void 0 ? _h : 'Copied!';
73
+ const shareButtonText = (_j = props.shareButtonText) !== null && _j !== void 0 ? _j : 'Share';
74
+ const shareMessage = ((_k = props.shareMessage) !== null && _k !== void 0 ? _k : 'Use my code: {{code}} to get a discount!').replace('{{code}}', code);
75
+ const shareUrl = (_l = props.shareUrl) !== null && _l !== void 0 ? _l : '';
76
+ // Styling from component appearance (children arrive fully styled)
77
+ const componentAppearance = component.appearance || {};
78
+ const codeContainerFill = getColorFromFill(componentAppearance.fill, '#F3F4F6');
79
+ const buttonFill = '#3B82F6'; // Default, buttons have their own styling
80
+ const codeTextColor = (_m = props.codeTextColor) !== null && _m !== void 0 ? _m : '#1F2937';
81
+ const labelColor = (_o = props.labelColor) !== null && _o !== void 0 ? _o : '#6B7280';
82
+ const descriptionColor = (_p = props.descriptionColor) !== null && _p !== void 0 ? _p : '#6B7280';
83
+ const buttonTextColor = '#FFFFFF';
84
+ const codeFontSize = (_q = props.codeFontSize) !== null && _q !== void 0 ? _q : 24;
85
+ const containerBorderRadius = (_r = componentAppearance.cornerRadius) !== null && _r !== void 0 ? _r : 12;
86
+ const containerPadding = (_s = props.containerPadding) !== null && _s !== void 0 ? _s : 16;
87
+ const [copied, setCopied] = (0, react_1.useState)(false);
88
+ const [copyAnim] = (0, react_1.useState)(new react_native_1.Animated.Value(1));
89
+ // Connect to state manager
90
+ (0, react_1.useEffect)(() => {
91
+ if (stateManager) {
92
+ stateManager.updateState(`element:${componentId}.code`, code);
93
+ stateManager.updateState(`element:${componentId}.copied`, copied);
94
+ }
95
+ }, [code, copied, componentId, stateManager]);
96
+ // Copy to clipboard
97
+ const handleCopy = (0, react_1.useCallback)(async () => {
98
+ try {
99
+ react_native_1.Clipboard.setString(code);
100
+ setCopied(true);
101
+ react_native_1.Animated.sequence([
102
+ react_native_1.Animated.timing(copyAnim, {
103
+ toValue: 0.9,
104
+ duration: 100,
105
+ useNativeDriver: true,
106
+ }),
107
+ react_native_1.Animated.timing(copyAnim, {
108
+ toValue: 1,
109
+ duration: 100,
110
+ useNativeDriver: true,
111
+ }),
112
+ ]).start();
113
+ if (stateManager) {
114
+ stateManager.updateState(`element:${componentId}.copied`, true);
115
+ }
116
+ setTimeout(() => {
117
+ setCopied(false);
118
+ if (stateManager) {
119
+ stateManager.updateState(`element:${componentId}.copied`, false);
120
+ }
121
+ }, 2000);
122
+ }
123
+ catch (err) {
124
+ console.error('Failed to copy:', err);
125
+ }
126
+ }, [code, copyAnim, componentId, stateManager]);
127
+ // Share functionality
128
+ const handleShare = (0, react_1.useCallback)(async () => {
129
+ try {
130
+ await react_native_1.Share.share({
131
+ message: shareUrl ? `${shareMessage} ${shareUrl}` : shareMessage,
132
+ title: codeLabel || 'Share Code',
133
+ });
134
+ if (stateManager) {
135
+ stateManager.updateState(`element:${componentId}.shared`, true);
136
+ }
137
+ }
138
+ catch (err) {
139
+ console.error('Share failed:', err);
140
+ }
141
+ }, [shareMessage, shareUrl, codeLabel, componentId, stateManager]);
142
+ const isHorizontal = layout === 'horizontal';
143
+ // Helper to get visible children
144
+ const visibleChildren = children.filter((child) => child.visible !== false);
145
+ // Hybrid mode: render children from Layers panel
146
+ if (visibleChildren.length > 0 && renderChild) {
147
+ return (<react_native_1.View style={[
148
+ styles.container,
149
+ { flexDirection: isHorizontal ? 'row' : 'column' },
150
+ ]}>
151
+ {visibleChildren.map((child, index) => (<react_1.default.Fragment key={child.id}>
152
+ {renderChild(child, index)}
153
+ </react_1.default.Fragment>))}
154
+ </react_native_1.View>);
155
+ }
156
+ // Legacy mode: self-contained rendering
157
+ return (<react_native_1.View style={[
158
+ styles.container,
159
+ { flexDirection: isHorizontal ? 'row' : 'column' },
160
+ ]}>
161
+ <react_native_1.View style={[
162
+ styles.mainContent,
163
+ { alignItems: isHorizontal ? 'flex-start' : 'center' },
164
+ ]}>
165
+ {/* Label */}
166
+ {codeLabel ? (<react_native_1.Text style={[styles.label, { fontSize: 14, color: labelColor }]}>
167
+ {codeLabel}
168
+ </react_native_1.Text>) : null}
169
+
170
+ {/* Code Display */}
171
+ <react_native_1.View style={[
172
+ styles.codeContainer,
173
+ {
174
+ backgroundColor: codeContainerFill,
175
+ borderRadius: containerBorderRadius,
176
+ paddingHorizontal: containerPadding,
177
+ paddingVertical: containerPadding * 0.75,
178
+ },
179
+ ]}>
180
+ <react_native_1.Text style={[
181
+ styles.codeText,
182
+ {
183
+ fontSize: codeFontSize,
184
+ fontWeight: '700',
185
+ color: codeTextColor,
186
+ },
187
+ ]}>
188
+ {code}
189
+ </react_native_1.Text>
190
+
191
+ {showCopyButton && (<react_native_1.TouchableOpacity onPress={handleCopy} activeOpacity={0.7}>
192
+ <react_native_1.Animated.View style={[
193
+ styles.copyButton,
194
+ {
195
+ backgroundColor: buttonFill,
196
+ borderRadius: 8,
197
+ transform: [{ scale: copyAnim }],
198
+ },
199
+ ]}>
200
+ <react_native_1.Text style={[styles.buttonText, { color: copied ? '#22C55E' : buttonTextColor }]}>
201
+ {copied ? copiedFeedback : copyButtonText}
202
+ </react_native_1.Text>
203
+ </react_native_1.Animated.View>
204
+ </react_native_1.TouchableOpacity>)}
205
+ </react_native_1.View>
206
+
207
+ {/* Description */}
208
+ {codeDescription ? (<react_native_1.Text style={[
209
+ styles.description,
210
+ {
211
+ fontSize: 12,
212
+ color: descriptionColor,
213
+ textAlign: isHorizontal ? 'left' : 'center',
214
+ },
215
+ ]}>
216
+ {codeDescription}
217
+ </react_native_1.Text>) : null}
218
+
219
+ {/* Share Button */}
220
+ {showShareButton && (<react_native_1.TouchableOpacity onPress={handleShare} style={[
221
+ styles.shareButton,
222
+ {
223
+ backgroundColor: buttonFill,
224
+ borderRadius: 8,
225
+ width: isHorizontal ? 'auto' : '100%',
226
+ },
227
+ ]} activeOpacity={0.7}>
228
+ <react_native_1.Text style={[styles.buttonText, { color: buttonTextColor }]}>
229
+ 📤 {shareButtonText}
230
+ </react_native_1.Text>
231
+ </react_native_1.TouchableOpacity>)}
232
+ </react_native_1.View>
233
+ </react_native_1.View>);
234
+ };
235
+ exports.ShareCodeComponent = ShareCodeComponent;
236
+ const styles = react_native_1.StyleSheet.create({
237
+ container: {
238
+ width: '100%',
239
+ gap: 12,
240
+ },
241
+ mainContent: {
242
+ flex: 1,
243
+ gap: 12,
244
+ },
245
+ label: {},
246
+ codeContainer: {
247
+ flexDirection: 'row',
248
+ alignItems: 'center',
249
+ justifyContent: 'center',
250
+ gap: 12,
251
+ width: '100%',
252
+ },
253
+ codeText: {
254
+ fontFamily: 'monospace',
255
+ letterSpacing: 2,
256
+ },
257
+ copyButton: {
258
+ paddingHorizontal: 12,
259
+ paddingVertical: 8,
260
+ },
261
+ buttonText: {
262
+ fontSize: 14,
263
+ fontWeight: '500',
264
+ },
265
+ description: {},
266
+ shareButton: {
267
+ flexDirection: 'row',
268
+ alignItems: 'center',
269
+ justifyContent: 'center',
270
+ gap: 6,
271
+ paddingVertical: 12,
272
+ paddingHorizontal: 16,
273
+ },
274
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Single Choice Grid Component for React Native
3
+ * Radio button style grid selection (single selection)
4
+ */
5
+ import React from 'react';
6
+ import { PaywallComponent } from '../types';
7
+ interface SingleChoiceGridProps {
8
+ component: PaywallComponent;
9
+ stateManager?: any;
10
+ isPreviewMode?: boolean;
11
+ }
12
+ export declare const SingleChoiceGridComponent: React.FC<SingleChoiceGridProps>;
13
+ export {};
@@ -0,0 +1,210 @@
1
+ "use strict";
2
+ /**
3
+ * Single Choice Grid Component for React Native
4
+ * Radio button style grid selection (single selection)
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.SingleChoiceGridComponent = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const react_native_1 = require("react-native");
43
+ const SIZE_MAP = { sm: 16, md: 20, lg: 24 };
44
+ const SingleChoiceGridComponent = ({ component, stateManager, isPreviewMode = false, }) => {
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
46
+ const props = component.properties || {};
47
+ // Parse options
48
+ const optionsStr = props.options || 'Option 1,Option 2,Option 3,Option 4';
49
+ const options = optionsStr.split(',').map((o) => o.trim()).filter(Boolean);
50
+ const descriptionsStr = props.optionDescriptions || '';
51
+ const descriptions = descriptionsStr.split(',').map((d) => d.trim());
52
+ // Grid settings
53
+ const columns = props.columns || 2;
54
+ const gap = parseFloat(((_a = props.gap) === null || _a === void 0 ? void 0 : _a.value) || props.gap) || 12;
55
+ const minItemHeight = parseFloat(((_b = props.minItemHeight) === null || _b === void 0 ? void 0 : _b.value) || props.minItemHeight) || 80;
56
+ // Selection settings
57
+ const defaultIndex = (_c = props.defaultSelectedIndex) !== null && _c !== void 0 ? _c : 0;
58
+ const allowDeselect = (_d = props.allowDeselect) !== null && _d !== void 0 ? _d : false;
59
+ const disabled = (_e = props.disabled) !== null && _e !== void 0 ? _e : false;
60
+ // State
61
+ const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(defaultIndex);
62
+ // State manager integration
63
+ (0, react_1.useEffect)(() => {
64
+ var _a, _b;
65
+ if (!stateManager)
66
+ return;
67
+ const stateId = `element:${component.id}.selectedIndex`;
68
+ (_a = stateManager.registerState) === null || _a === void 0 ? void 0 : _a.call(stateManager, stateId, selectedIndex);
69
+ return (_b = stateManager.subscribeToState) === null || _b === void 0 ? void 0 : _b.call(stateManager, stateId, (value) => {
70
+ if (value !== selectedIndex)
71
+ setSelectedIndex(value);
72
+ });
73
+ }, [component.id, selectedIndex, stateManager]);
74
+ const handleSelect = (index) => {
75
+ var _a, _b;
76
+ if (disabled)
77
+ return;
78
+ const newIndex = (allowDeselect && selectedIndex === index) ? -1 : index;
79
+ setSelectedIndex(newIndex);
80
+ (_a = stateManager === null || stateManager === void 0 ? void 0 : stateManager.updateState) === null || _a === void 0 ? void 0 : _a.call(stateManager, `element:${component.id}.selectedIndex`, newIndex);
81
+ (_b = stateManager === null || stateManager === void 0 ? void 0 : stateManager.updateState) === null || _b === void 0 ? void 0 : _b.call(stateManager, `element:${component.id}.selectedValue`, newIndex >= 0 ? options[newIndex] : '');
82
+ };
83
+ // Styling
84
+ const showIndicator = (_f = props.showIndicator) !== null && _f !== void 0 ? _f : true;
85
+ const indicatorPosition = props.indicatorPosition || 'top-right';
86
+ const indicatorSize = SIZE_MAP[props.indicatorSize] || SIZE_MAP.md;
87
+ const indicatorColor = props.indicatorColor || '#007AFF';
88
+ const indicatorBorderColor = props.indicatorBorderColor || '#d1d5db';
89
+ const cardBorderRadius = parseFloat(((_g = props.cardBorderRadius) === null || _g === void 0 ? void 0 : _g.value) || props.cardBorderRadius) || 12;
90
+ const cardBorderColor = props.cardBorderColor || '#e5e7eb';
91
+ const selectedBorderColor = props.selectedBorderColor || '#007AFF';
92
+ const labelFontSize = parseFloat(((_h = props.labelFontSize) === null || _h === void 0 ? void 0 : _h.value) || props.labelFontSize) || 16;
93
+ const labelFontWeight = String(props.labelFontWeight || '500');
94
+ const labelColor = props.labelColor || '#1f2937';
95
+ const selectedLabelColor = props.selectedLabelColor || '#007AFF';
96
+ const descriptionFontSize = parseFloat(((_j = props.descriptionFontSize) === null || _j === void 0 ? void 0 : _j.value) || props.descriptionFontSize) || 12;
97
+ const descriptionColor = props.descriptionColor || '#6b7280';
98
+ // Background color helper
99
+ const getBackgroundColor = (fill) => {
100
+ if (!fill)
101
+ return '#ffffff';
102
+ if (typeof fill === 'string')
103
+ return fill;
104
+ if (fill.type === 'color')
105
+ return fill.color || '#ffffff';
106
+ if (fill.resolvedColor)
107
+ return fill.resolvedColor;
108
+ return '#ffffff';
109
+ };
110
+ const cardBackground = getBackgroundColor(props.cardBackground);
111
+ const selectedCardBackground = getBackgroundColor(props.selectedCardBackground);
112
+ // Indicator position style
113
+ const getIndicatorPositionStyle = () => {
114
+ const base = { position: 'absolute' };
115
+ switch (indicatorPosition) {
116
+ case 'top-left': return { ...base, top: 8, left: 8 };
117
+ case 'top-right': return { ...base, top: 8, right: 8 };
118
+ case 'bottom-left': return { ...base, bottom: 8, left: 8 };
119
+ case 'bottom-right': return { ...base, bottom: 8, right: 8 };
120
+ default: return { ...base, top: 8, right: 8 };
121
+ }
122
+ };
123
+ // Calculate item width based on columns
124
+ const itemWidth = `${(100 - (columns - 1) * 2) / columns}%`;
125
+ return (<react_native_1.View style={[styles.container, { opacity: disabled ? 0.6 : 1 }]}>
126
+ <react_native_1.View style={[styles.grid, { gap }]}>
127
+ {options.map((option, index) => {
128
+ const isSelected = selectedIndex === index;
129
+ const description = descriptions[index] || '';
130
+ return (<react_native_1.TouchableOpacity key={index} onPress={() => handleSelect(index)} disabled={disabled} activeOpacity={0.7} style={[
131
+ styles.card,
132
+ {
133
+ width: itemWidth,
134
+ minHeight: minItemHeight,
135
+ backgroundColor: isSelected ? selectedCardBackground : cardBackground,
136
+ borderColor: isSelected ? selectedBorderColor : cardBorderColor,
137
+ borderRadius: cardBorderRadius,
138
+ },
139
+ ]}>
140
+ {/* Radio Indicator */}
141
+ {showIndicator && (<react_native_1.View style={[
142
+ getIndicatorPositionStyle(),
143
+ {
144
+ width: indicatorSize,
145
+ height: indicatorSize,
146
+ borderRadius: indicatorSize / 2,
147
+ borderWidth: 2,
148
+ borderColor: isSelected ? indicatorColor : indicatorBorderColor,
149
+ backgroundColor: isSelected ? indicatorColor : 'transparent',
150
+ alignItems: 'center',
151
+ justifyContent: 'center',
152
+ },
153
+ ]}>
154
+ {isSelected && (<react_native_1.View style={{
155
+ width: indicatorSize * 0.4,
156
+ height: indicatorSize * 0.4,
157
+ borderRadius: indicatorSize * 0.2,
158
+ backgroundColor: '#ffffff',
159
+ }}/>)}
160
+ </react_native_1.View>)}
161
+
162
+ {/* Label */}
163
+ <react_native_1.Text style={[
164
+ styles.label,
165
+ {
166
+ fontSize: labelFontSize,
167
+ fontWeight: labelFontWeight,
168
+ color: isSelected ? selectedLabelColor : labelColor,
169
+ },
170
+ ]}>
171
+ {option}
172
+ </react_native_1.Text>
173
+
174
+ {/* Description */}
175
+ {description ? (<react_native_1.Text style={[
176
+ styles.description,
177
+ {
178
+ fontSize: descriptionFontSize,
179
+ color: descriptionColor,
180
+ },
181
+ ]}>
182
+ {description}
183
+ </react_native_1.Text>) : null}
184
+ </react_native_1.TouchableOpacity>);
185
+ })}
186
+ </react_native_1.View>
187
+ </react_native_1.View>);
188
+ };
189
+ exports.SingleChoiceGridComponent = SingleChoiceGridComponent;
190
+ const styles = react_native_1.StyleSheet.create({
191
+ container: {
192
+ width: '100%',
193
+ },
194
+ grid: {
195
+ flexDirection: 'row',
196
+ flexWrap: 'wrap',
197
+ },
198
+ card: {
199
+ position: 'relative',
200
+ borderWidth: 2,
201
+ padding: 16,
202
+ justifyContent: 'center',
203
+ },
204
+ label: {
205
+ marginTop: 4,
206
+ },
207
+ description: {
208
+ marginTop: 4,
209
+ },
210
+ });
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { PaywallComponent } from '../types';
3
+ interface SliderComponentProps {
4
+ component: PaywallComponent;
5
+ stateManager?: any;
6
+ isPreviewMode?: boolean;
7
+ }
8
+ export declare const SliderComponent: React.FC<SliderComponentProps>;
9
+ export {};