@vtex/faststore-plugin-buyer-portal 1.3.79 → 1.3.80

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/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.80] - 2026-04-29
11
+
12
+ ### Fixed
13
+ - Remove the following components/exports to fix broken 1.3.79 build:
14
+ - CollectionsSettingsDrawer
15
+ - AddProductAssortmentDrawer
16
+ - RemoveProductAssortmentDrawer
17
+ - AddProductAssortmentDrawerTable
18
+ - getProductAssortmentFromScopeService
19
+ - RemoveProductAssortmentDrawerProps
20
+
10
21
  ## [1.3.79] - 2026-04-23
11
22
 
12
23
  ### Added
@@ -586,7 +597,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
586
597
  - Add CHANGELOG file
587
598
  - Add README file
588
599
 
589
- [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.79...HEAD
600
+ [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.80...HEAD
590
601
  [1.3.55]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.54...v1.3.55
591
602
  [1.3.54]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.53...v1.3.54
592
603
  [1.3.53]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.52...v1.3.53
@@ -654,6 +665,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
654
665
  [1.3.65]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.64...v1.3.65
655
666
  [1.3.64]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.64
656
667
  [1.3.69]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.69
668
+ [1.3.80]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.79...v1.3.80
657
669
  [1.3.79]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.78...v1.3.79
658
670
  [1.3.78]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.77...v1.3.78
659
671
  [1.3.77]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.76...v1.3.77
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.3.79",
3
+ "version": "1.3.80",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,8 +1,3 @@
1
- export {
2
- getProductAssortmentFromScopeService,
3
- type GetProductAssortmentFromScopeServiceProps,
4
- } from "./get-product-assortment-from-scope.service";
5
-
6
1
  export {
7
2
  getProductAssortmentAttachedService,
8
3
  type GetProductAssortmentAttachedServiceProps,
@@ -41,13 +41,6 @@ export type AddProductAssortmentDrawerProps = Omit<
41
41
  BasicDrawerProps,
42
42
  "children"
43
43
  >;
44
-
45
- export type RemoveProductAssortmentDrawerProps = Omit<
46
- BasicDrawerProps,
47
- "children"
48
- > & {
49
- productAssortment: ProductAssortmentSelectedProps;
50
- };
51
44
  export interface ProductAssortmentSelectedProps {
52
45
  id: string;
53
46
  name: string;
@@ -22,7 +22,7 @@ export const SCOPE_KEYS = {
22
22
  CREDIT_CARDS: "creditCards",
23
23
  } as const;
24
24
 
25
- export const CURRENT_VERSION = "1.3.79";
25
+ export const CURRENT_VERSION = "1.3.80";
26
26
 
27
27
  export const CHANGES_TIMEOUT_MESSAGE =
28
28
  "Changes may take up to 10 minutes to apply.";
@@ -1,198 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- import { useRouter } from "next/router";
4
-
5
- import { Link, Skeleton, useUI } from "@faststore/ui";
6
-
7
- import {
8
- BasicDrawer,
9
- Icon,
10
- InternalSearch,
11
- Paginator,
12
- } from "../../../shared/components";
13
- import { useBuyerPortal, useDebounce } from "../../../shared/hooks";
14
- import { DEBOUNCE_TIMEOUT } from "../../../shared/utils";
15
- import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
16
- import { useGetProductAssorments } from "../../hooks";
17
- import { useAddProductAssortmentToScope } from "../../hooks/useAddProductAssortmentToScope";
18
- import { AddProductAssortmentDrawerTable } from "../table/AddProductAssortmentDrawerTable";
19
-
20
- import type {
21
- AddProductAssortmentDrawerProps,
22
- ProductAssortmentWithAdditionalInformation,
23
- } from "../../types";
24
-
25
- export const AddProductAssortmentDrawer = ({
26
- close,
27
- ...props
28
- }: AddProductAssortmentDrawerProps) => {
29
- const { pushToast } = useUI();
30
- const [drawerSearch, setDrawerSearch] = useState("");
31
- const [drawerPage, setDrawerPage] = useState(1);
32
- const { currentOrgUnit, currentContract } = useBuyerPortal();
33
- const { reload } = useRouter();
34
-
35
- const { productAssortments: productAssortment, isLoadingProductAssortments } =
36
- useGetProductAssorments({
37
- contractId: currentContract?.id ?? "",
38
- unitId: currentOrgUnit?.id ?? "",
39
- page: drawerPage,
40
- name: drawerSearch,
41
- });
42
-
43
- const unitId = currentOrgUnit?.id;
44
- const contractId = currentContract?.id;
45
- const isLoading = isLoadingProductAssortments;
46
- const [isLastPage, setIsLastPage] = useState(true);
47
-
48
- useEffect(() => {
49
- setDrawerSearch("");
50
- }, [props.isOpen]);
51
-
52
- useDebounce(drawerSearch, DEBOUNCE_TIMEOUT, {
53
- onDebounce: (value) => {
54
- setDrawerSearch(value);
55
- setDrawerPage(1);
56
- },
57
- });
58
-
59
- useEffect(() => {
60
- if (productAssortment?.paging) {
61
- setIsLastPage(productAssortment.paging.pages === drawerPage);
62
- }
63
- }, [productAssortment.paging]);
64
-
65
- const addProductAssortmentMutation = useAddProductAssortmentToScope();
66
-
67
- const [selectedAssortment, setSelectedAssortment] = useState<
68
- ProductAssortmentWithAdditionalInformation[]
69
- >([]);
70
-
71
- const handleSuccess = async () => {
72
- const itemsToAdd = selectedAssortment.filter((s) => !s.isEnabled);
73
-
74
- if (itemsToAdd.length === 0) {
75
- close();
76
- return;
77
- }
78
-
79
- await addProductAssortmentMutation.mutate({
80
- unitId: unitId ?? "",
81
- contractId: contractId ?? "",
82
- data: itemsToAdd.map((s) => ({ name: s.name })),
83
- });
84
-
85
- pushToast({
86
- message: `Product assortment added successfully\n${CHANGES_TIMEOUT_MESSAGE}`,
87
- status: "INFO",
88
- });
89
-
90
- close();
91
- reload();
92
- };
93
-
94
- return (
95
- <BasicDrawer
96
- data-fs-bp-add-product-assortment-drawer
97
- id="add-product-assortment-drawer"
98
- close={close}
99
- size="large"
100
- {...props}
101
- >
102
- <BasicDrawer.Heading title="Add product assortment" onClose={close} />
103
-
104
- <BasicDrawer.Body>
105
- <span data-fs-bp-add-product-assortment-text-drawer>
106
- Add product assortment to <Link href="#">{currentOrgUnit?.name}</Link>
107
- </span>
108
-
109
- <div data-fs-bp-add-product-assortment-wrapper>
110
- <InternalSearch
111
- textSearch={setDrawerSearch}
112
- defaultValue={drawerSearch}
113
- />
114
-
115
- {productAssortment.paging && productAssortment.items.length > 0 && (
116
- <Paginator.Counter
117
- total={productAssortment.paging.total}
118
- itemsLength={
119
- isLastPage
120
- ? productAssortment.paging.total
121
- : drawerPage * productAssortment.paging.perPage
122
- }
123
- />
124
- )}
125
- </div>
126
- <section>
127
- {isLoading ? (
128
- <div data-fs-bp-drawer-product-assortment-skeleton>
129
- <Skeleton size={{ height: "3.5rem", width: "100%" }} />
130
- </div>
131
- ) : productAssortment.items && productAssortment.items.length ? (
132
- <div>
133
- <AddProductAssortmentDrawerTable
134
- data={productAssortment.items}
135
- onChange={setSelectedAssortment}
136
- />
137
- {productAssortment.items.length > 0 && (
138
- <div data-fs-bp-drawer-product-assortment-paginator>
139
- {productAssortment.items.length > 0 &&
140
- productAssortment.paging.page > 1 ? (
141
- <Paginator.NextPageButton
142
- onClick={() => setDrawerPage(drawerPage - 1)}
143
- disabled={isLoading}
144
- >
145
- {isLoading ? "Loading" : "Previous page"}
146
- </Paginator.NextPageButton>
147
- ) : (
148
- <></>
149
- )}
150
-
151
- {productAssortment.items.length > 0 && !isLastPage ? (
152
- <Paginator.NextPageButton
153
- onClick={() => setDrawerPage(drawerPage + 1)}
154
- disabled={isLoading}
155
- >
156
- {isLoading ? "Loading" : "Next page"}
157
- </Paginator.NextPageButton>
158
- ) : (
159
- <></>
160
- )}
161
-
162
- <Paginator.Counter
163
- total={productAssortment.paging.total}
164
- itemsLength={
165
- isLastPage
166
- ? productAssortment.paging.total
167
- : drawerPage * productAssortment.paging.perPage
168
- }
169
- />
170
- </div>
171
- )}
172
- </div>
173
- ) : (
174
- <div data-fs-bp-add-product-assortment-drawer-empty-state>
175
- <Icon name="Shapes" />
176
- <p>No product assortment found</p>
177
- </div>
178
- )}
179
- </section>
180
- </BasicDrawer.Body>
181
- <BasicDrawer.Footer data-fs-bp-add-product-assortment-drawer-footer>
182
- <BasicDrawer.Button variant="ghost" onClick={close}>
183
- Cancel
184
- </BasicDrawer.Button>
185
- <BasicDrawer.Button
186
- variant="confirm"
187
- disabled={selectedAssortment.filter((s) => !s.isEnabled).length === 0}
188
- onClick={handleSuccess}
189
- isLoading={addProductAssortmentMutation.isLoading}
190
- >
191
- Add
192
- {selectedAssortment.filter((s) => !s.isEnabled).length > 0 &&
193
- `(${selectedAssortment.filter((s) => !s.isEnabled).length})`}
194
- </BasicDrawer.Button>
195
- </BasicDrawer.Footer>
196
- </BasicDrawer>
197
- );
198
- };
@@ -1,66 +0,0 @@
1
- [data-fs-bp-add-product-assortment-drawer] {
2
- @import "@faststore/ui/src/components/atoms/Button/styles.scss";
3
- @import "../../../shared/components/BasicDrawer/basic-drawer.scss";
4
- @import "../../../shared/components/InputText/input-text.scss";
5
- @import "../../../shared/components/InternalSearch/internal-search.scss";
6
- @import "../../../shared/components/ErrorMessage/error-message.scss";
7
- @import "../../../shared/components/Paginator/paginator.scss";
8
- @import "../../components/table/add-product-assortment-drawer-table.scss";
9
-
10
- [data-fs-bp-add-product-assortment-text-drawer] {
11
- display: block;
12
- color: var(--fs-color-neutral-5);
13
- margin-bottom: 1.25rem;
14
- }
15
-
16
- [data-fs-bp-add-product-assortment-wrapper] {
17
- display: flex;
18
- align-items: center;
19
- justify-content: space-between;
20
- height: 2.5rem;
21
-
22
- @include media("<=tablet") {
23
- [data-fs-buyer-portal-internal-search] {
24
- width: 100%;
25
- }
26
-
27
- [data-fs-bp-paginator-counter] {
28
- display: none;
29
- }
30
- }
31
- }
32
-
33
- [data-fs-bp-add-product-assortment-drawer-empty-state] {
34
- display: flex;
35
- flex-direction: column;
36
- justify-content: center;
37
- align-items: center;
38
- gap: var(--fs-spacing-1);
39
- height: 18.75rem;
40
-
41
- color: #858585;
42
- font-weight: var(--fs-text-weight-semibold);
43
-
44
- [data-fs-icon] {
45
- width: var(--fs-spacing-6);
46
- height: var(--fs-spacing-6);
47
- }
48
- }
49
-
50
- [data-fs-bp-drawer-product-assortment-skeleton] {
51
- padding-top: var(--fs-spacing-2);
52
- }
53
-
54
- [data-fs-bp-drawer-product-assortment-paginator] {
55
- display: flex;
56
- align-items: center;
57
- justify-content: space-between;
58
- margin-top: var(--fs-spacing-0);
59
- padding: var(--fs-spacing-2) 0;
60
- }
61
-
62
- [data-fs-bp-add-product-assortment-drawer-footer] {
63
- justify-content: end;
64
- gap: 1.25rem;
65
- }
66
- }
@@ -1,81 +0,0 @@
1
- import { useState } from "react";
2
-
3
- import { useRouter } from "next/router";
4
-
5
- import { useUI } from "@faststore/ui";
6
-
7
- import {
8
- type BasicDrawerProps,
9
- SettingsDrawer,
10
- createListTypeOptions,
11
- } from "../../../shared/components";
12
- import { useSetScopeConfig, SCOPE_KEYS } from "../../../shared/hooks";
13
- import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
14
-
15
- export type CollectionsSettingsDrawerProps = Omit<
16
- BasicDrawerProps,
17
- "children"
18
- > & {
19
- readonly?: boolean;
20
- onUpdate?: () => void;
21
- };
22
-
23
- const COLLECTIONS_LIST_TYPE_OPTIONS = createListTypeOptions("collections");
24
-
25
- export const CollectionsSettingsDrawer = ({
26
- close,
27
- onUpdate,
28
- ...otherProps
29
- }: CollectionsSettingsDrawerProps) => {
30
- const { pushToast } = useUI();
31
- const router = useRouter();
32
-
33
- const [listType, setListType] = useState<"sync" | "custom">("custom");
34
-
35
- const { setScopeConfig, isSetScopeConfigLoading } = useSetScopeConfig({
36
- onSuccess: () => {
37
- pushToast({
38
- message: `Scope configuration updated successfully\n${CHANGES_TIMEOUT_MESSAGE}`,
39
- status: "INFO",
40
- });
41
- onUpdate?.();
42
- close();
43
- },
44
- onError: () => {
45
- pushToast({
46
- message: "Failed to update scope configuration",
47
- status: "ERROR",
48
- });
49
- },
50
- });
51
-
52
- const handleConfirmClick = () => {
53
- setScopeConfig({
54
- customerId: router.query.contractId as string,
55
- unitId: router.query.orgUnitId as string,
56
- scopeName: SCOPE_KEYS.COLLECTIONS,
57
- type: listType,
58
- });
59
- };
60
-
61
- return (
62
- <SettingsDrawer
63
- title="Collections settings"
64
- {...otherProps}
65
- close={close}
66
- onPrimaryAction={handleConfirmClick}
67
- isPrimaryButtonLoading={isSetScopeConfigLoading}
68
- scopeName={SCOPE_KEYS.COLLECTIONS}
69
- onDismiss={close}
70
- data-fs-bp-collections-settings-drawer
71
- >
72
- <SettingsDrawer.ListType
73
- title="List type"
74
- name="collections-list-type"
75
- value={listType}
76
- onChange={setListType}
77
- options={COLLECTIONS_LIST_TYPE_OPTIONS}
78
- />
79
- </SettingsDrawer>
80
- );
81
- };
@@ -1,79 +0,0 @@
1
- import { useRouter } from "next/router";
2
-
3
- import { Link, useUI } from "@faststore/ui";
4
-
5
- import { BasicDrawer } from "../../../shared/components";
6
- import { useBuyerPortal } from "../../../shared/hooks";
7
- import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
8
- import { useRemoveProductAssortmentFromScope } from "../../hooks/useRemoveProductAssortmentFromScope";
9
-
10
- import type { RemoveProductAssortmentDrawerProps } from "../../types";
11
-
12
- export function RemoveProductAssortmentDrawer({
13
- close,
14
- productAssortment,
15
- ...props
16
- }: RemoveProductAssortmentDrawerProps) {
17
- const { pushToast } = useUI();
18
-
19
- const { reload } = useRouter();
20
- const removeAssortmentMutation = useRemoveProductAssortmentFromScope();
21
- const { currentOrgUnit, currentContract } = useBuyerPortal();
22
-
23
- async function handleSuccess() {
24
- await removeAssortmentMutation.mutate({
25
- productAssortmentId: productAssortment.id,
26
- unitId: currentOrgUnit?.id ?? "",
27
- contractId: currentContract?.id ?? "",
28
- });
29
-
30
- pushToast({
31
- message: `Product assortment access removed successfully\n${CHANGES_TIMEOUT_MESSAGE}`,
32
- status: "INFO",
33
- });
34
- close();
35
-
36
- reload();
37
- }
38
-
39
- return (
40
- <BasicDrawer
41
- data-fs-bp-remove-product-assortment-drawer
42
- close={close}
43
- {...props}
44
- >
45
- <BasicDrawer.Heading
46
- title="Remove product assortment from unit"
47
- onClose={close}
48
- />
49
-
50
- <BasicDrawer.Body>
51
- <span>
52
- Remove <Link href="#">{productAssortment.name}</Link> contract from
53
- <Link href="#"> {currentOrgUnit?.name}</Link> organizational unit?
54
- </span>
55
- <span>
56
- This action will prevent users in this unit from accessing this
57
- product assortment during store navigation and checkout.
58
- </span>
59
- </BasicDrawer.Body>
60
-
61
- <BasicDrawer.Footer data-fs-bp-add-product-assortment-drawer-footer>
62
- <BasicDrawer.Button
63
- variant="ghost"
64
- disabled={removeAssortmentMutation.isLoading}
65
- onClick={close}
66
- >
67
- Cancel
68
- </BasicDrawer.Button>
69
- <BasicDrawer.Button
70
- variant="confirm"
71
- isLoading={removeAssortmentMutation.isLoading}
72
- onClick={handleSuccess}
73
- >
74
- Confirm
75
- </BasicDrawer.Button>
76
- </BasicDrawer.Footer>
77
- </BasicDrawer>
78
- );
79
- }
@@ -1,9 +0,0 @@
1
- [data-fs-bp-remove-product-assortment-drawer] {
2
- @import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
3
-
4
- span {
5
- display: block;
6
- color: var(--fs-color-neutral-7);
7
- margin-bottom: 1.25rem;
8
- }
9
- }
@@ -1,124 +0,0 @@
1
- import {
2
- Dispatch,
3
- SetStateAction,
4
- useCallback,
5
- useMemo,
6
- useState,
7
- } from "react";
8
-
9
- import { Checkbox } from "@faststore/ui";
10
-
11
- import { Table } from "../../../shared/components";
12
-
13
- import type { TableColumn } from "../../../shared/components/Table/TableHead/TableHead";
14
- import type { ProductAssortmentWithAdditionalInformation } from "../../types";
15
-
16
- interface AddProductAssortmentDrawerTableProps {
17
- loading?: boolean;
18
- data: ProductAssortmentWithAdditionalInformation[];
19
- onChange: Dispatch<
20
- SetStateAction<ProductAssortmentWithAdditionalInformation[]>
21
- >;
22
- }
23
-
24
- export const AddProductAssortmentDrawerTable = ({
25
- data,
26
- loading,
27
- onChange,
28
- }: AddProductAssortmentDrawerTableProps) => {
29
- const enabledIds = useMemo(
30
- () => data.filter((item) => item.isEnabled).map((item) => item.id),
31
- [data]
32
- );
33
-
34
- const [selectedIds, setSelectedIds] = useState<string[]>(enabledIds);
35
-
36
- const selectableIds = useMemo(
37
- () => data.filter((item) => !item.isEnabled).map((item) => item.id),
38
- [data]
39
- );
40
- const allSelected =
41
- selectableIds.every((id) => selectedIds.includes(id)) &&
42
- selectableIds.length > 0;
43
- const partiallySelected =
44
- selectedIds.some((id) => selectableIds.includes(id)) && !allSelected;
45
-
46
- const handleSelect = useCallback(
47
- (id: string, isEnabled: boolean) => {
48
- if (isEnabled) return;
49
-
50
- const newSelectedIds = selectedIds.includes(id)
51
- ? selectedIds.filter((item) => item !== id)
52
- : [...selectedIds, id];
53
-
54
- setSelectedIds(newSelectedIds);
55
- const selectedItems = data.filter((d) => newSelectedIds.includes(d.id));
56
- onChange(selectedItems);
57
- },
58
- [selectedIds, data, onChange]
59
- );
60
-
61
- const handleSelectAll = useCallback(() => {
62
- const newSelectedIds = allSelected
63
- ? enabledIds
64
- : [...selectableIds, ...enabledIds];
65
- setSelectedIds(newSelectedIds);
66
- const selectedItems = data.filter((d) => newSelectedIds.includes(d.id));
67
- onChange(selectedItems);
68
- }, [allSelected, selectableIds, enabledIds, data, onChange]);
69
-
70
- const columns: TableColumn[] = [
71
- {
72
- key: "check",
73
- align: "center",
74
- size: "2.5rem",
75
- label: (
76
- <Checkbox
77
- data-fs-bp-product-assortment-checkbox
78
- checked={allSelected}
79
- partial={partiallySelected}
80
- onChange={handleSelectAll}
81
- />
82
- ),
83
- },
84
- {
85
- key: "name",
86
- label: "Name",
87
- align: "left",
88
- size: "100%",
89
- },
90
- ];
91
-
92
- return (
93
- <div data-fs-bp-add-product-assortment-drawer-table>
94
- <Table layoutFixed>
95
- <Table.Head columns={columns} />
96
- <Table.Body>
97
- {loading ? (
98
- <Table.Loading columns={columns.length} />
99
- ) : (
100
- data.map((option) => (
101
- <Table.Row
102
- key={option.id}
103
- title={option.name}
104
- iconName="Shapes"
105
- iconSize={24}
106
- selected={selectedIds.includes(option.id)}
107
- prependColumns={
108
- <Table.Cell align="center">
109
- <Checkbox
110
- data-fs-bp-product-assortment-checkbox
111
- checked={selectedIds.includes(option.id)}
112
- disabled={option.isEnabled}
113
- onChange={() => handleSelect(option.id, option.isEnabled)}
114
- />
115
- </Table.Cell>
116
- }
117
- />
118
- ))
119
- )}
120
- </Table.Body>
121
- </Table>
122
- </div>
123
- );
124
- };
@@ -1,14 +0,0 @@
1
- [data-fs-bp-add-product-assortment-drawer-table] {
2
- @import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
3
- @import "../../../shared/components/Table/table.scss";
4
-
5
- margin-top: 1.25rem;
6
-
7
- [data-fs-tooltip] {
8
- --fs-tooltip-background: #1f1f1f;
9
- }
10
-
11
- [data-fs-bp-product-assortment-checkbox] {
12
- margin: 0 auto;
13
- }
14
- }