lancer-shared 1.2.19 → 1.2.20

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 (121) hide show
  1. package/dist/bundle.cjs.js +22 -8
  2. package/dist/constants/collections.js +14 -0
  3. package/dist/constants/common-questions.js +57 -0
  4. package/dist/constants/index.d.ts +1 -1
  5. package/dist/constants/index.js +18 -0
  6. package/dist/constants/invoice.d.ts +2 -0
  7. package/dist/constants/job-filter-options.js +265 -0
  8. package/dist/constants/job-status.js +21 -0
  9. package/dist/constants/mappings/countryMapping.js +120 -0
  10. package/dist/constants/mappings/regionMapping.js +240 -0
  11. package/dist/constants/routes.js +116 -0
  12. package/dist/constants/upwork-accounts.js +18 -0
  13. package/dist/index.js +4 -0
  14. package/dist/schemas/account/account-status.js +8 -0
  15. package/dist/schemas/account/bidder-account.js +35 -0
  16. package/dist/schemas/account/index.js +3 -0
  17. package/dist/schemas/account/scraper-account.js +34 -0
  18. package/dist/schemas/ai/ai-config.d.ts +36 -0
  19. package/dist/schemas/ai/ai-config.js +9 -0
  20. package/dist/schemas/ai/index.d.ts +3 -0
  21. package/dist/schemas/ai/index.js +3 -0
  22. package/dist/schemas/ai/proposal.d.ts +82 -0
  23. package/dist/schemas/ai/proposal.js +13 -0
  24. package/dist/schemas/ai/suitability.d.ts +37 -0
  25. package/dist/schemas/ai/suitability.js +14 -0
  26. package/dist/schemas/bid/bid-result.js +11 -0
  27. package/dist/schemas/bid/bid.js +35 -0
  28. package/dist/schemas/bid/index.js +2 -0
  29. package/dist/schemas/campaign/campaign-ai-metrics.js +6 -0
  30. package/dist/schemas/campaign/campaign-analytics.js +42 -0
  31. package/dist/schemas/campaign/campaign-expenses.js +6 -0
  32. package/dist/schemas/campaign/campaign-insights.js +31 -0
  33. package/dist/schemas/campaign/campaign-integrations.js +13 -0
  34. package/dist/schemas/campaign/campaign-job-count.js +3 -0
  35. package/dist/schemas/campaign/campaign.js +41 -0
  36. package/dist/schemas/campaign/index.js +7 -0
  37. package/dist/schemas/chat-message/chat-message.js +10 -0
  38. package/dist/schemas/chat-message/index.js +1 -0
  39. package/dist/schemas/config/agency-config.js +7 -0
  40. package/dist/schemas/config/index.js +1 -0
  41. package/dist/schemas/event/index.d.ts +58 -0
  42. package/dist/schemas/index.js +17 -0
  43. package/dist/schemas/invoice/index.d.ts +8 -0
  44. package/dist/schemas/job-filters/index.js +1 -0
  45. package/dist/schemas/job-filters/job-filters.js +84 -0
  46. package/dist/schemas/lead/index.js +173 -0
  47. package/dist/schemas/lead/lead-note.js +27 -0
  48. package/dist/schemas/lead/lead-status.js +23 -0
  49. package/dist/schemas/lead/nuxt.js +287 -0
  50. package/dist/schemas/logger/index.js +1 -0
  51. package/dist/schemas/logger/log-event.js +117 -0
  52. package/dist/schemas/organization/index.d.ts +68 -1
  53. package/dist/schemas/organization/index.js +70 -0
  54. package/dist/schemas/organization/member.js +7 -0
  55. package/dist/schemas/organization/organization.d.ts +118 -22
  56. package/dist/schemas/organization/organization.js +16 -0
  57. package/dist/schemas/organization/subscription.d.ts +47 -0
  58. package/dist/schemas/organization/subscription.js +17 -0
  59. package/dist/schemas/plan/index.d.ts +36 -3
  60. package/dist/schemas/proxy/index.js +3 -0
  61. package/dist/schemas/proxy/proxy-available-replacements.js +3 -0
  62. package/dist/schemas/proxy/proxy-country.js +249 -0
  63. package/dist/schemas/proxy/proxy.js +29 -0
  64. package/dist/schemas/saved-search/index.js +9 -0
  65. package/dist/schemas/scraper/index.js +2 -0
  66. package/dist/schemas/scraper/scrape-payload.d.ts +49 -0
  67. package/dist/schemas/scraper/scrape-payload.js +21 -0
  68. package/dist/schemas/scraper/scrape-result.js +23 -0
  69. package/dist/schemas/shared.js +19 -0
  70. package/dist/schemas/tier/index.d.ts +119 -0
  71. package/dist/schemas/time-filter/index.js +6 -0
  72. package/dist/schemas/transaction/index.js +17 -0
  73. package/dist/schemas/usage/index.js +18 -0
  74. package/dist/schemas/user/index.js +52 -0
  75. package/dist/types/account/account-status.js +1 -0
  76. package/dist/types/account/bidder-account.js +1 -0
  77. package/dist/types/account/index.js +3 -0
  78. package/dist/types/account/scraper-account.js +1 -0
  79. package/dist/types/ai/ai-config.d.ts +6 -0
  80. package/dist/types/ai/ai-config.js +1 -0
  81. package/dist/types/ai/index.d.ts +3 -0
  82. package/dist/types/ai/index.js +3 -0
  83. package/dist/types/ai/proposal.d.ts +10 -0
  84. package/dist/types/ai/proposal.js +1 -0
  85. package/dist/types/ai/suitability.d.ts +6 -0
  86. package/dist/types/ai/suitability.js +1 -0
  87. package/dist/types/bid/bid-result.js +1 -0
  88. package/dist/types/bid/bid.js +1 -0
  89. package/dist/types/bid/index.js +2 -0
  90. package/dist/types/campaign/campaign-analytics.js +1 -0
  91. package/dist/types/campaign/campaign-expenses.js +1 -0
  92. package/dist/types/campaign/campaign-insights.js +1 -0
  93. package/dist/types/campaign/campaign-integrations.js +1 -0
  94. package/dist/types/campaign/campaign-job-count.js +1 -0
  95. package/dist/types/campaign/campaign.js +1 -0
  96. package/dist/types/campaign/index.js +6 -0
  97. package/dist/types/chat-message/chat-message.js +1 -0
  98. package/dist/types/chat-message/index.js +1 -0
  99. package/dist/types/config/agency-config.js +1 -0
  100. package/dist/types/config/index.js +1 -0
  101. package/dist/types/index.js +15 -0
  102. package/dist/types/job/index.js +3 -0
  103. package/dist/types/job/job-note.js +1 -0
  104. package/dist/types/job/job-status.js +9 -0
  105. package/dist/types/job/nuxt.js +1 -0
  106. package/dist/types/job-filters/index.js +1 -0
  107. package/dist/types/job-filters/job-filters.js +1 -0
  108. package/dist/types/logger/index.js +1 -0
  109. package/dist/types/logger/log-event.js +1 -0
  110. package/dist/types/saved-search/index.js +1 -0
  111. package/dist/types/scraper/index.js +2 -0
  112. package/dist/types/scraper/scrape-payload.js +1 -0
  113. package/dist/types/scraper/scrape-result.js +1 -0
  114. package/dist/types/shared.js +1 -0
  115. package/dist/types/time-filter/index.js +1 -0
  116. package/dist/types/transaction/index.js +1 -0
  117. package/dist/types/usage/index.js +1 -0
  118. package/dist/types/user/index.js +1 -0
  119. package/dist/utils/index.js +1 -0
  120. package/dist/utils/try-catch.js +10 -0
  121. package/package.json +1 -1
