@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 CHANGED
@@ -3105,8 +3105,9 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
3105
3105
  const config = await getConfig();
3106
3106
  async function executeRequest() {
3107
3107
  const authHeader = await createAuthHeader(config.isServer);
3108
- const headers = Object.assign({ 'Content-Type': 'application/json', "X-Public-App-Id": config.appId, "X-App-Id": config.appId }, authHeader);
3109
- if (typeof window !== 'undefined' && window.CUSTOM_TAROBASE_APP_ID_HEADER) {
3108
+ const headers = Object.assign({ "Content-Type": "application/json", "X-Public-App-Id": config.appId, "X-App-Id": config.appId }, authHeader);
3109
+ if (typeof window !== "undefined" &&
3110
+ window.CUSTOM_TAROBASE_APP_ID_HEADER) {
3110
3111
  const customAppId = window.CUSTOM_TAROBASE_APP_ID_HEADER;
3111
3112
  if (customAppId) {
3112
3113
  headers["X-App-Id"] = customAppId;
@@ -3116,12 +3117,18 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
3116
3117
  if (_overrides === null || _overrides === void 0 ? void 0 : _overrides.headers) {
3117
3118
  Object.assign(headers, _overrides.headers);
3118
3119
  }
3120
+ // Signal to backend that client supports offchain transaction signing
3121
+ if (typeof window !== "undefined" &&
3122
+ window.TAROBASE_SUPPORTS_OFFCHAIN_SIGNING) {
3123
+ console.log("X-Supports-Offchain-Signing", "true");
3124
+ headers["X-Supports-Offchain-Signing"] = "true";
3125
+ }
3119
3126
  const requestConfig = {
3120
3127
  method,
3121
- url: `${config.apiUrl}${urlPath.startsWith('/') ? urlPath : `/${urlPath}`}`,
3128
+ url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
3122
3129
  headers,
3123
3130
  };
3124
- if (method !== 'GET' && method !== 'get') {
3131
+ if (method !== "GET" && method !== "get") {
3125
3132
  requestConfig.data = data ? JSON.stringify(data) : {};
3126
3133
  }
3127
3134
  const response = await axios(requestConfig);
@@ -3138,7 +3145,9 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
3138
3145
  throw new Error("No refresh token found");
3139
3146
  }
3140
3147
  const refreshData = await refreshSession(refreshToken);
3141
- if (refreshData && refreshData.idToken && refreshData.accessToken) {
3148
+ if (refreshData &&
3149
+ refreshData.idToken &&
3150
+ refreshData.accessToken) {
3142
3151
  updateIdTokenAndAccessToken(refreshData.idToken, refreshData.accessToken);
3143
3152
  }
3144
3153
  return await executeRequest();