@vtex/faststore-plugin-buyer-portal 1.1.94 → 1.1.96

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 (52) hide show
  1. package/package.json +1 -1
  2. package/src/features/addresses/clients/AddressesClient.ts +2 -2
  3. package/src/features/addresses/components/AddressForm/AddressForm.tsx +0 -15
  4. package/src/features/addresses/components/AddressInfoDisplay/AddressInfoDisplay.tsx +0 -1
  5. package/src/features/addresses/components/AddressLocationsList/AddressLocationsList.tsx +28 -39
  6. package/src/features/addresses/components/AddressRecipientsList/AddressRecipientsList.tsx +42 -42
  7. package/src/features/addresses/components/CreateAddressDrawer/CreateAddressDrawer.tsx +0 -2
  8. package/src/features/addresses/layouts/AddressDetailsLayout/address-details-layout.scss +285 -286
  9. package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +26 -29
  10. package/src/features/addresses/layouts/AddressesLayout/addresses-layout.scss +144 -151
  11. package/src/features/addresses/types/AddressData.ts +3 -3
  12. package/src/features/budgets/components/BudgetAllocationsSelection/BudgetAllocationsSelection.tsx +61 -57
  13. package/src/features/budgets/components/BudgetAllocationsSelection/budget-allocations-selection.scss +131 -232
  14. package/src/features/budgets/components/BudgetAllocationsTable/BudgetAllocationsTable.tsx +104 -91
  15. package/src/features/budgets/components/BudgetAllocationsTable/budget-allocations-table.scss +80 -182
  16. package/src/features/budgets/components/BudgetsTable/BudgetsTable.tsx +90 -107
  17. package/src/features/budgets/components/BudgetsTable/budgets-table.scss +128 -126
  18. package/src/features/budgets/layouts/BudgetsLayout/BudgetsLayout.tsx +0 -15
  19. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +61 -46
  20. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/buying-policies-layout.scss +64 -70
  21. package/src/features/collections/components/CollectionsTable/CollectionsTable.tsx +12 -18
  22. package/src/features/collections/components/CollectionsTable/collections-table.scss +138 -118
  23. package/src/features/collections/components/table/AddCollectionsDrawerTable.tsx +48 -54
  24. package/src/features/collections/components/table/add-collections-drawer-table.scss +57 -56
  25. package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +55 -61
  26. package/src/features/credit-cards/layouts/CreditCardsLayout/credit-card-layout.scss +63 -153
  27. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +58 -49
  28. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/add-payment-methods-drawer.scss +58 -63
  29. package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +15 -12
  30. package/src/features/roles/layout/RoleDetailsLayout/RoleDetailsLayout.tsx +57 -26
  31. package/src/features/roles/layout/RoleDetailsLayout/role-details-layout.scss +77 -0
  32. package/src/features/roles/layout/RolesLayout/RolesLayout.tsx +4 -12
  33. package/src/features/roles/layout/RolesLayout/roles-layout.scss +8 -22
  34. package/src/features/shared/components/CustomField/table/CustomFieldTable.tsx +67 -110
  35. package/src/features/shared/components/CustomField/table/custom-field-table.scss +39 -144
  36. package/src/features/shared/components/IconBookmarked/IconBookmarked.tsx +9 -0
  37. package/src/features/shared/components/IconBookmarked/icon-bookmarked.scss +9 -0
  38. package/src/features/shared/components/Table/Table.tsx +7 -2
  39. package/src/features/shared/components/Table/TableCell/TableCell.tsx +15 -3
  40. package/src/features/shared/components/Table/TableCell/table-cell.scss +34 -0
  41. package/src/features/shared/components/Table/TableHead/TableHead.tsx +34 -6
  42. package/src/features/shared/components/Table/TableHead/table-head.scss +53 -49
  43. package/src/features/shared/components/Table/TableLoading/TableLoading.tsx +16 -6
  44. package/src/features/shared/components/Table/TableLoading/table-loading.scss +13 -8
  45. package/src/features/shared/components/Table/TableRow/TableRow.tsx +65 -42
  46. package/src/features/shared/components/Table/TableRow/table-row.scss +104 -68
  47. package/src/features/shared/components/Table/table.scss +11 -6
  48. package/src/features/shared/components/Table/utils/tableColumns.ts +30 -33
  49. package/src/features/shared/components/index.ts +1 -0
  50. package/src/features/shared/utils/addresLabelToPropMapping.ts +0 -1
  51. package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +20 -27
  52. package/src/themes/layouts.scss +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.1.94",
