@geekapps/post-nextjs 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/client.d.ts +31 -0
  2. package/dist/client.d.ts.map +1 -0
  3. package/dist/client.js +29 -0
  4. package/dist/client.js.map +1 -0
  5. package/dist/errors.d.ts +11 -0
  6. package/dist/errors.d.ts.map +1 -0
  7. package/dist/errors.js +14 -0
  8. package/dist/errors.js.map +1 -0
  9. package/dist/http.d.ts +25 -0
  10. package/dist/http.d.ts.map +1 -0
  11. package/dist/http.js +51 -0
  12. package/dist/http.js.map +1 -0
  13. package/dist/index.d.ts +19 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +16 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/react-exports.d.ts +3 -0
  18. package/dist/react-exports.d.ts.map +1 -0
  19. package/dist/react-exports.js +3 -0
  20. package/dist/react-exports.js.map +1 -0
  21. package/dist/react.d.ts +12 -0
  22. package/dist/react.d.ts.map +1 -0
  23. package/dist/react.js +22 -0
  24. package/dist/react.js.map +1 -0
  25. package/dist/resources/domains.d.ts +14 -0
  26. package/dist/resources/domains.d.ts.map +1 -0
  27. package/dist/resources/domains.js +21 -0
  28. package/dist/resources/domains.js.map +1 -0
  29. package/dist/resources/history.d.ts +9 -0
  30. package/dist/resources/history.d.ts.map +1 -0
  31. package/dist/resources/history.js +26 -0
  32. package/dist/resources/history.js.map +1 -0
  33. package/dist/resources/managed-numbers.d.ts +28 -0
  34. package/dist/resources/managed-numbers.d.ts.map +1 -0
  35. package/dist/resources/managed-numbers.js +24 -0
  36. package/dist/resources/managed-numbers.js.map +1 -0
  37. package/dist/resources/messages.d.ts +8 -0
  38. package/dist/resources/messages.d.ts.map +1 -0
  39. package/dist/resources/messages.js +9 -0
  40. package/dist/resources/messages.js.map +1 -0
  41. package/dist/resources/plans.d.ts +10 -0
  42. package/dist/resources/plans.d.ts.map +1 -0
  43. package/dist/resources/plans.js +15 -0
  44. package/dist/resources/plans.js.map +1 -0
  45. package/dist/resources/smtp.d.ts +14 -0
  46. package/dist/resources/smtp.d.ts.map +1 -0
  47. package/dist/resources/smtp.js +18 -0
  48. package/dist/resources/smtp.js.map +1 -0
  49. package/dist/resources/statistics.d.ts +8 -0
  50. package/dist/resources/statistics.d.ts.map +1 -0
  51. package/dist/resources/statistics.js +17 -0
  52. package/dist/resources/statistics.js.map +1 -0
  53. package/dist/resources/templates.d.ts +17 -0
  54. package/dist/resources/templates.d.ts.map +1 -0
  55. package/dist/resources/templates.js +33 -0
  56. package/dist/resources/templates.js.map +1 -0
  57. package/dist/resources/webhooks.d.ts +13 -0
  58. package/dist/resources/webhooks.d.ts.map +1 -0
  59. package/dist/resources/webhooks.js +24 -0
  60. package/dist/resources/webhooks.js.map +1 -0
  61. package/dist/resources/whatsapp-numbers.d.ts +23 -0
  62. package/dist/resources/whatsapp-numbers.d.ts.map +1 -0
  63. package/dist/resources/whatsapp-numbers.js +54 -0
  64. package/dist/resources/whatsapp-numbers.js.map +1 -0
  65. package/dist/resources/whatsapp-templates.d.ts +12 -0
  66. package/dist/resources/whatsapp-templates.d.ts.map +1 -0
  67. package/dist/resources/whatsapp-templates.js +21 -0
  68. package/dist/resources/whatsapp-templates.js.map +1 -0
  69. package/dist/server-exports.d.ts +8 -0
  70. package/dist/server-exports.d.ts.map +1 -0
  71. package/dist/server-exports.js +5 -0
  72. package/dist/server-exports.js.map +1 -0
  73. package/dist/server.d.ts +21 -0
  74. package/dist/server.d.ts.map +1 -0
  75. package/dist/server.js +25 -0
  76. package/dist/server.js.map +1 -0
  77. package/dist/service-account.d.ts +23 -0
  78. package/dist/service-account.d.ts.map +1 -0
  79. package/dist/service-account.js +69 -0
  80. package/dist/service-account.js.map +1 -0
  81. package/dist/types.d.ts +346 -0
  82. package/dist/types.d.ts.map +1 -0
  83. package/dist/types.js +3 -0
  84. package/dist/types.js.map +1 -0
  85. package/package.json +38 -0
  86. package/src/client.ts +48 -0
  87. package/src/errors.ts +16 -0
  88. package/src/http.ts +75 -0
  89. package/src/index.ts +76 -0
  90. package/src/react-exports.ts +4 -0
  91. package/src/react.ts +38 -0
  92. package/src/resources/domains.ts +26 -0
  93. package/src/resources/history.ts +22 -0
  94. package/src/resources/managed-numbers.ts +47 -0
  95. package/src/resources/messages.ts +10 -0
  96. package/src/resources/plans.ts +18 -0
  97. package/src/resources/smtp.ts +22 -0
  98. package/src/resources/statistics.ts +15 -0
  99. package/src/resources/templates.ts +44 -0
  100. package/src/resources/webhooks.ts +37 -0
  101. package/src/resources/whatsapp-numbers.ts +80 -0
  102. package/src/resources/whatsapp-templates.ts +31 -0
  103. package/src/server-exports.ts +8 -0
  104. package/src/server.ts +42 -0
  105. package/src/service-account.ts +97 -0
  106. package/src/types.ts +418 -0
  107. package/tsconfig.json +20 -0
