@sendhome/common 1.0.203 → 1.0.205

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.
@@ -1,6 +1,8 @@
1
1
  export declare enum HelpCategory {
2
- GettingStarted = "Getting Started",
3
- CreatingOrders = "Creating Orders",
4
- Account = "Account",
5
- MyTransfers = "My Transfers"
2
+ GeneralInformation = "generalInformation",
3
+ ShoppingOrders = "shoppingOrders",
4
+ SecurityCompliance = "securityCompliance",
5
+ CustomerSupport = "customerSupport",
6
+ RewardsLoyalty = "rewardsLoyalty",
7
+ BusinessPartnerships = "businessPartnerships"
6
8
  }
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HelpCategory = void 0;
4
4
  var HelpCategory;
5
5
  (function (HelpCategory) {
6
- HelpCategory["GettingStarted"] = "Getting Started";
7
- HelpCategory["CreatingOrders"] = "Creating Orders";
8
- HelpCategory["Account"] = "Account";
9
- HelpCategory["MyTransfers"] = "My Transfers";
6
+ HelpCategory["GeneralInformation"] = "generalInformation";
7
+ HelpCategory["ShoppingOrders"] = "shoppingOrders";
8
+ HelpCategory["SecurityCompliance"] = "securityCompliance";
9
+ HelpCategory["CustomerSupport"] = "customerSupport";
10
+ HelpCategory["RewardsLoyalty"] = "rewardsLoyalty";
11
+ HelpCategory["BusinessPartnerships"] = "businessPartnerships";
10
12
  })(HelpCategory = exports.HelpCategory || (exports.HelpCategory = {}));
@@ -1,4 +1,4 @@
1
- import { Request, Response, NextFunction } from 'express';
1
+ import { Request, Response, NextFunction } from "express";
2
2
  interface UserPayload {
3
3
  id: string;
4
4
  sessionId: string;
@@ -21,10 +21,10 @@ const requireAuth = (sessionServiceUrl) => {
21
21
  var _a, _b;
22
22
  console.log("req.cookies.token", req.cookies.token);
23
23
  try {
24
- const token = req.cookies.token || ((_a = req.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(' ')[1]);
24
+ const token = req.cookies.token || ((_a = req.headers.authorization) === null || _a === void 0 ? void 0 : _a.split(" ")[1]);
25
25
  console.log("req.headers.authorization", (_b = req.headers.authorization) === null || _b === void 0 ? void 0 : _b.split(" ")[1]);
26
26
  if (!token) {
27
- res.status(401).json({ message: 'No session token provided' });
27
+ res.status(401).json({ message: "No session token provided" });
28
28
  return;
29
29
  }
30
30
  console.log("token", token);
@@ -35,7 +35,7 @@ const requireAuth = (sessionServiceUrl) => {
35
35
  // Call the session service to validate the session
36
36
  const response = yield axios_1.default.get(`${sessionServiceUrl}/${payload.sessionId}`);
37
37
  if (response.status !== 200) {
38
- res.status(401).json({ message: 'Invalid or expired session' });
38
+ res.status(401).json({ message: "Invalid or expired session" });
39
39
  return;
40
40
  }
41
41
  // Attach user ID to request object
@@ -46,13 +46,22 @@ const requireAuth = (sessionServiceUrl) => {
46
46
  console.error("Error during session validation:", error);
47
47
  // Check if error is an Axios error (e.g., network failure or service unreachable)
48
48
  if (axios_1.default.isAxiosError(error)) {
49
- res.status(500).json({ message: 'Error connecting to session service', error: error.message });
49
+ res
50
+ .status(500)
51
+ .json({
52
+ message: "Error connecting to session service",
53
+ error: error.message,
54
+ });
50
55
  }
51
- else if (error.name === 'JsonWebTokenError') {
52
- res.status(401).json({ message: 'Invalid JWT token', error: error.message });
56
+ else if (error.name === "JsonWebTokenError") {
57
+ res
58
+ .status(401)
59
+ .json({ message: "Invalid JWT token", error: error.message });
53
60
  }
54
61
  else {
55
- res.status(500).json({ message: 'Server error during session validation', error });
62
+ res
63
+ .status(500)
64
+ .json({ message: "Server error during session validation", error });
56
65
  }
57
66
  }
58
67
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendhome/common",
3
- "version": "1.0.203",
3
+ "version": "1.0.205",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",