@pooflabs/core 0.0.12 → 0.0.13
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.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -5
- package/dist/index.mjs.map +1 -1
- package/dist/utils/api.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3085,8 +3085,9 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
3085
3085
|
const config = await getConfig();
|
|
3086
3086
|
async function executeRequest() {
|
|
3087
3087
|
const authHeader = await createAuthHeader(config.isServer);
|
|
3088
|
-
const headers = Object.assign({
|
|
3089
|
-
if (typeof window !==
|
|
3088
|
+
const headers = Object.assign({ "Content-Type": "application/json", "X-Public-App-Id": config.appId, "X-App-Id": config.appId }, authHeader);
|
|
3089
|
+
if (typeof window !== "undefined" &&
|
|
3090
|
+
window.CUSTOM_TAROBASE_APP_ID_HEADER) {
|
|
3090
3091
|
const customAppId = window.CUSTOM_TAROBASE_APP_ID_HEADER;
|
|
3091
3092
|
if (customAppId) {
|
|
3092
3093
|
headers["X-App-Id"] = customAppId;
|
|
@@ -3096,12 +3097,18 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
3096
3097
|
if (_overrides === null || _overrides === void 0 ? void 0 : _overrides.headers) {
|
|
3097
3098
|
Object.assign(headers, _overrides.headers);
|
|
3098
3099
|
}
|
|
3100
|
+
// Signal to backend that client supports offchain transaction signing
|
|
3101
|
+
if (typeof window !== "undefined" &&
|
|
3102
|
+
window.TAROBASE_SUPPORTS_OFFCHAIN_SIGNING) {
|
|
3103
|
+
console.log("X-Supports-Offchain-Signing", "true");
|
|
3104
|
+
headers["X-Supports-Offchain-Signing"] = "true";
|
|
3105
|
+
}
|
|
3099
3106
|
const requestConfig = {
|
|
3100
3107
|
method,
|
|
3101
|
-
url: `${config.apiUrl}${urlPath.startsWith(
|
|
3108
|
+
url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
|
|
3102
3109
|
headers,
|
|
3103
3110
|
};
|
|
3104
|
-
if (method !==
|
|
3111
|
+
if (method !== "GET" && method !== "get") {
|
|
3105
3112
|
requestConfig.data = data ? JSON.stringify(data) : {};
|
|
3106
3113
|
}
|
|
3107
3114
|
const response = await axios(requestConfig);
|
|
@@ -3118,7 +3125,9 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
3118
3125
|
throw new Error("No refresh token found");
|
|
3119
3126
|
}
|
|
3120
3127
|
const refreshData = await refreshSession(refreshToken);
|
|
3121
|
-
if (refreshData &&
|
|
3128
|
+
if (refreshData &&
|
|
3129
|
+
refreshData.idToken &&
|
|
3130
|
+
refreshData.accessToken) {
|
|
3122
3131
|
updateIdTokenAndAccessToken(refreshData.idToken, refreshData.accessToken);
|
|
3123
3132
|
}
|
|
3124
3133
|
return await executeRequest();
|