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

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 (196) hide show
  1. package/.github/workflows/release.yaml +1 -1
  2. package/CHANGELOG.md +9 -0
  3. package/package.json +3 -3
  4. package/plugin.config.js +18 -18
  5. package/public/buyer-portal-icons.svg +69 -5
  6. package/src/features/addresses/clients/AddressesClient.ts +0 -1
  7. package/src/features/addresses/components/AddressLine/AddressLine.tsx +1 -1
  8. package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +5 -2
  9. package/src/features/buying-policies/clients/BuyingPoliciesClient.ts +127 -0
  10. package/src/features/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx +84 -0
  11. package/src/features/buying-policies/components/AddBuyingPolicyDrawer/add-buying-policy-drawer.scss +1 -0
  12. package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/BasicBuyingPolicyDrawer.tsx +387 -0
  13. package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/basic-buying-policy-drawer.scss +103 -0
  14. package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu.tsx +82 -16
  15. package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/buying-policy-dropdown-menu.scss +2 -0
  16. package/src/features/buying-policies/components/DeleteBuyingPolicyDrawer/DeleteBuyingPolicyDrawer.tsx +117 -0
  17. package/src/features/buying-policies/components/DeleteBuyingPolicyDrawer/delete-buying-policy-drawer.scss +5 -0
  18. package/src/features/buying-policies/components/UpdateBuyingPolicyDrawer/UpdateBuyingPolicyDrawer.tsx +98 -0
  19. package/src/features/buying-policies/components/UpdateBuyingPolicyDrawer/update-buying-policy-drawer.scss +0 -0
  20. package/src/features/buying-policies/components/index.ts +18 -0
  21. package/src/features/buying-policies/hooks/index.ts +4 -0
  22. package/src/features/buying-policies/hooks/useAddBuyingPolicy.ts +26 -0
  23. package/src/features/buying-policies/hooks/useGetBuyingPolicies.ts +32 -0
  24. package/src/features/buying-policies/hooks/useGetBuyingPolicy.ts +27 -0
  25. package/src/features/buying-policies/hooks/useRemoveBuyingPolicy.ts +26 -0
  26. package/src/features/buying-policies/hooks/useUpdateBuyingPolicy.ts +26 -0
  27. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +97 -33
  28. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/buying-policies-layout.scss +12 -2
  29. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +15 -10
  30. package/src/features/buying-policies/mocks/buying-policy-data.ts +41 -21
  31. package/src/features/buying-policies/services/add-buying-policy.service.ts +25 -0
  32. package/src/features/buying-policies/services/get-buying-policies.service.ts +25 -0
  33. package/src/features/buying-policies/services/get-buying-policy.service.ts +22 -0
  34. package/src/features/buying-policies/services/index.ts +24 -0
  35. package/src/features/buying-policies/services/remove-buying-policy.service.ts +24 -0
  36. package/src/features/buying-policies/services/update-buying-policy.service.ts +28 -0
  37. package/src/features/buying-policies/types/BuyingPolicy.ts +19 -0
  38. package/src/features/buying-policies/types/index.ts +1 -1
  39. package/src/features/buying-policies/utils/buyingPolicyDefault.ts +17 -0
  40. package/src/features/buying-policies/utils/index.ts +3 -0
  41. package/src/features/buying-policies/utils/orderFieldsCriteriaOptions.ts +47 -0
  42. package/src/features/buying-policies/utils/spendingLimitsCriteriaOptions.ts +27 -0
  43. package/src/features/collections/clients/CollectionsClient.ts +101 -0
  44. package/src/features/collections/components/AddCollectionsDrawer/AddCollectionsDrawer.tsx +133 -0
  45. package/src/features/collections/components/AddCollectionsDrawer/add-collections-drawer.scss +56 -0
  46. package/src/features/collections/components/CollectionSearchInput/CollectionSearchInput.tsx +30 -0
  47. package/src/features/collections/components/CollectionsProvider/CollectionsProvider.tsx +67 -0
  48. package/src/features/collections/components/CollectionsTable/CollectionsTable.tsx +115 -0
  49. package/src/features/collections/components/CollectionsTable/collections-table.scss +100 -0
  50. package/src/features/collections/components/EmptyState/EmptyState.tsx +17 -0
  51. package/src/features/collections/components/EmptyState/empty-state.scss +30 -0
  52. package/src/features/collections/components/RemoveCollectionDrawer/RemoveCollectionDrawer.tsx +85 -0
  53. package/src/features/collections/components/RemoveCollectionDrawer/remove-collection-drawer.scss +15 -0
  54. package/src/features/collections/components/index.tsx +5 -0
  55. package/src/features/collections/components/table/AddCollectionsDrawerTable.tsx +110 -0
  56. package/src/features/collections/components/table/add-collections-drawer-table.scss +66 -0
  57. package/src/features/collections/hooks/useAddCollectionsToScope.ts +23 -0
  58. package/src/features/collections/hooks/useCollections.ts +11 -0
  59. package/src/features/collections/hooks/useCollectionsFilter.ts +58 -0
  60. package/src/features/collections/hooks/useGetCollectionsFromContract.ts +24 -0
  61. package/src/features/collections/hooks/useGetCollectionsFromScope.ts +27 -0
  62. package/src/features/collections/hooks/useRemoveCollectionsFromScope.ts +26 -0
  63. package/src/features/collections/layouts/CollectionsLayout/CollectionsLayout.tsx +128 -0
  64. package/src/features/collections/layouts/CollectionsLayout/collections-layout.scss +101 -0
  65. package/src/features/collections/layouts/index.ts +4 -0
  66. package/src/features/collections/mocks/add-collections-data.ts +34 -0
  67. package/src/features/collections/mocks/collections-data.ts +56 -0
  68. package/src/features/collections/mocks/index.ts +1 -0
  69. package/src/features/collections/services/add-collections-to-scope.service.ts +15 -0
  70. package/src/features/collections/services/get-collections-from-contract.service.ts +9 -0
  71. package/src/features/collections/services/get-collections-from-scope.service.ts +32 -0
  72. package/src/features/collections/services/remove-collections-from-scope.ts +7 -0
  73. package/src/features/collections/types/index.ts +20 -0
  74. package/src/features/cost-centers/components/index.ts +0 -0
  75. package/src/features/cost-centers/layouts/CostCentersLayout/CostCentersLayout.tsx +493 -0
  76. package/src/features/cost-centers/layouts/CostCentersLayout/cost-centers-layout.scss +19 -0
  77. package/src/features/cost-centers/layouts/index.ts +1 -0
  78. package/src/features/cost-centers/types/index.ts +5 -0
  79. package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +1 -1
  80. package/src/features/credit-cards/layouts/CreditCardsLayout/credit-card-layout.scss +118 -119
  81. package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +16 -5
  82. package/src/features/org-units/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +1 -0
  83. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +159 -0
  84. package/src/features/payment-methods/components/AddPaymentMethodsDrawer/add-payment-methods-drawer.scss +34 -0
  85. package/src/features/payment-methods/components/RemoveMethodButton/RemoveMethodButton.tsx +32 -0
  86. package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/RemovePaymentMethodsDrawer.tsx +87 -0
  87. package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/remove-payment-methods-drawer.scss +31 -0
  88. package/src/features/payment-methods/components/SearchPaymentMethods/SearchPaymentMethods.tsx +28 -0
  89. package/src/features/payment-methods/components/SearchPaymentMethods/search-payment-methods.scss +15 -0
  90. package/src/features/payment-methods/components/index.ts +4 -0
  91. package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +136 -0
  92. package/src/features/payment-methods/layouts/PaymentMethodsLayout/payment-methods-layout.scss +128 -0
  93. package/src/features/payment-methods/layouts/index.ts +1 -0
  94. package/src/features/payment-methods/mocks/index.ts +1 -0
  95. package/src/features/payment-methods/mocks/payment-methods-data.ts +9 -0
  96. package/src/features/payment-methods/types/PaymentMethod.ts +4 -0
  97. package/src/features/payment-methods/types/index.ts +1 -0
  98. package/src/features/po-numbers/components/index.ts +0 -0
  99. package/src/features/po-numbers/layouts/PoNumbersCentersLayout/PoNumbersCentersLayout.tsx +493 -0
  100. package/src/features/po-numbers/layouts/PoNumbersCentersLayout/po-numbers-layout.scss +19 -0
  101. package/src/features/po-numbers/layouts/index.ts +1 -0
  102. package/src/features/po-numbers/mocks/custom-fields.ts +52 -0
  103. package/src/features/po-numbers/types/index.ts +5 -0
  104. package/src/features/shared/clients/CustomField.ts +250 -0
  105. package/src/features/shared/components/AutocompleteDropdown/AutocompleteDropdown.tsx +30 -13
  106. package/src/features/shared/components/AutocompleteDropdown/autocomplete-dropdown.scss +5 -0
  107. package/src/features/shared/components/BasicDrawer/BasicDrawer.tsx +3 -0
  108. package/src/features/shared/components/BasicDrawer/BasicDrawerBody.tsx +1 -1
  109. package/src/features/shared/components/BasicDrawer/BasicDrawerButton.tsx +1 -1
  110. package/src/features/shared/components/BasicDrawer/basic-drawer.scss +5 -5
  111. package/src/features/shared/components/ConditionalTooltip/ConditionalTooltip.tsx +21 -0
  112. package/src/features/shared/components/CustomField/create-custom-field/CreateCustomFieldDrawer.tsx +136 -0
  113. package/src/features/shared/components/CustomField/create-custom-field/create-custom-field-drawer.scss +14 -0
  114. package/src/features/shared/components/CustomField/delete-custom-field/DeleteCustomFieldDrawer.tsx +126 -0
  115. package/src/features/shared/components/CustomField/delete-custom-field/delete-custom-field-drawer.scss +30 -0
  116. package/src/features/shared/components/CustomField/index.ts +6 -0
  117. package/src/features/shared/components/CustomField/selected-card-item/CustomFieldSelectedCardItem.tsx +30 -0
  118. package/src/features/shared/components/CustomField/selected-card-item/custom-field-selected-card-item.scss +53 -0
  119. package/src/features/shared/components/CustomField/settings-drawer/CustomFieldSettingsDrawer.tsx +162 -0
  120. package/src/features/shared/components/CustomField/settings-drawer/custom-field-settings-drawer.scss +100 -0
  121. package/src/features/shared/components/CustomField/table/CustomFieldTable.tsx +236 -0
  122. package/src/features/shared/components/CustomField/table/custom-field-table.scss +133 -0
  123. package/src/features/shared/components/CustomField/update-custom-field/UpdateCustomFieldDrawer.tsx +166 -0
  124. package/src/features/shared/components/CustomField/update-custom-field/update-custom-field-drawer.scss +34 -0
  125. package/src/features/shared/components/HeaderInside/HeaderInside.tsx +2 -2
  126. package/src/features/shared/components/HeaderInside/HeaderInsideButton.tsx +5 -3
  127. package/src/features/shared/components/HeaderInside/header-inside.scss +6 -0
  128. package/src/features/shared/components/InputText/InputText.tsx +16 -2
  129. package/src/features/shared/components/InputText/Legend.tsx +9 -0
  130. package/src/features/shared/components/InputText/input-text.scss +8 -0
  131. package/src/features/shared/components/InternalSearch/internal-search.scss +1 -1
  132. package/src/features/shared/components/LevelDivider/LevelDivider.tsx +11 -0
  133. package/src/features/shared/components/LevelDivider/level-divider.scss +21 -0
  134. package/src/features/shared/components/ListLine/ListLine.tsx +52 -0
  135. package/src/features/shared/components/ListLine/list-line.scss +49 -0
  136. package/src/features/shared/components/OptionSelected/OptionSelected.tsx +7 -3
  137. package/src/features/shared/components/OrgUnitInputSearch/OrgUnitInputSearch.tsx +74 -0
  138. package/src/features/shared/components/OrgUnitInputSearch/org-unit-input-search.scss +4 -0
  139. package/src/features/shared/components/Pagination/Pagination.tsx +35 -0
  140. package/src/features/shared/components/Pagination/pagination.scss +27 -0
  141. package/src/features/shared/components/Paginator/Counter.tsx +10 -0
  142. package/src/features/shared/components/Paginator/NextPageButton.tsx +15 -0
  143. package/src/features/shared/components/Paginator/Paginator.tsx +4 -0
  144. package/src/features/shared/components/Paginator/paginator.scss +22 -0
  145. package/src/features/shared/components/TextHighlight/TextHighlight.tsx +25 -0
  146. package/src/features/shared/components/VerticalNav/VerticalNavLink.tsx +5 -1
  147. package/src/features/shared/components/VerticalNav/vertical-nav.scss +5 -0
  148. package/src/features/shared/components/index.ts +9 -0
  149. package/src/features/shared/components/pagination/pagination.scss +27 -0
  150. package/src/features/shared/hooks/custom-field/index.ts +10 -0
  151. package/src/features/shared/hooks/custom-field/useAddCustomFieldValueToScope.ts +25 -0
  152. package/src/features/shared/hooks/custom-field/useCreateCustomFieldValue.ts +25 -0
  153. package/src/features/shared/hooks/custom-field/useCustomFieldSettings.ts +18 -0
  154. package/src/features/shared/hooks/custom-field/useCustomFieldValue.ts +20 -0
  155. package/src/features/shared/hooks/custom-field/useCustomFieldsOnContract.ts +18 -0
  156. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValue.ts +25 -0
  157. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValueAndUpdateUnitScope.ts +27 -0
  158. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValueToScope.ts +27 -0
  159. package/src/features/shared/hooks/custom-field/useGetCustomFieldValuesToUnitScope.ts +20 -0
  160. package/src/features/shared/hooks/custom-field/useUpdateCustomFieldSettings.ts +27 -0
  161. package/src/features/shared/hooks/custom-field/useUpdateCustomFieldValue.ts +25 -0
  162. package/src/features/shared/hooks/index.ts +1 -0
  163. package/src/features/shared/hooks/useDebounce.ts +16 -2
  164. package/src/features/shared/hooks/usePageItems.ts +87 -0
  165. package/src/features/shared/hooks/useQueryParams.ts +20 -5
  166. package/src/features/shared/layouts/CustomFieldLayout/CustomFieldLayout.tsx +94 -0
  167. package/src/features/shared/layouts/CustomFieldLayout/custom-field-layout.scss +41 -0
  168. package/src/features/shared/layouts/index.ts +4 -0
  169. package/src/features/shared/services/custom-field/add-custom-field-value-to-scope.service.ts +26 -0
  170. package/src/features/shared/services/custom-field/create-custom-field-value.service.ts +26 -0
  171. package/src/features/shared/services/custom-field/delete-custom-field-value-and-update-unit-scope.service.ts +26 -0
  172. package/src/features/shared/services/custom-field/delete-custom-field-value-to-unit-scope.service.ts +26 -0
  173. package/src/features/shared/services/custom-field/delete-custom-field-value.service.ts +24 -0
  174. package/src/features/shared/services/custom-field/get-custom-field-settings.service.ts +19 -0
  175. package/src/features/shared/services/custom-field/get-custom-fields-on-contract.service.ts +13 -0
  176. package/src/features/shared/services/custom-field/get-custom-fields-values-to-unit-scope.service.ts +28 -0
  177. package/src/features/shared/services/custom-field/get-custom-fields-values.service.ts +25 -0
  178. package/src/features/shared/services/custom-field/index.ts +54 -0
  179. package/src/features/shared/services/custom-field/update-custom-field-settings.service.ts +26 -0
  180. package/src/features/shared/services/custom-field/update-custom-field-value.service.ts +26 -0
  181. package/src/features/shared/utils/api.ts +4 -3
  182. package/src/features/shared/utils/getContractSettingsLinks.ts +1 -1
  183. package/src/features/shared/utils/getFinanceSettingsLinks.ts +1 -1
  184. package/src/features/shared/utils/getOrganizationSettingsLinks.ts +1 -1
  185. package/src/features/shared/utils/getValidPage.ts +6 -0
  186. package/src/features/shared/utils/index.ts +1 -0
  187. package/src/pages/buying-policies.tsx +35 -15
  188. package/src/pages/buying-policy-details.tsx +9 -3
  189. package/src/pages/collections.tsx +59 -0
  190. package/src/pages/cost-centers.tsx +69 -0
  191. package/src/pages/org-units.tsx +0 -1
  192. package/src/pages/payment-methods.tsx +65 -0
  193. package/src/pages/po-numbers.tsx +69 -0
  194. package/src/themes/index.scss +4 -0
  195. package/src/themes/layouts.scss +12 -0
  196. package/src/features/buying-policies/types/BuyingPolicies.ts +0 -10
