@elevasis/core 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1662 -23
- package/dist/index.js +171 -24
- package/dist/organization-model/index.d.ts +1662 -23
- package/dist/organization-model/index.js +171 -24
- package/dist/test-utils/index.d.ts +711 -10
- package/dist/test-utils/index.js +159 -16
- package/package.json +7 -3
- package/src/__tests__/publish.test.ts +14 -13
- package/src/__tests__/template-core-compatibility.test.ts +4 -4
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +305 -201
- package/src/auth/multi-tenancy/index.ts +3 -0
- package/src/auth/multi-tenancy/theme-presets.ts +45 -0
- package/src/auth/multi-tenancy/types.ts +57 -83
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
- package/src/business/acquisition/activity-events.ts +1 -1
- package/src/business/acquisition/api-schemas.ts +1196 -1177
- package/src/business/acquisition/crm-state-actions.test.ts +139 -139
- package/src/business/acquisition/types.ts +381 -390
- package/src/business/crm/api-schemas.ts +40 -0
- package/src/business/crm/index.ts +1 -0
- package/src/business/deals/api-schemas.ts +79 -0
- package/src/business/deals/index.ts +1 -0
- package/src/business/projects/types.ts +124 -88
- package/src/execution/core/runner-types.ts +61 -80
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
- package/src/execution/engine/tools/integration/tool.ts +255 -253
- package/src/execution/engine/tools/lead-service-types.ts +895 -894
- package/src/execution/engine/tools/messages.ts +43 -0
- package/src/execution/engine/tools/platform/acquisition/types.ts +2 -1
- package/src/execution/engine/tools/platform/email/types.ts +97 -96
- package/src/execution/engine/tools/types.ts +234 -233
- package/src/execution/engine/workflow/types.ts +195 -193
- package/src/execution/external/api-schemas.ts +40 -0
- package/src/execution/external/index.ts +1 -0
- package/src/knowledge/README.md +32 -0
- package/src/knowledge/__tests__/queries.test.ts +504 -0
- package/src/knowledge/format.ts +99 -0
- package/src/knowledge/index.ts +5 -0
- package/src/knowledge/queries.ts +256 -0
- package/src/organization-model/__tests__/defaults.test.ts +172 -172
- package/src/organization-model/__tests__/foundation.test.ts +7 -7
- package/src/organization-model/__tests__/icons.test.ts +27 -0
- package/src/organization-model/__tests__/knowledge.test.ts +214 -0
- package/src/organization-model/contracts.ts +17 -15
- package/src/organization-model/defaults.ts +74 -19
- package/src/organization-model/domains/knowledge.ts +53 -0
- package/src/organization-model/domains/navigation.ts +416 -399
- package/src/organization-model/domains/shared.ts +6 -5
- package/src/organization-model/foundation.ts +10 -6
- package/src/organization-model/graph/build.ts +209 -182
- package/src/organization-model/graph/schema.ts +37 -34
- package/src/organization-model/graph/types.ts +47 -31
- package/src/organization-model/icons.ts +81 -0
- package/src/organization-model/index.ts +8 -3
- package/src/organization-model/organization-model.mdx +1 -1
- package/src/organization-model/published.ts +103 -86
- package/src/organization-model/schema.ts +90 -85
- package/src/organization-model/types.ts +40 -33
- package/src/platform/index.ts +23 -27
- package/src/platform/registry/index.ts +0 -4
- package/src/platform/registry/resource-registry.ts +0 -77
- package/src/platform/registry/serialized-types.ts +148 -219
- package/src/platform/registry/stats-types.ts +60 -60
- package/src/reference/_generated/contracts.md +1265 -1154
|
@@ -1,309 +1,310 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import type { Tool } from '../../../../types'
|
|
3
|
-
import { createIntegrationTool } from '../../../tool'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* const
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- Create link
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* @
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* const
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* const
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* const
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* @
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* const
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* @
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* const
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
-
|
|
291
|
-
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { Tool } from '../../../../types'
|
|
3
|
+
import { createIntegrationTool } from '../../../tool'
|
|
4
|
+
import { EmailSchema } from '../../../../../../../platform/utils/validation'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a tool that generates Stripe payment links
|
|
8
|
+
*
|
|
9
|
+
* @param credentialName - Name of the Stripe credential to use
|
|
10
|
+
* @returns Tool instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const tool = createStripeCreatePaymentLinkTool('elevasis-stripe')
|
|
15
|
+
* const result = await tool.execute({
|
|
16
|
+
* priceId: 'price_xxx',
|
|
17
|
+
* metadata: { deal_id: 'deal-123' },
|
|
18
|
+
* redirectUrl: 'https://app.elevasis.io/payment-success'
|
|
19
|
+
* }, context)
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function createStripeCreatePaymentLinkTool(credentialName: string): Tool {
|
|
23
|
+
return createIntegrationTool({
|
|
24
|
+
name: 'stripe_create_payment_link',
|
|
25
|
+
description: `Create a Stripe payment link for collecting payments.
|
|
26
|
+
|
|
27
|
+
Use this tool to generate a payment URL that can be sent to customers.
|
|
28
|
+
The link directs to Stripe's hosted checkout page.
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
- Create link for proposal payment: priceId, metadata with deal_id, redirectUrl
|
|
32
|
+
- Create link with invoice: set invoiceCreation=true`,
|
|
33
|
+
inputSchema: z.object({
|
|
34
|
+
priceId: z.string().describe('Stripe price ID (price_xxx)'),
|
|
35
|
+
quantity: z.number().optional().default(1).describe('Quantity of items'),
|
|
36
|
+
metadata: z.record(z.string(), z.string()).optional().describe('Custom metadata'),
|
|
37
|
+
afterCompletionType: z
|
|
38
|
+
.enum(['redirect', 'hosted_confirmation'])
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('What happens after payment'),
|
|
41
|
+
redirectUrl: z.string().url().optional().describe('URL to redirect after payment'),
|
|
42
|
+
allowPromotionCodes: z.boolean().optional().describe('Allow promo codes'),
|
|
43
|
+
automaticTax: z.boolean().optional().describe('Enable automatic tax'),
|
|
44
|
+
billingAddressCollection: z.enum(['auto', 'required']).optional().describe('Billing address mode'),
|
|
45
|
+
invoiceCreation: z.boolean().optional().describe('Generate invoice')
|
|
46
|
+
}),
|
|
47
|
+
outputSchema: z.object({
|
|
48
|
+
id: z.string().describe('Payment link ID (plink_xxx)'),
|
|
49
|
+
url: z.string().describe('Shareable payment URL'),
|
|
50
|
+
active: z.boolean().describe('Whether the link is active'),
|
|
51
|
+
livemode: z.boolean().describe('Whether in production mode')
|
|
52
|
+
}),
|
|
53
|
+
integration: 'stripe' as const,
|
|
54
|
+
method: 'createPaymentLink' as const,
|
|
55
|
+
credentialName
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Create a tool that retrieves a Stripe payment link
|
|
61
|
+
*
|
|
62
|
+
* @param credentialName - Name of the Stripe credential to use
|
|
63
|
+
* @returns Tool instance
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const tool = createStripeGetPaymentLinkTool('elevasis-stripe')
|
|
68
|
+
* const result = await tool.execute({
|
|
69
|
+
* paymentLinkId: 'plink_xxx'
|
|
70
|
+
* }, context)
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export function createStripeGetPaymentLinkTool(credentialName: string): Tool {
|
|
74
|
+
return createIntegrationTool({
|
|
75
|
+
name: 'stripe_get_payment_link',
|
|
76
|
+
description: `Get details of a Stripe payment link.
|
|
77
|
+
|
|
78
|
+
Use this tool to retrieve information about an existing payment link,
|
|
79
|
+
including its URL, status, and metadata.
|
|
80
|
+
|
|
81
|
+
Useful for:
|
|
82
|
+
- Checking if a payment link is still active
|
|
83
|
+
- Retrieving the URL for a previously created link
|
|
84
|
+
- Accessing metadata associated with the link`,
|
|
85
|
+
inputSchema: z.object({
|
|
86
|
+
paymentLinkId: z.string().describe('Payment link ID (plink_xxx)')
|
|
87
|
+
}),
|
|
88
|
+
outputSchema: z.object({
|
|
89
|
+
id: z.string().describe('Payment link ID'),
|
|
90
|
+
url: z.string().describe('Shareable payment URL'),
|
|
91
|
+
active: z.boolean().describe('Whether the link is active'),
|
|
92
|
+
livemode: z.boolean().describe('Whether in production mode'),
|
|
93
|
+
metadata: z.record(z.string(), z.string()).describe('Custom metadata')
|
|
94
|
+
}),
|
|
95
|
+
integration: 'stripe' as const,
|
|
96
|
+
method: 'getPaymentLink' as const,
|
|
97
|
+
credentialName
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Create a tool that updates a Stripe payment link
|
|
103
|
+
*
|
|
104
|
+
* @param credentialName - Name of the Stripe credential to use
|
|
105
|
+
* @returns Tool instance
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const tool = createStripeUpdatePaymentLinkTool('elevasis-stripe')
|
|
110
|
+
* const result = await tool.execute({
|
|
111
|
+
* paymentLinkId: 'plink_xxx',
|
|
112
|
+
* active: false // Deactivate the link
|
|
113
|
+
* }, context)
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export function createStripeUpdatePaymentLinkTool(credentialName: string): Tool {
|
|
117
|
+
return createIntegrationTool({
|
|
118
|
+
name: 'stripe_update_payment_link',
|
|
119
|
+
description: `Update a Stripe payment link.
|
|
120
|
+
|
|
121
|
+
Use this tool to modify an existing payment link.
|
|
122
|
+
Common operations:
|
|
123
|
+
- Deactivate a link (set active=false)
|
|
124
|
+
- Update metadata
|
|
125
|
+
|
|
126
|
+
Note: You cannot change the price after creation.`,
|
|
127
|
+
inputSchema: z.object({
|
|
128
|
+
paymentLinkId: z.string().describe('Payment link ID (plink_xxx)'),
|
|
129
|
+
active: z.boolean().optional().describe('Enable or disable the link'),
|
|
130
|
+
metadata: z.record(z.string(), z.string()).optional().describe('Update metadata')
|
|
131
|
+
}),
|
|
132
|
+
outputSchema: z.object({
|
|
133
|
+
id: z.string().describe('Payment link ID'),
|
|
134
|
+
active: z.boolean().describe('Whether the link is active'),
|
|
135
|
+
url: z.string().describe('Shareable payment URL')
|
|
136
|
+
}),
|
|
137
|
+
integration: 'stripe' as const,
|
|
138
|
+
method: 'updatePaymentLink' as const,
|
|
139
|
+
credentialName
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Create a tool that lists Stripe payment links
|
|
145
|
+
*
|
|
146
|
+
* @param credentialName - Name of the Stripe credential to use
|
|
147
|
+
* @returns Tool instance
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const tool = createStripeListPaymentLinksTool('elevasis-stripe')
|
|
152
|
+
* const result = await tool.execute({
|
|
153
|
+
* active: true,
|
|
154
|
+
* limit: 10
|
|
155
|
+
* }, context)
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export function createStripeListPaymentLinksTool(credentialName: string): Tool {
|
|
159
|
+
return createIntegrationTool({
|
|
160
|
+
name: 'stripe_list_payment_links',
|
|
161
|
+
description: `List Stripe payment links.
|
|
162
|
+
|
|
163
|
+
Use this tool to retrieve a list of payment links.
|
|
164
|
+
Supports filtering by active status and pagination.
|
|
165
|
+
|
|
166
|
+
Useful for:
|
|
167
|
+
- Finding active payment links
|
|
168
|
+
- Auditing created links
|
|
169
|
+
- Paginating through large numbers of links`,
|
|
170
|
+
inputSchema: z.object({
|
|
171
|
+
active: z.boolean().optional().describe('Filter by active status'),
|
|
172
|
+
limit: z.number().min(1).max(100).optional().describe('Number of links to return (1-100)'),
|
|
173
|
+
startingAfter: z.string().optional().describe('Cursor for pagination (payment link ID)'),
|
|
174
|
+
endingBefore: z.string().optional().describe('Cursor for pagination (payment link ID)')
|
|
175
|
+
}),
|
|
176
|
+
outputSchema: z.object({
|
|
177
|
+
data: z
|
|
178
|
+
.array(
|
|
179
|
+
z.object({
|
|
180
|
+
id: z.string().describe('Payment link ID'),
|
|
181
|
+
url: z.string().describe('Shareable payment URL'),
|
|
182
|
+
active: z.boolean().describe('Whether the link is active'),
|
|
183
|
+
metadata: z.record(z.string(), z.string()).describe('Custom metadata')
|
|
184
|
+
})
|
|
185
|
+
)
|
|
186
|
+
.describe('List of payment links'),
|
|
187
|
+
hasMore: z.boolean().describe('Whether more results are available')
|
|
188
|
+
}),
|
|
189
|
+
integration: 'stripe' as const,
|
|
190
|
+
method: 'listPaymentLinks' as const,
|
|
191
|
+
credentialName
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Create a tool that generates Stripe checkout sessions for custom amounts
|
|
197
|
+
*
|
|
198
|
+
* Use this for variable/custom pricing where the amount comes from the proposal.
|
|
199
|
+
* Unlike payment links (which require pre-defined price IDs), checkout sessions
|
|
200
|
+
* support price_data with any unit_amount.
|
|
201
|
+
*
|
|
202
|
+
* @param credentialName - Name of the Stripe credential to use
|
|
203
|
+
* @returns Tool instance
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const tool = createStripeCheckoutSessionTool('elevasis-stripe')
|
|
208
|
+
* const result = await tool.execute({
|
|
209
|
+
* amount: 2400000, // $24,000 in cents
|
|
210
|
+
* metadata: { deal_id: 'deal-123' },
|
|
211
|
+
* successUrl: 'https://app.elevasis.io/payment-success',
|
|
212
|
+
* cancelUrl: 'https://app.elevasis.io/payment-cancelled'
|
|
213
|
+
* }, context)
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
export function createStripeCheckoutSessionTool(credentialName: string): Tool {
|
|
217
|
+
return createIntegrationTool({
|
|
218
|
+
name: 'stripe_create_checkout_session',
|
|
219
|
+
description: `Create a Stripe checkout session for custom-amount payments.
|
|
220
|
+
|
|
221
|
+
Use this tool for variable pricing where the amount comes from the proposal.
|
|
222
|
+
Creates a one-time payment URL that expires in 24 hours.
|
|
223
|
+
|
|
224
|
+
Key differences from payment links:
|
|
225
|
+
- Supports any amount (no pre-defined price IDs needed)
|
|
226
|
+
- URL expires in 24 hours (must recreate if needed)
|
|
227
|
+
- Created per-transaction (not reusable)
|
|
228
|
+
|
|
229
|
+
Examples:
|
|
230
|
+
- Collect payment for signed proposal: amount from proposal, metadata with deal_id
|
|
231
|
+
- Customer receives hosted Stripe checkout page`,
|
|
232
|
+
inputSchema: z.object({
|
|
233
|
+
amount: z.number().int().positive().describe('Amount in cents (e.g., 2400000 for $24,000)'),
|
|
234
|
+
currency: z.string().optional().default('usd').describe('Currency code (default: usd)'),
|
|
235
|
+
productName: z.string().optional().describe('Product name shown in checkout'),
|
|
236
|
+
productDescription: z.string().optional().describe('Product description'),
|
|
237
|
+
metadata: z.record(z.string(), z.string()).optional().describe('Metadata (deal_id, etc.)'),
|
|
238
|
+
successUrl: z.string().url().describe('URL after successful payment'),
|
|
239
|
+
cancelUrl: z.string().url().describe('URL if customer cancels'),
|
|
240
|
+
customerEmail: EmailSchema.optional().describe('Pre-fill customer email')
|
|
241
|
+
}),
|
|
242
|
+
outputSchema: z.object({
|
|
243
|
+
id: z.string().describe('Session ID (cs_xxx)'),
|
|
244
|
+
url: z.string().describe('Payment URL (expires in 24h)'),
|
|
245
|
+
expiresAt: z.number().describe('Expiration timestamp (Unix seconds)')
|
|
246
|
+
}),
|
|
247
|
+
integration: 'stripe' as const,
|
|
248
|
+
method: 'createCheckoutSession' as const,
|
|
249
|
+
credentialName
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Create a tool that generates Stripe payment links with dynamic pricing
|
|
255
|
+
*
|
|
256
|
+
* Unlike standard payment links (which require pre-created Price IDs),
|
|
257
|
+
* this tool uses inline price_data for dynamic pricing. Supports both
|
|
258
|
+
* one-time setup fees and recurring monthly subscriptions.
|
|
259
|
+
*
|
|
260
|
+
* @param credentialName - Name of the Stripe credential to use
|
|
261
|
+
* @returns Tool instance
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const tool = createStripeAutoPaymentLinkTool('elevasis-stripe')
|
|
266
|
+
* const result = await tool.execute({
|
|
267
|
+
* dealId: 'deal-123',
|
|
268
|
+
* companyName: 'Acme Corp',
|
|
269
|
+
* contactEmail: 'john@acme.com',
|
|
270
|
+
* initialFee: 3000, // $3,000 one-time
|
|
271
|
+
* monthlyFee: 500 // $500/month recurring
|
|
272
|
+
* }, context)
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
export function createStripeAutoPaymentLinkTool(credentialName: string): Tool {
|
|
276
|
+
return createIntegrationTool({
|
|
277
|
+
name: 'stripe_create_auto_payment_link',
|
|
278
|
+
description: `Create a Stripe payment link with dynamic pricing (inline price_data).
|
|
279
|
+
|
|
280
|
+
Use this tool for variable pricing with both one-time and recurring fees.
|
|
281
|
+
URLs NEVER EXPIRE - same link can be used in all reminder emails.
|
|
282
|
+
|
|
283
|
+
Key features:
|
|
284
|
+
- Supports dynamic amounts (no pre-defined Price IDs needed)
|
|
285
|
+
- Can include both one-time setup fee AND monthly recurring in one link
|
|
286
|
+
- URL never expires (unlike checkout sessions)
|
|
287
|
+
- Metadata propagates to all webhooks (checkout.session.completed, etc.)
|
|
288
|
+
|
|
289
|
+
Examples:
|
|
290
|
+
- Setup + monthly: initialFee=3000, monthlyFee=500 ($3,000 one-time + $500/month)
|
|
291
|
+
- Monthly only: initialFee=0, monthlyFee=500 ($500/month subscription)
|
|
292
|
+
- One-time only: initialFee=3000, monthlyFee=0 ($3,000 one-time payment)`,
|
|
293
|
+
inputSchema: z.object({
|
|
294
|
+
dealId: z.string().describe('Local deal ID for metadata'),
|
|
295
|
+
companyName: z.string().describe('Company name for product description'),
|
|
296
|
+
contactEmail: EmailSchema.describe('Contact email for metadata'),
|
|
297
|
+
initialFee: z.number().min(0).describe('One-time setup fee in dollars (e.g., 3000 for $3,000)'),
|
|
298
|
+
monthlyFee: z.number().min(0).describe('Recurring monthly fee in dollars (e.g., 500 for $500/month)')
|
|
299
|
+
}),
|
|
300
|
+
outputSchema: z.object({
|
|
301
|
+
paymentLinkId: z.string().describe('Payment link ID (plink_xxx)'),
|
|
302
|
+
url: z.string().describe('Payment URL (NEVER EXPIRES)'),
|
|
303
|
+
hasInitialFee: z.boolean().describe('Whether link includes one-time fee'),
|
|
304
|
+
hasRecurring: z.boolean().describe('Whether link includes recurring subscription')
|
|
305
|
+
}),
|
|
306
|
+
integration: 'stripe' as const,
|
|
307
|
+
method: 'createAutoPaymentLink' as const,
|
|
308
|
+
credentialName
|
|
309
|
+
})
|
|
310
|
+
}
|