@vtex/faststore-plugin-buyer-portal 1.0.16 → 1.0.18

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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/plugin.config.js +6 -1
  3. package/src/apis/new-route.ts +7 -0
  4. package/src/components/AddressLine/AddressLine.tsx +14 -13
  5. package/src/components/AddressLine/address-line.scss +23 -2
  6. package/src/components/AddressesCard/AddressesCard.tsx +78 -106
  7. package/src/components/Card/card.scss +68 -23
  8. package/src/components/ContractsCard/ContractsCard.tsx +174 -92
  9. package/src/components/CustomerSwitch/CustomerSwitchSearch.tsx +1 -1
  10. package/src/components/CustomerSwitch/customer-switch.scss +42 -3
  11. package/src/components/HomeCard/HomeCard.tsx +65 -0
  12. package/src/components/InternalSearch/internal-search.scss +1 -0
  13. package/src/components/InternalTopbar/InternalTopbar.tsx +25 -11
  14. package/src/components/InternalTopbar/internal-top-bar.scss +79 -3
  15. package/src/components/Logo/Logo.tsx +1 -1
  16. package/src/components/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +19 -0
  17. package/src/components/OrgUnitsHierarchyTree/OrgUnitsHierarchyTree.tsx +21 -21
  18. package/src/components/OrgUnitsHierarchyTree/org-units-hierarchy-tree.scss +41 -25
  19. package/src/components/OrganizationalUnitsCard/OrganizationalUnitsCard.tsx +29 -51
  20. package/src/components/ProfileCard/ProfileCard.tsx +22 -36
  21. package/src/components/ProfileSummary/ProfileSummary.tsx +1 -1
  22. package/src/components/ProfileSummary/profile-summary.scss +12 -4
  23. package/src/components/SelfManagementDrawer/SelfManagementDrawer.tsx +1 -1
  24. package/src/components/SelfManagementDrawer/SelfManagementDrawerHeader.tsx +5 -1
  25. package/src/components/SelfManagementDrawer/self-management-drawer.scss +70 -12
  26. package/src/components/SelfManagementSignInButton/SelfManagementSignInButton.tsx +4 -7
  27. package/src/components/SortFilter/SortFilter.tsx +1 -1
  28. package/src/components/SortFilter/sort-filter.scss +4 -2
  29. package/src/components/Tag/tag.scss +1 -0
  30. package/src/components/UsersCard/UsersCard.tsx +75 -92
  31. package/src/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +19 -28
  32. package/src/layouts/AddressDetailsLayout/address-details-layout.scss +23 -19
  33. package/src/layouts/AddressesLayout/AddressesLayout.tsx +6 -23
  34. package/src/layouts/AddressesLayout/addresses-layout.scss +5 -20
  35. package/src/layouts/ContractsLayout/ContractsLayout.tsx +1 -1
  36. package/src/layouts/HomeLayout/home-layout.scss +13 -5
  37. package/src/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +21 -15
  38. package/src/layouts/OrgUnitsLayout/org-units-layout.scss +26 -0
  39. package/src/layouts/ProfileLayout/ProfileLayout.tsx +10 -14
  40. package/src/layouts/ProfileLayout/profile-layout.scss +16 -6
  41. package/src/layouts/UserDetailsLayout/UserDetailsLayout.tsx +26 -6
  42. package/src/layouts/UserDetailsLayout/user-details-layout.scss +43 -6
  43. package/src/layouts/UsersLayout/UsersLayout.tsx +92 -11
  44. package/src/layouts/UsersLayout/users-layout.scss +68 -7
  45. package/src/mock/contracts-data.ts +9 -9
  46. package/src/mock/organization-data.ts +1 -1
  47. package/src/themes/index.scss +39 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {},
package/plugin.config.js CHANGED
@@ -32,6 +32,11 @@ module.exports = {
32
32
  profile: {
33
33
  path: "/profile",
34
34
  appLayout: false,
35
- }
35
+ },
36
+ },
37
+ apis: {
38
+ "new-route": {
39
+ path: "/new-route",
40
+ },
36
41
  },
