@sudobility/building_blocks 0.0.16 → 0.0.18
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/index.d.ts +2 -0
- package/dist/components/pages/app-privacy-policy-page.d.ts +137 -0
- package/dist/components/pages/app-sitemap-page.d.ts +116 -0
- package/dist/components/pages/app-terms-of-service-page.d.ts +107 -0
- package/dist/components/pages/index.d.ts +6 -0
- package/dist/components/subscription/AppPricingPage.d.ts +86 -0
- package/dist/components/subscription/AppSubscriptionsPage.d.ts +114 -0
- package/dist/components/subscription/index.d.ts +4 -0
- package/dist/index.js +4022 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React, { type ReactNode, type ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a content section with a list
|
|
4
|
+
*/
|
|
5
|
+
export interface PrivacySectionWithList {
|
|
6
|
+
/** Section title */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Optional description before the list */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** List items */
|
|
11
|
+
items: string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for a content section with paragraph text
|
|
15
|
+
*/
|
|
16
|
+
export interface PrivacySectionWithContent {
|
|
17
|
+
/** Section title */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Paragraph content */
|
|
20
|
+
content: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for a subsection (h3 level)
|
|
24
|
+
*/
|
|
25
|
+
export interface PrivacySubsection {
|
|
26
|
+
/** Subsection title */
|
|
27
|
+
title: string;
|
|
28
|
+
/** List items */
|
|
29
|
+
items: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Contact information configuration
|
|
33
|
+
*/
|
|
34
|
+
export interface PrivacyContactInfo {
|
|
35
|
+
/** Email label (e.g., "Email:") */
|
|
36
|
+
emailLabel: string;
|
|
37
|
+
/** Email address */
|
|
38
|
+
email: string;
|
|
39
|
+
/** Website label (e.g., "Website:") */
|
|
40
|
+
websiteLabel: string;
|
|
41
|
+
/** Website URL */
|
|
42
|
+
websiteUrl: string;
|
|
43
|
+
/** Data Protection Officer label */
|
|
44
|
+
dpoLabel: string;
|
|
45
|
+
/** DPO email */
|
|
46
|
+
dpoEmail: string;
|
|
47
|
+
/** GDPR section title */
|
|
48
|
+
gdprTitle: string;
|
|
49
|
+
/** GDPR section content */
|
|
50
|
+
gdprContent: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* All text content for the privacy policy page
|
|
54
|
+
*/
|
|
55
|
+
export interface PrivacyPolicyPageText {
|
|
56
|
+
/** Page heading */
|
|
57
|
+
heading: string;
|
|
58
|
+
/** Last updated label */
|
|
59
|
+
lastUpdatedLabel: string;
|
|
60
|
+
/** Introduction section */
|
|
61
|
+
introduction: PrivacySectionWithContent;
|
|
62
|
+
/** Information We Collect section */
|
|
63
|
+
informationWeCollect: {
|
|
64
|
+
title: string;
|
|
65
|
+
youProvide: PrivacySubsection;
|
|
66
|
+
automatic: PrivacySubsection;
|
|
67
|
+
};
|
|
68
|
+
/** How We Use Your Information section */
|
|
69
|
+
howWeUse: PrivacySectionWithList;
|
|
70
|
+
/** Information Sharing section */
|
|
71
|
+
informationSharing: PrivacySectionWithList;
|
|
72
|
+
/** Data Security section */
|
|
73
|
+
dataSecurity: PrivacySectionWithList;
|
|
74
|
+
/** Data Retention section */
|
|
75
|
+
dataRetention: PrivacySectionWithContent;
|
|
76
|
+
/** Your Privacy Rights section */
|
|
77
|
+
privacyRights: PrivacySectionWithList;
|
|
78
|
+
/** Web3 Considerations section (optional) */
|
|
79
|
+
web3Considerations?: PrivacySectionWithList;
|
|
80
|
+
/** International Transfers section */
|
|
81
|
+
internationalTransfers: PrivacySectionWithContent;
|
|
82
|
+
/** Children's Privacy section */
|
|
83
|
+
childrensPrivacy: PrivacySectionWithContent;
|
|
84
|
+
/** Cookies section */
|
|
85
|
+
cookies: PrivacySectionWithContent;
|
|
86
|
+
/** Changes to Policy section */
|
|
87
|
+
changes: PrivacySectionWithContent;
|
|
88
|
+
/** Contact section */
|
|
89
|
+
contact: {
|
|
90
|
+
title: string;
|
|
91
|
+
description: string;
|
|
92
|
+
info: PrivacyContactInfo;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Props for AppPrivacyPolicyPage component
|
|
97
|
+
*/
|
|
98
|
+
export interface AppPrivacyPolicyPageProps {
|
|
99
|
+
/** All text content (must be provided by consumer) */
|
|
100
|
+
text: PrivacyPolicyPageText;
|
|
101
|
+
/** Current date for "last updated" display */
|
|
102
|
+
lastUpdatedDate?: string;
|
|
103
|
+
/** Optional wrapper component for the page layout */
|
|
104
|
+
PageWrapper?: ComponentType<{
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
}>;
|
|
107
|
+
/** Optional className for the container */
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* AppPrivacyPolicyPage - A reusable privacy policy page component
|
|
112
|
+
*
|
|
113
|
+
* Displays a comprehensive privacy policy with:
|
|
114
|
+
* - Standard legal sections
|
|
115
|
+
* - Optional Web3-specific considerations
|
|
116
|
+
* - Contact information with GDPR notice
|
|
117
|
+
*
|
|
118
|
+
* All text content must be provided by the consumer app.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* <AppPrivacyPolicyPage
|
|
123
|
+
* text={{
|
|
124
|
+
* heading: "Privacy Policy",
|
|
125
|
+
* lastUpdatedLabel: "Last updated",
|
|
126
|
+
* introduction: {
|
|
127
|
+
* title: "Introduction",
|
|
128
|
+
* content: "We respect your privacy..."
|
|
129
|
+
* },
|
|
130
|
+
* // ... other sections
|
|
131
|
+
* }}
|
|
132
|
+
* lastUpdatedDate="January 1, 2025"
|
|
133
|
+
* />
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare const AppPrivacyPolicyPage: React.FC<AppPrivacyPolicyPageProps>;
|
|
137
|
+
export default AppPrivacyPolicyPage;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React, { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
import type { LinkComponentProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a single sitemap link
|
|
5
|
+
*/
|
|
6
|
+
export interface SitemapLink {
|
|
7
|
+
/** URL path */
|
|
8
|
+
path: string;
|
|
9
|
+
/** Display label */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional description */
|
|
12
|
+
description?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for a sitemap section
|
|
16
|
+
*/
|
|
17
|
+
export interface SitemapSection {
|
|
18
|
+
/** Section title */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Section icon type (optional) */
|
|
21
|
+
icon?: 'home' | 'document' | 'envelope' | 'cog' | 'language';
|
|
22
|
+
/** Links in this section */
|
|
23
|
+
links: SitemapLink[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for a language option
|
|
27
|
+
*/
|
|
28
|
+
export interface LanguageOption {
|
|
29
|
+
/** Language code (e.g., 'en', 'es') */
|
|
30
|
+
code: string;
|
|
31
|
+
/** Display name */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Flag emoji */
|
|
34
|
+
flag: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for quick action buttons
|
|
38
|
+
*/
|
|
39
|
+
export interface QuickLink {
|
|
40
|
+
/** URL path */
|
|
41
|
+
path: string;
|
|
42
|
+
/** Display label */
|
|
43
|
+
label: string;
|
|
44
|
+
/** Button variant */
|
|
45
|
+
variant: 'primary' | 'secondary' | 'outline';
|
|
46
|
+
/** Optional icon */
|
|
47
|
+
icon?: 'envelope' | 'document';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Text content for the sitemap page
|
|
51
|
+
*/
|
|
52
|
+
export interface SitemapPageText {
|
|
53
|
+
/** Page title */
|
|
54
|
+
title: string;
|
|
55
|
+
/** Page subtitle */
|
|
56
|
+
subtitle: string;
|
|
57
|
+
/** Languages section title */
|
|
58
|
+
languagesSectionTitle: string;
|
|
59
|
+
/** Languages section description */
|
|
60
|
+
languagesDescription: string;
|
|
61
|
+
/** Quick links section title */
|
|
62
|
+
quickLinksTitle: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Props for AppSitemapPage component
|
|
66
|
+
*/
|
|
67
|
+
export interface AppSitemapPageProps {
|
|
68
|
+
/** All text content (must be provided by consumer) */
|
|
69
|
+
text: SitemapPageText;
|
|
70
|
+
/** Sitemap sections */
|
|
71
|
+
sections: SitemapSection[];
|
|
72
|
+
/** Available languages */
|
|
73
|
+
languages: LanguageOption[];
|
|
74
|
+
/** Quick action links */
|
|
75
|
+
quickLinks?: QuickLink[];
|
|
76
|
+
/** Custom Link component for navigation */
|
|
77
|
+
LinkComponent: ComponentType<LinkComponentProps & {
|
|
78
|
+
language?: string;
|
|
79
|
+
}>;
|
|
80
|
+
/** Optional wrapper component for the page layout */
|
|
81
|
+
PageWrapper?: ComponentType<{
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
}>;
|
|
84
|
+
/** Optional className for the container */
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* AppSitemapPage - A reusable sitemap page component
|
|
89
|
+
*
|
|
90
|
+
* Displays a comprehensive sitemap with:
|
|
91
|
+
* - Language selector
|
|
92
|
+
* - Organized sections with links
|
|
93
|
+
* - Quick action buttons
|
|
94
|
+
*
|
|
95
|
+
* All text content must be provided by the consumer app.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <AppSitemapPage
|
|
100
|
+
* text={{
|
|
101
|
+
* title: "Sitemap",
|
|
102
|
+
* subtitle: "Explore all pages",
|
|
103
|
+
* languagesSectionTitle: "Languages",
|
|
104
|
+
* languagesDescription: "Available in multiple languages",
|
|
105
|
+
* quickLinksTitle: "Quick Links"
|
|
106
|
+
* }}
|
|
107
|
+
* sections={[
|
|
108
|
+
* { title: "Main", icon: "home", links: [{ path: "/", label: "Home" }] }
|
|
109
|
+
* ]}
|
|
110
|
+
* languages={[{ code: "en", name: "English", flag: "🇺🇸" }]}
|
|
111
|
+
* LinkComponent={LocalizedLink}
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare const AppSitemapPage: React.FC<AppSitemapPageProps>;
|
|
116
|
+
export default AppSitemapPage;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { type ReactNode, type ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a section with paragraph content
|
|
4
|
+
*/
|
|
5
|
+
export interface TermsSectionWithContent {
|
|
6
|
+
/** Section title */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Paragraph content (can include HTML for links) */
|
|
9
|
+
content: string;
|
|
10
|
+
/** Whether content contains HTML that should be rendered */
|
|
11
|
+
isHtml?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for a section with a list
|
|
15
|
+
*/
|
|
16
|
+
export interface TermsSectionWithList {
|
|
17
|
+
/** Section title */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Optional description before the list */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** List items */
|
|
22
|
+
items: string[];
|
|
23
|
+
/** Optional additional content after the list */
|
|
24
|
+
additionalContent?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Contact information configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface TermsContactInfo {
|
|
30
|
+
/** Email label (e.g., "Email:") */
|
|
31
|
+
emailLabel: string;
|
|
32
|
+
/** Email address */
|
|
33
|
+
email: string;
|
|
34
|
+
/** Website label (e.g., "Website:") */
|
|
35
|
+
websiteLabel: string;
|
|
36
|
+
/** Website URL */
|
|
37
|
+
websiteUrl: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* All text content for the terms of service page
|
|
41
|
+
*/
|
|
42
|
+
export interface TermsOfServicePageText {
|
|
43
|
+
/** Page title */
|
|
44
|
+
title: string;
|
|
45
|
+
/** Last updated text (with placeholder for date) */
|
|
46
|
+
lastUpdated: string;
|
|
47
|
+
/** All sections in order */
|
|
48
|
+
sections: Array<TermsSectionWithContent | TermsSectionWithList>;
|
|
49
|
+
/** Contact information */
|
|
50
|
+
contact: {
|
|
51
|
+
/** Section title */
|
|
52
|
+
title: string;
|
|
53
|
+
/** Section description */
|
|
54
|
+
description: string;
|
|
55
|
+
/** Whether description contains HTML */
|
|
56
|
+
isHtml?: boolean;
|
|
57
|
+
/** Contact details */
|
|
58
|
+
info: TermsContactInfo;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Props for AppTermsOfServicePage component
|
|
63
|
+
*/
|
|
64
|
+
export interface AppTermsOfServicePageProps {
|
|
65
|
+
/** All text content (must be provided by consumer) */
|
|
66
|
+
text: TermsOfServicePageText;
|
|
67
|
+
/** Current date for "last updated" display */
|
|
68
|
+
lastUpdatedDate?: string;
|
|
69
|
+
/** Optional wrapper component for the page layout */
|
|
70
|
+
PageWrapper?: ComponentType<{
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
}>;
|
|
73
|
+
/** Optional className for the container */
|
|
74
|
+
className?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* AppTermsOfServicePage - A reusable terms of service page component
|
|
78
|
+
*
|
|
79
|
+
* Displays a comprehensive terms of service document with:
|
|
80
|
+
* - Flexible section structure (content or list-based)
|
|
81
|
+
* - Contact information
|
|
82
|
+
* - Support for HTML content in specific sections
|
|
83
|
+
*
|
|
84
|
+
* All text content must be provided by the consumer app.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <AppTermsOfServicePage
|
|
89
|
+
* text={{
|
|
90
|
+
* title: "Terms of Service",
|
|
91
|
+
* lastUpdated: "Last updated: {{date}}",
|
|
92
|
+
* sections: [
|
|
93
|
+
* { title: "Acceptance", content: "By using..." },
|
|
94
|
+
* { title: "User Responsibilities", items: ["Item 1", "Item 2"] }
|
|
95
|
+
* ],
|
|
96
|
+
* contact: {
|
|
97
|
+
* title: "Contact",
|
|
98
|
+
* description: "Questions?",
|
|
99
|
+
* info: { emailLabel: "Email:", email: "support@example.com", ... }
|
|
100
|
+
* }
|
|
101
|
+
* }}
|
|
102
|
+
* lastUpdatedDate="January 1, 2025"
|
|
103
|
+
* />
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare const AppTermsOfServicePage: React.FC<AppTermsOfServicePageProps>;
|
|
107
|
+
export default AppTermsOfServicePage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AppSitemapPage } from './app-sitemap-page';
|
|
2
|
+
export type { AppSitemapPageProps, SitemapPageText, SitemapSection, SitemapLink, LanguageOption, QuickLink, } from './app-sitemap-page';
|
|
3
|
+
export { AppPrivacyPolicyPage } from './app-privacy-policy-page';
|
|
4
|
+
export type { AppPrivacyPolicyPageProps, PrivacyPolicyPageText, PrivacySectionWithList, PrivacySectionWithContent, PrivacySubsection, PrivacyContactInfo, } from './app-privacy-policy-page';
|
|
5
|
+
export { AppTermsOfServicePage } from './app-terms-of-service-page';
|
|
6
|
+
export type { AppTermsOfServicePageProps, TermsOfServicePageText, TermsSectionWithContent, TermsSectionWithList, TermsContactInfo, } from './app-terms-of-service-page';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview App Pricing Page
|
|
3
|
+
* @description Public pricing page for displaying subscription options
|
|
4
|
+
*/
|
|
5
|
+
/** Product from subscription provider */
|
|
6
|
+
export interface PricingProduct {
|
|
7
|
+
identifier: string;
|
|
8
|
+
title: string;
|
|
9
|
+
price: string;
|
|
10
|
+
priceString: string;
|
|
11
|
+
period?: string;
|
|
12
|
+
}
|
|
13
|
+
/** FAQ item */
|
|
14
|
+
export interface FAQItem {
|
|
15
|
+
question: string;
|
|
16
|
+
answer: string;
|
|
17
|
+
}
|
|
18
|
+
/** All localized labels for the pricing page */
|
|
19
|
+
export interface PricingPageLabels {
|
|
20
|
+
title: string;
|
|
21
|
+
subtitle: string;
|
|
22
|
+
periodYear: string;
|
|
23
|
+
periodMonth: string;
|
|
24
|
+
periodWeek: string;
|
|
25
|
+
billingMonthly: string;
|
|
26
|
+
billingYearly: string;
|
|
27
|
+
freeTierTitle: string;
|
|
28
|
+
freeTierPrice: string;
|
|
29
|
+
freeTierFeatures: string[];
|
|
30
|
+
currentPlanBadge: string;
|
|
31
|
+
mostPopularBadge: string;
|
|
32
|
+
ctaLogIn: string;
|
|
33
|
+
ctaTryFree: string;
|
|
34
|
+
ctaUpgrade: string;
|
|
35
|
+
faqTitle: string;
|
|
36
|
+
}
|
|
37
|
+
/** Formatter functions for dynamic strings */
|
|
38
|
+
export interface PricingPageFormatters {
|
|
39
|
+
/** Format savings badge: "Save 20%" */
|
|
40
|
+
formatSavePercent: (percent: number) => string;
|
|
41
|
+
/** Get features for a product by its identifier */
|
|
42
|
+
getProductFeatures: (productId: string) => string[];
|
|
43
|
+
}
|
|
44
|
+
/** Package ID to entitlement mapping */
|
|
45
|
+
export interface EntitlementMap {
|
|
46
|
+
[packageId: string]: string;
|
|
47
|
+
}
|
|
48
|
+
/** Entitlement to level mapping for comparing plan tiers */
|
|
49
|
+
export interface EntitlementLevels {
|
|
50
|
+
[entitlement: string]: number;
|
|
51
|
+
}
|
|
52
|
+
export interface AppPricingPageProps {
|
|
53
|
+
/** Available subscription products */
|
|
54
|
+
products: PricingProduct[];
|
|
55
|
+
/** Whether user is authenticated */
|
|
56
|
+
isAuthenticated: boolean;
|
|
57
|
+
/** Whether user has an active subscription */
|
|
58
|
+
hasActiveSubscription: boolean;
|
|
59
|
+
/** Current subscription product identifier (if any) */
|
|
60
|
+
currentProductIdentifier?: string;
|
|
61
|
+
/** User ID used for subscription (the selected entity's ID when logged in) */
|
|
62
|
+
subscriptionUserId?: string;
|
|
63
|
+
/** All localized labels */
|
|
64
|
+
labels: PricingPageLabels;
|
|
65
|
+
/** Formatter functions */
|
|
66
|
+
formatters: PricingPageFormatters;
|
|
67
|
+
/** Package ID to entitlement mapping for calculating savings */
|
|
68
|
+
entitlementMap: EntitlementMap;
|
|
69
|
+
/** Entitlement to level mapping for comparing tiers (higher = better) */
|
|
70
|
+
entitlementLevels: EntitlementLevels;
|
|
71
|
+
/** Called when user clicks on a plan */
|
|
72
|
+
onPlanClick: (planIdentifier: string) => void;
|
|
73
|
+
/** Called when user clicks on free plan */
|
|
74
|
+
onFreePlanClick: () => void;
|
|
75
|
+
/** Optional FAQ items */
|
|
76
|
+
faqItems?: FAQItem[];
|
|
77
|
+
/** Optional className for the container */
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Public pricing page for displaying subscription options.
|
|
82
|
+
* - Non-authenticated: Free tile shows "Try it for Free", paid tiles show "Log in to Continue"
|
|
83
|
+
* - Authenticated on free: Free tile shows "Current Plan" badge (no CTA), paid tiles show "Upgrade"
|
|
84
|
+
* - Authenticated with subscription: Current plan shows badge (no CTA), higher tiers show "Upgrade"
|
|
85
|
+
*/
|
|
86
|
+
export declare function AppPricingPage({ products, isAuthenticated, hasActiveSubscription, currentProductIdentifier, labels, formatters, entitlementMap, entitlementLevels, onPlanClick, onFreePlanClick, faqItems, className, }: AppPricingPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview App Subscriptions Page
|
|
3
|
+
* @description Page for managing app subscriptions and viewing rate limits
|
|
4
|
+
*/
|
|
5
|
+
import type { RateLimitsConfigData } from '@sudobility/types';
|
|
6
|
+
/** Product from subscription provider */
|
|
7
|
+
export interface SubscriptionProduct {
|
|
8
|
+
identifier: string;
|
|
9
|
+
title: string;
|
|
10
|
+
price: string;
|
|
11
|
+
priceString: string;
|
|
12
|
+
period?: string;
|
|
13
|
+
freeTrialPeriod?: string;
|
|
14
|
+
introPrice?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Current subscription state */
|
|
17
|
+
export interface CurrentSubscription {
|
|
18
|
+
isActive: boolean;
|
|
19
|
+
productIdentifier?: string;
|
|
20
|
+
expirationDate?: Date;
|
|
21
|
+
willRenew?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Subscription context value passed from consumer */
|
|
24
|
+
export interface SubscriptionContextValue {
|
|
25
|
+
products: SubscriptionProduct[];
|
|
26
|
+
currentSubscription: CurrentSubscription | null;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
error: string | null;
|
|
29
|
+
purchase: (productId: string) => Promise<boolean>;
|
|
30
|
+
restore: () => Promise<boolean>;
|
|
31
|
+
clearError: () => void;
|
|
32
|
+
}
|
|
33
|
+
/** All localized labels for the subscription page */
|
|
34
|
+
export interface SubscriptionPageLabels {
|
|
35
|
+
title: string;
|
|
36
|
+
errorTitle: string;
|
|
37
|
+
purchaseError: string;
|
|
38
|
+
restoreError: string;
|
|
39
|
+
restoreNoPurchases: string;
|
|
40
|
+
periodYear: string;
|
|
41
|
+
periodMonth: string;
|
|
42
|
+
periodWeek: string;
|
|
43
|
+
billingMonthly: string;
|
|
44
|
+
billingYearly: string;
|
|
45
|
+
unlimited: string;
|
|
46
|
+
unlimitedRequests: string;
|
|
47
|
+
currentStatusLabel: string;
|
|
48
|
+
statusActive: string;
|
|
49
|
+
statusInactive: string;
|
|
50
|
+
statusInactiveMessage: string;
|
|
51
|
+
labelPlan: string;
|
|
52
|
+
labelPremium: string;
|
|
53
|
+
labelExpires: string;
|
|
54
|
+
labelWillRenew: string;
|
|
55
|
+
labelMonthlyUsage: string;
|
|
56
|
+
labelDailyUsage: string;
|
|
57
|
+
yes: string;
|
|
58
|
+
no: string;
|
|
59
|
+
buttonSubscribe: string;
|
|
60
|
+
buttonPurchasing: string;
|
|
61
|
+
buttonRestore: string;
|
|
62
|
+
buttonRestoring: string;
|
|
63
|
+
noProducts: string;
|
|
64
|
+
noProductsForPeriod: string;
|
|
65
|
+
freeTierTitle: string;
|
|
66
|
+
freeTierPrice: string;
|
|
67
|
+
freeTierFeatures: string[];
|
|
68
|
+
currentPlanBadge: string;
|
|
69
|
+
}
|
|
70
|
+
/** Formatter functions for dynamic strings */
|
|
71
|
+
export interface SubscriptionPageFormatters {
|
|
72
|
+
/** Format rate limit: "1,000 requests/hour" */
|
|
73
|
+
formatHourlyLimit: (limit: string) => string;
|
|
74
|
+
/** Format rate limit: "10,000 requests/day" */
|
|
75
|
+
formatDailyLimit: (limit: string) => string;
|
|
76
|
+
/** Format rate limit: "100,000 requests/month" */
|
|
77
|
+
formatMonthlyLimit: (limit: string) => string;
|
|
78
|
+
/** Format trial period: "7 days free trial" */
|
|
79
|
+
formatTrialDays: (count: number) => string;
|
|
80
|
+
/** Format trial period: "2 weeks free trial" */
|
|
81
|
+
formatTrialWeeks: (count: number) => string;
|
|
82
|
+
/** Format trial period: "1 month free trial" */
|
|
83
|
+
formatTrialMonths: (count: number) => string;
|
|
84
|
+
/** Format savings badge: "Save 20%" */
|
|
85
|
+
formatSavePercent: (percent: number) => string;
|
|
86
|
+
/** Format intro price note */
|
|
87
|
+
formatIntroNote: (price: string) => string;
|
|
88
|
+
}
|
|
89
|
+
export interface AppSubscriptionsPageProps {
|
|
90
|
+
/** Subscription context value */
|
|
91
|
+
subscription: SubscriptionContextValue;
|
|
92
|
+
/** Rate limit configuration */
|
|
93
|
+
rateLimitsConfig?: RateLimitsConfigData | null;
|
|
94
|
+
/** User ID used for subscription (the selected entity's ID when logged in) */
|
|
95
|
+
subscriptionUserId?: string;
|
|
96
|
+
/** All localized labels */
|
|
97
|
+
labels: SubscriptionPageLabels;
|
|
98
|
+
/** Formatter functions for dynamic strings */
|
|
99
|
+
formatters: SubscriptionPageFormatters;
|
|
100
|
+
/** Package ID to entitlement mapping */
|
|
101
|
+
packageEntitlementMap?: Record<string, string>;
|
|
102
|
+
/** Called when purchase succeeds */
|
|
103
|
+
onPurchaseSuccess?: () => void;
|
|
104
|
+
/** Called when restore succeeds */
|
|
105
|
+
onRestoreSuccess?: () => void;
|
|
106
|
+
/** Called on error */
|
|
107
|
+
onError?: (title: string, message: string) => void;
|
|
108
|
+
/** Called on warning */
|
|
109
|
+
onWarning?: (title: string, message: string) => void;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Page for managing app subscriptions.
|
|
113
|
+
*/
|
|
114
|
+
export declare function AppSubscriptionsPage({ subscription, rateLimitsConfig, labels, formatters, packageEntitlementMap, onPurchaseSuccess, onRestoreSuccess, onError, onWarning, }: AppSubscriptionsPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AppSubscriptionsPage } from './AppSubscriptionsPage';
|
|
2
|
+
export type { AppSubscriptionsPageProps, SubscriptionProduct, CurrentSubscription, SubscriptionContextValue, SubscriptionPageLabels, SubscriptionPageFormatters, } from './AppSubscriptionsPage';
|
|
3
|
+
export { AppPricingPage } from './AppPricingPage';
|
|
4
|
+
export type { AppPricingPageProps, PricingProduct, FAQItem, PricingPageLabels, PricingPageFormatters, EntitlementMap, EntitlementLevels, } from './AppPricingPage';
|