@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,215 @@
1
+ /**
2
+ * BDSurvey Types — Standalone survey SDK types
3
+ *
4
+ * These types are the canonical definitions for the BDSurvey system.
5
+ * The BillDog SDK re-exports these for backward compatibility.
6
+ */
7
+ export type SurveyQuestionType = 'multiple_choice' | 'multi_select' | 'text' | 'rating' | 'nps' | 'boolean' | 'dropdown' | 'matrix' | 'ranking' | 'slider' | 'emoji' | 'thumbs' | 'link';
8
+ export interface SurveyChoice {
9
+ id: string;
10
+ label: string;
11
+ value: string | null;
12
+ is_other: boolean;
13
+ choice_order: number;
14
+ image_url?: string | null;
15
+ metadata: Record<string, unknown>;
16
+ }
17
+ export type SurveyLogicOperator = 'equals' | 'not_equals' | 'contains' | 'is_any_of' | 'greater_than' | 'less_than';
18
+ export interface SurveyLogicCondition {
19
+ operator: SurveyLogicOperator;
20
+ value?: string | number;
21
+ choice_id?: string;
22
+ }
23
+ export interface SurveyLogicRule {
24
+ id: string;
25
+ /**
26
+ * Single condition (legacy / simple rules). Retained for backward compatibility.
27
+ * When `conditions` is present and non-empty it takes precedence over `condition`.
28
+ */
29
+ condition?: SurveyLogicCondition;
30
+ /**
31
+ * Compound conditions (PostHog-parity, added). Combined per `condition_logic`.
32
+ * Evaluators prefer this over `condition` when present.
33
+ */
34
+ conditions?: SurveyLogicCondition[];
35
+ /** How to combine `conditions`. Defaults to 'and'. */
36
+ condition_logic?: 'and' | 'or';
37
+ action_type: 'skip_to_question' | 'skip_to_page' | 'end_survey';
38
+ target_id?: string;
39
+ rule_order: number;
40
+ }
41
+ export interface SurveyQuestion {
42
+ id: string;
43
+ type: SurveyQuestionType;
44
+ text: string;
45
+ description: string | null;
46
+ is_required: boolean;
47
+ question_order: number;
48
+ config: Record<string, unknown>;
49
+ settings: Record<string, unknown>;
50
+ choices: SurveyChoice[];
51
+ logic_rules?: SurveyLogicRule[];
52
+ }
53
+ export interface SurveyPage {
54
+ id: string;
55
+ title: string | null;
56
+ description: string | null;
57
+ page_order: number;
58
+ settings: Record<string, unknown>;
59
+ questions: SurveyQuestion[];
60
+ }
61
+ export interface SurveyMobileDisplayConfig {
62
+ displayStyle?: 'full_screen' | 'sheet' | 'push_navigation' | 'no_transition' | 'side_drawer' | 'overlay_popup';
63
+ allowScrolling?: boolean;
64
+ interceptBackButton?: boolean;
65
+ accessControl?: 'restricted' | 'unrestricted';
66
+ safeAreaInsets?: boolean;
67
+ sheetConfig?: {
68
+ heightPercent?: number;
69
+ cornerRadius?: number;
70
+ };
71
+ popupConfig?: {
72
+ widthPercent?: number;
73
+ heightPercent?: number;
74
+ cornerRadius?: number;
75
+ };
76
+ drawerConfig?: {
77
+ widthPercent?: number;
78
+ cornerRadius?: number;
79
+ };
80
+ }
81
+ export interface SurveyConfiguration {
82
+ id: string;
83
+ name: string;
84
+ description: string | null;
85
+ type: string;
86
+ settings: SurveySettings;
87
+ pages: SurveyPage[];
88
+ mobile_display?: SurveyMobileDisplayConfig;
89
+ version?: number;
90
+ variant_group?: string | null;
91
+ variant_name?: string | null;
92
+ should_show?: boolean;
93
+ presentation_percentage?: number;
94
+ /** Display/targeting conditions (PostHog-parity, added). */
95
+ display_conditions?: SurveyDisplayConditions;
96
+ }
97
+ /**
98
+ * Display/targeting conditions evaluated client-side before a survey is shown
99
+ * (PostHog-parity, added). All present conditions must pass (logical AND).
100
+ */
101
+ export interface SurveyDisplayConditions {
102
+ /** Restrict to device categories. Empty/undefined = all devices. */
103
+ device_types?: SurveyDeviceType[];
104
+ /** Only show when a feature flag is enabled (optionally a specific variant). */
105
+ feature_flag?: {
106
+ key: string;
107
+ variant?: string | null;
108
+ };
109
+ /** Web/screen targeting: match the current URL/route. */
110
+ url_match?: {
111
+ operator: 'exact' | 'contains' | 'regex' | 'not_contains';
112
+ value: string;
113
+ };
114
+ /** Only show after an event fires during the session (optional property filters). */
115
+ event_trigger?: {
116
+ event_name: string;
117
+ property_filters?: Record<string, unknown>;
118
+ };
119
+ /** Delay before showing, in milliseconds. */
120
+ delay_ms?: number;
121
+ [key: string]: unknown;
122
+ }
123
+ export type SurveyDeviceType = 'phone' | 'tablet' | 'desktop' | 'tv' | 'watch';
124
+ /**
125
+ * Recurrence/repeat policy (PostHog-parity, added).
126
+ * `show_once` is the legacy single-show flag; `recurring` supersedes it when enabled.
127
+ */
128
+ export interface SurveyRecurrence {
129
+ enabled: boolean;
130
+ /** Maximum number of times the survey may be shown to a user. */
131
+ max_repeats?: number;
132
+ /** Minimum days between repeated showings. */
133
+ interval_days?: number;
134
+ /** Re-show every time the trigger event fires (ignores interval_days when true). */
135
+ on_every_trigger?: boolean;
136
+ }
137
+ export interface SurveySettings {
138
+ show_once?: boolean;
139
+ shuffle_options?: boolean;
140
+ /** Randomize question order (PostHog-parity, added). */
141
+ shuffle_questions?: boolean;
142
+ /** Recurring/repeat policy (PostHog-parity, added). */
143
+ recurring?: SurveyRecurrence;
144
+ /** Global wait period: don't show if the user saw ANY survey in the last N days (added). */
145
+ wait_period_days?: number;
146
+ presentation_percentage?: number;
147
+ locale?: string | null;
148
+ theme?: SurveyTheme;
149
+ thankYouMessage?: {
150
+ title: string;
151
+ body?: string | null;
152
+ } | null;
153
+ welcomeScreen?: {
154
+ title: string;
155
+ body?: string | null;
156
+ buttonText?: string | null;
157
+ } | null;
158
+ [key: string]: unknown;
159
+ }
160
+ export interface SurveyTheme {
161
+ primaryColor?: string;
162
+ backgroundColor?: string;
163
+ textColor?: string;
164
+ borderRadius?: number;
165
+ fontFamily?: string;
166
+ [key: string]: unknown;
167
+ }
168
+ export interface SurveyAnswer {
169
+ question_id: string;
170
+ choice_id?: string | null;
171
+ answer_text?: string | null;
172
+ answer_number?: number | null;
173
+ answer_json?: Record<string, unknown> | null;
174
+ }
175
+ export interface SurveyContext {
176
+ customer_id?: string;
177
+ anonymous_id?: string;
178
+ platform?: string;
179
+ session_id?: string;
180
+ device_info?: Record<string, unknown>;
181
+ custom_variables?: Record<string, string>;
182
+ [key: string]: unknown;
183
+ }
184
+ export interface SurveySubmitResult {
185
+ respondent_id: string;
186
+ survey_id: string;
187
+ status: string;
188
+ /** Submitted answers — included so host apps can implement conditional post-submit flows */
189
+ answers?: SurveyAnswer[];
190
+ }
191
+ export interface SurveyPresentationOptions {
192
+ customerId?: string;
193
+ anonymousId?: string;
194
+ platform?: string;
195
+ customVariables?: Record<string, string>;
196
+ onPresent?: (surveyId: string) => void;
197
+ onDismiss?: (surveyId: string) => void;
198
+ onComplete?: (surveyId: string, result: SurveySubmitResult) => void;
199
+ onError?: (error: Error) => void;
200
+ onAnswerChanged?: (answer: SurveyAnswer) => void;
201
+ }
202
+ export interface SurveyCacheEntry {
203
+ config: SurveyConfiguration;
204
+ fetchedAt: number;
205
+ }
206
+ export interface SurveyListItem {
207
+ id: string;
208
+ name: string;
209
+ description: string | null;
210
+ type: string;
211
+ status: string;
212
+ }
213
+ export interface SurveyListResult {
214
+ surveys: SurveyListItem[];
215
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * BDSurvey Types — Standalone survey SDK types
4
+ *
5
+ * These types are the canonical definitions for the BDSurvey system.
6
+ * The BillDog SDK re-exports these for backward compatibility.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Type definitions matching the web PaywallComponent structure
3
+ */
4
+ export type ComponentType = 'text' | 'image' | 'button' | 'stack' | 'feature-list' | 'price' | 'badge' | 'divider' | 'spacer' | 'icon' | 'video' | 'carousel' | 'tabs' | 'footer' | 'social-proof' | 'progress-loader' | 'chart-curve' | 'single-choice-grid' | 'multi-choice-grid' | 'checkbox' | 'toggle' | 'segmented-picker' | 'countdown' | 'accordion' | 'accordion-header' | 'slider' | 'navigation' | 'confetti' | 'delayed-x' | 'haptic-feedback' | 'shape' | 'webp' | 'gif' | 'lottie' | 'drawer-modal' | 'timeline' | 'text-input' | 'star-rating-input' | 'nps-scale' | 'oauth-button' | 'progress-stepper' | 'share-code' | 'share-buttons' | 'vertical-products' | 'horizontal-products' | 'accolade-cps' | 'sticker-composite';
5
+ /** Carousel transition animation types */
6
+ export type CarouselTransition = 'scroll' | 'fade' | 'slide' | 'push' | 'none';
7
+ export type NotificationChannel = 'push' | 'email' | 'sms' | 'live_activity';
8
+ export type LayoutType = 'fill' | 'fixed' | 'hug' | 'fit';
9
+ /** Size value as exported by web builder */
10
+ export interface SizeValue {
11
+ type: 'fill' | 'fixed' | 'fit' | 'hug';
12
+ value?: number;
13
+ }
14
+ export interface Size {
15
+ width: SizeValue | number | string;
16
+ height: SizeValue | number | string;
17
+ }
18
+ export interface Position {
19
+ x: number;
20
+ y: number;
21
+ }
22
+ export interface Layout {
23
+ width?: LayoutType;
24
+ height?: LayoutType;
25
+ padding?: {
26
+ top?: number;
27
+ right?: number;
28
+ bottom?: number;
29
+ left?: number;
30
+ };
31
+ margin?: {
32
+ top?: number;
33
+ right?: number;
34
+ bottom?: number;
35
+ left?: number;
36
+ };
37
+ }
38
+ /** Gradient stop definition */
39
+ export interface GradientStop {
40
+ color: string;
41
+ position: number;
42
+ resolvedColor?: string;
43
+ }
44
+ /** Gradient configuration */
45
+ export interface GradientConfig {
46
+ type: 'linear' | 'radial';
47
+ angle?: number;
48
+ stops: GradientStop[];
49
+ }
50
+ /** Image fill configuration */
51
+ export interface ImageFillConfig {
52
+ url: string;
53
+ fit?: 'fill' | 'fit' | 'stretch' | 'tile';
54
+ position?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
55
+ }
56
+ /** Fill value from web builder (source of truth) */
57
+ export type FillValue = string | {
58
+ type: 'color' | 'gradient' | 'image';
59
+ color?: string;
60
+ /** Pre-resolved hex color from the web exporter */
61
+ resolvedColor?: string;
62
+ opacity?: number;
63
+ gradient?: GradientConfig;
64
+ image?: ImageFillConfig;
65
+ };
66
+ /** Background color object (SDK-compatible format from web exporter) */
67
+ export interface BackgroundColorObject {
68
+ type: 'color' | 'gradient' | 'image';
69
+ color?: string;
70
+ resolvedColor?: string;
71
+ opacity?: number;
72
+ gradient?: GradientConfig;
73
+ }
74
+ /** Background color can be a string or complex object from web builder */
75
+ export type BackgroundColorValue = string | {
76
+ type: 'color' | 'gradient' | 'image';
77
+ color?: string;
78
+ opacity?: number;
79
+ resolvedColor?: string;
80
+ gradient?: {
81
+ type: 'linear' | 'radial';
82
+ angle?: number;
83
+ stops: Array<{
84
+ color: string;
85
+ position: number;
86
+ resolvedColor?: string;
87
+ }>;
88
+ };
89
+ imageUrl?: string;
90
+ };
91
+ export interface Appearance {
92
+ /** Original fill value from web builder (source of truth) */
93
+ fill?: FillValue;
94
+ /** Pre-resolved background color string for SDK compatibility */
95
+ backgroundColor?: BackgroundColorValue;
96
+ /** Structured background color object for gradients */
97
+ backgroundColorObj?: BackgroundColorObject;
98
+ borderColor?: string | {
99
+ type: string;
100
+ color?: string;
101
+ resolvedColor?: string;
102
+ };
103
+ /** Pre-resolved hex border color from the web exporter */
104
+ borderColorResolved?: string;
105
+ borderWidth?: number;
106
+ borderRadius?: number;
107
+ cornerRadius?: number;
108
+ opacity?: number;
109
+ shape?: 'rectangle' | 'pill' | 'circle';
110
+ transform?: Transform;
111
+ border?: Border;
112
+ shadow?: Shadow;
113
+ borderBottom?: LegacyBorderSide;
114
+ borderTop?: LegacyBorderSide;
115
+ borderLeft?: LegacyBorderSide;
116
+ borderRight?: LegacyBorderSide;
117
+ }
118
+ /**
119
+ * Get effective background color from appearance
120
+ * Priority: fill.color → backgroundColorObj.resolvedColor → backgroundColor
121
+ */
122
+ export declare function getEffectiveBackgroundColor(appearance: Appearance): string | undefined;
123
+ /**
124
+ * Check if appearance has a gradient background
125
+ */
126
+ export declare function hasGradientBackground(appearance: Appearance): boolean;
127
+ /**
128
+ * Get gradient config from appearance
129
+ */
130
+ export declare function getGradientConfig(appearance: Appearance): GradientConfig | undefined;
131
+ /** Text color object for structured text styling */
132
+ export interface TextColorObject {
133
+ type: 'color' | 'gradient';
134
+ color?: string;
135
+ resolvedColor?: string;
136
+ gradient?: GradientConfig;
137
+ }
138
+ /** Typography configuration for text components */
139
+ export interface Typography {
140
+ fontFamily?: string;
141
+ fontSize?: number;
142
+ fontWeight?: number;
143
+ fontStyle?: 'normal' | 'italic';
144
+ lineHeight?: number;
145
+ letterSpacing?: number;
146
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
147
+ textDecoration?: 'none' | 'underline' | 'line-through';
148
+ textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
149
+ color?: string;
150
+ resolvedColor?: string;
151
+ textColorObj?: TextColorObject;
152
+ }
153
+ /** Transform configuration for component transformations */
154
+ export interface Transform {
155
+ rotation?: number;
156
+ rotationX?: number;
157
+ rotationY?: number;
158
+ scaleX?: number;
159
+ scaleY?: number;
160
+ translateX?: number;
161
+ translateY?: number;
162
+ skewX?: number;
163
+ skewY?: number;
164
+ anchorX?: number;
165
+ anchorY?: number;
166
+ }
167
+ /** Border side configuration */
168
+ export interface BorderSide {
169
+ width?: number;
170
+ color?: string;
171
+ resolvedColor?: string;
172
+ style?: 'solid' | 'dashed' | 'dotted' | 'none';
173
+ }
174
+ /** Border radius configuration */
175
+ export interface BorderRadius {
176
+ topLeft?: number;
177
+ topRight?: number;
178
+ bottomLeft?: number;
179
+ bottomRight?: number;
180
+ uniform?: number;
181
+ }
182
+ /** Border configuration */
183
+ export interface Border {
184
+ width?: number;
185
+ color?: string;
186
+ resolvedColor?: string;
187
+ style?: 'solid' | 'dashed' | 'dotted' | 'none';
188
+ top?: BorderSide;
189
+ right?: BorderSide;
190
+ bottom?: BorderSide;
191
+ left?: BorderSide;
192
+ radius?: BorderRadius;
193
+ }
194
+ /** Shadow configuration */
195
+ export interface Shadow {
196
+ offsetX?: number;
197
+ offsetY?: number;
198
+ /** Legacy/web-builder aliases for offsetX/offsetY */
199
+ x?: number;
200
+ y?: number;
201
+ blur?: number;
202
+ spread?: number;
203
+ color?: string;
204
+ resolvedColor?: string;
205
+ opacity?: number;
206
+ inset?: boolean;
207
+ }
208
+ /** Legacy border side for appearance (backward compat) */
209
+ export interface LegacyBorderSide {
210
+ color?: string;
211
+ width?: number;
212
+ }
213
+ /** Border configuration from web builder (root-level on component) */
214
+ export interface BorderConfig {
215
+ color?: string;
216
+ /** Pre-resolved hex border color from the web exporter */
217
+ resolvedColor?: string;
218
+ width?: number;
219
+ style?: 'solid' | 'dashed' | 'dotted';
220
+ radius?: BorderRadius;
221
+ }
222
+ /** Get effective typography color */
223
+ export declare function getEffectiveTypographyColor(typography: Typography): string | undefined;
224
+ /** Check if transform has any transformation applied */
225
+ export declare function hasTransform(transform: Transform): boolean;
226
+ /** Get effective border color */
227
+ export declare function getEffectiveBorderColor(border: Border): string | undefined;
228
+ /** Get effective shadow color */
229
+ export declare function getEffectiveShadowColor(shadow: Shadow): string | undefined;
230
+ export interface ContainerLayout {
231
+ type?: 'row' | 'column' | 'grid' | 'wrap' | 'absolute';
232
+ axis?: 'horizontal' | 'vertical' | 'layered';
233
+ gap?: {
234
+ value: number;
235
+ unit: string;
236
+ } | number;
237
+ horizontalAlignment?: 'start' | 'center' | 'end' | 'stretch' | 'space-between';
238
+ verticalAlignment?: 'start' | 'center' | 'end' | 'stretch';
239
+ distribution?: string;
240
+ overflow?: string;
241
+ columns?: number;
242
+ rows?: number;
243
+ }
244
+ export interface PaywallComponent {
245
+ id: string;
246
+ type: ComponentType;
247
+ name: string;
248
+ componentLevel?: 'primitive' | 'composite' | 'custom';
249
+ isSnippet?: boolean;
250
+ shareStatus?: 'private' | 'public';
251
+ createdBy?: string;
252
+ snippetCategory?: string;
253
+ position: Position;
254
+ size: Size;
255
+ layout: Layout;
256
+ appearance: Appearance;
257
+ properties: Record<string, any>;
258
+ children?: PaywallComponent[];
259
+ visible?: boolean;
260
+ locked?: boolean;
261
+ border?: BorderConfig;
262
+ absolutePosition?: {
263
+ x: number;
264
+ y: number;
265
+ };
266
+ zIndex?: number;
267
+ compositeType?: string;
268
+ containerLayout?: ContainerLayout;
269
+ role?: string;
270
+ /** Selected state properties - mirrors the `properties` map structure */
271
+ selectedProperties?: Record<string, any>;
272
+ /** Selected state appearance - full appearance for selected state */
273
+ selectedAppearance?: Appearance;
274
+ /** Selected state layout - padding/margin for selected state */
275
+ selectedLayout?: Layout;
276
+ /** Selected state size - width/height for selected state */
277
+ selectedSize?: Size;
278
+ /** Selected state container layout - axis/gap/alignment for selected state */
279
+ selectedContainerLayout?: ContainerLayout;
280
+ }
281
+ export interface Product {
282
+ id: string;
283
+ product_identifier: string;
284
+ display_name: string;
285
+ description?: string;
286
+ type: string;
287
+ platform: string;
288
+ price_usd?: number;
289
+ currency?: string;
290
+ intro_price_usd?: number;
291
+ intro_duration?: number;
292
+ intro_period?: string;
293
+ intro_cycles?: number;
294
+ }
295
+ export interface OfferingPackage {
296
+ id: string;
297
+ package_identifier: string;
298
+ package_type?: string;
299
+ position: number;
300
+ metadata?: Record<string, any>;
301
+ product_id?: string;
302
+ product?: Product;
303
+ }
304
+ export type DisplayStyle = 'full_screen' | 'sheet' | 'push_navigation' | 'no_transition' | 'side_drawer' | 'overlay_popup';
305
+ export type AccessControl = 'restricted' | 'unrestricted';
306
+ export interface ScreenLayout {
307
+ alignment: 'start' | 'center' | 'end';
308
+ gap: number;
309
+ padding: {
310
+ top: number;
311
+ bottom: number;
312
+ left: number;
313
+ right: number;
314
+ };
315
+ safeAreaInsets?: boolean;
316
+ }
317
+ export interface ControllerMapping {
318
+ upButton?: string;
319
+ downButton?: string;
320
+ selectButton?: string;
321
+ dismissButton?: string;
322
+ }
323
+ export interface MobileDisplayConfig {
324
+ displayStyle: DisplayStyle;
325
+ allowScrolling: boolean;
326
+ gameControllerEnabled: boolean;
327
+ controllerMapping?: ControllerMapping;
328
+ interceptBackButton: boolean;
329
+ accessControl: AccessControl;
330
+ requirements?: {
331
+ minIosVersion?: string;
332
+ minAndroidVersion?: string;
333
+ requiredFeatures?: string[];
334
+ };
335
+ }
336
+ export interface EmailPayload {
337
+ to: string;
338
+ subject: string;
339
+ html_body: string;
340
+ text_body?: string;
341
+ from?: string;
342
+ reply_to?: string;
343
+ notification_id?: string;
344
+ }
345
+ export interface SMSPayload {
346
+ to: string;
347
+ body: string;
348
+ from?: string;
349
+ notification_id?: string;
350
+ }
351
+ export interface LiveActivityPayload {
352
+ activity_token: string;
353
+ event: 'start' | 'update' | 'end';
354
+ content_state: Record<string, any>;
355
+ stale_date?: Date;
356
+ dismissal_date?: Date;
357
+ notification_id?: string;
358
+ }
359
+ /**
360
+ * Canonical theme colors — 26 fields matching paywall-renderer ThemeColors.
361
+ * All values are pre-resolved hex strings from the exporter.
362
+ */
363
+ export interface ThemeColors {
364
+ primary: string;
365
+ primaryForeground: string;
366
+ secondary: string;
367
+ secondaryForeground: string;
368
+ background: string;
369
+ foreground: string;
370
+ card: string;
371
+ cardForeground: string;
372
+ muted: string;
373
+ mutedForeground: string;
374
+ border: string;
375
+ accent: string;
376
+ accentForeground: string;
377
+ destructive: string;
378
+ destructiveForeground: string;
379
+ input: string;
380
+ ring: string;
381
+ popover: string;
382
+ popoverForeground: string;
383
+ success: string;
384
+ successForeground: string;
385
+ warning: string;
386
+ warningForeground: string;
387
+ info: string;
388
+ infoForeground: string;
389
+ }
390
+ /** Theme configuration with resolved colors */
391
+ export interface ThemeConfig {
392
+ /** Canonical typed colors (preferred) */
393
+ colors?: Partial<ThemeColors>;
394
+ /** Legacy color fields — mapped to canonical names by normalizeThemeColors() */
395
+ primaryColor?: string;
396
+ secondaryColor?: string;
397
+ backgroundColor?: string;
398
+ textColor?: string;
399
+ cardColor?: string;
400
+ mutedColor?: string;
401
+ borderColor?: string;
402
+ accentColor?: string;
403
+ themingMode?: 'full' | 'component-priority' | 'disabled';
404
+ resolvedColors?: Record<string, string>;
405
+ fonts?: Record<string, any>;
406
+ screenLayout?: ScreenLayout;
407
+ }
408
+ /**
409
+ * Normalize any theme config (legacy or canonical) into the 26-field ThemeColors.
410
+ * Maps legacy field names (primaryColor, backgroundColor, etc.) to canonical names.
411
+ */
412
+ export declare function normalizeThemeColors(config: ThemeConfig | undefined): ThemeColors;
413
+ export type OfferDisplayMode = 'automatic' | 'always' | 'never';
414
+ export interface AppStoreIntegration {
415
+ showIntroPrice: OfferDisplayMode;
416
+ showFreeTrial: OfferDisplayMode;
417
+ autoSelectBestOffer?: boolean;
418
+ promoOfferIdentifier?: string;
419
+ }
420
+ export interface PaywallConfiguration {
421
+ components: PaywallComponent[];
422
+ theme?: ThemeConfig;
423
+ variables?: Record<string, string>;
424
+ localizations?: Record<string, Record<string, string>>;
425
+ /** Per-variable locale overrides: { variableName: { locale: value } } */
426
+ variableLocalizations?: Record<string, Record<string, string>>;
427
+ offeringId?: string;
428
+ /** Base locale for translations (source language), defaults to 'en' */
429
+ baseLocale?: string;
430
+ mobileDisplay?: MobileDisplayConfig;
431
+ appStoreIntegration?: AppStoreIntegration;
432
+ /**
433
+ * Resolved store packages/products bound to this paywall, when available.
434
+ * Shape is store-dependent (StoreKit/Play) and accessed structurally by
435
+ * product components, so it is typed loosely here.
436
+ */
437
+ packages?: any[];
438
+ }