@omnibase/core-js 0.4.2 → 0.5.0
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/payments/index.cjs +474 -83
- package/dist/payments/index.d.cts +3 -191
- package/dist/payments/index.d.ts +3 -191
- package/dist/payments/index.js +469 -77
- package/dist/tenants/index.cjs +535 -157
- package/dist/tenants/index.d.cts +1620 -268
- package/dist/tenants/index.d.ts +1620 -268
- package/dist/tenants/index.js +534 -152
- package/package.json +1 -1
|
@@ -1,191 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Stripe configuration types mirroring the Go structs and JSON schema
|
|
5
|
-
*/
|
|
6
|
-
type StripeConfigResponse = ApiResponse<{
|
|
7
|
-
config: StripeConfiguration;
|
|
8
|
-
message?: string;
|
|
9
|
-
}>;
|
|
10
|
-
interface StripeConfiguration {
|
|
11
|
-
version: string;
|
|
12
|
-
products: Product[];
|
|
13
|
-
}
|
|
14
|
-
interface Product {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
type?: "service" | "good" | "metered";
|
|
19
|
-
prices: Price[];
|
|
20
|
-
ui?: ProductUI;
|
|
21
|
-
}
|
|
22
|
-
interface Price {
|
|
23
|
-
id: string;
|
|
24
|
-
amount?: number;
|
|
25
|
-
currency: string;
|
|
26
|
-
interval?: "month" | "year" | "week" | "day";
|
|
27
|
-
interval_count?: number;
|
|
28
|
-
usage_type?: "licensed" | "metered";
|
|
29
|
-
billing_scheme?: "per_unit" | "tiered";
|
|
30
|
-
tiers_mode?: "graduated" | "volume";
|
|
31
|
-
tiers?: Tier[];
|
|
32
|
-
ui?: PriceUI;
|
|
33
|
-
}
|
|
34
|
-
interface Tier {
|
|
35
|
-
up_to: number | "inf";
|
|
36
|
-
flat_amount?: number;
|
|
37
|
-
unit_amount?: number;
|
|
38
|
-
}
|
|
39
|
-
interface ProductUI {
|
|
40
|
-
display_name?: string;
|
|
41
|
-
tagline?: string;
|
|
42
|
-
features?: string[];
|
|
43
|
-
badge?: string;
|
|
44
|
-
cta_text?: string;
|
|
45
|
-
highlighted?: boolean;
|
|
46
|
-
sort_order?: number;
|
|
47
|
-
}
|
|
48
|
-
interface PriceUI {
|
|
49
|
-
display_name?: string;
|
|
50
|
-
price_display?: PriceDisplay;
|
|
51
|
-
billing_period?: string;
|
|
52
|
-
features?: string[];
|
|
53
|
-
limits?: PriceLimit[];
|
|
54
|
-
}
|
|
55
|
-
interface PriceDisplay {
|
|
56
|
-
custom_text?: string;
|
|
57
|
-
show_currency?: boolean;
|
|
58
|
-
suffix?: string;
|
|
59
|
-
}
|
|
60
|
-
interface PriceLimit {
|
|
61
|
-
text: string;
|
|
62
|
-
value?: number;
|
|
63
|
-
unit?: string;
|
|
64
|
-
}
|
|
65
|
-
interface ProductWithPricingUI extends Product {
|
|
66
|
-
pricing_display: {
|
|
67
|
-
name: string;
|
|
68
|
-
tagline?: string;
|
|
69
|
-
features: string[];
|
|
70
|
-
badge?: string;
|
|
71
|
-
cta_text: string;
|
|
72
|
-
highlighted: boolean;
|
|
73
|
-
sort_order: number;
|
|
74
|
-
prices: Array<{
|
|
75
|
-
id: string;
|
|
76
|
-
display_name: string;
|
|
77
|
-
formatted_price: string;
|
|
78
|
-
billing_period: string;
|
|
79
|
-
features: string[];
|
|
80
|
-
limits: Array<{
|
|
81
|
-
text: string;
|
|
82
|
-
value?: number;
|
|
83
|
-
unit?: string;
|
|
84
|
-
}>;
|
|
85
|
-
}>;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Get the current Stripe configuration from the database
|
|
91
|
-
*
|
|
92
|
-
* Retrieves the latest Stripe configuration including products, prices,
|
|
93
|
-
* and UI customization data. This configuration represents the current
|
|
94
|
-
* active pricing structure with all UI elements for pricing table rendering.
|
|
95
|
-
*
|
|
96
|
-
* @returns Promise resolving to the current Stripe configuration
|
|
97
|
-
*
|
|
98
|
-
* @throws {Error} When OMNIBASE_API_URL environment variable is not configured
|
|
99
|
-
* @throws {Error} When the API request fails due to network issues
|
|
100
|
-
* @throws {Error} When the server returns an error response (4xx, 5xx status codes)
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* Basic usage:
|
|
104
|
-
* ```typescript
|
|
105
|
-
* const config = await getStripeConfig();
|
|
106
|
-
* console.log(`Found ${config.data.config.products.length} products`);
|
|
107
|
-
*
|
|
108
|
-
* // Access product UI configuration
|
|
109
|
-
* config.data.config.products.forEach(product => {
|
|
110
|
-
* console.log(`${product.name}: ${product.ui?.tagline || 'No tagline'}`);
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
declare function getStripeConfig(): Promise<StripeConfigResponse>;
|
|
115
|
-
/**
|
|
116
|
-
* Get available products with UI-ready pricing data
|
|
117
|
-
*
|
|
118
|
-
* Transforms the raw Stripe configuration into UI-ready format for pricing
|
|
119
|
-
* table rendering. Includes formatted pricing, features, limits, and all
|
|
120
|
-
* display customizations needed for marketing pages.
|
|
121
|
-
*
|
|
122
|
-
* @returns Promise resolving to products ready for UI consumption
|
|
123
|
-
*
|
|
124
|
-
* @throws {Error} When OMNIBASE_AUTH_URL environment variable is not configured
|
|
125
|
-
* @throws {Error} When the API request fails or configuration is invalid
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* Pricing table rendering:
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const products = await getAvailableProducts();
|
|
131
|
-
*
|
|
132
|
-
* products.forEach(product => {
|
|
133
|
-
* const display = product.pricing_display;
|
|
134
|
-
* console.log(`${display.name} - ${display.tagline}`);
|
|
135
|
-
*
|
|
136
|
-
* display.prices.forEach(price => {
|
|
137
|
-
* console.log(` ${price.display_name}: ${price.formatted_price}`);
|
|
138
|
-
* });
|
|
139
|
-
* });
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
declare function getAvailableProducts(): Promise<ProductWithPricingUI[]>;
|
|
143
|
-
/**
|
|
144
|
-
* Get a specific product by ID
|
|
145
|
-
*
|
|
146
|
-
* Retrieves a single product configuration by its ID from the current
|
|
147
|
-
* Stripe configuration. Useful for product-specific operations.
|
|
148
|
-
*
|
|
149
|
-
* @param productId - The configuration product ID to retrieve
|
|
150
|
-
* @returns Promise resolving to the product or null if not found
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* const product = await getProduct('starter_plan');
|
|
155
|
-
* if (product) {
|
|
156
|
-
* console.log(`Found product: ${product.name}`);
|
|
157
|
-
* }
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
declare function getProduct(productId: string): Promise<Product | null>;
|
|
161
|
-
|
|
162
|
-
type CheckoutOptions = {
|
|
163
|
-
price_id: string;
|
|
164
|
-
mode: "payment" | "subscription";
|
|
165
|
-
success_url: string;
|
|
166
|
-
cancel_url: string;
|
|
167
|
-
customer_id?: string;
|
|
168
|
-
};
|
|
169
|
-
type CreateCheckoutResponse = ApiResponse<{
|
|
170
|
-
url: string;
|
|
171
|
-
sessionId: string;
|
|
172
|
-
}>;
|
|
173
|
-
declare const createCheckout: (options: CheckoutOptions) => Promise<CreateCheckoutResponse>;
|
|
174
|
-
|
|
175
|
-
type PortalOptions = {
|
|
176
|
-
customer_id: string;
|
|
177
|
-
return_url: string;
|
|
178
|
-
};
|
|
179
|
-
type CreateCustomerPortalResponse = ApiResponse<{
|
|
180
|
-
url: string;
|
|
181
|
-
}>;
|
|
182
|
-
declare const createCustomerPortal: (options: PortalOptions) => Promise<CreateCustomerPortalResponse>;
|
|
183
|
-
|
|
184
|
-
type UsageOptions = {
|
|
185
|
-
meter_event_name: string;
|
|
186
|
-
customer_id: string;
|
|
187
|
-
value: string;
|
|
188
|
-
};
|
|
189
|
-
declare const recordUsage: (options: UsageOptions) => Promise<ApiResponse<"">>;
|
|
190
|
-
|
|
191
|
-
export { type CheckoutOptions, type CreateCheckoutResponse, type CreateCustomerPortalResponse, type PortalOptions, type Price, type PriceDisplay, type PriceLimit, type PriceUI, type Product, type ProductUI, type ProductWithPricingUI, type StripeConfigResponse, type StripeConfiguration, type Tier, type UsageOptions, createCheckout, createCustomerPortal, getAvailableProducts, getProduct, getStripeConfig, recordUsage };
|
|
1
|
+
export { k as CheckoutManager, i as CheckoutOptions, C as ConfigManager, j as CreateCheckoutResponse, m as CreateCustomerPortalResponse, P as PaymentHandler, n as PortalManager, l as PortalOptions, c as Price, f as PriceDisplay, g as PriceLimit, e as PriceUI, b as Product, d as ProductUI, h as ProductWithPricingUI, S as StripeConfigResponse, a as StripeConfiguration, T as Tier, o as UsageManager, U as UsageOptions } from '../tenants/index.cjs';
|
|
2
|
+
import '../permissions/index.cjs';
|
|
3
|
+
import '@ory/client';
|
package/dist/payments/index.d.ts
CHANGED
|
@@ -1,191 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Stripe configuration types mirroring the Go structs and JSON schema
|
|
5
|
-
*/
|
|
6
|
-
type StripeConfigResponse = ApiResponse<{
|
|
7
|
-
config: StripeConfiguration;
|
|
8
|
-
message?: string;
|
|
9
|
-
}>;
|
|
10
|
-
interface StripeConfiguration {
|
|
11
|
-
version: string;
|
|
12
|
-
products: Product[];
|
|
13
|
-
}
|
|
14
|
-
interface Product {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
type?: "service" | "good" | "metered";
|
|
19
|
-
prices: Price[];
|
|
20
|
-
ui?: ProductUI;
|
|
21
|
-
}
|
|
22
|
-
interface Price {
|
|
23
|
-
id: string;
|
|
24
|
-
amount?: number;
|
|
25
|
-
currency: string;
|
|
26
|
-
interval?: "month" | "year" | "week" | "day";
|
|
27
|
-
interval_count?: number;
|
|
28
|
-
usage_type?: "licensed" | "metered";
|
|
29
|
-
billing_scheme?: "per_unit" | "tiered";
|
|
30
|
-
tiers_mode?: "graduated" | "volume";
|
|
31
|
-
tiers?: Tier[];
|
|
32
|
-
ui?: PriceUI;
|
|
33
|
-
}
|
|
34
|
-
interface Tier {
|
|
35
|
-
up_to: number | "inf";
|
|
36
|
-
flat_amount?: number;
|
|
37
|
-
unit_amount?: number;
|
|
38
|
-
}
|
|
39
|
-
interface ProductUI {
|
|
40
|
-
display_name?: string;
|
|
41
|
-
tagline?: string;
|
|
42
|
-
features?: string[];
|
|
43
|
-
badge?: string;
|
|
44
|
-
cta_text?: string;
|
|
45
|
-
highlighted?: boolean;
|
|
46
|
-
sort_order?: number;
|
|
47
|
-
}
|
|
48
|
-
interface PriceUI {
|
|
49
|
-
display_name?: string;
|
|
50
|
-
price_display?: PriceDisplay;
|
|
51
|
-
billing_period?: string;
|
|
52
|
-
features?: string[];
|
|
53
|
-
limits?: PriceLimit[];
|
|
54
|
-
}
|
|
55
|
-
interface PriceDisplay {
|
|
56
|
-
custom_text?: string;
|
|
57
|
-
show_currency?: boolean;
|
|
58
|
-
suffix?: string;
|
|
59
|
-
}
|
|
60
|
-
interface PriceLimit {
|
|
61
|
-
text: string;
|
|
62
|
-
value?: number;
|
|
63
|
-
unit?: string;
|
|
64
|
-
}
|
|
65
|
-
interface ProductWithPricingUI extends Product {
|
|
66
|
-
pricing_display: {
|
|
67
|
-
name: string;
|
|
68
|
-
tagline?: string;
|
|
69
|
-
features: string[];
|
|
70
|
-
badge?: string;
|
|
71
|
-
cta_text: string;
|
|
72
|
-
highlighted: boolean;
|
|
73
|
-
sort_order: number;
|
|
74
|
-
prices: Array<{
|
|
75
|
-
id: string;
|
|
76
|
-
display_name: string;
|
|
77
|
-
formatted_price: string;
|
|
78
|
-
billing_period: string;
|
|
79
|
-
features: string[];
|
|
80
|
-
limits: Array<{
|
|
81
|
-
text: string;
|
|
82
|
-
value?: number;
|
|
83
|
-
unit?: string;
|
|
84
|
-
}>;
|
|
85
|
-
}>;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Get the current Stripe configuration from the database
|
|
91
|
-
*
|
|
92
|
-
* Retrieves the latest Stripe configuration including products, prices,
|
|
93
|
-
* and UI customization data. This configuration represents the current
|
|
94
|
-
* active pricing structure with all UI elements for pricing table rendering.
|
|
95
|
-
*
|
|
96
|
-
* @returns Promise resolving to the current Stripe configuration
|
|
97
|
-
*
|
|
98
|
-
* @throws {Error} When OMNIBASE_API_URL environment variable is not configured
|
|
99
|
-
* @throws {Error} When the API request fails due to network issues
|
|
100
|
-
* @throws {Error} When the server returns an error response (4xx, 5xx status codes)
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* Basic usage:
|
|
104
|
-
* ```typescript
|
|
105
|
-
* const config = await getStripeConfig();
|
|
106
|
-
* console.log(`Found ${config.data.config.products.length} products`);
|
|
107
|
-
*
|
|
108
|
-
* // Access product UI configuration
|
|
109
|
-
* config.data.config.products.forEach(product => {
|
|
110
|
-
* console.log(`${product.name}: ${product.ui?.tagline || 'No tagline'}`);
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
declare function getStripeConfig(): Promise<StripeConfigResponse>;
|
|
115
|
-
/**
|
|
116
|
-
* Get available products with UI-ready pricing data
|
|
117
|
-
*
|
|
118
|
-
* Transforms the raw Stripe configuration into UI-ready format for pricing
|
|
119
|
-
* table rendering. Includes formatted pricing, features, limits, and all
|
|
120
|
-
* display customizations needed for marketing pages.
|
|
121
|
-
*
|
|
122
|
-
* @returns Promise resolving to products ready for UI consumption
|
|
123
|
-
*
|
|
124
|
-
* @throws {Error} When OMNIBASE_AUTH_URL environment variable is not configured
|
|
125
|
-
* @throws {Error} When the API request fails or configuration is invalid
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* Pricing table rendering:
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const products = await getAvailableProducts();
|
|
131
|
-
*
|
|
132
|
-
* products.forEach(product => {
|
|
133
|
-
* const display = product.pricing_display;
|
|
134
|
-
* console.log(`${display.name} - ${display.tagline}`);
|
|
135
|
-
*
|
|
136
|
-
* display.prices.forEach(price => {
|
|
137
|
-
* console.log(` ${price.display_name}: ${price.formatted_price}`);
|
|
138
|
-
* });
|
|
139
|
-
* });
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
declare function getAvailableProducts(): Promise<ProductWithPricingUI[]>;
|
|
143
|
-
/**
|
|
144
|
-
* Get a specific product by ID
|
|
145
|
-
*
|
|
146
|
-
* Retrieves a single product configuration by its ID from the current
|
|
147
|
-
* Stripe configuration. Useful for product-specific operations.
|
|
148
|
-
*
|
|
149
|
-
* @param productId - The configuration product ID to retrieve
|
|
150
|
-
* @returns Promise resolving to the product or null if not found
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* const product = await getProduct('starter_plan');
|
|
155
|
-
* if (product) {
|
|
156
|
-
* console.log(`Found product: ${product.name}`);
|
|
157
|
-
* }
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
declare function getProduct(productId: string): Promise<Product | null>;
|
|
161
|
-
|
|
162
|
-
type CheckoutOptions = {
|
|
163
|
-
price_id: string;
|
|
164
|
-
mode: "payment" | "subscription";
|
|
165
|
-
success_url: string;
|
|
166
|
-
cancel_url: string;
|
|
167
|
-
customer_id?: string;
|
|
168
|
-
};
|
|
169
|
-
type CreateCheckoutResponse = ApiResponse<{
|
|
170
|
-
url: string;
|
|
171
|
-
sessionId: string;
|
|
172
|
-
}>;
|
|
173
|
-
declare const createCheckout: (options: CheckoutOptions) => Promise<CreateCheckoutResponse>;
|
|
174
|
-
|
|
175
|
-
type PortalOptions = {
|
|
176
|
-
customer_id: string;
|
|
177
|
-
return_url: string;
|
|
178
|
-
};
|
|
179
|
-
type CreateCustomerPortalResponse = ApiResponse<{
|
|
180
|
-
url: string;
|
|
181
|
-
}>;
|
|
182
|
-
declare const createCustomerPortal: (options: PortalOptions) => Promise<CreateCustomerPortalResponse>;
|
|
183
|
-
|
|
184
|
-
type UsageOptions = {
|
|
185
|
-
meter_event_name: string;
|
|
186
|
-
customer_id: string;
|
|
187
|
-
value: string;
|
|
188
|
-
};
|
|
189
|
-
declare const recordUsage: (options: UsageOptions) => Promise<ApiResponse<"">>;
|
|
190
|
-
|
|
191
|
-
export { type CheckoutOptions, type CreateCheckoutResponse, type CreateCustomerPortalResponse, type PortalOptions, type Price, type PriceDisplay, type PriceLimit, type PriceUI, type Product, type ProductUI, type ProductWithPricingUI, type StripeConfigResponse, type StripeConfiguration, type Tier, type UsageOptions, createCheckout, createCustomerPortal, getAvailableProducts, getProduct, getStripeConfig, recordUsage };
|
|
1
|
+
export { k as CheckoutManager, i as CheckoutOptions, C as ConfigManager, j as CreateCheckoutResponse, m as CreateCustomerPortalResponse, P as PaymentHandler, n as PortalManager, l as PortalOptions, c as Price, f as PriceDisplay, g as PriceLimit, e as PriceUI, b as Product, d as ProductUI, h as ProductWithPricingUI, S as StripeConfigResponse, a as StripeConfiguration, T as Tier, o as UsageManager, U as UsageOptions } from '../tenants/index.js';
|
|
2
|
+
import '../permissions/index.js';
|
|
3
|
+
import '@ory/client';
|