-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegrations.ts
More file actions
17 lines (15 loc) · 1.4 KB
/
Copy pathintegrations.ts
File metadata and controls
17 lines (15 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/** Provider-neutral contracts. Implement only the adapters your brand uses. */
export type AddressInput = { recipientFullName: string; line1: string; line2?: string; city: string; region: string; postal: string; country: string };
export type ValidatedAddress = AddressInput & { valid: boolean; normalized: boolean; warnings: string[] };
export type ShipmentInput = { reference: string; address: ValidatedAddress; lines: { sku: string; quantity: number }[] };
export type ShipmentResult = { carrier: string; trackingNumber: string; labelUrl?: string };
export interface AddressValidator { validate(address: AddressInput): Promise<ValidatedAddress>; }
export interface FulfillmentProvider { createShipment(shipment: ShipmentInput): Promise<ShipmentResult>; getTracking(trackingNumber: string): Promise<{ state: string; detail?: string; occurredAt: string }>; }
export interface MessageProvider { send(input: { channel: "sms" | "whatsapp" | "email"; to: string; body: string }): Promise<{ messageId: string }>; }
export interface UploadProvider { createUpload(input: { filename: string; contentType: string; bytes: number }): Promise<{ uploadUrl: string; publicUrl: string }>; }
export const adapterGuide = {
address: ["Google Address Validation", "Smarty"],
fulfillment: ["EasyPost", "Shippo", "CSV export"],
messaging: ["Twilio", "Resend", "Postmark"],
uploads: ["Cloudflare R2", "S3", "Supabase Storage"],
} as const;