@medalsocial/sdk 1.0.0 → 1.1.2

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.
@@ -0,0 +1,436 @@
1
+ import Medal, { ApiResponse, EmailSendResult, ContactCreateResult, ContactNoteResult, ConsentResult, DealCreateResult } from '../src/index.js';
2
+ import { z } from 'zod';
3
+
4
+ declare const SendEmailSchema: z.ZodObject<{
5
+ template_slug: z.ZodString;
6
+ to: z.ZodString;
7
+ name: z.ZodOptional<z.ZodString>;
8
+ locale: z.ZodOptional<z.ZodString>;
9
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ template_slug: string;
12
+ to: string;
13
+ name?: string | undefined;
14
+ locale?: string | undefined;
15
+ variables?: Record<string, string> | undefined;
16
+ }, {
17
+ template_slug: string;
18
+ to: string;
19
+ name?: string | undefined;
20
+ locale?: string | undefined;
21
+ variables?: Record<string, string> | undefined;
22
+ }>;
23
+ declare const CreateContactSchema: z.ZodObject<{
24
+ email: z.ZodString;
25
+ first_name: z.ZodOptional<z.ZodString>;
26
+ last_name: z.ZodOptional<z.ZodString>;
27
+ phone: z.ZodOptional<z.ZodString>;
28
+ company: z.ZodOptional<z.ZodString>;
29
+ job_title: z.ZodOptional<z.ZodString>;
30
+ status: z.ZodOptional<z.ZodEnum<["lead", "prospect", "customer", "churned", "archived"]>>;
31
+ notes: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ email: string;
34
+ status?: "lead" | "prospect" | "customer" | "churned" | "archived" | undefined;
35
+ first_name?: string | undefined;
36
+ last_name?: string | undefined;
37
+ phone?: string | undefined;
38
+ company?: string | undefined;
39
+ job_title?: string | undefined;
40
+ notes?: string | undefined;
41
+ }, {
42
+ email: string;
43
+ status?: "lead" | "prospect" | "customer" | "churned" | "archived" | undefined;
44
+ first_name?: string | undefined;
45
+ last_name?: string | undefined;
46
+ phone?: string | undefined;
47
+ company?: string | undefined;
48
+ job_title?: string | undefined;
49
+ notes?: string | undefined;
50
+ }>;
51
+ declare const AddContactNoteSchema: z.ZodObject<{
52
+ contactId: z.ZodString;
53
+ content: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ contactId: string;
56
+ content: string;
57
+ }, {
58
+ contactId: string;
59
+ content: string;
60
+ }>;
61
+ declare const CookieConsentSchema: z.ZodObject<{
62
+ domain: z.ZodString;
63
+ consentStatus: z.ZodEnum<["granted", "denied", "partial"]>;
64
+ consentTimestamp: z.ZodString;
65
+ ipAddress: z.ZodOptional<z.ZodString>;
66
+ userAgent: z.ZodOptional<z.ZodString>;
67
+ cookiePreferences: z.ZodObject<{
68
+ necessary: z.ZodOptional<z.ZodObject<{
69
+ allowed: z.ZodBoolean;
70
+ }, "strip", z.ZodTypeAny, {
71
+ allowed: boolean;
72
+ }, {
73
+ allowed: boolean;
74
+ }>>;
75
+ analytics: z.ZodOptional<z.ZodObject<{
76
+ allowed: z.ZodBoolean;
77
+ }, "strip", z.ZodTypeAny, {
78
+ allowed: boolean;
79
+ }, {
80
+ allowed: boolean;
81
+ }>>;
82
+ marketing: z.ZodOptional<z.ZodObject<{
83
+ allowed: z.ZodBoolean;
84
+ }, "strip", z.ZodTypeAny, {
85
+ allowed: boolean;
86
+ }, {
87
+ allowed: boolean;
88
+ }>>;
89
+ functional: z.ZodOptional<z.ZodObject<{
90
+ allowed: z.ZodBoolean;
91
+ }, "strip", z.ZodTypeAny, {
92
+ allowed: boolean;
93
+ }, {
94
+ allowed: boolean;
95
+ }>>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ necessary?: {
98
+ allowed: boolean;
99
+ } | undefined;
100
+ analytics?: {
101
+ allowed: boolean;
102
+ } | undefined;
103
+ marketing?: {
104
+ allowed: boolean;
105
+ } | undefined;
106
+ functional?: {
107
+ allowed: boolean;
108
+ } | undefined;
109
+ }, {
110
+ necessary?: {
111
+ allowed: boolean;
112
+ } | undefined;
113
+ analytics?: {
114
+ allowed: boolean;
115
+ } | undefined;
116
+ marketing?: {
117
+ allowed: boolean;
118
+ } | undefined;
119
+ functional?: {
120
+ allowed: boolean;
121
+ } | undefined;
122
+ }>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ domain: string;
125
+ consentStatus: "granted" | "denied" | "partial";
126
+ consentTimestamp: string;
127
+ cookiePreferences: {
128
+ necessary?: {
129
+ allowed: boolean;
130
+ } | undefined;
131
+ analytics?: {
132
+ allowed: boolean;
133
+ } | undefined;
134
+ marketing?: {
135
+ allowed: boolean;
136
+ } | undefined;
137
+ functional?: {
138
+ allowed: boolean;
139
+ } | undefined;
140
+ };
141
+ ipAddress?: string | undefined;
142
+ userAgent?: string | undefined;
143
+ }, {
144
+ domain: string;
145
+ consentStatus: "granted" | "denied" | "partial";
146
+ consentTimestamp: string;
147
+ cookiePreferences: {
148
+ necessary?: {
149
+ allowed: boolean;
150
+ } | undefined;
151
+ analytics?: {
152
+ allowed: boolean;
153
+ } | undefined;
154
+ marketing?: {
155
+ allowed: boolean;
156
+ } | undefined;
157
+ functional?: {
158
+ allowed: boolean;
159
+ } | undefined;
160
+ };
161
+ ipAddress?: string | undefined;
162
+ userAgent?: string | undefined;
163
+ }>;
164
+ declare const RecordConsentSchema: z.ZodObject<{
165
+ email: z.ZodString;
166
+ consent_type: z.ZodEnum<["marketing_email", "analytics_tracking", "third_party_sharing"]>;
167
+ granted: z.ZodBoolean;
168
+ source: z.ZodOptional<z.ZodString>;
169
+ ip_address: z.ZodOptional<z.ZodString>;
170
+ }, "strip", z.ZodTypeAny, {
171
+ email: string;
172
+ granted: boolean;
173
+ consent_type: "marketing_email" | "analytics_tracking" | "third_party_sharing";
174
+ source?: string | undefined;
175
+ ip_address?: string | undefined;
176
+ }, {
177
+ email: string;
178
+ granted: boolean;
179
+ consent_type: "marketing_email" | "analytics_tracking" | "third_party_sharing";
180
+ source?: string | undefined;
181
+ ip_address?: string | undefined;
182
+ }>;
183
+ declare const CreateDealSchema: z.ZodObject<{
184
+ title: z.ZodString;
185
+ description: z.ZodOptional<z.ZodString>;
186
+ value: z.ZodOptional<z.ZodNumber>;
187
+ currency: z.ZodOptional<z.ZodString>;
188
+ contact_email: z.ZodOptional<z.ZodString>;
189
+ notes: z.ZodOptional<z.ZodString>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ title: string;
192
+ value?: number | undefined;
193
+ notes?: string | undefined;
194
+ description?: string | undefined;
195
+ currency?: string | undefined;
196
+ contact_email?: string | undefined;
197
+ }, {
198
+ title: string;
199
+ value?: number | undefined;
200
+ notes?: string | undefined;
201
+ description?: string | undefined;
202
+ currency?: string | undefined;
203
+ contact_email?: string | undefined;
204
+ }>;
205
+ declare function createMedalTools(client: Medal): {
206
+ sendEmail: {
207
+ description: string;
208
+ parameters: z.ZodObject<{
209
+ template_slug: z.ZodString;
210
+ to: z.ZodString;
211
+ name: z.ZodOptional<z.ZodString>;
212
+ locale: z.ZodOptional<z.ZodString>;
213
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ template_slug: string;
216
+ to: string;
217
+ name?: string | undefined;
218
+ locale?: string | undefined;
219
+ variables?: Record<string, string> | undefined;
220
+ }, {
221
+ template_slug: string;
222
+ to: string;
223
+ name?: string | undefined;
224
+ locale?: string | undefined;
225
+ variables?: Record<string, string> | undefined;
226
+ }>;
227
+ execute: (args: z.infer<typeof SendEmailSchema>) => Promise<ApiResponse<EmailSendResult>>;
228
+ };
229
+ createContact: {
230
+ description: string;
231
+ parameters: z.ZodObject<{
232
+ email: z.ZodString;
233
+ first_name: z.ZodOptional<z.ZodString>;
234
+ last_name: z.ZodOptional<z.ZodString>;
235
+ phone: z.ZodOptional<z.ZodString>;
236
+ company: z.ZodOptional<z.ZodString>;
237
+ job_title: z.ZodOptional<z.ZodString>;
238
+ status: z.ZodOptional<z.ZodEnum<["lead", "prospect", "customer", "churned", "archived"]>>;
239
+ notes: z.ZodOptional<z.ZodString>;
240
+ }, "strip", z.ZodTypeAny, {
241
+ email: string;
242
+ status?: "lead" | "prospect" | "customer" | "churned" | "archived" | undefined;
243
+ first_name?: string | undefined;
244
+ last_name?: string | undefined;
245
+ phone?: string | undefined;
246
+ company?: string | undefined;
247
+ job_title?: string | undefined;
248
+ notes?: string | undefined;
249
+ }, {
250
+ email: string;
251
+ status?: "lead" | "prospect" | "customer" | "churned" | "archived" | undefined;
252
+ first_name?: string | undefined;
253
+ last_name?: string | undefined;
254
+ phone?: string | undefined;
255
+ company?: string | undefined;
256
+ job_title?: string | undefined;
257
+ notes?: string | undefined;
258
+ }>;
259
+ execute: (args: z.infer<typeof CreateContactSchema>) => Promise<ApiResponse<ContactCreateResult>>;
260
+ };
261
+ addContactNote: {
262
+ description: string;
263
+ parameters: z.ZodObject<{
264
+ contactId: z.ZodString;
265
+ content: z.ZodString;
266
+ }, "strip", z.ZodTypeAny, {
267
+ contactId: string;
268
+ content: string;
269
+ }, {
270
+ contactId: string;
271
+ content: string;
272
+ }>;
273
+ execute: (args: z.infer<typeof AddContactNoteSchema>) => Promise<ApiResponse<ContactNoteResult>>;
274
+ };
275
+ recordCookieConsent: {
276
+ description: string;
277
+ parameters: z.ZodObject<{
278
+ domain: z.ZodString;
279
+ consentStatus: z.ZodEnum<["granted", "denied", "partial"]>;
280
+ consentTimestamp: z.ZodString;
281
+ ipAddress: z.ZodOptional<z.ZodString>;
282
+ userAgent: z.ZodOptional<z.ZodString>;
283
+ cookiePreferences: z.ZodObject<{
284
+ necessary: z.ZodOptional<z.ZodObject<{
285
+ allowed: z.ZodBoolean;
286
+ }, "strip", z.ZodTypeAny, {
287
+ allowed: boolean;
288
+ }, {
289
+ allowed: boolean;
290
+ }>>;
291
+ analytics: z.ZodOptional<z.ZodObject<{
292
+ allowed: z.ZodBoolean;
293
+ }, "strip", z.ZodTypeAny, {
294
+ allowed: boolean;
295
+ }, {
296
+ allowed: boolean;
297
+ }>>;
298
+ marketing: z.ZodOptional<z.ZodObject<{
299
+ allowed: z.ZodBoolean;
300
+ }, "strip", z.ZodTypeAny, {
301
+ allowed: boolean;
302
+ }, {
303
+ allowed: boolean;
304
+ }>>;
305
+ functional: z.ZodOptional<z.ZodObject<{
306
+ allowed: z.ZodBoolean;
307
+ }, "strip", z.ZodTypeAny, {
308
+ allowed: boolean;
309
+ }, {
310
+ allowed: boolean;
311
+ }>>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ necessary?: {
314
+ allowed: boolean;
315
+ } | undefined;
316
+ analytics?: {
317
+ allowed: boolean;
318
+ } | undefined;
319
+ marketing?: {
320
+ allowed: boolean;
321
+ } | undefined;
322
+ functional?: {
323
+ allowed: boolean;
324
+ } | undefined;
325
+ }, {
326
+ necessary?: {
327
+ allowed: boolean;
328
+ } | undefined;
329
+ analytics?: {
330
+ allowed: boolean;
331
+ } | undefined;
332
+ marketing?: {
333
+ allowed: boolean;
334
+ } | undefined;
335
+ functional?: {
336
+ allowed: boolean;
337
+ } | undefined;
338
+ }>;
339
+ }, "strip", z.ZodTypeAny, {
340
+ domain: string;
341
+ consentStatus: "granted" | "denied" | "partial";
342
+ consentTimestamp: string;
343
+ cookiePreferences: {
344
+ necessary?: {
345
+ allowed: boolean;
346
+ } | undefined;
347
+ analytics?: {
348
+ allowed: boolean;
349
+ } | undefined;
350
+ marketing?: {
351
+ allowed: boolean;
352
+ } | undefined;
353
+ functional?: {
354
+ allowed: boolean;
355
+ } | undefined;
356
+ };
357
+ ipAddress?: string | undefined;
358
+ userAgent?: string | undefined;
359
+ }, {
360
+ domain: string;
361
+ consentStatus: "granted" | "denied" | "partial";
362
+ consentTimestamp: string;
363
+ cookiePreferences: {
364
+ necessary?: {
365
+ allowed: boolean;
366
+ } | undefined;
367
+ analytics?: {
368
+ allowed: boolean;
369
+ } | undefined;
370
+ marketing?: {
371
+ allowed: boolean;
372
+ } | undefined;
373
+ functional?: {
374
+ allowed: boolean;
375
+ } | undefined;
376
+ };
377
+ ipAddress?: string | undefined;
378
+ userAgent?: string | undefined;
379
+ }>;
380
+ execute: (args: z.infer<typeof CookieConsentSchema>) => Promise<{
381
+ success: boolean;
382
+ logId?: string;
383
+ }>;
384
+ };
385
+ recordConsent: {
386
+ description: string;
387
+ parameters: z.ZodObject<{
388
+ email: z.ZodString;
389
+ consent_type: z.ZodEnum<["marketing_email", "analytics_tracking", "third_party_sharing"]>;
390
+ granted: z.ZodBoolean;
391
+ source: z.ZodOptional<z.ZodString>;
392
+ ip_address: z.ZodOptional<z.ZodString>;
393
+ }, "strip", z.ZodTypeAny, {
394
+ email: string;
395
+ granted: boolean;
396
+ consent_type: "marketing_email" | "analytics_tracking" | "third_party_sharing";
397
+ source?: string | undefined;
398
+ ip_address?: string | undefined;
399
+ }, {
400
+ email: string;
401
+ granted: boolean;
402
+ consent_type: "marketing_email" | "analytics_tracking" | "third_party_sharing";
403
+ source?: string | undefined;
404
+ ip_address?: string | undefined;
405
+ }>;
406
+ execute: (args: z.infer<typeof RecordConsentSchema>) => Promise<ApiResponse<ConsentResult>>;
407
+ };
408
+ createDeal: {
409
+ description: string;
410
+ parameters: z.ZodObject<{
411
+ title: z.ZodString;
412
+ description: z.ZodOptional<z.ZodString>;
413
+ value: z.ZodOptional<z.ZodNumber>;
414
+ currency: z.ZodOptional<z.ZodString>;
415
+ contact_email: z.ZodOptional<z.ZodString>;
416
+ notes: z.ZodOptional<z.ZodString>;
417
+ }, "strip", z.ZodTypeAny, {
418
+ title: string;
419
+ value?: number | undefined;
420
+ notes?: string | undefined;
421
+ description?: string | undefined;
422
+ currency?: string | undefined;
423
+ contact_email?: string | undefined;
424
+ }, {
425
+ title: string;
426
+ value?: number | undefined;
427
+ notes?: string | undefined;
428
+ description?: string | undefined;
429
+ currency?: string | undefined;
430
+ contact_email?: string | undefined;
431
+ }>;
432
+ execute: (args: z.infer<typeof CreateDealSchema>) => Promise<ApiResponse<DealCreateResult>>;
433
+ };
434
+ };
435
+
436
+ export { createMedalTools };
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // pilot/index.ts
21
+ var pilot_exports = {};
22
+ __export(pilot_exports, {
23
+ createMedalTools: () => createMedalTools
24
+ });
25
+ module.exports = __toCommonJS(pilot_exports);
26
+ var import_zod = require("zod");
27
+ var SendEmailSchema = import_zod.z.object({
28
+ template_slug: import_zod.z.string(),
29
+ to: import_zod.z.string().email(),
30
+ name: import_zod.z.string().optional(),
31
+ locale: import_zod.z.string().optional(),
32
+ variables: import_zod.z.record(import_zod.z.string()).optional()
33
+ });
34
+ var CreateContactSchema = import_zod.z.object({
35
+ email: import_zod.z.string().email(),
36
+ first_name: import_zod.z.string().optional(),
37
+ last_name: import_zod.z.string().optional(),
38
+ phone: import_zod.z.string().optional(),
39
+ company: import_zod.z.string().optional(),
40
+ job_title: import_zod.z.string().optional(),
41
+ status: import_zod.z.enum(["lead", "prospect", "customer", "churned", "archived"]).optional(),
42
+ notes: import_zod.z.string().optional()
43
+ });
44
+ var AddContactNoteSchema = import_zod.z.object({
45
+ contactId: import_zod.z.string(),
46
+ content: import_zod.z.string()
47
+ });
48
+ var CookieConsentSchema = import_zod.z.object({
49
+ domain: import_zod.z.string(),
50
+ consentStatus: import_zod.z.enum(["granted", "denied", "partial"]),
51
+ consentTimestamp: import_zod.z.string(),
52
+ ipAddress: import_zod.z.string().optional(),
53
+ userAgent: import_zod.z.string().optional(),
54
+ cookiePreferences: import_zod.z.object({
55
+ necessary: import_zod.z.object({ allowed: import_zod.z.boolean() }).optional(),
56
+ analytics: import_zod.z.object({ allowed: import_zod.z.boolean() }).optional(),
57
+ marketing: import_zod.z.object({ allowed: import_zod.z.boolean() }).optional(),
58
+ functional: import_zod.z.object({ allowed: import_zod.z.boolean() }).optional()
59
+ })
60
+ });
61
+ var RecordConsentSchema = import_zod.z.object({
62
+ email: import_zod.z.string().email(),
63
+ consent_type: import_zod.z.enum(["marketing_email", "analytics_tracking", "third_party_sharing"]),
64
+ granted: import_zod.z.boolean(),
65
+ source: import_zod.z.string().optional(),
66
+ ip_address: import_zod.z.string().optional()
67
+ });
68
+ var CreateDealSchema = import_zod.z.object({
69
+ title: import_zod.z.string(),
70
+ description: import_zod.z.string().optional(),
71
+ value: import_zod.z.number().optional(),
72
+ currency: import_zod.z.string().optional(),
73
+ contact_email: import_zod.z.string().email().optional(),
74
+ notes: import_zod.z.string().optional()
75
+ });
76
+ function createMedalTools(client) {
77
+ return {
78
+ sendEmail: {
79
+ description: "Send a transactional email using a template",
80
+ parameters: SendEmailSchema,
81
+ execute: async (args) => client.emails.send(args)
82
+ },
83
+ createContact: {
84
+ description: "Create a new contact in Medal Social CRM",
85
+ parameters: CreateContactSchema,
86
+ execute: async (args) => client.contacts.create(args)
87
+ },
88
+ addContactNote: {
89
+ description: "Add a note to a contact's timeline",
90
+ parameters: AddContactNoteSchema,
91
+ execute: async (args) => client.contacts.addNote(args.contactId, { content: args.content })
92
+ },
93
+ recordCookieConsent: {
94
+ description: "Record a user's cookie consent preferences",
95
+ parameters: CookieConsentSchema,
96
+ execute: async (args) => client.gdpr.cookieConsent(args)
97
+ },
98
+ recordConsent: {
99
+ description: "Record a GDPR consent decision for a contact by email",
100
+ parameters: RecordConsentSchema,
101
+ execute: async (args) => client.gdpr.recordConsent(args)
102
+ },
103
+ createDeal: {
104
+ description: "Create a new deal in Medal Social CRM",
105
+ parameters: CreateDealSchema,
106
+ execute: async (args) => client.deals.create(args)
107
+ }
108
+ };
109
+ }
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ createMedalTools
113
+ });
114
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../pilot/index.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { Medal } from \"../src/index.js\";\n\nconst SendEmailSchema = z.object({\n template_slug: z.string(),\n to: z.string().email(),\n name: z.string().optional(),\n locale: z.string().optional(),\n variables: z.record(z.string()).optional(),\n});\n\nconst CreateContactSchema = z.object({\n email: z.string().email(),\n first_name: z.string().optional(),\n last_name: z.string().optional(),\n phone: z.string().optional(),\n company: z.string().optional(),\n job_title: z.string().optional(),\n status: z.enum([\"lead\", \"prospect\", \"customer\", \"churned\", \"archived\"]).optional(),\n notes: z.string().optional(),\n});\n\nconst AddContactNoteSchema = z.object({\n contactId: z.string(),\n content: z.string(),\n});\n\nconst CookieConsentSchema = z.object({\n domain: z.string(),\n consentStatus: z.enum([\"granted\", \"denied\", \"partial\"]),\n consentTimestamp: z.string(),\n ipAddress: z.string().optional(),\n userAgent: z.string().optional(),\n cookiePreferences: z.object({\n necessary: z.object({ allowed: z.boolean() }).optional(),\n analytics: z.object({ allowed: z.boolean() }).optional(),\n marketing: z.object({ allowed: z.boolean() }).optional(),\n functional: z.object({ allowed: z.boolean() }).optional(),\n }),\n});\n\nconst RecordConsentSchema = z.object({\n email: z.string().email(),\n consent_type: z.enum([\"marketing_email\", \"analytics_tracking\", \"third_party_sharing\"]),\n granted: z.boolean(),\n source: z.string().optional(),\n ip_address: z.string().optional(),\n});\n\nconst CreateDealSchema = z.object({\n title: z.string(),\n description: z.string().optional(),\n value: z.number().optional(),\n currency: z.string().optional(),\n contact_email: z.string().email().optional(),\n notes: z.string().optional(),\n});\n\nexport function createMedalTools(client: Medal) {\n return {\n sendEmail: {\n description: \"Send a transactional email using a template\",\n parameters: SendEmailSchema,\n execute: async (args: z.infer<typeof SendEmailSchema>) => client.emails.send(args),\n },\n createContact: {\n description: \"Create a new contact in Medal Social CRM\",\n parameters: CreateContactSchema,\n execute: async (args: z.infer<typeof CreateContactSchema>) => client.contacts.create(args),\n },\n addContactNote: {\n description: \"Add a note to a contact's timeline\",\n parameters: AddContactNoteSchema,\n execute: async (args: z.infer<typeof AddContactNoteSchema>) =>\n client.contacts.addNote(args.contactId, { content: args.content }),\n },\n recordCookieConsent: {\n description: \"Record a user's cookie consent preferences\",\n parameters: CookieConsentSchema,\n execute: async (args: z.infer<typeof CookieConsentSchema>) => client.gdpr.cookieConsent(args),\n },\n recordConsent: {\n description: \"Record a GDPR consent decision for a contact by email\",\n parameters: RecordConsentSchema,\n execute: async (args: z.infer<typeof RecordConsentSchema>) => client.gdpr.recordConsent(args),\n },\n createDeal: {\n description: \"Create a new deal in Medal Social CRM\",\n parameters: CreateDealSchema,\n execute: async (args: z.infer<typeof CreateDealSchema>) => client.deals.create(args),\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAGlB,IAAM,kBAAkB,aAAE,OAAO;AAAA,EAC/B,eAAe,aAAE,OAAO;AAAA,EACxB,IAAI,aAAE,OAAO,EAAE,MAAM;AAAA,EACrB,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,WAAW,aAAE,OAAO,aAAE,OAAO,CAAC,EAAE,SAAS;AAC3C,CAAC;AAED,IAAM,sBAAsB,aAAE,OAAO;AAAA,EACnC,OAAO,aAAE,OAAO,EAAE,MAAM;AAAA,EACxB,YAAY,aAAE,OAAO,EAAE,SAAS;AAAA,EAChC,WAAW,aAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,OAAO,aAAE,OA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.string().email(),
6
+ name: z.string().optional(),
7
+ locale: z.string().optional(),
8
+ variables: z.record(z.string()).optional()
9
+ });
10
+ var CreateContactSchema = z.object({
11
+ email: z.string().email(),
12
+ first_name: z.string().optional(),
13
+ last_name: z.string().optional(),
14
+ phone: z.string().optional(),
15
+ company: z.string().optional(),
16
+ job_title: z.string().optional(),
17
+ status: z.enum(["lead", "prospect", "customer", "churned", "archived"]).optional(),
18
+ notes: z.string().optional()
19
+ });
20
+ var AddContactNoteSchema = z.object({
21
+ contactId: z.string(),
22
+ content: z.string()
23
+ });
24
+ var CookieConsentSchema = z.object({
25
+ domain: z.string(),
26
+ consentStatus: z.enum(["granted", "denied", "partial"]),
27
+ consentTimestamp: z.string(),
28
+ ipAddress: z.string().optional(),
29
+ userAgent: z.string().optional(),
30
+ cookiePreferences: z.object({
31
+ necessary: z.object({ allowed: z.boolean() }).optional(),
32
+ analytics: z.object({ allowed: z.boolean() }).optional(),
33
+ marketing: z.object({ allowed: z.boolean() }).optional(),
34
+ functional: z.object({ allowed: z.boolean() }).optional()
35
+ })
36
+ });
37
+ var RecordConsentSchema = z.object({
38
+ email: z.string().email(),
39
+ consent_type: z.enum(["marketing_email", "analytics_tracking", "third_party_sharing"]),
40
+ granted: z.boolean(),
41
+ source: z.string().optional(),
42
+ ip_address: z.string().optional()
43
+ });
44
+ var CreateDealSchema = z.object({
45
+ title: z.string(),
46
+ description: z.string().optional(),
47
+ value: z.number().optional(),
48
+ currency: z.string().optional(),
49
+ contact_email: z.string().email().optional(),
50
+ notes: z.string().optional()
51
+ });
52
+ function createMedalTools(client) {
53
+ return {
54
+ sendEmail: {
55
+ description: "Send a transactional email using a template",
56
+ parameters: SendEmailSchema,
57
+ execute: async (args) => client.emails.send(args)
58
+ },
59
+ createContact: {
60
+ description: "Create a new contact in Medal Social CRM",
61
+ parameters: CreateContactSchema,
62
+ execute: async (args) => client.contacts.create(args)
63
+ },
64
+ addContactNote: {
65
+ description: "Add a note to a contact's timeline",
66
+ parameters: AddContactNoteSchema,
67
+ execute: async (args) => client.contacts.addNote(args.contactId, { content: args.content })
68
+ },
69
+ recordCookieConsent: {
70
+ description: "Record a user's cookie consent preferences",
71
+ parameters: CookieConsentSchema,
72
+ execute: async (args) => client.gdpr.cookieConsent(args)
73
+ },
74
+ recordConsent: {
75
+ description: "Record a GDPR consent decision for a contact by email",
76
+ parameters: RecordConsentSchema,
77
+ execute: async (args) => client.gdpr.recordConsent(args)
78
+ },
79
+ createDeal: {
80
+ description: "Create a new deal in Medal Social CRM",
81
+ parameters: CreateDealSchema,
82
+ execute: async (args) => client.deals.create(args)
83
+ }
84
+ };
85
+ }
86
+ export {
87
+ createMedalTools
88
+ };
89
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../pilot/index.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { Medal } from \"../src/index.js\";\n\nconst SendEmailSchema = z.object({\n template_slug: z.string(),\n to: z.string().email(),\n name: z.string().optional(),\n locale: z.string().optional(),\n variables: z.record(z.string()).optional(),\n});\n\nconst CreateContactSchema = z.object({\n email: z.string().email(),\n first_name: z.string().optional(),\n last_name: z.string().optional(),\n phone: z.string().optional(),\n company: z.string().optional(),\n job_title: z.string().optional(),\n status: z.enum([\"lead\", \"prospect\", \"customer\", \"churned\", \"archived\"]).optional(),\n notes: z.string().optional(),\n});\n\nconst AddContactNoteSchema = z.object({\n contactId: z.string(),\n content: z.string(),\n});\n\nconst CookieConsentSchema = z.object({\n domain: z.string(),\n consentStatus: z.enum([\"granted\", \"denied\", \"partial\"]),\n consentTimestamp: z.string(),\n ipAddress: z.string().optional(),\n userAgent: z.string().optional(),\n cookiePreferences: z.object({\n necessary: z.object({ allowed: z.boolean() }).optional(),\n analytics: z.object({ allowed: z.boolean() }).optional(),\n marketing: z.object({ allowed: z.boolean() }).optional(),\n functional: z.object({ allowed: z.boolean() }).optional(),\n }),\n});\n\nconst RecordConsentSchema = z.object({\n email: z.string().email(),\n consent_type: z.enum([\"marketing_email\", \"analytics_tracking\", \"third_party_sharing\"]),\n granted: z.boolean(),\n source: z.string().optional(),\n ip_address: z.string().optional(),\n});\n\nconst CreateDealSchema = z.object({\n title: z.string(),\n description: z.string().optional(),\n value: z.number().optional(),\n currency: z.string().optional(),\n contact_email: z.string().email().optional(),\n notes: z.string().optional(),\n});\n\nexport function createMedalTools(client: Medal) {\n return {\n sendEmail: {\n description: \"Send a transactional email using a template\",\n parameters: SendEmailSchema,\n execute: async (args: z.infer<typeof SendEmailSchema>) => client.emails.send(args),\n },\n createContact: {\n description: \"Create a new contact in Medal Social CRM\",\n parameters: CreateContactSchema,\n execute: async (args: z.infer<typeof CreateContactSchema>) => client.contacts.create(args),\n },\n addContactNote: {\n description: \"Add a note to a contact's timeline\",\n parameters: AddContactNoteSchema,\n execute: async (args: z.infer<typeof AddContactNoteSchema>) =>\n client.contacts.addNote(args.contactId, { content: args.content }),\n },\n recordCookieConsent: {\n description: \"Record a user's cookie consent preferences\",\n parameters: CookieConsentSchema,\n execute: async (args: z.infer<typeof CookieConsentSchema>) => client.gdpr.cookieConsent(args),\n },\n recordConsent: {\n description: \"Record a GDPR consent decision for a contact by email\",\n parameters: RecordConsentSchema,\n execute: async (args: z.infer<typeof RecordConsentSchema>) => client.gdpr.recordConsent(args),\n },\n createDeal: {\n description: \"Create a new deal in Medal Social CRM\",\n parameters: CreateDealSchema,\n execute: async (args: z.infer<typeof CreateDealSchema>) => client.deals.create(args),\n },\n };\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAGlB,IAAM,kBAAkB,EAAE,OAAO;AAAA,EAC/B,eAAe,EAAE,OAAO;AAAA,EACxB,IAAI,EAAE,OAAO,EAAE,MAAM;AAAA,EACrB,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS;AAC3C,CAAC;AAED,IAAM,sBA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,SAA2C,OAAO,MAAM,OAAO,IAAI;AAAA,IACrF;AAAA,EACF;AACF;","names":[]}
@@ -610,4 +610,6 @@ declare class Medal {
610
610
  constructor(token: string, options?: MedalOptions);
611
611
  }
