@conversokit/shared 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 (47) hide show
  1. package/LICENSE +201 -0
  2. package/dist/compliance.d.ts +22 -0
  3. package/dist/compliance.d.ts.map +1 -0
  4. package/dist/compliance.js +15 -0
  5. package/dist/index.d.ts +15 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +14 -0
  8. package/dist/mock/availability.d.ts +3 -0
  9. package/dist/mock/availability.d.ts.map +1 -0
  10. package/dist/mock/availability.js +34 -0
  11. package/dist/mock/cart.d.ts +4 -0
  12. package/dist/mock/cart.d.ts.map +1 -0
  13. package/dist/mock/cart.js +16 -0
  14. package/dist/mock/dashboard.d.ts +6 -0
  15. package/dist/mock/dashboard.d.ts.map +1 -0
  16. package/dist/mock/dashboard.js +51 -0
  17. package/dist/mock/leadForm.d.ts +3 -0
  18. package/dist/mock/leadForm.d.ts.map +1 -0
  19. package/dist/mock/leadForm.js +53 -0
  20. package/dist/mock/products.d.ts +3 -0
  21. package/dist/mock/products.d.ts.map +1 -0
  22. package/dist/mock/products.js +29 -0
  23. package/dist/mock/travel.d.ts +6 -0
  24. package/dist/mock/travel.d.ts.map +1 -0
  25. package/dist/mock/travel.js +105 -0
  26. package/dist/schemas/booking.d.ts +116 -0
  27. package/dist/schemas/booking.d.ts.map +1 -0
  28. package/dist/schemas/booking.js +30 -0
  29. package/dist/schemas/commerce.d.ts +184 -0
  30. package/dist/schemas/commerce.d.ts.map +1 -0
  31. package/dist/schemas/commerce.js +25 -0
  32. package/dist/schemas/dashboard.d.ts +197 -0
  33. package/dist/schemas/dashboard.d.ts.map +1 -0
  34. package/dist/schemas/dashboard.js +31 -0
  35. package/dist/schemas/leadgen.d.ts +181 -0
  36. package/dist/schemas/leadgen.d.ts.map +1 -0
  37. package/dist/schemas/leadgen.js +33 -0
  38. package/dist/schemas/travel.d.ts +266 -0
  39. package/dist/schemas/travel.d.ts.map +1 -0
  40. package/dist/schemas/travel.js +51 -0
  41. package/dist/tool.d.ts +45 -0
  42. package/dist/tool.d.ts.map +1 -0
  43. package/dist/tool.js +3 -0
  44. package/dist/widget-config.d.ts +37 -0
  45. package/dist/widget-config.d.ts.map +1 -0
  46. package/dist/widget-config.js +5 -0
  47. package/package.json +36 -0
