@vtex/faststore-plugin-buyer-portal 1.0.46 → 1.0.48

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 (165) hide show
  1. package/.github/workflows/release.yaml +1 -1
  2. package/CHANGELOG.md +1 -6
  3. package/package.json +3 -3
  4. package/plugin.config.js +18 -18
  5. package/public/buyer-portal-icons.svg +1 -58
  6. package/src/features/addresses/clients/AddressesClient.ts +18 -6
  7. package/src/features/addresses/components/AddressLine/AddressLine.tsx +1 -1
  8. package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +86 -80
  9. package/src/features/addresses/layouts/AddressesLayout/addresses-layout.scss +12 -5
  10. package/src/features/addresses/services/get-addresses-by-unit-id.service.ts +14 -15
  11. package/src/features/addresses/services/index.ts +0 -4
  12. package/src/features/buying-policies/clients/BuyingPoliciesClient.ts +6 -10
  13. package/src/features/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx +1 -2
  14. package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/BasicBuyingPolicyDrawer.tsx +4 -7
  15. package/src/features/buying-policies/components/UpdateBuyingPolicyDrawer/update-buying-policy-drawer.scss +1 -0
  16. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +30 -35
  17. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/buying-policies-layout.scss +1 -2
  18. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +29 -3
  19. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/buying-policy-details-layout.scss +1 -0
  20. package/src/features/buying-policies/types/BuyingPolicy.ts +9 -4
  21. package/src/features/buying-policies/utils/buyingPoliciesWorkflowTypes.ts +8 -0
  22. package/src/features/buying-policies/utils/buyingPolicyDefault.ts +3 -2
  23. package/src/features/buying-policies/utils/index.ts +4 -0
  24. package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +1 -1
  25. package/src/features/credit-cards/layouts/CreditCardsLayout/credit-card-layout.scss +119 -118
  26. package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +5 -16
  27. package/src/features/org-units/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +0 -1
  28. package/src/features/shared/components/AutocompleteDropdown/AutocompleteDropdown.tsx +12 -29
  29. package/src/features/shared/components/AutocompleteDropdown/autocomplete-dropdown.scss +0 -5
  30. package/src/features/shared/components/BasicDrawer/BasicDrawer.tsx +0 -3
  31. package/src/features/shared/components/BasicDrawer/BasicDrawerButton.tsx +1 -1
  32. package/src/features/shared/components/BasicDrawer/basic-drawer.scss +5 -5
  33. package/src/features/shared/components/HeaderInside/HeaderInside.tsx +2 -2
  34. package/src/features/shared/components/HeaderInside/HeaderInsideButton.tsx +3 -5
  35. package/src/features/shared/components/HeaderInside/header-inside.scss +0 -6
  36. package/src/features/shared/components/InternalSearch/internal-search.scss +1 -1
  37. package/src/features/shared/components/Table/TableHead/table-head.scss +2 -0
  38. package/src/features/shared/components/Table/TableRow/table-row.scss +1 -2
  39. package/src/features/shared/components/VerticalNav/VerticalNavLink.tsx +1 -5
  40. package/src/features/shared/components/VerticalNav/vertical-nav.scss +0 -5
  41. package/src/features/shared/components/index.ts +3 -4
  42. package/src/features/shared/hooks/usePageItems.ts +2 -1
  43. package/src/features/shared/layouts/index.ts +0 -4
  44. package/src/features/shared/utils/api.ts +3 -4
  45. package/src/features/shared/utils/constants.ts +2 -0
  46. package/src/features/shared/utils/getContractSettingsLinks.ts +1 -1
  47. package/src/features/shared/utils/getFinanceSettingsLinks.ts +1 -1
  48. package/src/features/shared/utils/getOrganizationSettingsLinks.ts +1 -1
  49. package/src/features/shared/utils/index.ts +1 -1
  50. package/src/features/users/hooks/useDebouncedSearchOrgUnit.ts +2 -1
  51. package/src/pages/addresses.tsx +30 -8
  52. package/src/pages/org-units.tsx +1 -0
  53. package/src/themes/index.scss +0 -4
  54. package/src/themes/layouts.scss +0 -12
  55. package/src/features/addresses/hooks/useDebouncedSearchAddressByUnitId.ts +0 -26
  56. package/src/features/addresses/hooks/useSearchAddressByUnitId.ts +0 -20
  57. package/src/features/addresses/services/search-address-by-unit-id.service.ts +0 -30
  58. package/src/features/collections/clients/CollectionsClient.ts +0 -101
  59. package/src/features/collections/components/AddCollectionsDrawer/AddCollectionsDrawer.tsx +0 -133
  60. package/src/features/collections/components/AddCollectionsDrawer/add-collections-drawer.scss +0 -56
  61. package/src/features/collections/components/CollectionSearchInput/CollectionSearchInput.tsx +0 -30
  62. package/src/features/collections/components/CollectionsProvider/CollectionsProvider.tsx +0 -67
  63. package/src/features/collections/components/CollectionsTable/CollectionsTable.tsx +0 -115
  64. package/src/features/collections/components/CollectionsTable/collections-table.scss +0 -100
  65. package/src/features/collections/components/EmptyState/EmptyState.tsx +0 -17
  66. package/src/features/collections/components/EmptyState/empty-state.scss +0 -30
  67. package/src/features/collections/components/RemoveCollectionDrawer/RemoveCollectionDrawer.tsx +0 -85
  68. package/src/features/collections/components/RemoveCollectionDrawer/remove-collection-drawer.scss +0 -15
  69. package/src/features/collections/components/index.tsx +0 -5
  70. package/src/features/collections/components/table/AddCollectionsDrawerTable.tsx +0 -110
  71. package/src/features/collections/components/table/add-collections-drawer-table.scss +0 -66
  72. package/src/features/collections/hooks/useAddCollectionsToScope.ts +0 -23
  73. package/src/features/collections/hooks/useCollections.ts +0 -11
  74. package/src/features/collections/hooks/useCollectionsFilter.ts +0 -58
  75. package/src/features/collections/hooks/useGetCollectionsFromContract.ts +0 -24
  76. package/src/features/collections/hooks/useGetCollectionsFromScope.ts +0 -27
  77. package/src/features/collections/hooks/useRemoveCollectionsFromScope.ts +0 -26
  78. package/src/features/collections/layouts/CollectionsLayout/CollectionsLayout.tsx +0 -128
  79. package/src/features/collections/layouts/CollectionsLayout/collections-layout.scss +0 -101
  80. package/src/features/collections/layouts/index.ts +0 -4
  81. package/src/features/collections/mocks/add-collections-data.ts +0 -34
  82. package/src/features/collections/mocks/collections-data.ts +0 -56
  83. package/src/features/collections/mocks/index.ts +0 -1
  84. package/src/features/collections/services/add-collections-to-scope.service.ts +0 -15
  85. package/src/features/collections/services/get-collections-from-contract.service.ts +0 -9
  86. package/src/features/collections/services/get-collections-from-scope.service.ts +0 -32
  87. package/src/features/collections/services/remove-collections-from-scope.ts +0 -7
  88. package/src/features/collections/types/index.ts +0 -20
  89. package/src/features/cost-centers/components/index.ts +0 -0
  90. package/src/features/cost-centers/layouts/CostCentersLayout/CostCentersLayout.tsx +0 -493
  91. package/src/features/cost-centers/layouts/CostCentersLayout/cost-centers-layout.scss +0 -19
  92. package/src/features/cost-centers/layouts/index.ts +0 -1
  93. package/src/features/cost-centers/types/index.ts +0 -5
  94. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +0 -159
  95. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/add-payment-methods-drawer.scss +0 -34
  96. package/src/features/payment-methods/components/RemoveMethodButton/RemoveMethodButton.tsx +0 -32
  97. package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/RemovePaymentMethodsDrawer.tsx +0 -87
  98. package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/remove-payment-methods-drawer.scss +0 -31
  99. package/src/features/payment-methods/components/SearchPaymentMethods/SearchPaymentMethods.tsx +0 -28
  100. package/src/features/payment-methods/components/SearchPaymentMethods/search-payment-methods.scss +0 -15
  101. package/src/features/payment-methods/components/index.ts +0 -4
  102. package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +0 -136
  103. package/src/features/payment-methods/layouts/PaymentMethodsLayout/payment-methods-layout.scss +0 -128
  104. package/src/features/payment-methods/layouts/index.ts +0 -1
  105. package/src/features/payment-methods/mocks/index.ts +0 -1
  106. package/src/features/payment-methods/mocks/payment-methods-data.ts +0 -9
  107. package/src/features/payment-methods/types/PaymentMethod.ts +0 -4
  108. package/src/features/payment-methods/types/index.ts +0 -1
  109. package/src/features/po-numbers/components/index.ts +0 -0
  110. package/src/features/po-numbers/layouts/PoNumbersCentersLayout/PoNumbersCentersLayout.tsx +0 -493
  111. package/src/features/po-numbers/layouts/PoNumbersCentersLayout/po-numbers-layout.scss +0 -19
  112. package/src/features/po-numbers/layouts/index.ts +0 -1
  113. package/src/features/po-numbers/mocks/custom-fields.ts +0 -52
  114. package/src/features/po-numbers/types/index.ts +0 -5
  115. package/src/features/shared/clients/CustomField.ts +0 -250
  116. package/src/features/shared/components/ConditionalTooltip/ConditionalTooltip.tsx +0 -21
  117. package/src/features/shared/components/CustomField/create-custom-field/CreateCustomFieldDrawer.tsx +0 -136
  118. package/src/features/shared/components/CustomField/create-custom-field/create-custom-field-drawer.scss +0 -14
  119. package/src/features/shared/components/CustomField/delete-custom-field/DeleteCustomFieldDrawer.tsx +0 -126
  120. package/src/features/shared/components/CustomField/delete-custom-field/delete-custom-field-drawer.scss +0 -30
  121. package/src/features/shared/components/CustomField/index.ts +0 -6
  122. package/src/features/shared/components/CustomField/selected-card-item/CustomFieldSelectedCardItem.tsx +0 -30
  123. package/src/features/shared/components/CustomField/selected-card-item/custom-field-selected-card-item.scss +0 -53
  124. package/src/features/shared/components/CustomField/settings-drawer/CustomFieldSettingsDrawer.tsx +0 -162
  125. package/src/features/shared/components/CustomField/settings-drawer/custom-field-settings-drawer.scss +0 -100
  126. package/src/features/shared/components/CustomField/table/CustomFieldTable.tsx +0 -236
  127. package/src/features/shared/components/CustomField/table/custom-field-table.scss +0 -133
  128. package/src/features/shared/components/CustomField/update-custom-field/UpdateCustomFieldDrawer.tsx +0 -166
  129. package/src/features/shared/components/CustomField/update-custom-field/update-custom-field-drawer.scss +0 -34
  130. package/src/features/shared/components/ListLine/ListLine.tsx +0 -52
  131. package/src/features/shared/components/ListLine/list-line.scss +0 -49
  132. package/src/features/shared/components/Pagination/Pagination.tsx +0 -35
  133. package/src/features/shared/components/Pagination/pagination.scss +0 -27
  134. package/src/features/shared/components/TextHighlight/TextHighlight.tsx +0 -25
  135. package/src/features/shared/components/pagination/pagination.scss +0 -27
  136. package/src/features/shared/hooks/custom-field/index.ts +0 -10
  137. package/src/features/shared/hooks/custom-field/useAddCustomFieldValueToScope.ts +0 -25
  138. package/src/features/shared/hooks/custom-field/useCreateCustomFieldValue.ts +0 -25
  139. package/src/features/shared/hooks/custom-field/useCustomFieldSettings.ts +0 -18
  140. package/src/features/shared/hooks/custom-field/useCustomFieldValue.ts +0 -20
  141. package/src/features/shared/hooks/custom-field/useCustomFieldsOnContract.ts +0 -18
  142. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValue.ts +0 -25
  143. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValueAndUpdateUnitScope.ts +0 -27
  144. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValueToScope.ts +0 -27
  145. package/src/features/shared/hooks/custom-field/useGetCustomFieldValuesToUnitScope.ts +0 -20
  146. package/src/features/shared/hooks/custom-field/useUpdateCustomFieldSettings.ts +0 -27
  147. package/src/features/shared/hooks/custom-field/useUpdateCustomFieldValue.ts +0 -25
  148. package/src/features/shared/layouts/CustomFieldLayout/CustomFieldLayout.tsx +0 -94
  149. package/src/features/shared/layouts/CustomFieldLayout/custom-field-layout.scss +0 -41
  150. package/src/features/shared/services/custom-field/add-custom-field-value-to-scope.service.ts +0 -26
  151. package/src/features/shared/services/custom-field/create-custom-field-value.service.ts +0 -26
  152. package/src/features/shared/services/custom-field/delete-custom-field-value-and-update-unit-scope.service.ts +0 -26
  153. package/src/features/shared/services/custom-field/delete-custom-field-value-to-unit-scope.service.ts +0 -26
  154. package/src/features/shared/services/custom-field/delete-custom-field-value.service.ts +0 -24
  155. package/src/features/shared/services/custom-field/get-custom-field-settings.service.ts +0 -19
  156. package/src/features/shared/services/custom-field/get-custom-fields-on-contract.service.ts +0 -13
  157. package/src/features/shared/services/custom-field/get-custom-fields-values-to-unit-scope.service.ts +0 -28
  158. package/src/features/shared/services/custom-field/get-custom-fields-values.service.ts +0 -25
  159. package/src/features/shared/services/custom-field/index.ts +0 -54
  160. package/src/features/shared/services/custom-field/update-custom-field-settings.service.ts +0 -26
  161. package/src/features/shared/services/custom-field/update-custom-field-value.service.ts +0 -26
  162. package/src/pages/collections.tsx +0 -59
  163. package/src/pages/cost-centers.tsx +0 -69
  164. package/src/pages/payment-methods.tsx +0 -65
  165. package/src/pages/po-numbers.tsx +0 -69
