@verixo/sdk 0.1.1 → 0.2.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.
- package/dist/index.cjs +118 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -1
- package/dist/index.d.ts +164 -1
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -116,6 +116,120 @@ var Analytics = class {
|
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
+
// src/resources/call_plans.ts
|
|
120
|
+
var CallPlans = class {
|
|
121
|
+
constructor(http) {
|
|
122
|
+
this.http = http;
|
|
123
|
+
}
|
|
124
|
+
http;
|
|
125
|
+
// ─── Call Plans ─────────────────────────────────────────────────────────────
|
|
126
|
+
/**
|
|
127
|
+
* List all available call plan tiers with pricing.
|
|
128
|
+
* No authentication required — safe to call before purchase.
|
|
129
|
+
*
|
|
130
|
+
* Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute
|
|
131
|
+
* bucket rather than silently throttling. See `highCostMinutes` on each plan.
|
|
132
|
+
*/
|
|
133
|
+
list() {
|
|
134
|
+
return this.http.get("/api/v1/call-plans");
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Subscribe to a call plan. Debits your wallet.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })
|
|
141
|
+
*/
|
|
142
|
+
subscribe(params) {
|
|
143
|
+
return this.http.post("/api/v1/call-plans/subscribe", {
|
|
144
|
+
tier: params.tier,
|
|
145
|
+
paymentProvider: params.paymentProvider ?? "STRIPE",
|
|
146
|
+
paymentReference: params.paymentReference ?? ""
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** Get the authenticated user's active call plan subscription, or null if none. */
|
|
150
|
+
async current() {
|
|
151
|
+
try {
|
|
152
|
+
return await this.http.get("/api/v1/call-plans/my");
|
|
153
|
+
} catch (err) {
|
|
154
|
+
if (err?.status === 204 || err?.status === 404) return null;
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** List all call plan subscription history for the authenticated user. */
|
|
159
|
+
history() {
|
|
160
|
+
return this.http.get("/api/v1/call-plans/history");
|
|
161
|
+
}
|
|
162
|
+
/** Cancel the active call plan subscription immediately. */
|
|
163
|
+
cancel() {
|
|
164
|
+
return this.http.request("/api/v1/call-plans/my", { method: "DELETE" });
|
|
165
|
+
}
|
|
166
|
+
// ─── Special / Bundle Packages ───────────────────────────────────────────────
|
|
167
|
+
/**
|
|
168
|
+
* List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).
|
|
169
|
+
* No authentication required.
|
|
170
|
+
*/
|
|
171
|
+
listBundles() {
|
|
172
|
+
return this.http.get("/api/v1/special-packages");
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Purchase a bundle package. Each bundle fans out async provisioning events
|
|
176
|
+
* (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.
|
|
177
|
+
* Poll `myBundles()` to track provisioning completion.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })
|
|
181
|
+
* console.log(order.status) // "PROCESSING"
|
|
182
|
+
*/
|
|
183
|
+
purchaseBundle(params) {
|
|
184
|
+
return this.http.post("/api/v1/special-packages/purchase", {
|
|
185
|
+
packageType: params.packageType,
|
|
186
|
+
paymentProvider: params.paymentProvider ?? "STRIPE",
|
|
187
|
+
paymentReference: params.paymentReference ?? ""
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** List all bundle purchases for the authenticated user. */
|
|
191
|
+
myBundles() {
|
|
192
|
+
return this.http.get("/api/v1/special-packages/my");
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// src/resources/esim.ts
|
|
197
|
+
var ESim = class {
|
|
198
|
+
constructor(http) {
|
|
199
|
+
this.http = http;
|
|
200
|
+
}
|
|
201
|
+
http;
|
|
202
|
+
/**
|
|
203
|
+
* List available eSIM packages for a country via Airalo.
|
|
204
|
+
* No authentication required.
|
|
205
|
+
*/
|
|
206
|
+
listPackages(countryCode, days = 30) {
|
|
207
|
+
return this.http.get(
|
|
208
|
+
`/api/v1/esim/packages?countryCode=${encodeURIComponent(countryCode)}&days=${days}`
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Purchase an eSIM. The gateway debits your wallet and returns
|
|
213
|
+
* activation info including the QR code URL and LPA activation code
|
|
214
|
+
* suitable for qr_flutter / Apple's one-tap install URL.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })
|
|
218
|
+
* console.log(profile.activationCode) // "LPA:1$smdp$matching_id"
|
|
219
|
+
*/
|
|
220
|
+
purchase(params) {
|
|
221
|
+
return this.http.post("/api/v1/esim/purchase", params);
|
|
222
|
+
}
|
|
223
|
+
/** List all eSIM profiles provisioned for the authenticated user. */
|
|
224
|
+
list() {
|
|
225
|
+
return this.http.get("/api/v1/esim/my");
|
|
226
|
+
}
|
|
227
|
+
/** Check current data balance for a provisioned eSIM by its ICCID. */
|
|
228
|
+
usage(iccid) {
|
|
229
|
+
return this.http.get(`/api/v1/esim/${encodeURIComponent(iccid)}/usage`);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
119
233
|
// src/resources/numbers.ts
|
|
120
234
|
var Numbers = class {
|
|
121
235
|
constructor(http) {
|
|
@@ -199,12 +313,16 @@ var Verixo = class {
|
|
|
199
313
|
numbers;
|
|
200
314
|
sessions;
|
|
201
315
|
analytics;
|
|
316
|
+
esim;
|
|
317
|
+
callPlans;
|
|
202
318
|
http;
|
|
203
319
|
constructor(apiKey, options = {}) {
|
|
204
320
|
this.http = new HttpClient(apiKey, options);
|
|
205
321
|
this.numbers = new Numbers(this.http);
|
|
206
322
|
this.sessions = new Sessions(this.http);
|
|
207
323
|
this.analytics = new Analytics(this.http);
|
|
324
|
+
this.esim = new ESim(this.http);
|
|
325
|
+
this.callPlans = new CallPlans(this.http);
|
|
208
326
|
}
|
|
209
327
|
/**
|
|
210
328
|
* Get pushed the OTP for a session in real time, instead of polling
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/client.ts","../src/resources/analytics.ts","../src/resources/numbers.ts","../src/resources/sessions.ts","../src/subscribe.ts"],"sourcesContent":["import { HttpClient } from \"./client.js\";\nimport { Analytics } from \"./resources/analytics.js\";\nimport { Numbers } from \"./resources/numbers.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { subscribe } from \"./subscribe.js\";\nimport type { OtpPush, VerixoOptions } from \"./types.js\";\n\nexport { VerixoError } from \"./errors.js\";\nexport type {\n DeliveryRate,\n OtpPush,\n PurchaseNumberParams,\n PurchaseResult,\n SearchNumbersParams,\n SearchNumbersResult,\n SessionState,\n SessionStatus,\n VerixoOptions,\n VirtualNumber,\n} from \"./types.js\";\n\nexport default class Verixo {\n readonly numbers: Numbers;\n readonly sessions: Sessions;\n readonly analytics: Analytics;\n private readonly http: HttpClient;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n this.http = new HttpClient(apiKey, options);\n this.numbers = new Numbers(this.http);\n this.sessions = new Sessions(this.http);\n this.analytics = new Analytics(this.http);\n }\n\n /**\n * Get pushed the OTP for a session in real time, instead of polling\n * `sessions.get()`. Returns an unsubscribe function.\n *\n * @example\n * const session = await vc.numbers.purchase({ serviceSlug: 'whatsapp', countryCode: 'NG' })\n * vc.subscribe(session.sessionToken, ({ otp, latencyMs }) => {\n * console.log(`OTP: ${otp} in ${latencyMs}ms`)\n * })\n */\n subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n return subscribe(this.http, sessionToken, onOtp);\n }\n}\n","export interface VerixoErrorOptions {\n status: number;\n code?: string;\n detail?: string;\n raw?: unknown;\n}\n\n/**\n * Thrown for any non-2xx response from the Verixo API. `status` is always\n * present; `code`/`detail` are populated when the gateway returns a JSON\n * error body (most do) -- a small number of paths (e.g. an invalid API key\n * rejected before reaching a controller) return an empty body, in which case\n * only `status` and a generic `message` are available.\n */\nexport class VerixoError extends Error {\n readonly status: number;\n readonly code?: string;\n readonly detail?: string;\n readonly raw?: unknown;\n\n constructor(message: string, options: VerixoErrorOptions) {\n super(message);\n this.name = \"VerixoError\";\n this.status = options.status;\n this.code = options.code;\n this.detail = options.detail;\n this.raw = options.raw;\n }\n}\n\nconst STATUS_FALLBACKS: Record<number, string> = {\n 401: \"Missing or invalid API key.\",\n 402: \"Insufficient wallet balance.\",\n 403: \"You don't have access to this resource.\",\n 404: \"Not found.\",\n 408: \"Request timed out.\",\n 422: \"The request did not meet a required condition (e.g. minScore).\",\n 429: \"Rate limit exceeded.\",\n};\n\nexport async function errorFromResponse(res: Response): Promise<VerixoError> {\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n body = undefined;\n }\n\n const obj = (body && typeof body === \"object\" ? body : {}) as Record<string, unknown>;\n const detail = (obj.detail ?? obj.error ?? obj.message) as string | undefined;\n const code = (obj.grpcCode ?? obj.code) as string | undefined;\n const message = detail ?? STATUS_FALLBACKS[res.status] ?? `Request failed with status ${res.status}`;\n\n return new VerixoError(message, { status: res.status, code, detail, raw: body });\n}\n","import { errorFromResponse } from \"./errors.js\";\nimport type { VerixoOptions } from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.verifiedcore.com\";\n\nexport class HttpClient {\n readonly apiKey: string;\n readonly baseUrl: string;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n if (!apiKey) {\n throw new Error(\"Verixo: an API key (or JWT) is required, e.g. new Verixo('vc_test_...')\");\n }\n this.apiKey = apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n }\n\n async request<T>(path: string, init: RequestInit = {}): Promise<T> {\n // The gateway classifies the credential by sniffing the raw Authorization header for a\n // vc_test_/vc_live_ prefix -- a \"Bearer \" prefix on an API key would make it misclassify\n // the request as a (malformed) JWT and reject it, so API keys go out unprefixed.\n const isApiKey = this.apiKey.startsWith(\"vc_test_\") || this.apiKey.startsWith(\"vc_live_\");\n const authorization = isApiKey ? this.apiKey : `Bearer ${this.apiKey}`;\n\n const res = await fetch(`${this.baseUrl}${path}`, {\n ...init,\n headers: {\n Authorization: authorization,\n ...(init.body ? { \"Content-Type\": \"application/json\" } : {}),\n ...init.headers,\n },\n });\n\n if (!res.ok) {\n throw await errorFromResponse(res);\n }\n\n if (res.status === 204) return undefined as T;\n return (await res.json()) as T;\n }\n\n get<T>(path: string): Promise<T> {\n return this.request<T>(path, { method: \"GET\" });\n }\n\n post<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: \"POST\", body: body ? JSON.stringify(body) : undefined });\n }\n\n /** ws:// or wss:// origin derived from baseUrl, for the OTP push subscription. */\n get wsOrigin(): string {\n return this.baseUrl.replace(/^http/, \"ws\");\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { DeliveryRate } from \"../types.js\";\n\nexport class Analytics {\n constructor(private readonly http: HttpClient) {}\n\n /** Public delivery-rate stats by country for a service. No auth required by the API itself. */\n rates(serviceSlug = \"whatsapp\"): Promise<{ rates: DeliveryRate[]; updatedAt: string }> {\n return this.http.get(`/api/v1/analytics/rates?serviceSlug=${encodeURIComponent(serviceSlug)}`);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { PurchaseNumberParams, PurchaseResult, SearchNumbersParams, SearchNumbersResult } from \"../types.js\";\n\nexport class Numbers {\n constructor(private readonly http: HttpClient) {}\n\n /** Browse available numbers ranked by Health Score (TM). No purchase is made. */\n search(params: SearchNumbersParams): Promise<SearchNumbersResult> {\n const q = new URLSearchParams({ serviceSlug: params.serviceSlug });\n if (params.countryCode) q.set(\"countryCode\", params.countryCode);\n if (params.minScore != null) q.set(\"minScore\", String(params.minScore));\n if (params.limit != null) q.set(\"limit\", String(params.limit));\n return this.http.get<SearchNumbersResult>(`/api/v1/numbers/search?${q}`);\n }\n\n /**\n * Buy a number for a service + country. The server picks the best available\n * candidate by Health Score automatically -- there's no numberId parameter,\n * since by the time you'd pass one back the number may already be gone.\n */\n purchase(params: PurchaseNumberParams): Promise<PurchaseResult> {\n return this.http.post<PurchaseResult>(\"/api/v1/numbers/purchase\", params);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { SessionStatus } from \"../types.js\";\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Poll a session's current delivery status. */\n get(sessionToken: string): Promise<SessionStatus> {\n return this.http.get<SessionStatus>(`/api/v1/numbers/session/${encodeURIComponent(sessionToken)}`);\n }\n\n /**\n * Poll until the session reaches a terminal state (DELIVERED, REFUNDED, EXPIRED, FAILED)\n * or the timeout elapses. Prefer `vc.subscribe()` for real-time push -- this is a fallback\n * for environments where a persistent WebSocket isn't practical (e.g. serverless functions).\n */\n async waitForOtp(sessionToken: string, timeoutMs = 90_000, intervalMs = 2_000): Promise<SessionStatus> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n const session = await this.get(sessionToken);\n if (session.status !== \"PENDING\") return session;\n if (Date.now() >= deadline) return session;\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n","import { Client } from \"@stomp/stompjs\";\nimport type { HttpClient } from \"./client.js\";\nimport type { OtpPush } from \"./types.js\";\n\n/**\n * Subscribes to real-time OTP push for a session over the gateway's WebSocket\n * proxy (wss://.../ws -> delivery-service's STOMP broker, topic\n * /topic/otp/{sessionToken}). Requires a global WebSocket implementation --\n * present natively in browsers and Node 22+; on older Node, pass a `ws`\n * instance via globalThis.WebSocket before calling subscribe().\n *\n * Returns an unsubscribe function. The callback fires at most once per\n * session (a session only ever delivers one OTP).\n */\nexport function subscribe(http: HttpClient, sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n if (typeof WebSocket === \"undefined\") {\n throw new Error(\n \"Verixo.subscribe() requires a global WebSocket implementation. \" +\n \"This is built into browsers and Node 22+; on older Node, polyfill \" +\n \"globalThis.WebSocket (e.g. with the 'ws' package) before calling subscribe().\"\n );\n }\n\n const subscribedAt = Date.now();\n const client = new Client({\n brokerURL: `${http.wsOrigin}/ws`,\n reconnectDelay: 5_000,\n onConnect: () => {\n client.subscribe(`/topic/otp/${sessionToken}`, (message) => {\n try {\n const payload = JSON.parse(message.body) as Omit<OtpPush, \"latencyMs\">;\n onOtp({ ...payload, latencyMs: Date.now() - subscribedAt });\n } catch {\n // Ignore malformed frames rather than crashing the caller's process.\n }\n });\n },\n });\n\n client.activate();\n return () => {\n void client.deactivate();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,SAA6B;AACxD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS,QAAQ;AACtB,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,MAAM,QAAQ;AAAA,EACrB;AACF;AAEA,IAAM,mBAA2C;AAAA,EAC/C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEA,eAAsB,kBAAkB,KAAqC;AAC3E,MAAI;AACJ,MAAI;AACF,WAAO,MAAM,IAAI,KAAK;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,QAAM,MAAO,QAAQ,OAAO,SAAS,WAAW,OAAO,CAAC;AACxD,QAAM,SAAU,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AAA;AAAA,EAYA,UAAU,cAAsB,OAA4C;AAC1E,WAAO,UAAU,KAAK,MAAM,cAAc,KAAK;AAAA,EACjD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/client.ts","../src/resources/analytics.ts","../src/resources/call_plans.ts","../src/resources/esim.ts","../src/resources/numbers.ts","../src/resources/sessions.ts","../src/subscribe.ts"],"sourcesContent":["import { HttpClient } from \"./client.js\";\nimport { Analytics } from \"./resources/analytics.js\";\nimport { CallPlans } from \"./resources/call_plans.js\";\nimport { ESim } from \"./resources/esim.js\";\nimport { Numbers } from \"./resources/numbers.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { subscribe } from \"./subscribe.js\";\nimport type { OtpPush, VerixoOptions } from \"./types.js\";\n\nexport { VerixoError } from \"./errors.js\";\nexport type {\n CallPlan,\n CallPlanSubscription,\n DeliveryRate,\n ESimPackage,\n ESimProfile,\n ESimPurchaseParams,\n ESimUsage,\n OtpPush,\n PurchaseBundleParams,\n PurchaseNumberParams,\n PurchaseResult,\n SearchNumbersParams,\n SearchNumbersResult,\n SessionState,\n SessionStatus,\n SpecialPackage,\n SpecialPackageOrder,\n SubscribeCallPlanParams,\n VerixoOptions,\n VirtualNumber,\n} from \"./types.js\";\n\nexport default class Verixo {\n readonly numbers: Numbers;\n readonly sessions: Sessions;\n readonly analytics: Analytics;\n readonly esim: ESim;\n readonly callPlans: CallPlans;\n private readonly http: HttpClient;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n this.http = new HttpClient(apiKey, options);\n this.numbers = new Numbers(this.http);\n this.sessions = new Sessions(this.http);\n this.analytics = new Analytics(this.http);\n this.esim = new ESim(this.http);\n this.callPlans = new CallPlans(this.http);\n }\n\n /**\n * Get pushed the OTP for a session in real time, instead of polling\n * `sessions.get()`. Returns an unsubscribe function.\n *\n * @example\n * const session = await vc.numbers.purchase({ serviceSlug: 'whatsapp', countryCode: 'NG' })\n * vc.subscribe(session.sessionToken, ({ otp, latencyMs }) => {\n * console.log(`OTP: ${otp} in ${latencyMs}ms`)\n * })\n */\n subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n return subscribe(this.http, sessionToken, onOtp);\n }\n}\n","export interface VerixoErrorOptions {\n status: number;\n code?: string;\n detail?: string;\n raw?: unknown;\n}\n\n/**\n * Thrown for any non-2xx response from the Verixo API. `status` is always\n * present; `code`/`detail` are populated when the gateway returns a JSON\n * error body (most do) -- a small number of paths (e.g. an invalid API key\n * rejected before reaching a controller) return an empty body, in which case\n * only `status` and a generic `message` are available.\n */\nexport class VerixoError extends Error {\n readonly status: number;\n readonly code?: string;\n readonly detail?: string;\n readonly raw?: unknown;\n\n constructor(message: string, options: VerixoErrorOptions) {\n super(message);\n this.name = \"VerixoError\";\n this.status = options.status;\n this.code = options.code;\n this.detail = options.detail;\n this.raw = options.raw;\n }\n}\n\nconst STATUS_FALLBACKS: Record<number, string> = {\n 401: \"Missing or invalid API key.\",\n 402: \"Insufficient wallet balance.\",\n 403: \"You don't have access to this resource.\",\n 404: \"Not found.\",\n 408: \"Request timed out.\",\n 422: \"The request did not meet a required condition (e.g. minScore).\",\n 429: \"Rate limit exceeded.\",\n};\n\nexport async function errorFromResponse(res: Response): Promise<VerixoError> {\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n body = undefined;\n }\n\n const obj = (body && typeof body === \"object\" ? body : {}) as Record<string, unknown>;\n const detail = (obj.detail ?? obj.error ?? obj.message) as string | undefined;\n const code = (obj.grpcCode ?? obj.code) as string | undefined;\n const message = detail ?? STATUS_FALLBACKS[res.status] ?? `Request failed with status ${res.status}`;\n\n return new VerixoError(message, { status: res.status, code, detail, raw: body });\n}\n","import { errorFromResponse } from \"./errors.js\";\nimport type { VerixoOptions } from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.verifiedcore.com\";\n\nexport class HttpClient {\n readonly apiKey: string;\n readonly baseUrl: string;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n if (!apiKey) {\n throw new Error(\"Verixo: an API key (or JWT) is required, e.g. new Verixo('vc_test_...')\");\n }\n this.apiKey = apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n }\n\n async request<T>(path: string, init: RequestInit = {}): Promise<T> {\n // The gateway classifies the credential by sniffing the raw Authorization header for a\n // vc_test_/vc_live_ prefix -- a \"Bearer \" prefix on an API key would make it misclassify\n // the request as a (malformed) JWT and reject it, so API keys go out unprefixed.\n const isApiKey = this.apiKey.startsWith(\"vc_test_\") || this.apiKey.startsWith(\"vc_live_\");\n const authorization = isApiKey ? this.apiKey : `Bearer ${this.apiKey}`;\n\n const res = await fetch(`${this.baseUrl}${path}`, {\n ...init,\n headers: {\n Authorization: authorization,\n ...(init.body ? { \"Content-Type\": \"application/json\" } : {}),\n ...init.headers,\n },\n });\n\n if (!res.ok) {\n throw await errorFromResponse(res);\n }\n\n if (res.status === 204) return undefined as T;\n return (await res.json()) as T;\n }\n\n get<T>(path: string): Promise<T> {\n return this.request<T>(path, { method: \"GET\" });\n }\n\n post<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: \"POST\", body: body ? JSON.stringify(body) : undefined });\n }\n\n /** ws:// or wss:// origin derived from baseUrl, for the OTP push subscription. */\n get wsOrigin(): string {\n return this.baseUrl.replace(/^http/, \"ws\");\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { DeliveryRate } from \"../types.js\";\n\nexport class Analytics {\n constructor(private readonly http: HttpClient) {}\n\n /** Public delivery-rate stats by country for a service. No auth required by the API itself. */\n rates(serviceSlug = \"whatsapp\"): Promise<{ rates: DeliveryRate[]; updatedAt: string }> {\n return this.http.get(`/api/v1/analytics/rates?serviceSlug=${encodeURIComponent(serviceSlug)}`);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type {\n CallPlan,\n CallPlanSubscription,\n PurchaseBundleParams,\n SpecialPackage,\n SpecialPackageOrder,\n SubscribeCallPlanParams,\n} from \"../types.js\";\n\nexport class CallPlans {\n constructor(private readonly http: HttpClient) {}\n\n // ─── Call Plans ─────────────────────────────────────────────────────────────\n\n /**\n * List all available call plan tiers with pricing.\n * No authentication required — safe to call before purchase.\n *\n * Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute\n * bucket rather than silently throttling. See `highCostMinutes` on each plan.\n */\n list(): Promise<CallPlan[]> {\n return this.http.get<CallPlan[]>(\"/api/v1/call-plans\");\n }\n\n /**\n * Subscribe to a call plan. Debits your wallet.\n *\n * @example\n * await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })\n */\n subscribe(params: SubscribeCallPlanParams): Promise<CallPlanSubscription> {\n return this.http.post<CallPlanSubscription>(\"/api/v1/call-plans/subscribe\", {\n tier: params.tier,\n paymentProvider: params.paymentProvider ?? \"STRIPE\",\n paymentReference: params.paymentReference ?? \"\",\n });\n }\n\n /** Get the authenticated user's active call plan subscription, or null if none. */\n async current(): Promise<CallPlanSubscription | null> {\n try {\n return await this.http.get<CallPlanSubscription>(\"/api/v1/call-plans/my\");\n } catch (err: any) {\n if (err?.status === 204 || err?.status === 404) return null;\n throw err;\n }\n }\n\n /** List all call plan subscription history for the authenticated user. */\n history(): Promise<CallPlanSubscription[]> {\n return this.http.get<CallPlanSubscription[]>(\"/api/v1/call-plans/history\");\n }\n\n /** Cancel the active call plan subscription immediately. */\n cancel(): Promise<void> {\n return this.http.request<void>(\"/api/v1/call-plans/my\", { method: \"DELETE\" });\n }\n\n // ─── Special / Bundle Packages ───────────────────────────────────────────────\n\n /**\n * List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).\n * No authentication required.\n */\n listBundles(): Promise<SpecialPackage[]> {\n return this.http.get<SpecialPackage[]>(\"/api/v1/special-packages\");\n }\n\n /**\n * Purchase a bundle package. Each bundle fans out async provisioning events\n * (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.\n * Poll `myBundles()` to track provisioning completion.\n *\n * @example\n * const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })\n * console.log(order.status) // \"PROCESSING\"\n */\n purchaseBundle(params: PurchaseBundleParams): Promise<SpecialPackageOrder> {\n return this.http.post<SpecialPackageOrder>(\"/api/v1/special-packages/purchase\", {\n packageType: params.packageType,\n paymentProvider: params.paymentProvider ?? \"STRIPE\",\n paymentReference: params.paymentReference ?? \"\",\n });\n }\n\n /** List all bundle purchases for the authenticated user. */\n myBundles(): Promise<SpecialPackageOrder[]> {\n return this.http.get<SpecialPackageOrder[]>(\"/api/v1/special-packages/my\");\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { ESimPackage, ESimProfile, ESimPurchaseParams, ESimUsage } from \"../types.js\";\n\nexport class ESim {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * List available eSIM packages for a country via Airalo.\n * No authentication required.\n */\n listPackages(countryCode: string, days = 30): Promise<ESimPackage[]> {\n return this.http.get<ESimPackage[]>(\n `/api/v1/esim/packages?countryCode=${encodeURIComponent(countryCode)}&days=${days}`,\n );\n }\n\n /**\n * Purchase an eSIM. The gateway debits your wallet and returns\n * activation info including the QR code URL and LPA activation code\n * suitable for qr_flutter / Apple's one-tap install URL.\n *\n * @example\n * const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })\n * console.log(profile.activationCode) // \"LPA:1$smdp$matching_id\"\n */\n purchase(params: ESimPurchaseParams): Promise<ESimProfile> {\n return this.http.post<ESimProfile>(\"/api/v1/esim/purchase\", params);\n }\n\n /** List all eSIM profiles provisioned for the authenticated user. */\n list(): Promise<ESimProfile[]> {\n return this.http.get<ESimProfile[]>(\"/api/v1/esim/my\");\n }\n\n /** Check current data balance for a provisioned eSIM by its ICCID. */\n usage(iccid: string): Promise<ESimUsage> {\n return this.http.get<ESimUsage>(`/api/v1/esim/${encodeURIComponent(iccid)}/usage`);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { PurchaseNumberParams, PurchaseResult, SearchNumbersParams, SearchNumbersResult } from \"../types.js\";\n\nexport class Numbers {\n constructor(private readonly http: HttpClient) {}\n\n /** Browse available numbers ranked by Health Score (TM). No purchase is made. */\n search(params: SearchNumbersParams): Promise<SearchNumbersResult> {\n const q = new URLSearchParams({ serviceSlug: params.serviceSlug });\n if (params.countryCode) q.set(\"countryCode\", params.countryCode);\n if (params.minScore != null) q.set(\"minScore\", String(params.minScore));\n if (params.limit != null) q.set(\"limit\", String(params.limit));\n return this.http.get<SearchNumbersResult>(`/api/v1/numbers/search?${q}`);\n }\n\n /**\n * Buy a number for a service + country. The server picks the best available\n * candidate by Health Score automatically -- there's no numberId parameter,\n * since by the time you'd pass one back the number may already be gone.\n */\n purchase(params: PurchaseNumberParams): Promise<PurchaseResult> {\n return this.http.post<PurchaseResult>(\"/api/v1/numbers/purchase\", params);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { SessionStatus } from \"../types.js\";\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Poll a session's current delivery status. */\n get(sessionToken: string): Promise<SessionStatus> {\n return this.http.get<SessionStatus>(`/api/v1/numbers/session/${encodeURIComponent(sessionToken)}`);\n }\n\n /**\n * Poll until the session reaches a terminal state (DELIVERED, REFUNDED, EXPIRED, FAILED)\n * or the timeout elapses. Prefer `vc.subscribe()` for real-time push -- this is a fallback\n * for environments where a persistent WebSocket isn't practical (e.g. serverless functions).\n */\n async waitForOtp(sessionToken: string, timeoutMs = 90_000, intervalMs = 2_000): Promise<SessionStatus> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n const session = await this.get(sessionToken);\n if (session.status !== \"PENDING\") return session;\n if (Date.now() >= deadline) return session;\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n","import { Client } from \"@stomp/stompjs\";\nimport type { HttpClient } from \"./client.js\";\nimport type { OtpPush } from \"./types.js\";\n\n/**\n * Subscribes to real-time OTP push for a session over the gateway's WebSocket\n * proxy (wss://.../ws -> delivery-service's STOMP broker, topic\n * /topic/otp/{sessionToken}). Requires a global WebSocket implementation --\n * present natively in browsers and Node 22+; on older Node, pass a `ws`\n * instance via globalThis.WebSocket before calling subscribe().\n *\n * Returns an unsubscribe function. The callback fires at most once per\n * session (a session only ever delivers one OTP).\n */\nexport function subscribe(http: HttpClient, sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n if (typeof WebSocket === \"undefined\") {\n throw new Error(\n \"Verixo.subscribe() requires a global WebSocket implementation. \" +\n \"This is built into browsers and Node 22+; on older Node, polyfill \" +\n \"globalThis.WebSocket (e.g. with the 'ws' package) before calling subscribe().\"\n );\n }\n\n const subscribedAt = Date.now();\n const client = new Client({\n brokerURL: `${http.wsOrigin}/ws`,\n reconnectDelay: 5_000,\n onConnect: () => {\n client.subscribe(`/topic/otp/${sessionToken}`, (message) => {\n try {\n const payload = JSON.parse(message.body) as Omit<OtpPush, \"latencyMs\">;\n onOtp({ ...payload, latencyMs: Date.now() - subscribedAt });\n } catch {\n // Ignore malformed frames rather than crashing the caller's process.\n }\n });\n },\n });\n\n client.activate();\n return () => {\n void client.deactivate();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,SAA6B;AACxD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS,QAAQ;AACtB,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,MAAM,QAAQ;AAAA,EACrB;AACF;AAEA,IAAM,mBAA2C;AAAA,EAC/C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEA,eAAsB,kBAAkB,KAAqC;AAC3E,MAAI;AACJ,MAAI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AAK,QAAQ;AAAA,IAC3B,gBAAgB;AAAA,IAChB,WAAW,MAAM;AACf,aAAO,UAAU,cAAc,YAAY,IAAI,CAAC,YAAY;AAC1D,YAAI;AACF,gBAAM,UAAU,KAAK,MAAM,QAAQ,IAAI;AACvC,gBAAM,EAAE,GAAG,SAAS,WAAW,KAAK,IAAI,IAAI,aAAa,CAAC;AAAA,QAC5D,QAAQ;AAAA,QAER;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAChB,SAAO,MAAM;AACX,SAAK,OAAO,WAAW;AAAA,EACzB;AACF;;;ARVA,IAAqB,SAArB,MAA4B;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACQ;AAAA,EAEjB,YAAY,QAAgB,UAAyB,CAAC,GAAG;AACvD,SAAK,OAAO,IAAI,WAAW,QAAQ,OAAO;AAC1C,SAAK,UAAU,IAAI,QAAQ,KAAK,IAAI;AACpC,SAAK,WAAW,IAAI,SAAS,KAAK,IAAI;AACtC,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AACxC,SAAK,OAAO,IAAI,KAAK,KAAK,IAAI;AAC9B,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,UAAU,cAAsB,OAA4C;AAC1E,WAAO,UAAU,KAAK,MAAM,cAAc,KAAK;AAAA,EACjD;AACF;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -86,6 +86,100 @@ interface OtpPush {
|
|
|
86
86
|
/** Milliseconds between calling subscribe() and this push arriving -- not from the server. */
|
|
87
87
|
latencyMs: number;
|
|
88
88
|
}
|
|
89
|
+
interface ESimPackage {
|
|
90
|
+
packageId: string;
|
|
91
|
+
name: string;
|
|
92
|
+
countryCode: string;
|
|
93
|
+
dataGb: number;
|
|
94
|
+
validityDays: number;
|
|
95
|
+
priceUsd: number;
|
|
96
|
+
slug?: string;
|
|
97
|
+
}
|
|
98
|
+
interface ESimPurchaseParams {
|
|
99
|
+
packageId: string;
|
|
100
|
+
countryCode: string;
|
|
101
|
+
priceUsd: number;
|
|
102
|
+
}
|
|
103
|
+
interface ESimProfile {
|
|
104
|
+
profileId: string;
|
|
105
|
+
iccid: string;
|
|
106
|
+
activationCode: string;
|
|
107
|
+
qrCodeUrl: string;
|
|
108
|
+
directAppleInstallUrl: string;
|
|
109
|
+
smdpAddress: string;
|
|
110
|
+
matchingId: string;
|
|
111
|
+
apnType: string;
|
|
112
|
+
apnValue: string;
|
|
113
|
+
isRoaming: boolean;
|
|
114
|
+
carrierName: string;
|
|
115
|
+
dataGbIncluded: number;
|
|
116
|
+
validityDays: number;
|
|
117
|
+
countryCode: string;
|
|
118
|
+
status: string;
|
|
119
|
+
}
|
|
120
|
+
interface ESimUsage {
|
|
121
|
+
iccid: string;
|
|
122
|
+
remainingMb: number;
|
|
123
|
+
totalMb: number;
|
|
124
|
+
usedPercent: number;
|
|
125
|
+
expiresAt: string;
|
|
126
|
+
}
|
|
127
|
+
interface CallPlan {
|
|
128
|
+
id: string;
|
|
129
|
+
tier: "BASIC" | "STANDARD" | "PREMIUM";
|
|
130
|
+
name: string;
|
|
131
|
+
/** -1 = unlimited */
|
|
132
|
+
minutes: number;
|
|
133
|
+
priceUsd: number;
|
|
134
|
+
perMin: number;
|
|
135
|
+
popular: boolean;
|
|
136
|
+
highCostMinutes: number;
|
|
137
|
+
highCostCountries: string[];
|
|
138
|
+
features: string[];
|
|
139
|
+
}
|
|
140
|
+
interface CallPlanSubscription {
|
|
141
|
+
id: string;
|
|
142
|
+
userId: string;
|
|
143
|
+
tier: string;
|
|
144
|
+
status: string;
|
|
145
|
+
minutesUsed: number;
|
|
146
|
+
minutesTotal: number;
|
|
147
|
+
highCostMinutesUsed: number;
|
|
148
|
+
highCostMinutesTotal: number;
|
|
149
|
+
renewsAt: string;
|
|
150
|
+
createdAt: string;
|
|
151
|
+
}
|
|
152
|
+
interface SubscribeCallPlanParams {
|
|
153
|
+
tier: "BASIC" | "STANDARD" | "PREMIUM";
|
|
154
|
+
paymentProvider?: string;
|
|
155
|
+
paymentReference?: string;
|
|
156
|
+
}
|
|
157
|
+
interface SpecialPackage {
|
|
158
|
+
id: string;
|
|
159
|
+
type: string;
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
priceUsd: number;
|
|
163
|
+
components: string[];
|
|
164
|
+
}
|
|
165
|
+
interface SpecialPackageOrder {
|
|
166
|
+
orderId: string;
|
|
167
|
+
userId: string;
|
|
168
|
+
packageType: string;
|
|
169
|
+
status: string;
|
|
170
|
+
smsCreditsAdded: boolean;
|
|
171
|
+
callPlanProvisioned: boolean;
|
|
172
|
+
eSimProvisioned: boolean;
|
|
173
|
+
virtualNumberProvisioned: boolean;
|
|
174
|
+
apiAccessProvisioned: boolean;
|
|
175
|
+
privacyModeEnabled: boolean;
|
|
176
|
+
createdAt: string;
|
|
177
|
+
}
|
|
178
|
+
interface PurchaseBundleParams {
|
|
179
|
+
packageType: "STARTER_BUNDLE" | "BUSINESS_BUNDLE" | "DEVELOPER_BUNDLE" | "NIGERIA_SPECIAL" | "PRIVACY_BUNDLE";
|
|
180
|
+
paymentProvider?: string;
|
|
181
|
+
paymentReference?: string;
|
|
182
|
+
}
|
|
89
183
|
|
|
90
184
|
declare class HttpClient {
|
|
91
185
|
readonly apiKey: string;
|
|
@@ -108,6 +202,73 @@ declare class Analytics {
|
|
|
108
202
|
}>;
|
|
109
203
|
}
|
|
110
204
|
|
|
205
|
+
declare class CallPlans {
|
|
206
|
+
private readonly http;
|
|
207
|
+
constructor(http: HttpClient);
|
|
208
|
+
/**
|
|
209
|
+
* List all available call plan tiers with pricing.
|
|
210
|
+
* No authentication required — safe to call before purchase.
|
|
211
|
+
*
|
|
212
|
+
* Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute
|
|
213
|
+
* bucket rather than silently throttling. See `highCostMinutes` on each plan.
|
|
214
|
+
*/
|
|
215
|
+
list(): Promise<CallPlan[]>;
|
|
216
|
+
/**
|
|
217
|
+
* Subscribe to a call plan. Debits your wallet.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })
|
|
221
|
+
*/
|
|
222
|
+
subscribe(params: SubscribeCallPlanParams): Promise<CallPlanSubscription>;
|
|
223
|
+
/** Get the authenticated user's active call plan subscription, or null if none. */
|
|
224
|
+
current(): Promise<CallPlanSubscription | null>;
|
|
225
|
+
/** List all call plan subscription history for the authenticated user. */
|
|
226
|
+
history(): Promise<CallPlanSubscription[]>;
|
|
227
|
+
/** Cancel the active call plan subscription immediately. */
|
|
228
|
+
cancel(): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).
|
|
231
|
+
* No authentication required.
|
|
232
|
+
*/
|
|
233
|
+
listBundles(): Promise<SpecialPackage[]>;
|
|
234
|
+
/**
|
|
235
|
+
* Purchase a bundle package. Each bundle fans out async provisioning events
|
|
236
|
+
* (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.
|
|
237
|
+
* Poll `myBundles()` to track provisioning completion.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })
|
|
241
|
+
* console.log(order.status) // "PROCESSING"
|
|
242
|
+
*/
|
|
243
|
+
purchaseBundle(params: PurchaseBundleParams): Promise<SpecialPackageOrder>;
|
|
244
|
+
/** List all bundle purchases for the authenticated user. */
|
|
245
|
+
myBundles(): Promise<SpecialPackageOrder[]>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class ESim {
|
|
249
|
+
private readonly http;
|
|
250
|
+
constructor(http: HttpClient);
|
|
251
|
+
/**
|
|
252
|
+
* List available eSIM packages for a country via Airalo.
|
|
253
|
+
* No authentication required.
|
|
254
|
+
*/
|
|
255
|
+
listPackages(countryCode: string, days?: number): Promise<ESimPackage[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Purchase an eSIM. The gateway debits your wallet and returns
|
|
258
|
+
* activation info including the QR code URL and LPA activation code
|
|
259
|
+
* suitable for qr_flutter / Apple's one-tap install URL.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })
|
|
263
|
+
* console.log(profile.activationCode) // "LPA:1$smdp$matching_id"
|
|
264
|
+
*/
|
|
265
|
+
purchase(params: ESimPurchaseParams): Promise<ESimProfile>;
|
|
266
|
+
/** List all eSIM profiles provisioned for the authenticated user. */
|
|
267
|
+
list(): Promise<ESimProfile[]>;
|
|
268
|
+
/** Check current data balance for a provisioned eSIM by its ICCID. */
|
|
269
|
+
usage(iccid: string): Promise<ESimUsage>;
|
|
270
|
+
}
|
|
271
|
+
|
|
111
272
|
declare class Numbers {
|
|
112
273
|
private readonly http;
|
|
113
274
|
constructor(http: HttpClient);
|
|
@@ -159,6 +320,8 @@ declare class Verixo {
|
|
|
159
320
|
readonly numbers: Numbers;
|
|
160
321
|
readonly sessions: Sessions;
|
|
161
322
|
readonly analytics: Analytics;
|
|
323
|
+
readonly esim: ESim;
|
|
324
|
+
readonly callPlans: CallPlans;
|
|
162
325
|
private readonly http;
|
|
163
326
|
constructor(apiKey: string, options?: VerixoOptions);
|
|
164
327
|
/**
|
|
@@ -174,4 +337,4 @@ declare class Verixo {
|
|
|
174
337
|
subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void;
|
|
175
338
|
}
|
|
176
339
|
|
|
177
|
-
export { type DeliveryRate, type OtpPush, type PurchaseNumberParams, type PurchaseResult, type SearchNumbersParams, type SearchNumbersResult, type SessionState, type SessionStatus, VerixoError, type VerixoOptions, type VirtualNumber, Verixo as default };
|
|
340
|
+
export { type CallPlan, type CallPlanSubscription, type DeliveryRate, type ESimPackage, type ESimProfile, type ESimPurchaseParams, type ESimUsage, type OtpPush, type PurchaseBundleParams, type PurchaseNumberParams, type PurchaseResult, type SearchNumbersParams, type SearchNumbersResult, type SessionState, type SessionStatus, type SpecialPackage, type SpecialPackageOrder, type SubscribeCallPlanParams, VerixoError, type VerixoOptions, type VirtualNumber, Verixo as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -86,6 +86,100 @@ interface OtpPush {
|
|
|
86
86
|
/** Milliseconds between calling subscribe() and this push arriving -- not from the server. */
|
|
87
87
|
latencyMs: number;
|
|
88
88
|
}
|
|
89
|
+
interface ESimPackage {
|
|
90
|
+
packageId: string;
|
|
91
|
+
name: string;
|
|
92
|
+
countryCode: string;
|
|
93
|
+
dataGb: number;
|
|
94
|
+
validityDays: number;
|
|
95
|
+
priceUsd: number;
|
|
96
|
+
slug?: string;
|
|
97
|
+
}
|
|
98
|
+
interface ESimPurchaseParams {
|
|
99
|
+
packageId: string;
|
|
100
|
+
countryCode: string;
|
|
101
|
+
priceUsd: number;
|
|
102
|
+
}
|
|
103
|
+
interface ESimProfile {
|
|
104
|
+
profileId: string;
|
|
105
|
+
iccid: string;
|
|
106
|
+
activationCode: string;
|
|
107
|
+
qrCodeUrl: string;
|
|
108
|
+
directAppleInstallUrl: string;
|
|
109
|
+
smdpAddress: string;
|
|
110
|
+
matchingId: string;
|
|
111
|
+
apnType: string;
|
|
112
|
+
apnValue: string;
|
|
113
|
+
isRoaming: boolean;
|
|
114
|
+
carrierName: string;
|
|
115
|
+
dataGbIncluded: number;
|
|
116
|
+
validityDays: number;
|
|
117
|
+
countryCode: string;
|
|
118
|
+
status: string;
|
|
119
|
+
}
|
|
120
|
+
interface ESimUsage {
|
|
121
|
+
iccid: string;
|
|
122
|
+
remainingMb: number;
|
|
123
|
+
totalMb: number;
|
|
124
|
+
usedPercent: number;
|
|
125
|
+
expiresAt: string;
|
|
126
|
+
}
|
|
127
|
+
interface CallPlan {
|
|
128
|
+
id: string;
|
|
129
|
+
tier: "BASIC" | "STANDARD" | "PREMIUM";
|
|
130
|
+
name: string;
|
|
131
|
+
/** -1 = unlimited */
|
|
132
|
+
minutes: number;
|
|
133
|
+
priceUsd: number;
|
|
134
|
+
perMin: number;
|
|
135
|
+
popular: boolean;
|
|
136
|
+
highCostMinutes: number;
|
|
137
|
+
highCostCountries: string[];
|
|
138
|
+
features: string[];
|
|
139
|
+
}
|
|
140
|
+
interface CallPlanSubscription {
|
|
141
|
+
id: string;
|
|
142
|
+
userId: string;
|
|
143
|
+
tier: string;
|
|
144
|
+
status: string;
|
|
145
|
+
minutesUsed: number;
|
|
146
|
+
minutesTotal: number;
|
|
147
|
+
highCostMinutesUsed: number;
|
|
148
|
+
highCostMinutesTotal: number;
|
|
149
|
+
renewsAt: string;
|
|
150
|
+
createdAt: string;
|
|
151
|
+
}
|
|
152
|
+
interface SubscribeCallPlanParams {
|
|
153
|
+
tier: "BASIC" | "STANDARD" | "PREMIUM";
|
|
154
|
+
paymentProvider?: string;
|
|
155
|
+
paymentReference?: string;
|
|
156
|
+
}
|
|
157
|
+
interface SpecialPackage {
|
|
158
|
+
id: string;
|
|
159
|
+
type: string;
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
priceUsd: number;
|
|
163
|
+
components: string[];
|
|
164
|
+
}
|
|
165
|
+
interface SpecialPackageOrder {
|
|
166
|
+
orderId: string;
|
|
167
|
+
userId: string;
|
|
168
|
+
packageType: string;
|
|
169
|
+
status: string;
|
|
170
|
+
smsCreditsAdded: boolean;
|
|
171
|
+
callPlanProvisioned: boolean;
|
|
172
|
+
eSimProvisioned: boolean;
|
|
173
|
+
virtualNumberProvisioned: boolean;
|
|
174
|
+
apiAccessProvisioned: boolean;
|
|
175
|
+
privacyModeEnabled: boolean;
|
|
176
|
+
createdAt: string;
|
|
177
|
+
}
|
|
178
|
+
interface PurchaseBundleParams {
|
|
179
|
+
packageType: "STARTER_BUNDLE" | "BUSINESS_BUNDLE" | "DEVELOPER_BUNDLE" | "NIGERIA_SPECIAL" | "PRIVACY_BUNDLE";
|
|
180
|
+
paymentProvider?: string;
|
|
181
|
+
paymentReference?: string;
|
|
182
|
+
}
|
|
89
183
|
|
|
90
184
|
declare class HttpClient {
|
|
91
185
|
readonly apiKey: string;
|
|
@@ -108,6 +202,73 @@ declare class Analytics {
|
|
|
108
202
|
}>;
|
|
109
203
|
}
|
|
110
204
|
|
|
205
|
+
declare class CallPlans {
|
|
206
|
+
private readonly http;
|
|
207
|
+
constructor(http: HttpClient);
|
|
208
|
+
/**
|
|
209
|
+
* List all available call plan tiers with pricing.
|
|
210
|
+
* No authentication required — safe to call before purchase.
|
|
211
|
+
*
|
|
212
|
+
* Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute
|
|
213
|
+
* bucket rather than silently throttling. See `highCostMinutes` on each plan.
|
|
214
|
+
*/
|
|
215
|
+
list(): Promise<CallPlan[]>;
|
|
216
|
+
/**
|
|
217
|
+
* Subscribe to a call plan. Debits your wallet.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })
|
|
221
|
+
*/
|
|
222
|
+
subscribe(params: SubscribeCallPlanParams): Promise<CallPlanSubscription>;
|
|
223
|
+
/** Get the authenticated user's active call plan subscription, or null if none. */
|
|
224
|
+
current(): Promise<CallPlanSubscription | null>;
|
|
225
|
+
/** List all call plan subscription history for the authenticated user. */
|
|
226
|
+
history(): Promise<CallPlanSubscription[]>;
|
|
227
|
+
/** Cancel the active call plan subscription immediately. */
|
|
228
|
+
cancel(): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).
|
|
231
|
+
* No authentication required.
|
|
232
|
+
*/
|
|
233
|
+
listBundles(): Promise<SpecialPackage[]>;
|
|
234
|
+
/**
|
|
235
|
+
* Purchase a bundle package. Each bundle fans out async provisioning events
|
|
236
|
+
* (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.
|
|
237
|
+
* Poll `myBundles()` to track provisioning completion.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })
|
|
241
|
+
* console.log(order.status) // "PROCESSING"
|
|
242
|
+
*/
|
|
243
|
+
purchaseBundle(params: PurchaseBundleParams): Promise<SpecialPackageOrder>;
|
|
244
|
+
/** List all bundle purchases for the authenticated user. */
|
|
245
|
+
myBundles(): Promise<SpecialPackageOrder[]>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class ESim {
|
|
249
|
+
private readonly http;
|
|
250
|
+
constructor(http: HttpClient);
|
|
251
|
+
/**
|
|
252
|
+
* List available eSIM packages for a country via Airalo.
|
|
253
|
+
* No authentication required.
|
|
254
|
+
*/
|
|
255
|
+
listPackages(countryCode: string, days?: number): Promise<ESimPackage[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Purchase an eSIM. The gateway debits your wallet and returns
|
|
258
|
+
* activation info including the QR code URL and LPA activation code
|
|
259
|
+
* suitable for qr_flutter / Apple's one-tap install URL.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })
|
|
263
|
+
* console.log(profile.activationCode) // "LPA:1$smdp$matching_id"
|
|
264
|
+
*/
|
|
265
|
+
purchase(params: ESimPurchaseParams): Promise<ESimProfile>;
|
|
266
|
+
/** List all eSIM profiles provisioned for the authenticated user. */
|
|
267
|
+
list(): Promise<ESimProfile[]>;
|
|
268
|
+
/** Check current data balance for a provisioned eSIM by its ICCID. */
|
|
269
|
+
usage(iccid: string): Promise<ESimUsage>;
|
|
270
|
+
}
|
|
271
|
+
|
|
111
272
|
declare class Numbers {
|
|
112
273
|
private readonly http;
|
|
113
274
|
constructor(http: HttpClient);
|
|
@@ -159,6 +320,8 @@ declare class Verixo {
|
|
|
159
320
|
readonly numbers: Numbers;
|
|
160
321
|
readonly sessions: Sessions;
|
|
161
322
|
readonly analytics: Analytics;
|
|
323
|
+
readonly esim: ESim;
|
|
324
|
+
readonly callPlans: CallPlans;
|
|
162
325
|
private readonly http;
|
|
163
326
|
constructor(apiKey: string, options?: VerixoOptions);
|
|
164
327
|
/**
|
|
@@ -174,4 +337,4 @@ declare class Verixo {
|
|
|
174
337
|
subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void;
|
|
175
338
|
}
|
|
176
339
|
|
|
177
|
-
export { type DeliveryRate, type OtpPush, type PurchaseNumberParams, type PurchaseResult, type SearchNumbersParams, type SearchNumbersResult, type SessionState, type SessionStatus, VerixoError, type VerixoOptions, type VirtualNumber, Verixo as default };
|
|
340
|
+
export { type CallPlan, type CallPlanSubscription, type DeliveryRate, type ESimPackage, type ESimProfile, type ESimPurchaseParams, type ESimUsage, type OtpPush, type PurchaseBundleParams, type PurchaseNumberParams, type PurchaseResult, type SearchNumbersParams, type SearchNumbersResult, type SessionState, type SessionStatus, type SpecialPackage, type SpecialPackageOrder, type SubscribeCallPlanParams, VerixoError, type VerixoOptions, type VirtualNumber, Verixo as default };
|
package/dist/index.js
CHANGED
|
@@ -89,6 +89,120 @@ var Analytics = class {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
// src/resources/call_plans.ts
|
|
93
|
+
var CallPlans = class {
|
|
94
|
+
constructor(http) {
|
|
95
|
+
this.http = http;
|
|
96
|
+
}
|
|
97
|
+
http;
|
|
98
|
+
// ─── Call Plans ─────────────────────────────────────────────────────────────
|
|
99
|
+
/**
|
|
100
|
+
* List all available call plan tiers with pricing.
|
|
101
|
+
* No authentication required — safe to call before purchase.
|
|
102
|
+
*
|
|
103
|
+
* Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute
|
|
104
|
+
* bucket rather than silently throttling. See `highCostMinutes` on each plan.
|
|
105
|
+
*/
|
|
106
|
+
list() {
|
|
107
|
+
return this.http.get("/api/v1/call-plans");
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Subscribe to a call plan. Debits your wallet.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })
|
|
114
|
+
*/
|
|
115
|
+
subscribe(params) {
|
|
116
|
+
return this.http.post("/api/v1/call-plans/subscribe", {
|
|
117
|
+
tier: params.tier,
|
|
118
|
+
paymentProvider: params.paymentProvider ?? "STRIPE",
|
|
119
|
+
paymentReference: params.paymentReference ?? ""
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** Get the authenticated user's active call plan subscription, or null if none. */
|
|
123
|
+
async current() {
|
|
124
|
+
try {
|
|
125
|
+
return await this.http.get("/api/v1/call-plans/my");
|
|
126
|
+
} catch (err) {
|
|
127
|
+
if (err?.status === 204 || err?.status === 404) return null;
|
|
128
|
+
throw err;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** List all call plan subscription history for the authenticated user. */
|
|
132
|
+
history() {
|
|
133
|
+
return this.http.get("/api/v1/call-plans/history");
|
|
134
|
+
}
|
|
135
|
+
/** Cancel the active call plan subscription immediately. */
|
|
136
|
+
cancel() {
|
|
137
|
+
return this.http.request("/api/v1/call-plans/my", { method: "DELETE" });
|
|
138
|
+
}
|
|
139
|
+
// ─── Special / Bundle Packages ───────────────────────────────────────────────
|
|
140
|
+
/**
|
|
141
|
+
* List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).
|
|
142
|
+
* No authentication required.
|
|
143
|
+
*/
|
|
144
|
+
listBundles() {
|
|
145
|
+
return this.http.get("/api/v1/special-packages");
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Purchase a bundle package. Each bundle fans out async provisioning events
|
|
149
|
+
* (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.
|
|
150
|
+
* Poll `myBundles()` to track provisioning completion.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })
|
|
154
|
+
* console.log(order.status) // "PROCESSING"
|
|
155
|
+
*/
|
|
156
|
+
purchaseBundle(params) {
|
|
157
|
+
return this.http.post("/api/v1/special-packages/purchase", {
|
|
158
|
+
packageType: params.packageType,
|
|
159
|
+
paymentProvider: params.paymentProvider ?? "STRIPE",
|
|
160
|
+
paymentReference: params.paymentReference ?? ""
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/** List all bundle purchases for the authenticated user. */
|
|
164
|
+
myBundles() {
|
|
165
|
+
return this.http.get("/api/v1/special-packages/my");
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// src/resources/esim.ts
|
|
170
|
+
var ESim = class {
|
|
171
|
+
constructor(http) {
|
|
172
|
+
this.http = http;
|
|
173
|
+
}
|
|
174
|
+
http;
|
|
175
|
+
/**
|
|
176
|
+
* List available eSIM packages for a country via Airalo.
|
|
177
|
+
* No authentication required.
|
|
178
|
+
*/
|
|
179
|
+
listPackages(countryCode, days = 30) {
|
|
180
|
+
return this.http.get(
|
|
181
|
+
`/api/v1/esim/packages?countryCode=${encodeURIComponent(countryCode)}&days=${days}`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Purchase an eSIM. The gateway debits your wallet and returns
|
|
186
|
+
* activation info including the QR code URL and LPA activation code
|
|
187
|
+
* suitable for qr_flutter / Apple's one-tap install URL.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })
|
|
191
|
+
* console.log(profile.activationCode) // "LPA:1$smdp$matching_id"
|
|
192
|
+
*/
|
|
193
|
+
purchase(params) {
|
|
194
|
+
return this.http.post("/api/v1/esim/purchase", params);
|
|
195
|
+
}
|
|
196
|
+
/** List all eSIM profiles provisioned for the authenticated user. */
|
|
197
|
+
list() {
|
|
198
|
+
return this.http.get("/api/v1/esim/my");
|
|
199
|
+
}
|
|
200
|
+
/** Check current data balance for a provisioned eSIM by its ICCID. */
|
|
201
|
+
usage(iccid) {
|
|
202
|
+
return this.http.get(`/api/v1/esim/${encodeURIComponent(iccid)}/usage`);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
92
206
|
// src/resources/numbers.ts
|
|
93
207
|
var Numbers = class {
|
|
94
208
|
constructor(http) {
|
|
@@ -172,12 +286,16 @@ var Verixo = class {
|
|
|
172
286
|
numbers;
|
|
173
287
|
sessions;
|
|
174
288
|
analytics;
|
|
289
|
+
esim;
|
|
290
|
+
callPlans;
|
|
175
291
|
http;
|
|
176
292
|
constructor(apiKey, options = {}) {
|
|
177
293
|
this.http = new HttpClient(apiKey, options);
|
|
178
294
|
this.numbers = new Numbers(this.http);
|
|
179
295
|
this.sessions = new Sessions(this.http);
|
|
180
296
|
this.analytics = new Analytics(this.http);
|
|
297
|
+
this.esim = new ESim(this.http);
|
|
298
|
+
this.callPlans = new CallPlans(this.http);
|
|
181
299
|
}
|
|
182
300
|
/**
|
|
183
301
|
* Get pushed the OTP for a session in real time, instead of polling
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/client.ts","../src/resources/analytics.ts","../src/resources/numbers.ts","../src/resources/sessions.ts","../src/subscribe.ts","../src/index.ts"],"sourcesContent":["export interface VerixoErrorOptions {\n status: number;\n code?: string;\n detail?: string;\n raw?: unknown;\n}\n\n/**\n * Thrown for any non-2xx response from the Verixo API. `status` is always\n * present; `code`/`detail` are populated when the gateway returns a JSON\n * error body (most do) -- a small number of paths (e.g. an invalid API key\n * rejected before reaching a controller) return an empty body, in which case\n * only `status` and a generic `message` are available.\n */\nexport class VerixoError extends Error {\n readonly status: number;\n readonly code?: string;\n readonly detail?: string;\n readonly raw?: unknown;\n\n constructor(message: string, options: VerixoErrorOptions) {\n super(message);\n this.name = \"VerixoError\";\n this.status = options.status;\n this.code = options.code;\n this.detail = options.detail;\n this.raw = options.raw;\n }\n}\n\nconst STATUS_FALLBACKS: Record<number, string> = {\n 401: \"Missing or invalid API key.\",\n 402: \"Insufficient wallet balance.\",\n 403: \"You don't have access to this resource.\",\n 404: \"Not found.\",\n 408: \"Request timed out.\",\n 422: \"The request did not meet a required condition (e.g. minScore).\",\n 429: \"Rate limit exceeded.\",\n};\n\nexport async function errorFromResponse(res: Response): Promise<VerixoError> {\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n body = undefined;\n }\n\n const obj = (body && typeof body === \"object\" ? body : {}) as Record<string, unknown>;\n const detail = (obj.detail ?? obj.error ?? obj.message) as string | undefined;\n const code = (obj.grpcCode ?? obj.code) as string | undefined;\n const message = detail ?? STATUS_FALLBACKS[res.status] ?? `Request failed with status ${res.status}`;\n\n return new VerixoError(message, { status: res.status, code, detail, raw: body });\n}\n","import { errorFromResponse } from \"./errors.js\";\nimport type { VerixoOptions } from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.verifiedcore.com\";\n\nexport class HttpClient {\n readonly apiKey: string;\n readonly baseUrl: string;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n if (!apiKey) {\n throw new Error(\"Verixo: an API key (or JWT) is required, e.g. new Verixo('vc_test_...')\");\n }\n this.apiKey = apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n }\n\n async request<T>(path: string, init: RequestInit = {}): Promise<T> {\n // The gateway classifies the credential by sniffing the raw Authorization header for a\n // vc_test_/vc_live_ prefix -- a \"Bearer \" prefix on an API key would make it misclassify\n // the request as a (malformed) JWT and reject it, so API keys go out unprefixed.\n const isApiKey = this.apiKey.startsWith(\"vc_test_\") || this.apiKey.startsWith(\"vc_live_\");\n const authorization = isApiKey ? this.apiKey : `Bearer ${this.apiKey}`;\n\n const res = await fetch(`${this.baseUrl}${path}`, {\n ...init,\n headers: {\n Authorization: authorization,\n ...(init.body ? { \"Content-Type\": \"application/json\" } : {}),\n ...init.headers,\n },\n });\n\n if (!res.ok) {\n throw await errorFromResponse(res);\n }\n\n if (res.status === 204) return undefined as T;\n return (await res.json()) as T;\n }\n\n get<T>(path: string): Promise<T> {\n return this.request<T>(path, { method: \"GET\" });\n }\n\n post<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: \"POST\", body: body ? JSON.stringify(body) : undefined });\n }\n\n /** ws:// or wss:// origin derived from baseUrl, for the OTP push subscription. */\n get wsOrigin(): string {\n return this.baseUrl.replace(/^http/, \"ws\");\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { DeliveryRate } from \"../types.js\";\n\nexport class Analytics {\n constructor(private readonly http: HttpClient) {}\n\n /** Public delivery-rate stats by country for a service. No auth required by the API itself. */\n rates(serviceSlug = \"whatsapp\"): Promise<{ rates: DeliveryRate[]; updatedAt: string }> {\n return this.http.get(`/api/v1/analytics/rates?serviceSlug=${encodeURIComponent(serviceSlug)}`);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { PurchaseNumberParams, PurchaseResult, SearchNumbersParams, SearchNumbersResult } from \"../types.js\";\n\nexport class Numbers {\n constructor(private readonly http: HttpClient) {}\n\n /** Browse available numbers ranked by Health Score (TM). No purchase is made. */\n search(params: SearchNumbersParams): Promise<SearchNumbersResult> {\n const q = new URLSearchParams({ serviceSlug: params.serviceSlug });\n if (params.countryCode) q.set(\"countryCode\", params.countryCode);\n if (params.minScore != null) q.set(\"minScore\", String(params.minScore));\n if (params.limit != null) q.set(\"limit\", String(params.limit));\n return this.http.get<SearchNumbersResult>(`/api/v1/numbers/search?${q}`);\n }\n\n /**\n * Buy a number for a service + country. The server picks the best available\n * candidate by Health Score automatically -- there's no numberId parameter,\n * since by the time you'd pass one back the number may already be gone.\n */\n purchase(params: PurchaseNumberParams): Promise<PurchaseResult> {\n return this.http.post<PurchaseResult>(\"/api/v1/numbers/purchase\", params);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { SessionStatus } from \"../types.js\";\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Poll a session's current delivery status. */\n get(sessionToken: string): Promise<SessionStatus> {\n return this.http.get<SessionStatus>(`/api/v1/numbers/session/${encodeURIComponent(sessionToken)}`);\n }\n\n /**\n * Poll until the session reaches a terminal state (DELIVERED, REFUNDED, EXPIRED, FAILED)\n * or the timeout elapses. Prefer `vc.subscribe()` for real-time push -- this is a fallback\n * for environments where a persistent WebSocket isn't practical (e.g. serverless functions).\n */\n async waitForOtp(sessionToken: string, timeoutMs = 90_000, intervalMs = 2_000): Promise<SessionStatus> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n const session = await this.get(sessionToken);\n if (session.status !== \"PENDING\") return session;\n if (Date.now() >= deadline) return session;\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n","import { Client } from \"@stomp/stompjs\";\nimport type { HttpClient } from \"./client.js\";\nimport type { OtpPush } from \"./types.js\";\n\n/**\n * Subscribes to real-time OTP push for a session over the gateway's WebSocket\n * proxy (wss://.../ws -> delivery-service's STOMP broker, topic\n * /topic/otp/{sessionToken}). Requires a global WebSocket implementation --\n * present natively in browsers and Node 22+; on older Node, pass a `ws`\n * instance via globalThis.WebSocket before calling subscribe().\n *\n * Returns an unsubscribe function. The callback fires at most once per\n * session (a session only ever delivers one OTP).\n */\nexport function subscribe(http: HttpClient, sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n if (typeof WebSocket === \"undefined\") {\n throw new Error(\n \"Verixo.subscribe() requires a global WebSocket implementation. \" +\n \"This is built into browsers and Node 22+; on older Node, polyfill \" +\n \"globalThis.WebSocket (e.g. with the 'ws' package) before calling subscribe().\"\n );\n }\n\n const subscribedAt = Date.now();\n const client = new Client({\n brokerURL: `${http.wsOrigin}/ws`,\n reconnectDelay: 5_000,\n onConnect: () => {\n client.subscribe(`/topic/otp/${sessionToken}`, (message) => {\n try {\n const payload = JSON.parse(message.body) as Omit<OtpPush, \"latencyMs\">;\n onOtp({ ...payload, latencyMs: Date.now() - subscribedAt });\n } catch {\n // Ignore malformed frames rather than crashing the caller's process.\n }\n });\n },\n });\n\n client.activate();\n return () => {\n void client.deactivate();\n };\n}\n","import { HttpClient } from \"./client.js\";\nimport { Analytics } from \"./resources/analytics.js\";\nimport { Numbers } from \"./resources/numbers.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { subscribe } from \"./subscribe.js\";\nimport type { OtpPush, VerixoOptions } from \"./types.js\";\n\nexport { VerixoError } from \"./errors.js\";\nexport type {\n DeliveryRate,\n OtpPush,\n PurchaseNumberParams,\n PurchaseResult,\n SearchNumbersParams,\n SearchNumbersResult,\n SessionState,\n SessionStatus,\n VerixoOptions,\n VirtualNumber,\n} from \"./types.js\";\n\nexport default class Verixo {\n readonly numbers: Numbers;\n readonly sessions: Sessions;\n readonly analytics: Analytics;\n private readonly http: HttpClient;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n this.http = new HttpClient(apiKey, options);\n this.numbers = new Numbers(this.http);\n this.sessions = new Sessions(this.http);\n this.analytics = new Analytics(this.http);\n }\n\n /**\n * Get pushed the OTP for a session in real time, instead of polling\n * `sessions.get()`. Returns an unsubscribe function.\n *\n * @example\n * const session = await vc.numbers.purchase({ serviceSlug: 'whatsapp', countryCode: 'NG' })\n * vc.subscribe(session.sessionToken, ({ otp, latencyMs }) => {\n * console.log(`OTP: ${otp} in ${latencyMs}ms`)\n * })\n */\n subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n return subscribe(this.http, sessionToken, onOtp);\n }\n}\n"],"mappings":";AAcO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,SAA6B;AACxD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,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AA,EACF,CAAC;AAED,SAAO,SAAS;AAChB,SAAO,MAAM;AACX,SAAK,OAAO,WAAW;AAAA,EACzB;AACF;;;ACtBA,IAAqB,SAArB,MAA4B;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACQ;AAAA,EAEjB,YAAY,QAAgB,UAAyB,CAAC,GAAG;AACvD,SAAK,OAAO,IAAI,WAAW,QAAQ,OAAO;AAC1C,SAAK,UAAU,IAAI,QAAQ,KAAK,IAAI;AACpC,SAAK,WAAW,IAAI,SAAS,KAAK,IAAI;AACtC,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,UAAU,cAAsB,OAA4C;AAC1E,WAAO,UAAU,KAAK,MAAM,cAAc,KAAK;AAAA,EACjD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/client.ts","../src/resources/analytics.ts","../src/resources/call_plans.ts","../src/resources/esim.ts","../src/resources/numbers.ts","../src/resources/sessions.ts","../src/subscribe.ts","../src/index.ts"],"sourcesContent":["export interface VerixoErrorOptions {\n status: number;\n code?: string;\n detail?: string;\n raw?: unknown;\n}\n\n/**\n * Thrown for any non-2xx response from the Verixo API. `status` is always\n * present; `code`/`detail` are populated when the gateway returns a JSON\n * error body (most do) -- a small number of paths (e.g. an invalid API key\n * rejected before reaching a controller) return an empty body, in which case\n * only `status` and a generic `message` are available.\n */\nexport class VerixoError extends Error {\n readonly status: number;\n readonly code?: string;\n readonly detail?: string;\n readonly raw?: unknown;\n\n constructor(message: string, options: VerixoErrorOptions) {\n super(message);\n this.name = \"VerixoError\";\n this.status = options.status;\n this.code = options.code;\n this.detail = options.detail;\n this.raw = options.raw;\n }\n}\n\nconst STATUS_FALLBACKS: Record<number, string> = {\n 401: \"Missing or invalid API key.\",\n 402: \"Insufficient wallet balance.\",\n 403: \"You don't have access to this resource.\",\n 404: \"Not found.\",\n 408: \"Request timed out.\",\n 422: \"The request did not meet a required condition (e.g. minScore).\",\n 429: \"Rate limit exceeded.\",\n};\n\nexport async function errorFromResponse(res: Response): Promise<VerixoError> {\n let body: unknown;\n try {\n body = await res.json();\n } catch {\n body = undefined;\n }\n\n const obj = (body && typeof body === \"object\" ? body : {}) as Record<string, unknown>;\n const detail = (obj.detail ?? obj.error ?? obj.message) as string | undefined;\n const code = (obj.grpcCode ?? obj.code) as string | undefined;\n const message = detail ?? STATUS_FALLBACKS[res.status] ?? `Request failed with status ${res.status}`;\n\n return new VerixoError(message, { status: res.status, code, detail, raw: body });\n}\n","import { errorFromResponse } from \"./errors.js\";\nimport type { VerixoOptions } from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.verifiedcore.com\";\n\nexport class HttpClient {\n readonly apiKey: string;\n readonly baseUrl: string;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n if (!apiKey) {\n throw new Error(\"Verixo: an API key (or JWT) is required, e.g. new Verixo('vc_test_...')\");\n }\n this.apiKey = apiKey;\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n }\n\n async request<T>(path: string, init: RequestInit = {}): Promise<T> {\n // The gateway classifies the credential by sniffing the raw Authorization header for a\n // vc_test_/vc_live_ prefix -- a \"Bearer \" prefix on an API key would make it misclassify\n // the request as a (malformed) JWT and reject it, so API keys go out unprefixed.\n const isApiKey = this.apiKey.startsWith(\"vc_test_\") || this.apiKey.startsWith(\"vc_live_\");\n const authorization = isApiKey ? this.apiKey : `Bearer ${this.apiKey}`;\n\n const res = await fetch(`${this.baseUrl}${path}`, {\n ...init,\n headers: {\n Authorization: authorization,\n ...(init.body ? { \"Content-Type\": \"application/json\" } : {}),\n ...init.headers,\n },\n });\n\n if (!res.ok) {\n throw await errorFromResponse(res);\n }\n\n if (res.status === 204) return undefined as T;\n return (await res.json()) as T;\n }\n\n get<T>(path: string): Promise<T> {\n return this.request<T>(path, { method: \"GET\" });\n }\n\n post<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: \"POST\", body: body ? JSON.stringify(body) : undefined });\n }\n\n /** ws:// or wss:// origin derived from baseUrl, for the OTP push subscription. */\n get wsOrigin(): string {\n return this.baseUrl.replace(/^http/, \"ws\");\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { DeliveryRate } from \"../types.js\";\n\nexport class Analytics {\n constructor(private readonly http: HttpClient) {}\n\n /** Public delivery-rate stats by country for a service. No auth required by the API itself. */\n rates(serviceSlug = \"whatsapp\"): Promise<{ rates: DeliveryRate[]; updatedAt: string }> {\n return this.http.get(`/api/v1/analytics/rates?serviceSlug=${encodeURIComponent(serviceSlug)}`);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type {\n CallPlan,\n CallPlanSubscription,\n PurchaseBundleParams,\n SpecialPackage,\n SpecialPackageOrder,\n SubscribeCallPlanParams,\n} from \"../types.js\";\n\nexport class CallPlans {\n constructor(private readonly http: HttpClient) {}\n\n // ─── Call Plans ─────────────────────────────────────────────────────────────\n\n /**\n * List all available call plan tiers with pricing.\n * No authentication required — safe to call before purchase.\n *\n * Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute\n * bucket rather than silently throttling. See `highCostMinutes` on each plan.\n */\n list(): Promise<CallPlan[]> {\n return this.http.get<CallPlan[]>(\"/api/v1/call-plans\");\n }\n\n /**\n * Subscribe to a call plan. Debits your wallet.\n *\n * @example\n * await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })\n */\n subscribe(params: SubscribeCallPlanParams): Promise<CallPlanSubscription> {\n return this.http.post<CallPlanSubscription>(\"/api/v1/call-plans/subscribe\", {\n tier: params.tier,\n paymentProvider: params.paymentProvider ?? \"STRIPE\",\n paymentReference: params.paymentReference ?? \"\",\n });\n }\n\n /** Get the authenticated user's active call plan subscription, or null if none. */\n async current(): Promise<CallPlanSubscription | null> {\n try {\n return await this.http.get<CallPlanSubscription>(\"/api/v1/call-plans/my\");\n } catch (err: any) {\n if (err?.status === 204 || err?.status === 404) return null;\n throw err;\n }\n }\n\n /** List all call plan subscription history for the authenticated user. */\n history(): Promise<CallPlanSubscription[]> {\n return this.http.get<CallPlanSubscription[]>(\"/api/v1/call-plans/history\");\n }\n\n /** Cancel the active call plan subscription immediately. */\n cancel(): Promise<void> {\n return this.http.request<void>(\"/api/v1/call-plans/my\", { method: \"DELETE\" });\n }\n\n // ─── Special / Bundle Packages ───────────────────────────────────────────────\n\n /**\n * List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).\n * No authentication required.\n */\n listBundles(): Promise<SpecialPackage[]> {\n return this.http.get<SpecialPackage[]>(\"/api/v1/special-packages\");\n }\n\n /**\n * Purchase a bundle package. Each bundle fans out async provisioning events\n * (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.\n * Poll `myBundles()` to track provisioning completion.\n *\n * @example\n * const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })\n * console.log(order.status) // \"PROCESSING\"\n */\n purchaseBundle(params: PurchaseBundleParams): Promise<SpecialPackageOrder> {\n return this.http.post<SpecialPackageOrder>(\"/api/v1/special-packages/purchase\", {\n packageType: params.packageType,\n paymentProvider: params.paymentProvider ?? \"STRIPE\",\n paymentReference: params.paymentReference ?? \"\",\n });\n }\n\n /** List all bundle purchases for the authenticated user. */\n myBundles(): Promise<SpecialPackageOrder[]> {\n return this.http.get<SpecialPackageOrder[]>(\"/api/v1/special-packages/my\");\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { ESimPackage, ESimProfile, ESimPurchaseParams, ESimUsage } from \"../types.js\";\n\nexport class ESim {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * List available eSIM packages for a country via Airalo.\n * No authentication required.\n */\n listPackages(countryCode: string, days = 30): Promise<ESimPackage[]> {\n return this.http.get<ESimPackage[]>(\n `/api/v1/esim/packages?countryCode=${encodeURIComponent(countryCode)}&days=${days}`,\n );\n }\n\n /**\n * Purchase an eSIM. The gateway debits your wallet and returns\n * activation info including the QR code URL and LPA activation code\n * suitable for qr_flutter / Apple's one-tap install URL.\n *\n * @example\n * const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })\n * console.log(profile.activationCode) // \"LPA:1$smdp$matching_id\"\n */\n purchase(params: ESimPurchaseParams): Promise<ESimProfile> {\n return this.http.post<ESimProfile>(\"/api/v1/esim/purchase\", params);\n }\n\n /** List all eSIM profiles provisioned for the authenticated user. */\n list(): Promise<ESimProfile[]> {\n return this.http.get<ESimProfile[]>(\"/api/v1/esim/my\");\n }\n\n /** Check current data balance for a provisioned eSIM by its ICCID. */\n usage(iccid: string): Promise<ESimUsage> {\n return this.http.get<ESimUsage>(`/api/v1/esim/${encodeURIComponent(iccid)}/usage`);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { PurchaseNumberParams, PurchaseResult, SearchNumbersParams, SearchNumbersResult } from \"../types.js\";\n\nexport class Numbers {\n constructor(private readonly http: HttpClient) {}\n\n /** Browse available numbers ranked by Health Score (TM). No purchase is made. */\n search(params: SearchNumbersParams): Promise<SearchNumbersResult> {\n const q = new URLSearchParams({ serviceSlug: params.serviceSlug });\n if (params.countryCode) q.set(\"countryCode\", params.countryCode);\n if (params.minScore != null) q.set(\"minScore\", String(params.minScore));\n if (params.limit != null) q.set(\"limit\", String(params.limit));\n return this.http.get<SearchNumbersResult>(`/api/v1/numbers/search?${q}`);\n }\n\n /**\n * Buy a number for a service + country. The server picks the best available\n * candidate by Health Score automatically -- there's no numberId parameter,\n * since by the time you'd pass one back the number may already be gone.\n */\n purchase(params: PurchaseNumberParams): Promise<PurchaseResult> {\n return this.http.post<PurchaseResult>(\"/api/v1/numbers/purchase\", params);\n }\n}\n","import type { HttpClient } from \"../client.js\";\nimport type { SessionStatus } from \"../types.js\";\n\nexport class Sessions {\n constructor(private readonly http: HttpClient) {}\n\n /** Poll a session's current delivery status. */\n get(sessionToken: string): Promise<SessionStatus> {\n return this.http.get<SessionStatus>(`/api/v1/numbers/session/${encodeURIComponent(sessionToken)}`);\n }\n\n /**\n * Poll until the session reaches a terminal state (DELIVERED, REFUNDED, EXPIRED, FAILED)\n * or the timeout elapses. Prefer `vc.subscribe()` for real-time push -- this is a fallback\n * for environments where a persistent WebSocket isn't practical (e.g. serverless functions).\n */\n async waitForOtp(sessionToken: string, timeoutMs = 90_000, intervalMs = 2_000): Promise<SessionStatus> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n const session = await this.get(sessionToken);\n if (session.status !== \"PENDING\") return session;\n if (Date.now() >= deadline) return session;\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n","import { Client } from \"@stomp/stompjs\";\nimport type { HttpClient } from \"./client.js\";\nimport type { OtpPush } from \"./types.js\";\n\n/**\n * Subscribes to real-time OTP push for a session over the gateway's WebSocket\n * proxy (wss://.../ws -> delivery-service's STOMP broker, topic\n * /topic/otp/{sessionToken}). Requires a global WebSocket implementation --\n * present natively in browsers and Node 22+; on older Node, pass a `ws`\n * instance via globalThis.WebSocket before calling subscribe().\n *\n * Returns an unsubscribe function. The callback fires at most once per\n * session (a session only ever delivers one OTP).\n */\nexport function subscribe(http: HttpClient, sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n if (typeof WebSocket === \"undefined\") {\n throw new Error(\n \"Verixo.subscribe() requires a global WebSocket implementation. \" +\n \"This is built into browsers and Node 22+; on older Node, polyfill \" +\n \"globalThis.WebSocket (e.g. with the 'ws' package) before calling subscribe().\"\n );\n }\n\n const subscribedAt = Date.now();\n const client = new Client({\n brokerURL: `${http.wsOrigin}/ws`,\n reconnectDelay: 5_000,\n onConnect: () => {\n client.subscribe(`/topic/otp/${sessionToken}`, (message) => {\n try {\n const payload = JSON.parse(message.body) as Omit<OtpPush, \"latencyMs\">;\n onOtp({ ...payload, latencyMs: Date.now() - subscribedAt });\n } catch {\n // Ignore malformed frames rather than crashing the caller's process.\n }\n });\n },\n });\n\n client.activate();\n return () => {\n void client.deactivate();\n };\n}\n","import { HttpClient } from \"./client.js\";\nimport { Analytics } from \"./resources/analytics.js\";\nimport { CallPlans } from \"./resources/call_plans.js\";\nimport { ESim } from \"./resources/esim.js\";\nimport { Numbers } from \"./resources/numbers.js\";\nimport { Sessions } from \"./resources/sessions.js\";\nimport { subscribe } from \"./subscribe.js\";\nimport type { OtpPush, VerixoOptions } from \"./types.js\";\n\nexport { VerixoError } from \"./errors.js\";\nexport type {\n CallPlan,\n CallPlanSubscription,\n DeliveryRate,\n ESimPackage,\n ESimProfile,\n ESimPurchaseParams,\n ESimUsage,\n OtpPush,\n PurchaseBundleParams,\n PurchaseNumberParams,\n PurchaseResult,\n SearchNumbersParams,\n SearchNumbersResult,\n SessionState,\n SessionStatus,\n SpecialPackage,\n SpecialPackageOrder,\n SubscribeCallPlanParams,\n VerixoOptions,\n VirtualNumber,\n} from \"./types.js\";\n\nexport default class Verixo {\n readonly numbers: Numbers;\n readonly sessions: Sessions;\n readonly analytics: Analytics;\n readonly esim: ESim;\n readonly callPlans: CallPlans;\n private readonly http: HttpClient;\n\n constructor(apiKey: string, options: VerixoOptions = {}) {\n this.http = new HttpClient(apiKey, options);\n this.numbers = new Numbers(this.http);\n this.sessions = new Sessions(this.http);\n this.analytics = new Analytics(this.http);\n this.esim = new ESim(this.http);\n this.callPlans = new CallPlans(this.http);\n }\n\n /**\n * Get pushed the OTP for a session in real time, instead of polling\n * `sessions.get()`. Returns an unsubscribe function.\n *\n * @example\n * const session = await vc.numbers.purchase({ serviceSlug: 'whatsapp', countryCode: 'NG' })\n * vc.subscribe(session.sessionToken, ({ otp, latencyMs }) => {\n * console.log(`OTP: ${otp} in ${latencyMs}ms`)\n * })\n */\n subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void {\n return subscribe(this.http, sessionToken, onOtp);\n }\n}\n"],"mappings":";AAcO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAA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