@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,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Multi Choice Grid Component for React Native
|
|
4
|
+
* Checkbox style grid selection (multiple selection)
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.MultiChoiceGridComponent = void 0;
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const react_native_1 = require("react-native");
|
|
43
|
+
const react_native_svg_1 = __importStar(require("react-native-svg"));
|
|
44
|
+
const SIZE_MAP = { sm: 16, md: 20, lg: 24 };
|
|
45
|
+
// Check icon paths
|
|
46
|
+
const CHECK_PATHS = {
|
|
47
|
+
check: 'M20 6L9 17L4 12',
|
|
48
|
+
cross: 'M18 6L6 18M6 6L18 18',
|
|
49
|
+
circle: 'M12 12m-8 0a8 8 0 1 0 16 0a8 8 0 1 0 -16 0',
|
|
50
|
+
};
|
|
51
|
+
const MultiChoiceGridComponent = ({ component, stateManager, isPreviewMode = false, }) => {
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
53
|
+
const props = component.properties || {};
|
|
54
|
+
// Parse options
|
|
55
|
+
const optionsStr = props.options || 'Option 1,Option 2,Option 3,Option 4';
|
|
56
|
+
const options = optionsStr.split(',').map((o) => o.trim()).filter(Boolean);
|
|
57
|
+
const descriptionsStr = props.optionDescriptions || '';
|
|
58
|
+
const descriptions = descriptionsStr.split(',').map((d) => d.trim());
|
|
59
|
+
// Grid settings
|
|
60
|
+
const columns = props.columns || 2;
|
|
61
|
+
const gap = parseFloat(((_a = props.gap) === null || _a === void 0 ? void 0 : _a.value) || props.gap) || 12;
|
|
62
|
+
const minItemHeight = parseFloat(((_b = props.minItemHeight) === null || _b === void 0 ? void 0 : _b.value) || props.minItemHeight) || 80;
|
|
63
|
+
// Selection settings
|
|
64
|
+
const defaultIndicesStr = props.defaultSelectedIndices || '';
|
|
65
|
+
const defaultIndices = defaultIndicesStr
|
|
66
|
+
.split(',')
|
|
67
|
+
.map((s) => parseInt(s.trim(), 10))
|
|
68
|
+
.filter((n) => !isNaN(n));
|
|
69
|
+
const minSelections = props.minSelections || 0;
|
|
70
|
+
const maxSelections = props.maxSelections || 0;
|
|
71
|
+
const disabled = (_c = props.disabled) !== null && _c !== void 0 ? _c : false;
|
|
72
|
+
// State
|
|
73
|
+
const [selectedIndices, setSelectedIndices] = (0, react_1.useState)(defaultIndices);
|
|
74
|
+
// State manager integration
|
|
75
|
+
(0, react_1.useEffect)(() => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
if (!stateManager)
|
|
78
|
+
return;
|
|
79
|
+
const stateId = `element:${component.id}.selectedIndices`;
|
|
80
|
+
(_a = stateManager.registerState) === null || _a === void 0 ? void 0 : _a.call(stateManager, stateId, selectedIndices);
|
|
81
|
+
return (_b = stateManager.subscribeToState) === null || _b === void 0 ? void 0 : _b.call(stateManager, stateId, (value) => {
|
|
82
|
+
if (JSON.stringify(value) !== JSON.stringify(selectedIndices)) {
|
|
83
|
+
setSelectedIndices(value);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}, [component.id, selectedIndices, stateManager]);
|
|
87
|
+
const handleSelect = (index) => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
if (disabled)
|
|
90
|
+
return;
|
|
91
|
+
let newIndices;
|
|
92
|
+
if (selectedIndices.includes(index)) {
|
|
93
|
+
if (minSelections > 0 && selectedIndices.length <= minSelections) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
newIndices = selectedIndices.filter(i => i !== index);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
if (maxSelections > 0 && selectedIndices.length >= maxSelections) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
newIndices = [...selectedIndices, index].sort((a, b) => a - b);
|
|
103
|
+
}
|
|
104
|
+
setSelectedIndices(newIndices);
|
|
105
|
+
(_a = stateManager === null || stateManager === void 0 ? void 0 : stateManager.updateState) === null || _a === void 0 ? void 0 : _a.call(stateManager, `element:${component.id}.selectedIndices`, newIndices);
|
|
106
|
+
(_b = stateManager === null || stateManager === void 0 ? void 0 : stateManager.updateState) === null || _b === void 0 ? void 0 : _b.call(stateManager, `element:${component.id}.selectedValues`, newIndices.map(i => options[i]));
|
|
107
|
+
};
|
|
108
|
+
// Styling
|
|
109
|
+
const showIndicator = (_d = props.showIndicator) !== null && _d !== void 0 ? _d : true;
|
|
110
|
+
const indicatorPosition = props.indicatorPosition || 'top-right';
|
|
111
|
+
const checkIcon = props.checkIcon || 'check';
|
|
112
|
+
const indicatorSize = SIZE_MAP[props.indicatorSize] || SIZE_MAP.md;
|
|
113
|
+
const indicatorColor = props.indicatorColor || '#ffffff';
|
|
114
|
+
const indicatorBackground = props.indicatorBackground || '#007AFF';
|
|
115
|
+
const indicatorBorderColor = props.indicatorBorderColor || '#d1d5db';
|
|
116
|
+
const cardBorderRadius = parseFloat(((_e = props.cardBorderRadius) === null || _e === void 0 ? void 0 : _e.value) || props.cardBorderRadius) || 12;
|
|
117
|
+
const cardBorderColor = props.cardBorderColor || '#e5e7eb';
|
|
118
|
+
const selectedBorderColor = props.selectedBorderColor || '#007AFF';
|
|
119
|
+
const labelFontSize = parseFloat(((_f = props.labelFontSize) === null || _f === void 0 ? void 0 : _f.value) || props.labelFontSize) || 16;
|
|
120
|
+
const labelFontWeight = String(props.labelFontWeight || '500');
|
|
121
|
+
const labelColor = props.labelColor || '#1f2937';
|
|
122
|
+
const selectedLabelColor = props.selectedLabelColor || '#007AFF';
|
|
123
|
+
const descriptionFontSize = parseFloat(((_g = props.descriptionFontSize) === null || _g === void 0 ? void 0 : _g.value) || props.descriptionFontSize) || 12;
|
|
124
|
+
const descriptionColor = props.descriptionColor || '#6b7280';
|
|
125
|
+
// Background color helper
|
|
126
|
+
const getBackgroundColor = (fill) => {
|
|
127
|
+
if (!fill)
|
|
128
|
+
return '#ffffff';
|
|
129
|
+
if (typeof fill === 'string')
|
|
130
|
+
return fill;
|
|
131
|
+
if (fill.type === 'color')
|
|
132
|
+
return fill.color || '#ffffff';
|
|
133
|
+
if (fill.resolvedColor)
|
|
134
|
+
return fill.resolvedColor;
|
|
135
|
+
return '#ffffff';
|
|
136
|
+
};
|
|
137
|
+
const cardBackground = getBackgroundColor(props.cardBackground);
|
|
138
|
+
const selectedCardBackground = getBackgroundColor(props.selectedCardBackground);
|
|
139
|
+
// Indicator position style
|
|
140
|
+
const getIndicatorPositionStyle = () => {
|
|
141
|
+
const base = { position: 'absolute' };
|
|
142
|
+
switch (indicatorPosition) {
|
|
143
|
+
case 'top-left': return { ...base, top: 8, left: 8 };
|
|
144
|
+
case 'top-right': return { ...base, top: 8, right: 8 };
|
|
145
|
+
case 'bottom-left': return { ...base, bottom: 8, left: 8 };
|
|
146
|
+
case 'bottom-right': return { ...base, bottom: 8, right: 8 };
|
|
147
|
+
default: return { ...base, top: 8, right: 8 };
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
// Calculate item width based on columns
|
|
151
|
+
const itemWidth = `${(100 - (columns - 1) * 2) / columns}%`;
|
|
152
|
+
return (<react_native_1.View style={[styles.container, { opacity: disabled ? 0.6 : 1 }]}>
|
|
153
|
+
<react_native_1.View style={[styles.grid, { gap }]}>
|
|
154
|
+
{options.map((option, index) => {
|
|
155
|
+
const isSelected = selectedIndices.includes(index);
|
|
156
|
+
const description = descriptions[index] || '';
|
|
157
|
+
return (<react_native_1.TouchableOpacity key={index} onPress={() => handleSelect(index)} disabled={disabled} activeOpacity={0.7} style={[
|
|
158
|
+
styles.card,
|
|
159
|
+
{
|
|
160
|
+
width: itemWidth,
|
|
161
|
+
minHeight: minItemHeight,
|
|
162
|
+
backgroundColor: isSelected ? selectedCardBackground : cardBackground,
|
|
163
|
+
borderColor: isSelected ? selectedBorderColor : cardBorderColor,
|
|
164
|
+
borderRadius: cardBorderRadius,
|
|
165
|
+
},
|
|
166
|
+
]}>
|
|
167
|
+
{/* Checkbox Indicator */}
|
|
168
|
+
{showIndicator && (<react_native_1.View style={[
|
|
169
|
+
getIndicatorPositionStyle(),
|
|
170
|
+
{
|
|
171
|
+
width: indicatorSize,
|
|
172
|
+
height: indicatorSize,
|
|
173
|
+
borderRadius: 4,
|
|
174
|
+
borderWidth: 2,
|
|
175
|
+
borderColor: isSelected ? indicatorBackground : indicatorBorderColor,
|
|
176
|
+
backgroundColor: isSelected ? indicatorBackground : 'transparent',
|
|
177
|
+
alignItems: 'center',
|
|
178
|
+
justifyContent: 'center',
|
|
179
|
+
},
|
|
180
|
+
]}>
|
|
181
|
+
{isSelected && (<react_native_svg_1.default width={indicatorSize * 0.7} height={indicatorSize * 0.7} viewBox="0 0 24 24" fill="none">
|
|
182
|
+
<react_native_svg_1.Path d={CHECK_PATHS[checkIcon] || CHECK_PATHS.check} stroke={indicatorColor} strokeWidth={3} strokeLinecap="round" strokeLinejoin="round"/>
|
|
183
|
+
</react_native_svg_1.default>)}
|
|
184
|
+
</react_native_1.View>)}
|
|
185
|
+
|
|
186
|
+
{/* Label */}
|
|
187
|
+
<react_native_1.Text style={[
|
|
188
|
+
styles.label,
|
|
189
|
+
{
|
|
190
|
+
fontSize: labelFontSize,
|
|
191
|
+
fontWeight: labelFontWeight,
|
|
192
|
+
color: isSelected ? selectedLabelColor : labelColor,
|
|
193
|
+
},
|
|
194
|
+
]}>
|
|
195
|
+
{option}
|
|
196
|
+
</react_native_1.Text>
|
|
197
|
+
|
|
198
|
+
{/* Description */}
|
|
199
|
+
{description ? (<react_native_1.Text style={[
|
|
200
|
+
styles.description,
|
|
201
|
+
{
|
|
202
|
+
fontSize: descriptionFontSize,
|
|
203
|
+
color: descriptionColor,
|
|
204
|
+
},
|
|
205
|
+
]}>
|
|
206
|
+
{description}
|
|
207
|
+
</react_native_1.Text>) : null}
|
|
208
|
+
</react_native_1.TouchableOpacity>);
|
|
209
|
+
})}
|
|
210
|
+
</react_native_1.View>
|
|
211
|
+
</react_native_1.View>);
|
|
212
|
+
};
|
|
213
|
+
exports.MultiChoiceGridComponent = MultiChoiceGridComponent;
|
|
214
|
+
const styles = react_native_1.StyleSheet.create({
|
|
215
|
+
container: {
|
|
216
|
+
width: '100%',
|
|
217
|
+
},
|
|
218
|
+
grid: {
|
|
219
|
+
flexDirection: 'row',
|
|
220
|
+
flexWrap: 'wrap',
|
|
221
|
+
},
|
|
222
|
+
card: {
|
|
223
|
+
position: 'relative',
|
|
224
|
+
borderWidth: 2,
|
|
225
|
+
padding: 16,
|
|
226
|
+
justifyContent: 'center',
|
|
227
|
+
},
|
|
228
|
+
label: {
|
|
229
|
+
marginTop: 4,
|
|
230
|
+
},
|
|
231
|
+
description: {
|
|
232
|
+
marginTop: 4,
|
|
233
|
+
},
|
|
234
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPSScaleComponent - React Native
|
|
3
|
+
*
|
|
4
|
+
* Net Promoter Score scale with child-based architecture.
|
|
5
|
+
* Renders children with nps-button-* roles, applies selectedAppearance for selected state.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { PaywallComponent } from '../types';
|
|
9
|
+
interface NPSScaleComponentProps {
|
|
10
|
+
component: PaywallComponent;
|
|
11
|
+
stateManager?: any;
|
|
12
|
+
isPreviewMode?: boolean;
|
|
13
|
+
renderChild?: (child: PaywallComponent) => React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const NPSScaleComponent: React.FC<NPSScaleComponentProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* NPSScaleComponent - React Native
|
|
4
|
+
*
|
|
5
|
+
* Net Promoter Score scale with child-based architecture.
|
|
6
|
+
* Renders children with nps-button-* roles, applies selectedAppearance for selected state.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.NPSScaleComponent = void 0;
|
|
43
|
+
const react_1 = __importStar(require("react"));
|
|
44
|
+
const react_native_1 = require("react-native");
|
|
45
|
+
// NPS Categories
|
|
46
|
+
const getNPSCategory = (value, min, max) => {
|
|
47
|
+
const normalizedMax = max - min;
|
|
48
|
+
const normalizedValue = value - min;
|
|
49
|
+
const percentage = normalizedValue / normalizedMax;
|
|
50
|
+
if (percentage <= 0.6)
|
|
51
|
+
return 'detractor';
|
|
52
|
+
if (percentage <= 0.8)
|
|
53
|
+
return 'passive';
|
|
54
|
+
return 'promoter';
|
|
55
|
+
};
|
|
56
|
+
// Extract value from role like "nps-button-5"
|
|
57
|
+
const extractValueFromRole = (role) => {
|
|
58
|
+
if (!role || !role.startsWith('nps-button-'))
|
|
59
|
+
return 0;
|
|
60
|
+
const valueStr = role.replace('nps-button-', '');
|
|
61
|
+
return parseInt(valueStr, 10) || 0;
|
|
62
|
+
};
|
|
63
|
+
const NPSScaleComponent = ({ component, stateManager, isPreviewMode = false, renderChild, }) => {
|
|
64
|
+
var _a, _b, _c;
|
|
65
|
+
const props = component.properties;
|
|
66
|
+
const componentId = component.id;
|
|
67
|
+
// Configuration
|
|
68
|
+
const minValue = (_a = props.minValue) !== null && _a !== void 0 ? _a : 0;
|
|
69
|
+
const maxValue = (_b = props.maxValue) !== null && _b !== void 0 ? _b : 10;
|
|
70
|
+
const defaultValue = (_c = props.defaultValue) !== null && _c !== void 0 ? _c : -1;
|
|
71
|
+
const showLabels = props.showLabels !== false;
|
|
72
|
+
const minLabel = props.minLabel || 'Not at all likely';
|
|
73
|
+
const maxLabel = props.maxLabel || 'Extremely likely';
|
|
74
|
+
const buttonGap = props.buttonGap || 4;
|
|
75
|
+
const [selectedValue, setSelectedValue] = (0, react_1.useState)(defaultValue);
|
|
76
|
+
const [animatedValues] = (0, react_1.useState)(() => Array.from({ length: maxValue - minValue + 1 }, () => new react_native_1.Animated.Value(1)));
|
|
77
|
+
// Get NPS button children sorted by value
|
|
78
|
+
const npsButtonChildren = (0, react_1.useMemo)(() => {
|
|
79
|
+
const children = component.children || [];
|
|
80
|
+
return children
|
|
81
|
+
.filter((child) => { var _a; return (_a = child.role) === null || _a === void 0 ? void 0 : _a.startsWith('nps-button-'); })
|
|
82
|
+
.sort((a, b) => {
|
|
83
|
+
const valueA = extractValueFromRole(a.role);
|
|
84
|
+
const valueB = extractValueFromRole(b.role);
|
|
85
|
+
return valueA - valueB;
|
|
86
|
+
});
|
|
87
|
+
}, [component.children]);
|
|
88
|
+
const hasChildren = npsButtonChildren.length > 0 && renderChild;
|
|
89
|
+
// Update state manager when value changes
|
|
90
|
+
(0, react_1.useEffect)(() => {
|
|
91
|
+
if (stateManager && selectedValue >= minValue) {
|
|
92
|
+
const category = getNPSCategory(selectedValue, minValue, maxValue);
|
|
93
|
+
stateManager.updateState(`element:${componentId}.score`, selectedValue);
|
|
94
|
+
stateManager.updateState(`element:${componentId}.category`, category);
|
|
95
|
+
stateManager.updateState(`element:${componentId}.isValid`, true);
|
|
96
|
+
}
|
|
97
|
+
}, [selectedValue, componentId, minValue, maxValue, stateManager]);
|
|
98
|
+
// Subscribe to external state changes
|
|
99
|
+
(0, react_1.useEffect)(() => {
|
|
100
|
+
if (stateManager) {
|
|
101
|
+
return stateManager.subscribeToState(`element:${componentId}.score`, (value) => {
|
|
102
|
+
if (value !== selectedValue) {
|
|
103
|
+
setSelectedValue(value);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, [componentId, stateManager, selectedValue]);
|
|
108
|
+
// Handle value selection
|
|
109
|
+
const handleSelect = (0, react_1.useCallback)((value, index) => {
|
|
110
|
+
// Animate button
|
|
111
|
+
react_native_1.Animated.sequence([
|
|
112
|
+
react_native_1.Animated.timing(animatedValues[index], {
|
|
113
|
+
toValue: 0.9,
|
|
114
|
+
duration: 50,
|
|
115
|
+
useNativeDriver: true,
|
|
116
|
+
}),
|
|
117
|
+
react_native_1.Animated.timing(animatedValues[index], {
|
|
118
|
+
toValue: 1.1,
|
|
119
|
+
duration: 100,
|
|
120
|
+
useNativeDriver: true,
|
|
121
|
+
}),
|
|
122
|
+
react_native_1.Animated.timing(animatedValues[index], {
|
|
123
|
+
toValue: 1,
|
|
124
|
+
duration: 100,
|
|
125
|
+
useNativeDriver: true,
|
|
126
|
+
}),
|
|
127
|
+
]).start();
|
|
128
|
+
setSelectedValue(value);
|
|
129
|
+
}, [animatedValues]);
|
|
130
|
+
// Apply selectedAppearance to child when selected
|
|
131
|
+
const applySelectedAppearance = (0, react_1.useCallback)((child, isSelected) => {
|
|
132
|
+
if (!isSelected || !child.selectedAppearance) {
|
|
133
|
+
return child;
|
|
134
|
+
}
|
|
135
|
+
// Create a copy with selectedAppearance merged into appearance
|
|
136
|
+
return {
|
|
137
|
+
...child,
|
|
138
|
+
appearance: child.selectedAppearance,
|
|
139
|
+
};
|
|
140
|
+
}, []);
|
|
141
|
+
// Get styling from component.properties for fallback rendering (canonical direct properties)
|
|
142
|
+
const getSelectionStyles = (0, react_1.useCallback)(() => {
|
|
143
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
144
|
+
const componentAppearance = component.appearance || {};
|
|
145
|
+
// Read from component.properties (canonical names per Property Parity Contract)
|
|
146
|
+
const buttonFill = props.buttonFill;
|
|
147
|
+
const selectedFill = props.selectedFill;
|
|
148
|
+
const buttonSize = (_a = props.buttonSize) !== null && _a !== void 0 ? _a : 40;
|
|
149
|
+
const borderRadius = (_c = (_b = componentAppearance.cornerRadius) !== null && _b !== void 0 ? _b : props.borderRadius) !== null && _c !== void 0 ? _c : 8;
|
|
150
|
+
const fontSize = (_d = props.labelFontSize) !== null && _d !== void 0 ? _d : 14;
|
|
151
|
+
// Extract colors from FillValue objects
|
|
152
|
+
const activeBackground = (_f = (_e = selectedFill === null || selectedFill === void 0 ? void 0 : selectedFill.resolvedColor) !== null && _e !== void 0 ? _e : selectedFill === null || selectedFill === void 0 ? void 0 : selectedFill.color) !== null && _f !== void 0 ? _f : '#3B82F6';
|
|
153
|
+
const inactiveBackground = (_m = (_k = (_h = (_g = buttonFill === null || buttonFill === void 0 ? void 0 : buttonFill.resolvedColor) !== null && _g !== void 0 ? _g : buttonFill === null || buttonFill === void 0 ? void 0 : buttonFill.color) !== null && _h !== void 0 ? _h : (_j = componentAppearance.fill) === null || _j === void 0 ? void 0 : _j.resolvedColor) !== null && _k !== void 0 ? _k : (_l = componentAppearance.fill) === null || _l === void 0 ? void 0 : _l.color) !== null && _m !== void 0 ? _m : '#E5E7EB';
|
|
154
|
+
const activeTextColor = (_o = props.selectedTextColor) !== null && _o !== void 0 ? _o : '#FFFFFF';
|
|
155
|
+
const inactiveTextColor = (_p = props.textColor) !== null && _p !== void 0 ? _p : '#6B7280';
|
|
156
|
+
return {
|
|
157
|
+
buttonSize,
|
|
158
|
+
borderRadius,
|
|
159
|
+
fontSize,
|
|
160
|
+
activeBackground,
|
|
161
|
+
inactiveBackground,
|
|
162
|
+
activeTextColor,
|
|
163
|
+
inactiveTextColor,
|
|
164
|
+
};
|
|
165
|
+
}, [component, props]);
|
|
166
|
+
const selectionStyles = getSelectionStyles();
|
|
167
|
+
// Render child-based buttons
|
|
168
|
+
const renderChildBasedButtons = () => {
|
|
169
|
+
return npsButtonChildren.map((child, index) => {
|
|
170
|
+
const value = extractValueFromRole(child.role);
|
|
171
|
+
const isSelected = selectedValue === value;
|
|
172
|
+
return (<react_native_1.TouchableOpacity key={child.id} onPress={() => handleSelect(value, index)} activeOpacity={0.7} style={{ marginHorizontal: buttonGap / 2 }}>
|
|
173
|
+
<react_native_1.Animated.View style={{
|
|
174
|
+
transform: [{ scale: animatedValues[index] }],
|
|
175
|
+
}}>
|
|
176
|
+
{renderChild(applySelectedAppearance(child, isSelected))}
|
|
177
|
+
</react_native_1.Animated.View>
|
|
178
|
+
</react_native_1.TouchableOpacity>);
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
// Render fallback buttons when no children available
|
|
182
|
+
const renderFallbackButtons = () => {
|
|
183
|
+
const values = [];
|
|
184
|
+
for (let i = minValue; i <= maxValue; i++) {
|
|
185
|
+
values.push(i);
|
|
186
|
+
}
|
|
187
|
+
return values.map((value, index) => {
|
|
188
|
+
const isSelected = selectedValue === value;
|
|
189
|
+
const backgroundColor = isSelected
|
|
190
|
+
? selectionStyles.activeBackground
|
|
191
|
+
: selectionStyles.inactiveBackground;
|
|
192
|
+
const textColor = isSelected
|
|
193
|
+
? selectionStyles.activeTextColor
|
|
194
|
+
: selectionStyles.inactiveTextColor;
|
|
195
|
+
return (<react_native_1.TouchableOpacity key={value} onPress={() => handleSelect(value, index)} activeOpacity={0.7} style={{ marginHorizontal: buttonGap / 2 }}>
|
|
196
|
+
<react_native_1.Animated.View style={[
|
|
197
|
+
styles.button,
|
|
198
|
+
{
|
|
199
|
+
width: selectionStyles.buttonSize,
|
|
200
|
+
height: selectionStyles.buttonSize,
|
|
201
|
+
borderRadius: selectionStyles.borderRadius,
|
|
202
|
+
backgroundColor,
|
|
203
|
+
transform: [{ scale: animatedValues[index] }],
|
|
204
|
+
},
|
|
205
|
+
]}>
|
|
206
|
+
<react_native_1.Text style={[
|
|
207
|
+
styles.buttonText,
|
|
208
|
+
{
|
|
209
|
+
fontSize: selectionStyles.fontSize,
|
|
210
|
+
color: textColor,
|
|
211
|
+
fontWeight: isSelected ? '600' : '500',
|
|
212
|
+
}
|
|
213
|
+
]}>
|
|
214
|
+
{value}
|
|
215
|
+
</react_native_1.Text>
|
|
216
|
+
</react_native_1.Animated.View>
|
|
217
|
+
</react_native_1.TouchableOpacity>);
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
return (<react_native_1.View style={styles.container}>
|
|
221
|
+
{/* Scale Buttons */}
|
|
222
|
+
<react_native_1.View style={[styles.scaleContainer, { gap: buttonGap }]}>
|
|
223
|
+
{hasChildren ? renderChildBasedButtons() : renderFallbackButtons()}
|
|
224
|
+
</react_native_1.View>
|
|
225
|
+
|
|
226
|
+
{/* Labels */}
|
|
227
|
+
{showLabels && (<react_native_1.View style={styles.labelsContainer}>
|
|
228
|
+
<react_native_1.Text style={styles.labelText}>{minLabel}</react_native_1.Text>
|
|
229
|
+
<react_native_1.Text style={styles.labelText}>{maxLabel}</react_native_1.Text>
|
|
230
|
+
</react_native_1.View>)}
|
|
231
|
+
</react_native_1.View>);
|
|
232
|
+
};
|
|
233
|
+
exports.NPSScaleComponent = NPSScaleComponent;
|
|
234
|
+
const styles = react_native_1.StyleSheet.create({
|
|
235
|
+
container: {
|
|
236
|
+
width: '100%',
|
|
237
|
+
gap: 16,
|
|
238
|
+
},
|
|
239
|
+
scaleContainer: {
|
|
240
|
+
flexDirection: 'row',
|
|
241
|
+
flexWrap: 'wrap',
|
|
242
|
+
justifyContent: 'center',
|
|
243
|
+
},
|
|
244
|
+
button: {
|
|
245
|
+
alignItems: 'center',
|
|
246
|
+
justifyContent: 'center',
|
|
247
|
+
},
|
|
248
|
+
buttonText: {
|
|
249
|
+
fontWeight: '500',
|
|
250
|
+
},
|
|
251
|
+
labelsContainer: {
|
|
252
|
+
flexDirection: 'row',
|
|
253
|
+
justifyContent: 'space-between',
|
|
254
|
+
paddingHorizontal: 4,
|
|
255
|
+
},
|
|
256
|
+
labelText: {
|
|
257
|
+
fontSize: 12,
|
|
258
|
+
color: '#6B7280',
|
|
259
|
+
},
|
|
260
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NavigationComponent - React Native
|
|
3
|
+
*
|
|
4
|
+
* Multi-screen paywall navigation with state management.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Page stack navigation
|
|
7
|
+
* - State integration for current page tracking
|
|
8
|
+
* - Transition animations (slide, fade, push, none)
|
|
9
|
+
* - Swipe gesture navigation
|
|
10
|
+
* - Forward/back navigation
|
|
11
|
+
* - Entry/exit condition support
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { PaywallComponent } from '../types';
|
|
15
|
+
interface NavigationComponentProps {
|
|
16
|
+
component: PaywallComponent;
|
|
17
|
+
/** Child components to render within the navigation (defaults to component.children) */
|
|
18
|
+
children?: PaywallComponent[];
|
|
19
|
+
stateManager?: any;
|
|
20
|
+
isPreviewMode?: boolean;
|
|
21
|
+
renderComponent?: (component: PaywallComponent) => React.ReactNode;
|
|
22
|
+
/** Alias for renderComponent used by ComponentRenderer */
|
|
23
|
+
renderChild?: (child: PaywallComponent, index?: number) => React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare const NavigationComponent: React.FC<NavigationComponentProps>;
|
|
26
|
+
export {};
|