@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,221 @@
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.SegmentedPickerComponent = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ // Helper to extract color from FillValue or string
40
+ const extractColor = (fill, fallback = 'transparent') => {
41
+ if (!fill)
42
+ return fallback;
43
+ if (typeof fill === 'string')
44
+ return fill;
45
+ if (fill.type === 'color' && fill.color)
46
+ return fill.color;
47
+ if (fill.resolvedColor)
48
+ return fill.resolvedColor;
49
+ return fallback;
50
+ };
51
+ // Helper to apply selectedAppearance to child when selected
52
+ const applySelectedAppearanceToChild = (child, isSelected) => {
53
+ if (!isSelected || !child.selectedAppearance) {
54
+ return child;
55
+ }
56
+ // Merge selectedAppearance into appearance for selected state
57
+ return {
58
+ ...child,
59
+ appearance: child.selectedAppearance,
60
+ };
61
+ };
62
+ const SegmentedPickerComponent = ({ component, stateManager, isPreviewMode = false, renderChild, }) => {
63
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
64
+ const props = component.properties;
65
+ // Children arrive fully styled with selectedAppearance for state changes
66
+ // Selection properties
67
+ const defaultIndex = (_a = props.defaultSelectedIndex) !== null && _a !== void 0 ? _a : 0;
68
+ const disabled = (_b = props.disabled) !== null && _b !== void 0 ? _b : false;
69
+ const selectableSegments = props.selectableSegments !== false;
70
+ const bindToPackages = (_c = props.bindToPackages) !== null && _c !== void 0 ? _c : false;
71
+ const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(defaultIndex);
72
+ // Get segment children (filter by role)
73
+ const segmentChildren = (0, react_1.useMemo)(() => {
74
+ if (!component.children)
75
+ return [];
76
+ return component.children.filter(child => {
77
+ const role = child.role;
78
+ return (role === null || role === void 0 ? void 0 : role.startsWith('segment-')) && role !== 'segment-label';
79
+ });
80
+ }, [component.children]);
81
+ // Register initial state
82
+ (0, react_1.useEffect)(() => {
83
+ if (stateManager) {
84
+ stateManager.updateState(`element:${component.id}.selectedIndex`, selectedIndex);
85
+ }
86
+ }, []);
87
+ // Subscribe to external state changes
88
+ (0, react_1.useEffect)(() => {
89
+ if (stateManager) {
90
+ return stateManager.subscribeToState(`element:${component.id}.selectedIndex`, (value) => {
91
+ if (value !== selectedIndex) {
92
+ setSelectedIndex(value);
93
+ }
94
+ });
95
+ }
96
+ }, [component.id, stateManager]);
97
+ const handleSelect = (index) => {
98
+ if (!disabled && selectableSegments) {
99
+ setSelectedIndex(index);
100
+ if (stateManager) {
101
+ stateManager.updateState(`element:${component.id}.selectedIndex`, index);
102
+ }
103
+ }
104
+ };
105
+ // Container styling from props
106
+ const containerBackground = extractColor(props.containerBackground, '#f0f0f0');
107
+ const containerBorderRadius = (_d = props.borderRadius) !== null && _d !== void 0 ? _d : 8;
108
+ const containerPadding = (_e = props.padding) !== null && _e !== void 0 ? _e : 4;
109
+ const gap = (_f = props.gap) !== null && _f !== void 0 ? _f : 4;
110
+ // Get styling from component properties and appearance (direct properties architecture)
111
+ const componentAppearance = component.appearance || {};
112
+ const componentBorder = component.border || {};
113
+ // Segment styling - read from component.properties (canonical names)
114
+ const segmentFill = props.segmentFill;
115
+ const selectedSegmentFill = props.selectedSegmentFill;
116
+ const segmentBackground = extractColor(segmentFill, extractColor(componentAppearance.fill, 'transparent'));
117
+ const selectedBackground = extractColor(selectedSegmentFill, '#007AFF');
118
+ const segmentCornerRadius = (_g = componentAppearance.cornerRadius) !== null && _g !== void 0 ? _g : 6;
119
+ const segmentPadding = (_h = props.padding) !== null && _h !== void 0 ? _h : 8;
120
+ const segmentBorderColor = extractColor(componentBorder.color, 'transparent');
121
+ const segmentBorderWidth = (_j = componentBorder.width) !== null && _j !== void 0 ? _j : 0;
122
+ const selectedBorderColor = (_k = props.selectedBorderColor) !== null && _k !== void 0 ? _k : 'transparent';
123
+ const selectedBorderWidth = (_l = props.selectedBorderWidth) !== null && _l !== void 0 ? _l : 0;
124
+ // Render with children (child-based architecture)
125
+ if (segmentChildren.length > 0 && renderChild) {
126
+ return (<react_native_1.View style={[
127
+ styles.container,
128
+ {
129
+ backgroundColor: containerBackground,
130
+ borderRadius: containerBorderRadius,
131
+ padding: containerPadding,
132
+ gap,
133
+ },
134
+ disabled && styles.disabled,
135
+ ]}>
136
+ {segmentChildren.map((child, index) => {
137
+ var _a, _b;
138
+ const isActive = index === selectedIndex;
139
+ // Use child.selectedAppearance when active (children already have base styling)
140
+ const appearance = isActive ? child.selectedAppearance : child.appearance;
141
+ const bgColor = extractColor(appearance === null || appearance === void 0 ? void 0 : appearance.fill, isActive ? selectedBackground : segmentBackground);
142
+ const borderColor = isActive
143
+ ? extractColor(appearance === null || appearance === void 0 ? void 0 : appearance.borderColor, selectedBorderColor)
144
+ : extractColor(componentBorder.color, segmentBorderColor);
145
+ const borderWidth = isActive
146
+ ? ((_a = appearance === null || appearance === void 0 ? void 0 : appearance.borderWidth) !== null && _a !== void 0 ? _a : selectedBorderWidth)
147
+ : segmentBorderWidth;
148
+ // Apply selectedAppearance to child for rendering
149
+ const styledChild = applySelectedAppearanceToChild(child, isActive);
150
+ return (<react_native_1.TouchableOpacity key={child.id} onPress={() => handleSelect(index)} disabled={disabled || !selectableSegments} activeOpacity={0.7} style={[
151
+ styles.segment,
152
+ {
153
+ backgroundColor: bgColor,
154
+ borderRadius: (_b = appearance === null || appearance === void 0 ? void 0 : appearance.cornerRadius) !== null && _b !== void 0 ? _b : segmentCornerRadius,
155
+ padding: segmentPadding,
156
+ borderWidth,
157
+ borderColor,
158
+ },
159
+ ]}>
160
+ {renderChild(styledChild, index, isActive)}
161
+ </react_native_1.TouchableOpacity>);
162
+ })}
163
+ </react_native_1.View>);
164
+ }
165
+ // Fallback: render simple text segments from legacy segments property or defaults
166
+ const legacySegments = (_m = props.segments) !== null && _m !== void 0 ? _m : ['Option 1', 'Option 2'];
167
+ const activeColor = extractColor(selectedSegmentFill, (_o = props.activeColor) !== null && _o !== void 0 ? _o : '#007AFF');
168
+ const inactiveColor = extractColor(segmentFill, (_p = props.inactiveColor) !== null && _p !== void 0 ? _p : 'transparent');
169
+ const activeTextColor = (_r = (_q = props.selectedTextColor) !== null && _q !== void 0 ? _q : props.activeTextColor) !== null && _r !== void 0 ? _r : '#fff';
170
+ const inactiveTextColor = (_t = (_s = props.textColor) !== null && _s !== void 0 ? _s : props.inactiveTextColor) !== null && _t !== void 0 ? _t : '#333';
171
+ return (<react_native_1.View style={[
172
+ styles.container,
173
+ {
174
+ backgroundColor: containerBackground,
175
+ borderRadius: containerBorderRadius,
176
+ padding: containerPadding,
177
+ },
178
+ disabled && styles.disabled,
179
+ ]}>
180
+ {legacySegments.map((segment, index) => {
181
+ var _a, _b;
182
+ const isActive = index === selectedIndex;
183
+ return (<react_native_1.TouchableOpacity key={index} onPress={() => handleSelect(index)} disabled={disabled || !selectableSegments} activeOpacity={0.7} style={[
184
+ styles.segment,
185
+ {
186
+ backgroundColor: isActive ? activeColor : inactiveColor,
187
+ borderRadius: segmentCornerRadius,
188
+ padding: segmentPadding,
189
+ },
190
+ ]}>
191
+ <react_native_1.Text style={[
192
+ styles.segmentText,
193
+ {
194
+ color: isActive ? activeTextColor : inactiveTextColor,
195
+ fontSize: (_a = props.labelFontSize) !== null && _a !== void 0 ? _a : 14,
196
+ fontWeight: isActive ? '600' : ((_b = props.labelFontWeight) !== null && _b !== void 0 ? _b : 'normal'),
197
+ },
198
+ ]}>
199
+ {segment}
200
+ </react_native_1.Text>
201
+ </react_native_1.TouchableOpacity>);
202
+ })}
203
+ </react_native_1.View>);
204
+ };
205
+ exports.SegmentedPickerComponent = SegmentedPickerComponent;
206
+ const styles = react_native_1.StyleSheet.create({
207
+ container: {
208
+ flexDirection: 'row',
209
+ },
210
+ disabled: {
211
+ opacity: 0.5,
212
+ },
213
+ segment: {
214
+ flex: 1,
215
+ alignItems: 'center',
216
+ justifyContent: 'center',
217
+ },
218
+ segmentText: {
219
+ textAlign: 'center',
220
+ },
221
+ });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ShareButtonsComponent - React Native
3
+ *
4
+ * Social share buttons with Stack Child-Based Hybrid architecture and Layout Assistant.
5
+ * Features:
6
+ * - Hybrid mode: renders children via renderChild when available
7
+ * - Legacy mode: self-renders buttons when no children
8
+ * - Native share sheet
9
+ * - Platform-specific sharing (Twitter, Facebook, etc.)
10
+ * - Copy link functionality
11
+ */
12
+ import React from 'react';
13
+ import { PaywallComponent } from '../types';
14
+ interface ShareButtonsComponentProps {
15
+ component: PaywallComponent;
16
+ stateManager?: any;
17
+ isPreviewMode?: boolean;
18
+ renderChild?: (child: PaywallComponent, index: number) => React.ReactNode;
19
+ }
20
+ export declare const ShareButtonsComponent: React.FC<ShareButtonsComponentProps>;
21
+ export {};
@@ -0,0 +1,265 @@
1
+ "use strict";
2
+ /**
3
+ * ShareButtonsComponent - React Native
4
+ *
5
+ * Social share buttons with Stack Child-Based Hybrid architecture and Layout Assistant.
6
+ * Features:
7
+ * - Hybrid mode: renders children via renderChild when available
8
+ * - Legacy mode: self-renders buttons when no children
9
+ * - Native share sheet
10
+ * - Platform-specific sharing (Twitter, Facebook, etc.)
11
+ * - Copy link functionality
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.ShareButtonsComponent = void 0;
48
+ const react_1 = __importStar(require("react"));
49
+ const react_native_1 = require("react-native");
50
+ // Helper to extract color from fill value
51
+ const getColorFromFill = (fill, fallback) => {
52
+ if (!fill)
53
+ return fallback;
54
+ if (typeof fill === 'string')
55
+ return fill;
56
+ if (fill.resolvedColor)
57
+ return fill.resolvedColor;
58
+ if (fill.type === 'color' && fill.color)
59
+ return fill.color;
60
+ return fallback;
61
+ };
62
+ // Platform configurations with brand colors
63
+ const PLATFORM_CONFIG = {
64
+ native: { icon: '📤', label: 'Share', color: '#3B82F6' },
65
+ copy: { icon: '🔗', label: 'Copy', color: '#6B7280' },
66
+ twitter: { icon: '🐦', label: 'Twitter', color: '#1DA1F2' },
67
+ facebook: { icon: '📘', label: 'Facebook', color: '#1877F2' },
68
+ linkedin: { icon: '💼', label: 'LinkedIn', color: '#0A66C2' },
69
+ whatsapp: { icon: '💬', label: 'WhatsApp', color: '#25D366' },
70
+ telegram: { icon: '✈️', label: 'Telegram', color: '#0088cc' },
71
+ email: { icon: '✉️', label: 'Email', color: '#6B7280' },
72
+ };
73
+ const ShareButtonsComponent = ({ component, stateManager, isPreviewMode = false, renderChild, }) => {
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
75
+ const props = component.properties;
76
+ // Children arrive fully styled with selectedAppearance for state changes
77
+ const children = component.children || [];
78
+ const visibleChildren = children.filter((c) => c.visible !== false);
79
+ const componentId = component.id;
80
+ // Platform toggles
81
+ const showNativeShare = props.showNativeShare !== false;
82
+ const showCopyLink = props.showCopyLink !== false;
83
+ const showTwitter = (_a = props.showTwitter) !== null && _a !== void 0 ? _a : false;
84
+ const showFacebook = (_b = props.showFacebook) !== null && _b !== void 0 ? _b : false;
85
+ const showLinkedIn = (_c = props.showLinkedIn) !== null && _c !== void 0 ? _c : false;
86
+ const showWhatsApp = (_d = props.showWhatsApp) !== null && _d !== void 0 ? _d : false;
87
+ const showTelegram = (_e = props.showTelegram) !== null && _e !== void 0 ? _e : false;
88
+ const showEmail = (_f = props.showEmail) !== null && _f !== void 0 ? _f : false;
89
+ // Build enabled platforms array
90
+ const enabledPlatforms = [];
91
+ if (showNativeShare)
92
+ enabledPlatforms.push('native');
93
+ if (showCopyLink)
94
+ enabledPlatforms.push('copy');
95
+ if (showTwitter)
96
+ enabledPlatforms.push('twitter');
97
+ if (showFacebook)
98
+ enabledPlatforms.push('facebook');
99
+ if (showLinkedIn)
100
+ enabledPlatforms.push('linkedin');
101
+ if (showWhatsApp)
102
+ enabledPlatforms.push('whatsapp');
103
+ if (showTelegram)
104
+ enabledPlatforms.push('telegram');
105
+ if (showEmail)
106
+ enabledPlatforms.push('email');
107
+ // Share Content
108
+ const shareTitle = (_g = props.shareTitle) !== null && _g !== void 0 ? _g : 'Check this out!';
109
+ const shareText = (_h = props.shareText) !== null && _h !== void 0 ? _h : 'I found this amazing app!';
110
+ const shareUrl = (_j = props.shareUrl) !== null && _j !== void 0 ? _j : '';
111
+ // Layout
112
+ const layout = (_k = props.layout) !== null && _k !== void 0 ? _k : 'horizontal';
113
+ const buttonGap = (_l = props.buttonGap) !== null && _l !== void 0 ? _l : 8;
114
+ const alignment = (_m = props.alignment) !== null && _m !== void 0 ? _m : 'center';
115
+ // Button Styling - children arrive fully styled
116
+ const componentAppearance = component.appearance || {};
117
+ const buttonStyle = (_o = props.buttonStyle) !== null && _o !== void 0 ? _o : 'icon-only';
118
+ const buttonSize = (_p = props.buttonSize) !== null && _p !== void 0 ? _p : 44;
119
+ const buttonBorderRadius = (_r = (_q = componentAppearance.cornerRadius) !== null && _q !== void 0 ? _q : props.buttonBorderRadius) !== null && _r !== void 0 ? _r : 8;
120
+ const useBrandColors = props.useBrandColors !== false;
121
+ // Custom colors from component appearance
122
+ const customButtonBackground = getColorFromFill(componentAppearance.fill, '#E5E7EB');
123
+ const customIconColor = '#FFFFFF';
124
+ // Labels
125
+ const copiedLabel = (_s = props.copiedLabel) !== null && _s !== void 0 ? _s : 'Copied!';
126
+ const [copiedState, setCopiedState] = (0, react_1.useState)(false);
127
+ // Handle share for each platform
128
+ const handleShare = (0, react_1.useCallback)(async (platform) => {
129
+ const fullContent = shareUrl ? `${shareText} ${shareUrl}` : shareText;
130
+ switch (platform) {
131
+ case 'native':
132
+ try {
133
+ await react_native_1.Share.share({
134
+ message: fullContent,
135
+ title: shareTitle,
136
+ });
137
+ }
138
+ catch (err) {
139
+ console.error('Share failed:', err);
140
+ }
141
+ break;
142
+ case 'copy':
143
+ try {
144
+ react_native_1.Clipboard.setString(shareUrl || shareText);
145
+ setCopiedState(true);
146
+ setTimeout(() => setCopiedState(false), 2000);
147
+ }
148
+ catch (err) {
149
+ console.error('Copy failed:', err);
150
+ }
151
+ break;
152
+ case 'twitter':
153
+ react_native_1.Linking.openURL(`https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}&url=${encodeURIComponent(shareUrl)}`);
154
+ break;
155
+ case 'facebook':
156
+ react_native_1.Linking.openURL(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}&quote=${encodeURIComponent(shareText)}`);
157
+ break;
158
+ case 'linkedin':
159
+ react_native_1.Linking.openURL(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(shareUrl)}`);
160
+ break;
161
+ case 'whatsapp':
162
+ react_native_1.Linking.openURL(`whatsapp://send?text=${encodeURIComponent(fullContent)}`);
163
+ break;
164
+ case 'telegram':
165
+ react_native_1.Linking.openURL(`tg://msg?text=${encodeURIComponent(fullContent)}`);
166
+ break;
167
+ case 'email':
168
+ react_native_1.Linking.openURL(`mailto:?subject=${encodeURIComponent(shareTitle)}&body=${encodeURIComponent(fullContent)}`);
169
+ break;
170
+ }
171
+ // Track share event
172
+ if (stateManager) {
173
+ stateManager.updateState(`element:${componentId}.lastShared`, platform);
174
+ }
175
+ }, [shareTitle, shareText, shareUrl, componentId, stateManager]);
176
+ const getLabel = (platform) => {
177
+ var _a, _b;
178
+ if (platform === 'copy')
179
+ return copiedState ? copiedLabel : ((_a = PLATFORM_CONFIG[platform]) === null || _a === void 0 ? void 0 : _a.label) || platform;
180
+ return ((_b = PLATFORM_CONFIG[platform]) === null || _b === void 0 ? void 0 : _b.label) || platform;
181
+ };
182
+ // HYBRID MODE: Render children if available and renderChild is provided
183
+ if (visibleChildren.length > 0 && renderChild) {
184
+ return (<react_native_1.View style={[
185
+ styles.container,
186
+ {
187
+ flexDirection: layout === 'vertical' ? 'column' : 'row',
188
+ gap: buttonGap,
189
+ justifyContent: alignment === 'start' ? 'flex-start' : alignment === 'end' ? 'flex-end' : 'center',
190
+ },
191
+ ]}>
192
+ {visibleChildren.map((child, index) => {
193
+ const platform = (child.role || '').replace('share-button-', '');
194
+ return (<react_native_1.TouchableOpacity key={child.id} onPress={() => handleShare(platform)} activeOpacity={0.7}>
195
+ {renderChild(child, index)}
196
+ </react_native_1.TouchableOpacity>);
197
+ })}
198
+ </react_native_1.View>);
199
+ }
200
+ // Show message if no platforms enabled
201
+ if (enabledPlatforms.length === 0) {
202
+ return (<react_native_1.View style={styles.emptyContainer}>
203
+ <react_native_1.Text style={styles.emptyText}>Enable at least one share platform</react_native_1.Text>
204
+ </react_native_1.View>);
205
+ }
206
+ // LEGACY MODE: Self-render buttons
207
+ return (<react_native_1.View style={[
208
+ styles.container,
209
+ {
210
+ flexDirection: layout === 'vertical' ? 'column' : 'row',
211
+ gap: buttonGap,
212
+ justifyContent: alignment === 'start' ? 'flex-start' : alignment === 'end' ? 'flex-end' : 'center',
213
+ },
214
+ ]}>
215
+ {enabledPlatforms.map((platform) => {
216
+ const config = PLATFORM_CONFIG[platform];
217
+ if (!config)
218
+ return null;
219
+ const bgColor = useBrandColors ? config.color : customButtonBackground;
220
+ const textColor = useBrandColors ? '#FFFFFF' : customIconColor;
221
+ return (<react_native_1.TouchableOpacity key={platform} onPress={() => handleShare(platform)} activeOpacity={0.7} style={[
222
+ styles.button,
223
+ {
224
+ width: buttonStyle === 'text-only' ? undefined : buttonSize,
225
+ height: buttonSize,
226
+ borderRadius: buttonBorderRadius,
227
+ backgroundColor: bgColor,
228
+ paddingHorizontal: buttonStyle === 'text-only' ? 16 : 0,
229
+ },
230
+ ]}>
231
+ {buttonStyle !== 'text-only' && (<react_native_1.Text style={{ fontSize: buttonSize * 0.45 }}>
232
+ {platform === 'copy' && copiedState ? '✓' : config.icon}
233
+ </react_native_1.Text>)}
234
+ {buttonStyle !== 'icon-only' && (<react_native_1.Text style={[styles.buttonText, { color: textColor }]}>
235
+ {getLabel(platform)}
236
+ </react_native_1.Text>)}
237
+ </react_native_1.TouchableOpacity>);
238
+ })}
239
+ </react_native_1.View>);
240
+ };
241
+ exports.ShareButtonsComponent = ShareButtonsComponent;
242
+ const styles = react_native_1.StyleSheet.create({
243
+ container: {
244
+ flexWrap: 'wrap',
245
+ alignItems: 'center',
246
+ },
247
+ emptyContainer: {
248
+ padding: 16,
249
+ alignItems: 'center',
250
+ },
251
+ emptyText: {
252
+ fontSize: 14,
253
+ color: '#6B7280',
254
+ },
255
+ button: {
256
+ flexDirection: 'row',
257
+ alignItems: 'center',
258
+ justifyContent: 'center',
259
+ gap: 6,
260
+ },
261
+ buttonText: {
262
+ fontSize: 13,
263
+ fontWeight: '500',
264
+ },
265
+ });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ShareCodeComponent - React Native
3
+ *
4
+ * Hybrid component with child-based architecture.
5
+ * Uses component.properties for styling; children arrive fully styled with selectedAppearance.
6
+ */
7
+ import React from 'react';
8
+ import { PaywallComponent } from '../types';
9
+ interface ShareCodeComponentProps {
10
+ component: PaywallComponent;
11
+ stateManager?: any;
12
+ isPreviewMode?: boolean;
13
+ renderChild?: (child: PaywallComponent, index: number) => React.ReactNode;
14
+ }
15
+ export declare const ShareCodeComponent: React.FC<ShareCodeComponentProps>;
16
+ export {};