@@ -0,0 +1,181 @@
1
+ import { z } from 'zod';
2
+ export declare const leadFieldTypeSchema: z.ZodEnum<["text", "email", "tel", "textarea", "select", "number"]>;
3
+ export type LeadFieldType = z.infer<typeof leadFieldTypeSchema>;
4
+ export declare const leadFieldSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ label: z.ZodString;
7
+ type: z.ZodOptional<z.ZodEnum<["text", "email", "tel", "textarea", "select", "number"]>>;
8
+ required: z.ZodOptional<z.ZodBoolean>;
9
+ placeholder: z.ZodOptional<z.ZodString>;
10
+ options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ name: string;
13
+ label: string;
14
+ options?: string[] | undefined;
15
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
16
+ required?: boolean | undefined;
17
+ placeholder?: string | undefined;
18
+ }, {
19
+ name: string;
20
+ label: string;
21
+ options?: string[] | undefined;
22
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
23
+ required?: boolean | undefined;
24
+ placeholder?: string | undefined;
25
+ }>;
26
+ export type LeadField = z.infer<typeof leadFieldSchema>;
27
+ export declare const formStepSchema: z.ZodObject<{
28
+ id: z.ZodString;
29
+ title: z.ZodString;
30
+ description: z.ZodOptional<z.ZodString>;
31
+ fields: z.ZodArray<z.ZodObject<{
32
+ name: z.ZodString;
33
+ label: z.ZodString;
34
+ type: z.ZodOptional<z.ZodEnum<["text", "email", "tel", "textarea", "select", "number"]>>;
35
+ required: z.ZodOptional<z.ZodBoolean>;
36
+ placeholder: z.ZodOptional<z.ZodString>;
37
+ options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ name: string;
40
+ label: string;
41
+ options?: string[] | undefined;
42
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
43
+ required?: boolean | undefined;
44
+ placeholder?: string | undefined;
45
+ }, {
46
+ name: string;
47
+ label: string;
48
+ options?: string[] | undefined;
49
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
50
+ required?: boolean | undefined;
51
+ placeholder?: string | undefined;
52
+ }>, "many">;
53
+ }, "strip", z.ZodTypeAny, {
54
+ id: string;
55
+ title: string;
56
+ fields: {
57
+ name: string;
58
+ label: string;
59
+ options?: string[] | undefined;
60
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
61
+ required?: boolean | undefined;
62
+ placeholder?: string | undefined;
63
+ }[];
64
+ description?: string | undefined;
65
+ }, {
66
+ id: string;
67
+ title: string;
68
+ fields: {
69
+ name: string;
70
+ label: string;
71
+ options?: string[] | undefined;
72
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
73
+ required?: boolean | undefined;
74
+ placeholder?: string | undefined;
75
+ }[];
76
+ description?: string | undefined;
77
+ }>;
78
+ export type FormStep = z.infer<typeof formStepSchema>;
79
+ export declare const leadFormSchema: z.ZodObject<{
80
+ id: z.ZodString;
81
+ title: z.ZodString;
82
+ steps: z.ZodArray<z.ZodObject<{
83
+ id: z.ZodString;
84
+ title: z.ZodString;
85
+ description: z.ZodOptional<z.ZodString>;
86
+ fields: z.ZodArray<z.ZodObject<{
87
+ name: z.ZodString;
88
+ label: z.ZodString;
89
+ type: z.ZodOptional<z.ZodEnum<["text", "email", "tel", "textarea", "select", "number"]>>;
90
+ required: z.ZodOptional<z.ZodBoolean>;
91
+ placeholder: z.ZodOptional<z.ZodString>;
92
+ options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
93
+ }, "strip", z.ZodTypeAny, {
94
+ name: string;
95
+ label: string;
96
+ options?: string[] | undefined;
97
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
98
+ required?: boolean | undefined;
99
+ placeholder?: string | undefined;
100
+ }, {
101
+ name: string;
102
+ label: string;
103
+ options?: string[] | undefined;
104
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
105
+ required?: boolean | undefined;
106
+ placeholder?: string | undefined;
107
+ }>, "many">;
108
+ }, "strip", z.ZodTypeAny, {
109
+ id: string;
110
+ title: string;
111
+ fields: {
112
+ name: string;
113
+ label: string;
114
+ options?: string[] | undefined;
115
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
116
+ required?: boolean | undefined;
117
+ placeholder?: string | undefined;
118
+ }[];
119
+ description?: string | undefined;
120
+ }, {
121
+ id: string;
122
+ title: string;
123
+ fields: {
124
+ name: string;
125
+ label: string;
126
+ options?: string[] | undefined;
127
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
128
+ required?: boolean | undefined;
129
+ placeholder?: string | undefined;
130
+ }[];
131
+ description?: string | undefined;
132
+ }>, "many">;
133
+ }, "strip", z.ZodTypeAny, {
134
+ id: string;
135
+ title: string;
136
+ steps: {
137
+ id: string;
138
+ title: string;
139
+ fields: {
140
+ name: string;
141
+ label: string;
142
+ options?: string[] | undefined;
143
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
144
+ required?: boolean | undefined;
145
+ placeholder?: string | undefined;
146
+ }[];
147
+ description?: string | undefined;
148
+ }[];
149
+ }, {
150
+ id: string;
151
+ title: string;
152
+ steps: {
153
+ id: string;
154
+ title: string;
155
+ fields: {
156
+ name: string;
157
+ label: string;
158
+ options?: string[] | undefined;
159
+ type?: "number" | "email" | "text" | "tel" | "textarea" | "select" | undefined;
160
+ required?: boolean | undefined;
161
+ placeholder?: string | undefined;
162
+ }[];
163
+ description?: string | undefined;
164
+ }[];
165
+ }>;
166
+ export type LeadForm = z.infer<typeof leadFormSchema>;
167
+ export declare const leadSubmissionSchema: z.ZodObject<{
168
+ formId: z.ZodString;
169
+ values: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
170
+ submittedAt: z.ZodString;
171
+ }, "strip", z.ZodTypeAny, {
172
+ values: Record<string, string | number | boolean>;
173
+ formId: string;
174
+ submittedAt: string;
175
+ }, {
176
+ values: Record<string, string | number | boolean>;
177
+ formId: string;
178
+ submittedAt: string;
179
+ }>;
180
+ export type LeadSubmission = z.infer<typeof leadSubmissionSchema>;
181
+ //# sourceMappingURL=leadgen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leadgen.d.ts","sourceRoot":"","sources":["../../src/schemas/leadgen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB,qEAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;EAO1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ export const leadFieldTypeSchema = z.enum([
3
+ 'text',
4
+ 'email',
5
+ 'tel',
6
+ 'textarea',
7
+ 'select',
8
+ 'number'
9
+ ]);
10
+ export const leadFieldSchema = z.object({
11
+ name: z.string(),
12
+ label: z.string(),
13
+ type: leadFieldTypeSchema.optional(),
14
+ required: z.boolean().optional(),
15
+ placeholder: z.string().optional(),
16
+ options: z.array(z.string()).optional()
17
+ });
18
+ export const formStepSchema = z.object({
19
+ id: z.string(),
20
+ title: z.string(),
21
+ description: z.string().optional(),
22
+ fields: z.array(leadFieldSchema)
23
+ });
24
+ export const leadFormSchema = z.object({
25
+ id: z.string(),
26
+ title: z.string(),
27
+ steps: z.array(formStepSchema)
28
+ });
29
+ export const leadSubmissionSchema = z.object({
30
+ formId: z.string(),
31
+ values: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])),
32
+ submittedAt: z.string()
33
+ });
@@ -0,0 +1,266 @@
1
+ import { z } from 'zod';
2
+ export declare const hotelSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ city: z.ZodString;
6
+ country: z.ZodOptional<z.ZodString>;
7
+ rating: z.ZodOptional<z.ZodNumber>;
8
+ pricePerNight: z.ZodString;
9
+ imageUrl: z.ZodOptional<z.ZodString>;
10
+ amenities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ id: string;
13
+ name: string;
14
+ city: string;
15
+ pricePerNight: string;
16
+ imageUrl?: string | undefined;
17
+ rating?: number | undefined;
18
+ country?: string | undefined;
19
+ amenities?: string[] | undefined;
20
+ }, {
21
+ id: string;
22
+ name: string;
23
+ city: string;
24
+ pricePerNight: string;
25
+ imageUrl?: string | undefined;
26
+ rating?: number | undefined;
27
+ country?: string | undefined;
28
+ amenities?: string[] | undefined;
29
+ }>;
30
+ export type Hotel = z.infer<typeof hotelSchema>;
31
+ export declare const flightLegSchema: z.ZodObject<{
32
+ airline: z.ZodString;
33
+ flightNumber: z.ZodString;
34
+ origin: z.ZodString;
35
+ destination: z.ZodString;
36
+ departsAt: z.ZodString;
37
+ arrivesAt: z.ZodString;
38
+ durationMinutes: z.ZodOptional<z.ZodNumber>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ airline: string;
41
+ flightNumber: string;
42
+ origin: string;
43
+ destination: string;
44
+ departsAt: string;
45
+ arrivesAt: string;
46
+ durationMinutes?: number | undefined;
47
+ }, {
48
+ airline: string;
49
+ flightNumber: string;
50
+ origin: string;
51
+ destination: string;
52
+ departsAt: string;
53
+ arrivesAt: string;
54
+ durationMinutes?: number | undefined;
55
+ }>;
56
+ export type FlightLeg = z.infer<typeof flightLegSchema>;
57
+ export declare const flightSummarySchema: z.ZodObject<{
58
+ id: z.ZodString;
59
+ outbound: z.ZodObject<{
60
+ airline: z.ZodString;
61
+ flightNumber: z.ZodString;
62
+ origin: z.ZodString;
63
+ destination: z.ZodString;
64
+ departsAt: z.ZodString;
65
+ arrivesAt: z.ZodString;
66
+ durationMinutes: z.ZodOptional<z.ZodNumber>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ airline: string;
69
+ flightNumber: string;
70
+ origin: string;
71
+ destination: string;
72
+ departsAt: string;
73
+ arrivesAt: string;
74
+ durationMinutes?: number | undefined;
75
+ }, {
76
+ airline: string;
77
+ flightNumber: string;
78
+ origin: string;
79
+ destination: string;
80
+ departsAt: string;
81
+ arrivesAt: string;
82
+ durationMinutes?: number | undefined;
83
+ }>;
84
+ return: z.ZodOptional<z.ZodObject<{
85
+ airline: z.ZodString;
86
+ flightNumber: z.ZodString;
87
+ origin: z.ZodString;
88
+ destination: z.ZodString;
89
+ departsAt: z.ZodString;
90
+ arrivesAt: z.ZodString;
91
+ durationMinutes: z.ZodOptional<z.ZodNumber>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ airline: string;
94
+ flightNumber: string;
95
+ origin: string;
96
+ destination: string;
97
+ departsAt: string;
98
+ arrivesAt: string;
99
+ durationMinutes?: number | undefined;
100
+ }, {
101
+ airline: string;
102
+ flightNumber: string;
103
+ origin: string;
104
+ destination: string;
105
+ departsAt: string;
106
+ arrivesAt: string;
107
+ durationMinutes?: number | undefined;
108
+ }>>;
109
+ price: z.ZodString;
110
+ bookingClass: z.ZodOptional<z.ZodString>;
111
+ stops: z.ZodOptional<z.ZodNumber>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ id: string;
114
+ price: string;
115
+ outbound: {
116
+ airline: string;
117
+ flightNumber: string;
118
+ origin: string;
119
+ destination: string;
120
+ departsAt: string;
121
+ arrivesAt: string;
122
+ durationMinutes?: number | undefined;
123
+ };
124
+ return?: {
125
+ airline: string;
126
+ flightNumber: string;
127
+ origin: string;
128
+ destination: string;
129
+ departsAt: string;
130
+ arrivesAt: string;
131
+ durationMinutes?: number | undefined;
132
+ } | undefined;
133
+ bookingClass?: string | undefined;
134
+ stops?: number | undefined;
135
+ }, {
136
+ id: string;
137
+ price: string;
138
+ outbound: {
139
+ airline: string;
140
+ flightNumber: string;
141
+ origin: string;
142
+ destination: string;
143
+ departsAt: string;
144
+ arrivesAt: string;
145
+ durationMinutes?: number | undefined;
146
+ };
147
+ return?: {
148
+ airline: string;
149
+ flightNumber: string;
150
+ origin: string;
151
+ destination: string;
152
+ departsAt: string;
153
+ arrivesAt: string;
154
+ durationMinutes?: number | undefined;
155
+ } | undefined;
156
+ bookingClass?: string | undefined;
157
+ stops?: number | undefined;
158
+ }>;
159
+ export type FlightSummary = z.infer<typeof flightSummarySchema>;
160
+ export declare const itineraryStopSchema: z.ZodObject<{
161
+ id: z.ZodString;
162
+ title: z.ZodString;
163
+ startsAt: z.ZodString;
164
+ endsAt: z.ZodOptional<z.ZodString>;
165
+ location: z.ZodOptional<z.ZodString>;
166
+ description: z.ZodOptional<z.ZodString>;
167
+ kind: z.ZodOptional<z.ZodEnum<["flight", "hotel", "activity", "transfer"]>>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ id: string;
170
+ title: string;
171
+ startsAt: string;
172
+ endsAt?: string | undefined;
173
+ description?: string | undefined;
174
+ location?: string | undefined;
175
+ kind?: "flight" | "hotel" | "activity" | "transfer" | undefined;
176
+ }, {
177
+ id: string;
178
+ title: string;
179
+ startsAt: string;
180
+ endsAt?: string | undefined;
181
+ description?: string | undefined;
182
+ location?: string | undefined;
183
+ kind?: "flight" | "hotel" | "activity" | "transfer" | undefined;
184
+ }>;
185
+ export type ItineraryStop = z.infer<typeof itineraryStopSchema>;
186
+ export declare const itinerarySchema: z.ZodObject<{
187
+ id: z.ZodString;
188
+ title: z.ZodString;
189
+ stops: z.ZodArray<z.ZodObject<{
190
+ id: z.ZodString;
191
+ title: z.ZodString;
192
+ startsAt: z.ZodString;
193
+ endsAt: z.ZodOptional<z.ZodString>;
194
+ location: z.ZodOptional<z.ZodString>;
195
+ description: z.ZodOptional<z.ZodString>;
196
+ kind: z.ZodOptional<z.ZodEnum<["flight", "hotel", "activity", "transfer"]>>;
197
+ }, "strip", z.ZodTypeAny, {
198
+ id: string;
199
+ title: string;
200
+ startsAt: string;
201
+ endsAt?: string | undefined;
202
+ description?: string | undefined;
203
+ location?: string | undefined;
204
+ kind?: "flight" | "hotel" | "activity" | "transfer" | undefined;
205
+ }, {
206
+ id: string;
207
+ title: string;
208
+ startsAt: string;
209
+ endsAt?: string | undefined;
210
+ description?: string | undefined;
211
+ location?: string | undefined;
212
+ kind?: "flight" | "hotel" | "activity" | "transfer" | undefined;
213
+ }>, "many">;
214
+ }, "strip", z.ZodTypeAny, {
215
+ id: string;
216
+ title: string;
217
+ stops: {
218
+ id: string;
219
+ title: string;
220
+ startsAt: string;
221
+ endsAt?: string | undefined;
222
+ description?: string | undefined;
223
+ location?: string | undefined;
224
+ kind?: "flight" | "hotel" | "activity" | "transfer" | undefined;
225
+ }[];
226
+ }, {
227
+ id: string;
228
+ title: string;
229
+ stops: {
230
+ id: string;
231
+ title: string;
232
+ startsAt: string;
233
+ endsAt?: string | undefined;
234
+ description?: string | undefined;
235
+ location?: string | undefined;
236
+ kind?: "flight" | "hotel" | "activity" | "transfer" | undefined;
237
+ }[];
238
+ }>;
239
+ export type Itinerary = z.infer<typeof itinerarySchema>;
240
+ export declare const destinationSchema: z.ZodObject<{
241
+ id: z.ZodString;
242
+ name: z.ZodString;
243
+ country: z.ZodOptional<z.ZodString>;
244
+ imageUrl: z.ZodOptional<z.ZodString>;
245
+ tagline: z.ZodOptional<z.ZodString>;
246
+ bestSeason: z.ZodOptional<z.ZodString>;
247
+ averagePrice: z.ZodOptional<z.ZodString>;
248
+ }, "strip", z.ZodTypeAny, {
249
+ id: string;
250
+ name: string;
251
+ imageUrl?: string | undefined;
252
+ country?: string | undefined;
253
+ tagline?: string | undefined;
254
+ bestSeason?: string | undefined;
255
+ averagePrice?: string | undefined;
256
+ }, {
257
+ id: string;
258
+ name: string;
259
+ imageUrl?: string | undefined;
260
+ country?: string | undefined;
261
+ tagline?: string | undefined;
262
+ bestSeason?: string | undefined;
263
+ averagePrice?: string | undefined;
264
+ }>;
265
+ export type Destination = z.infer<typeof destinationSchema>;
266
+ //# sourceMappingURL=travel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"travel.d.ts","sourceRoot":"","sources":["../../src/schemas/travel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAQ9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;EAQ5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ export const hotelSchema = z.object({
3
+ id: z.string(),
4
+ name: z.string(),
5
+ city: z.string(),
6
+ country: z.string().optional(),
7
+ rating: z.number().min(0).max(5).optional(),
8
+ pricePerNight: z.string(),
9
+ imageUrl: z.string().url().optional(),
10
+ amenities: z.array(z.string()).optional()
11
+ });
12
+ export const flightLegSchema = z.object({
13
+ airline: z.string(),
14
+ flightNumber: z.string(),
15
+ origin: z.string(),
16
+ destination: z.string(),
17
+ departsAt: z.string(),
18
+ arrivesAt: z.string(),
19
+ durationMinutes: z.number().optional()
20
+ });
21
+ export const flightSummarySchema = z.object({
22
+ id: z.string(),
23
+ outbound: flightLegSchema,
24
+ return: flightLegSchema.optional(),
25
+ price: z.string(),
26
+ bookingClass: z.string().optional(),
27
+ stops: z.number().int().min(0).optional()
28
+ });
29
+ export const itineraryStopSchema = z.object({
30
+ id: z.string(),
31
+ title: z.string(),
32
+ startsAt: z.string(),
33
+ endsAt: z.string().optional(),
34
+ location: z.string().optional(),
35
+ description: z.string().optional(),
36
+ kind: z.enum(['flight', 'hotel', 'activity', 'transfer']).optional()
37
+ });
38
+ export const itinerarySchema = z.object({
39
+ id: z.string(),
40
+ title: z.string(),
41
+ stops: z.array(itineraryStopSchema)
42
+ });
43
+ export const destinationSchema = z.object({
44
+ id: z.string(),
45
+ name: z.string(),
46
+ country: z.string().optional(),
47
+ imageUrl: z.string().url().optional(),
48
+ tagline: z.string().optional(),
49
+ bestSeason: z.string().optional(),
50
+ averagePrice: z.string().optional()
51
+ });
package/dist/tool.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ import type { ZodType } from 'zod';
3
+ export interface ToolPermissions {
4
+ requiresAuth?: boolean;
5
+ requiresConsent?: boolean;
6
+ scopes?: string[];
7
+ }
8
+ export interface ToolAuth {
9
+ type: 'apiKey' | 'jwt' | 'oauth' | 'anonymous';
10
+ user?: {
11
+ id: string;
12
+ email?: string;
13
+ };
14
+ }
15
+ export interface ToolConsent {
16
+ scopes: string[];
17
+ acceptedAt: string;
18
+ }
19
+ export interface ToolLogger {
20
+ info(...args: unknown[]): void;
21
+ warn(...args: unknown[]): void;
22
+ error(...args: unknown[]): void;
23
+ }
24
+ export interface ToolContext {
25
+ userId?: string;
26
+ sessionId: string;
27
+ auth?: ToolAuth;
28
+ consent?: ToolConsent;
29
+ logger: ToolLogger;
30
+ }
31
+ export interface RateLimitConfig {
32
+ perMinute?: number;
33
+ perHour?: number;
34
+ }
35
+ export interface Tool<I extends ZodType = ZodType, O extends ZodType = ZodType> {
36
+ name: string;
37
+ description: string;
38
+ inputSchema: I;
39
+ outputSchema: O;
40
+ permissions: ToolPermissions;
41
+ rateLimit?: RateLimitConfig;
42
+ handler(input: z.infer<I>, ctx: ToolContext): Promise<z.infer<O>>;
43
+ }
44
+ export declare function defineTool<I extends ZodType, O extends ZodType>(tool: Tool<I, O>): Tool<I, O>;
45
+ //# sourceMappingURL=tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC;IAC/C,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,OAAO,GAAG,OAAO;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC;IACf,YAAY,EAAE,CAAC,CAAC;IAChB,WAAW,EAAE,eAAe,CAAC;IAC7B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CACnE;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,OAAO,EAC7D,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACf,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAEZ"}
package/dist/tool.js ADDED
@@ -0,0 +1,3 @@
1
+ export function defineTool(tool) {
2
+ return tool;
3
+ }
@@ -0,0 +1,37 @@
1
+ import type { ZodType } from 'zod';
2
+ export interface CTA {
3
+ label: string;
4
+ kind: 'tool' | 'link' | 'event';
5
+ payload?: unknown;
6
+ }
7
+ export interface WidgetPermissions {
8
+ collectPersonalData?: boolean;
9
+ requiresConsent?: boolean;
10
+ supportsOAuth?: boolean;
11
+ allowsExternalLinks?: boolean;
12
+ allowsFileUpload?: boolean;
13
+ }
14
+ export interface WidgetAppearance {
15
+ theme?: string;
16
+ density?: 'compact' | 'comfortable';
17
+ style?: 'modern' | 'minimal' | 'enterprise';
18
+ }
19
+ export interface WidgetActions {
20
+ primaryCTA?: CTA;
21
+ secondaryCTA?: CTA;
22
+ }
23
+ export interface WidgetConfig {
24
+ permissions: WidgetPermissions;
25
+ appearance: WidgetAppearance;
26
+ actions: WidgetActions;
27
+ }
28
+ export type WidgetCategory = 'core' | 'commerce' | 'booking' | 'leadgen' | 'travel' | 'dashboard';
29
+ export interface WidgetMeta<S extends ZodType = ZodType> {
30
+ name: string;
31
+ category: WidgetCategory;
32
+ version: string;
33
+ config: WidgetConfig;
34
+ schema: S;
35
+ }
36
+ export declare const defaultWidgetConfig: WidgetConfig;
37
+ //# sourceMappingURL=widget-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-config.d.ts","sourceRoot":"","sources":["../src/widget-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;CAC7C;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,UAAU,GACV,SAAS,GACT,SAAS,GACT,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACX;AAED,eAAO,MAAM,mBAAmB,EAAE,YAIjC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const defaultWidgetConfig = {
2
+ permissions: {},
3
+ appearance: {},
4
+ actions: {}
5
+ };
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@conversokit/shared",
3
+ "version": "0.1.0",
4
+ "description": "Shared Zod schemas, TypeScript types, and example fixtures consumed by every other ConversoKit package.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Xyborg/ConversoKit.git",
9
+ "directory": "packages/shared"
10
+ },
11
+ "homepage": "https://github.com/Xyborg/ConversoKit#readme",
12
+ "bugs": "https://github.com/Xyborg/ConversoKit/issues",
13
+ "type": "module",
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "dependencies": {
23
+ "zod": "^3.22.2"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.2.0",
27
+ "vitest": "^1.6.0"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc --project tsconfig.json",
31
+ "dev": "tsc --project tsconfig.json --watch",
32
+ "typecheck": "tsc --noEmit",
33
+ "lint": "eslint src",
34
+ "test": "vitest run"
35
+ }
36
+ }