@amityco/ts-sdk 7.34.1-0b076f5c.0 → 7.34.1-a5ab820f.0
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.js
CHANGED
|
@@ -38937,6 +38937,18 @@ const widgetQuery = (call, keys) => keys.reduce((query, key) => {
|
|
|
38937
38937
|
const given = key === 'cursor' ? !!value : value !== undefined && value !== null;
|
|
38938
38938
|
return given ? Object.assign(Object.assign({}, query), { [key]: value }) : query;
|
|
38939
38939
|
}, {});
|
|
38940
|
+
/**
|
|
38941
|
+
* Drops `traceparent` from a widget request. The widget service's CORS does not
|
|
38942
|
+
* allow it yet, so a browser refuses the request; `x-request-id` still goes.
|
|
38943
|
+
* Remove once the service allows `traceparent`.
|
|
38944
|
+
*
|
|
38945
|
+
* @hidden
|
|
38946
|
+
*/
|
|
38947
|
+
const withoutTraceparent = (data, headers) => {
|
|
38948
|
+
headers.delete('traceparent');
|
|
38949
|
+
return data;
|
|
38950
|
+
};
|
|
38951
|
+
const defaultTransforms = () => { var _a; return [(_a = axios__default["default"].defaults.transformRequest) !== null && _a !== void 0 ? _a : []].flat(); };
|
|
38940
38952
|
const bodyText = (data) => {
|
|
38941
38953
|
if (typeof data === 'string')
|
|
38942
38954
|
return data;
|
|
@@ -38954,7 +38966,9 @@ const sendWidgetRequest = async ({ method, url, call, params, data, json, timeou
|
|
|
38954
38966
|
var _a;
|
|
38955
38967
|
const client = await widgetSession();
|
|
38956
38968
|
const target = widgetTarget(url, client.http.defaults.baseURL, allowed);
|
|
38957
|
-
const config = Object.assign(Object.assign(Object.assign({}, (target.baseURL ? { baseURL: target.baseURL } : {})), (params && Object.keys(params).length ? { params } : {})), { headers: widgetHeaders(client.apiKey, call, json), timeout, adapter: WIDGET_ADAPTERS, fetchOptions: { cache: 'no-store' },
|
|
38969
|
+
const config = Object.assign(Object.assign(Object.assign({}, (target.baseURL ? { baseURL: target.baseURL } : {})), (params && Object.keys(params).length ? { params } : {})), { headers: widgetHeaders(client.apiKey, call, json), timeout, adapter: WIDGET_ADAPTERS, fetchOptions: { cache: 'no-store' },
|
|
38970
|
+
// transforms run after the client's interceptor has set traceparent
|
|
38971
|
+
transformRequest: [withoutTraceparent, ...defaultTransforms()], responseType: 'text',
|
|
38958
38972
|
// every status is read here, not by the client's error interceptor
|
|
38959
38973
|
validateStatus: () => true });
|
|
38960
38974
|
let response;
|
package/dist/index.esm.js
CHANGED
|
@@ -38937,6 +38937,18 @@ const widgetQuery = (call, keys) => keys.reduce((query, key) => {
|
|
|
38937
38937
|
const given = key === 'cursor' ? !!value : value !== undefined && value !== null;
|
|
38938
38938
|
return given ? Object.assign(Object.assign({}, query), { [key]: value }) : query;
|
|
38939
38939
|
}, {});
|
|
38940
|
+
/**
|
|
38941
|
+
* Drops `traceparent` from a widget request. The widget service's CORS does not
|
|
38942
|
+
* allow it yet, so a browser refuses the request; `x-request-id` still goes.
|
|
38943
|
+
* Remove once the service allows `traceparent`.
|
|
38944
|
+
*
|
|
38945
|
+
* @hidden
|
|
38946
|
+
*/
|
|
38947
|
+
const withoutTraceparent = (data, headers) => {
|
|
38948
|
+
headers.delete('traceparent');
|
|
38949
|
+
return data;
|
|
38950
|
+
};
|
|
38951
|
+
const defaultTransforms = () => { var _a; return [(_a = axios.defaults.transformRequest) !== null && _a !== void 0 ? _a : []].flat(); };
|
|
38940
38952
|
const bodyText = (data) => {
|
|
38941
38953
|
if (typeof data === 'string')
|
|
38942
38954
|
return data;
|
|
@@ -38954,7 +38966,9 @@ const sendWidgetRequest = async ({ method, url, call, params, data, json, timeou
|
|
|
38954
38966
|
var _a;
|
|
38955
38967
|
const client = await widgetSession();
|
|
38956
38968
|
const target = widgetTarget(url, client.http.defaults.baseURL, allowed);
|
|
38957
|
-
const config = Object.assign(Object.assign(Object.assign({}, (target.baseURL ? { baseURL: target.baseURL } : {})), (params && Object.keys(params).length ? { params } : {})), { headers: widgetHeaders(client.apiKey, call, json), timeout, adapter: WIDGET_ADAPTERS, fetchOptions: { cache: 'no-store' },
|
|
38969
|
+
const config = Object.assign(Object.assign(Object.assign({}, (target.baseURL ? { baseURL: target.baseURL } : {})), (params && Object.keys(params).length ? { params } : {})), { headers: widgetHeaders(client.apiKey, call, json), timeout, adapter: WIDGET_ADAPTERS, fetchOptions: { cache: 'no-store' },
|
|
38970
|
+
// transforms run after the client's interceptor has set traceparent
|
|
38971
|
+
transformRequest: [withoutTraceparent, ...defaultTransforms()], responseType: 'text',
|
|
38958
38972
|
// every status is read here, not by the client's error interceptor
|
|
38959
38973
|
validateStatus: () => true });
|
|
38960
38974
|
let response;
|