@sudobility/building_blocks 0.0.154 → 0.0.156
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/dist/components/subscription/index.d.ts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +3 -729
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/subscription/AppPricingPage.d.ts +0 -79
- package/dist/components/subscription/AppSubscriptionsPage.d.ts +0 -101
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/building_blocks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.156",
|
|
4
4
|
"description": "Higher-level shared UI building blocks for Sudobility apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"@sudobility/design": "^1.1.23",
|
|
102
102
|
"@sudobility/devops-components": "^2.0.17",
|
|
103
103
|
"@sudobility/di": "^1.5.46",
|
|
104
|
-
"@sudobility/di_web": "^0.1.
|
|
104
|
+
"@sudobility/di_web": "^0.1.123",
|
|
105
105
|
"@sudobility/entity_client": "^0.0.28",
|
|
106
106
|
"@sudobility/subscription-components": "^1.0.27",
|
|
107
|
-
"@sudobility/subscription_lib": "^0.0.
|
|
107
|
+
"@sudobility/subscription_lib": "^0.0.25",
|
|
108
108
|
"@sudobility/types": "^1.9.58",
|
|
109
109
|
"@tanstack/react-query": "^5.80.0",
|
|
110
110
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview App Pricing Page
|
|
3
|
-
* @description Public pricing page for displaying subscription options.
|
|
4
|
-
*
|
|
5
|
-
* This component uses Section internally for proper page layout.
|
|
6
|
-
* Do NOT wrap this component in a Section when consuming it.
|
|
7
|
-
*
|
|
8
|
-
* Uses subscription_lib hooks directly for all subscription data:
|
|
9
|
-
* - useSubscriptionPeriods: Get available billing periods
|
|
10
|
-
* - useSubscriptionForPeriod: Get packages for selected period
|
|
11
|
-
* - useSubscribable: Determine which packages are enabled
|
|
12
|
-
*/
|
|
13
|
-
import type { AnalyticsTrackingParams } from '../../types';
|
|
14
|
-
/** FAQ item */
|
|
15
|
-
export interface FAQItem {
|
|
16
|
-
question: string;
|
|
17
|
-
answer: string;
|
|
18
|
-
}
|
|
19
|
-
/** All localized labels for the pricing page */
|
|
20
|
-
export interface PricingPageLabels {
|
|
21
|
-
title: string;
|
|
22
|
-
subtitle: string;
|
|
23
|
-
periodYear: string;
|
|
24
|
-
periodMonth: string;
|
|
25
|
-
periodWeek: string;
|
|
26
|
-
billingMonthly: string;
|
|
27
|
-
billingYearly: string;
|
|
28
|
-
freeTierTitle: string;
|
|
29
|
-
freeTierPrice: string;
|
|
30
|
-
freeTierFeatures: string[];
|
|
31
|
-
currentPlanBadge: string;
|
|
32
|
-
mostPopularBadge: string;
|
|
33
|
-
ctaLogIn: string;
|
|
34
|
-
ctaTryFree: string;
|
|
35
|
-
ctaUpgrade: string;
|
|
36
|
-
faqTitle: string;
|
|
37
|
-
}
|
|
38
|
-
/** Formatter functions for dynamic strings */
|
|
39
|
-
export interface PricingPageFormatters {
|
|
40
|
-
/** Format savings badge: "Save 20%" */
|
|
41
|
-
formatSavePercent: (percent: number) => string;
|
|
42
|
-
/** Get features for a product by its identifier */
|
|
43
|
-
getProductFeatures: (productId: string) => string[];
|
|
44
|
-
}
|
|
45
|
-
export interface AppPricingPageProps {
|
|
46
|
-
/** Whether user is authenticated */
|
|
47
|
-
isAuthenticated: boolean;
|
|
48
|
-
/** All localized labels */
|
|
49
|
-
labels: PricingPageLabels;
|
|
50
|
-
/** Formatter functions */
|
|
51
|
-
formatters: PricingPageFormatters;
|
|
52
|
-
/** Called when non-authenticated user clicks on a plan (e.g., redirect to login) */
|
|
53
|
-
onPlanClick: (planIdentifier: string) => void;
|
|
54
|
-
/** Called when user clicks on free plan */
|
|
55
|
-
onFreePlanClick: () => void;
|
|
56
|
-
/** Purchase handler for authenticated users - called with packageId */
|
|
57
|
-
onPurchase?: (packageId: string) => Promise<boolean>;
|
|
58
|
-
/** Called when purchase succeeds */
|
|
59
|
-
onPurchaseSuccess?: () => void;
|
|
60
|
-
/** Called on purchase error */
|
|
61
|
-
onPurchaseError?: (error: Error) => void;
|
|
62
|
-
/** Optional FAQ items */
|
|
63
|
-
faqItems?: FAQItem[];
|
|
64
|
-
/** Optional className for the container */
|
|
65
|
-
className?: string;
|
|
66
|
-
/** Optional analytics tracking callback */
|
|
67
|
-
onTrack?: (params: AnalyticsTrackingParams) => void;
|
|
68
|
-
/** Offer ID for subscription_lib hooks */
|
|
69
|
-
offerId: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Public pricing page for displaying subscription options.
|
|
73
|
-
* Uses subscription_lib hooks directly for all subscription data.
|
|
74
|
-
*
|
|
75
|
-
* - Non-authenticated: Free tile shows "Try it for Free", paid tiles show "Log in to Continue"
|
|
76
|
-
* - Authenticated on free: Free tile shows "Current Plan" badge (no CTA), paid tiles show "Upgrade"
|
|
77
|
-
* - Authenticated with subscription: Current plan shows badge (no CTA), higher tiers show "Upgrade"
|
|
78
|
-
*/
|
|
79
|
-
export declare function AppPricingPage({ isAuthenticated, labels, formatters, onPlanClick, onFreePlanClick, onPurchase, onPurchaseSuccess, onPurchaseError, faqItems, className, onTrack, offerId, }: AppPricingPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview App Subscriptions Page
|
|
3
|
-
* @description Page for managing app subscriptions and viewing rate limits.
|
|
4
|
-
*
|
|
5
|
-
* Uses subscription_lib hooks directly for all subscription data:
|
|
6
|
-
* - useSubscriptionPeriods: Get available billing periods
|
|
7
|
-
* - useSubscriptionForPeriod: Get packages for selected period
|
|
8
|
-
* - useSubscribable: Determine which packages are enabled
|
|
9
|
-
* - useUserSubscription: Get current user's subscription
|
|
10
|
-
*/
|
|
11
|
-
import type { RateLimitsConfigData } from '@sudobility/types';
|
|
12
|
-
import type { AnalyticsTrackingParams } from '../../types';
|
|
13
|
-
/** All localized labels for the subscription page */
|
|
14
|
-
export interface SubscriptionPageLabels {
|
|
15
|
-
title: string;
|
|
16
|
-
errorTitle: string;
|
|
17
|
-
purchaseError: string;
|
|
18
|
-
restoreError: string;
|
|
19
|
-
restoreNoPurchases: string;
|
|
20
|
-
periodYear: string;
|
|
21
|
-
periodMonth: string;
|
|
22
|
-
periodWeek: string;
|
|
23
|
-
billingMonthly: string;
|
|
24
|
-
billingYearly: string;
|
|
25
|
-
unlimited: string;
|
|
26
|
-
unlimitedRequests: string;
|
|
27
|
-
currentStatusLabel: string;
|
|
28
|
-
statusActive: string;
|
|
29
|
-
statusInactive: string;
|
|
30
|
-
statusInactiveMessage: string;
|
|
31
|
-
labelPlan: string;
|
|
32
|
-
labelPremium: string;
|
|
33
|
-
labelExpires: string;
|
|
34
|
-
labelWillRenew: string;
|
|
35
|
-
labelMonthlyUsage: string;
|
|
36
|
-
labelDailyUsage: string;
|
|
37
|
-
yes: string;
|
|
38
|
-
no: string;
|
|
39
|
-
buttonSubscribe: string;
|
|
40
|
-
buttonPurchasing: string;
|
|
41
|
-
buttonUpgrade: string;
|
|
42
|
-
buttonUpgrading: string;
|
|
43
|
-
buttonRestore: string;
|
|
44
|
-
buttonRestoring: string;
|
|
45
|
-
noProducts: string;
|
|
46
|
-
noProductsForPeriod: string;
|
|
47
|
-
freeTierTitle: string;
|
|
48
|
-
freeTierPrice: string;
|
|
49
|
-
freeTierFeatures: string[];
|
|
50
|
-
currentPlanBadge: string;
|
|
51
|
-
}
|
|
52
|
-
/** Formatter functions for dynamic strings */
|
|
53
|
-
export interface SubscriptionPageFormatters {
|
|
54
|
-
/** Format rate limit: "1,000 requests/hour" */
|
|
55
|
-
formatHourlyLimit: (limit: string) => string;
|
|
56
|
-
/** Format rate limit: "10,000 requests/day" */
|
|
57
|
-
formatDailyLimit: (limit: string) => string;
|
|
58
|
-
/** Format rate limit: "100,000 requests/month" */
|
|
59
|
-
formatMonthlyLimit: (limit: string) => string;
|
|
60
|
-
/** Format trial period: "7 days free trial" */
|
|
61
|
-
formatTrialDays: (count: number) => string;
|
|
62
|
-
/** Format trial period: "2 weeks free trial" */
|
|
63
|
-
formatTrialWeeks: (count: number) => string;
|
|
64
|
-
/** Format trial period: "1 month free trial" */
|
|
65
|
-
formatTrialMonths: (count: number) => string;
|
|
66
|
-
/** Format savings badge: "Save 20%" */
|
|
67
|
-
formatSavePercent: (percent: number) => string;
|
|
68
|
-
/** Format intro price note */
|
|
69
|
-
formatIntroNote: (price: string) => string;
|
|
70
|
-
/** Get features for a product by its identifier */
|
|
71
|
-
getProductFeatures: (productId: string) => string[];
|
|
72
|
-
}
|
|
73
|
-
export interface AppSubscriptionsPageProps {
|
|
74
|
-
/** Offer ID for subscription_lib hooks (e.g., "api", "default") */
|
|
75
|
-
offerId: string;
|
|
76
|
-
/** Rate limit configuration (for displaying current usage) */
|
|
77
|
-
rateLimitsConfig?: RateLimitsConfigData | null;
|
|
78
|
-
/** All localized labels */
|
|
79
|
-
labels: SubscriptionPageLabels;
|
|
80
|
-
/** Formatter functions for dynamic strings */
|
|
81
|
-
formatters: SubscriptionPageFormatters;
|
|
82
|
-
/** Purchase handler - called with packageId */
|
|
83
|
-
onPurchase: (packageId: string) => Promise<boolean>;
|
|
84
|
-
/** Restore purchases handler */
|
|
85
|
-
onRestore: () => Promise<boolean>;
|
|
86
|
-
/** Called when purchase succeeds */
|
|
87
|
-
onPurchaseSuccess?: () => void;
|
|
88
|
-
/** Called when restore succeeds */
|
|
89
|
-
onRestoreSuccess?: () => void;
|
|
90
|
-
/** Called on error */
|
|
91
|
-
onError?: (title: string, message: string) => void;
|
|
92
|
-
/** Called on warning */
|
|
93
|
-
onWarning?: (title: string, message: string) => void;
|
|
94
|
-
/** Optional analytics tracking callback */
|
|
95
|
-
onTrack?: (params: AnalyticsTrackingParams) => void;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Page for managing app subscriptions.
|
|
99
|
-
* Uses subscription_lib hooks directly for all subscription data.
|
|
100
|
-
*/
|
|
101
|
-
export declare function AppSubscriptionsPage({ offerId, rateLimitsConfig, labels, formatters, onPurchase, onRestore, onPurchaseSuccess, onRestoreSuccess, onError, onWarning, onTrack, }: AppSubscriptionsPageProps): import("react/jsx-runtime").JSX.Element;
|