alchemy 0.24.0 → 0.24.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/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +1 -4
- package/lib/aws/function.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +3 -3
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +3 -3
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/index.d.ts +2 -0
- package/lib/cloudflare/do-state-store/index.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/index.js +2 -0
- package/lib/cloudflare/do-state-store/index.js.map +1 -0
- package/lib/cloudflare/do-state-store/internal.d.ts +19 -0
- package/lib/cloudflare/do-state-store/internal.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/internal.js +163 -0
- package/lib/cloudflare/do-state-store/internal.js.map +1 -0
- package/lib/cloudflare/do-state-store/store.d.ts +59 -0
- package/lib/cloudflare/do-state-store/store.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/store.js +120 -0
- package/lib/cloudflare/do-state-store/store.js.map +1 -0
- package/lib/cloudflare/do-state-store/types.d.ts +82 -0
- package/lib/cloudflare/do-state-store/types.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/types.js +1 -0
- package/lib/cloudflare/do-state-store/types.js.map +1 -0
- package/lib/cloudflare/do-state-store/worker.d.ts +27 -0
- package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -0
- package/lib/cloudflare/do-state-store/worker.js +170 -0
- package/lib/cloudflare/do-state-store/worker.js.map +1 -0
- package/lib/cloudflare/index.d.ts +1 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +1 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/pipeline.js +1 -1
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts +14 -1
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +17 -0
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/website.d.ts +30 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +8 -5
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-metadata.js +1 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +40 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +40 -38
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.js +1 -1
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/fs/file-system-state-store.d.ts +3 -1
- package/lib/fs/file-system-state-store.d.ts.map +1 -1
- package/lib/fs/file-system-state-store.js +2 -2
- package/lib/fs/file-system-state-store.js.map +1 -1
- package/lib/stripe/card.d.ts +171 -0
- package/lib/stripe/card.d.ts.map +1 -0
- package/lib/stripe/card.js +148 -0
- package/lib/stripe/card.js.map +1 -0
- package/lib/stripe/client.d.ts +9 -0
- package/lib/stripe/client.d.ts.map +1 -0
- package/lib/stripe/client.js +94 -0
- package/lib/stripe/client.js.map +1 -0
- package/lib/stripe/coupon.d.ts +135 -0
- package/lib/stripe/coupon.d.ts.map +1 -0
- package/lib/stripe/coupon.js +161 -0
- package/lib/stripe/coupon.js.map +1 -0
- package/lib/stripe/customer.d.ts +269 -0
- package/lib/stripe/customer.d.ts.map +1 -0
- package/lib/stripe/customer.js +289 -0
- package/lib/stripe/customer.js.map +1 -0
- package/lib/stripe/entitlements-feature.d.ts +84 -0
- package/lib/stripe/entitlements-feature.d.ts.map +1 -0
- package/lib/stripe/entitlements-feature.js +102 -0
- package/lib/stripe/entitlements-feature.js.map +1 -0
- package/lib/stripe/file.d.ts +143 -0
- package/lib/stripe/file.d.ts.map +1 -0
- package/lib/stripe/file.js +97 -0
- package/lib/stripe/file.js.map +1 -0
- package/lib/stripe/index.d.ts +11 -0
- package/lib/stripe/index.d.ts.map +1 -1
- package/lib/stripe/index.js +11 -0
- package/lib/stripe/index.js.map +1 -1
- package/lib/stripe/meter.d.ts +10 -1
- package/lib/stripe/meter.d.ts.map +1 -1
- package/lib/stripe/meter.js +13 -7
- package/lib/stripe/meter.js.map +1 -1
- package/lib/stripe/portal-configuration.d.ts +286 -0
- package/lib/stripe/portal-configuration.d.ts.map +1 -0
- package/lib/stripe/portal-configuration.js +320 -0
- package/lib/stripe/portal-configuration.js.map +1 -0
- package/lib/stripe/price.d.ts +10 -1
- package/lib/stripe/price.d.ts.map +1 -1
- package/lib/stripe/price.js +34 -13
- package/lib/stripe/price.js.map +1 -1
- package/lib/stripe/product-feature.d.ts +76 -0
- package/lib/stripe/product-feature.d.ts.map +1 -0
- package/lib/stripe/product-feature.js +74 -0
- package/lib/stripe/product-feature.js.map +1 -0
- package/lib/stripe/product.d.ts +10 -1
- package/lib/stripe/product.d.ts.map +1 -1
- package/lib/stripe/product.js +33 -14
- package/lib/stripe/product.js.map +1 -1
- package/lib/stripe/promotion-code.d.ts +138 -0
- package/lib/stripe/promotion-code.d.ts.map +1 -0
- package/lib/stripe/promotion-code.js +150 -0
- package/lib/stripe/promotion-code.js.map +1 -0
- package/lib/stripe/shipping-rate.d.ts +188 -0
- package/lib/stripe/shipping-rate.d.ts.map +1 -0
- package/lib/stripe/shipping-rate.js +198 -0
- package/lib/stripe/shipping-rate.js.map +1 -0
- package/lib/stripe/tax-rate.d.ts +130 -0
- package/lib/stripe/tax-rate.d.ts.map +1 -0
- package/lib/stripe/tax-rate.js +126 -0
- package/lib/stripe/tax-rate.js.map +1 -0
- package/lib/stripe/webhook.d.ts +10 -1
- package/lib/stripe/webhook.d.ts.map +1 -1
- package/lib/stripe/webhook.js +59 -14
- package/lib/stripe/webhook.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +2 -6
- package/lib/test/bun.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js +3 -7
- package/lib/test/vitest.js.map +1 -1
- package/lib/util/retry.d.ts +1 -1
- package/lib/util/retry.d.ts.map +1 -1
- package/lib/util/retry.js.map +1 -1
- package/package.json +2 -1
- package/src/aws/function.ts +3 -6
- package/src/cloudflare/bindings.ts +3 -2
- package/src/cloudflare/bound.ts +3 -3
- package/src/cloudflare/do-state-store/index.ts +1 -0
- package/src/cloudflare/do-state-store/internal.ts +215 -0
- package/src/cloudflare/do-state-store/store.ts +188 -0
- package/src/cloudflare/do-state-store/types.ts +74 -0
- package/src/cloudflare/do-state-store/worker.ts +199 -0
- package/src/cloudflare/index.ts +1 -0
- package/src/cloudflare/pipeline.ts +1 -1
- package/src/cloudflare/queue-consumer.ts +59 -1
- package/src/cloudflare/website.ts +38 -6
- package/src/cloudflare/worker-metadata.ts +1 -1
- package/src/cloudflare/worker.ts +66 -46
- package/src/cloudflare/wrangler.json.ts +1 -1
- package/src/fs/file-system-state-store.ts +7 -2
- package/src/stripe/card.ts +320 -0
- package/src/stripe/client.ts +145 -0
- package/src/stripe/coupon.ts +280 -0
- package/src/stripe/customer.ts +528 -0
- package/src/stripe/entitlements-feature.ts +169 -0
- package/src/stripe/file.ts +219 -0
- package/src/stripe/index.ts +11 -0
- package/src/stripe/meter.ts +23 -7
- package/src/stripe/portal-configuration.ts +609 -0
- package/src/stripe/price.ts +47 -14
- package/src/stripe/product-feature.ts +150 -0
- package/src/stripe/product.ts +48 -15
- package/src/stripe/promotion-code.ts +268 -0
- package/src/stripe/shipping-rate.ts +362 -0
- package/src/stripe/tax-rate.ts +218 -0
- package/src/stripe/webhook.ts +82 -15
- package/src/test/bun.ts +2 -7
- package/src/test/vitest.ts +3 -8
- package/src/util/retry.ts +1 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import type { Context } from "../context.ts";
|
|
3
|
+
import { Resource } from "../resource.ts";
|
|
4
|
+
import type { Secret } from "../secret.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Business profile information for the portal
|
|
7
|
+
*/
|
|
8
|
+
export interface PortalConfigurationBusinessProfile {
|
|
9
|
+
/**
|
|
10
|
+
* The messaging shown to customers in the portal
|
|
11
|
+
*/
|
|
12
|
+
headline?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A link to the business's publicly available privacy policy
|
|
15
|
+
*/
|
|
16
|
+
privacyPolicyUrl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A link to the business's publicly available terms of service
|
|
19
|
+
*/
|
|
20
|
+
termsOfServiceUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Customer update feature configuration
|
|
24
|
+
*/
|
|
25
|
+
export interface PortalCustomerUpdateFeature {
|
|
26
|
+
/**
|
|
27
|
+
* The types of customer update that are supported
|
|
28
|
+
*/
|
|
29
|
+
allowedUpdates?: Array<Stripe.BillingPortal.ConfigurationCreateParams.Features.CustomerUpdate.AllowedUpdate>;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the feature is enabled
|
|
32
|
+
*/
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Invoice history feature configuration
|
|
37
|
+
*/
|
|
38
|
+
export interface PortalInvoiceHistoryFeature {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the feature is enabled
|
|
41
|
+
*/
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Payment method update feature configuration
|
|
46
|
+
*/
|
|
47
|
+
export interface PortalPaymentMethodUpdateFeature {
|
|
48
|
+
/**
|
|
49
|
+
* Whether the feature is enabled
|
|
50
|
+
*/
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Subscription cancellation reason configuration
|
|
55
|
+
*/
|
|
56
|
+
export interface PortalSubscriptionCancellationReason {
|
|
57
|
+
/**
|
|
58
|
+
* Whether the feature is enabled
|
|
59
|
+
*/
|
|
60
|
+
enabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Which cancellation reasons will be given as options to the customer
|
|
63
|
+
*/
|
|
64
|
+
options?: Array<Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason.Option>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Subscription cancel feature configuration
|
|
68
|
+
*/
|
|
69
|
+
export interface PortalSubscriptionCancelFeature {
|
|
70
|
+
/**
|
|
71
|
+
* Cancellation reason configuration
|
|
72
|
+
*/
|
|
73
|
+
cancellationReason?: PortalSubscriptionCancellationReason;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the feature is enabled
|
|
76
|
+
*/
|
|
77
|
+
enabled?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to cancel subscriptions immediately or at the end of the billing period
|
|
80
|
+
*/
|
|
81
|
+
mode?: Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionCancel.Mode;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to create prorations when canceling subscriptions
|
|
84
|
+
*/
|
|
85
|
+
prorationBehavior?: Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionCancel.ProrationBehavior;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Subscription pause feature configuration
|
|
89
|
+
*/
|
|
90
|
+
export interface PortalSubscriptionPauseFeature {
|
|
91
|
+
/**
|
|
92
|
+
* Whether the feature is enabled
|
|
93
|
+
*/
|
|
94
|
+
enabled?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Subscription update product configuration
|
|
98
|
+
*/
|
|
99
|
+
export interface PortalSubscriptionUpdateProduct {
|
|
100
|
+
product: string;
|
|
101
|
+
prices?: string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Subscription update feature configuration
|
|
105
|
+
*/
|
|
106
|
+
export interface PortalSubscriptionUpdateFeature {
|
|
107
|
+
/**
|
|
108
|
+
* The types of subscription updates that are supported for items
|
|
109
|
+
*/
|
|
110
|
+
defaultAllowedUpdates?: Array<Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionUpdate.DefaultAllowedUpdate>;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the feature is enabled
|
|
113
|
+
*/
|
|
114
|
+
enabled?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* The list of products that support subscription updates
|
|
117
|
+
*/
|
|
118
|
+
products?: Array<PortalSubscriptionUpdateProduct>;
|
|
119
|
+
/**
|
|
120
|
+
* Determines how to handle prorations resulting from subscription updates
|
|
121
|
+
*/
|
|
122
|
+
prorationBehavior?: Stripe.BillingPortal.ConfigurationCreateParams.Features.SubscriptionUpdate.ProrationBehavior;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Features available in the customer portal
|
|
126
|
+
*/
|
|
127
|
+
export interface PortalConfigurationFeatures {
|
|
128
|
+
/**
|
|
129
|
+
* Information about updating the customer details in the portal
|
|
130
|
+
*/
|
|
131
|
+
customerUpdate?: PortalCustomerUpdateFeature;
|
|
132
|
+
/**
|
|
133
|
+
* Information about showing the billing history in the portal
|
|
134
|
+
*/
|
|
135
|
+
invoiceHistory?: PortalInvoiceHistoryFeature;
|
|
136
|
+
/**
|
|
137
|
+
* Information about updating payment methods in the portal
|
|
138
|
+
*/
|
|
139
|
+
paymentMethodUpdate?: PortalPaymentMethodUpdateFeature;
|
|
140
|
+
/**
|
|
141
|
+
* Information about canceling subscriptions in the portal
|
|
142
|
+
*/
|
|
143
|
+
subscriptionCancel?: PortalSubscriptionCancelFeature;
|
|
144
|
+
/**
|
|
145
|
+
* Information about pausing subscriptions in the portal
|
|
146
|
+
*/
|
|
147
|
+
subscriptionPause?: PortalSubscriptionPauseFeature;
|
|
148
|
+
/**
|
|
149
|
+
* Information about updating subscriptions in the portal
|
|
150
|
+
*/
|
|
151
|
+
subscriptionUpdate?: PortalSubscriptionUpdateFeature;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Properties for creating a Stripe portal configuration
|
|
155
|
+
*/
|
|
156
|
+
export interface PortalConfigurationProps {
|
|
157
|
+
/**
|
|
158
|
+
* The business information shown to customers in the portal
|
|
159
|
+
*/
|
|
160
|
+
businessProfile?: PortalConfigurationBusinessProfile;
|
|
161
|
+
/**
|
|
162
|
+
* The default URL to redirect customers to when they click on the portal's link to return to your website
|
|
163
|
+
*/
|
|
164
|
+
defaultReturnUrl?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Information about the features available in the portal
|
|
167
|
+
*/
|
|
168
|
+
features?: PortalConfigurationFeatures;
|
|
169
|
+
/**
|
|
170
|
+
* Set of key-value pairs that you can attach to an object
|
|
171
|
+
*/
|
|
172
|
+
metadata?: Record<string, string>;
|
|
173
|
+
/**
|
|
174
|
+
* API key to use (overrides environment variable)
|
|
175
|
+
*/
|
|
176
|
+
apiKey?: Secret;
|
|
177
|
+
/**
|
|
178
|
+
* If true, adopt existing resource if creation fails due to conflict
|
|
179
|
+
*/
|
|
180
|
+
adopt?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Output from the Stripe portal configuration
|
|
184
|
+
*/
|
|
185
|
+
export interface PortalConfiguration extends Resource<"stripe::PortalConfiguration">, PortalConfigurationProps {
|
|
186
|
+
/**
|
|
187
|
+
* The ID of the configuration
|
|
188
|
+
*/
|
|
189
|
+
id: string;
|
|
190
|
+
/**
|
|
191
|
+
* String representing the object's type
|
|
192
|
+
*/
|
|
193
|
+
object: "billing_portal.configuration";
|
|
194
|
+
/**
|
|
195
|
+
* Whether the configuration is active and can be used to create portal sessions
|
|
196
|
+
*/
|
|
197
|
+
active: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* ID of the Connect Application that created the configuration
|
|
200
|
+
*/
|
|
201
|
+
application?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Time at which the object was created
|
|
204
|
+
*/
|
|
205
|
+
created: number;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the configuration is the default
|
|
208
|
+
*/
|
|
209
|
+
isDefault: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Has the value true if the object exists in live mode or the value false if the object exists in test mode
|
|
212
|
+
*/
|
|
213
|
+
livemode: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Time at which the object was last updated
|
|
216
|
+
*/
|
|
217
|
+
updated: number;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Create and manage Stripe customer portal configurations
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* // Create a basic portal configuration
|
|
224
|
+
* const basicPortal = await PortalConfiguration("basic-portal", {
|
|
225
|
+
* businessProfile: {
|
|
226
|
+
* headline: "Manage your subscription",
|
|
227
|
+
* privacyPolicyUrl: "https://example.com/privacy",
|
|
228
|
+
* termsOfServiceUrl: "https://example.com/terms"
|
|
229
|
+
* },
|
|
230
|
+
* features: {
|
|
231
|
+
* invoiceHistory: { enabled: true },
|
|
232
|
+
* paymentMethodUpdate: { enabled: true }
|
|
233
|
+
* }
|
|
234
|
+
* });
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* // Create a portal with subscription management
|
|
238
|
+
* const subscriptionPortal = await PortalConfiguration("subscription-portal", {
|
|
239
|
+
* defaultReturnUrl: "https://example.com/account",
|
|
240
|
+
* features: {
|
|
241
|
+
* subscriptionCancel: {
|
|
242
|
+
* enabled: true,
|
|
243
|
+
* mode: "at_period_end",
|
|
244
|
+
* prorationBehavior: "none"
|
|
245
|
+
* },
|
|
246
|
+
* subscriptionUpdate: {
|
|
247
|
+
* enabled: true,
|
|
248
|
+
* defaultAllowedUpdates: ["price", "quantity"],
|
|
249
|
+
* prorationBehavior: "create_prorations"
|
|
250
|
+
* }
|
|
251
|
+
* }
|
|
252
|
+
* });
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* // Create a comprehensive portal configuration
|
|
256
|
+
* const fullPortal = await PortalConfiguration("full-portal", {
|
|
257
|
+
* businessProfile: {
|
|
258
|
+
* headline: "Manage your Acme Corp subscription",
|
|
259
|
+
* privacyPolicyUrl: "https://acme.com/privacy",
|
|
260
|
+
* termsOfServiceUrl: "https://acme.com/terms"
|
|
261
|
+
* },
|
|
262
|
+
* defaultReturnUrl: "https://acme.com/dashboard",
|
|
263
|
+
* features: {
|
|
264
|
+
* customerUpdate: {
|
|
265
|
+
* enabled: true,
|
|
266
|
+
* allowedUpdates: ["email", "address", "shipping", "phone", "tax_id"]
|
|
267
|
+
* },
|
|
268
|
+
* invoiceHistory: { enabled: true },
|
|
269
|
+
* paymentMethodUpdate: { enabled: true },
|
|
270
|
+
* subscriptionCancel: {
|
|
271
|
+
* enabled: true,
|
|
272
|
+
* mode: "immediately",
|
|
273
|
+
* cancellationReason: {
|
|
274
|
+
* enabled: true,
|
|
275
|
+
* options: ["too_expensive", "missing_features", "switched_service"]
|
|
276
|
+
* }
|
|
277
|
+
* }
|
|
278
|
+
* },
|
|
279
|
+
* metadata: {
|
|
280
|
+
* environment: "production",
|
|
281
|
+
* version: "v2"
|
|
282
|
+
* }
|
|
283
|
+
* });
|
|
284
|
+
*/
|
|
285
|
+
export declare const PortalConfiguration: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<PortalConfiguration>, _id: string, props: PortalConfigurationProps) => Promise<PortalConfiguration>);
|
|
286
|
+
//# sourceMappingURL=portal-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-configuration.d.ts","sourceRoot":"","sources":["../../src/stripe/portal-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE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AAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBACf,SAAQ,QAAQ,CAAC,6BAA6B,CAAC,EAC7C,wBAAwB;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,MAAM,EAAE,8BAA8B,CAAC;IACvC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,eAAO,MAAM,mBAAmB,yFAGtB,OAAO,CAAC,mBAAmB,CAAC,OAC7B,MAAM,SACJ,wBAAwB,KAC9B,OAAO,CAAC,mBAAmB,CAAC,CAwShC,CAAC"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { Resource } from "../resource.js";
|
|
2
|
+
import { createStripeClient, handleStripeDeleteError, isStripeConflictError, } from "./client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create and manage Stripe customer portal configurations
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Create a basic portal configuration
|
|
8
|
+
* const basicPortal = await PortalConfiguration("basic-portal", {
|
|
9
|
+
* businessProfile: {
|
|
10
|
+
* headline: "Manage your subscription",
|
|
11
|
+
* privacyPolicyUrl: "https://example.com/privacy",
|
|
12
|
+
* termsOfServiceUrl: "https://example.com/terms"
|
|
13
|
+
* },
|
|
14
|
+
* features: {
|
|
15
|
+
* invoiceHistory: { enabled: true },
|
|
16
|
+
* paymentMethodUpdate: { enabled: true }
|
|
17
|
+
* }
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Create a portal with subscription management
|
|
22
|
+
* const subscriptionPortal = await PortalConfiguration("subscription-portal", {
|
|
23
|
+
* defaultReturnUrl: "https://example.com/account",
|
|
24
|
+
* features: {
|
|
25
|
+
* subscriptionCancel: {
|
|
26
|
+
* enabled: true,
|
|
27
|
+
* mode: "at_period_end",
|
|
28
|
+
* prorationBehavior: "none"
|
|
29
|
+
* },
|
|
30
|
+
* subscriptionUpdate: {
|
|
31
|
+
* enabled: true,
|
|
32
|
+
* defaultAllowedUpdates: ["price", "quantity"],
|
|
33
|
+
* prorationBehavior: "create_prorations"
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Create a comprehensive portal configuration
|
|
40
|
+
* const fullPortal = await PortalConfiguration("full-portal", {
|
|
41
|
+
* businessProfile: {
|
|
42
|
+
* headline: "Manage your Acme Corp subscription",
|
|
43
|
+
* privacyPolicyUrl: "https://acme.com/privacy",
|
|
44
|
+
* termsOfServiceUrl: "https://acme.com/terms"
|
|
45
|
+
* },
|
|
46
|
+
* defaultReturnUrl: "https://acme.com/dashboard",
|
|
47
|
+
* features: {
|
|
48
|
+
* customerUpdate: {
|
|
49
|
+
* enabled: true,
|
|
50
|
+
* allowedUpdates: ["email", "address", "shipping", "phone", "tax_id"]
|
|
51
|
+
* },
|
|
52
|
+
* invoiceHistory: { enabled: true },
|
|
53
|
+
* paymentMethodUpdate: { enabled: true },
|
|
54
|
+
* subscriptionCancel: {
|
|
55
|
+
* enabled: true,
|
|
56
|
+
* mode: "immediately",
|
|
57
|
+
* cancellationReason: {
|
|
58
|
+
* enabled: true,
|
|
59
|
+
* options: ["too_expensive", "missing_features", "switched_service"]
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* },
|
|
63
|
+
* metadata: {
|
|
64
|
+
* environment: "production",
|
|
65
|
+
* version: "v2"
|
|
66
|
+
* }
|
|
67
|
+
* });
|
|
68
|
+
*/
|
|
69
|
+
export const PortalConfiguration = Resource("stripe::PortalConfiguration", async function (_id, props) {
|
|
70
|
+
const stripe = createStripeClient({ apiKey: props.apiKey });
|
|
71
|
+
if (this.phase === "delete") {
|
|
72
|
+
try {
|
|
73
|
+
if (this.output?.id) {
|
|
74
|
+
const existingConfig = await stripe.billingPortal.configurations.retrieve(this.output.id);
|
|
75
|
+
if (!existingConfig.is_default) {
|
|
76
|
+
await stripe.billingPortal.configurations.update(this.output.id, {
|
|
77
|
+
active: false,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
handleStripeDeleteError(error, "PortalConfiguration", this.output?.id);
|
|
84
|
+
}
|
|
85
|
+
return this.destroy();
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
let configuration;
|
|
89
|
+
if (this.phase === "update" && this.output?.id) {
|
|
90
|
+
const updateParams = {
|
|
91
|
+
business_profile: props.businessProfile
|
|
92
|
+
? {
|
|
93
|
+
headline: props.businessProfile.headline,
|
|
94
|
+
privacy_policy_url: props.businessProfile.privacyPolicyUrl,
|
|
95
|
+
terms_of_service_url: props.businessProfile.termsOfServiceUrl,
|
|
96
|
+
}
|
|
97
|
+
: undefined,
|
|
98
|
+
default_return_url: props.defaultReturnUrl,
|
|
99
|
+
metadata: props.metadata,
|
|
100
|
+
};
|
|
101
|
+
if (props.features) {
|
|
102
|
+
updateParams.features = {
|
|
103
|
+
customer_update: props.features.customerUpdate
|
|
104
|
+
? {
|
|
105
|
+
allowed_updates: props.features.customerUpdate.allowedUpdates || [],
|
|
106
|
+
enabled: props.features.customerUpdate.enabled || false,
|
|
107
|
+
}
|
|
108
|
+
: { enabled: false },
|
|
109
|
+
invoice_history: props.features.invoiceHistory
|
|
110
|
+
? {
|
|
111
|
+
enabled: props.features.invoiceHistory.enabled || false,
|
|
112
|
+
}
|
|
113
|
+
: undefined,
|
|
114
|
+
payment_method_update: props.features.paymentMethodUpdate
|
|
115
|
+
? {
|
|
116
|
+
enabled: props.features.paymentMethodUpdate.enabled || false,
|
|
117
|
+
}
|
|
118
|
+
: undefined,
|
|
119
|
+
subscription_cancel: props.features.subscriptionCancel
|
|
120
|
+
? {
|
|
121
|
+
cancellation_reason: props.features.subscriptionCancel
|
|
122
|
+
.cancellationReason
|
|
123
|
+
? {
|
|
124
|
+
enabled: props.features.subscriptionCancel.cancellationReason
|
|
125
|
+
.enabled || false,
|
|
126
|
+
options: props.features.subscriptionCancel.cancellationReason
|
|
127
|
+
.options || [],
|
|
128
|
+
}
|
|
129
|
+
: undefined,
|
|
130
|
+
enabled: props.features.subscriptionCancel.enabled || false,
|
|
131
|
+
mode: props.features.subscriptionCancel.mode || "immediately",
|
|
132
|
+
proration_behavior: props.features.subscriptionCancel.prorationBehavior ||
|
|
133
|
+
"none",
|
|
134
|
+
}
|
|
135
|
+
: undefined,
|
|
136
|
+
subscription_update: props.features.subscriptionUpdate
|
|
137
|
+
? {
|
|
138
|
+
default_allowed_updates: props.features.subscriptionUpdate.defaultAllowedUpdates ||
|
|
139
|
+
[],
|
|
140
|
+
enabled: props.features.subscriptionUpdate.enabled || false,
|
|
141
|
+
products: props.features.subscriptionUpdate.products?.map((p) => ({
|
|
142
|
+
product: p.product,
|
|
143
|
+
prices: p.prices || [],
|
|
144
|
+
})) || [],
|
|
145
|
+
proration_behavior: props.features.subscriptionUpdate.prorationBehavior ||
|
|
146
|
+
"none",
|
|
147
|
+
}
|
|
148
|
+
: undefined,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
configuration = await stripe.billingPortal.configurations.update(this.output.id, updateParams);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const createParams = {
|
|
155
|
+
business_profile: props.businessProfile
|
|
156
|
+
? {
|
|
157
|
+
headline: props.businessProfile.headline,
|
|
158
|
+
privacy_policy_url: props.businessProfile.privacyPolicyUrl,
|
|
159
|
+
terms_of_service_url: props.businessProfile.termsOfServiceUrl,
|
|
160
|
+
}
|
|
161
|
+
: undefined,
|
|
162
|
+
default_return_url: props.defaultReturnUrl,
|
|
163
|
+
metadata: props.metadata,
|
|
164
|
+
features: {
|
|
165
|
+
customer_update: { enabled: false },
|
|
166
|
+
invoice_history: { enabled: true },
|
|
167
|
+
payment_method_update: { enabled: true },
|
|
168
|
+
subscription_cancel: { enabled: true },
|
|
169
|
+
subscription_update: {
|
|
170
|
+
enabled: false,
|
|
171
|
+
default_allowed_updates: [],
|
|
172
|
+
products: [],
|
|
173
|
+
proration_behavior: "none",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
if (props.features) {
|
|
178
|
+
createParams.features = {
|
|
179
|
+
customer_update: props.features.customerUpdate
|
|
180
|
+
? {
|
|
181
|
+
allowed_updates: props.features.customerUpdate.allowedUpdates || [],
|
|
182
|
+
enabled: props.features.customerUpdate.enabled || false,
|
|
183
|
+
}
|
|
184
|
+
: { enabled: false },
|
|
185
|
+
invoice_history: props.features.invoiceHistory
|
|
186
|
+
? {
|
|
187
|
+
enabled: props.features.invoiceHistory.enabled || false,
|
|
188
|
+
}
|
|
189
|
+
: undefined,
|
|
190
|
+
payment_method_update: props.features.paymentMethodUpdate
|
|
191
|
+
? {
|
|
192
|
+
enabled: props.features.paymentMethodUpdate.enabled || false,
|
|
193
|
+
}
|
|
194
|
+
: undefined,
|
|
195
|
+
subscription_cancel: props.features.subscriptionCancel
|
|
196
|
+
? {
|
|
197
|
+
cancellation_reason: props.features.subscriptionCancel
|
|
198
|
+
.cancellationReason
|
|
199
|
+
? {
|
|
200
|
+
enabled: props.features.subscriptionCancel.cancellationReason
|
|
201
|
+
.enabled || false,
|
|
202
|
+
options: props.features.subscriptionCancel.cancellationReason
|
|
203
|
+
.options || [],
|
|
204
|
+
}
|
|
205
|
+
: undefined,
|
|
206
|
+
enabled: props.features.subscriptionCancel.enabled || false,
|
|
207
|
+
mode: props.features.subscriptionCancel.mode || "immediately",
|
|
208
|
+
proration_behavior: props.features.subscriptionCancel.prorationBehavior ||
|
|
209
|
+
"none",
|
|
210
|
+
}
|
|
211
|
+
: undefined,
|
|
212
|
+
subscription_update: props.features.subscriptionUpdate
|
|
213
|
+
? {
|
|
214
|
+
default_allowed_updates: props.features.subscriptionUpdate.defaultAllowedUpdates ||
|
|
215
|
+
[],
|
|
216
|
+
enabled: props.features.subscriptionUpdate.enabled || false,
|
|
217
|
+
products: props.features.subscriptionUpdate.products?.map((p) => ({
|
|
218
|
+
product: p.product,
|
|
219
|
+
prices: p.prices || [],
|
|
220
|
+
})) || [],
|
|
221
|
+
proration_behavior: props.features.subscriptionUpdate.prorationBehavior ||
|
|
222
|
+
"none",
|
|
223
|
+
}
|
|
224
|
+
: undefined,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
configuration =
|
|
229
|
+
await stripe.billingPortal.configurations.create(createParams);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (isStripeConflictError(error) && props.adopt) {
|
|
233
|
+
throw new Error("PortalConfiguration adoption is not supported - portal configurations cannot be uniquely identified for adoption");
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return this({
|
|
241
|
+
id: configuration.id,
|
|
242
|
+
object: configuration.object,
|
|
243
|
+
active: configuration.active,
|
|
244
|
+
application: typeof configuration.application === "string"
|
|
245
|
+
? configuration.application
|
|
246
|
+
: undefined,
|
|
247
|
+
businessProfile: configuration.business_profile
|
|
248
|
+
? {
|
|
249
|
+
headline: configuration.business_profile.headline || undefined,
|
|
250
|
+
privacyPolicyUrl: configuration.business_profile.privacy_policy_url || undefined,
|
|
251
|
+
termsOfServiceUrl: configuration.business_profile.terms_of_service_url ||
|
|
252
|
+
undefined,
|
|
253
|
+
}
|
|
254
|
+
: undefined,
|
|
255
|
+
created: configuration.created,
|
|
256
|
+
defaultReturnUrl: configuration.default_return_url || undefined,
|
|
257
|
+
features: {
|
|
258
|
+
customerUpdate: configuration.features.customer_update
|
|
259
|
+
? {
|
|
260
|
+
allowedUpdates: configuration.features.customer_update.allowed_updates ||
|
|
261
|
+
undefined,
|
|
262
|
+
enabled: configuration.features.customer_update.enabled || undefined,
|
|
263
|
+
}
|
|
264
|
+
: undefined,
|
|
265
|
+
invoiceHistory: configuration.features.invoice_history
|
|
266
|
+
? {
|
|
267
|
+
enabled: configuration.features.invoice_history.enabled || undefined,
|
|
268
|
+
}
|
|
269
|
+
: undefined,
|
|
270
|
+
paymentMethodUpdate: configuration.features.payment_method_update
|
|
271
|
+
? {
|
|
272
|
+
enabled: configuration.features.payment_method_update.enabled ||
|
|
273
|
+
undefined,
|
|
274
|
+
}
|
|
275
|
+
: undefined,
|
|
276
|
+
subscriptionCancel: configuration.features.subscription_cancel
|
|
277
|
+
? {
|
|
278
|
+
cancellationReason: configuration.features.subscription_cancel
|
|
279
|
+
.cancellation_reason
|
|
280
|
+
? {
|
|
281
|
+
enabled: configuration.features.subscription_cancel
|
|
282
|
+
.cancellation_reason.enabled || undefined,
|
|
283
|
+
options: configuration.features.subscription_cancel
|
|
284
|
+
.cancellation_reason.options || undefined,
|
|
285
|
+
}
|
|
286
|
+
: undefined,
|
|
287
|
+
enabled: configuration.features.subscription_cancel.enabled ||
|
|
288
|
+
undefined,
|
|
289
|
+
mode: configuration.features.subscription_cancel.mode || undefined,
|
|
290
|
+
prorationBehavior: configuration.features.subscription_cancel
|
|
291
|
+
.proration_behavior || undefined,
|
|
292
|
+
}
|
|
293
|
+
: undefined,
|
|
294
|
+
subscriptionUpdate: configuration.features.subscription_update
|
|
295
|
+
? {
|
|
296
|
+
defaultAllowedUpdates: configuration.features.subscription_update
|
|
297
|
+
.default_allowed_updates || undefined,
|
|
298
|
+
enabled: configuration.features.subscription_update.enabled ||
|
|
299
|
+
undefined,
|
|
300
|
+
products: configuration.features.subscription_update.products?.map((p) => ({
|
|
301
|
+
product: p.product,
|
|
302
|
+
prices: p.prices || undefined,
|
|
303
|
+
})) || undefined,
|
|
304
|
+
prorationBehavior: configuration.features.subscription_update
|
|
305
|
+
.proration_behavior || undefined,
|
|
306
|
+
}
|
|
307
|
+
: undefined,
|
|
308
|
+
},
|
|
309
|
+
isDefault: configuration.is_default,
|
|
310
|
+
livemode: configuration.livemode,
|
|
311
|
+
metadata: configuration.metadata || undefined,
|
|
312
|
+
updated: configuration.updated,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
console.error("Error creating/updating portal configuration:", error);
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
//# sourceMappingURL=portal-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-configuration.js","sourceRoot":"","sources":["../../src/stripe/portal-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAwOrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CACzC,6BAA6B,EAC7B,KAAK,WAEH,GAAW,EACX,KAA+B;IAE/B,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5D,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,MA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,QAAQ,CAAC,mBAAmB;6BACvC,kBAAkB,IAAI,SAAS;qBACrC;oBACH,CAAC,CAAC,SAAS;aACd;YACD,SAAS,EAAE,aAAa,CAAC,UAAU;YACnC,QAAQ,EAAE,aAAa,CAAC,QAAQ;YAChC,QAAQ,EAAE,aAAa,CAAC,QAAQ,IAAI,SAAS;YAC7C,OAAO,EAAE,aAAa,CAAC,OAAO;SAC/B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;QACtE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC"}
|
package/lib/stripe/price.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import Stripe from "stripe";
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
2
|
import type { Context } from "../context.ts";
|
|
3
3
|
import { Resource } from "../resource.ts";
|
|
4
|
+
import type { Secret } from "../secret.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Properties for price recurring configuration
|
|
6
7
|
*/
|
|
@@ -89,6 +90,14 @@ export interface PriceProps {
|
|
|
89
90
|
* If set to true, will atomically transfer the lookup key from an existing price to this price.
|
|
90
91
|
*/
|
|
91
92
|
transferLookupKey?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* API key to use (overrides environment variable)
|
|
95
|
+
*/
|
|
96
|
+
apiKey?: Secret;
|
|
97
|
+
/**
|
|
98
|
+
* If true, adopt existing resource if creation fails due to conflict
|
|
99
|
+
*/
|
|
100
|
+
adopt?: boolean;
|
|
92
101
|
}
|
|
93
102
|
/**
|
|
94
103
|
* Output from the Stripe price
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/stripe/price.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":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