@vtex/faststore-plugin-buyer-portal 1.3.38 → 1.3.39

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.39] - 2025-12-09
11
+
12
+ ### Added
13
+
14
+ - Add empty state to Payment Methods
15
+
10
16
  ## [1.3.38] - 2025-12-08
11
17
 
12
18
  ### Added
@@ -346,7 +352,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
346
352
  - Add CHANGELOG file
347
353
  - Add README file
348
354
 
349
- [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.38...HEAD
355
+ [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.39...HEAD
350
356
  [1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.2.2...1.2.3
351
357
  [1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.3
352
358
  [1.2.4]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.4
@@ -388,6 +394,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
388
394
  > > > > > > > main
389
395
  > > > > > > > [1.3.11]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.11
390
396
 
397
+ [1.3.39]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.38...v1.3.39
391
398
  [1.3.38]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.37...v1.3.38
392
399
  [1.3.37]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.36...v1.3.37
393
400
  [1.3.36]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.35...v1.3.36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.3.38",
3
+ "version": "1.3.39",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@ export const PaymentMethodsLayout = ({
45
45
  setSelectedMethod(undefined);
46
46
  });
47
47
 
48
- const isLastPage = data.paging.pages === page;
48
+ const isLastPage = data.paging.pages === page || data.paging.pages === 0;
49
49
 
50
50
  const {
51
51
  isLoading,
@@ -180,35 +180,37 @@ export const PaymentMethodsLayout = ({
180
180
 
181
181
  {renderContent()}
182
182
 
183
- <div data-fs-bp-payment-methods-paginator>
184
- {data.paging.page > 1 ? (
185
- <Paginator.NextPageButton
186
- onClick={decreasePage}
187
- disabled={isLoading}
188
- >
189
- {isLoading ? "Loading" : "Previous Page"}
190
- </Paginator.NextPageButton>
191
- ) : (
192
- <></>
193
- )}
194
- {!isLastPage ? (
195
- <Paginator.NextPageButton
196
- onClick={increasePage}
197
- disabled={isLoading}
198
- >
199
- {isLoading ? "Loading" : "Next Page"}
200
- </Paginator.NextPageButton>
201
- ) : (
202
- <></>
203
- )}
204
-
205
- <Paginator.Counter
206
- total={data.paging.total}
207
- itemsLength={
208
- isLastPage ? data.paging.total : page * data.paging.perPage
209
- }
210
- />
211
- </div>
183
+ {!isLoading && paymentMethods.length > 0 && (
184
+ <div data-fs-bp-payment-methods-paginator>
185
+ {data.paging.page > 1 ? (
186
+ <Paginator.NextPageButton
187
+ onClick={decreasePage}
188
+ disabled={isLoading}
189
+ >
190
+ {isLoading ? "Loading" : "Previous Page"}
191
+ </Paginator.NextPageButton>
192
+ ) : (
193
+ <></>
194
+ )}
195
+ {!isLastPage ? (
196
+ <Paginator.NextPageButton
197
+ onClick={increasePage}
198
+ disabled={isLoading}
199
+ >
200
+ {isLoading ? "Loading" : "Next Page"}
201
+ </Paginator.NextPageButton>
202
+ ) : (
203
+ <></>
204
+ )}
205
+
206
+ <Paginator.Counter
207
+ total={data.paging.total}
208
+ itemsLength={
209
+ isLastPage ? data.paging.total : page * data.paging.perPage
210
+ }
211
+ />
212
+ </div>
213
+ )}
212
214
 
213
215
  {!isLoading && (
214
216
  <p data-fs-bp-payment-methods-search-container-counter-bottom>
@@ -29,7 +29,6 @@ export class ProductAssortmentClient extends Client {
29
29
  headers: { Cookie: cookie },
30
30
  params: {
31
31
  ...(name ? { name } : undefined),
32
- filterByScope: true,
33
32
  ...(page ? { page } : undefined),
34
33
  },
35
34
  }
@@ -43,7 +43,9 @@ export const ProductAssortmentLayout = ({
43
43
  page,
44
44
  });
45
45
 
46
- const isLastPage = initialProductAssortment.paging.pages === page;
46
+ const isLastPage =
47
+ initialProductAssortment.paging.pages === page ||
48
+ initialProductAssortment.paging.pages === 0;
47
49
 
48
50
  const {
49
51
  open: openAddProductAssortmentDrawer,
@@ -53,6 +55,18 @@ export const ProductAssortmentLayout = ({
53
55
 
54
56
  //const enabledAssortment = productAssortment.filter((p) => p.isEnabled);
55
57
  const hasAllAssortment = drawerProductAssortment.items.length === 0;
58
+ const isEmpty = productAssortment.length === 0;
59
+
60
+ const renderEmpty = () => (
61
+ <EmptyState
62
+ title="No results found"
63
+ description={
64
+ searchTerm.length > 0
65
+ ? "Try using different terms"
66
+ : "No Product Assorments found"
67
+ }
68
+ />
69
+ );
56
70
 
57
71
  return (
58
72
  <GlobalLayout>
@@ -114,41 +128,47 @@ export const ProductAssortmentLayout = ({
114
128
  />
115
129
  </div>
116
130
 
117
- <section>
118
- <ProductAssortmentTable productAssortment={productAssortment} />
131
+ {!isLoading && productAssortment.length === 0 ? (
132
+ renderEmpty()
133
+ ) : (
134
+ <section>
135
+ <ProductAssortmentTable
136
+ productAssortment={productAssortment}
137
+ />
119
138
 
120
- <div data-fs-bp-product-assortment-paginator>
121
- {initialProductAssortment.paging.page > 1 ? (
122
- <Paginator.NextPageButton
123
- onClick={decreasePage}
124
- disabled={isLoading}
125
- >
126
- {isLoading ? "Loading" : "Previous Page"}
127
- </Paginator.NextPageButton>
128
- ) : (
129
- <></>
130
- )}
131
- {!isLastPage ? (
132
- <Paginator.NextPageButton
133
- onClick={increasePage}
134
- disabled={isLoading}
135
- >
136
- {isLoading ? "Loading" : "Next Page"}
137
- </Paginator.NextPageButton>
138
- ) : (
139
- <></>
140
- )}
139
+ <div data-fs-bp-product-assortment-paginator>
140
+ {initialProductAssortment.paging.page > 1 ? (
141
+ <Paginator.NextPageButton
142
+ onClick={decreasePage}
143
+ disabled={isLoading}
144
+ >
145
+ {isLoading ? "Loading" : "Previous Page"}
146
+ </Paginator.NextPageButton>
147
+ ) : (
148
+ <></>
149
+ )}
150
+ {!isLastPage && !isEmpty ? (
151
+ <Paginator.NextPageButton
152
+ onClick={increasePage}
153
+ disabled={isLoading}
154
+ >
155
+ {isLoading ? "Loading" : "Next Page"}
156
+ </Paginator.NextPageButton>
157
+ ) : (
158
+ <></>
159
+ )}
141
160
 
142
- <Paginator.Counter
143
- total={initialProductAssortment.paging.total}
144
- itemsLength={
145
- isLastPage
146
- ? initialProductAssortment.paging.total
147
- : page * initialProductAssortment.paging.perPage
148
- }
149
- />
150
- </div>
151
- </section>
161
+ <Paginator.Counter
162
+ total={initialProductAssortment.paging.total}
163
+ itemsLength={
164
+ isLastPage
165
+ ? initialProductAssortment.paging.total
166
+ : page * initialProductAssortment.paging.perPage
167
+ }
168
+ />
169
+ </div>
170
+ </section>
171
+ )}
152
172
  </div>
153
173
  )}
154
174
  </section>
@@ -13,4 +13,4 @@ export const LOCAL_STORAGE_LOCATION_EDIT_KEY = "bp_hide_edit_location_confirm";
13
13
  export const LOCAL_STORAGE_RECIPIENT_EDIT_KEY =
14
14
  "bp_hide_edit_recipient_confirm";
15
15
 
16
- export const CURRENT_VERSION = "1.3.38";
16
+ export const CURRENT_VERSION = "1.3.39";