@@ -4,7 +4,7 @@ name: CD
4
4
  on:
5
5
  push:
6
6
  branches:
7
- - feat/demo
7
+ - main
8
8
 
9
9
  jobs:
10
10
  build:
package/CHANGELOG.md CHANGED
@@ -14,17 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
 
15
15
  ### Added
16
16
 
17
- - Add Buying Policies Page
18
- - Add Buying Policy Details Page
19
- - Add Buying Policy Drawers
20
-
21
- ### Added
22
-
23
17
  - Add Buying Policies Page
24
18
  - Add Buying Policy Details Page
25
19
  - Add Buying Policy Drawers
26
20
  - Add Buying Policy Integrations
27
21
  - Add Pagination Tools
22
+ - Add Address Pagination
28
23
 
29
24
  ### Added
30
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -8,8 +8,8 @@
8
8
  "react-dom": "^19.0.0"
9
9
  },
10
10
  "devDependencies": {
11
- "@faststore/core": "^3.50.1",
12
- "@faststore/ui": "^3.49.1",
11
+ "@faststore/core": "^3.0.147",
12
+ "@faststore/ui": "^3.0.147",
13
13
  "@types/react": "^18.2.42",
14
14
  "next": "13.5.7",
15
15
  "typescript": "4.7.3"
package/plugin.config.js CHANGED
@@ -10,8 +10,6 @@ module.exports = {
10
10
  path: "/buyer-portal/address/[orgUnitId]/[contractId]/[addressId]",
11
11
  appLayout: false,
12
12
  },
13
-
14
- // ----
15
13
  profile: {
16
14
  path: "/buyer-portal/profile/[orgUnitId]/[contractId]",
17
15
  appLayout: false,
@@ -20,26 +18,28 @@ module.exports = {
20
18
  path: "/buyer-portal/addresses/[orgUnitId]/[contractId]",
21
19
  appLayout: false,
22
20
  },
23
- "payment-methods": {
24
- path: "/buyer-portal/payment-methods/[orgUnitId]/[contractId]",
25
- appLayout: false,
26
- },
21
+
22
+ // Theses Routes will be added in the future
23
+ // "payment-methods": {
24
+ // path: "/buyer-portal/payment-methods/[orgUnitId]/[contractId]",
25
+ // appLayout: false,
26
+ // },
27
27
  "credit-cards": {
28
28
  path: "/buyer-portal/credit-cards/[orgUnitId]/[contractId]",
29
29
  appLayout: false,
30
30
  },
31
- collections: {
32
- path: "/buyer-portal/collections/[orgUnitId]/[contractId]",
33
- appLayout: false,
34
- },
35
- "po-numbers": {
36
- path: "/buyer-portal/po-numbers/[orgUnitId]/[contractId]",
37
- appLayout: false,
38
- },
39
- "cost-centers": {
40
- path: "/buyer-portal/cost-centers/[orgUnitId]/[contractId]",
41
- appLayout: false,
42
- },
31
+ // collections: {
32
+ // path: "/buyer-portal/collections/[orgUnitId]/[contractId]",
33
+ // appLayout: false,
34
+ // },
35
+ // "po-numbers": {
36
+ // path: "/buyer-portal/po-numbers/[orgUnitId]/[contractId]",
37
+ // appLayout: false,
38
+ // },
39
+ // "cost-centers": {
40
+ // path: "/buyer-portal/cost-centers/[orgUnitId]/[contractId]",
41
+ // appLayout: false,
42
+ // },
43
43
  // releases: {
44
44
  // path: "/buyer-portal/releases/[orgUnitId]/[contractId]",
45
45
  // appLayout: false,
@@ -1,15 +1,4 @@
1
-
2
1
  <svg style="display:none">
3
-
4
- <symbol
5
- id="Shapes"
6
- viewBox="0 0 19 20"
7
- fill="currentColor"
8
- xmlns="http://www.w3.org/2000/svg"
9
- >
10
- <path fill="currentColor" d="M3.5 9L9 0L14.5 9H3.5ZM14.5 20C13.25 20 12.1875 19.5625 11.3125 18.6875C10.4375 17.8125 10 16.75 10 15.5C10 14.25 10.4375 13.1875 11.3125 12.3125C12.1875 11.4375 13.25 11 14.5 11C15.75 11 16.8125 11.4375 17.6875 12.3125C18.5625 13.1875 19 14.25 19 15.5C19 16.75 18.5625 17.8125 17.6875 18.6875C16.8125 19.5625 15.75 20 14.5 20ZM0 19.5V11.5H8V19.5H0ZM14.5 18C15.2 18 15.7917 17.7583 16.275 17.275C16.7583 16.7917 17 16.2 17 15.5C17 14.8 16.7583 14.2083 16.275 13.725C15.7917 13.2417 15.2 13 14.5 13C13.8 13 13.2083 13.2417 12.725 13.725C12.2417 14.2083 12 14.8 12 15.5C12 16.2 12.2417 16.7917 12.725 17.275C13.2083 17.7583 13.8 18 14.5 18ZM2 17.5H6V13.5H2V17.5ZM7.05 7H10.95L9 3.85L7.05 7Z" />
11
- </symbol>
12
-
13
2
  <symbol id="Active" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
14
3
  viewBox="0 -960 960 960">
15
4
  <path
@@ -25,11 +14,6 @@
25
14
  <path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
26
15
  </symbol>
27
16
 
28
-
29
- <symbol id="DoNotDisturb" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
30
- <path d="M5 11H15V9H5V11ZM10 20C8.61667 20 7.31667 19.7375 6.1 19.2125C4.88333 18.6875 3.825 17.975 2.925 17.075C2.025 16.175 1.3125 15.1167 0.7875 13.9C0.2625 12.6833 0 11.3833 0 10C0 8.61667 0.2625 7.31667 0.7875 6.1C1.3125 4.88333 2.025 3.825 2.925 2.925C3.825 2.025 4.88333 1.3125 6.1 0.7875C7.31667 0.2625 8.61667 0 10 0C11.3833 0 12.6833 0.2625 13.9 0.7875C15.1167 1.3125 16.175 2.025 17.075 2.925C17.975 3.825 18.6875 4.88333 19.2125 6.1C19.7375 7.31667 20 8.61667 20 10C20 11.3833 19.7375 12.6833 19.2125 13.9C18.6875 15.1167 17.975 16.175 17.075 17.075C16.175 17.975 15.1167 18.6875 13.9 19.2125C12.6833 19.7375 11.3833 20 10 20ZM10 18C12.2333 18 14.125 17.225 15.675 15.675C17.225 14.125 18 12.2333 18 10C18 7.76667 17.225 5.875 15.675 4.325C14.125 2.775 12.2333 2 10 2C7.76667 2 5.875 2.775 4.325 4.325C2.775 5.875 2 7.76667 2 10C2 12.2333 2.775 14.125 4.325 15.675C5.875 17.225 7.76667 18 10 18Z"/>
31
- </symbol>
32
-
33
17
  <symbol
34
18
  id="Address" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"
35
19
  fill="currentColor">
@@ -109,15 +93,6 @@
109
93
  d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" />
110
94
  </symbol>
111
95
 
112
- <symbol
113
- id="TableEdit"
114
- xmlns="http://www.w3.org/2000/svg"
115
- viewBox="0 0 24 24"
116
- fill="currentColor"
117
- >
118
- <path d="M5 13H11V9H5V13ZM5 7H19V5H5V7ZM5 21C4.45 21 3.97917 20.8042 3.5875 20.4125C3.19583 20.0208 3 19.55 3 19V5C3 4.45 3.19583 3.97917 3.5875 3.5875C3.97917 3.19583 4.45 3 5 3H19C19.55 3 20.0208 3.19583 20.4125 3.5875C20.8042 3.97917 21 4.45 21 5V11.3C20.6833 11.1667 20.3542 11.0792 20.0125 11.0375C19.6708 10.9958 19.3333 11 19 11.05C18.65 11.1167 18.3125 11.2292 17.9875 11.3875C17.6625 11.5458 17.3667 11.7583 17.1 12.025L16.125 13L11 18.1V21H5ZM5 19H11V15H5V19ZM13 13H16.125L17.1 12.025C17.3667 11.7583 17.6625 11.5458 17.9875 11.3875C18.3125 11.2292 18.65 11.1167 19 11.05V9H13V13ZM13 22V18.925L18.525 13.425C18.675 13.275 18.8417 13.1667 19.025 13.1C19.2083 13.0333 19.3917 13 19.575 13C19.775 13 19.9667 13.0375 20.15 13.1125C20.3333 13.1875 20.5 13.3 20.65 13.45L21.575 14.375C21.7083 14.525 21.8125 14.6917 21.8875 14.875C21.9625 15.0583 22 15.2417 22 15.425C22 15.6083 21.9667 15.7958 21.9 15.9875C21.8333 16.1792 21.725 16.35 21.575 16.5L16.075 22H13ZM14.5 20.5H15.45L18.475 17.45L17.55 16.525L14.5 19.55V20.5ZM18.025 16.975L17.55 16.525L18.475 17.45L18.025 16.975Z" fill="currentColor"/>
119
- </symbol>
120
-
121
96
  <symbol
122
97
  id="FilledFolder"
123
98
  xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="currentColor">
@@ -281,31 +256,6 @@
281
256
  fill="currentColor" />
282
257
  </symbol>
283
258
 
284
- <symbol id="Settings" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
285
- <path
286
- d="M9.25019 22L8.85019 18.8C8.63353 18.7167 8.42936 18.6167 8.23769 18.5C8.04603 18.3833 7.85853 18.2583 7.67519 18.125L4.70019 19.375L1.9502 14.625L4.52519 12.675C4.50853 12.5583 4.50019 12.4458 4.50019 12.3375V11.6625C4.50019 11.5542 4.50853 11.4417 4.52519 11.325L1.9502 9.375L4.70019 4.625L7.67519 5.875C7.85853 5.74167 8.05019 5.61667 8.25019 5.5C8.45019 5.38333 8.65019 5.28333 8.85019 5.2L9.25019 2H14.7502L15.1502 5.2C15.3669 5.28333 15.571 5.38333 15.7627 5.5C15.9544 5.61667 16.1419 5.74167 16.3252 5.875L19.3002 4.625L22.0502 9.375L19.4752 11.325C19.4919 11.4417 19.5002 11.5542 19.5002 11.6625V12.3375C19.5002 12.4458 19.4835 12.5583 19.4502 12.675L22.0252 14.625L19.2752 19.375L16.3252 18.125C16.1419 18.2583 15.9502 18.3833 15.7502 18.5C15.5502 18.6167 15.3502 18.7167 15.1502 18.8L14.7502 22H9.25019ZM11.0002 20H12.9752L13.3252 17.35C13.8419 17.2167 14.321 17.0208 14.7627 16.7625C15.2044 16.5042 15.6085 16.1917 15.9752 15.825L18.4502 16.85L19.4252 15.15L17.2752 13.525C17.3585 13.2917 17.4169 13.0458 17.4502 12.7875C17.4835 12.5292 17.5002 12.2667 17.5002 12C17.5002 11.7333 17.4835 11.4708 17.4502 11.2125C17.4169 10.9542 17.3585 10.7083 17.2752 10.475L19.4252 8.85L18.4502 7.15L15.9752 8.2C15.6085 7.81667 15.2044 7.49583 14.7627 7.2375C14.321 6.97917 13.8419 6.78333 13.3252 6.65L13.0002 4H11.0252L10.6752 6.65C10.1585 6.78333 9.67936 6.97917 9.23769 7.2375C8.79603 7.49583 8.39186 7.80833 8.02519 8.175L5.55019 7.15L4.57519 8.85L6.72519 10.45C6.64186 10.7 6.58353 10.95 6.55019 11.2C6.51686 11.45 6.50019 11.7167 6.50019 12C6.50019 12.2667 6.51686 12.525 6.55019 12.775C6.58353 13.025 6.64186 13.275 6.72519 13.525L4.57519 15.15L5.55019 16.85L8.02519 15.8C8.39186 16.1833 8.79603 16.5042 9.23769 16.7625C9.67936 17.0208 10.1585 17.2167 10.6752 17.35L11.0002 20ZM12.0502 15.5C13.0169 15.5 13.8419 15.1583 14.5252 14.475C15.2085 13.7917 15.5502 12.9667 15.5502 12C15.5502 11.0333 15.2085 10.2083 14.5252 9.525C13.8419 8.84167 13.0169 8.5 12.0502 8.5C11.0669 8.5 10.2377 8.84167 9.56269 9.525C8.88769 10.2083 8.55019 11.0333 8.55019 12C8.55019 12.9667 8.88769 13.7917 9.56269 14.475C10.2377 15.1583 11.0669 15.5 12.0502 15.5Z" fill="currentColor"/>
287
- </symbol>
288
-
289
- <symbol id="FormatSize" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
290
- <path d="M12 16V6H8V4H18V6H14V16H12ZM4.5 16V10H2V8H9V10H6.5V16H4.5Z" fill="currentColor"/>
291
- </symbol>
292
-
293
- <symbol id="BookmarkAdd" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
294
- <path d="M5 17V4.5C5 4.08181 5.14583 3.72375 5.4375 3.42583C5.72917 3.12806 6.08333 2.98611 6.5 3H11V4.5H6.5V14.7708L10 13.375L13.5 14.7708V9H15V17L10 15L5 17ZM14.25 7.25V5.75H12.75V4.25H14.25V2.75H15.75V4.25H17.25V5.75H15.75V7.25H14.25Z" fill="currentColor"/>
295
- </symbol>
296
-
297
- <symbol id="BookmarkRemove" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
298
- <path d="M17.25 5.74995H12.75V4.24995H17.25V5.74995ZM5 17V4.49995C5 4.08176 5.14583 3.7237 5.4375 3.42579C5.72917 3.12801 6.08333 2.98606 6.5 2.99995H11V4.49995H6.5V14.7708L10 13.375L13.5 14.7708V8.99995H15V17L10 15L5 17Z" fill="currentColor"/>
299
- </symbol>
300
-
301
- <symbol id="CircleRemove" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
302
- <path d="M5.83317 10.8332H14.1665V9.1665H5.83317V10.8332ZM9.99984 18.3332C8.84706 18.3332 7.76373 18.1144 6.74984 17.6769C5.73595 17.2394 4.854 16.6457 4.104 15.8957C3.354 15.1457 2.76025 14.2637 2.32275 13.2498C1.88525 12.2359 1.6665 11.1526 1.6665 9.99984C1.6665 8.84706 1.88525 7.76373 2.32275 6.74984C2.76025 5.73595 3.354 4.854 4.104 4.104C4.854 3.354 5.73595 2.76025 6.74984 2.32275C7.76373 1.88525 8.84706 1.6665 9.99984 1.6665C11.1526 1.6665 12.2359 1.88525 13.2498 2.32275C14.2637 2.76025 15.1457 3.354 15.8957 4.104C16.6457 4.854 17.2394 5.73595 17.6769 6.74984C18.1144 7.76373 18.3332 8.84706 18.3332 9.99984C18.3332 11.1526 18.1144 12.2359 17.6769 13.2498C17.2394 14.2637 16.6457 15.1457 15.8957 15.8957C15.1457 16.6457 14.2637 17.2394 13.2498 17.6769C12.2359 18.1144 11.1526 18.3332 9.99984 18.3332ZM9.99984 16.6665C11.8609 16.6665 13.4373 16.0207 14.729 14.729C16.0207 13.4373 16.6665 11.8609 16.6665 9.99984C16.6665 8.13873 16.0207 6.56234 14.729 5.27067C13.4373 3.979 11.8609 3.33317 9.99984 3.33317C8.13873 3.33317 6.56234 3.979 5.27067 5.27067C3.979 6.56234 3.33317 8.13873 3.33317 9.99984C3.33317 11.8609 3.979 13.4373 5.27067 14.729C6.56234 16.0207 8.13873 16.6665 9.99984 16.6665Z" fill="currentColor"/>
303
- </symbol>
304
-
305
- <symbol id="Default" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
306
- <path d="M5 21V5C5 4.45 5.19583 3.97917 5.5875 3.5875C5.97917 3.19583 6.45 3 7 3H17C17.55 3 18.0208 3.19583 18.4125 3.5875C18.8042 3.97917 19 4.45 19 5V21L12 18L5 21ZM7 17.95L12 15.8L17 17.95V5H7V17.95Z" fill="currentColor"/>
307
- </symbol>
308
-
309
259
  <symbol
310
260
  id="ErrorX"
311
261
  xmlns="http://www.w3.org/2000/svg"
@@ -404,11 +354,4 @@
404
354
  fill="currentColor" />
405
355
  </symbol>
406
356
 
407
- <symbol
408
- id="AccountBalanceWallet"
409
- viewBox="0 0 19 18"
410
- fill="none"
411
- xmlns="http://www.w3.org/2000/svg">
412
- <path d="M2 18C1.45 18 0.979167 17.8042 0.5875 17.4125C0.195833 17.0208 0 16.55 0 16V2C0 1.45 0.195833 0.979167 0.5875 0.5875C0.979167 0.195833 1.45 0 2 0H16C16.55 0 17.0208 0.195833 17.4125 0.5875C17.8042 0.979167 18 1.45 18 2V4.5H16V2H2V16H16V13.5H18V16C18 16.55 17.8042 17.0208 17.4125 17.4125C17.0208 17.8042 16.55 18 16 18H2ZM10 14C9.45 14 8.97917 13.8042 8.5875 13.4125C8.19583 13.0208 8 12.55 8 12V6C8 5.45 8.19583 4.97917 8.5875 4.5875C8.97917 4.19583 9.45 4 10 4H17C17.55 4 18.0208 4.19583 18.4125 4.5875C18.8042 4.97917 19 5.45 19 6V12C19 12.55 18.8042 13.0208 18.4125 13.4125C18.0208 13.8042 17.55 14 17 14H10ZM17 12V6H10V12H17ZM13 10.5C13.4167 10.5 13.7708 10.3542 14.0625 10.0625C14.3542 9.77083 14.5 9.41667 14.5 9C14.5 8.58333 14.3542 8.22917 14.0625 7.9375C13.7708 7.64583 13.4167 7.5 13 7.5C12.5833 7.5 12.2292 7.64583 11.9375 7.9375C11.6458 8.22917 11.5 8.58333 11.5 9C11.5 9.41667 11.6458 9.77083 11.9375 10.0625C12.2292 10.3542 12.5833 10.5 13 10.5Z" fill="currentColor"/>
413
- </symbol>
414
- </svg>
357
+ </svg>
@@ -2,8 +2,9 @@ import { Client } from "../../shared/clients/Client";
2
2
  import { getApiUrl } from "../../shared/utils";
3
3
  import type { AddressData, AddressInput } from "../types";
4
4
 
5
- type AddressList = {
5
+ type AddressResponse = {
6
6
  addresses: AddressData[];
7
+ total: number;
7
8
  };
8
9
 
9
10
  export default class AddressesClient extends Client {
@@ -12,16 +13,27 @@ export default class AddressesClient extends Client {
12
13
  }
13
14
 
14
15
  getAddressesByCustomerId(customerId: string, cookie: string) {
15
- return this.get<AddressList>(`addresses/${customerId}`, {
16
+ return this.get<AddressResponse>(`addresses/${customerId}`, {
16
17
  headers: {
17
18
  Cookie: cookie,
18
19
  },
19
20
  });
20
21
  }
21
22
 
22
- getAddressesByUnitId(orgUnitId: string, cookie: string, name?: string) {
23
- const url = `unit/addresses/${orgUnitId}` + (name ? `?name=${name}` : "");
24
- return this.get<AddressList>(url, {
23
+ getAddressesByUnitId(
24
+ orgUnitId: string,
25
+ cookie: string,
26
+ name?: string,
27
+ page = 1
28
+ ) {
29
+ const params = new URLSearchParams();
30
+ if (name) params.append("name", name);
31
+ if (page && page > 1) params.append("page", String(page));
32
+ const queryString = params.toString();
33
+
34
+ const url = `unit/addresses/${orgUnitId}?${queryString}`;
35
+
36
+ return this.get<AddressResponse>(url, {
25
37
  headers: {
26
38
  Cookie: cookie,
27
39
  },
@@ -37,7 +49,7 @@ export default class AddressesClient extends Client {
37
49
  }
38
50
 
39
51
  searchAddressesByName(customerId: string, name: string, cookie: string) {
40
- return this.get<AddressList>(
52
+ return this.get<AddressResponse>(
41
53
  `search/addresses/${customerId}?name=${name}`,
42
54
  {
43
55
  headers: {
@@ -1,4 +1,4 @@
1
- import { Dropdown } from "@faststore/ui";
1
+ import { Toggle, Dropdown, DropdownButton } from "@faststore/ui";
2
2
  import Link from "next/link";
3
3
  import { BasicDropdownMenu, Icon, Tag } from "../../../shared/components";
4
4
  import type { AddressData } from "../../types";
@@ -1,28 +1,42 @@
1
- import { use, useEffect, useState } from "react";
2
- import { InternalSearch, HeaderInside } from "../../../shared/components";
3
1
  import {
4
- useQueryParams,
5
- useDrawerProps,
6
- useBuyerPortal,
7
- } from "../../../shared/hooks";
2
+ InternalSearch,
3
+ HeaderInside,
4
+ Paginator,
5
+ } from "../../../shared/components";
6
+ import { useDrawerProps, useBuyerPortal } from "../../../shared/hooks";
8
7
  import { ContractTabsLayout, GlobalLayout } from "../../../shared/layouts";
9
8
  import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
10
9
  import { AddressDropdownMenu, CreateAddressDrawer } from "../../components";
11
10
  import type { AddressData } from "../../types";
12
- import { useDebouncedSearchAddressByUnitId } from "../../hooks/useDebouncedSearchAddressByUnitId";
13
11
  import { Table } from "../../../shared/components/Table/Table";
14
12
  import { EmptyState } from "../../../shared/components/EmptyState/EmptyState";
15
13
  import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
14
+ import { usePageItems } from "../../../shared/hooks/usePageItems";
16
15
 
17
16
  export type AddressLayoutProps = {
18
- data: AddressData[];
19
- search?: string;
17
+ addresses: AddressData[];
18
+ total: number;
19
+ search: string;
20
+ page: number;
20
21
  };
21
22
 
22
- export const AddressLayout = ({ data, search }: AddressLayoutProps) => {
23
- const [addressesData, setAddressesData] = useState<AddressData[]>(data);
24
- const [querySearch, setQuerySearch] = useState(search ?? "");
25
- const { setQueryString, removeQueryString } = useQueryParams();
23
+ export const AddressLayout = ({
24
+ addresses: initialAddresses,
25
+ search,
26
+ total,
27
+ page,
28
+ }: AddressLayoutProps) => {
29
+ const {
30
+ isLoading,
31
+ items: addresses,
32
+ searchTerm,
33
+ setSearchTerm,
34
+ increasePage,
35
+ } = usePageItems<AddressData>({
36
+ initialItems: initialAddresses,
37
+ search,
38
+ page,
39
+ });
26
40
 
27
41
  const {
28
42
  open: openCreateDrawer,
@@ -36,28 +50,6 @@ export const AddressLayout = ({ data, search }: AddressLayoutProps) => {
36
50
  currentContract: contract,
37
51
  } = useBuyerPortal();
38
52
 
39
- const { searchedAddresses, isLoading } = useDebouncedSearchAddressByUnitId(
40
- querySearch,
41
- orgUnit?.id ?? ""
42
- );
43
-
44
- useEffect(() => {
45
- if (!isLoading && querySearch.length > 0) {
46
- setAddressesData(searchedAddresses);
47
- }
48
- }, [searchedAddresses, querySearch, isLoading]);
49
-
50
- const handleSearch = (searchTerm: string) => {
51
- setQuerySearch(searchTerm);
52
-
53
- if (searchTerm) {
54
- setQueryString("search", searchTerm);
55
- } else {
56
- removeQueryString("search");
57
- setAddressesData(data);
58
- }
59
- };
60
-
61
53
  return (
62
54
  <GlobalLayout>
63
55
  <ContractTabsLayout
@@ -73,23 +65,26 @@ export const AddressLayout = ({ data, search }: AddressLayoutProps) => {
73
65
  }}
74
66
  >
75
67
  <section data-fs-addresses-section>
76
- <HeaderInside title="Addresses">
68
+ <HeaderInside title="Address">
77
69
  <HeaderInside.Button onClick={openCreateDrawer} />
78
70
  </HeaderInside>
79
71
 
80
- {data.length === 0 ? (
72
+ {addresses.length === 0 && !isLoading && searchTerm.length === 0 ? (
81
73
  <EmptyState title="No addresses yet" iconName="LocalPostOffice" />
82
74
  ) : (
83
75
  <>
84
76
  <div data-fs-buyer-portal-address-filter>
85
77
  <InternalSearch
86
- defaultValue={querySearch}
87
- textSearch={handleSearch}
78
+ defaultValue={searchTerm}
79
+ textSearch={setSearchTerm}
80
+ />
81
+
82
+ <Paginator.Counter
83
+ total={total}
84
+ itemsLength={addresses.length}
88
85
  />
89
86
  </div>
90
- {!isLoading &&
91
- addressesData.length === 0 &&
92
- querySearch.length > 0 ? (
87
+ {!isLoading && addresses.length === 0 && searchTerm.length > 0 ? (
93
88
  <EmptyState
94
89
  title="No results found"
95
90
  description="Try using different terms or filters"
@@ -98,46 +93,57 @@ export const AddressLayout = ({ data, search }: AddressLayoutProps) => {
98
93
  <div data-fs-addresses-table>
99
94
  <Table>
100
95
  <Table.Head columns={getTableColumns({ withType: true })} />
101
- {isLoading ? (
102
- <Table.Body>
103
- <Table.Loading />
104
- </Table.Body>
105
- ) : (
106
- <Table.Body>
107
- {addressesData.map(({ id, ...address }) => (
108
- <Table.Row
109
- key={id}
110
- title={address.name}
111
- searchTerm={querySearch}
112
- iconName="LocalPostOffice"
113
- iconSize={20}
114
- children={
115
- Array.isArray(address.types) &&
116
- address.types.length > 0
117
- ? address.types.map((type) => (
118
- <span key={type}>{type}</span>
119
- ))
120
- : null
121
- }
122
- href={buyerPortalRoutes.addressDetails({
123
- orgUnitId: orgUnit?.id ?? "",
124
- contractId: contract?.id ?? "",
125
- addressId: id,
126
- })}
127
- dropdownMenu={
128
- <AddressDropdownMenu
129
- currentAddress={{
130
- id,
131
- ...address,
132
- }}
133
- />
134
- }
135
- />
136
- ))}
137
- </Table.Body>
138
- )}
96
+
97
+ <Table.Body>
98
+ {addresses.map(({ id, ...address }) => (
99
+ <Table.Row
100
+ key={id}
101
+ title={address.name}
102
+ searchTerm={search}
103
+ iconName="LocalPostOffice"
104
+ iconSize={20}
105
+ children={
106
+ Array.isArray(address.types) &&
107
+ address.types.length > 0
108
+ ? address.types.map((type) => (
109
+ <span key={type}>{type}</span>
110
+ ))
111
+ : null
112
+ }
113
+ href={buyerPortalRoutes.addressDetails({
114
+ orgUnitId: orgUnit?.id ?? "",
115
+ contractId: contract?.id ?? "",
116
+ addressId: id,
117
+ })}
118
+ dropdownMenu={
119
+ <AddressDropdownMenu
120
+ currentAddress={{
121
+ id,
122
+ ...address,
123
+ }}
124
+ />
125
+ }
126
+ />
127
+ ))}
128
+ </Table.Body>
139
129
  </Table>
140
130
 
131
+ <div data-fs-bp-addresses-paginator>
132
+ {total > addresses.length && (
133
+ <Paginator.NextPageButton
134
+ onClick={increasePage}
135
+ disabled={isLoading}
136
+ >
137
+ {isLoading ? "Loading" : "Load More"}
138
+ </Paginator.NextPageButton>
139
+ )}
140
+
141
+ <Paginator.Counter
142
+ total={total}
143
+ itemsLength={addresses.length}
144
+ />
145
+ </div>
146
+
141
147
  {isCreateAddressDrawerOpen && (
142
148
  <CreateAddressDrawer
143
149
  readonly
@@ -12,8 +12,9 @@
12
12
  @import "../../../shared/components/HeaderInside/header-inside.scss";
13
13
  @import "../../../shared/components/Table/table.scss";
14
14
  @import "../../../shared/components/EmptyState/empty-state.scss";
15
+ @import "../../../shared/components/Paginator/paginator.scss";
15
16
 
16
- padding: 0 calc(var(--fs-spacing-9) - var(--fs-spacing-0));
17
+ padding: calc(var(--fs-spacing-9) - var(--fs-spacing-0));
17
18
  display: flex;
18
19
  flex-direction: column;
19
20
  height: 100%;
@@ -62,7 +63,7 @@
62
63
  [data-fs-buyer-portal-address-filter] {
63
64
  display: flex;
64
65
  justify-content: space-between;
65
- padding-bottom: var(--fs-spacing-4);
66
+ padding: 0 0 var(--fs-spacing-4);
66
67
  }
67
68
 
68
69
  [data-fs-buyer-portal-address-filter-search-container] {
@@ -70,9 +71,15 @@
70
71
  gap: var(--fs-spacing-1);
71
72
  }
72
73
 
73
- [data-fs-addresses-list] {
74
- width: 100%;
74
+ [data-fs-addresses-table] {
75
+ padding-bottom: var(--fs-spacing-9);
76
+ }
77
+
78
+ [data-fs-bp-addresses-paginator] {
75
79
  display: flex;
76
- flex-direction: column;
80
+ align-items: center;
81
+ justify-content: space-between;
82
+ margin-top: var(--fs-spacing-0);
83
+ padding: var(--fs-spacing-2) 0;
77
84
  }
78
85
  }
@@ -8,6 +8,7 @@ export type GetAddressesByUnitIdServiceProps = Partial<{
8
8
  status: string;
9
9
  type: string;
10
10
  sort: string;
11
+ page?: number;
11
12
  }> & {
12
13
  cookie: string;
13
14
  };
@@ -18,24 +19,20 @@ export const getAddressesByUnitIdService = async ({
18
19
  type,
19
20
  sort,
20
21
  cookie,
21
- }: GetAddressesByUnitIdServiceProps): Promise<AddressData[]> => {
22
+ search = "",
23
+ page = 1,
24
+ }: GetAddressesByUnitIdServiceProps) => {
22
25
  if (!orgUnitId) {
23
- return [];
26
+ return { data: [], total: 0 };
24
27
  }
28
+ const { addresses, total } = await addressesClient.getAddressesByUnitId(
29
+ orgUnitId,
30
+ cookie,
31
+ search,
32
+ page
33
+ );
25
34
 
26
- const addressesData: AddressData[] = [];
27
-
28
- try {
29
- const { addresses = [] } = await addressesClient.getAddressesByUnitId(
30
- orgUnitId,
31
- cookie
32
- );
33
- addressesData.push(...addresses);
34
- } catch (err) {
35
- throw new Error(JSON.stringify(err));
36
- }
37
-
38
- return addressesData
35
+ const formattedAddress = addresses
39
36
  ?.filter((address) => {
40
37
  const matchesStatus =
41
38
  !status || address.isActive === statusFilters[status];
@@ -44,4 +41,6 @@ export const getAddressesByUnitIdService = async ({
44
41
  return matchesStatus && matchesType;
45
42
  })
46
43
  .sort((a, b) => compareItems(a, b, sort));
44
+
45
+ return { data: formattedAddress, total };
47
46
  };
@@ -19,10 +19,6 @@ export {
19
19
  searchAddressByNameService,
20
20
  type SearchAddressByNameProps,
21
21
  } from "./search-address-by-name.service";
22
- export {
23
- searchAddressByUnitIdService,
24
- type SearchAddressByUnitIdProps,
25
- } from "./search-address-by-unit-id.service";
26
22
  export {
27
23
  editAddressService,
28
24
  type EditAddressServiceProps,
@@ -18,20 +18,16 @@ class BuyingPoliciesClient extends Client {
18
18
  if (search) params.append("search", search);
19
19
  if (page && page > 1) params.append("page", String(page));
20
20
  const queryString = params.toString();
21
+ const query = queryString ? `?${queryString}` : "";
21
22
 
22
23
  return this.get<{
23
24
  data: BuyingPolicy[];
24
25
  total: number;
25
- }>(
26
- `customers/${customerId}/units/${orgUnitId}/buying-policies${
27
- queryString && `?${queryString}`
28
- }`,
29
- {
30
- headers: {
31
- Cookie: cookie,
32
- },
33
- }
34
- );
26
+ }>(`customers/${customerId}/units/${orgUnitId}/buying-policies${query}`, {
27
+ headers: {
28
+ Cookie: cookie,
29
+ },
30
+ });
35
31
  }
36
32
 
37
33
  getBuyingPolicyById(
@@ -54,8 +54,7 @@ export const AddBuyingPolicyDrawer = ({
54
54
 
55
55
  const { addBuyingPolicy, isAddBuyingPolicyLoading } = useAddBuyingPolicy({
56
56
  onSuccess: handleAddBuyingPolicySuccess,
57
- onError: (err) => {
58
- // TODO: Handle error
57
+ onError: () => {
59
58
  pushToast({
60
59
  message: "Error adding buying policy",
61
60
  status: "ERROR",