@verixo/sdk 0.2.0 → 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
@@ -280,6 +280,31 @@ var Sessions = class {
280
280
  }
281
281
  };
282
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
+
283
308
  // src/subscribe.ts
284
309
  var import_stompjs = require("@stomp/stompjs");
285
310
  function subscribe(http, sessionToken, onOtp) {
@@ -315,6 +340,7 @@ var Verixo = class {
315
340
  analytics;
316
341
  esim;
317
342
  callPlans;
343
+ wallet;
318
344
  http;
319
345
  constructor(apiKey, options = {}) {
320
346
  this.http = new HttpClient(apiKey, options);
@@ -323,6 +349,7 @@ var Verixo = class {
323
349
  this.analytics = new Analytics(this.http);
324
350
  this.esim = new ESim(this.http);
325
351
  this.callPlans = new CallPlans(this.http);
352
+ this.wallet = new Wallet(this.http);
326
353
  }
327
354
  /**
328
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/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;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,8B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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":[]}
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,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEA,eAAsB,kBAAkB,KAAqC;AAC3E,MAAI;AACJ,MAAI;AACF,WAAO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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,25 @@ 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
+ }
89
108
  interface ESimPackage {
90
109
  packageId: string;
91
110
  name: string;
@@ -295,6 +314,23 @@ declare class Sessions {
295
314
  waitForOtp(sessionToken: string, timeoutMs?: number, intervalMs?: number): Promise<SessionStatus>;
296
315
  }
297
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
+
298
334
  interface VerixoErrorOptions {
299
335
  status: number;
300
336
  code?: string;
@@ -322,6 +358,7 @@ declare class Verixo {
322
358
  readonly analytics: Analytics;
323
359
  readonly esim: ESim;
324
360
  readonly callPlans: CallPlans;
361
+ readonly wallet: Wallet;
325
362
  private readonly http;
326
363
  constructor(apiKey: string, options?: VerixoOptions);
327
364
  /**
@@ -337,4 +374,4 @@ declare class Verixo {
337
374
  subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void;
338
375
  }
339
376
 
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 };
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,25 @@ 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
+ }
89
108
  interface ESimPackage {
90
109
  packageId: string;
91
110
  name: string;
@@ -295,6 +314,23 @@ declare class Sessions {
295
314
  waitForOtp(sessionToken: string, timeoutMs?: number, intervalMs?: number): Promise<SessionStatus>;
296
315
  }
297
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
+
298
334
  interface VerixoErrorOptions {
299
335
  status: number;
300
336
  code?: string;
@@ -322,6 +358,7 @@ declare class Verixo {
322
358
  readonly analytics: Analytics;
323
359
  readonly esim: ESim;
324
360
  readonly callPlans: CallPlans;
361
+ readonly wallet: Wallet;
325
362
  private readonly http;
326
363
  constructor(apiKey: string, options?: VerixoOptions);
327
364
  /**
@@ -337,4 +374,4 @@ declare class Verixo {
337
374
  subscribe(sessionToken: string, onOtp: (push: OtpPush) => void): () => void;
338
375
  }
339
376
 
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 };
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
@@ -253,6 +253,31 @@ var Sessions = class {
253
253
  }
254
254
  };
255
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
+
256
281
  // src/subscribe.ts
257
282
  import { Client } from "@stomp/stompjs";
258
283
  function subscribe(http, sessionToken, onOtp) {
@@ -288,6 +313,7 @@ var Verixo = class {
288
313
  analytics;
289
314
  esim;
290
315
  callPlans;
316
+ wallet;
291
317
  http;
292
318
  constructor(apiKey, options = {}) {
293
319
  this.http = new HttpClient(apiKey, options);
@@ -296,6 +322,7 @@ var Verixo = class {
296
322
  this.analytics = new Analytics(this.http);
297
323
  this.esim = new ESim(this.http);
298
324
  this.callPlans = new CallPlans(this.http);
325
+ this.wallet = new Wallet(this.http);
299
326
  }
300
327
  /**
301
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/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;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,mBAA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AArB,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":[]}
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,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,Y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AAA;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.2.0",
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",