@verixo/sdk 0.1.1 → 0.3.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 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) {
@@ -166,6 +280,31 @@ var Sessions = class {
166
280
  }
167
281
  };
168
282
 
283
+ // src/resources/wallet.ts
284
+ var Wallet = class {
285
+ constructor(http) {
286
+ this.http = http;
287
+ }
288
+ http;
289
+ /** Get the authenticated user's current wallet balance and today's auto-refund count. */
290
+ balance() {
291
+ return this.http.get("/api/v1/wallet/balance");
292
+ }
293
+ /**
294
+ * List wallet transactions (credits, debits, refunds) for the authenticated user.
295
+ *
296
+ * @example
297
+ * const { transactions, total } = await vc.wallet.transactions({ page: 0, size: 20 })
298
+ */
299
+ transactions(params = {}) {
300
+ const q = new URLSearchParams();
301
+ if (params.page != null) q.set("page", String(params.page));
302
+ if (params.size != null) q.set("size", String(params.size));
303
+ const qs = q.toString();
304
+ return this.http.get(`/api/v1/wallet/transactions${qs ? `?${qs}` : ""}`);
305
+ }
306
+ };
307
+
169
308
  // src/subscribe.ts
170
309
  var import_stompjs = require("@stomp/stompjs");
171
310
  function subscribe(http, sessionToken, onOtp) {
@@ -199,12 +338,18 @@ var Verixo = class {
199
338
  numbers;
200
339
  sessions;
201
340
  analytics;
341
+ esim;
342
+ callPlans;
343
+ wallet;
202
344
  http;
203
345
  constructor(apiKey, options = {}) {
204
346
  this.http = new HttpClient(apiKey, options);
205
347
  this.numbers = new Numbers(this.http);
206
348
  this.sessions = new Sessions(this.http);
207
349
  this.analytics = new Analytics(this.http);
350
+ this.esim = new ESim(this.http);
351
+ this.callPlans = new CallPlans(this.http);
352
+ this.wallet = new Wallet(this.http);
208
353
  }
209
354
  /**
210
355
  * Get pushed the OTP for a session in real time, instead of polling
@@ -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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3B,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;;;ANtBA,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/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/resources/wallet.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 { Wallet } from \"./resources/wallet.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 WalletBalance,\n WalletTransaction,\n WalletTransactionsResult,\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 readonly wallet: Wallet;\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 this.wallet = new Wallet(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 type { HttpClient } from \"../client.js\";\nimport type { WalletBalance, WalletTransaction, WalletTransactionsResult } from \"../types.js\";\n\nexport class Wallet {\n constructor(private readonly http: HttpClient) {}\n\n /** Get the authenticated user's current wallet balance and today's auto-refund count. */\n balance(): Promise<WalletBalance> {\n return this.http.get<WalletBalance>(\"/api/v1/wallet/balance\");\n }\n\n /**\n * List wallet transactions (credits, debits, refunds) for the authenticated user.\n *\n * @example\n * const { transactions, total } = await vc.wallet.transactions({ page: 0, size: 20 })\n */\n transactions(params: { page?: number; size?: number } = {}): Promise<WalletTransactionsResult> {\n const q = new URLSearchParams();\n if (params.page != null) q.set(\"page\", String(params.page));\n if (params.size != null) q.set(\"size\", String(params.size));\n const qs = q.toString();\n return this.http.get<WalletTransactionsResult>(`/api/v1/wallet/transactions${qs ? `?${qs}` : \"\"}`);\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,KAA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I,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;AACxC,SAAK,SAAS,IAAI,OAAO,KAAK,IAAI;AAAA,EACpC;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,119 @@ interface OtpPush {
86
86
  /** Milliseconds between calling subscribe() and this push arriving -- not from the server. */
87
87
  latencyMs: number;
88
88
  }
89
+ interface WalletBalance {
90
+ balanceUsd: number;
91
+ refundsToday: number;
92
+ }
93
+ interface WalletTransaction {
94
+ id: string;
95
+ type: string;
96
+ amountUsd: number;
97
+ description: string;
98
+ referenceId: string;
99
+ balanceAfterUsd: number;
100
+ createdAt: string;
101
+ }
102
+ interface WalletTransactionsResult {
103
+ transactions: WalletTransaction[];
104
+ total: number;
105
+ page: number;
106
+ size: number;
107
+ }
108
+ interface ESimPackage {
109
+ packageId: string;
110
+ name: string;
111
+ countryCode: string;
112
+ dataGb: number;
113
+ validityDays: number;
114
+ priceUsd: number;
115
+ slug?: string;
116
+ }
117
+ interface ESimPurchaseParams {
118
+ packageId: string;
119
+ countryCode: string;
120
+ priceUsd: number;
121
+ }
122
+ interface ESimProfile {
123
+ profileId: string;
124
+ iccid: string;
125
+ activationCode: string;
126
+ qrCodeUrl: string;
127
+ directAppleInstallUrl: string;
128
+ smdpAddress: string;
129
+ matchingId: string;
130
+ apnType: string;
131
+ apnValue: string;
132
+ isRoaming: boolean;
133
+ carrierName: string;
134
+ dataGbIncluded: number;
135
+ validityDays: number;
136
+ countryCode: string;
137
+ status: string;
138
+ }
139
+ interface ESimUsage {
140
+ iccid: string;
141
+ remainingMb: number;
142
+ totalMb: number;
143
+ usedPercent: number;
144
+ expiresAt: string;
145
+ }
146
+ interface CallPlan {
147
+ id: string;
148
+ tier: "BASIC" | "STANDARD" | "PREMIUM";
149
+ name: string;
150
+ /** -1 = unlimited */
151
+ minutes: number;
152
+ priceUsd: number;
153
+ perMin: number;
154
+ popular: boolean;
155
+ highCostMinutes: number;
156
+ highCostCountries: string[];
157
+ features: string[];
158
+ }
159
+ interface CallPlanSubscription {
160
+ id: string;
161
+ userId: string;
162
+ tier: string;
163
+ status: string;
164
+ minutesUsed: number;
165
+ minutesTotal: number;
166
+ highCostMinutesUsed: number;
167
+ highCostMinutesTotal: number;
168
+ renewsAt: string;
169
+ createdAt: string;
170
+ }
171
+ interface SubscribeCallPlanParams {
172
+ tier: "BASIC" | "STANDARD" | "PREMIUM";
173
+ paymentProvider?: string;
174
+ paymentReference?: string;
175
+ }
176
+ interface SpecialPackage {
177
+ id: string;
178
+ type: string;
179
+ name: string;
180
+ description: string;
181
+ priceUsd: number;
182
+ components: string[];
183
+ }
184
+ interface SpecialPackageOrder {
185
+ orderId: string;
186
+ userId: string;
187
+ packageType: string;
188
+ status: string;
189
+ smsCreditsAdded: boolean;
190
+ callPlanProvisioned: boolean;
191
+ eSimProvisioned: boolean;
192
+ virtualNumberProvisioned: boolean;
193
+ apiAccessProvisioned: boolean;
194
+ privacyModeEnabled: boolean;
195
+ createdAt: string;
196
+ }
197
+ interface PurchaseBundleParams {
198
+ packageType: "STARTER_BUNDLE" | "BUSINESS_BUNDLE" | "DEVELOPER_BUNDLE" | "NIGERIA_SPECIAL" | "PRIVACY_BUNDLE";
199
+ paymentProvider?: string;
200
+ paymentReference?: string;
201
+ }
89
202
 
90
203
  declare class HttpClient {
91
204
  readonly apiKey: string;
@@ -108,6 +221,73 @@ declare class Analytics {
108
221
  }>;
109
222
  }
110
223
 
224
+ declare class CallPlans {
225
+ private readonly http;
226
+ constructor(http: HttpClient);
227
+ /**
228
+ * List all available call plan tiers with pricing.
229
+ * No authentication required — safe to call before purchase.
230
+ *
231
+ * Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute
232
+ * bucket rather than silently throttling. See `highCostMinutes` on each plan.
233
+ */
234
+ list(): Promise<CallPlan[]>;
235
+ /**
236
+ * Subscribe to a call plan. Debits your wallet.
237
+ *
238
+ * @example
239
+ * await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })
240
+ */
241
+ subscribe(params: SubscribeCallPlanParams): Promise<CallPlanSubscription>;
242
+ /** Get the authenticated user's active call plan subscription, or null if none. */
243
+ current(): Promise<CallPlanSubscription | null>;
244
+ /** List all call plan subscription history for the authenticated user. */
245
+ history(): Promise<CallPlanSubscription[]>;
246
+ /** Cancel the active call plan subscription immediately. */
247
+ cancel(): Promise<void>;
248
+ /**
249
+ * List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).
250
+ * No authentication required.
251
+ */
252
+ listBundles(): Promise<SpecialPackage[]>;
253
+ /**
254
+ * Purchase a bundle package. Each bundle fans out async provisioning events
255
+ * (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.
256
+ * Poll `myBundles()` to track provisioning completion.
257
+ *
258
+ * @example
259
+ * const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })
260
+ * console.log(order.status) // "PROCESSING"
261
+ */
262
+ purchaseBundle(params: PurchaseBundleParams): Promise<SpecialPackageOrder>;
263
+ /** List all bundle purchases for the authenticated user. */
264
+ myBundles(): Promise<SpecialPackageOrder[]>;
265
+ }
266
+
267
+ declare class ESim {
268
+ private readonly http;
269
+ constructor(http: HttpClient);
270
+ /**
271
+ * List available eSIM packages for a country via Airalo.
272
+ * No authentication required.
273
+ */
274
+ listPackages(countryCode: string, days?: number): Promise<ESimPackage[]>;
275
+ /**
276
+ * Purchase an eSIM. The gateway debits your wallet and returns
277
+ * activation info including the QR code URL and LPA activation code
278
+ * suitable for qr_flutter / Apple's one-tap install URL.
279
+ *
280
+ * @example
281
+ * const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })
282
+ * console.log(profile.activationCode) // "LPA:1$smdp$matching_id"
283
+ */
284
+ purchase(params: ESimPurchaseParams): Promise<ESimProfile>;
285
+ /** List all eSIM profiles provisioned for the authenticated user. */
286
+ list(): Promise<ESimProfile[]>;
287
+ /** Check current data balance for a provisioned eSIM by its ICCID. */
288
+ usage(iccid: string): Promise<ESimUsage>;
289
+ }
290
+
111
291
  declare class Numbers {
112
292
  private readonly http;
113
293
  constructor(http: HttpClient);
@@ -134,6 +314,23 @@ declare class Sessions {
134
314
  waitForOtp(sessionToken: string, timeoutMs?: number, intervalMs?: number): Promise<SessionStatus>;
135
315
  }
136
316
 
317
+ declare class Wallet {
318
+ private readonly http;
319
+ constructor(http: HttpClient);
320
+ /** Get the authenticated user's current wallet balance and today's auto-refund count. */
321
+ balance(): Promise<WalletBalance>;
322
+ /**
323
+ * List wallet transactions (credits, debits, refunds) for the authenticated user.
324
+ *
325
+ * @example
326
+ * const { transactions, total } = await vc.wallet.transactions({ page: 0, size: 20 })
327
+ */
328
+ transactions(params?: {
329
+ page?: number;
330
+ size?: number;
331
+ }): Promise<WalletTransactionsResult>;
332
+ }
333
+
137
334
  interface VerixoErrorOptions {
138
335
  status: number;
139
336
  code?: string;
@@ -159,6 +356,9 @@ declare class Verixo {
159
356
  readonly numbers: Numbers;
160
357
  readonly sessions: Sessions;
161
358
  readonly analytics: Analytics;
359
+ readonly esim: ESim;
360
+ readonly callPlans: CallPlans;
361
+ readonly wallet: Wallet;
162
362
  private readonly http;
163
363
  constructor(apiKey: string, options?: VerixoOptions);
164
364
  /**
@@ -174,4 +374,4 @@ declare class Verixo {
174
374
  subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void;
175
375
  }
176
376
 
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 };
377
+ 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, type WalletBalance, type WalletTransaction, type WalletTransactionsResult, Verixo as default };
package/dist/index.d.ts CHANGED
@@ -86,6 +86,119 @@ interface OtpPush {
86
86
  /** Milliseconds between calling subscribe() and this push arriving -- not from the server. */
87
87
  latencyMs: number;
88
88
  }
89
+ interface WalletBalance {
90
+ balanceUsd: number;
91
+ refundsToday: number;
92
+ }
93
+ interface WalletTransaction {
94
+ id: string;
95
+ type: string;
96
+ amountUsd: number;
97
+ description: string;
98
+ referenceId: string;
99
+ balanceAfterUsd: number;
100
+ createdAt: string;
101
+ }
102
+ interface WalletTransactionsResult {
103
+ transactions: WalletTransaction[];
104
+ total: number;
105
+ page: number;
106
+ size: number;
107
+ }
108
+ interface ESimPackage {
109
+ packageId: string;
110
+ name: string;
111
+ countryCode: string;
112
+ dataGb: number;
113
+ validityDays: number;
114
+ priceUsd: number;
115
+ slug?: string;
116
+ }
117
+ interface ESimPurchaseParams {
118
+ packageId: string;
119
+ countryCode: string;
120
+ priceUsd: number;
121
+ }
122
+ interface ESimProfile {
123
+ profileId: string;
124
+ iccid: string;
125
+ activationCode: string;
126
+ qrCodeUrl: string;
127
+ directAppleInstallUrl: string;
128
+ smdpAddress: string;
129
+ matchingId: string;
130
+ apnType: string;
131
+ apnValue: string;
132
+ isRoaming: boolean;
133
+ carrierName: string;
134
+ dataGbIncluded: number;
135
+ validityDays: number;
136
+ countryCode: string;
137
+ status: string;
138
+ }
139
+ interface ESimUsage {
140
+ iccid: string;
141
+ remainingMb: number;
142
+ totalMb: number;
143
+ usedPercent: number;
144
+ expiresAt: string;
145
+ }
146
+ interface CallPlan {
147
+ id: string;
148
+ tier: "BASIC" | "STANDARD" | "PREMIUM";
149
+ name: string;
150
+ /** -1 = unlimited */
151
+ minutes: number;
152
+ priceUsd: number;
153
+ perMin: number;
154
+ popular: boolean;
155
+ highCostMinutes: number;
156
+ highCostCountries: string[];
157
+ features: string[];
158
+ }
159
+ interface CallPlanSubscription {
160
+ id: string;
161
+ userId: string;
162
+ tier: string;
163
+ status: string;
164
+ minutesUsed: number;
165
+ minutesTotal: number;
166
+ highCostMinutesUsed: number;
167
+ highCostMinutesTotal: number;
168
+ renewsAt: string;
169
+ createdAt: string;
170
+ }
171
+ interface SubscribeCallPlanParams {
172
+ tier: "BASIC" | "STANDARD" | "PREMIUM";
173
+ paymentProvider?: string;
174
+ paymentReference?: string;
175
+ }
176
+ interface SpecialPackage {
177
+ id: string;
178
+ type: string;
179
+ name: string;
180
+ description: string;
181
+ priceUsd: number;
182
+ components: string[];
183
+ }
184
+ interface SpecialPackageOrder {
185
+ orderId: string;
186
+ userId: string;
187
+ packageType: string;
188
+ status: string;
189
+ smsCreditsAdded: boolean;
190
+ callPlanProvisioned: boolean;
191
+ eSimProvisioned: boolean;
192
+ virtualNumberProvisioned: boolean;
193
+ apiAccessProvisioned: boolean;
194
+ privacyModeEnabled: boolean;
195
+ createdAt: string;
196
+ }
197
+ interface PurchaseBundleParams {
198
+ packageType: "STARTER_BUNDLE" | "BUSINESS_BUNDLE" | "DEVELOPER_BUNDLE" | "NIGERIA_SPECIAL" | "PRIVACY_BUNDLE";
199
+ paymentProvider?: string;
200
+ paymentReference?: string;
201
+ }
89
202
 
90
203
  declare class HttpClient {
91
204
  readonly apiKey: string;
@@ -108,6 +221,73 @@ declare class Analytics {
108
221
  }>;
109
222
  }
110
223
 
224
+ declare class CallPlans {
225
+ private readonly http;
226
+ constructor(http: HttpClient);
227
+ /**
228
+ * List all available call plan tiers with pricing.
229
+ * No authentication required — safe to call before purchase.
230
+ *
231
+ * Premium plans cap high-cost destinations (NG/GH/KE) to a disclosed minute
232
+ * bucket rather than silently throttling. See `highCostMinutes` on each plan.
233
+ */
234
+ list(): Promise<CallPlan[]>;
235
+ /**
236
+ * Subscribe to a call plan. Debits your wallet.
237
+ *
238
+ * @example
239
+ * await vc.callPlans.subscribe({ tier: 'STANDARD', paymentProvider: 'STRIPE' })
240
+ */
241
+ subscribe(params: SubscribeCallPlanParams): Promise<CallPlanSubscription>;
242
+ /** Get the authenticated user's active call plan subscription, or null if none. */
243
+ current(): Promise<CallPlanSubscription | null>;
244
+ /** List all call plan subscription history for the authenticated user. */
245
+ history(): Promise<CallPlanSubscription[]>;
246
+ /** Cancel the active call plan subscription immediately. */
247
+ cancel(): Promise<void>;
248
+ /**
249
+ * List all available bundle packages (STARTER, BUSINESS, DEVELOPER, etc.).
250
+ * No authentication required.
251
+ */
252
+ listBundles(): Promise<SpecialPackage[]>;
253
+ /**
254
+ * Purchase a bundle package. Each bundle fans out async provisioning events
255
+ * (SMS credits, call plan, eSIM, virtual number, API access) via Kafka.
256
+ * Poll `myBundles()` to track provisioning completion.
257
+ *
258
+ * @example
259
+ * const order = await vc.callPlans.purchaseBundle({ packageType: 'STARTER_BUNDLE' })
260
+ * console.log(order.status) // "PROCESSING"
261
+ */
262
+ purchaseBundle(params: PurchaseBundleParams): Promise<SpecialPackageOrder>;
263
+ /** List all bundle purchases for the authenticated user. */
264
+ myBundles(): Promise<SpecialPackageOrder[]>;
265
+ }
266
+
267
+ declare class ESim {
268
+ private readonly http;
269
+ constructor(http: HttpClient);
270
+ /**
271
+ * List available eSIM packages for a country via Airalo.
272
+ * No authentication required.
273
+ */
274
+ listPackages(countryCode: string, days?: number): Promise<ESimPackage[]>;
275
+ /**
276
+ * Purchase an eSIM. The gateway debits your wallet and returns
277
+ * activation info including the QR code URL and LPA activation code
278
+ * suitable for qr_flutter / Apple's one-tap install URL.
279
+ *
280
+ * @example
281
+ * const profile = await vc.esim.purchase({ packageId: 'airalo-ng-1gb', countryCode: 'NG', priceUsd: 9.99 })
282
+ * console.log(profile.activationCode) // "LPA:1$smdp$matching_id"
283
+ */
284
+ purchase(params: ESimPurchaseParams): Promise<ESimProfile>;
285
+ /** List all eSIM profiles provisioned for the authenticated user. */
286
+ list(): Promise<ESimProfile[]>;
287
+ /** Check current data balance for a provisioned eSIM by its ICCID. */
288
+ usage(iccid: string): Promise<ESimUsage>;
289
+ }
290
+
111
291
  declare class Numbers {
112
292
  private readonly http;
113
293
  constructor(http: HttpClient);
@@ -134,6 +314,23 @@ declare class Sessions {
134
314
  waitForOtp(sessionToken: string, timeoutMs?: number, intervalMs?: number): Promise<SessionStatus>;
135
315
  }
136
316
 
317
+ declare class Wallet {
318
+ private readonly http;
319
+ constructor(http: HttpClient);
320
+ /** Get the authenticated user's current wallet balance and today's auto-refund count. */
321
+ balance(): Promise<WalletBalance>;
322
+ /**
323
+ * List wallet transactions (credits, debits, refunds) for the authenticated user.
324
+ *
325
+ * @example
326
+ * const { transactions, total } = await vc.wallet.transactions({ page: 0, size: 20 })
327
+ */
328
+ transactions(params?: {
329
+ page?: number;
330
+ size?: number;
331
+ }): Promise<WalletTransactionsResult>;
332
+ }
333
+
137
334
  interface VerixoErrorOptions {
138
335
  status: number;
139
336
  code?: string;
@@ -159,6 +356,9 @@ declare class Verixo {
159
356
  readonly numbers: Numbers;
160
357
  readonly sessions: Sessions;
161
358
  readonly analytics: Analytics;
359
+ readonly esim: ESim;
360
+ readonly callPlans: CallPlans;
361
+ readonly wallet: Wallet;
162
362
  private readonly http;
163
363
  constructor(apiKey: string, options?: VerixoOptions);
164
364
  /**
@@ -174,4 +374,4 @@ declare class Verixo {
174
374
  subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void;
175
375
  }
176
376
 
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 };
377
+ 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, type WalletBalance, type WalletTransaction, type WalletTransactionsResult, 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) {
@@ -139,6 +253,31 @@ var Sessions = class {
139
253
  }
140
254
  };
141
255
 
256
+ // src/resources/wallet.ts
257
+ var Wallet = class {
258
+ constructor(http) {
259
+ this.http = http;
260
+ }
261
+ http;
262
+ /** Get the authenticated user's current wallet balance and today's auto-refund count. */
263
+ balance() {
264
+ return this.http.get("/api/v1/wallet/balance");
265
+ }
266
+ /**
267
+ * List wallet transactions (credits, debits, refunds) for the authenticated user.
268
+ *
269
+ * @example
270
+ * const { transactions, total } = await vc.wallet.transactions({ page: 0, size: 20 })
271
+ */
272
+ transactions(params = {}) {
273
+ const q = new URLSearchParams();
274
+ if (params.page != null) q.set("page", String(params.page));
275
+ if (params.size != null) q.set("size", String(params.size));
276
+ const qs = q.toString();
277
+ return this.http.get(`/api/v1/wallet/transactions${qs ? `?${qs}` : ""}`);
278
+ }
279
+ };
280
+
142
281
  // src/subscribe.ts
143
282
  import { Client } from "@stomp/stompjs";
144
283
  function subscribe(http, sessionToken, onOtp) {
@@ -172,12 +311,18 @@ var Verixo = class {
172
311
  numbers;
173
312
  sessions;
174
313
  analytics;
314
+ esim;
315
+ callPlans;
316
+ wallet;
175
317
  http;
176
318
  constructor(apiKey, options = {}) {
177
319
  this.http = new HttpClient(apiKey, options);
178
320
  this.numbers = new Numbers(this.http);
179
321
  this.sessions = new Sessions(this.http);
180
322
  this.analytics = new Analytics(this.http);
323
+ this.esim = new ESim(this.http);
324
+ this.callPlans = new CallPlans(this.http);
325
+ this.wallet = new Wallet(this.http);
181
326
  }
182
327
  /**
183
328
  * 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,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,IAAI,UAAU,IAAI,SAAS,IAAI;AAC/C,QAAM,OAAQ,IAAI,YAAY,IAAI;AAClC,QAAM,UAAU,UAAU,iBAAiB,IAAI,MAAM,KAAK,8BAA8B,IAAI,MAAM;AAElG,SAAO,IAAI,YAAY,SAAS,EAAE,QAAQ,IAAI,QAAQ,MAAM,QAAQ,KAAK,KAAK,CAAC;AACjF;;;ACnDA,IAAM,mBAAmB;AAElB,IAAM,aAAN,MAAiB;AAAA,EACb;AAAA,EACA;AAAA,E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AsB,OAA4C;AAC5G,MAAI,OAAO,cAAc,aAAa;AACpC,UAAM,IAAI;AAAA,MACR;AAAA,IAGF;AAAA,EACF;AAEA,QAAM,eAAe,KAAK,IAAI;AAC9B,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,WAAW,GAAG,KAAK,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;;;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/resources/wallet.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 type { HttpClient } from \"../client.js\";\nimport type { WalletBalance, WalletTransaction, WalletTransactionsResult } from \"../types.js\";\n\nexport class Wallet {\n constructor(private readonly http: HttpClient) {}\n\n /** Get the authenticated user's current wallet balance and today's auto-refund count. */\n balance(): Promise<WalletBalance> {\n return this.http.get<WalletBalance>(\"/api/v1/wallet/balance\");\n }\n\n /**\n * List wallet transactions (credits, debits, refunds) for the authenticated user.\n *\n * @example\n * const { transactions, total } = await vc.wallet.transactions({ page: 0, size: 20 })\n */\n transactions(params: { page?: number; size?: number } = {}): Promise<WalletTransactionsResult> {\n const q = new URLSearchParams();\n if (params.page != null) q.set(\"page\", String(params.page));\n if (params.size != null) q.set(\"size\", String(params.size));\n const qs = q.toString();\n return this.http.get<WalletTransactionsResult>(`/api/v1/wallet/transactions${qs ? `?${qs}` : \"\"}`);\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 { Wallet } from \"./resources/wallet.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 WalletBalance,\n WalletTransaction,\n WalletTransactionsResult,\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 readonly wallet: Wallet;\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 this.wallet = new Wallet(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,SAAS,QAAQ;AACtB,SAAK,OAAO,QAA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AAA,EACjB;AAAA,EACA;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;AACxC,SAAK,SAAS,IAAI,OAAO,KAAK,IAAI;AAAA,EACpC;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verixo/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Official Node.js SDK for the Verixo OTP-as-a-Service API",
5
5
  "license": "MIT",
6
6
  "homepage": "https://verifiedcore.com",