crexperium-sdk 1.1.1 → 1.2.1
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/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -5
package/dist/index.js
CHANGED
|
@@ -132,22 +132,17 @@ class NetworkError extends CRMError {
|
|
|
132
132
|
const isBrowser$1 = typeof window !== 'undefined';
|
|
133
133
|
// Get fetch implementation
|
|
134
134
|
function getFetch() {
|
|
135
|
+
// Browser environment
|
|
135
136
|
if (isBrowser$1 && typeof window.fetch !== 'undefined') {
|
|
136
137
|
return window.fetch.bind(window);
|
|
137
138
|
}
|
|
138
|
-
//
|
|
139
|
+
// Node.js 18+ with native fetch
|
|
139
140
|
if (typeof globalThis.fetch !== 'undefined') {
|
|
140
141
|
return globalThis.fetch.bind(globalThis);
|
|
141
142
|
}
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const nodeFetch = require('node-fetch');
|
|
146
|
-
return nodeFetch.default || nodeFetch;
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
throw new Error('Fetch is not available. Please upgrade to Node.js 18+ or install node-fetch.');
|
|
150
|
-
}
|
|
143
|
+
// Node.js <18 without fetch - throw helpful error
|
|
144
|
+
throw new Error('Fetch is not available. Please upgrade to Node.js 18+ which includes native fetch support. ' +
|
|
145
|
+
'Alternatively, install and configure a polyfill.');
|
|
151
146
|
}
|
|
152
147
|
class HTTPClient {
|
|
153
148
|
constructor(config) {
|