@revealui/services 0.0.2 → 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 (112) hide show
  1. package/LICENSE +22 -202
  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 +35 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +46 -0
  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 +70 -54
  109. package/dist/.vite/ssr-manifest.json +0 -209
  110. package/dist/assets/index-Bai9hEWd.js +0 -16
  111. package/dist/assets/index-Bai9hEWd.js.map +0 -1
  112. package/dist/index.html +0 -23
package/LICENSE CHANGED
@@ -1,202 +1,22 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (which shall not include Communications that are clearly marked or
39
- otherwise designated in writing by the copyright owner as "Not a Work").
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is clearly marked or otherwise designated
61
- in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "page" as the copyright notice for easier identification within
188
- third-party archives.
189
-
190
- Copyright 2025 RevealUI Team
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
201
- implied. See the License for the specific language governing
202
- permissions and limitations under the License.
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,MA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":3,"file":"index.d.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,CAA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AAK,CAAC,4BAA4B,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