@feelflow/ffid-sdk 5.12.0 → 5.13.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.
@@ -92,6 +92,7 @@ function verifyWebhookSignature(rawBody, signatureHeader, secret, toleranceSecon
92
92
  var SDK_LOG_PREFIX = "[FFID Webhook SDK]";
93
93
  var HTTP_OK = 200;
94
94
  var HTTP_BAD_REQUEST = 400;
95
+ var HTTP_INTERNAL_SERVER_ERROR = 500;
95
96
  var noopLogger = {
96
97
  debug: () => {
97
98
  },
@@ -184,7 +185,8 @@ function createFFIDWebhookHandler(config) {
184
185
  }).catch((error) => {
185
186
  logger.error("Webhook processing failed:", error);
186
187
  const message = error instanceof Error ? error.message : "Webhook processing failed";
187
- res.status(HTTP_BAD_REQUEST).json({ error: message });
188
+ const status = error instanceof FFIDWebhookError ? HTTP_BAD_REQUEST : HTTP_INTERNAL_SERVER_ERROR;
189
+ res.status(status).json({ error: message });
188
190
  });
189
191
  };
190
192
  }
@@ -211,9 +213,10 @@ function createFFIDWebhookHandler(config) {
211
213
  } catch (error) {
212
214
  logger.error("Webhook processing failed:", error);
213
215
  const message = error instanceof Error ? error.message : "Webhook processing failed";
216
+ const status = error instanceof FFIDWebhookError ? HTTP_BAD_REQUEST : HTTP_INTERNAL_SERVER_ERROR;
214
217
  return new Response(
215
218
  JSON.stringify({ error: message }),
216
- { status: HTTP_BAD_REQUEST, headers: { "Content-Type": "application/json" } }
219
+ { status, headers: { "Content-Type": "application/json" } }
217
220
  );
218
221
  }
219
222
  };
@@ -90,6 +90,7 @@ function verifyWebhookSignature(rawBody, signatureHeader, secret, toleranceSecon
90
90
  var SDK_LOG_PREFIX = "[FFID Webhook SDK]";
91
91
  var HTTP_OK = 200;
92
92
  var HTTP_BAD_REQUEST = 400;
93
+ var HTTP_INTERNAL_SERVER_ERROR = 500;
93
94
  var noopLogger = {
94
95
  debug: () => {
95
96
  },
@@ -182,7 +183,8 @@ function createFFIDWebhookHandler(config) {
182
183
  }).catch((error) => {
183
184
  logger.error("Webhook processing failed:", error);
184
185
  const message = error instanceof Error ? error.message : "Webhook processing failed";
185
- res.status(HTTP_BAD_REQUEST).json({ error: message });
186
+ const status = error instanceof FFIDWebhookError ? HTTP_BAD_REQUEST : HTTP_INTERNAL_SERVER_ERROR;
187
+ res.status(status).json({ error: message });
186
188
  });
187
189
  };
188
190
  }
@@ -209,9 +211,10 @@ function createFFIDWebhookHandler(config) {
209
211
  } catch (error) {
210
212
  logger.error("Webhook processing failed:", error);
211
213
  const message = error instanceof Error ? error.message : "Webhook processing failed";
214
+ const status = error instanceof FFIDWebhookError ? HTTP_BAD_REQUEST : HTTP_INTERNAL_SERVER_ERROR;
212
215
  return new Response(
213
216
  JSON.stringify({ error: message }),
214
- { status: HTTP_BAD_REQUEST, headers: { "Content-Type": "application/json" } }
217
+ { status, headers: { "Content-Type": "application/json" } }
215
218
  );
216
219
  }
217
220
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "5.12.0",
3
+ "version": "5.13.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",