@@ -0,0 +1,249 @@
1
+ import { z } from 'zod';
2
+ export const proxyCountrySchema = z.enum([
3
+ 'US',
4
+ 'CA',
5
+ 'GB',
6
+ 'AF',
7
+ 'AX',
8
+ 'AL',
9
+ 'DZ',
10
+ 'AS',
11
+ 'AD',
12
+ 'AO',
13
+ 'AI',
14
+ 'AQ',
15
+ 'AG',
16
+ 'AR',
17
+ 'AM',
18
+ 'AW',
19
+ 'AU',
20
+ 'AT',
21
+ 'AZ',
22
+ 'BS',
23
+ 'BH',
24
+ 'BD',
25
+ 'BB',
26
+ 'BY',
27
+ 'BE',
28
+ 'BZ',
29
+ 'BJ',
30
+ 'BM',
31
+ 'BT',
32
+ 'BO',
33
+ 'BA',
34
+ 'BW',
35
+ 'BV',
36
+ 'BR',
37
+ 'IO',
38
+ 'BN',
39
+ 'BG',
40
+ 'BF',
41
+ 'BI',
42
+ 'KH',
43
+ 'CM',
44
+ 'CV',
45
+ 'KY',
46
+ 'CF',
47
+ 'TD',
48
+ 'CL',
49
+ 'CN',
50
+ 'CX',
51
+ 'CC',
52
+ 'CO',
53
+ 'KM',
54
+ 'CG',
55
+ 'CD',
56
+ 'CK',
57
+ 'CR',
58
+ 'CI',
59
+ 'HR',
60
+ 'CU',
61
+ 'CY',
62
+ 'CZ',
63
+ 'DK',
64
+ 'DJ',
65
+ 'DM',
66
+ 'DO',
67
+ 'EC',
68
+ 'EG',
69
+ 'SV',
70
+ 'GQ',
71
+ 'ER',
72
+ 'EE',
73
+ 'ET',
74
+ 'FK',
75
+ 'FO',
76
+ 'FJ',
77
+ 'FI',
78
+ 'FR',
79
+ 'GF',
80
+ 'PF',
81
+ 'TF',
82
+ 'GA',
83
+ 'GM',
84
+ 'GE',
85
+ 'DE',
86
+ 'GH',
87
+ 'GI',
88
+ 'GR',
89
+ 'GL',
90
+ 'GD',
91
+ 'GP',
92
+ 'GU',
93
+ 'GT',
94
+ 'GG',
95
+ 'GN',
96
+ 'GW',
97
+ 'GY',
98
+ 'HT',
99
+ 'HM',
100
+ 'VA',
101
+ 'HN',
102
+ 'HK',
103
+ 'HU',
104
+ 'IS',
105
+ 'IN',
106
+ 'ID',
107
+ 'IR',
108
+ 'IQ',
109
+ 'IE',
110
+ 'IM',
111
+ 'IL',
112
+ 'IT',
113
+ 'JM',
114
+ 'JP',
115
+ 'JE',
116
+ 'JO',
117
+ 'KZ',
118
+ 'KE',
119
+ 'KI',
120
+ 'KP',
121
+ 'KR',
122
+ 'KW',
123
+ 'KG',
124
+ 'LA',
125
+ 'LV',
126
+ 'LB',
127
+ 'LS',
128
+ 'LR',
129
+ 'LY',
130
+ 'LI',
131
+ 'LT',
132
+ 'LU',
133
+ 'MO',
134
+ 'MK',
135
+ 'MG',
136
+ 'MW',
137
+ 'MY',
138
+ 'MV',
139
+ 'ML',
140
+ 'MT',
141
+ 'MH',
142
+ 'MQ',
143
+ 'MR',
144
+ 'MU',
145
+ 'YT',
146
+ 'MX',
147
+ 'FM',
148
+ 'MD',
149
+ 'MC',
150
+ 'MN',
151
+ 'ME',
152
+ 'MS',
153
+ 'MA',
154
+ 'MZ',
155
+ 'MM',
156
+ 'NA',
157
+ 'NR',
158
+ 'NP',
159
+ 'NL',
160
+ 'AN',
161
+ 'NC',
162
+ 'NZ',
163
+ 'NI',
164
+ 'NE',
165
+ 'NG',
166
+ 'NU',
167
+ 'NF',
168
+ 'MP',
169
+ 'NO',
170
+ 'OM',
171
+ 'PK',
172
+ 'PW',
173
+ 'PS',
174
+ 'PA',
175
+ 'PG',
176
+ 'PY',
177
+ 'PE',
178
+ 'PH',
179
+ 'PN',
180
+ 'PL',
181
+ 'PT',
182
+ 'PR',
183
+ 'QA',
184
+ 'RE',
185
+ 'RO',
186
+ 'RU',
187
+ 'RW',
188
+ 'BL',
189
+ 'SH',
190
+ 'KN',
191
+ 'LC',
192
+ 'MF',
193
+ 'PM',
194
+ 'VC',
195
+ 'WS',
196
+ 'SM',
197
+ 'ST',
198
+ 'SA',
199
+ 'SN',
200
+ 'RS',
201
+ 'SC',
202
+ 'SL',
203
+ 'SG',
204
+ 'SK',
205
+ 'SI',
206
+ 'SB',
207
+ 'SO',
208
+ 'ZA',
209
+ 'GS',
210
+ 'ES',
211
+ 'LK',
212
+ 'SD',
213
+ 'SR',
214
+ 'SJ',
215
+ 'SZ',
216
+ 'SE',
217
+ 'CH',
218
+ 'SY',
219
+ 'TW',
220
+ 'TJ',
221
+ 'TZ',
222
+ 'TH',
223
+ 'TL',
224
+ 'TG',
225
+ 'TK',
226
+ 'TO',
227
+ 'TT',
228
+ 'TN',
229
+ 'TR',
230
+ 'TM',
231
+ 'TC',
232
+ 'TV',
233
+ 'UG',
234
+ 'UA',
235
+ 'AE',
236
+ 'UM',
237
+ 'UY',
238
+ 'UZ',
239
+ 'VU',
240
+ 'VE',
241
+ 'VN',
242
+ 'VG',
243
+ 'VI',
244
+ 'WF',
245
+ 'EH',
246
+ 'YE',
247
+ 'ZM',
248
+ 'ZW',
249
+ ]);
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { proxyCountrySchema } from './proxy-country';
3
+ export const proxyStatusSchema = z.enum([
4
+ 'invalid',
5
+ 'valid',
6
+ 'pending_validation',
7
+ ]);
8
+ export const proxyProviderSchema = z.enum(['webshare']);
9
+ export const proxySchema = z.object({
10
+ id: z.string(),
11
+ externalId: z.string(),
12
+ host: z.string(),
13
+ port: z.number(),
14
+ username: z.string(),
15
+ password: z.string(),
16
+ provider: proxyProviderSchema,
17
+ fraudScore: z.number().nullable(),
18
+ claimedCountry: proxyCountrySchema,
19
+ status: proxyStatusSchema.nullable(),
20
+ country: proxyCountrySchema.nullable(),
21
+ bidderId: z.string().nullable(),
22
+ });
23
+ export const externalProxySchema = proxySchema.omit({
24
+ id: true,
25
+ bidderId: true,
26
+ status: true,
27
+ country: true,
28
+ fraudScore: true,
29
+ });
@@ -0,0 +1,9 @@
1
+ import { date, number, object, string } from "zod";
2
+ import { booleanSchema } from "../shared";
3
+ export const savedSearchSchema = object({
4
+ id: number().int(),
5
+ name: string(),
6
+ url: string(),
7
+ createdAt: date(),
8
+ isActive: booleanSchema,
9
+ });
@@ -0,0 +1,2 @@
1
+ export * from './scrape-payload';
2
+ export * from './scrape-result';
@@ -128,6 +128,7 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
128
128
  tierId: import("zod").ZodEnum<["free", "premium"]>;
