@delopay/sdk 0.1.3 → 0.1.5

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.d.cts CHANGED
@@ -3458,10 +3458,10 @@ declare class Delopay {
3458
3458
  * Create a new Delopay client.
3459
3459
  *
3460
3460
  * @param apiKey - Your Delopay API key (e.g. `sk_live_...` or `sk_test_...`).
3461
+ * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).
3461
3462
  * @param options - Optional configuration (sandbox mode, base URL override, timeout).
3462
- * @throws {Error} When `apiKey` is empty or not provided.
3463
3463
  */
3464
- constructor(apiKey: string, options?: DelopayOptions);
3464
+ constructor(apiKey?: string, options?: DelopayOptions);
3465
3465
  /**
3466
3466
  * Set a JWT token for subsequent requests.
3467
3467
  * When set, requests use `Authorization: Bearer <token>` instead of `api-key`.
package/dist/index.d.ts CHANGED
@@ -3458,10 +3458,10 @@ declare class Delopay {
3458
3458
  * Create a new Delopay client.
3459
3459
  *
3460
3460
  * @param apiKey - Your Delopay API key (e.g. `sk_live_...` or `sk_test_...`).
3461
+ * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).
3461
3462
  * @param options - Optional configuration (sandbox mode, base URL override, timeout).
3462
- * @throws {Error} When `apiKey` is empty or not provided.
3463
3463
  */
3464
- constructor(apiKey: string, options?: DelopayOptions);
3464
+ constructor(apiKey?: string, options?: DelopayOptions);
3465
3465
  /**
3466
3466
  * Set a JWT token for subsequent requests.
3467
3467
  * When set, requests use `Authorization: Bearer <token>` instead of `api-key`.
package/dist/index.js CHANGED
@@ -2406,18 +2406,15 @@ var Delopay = class {
2406
2406
  * Create a new Delopay client.
2407
2407
  *
2408
2408
  * @param apiKey - Your Delopay API key (e.g. `sk_live_...` or `sk_test_...`).
2409
+ * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).
2409
2410
  * @param options - Optional configuration (sandbox mode, base URL override, timeout).
2410
- * @throws {Error} When `apiKey` is empty or not provided.
2411
2411
  */
2412
2412
  constructor(apiKey, options) {
2413
- if (!apiKey) {
2414
- throw new Error("API key is required");
2415
- }
2416
- this.apiKey = apiKey;
2413
+ this.apiKey = apiKey ?? "";
2417
2414
  this.timeout = options?.timeout ?? 3e4;
2418
2415
  this.maxRetries = options?.maxRetries ?? 2;
2419
2416
  this.debug = options?.debug ?? false;
2420
- if (options?.baseUrl) {
2417
+ if (options?.baseUrl !== void 0) {
2421
2418
  this.baseUrl = options.baseUrl;
2422
2419
  } else if (options?.sandbox) {
2423
2420
  this.baseUrl = SANDBOX_URL;
@@ -2512,7 +2509,7 @@ var Delopay = class {
2512
2509
  }
2513
2510
  }
2514
2511
  const headers = {
2515
- ...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : { "api-key": this.apiKey },
2512
+ ...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : this.apiKey ? { "api-key": this.apiKey } : {},
2516
2513
  ...options?.headers
2517
2514
  };
2518
2515
  if (options?.body) {