@revealui/services 0.0.3 → 0.1.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.
Files changed (108) hide show
  1. package/LICENSE +22 -0
  2. package/LICENSE.commercial +112 -0
  3. package/README.md +177 -0
  4. package/dist/api/create-checkout-session/index.d.ts +2 -0
  5. package/dist/api/create-checkout-session/index.d.ts.map +1 -0
  6. package/dist/api/create-checkout-session/index.js +61 -0
  7. package/dist/api/create-checkout-session/index.js.map +1 -0
  8. package/dist/api/create-portal-link/index.d.ts +2 -0
  9. package/dist/api/create-portal-link/index.d.ts.map +1 -0
  10. package/dist/api/create-portal-link/index.js +37 -0
  11. package/dist/api/create-portal-link/index.js.map +1 -0
  12. package/dist/api/handlers/customer-handlers.d.ts +27 -0
  13. package/dist/api/handlers/customer-handlers.d.ts.map +1 -0
  14. package/dist/api/handlers/customer-handlers.js +86 -0
  15. package/dist/api/handlers/customer-handlers.js.map +1 -0
  16. package/dist/api/handlers/index.d.ts +18 -0
  17. package/dist/api/handlers/index.d.ts.map +1 -0
  18. package/dist/api/handlers/index.js +18 -0
  19. package/dist/api/handlers/index.js.map +1 -0
  20. package/dist/api/handlers/invoice-handlers.d.ts +9 -0
  21. package/dist/api/handlers/invoice-handlers.d.ts.map +1 -0
  22. package/dist/api/handlers/invoice-handlers.js +52 -0
  23. package/dist/api/handlers/invoice-handlers.js.map +1 -0
  24. package/dist/api/handlers/payment-handlers.d.ts +13 -0
  25. package/dist/api/handlers/payment-handlers.d.ts.map +1 -0
  26. package/dist/api/handlers/payment-handlers.js +133 -0
  27. package/dist/api/handlers/payment-handlers.js.map +1 -0
  28. package/dist/api/handlers/payment-intent.d.ts +21 -0
  29. package/dist/api/handlers/payment-intent.d.ts.map +1 -0
  30. package/dist/api/handlers/payment-intent.js +87 -0
  31. package/dist/api/handlers/payment-intent.js.map +1 -0
  32. package/dist/api/handlers/product-handlers.d.ts +11 -0
  33. package/dist/api/handlers/product-handlers.d.ts.map +1 -0
  34. package/dist/api/handlers/product-handlers.js +43 -0
  35. package/dist/api/handlers/product-handlers.js.map +1 -0
  36. package/dist/api/handlers/subscription-handlers.d.ts +13 -0
  37. package/dist/api/handlers/subscription-handlers.d.ts.map +1 -0
  38. package/dist/api/handlers/subscription-handlers.js +115 -0
  39. package/dist/api/handlers/subscription-handlers.js.map +1 -0
  40. package/dist/api/index.d.ts +8 -0
  41. package/dist/api/index.d.ts.map +1 -0
  42. package/dist/api/index.js +8 -0
  43. package/dist/api/index.js.map +1 -0
  44. package/dist/api/types/stripe.d.ts +42 -0
  45. package/dist/api/types/stripe.d.ts.map +1 -0
  46. package/dist/api/types/stripe.js +72 -0
  47. package/dist/api/types/stripe.js.map +1 -0
  48. package/dist/api/update-price/index.d.ts +42 -0
  49. package/dist/api/update-price/index.d.ts.map +1 -0
  50. package/dist/api/update-price/index.js +78 -0
  51. package/dist/api/update-price/index.js.map +1 -0
  52. package/dist/api/update-product/index.d.ts +44 -0
  53. package/dist/api/update-product/index.d.ts.map +1 -0
  54. package/dist/api/update-product/index.js +85 -0
  55. package/dist/api/update-product/index.js.map +1 -0
  56. package/dist/api/utils.d.ts +34 -0
  57. package/dist/api/utils.d.ts.map +1 -0
  58. package/dist/api/utils.js +66 -0
  59. package/dist/api/utils.js.map +1 -0
  60. package/dist/api/webhooks/index.d.ts +2 -0
  61. package/dist/api/webhooks/index.d.ts.map +1 -0
  62. package/dist/api/webhooks/index.js +270 -0
  63. package/dist/api/webhooks/index.js.map +1 -0
  64. package/dist/client/index.d.ts +11 -0
  65. package/dist/client/index.d.ts.map +1 -0
  66. package/dist/client/index.js +12 -0
  67. package/dist/client/index.js.map +1 -0
  68. package/dist/index.d.ts +32 -24
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +45 -41
  71. package/dist/index.js.map +1 -0
  72. package/dist/stripe/db-circuit-breaker.d.ts +47 -0
  73. package/dist/stripe/db-circuit-breaker.d.ts.map +1 -0
  74. package/dist/stripe/db-circuit-breaker.js +223 -0
  75. package/dist/stripe/db-circuit-breaker.js.map +1 -0
  76. package/dist/stripe/index.d.ts +2 -0
  77. package/dist/stripe/index.d.ts.map +1 -0
  78. package/dist/stripe/index.js +2 -0
  79. package/dist/stripe/index.js.map +1 -0
  80. package/dist/stripe/stripeClient.d.ts +126 -0
  81. package/dist/stripe/stripeClient.d.ts.map +1 -0
  82. package/dist/stripe/stripeClient.js +226 -0
  83. package/dist/stripe/stripeClient.js.map +1 -0
  84. package/dist/supabase/index.d.ts +6 -0
  85. package/dist/supabase/index.d.ts.map +1 -0
  86. package/dist/supabase/index.js +5 -0
  87. package/dist/supabase/index.js.map +1 -0
  88. package/dist/supabase/resilience.d.ts +50 -0
  89. package/dist/supabase/resilience.d.ts.map +1 -0
  90. package/dist/supabase/resilience.js +166 -0
  91. package/dist/supabase/resilience.js.map +1 -0
  92. package/dist/supabase/types.d.ts +206 -0
  93. package/dist/supabase/types.d.ts.map +1 -0
  94. package/dist/supabase/types.js +19 -0
  95. package/dist/supabase/types.js.map +1 -0
  96. package/dist/supabase/utils/client.d.ts +4 -0
  97. package/dist/supabase/utils/client.d.ts.map +1 -0
  98. package/dist/supabase/utils/client.js +12 -0
  99. package/dist/supabase/utils/client.js.map +1 -0
  100. package/dist/supabase/utils/server.d.ts +10 -0
  101. package/dist/supabase/utils/server.d.ts.map +1 -0
  102. package/dist/supabase/utils/server.js +49 -0
  103. package/dist/supabase/utils/server.js.map +1 -0
  104. package/dist/supabase/utils/web.d.ts +4 -0
  105. package/dist/supabase/utils/web.d.ts.map +1 -0
  106. package/dist/supabase/utils/web.js +37 -0
  107. package/dist/supabase/utils/web.js.map +1 -0
  108. package/package.json +73 -16
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 RevealUI Studio
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.
22
+
@@ -0,0 +1,112 @@
1
+ RevealUI Commercial License
2
+ Version 1.0, February 2026
3
+
4
+ Copyright (c) 2025-2026 RevealUI Studio (founder@revealui.com)
5
+
6
+ TERMS AND CONDITIONS
7
+
8
+ 1. DEFINITIONS
9
+
10
+ "Software" means the RevealUI source code, documentation, and associated
11
+ files contained in directories and packages designated as commercial,
12
+ including but not limited to: packages/ai, packages/mcp, packages/editors,
13
+ packages/services, packages/harnesses, and any directory named "ee" within
14
+ the repository.
15
+
16
+ "License Key" means a valid RevealUI license key obtained through an active
17
+ paid subscription at https://revealui.com.
18
+
19
+ "Licensee" means the individual or organization that holds a valid License
20
+ Key through an active subscription.
21
+
22
+ "Production Use" means any use of the Software beyond local development and
23
+ evaluation, including but not limited to: deploying the Software to serve
24
+ end users, integrating the Software into a product or service, or using the
25
+ Software in a revenue-generating capacity.
26
+
27
+ 2. GRANT OF RIGHTS
28
+
29
+ Subject to the terms of this License and a valid License Key, the Licensee
30
+ is granted a non-exclusive, non-transferable, revocable license to:
31
+
32
+ (a) Use the Software for internal development and Production Use.
33
+ (b) Modify the Software for internal use.
34
+ (c) Deploy the Software on infrastructure controlled by the Licensee.
35
+
36
+ Enterprise License holders are additionally granted the right to:
37
+
38
+ (d) Deploy the Software in a self-hosted environment.
39
+ (e) Remove or replace RevealUI branding (white-label).
40
+ (f) Use the Software for multiple tenants within the Licensee's
41
+ organization or customer base.
42
+
43
+ 3. RESTRICTIONS
44
+
45
+ The Licensee SHALL NOT:
46
+
47
+ (a) Provide the Software, or any portion of it, to third parties as a
48
+ hosted or managed service that competes with RevealUI.
49
+ (b) Redistribute, sublicense, sell, or otherwise transfer the Software
50
+ or any portion of it to third parties.
51
+ (c) Remove, alter, or circumvent the license key verification
52
+ functionality of the Software.
53
+ (d) Use the Software in Production without a valid License Key.
54
+ (e) Share, publish, or make the License Key available to unauthorized
55
+ parties.
56
+
57
+ 4. EVALUATION
58
+
59
+ The Software may be used for evaluation and local development purposes
60
+ without a License Key. Evaluation use does not grant any rights to
61
+ Production Use.
62
+
63
+ 5. SUBSCRIPTION AND PAYMENT
64
+
65
+ This License is valid only during the term of an active paid subscription.
66
+ Upon cancellation or expiration of the subscription:
67
+
68
+ (a) The License terminates automatically.
69
+ (b) A grace period of fourteen (14) days is provided for the Licensee
70
+ to transition away from Production Use.
71
+ (c) After the grace period, the Licensee must cease all Production Use
72
+ of the Software.
73
+
74
+ 6. INTELLECTUAL PROPERTY
75
+
76
+ The Software is and remains the intellectual property of RevealUI Studio.
77
+ This License does not grant any ownership rights. Contributions to
78
+ commercial portions of the Software require a Contributor License Agreement.
79
+
80
+ 7. OPEN SOURCE COMPONENTS
81
+
82
+ This License applies only to files and directories designated as commercial.
83
+ Files under the MIT License (as indicated in the root LICENSE file) are not
84
+ subject to this commercial license and may be used freely under MIT terms.
85
+
86
+ 8. DISCLAIMER OF WARRANTY
87
+
88
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
90
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
91
+
92
+ 9. LIMITATION OF LIABILITY
93
+
94
+ IN NO EVENT SHALL REVEALUI STUDIO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
96
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
97
+ DEALINGS IN THE SOFTWARE, EXCEEDING THE AMOUNT PAID BY THE LICENSEE IN
98
+ THE TWELVE (12) MONTHS PRECEDING THE CLAIM.
99
+
100
+ 10. GOVERNING LAW
101
+
102
+ This License shall be governed by the laws of the State of California,
103
+ United States of America, without regard to its conflict of law provisions.
104
+
105
+ 11. ENTIRE AGREEMENT
106
+
107
+ This License constitutes the entire agreement between the parties with
108
+ respect to the commercial portions of the Software and supersedes all
109
+ prior agreements, understandings, and communications.
110
+
111
+ For licensing inquiries: founder@revealui.com
112
+ For pricing and subscriptions: https://revealui.com/pricing
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # @revealui/services
2
+
3
+ > **Commercial package** — requires a [RevealUI Pro license](https://revealui.com/pro). Free to install and evaluate; a license key is required for production use.
4
+
5
+
6
+ External service integrations for RevealUI — Stripe, Supabase, and Vercel.
7
+
8
+ ## Features
9
+
10
+ - **Stripe Integration**: Payment processing and billing operations
11
+ - **Supabase Integration**: Database and auth client utilities
12
+ - **Vercel Integration**: Blob storage and deployment management
13
+ - **Type-safe**: Full TypeScript support
14
+ - **Server & Client**: Separate exports for server-side and client-side usage
15
+
16
+ ## Installation
17
+
18
+ This package is private and only used within the RevealUI monorepo via `workspace:*` references.
19
+
20
+ ## Usage
21
+
22
+ ### Server-side
23
+
24
+ ```typescript
25
+ import { stripeClient } from '@revealui/services/server'
26
+
27
+ // Use Stripe
28
+ const customer = await stripeClient.customers.create({
29
+ email: 'customer@example.com',
30
+ name: 'Customer Name'
31
+ })
32
+ ```
33
+
34
+ ### Client-side
35
+
36
+ ```typescript
37
+ import { createSupabaseClient } from '@revealui/services/client'
38
+
39
+ const supabase = createSupabaseClient()
40
+
41
+ // Query data
42
+ const { data, error } = await supabase
43
+ .from('posts')
44
+ .select('*')
45
+ .eq('published', true)
46
+ ```
47
+
48
+ ## Available Exports
49
+
50
+ ### `@revealui/services/server`
51
+
52
+ Server-side integrations (Node.js/Next.js API routes only):
53
+
54
+ - Stripe client
55
+ - Supabase admin client
56
+ - Vercel API client
57
+
58
+ ### `@revealui/services/client`
59
+
60
+ Client-side integrations (browser-safe):
61
+
62
+ - Supabase client factory
63
+ - Browser-compatible utilities
64
+
65
+ ## Stripe Integration
66
+
67
+ ```typescript
68
+ import { stripeClient } from '@revealui/services/server'
69
+
70
+ // Create customer
71
+ const customer = await stripeClient.customers.create({
72
+ email: 'user@example.com'
73
+ })
74
+
75
+ // Create payment intent
76
+ const paymentIntent = await stripeClient.paymentIntents.create({
77
+ amount: 2000,
78
+ currency: 'usd',
79
+ customer: customer.id
80
+ })
81
+
82
+ // Create subscription
83
+ const subscription = await stripeClient.subscriptions.create({
84
+ customer: customer.id,
85
+ items: [{ price: 'price_xxxxx' }]
86
+ })
87
+ ```
88
+
89
+ ## Supabase Integration
90
+
91
+ ```typescript
92
+ import { createSupabaseClient } from '@revealui/services/client'
93
+
94
+ const supabase = createSupabaseClient()
95
+
96
+ // Query data
97
+ const { data: posts } = await supabase
98
+ .from('posts')
99
+ .select('*')
100
+ .order('created_at', { ascending: false })
101
+
102
+ // Insert data
103
+ const { data: newPost } = await supabase
104
+ .from('posts')
105
+ .insert({ title: 'New Post', content: 'Content here' })
106
+ .select()
107
+ .single()
108
+
109
+ // Real-time subscription
110
+ const channel = supabase
111
+ .channel('posts-changes')
112
+ .on('postgres_changes', {
113
+ event: '*',
114
+ schema: 'public',
115
+ table: 'posts'
116
+ }, (payload) => {
117
+ console.log('Change detected:', payload)
118
+ })
119
+ .subscribe()
120
+ ```
121
+
122
+ ## Environment Variables
123
+
124
+ Required environment variables:
125
+
126
+ ```env
127
+ # Stripe
128
+ STRIPE_SECRET_KEY=sk_test_...
129
+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
130
+
131
+ # Supabase
132
+ SUPABASE_URL=https://....supabase.co
133
+ SUPABASE_ANON_KEY=eyJ...
134
+ SUPABASE_SERVICE_ROLE_KEY=eyJ...
135
+
136
+ # Vercel
137
+ VERCEL_API_KEY=vercel_...
138
+ BLOB_READ_WRITE_TOKEN=vercel_blob_...
139
+ ```
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ # Build package
145
+ pnpm --filter @revealui/services build
146
+
147
+ # Run tests
148
+ pnpm --filter @revealui/services test
149
+
150
+ # Watch mode
151
+ pnpm --filter @revealui/services dev
152
+
153
+ # Type check
154
+ pnpm --filter @revealui/services typecheck
155
+ ```
156
+
157
+ ## Testing
158
+
159
+ ```bash
160
+ # Run all tests
161
+ pnpm --filter @revealui/services test
162
+
163
+ # Run tests in watch mode
164
+ pnpm --filter @revealui/services test:watch
165
+
166
+ # Run with coverage
167
+ pnpm --filter @revealui/services test:coverage
168
+ ```
169
+
170
+ ## Related Documentation
171
+
172
+ - [Environment Variables Guide](../../docs/ENVIRONMENT_VARIABLES_GUIDE.md) - Service API keys setup
173
+ - [Architecture](../../docs/ARCHITECTURE.md) - Service integration patterns
174
+
175
+ ## License
176
+
177
+ Commercial — see [LICENSE.commercial](../../LICENSE.commercial)
@@ -0,0 +1,2 @@
1
+ export declare function POST(request: Request): Promise<Response>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/create-checkout-session/index.ts"],"names":[],"mappings":"AAWA,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiE9D"}
@@ -0,0 +1,61 @@
1
+ import { logger } from '@revealui/core/utils/logger';
2
+ import { protectedStripe } from '../../stripe/stripeClient.js';
3
+ import { createServerClientFromRequest } from '../../supabase/index.js';
4
+ import { createOrRetrieveCustomer, getURL } from '../utils.js';
5
+ export async function POST(request) {
6
+ logger.debug('Checkout session request received');
7
+ const body = (await request.json());
8
+ const { price, quantity = 1, metadata = {} } = body;
9
+ const supabase = createServerClientFromRequest(request);
10
+ if (!supabase) {
11
+ return new Response('Supabase client not available', { status: 500 });
12
+ }
13
+ try {
14
+ const { data: { user }, } = await supabase.auth.getUser();
15
+ logger.debug('User retrieved for checkout', { userId: user?.id });
16
+ const customer = await createOrRetrieveCustomer({
17
+ uuid: user?.id || '',
18
+ email: user?.email || '',
19
+ supabase,
20
+ });
21
+ const customerId = typeof customer === 'string'
22
+ ? customer
23
+ : typeof customer === 'object' && customer !== null && 'stripe_customer_id' in customer
24
+ ? customer.stripe_customer_id
25
+ : null;
26
+ if (!customerId) {
27
+ return new Response('Failed to create or retrieve customer', {
28
+ status: 500,
29
+ });
30
+ }
31
+ const session = await protectedStripe.checkout.sessions.create({
32
+ payment_method_types: ['card'],
33
+ billing_address_collection: 'required',
34
+ customer: customerId,
35
+ line_items: [
36
+ {
37
+ price: price.id,
38
+ quantity,
39
+ },
40
+ ],
41
+ mode: 'subscription',
42
+ allow_promotion_codes: true,
43
+ subscription_data: {
44
+ trial_period_days: 7,
45
+ metadata: metadata,
46
+ },
47
+ success_url: `${getURL()}/account`,
48
+ cancel_url: `${getURL()}/`,
49
+ });
50
+ return new Response(JSON.stringify({ sessionId: session.id }), {
51
+ headers: {
52
+ 'Content-Type': 'application/json',
53
+ },
54
+ });
55
+ }
56
+ catch (err) {
57
+ logger.error('Error creating checkout session', { error: err });
58
+ return new Response('Internal Error', { status: 500 });
59
+ }
60
+ }
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/create-checkout-session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MA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.ts","sourceRoot":"","sources":["../../../src/api/create-portal-link/index.ts"],"names":[],"mappings":"AAKA,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmC9D"}
@@ -0,0 +1,37 @@
1
+ import { logger } from '@revealui/core/utils/logger';
2
+ import { protectedStripe } from '../../stripe/stripeClient.js';
3
+ import { createServerClientFromRequest } from '../../supabase/index.js';
4
+ import { createOrRetrieveCustomer, getURL } from '../utils.js';
5
+ export async function POST(request) {
6
+ const supabase = createServerClientFromRequest(request);
7
+ if (!supabase) {
8
+ return new Response('Supabase client not available', { status: 500 });
9
+ }
10
+ try {
11
+ const { data: { user }, } = await supabase.auth.getUser();
12
+ if (!user)
13
+ throw Error('Could not get user');
14
+ const customer = await createOrRetrieveCustomer({
15
+ uuid: user.id || '',
16
+ email: user.email || '',
17
+ supabase,
18
+ });
19
+ const customerId = typeof customer === 'string'
20
+ ? customer
21
+ : typeof customer === 'object' && customer !== null && 'stripe_customer_id' in customer
22
+ ? customer.stripe_customer_id
23
+ : null;
24
+ if (!customerId)
25
+ throw Error('Could not get customer');
26
+ const { url } = await protectedStripe.billingPortal.sessions.create({
27
+ customer: customerId,
28
+ return_url: `${getURL()}/account`,
29
+ });
30
+ return Response.json({ url });
31
+ }
32
+ catch (err) {
33
+ logger.error('Error creating portal link', { error: err });
34
+ return new Response('Internal Error', { status: 500 });
35
+ }
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/create-portal-link/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE9D,MA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BAA4B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QAC1D,OAAO,IAAI,QAAQ,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACxD,CAAC;AACH,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Customer and billing handlers for Stripe webhooks
3
+ */
4
+ import type Stripe from 'stripe';
5
+ import type { SupabaseClient } from '../../supabase/index.js';
6
+ import type { Database } from '../../supabase/types.js';
7
+ import type { StripeWebhookEvent } from '../types/stripe.js';
8
+ export declare const createOrRetrieveCustomer: ({ email, uuid, supabase, }: {
9
+ email: string;
10
+ uuid: string | number;
11
+ supabase: SupabaseClient<Database>;
12
+ }) => Promise<string | {
13
+ stripe_customer_id: string | null;
14
+ }>;
15
+ export declare const copyBillingDetailsToCustomer: (uuid: string | number, paymentMethod: Stripe.PaymentMethod, supabase: SupabaseClient<Database>) => Promise<void>;
16
+ /**
17
+ * Log customer creation events. The RevealUI user record is created during
18
+ * checkout via createOrRetrieveCustomer; this handler covers customers created
19
+ * outside that flow (e.g., from the Stripe dashboard or another integration).
20
+ */
21
+ export declare const handleCustomerCreated: (event: StripeWebhookEvent<"customer.created">) => void;
22
+ /**
23
+ * Log customer update events. Billing detail syncing is handled by
24
+ * handlePaymentMethodAttached; no additional action is required here.
25
+ */
26
+ export declare const handleCustomerUpdated: (event: StripeWebhookEvent<"customer.updated">) => void;
27
+ //# sourceMappingURL=customer-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-handlers.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/customer-handlers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAG5D,eAAO,MAAM,wBAAwB,GAAU,4BAI5C;IACD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;CACnC,KAAG,OAAO,CAAC,MAAM,GAAG;IAAE,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAyBzD,CAAA;AAED,eAAO,MAAM,4BAA4B,GACvC,MAAM,MAAM,GAAG,MAAM,EACrB,eAAe,MAAM,CAAC,aAAa,EACnC,UAAU,cAAc,CAAC,QAAQ,CAAC,KACjC,OAAO,CAAC,IAAI,CA6Bd,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,KAAG,IAMrF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,KAAG,IAMrF,CAAA"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Customer and billing handlers for Stripe webhooks
3
+ */
4
+ import { logger } from '@revealui/core/utils/logger';
5
+ import { protectedStripe } from '../../stripe/stripeClient.js';
6
+ import { extractCustomerId } from '../types/stripe.js';
7
+ export const createOrRetrieveCustomer = async ({ email, uuid, supabase, }) => {
8
+ const { data, error } = await supabase
9
+ .from('users')
10
+ .select('stripe_customer_id')
11
+ .eq('id', String(uuid))
12
+ .single();
13
+ if (error || !data) {
14
+ const customerData = {
15
+ metadata: {
16
+ supabaseUUID: String(uuid),
17
+ ...(email ? { email } : {}),
18
+ },
19
+ };
20
+ const customer = await protectedStripe.customers.create(customerData);
21
+ const { error: supabaseError } = await supabase.from('users').insert([
22
+ {
23
+ email: email,
24
+ stripe_customer_id: customer.id,
25
+ },
26
+ ]);
27
+ if (supabaseError)
28
+ throw supabaseError;
29
+ logger.info('New customer created and inserted', { uuid });
30
+ return customer.id;
31
+ }
32
+ return data;
33
+ };
34
+ export const copyBillingDetailsToCustomer = async (uuid, paymentMethod, supabase) => {
35
+ const customerId = extractCustomerId(paymentMethod.customer);
36
+ if (!customerId) {
37
+ throw new Error('Payment method does not have a valid customer ID');
38
+ }
39
+ const { name, phone, address } = paymentMethod.billing_details;
40
+ if (!(name && phone && address))
41
+ return;
42
+ const updateParams = {
43
+ ...(name ? { name } : {}),
44
+ ...(phone ? { phone } : {}),
45
+ ...(address
46
+ ? {
47
+ address: {
48
+ city: address.city ?? undefined,
49
+ country: address.country ?? undefined,
50
+ line1: address.line1 ?? undefined,
51
+ line2: address.line2 ?? undefined,
52
+ postal_code: address.postal_code ?? undefined,
53
+ state: address.state ?? undefined,
54
+ },
55
+ }
56
+ : {}),
57
+ };
58
+ await protectedStripe.customers.update(customerId, updateParams);
59
+ const { error } = await supabase.from('users').update({}).eq('id', String(uuid));
60
+ if (error)
61
+ throw error;
62
+ };
63
+ /**
64
+ * Log customer creation events. The RevealUI user record is created during
65
+ * checkout via createOrRetrieveCustomer; this handler covers customers created
66
+ * outside that flow (e.g., from the Stripe dashboard or another integration).
67
+ */
68
+ export const handleCustomerCreated = (event) => {
69
+ const customer = event.data.object;
70
+ logger.info('Stripe customer created', {
71
+ customerId: customer.id,
72
+ email: customer.email ?? '(no email)',
73
+ });
74
+ };
75
+ /**
76
+ * Log customer update events. Billing detail syncing is handled by
77
+ * handlePaymentMethodAttached; no additional action is required here.
78
+ */
79
+ export const handleCustomerUpdated = (event) => {
80
+ const customer = event.data.object;
81
+ logger.info('Stripe customer updated', {
82
+ customerId: customer.id,
83
+ email: customer.email ?? '(no email)',
84
+ });
85
+ };
86
+ //# sourceMappingURL=customer-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer-handlers.js","sourceRoot":"","sources":["../../../src/api/handlers/customer-handlers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B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AChF,IAAI,KAAK;QAAE,MAAM,KAAK,CAAA;AACxB,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAA6C,EAAQ,EAAE;IAC3F,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAA;IAClC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QACrC,UAAU,EAAE,QAAQ,CAAC,EAAE;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,YAAY;KACtC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAA6C,EAAQ,EAAE;IAC3F,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAA;IAClC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QACrC,UAAU,EAAE,QAAQ,CAAC,EAAE;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,YAAY;KACtC,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Stripe webhook and API handlers
3
+ *
4
+ * Split from the monolithic api/utils.ts into focused modules:
5
+ * - subscription-handlers: Subscription lifecycle management
6
+ * - invoice-handlers: Invoice payment events
7
+ * - product-handlers: Product and price record management
8
+ * - customer-handlers: Customer and billing management
9
+ * - payment-handlers: Payment method and setup intent events
10
+ * - payment-intent: Payment intent creation
11
+ */
12
+ export { copyBillingDetailsToCustomer, createOrRetrieveCustomer, handleCustomerCreated, handleCustomerUpdated, } from './customer-handlers.js';
13
+ export { handleInvoicePaymentFailed, handleInvoicePaymentSucceeded } from './invoice-handlers.js';
14
+ export { handlePaymentMethodAttached, handlePaymentMethodCreated, handlePaymentMethodDetached, handlePaymentMethodUpdated, handleSetupIntentFailed, handleSetupIntentSucceeded, } from './payment-handlers.js';
15
+ export { createPaymentIntent } from './payment-intent.js';
16
+ export { toDateTime, upsertPriceRecord, upsertProductRecord, upsertRecord, } from './product-handlers.js';
17
+ export { handleCheckoutSessionCompleted, handleCustomerSubscriptionCreated, handleCustomerSubscriptionDeleted, handleCustomerSubscriptionUpdated, handleSupabaseError, manageSubscriptionStatusChange, } from './subscription-handlers.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AACjG,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Stripe webhook and API handlers
3
+ *
4
+ * Split from the monolithic api/utils.ts into focused modules:
5
+ * - subscription-handlers: Subscription lifecycle management
6
+ * - invoice-handlers: Invoice payment events
7
+ * - product-handlers: Product and price record management
8
+ * - customer-handlers: Customer and billing management
9
+ * - payment-handlers: Payment method and setup intent events
10
+ * - payment-intent: Payment intent creation
11
+ */
12
+ export { copyBillingDetailsToCustomer, createOrRetrieveCustomer, handleCustomerCreated, handleCustomerUpdated, } from './customer-handlers.js';
13
+ export { handleInvoicePaymentFailed, handleInvoicePaymentSucceeded } from './invoice-handlers.js';
14
+ export { handlePaymentMethodAttached, handlePaymentMethodCreated, handlePaymentMethodDetached, handlePaymentMethodUpdated, handleSetupIntentFailed, handleSetupIntentSucceeded, } from './payment-handlers.js';
15
+ export { createPaymentIntent } from './payment-intent.js';
16
+ export { toDateTime, upsertPriceRecord, upsertProductRecord, upsertRecord, } from './product-handlers.js';
17
+ export { handleCheckoutSessionCompleted, handleCustomerSubscriptionCreated, handleCustomerSubscriptionDeleted, handleCustomerSubscriptionUpdated, handleSupabaseError, manageSubscriptionStatusChange, } from './subscription-handlers.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AACjG,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Invoice event handlers for Stripe webhooks
3
+ */
4
+ import type { SupabaseClient } from '../../supabase/index.js';
5
+ import type { Database } from '../../supabase/types.js';
6
+ import type { StripeWebhookEvent } from '../types/stripe.js';
7
+ export declare const handleInvoicePaymentSucceeded: (event: StripeWebhookEvent<"invoice.payment_succeeded">, supabase: SupabaseClient<Database>) => Promise<void>;
8
+ export declare function handleInvoicePaymentFailed(event: StripeWebhookEvent<'invoice.payment_failed'>, supabase: SupabaseClient<Database>): Promise<void>;
9
+ //# sourceMappingURL=invoice-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-handlers.d.ts","sourceRoot":"","sources":["../../../src/api/handlers/invoice-handlers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAI5D,eAAO,MAAM,6BAA6B,GACxC,OAAO,kBAAkB,CAAC,2BAA2B,CAAC,EACtD,UAAU,cAAc,CAAC,QAAQ,CAAC,KACjC,OAAO,CAAC,IAAI,CAwBd,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,EACnD,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC,CAwBf"}