@vtex/faststore-plugin-buyer-portal 1.1.102 → 1.1.104

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.1.102",
3
+ "version": "1.1.104",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,7 +18,6 @@ export class OrgUnitClient extends Client {
18
18
  headers: {
19
19
  Cookie: cookie,
20
20
  },
21
- cache: "force-cache",
22
21
  });
23
22
  }
24
23
 
@@ -8,6 +8,7 @@
8
8
  @import "../../../shared/components/Error/error.scss";
9
9
 
10
10
  width: 100%;
11
+ padding: var(--fs-text-size-1) var(--fs-spacing-7);
11
12
 
12
13
  [data-fs-bp-profile-details-title] {
13
14
  font-weight: var(--fs-text-weight-semibold);
@@ -3,7 +3,6 @@ import {
3
3
  getAuthFromCookie,
4
4
  getCookieWithoutSessionObjects,
5
5
  } from "../utils/cookie";
6
- import { extractErrorMessage } from "../utils/extractErrorMessage";
7
6
 
8
7
  interface RequestConfig<Input = unknown> {
9
8
  url: string;
@@ -108,25 +107,11 @@ class Client {
108
107
  }
109
108
 
110
109
  if (!response.ok) {
111
- const errorMessage = extractErrorMessage(response, responseData);
112
-
113
- const clientError = this.createClientError(
114
- errorMessage,
115
- response,
116
- responseData,
117
- {
118
- url,
119
- method,
120
- data,
121
- headers,
122
- params,
123
- ignoreContentType,
124
- cache,
125
- componentName,
126
- }
110
+ console.error(`Request to ${url} failed:`, responseData);
111
+ console.error(response.status, response.statusText);
112
+ throw new Error(
113
+ responseData ? JSON.stringify(responseData) : "Request failed"
127
114
  );
128
-
129
- throw clientError;
130
115
  }
131
116
 
132
117
  return responseData as Return;
@@ -55,17 +55,20 @@
55
55
  font-size: var(--fs-text-size-2);
56
56
  font-weight: var(--fs-text-weight-medium);
57
57
  color: #e2e2e2;
58
+ text-wrap: wrap;
58
59
  }
59
60
 
60
61
  [data-fs-bp-error-details-stack] {
61
62
  font-size: var(--fs-text-size-2);
62
63
  margin: var(--fs-spacing-4) 0;
63
64
  font-weight: var(--fs-text-weight-medium);
65
+ text-wrap: wrap;
64
66
  }
65
67
 
66
68
  [data-fs-bp-error-details-component] {
67
69
  font-size: var(--fs-text-size-2);
68
70
  font-weight: var(--fs-text-weight-medium);
71
+ text-wrap: wrap;
69
72
  }
70
73
  }
71
74
  }
@@ -26,8 +26,8 @@ export const SidebarMenu = ({ ...otherProps }: SidebarMenuProps) => {
26
26
 
27
27
  const router = useRouter();
28
28
 
29
- const orgUnitId = router.query.orgUnitId as string;
30
- const customerId = router.query.contractId as string;
29
+ const orgUnitId = (router.query.orgUnitId as string) || "";
30
+ const customerId = (router.query.contractId as string) || "";
31
31
 
32
32
  const idContract =
33
33
  (currentContract?.id
@@ -38,8 +38,8 @@ export const SidebarMenu = ({ ...otherProps }: SidebarMenuProps) => {
38
38
  <aside data-fs-bp-sidebar-menu {...otherProps}>
39
39
  <VerticalNav.Menu title="Contract">
40
40
  {getContractSettingsLinks({
41
- orgUnitId: orgUnitId ?? currentOrgUnit?.id ?? "",
42
- contractId: customerId ?? idContract,
41
+ orgUnitId: orgUnitId || currentOrgUnit?.id || "",
42
+ contractId: customerId || idContract,
43
43
  }).map((option) => (
44
44
  <VerticalNav.Link key={option.name} link={option.link}>
45
45
  {option.name}
@@ -54,8 +54,8 @@ export const ErrorTabsLayout = ({ children, error }: ErrorTabsLayoutProps) => {
54
54
  currentContract: contract,
55
55
  } = useBuyerPortal();
56
56
 
57
- const orgUnitId = router.query.orgUnitId as string;
58
- const customerId = router.query.contractId as string;
57
+ const orgUnitId = (router.query.orgUnitId as string) || "";
58
+ const customerId = (router.query.contractId as string) || "";
59
59
 
60
60
  const layoutConfig = getTabsLayoutConfigFromRoute(router.route);
61
61
 
@@ -1 +1 @@
1
- @import "../../components//Error/error.scss";
1
+ @import "../../components/Error/error.scss";
@@ -1,9 +1,13 @@
1
1
  const base = "/pvt/organization-account";
2
2
 
3
3
  function replaceParams(template: string, params: Record<string, string>) {
4
- return Object.entries(params).reduce((url, [key, value]) => {
5
- return url.replace(`[${key}]`, value);
6
- }, template);
4
+ return Object.entries(params)
5
+ .reduce((url, [key, value]) => {
6
+ // Handle empty or undefined values by replacing with empty string
7
+ const cleanValue = value || "";
8
+ return url.replace(`[${key}]`, cleanValue);
9
+ }, template)
10
+ .replace(/\/+/g, "/"); // Remove consecutive slashes
7
11
  }
8
12
 
9
13
  export const buyerPortalRoutes = {