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