129
129
  subscription: import("zod").ZodNullable<import("zod").ZodObject<{
130
130
  planId: import("zod").ZodString;
131
+ pendingPlanId: import("zod").ZodNullable<import("zod").ZodString>;
131
132
  status: import("zod").ZodEnum<["active", "trialing", "cancelled", "paused", "payment_pending", "payment_failed"]>;
132
133
  startedAt: import("zod").ZodNumber;
133
134
  currentPeriodEnd: import("zod").ZodNumber;
@@ -153,6 +154,16 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
153
154
  id: string;
154
155
  };
155
156
  }>, "many">;
157
+ invoice: import("zod").ZodObject<{
158
+ id: import("zod").ZodString;
159
+ hosted_invoice_url: import("zod").ZodNullable<import("zod").ZodString>;
160
+ }, "strip", import("zod").ZodTypeAny, {
161
+ id: string;
162
+ hosted_invoice_url: string | null;
163
+ }, {
164
+ id: string;
165
+ hosted_invoice_url: string | null;
166
+ }>;
156
167
  }, "strip", import("zod").ZodTypeAny, {
157
168
  id: string;
158
169
  items: {
@@ -161,6 +172,10 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
161
172
  id: string;
162
173
  };
163
174
  }[];
175
+ invoice: {
176
+ id: string;
177
+ hosted_invoice_url: string | null;
178
+ };
164
179
  }, {
165
180
  id: string;
166
181
  items: {
@@ -169,11 +184,16 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
169
184
  id: string;
170
185
  };
171
186
  }[];
