@vtex/faststore-plugin-buyer-portal 1.1.103 → 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.103",
3
+ "version": "1.1.104",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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,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 = {