@delopay/sdk 0.1.4 → 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.cjs +3 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2439,14 +2439,11 @@ var Delopay = class {
|
|
|
2439
2439
|
* Create a new Delopay client.
|
|
2440
2440
|
*
|
|
2441
2441
|
* @param apiKey - Your Delopay API key (e.g. `sk_live_...` or `sk_test_...`).
|
|
2442
|
+
* Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).
|
|
2442
2443
|
* @param options - Optional configuration (sandbox mode, base URL override, timeout).
|
|
2443
|
-
* @throws {Error} When `apiKey` is empty or not provided.
|
|
2444
2444
|
*/
|
|
2445
2445
|
constructor(apiKey, options) {
|
|
2446
|
-
|
|
2447
|
-
throw new Error("API key is required");
|
|
2448
|
-
}
|
|
2449
|
-
this.apiKey = apiKey;
|
|
2446
|
+
this.apiKey = apiKey ?? "";
|
|
2450
2447
|
this.timeout = options?.timeout ?? 3e4;
|
|
2451
2448
|
this.maxRetries = options?.maxRetries ?? 2;
|
|
2452
2449
|
this.debug = options?.debug ?? false;
|
|
@@ -2545,7 +2542,7 @@ var Delopay = class {
|
|
|
2545
2542
|
}
|
|
2546
2543
|
}
|
|
2547
2544
|
const headers = {
|
|
2548
|
-
...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : { "api-key": this.apiKey },
|
|
2545
|
+
...this.jwtToken ? { Authorization: `Bearer ${this.jwtToken}` } : this.apiKey ? { "api-key": this.apiKey } : {},
|
|
2549
2546
|
...options?.headers
|
|
2550
2547
|
};
|
|
2551
2548
|
if (options?.body) {
|