@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.
- package/BillDogReactNative.podspec +30 -0
- package/LICENSE +21 -0
- package/README.md +330 -0
- package/android/build.gradle +99 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/kotlin/io/billdog/reactnative/BillDogABTestModule.kt +317 -0
- package/android/src/main/kotlin/io/billdog/reactnative/BillDogAnalyticsModule.kt +389 -0
- package/android/src/main/kotlin/io/billdog/reactnative/BillDogModule.kt +817 -0
- package/android/src/main/kotlin/io/billdog/reactnative/BillDogPaywallViewManager.kt +383 -0
- package/android/src/main/kotlin/io/billdog/reactnative/BillDogSurveyModule.kt +427 -0
- package/android/src/main/kotlin/io/billdog/reactnative/BillDogVirtualCurrencyModule.kt +407 -0
- package/android/src/main/kotlin/io/billdog/virtualcurrency/BillDogVirtualCurrencyPackage.kt +44 -0
- package/dist/AdvancedPaywallCache.d.ts +70 -0
- package/dist/AdvancedPaywallCache.js +344 -0
- package/dist/BillDog.d.ts +255 -0
- package/dist/BillDog.js +918 -0
- package/dist/BillDogConfiguration.d.ts +145 -0
- package/dist/BillDogConfiguration.js +229 -0
- package/dist/ComponentRenderer.d.ts +17 -0
- package/dist/ComponentRenderer.js +886 -0
- package/dist/LayoutEngine.d.ts +101 -0
- package/dist/LayoutEngine.js +394 -0
- package/dist/LocalizationResolver.d.ts +99 -0
- package/dist/LocalizationResolver.js +266 -0
- package/dist/NativePaywallView.d.ts +36 -0
- package/dist/NativePaywallView.js +59 -0
- package/dist/PaywallCache.d.ts +74 -0
- package/dist/PaywallCache.js +293 -0
- package/dist/PaywallStateManager.d.ts +62 -0
- package/dist/PaywallStateManager.js +147 -0
- package/dist/PaywallView.d.ts +42 -0
- package/dist/PaywallView.js +275 -0
- package/dist/ProductVariableProvider.d.ts +60 -0
- package/dist/ProductVariableProvider.js +239 -0
- package/dist/VariableResolver.d.ts +120 -0
- package/dist/VariableResolver.js +379 -0
- package/dist/WebViewPaywall.d.ts +75 -0
- package/dist/WebViewPaywall.js +360 -0
- package/dist/animations/presets.d.ts +49 -0
- package/dist/animations/presets.js +367 -0
- package/dist/components/AccoladeCpsComponent.d.ts +13 -0
- package/dist/components/AccoladeCpsComponent.js +248 -0
- package/dist/components/AccordionComponent.d.ts +10 -0
- package/dist/components/AccordionComponent.js +187 -0
- package/dist/components/AnimatedWrapper.d.ts +35 -0
- package/dist/components/AnimatedWrapper.js +277 -0
- package/dist/components/CarouselComponent.d.ts +23 -0
- package/dist/components/CarouselComponent.js +484 -0
- package/dist/components/ChartCurveComponent.d.ts +13 -0
- package/dist/components/ChartCurveComponent.js +333 -0
- package/dist/components/CheckboxComponent.d.ts +9 -0
- package/dist/components/CheckboxComponent.js +172 -0
- package/dist/components/ConfettiComponent.d.ts +9 -0
- package/dist/components/ConfettiComponent.js +172 -0
- package/dist/components/CountdownComponent.d.ts +16 -0
- package/dist/components/CountdownComponent.js +414 -0
- package/dist/components/DelayedXComponent.d.ts +12 -0
- package/dist/components/DelayedXComponent.js +240 -0
- package/dist/components/DrawerModalComponent.d.ts +20 -0
- package/dist/components/DrawerModalComponent.js +286 -0
- package/dist/components/GradientView.d.ts +38 -0
- package/dist/components/GradientView.js +126 -0
- package/dist/components/HapticFeedbackComponent.d.ts +16 -0
- package/dist/components/HapticFeedbackComponent.js +64 -0
- package/dist/components/HorizontalProductsComponent.d.ts +17 -0
- package/dist/components/HorizontalProductsComponent.js +284 -0
- package/dist/components/MultiChoiceGridComponent.d.ts +13 -0
- package/dist/components/MultiChoiceGridComponent.js +234 -0
- package/dist/components/NPSScaleComponent.d.ts +16 -0
- package/dist/components/NPSScaleComponent.js +260 -0
- package/dist/components/NavigationComponent.d.ts +26 -0
- package/dist/components/NavigationComponent.js +302 -0
- package/dist/components/OAuthButtonComponent.d.ts +20 -0
- package/dist/components/OAuthButtonComponent.js +237 -0
- package/dist/components/ProgressLoaderComponent.d.ts +13 -0
- package/dist/components/ProgressLoaderComponent.js +308 -0
- package/dist/components/ProgressStepperComponent.d.ts +18 -0
- package/dist/components/ProgressStepperComponent.js +228 -0
- package/dist/components/SegmentedPickerComponent.d.ts +10 -0
- package/dist/components/SegmentedPickerComponent.js +221 -0
- package/dist/components/ShareButtonsComponent.d.ts +21 -0
- package/dist/components/ShareButtonsComponent.js +265 -0
- package/dist/components/ShareCodeComponent.d.ts +16 -0
- package/dist/components/ShareCodeComponent.js +274 -0
- package/dist/components/SingleChoiceGridComponent.d.ts +13 -0
- package/dist/components/SingleChoiceGridComponent.js +210 -0
- package/dist/components/SliderComponent.d.ts +9 -0
- package/dist/components/SliderComponent.js +263 -0
- package/dist/components/StarRatingInputComponent.d.ts +20 -0
- package/dist/components/StarRatingInputComponent.js +198 -0
- package/dist/components/StickerCompositeComponent.d.ts +13 -0
- package/dist/components/StickerCompositeComponent.js +136 -0
- package/dist/components/TabsComponent.d.ts +19 -0
- package/dist/components/TabsComponent.js +431 -0
- package/dist/components/TextInputComponent.d.ts +18 -0
- package/dist/components/TextInputComponent.js +227 -0
- package/dist/components/TimelineComponent.d.ts +19 -0
- package/dist/components/TimelineComponent.js +104 -0
- package/dist/components/ToggleComponent.d.ts +14 -0
- package/dist/components/ToggleComponent.js +132 -0
- package/dist/components/VerticalProductsComponent.d.ts +17 -0
- package/dist/components/VerticalProductsComponent.js +311 -0
- package/dist/dynamicValues.d.ts +36 -0
- package/dist/dynamicValues.js +142 -0
- package/dist/filters/dateFilters.d.ts +50 -0
- package/dist/filters/dateFilters.js +390 -0
- package/dist/filters/index.d.ts +18 -0
- package/dist/filters/index.js +253 -0
- package/dist/hooks/useOfferings.d.ts +76 -0
- package/dist/hooks/useOfferings.js +99 -0
- package/dist/hooks/usePaywall.d.ts +27 -0
- package/dist/hooks/usePaywall.js +114 -0
- package/dist/hooks/usePlacement.d.ts +34 -0
- package/dist/hooks/usePlacement.js +89 -0
- package/dist/hooks/useSubscription.d.ts +40 -0
- package/dist/hooks/useSubscription.js +97 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +198 -0
- package/dist/models/BillDogError.d.ts +40 -0
- package/dist/models/BillDogError.js +11 -0
- package/dist/models/CacheFetchPolicy.d.ts +8 -0
- package/dist/models/CacheFetchPolicy.js +4 -0
- package/dist/models/CustomProduct.d.ts +32 -0
- package/dist/models/CustomProduct.js +15 -0
- package/dist/models/CustomerInfo.d.ts +17 -0
- package/dist/models/CustomerInfo.js +11 -0
- package/dist/models/Delegate.d.ts +20 -0
- package/dist/models/Delegate.js +11 -0
- package/dist/models/EntitlementInfo.d.ts +19 -0
- package/dist/models/EntitlementInfo.js +2 -0
- package/dist/models/Placement.d.ts +54 -0
- package/dist/models/Placement.js +15 -0
- package/dist/models/PurchaseParams.d.ts +39 -0
- package/dist/models/PurchaseParams.js +60 -0
- package/dist/models/PurchaseResult.d.ts +30 -0
- package/dist/models/PurchaseResult.js +15 -0
- package/dist/models/RestoreResult.d.ts +30 -0
- package/dist/models/RestoreResult.js +22 -0
- package/dist/models/RestoredItem.d.ts +26 -0
- package/dist/models/RestoredItem.js +13 -0
- package/dist/modules/ABTest.d.ts +65 -0
- package/dist/modules/ABTest.js +113 -0
- package/dist/modules/Analytics.d.ts +91 -0
- package/dist/modules/Analytics.js +182 -0
- package/dist/modules/Survey.d.ts +65 -0
- package/dist/modules/Survey.js +82 -0
- package/dist/modules/VirtualCurrency.d.ts +63 -0
- package/dist/modules/VirtualCurrency.js +147 -0
- package/dist/murmur.d.ts +23 -0
- package/dist/murmur.js +104 -0
- package/dist/notifications/LiveActivitiesManager.d.ts +47 -0
- package/dist/notifications/LiveActivitiesManager.js +106 -0
- package/dist/notifications/NotificationScheduler.d.ts +55 -0
- package/dist/notifications/NotificationScheduler.js +199 -0
- package/dist/notifications/PurchaseNotificationHandler.d.ts +24 -0
- package/dist/notifications/PurchaseNotificationHandler.js +55 -0
- package/dist/notifications/useDeviceToken.d.ts +36 -0
- package/dist/notifications/useDeviceToken.js +97 -0
- package/dist/notifications/useLiveActivity.d.ts +39 -0
- package/dist/notifications/useLiveActivity.js +104 -0
- package/dist/review/ReviewAnalytics.d.ts +34 -0
- package/dist/review/ReviewAnalytics.js +73 -0
- package/dist/review/ReviewManager.d.ts +83 -0
- package/dist/review/ReviewManager.js +339 -0
- package/dist/review/ReviewTimingManager.d.ts +82 -0
- package/dist/review/ReviewTimingManager.js +224 -0
- package/dist/survey-core/types.d.ts +215 -0
- package/dist/survey-core/types.js +8 -0
- package/dist/types.d.ts +438 -0
- package/dist/types.js +158 -0
- package/dist/utils/ApiClient.d.ts +65 -0
- package/dist/utils/ApiClient.js +132 -0
- package/dist/utils/CSSConverter.d.ts +49 -0
- package/dist/utils/CSSConverter.js +470 -0
- package/dist/utils/animations.d.ts +41 -0
- package/dist/utils/animations.js +194 -0
- package/dist/utils/calendarIntegration.d.ts +36 -0
- package/dist/utils/calendarIntegration.js +89 -0
- package/dist/utils/configurationResolver.d.ts +23 -0
- package/dist/utils/configurationResolver.js +78 -0
- package/dist/utils/deviceDetection.d.ts +38 -0
- package/dist/utils/deviceDetection.js +59 -0
- package/dist/utils/hapticFeedback.d.ts +17 -0
- package/dist/utils/hapticFeedback.js +53 -0
- package/dist/utils/iconMapper.d.ts +26 -0
- package/dist/utils/iconMapper.js +113 -0
- package/dist/utils/notificationPermissions.d.ts +13 -0
- package/dist/utils/notificationPermissions.js +51 -0
- package/dist/utils/priceFormatting.d.ts +19 -0
- package/dist/utils/priceFormatting.js +99 -0
- package/dist/utils/shareSheet.d.ts +17 -0
- package/dist/utils/shareSheet.js +42 -0
- package/dist/utils/subscriptionUpgrade.d.ts +84 -0
- package/dist/utils/subscriptionUpgrade.js +100 -0
- package/dist/valueUtils.d.ts +48 -0
- package/dist/valueUtils.js +129 -0
- package/dist/xFlowTags.d.ts +18 -0
- package/dist/xFlowTags.js +385 -0
- package/ios/BillDogABTest.m +50 -0
- package/ios/BillDogABTest.swift +188 -0
- package/ios/BillDogAnalytics.m +105 -0
- package/ios/BillDogAnalytics.swift +324 -0
- package/ios/BillDogBridge.m +222 -0
- package/ios/BillDogBridge.swift +715 -0
- package/ios/BillDogLiveActivities.m +41 -0
- package/ios/BillDogLiveActivities.swift +104 -0
- package/ios/BillDogPaywallViewManager.m +39 -0
- package/ios/BillDogPaywallViewManager.swift +361 -0
- package/ios/BillDogSurvey.m +34 -0
- package/ios/BillDogSurvey.swift +257 -0
- package/ios/BillDogVirtualCurrencyBridge.m +63 -0
- package/ios/BillDogVirtualCurrencyBridge.swift +511 -0
- package/junit.xml +25 -0
- package/package.json +61 -0
- package/react-native.config.js +13 -0
- package/src/AdvancedPaywallCache.ts +433 -0
- package/src/BillDog.ts +983 -0
- package/src/BillDogConfiguration.ts +318 -0
- package/src/ComponentRenderer.tsx +1325 -0
- package/src/LayoutEngine.ts +459 -0
- package/src/LocalizationResolver.ts +311 -0
- package/src/NativePaywallView.tsx +132 -0
- package/src/PaywallCache.ts +358 -0
- package/src/PaywallStateManager.ts +154 -0
- package/src/PaywallView.tsx +328 -0
- package/src/ProductVariableProvider.ts +282 -0
- package/src/VariableResolver.ts +516 -0
- package/src/WebViewPaywall.tsx +454 -0
- package/src/animations/presets.ts +421 -0
- package/src/components/AccoladeCpsComponent.tsx +259 -0
- package/src/components/AccordionComponent.tsx +213 -0
- package/src/components/AnimatedWrapper.tsx +316 -0
- package/src/components/CarouselComponent.tsx +615 -0
- package/src/components/ChartCurveComponent.tsx +452 -0
- package/src/components/CheckboxComponent.tsx +185 -0
- package/src/components/ConfettiComponent.tsx +178 -0
- package/src/components/CountdownComponent.tsx +454 -0
- package/src/components/DelayedXComponent.tsx +266 -0
- package/src/components/DrawerModalComponent.tsx +324 -0
- package/src/components/GradientView.tsx +129 -0
- package/src/components/HapticFeedbackComponent.tsx +39 -0
- package/src/components/HorizontalProductsComponent.tsx +329 -0
- package/src/components/MultiChoiceGridComponent.tsx +265 -0
- package/src/components/NPSScaleComponent.tsx +294 -0
- package/src/components/NavigationComponent.tsx +329 -0
- package/src/components/OAuthButtonComponent.tsx +266 -0
- package/src/components/ProgressLoaderComponent.tsx +366 -0
- package/src/components/ProgressStepperComponent.tsx +250 -0
- package/src/components/SegmentedPickerComponent.tsx +245 -0
- package/src/components/ShareButtonsComponent.tsx +299 -0
- package/src/components/ShareCodeComponent.tsx +303 -0
- package/src/components/SingleChoiceGridComponent.tsx +229 -0
- package/src/components/SliderComponent.tsx +280 -0
- package/src/components/StarRatingInputComponent.tsx +223 -0
- package/src/components/StickerCompositeComponent.tsx +168 -0
- package/src/components/TabsComponent.tsx +496 -0
- package/src/components/TextInputComponent.tsx +258 -0
- package/src/components/TimelineComponent.tsx +129 -0
- package/src/components/ToggleComponent.tsx +142 -0
- package/src/components/VerticalProductsComponent.tsx +357 -0
- package/src/dynamicValues.ts +180 -0
- package/src/filters/dateFilters.ts +411 -0
- package/src/filters/index.ts +281 -0
- package/src/hooks/useOfferings.ts +192 -0
- package/src/hooks/usePaywall.ts +154 -0
- package/src/hooks/usePlacement.ts +143 -0
- package/src/hooks/useSubscription.ts +154 -0
- package/src/index.ts +245 -0
- package/src/models/BillDogError.ts +24 -0
- package/src/models/CacheFetchPolicy.ts +13 -0
- package/src/models/CustomProduct.ts +33 -0
- package/src/models/CustomerInfo.ts +26 -0
- package/src/models/Delegate.ts +22 -0
- package/src/models/EntitlementInfo.ts +27 -0
- package/src/models/Placement.ts +50 -0
- package/src/models/PurchaseParams.ts +81 -0
- package/src/models/PurchaseResult.ts +32 -0
- package/src/models/RestoreResult.ts +27 -0
- package/src/models/RestoredItem.ts +25 -0
- package/src/modules/ABTest.ts +131 -0
- package/src/modules/Analytics.ts +227 -0
- package/src/modules/Survey.ts +126 -0
- package/src/modules/VirtualCurrency.ts +223 -0
- package/src/murmur.ts +102 -0
- package/src/notifications/LiveActivitiesManager.ts +140 -0
- package/src/notifications/NotificationScheduler.ts +292 -0
- package/src/notifications/PurchaseNotificationHandler.ts +67 -0
- package/src/notifications/useDeviceToken.ts +116 -0
- package/src/notifications/useLiveActivity.ts +125 -0
- package/src/review/ReviewAnalytics.ts +89 -0
- package/src/review/ReviewManager.ts +355 -0
- package/src/review/ReviewTimingManager.ts +265 -0
- package/src/survey-core/types.ts +244 -0
- package/src/types/ambient.d.ts +9 -0
- package/src/types.ts +680 -0
- package/src/utils/ApiClient.ts +163 -0
- package/src/utils/CSSConverter.ts +552 -0
- package/src/utils/animations.ts +232 -0
- package/src/utils/calendarIntegration.ts +113 -0
- package/src/utils/configurationResolver.ts +106 -0
- package/src/utils/deviceDetection.ts +83 -0
- package/src/utils/hapticFeedback.ts +55 -0
- package/src/utils/iconMapper.ts +102 -0
- package/src/utils/notificationPermissions.ts +48 -0
- package/src/utils/priceFormatting.ts +119 -0
- package/src/utils/shareSheet.ts +55 -0
- package/src/utils/subscriptionUpgrade.ts +183 -0
- package/src/valueUtils.ts +108 -0
- package/src/xFlowTags.ts +463 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Engine - Converts JSON layout to React Native StyleSheet
|
|
3
|
+
*
|
|
4
|
+
* PHASE 5 SIMPLIFIED: All colors are now pre-resolved to hex by the web exporter.
|
|
5
|
+
* Removed ThemeColorResolver, CSS variable resolution, and HSL parsing.
|
|
6
|
+
*/
|
|
7
|
+
import { ViewStyle } from 'react-native';
|
|
8
|
+
import { Layout, Appearance, Size, BorderConfig, Shadow } from './types';
|
|
9
|
+
export interface CustomCSSConfig {
|
|
10
|
+
styles?: string;
|
|
11
|
+
transitions?: string;
|
|
12
|
+
animations?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a size value from any format to { type, value }
|
|
16
|
+
*/
|
|
17
|
+
declare function normalizeSizeValue(size: any): {
|
|
18
|
+
type: string;
|
|
19
|
+
value?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare class LayoutEngine {
|
|
22
|
+
/**
|
|
23
|
+
* Normalize size value (exported for external use)
|
|
24
|
+
*/
|
|
25
|
+
static normalizeSizeValue: typeof normalizeSizeValue;
|
|
26
|
+
/**
|
|
27
|
+
* Convert JSON layout and size to React Native flex layout
|
|
28
|
+
*/
|
|
29
|
+
static getFlexLayout(layout: Layout, size?: Size): ViewStyle;
|
|
30
|
+
/**
|
|
31
|
+
* Convert size to React Native dimensions
|
|
32
|
+
* @deprecated Use getFlexLayout with size parameter instead
|
|
33
|
+
*/
|
|
34
|
+
static getSize(size: Size, layout: Layout): ViewStyle;
|
|
35
|
+
/**
|
|
36
|
+
* Parse a color value - PHASE 5 SIMPLIFIED
|
|
37
|
+
* All colors are now pre-resolved to hex by the web exporter
|
|
38
|
+
*/
|
|
39
|
+
private static parseColorValue;
|
|
40
|
+
/**
|
|
41
|
+
* Convert JSON appearance to React Native ViewStyle
|
|
42
|
+
*/
|
|
43
|
+
static getAppearanceStyle(appearance: Appearance): ViewStyle;
|
|
44
|
+
/**
|
|
45
|
+
* Get appearance style with border config support
|
|
46
|
+
*/
|
|
47
|
+
static getAppearanceStyleWithBorder(appearance: Appearance, border?: BorderConfig): ViewStyle;
|
|
48
|
+
/**
|
|
49
|
+
* Apply shadow to style
|
|
50
|
+
*/
|
|
51
|
+
static applyShadow(style: ViewStyle, shadow: Shadow): ViewStyle;
|
|
52
|
+
/**
|
|
53
|
+
* Apply border sides (top, right, bottom, left individual borders)
|
|
54
|
+
*/
|
|
55
|
+
static applyBorderSides(style: ViewStyle, appearance: Appearance): ViewStyle;
|
|
56
|
+
/**
|
|
57
|
+
* Apply custom CSS styles (for native rendering)
|
|
58
|
+
*/
|
|
59
|
+
static applyCustomCSS(style: ViewStyle, customCSS?: CustomCSSConfig): {
|
|
60
|
+
style: ViewStyle;
|
|
61
|
+
warnings: string[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Validate if custom CSS can be rendered natively
|
|
65
|
+
*/
|
|
66
|
+
static validateCustomCSSForNative(customCSS?: CustomCSSConfig): {
|
|
67
|
+
isValid: boolean;
|
|
68
|
+
warnings: string[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Get container style for stack/group components
|
|
72
|
+
*/
|
|
73
|
+
static getContainerStyle(layout: Layout, size: Size, appearance: Appearance, containerLayout?: {
|
|
74
|
+
direction?: string;
|
|
75
|
+
distribution?: string;
|
|
76
|
+
alignment?: string;
|
|
77
|
+
gap?: number;
|
|
78
|
+
}): ViewStyle;
|
|
79
|
+
/**
|
|
80
|
+
* Build a combined ViewStyle for a single rendered component.
|
|
81
|
+
*
|
|
82
|
+
* Composes flex layout + appearance + optional custom CSS, then layers on
|
|
83
|
+
* absolute positioning and z-index when present. This delegates to the
|
|
84
|
+
* existing helpers so runtime behavior matches the per-helper output the
|
|
85
|
+
* renderer previously relied on.
|
|
86
|
+
*/
|
|
87
|
+
static getComponentStyle(layout: Layout, appearance: Appearance, size: Size, _type?: string, _properties?: Record<string, any>, absolutePosition?: {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
}, zIndex?: number, customCSS?: CustomCSSConfig): ViewStyle;
|
|
91
|
+
}
|
|
92
|
+
export declare const ThemeColorResolver: {
|
|
93
|
+
setTheme: (_config: any) => void;
|
|
94
|
+
setResolvedColors: (_colors: any) => void;
|
|
95
|
+
clearTheme: () => void;
|
|
96
|
+
isThemingEnabled: () => boolean;
|
|
97
|
+
getThemingMode: () => "disabled";
|
|
98
|
+
resolveVariable: (_name: string) => string | undefined;
|
|
99
|
+
getDefaultVariableColor: (_name: string) => string;
|
|
100
|
+
};
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Layout Engine - Converts JSON layout to React Native StyleSheet
|
|
4
|
+
*
|
|
5
|
+
* PHASE 5 SIMPLIFIED: All colors are now pre-resolved to hex by the web exporter.
|
|
6
|
+
* Removed ThemeColorResolver, CSS variable resolution, and HSL parsing.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ThemeColorResolver = exports.LayoutEngine = void 0;
|
|
10
|
+
const CSSConverter_1 = require("./utils/CSSConverter");
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a size value from any format to { type, value }
|
|
13
|
+
*/
|
|
14
|
+
function normalizeSizeValue(size) {
|
|
15
|
+
// Already normalized format
|
|
16
|
+
if (size && typeof size === 'object' && 'type' in size) {
|
|
17
|
+
// Migrate 'hug' to 'fit' for consistency
|
|
18
|
+
const type = size.type === 'hug' ? 'fit' : size.type;
|
|
19
|
+
return { type, value: size.value };
|
|
20
|
+
}
|
|
21
|
+
// Number value = fixed
|
|
22
|
+
if (typeof size === 'number') {
|
|
23
|
+
return { type: 'fixed', value: size };
|
|
24
|
+
}
|
|
25
|
+
// String value
|
|
26
|
+
if (typeof size === 'string') {
|
|
27
|
+
const lower = size.toLowerCase();
|
|
28
|
+
if (lower === 'fill' || lower === '100%')
|
|
29
|
+
return { type: 'fill' };
|
|
30
|
+
if (lower === 'fit' || lower === 'auto' || lower === 'hug')
|
|
31
|
+
return { type: 'fit' };
|
|
32
|
+
// Try to parse as number
|
|
33
|
+
const num = parseFloat(size);
|
|
34
|
+
if (!isNaN(num))
|
|
35
|
+
return { type: 'fixed', value: num };
|
|
36
|
+
return { type: 'fit' };
|
|
37
|
+
}
|
|
38
|
+
// Default
|
|
39
|
+
return { type: 'fit' };
|
|
40
|
+
}
|
|
41
|
+
class LayoutEngine {
|
|
42
|
+
/**
|
|
43
|
+
* Convert JSON layout and size to React Native flex layout
|
|
44
|
+
*/
|
|
45
|
+
static getFlexLayout(layout, size) {
|
|
46
|
+
const style = {};
|
|
47
|
+
// Normalize size values
|
|
48
|
+
const normalizedWidth = (size === null || size === void 0 ? void 0 : size.width) ? normalizeSizeValue(size.width) : { type: 'fit' };
|
|
49
|
+
const normalizedHeight = (size === null || size === void 0 ? void 0 : size.height) ? normalizeSizeValue(size.height) : { type: 'fit' };
|
|
50
|
+
// Width handling
|
|
51
|
+
switch (normalizedWidth.type) {
|
|
52
|
+
case 'fill':
|
|
53
|
+
style.alignSelf = 'stretch';
|
|
54
|
+
style.width = '100%';
|
|
55
|
+
break;
|
|
56
|
+
case 'fixed':
|
|
57
|
+
if (normalizedWidth.value && normalizedWidth.value > 0) {
|
|
58
|
+
style.width = normalizedWidth.value;
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case 'fit':
|
|
62
|
+
default:
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
// Height handling
|
|
66
|
+
switch (normalizedHeight.type) {
|
|
67
|
+
case 'fill':
|
|
68
|
+
style.flex = 1;
|
|
69
|
+
break;
|
|
70
|
+
case 'fixed':
|
|
71
|
+
if (normalizedHeight.value && normalizedHeight.value > 0) {
|
|
72
|
+
style.height = normalizedHeight.value;
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case 'fit':
|
|
76
|
+
default:
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
// Padding
|
|
80
|
+
if (layout.padding) {
|
|
81
|
+
if (layout.padding.top !== undefined)
|
|
82
|
+
style.paddingTop = layout.padding.top;
|
|
83
|
+
if (layout.padding.right !== undefined)
|
|
84
|
+
style.paddingRight = layout.padding.right;
|
|
85
|
+
if (layout.padding.bottom !== undefined)
|
|
86
|
+
style.paddingBottom = layout.padding.bottom;
|
|
87
|
+
if (layout.padding.left !== undefined)
|
|
88
|
+
style.paddingLeft = layout.padding.left;
|
|
89
|
+
}
|
|
90
|
+
// Margin
|
|
91
|
+
if (layout.margin) {
|
|
92
|
+
if (layout.margin.top !== undefined)
|
|
93
|
+
style.marginTop = layout.margin.top;
|
|
94
|
+
if (layout.margin.right !== undefined)
|
|
95
|
+
style.marginRight = layout.margin.right;
|
|
96
|
+
if (layout.margin.bottom !== undefined)
|
|
97
|
+
style.marginBottom = layout.margin.bottom;
|
|
98
|
+
if (layout.margin.left !== undefined)
|
|
99
|
+
style.marginLeft = layout.margin.left;
|
|
100
|
+
}
|
|
101
|
+
return style;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Convert size to React Native dimensions
|
|
105
|
+
* @deprecated Use getFlexLayout with size parameter instead
|
|
106
|
+
*/
|
|
107
|
+
static getSize(size, layout) {
|
|
108
|
+
const style = {};
|
|
109
|
+
const normalizedWidth = normalizeSizeValue(size.width);
|
|
110
|
+
const normalizedHeight = normalizeSizeValue(size.height);
|
|
111
|
+
// Width
|
|
112
|
+
if (normalizedWidth.type === 'fixed' && normalizedWidth.value) {
|
|
113
|
+
style.width = normalizedWidth.value;
|
|
114
|
+
}
|
|
115
|
+
else if (normalizedWidth.type === 'fill') {
|
|
116
|
+
style.width = '100%';
|
|
117
|
+
}
|
|
118
|
+
// Height
|
|
119
|
+
if (normalizedHeight.type === 'fixed' && normalizedHeight.value) {
|
|
120
|
+
style.height = normalizedHeight.value;
|
|
121
|
+
}
|
|
122
|
+
return style;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parse a color value - PHASE 5 SIMPLIFIED
|
|
126
|
+
* All colors are now pre-resolved to hex by the web exporter
|
|
127
|
+
*/
|
|
128
|
+
static parseColorValue(color) {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
if (!color)
|
|
131
|
+
return undefined;
|
|
132
|
+
if (typeof color === 'string') {
|
|
133
|
+
// Handle 8-character hex colors (#RRGGBBAA format)
|
|
134
|
+
if (color.length === 9 && color.startsWith('#')) {
|
|
135
|
+
// Convert RRGGBBAA to rgba for React Native
|
|
136
|
+
const r = parseInt(color.substring(1, 3), 16);
|
|
137
|
+
const g = parseInt(color.substring(3, 5), 16);
|
|
138
|
+
const b = parseInt(color.substring(5, 7), 16);
|
|
139
|
+
const a = parseInt(color.substring(7, 9), 16) / 255;
|
|
140
|
+
return `rgba(${r}, ${g}, ${b}, ${a.toFixed(2)})`;
|
|
141
|
+
}
|
|
142
|
+
return color;
|
|
143
|
+
}
|
|
144
|
+
// Handle object format { type: 'color'|'gradient', color?: string, gradient?: {...} }
|
|
145
|
+
if (typeof color === 'object') {
|
|
146
|
+
// Check resolvedColor first (pre-computed hex from web exporter)
|
|
147
|
+
if (color.resolvedColor)
|
|
148
|
+
return this.parseColorValue(color.resolvedColor);
|
|
149
|
+
// Direct color type with nested color
|
|
150
|
+
if (color.type === 'color' && color.color) {
|
|
151
|
+
return this.parseColorValue(color.color);
|
|
152
|
+
}
|
|
153
|
+
// Gradient type - fallback to first stop color
|
|
154
|
+
if (color.type === 'gradient' && ((_b = (_a = color.gradient) === null || _a === void 0 ? void 0 : _a.stops) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
155
|
+
const firstStop = color.gradient.stops[0];
|
|
156
|
+
if (firstStop === null || firstStop === void 0 ? void 0 : firstStop.color) {
|
|
157
|
+
return this.parseColorValue(firstStop.color);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Fallback fields
|
|
161
|
+
if (color.color && typeof color.color === 'string')
|
|
162
|
+
return this.parseColorValue(color.color);
|
|
163
|
+
if (color.hex)
|
|
164
|
+
return color.hex;
|
|
165
|
+
if (color.value)
|
|
166
|
+
return color.value;
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Convert JSON appearance to React Native ViewStyle
|
|
172
|
+
*/
|
|
173
|
+
static getAppearanceStyle(appearance) {
|
|
174
|
+
var _a;
|
|
175
|
+
const style = {};
|
|
176
|
+
// Background color - check resolvedColor first.
|
|
177
|
+
// `fill` may be a plain color string or a structured fill object; only the
|
|
178
|
+
// object branch carries resolvedColor/color, so narrow before accessing.
|
|
179
|
+
const fillObj = typeof appearance.fill === 'object' ? appearance.fill : undefined;
|
|
180
|
+
const bgColor = this.parseColorValue(fillObj === null || fillObj === void 0 ? void 0 : fillObj.resolvedColor)
|
|
181
|
+
|| this.parseColorValue(fillObj === null || fillObj === void 0 ? void 0 : fillObj.color)
|
|
182
|
+
|| this.parseColorValue(typeof appearance.fill === 'string' ? appearance.fill : undefined)
|
|
183
|
+
|| this.parseColorValue(appearance.backgroundColor);
|
|
184
|
+
if (bgColor) {
|
|
185
|
+
style.backgroundColor = bgColor;
|
|
186
|
+
}
|
|
187
|
+
// Border radius
|
|
188
|
+
const borderRadius = (_a = appearance.cornerRadius) !== null && _a !== void 0 ? _a : appearance.borderRadius;
|
|
189
|
+
if (borderRadius !== undefined && borderRadius > 0) {
|
|
190
|
+
style.borderRadius = borderRadius;
|
|
191
|
+
}
|
|
192
|
+
// Opacity
|
|
193
|
+
if (appearance.opacity !== undefined) {
|
|
194
|
+
style.opacity = appearance.opacity;
|
|
195
|
+
}
|
|
196
|
+
// Border
|
|
197
|
+
if (appearance.borderWidth !== undefined && appearance.borderWidth > 0) {
|
|
198
|
+
style.borderWidth = appearance.borderWidth;
|
|
199
|
+
const borderColor = this.parseColorValue(appearance.borderColorResolved)
|
|
200
|
+
|| this.parseColorValue(appearance.borderColor);
|
|
201
|
+
if (borderColor) {
|
|
202
|
+
style.borderColor = borderColor;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return style;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get appearance style with border config support
|
|
209
|
+
*/
|
|
210
|
+
static getAppearanceStyleWithBorder(appearance, border) {
|
|
211
|
+
var _a;
|
|
212
|
+
const style = this.getAppearanceStyle(appearance);
|
|
213
|
+
if (border) {
|
|
214
|
+
if (border.width !== undefined && border.width > 0) {
|
|
215
|
+
style.borderWidth = border.width;
|
|
216
|
+
}
|
|
217
|
+
// Use resolvedColor first (pre-computed hex)
|
|
218
|
+
const borderColor = border.resolvedColor || border.color;
|
|
219
|
+
if (borderColor) {
|
|
220
|
+
style.borderColor = this.parseColorValue(borderColor);
|
|
221
|
+
}
|
|
222
|
+
if (((_a = border.radius) === null || _a === void 0 ? void 0 : _a.uniform) !== undefined) {
|
|
223
|
+
style.borderRadius = border.radius.uniform;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return style;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Apply shadow to style
|
|
230
|
+
*/
|
|
231
|
+
static applyShadow(style, shadow) {
|
|
232
|
+
var _a, _b, _c, _d;
|
|
233
|
+
const result = { ...style };
|
|
234
|
+
const shadowColor = this.parseColorValue(shadow.color);
|
|
235
|
+
if (shadowColor) {
|
|
236
|
+
result.shadowColor = shadowColor;
|
|
237
|
+
}
|
|
238
|
+
result.shadowOffset = {
|
|
239
|
+
width: (_a = shadow.x) !== null && _a !== void 0 ? _a : 0,
|
|
240
|
+
height: (_b = shadow.y) !== null && _b !== void 0 ? _b : 0,
|
|
241
|
+
};
|
|
242
|
+
result.shadowOpacity = 1;
|
|
243
|
+
result.shadowRadius = (_c = shadow.blur) !== null && _c !== void 0 ? _c : 0;
|
|
244
|
+
// Android elevation
|
|
245
|
+
result.elevation = Math.max((_d = shadow.blur) !== null && _d !== void 0 ? _d : 0, 1);
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Apply border sides (top, right, bottom, left individual borders)
|
|
250
|
+
*/
|
|
251
|
+
static applyBorderSides(style, appearance) {
|
|
252
|
+
const result = { ...style };
|
|
253
|
+
const applyBorderSide = (side, prefix) => {
|
|
254
|
+
if (!side)
|
|
255
|
+
return;
|
|
256
|
+
if (side.width !== undefined && side.width > 0) {
|
|
257
|
+
result[`border${prefix}Width`] = side.width;
|
|
258
|
+
}
|
|
259
|
+
const color = side.resolvedColor || side.color;
|
|
260
|
+
if (color) {
|
|
261
|
+
result[`border${prefix}Color`] = this.parseColorValue(color);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
applyBorderSide(appearance.borderTop, 'Top');
|
|
265
|
+
applyBorderSide(appearance.borderRight, 'Right');
|
|
266
|
+
applyBorderSide(appearance.borderBottom, 'Bottom');
|
|
267
|
+
applyBorderSide(appearance.borderLeft, 'Left');
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Apply custom CSS styles (for native rendering)
|
|
272
|
+
*/
|
|
273
|
+
static applyCustomCSS(style, customCSS) {
|
|
274
|
+
if (!(customCSS === null || customCSS === void 0 ? void 0 : customCSS.styles)) {
|
|
275
|
+
return { style, warnings: [] };
|
|
276
|
+
}
|
|
277
|
+
const result = (0, CSSConverter_1.convertCSSToReactNative)(customCSS.styles);
|
|
278
|
+
return {
|
|
279
|
+
style: { ...style, ...result.style },
|
|
280
|
+
warnings: result.warnings,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Validate if custom CSS can be rendered natively
|
|
285
|
+
*/
|
|
286
|
+
static validateCustomCSSForNative(customCSS) {
|
|
287
|
+
if (!(customCSS === null || customCSS === void 0 ? void 0 : customCSS.styles)) {
|
|
288
|
+
return { isValid: true, warnings: [] };
|
|
289
|
+
}
|
|
290
|
+
const warnings = (0, CSSConverter_1.validateCSSForNative)(customCSS.styles);
|
|
291
|
+
return { isValid: warnings.length === 0, warnings };
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Get container style for stack/group components
|
|
295
|
+
*/
|
|
296
|
+
static getContainerStyle(layout, size, appearance, containerLayout) {
|
|
297
|
+
const style = {
|
|
298
|
+
...this.getFlexLayout(layout, size),
|
|
299
|
+
...this.getAppearanceStyle(appearance),
|
|
300
|
+
};
|
|
301
|
+
if (containerLayout) {
|
|
302
|
+
// Flex direction - uses canonical 'direction' property
|
|
303
|
+
style.flexDirection = containerLayout.direction === 'horizontal' ? 'row' : 'column';
|
|
304
|
+
// Distribution (justify-content)
|
|
305
|
+
switch (containerLayout.distribution) {
|
|
306
|
+
case 'start':
|
|
307
|
+
style.justifyContent = 'flex-start';
|
|
308
|
+
break;
|
|
309
|
+
case 'center':
|
|
310
|
+
style.justifyContent = 'center';
|
|
311
|
+
break;
|
|
312
|
+
case 'end':
|
|
313
|
+
style.justifyContent = 'flex-end';
|
|
314
|
+
break;
|
|
315
|
+
case 'space-between':
|
|
316
|
+
style.justifyContent = 'space-between';
|
|
317
|
+
break;
|
|
318
|
+
case 'space-around':
|
|
319
|
+
style.justifyContent = 'space-around';
|
|
320
|
+
break;
|
|
321
|
+
case 'space-evenly':
|
|
322
|
+
style.justifyContent = 'space-evenly';
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
// Alignment (align-items)
|
|
326
|
+
switch (containerLayout.alignment) {
|
|
327
|
+
case 'start':
|
|
328
|
+
style.alignItems = 'flex-start';
|
|
329
|
+
break;
|
|
330
|
+
case 'center':
|
|
331
|
+
style.alignItems = 'center';
|
|
332
|
+
break;
|
|
333
|
+
case 'end':
|
|
334
|
+
style.alignItems = 'flex-end';
|
|
335
|
+
break;
|
|
336
|
+
case 'stretch':
|
|
337
|
+
style.alignItems = 'stretch';
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
// Gap
|
|
341
|
+
if (containerLayout.gap !== undefined) {
|
|
342
|
+
style.gap = containerLayout.gap;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return style;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Build a combined ViewStyle for a single rendered component.
|
|
349
|
+
*
|
|
350
|
+
* Composes flex layout + appearance + optional custom CSS, then layers on
|
|
351
|
+
* absolute positioning and z-index when present. This delegates to the
|
|
352
|
+
* existing helpers so runtime behavior matches the per-helper output the
|
|
353
|
+
* renderer previously relied on.
|
|
354
|
+
*/
|
|
355
|
+
static getComponentStyle(layout, appearance, size, _type, _properties, absolutePosition, zIndex, customCSS) {
|
|
356
|
+
let style = {
|
|
357
|
+
...this.getFlexLayout(layout, size),
|
|
358
|
+
...this.getAppearanceStyle(appearance),
|
|
359
|
+
};
|
|
360
|
+
if (customCSS) {
|
|
361
|
+
style = this.applyCustomCSS(style, customCSS).style;
|
|
362
|
+
}
|
|
363
|
+
if (absolutePosition) {
|
|
364
|
+
style.position = 'absolute';
|
|
365
|
+
style.left = absolutePosition.x;
|
|
366
|
+
style.top = absolutePosition.y;
|
|
367
|
+
}
|
|
368
|
+
if (zIndex !== undefined) {
|
|
369
|
+
style.zIndex = zIndex;
|
|
370
|
+
}
|
|
371
|
+
return style;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
exports.LayoutEngine = LayoutEngine;
|
|
375
|
+
/**
|
|
376
|
+
* Normalize size value (exported for external use)
|
|
377
|
+
*/
|
|
378
|
+
LayoutEngine.normalizeSizeValue = normalizeSizeValue;
|
|
379
|
+
// Export for backward compatibility
|
|
380
|
+
exports.ThemeColorResolver = {
|
|
381
|
+
setTheme: (_config) => {
|
|
382
|
+
console.log('[ThemeColorResolver] Phase 5: Colors pre-resolved, theme setup skipped');
|
|
383
|
+
},
|
|
384
|
+
setResolvedColors: (_colors) => { },
|
|
385
|
+
clearTheme: () => { },
|
|
386
|
+
isThemingEnabled: () => false,
|
|
387
|
+
getThemingMode: () => 'disabled',
|
|
388
|
+
// Phase 5: colors are pre-resolved upstream, so this runtime stub performs no
|
|
389
|
+
// variable resolution. resolveVariable returns undefined (caller falls through
|
|
390
|
+
// to its own fallback) and getDefaultVariableColor returns a neutral
|
|
391
|
+
// transparent default to keep the renderer's string-typed color pipeline valid.
|
|
392
|
+
resolveVariable: (_name) => undefined,
|
|
393
|
+
getDefaultVariableColor: (_name) => 'transparent',
|
|
394
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PaywallConfiguration, PaywallComponent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Client-side localization resolver for React Native SDK
|
|
4
|
+
* Resolves localized text based on device locale with fallback to baseLocale
|
|
5
|
+
*/
|
|
6
|
+
export declare class LocalizationResolver {
|
|
7
|
+
private localizations?;
|
|
8
|
+
private baseLocale;
|
|
9
|
+
private selectedLocale;
|
|
10
|
+
constructor(localizations?: Record<string, Record<string, string>>, baseLocale?: string, explicitLocale?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Get the effective locale. Precedence mirrors Android
|
|
13
|
+
* `BillDogConfig.getEffectiveLocale` (BillDogConfig.kt:150-152):
|
|
14
|
+
* runtime locale override > device locale > "en".
|
|
15
|
+
*
|
|
16
|
+
* Public + static so callers (e.g. WebViewPaywall's locale bridge) can
|
|
17
|
+
* resolve the active locale without constructing a resolver.
|
|
18
|
+
*/
|
|
19
|
+
static getEffectiveLocale(): string;
|
|
20
|
+
/** Instance accessor — defers to the canonical static resolver. */
|
|
21
|
+
private getEffectiveLocale;
|
|
22
|
+
/**
|
|
23
|
+
* Returns true when `locale`'s language belongs to a right-to-left
|
|
24
|
+
* script. Matches against the language portion only (e.g. `ar-EG` → `ar`),
|
|
25
|
+
* mirroring Android `PaywallScreen.kt:431-458`.
|
|
26
|
+
*/
|
|
27
|
+
static isRtlLocale(locale: string | null | undefined): boolean;
|
|
28
|
+
/** Detect the device locale from the platform native modules. */
|
|
29
|
+
static detectDeviceLocale(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Set the active locale for resolution
|
|
32
|
+
*/
|
|
33
|
+
setLocale(locale: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get the currently selected locale
|
|
36
|
+
*/
|
|
37
|
+
getSelectedLocale(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Get the base locale (source language)
|
|
40
|
+
*/
|
|
41
|
+
getBaseLocale(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Find the matching locale key using the canonical 4-step matcher.
|
|
44
|
+
* Mirrors Android `LocalizationResolver.findLocaleKey` (LocalizationResolver.kt:50-86)
|
|
45
|
+
* and iOS `LocalizationResolver.findLocaleKey` exactly:
|
|
46
|
+
* 1. exact match
|
|
47
|
+
* 2. case-insensitive match
|
|
48
|
+
* 3. separator-normalized match (en-US ↔ en_US)
|
|
49
|
+
* 4. language-only fallback (en-US → en, or en → first en-* regional)
|
|
50
|
+
*/
|
|
51
|
+
private findLocaleKey;
|
|
52
|
+
/**
|
|
53
|
+
* Check if current locale is the base locale
|
|
54
|
+
*/
|
|
55
|
+
isBaseLocale(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Get available locales from the localization data
|
|
58
|
+
*/
|
|
59
|
+
getAvailableLocales(): Set<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a localization key to its translated value
|
|
62
|
+
* Falls back to defaultValue if translation not found
|
|
63
|
+
*/
|
|
64
|
+
resolve(key: string, defaultValue: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a variable value with localization support
|
|
67
|
+
* Variable keys are prefixed with locale for lookup
|
|
68
|
+
*/
|
|
69
|
+
resolveVariable(variableKey: string, defaultValue: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve all localizable properties in a component.
|
|
72
|
+
*
|
|
73
|
+
* Lookup keys are componentId-prefixed (`<componentId>.<propertyName>`),
|
|
74
|
+
* matching the shape the dashboard `LocalizationPanel` writes and the
|
|
75
|
+
* Android `VariableResolver.resolveComponent` runtime path
|
|
76
|
+
* (VariableResolver.kt:124-156) + iOS `LocalizationResolver.swift:194-198`.
|
|
77
|
+
* Previously this looked up the source string itself as the key, which
|
|
78
|
+
* never matched the dashboard-authored translation maps.
|
|
79
|
+
*/
|
|
80
|
+
resolveComponent(component: PaywallComponent): PaywallComponent;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve all components in a configuration
|
|
83
|
+
*/
|
|
84
|
+
resolveConfiguration(config: PaywallConfiguration): PaywallConfiguration;
|
|
85
|
+
/**
|
|
86
|
+
* Create resolver from PaywallConfiguration
|
|
87
|
+
* Respects global locale override from BillDogConfiguration
|
|
88
|
+
*/
|
|
89
|
+
static fromConfiguration(config: PaywallConfiguration): LocalizationResolver;
|
|
90
|
+
/**
|
|
91
|
+
* Create resolver with device locale auto-detected
|
|
92
|
+
* Respects global locale override from BillDogConfiguration
|
|
93
|
+
*/
|
|
94
|
+
static withDeviceLocale(config: PaywallConfiguration): LocalizationResolver;
|
|
95
|
+
/**
|
|
96
|
+
* Create resolver with specific locale (overrides global config)
|
|
97
|
+
*/
|
|
98
|
+
static withLocale(config: PaywallConfiguration, locale: string): LocalizationResolver;
|
|
99
|
+
}
|