612
612
 
613
- export { type Activity, type AddNoteInput, type ApiResponse, BaseClient, type BatchSendInput, type BatchSendResult, type BatchSendSummary, type Channel, type ConsentRecord, type ConsentResult, type ConsentType, type Contact, type ContactConsents, type ContactCreateResult, type ContactNoteResult, type ContactRemoveResult, type ContactStatus, type ContactUpdateResult, Contacts, type CookieCategoryConsent, type CookieConsentInput, type CreateContactInput, type CreateDealInput, type CreatePostInput, type Deal, type DealCreateResult, type DealRemoveResult, type DealStatus, type DealUpdateResult, Deals, type EmailSend, type EmailSendResult, type EmailStatus, type EmailTemplate, type EmailTemplateDetail, Emails, Gdpr, type GdprExport, type GetTemplateOptions, type ImportContactInput, type ImportContactsResult, type ListContactsOptions, type ListDealsOptions, type ListPostsOptions, Medal, MedalApiError, type MedalOptions, type PaginatedResponse, type PaginationOptions, type Post, type PostDetail, type PostType, type PostVariant, Posts, type PublishResult, type RecordConsentInput, type SchedulePostInput, type ScheduleResult, type SendEmailInput, type UpdateContactInput, type UpdateDealInput, type UpdatePostInput, type Workspace, Workspaces, Medal as default };
613
+ declare function createMedalClient(apiKey: string, options?: MedalOptions): Medal;
614
+
615
+ export { type Activity, type AddNoteInput, type ApiResponse, BaseClient, type BatchSendInput, type BatchSendResult, type BatchSendSummary, type Channel, type ConsentRecord, type ConsentResult, type ConsentType, type Contact, type ContactConsents, type ContactCreateResult, type ContactNoteResult, type ContactRemoveResult, type ContactStatus, type ContactUpdateResult, Contacts, type CookieCategoryConsent, type CookieConsentInput, type CreateContactInput, type CreateDealInput, type CreatePostInput, type Deal, type DealCreateResult, type DealRemoveResult, type DealStatus, type DealUpdateResult, Deals, type EmailSend, type EmailSendResult, type EmailStatus, type EmailTemplate, type EmailTemplateDetail, Emails, Gdpr, type GdprExport, type GetTemplateOptions, type ImportContactInput, type ImportContactsResult, type ListContactsOptions, type ListDealsOptions, type ListPostsOptions, Medal, MedalApiError, type MedalOptions, type PaginatedResponse, type PaginationOptions, type Post, type PostDetail, type PostType, type PostVariant, Posts, type PublishResult, type RecordConsentInput, type SchedulePostInput, type ScheduleResult, type SendEmailInput, type UpdateContactInput, type UpdateDealInput, type UpdatePostInput, type Workspace, Workspaces, createMedalClient, Medal as default };