@@ -4,7 +4,7 @@ name: CD
4
4
  on:
5
5
  push:
6
6
  branches:
7
- - main
7
+ - feat/demo
8
8
 
9
9
  jobs:
10
10
  build:
package/CHANGELOG.md CHANGED
@@ -16,6 +16,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
 
17
17
  - Add Buying Policies Page
18
18
  - Add Buying Policy Details Page
19
+ - Add Buying Policy Drawers
20
+
21
+ ### Added
22
+
23
+ - Add Buying Policies Page
24
+ - Add Buying Policy Details Page
25
+ - Add Buying Policy Drawers
26
+ - Add Buying Policy Integrations
27
+ - Add Pagination Tools
19
28
 
20
29
  ### Added
21
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
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.0.147",
12
- "@faststore/ui": "^3.0.147",
11
+ "@faststore/core": "^3.50.1",
12
+ "@faststore/ui": "^3.49.1",
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,6 +10,8 @@ module.exports = {
10
10
  path: "/buyer-portal/address/[orgUnitId]/[contractId]/[addressId]",
11
11
  appLayout: false,
12
12
  },
13
+
14
+ // ----
13
15
  profile: {
14
16
  path: "/buyer-portal/profile/[orgUnitId]/[contractId]",
15
17
  appLayout: false,
@@ -18,28 +20,26 @@ module.exports = {
18
20
  path: "/buyer-portal/addresses/[orgUnitId]/[contractId]",
19
21
  appLayout: false,
20
22
  },
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
- // },
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,4 +1,15 @@
1
+
1
2
  <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
+
2
13
  <symbol id="Active" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
3
14
  viewBox="0 -960 960 960">
4
15
  <path
@@ -14,6 +25,11 @@
14
25
  <path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z" />
15
26
  </symbol>
16
27
 
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
+
17
33
  <symbol
18
34
  id="Address" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"
19
35
  fill="currentColor">
@@ -93,6 +109,15 @@
93
109
  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" />
94
110
  </symbol>
95
111
 
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
+
96
121
  <symbol
97
122
  id="FilledFolder"
98
123
  xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="currentColor">
@@ -256,6 +281,31 @@
256
281
  fill="currentColor" />
257
282
  </symbol>
258
283
 
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
+
259
309
  <symbol
260
310
  id="ErrorX"
261
311
  xmlns="http://www.w3.org/2000/svg"
@@ -339,12 +389,26 @@
339
389
  </symbol>
340
390
 
341
391
  <symbol
342
- id="Rename"
343
- viewBox="0 0 17 13"
344
- fill="none"
345
- xmlns="http://www.w3.org/2000/svg">
346
- <path d="M10.0712 12.6473V2.64734H6.0712V0.647339H16.0712V2.64734H12.0712V12.6473H10.0712ZM2.5712 12.6473V6.64734H0.0711975V4.64734H7.0712V6.64734H4.5712V12.6473H2.5712Z" fill="currentColor"/>
392
+ id="Rename"
393
+ viewBox="0 0 17 13"
394
+ fill="none"
395
+ xmlns="http://www.w3.org/2000/svg">
396
+ <path
397
+ d="M10.0712 12.6473V2.64734H6.0712V0.647339H16.0712V2.64734H12.0712V12.6473H10.0712ZM2.5712 12.6473V6.64734H0.0711975V4.64734H7.0712V6.64734H4.5712V12.6473H2.5712Z"
398
+ fill="currentColor" />
347
399
  </symbol>
348
400
 
401
+ <symbol id="MinusCircle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
402
+ <path
403
+ d="M7 13H17V11H7V13ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2C13.3833 2 14.6833 2.2625 15.9 2.7875C17.1167 3.3125 18.175 4.025 19.075 4.925C19.975 5.825 20.6875 6.88333 21.2125 8.1C21.7375 9.31667 22 10.6167 22 12C22 13.3833 21.7375 14.6833 21.2125 15.9C20.6875 17.1167 19.975 18.175 19.075 19.075C18.175 19.975 17.1167 20.6875 15.9 21.2125C14.6833 21.7375 13.3833 22 12 22ZM12 20C14.2333 20 16.125 19.225 17.675 17.675C19.225 16.125 20 14.2333 20 12C20 9.76667 19.225 7.875 17.675 6.325C16.125 4.775 14.2333 4 12 4C9.76667 4 7.875 4.775 6.325 6.325C4.775 7.875 4 9.76667 4 12C4 14.2333 4.775 16.125 6.325 17.675C7.875 19.225 9.76667 20 12 20Z"
404
+ fill="currentColor" />
405
+ </symbol>
349
406
 
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>
350
414
  </svg>
@@ -19,7 +19,6 @@ export default class AddressesClient extends Client {
19
19
  });