37
42
  };
@@ -0,0 +1,7 @@
1
+ import { NextApiRequest, NextApiResponse } from "next/types";
2
+
3
+ // TODO: Remove when Plugin API feature be merged
4
+ export default function handle(req: NextApiRequest, res: NextApiResponse) {
5
+ console.log(req);
6
+ return res.json({ hello: "from plugin" });
7
+ }
@@ -19,20 +19,21 @@ export const AddressLine = ({
19
19
  status,
20
20
  }: AddressLineProps) => (
21
21
  <li data-fs-addresses-line>
22
- <Icon
23
- name="LocalPostOffice"
24
- width={20}
25
- height={20}
26
- data-fs-addresses-line-icon
27
- />
28
- <Link title={name} href={href} data-fs-addresses-line-name>
29
- {name}
30
- </Link>
31
-
32
- {tags.map((tag, index) => (
33
- <Tag key={index}>{tag}</Tag>
34
- ))}
22
+ <Link href={href} data-fs-addresses-line-link>
23
+ <Icon
24
+ name="LocalPostOffice"
25
+ width={20}
26
+ height={20}
27
+ data-fs-addresses-line-icon
28
+ />
29
+ <span title={name} data-fs-addresses-line-name>
30
+ {name}
31
+ </span>
35
32
 
33
+ {tags.map((tag, index) => (
34
+ <Tag key={index}>{tag}</Tag>
35
+ ))}
36
+ </Link>
36
37
  <Toggle id={id} defaultChecked={status} />
37
38
  <button data-fs-addresses-dropdown-trigger>
38
39
  <Icon
@@ -3,7 +3,6 @@
3
3
  display: flex;
4
4
  align-items: center;
5
5
  justify-content: space-between;
6
- position: relative;
7
6
 
8
7
  padding: var(--fs-spacing-2) 0;
9
8
  border-top: var(--fs-border-width) solid #e5e5e5;
@@ -11,9 +10,25 @@
11
10
  display: flex;
12
11
  align-items: center;
13
12
 
13
+ &:hover {
14
+ background-color: #f5f5f5;
15
+ }
16
+
17
+ [data-fs-addresses-line-link] {
18
+ display: flex;
19
+ align-items: center;
20
+ text-decoration: none;
21
+ flex: 1;
22
+
23
+ &:visited {
24
+ color: #1f1f1f;
25
+ }
26
+ }
27
+
14
28
  [data-fs-addresses-line-icon] {
15
29
  color: #0068d7;
16
- margin-right: var(--fs-spacing-1);
30
+ margin: 10px;
31
+ margin-right: 20px;
17
32
  }
18
33
 
19
34
  [data-fs-addresses-line-name] {
@@ -37,6 +52,12 @@
37
52
 
38
53
  [data-fs-addresses-dropdown-trigger] {
39
54
  cursor: pointer;
55
+ height: 40px;
56
+ width: 40px;
57
+ border-radius: 1000px;
58
+ &:hover {
59
+ background-color: #e0e0e0;
60
+ }
40
61
 
41
62
  [data-fs-addresses-dropdown-trigger-icon] {
42
63
  color: #707070;
@@ -1,132 +1,104 @@
1
1
  import {
2
- Icon as UIIcon,
3
- IconButton,
4
2
  Toggle,
5
3
  Dropdown,
6
4
  DropdownItem,
7
5
  DropdownMenu,
8
6
  DropdownButton,
9
7
  } from "@faststore/ui";
10
- import Link from "next/link";
11
-
12
- import { Card, CardBody, CardFooter, CardHeader } from "../Card";
13
8
  import { Tag } from "../Tag/Tag";
14
- import { useRouter } from "next/router";
15
9
  import { AddressData } from "../../types/AddressData";
16
10
  import { Icon } from "../Icon";
11
+ import { HomeCard } from "../HomeCard/HomeCard";
17
12
 
18
13
  type AddressesCardProps = {
19
14
  addresses: AddressData[];
20
15
  };
21
16
 
22
17
  export default function AddressesCard({ addresses }: AddressesCardProps) {
23
- const { push } = useRouter();
24
-
25
18
  return (
26
- <Card>
27
- <CardHeader>
28
- <div data-fs-card-title>
29
- Addresses <span data-fs-card-title-counter>{addresses.length}</span>
30
- </div>
31
- <IconButton
32
- icon={<UIIcon name="PlusCircle" width={20} height={20} />}
33
- aria-label={`$addresses action`}
34
- onClick={() => { }}
35
- />
36
- </CardHeader>
37
- <CardBody>
38
- {addresses.length &&
39
- addresses.slice(0, 5).map((address) => {
40
- return (
41
- <div key={address.id}>
42
- <hr data-fs-divider />
19
+ <HomeCard
20
+ footerLink="/addresses"
21
+ footerMessage="Manage addresses"
22
+ title="Addresses"
23
+ subTitle={addresses.length ?? 0}
24
+ onPlusIconClick={() => {}}
25
+ >
26
+ {addresses.length &&
27
+ addresses.slice(0, 3).map((address) => {
28
+ return (
29
+ <div key={address.id}>
30
+ <hr data-fs-divider />
43
31
 
44
- <div data-fs-card-row key={address.id}>
45
- <div data-fs-card-information-row>
46
- <div data-fs-card-information-icon>
47
- <Icon name="LocalPostOffice" height={24} width={24} />
48
- </div>
49
- <div data-fs-card-information-title>
50
- <span title={address.name}>{address.name}</span>
51
- </div>
32
+ <div data-fs-card-row key={address.id}>
33
+ <div data-fs-card-information-row>
34
+ <div data-fs-card-information-icon>
35
+ <Icon name="LocalPostOffice" height={24} width={24} />
36
+ </div>
37
+ <div data-fs-card-information-title>
38
+ <span title={address.name}>{address.name}</span>
39
+ </div>
52
40
 
53
- <div data-fs-card-information-type>
54
- {address.tags.map((tag) => (
55
- <Tag key={`${address.id}-${tag}`}>{tag}</Tag>
56
- ))}
57
- </div>
41
+ <div data-fs-card-information-type>
42
+ {address.tags.map((tag) => (
43
+ <Tag key={`${address.id}-${tag}`}>{tag}</Tag>
44
+ ))}
58
45
  </div>
59
- <div data-fs-card-action-row>
60
- <Toggle
61
- id="addressActive"
62
- defaultChecked={address.status}
63
- />
46
+ </div>
47
+ <div data-fs-card-action-row>
48
+ <Toggle id="addressActive" defaultChecked={address.status} />
64
49
 
65
- <Dropdown>
66
- <DropdownButton>
67
- <UIIcon name="DotsThree" data-fs-menu-action-button />
68
- </DropdownButton>
69
- <DropdownMenu>
70
- <DropdownItem data-fs-card-dropdown-item>
71
- <Icon name="ArrowSquareOut" data-fs-dropdown-icon />
72
- Open
73
- </DropdownItem>
74
- <DropdownItem>
75
- <Icon
76
- name="Edit"
77
- width={24}
78
- height={24}
79
- data-fs-dropdown-icon
80
- />
81
- Edit
82
- </DropdownItem>
83
- <DropdownItem>
84
- <Icon
85
- name="Delete"
86
- width={24}
87
- height={24}
88
- data-fs-dropdown-icon
89
- />{" "}
90
- Delete
91
- </DropdownItem>
92
- <DropdownItem>
93
- <div data-fs-dropdown-active-item>
94
- <div data-fs-dropdown-active-item-label>
95
- <Icon
96
- name="Active"
97
- width={24}
98
- height={24}
99
- data-fs-dropdown-icon
100
- />{" "}
101
- Active
102
- </div>
103
- <Toggle
104
- id="addressActiveMenu"
105
- defaultChecked={address.status}
106
- data-fs-internal-toggle
107
- />
50
+ <Dropdown>
51
+ <DropdownButton data-fs-card-row-dropdown-button>
52
+ <Icon name="MoreVert" data-fs-menu-action-button />
53
+ </DropdownButton>
54
+ <DropdownMenu>
55
+ <DropdownItem data-fs-card-dropdown-item>
56
+ <Icon name="ArrowSquareOut" data-fs-dropdown-icon />
57
+ Open
58
+ </DropdownItem>
59
+ <DropdownItem>
60
+ <Icon
61
+ name="Edit"
62
+ width={24}
63
+ height={24}
64
+ data-fs-dropdown-icon
65
+ />
66
+ Edit
67
+ </DropdownItem>
68
+ <DropdownItem>
69
+ <Icon
70
+ name="Delete"
71
+ width={24}
72
+ height={24}
73
+ data-fs-dropdown-icon
74
+ />{" "}
75
+ Delete
76
+ </DropdownItem>
77
+ <DropdownItem>
78
+ <div data-fs-dropdown-active-item>
79
+ <div data-fs-dropdown-active-item-label>
80
+ <Icon
81
+ name="Active"
82
+ width={24}
83
+ height={24}
84
+ data-fs-dropdown-icon
85
+ />{" "}
86
+ Active
108
87
  </div>
109
- </DropdownItem>
110
- </DropdownMenu>
111
- </Dropdown>
112
- </div>
88
+ <Toggle
89
+ id="addressActiveMenu"
90
+ defaultChecked={address.status}
91
+ data-fs-internal-toggle
92
+ />
93
+ </div>
94
+ </DropdownItem>
95
+ </DropdownMenu>
96
+ </Dropdown>
113
97
  </div>
114
98
  </div>
115
- );
116
- })}
117
- </CardBody>
118
- <CardFooter>
119
- <Link href="/addresses" data-fs-card-footer-link>
120
- <span>Manage addresses</span>
121
- </Link>
122
- <IconButton
123
- onClick={() => {
124
- push("/addresses");
125
- }}
126
- icon={<Icon name="CaretRight" data-fs-card-footer-icon />}
127
- aria-label="manage-addresses"
128
- />
129
- </CardFooter>
130
- </Card>
99
+ </div>
100
+ );
101
+ })}
102
+ </HomeCard>
131
103
  );
132
104
  }
@@ -21,6 +21,9 @@
21
21
  border: var(--fs-card-border-width) solid rgba(224, 224, 224, 1);
22
22
  border-radius: 12px;
23
23
  overflow: hidden;
24
+ height: 330px;
25
+ display: flex;
26
+ flex-direction: column;
24
27
 
25
28
  [data-fs-card-header] {
26
29
  border-top-left-radius: 12px;
@@ -29,7 +32,7 @@
29
32
  background-color: white;
30
33
  align-items: center;
31
34
 
32
- padding: var(--fs-card-header-padding);
35
+ padding: 20px;
33
36
  font-weight: var(--fs-card-header-font-weight);
34
37
  display: flex;
35
38
  justify-content: space-between;
@@ -42,29 +45,41 @@
42
45
  color: var(--fs-card-header-icon-color);
43
46
  }
44
47
 
48
+ [data-fs-card-title] {
49
+ font-size: 16px;
50
+ font-weight: 600;
51
+ line-height: 24px;
52
+ }
53
+
45
54
  [data-fs-card-title-counter] {
46
55
  font-weight: 600;
47
- margin-left: 0.75rem;
56
+ margin-left: 8px;
48
57
  color: #adadad;
49
58
  }
50
59
  }
51
60
 
52
61
  [data-fs-card-body] {
53
- padding: var(--fs-card-body-padding);
54
- padding-bottom: 0px;
62
+ padding: 20px;
63
+ padding-bottom: 12px;
55
64
 
56
65
  [data-fs-profile-card-row] {
57
66
  display: flex;
58
67
  flex-direction: row;
59
- gap: 2.5rem;
60
- padding-top: 1.25rem;
61
- padding-bottom: 1.25rem;
68
+ gap: 40px;
69
+ padding-top: 22px;
70
+ padding-bottom: 22px;
71
+ font-size: 14px;
72
+ line-height: 20px;
62
73
 
63
74
  [data-fs-card-row-label] {
64
75
  font-weight: 500;
65
- width: 100px;
76
+ width: 72px;
66
77
  color: gray;
67
78
  }
79
+
80
+ h1 {
81
+ font-weight: 500;
82
+ }
68
83
  }
69
84
 
70
85
  [data-fs-card-row] {
@@ -73,12 +88,7 @@
73
88
  gap: 2.5rem;
74
89
  padding-top: 0.5rem;
75
90
  padding-bottom: 0.5rem;
76
-
77
- [data-fs-card-row-label] {
78
- font-weight: 500;
79
- width: 100px;
80
- color: gray;
81
- }
91
+ height: 64px;
82
92
  }
83
93
 
84
94
  [data-fs-card-information-row] {
@@ -88,8 +98,9 @@
88
98
  width: 100%;
89
99
 
90
100
  [data-fs-card-information-icon] {
101
+ padding: 8px;
91
102
  color: #0366dd;
92
- margin-right: 1rem;
103
+ margin-right: 10px;
93
104
  }
94
105
 
95
106
  [data-fs-card-information-title] {
@@ -97,8 +108,28 @@
97
108
  white-space: nowrap;
98
109
  overflow: hidden;
99
110
  text-overflow: ellipsis;
100
- margin-right: 1rem;
101
- max-width: 220px;
111
+ margin-right: 30px;
112
+ max-width: 188px;
113
+ font-size: 14px;
114
+ line-height: 20px;
115
+ text-overflow: ellipsis;
116
+ word-wrap: normal;
117
+ font-weight: 500;
118
+
119
+ h1 {
120
+ overflow: hidden;
121
+
122
+ white-space: nowrap;
123
+ text-overflow: ellipsis;
124
+ word-wrap: normal;
125
+ width: 100%;
126
+ }
127
+ }
128
+
129
+ [data-fs-card-row-label] {
130
+ font-size: 14px;
131
+ font-weight: 400;
132
+ color: #858585;
102
133
  }
103
134
 
104
135
  [data-fs-card-information-type] {
@@ -122,10 +153,6 @@
122
153
  margin-left: auto;
123
154
  }
124
155
 
125
- [data-fs-menu-action-button] {
126
- rotate: 90deg;
127
- }
128
-
129
156
  [data-fs-card-body-empty-state] {
130
157
  display: flex;
131
158
  flex-direction: column;
@@ -138,13 +165,18 @@
138
165
  }
139
166
  }
140
167
 
168
+ [data-fs-profile-name] {
169
+ font-weight: 500;
170
+ }
171
+
141
172
  [data-fs-email-text] {
142
173
  color: #0366dd;
174
+ font-weight: 500;
143
175
  }
144
176
  }
145
177
 
146
178
  [data-fs-divider] {
147
- border: 1px solid #e0e0e0;
179
+ border: 0.5px solid #e0e0e0;
148
180
  }
149
181
 
150
182
  [data-fs-card-footer] {
@@ -155,13 +187,26 @@
155
187
  display: flex;
156
188
  justify-content: space-between;
157
189
  align-items: center;
190
+ margin-top: auto;
158
191
 
159
192
  [data-fs-card-footer-link] {
160
193
  font-weight: 500;
161
- line-height: 14px;
194
+ font-size: 14px;
195
+ line-height: 20px;
162
196
  color: #0366dd;
163
197
  text-decoration: none;
164
198
  }
199
+ [data-fs-button-wrapper] {
200
+ height: 40px !important;
201
+ width: 40px !important;
202
+ }
203
+ [data-fs-icon-button] {
204
+ display: inline-flex;
205
+ height: 40px !important;
206
+ min-height: 40px !important;
207
+ width: 40px !important;
208
+ overflow: hidden;
209
+ }
165
210
 
166
211
  [data-fs-card-footer-icon] {
167
212
  color: grey;