@freehold/payments 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Freehold
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,151 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, HTMLAttributes, SVGProps } from 'react';
3
+ import { ClassValue } from 'clsx';
4
+ import * as class_variance_authority_types from 'class-variance-authority/types';
5
+ import { VariantProps } from 'class-variance-authority';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
7
+
8
+ type PaymentProvider = 'stripe' | 'paddle';
9
+ type PaymentStatus = 'idle' | 'processing' | 'succeeded' | 'failed';
10
+ interface PaymentResult {
11
+ status: PaymentStatus;
12
+ provider: PaymentProvider;
13
+ transactionId?: string;
14
+ error?: string;
15
+ }
16
+ interface OrderLineItem {
17
+ id: string;
18
+ name: string;
19
+ description?: string;
20
+ quantity: number;
21
+ unitPrice: number;
22
+ currency: string;
23
+ }
24
+ interface OrderSummaryData {
25
+ items: OrderLineItem[];
26
+ subtotal: number;
27
+ tax?: number;
28
+ discount?: number;
29
+ total: number;
30
+ currency: string;
31
+ }
32
+ interface CheckoutHeaderConfig {
33
+ title: string;
34
+ description?: string;
35
+ logo?: ReactNode;
36
+ }
37
+ interface CheckoutFooterConfig {
38
+ termsUrl?: string;
39
+ privacyUrl?: string;
40
+ showPoweredBy?: boolean;
41
+ }
42
+ type BillingPeriod = 'monthly' | 'yearly' | 'one-time';
43
+ interface PricingFeature {
44
+ text: string;
45
+ included?: boolean;
46
+ hint?: string;
47
+ }
48
+ interface PricingTier {
49
+ id: string;
50
+ name: string;
51
+ description?: string;
52
+ price: number;
53
+ currency: string;
54
+ billingPeriod: BillingPeriod;
55
+ billingLabel?: string;
56
+ features: PricingFeature[];
57
+ badge?: string;
58
+ ctaLabel: string;
59
+ featured?: boolean;
60
+ originalPrice?: number;
61
+ }
62
+
63
+ declare function formatCurrency(amount: number, currency?: string, locale?: string): string;
64
+
65
+ declare function cn(...inputs: ClassValue[]): string;
66
+
67
+ declare const orderSummaryVariants: (props?: ({
68
+ variant?: "default" | "compact" | null | undefined;
69
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
70
+ interface OrderSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof orderSummaryVariants>, OrderSummaryData {
71
+ }
72
+ declare const OrderSummary: react.ForwardRefExoticComponent<OrderSummaryProps & react.RefAttributes<HTMLDivElement>>;
73
+
74
+ type IconProps = SVGProps<SVGSVGElement>;
75
+ declare function VisaIcon(props: IconProps): react_jsx_runtime.JSX.Element;
76
+ declare function MastercardIcon(props: IconProps): react_jsx_runtime.JSX.Element;
77
+ declare function AmexIcon(props: IconProps): react_jsx_runtime.JSX.Element;
78
+ declare function ApplePayIcon(props: IconProps): react_jsx_runtime.JSX.Element;
79
+ declare function GooglePayIcon(props: IconProps): react_jsx_runtime.JSX.Element;
80
+ declare function PayPalIcon(props: IconProps): react_jsx_runtime.JSX.Element;
81
+
82
+ declare const iconMap: {
83
+ readonly visa: typeof VisaIcon;
84
+ readonly mastercard: typeof MastercardIcon;
85
+ readonly amex: typeof AmexIcon;
86
+ readonly 'apple-pay': typeof ApplePayIcon;
87
+ readonly 'google-pay': typeof GooglePayIcon;
88
+ readonly paypal: typeof PayPalIcon;
89
+ };
90
+ type PaymentMethod = keyof typeof iconMap;
91
+ interface PaymentMethodIconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
92
+ method: PaymentMethod;
93
+ size?: 'sm' | 'md' | 'lg';
94
+ }
95
+ declare const PaymentMethodIcon: react.ForwardRefExoticComponent<PaymentMethodIconProps & react.RefAttributes<HTMLSpanElement>>;
96
+
97
+ declare const securityBadgeVariants: (props?: ({
98
+ variant?: "default" | "subtle" | null | undefined;
99
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
100
+ interface SecurityBadgeProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof securityBadgeVariants> {
101
+ label?: string;
102
+ }
103
+ declare const SecurityBadge: react.ForwardRefExoticComponent<SecurityBadgeProps & react.RefAttributes<HTMLDivElement>>;
104
+
105
+ interface CheckoutDividerProps extends HTMLAttributes<HTMLDivElement> {
106
+ label?: string;
107
+ }
108
+ declare const CheckoutDivider: react.ForwardRefExoticComponent<CheckoutDividerProps & react.RefAttributes<HTMLDivElement>>;
109
+
110
+ interface CheckoutHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, CheckoutHeaderConfig {
111
+ }
112
+ declare const CheckoutHeader: react.ForwardRefExoticComponent<CheckoutHeaderProps & react.RefAttributes<HTMLDivElement>>;
113
+
114
+ interface CheckoutFooterProps extends HTMLAttributes<HTMLDivElement>, CheckoutFooterConfig {
115
+ }
116
+ declare const CheckoutFooter: react.ForwardRefExoticComponent<CheckoutFooterProps & react.RefAttributes<HTMLDivElement>>;
117
+
118
+ declare const pricingCardVariants: (props?: ({
119
+ variant?: "default" | "featured" | null | undefined;
120
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
121
+ interface PricingCardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof pricingCardVariants>, Omit<PricingTier, 'id'> {
122
+ ctaSlot?: ReactNode;
123
+ onCtaClick?: () => void;
124
+ }
125
+ declare const PricingCard: react.ForwardRefExoticComponent<PricingCardProps & react.RefAttributes<HTMLDivElement>>;
126
+
127
+ interface CheckoutCardProps extends HTMLAttributes<HTMLDivElement> {
128
+ header?: CheckoutHeaderConfig;
129
+ footer?: CheckoutFooterConfig;
130
+ }
131
+ declare const CheckoutCard: react.ForwardRefExoticComponent<CheckoutCardProps & react.RefAttributes<HTMLDivElement>>;
132
+
133
+ interface CheckoutFullScreenProps extends HTMLAttributes<HTMLDivElement> {
134
+ header?: CheckoutHeaderConfig;
135
+ footer?: CheckoutFooterConfig;
136
+ }
137
+ declare const CheckoutFullScreen: react.ForwardRefExoticComponent<CheckoutFullScreenProps & react.RefAttributes<HTMLDivElement>>;
138
+
139
+ interface CheckoutSplitScreenProps extends HTMLAttributes<HTMLDivElement> {
140
+ left: ReactNode;
141
+ header?: CheckoutHeaderConfig;
142
+ footer?: CheckoutFooterConfig;
143
+ }
144
+ declare const CheckoutSplitScreen: react.ForwardRefExoticComponent<CheckoutSplitScreenProps & react.RefAttributes<HTMLDivElement>>;
145
+
146
+ interface PricingGridProps extends HTMLAttributes<HTMLDivElement> {
147
+ columns?: 2 | 3 | 4;
148
+ }
149
+ declare const PricingGrid: react.ForwardRefExoticComponent<PricingGridProps & react.RefAttributes<HTMLDivElement>>;
150
+
151
+ export { type BillingPeriod, CheckoutCard, type CheckoutCardProps, CheckoutDivider, type CheckoutDividerProps, CheckoutFooter, type CheckoutFooterConfig, type CheckoutFooterProps, CheckoutFullScreen, type CheckoutFullScreenProps, CheckoutHeader, type CheckoutHeaderConfig, type CheckoutHeaderProps, CheckoutSplitScreen, type CheckoutSplitScreenProps, type OrderLineItem, OrderSummary, type OrderSummaryData, type OrderSummaryProps, type PaymentMethod, PaymentMethodIcon, type PaymentMethodIconProps, type PaymentProvider, type PaymentResult, type PaymentStatus, PricingCard, type PricingCardProps, type PricingFeature, PricingGrid, type PricingGridProps, type PricingTier, SecurityBadge, type SecurityBadgeProps, cn, formatCurrency, orderSummaryVariants, pricingCardVariants, securityBadgeVariants };
@@ -0,0 +1,151 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, HTMLAttributes, SVGProps } from 'react';
3
+ import { ClassValue } from 'clsx';
4
+ import * as class_variance_authority_types from 'class-variance-authority/types';
5
+ import { VariantProps } from 'class-variance-authority';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
7
+
8
+ type PaymentProvider = 'stripe' | 'paddle';
9
+ type PaymentStatus = 'idle' | 'processing' | 'succeeded' | 'failed';
10
+ interface PaymentResult {
11
+ status: PaymentStatus;
12
+ provider: PaymentProvider;
13
+ transactionId?: string;
14
+ error?: string;
15
+ }
16
+ interface OrderLineItem {
17
+ id: string;
18
+ name: string;
19
+ description?: string;
20
+ quantity: number;
21
+ unitPrice: number;
22
+ currency: string;
23
+ }
24
+ interface OrderSummaryData {
25
+ items: OrderLineItem[];
26
+ subtotal: number;
27
+ tax?: number;
28
+ discount?: number;
29
+ total: number;
30
+ currency: string;
31
+ }
32
+ interface CheckoutHeaderConfig {
33
+ title: string;
34
+ description?: string;
35
+ logo?: ReactNode;
36
+ }
37
+ interface CheckoutFooterConfig {
38
+ termsUrl?: string;
39
+ privacyUrl?: string;
40
+ showPoweredBy?: boolean;
41
+ }
42
+ type BillingPeriod = 'monthly' | 'yearly' | 'one-time';
43
+ interface PricingFeature {
44
+ text: string;
45
+ included?: boolean;
46
+ hint?: string;
47
+ }
48
+ interface PricingTier {
49
+ id: string;
50
+ name: string;
51
+ description?: string;
52
+ price: number;
53
+ currency: string;
54
+ billingPeriod: BillingPeriod;
55
+ billingLabel?: string;
56
+ features: PricingFeature[];
57
+ badge?: string;
58
+ ctaLabel: string;
59
+ featured?: boolean;
60
+ originalPrice?: number;
61
+ }
62
+
63
+ declare function formatCurrency(amount: number, currency?: string, locale?: string): string;
64
+
65
+ declare function cn(...inputs: ClassValue[]): string;
66
+
67
+ declare const orderSummaryVariants: (props?: ({
68
+ variant?: "default" | "compact" | null | undefined;
69
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
70
+ interface OrderSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof orderSummaryVariants>, OrderSummaryData {
71
+ }
72
+ declare const OrderSummary: react.ForwardRefExoticComponent<OrderSummaryProps & react.RefAttributes<HTMLDivElement>>;
73
+
74
+ type IconProps = SVGProps<SVGSVGElement>;
75
+ declare function VisaIcon(props: IconProps): react_jsx_runtime.JSX.Element;
76
+ declare function MastercardIcon(props: IconProps): react_jsx_runtime.JSX.Element;
77
+ declare function AmexIcon(props: IconProps): react_jsx_runtime.JSX.Element;
78
+ declare function ApplePayIcon(props: IconProps): react_jsx_runtime.JSX.Element;
79
+ declare function GooglePayIcon(props: IconProps): react_jsx_runtime.JSX.Element;
80
+ declare function PayPalIcon(props: IconProps): react_jsx_runtime.JSX.Element;
81
+
82
+ declare const iconMap: {
83
+ readonly visa: typeof VisaIcon;
84
+ readonly mastercard: typeof MastercardIcon;
85
+ readonly amex: typeof AmexIcon;
86
+ readonly 'apple-pay': typeof ApplePayIcon;
87
+ readonly 'google-pay': typeof GooglePayIcon;
88
+ readonly paypal: typeof PayPalIcon;
89
+ };
90
+ type PaymentMethod = keyof typeof iconMap;
91
+ interface PaymentMethodIconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
92
+ method: PaymentMethod;
93
+ size?: 'sm' | 'md' | 'lg';
94
+ }
95
+ declare const PaymentMethodIcon: react.ForwardRefExoticComponent<PaymentMethodIconProps & react.RefAttributes<HTMLSpanElement>>;
96
+
97
+ declare const securityBadgeVariants: (props?: ({
98
+ variant?: "default" | "subtle" | null | undefined;
99
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
100
+ interface SecurityBadgeProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof securityBadgeVariants> {
101
+ label?: string;
102
+ }
103
+ declare const SecurityBadge: react.ForwardRefExoticComponent<SecurityBadgeProps & react.RefAttributes<HTMLDivElement>>;
104
+
105
+ interface CheckoutDividerProps extends HTMLAttributes<HTMLDivElement> {
106
+ label?: string;
107
+ }
108
+ declare const CheckoutDivider: react.ForwardRefExoticComponent<CheckoutDividerProps & react.RefAttributes<HTMLDivElement>>;
109
+
110
+ interface CheckoutHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, CheckoutHeaderConfig {
111
+ }
112
+ declare const CheckoutHeader: react.ForwardRefExoticComponent<CheckoutHeaderProps & react.RefAttributes<HTMLDivElement>>;
113
+
114
+ interface CheckoutFooterProps extends HTMLAttributes<HTMLDivElement>, CheckoutFooterConfig {
115
+ }
116
+ declare const CheckoutFooter: react.ForwardRefExoticComponent<CheckoutFooterProps & react.RefAttributes<HTMLDivElement>>;
117
+
118
+ declare const pricingCardVariants: (props?: ({
119
+ variant?: "default" | "featured" | null | undefined;
120
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
121
+ interface PricingCardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof pricingCardVariants>, Omit<PricingTier, 'id'> {
122
+ ctaSlot?: ReactNode;
123
+ onCtaClick?: () => void;
124
+ }
125
+ declare const PricingCard: react.ForwardRefExoticComponent<PricingCardProps & react.RefAttributes<HTMLDivElement>>;
126
+
127
+ interface CheckoutCardProps extends HTMLAttributes<HTMLDivElement> {
128
+ header?: CheckoutHeaderConfig;
129
+ footer?: CheckoutFooterConfig;
130
+ }
131
+ declare const CheckoutCard: react.ForwardRefExoticComponent<CheckoutCardProps & react.RefAttributes<HTMLDivElement>>;
132
+
133
+ interface CheckoutFullScreenProps extends HTMLAttributes<HTMLDivElement> {
134
+ header?: CheckoutHeaderConfig;
135
+ footer?: CheckoutFooterConfig;
136
+ }
137
+ declare const CheckoutFullScreen: react.ForwardRefExoticComponent<CheckoutFullScreenProps & react.RefAttributes<HTMLDivElement>>;
138
+
139
+ interface CheckoutSplitScreenProps extends HTMLAttributes<HTMLDivElement> {
140
+ left: ReactNode;
141
+ header?: CheckoutHeaderConfig;
142
+ footer?: CheckoutFooterConfig;
143
+ }
144
+ declare const CheckoutSplitScreen: react.ForwardRefExoticComponent<CheckoutSplitScreenProps & react.RefAttributes<HTMLDivElement>>;
145
+
146
+ interface PricingGridProps extends HTMLAttributes<HTMLDivElement> {
147
+ columns?: 2 | 3 | 4;
148
+ }
149
+ declare const PricingGrid: react.ForwardRefExoticComponent<PricingGridProps & react.RefAttributes<HTMLDivElement>>;
150
+
151
+ export { type BillingPeriod, CheckoutCard, type CheckoutCardProps, CheckoutDivider, type CheckoutDividerProps, CheckoutFooter, type CheckoutFooterConfig, type CheckoutFooterProps, CheckoutFullScreen, type CheckoutFullScreenProps, CheckoutHeader, type CheckoutHeaderConfig, type CheckoutHeaderProps, CheckoutSplitScreen, type CheckoutSplitScreenProps, type OrderLineItem, OrderSummary, type OrderSummaryData, type OrderSummaryProps, type PaymentMethod, PaymentMethodIcon, type PaymentMethodIconProps, type PaymentProvider, type PaymentResult, type PaymentStatus, PricingCard, type PricingCardProps, type PricingFeature, PricingGrid, type PricingGridProps, type PricingTier, SecurityBadge, type SecurityBadgeProps, cn, formatCurrency, orderSummaryVariants, pricingCardVariants, securityBadgeVariants };