@basis-theory/basis-theory-js 1.79.4 → 1.79.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.79.4",
3
+ "version": "1.79.5",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -20,23 +20,30 @@ class BasisTheoryService {
20
20
  transformResponse,
21
21
  appInfo
22
22
  } = options;
23
- this.client = _axios.default.create({
24
- baseURL,
25
- headers: {
26
- [_common.API_KEY_HEADER]: apiKey,
27
- [_common.CLIENT_USER_AGENT_HEADER]: (0, _common.buildClientUserAgentString)(appInfo),
28
- ...(typeof window === 'undefined' && {
29
- [_common.USER_AGENT_HEADER]: (0, _common.buildUserAgentString)(appInfo)
30
- })
31
- },
32
-
33
- /* eslint-disable unicorn/prefer-spread */
34
- transformRequest: [].concat(transformRequest || _common.transformRequestSnakeCase, _axios.default.defaults.transformRequest),
35
- transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase)
36
- /* eslint-enable unicorn/prefer-spread */
37
-
38
- });
39
- this.client.interceptors.response.use(undefined, _common.errorInterceptor);
23
+
24
+ if (typeof _axios.default === 'string') {
25
+ // known issue with create react app
26
+ // eslint-disable-next-line unicorn/prefer-type-error
27
+ throw new Error('The Basis Theory SDK is not supported with CRA 5, downgrade to CRA 4 or see https://github.com/facebook/create-react-app/issues/11889#issuecomment-1114928008 for a workaround.');
28
+ } else {
29
+ this.client = _axios.default.create({
30
+ baseURL,
31
+ headers: {
32
+ [_common.API_KEY_HEADER]: apiKey,
33
+ [_common.CLIENT_USER_AGENT_HEADER]: (0, _common.buildClientUserAgentString)(appInfo),
34
+ ...(typeof window === 'undefined' && {
35
+ [_common.USER_AGENT_HEADER]: (0, _common.buildUserAgentString)(appInfo)
36
+ })
37
+ },
38
+
39
+ /* eslint-disable unicorn/prefer-spread */
40
+ transformRequest: [].concat(transformRequest || _common.transformRequestSnakeCase, _axios.default.defaults.transformRequest),
41
+ transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase)
42
+ /* eslint-enable unicorn/prefer-spread */
43
+
44
+ });
45
+ this.client.interceptors.response.use(undefined, _common.errorInterceptor);
46
+ }
40
47
  }
41
48
 
42
49
  }