187
+ invoice: {
188
+ id: string;
189
+ hosted_invoice_url: string | null;
190
+ };
172
191
  }>;
173
192
  source: import("zod").ZodEnum<["stripe", "manual"]>;
174
193
  }, "strip", import("zod").ZodTypeAny, {
175
194
  status: "active" | "trialing" | "cancelled" | "paused" | "payment_pending" | "payment_failed";
176
195
  planId: string;
196
+ pendingPlanId: string | null;
177
197
  startedAt: number;
178
198
  currentPeriodEnd: number;
179
199
  stripe: {
@@ -184,11 +204,16 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
184
204
  id: string;
185
205
  };
186
206
  }[];
207
+ invoice: {
208
+ id: string;
209
+ hosted_invoice_url: string | null;
210
+ };
187
211
  };
188
212
  source: "stripe" | "manual";
189
213
  }, {
190
214
  status: "active" | "trialing" | "cancelled" | "paused" | "payment_pending" | "payment_failed";
191
215
  planId: string;
216
+ pendingPlanId: string | null;
192
217
  startedAt: number;
193
218
  currentPeriodEnd: number;
194
219
  stripe: {
@@ -199,6 +224,10 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
199
224
  id: string;
200
225
  };
201
226
  }[];
227
+ invoice: {
228
+ id: string;
229
+ hosted_invoice_url: string | null;
230
+ };
202
231
  };
