@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,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* usePlacement Hook — placement registration with a feature-callback model
|
|
4
|
+
* (API_Calls_Migration P4, Track D).
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the iOS `register` / Android `registerFeature` feature gate:
|
|
7
|
+
* - **non-gated** placement → `onFeatureUnlocked` runs immediately;
|
|
8
|
+
* - **gated** placement → the paywall is presented (via the native bridge)
|
|
9
|
+
* and `onFeatureUnlocked` runs only on an entitlement-granting outcome
|
|
10
|
+
* (already-entitled / purchased / restored). A dismissed/errored outcome
|
|
11
|
+
* does NOT run it.
|
|
12
|
+
*
|
|
13
|
+
* Gating is resolved in JS through the unified `get-wall-for-placement`
|
|
14
|
+
* endpoint (an unknown placement is auto-created server-side — P4 hybrid
|
|
15
|
+
* auto-create). `usePaywall` + `useOfferings` remain the escape-hatch hooks.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.usePlacement = void 0;
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const BillDog_1 = require("../BillDog");
|
|
21
|
+
const ApiClient_1 = require("../utils/ApiClient");
|
|
22
|
+
/** Resolve a placement in JS via `get-wall-for-placement` to learn its gating. */
|
|
23
|
+
async function resolvePlacement(placementId, params) {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25
|
+
try {
|
|
26
|
+
const json = await ApiClient_1.ApiClient.post('get-wall-for-placement', {
|
|
27
|
+
placement_identifier: placementId,
|
|
28
|
+
...(params ? { custom_attributes: params } : {}),
|
|
29
|
+
});
|
|
30
|
+
const data = (_a = json === null || json === void 0 ? void 0 : json.data) !== null && _a !== void 0 ? _a : {};
|
|
31
|
+
if (((_b = data.placement) === null || _b === void 0 ? void 0 : _b.source) === 'sdk_autocreated') {
|
|
32
|
+
console.warn(`[usePlacement] Placement '${placementId}' is unconfigured (auto-created on ` +
|
|
33
|
+
'first sighting). Configure it in the BillDog dashboard — or fix the ' +
|
|
34
|
+
'identifier if this is a typo.');
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
paywallId: (_d = (_c = data.paywall) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null,
|
|
38
|
+
gated: ((_e = data.presentation) === null || _e === void 0 ? void 0 : _e.gated) === true,
|
|
39
|
+
holdout: ((_f = data.presentation) === null || _f === void 0 ? void 0 : _f.holdout) === true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Resolution failed — caller falls back to presenting the paywall.
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const usePlacement = () => {
|
|
48
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
49
|
+
const [lastResult, setLastResult] = (0, react_1.useState)(null);
|
|
50
|
+
const register = (0, react_1.useCallback)(async (placementId, params, handler) => {
|
|
51
|
+
setLoading(true);
|
|
52
|
+
try {
|
|
53
|
+
const result = await BillDog_1.BillDog.register(placementId, params, handler);
|
|
54
|
+
setLastResult(result);
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
setLoading(false);
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
const registerFeature = (0, react_1.useCallback)(async (placementId, onFeatureUnlocked, params) => {
|
|
62
|
+
setLoading(true);
|
|
63
|
+
try {
|
|
64
|
+
const resolved = await resolvePlacement(placementId, params);
|
|
65
|
+
// Non-gated (or nothing to gate with) → unlock immediately.
|
|
66
|
+
if (resolved && (!resolved.gated || !resolved.paywallId)) {
|
|
67
|
+
onFeatureUnlocked();
|
|
68
|
+
const immediate = { type: 'entitled' };
|
|
69
|
+
setLastResult(immediate);
|
|
70
|
+
return immediate;
|
|
71
|
+
}
|
|
72
|
+
// Gated — or resolution failed (fail safe by presenting). Present the
|
|
73
|
+
// paywall via the native bridge; unlock only on an entitlement outcome.
|
|
74
|
+
const result = await BillDog_1.BillDog.register(placementId, params);
|
|
75
|
+
setLastResult(result);
|
|
76
|
+
if (result.type === 'entitled' ||
|
|
77
|
+
result.type === 'purchased' ||
|
|
78
|
+
result.type === 'restored') {
|
|
79
|
+
onFeatureUnlocked();
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
setLoading(false);
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
87
|
+
return { register, registerFeature, loading, lastResult };
|
|
88
|
+
};
|
|
89
|
+
exports.usePlacement = usePlacement;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type SubscriptionUpgradeOptions, type ProrationPreview, type SubscriptionUpgradeResult } from '../utils/subscriptionUpgrade';
|
|
2
|
+
export interface UseSubscriptionOptions {
|
|
3
|
+
/** @deprecated Use BillDogConfiguration.configure({ apiKey }) instead */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UseSubscriptionReturn {
|
|
7
|
+
/** Preview upgrade/downgrade costs before executing */
|
|
8
|
+
previewUpgrade: (newPriceId: string, options?: SubscriptionUpgradeOptions) => Promise<ProrationPreview>;
|
|
9
|
+
/** Upgrade to a higher-tier subscription */
|
|
10
|
+
upgradeSubscription: (newPriceId: string, options?: SubscriptionUpgradeOptions) => Promise<SubscriptionUpgradeResult>;
|
|
11
|
+
/** Downgrade to a lower-tier subscription */
|
|
12
|
+
downgradeSubscription: (newPriceId: string, options?: SubscriptionUpgradeOptions) => Promise<SubscriptionUpgradeResult>;
|
|
13
|
+
/** Whether an operation is in progress */
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
/** Last error that occurred */
|
|
16
|
+
error: Error | null;
|
|
17
|
+
/** Last proration preview */
|
|
18
|
+
preview: ProrationPreview | null;
|
|
19
|
+
/** Last upgrade/downgrade result */
|
|
20
|
+
result: SubscriptionUpgradeResult | null;
|
|
21
|
+
/** Clear error state */
|
|
22
|
+
clearError: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook for managing subscription upgrades and downgrades.
|
|
26
|
+
*
|
|
27
|
+
* Credentials are resolved from `BillDogConfiguration` by default.
|
|
28
|
+
* Pass an `apiKey` override only for backward compatibility.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // After calling BillDogConfiguration.configure({ apiKey: 'bd_...' })
|
|
33
|
+
* const { previewUpgrade, upgradeSubscription } = useSubscription();
|
|
34
|
+
*
|
|
35
|
+
* const preview = await previewUpgrade('price_new_plan', {
|
|
36
|
+
* customerId: 'customer_123',
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useSubscription(options?: UseSubscriptionOptions): UseSubscriptionReturn;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSubscription = useSubscription;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const subscriptionUpgrade_1 = require("../utils/subscriptionUpgrade");
|
|
6
|
+
/**
|
|
7
|
+
* Hook for managing subscription upgrades and downgrades.
|
|
8
|
+
*
|
|
9
|
+
* Credentials are resolved from `BillDogConfiguration` by default.
|
|
10
|
+
* Pass an `apiKey` override only for backward compatibility.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // After calling BillDogConfiguration.configure({ apiKey: 'bd_...' })
|
|
15
|
+
* const { previewUpgrade, upgradeSubscription } = useSubscription();
|
|
16
|
+
*
|
|
17
|
+
* const preview = await previewUpgrade('price_new_plan', {
|
|
18
|
+
* customerId: 'customer_123',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function useSubscription(options = {}) {
|
|
23
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
24
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
25
|
+
const [preview, setPreview] = (0, react_1.useState)(null);
|
|
26
|
+
const [result, setResult] = (0, react_1.useState)(null);
|
|
27
|
+
const clearError = (0, react_1.useCallback)(() => {
|
|
28
|
+
setError(null);
|
|
29
|
+
}, []);
|
|
30
|
+
const handlePreviewUpgrade = (0, react_1.useCallback)(async (newPriceId, upgradeOptions) => {
|
|
31
|
+
setIsLoading(true);
|
|
32
|
+
setError(null);
|
|
33
|
+
try {
|
|
34
|
+
const previewResult = await (0, subscriptionUpgrade_1.previewSubscriptionUpgrade)(options.apiKey, newPriceId, upgradeOptions);
|
|
35
|
+
setPreview(previewResult);
|
|
36
|
+
return previewResult;
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
40
|
+
setError(error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setIsLoading(false);
|
|
45
|
+
}
|
|
46
|
+
}, [options.apiKey]);
|
|
47
|
+
const handleUpgradeSubscription = (0, react_1.useCallback)(async (newPriceId, upgradeOptions) => {
|
|
48
|
+
setIsLoading(true);
|
|
49
|
+
setError(null);
|
|
50
|
+
try {
|
|
51
|
+
const upgradeResult = await (0, subscriptionUpgrade_1.upgradeSubscription)(options.apiKey, newPriceId, upgradeOptions);
|
|
52
|
+
setResult(upgradeResult);
|
|
53
|
+
if (!upgradeResult.success) {
|
|
54
|
+
throw new Error(upgradeResult.errorMessage || 'Upgrade failed');
|
|
55
|
+
}
|
|
56
|
+
return upgradeResult;
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
60
|
+
setError(error);
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
setIsLoading(false);
|
|
65
|
+
}
|
|
66
|
+
}, [options.apiKey]);
|
|
67
|
+
const handleDowngradeSubscription = (0, react_1.useCallback)(async (newPriceId, upgradeOptions) => {
|
|
68
|
+
setIsLoading(true);
|
|
69
|
+
setError(null);
|
|
70
|
+
try {
|
|
71
|
+
const downgradeResult = await (0, subscriptionUpgrade_1.downgradeSubscription)(options.apiKey, newPriceId, upgradeOptions);
|
|
72
|
+
setResult(downgradeResult);
|
|
73
|
+
if (!downgradeResult.success) {
|
|
74
|
+
throw new Error(downgradeResult.errorMessage || 'Downgrade failed');
|
|
75
|
+
}
|
|
76
|
+
return downgradeResult;
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
80
|
+
setError(error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
setIsLoading(false);
|
|
85
|
+
}
|
|
86
|
+
}, [options.apiKey]);
|
|
87
|
+
return {
|
|
88
|
+
previewUpgrade: handlePreviewUpgrade,
|
|
89
|
+
upgradeSubscription: handleUpgradeSubscription,
|
|
90
|
+
downgradeSubscription: handleDowngradeSubscription,
|
|
91
|
+
isLoading,
|
|
92
|
+
error,
|
|
93
|
+
preview,
|
|
94
|
+
result,
|
|
95
|
+
clearError,
|
|
96
|
+
};
|
|
97
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BillDog React Native Paywalls SDK
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { PaywallView } from '@billdog.io/react-native';
|
|
6
|
+
*
|
|
7
|
+
* <PaywallView
|
|
8
|
+
* paywallIdentifier="premium_offer"
|
|
9
|
+
* onButtonPress={(id, action) => console.log('Button pressed', id, action)}
|
|
10
|
+
* />
|
|
11
|
+
*/
|
|
12
|
+
export { PaywallView } from './PaywallView';
|
|
13
|
+
export { ComponentRenderer } from './ComponentRenderer';
|
|
14
|
+
export { PaywallStateManager, paywallStateManager } from './PaywallStateManager';
|
|
15
|
+
export type { StateListener, Unsubscribe } from './PaywallStateManager';
|
|
16
|
+
export { WebViewPaywall } from './WebViewPaywall';
|
|
17
|
+
export type { WebViewPaywallProps } from './WebViewPaywall';
|
|
18
|
+
export { NativePaywallView, isNativePaywallAvailable, } from './NativePaywallView';
|
|
19
|
+
export type { NativePaywallViewProps } from './NativePaywallView';
|
|
20
|
+
export { ProgressLoaderComponent } from './components/ProgressLoaderComponent';
|
|
21
|
+
export { ChartCurveComponent } from './components/ChartCurveComponent';
|
|
22
|
+
export { SingleChoiceGridComponent } from './components/SingleChoiceGridComponent';
|
|
23
|
+
export { MultiChoiceGridComponent } from './components/MultiChoiceGridComponent';
|
|
24
|
+
export { DrawerModalComponent } from './components/DrawerModalComponent';
|
|
25
|
+
export { TimelineComponent } from './components/TimelineComponent';
|
|
26
|
+
export { TextInputComponent } from './components/TextInputComponent';
|
|
27
|
+
export { StarRatingInputComponent } from './components/StarRatingInputComponent';
|
|
28
|
+
export { NPSScaleComponent } from './components/NPSScaleComponent';
|
|
29
|
+
export { OAuthButtonComponent } from './components/OAuthButtonComponent';
|
|
30
|
+
export { ProgressStepperComponent } from './components/ProgressStepperComponent';
|
|
31
|
+
export { ShareCodeComponent } from './components/ShareCodeComponent';
|
|
32
|
+
export { ShareButtonsComponent } from './components/ShareButtonsComponent';
|
|
33
|
+
export { LayoutEngine } from './LayoutEngine';
|
|
34
|
+
export { usePaywall } from './hooks/usePaywall';
|
|
35
|
+
export { useOfferings } from './hooks/useOfferings';
|
|
36
|
+
export { usePlacement } from './hooks/usePlacement';
|
|
37
|
+
export { BillDog } from './BillDog';
|
|
38
|
+
export type { PurchaseController } from './BillDog';
|
|
39
|
+
export type { CustomProduct } from './models/CustomProduct';
|
|
40
|
+
export type { PurchaseResult } from './models/PurchaseResult';
|
|
41
|
+
export type { RestoreResult } from './models/RestoreResult';
|
|
42
|
+
export { BillDogConfiguration, DEFAULT_API_BASE_URL } from './BillDogConfiguration';
|
|
43
|
+
export type { BillDogConfig } from './BillDogConfiguration';
|
|
44
|
+
export { PaywallCache } from './PaywallCache';
|
|
45
|
+
export { AdvancedPaywallCache } from './AdvancedPaywallCache';
|
|
46
|
+
export { detectDeviceCategory, getDeviceInfo, isTablet } from './utils/deviceDetection';
|
|
47
|
+
export { resolveConfiguration, findNearestConfig } from './utils/configurationResolver';
|
|
48
|
+
export { triggerHaptic, isHapticAvailable } from './utils/hapticFeedback';
|
|
49
|
+
export { requestReview, canRequestReview, initializeReviewTiming, recordReviewSession, recordSignificantEvent, shouldRequestReview, } from './review/ReviewManager';
|
|
50
|
+
export { ReviewAnalytics } from './review/ReviewAnalytics';
|
|
51
|
+
export type { ReviewAnalyticsEvent } from './review/ReviewAnalytics';
|
|
52
|
+
export { ReviewTimingManager } from './review/ReviewTimingManager';
|
|
53
|
+
export type { ReviewTimingConfig } from './review/ReviewTimingManager';
|
|
54
|
+
export type { PaywallComponent, PaywallConfiguration, ComponentType, Layout, Appearance, Size, Position, LayoutType, Product, OfferingPackage, } from './types';
|
|
55
|
+
export { VariableResolver } from './VariableResolver';
|
|
56
|
+
export type { DeviceInfo } from './VariableResolver';
|
|
57
|
+
export { LocalizationResolver } from './LocalizationResolver';
|
|
58
|
+
export declare const setLocaleOverride: (locale: string | undefined) => void;
|
|
59
|
+
export declare const getLocaleOverride: () => string | undefined;
|
|
60
|
+
export * from './utils/priceFormatting';
|
|
61
|
+
export { convertCSSToReactNative, validateCSSForNative, angleToGradientPoints, } from './utils/CSSConverter';
|
|
62
|
+
export type { CSSConversionResult, GradientConfig, GradientStop } from './utils/CSSConverter';
|
|
63
|
+
export { GradientView, isGradientSupported, getGradientStyleOrFallback } from './components/GradientView';
|
|
64
|
+
export type { GradientViewProps } from './components/GradientView';
|
|
65
|
+
export type { UseOfferingsOptions, UseOfferingsResult } from './hooks/useOfferings';
|
|
66
|
+
export type { UsePaywallOptions, UsePaywallResult } from './hooks/usePaywall';
|
|
67
|
+
export type { UsePlacementResult } from './hooks/usePlacement';
|
|
68
|
+
export type { AdvancedCacheConfig } from './AdvancedPaywallCache';
|
|
69
|
+
export type { CacheConfig } from './PaywallCache';
|
|
70
|
+
export type { DeviceCategory, DeviceCategoryInfo } from './utils/deviceDetection';
|
|
71
|
+
export type { MultiPaywallConfig } from './utils/configurationResolver';
|
|
72
|
+
export { NotificationScheduler, requestNotificationPermissions, checkNotificationPermissions, scheduleTrialNotification, cancelTrialNotification, getScheduledNotifications, } from './notifications/NotificationScheduler';
|
|
73
|
+
export type { NotificationConfig, Subscription } from './notifications/NotificationScheduler';
|
|
74
|
+
export { useDeviceToken, registerDeviceToken } from './notifications/useDeviceToken';
|
|
75
|
+
export { PurchaseNotificationHandler } from './notifications/PurchaseNotificationHandler';
|
|
76
|
+
export type { PurchaseNotificationConfig, PurchaseDetails } from './notifications/PurchaseNotificationHandler';
|
|
77
|
+
export { requestNotificationPermission, checkNotificationPermission, isNotificationSupported, } from './utils/notificationPermissions';
|
|
78
|
+
export type { NotificationPermissionStatus } from './utils/notificationPermissions';
|
|
79
|
+
export { share, isShareSupported } from './utils/shareSheet';
|
|
80
|
+
export type { ShareData, ShareResult } from './utils/shareSheet';
|
|
81
|
+
export { requestCalendarPermission, checkCalendarPermission, addCalendarEvent, isCalendarSupported, } from './utils/calendarIntegration';
|
|
82
|
+
export type { CalendarEvent, CalendarPermissionStatus, CalendarResult, } from './utils/calendarIntegration';
|
|
83
|
+
export { LiveActivitiesManager, liveActivities } from './notifications/LiveActivitiesManager';
|
|
84
|
+
export { useLiveActivity } from './notifications/useLiveActivity';
|
|
85
|
+
export type { LiveActivityConfig, LiveActivityUpdate } from './notifications/LiveActivitiesManager';
|
|
86
|
+
export type { UseLiveActivityOptions, UseLiveActivityReturn } from './notifications/useLiveActivity';
|
|
87
|
+
export { useSubscription } from './hooks/useSubscription';
|
|
88
|
+
export type { UseSubscriptionOptions, UseSubscriptionReturn } from './hooks/useSubscription';
|
|
89
|
+
export { previewSubscriptionUpgrade, upgradeSubscription, downgradeSubscription, } from './utils/subscriptionUpgrade';
|
|
90
|
+
export type { SubscriptionUpgradeOptions, ProrationPreview, SubscriptionUpgradeResult, ProrationBehavior, BillingCycleAnchor, } from './utils/subscriptionUpgrade';
|
|
91
|
+
export { AnalyticsManager } from './modules/Analytics';
|
|
92
|
+
export type { AnalyticsEvent, RevenueEvent, UserProperties, UserPropertyOperation } from './modules/Analytics';
|
|
93
|
+
export { ABTestManager } from './modules/ABTest';
|
|
94
|
+
export type { ExperimentAssignment } from './modules/ABTest';
|
|
95
|
+
export { SurveyManager } from './modules/Survey';
|
|
96
|
+
export type { Survey, SurveyPage, SurveyQuestion, SurveyChoice, SurveyAnswer, SurveyResponse, SurveyPresentationOptions, } from './modules/Survey';
|
|
97
|
+
export { VirtualCurrencyManager } from './modules/VirtualCurrency';
|
|
98
|
+
export type { VirtualCurrency, VirtualCurrencyTransaction, ExchangeResult, VirtualCurrencyConfig, } from './modules/VirtualCurrency';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BillDog React Native Paywalls SDK
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* import { PaywallView } from '@billdog.io/react-native';
|
|
7
|
+
*
|
|
8
|
+
* <PaywallView
|
|
9
|
+
* paywallIdentifier="premium_offer"
|
|
10
|
+
* onButtonPress={(id, action) => console.log('Button pressed', id, action)}
|
|
11
|
+
* />
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.validateCSSForNative = exports.convertCSSToReactNative = exports.getLocaleOverride = exports.setLocaleOverride = exports.LocalizationResolver = exports.VariableResolver = exports.ReviewTimingManager = exports.ReviewAnalytics = exports.shouldRequestReview = exports.recordSignificantEvent = exports.recordReviewSession = exports.initializeReviewTiming = exports.canRequestReview = exports.requestReview = exports.isHapticAvailable = exports.triggerHaptic = exports.findNearestConfig = exports.resolveConfiguration = exports.isTablet = exports.getDeviceInfo = exports.detectDeviceCategory = exports.AdvancedPaywallCache = exports.PaywallCache = exports.DEFAULT_API_BASE_URL = exports.BillDogConfiguration = exports.BillDog = exports.usePlacement = exports.useOfferings = exports.usePaywall = exports.LayoutEngine = exports.ShareButtonsComponent = exports.ShareCodeComponent = exports.ProgressStepperComponent = exports.OAuthButtonComponent = exports.NPSScaleComponent = exports.StarRatingInputComponent = exports.TextInputComponent = exports.TimelineComponent = exports.DrawerModalComponent = exports.MultiChoiceGridComponent = exports.SingleChoiceGridComponent = exports.ChartCurveComponent = exports.ProgressLoaderComponent = exports.isNativePaywallAvailable = exports.NativePaywallView = exports.WebViewPaywall = exports.paywallStateManager = exports.PaywallStateManager = exports.ComponentRenderer = exports.PaywallView = void 0;
|
|
29
|
+
exports.VirtualCurrencyManager = exports.SurveyManager = exports.ABTestManager = exports.AnalyticsManager = exports.downgradeSubscription = exports.upgradeSubscription = exports.previewSubscriptionUpgrade = exports.useSubscription = exports.useLiveActivity = exports.liveActivities = exports.LiveActivitiesManager = exports.isCalendarSupported = exports.addCalendarEvent = exports.checkCalendarPermission = exports.requestCalendarPermission = exports.isShareSupported = exports.share = exports.isNotificationSupported = exports.checkNotificationPermission = exports.requestNotificationPermission = exports.PurchaseNotificationHandler = exports.registerDeviceToken = exports.useDeviceToken = exports.getScheduledNotifications = exports.cancelTrialNotification = exports.scheduleTrialNotification = exports.checkNotificationPermissions = exports.requestNotificationPermissions = exports.NotificationScheduler = exports.getGradientStyleOrFallback = exports.isGradientSupported = exports.GradientView = exports.angleToGradientPoints = void 0;
|
|
30
|
+
var PaywallView_1 = require("./PaywallView");
|
|
31
|
+
Object.defineProperty(exports, "PaywallView", { enumerable: true, get: function () { return PaywallView_1.PaywallView; } });
|
|
32
|
+
var ComponentRenderer_1 = require("./ComponentRenderer");
|
|
33
|
+
Object.defineProperty(exports, "ComponentRenderer", { enumerable: true, get: function () { return ComponentRenderer_1.ComponentRenderer; } });
|
|
34
|
+
var PaywallStateManager_1 = require("./PaywallStateManager");
|
|
35
|
+
Object.defineProperty(exports, "PaywallStateManager", { enumerable: true, get: function () { return PaywallStateManager_1.PaywallStateManager; } });
|
|
36
|
+
Object.defineProperty(exports, "paywallStateManager", { enumerable: true, get: function () { return PaywallStateManager_1.paywallStateManager; } });
|
|
37
|
+
// Optional WebView-based paywall — alternative to the native PaywallView
|
|
38
|
+
// that loads the unified renderer bundle iOS/Android/Flutter use.
|
|
39
|
+
// Requires react-native-webview peer dep (already listed). See
|
|
40
|
+
// docs/webview-implementation/04-react-native-implementation.md.
|
|
41
|
+
var WebViewPaywall_1 = require("./WebViewPaywall");
|
|
42
|
+
Object.defineProperty(exports, "WebViewPaywall", { enumerable: true, get: function () { return WebViewPaywall_1.WebViewPaywall; } });
|
|
43
|
+
// Option 2 inline path: embeds the NATIVE paywall view via the `BDPaywallView`
|
|
44
|
+
// native component (BillDogPaywallViewManager on iOS/Android).
|
|
45
|
+
var NativePaywallView_1 = require("./NativePaywallView");
|
|
46
|
+
Object.defineProperty(exports, "NativePaywallView", { enumerable: true, get: function () { return NativePaywallView_1.NativePaywallView; } });
|
|
47
|
+
Object.defineProperty(exports, "isNativePaywallAvailable", { enumerable: true, get: function () { return NativePaywallView_1.isNativePaywallAvailable; } });
|
|
48
|
+
var ProgressLoaderComponent_1 = require("./components/ProgressLoaderComponent");
|
|
49
|
+
Object.defineProperty(exports, "ProgressLoaderComponent", { enumerable: true, get: function () { return ProgressLoaderComponent_1.ProgressLoaderComponent; } });
|
|
50
|
+
var ChartCurveComponent_1 = require("./components/ChartCurveComponent");
|
|
51
|
+
Object.defineProperty(exports, "ChartCurveComponent", { enumerable: true, get: function () { return ChartCurveComponent_1.ChartCurveComponent; } });
|
|
52
|
+
var SingleChoiceGridComponent_1 = require("./components/SingleChoiceGridComponent");
|
|
53
|
+
Object.defineProperty(exports, "SingleChoiceGridComponent", { enumerable: true, get: function () { return SingleChoiceGridComponent_1.SingleChoiceGridComponent; } });
|
|
54
|
+
var MultiChoiceGridComponent_1 = require("./components/MultiChoiceGridComponent");
|
|
55
|
+
Object.defineProperty(exports, "MultiChoiceGridComponent", { enumerable: true, get: function () { return MultiChoiceGridComponent_1.MultiChoiceGridComponent; } });
|
|
56
|
+
var DrawerModalComponent_1 = require("./components/DrawerModalComponent");
|
|
57
|
+
Object.defineProperty(exports, "DrawerModalComponent", { enumerable: true, get: function () { return DrawerModalComponent_1.DrawerModalComponent; } });
|
|
58
|
+
var TimelineComponent_1 = require("./components/TimelineComponent");
|
|
59
|
+
Object.defineProperty(exports, "TimelineComponent", { enumerable: true, get: function () { return TimelineComponent_1.TimelineComponent; } });
|
|
60
|
+
var TextInputComponent_1 = require("./components/TextInputComponent");
|
|
61
|
+
Object.defineProperty(exports, "TextInputComponent", { enumerable: true, get: function () { return TextInputComponent_1.TextInputComponent; } });
|
|
62
|
+
var StarRatingInputComponent_1 = require("./components/StarRatingInputComponent");
|
|
63
|
+
Object.defineProperty(exports, "StarRatingInputComponent", { enumerable: true, get: function () { return StarRatingInputComponent_1.StarRatingInputComponent; } });
|
|
64
|
+
var NPSScaleComponent_1 = require("./components/NPSScaleComponent");
|
|
65
|
+
Object.defineProperty(exports, "NPSScaleComponent", { enumerable: true, get: function () { return NPSScaleComponent_1.NPSScaleComponent; } });
|
|
66
|
+
var OAuthButtonComponent_1 = require("./components/OAuthButtonComponent");
|
|
67
|
+
Object.defineProperty(exports, "OAuthButtonComponent", { enumerable: true, get: function () { return OAuthButtonComponent_1.OAuthButtonComponent; } });
|
|
68
|
+
var ProgressStepperComponent_1 = require("./components/ProgressStepperComponent");
|
|
69
|
+
Object.defineProperty(exports, "ProgressStepperComponent", { enumerable: true, get: function () { return ProgressStepperComponent_1.ProgressStepperComponent; } });
|
|
70
|
+
var ShareCodeComponent_1 = require("./components/ShareCodeComponent");
|
|
71
|
+
Object.defineProperty(exports, "ShareCodeComponent", { enumerable: true, get: function () { return ShareCodeComponent_1.ShareCodeComponent; } });
|
|
72
|
+
var ShareButtonsComponent_1 = require("./components/ShareButtonsComponent");
|
|
73
|
+
Object.defineProperty(exports, "ShareButtonsComponent", { enumerable: true, get: function () { return ShareButtonsComponent_1.ShareButtonsComponent; } });
|
|
74
|
+
var LayoutEngine_1 = require("./LayoutEngine");
|
|
75
|
+
Object.defineProperty(exports, "LayoutEngine", { enumerable: true, get: function () { return LayoutEngine_1.LayoutEngine; } });
|
|
76
|
+
var usePaywall_1 = require("./hooks/usePaywall");
|
|
77
|
+
Object.defineProperty(exports, "usePaywall", { enumerable: true, get: function () { return usePaywall_1.usePaywall; } });
|
|
78
|
+
var useOfferings_1 = require("./hooks/useOfferings");
|
|
79
|
+
Object.defineProperty(exports, "useOfferings", { enumerable: true, get: function () { return useOfferings_1.useOfferings; } });
|
|
80
|
+
var usePlacement_1 = require("./hooks/usePlacement");
|
|
81
|
+
Object.defineProperty(exports, "usePlacement", { enumerable: true, get: function () { return usePlacement_1.usePlacement; } });
|
|
82
|
+
// Configuration
|
|
83
|
+
var BillDog_1 = require("./BillDog");
|
|
84
|
+
Object.defineProperty(exports, "BillDog", { enumerable: true, get: function () { return BillDog_1.BillDog; } });
|
|
85
|
+
var BillDogConfiguration_1 = require("./BillDogConfiguration");
|
|
86
|
+
Object.defineProperty(exports, "BillDogConfiguration", { enumerable: true, get: function () { return BillDogConfiguration_1.BillDogConfiguration; } });
|
|
87
|
+
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", { enumerable: true, get: function () { return BillDogConfiguration_1.DEFAULT_API_BASE_URL; } });
|
|
88
|
+
// Export cache classes
|
|
89
|
+
var PaywallCache_1 = require("./PaywallCache");
|
|
90
|
+
Object.defineProperty(exports, "PaywallCache", { enumerable: true, get: function () { return PaywallCache_1.PaywallCache; } });
|
|
91
|
+
var AdvancedPaywallCache_1 = require("./AdvancedPaywallCache");
|
|
92
|
+
Object.defineProperty(exports, "AdvancedPaywallCache", { enumerable: true, get: function () { return AdvancedPaywallCache_1.AdvancedPaywallCache; } });
|
|
93
|
+
// Export device detection and configuration resolver
|
|
94
|
+
var deviceDetection_1 = require("./utils/deviceDetection");
|
|
95
|
+
Object.defineProperty(exports, "detectDeviceCategory", { enumerable: true, get: function () { return deviceDetection_1.detectDeviceCategory; } });
|
|
96
|
+
Object.defineProperty(exports, "getDeviceInfo", { enumerable: true, get: function () { return deviceDetection_1.getDeviceInfo; } });
|
|
97
|
+
Object.defineProperty(exports, "isTablet", { enumerable: true, get: function () { return deviceDetection_1.isTablet; } });
|
|
98
|
+
var configurationResolver_1 = require("./utils/configurationResolver");
|
|
99
|
+
Object.defineProperty(exports, "resolveConfiguration", { enumerable: true, get: function () { return configurationResolver_1.resolveConfiguration; } });
|
|
100
|
+
Object.defineProperty(exports, "findNearestConfig", { enumerable: true, get: function () { return configurationResolver_1.findNearestConfig; } });
|
|
101
|
+
// Export haptic feedback
|
|
102
|
+
var hapticFeedback_1 = require("./utils/hapticFeedback");
|
|
103
|
+
Object.defineProperty(exports, "triggerHaptic", { enumerable: true, get: function () { return hapticFeedback_1.triggerHaptic; } });
|
|
104
|
+
Object.defineProperty(exports, "isHapticAvailable", { enumerable: true, get: function () { return hapticFeedback_1.isHapticAvailable; } });
|
|
105
|
+
// Export review functionality
|
|
106
|
+
var ReviewManager_1 = require("./review/ReviewManager");
|
|
107
|
+
Object.defineProperty(exports, "requestReview", { enumerable: true, get: function () { return ReviewManager_1.requestReview; } });
|
|
108
|
+
Object.defineProperty(exports, "canRequestReview", { enumerable: true, get: function () { return ReviewManager_1.canRequestReview; } });
|
|
109
|
+
Object.defineProperty(exports, "initializeReviewTiming", { enumerable: true, get: function () { return ReviewManager_1.initializeReviewTiming; } });
|
|
110
|
+
Object.defineProperty(exports, "recordReviewSession", { enumerable: true, get: function () { return ReviewManager_1.recordReviewSession; } });
|
|
111
|
+
Object.defineProperty(exports, "recordSignificantEvent", { enumerable: true, get: function () { return ReviewManager_1.recordSignificantEvent; } });
|
|
112
|
+
Object.defineProperty(exports, "shouldRequestReview", { enumerable: true, get: function () { return ReviewManager_1.shouldRequestReview; } });
|
|
113
|
+
var ReviewAnalytics_1 = require("./review/ReviewAnalytics");
|
|
114
|
+
Object.defineProperty(exports, "ReviewAnalytics", { enumerable: true, get: function () { return ReviewAnalytics_1.ReviewAnalytics; } });
|
|
115
|
+
var ReviewTimingManager_1 = require("./review/ReviewTimingManager");
|
|
116
|
+
Object.defineProperty(exports, "ReviewTimingManager", { enumerable: true, get: function () { return ReviewTimingManager_1.ReviewTimingManager; } });
|
|
117
|
+
// Export Variable and Localization Resolvers
|
|
118
|
+
var VariableResolver_1 = require("./VariableResolver");
|
|
119
|
+
Object.defineProperty(exports, "VariableResolver", { enumerable: true, get: function () { return VariableResolver_1.VariableResolver; } });
|
|
120
|
+
var LocalizationResolver_1 = require("./LocalizationResolver");
|
|
121
|
+
Object.defineProperty(exports, "LocalizationResolver", { enumerable: true, get: function () { return LocalizationResolver_1.LocalizationResolver; } });
|
|
122
|
+
// Re-export locale override API for convenience
|
|
123
|
+
const setLocaleOverride = (locale) => {
|
|
124
|
+
BillDogConfiguration_2.BillDogConfiguration.setLocaleOverride(locale);
|
|
125
|
+
};
|
|
126
|
+
exports.setLocaleOverride = setLocaleOverride;
|
|
127
|
+
const getLocaleOverride = () => {
|
|
128
|
+
return BillDogConfiguration_2.BillDogConfiguration.getLocaleOverride();
|
|
129
|
+
};
|
|
130
|
+
exports.getLocaleOverride = getLocaleOverride;
|
|
131
|
+
// Import for re-export
|
|
132
|
+
const BillDogConfiguration_2 = require("./BillDogConfiguration");
|
|
133
|
+
__exportStar(require("./utils/priceFormatting"), exports);
|
|
134
|
+
// Export CSS conversion and gradient utilities
|
|
135
|
+
var CSSConverter_1 = require("./utils/CSSConverter");
|
|
136
|
+
Object.defineProperty(exports, "convertCSSToReactNative", { enumerable: true, get: function () { return CSSConverter_1.convertCSSToReactNative; } });
|
|
137
|
+
Object.defineProperty(exports, "validateCSSForNative", { enumerable: true, get: function () { return CSSConverter_1.validateCSSForNative; } });
|
|
138
|
+
Object.defineProperty(exports, "angleToGradientPoints", { enumerable: true, get: function () { return CSSConverter_1.angleToGradientPoints; } });
|
|
139
|
+
// Export GradientView component
|
|
140
|
+
var GradientView_1 = require("./components/GradientView");
|
|
141
|
+
Object.defineProperty(exports, "GradientView", { enumerable: true, get: function () { return GradientView_1.GradientView; } });
|
|
142
|
+
Object.defineProperty(exports, "isGradientSupported", { enumerable: true, get: function () { return GradientView_1.isGradientSupported; } });
|
|
143
|
+
Object.defineProperty(exports, "getGradientStyleOrFallback", { enumerable: true, get: function () { return GradientView_1.getGradientStyleOrFallback; } });
|
|
144
|
+
// Notification utilities
|
|
145
|
+
var NotificationScheduler_1 = require("./notifications/NotificationScheduler");
|
|
146
|
+
Object.defineProperty(exports, "NotificationScheduler", { enumerable: true, get: function () { return NotificationScheduler_1.NotificationScheduler; } });
|
|
147
|
+
Object.defineProperty(exports, "requestNotificationPermissions", { enumerable: true, get: function () { return NotificationScheduler_1.requestNotificationPermissions; } });
|
|
148
|
+
Object.defineProperty(exports, "checkNotificationPermissions", { enumerable: true, get: function () { return NotificationScheduler_1.checkNotificationPermissions; } });
|
|
149
|
+
Object.defineProperty(exports, "scheduleTrialNotification", { enumerable: true, get: function () { return NotificationScheduler_1.scheduleTrialNotification; } });
|
|
150
|
+
Object.defineProperty(exports, "cancelTrialNotification", { enumerable: true, get: function () { return NotificationScheduler_1.cancelTrialNotification; } });
|
|
151
|
+
Object.defineProperty(exports, "getScheduledNotifications", { enumerable: true, get: function () { return NotificationScheduler_1.getScheduledNotifications; } });
|
|
152
|
+
var useDeviceToken_1 = require("./notifications/useDeviceToken");
|
|
153
|
+
Object.defineProperty(exports, "useDeviceToken", { enumerable: true, get: function () { return useDeviceToken_1.useDeviceToken; } });
|
|
154
|
+
Object.defineProperty(exports, "registerDeviceToken", { enumerable: true, get: function () { return useDeviceToken_1.registerDeviceToken; } });
|
|
155
|
+
var PurchaseNotificationHandler_1 = require("./notifications/PurchaseNotificationHandler");
|
|
156
|
+
Object.defineProperty(exports, "PurchaseNotificationHandler", { enumerable: true, get: function () { return PurchaseNotificationHandler_1.PurchaseNotificationHandler; } });
|
|
157
|
+
var notificationPermissions_1 = require("./utils/notificationPermissions");
|
|
158
|
+
Object.defineProperty(exports, "requestNotificationPermission", { enumerable: true, get: function () { return notificationPermissions_1.requestNotificationPermission; } });
|
|
159
|
+
Object.defineProperty(exports, "checkNotificationPermission", { enumerable: true, get: function () { return notificationPermissions_1.checkNotificationPermission; } });
|
|
160
|
+
Object.defineProperty(exports, "isNotificationSupported", { enumerable: true, get: function () { return notificationPermissions_1.isNotificationSupported; } });
|
|
161
|
+
// Export share sheet utilities
|
|
162
|
+
var shareSheet_1 = require("./utils/shareSheet");
|
|
163
|
+
Object.defineProperty(exports, "share", { enumerable: true, get: function () { return shareSheet_1.share; } });
|
|
164
|
+
Object.defineProperty(exports, "isShareSupported", { enumerable: true, get: function () { return shareSheet_1.isShareSupported; } });
|
|
165
|
+
// Export calendar integration utilities
|
|
166
|
+
var calendarIntegration_1 = require("./utils/calendarIntegration");
|
|
167
|
+
Object.defineProperty(exports, "requestCalendarPermission", { enumerable: true, get: function () { return calendarIntegration_1.requestCalendarPermission; } });
|
|
168
|
+
Object.defineProperty(exports, "checkCalendarPermission", { enumerable: true, get: function () { return calendarIntegration_1.checkCalendarPermission; } });
|
|
169
|
+
Object.defineProperty(exports, "addCalendarEvent", { enumerable: true, get: function () { return calendarIntegration_1.addCalendarEvent; } });
|
|
170
|
+
Object.defineProperty(exports, "isCalendarSupported", { enumerable: true, get: function () { return calendarIntegration_1.isCalendarSupported; } });
|
|
171
|
+
// Export Live Activities (iOS 16.1+)
|
|
172
|
+
var LiveActivitiesManager_1 = require("./notifications/LiveActivitiesManager");
|
|
173
|
+
Object.defineProperty(exports, "LiveActivitiesManager", { enumerable: true, get: function () { return LiveActivitiesManager_1.LiveActivitiesManager; } });
|
|
174
|
+
Object.defineProperty(exports, "liveActivities", { enumerable: true, get: function () { return LiveActivitiesManager_1.liveActivities; } });
|
|
175
|
+
var useLiveActivity_1 = require("./notifications/useLiveActivity");
|
|
176
|
+
Object.defineProperty(exports, "useLiveActivity", { enumerable: true, get: function () { return useLiveActivity_1.useLiveActivity; } });
|
|
177
|
+
// Export subscription upgrade utilities
|
|
178
|
+
var useSubscription_1 = require("./hooks/useSubscription");
|
|
179
|
+
Object.defineProperty(exports, "useSubscription", { enumerable: true, get: function () { return useSubscription_1.useSubscription; } });
|
|
180
|
+
var subscriptionUpgrade_1 = require("./utils/subscriptionUpgrade");
|
|
181
|
+
Object.defineProperty(exports, "previewSubscriptionUpgrade", { enumerable: true, get: function () { return subscriptionUpgrade_1.previewSubscriptionUpgrade; } });
|
|
182
|
+
Object.defineProperty(exports, "upgradeSubscription", { enumerable: true, get: function () { return subscriptionUpgrade_1.upgradeSubscription; } });
|
|
183
|
+
Object.defineProperty(exports, "downgradeSubscription", { enumerable: true, get: function () { return subscriptionUpgrade_1.downgradeSubscription; } });
|
|
184
|
+
// Modules — Analytics, A/B Testing, Survey, Virtual Currency
|
|
185
|
+
var Analytics_1 = require("./modules/Analytics");
|
|
186
|
+
Object.defineProperty(exports, "AnalyticsManager", { enumerable: true, get: function () { return Analytics_1.AnalyticsManager; } });
|
|
187
|
+
var ABTest_1 = require("./modules/ABTest");
|
|
188
|
+
Object.defineProperty(exports, "ABTestManager", { enumerable: true, get: function () { return ABTest_1.ABTestManager; } });
|
|
189
|
+
var Survey_1 = require("./modules/Survey");
|
|
190
|
+
Object.defineProperty(exports, "SurveyManager", { enumerable: true, get: function () { return Survey_1.SurveyManager; } });
|
|
191
|
+
var VirtualCurrency_1 = require("./modules/VirtualCurrency");
|
|
192
|
+
Object.defineProperty(exports, "VirtualCurrencyManager", { enumerable: true, get: function () { return VirtualCurrency_1.VirtualCurrencyManager; } });
|
|
193
|
+
// Internal components are rendered by ComponentRenderer and intentionally NOT exported:
|
|
194
|
+
// AccoladeCpsComponent, AccordionComponent, AnimatedWrapper, CarouselComponent,
|
|
195
|
+
// CheckboxComponent, ConfettiComponent, CountdownComponent, DelayedXComponent,
|
|
196
|
+
// HorizontalProductsComponent, NavigationComponent, SegmentedPickerComponent,
|
|
197
|
+
// SliderComponent, StickerCompositeComponent, TabsComponent, ToggleComponent,
|
|
198
|
+
// VerticalProductsComponent
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BillDogError — canonical typed error model (RN mirror).
|
|
3
|
+
*
|
|
4
|
+
* Spec: PUR-200, PUR-201, PUR-202 (.lovable/purchase-conformance-spec.md)
|
|
5
|
+
* Standard: mem://architecture/purchase-authoritative-standard
|
|
6
|
+
*
|
|
7
|
+
* Discriminated union; raw strings are NEVER surfaced across the public
|
|
8
|
+
* boundary. `category` is stable for analytics / logs.
|
|
9
|
+
*/
|
|
10
|
+
export type BillDogError = {
|
|
11
|
+
category: 'network';
|
|
12
|
+
message: string;
|
|
13
|
+
} | {
|
|
14
|
+
category: 'store';
|
|
15
|
+
message: string;
|
|
16
|
+
code?: number;
|
|
17
|
+
} | {
|
|
18
|
+
category: 'storeUnavailable';
|
|
19
|
+
message: string;
|
|
20
|
+
} | {
|
|
21
|
+
category: 'configuration';
|
|
22
|
+
message: string;
|
|
23
|
+
} | {
|
|
24
|
+
category: 'productNotFound';
|
|
25
|
+
message: string;
|
|
26
|
+
productId: string;
|
|
27
|
+
} | {
|
|
28
|
+
category: 'receiptValidation';
|
|
29
|
+
message: string;
|
|
30
|
+
} | {
|
|
31
|
+
category: 'userCancelled';
|
|
32
|
+
message: string;
|
|
33
|
+
} | {
|
|
34
|
+
category: 'unknown';
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* PUR-262: SDK-wide log levels. Canonical 5-level set, parity with iOS/Android.
|
|
39
|
+
*/
|
|
40
|
+
export type BillDogLogLevel = 'verbose' | 'debug' | 'info' | 'warn' | 'error';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BillDogError — canonical typed error model (RN mirror).
|
|
4
|
+
*
|
|
5
|
+
* Spec: PUR-200, PUR-201, PUR-202 (.lovable/purchase-conformance-spec.md)
|
|
6
|
+
* Standard: mem://architecture/purchase-authoritative-standard
|
|
7
|
+
*
|
|
8
|
+
* Discriminated union; raw strings are NEVER surfaced across the public
|
|
9
|
+
* boundary. `category` is stable for analytics / logs.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch policy for CustomerInfo — canonical 4 cases (PUR-140).
|
|
3
|
+
*
|
|
4
|
+
* Spec: `.lovable/purchase-conformance-spec.md`
|
|
5
|
+
* Default: `CACHED_OR_FETCHED` (PUR-141).
|
|
6
|
+
*/
|
|
7
|
+
export type CacheFetchPolicy = 'FROM_CACHE_ONLY' | 'FETCH_CURRENT' | 'CACHED_OR_FETCHED' | 'NOT_STALE_CACHED_OR_CURRENT';
|
|
8
|
+
export declare const DEFAULT_CACHE_FETCH_POLICY: CacheFetchPolicy;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CustomProduct — Superwall-style non-StoreKit / non-Play product.
|
|
3
|
+
*
|
|
4
|
+
* Spec: PUR-363, PUR-364
|
|
5
|
+
*
|
|
6
|
+
* Used to describe products that don't live in the App Store or Play Console
|
|
7
|
+
* (Stripe SKUs, Paddle plans, in-house entitlements). Routing is **only**
|
|
8
|
+
* dispatched through a host-provided PurchaseController; the bundled internal
|
|
9
|
+
* controller will reject custom products.
|
|
10
|
+
*
|
|
11
|
+
* Field names are kept identical to the native iOS (CustomProduct.swift) and
|
|
12
|
+
* Android (CustomProduct.kt) models so the contract is the same across SDKs.
|
|
13
|
+
*/
|
|
14
|
+
export interface CustomProduct {
|
|
15
|
+
/** Stable BillDog-side identifier for this product. */
|
|
16
|
+
id: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
/** Localized, ready-to-render price, e.g. "$89.99". */
|
|
19
|
+
priceString: string;
|
|
20
|
+
/** Numeric price in `currency`. */
|
|
21
|
+
price: number;
|
|
22
|
+
/** ISO 4217 currency code, e.g. "USD". */
|
|
23
|
+
currency: string;
|
|
24
|
+
/** External billing provider, e.g. "stripe", "paddle", "in_house". */
|
|
25
|
+
provider: string;
|
|
26
|
+
/** The id your PurchaseController charges (e.g. a Stripe price id). */
|
|
27
|
+
providerProductId: string;
|
|
28
|
+
/** Optional ISO 8601 duration (e.g. "P1M", "P1Y") for subscription products. */
|
|
29
|
+
period?: string;
|
|
30
|
+
/** Free-form metadata forwarded to your PurchaseController. */
|
|
31
|
+
metadata?: Record<string, string>;
|
|
32
|
+
}
|