3
+ "version": "1.1.96",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -102,7 +102,7 @@ export default class AddressesClient extends Client {
102
102
  name: data.name,
103
103
  zip: data.zip,
104
104
  streetAddress: data.streetAddress,
105
- neighborhood: data.neighborhood,
105
+ neighborhood: data?.neighborhood ?? "",
106
106
  streetAddress2: data.streetAddress2,
107
107
  city: data.city,
108
108
  state: data.state,
@@ -135,7 +135,7 @@ export default class AddressesClient extends Client {
135
135
  name: data.name,
136
136
  zip: data.zip,
137
137
  streetAddress: data.streetAddress,
138
- neighborhood: data.neighborhood,
138
+ neighborhood: data?.neighborhood ?? "",
139
139
  streetAddress2: data.streetAddress2,
140
140
  city: data.city,
141
141
  state: data.state,
@@ -202,21 +202,6 @@ export const AddressForm = ({
202
202
  }
203
203
  />
204
204
 
205
- <InputText
206
- label="Neighborhood"
207
- value={address.neighborhood}
208
- className="address-postal-code"
209
- hasError={isTouched && !address.neighborhood?.trim()}
210
- onChange={(event) =>
211
- setAddress({ ...address, neighborhood: event.target.value })
212
- }
213
- />
214
-
215
- <ErrorMessage
216
- show={isTouched && !address.neighborhood?.trim()}
217
- message="Neighborhood is required"
218
- />
219
-
220
205
  <InputText
221
206
  label="City"
222
207
  className="address-city"
@@ -16,7 +16,6 @@ const AddressDisplay: React.FC<AddressDisplayProps> = ({
16
16
  {option?.streetAddress2 && `, ${option?.streetAddress2}`}
17
17
  {option?.streetNumber && ` ${option?.streetNumber}`}
18
18
  {option?.unit && ` ${option?.unit}`}
19
- {option?.neighborhood && `, ${option?.neighborhood}`}
20
19
  {option?.city && `, ${option?.city}`}
21
20
  {option?.state && `, ${option?.state}`}
22
21
  {option?.zip && `, ${option?.zip}`}
@@ -11,6 +11,7 @@ import {
11
11
  Table,
12
12
  } from "../../../shared/components";
13
13
  import { EmptyState } from "../../../shared/components/EmptyState/EmptyState";
14
+ import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
14
15
  import {
15
16
  useBuyerPortal,
16
17
  useDrawerProps,
@@ -109,6 +110,10 @@ export const AddressLocationsList = forwardRef<
109
110
  refreshLocations: handleRefreshLocations,
110
111
  }));
111
112
 
113
+ const columns = getTableColumns({
114
+ actionsLength: 2,
115
+ });
116
+
112
117
  return (
113
118
  <div data-fs-bp-address-tabs-list data-fs-bp-address-location-list>
114
119
  <div data-fs-bp-address-tabs-filter>
@@ -137,53 +142,37 @@ export const AddressLocationsList = forwardRef<
137
142
  </EmptyState>
138
143
  ) : (
139
144
  <div data-fs-bp-address-tabs-table>
140
- <Table>
141
- <Table.Head
142
- columns={[
143
- {
144
- key: "name",
145
- label: "Name",
146
- align: "left",
147
- },
148
- {
149
- key: "actions",
150
- label: "",
151
- align: "right",
152
- size: "large",
153
- },
154
- ]}
155
- />
145
+ <Table layoutFixed>
146
+ <Table.Head columns={columns} />
156
147
  <Table.Body>
157
148
  {isLoading ? (
158
- <Table.Loading />
149
+ <Table.Loading columns={columns.length} />
159
150
  ) : (
160
151
  locations.map((item) => (
161
152
  <Table.Row
162
153
  key={item.id}
163
154
  title={item.value}
164
155
  searchTerm={search}
165
- actionIcons={
166
- <div data-fs-bp-address-tabs-actions>
167
- <IconButton
168
- data-fs-bp-address-tabs-actions-icon
169
- icon={<Icon name="Trash" width={20} height={20} />}
170
- aria-label={"remove location action"}
171
- onClick={() => {
172
- selectLocation(item);
173
- openDeleteLocation();
174
- }}
175
- />
176
- <IconButton
177
- data-fs-bp-address-tabs-actions-icon
178
- icon={<Icon name="Edit" width={20} height={20} />}
179
- aria-label={"edit location action"}
180
- onClick={() => {
181
- selectLocation(item);
182
- openEditLocation();
183
- }}
184
- />
185
- </div>
186
- }
156
+ actionIcons={[
157
+ <IconButton
158
+ data-fs-bp-address-tabs-actions-icon
159
+ icon={<Icon name="Trash" width={20} height={20} />}
160
+ aria-label={"remove location action"}
161
+ onClick={() => {
162
+ selectLocation(item);
163
+ openDeleteLocation();
164
+ }}
165
+ />,
166
+ <IconButton
167
+ data-fs-bp-address-tabs-actions-icon
168
+ icon={<Icon name="Edit" width={20} height={20} />}
169
+ aria-label={"edit location action"}
170
+ onClick={() => {
171
+ selectLocation(item);
172
+ openEditLocation();
173
+ }}
174
+ />,
175
+ ]}
187
176
  />
188
177
  ))
189
178
  )}
@@ -11,6 +11,7 @@ import {
11
11
  Table,
12
12
  } from "../../../shared/components";
13
13
  import { EmptyState } from "../../../shared/components/EmptyState/EmptyState";
14
+ import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
14
15
  import { useBuyerPortal, useDrawerProps } from "../../../shared/hooks";
15
16
  import {
16
17
  PAGE_PARAMS,
@@ -111,30 +112,42 @@ export const AddressRecipientsList = forwardRef<
111
112
  } = useDrawerProps();
112
113
 
113
114
  const renderActions = (recipient: RecipientData) => {
114
- return (
115
- <div data-fs-bp-address-tabs-actions>
116
- <IconButton
117
- data-fs-bp-address-tabs-actions-icon
118
- icon={<Icon name="Trash" width={20} height={20} />}
119
- aria-label={"remove recipient action"}
120
- onClick={() => {
121
- setCurrentRecipient(recipient);
122
- openDeleteRecipientsAddressDrawer();
123
- }}
124
- />
125
- <IconButton
126
- data-fs-bp-address-tabs-actions-icon
127
- icon={<Icon name="Edit" width={20} height={20} />}
128
- aria-label={"Edit recipient action"}
129
- onClick={() => {
130
- setCurrentRecipient(recipient);
131
- openEditRecipientsAddressDrawer();
132
- }}
133
- />
134
- </div>
135
- );
115
+ return [
116
+ <IconButton
117
+ data-fs-bp-address-tabs-actions-icon
118
+ icon={<Icon name="Trash" width={20} height={20} />}
119
+ aria-label={"remove recipient action"}
120
+ onClick={() => {
121
+ setCurrentRecipient(recipient);
122
+ openDeleteRecipientsAddressDrawer();
123
+ }}
124
+ />,
125
+ <IconButton
126
+ data-fs-bp-address-tabs-actions-icon
127
+ icon={<Icon name="Edit" width={20} height={20} />}
128
+ aria-label={"Edit recipient action"}
129
+ onClick={() => {
130
+ setCurrentRecipient(recipient);
131
+ openEditRecipientsAddressDrawer();
132
+ }}
133
+ />,
134
+ ];
136
135
  };
137
136
 
137
+ const columns = getTableColumns({
138
+ actionsLength: 2,
139
+ nameColumnSize: "11.125rem",
140
+ extraColumns: [
141
+ {
142
+ key: "phone",
143
+ label: "Phone",
144
+ align: "left",
145
+ size: "100%",
146
+ hideOnScreenSize: "phonemid",
147
+ },
148
+ ],
149
+ });
150
+
138
151
  return (
139
152
  <div data-fs-bp-address-tabs-list>
140
153
  <div data-fs-bp-address-tabs-filter>
@@ -155,25 +168,12 @@ export const AddressRecipientsList = forwardRef<
155
168
  />
156
169
  ) : (
157
170
  <div data-fs-bp-address-tabs-table>
158
- <Table>
159
- <Table.Head
160
- columns={[
161
- {
162
- key: "name",
163
- label: "Name",
164
- align: "left",
165
- },
166
- {
167
- key: "phone",
168
- label: "Phone",
169
- align: "left",
170
- },
171
- ]}
172
- />
171
+ <Table layoutFixed>
172
+ <Table.Head columns={columns} />
173
173
 
174
174
  <Table.Body>
175
175
  {isLoading ? (
176
- <Table.Loading />
176
+ <Table.Loading columns={columns.length} />
177
177
  ) : (
178
178
  recipients.map((recipient) => (
179
179
  <Table.Row
@@ -181,13 +181,13 @@ export const AddressRecipientsList = forwardRef<
181
181
  title={recipient.firstName + " " + recipient.lastName}
182
182
  searchTerm={search}
183
183
  children={
184
- recipient.phone ? (
185
- <td>
184
+ <Table.Cell hideOnScreenSize="phonemid">
185
+ {recipient.phone ? (
186
186
  <span>
187
187
  {maskPhoneNumber(recipient.phone, countryCode)}
188
188
  </span>
189
- </td>
190
- ) : null
189
+ ) : null}
190
+ </Table.Cell>
191
191
  }
192
192
  actionIcons={renderActions(recipient as RecipientData)}
193
193
  />
@@ -47,7 +47,6 @@ export const CreateAddressDrawer = ({
47
47
  geoCoordinates: "",
48
48
  city: "",
49
49
  types: [],
50
- neighborhood: "",
51
50
  });
52
51
 
53
52
  const [locations, setLocations] = useState<LocationInput[]>([{ name: "" }]);
@@ -104,7 +103,6 @@ export const CreateAddressDrawer = ({
104
103
  address.country &&
105
104
  address.zip &&
106
105
  address.state &&
107
- address.neighborhood &&
108
106
  address.city &&
109
107
  address.types.length > 0) ||
110
108
  useExistingAddress