203
232
  source: "stripe" | "manual";
204
233
  }>>;
@@ -277,6 +306,7 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
277
306
  subscription: {
278
307
  status: "active" | "trialing" | "cancelled" | "paused" | "payment_pending" | "payment_failed";
279
308
  planId: string;
309
+ pendingPlanId: string | null;
280
310
  startedAt: number;
281
311
  currentPeriodEnd: number;
282
312
  stripe: {
@@ -287,6 +317,10 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
287
317
  id: string;
288
318
  };
289
319
  }[];
320
+ invoice: {
321
+ id: string;
322
+ hosted_invoice_url: string | null;
323
+ };
290
324
  };
291
325
  source: "stripe" | "manual";
292
326
  } | null;
@@ -320,6 +354,7 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
320
354
  subscription: {
321
355
  status: "active" | "trialing" | "cancelled" | "paused" | "payment_pending" | "payment_failed";
322
356
  planId: string;
357
+ pendingPlanId: string | null;
323
358
  startedAt: number;
324
359
  currentPeriodEnd: number;
325
360
  stripe: {
@@ -330,6 +365,10 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
330
365
  id: string;
331
366
  };
332
367
  }[];
368
+ invoice: {
369
+ id: string;
370
+ hosted_invoice_url: string | null;
371
+ };
333
372
  };
334
373
  source: "stripe" | "manual";
335
374
  } | null;
@@ -989,6 +1028,7 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
989
1028
  subscription: {
990
1029
  status: "active" | "trialing" | "cancelled" | "paused" | "payment_pending" | "payment_failed";
991
1030
  planId: string;
1031
+ pendingPlanId: string | null;
992
1032
  startedAt: number;
993
1033
  currentPeriodEnd: number;
994
1034
  stripe: {
@@ -999,6 +1039,10 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
999
1039
  id: string;
1000
1040
  };
1001
1041
  }[];
1042
+ invoice: {
1043
+ id: string;
1044
+ hosted_invoice_url: string | null;
1045
+ };
1002
1046
  };
1003
1047
  source: "stripe" | "manual";
1004
1048
  } | null;
@@ -1180,6 +1224,7 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
1180
1224
  subscription: {
1181
1225
  status: "active" | "trialing" | "cancelled" | "paused" | "payment_pending" | "payment_failed";
1182
1226
  planId: string;
1227
+ pendingPlanId: string | null;
1183
1228
  startedAt: number;
1184
1229
  currentPeriodEnd: number;
1185
1230
  stripe: {
@@ -1190,6 +1235,10 @@ export declare const checkLeadStatusPayloadSchema: import("zod").ZodObject<{
1190
1235
  id: string;
1191
1236
  };
1192
1237
  }[];
1238
+ invoice: {
1239
+ id: string;
1240
+ hosted_invoice_url: string | null;
1241
+ };
1193
1242
  };
1194
1243
  source: "stripe" | "manual";
1195
1244
  } | null;