package/src/types.ts ADDED
@@ -0,0 +1,418 @@
1
+ // ─── Enums ────────────────────────────────────────────────────────────────────
2
+
3
+ export type MessageType = "email" | "sms" | "whatsapp";
4
+
5
+ export type MessageStatus =
6
+ | "queued"
7
+ | "sent"
8
+ | "delivered"
9
+ | "failed"
10
+ | "bounced"
11
+ | "opened"
12
+ | "clicked";
13
+
14
+ export type DomainType = "sending" | "tracking";
15
+
16
+ export type DomainStatus = "pending" | "verified" | "failed";
17
+
18
+ export type PlanTier = "free" | "starter" | "pro" | "enterprise";
19
+
20
+ export type WhatsappTemplateCategory = "MARKETING" | "UTILITY" | "AUTHENTICATION";
21
+
22
+ export type WhatsappTemplateStatus =
23
+ | "APPROVED"
24
+ | "PENDING"
25
+ | "REJECTED"
26
+ | "DISABLED"
27
+ | "PAUSED";
28
+
29
+ export type WebhookEvent =
30
+ | "message_sent"
31
+ | "message_delivered"
32
+ | "message_failed"
33
+ | "message_bounced"
34
+ | "message_opened"
35
+ | "message_clicked";
36
+
37
+ export type WabaStatus = "active" | "token_expired" | "disconnected";
38
+
39
+ export type WhatsappNumberStatus =
40
+ | "pending_verification"
41
+ | "active"
42
+ | "inactive"
43
+ | "failed";
44
+
45
+ export type ManagedNumberStatus =
46
+ | "provisioning"
47
+ | "active"
48
+ | "waiting_whatsapp_verification"
49
+ | "whatsapp_active"
50
+ | "suspended"
51
+ | "canceled"
52
+ | "failed";
53
+
54
+ // ─── Core models ──────────────────────────────────────────────────────────────
55
+
56
+ export interface MessageTemplate {
57
+ id: string;
58
+ orgId: string;
59
+ name: string;
60
+ type: MessageType;
61
+ subject: string | null;
62
+ body: string;
63
+ variables: string[];
64
+ description: string | null;
65
+ isActive: boolean;
66
+ draftBody: string | null;
67
+ draftSubject: string | null;
68
+ draftName: string | null;
69
+ draftBlocks: unknown[] | null;
70
+ draftUpdatedAt: string | null;
71
+ metaTemplateId: string | null;
72
+ metaStatus: string | null;
73
+ metaWabaId: string | null;
74
+ createdAt: string;
75
+ updatedAt: string;
76
+ }
77
+
78
+ export interface WhatsappTemplate {
79
+ id: string;
80
+ name: string;
81
+ templateName: string;
82
+ category: WhatsappTemplateCategory;
83
+ language: string;
84
+ header: string | null;
85
+ footer: string | null;
86
+ body: string;
87
+ variables: string[];
88
+ isActive: boolean;
89
+ metaTemplateId: string | null;
90
+ metaStatus: string | null;
91
+ metaWabaId: string | null;
92
+ createdAt: string;
93
+ updatedAt: string;
94
+ }
95
+
96
+ export interface MessageLog {
97
+ id: string;
98
+ type: MessageType;
99
+ status: MessageStatus;
100
+ from: string | null;
101
+ to: string;
102
+ subject: string | null;
103
+ templateId: string | null;
104
+ provider: string | null;
105
+ externalId: string | null;
106
+ error: string | null;
107
+ sentAt: string | null;
108
+ deliveredAt: string | null;
109
+ openedAt: string | null;
110
+ clickedAt: string | null;
111
+ createdAt: string;
112
+ }
113
+
114
+ export interface MessageLogDetail extends MessageLog {
115
+ body: string;
116
+ variables: Array<{ name: string; value: string }> | null;
117
+ template: MessageTemplate | null;
118
+ }
119
+
120
+ export interface OrgDomain {
121
+ id: string;
122
+ domain: string;
123
+ type: DomainType;
124
+ status: DomainStatus;
125
+ dkimSelector: string | null;
126
+ dkimPublicKey: string | null;
127
+ spfRecord: string | null;
128
+ trackingCname: string | null;
129
+ verifiedAt: string | null;
130
+ createdAt: string;
131
+ }
132
+
133
+ export interface DnsRecord {
134
+ type: "TXT" | "CNAME";
135
+ name: string;
136
+ value: string | null | undefined;
137
+ }
138
+
139
+ export interface OrgWebhook {
140
+ id: string;
141
+ url: string;
142
+ events: WebhookEvent[];
143
+ isActive: boolean;
144
+ createdAt: string;
145
+ updatedAt: string;
146
+ }
147
+
148
+ export interface OrgWebhookWithSecret extends OrgWebhook {
149
+ secret: string;
150
+ }
151
+
152
+ export interface WebhookDelivery {
153
+ id: string;
154
+ webhookId: string;
155
+ event: string;
156
+ statusCode: number | null;
157
+ response: string | null;
158
+ success: boolean;
159
+ createdAt: string;
160
+ }
161
+
162
+ export interface SmtpConfig {
163
+ id: string;
164
+ host: string;
165
+ port: number;
166
+ secure: boolean;
167
+ user: string;
168
+ createdAt: string;
169
+ updatedAt: string;
170
+ }
171
+
172
+ export interface OrgPlan {
173
+ tier: PlanTier;
174
+ monthlyEmails: number;
175
+ monthlySms: number;
176
+ monthlyWhatsapp: number;
177
+ }
178
+
179
+ export interface OrgUsage {
180
+ email: number;
181
+ sms: number;
182
+ whatsapp: number;
183
+ period: string;
184
+ }
185
+
186
+ export interface OrgWaba {
187
+ id: string;
188
+ orgId: string;
189
+ wabaId: string;
190
+ tokenExpiresAt: string | null;
191
+ businessName: string | null;
192
+ status: WabaStatus;
193
+ connectedAt: string;
194
+ updatedAt: string;
195
+ }
196
+
197
+ export interface WhatsappNumberProfile {
198
+ about: string | null;
199
+ description: string | null;
200
+ email: string | null;
201
+ websites: string[];
202
+ vertical: string | null;
203
+ profilePictureUrl: string | null;
204
+ }
205
+
206
+ export interface WhatsappNumber {
207
+ id: string;
208
+ orgId: string;
209
+ orgWabaId: string;
210
+ displayName: string;
211
+ phoneNumber: string;
212
+ phoneNumberId: string;
213
+ mode: string;
214
+ status: WhatsappNumberStatus;
215
+ qualityRating: string | null;
216
+ nameStatus: string | null;
217
+ profile: WhatsappNumberProfile;
218
+ createdAt: string;
219
+ updatedAt: string;
220
+ }
221
+
222
+ export interface ManagedNumber {
223
+ id: string;
224
+ orgId: string;
225
+ phoneNumber: string;
226
+ areaCode: string;
227
+ status: ManagedNumberStatus;
228
+ salvyId: string | null;
229
+ metaPhoneNumberId: string | null;
230
+ createdAt: string;
231
+ updatedAt: string;
232
+ }
233
+
234
+ export interface AreaCode {
235
+ areaCode: string;
236
+ state: string;
237
+ available: boolean;
238
+ }
239
+
240
+ // ─── Request types ────────────────────────────────────────────────────────────
241
+
242
+ export interface SendMessageInput {
243
+ type: MessageType;
244
+ to: string;
245
+ from?: string;
246
+ title?: string;
247
+ preview?: string;
248
+ template?: string;
249
+ subject?: string;
250
+ body?: string;
251
+ variables?: Array<{ name: string; value: string }>;
252
+ }
253
+
254
+ export interface CreateTemplateInput {
255
+ name: string;
256
+ type: MessageType;
257
+ subject?: string;
258
+ body: string;
259
+ description?: string;
260
+ isActive?: boolean;
261
+ }
262
+
263
+ export interface UpdateTemplateInput extends Partial<CreateTemplateInput> {}
264
+
265
+ export interface SaveDraftInput {
266
+ draftBody: string;
267
+ draftSubject?: string;
268
+ draftName?: string;
269
+ draftBlocks?: unknown[];
270
+ }
271
+
272
+ export interface CreateWhatsappTemplateInput {
273
+ name: string;
274
+ templateName: string;
275
+ category: WhatsappTemplateCategory;
276
+ language: string;
277
+ body: string;
278
+ header?: string;
279
+ footer?: string;
280
+ description?: string;
281
+ }
282
+
283
+ export interface UpdateWhatsappTemplateInput
284
+ extends Partial<CreateWhatsappTemplateInput> {}
285
+
286
+ export interface CreateDomainInput {
287
+ domain: string;
288
+ type: DomainType;
289
+ }
290
+
291
+ export interface CreateWebhookInput {
292
+ url: string;
293
+ events: WebhookEvent[];
294
+ isActive?: boolean;
295
+ }
296
+
297
+ export interface UpdateWebhookInput extends Partial<CreateWebhookInput> {}
298
+
299
+ export interface UpsertSmtpConfigInput {
300
+ host: string;
301
+ port: number;
302
+ secure?: boolean;
303
+ user: string;
304
+ password: string;
305
+ }
306
+
307
+ export interface UpdatePlanInput {
308
+ tier?: PlanTier;
309
+ monthlyEmails?: number;
310
+ monthlySms?: number;
311
+ monthlyWhatsapp?: number;
312
+ }
313
+
314
+ export interface ListHistoryParams {
315
+ type?: MessageType;
316
+ status?: MessageStatus;
317
+ from?: string;
318
+ to?: string;
319
+ page?: number;
320
+ limit?: number;
321
+ }
322
+
323
+ export interface StatisticsParams {
324
+ from?: string;
325
+ to?: string;
326
+ groupBy?: "day" | "month";
327
+ }
328
+
329
+ export interface ConnectWabaInput {
330
+ code: string;
331
+ }
332
+
333
+ export interface ConnectWhatsappNumberInput {
334
+ phoneNumberId: string;
335
+ wabaId: string;
336
+ }
337
+
338
+ export interface RegisterWhatsappNumberInput {
339
+ displayName: string;
340
+ phoneNumber: string;
341
+ method?: "SMS" | "VOICE";
342
+ wabaId?: string;
343
+ }
344
+
345
+ export interface UpdateWhatsappProfileInput {
346
+ about?: string;
347
+ description?: string;
348
+ email?: string;
349
+ websites?: string[];
350
+ vertical?: string;
351
+ }
352
+
353
+ export interface ProvisionManagedNumberInput {
354
+ areaCode: string;
355
+ }
356
+
357
+ // ─── Response types ───────────────────────────────────────────────────────────
358
+
359
+ export interface SendMessageResult {
360
+ id: string;
361
+ status: MessageStatus;
362
+ }
363
+
364
+ export interface PaginatedResult<T> {
365
+ data: T[];
366
+ pagination: {
367
+ total: number;
368
+ page: number;
369
+ limit: number;
370
+ pages: number;
371
+ };
372
+ }
373
+
374
+ export interface StatisticsResult {
375
+ totals: Record<
376
+ string,
377
+ { sent: number; delivered: number; failed: number; opened: number; clicked: number }
378
+ >;
379
+ currentPeriod: {
380
+ period: string;
381
+ usage: { email: number; sms: number; whatsapp: number };
382
+ limits: { email: number; sms: number; whatsapp: number };
383
+ };
384
+ }
385
+
386
+ export interface PlansResult {
387
+ plan: OrgPlan;
388
+ usage: OrgUsage;
389
+ }
390
+
391
+ export interface AvailablePlan extends OrgPlan {
392
+ tier: PlanTier;
393
+ }
394
+
395
+ export interface CreateDomainResult {
396
+ id: string;
397
+ domain: string;
398
+ type: DomainType;
399
+ status: DomainStatus;
400
+ dnsRecords: DnsRecord[];
401
+ }
402
+
403
+ export interface SyncWhatsappTemplatesResult {
404
+ created: number;
405
+ skipped: number;
406
+ }
407
+
408
+ export interface RotateSecretResult {
409
+ secret: string;
410
+ }
411
+
412
+ export interface WabaHealthResult {
413
+ health: unknown;
414
+ }
415
+
416
+ export interface PhoneNumberStatusResult {
417
+ status: unknown;
418
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2020", "DOM"],
7
+ "types": ["node"],
8
+ "outDir": "./dist",
9
+ "rootDir": "./src",
10
+ "declaration": true,
11
+ "declarationMap": true,
12
+ "sourceMap": true,
13
+ "strict": true,
14
+ "skipLibCheck": true,
15
+ "esModuleInterop": true,
16
+ "jsx": "react-jsx"
17
+ },
18
+ "include": ["src"],
19
+ "exclude": ["node_modules", "dist"]
20
+ }