20
20
  }
21
21
 
22
-
23
22
  getAddressesByUnitId(orgUnitId: string, cookie: string, name?: string) {
24
23
  const url = `unit/addresses/${orgUnitId}` + (name ? `?name=${name}` : "");
25
24
  return this.get<AddressList>(url, {
@@ -1,4 +1,4 @@
1
- import { Toggle, Dropdown, DropdownButton } from "@faststore/ui";
1
+ import { Dropdown } 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";
@@ -73,7 +73,7 @@ export const AddressLayout = ({ data, search }: AddressLayoutProps) => {
73
73
  }}
74
74
  >
75
75
  <section data-fs-addresses-section>
76
- <HeaderInside title="Address">
76
+ <HeaderInside title="Addresses">
77
77
  <HeaderInside.Button onClick={openCreateDrawer} />
78
78
  </HeaderInside>
79
79
 
@@ -82,7 +82,10 @@ export const AddressLayout = ({ data, search }: AddressLayoutProps) => {
82
82
  ) : (
83
83
  <>
84
84
  <div data-fs-buyer-portal-address-filter>
85
- <InternalSearch defaultValue={querySearch} textSearch={handleSearch} />
85
+ <InternalSearch
86
+ defaultValue={querySearch}
87
+ textSearch={handleSearch}
88
+ />
86
89
  </div>
87
90
  {!isLoading &&
88
91
  addressesData.length === 0 &&
@@ -0,0 +1,127 @@
1
+ import { Client } from "../../shared/clients/Client";
2
+ import { getApiUrl } from "../../shared/utils";
3
+ import type { BuyingPolicy } from "../types"; // ajuste conforme necessário
4
+
5
+ class BuyingPoliciesClient extends Client {
6
+ constructor() {
7
+ super(getApiUrl());
8
+ }
9
+
10
+ getBuyingPoliciesByOrgUnitId(
11
+ customerId: string,
12
+ orgUnitId: string,
13
+ cookie: string,
14
+ search?: string,
15
+ page = 1
16
+ ) {
17
+ const params = new URLSearchParams();
18
+ if (search) params.append("search", search);
19
+ if (page && page > 1) params.append("page", String(page));
20
+ const queryString = params.toString();
21
+
22
+ return this.get<{
23
+ data: BuyingPolicy[];
24
+ total: number;
25
+ }>(
26
+ `customers/${customerId}/units/${orgUnitId}/buying-policies${
27
+ queryString && `?${queryString}`
28
+ }`,
29
+ {
30
+ headers: {
31
+ Cookie: cookie,
32
+ },
33
+ }
34
+ );
35
+ }
36
+
37
+ getBuyingPolicyById(
38
+ customerId: string,
39
+ orgUnitId: string,
40
+ policyId: string,
41
+ cookie: string
42
+ ) {
43
+ return this.get<BuyingPolicy>(
44
+ `customers/${customerId}/units/${orgUnitId}/buying-policies/${policyId}`,
45
+ {
46
+ headers: {
47
+ Cookie: cookie,
48
+ },
49
+ }
50
+ );
51
+ }
52
+
53
+ addBuyingPolicyToOrgUnit(
54
+ props: {
55
+ customerId: string;
56
+ orgUnitId: string;
57
+ name: string;
58
+ description: string;
59
+ criteria: string;
60
+ action: BuyingPolicy["action"];
61
+ },
62
+ cookie: string
63
+ ) {
64
+ const { customerId, orgUnitId, ...data } = props;
65
+
66
+ return this.post<BuyingPolicy, Omit<BuyingPolicy, "id">>(
67
+ `customers/${customerId}/units/${orgUnitId}/buying-policies`,
68
+ data,
69
+ {
70
+ headers: {
71
+ Cookie: cookie,
72
+ "Content-Type": "application/json",
73
+ },
74
+ }
75
+ );
76
+ }
77
+
78
+ updateBuyingPolicy(
79
+ props: {
80
+ customerId: string;
81
+ orgUnitId: string;
82
+ policyId: string;
83
+ name: string;
84
+ description: string;
85
+ criteria: string;
86
+ action: BuyingPolicy["action"];
87
+ },
88
+ cookie: string
89
+ ) {
90
+ const { customerId, orgUnitId, policyId, ...data } = props;
91
+
92
+ return this.patch<BuyingPolicy, Omit<BuyingPolicy, "id">>(
93
+ `customers/${customerId}/units/${orgUnitId}/buying-policies/${policyId}`,
94
+ data,
95
+ {
96
+ headers: {
97
+ Cookie: cookie,
98
+ "Content-Type": "application/json",
99
+ },
100
+ }
101
+ );
102
+ }
103
+
104
+ removeBuyingPolicyFromOrgUnit(
105
+ props: {
106
+ customerId: string;
107
+ orgUnitId: string;
108
+ policyId: string;
109
+ },
110
+ cookie: string
111
+ ) {
112
+ const { customerId, orgUnitId, policyId } = props;
113
+
114
+ return this.delete<unknown, unknown>(
115
+ `customers/${customerId}/units/${orgUnitId}/buying-policies/${policyId}`,
116
+ undefined,
117
+ {
118
+ headers: {
119
+ Cookie: cookie,
120
+ },
121
+ }
122
+ );
123
+ }
124
+ }
125
+
126
+ const buyingPoliciesClient = new BuyingPoliciesClient();
127
+ export { buyingPoliciesClient };
@@ -0,0 +1,84 @@
1
+ import { useUI } from "@faststore/ui";
2
+ import { useRouter } from "next/router";
3
+ import type { BasicDrawerProps } from "../../../shared/components";
4
+ import { useAddBuyingPolicy } from "../../hooks";
5
+ import type { BuyingPolicy } from "../../types";
6
+ import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
7
+ import { BasicBuyingPolicyDrawer, type BasicBuyingPolicyDrawerProps } from "..";
8
+
9
+ export type AddBuyingPolicyDrawerProps = Omit<
10
+ BasicBuyingPolicyDrawerProps,
11
+ "children"
12
+ > & {
13
+ onCreate?: () => void;
14
+ orgUnitId: string;
15
+ contractId: string;
16
+ };
17
+
18
+ export const AddBuyingPolicyDrawer = ({
19
+ close,
20
+ onCreate,
21
+ orgUnitId,
22
+ contractId,
23
+ ...props
24
+ }: AddBuyingPolicyDrawerProps) => {
25
+ const { pushToast } = useUI();
26
+ const router = useRouter();
27
+
28
+ const handleAddBuyingPolicySuccess = (data: BuyingPolicy) => {
29
+ pushToast({
30
+ message: "Buying policy added successfully",
31
+ status: "INFO",
32
+ icon: (
33
+ <button
34
+ data-fs-bp-toast-view-button
35
+ type="button"
36
+ onClick={() => {
37
+ //TODO: Redirect to the user page
38
+ router.push(
39
+ buyerPortalRoutes.buyingPolicyDetails({
40
+ orgUnitId,
41
+ contractId,
42
+ buyingPolicyId: data.id,
43
+ })
44
+ );
45
+ }}
46
+ >
47
+ View
48
+ </button>
49
+ ),
50
+ });
51
+ onCreate?.();
52
+ close();
53
+ };
54
+
55
+ const { addBuyingPolicy, isAddBuyingPolicyLoading } = useAddBuyingPolicy({
56
+ onSuccess: handleAddBuyingPolicySuccess,
57
+ onError: (err) => {
58
+ // TODO: Handle error
59
+ pushToast({
60
+ message: "Error adding buying policy",
61
+ status: "ERROR",
62
+ });
63
+ },
64
+ });
65
+
66
+ return (
67
+ <BasicBuyingPolicyDrawer
68
+ close={close}
69
+ isLoading={isAddBuyingPolicyLoading}
70
+ onConfirm={(form) =>
71
+ addBuyingPolicy({
72
+ buyingPolicy: {
73
+ ...form,
74
+ },
75
+ orgUnitId,
76
+ contractId,
77
+ })
78
+ }
79
+ orgUnitId={orgUnitId}
80
+ contractId={contractId}
81
+ {...props}
82
+ />
83
+ );
84
+ };
@@ -0,0 +1 @@
1
+ @import "../BasicBuyingPolicyDrawer/basic-buying-policy-drawer.scss";