@@ -0,0 +1,21 @@
1
+ import { any, array, object, string } from "zod";
2
+ import { jobActivityOffsetHourSchema, jobListingSchema } from "../lead";
3
+ export const scrapePayloadSchema = object({
4
+ latestJobsUrls: array(string()),
5
+ cookies: array(any()),
6
+ username: string(),
7
+ password: string(),
8
+ });
9
+ export const scrapeUserProfilePayloadSchema = object({
10
+ profileUrl: string(),
11
+ cookies: array(any()),
12
+ username: string(),
13
+ password: string(),
14
+ });
15
+ export const scrapeJobPayloadSchema = object({
16
+ listing: jobListingSchema,
17
+ });
18
+ export const scrapeJobActivityPayloadSchema = object({
19
+ listing: jobListingSchema,
20
+ offsetHour: jobActivityOffsetHourSchema,
21
+ });
@@ -0,0 +1,23 @@
1
+ import { any, array, boolean, object, string } from "zod";
2
+ import { jobListingSchema, upworkJobSchema } from "../lead";
3
+ import { regionSchema } from "../shared";
4
+ import { upworkProfileSchema } from "../user";
5
+ export const scrapeResultSchema = object({
6
+ jobs: array(upworkJobSchema),
7
+ cookies: array(any()),
8
+ region: regionSchema,
9
+ usAccountCookies: array(any()).optional(),
10
+ ukAccountCookies: array(any()).optional(),
11
+ });
12
+ export const scrapeUserProfileResultSchema = object({
13
+ success: boolean(),
14
+ message: string(),
15
+ data: upworkProfileSchema,
16
+ });
17
+ export const scrapeFeedResultSchema = object({
18
+ listings: array(jobListingSchema),
19
+ cookies: array(any()),
20
+ region: regionSchema,
21
+ usAccountCookies: array(any()).optional(),
22
+ ukAccountCookies: array(any()).optional(),
23
+ });
@@ -0,0 +1,19 @@
1
+ import { coerce, string, z } from "zod";
2
+ export const booleanSchema = z
3
+ .union([z.boolean(), z.literal("true"), z.literal("false")])
4
+ .transform((value) => value === true || value === "true");
5
+ export const dateSchema = (params = {}) => coerce.date({
6
+ ...params,
7
+ });
8
+ export const passwordSchema = string()
9
+ .min(8, "Password must be at least 8 characters long.")
10
+ .max(255, "Password must be at most 255 characters long.")
11
+ .refine((password) => /[a-z]/.test(password), "Password must contain at least one lowercase letter.")
12
+ .refine((password) => /[A-Z]/.test(password), "Password must contain at least one uppercase letter.")
13
+ .refine((password) => /\d/.test(password), "Password must contain at least one number.")
14
+ .refine((password) => /[\W_]/.test(password), "Password must contain at least one symbol.");
15
+ export const regionSchema = z.union([
16
+ z.literal("USOnly"),
17
+ z.literal("UKOnly"),
18
+ z.literal("Worldwide"),
19
+ ]);
@@ -0,0 +1,119 @@
1
+ import { infer, z } from "zod";
2
+ export declare const planSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ slug: z.ZodString;
6
+ items: z.ZodArray<z.ZodObject<{
7
+ id: z.ZodString;
8
+ billingScheme: z.ZodEnum<["per_unit", "tiered"]>;
9
+ usageType: z.ZodNullable<z.ZodEnum<["metered", "licensed"]>>;
10
+ unitAmount: z.ZodNullable<z.ZodNumber>;
11
+ tiers: z.ZodArray<z.ZodObject<{
12
+ flatAmount: z.ZodNullable<z.ZodNumber>;
13
+ flatAmountDecimal: z.ZodNullable<z.ZodString>;
14
+ unitAmount: z.ZodNullable<z.ZodNumber>;
15
+ unitAmountDecimal: z.ZodString;
16
+ upTo: z.ZodNullable<z.ZodNumber>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ flatAmount: number | null;
19
+ flatAmountDecimal: string | null;
20
+ unitAmount: number | null;
21
+ unitAmountDecimal: string;
22
+ upTo: number | null;
23
+ }, {
24
+ flatAmount: number | null;
25
+ flatAmountDecimal: string | null;
26
+ unitAmount: number | null;
27
+ unitAmountDecimal: string;
28
+ upTo: number | null;
29
+ }>, "many">;
30
+ currency: z.ZodString;
31
+ interval: z.ZodEnum<["day", "week", "month", "year"]>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ id: string;
34
+ unitAmount: number | null;
35
+ billingScheme: "per_unit" | "tiered";
36
+ usageType: "metered" | "licensed" | null;
37
+ tiers: {
38
+ flatAmount: number | null;
39
+ flatAmountDecimal: string | null;
40
+ unitAmount: number | null;
41
+ unitAmountDecimal: string;
42
+ upTo: number | null;
43
+ }[];
44
+ currency: string;
45
+ interval: "day" | "week" | "month" | "year";
46
+ }, {
47
+ id: string;
48
+ unitAmount: number | null;
49
+ billingScheme: "per_unit" | "tiered";
50
+ usageType: "metered" | "licensed" | null;
51
+ tiers: {
52
+ flatAmount: number | null;
53
+ flatAmountDecimal: string | null;
54
+ unitAmount: number | null;
55
+ unitAmountDecimal: string;
56
+ upTo: number | null;
57
+ }[];
58
+ currency: string;
59
+ interval: "day" | "week" | "month" | "year";
60
+ }>, "many">;
61
+ version: z.ZodNumber;
62
+ features: z.ZodArray<z.ZodString, "many">;
63
+ sortOrder: z.ZodNumber;
64
+ isActive: z.ZodBoolean;
65
+ createdAt: z.ZodDate;
66
+ archivedAt: z.ZodNullable<z.ZodDate>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ id: string;
69
+ createdAt: Date;
70
+ name: string;
71
+ isActive: boolean;
72
+ sortOrder: number;
73
+ slug: string;
74
+ items: {
75
+ id: string;
76
+ unitAmount: number | null;
77
+ billingScheme: "per_unit" | "tiered";
78
+ usageType: "metered" | "licensed" | null;
79
+ tiers: {
80
+ flatAmount: number | null;
81
+ flatAmountDecimal: string | null;
82
+ unitAmount: number | null;
83
+ unitAmountDecimal: string;
84
+ upTo: number | null;
85
+ }[];
86
+ currency: string;
87
+ interval: "day" | "week" | "month" | "year";
88
+ }[];
89
+ version: number;
90
+ features: string[];
91
+ archivedAt: Date | null;
92
+ }, {
93
+ id: string;
94
+ createdAt: Date;
95
+ name: string;
96
+ isActive: boolean;
97
+ sortOrder: number;
98
+ slug: string;
99
+ items: {
100
+ id: string;
101
+ unitAmount: number | null;
102
+ billingScheme: "per_unit" | "tiered";
103
+ usageType: "metered" | "licensed" | null;
104
+ tiers: {
105
+ flatAmount: number | null;
106
+ flatAmountDecimal: string | null;
107
+ unitAmount: number | null;
108
+ unitAmountDecimal: string;
109
+ upTo: number | null;
110
+ }[];
111
+ currency: string;
112
+ interval: "day" | "week" | "month" | "year";
113
+ }[];
114
+ version: number;
115
+ features: string[];
116
+ archivedAt: Date | null;
117
+ }>;
118
+ export interface Plan extends infer<typeof planSchema> {
119
+ }
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export const timeFilterSchema = z.union([
3
+ z.literal("last_7_days"),
4
+ z.literal("last_30_days"),
5
+ z.literal("all_time"),
6
+ ]);
@@ -0,0 +1,17 @@
1
+ import { number, object, string, z } from "zod";
2
+ export const transactionTypeEnum = z.enum(["subscription", "add-on", "refund"]);
3
+ export const transactionStatusEnum = z.enum([
4
+ "succeeded",
5
+ "failed",
6
+ "refunded",
7
+ ]);
8
+ export const transactionSchema = object({
9
+ orgId: string(),
10
+ type: transactionTypeEnum,
11
+ creditsPurchased: number(),
12
+ creditsGranted: number().nullable(),
13
+ amountUsd: number(),
14
+ stripeInvoiceId: string(),
15
+ status: transactionStatusEnum,
16
+ timestamp: number(),
17
+ });
@@ -0,0 +1,18 @@
1
+ import { number, object, string } from "zod";
2
+ const breakdownSchema = object({
3
+ suitability: number(),
4
+ proposal: number(),
5
+ bidding: number(),
6
+ });
7
+ export const dailyUsageSchema = object({
8
+ breakdown: breakdownSchema,
9
+ tokensUsed: number().optional(),
10
+ campaignId: string().optional(),
11
+ model: string(),
12
+ timestamp: number(),
13
+ });
14
+ export const periodUsageSchema = object({
15
+ usedCredits: number(),
16
+ breakdown: breakdownSchema,
17
+ lastUpdated: number(),
18
+ });