@vtex/faststore-plugin-buyer-portal 2.0.0 → 2.0.1

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 (236) hide show
  1. package/.github/workflows/release.yaml +6 -7
  2. package/CHANGELOG.md +26 -2
  3. package/cypress/constants.ts +62 -2
  4. package/cypress/integration/accounting-fields/fields/accounting-field-create.test.ts +219 -0
  5. package/cypress/integration/accounting-fields/fields/accounting-field-delete.test.ts +119 -0
  6. package/cypress/integration/accounting-fields/fields/accounting-field-list.test.ts +78 -0
  7. package/cypress/integration/accounting-fields/fields/accounting-field-update.test.ts +144 -0
  8. package/cypress/integration/accounting-fields/values/accounting-value-create.test.ts +189 -0
  9. package/cypress/integration/accounting-fields/values/accounting-value-delete.test.ts +96 -0
  10. package/cypress/integration/accounting-fields/values/accounting-value-list.test.ts +255 -0
  11. package/cypress/integration/accounting-fields/values/accounting-value-update.test.ts +77 -0
  12. package/cypress/integration/addresses.test.ts +55 -4
  13. package/cypress/integration/budgets.test.ts +307 -104
  14. package/cypress/integration/buying-policies.test.ts +170 -93
  15. package/cypress/integration/locations.test.ts +87 -37
  16. package/cypress/integration/recipients.test.ts +94 -37
  17. package/cypress/support/accountingFieldHelper.ts +404 -0
  18. package/cypress/support/addressHelper.tsx +38 -11
  19. package/cypress/support/commands.ts +8 -4
  20. package/docs/data-fs-bp-testid-selector.md +178 -0
  21. package/package.json +1 -1
  22. package/plugin.config.js +4 -12
  23. package/public/buyer-portal-icons.svg +9 -0
  24. package/src/features/accounting-fields/clients/AccountingFieldsClient.ts +72 -0
  25. package/src/features/accounting-fields/clients/AccountingValuesClient.ts +160 -0
  26. package/src/features/accounting-fields/clients/index.ts +2 -0
  27. package/src/features/accounting-fields/components/AccountingConfirmDelete/AccountingConfirmDelete.tsx +85 -0
  28. package/src/features/accounting-fields/components/AccountingConfirmDelete/accounting-confirm-delete.scss +31 -0
  29. package/src/features/accounting-fields/components/AccountingFieldConfirmEdit/AccountingFieldConfirmEdit.tsx +46 -0
  30. package/src/features/accounting-fields/components/AccountingFieldConfirmEdit/accounting-field-confirm-edit.scss +8 -0
  31. package/src/features/accounting-fields/components/AccountingFieldDropdown/AccountingFieldDropdown.tsx +130 -0
  32. package/src/features/accounting-fields/components/AccountingFieldEmptyAlert/AccountingFieldEmptyAlert.tsx +28 -0
  33. package/src/features/accounting-fields/components/AccountingFieldEmptyAlert/accounting-field-empty-alert.scss +93 -0
  34. package/src/features/accounting-fields/components/AccountingFieldForm/AccountingFieldForm.tsx +222 -0
  35. package/src/features/accounting-fields/components/AccountingFieldForm/accounting-field-form.scss +63 -0
  36. package/src/features/accounting-fields/components/AccountingValueConfirmEdit/AccountingValueConfirmEdit.tsx +54 -0
  37. package/src/features/accounting-fields/components/AccountingValueConfirmEdit/accounting-value-confirm-edit.scss +8 -0
  38. package/src/features/accounting-fields/components/AccountingValueDropdown/AccountingValueDropdown.tsx +167 -0
  39. package/src/features/accounting-fields/components/AccountingValueForm/AccountingValueForm.tsx +197 -0
  40. package/src/features/accounting-fields/components/AccountingValueForm/accounting-value-form.scss +29 -0
  41. package/src/features/accounting-fields/components/CreateAccountingFieldDrawer/CreateAccountingFieldDrawer.tsx +225 -0
  42. package/src/features/accounting-fields/components/CreateAccountingFieldDrawer/create-accounting-field-drawer.scss +10 -0
  43. package/src/features/accounting-fields/components/CreateAccountingValueDrawer/CreateAccountingValueDrawer.tsx +189 -0
  44. package/src/features/accounting-fields/components/CreateAccountingValueDrawer/create-accounting-value-drawer.scss +3 -0
  45. package/src/features/accounting-fields/components/DeleteAccountingFieldDrawer/DeleteAccountingFieldDrawer.tsx +74 -0
  46. package/src/features/accounting-fields/components/DeleteAccountingFieldDrawer/delete-accounting-field-drawer.scss +3 -0
  47. package/src/features/accounting-fields/components/DeleteAccountingValueDrawer/DeleteAccountingValueDrawer.tsx +110 -0
  48. package/src/features/accounting-fields/components/DeleteAccountingValueDrawer/delete-accounting-value-drawer.scss +3 -0
  49. package/src/features/accounting-fields/components/EditAccountingFieldDrawer/EditAccountingFieldDrawer.tsx +151 -0
  50. package/src/features/accounting-fields/components/EditAccountingFieldDrawer/edit-accounting-field-drawer.scss +12 -0
  51. package/src/features/accounting-fields/components/EditAccountingValueDrawer/EditAccountingValueDrawer.tsx +147 -0
  52. package/src/features/accounting-fields/components/EditAccountingValueDrawer/edit-accounting-value-drawer.scss +4 -0
  53. package/src/features/accounting-fields/components/RemoveValueFromUnitDrawer/RemoveValueFromUnitDrawer.tsx +81 -0
  54. package/src/features/accounting-fields/components/RemoveValueFromUnitDrawer/remove-value-from-unit-drawer.scss +3 -0
  55. package/src/features/accounting-fields/components/SelectedAccountingValue/SelectedAccountingValue.tsx +33 -0
  56. package/src/features/accounting-fields/components/SelectedAccountingValue/selected-accounting-value.scss +52 -0
  57. package/src/features/accounting-fields/components/index.ts +14 -0
  58. package/src/features/accounting-fields/hooks/index.ts +14 -0
  59. package/src/features/accounting-fields/hooks/useAddAccountingValueToScope.ts +28 -0
  60. package/src/features/accounting-fields/hooks/useCreateAccountingField.ts +27 -0
  61. package/src/features/accounting-fields/hooks/useCreateAccountingValue.ts +27 -0
  62. package/src/features/accounting-fields/hooks/useDetailsAccountingField.ts +30 -0
  63. package/src/features/accounting-fields/hooks/useDetailsAccountingValue.ts +33 -0
  64. package/src/features/accounting-fields/hooks/useListAccountingFields.ts +26 -0
  65. package/src/features/accounting-fields/hooks/useListAccountingValues.ts +48 -0
  66. package/src/features/accounting-fields/hooks/useRemoveAccountingField.ts +28 -0
  67. package/src/features/accounting-fields/hooks/useRemoveAccountingValue.ts +28 -0
  68. package/src/features/accounting-fields/hooks/useRemoveAccountingValueFromScope.ts +30 -0
  69. package/src/features/accounting-fields/hooks/useSetDefaultValue.ts +27 -0
  70. package/src/features/accounting-fields/hooks/useUnsetDefaultValue.ts +27 -0
  71. package/src/features/accounting-fields/hooks/useUpdateAccountingField.ts +28 -0
  72. package/src/features/accounting-fields/hooks/useUpdateAccountingValue.ts +28 -0
  73. package/src/features/accounting-fields/layouts/AccountingFieldLayout/AccountingFieldLayout.tsx +309 -0
  74. package/src/features/accounting-fields/layouts/AccountingFieldLayout/accounting-field-layout.scss +88 -0
  75. package/src/features/accounting-fields/layouts/index.ts +1 -0
  76. package/src/features/accounting-fields/mocks/index.ts +3 -0
  77. package/src/features/accounting-fields/mocks/mockedAccountingFields.ts +31 -0
  78. package/src/features/accounting-fields/mocks/mockedRequest.ts +8 -0
  79. package/src/features/accounting-fields/services/add-accounting-value-to-scope-service.ts +6 -0
  80. package/src/features/accounting-fields/services/create-accounting-field-service.ts +16 -0
  81. package/src/features/accounting-fields/services/create-accounting-value-service.ts +16 -0
  82. package/src/features/accounting-fields/services/details-accounting-field-service.ts +16 -0
  83. package/src/features/accounting-fields/services/details-accounting-value-service.ts +16 -0
  84. package/src/features/accounting-fields/services/index.ts +14 -0
  85. package/src/features/accounting-fields/services/list-accounting-fields-service.ts +19 -0
  86. package/src/features/accounting-fields/services/list-accounting-values-service.ts +16 -0
  87. package/src/features/accounting-fields/services/remove-accounting-field-service.ts +7 -0
  88. package/src/features/accounting-fields/services/remove-accounting-value-from-scope-service.ts +7 -0
  89. package/src/features/accounting-fields/services/remove-accounting-value-service.ts +7 -0
  90. package/src/features/accounting-fields/services/set-default-value-service.ts +13 -0
  91. package/src/features/accounting-fields/services/unset-default-value-service.ts +16 -0
  92. package/src/features/accounting-fields/services/update-accounting-field-service.ts +7 -0
  93. package/src/features/accounting-fields/services/update-accounting-value-service.ts +7 -0
  94. package/src/features/accounting-fields/types/index.ts +113 -0
  95. package/src/features/accounting-fields/utils/check-accounting-field.ts +7 -0
  96. package/src/features/accounting-fields/utils/index.ts +1 -0
  97. package/src/features/addresses/clients/AddressesClient.ts +37 -2
  98. package/src/features/addresses/clients/LocationsClient.ts +19 -11
  99. package/src/features/addresses/components/AddressDropdownMenu/AddressDropdownMenu.tsx +12 -3
  100. package/src/features/addresses/components/AddressLocationsList/AddressLocationsList.tsx +6 -0
  101. package/src/features/addresses/components/AddressRecipientsList/AddressRecipientsList.tsx +2 -0
  102. package/src/features/addresses/components/CreateAddressDrawer/CreateAddressDrawer.tsx +5 -2
  103. package/src/features/addresses/components/CreateAddressSettingsDrawer/CreateAddressSettingsDrawer.tsx +62 -9
  104. package/src/features/addresses/components/CreateAddressSettingsDrawer/create-address-settings-drawer.scss +16 -17
  105. package/src/features/addresses/components/DeleteAddressLocationDrawer/DeleteAddressLocationDrawer.tsx +12 -11
  106. package/src/features/addresses/components/EditAddressLocationDrawer/EditAddressLocationDrawer.tsx +14 -7
  107. package/src/features/addresses/components/LocationForm/LocationField/LocationField.tsx +6 -2
  108. package/src/features/addresses/components/LocationForm/LocationForm.tsx +4 -1
  109. package/src/features/addresses/components/LocationsDrawer/LocationsDrawer.tsx +15 -5
  110. package/src/features/addresses/constants/messages.ts +2 -0
  111. package/src/features/addresses/hooks/index.ts +2 -0
  112. package/src/features/addresses/hooks/useAddressLocationDelete.ts +4 -2
  113. package/src/features/addresses/hooks/useAddressLocationEdit.ts +3 -2
  114. package/src/features/addresses/hooks/useEditAddressLocationSettings.ts +28 -0
  115. package/src/features/addresses/hooks/useGetAddressLocationSettings.ts +27 -0
  116. package/src/features/addresses/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +54 -20
  117. package/src/features/addresses/layouts/AddressDetailsLayout/address-details-layout.scss +5 -0
  118. package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +45 -6
  119. package/src/features/addresses/layouts/AddressesLayout/addresses-layout.scss +5 -0
  120. package/src/features/addresses/services/edit-address-location-settings.service.ts +7 -0
  121. package/src/features/addresses/services/get-address-location-settings.service.ts +16 -0
  122. package/src/features/addresses/services/index.ts +3 -0
  123. package/src/features/addresses/services/locations/delete-address-location.service.ts +3 -4
  124. package/src/features/addresses/services/locations/edit-address-location.service.ts +2 -2
  125. package/src/features/addresses/types/AddressData.ts +30 -7
  126. package/src/features/addresses/types/index.ts +1 -9
  127. package/src/features/budgets/components/BudgetAllocationsSelection/BudgetAllocationsSelection.tsx +46 -37
  128. package/src/features/budgets/components/BudgetAllocationsSelection/budget-allocations-selection.scss +1 -1
  129. package/src/features/budgets/components/BudgetsTable/BudgetsTable.tsx +6 -1
  130. package/src/features/budgets/components/CreateBudgetAllocationDrawer/CreateBudgetAllocationDrawer.tsx +43 -13
  131. package/src/features/budgets/components/CreateBudgetDrawer/CreateBudgetDrawer.tsx +36 -9
  132. package/src/features/budgets/hooks/useGetAllocations.ts +23 -30
  133. package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +9 -14
  134. package/src/features/budgets/types/index.ts +6 -0
  135. package/src/features/buying-policies/components/AccountingFieldCriteriaSelector/AccountingFieldCriteriaSelector.tsx +118 -0
  136. package/src/features/buying-policies/components/AccountingFieldCriteriaSelector/AccountingValueCriteriaSelector.tsx +267 -0
  137. package/src/features/buying-policies/components/{CustomFieldCriteriaSelector/custom-field-criteria-selector.scss → AccountingFieldCriteriaSelector/accounting-field-criteria-selector.scss} +5 -5
  138. package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/BasicBuyingPolicyDrawer.tsx +17 -32
  139. package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/basic-buying-policy-drawer.scss +1 -1
  140. package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu.tsx +5 -1
  141. package/src/features/buying-policies/components/index.ts +3 -0
  142. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +57 -2
  143. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/buying-policy-details-layout.scss +2 -0
  144. package/src/features/buying-policies/utils/accountingFieldCriteriaHelpers.ts +74 -0
  145. package/src/features/buying-policies/utils/index.ts +2 -6
  146. package/src/features/buying-policies/utils/orderFieldsCriteriaOptions.ts +8 -17
  147. package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +29 -56
  148. package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +168 -35
  149. package/src/features/org-units/layouts/OrgUnitDetailsLayout/org-units-details.scss +6 -1
  150. package/src/features/shared/clients/Client.ts +8 -0
  151. package/src/features/shared/components/BasicDrawer/BasicDrawerHeading.tsx +10 -0
  152. package/src/features/shared/components/BasicDrawer/basic-drawer.scss +13 -4
  153. package/src/features/shared/components/CustomDropdown/CustomDropdown.tsx +16 -0
  154. package/src/features/shared/components/CustomDropdown/custom-dropdown.scss +6 -0
  155. package/src/features/shared/components/InputText/InputText.tsx +12 -5
  156. package/src/features/shared/components/InputText/Textarea.tsx +120 -0
  157. package/src/features/shared/components/InputText/input-text.scss +10 -1
  158. package/src/features/shared/components/Paginator/paginator.scss +8 -5
  159. package/src/features/shared/components/SettingsDrawer/SettingsDrawerListType.tsx +1 -1
  160. package/src/features/shared/components/SettingsDrawer/settings-drawer.scss +38 -38
  161. package/src/features/shared/components/Tab/Tab.tsx +30 -8
  162. package/src/features/shared/components/Tab/TabOption.tsx +1 -0
  163. package/src/features/shared/components/Table/TableLoading/TableLoading.tsx +2 -5
  164. package/src/features/shared/components/VerticalNav/VerticalNavLink.tsx +12 -2
  165. package/src/features/shared/components/VerticalNav/VerticalNavMenu.tsx +2 -0
  166. package/src/features/shared/components/VerticalNav/VerticalNavTree.tsx +95 -0
  167. package/src/features/shared/components/VerticalNav/vertical-nav.scss +102 -7
  168. package/src/features/shared/layouts/BaseTabsLayout/SidebarMenu.tsx +90 -25
  169. package/src/features/shared/layouts/BaseTabsLayout/base-tabs-layout.scss +1 -7
  170. package/src/features/shared/layouts/index.ts +0 -4
  171. package/src/features/shared/types/VerticalNav.ts +17 -0
  172. package/src/features/shared/types/index.ts +4 -0
  173. package/src/features/shared/utils/buyerPortalRoutes.ts +10 -9
  174. package/src/features/shared/utils/constants.ts +3 -3
  175. package/src/features/shared/utils/getContractSettingsLinks.ts +0 -12
  176. package/src/features/shared/utils/getKeyByValue.ts +0 -3
  177. package/src/features/shared/utils/routeLayoutMapping.ts +6 -16
  178. package/src/pages/{cost-centers.tsx → accounting-field.tsx} +58 -34
  179. package/src/themes/layouts.scss +3 -3
  180. package/src/themes/tokens.scss +6 -1
  181. package/src/features/buying-policies/components/CustomFieldCriteriaSelector/CustomFieldCriteriaSelector.tsx +0 -154
  182. package/src/features/custom-fields/components/CreateCustomFieldValueDrawer/CreateCustomFieldValueDrawer.tsx +0 -208
  183. package/src/features/custom-fields/components/CustomFieldSettingsDrawer/CustomFieldSettingsDrawer.tsx +0 -379
  184. package/src/features/custom-fields/components/DeleteCustomFieldValueDrawer/DeleteCustomFieldValueDrawer.tsx +0 -183
  185. package/src/features/custom-fields/components/UpdateCustomFieldValueDrawer/UpdateCustomFieldValueDrawer.tsx +0 -108
  186. package/src/features/custom-fields/components/index.ts +0 -4
  187. package/src/features/custom-fields/layouts/CustomFieldsLayout/CustomFieldsLayout.tsx +0 -325
  188. package/src/features/custom-fields/layouts/CustomFieldsLayout/custom-fields-layout.scss +0 -37
  189. package/src/features/custom-fields/layouts/index.ts +0 -1
  190. package/src/features/custom-fields/types/index.ts +0 -5
  191. package/src/features/shared/clients/CustomField.ts +0 -204
  192. package/src/features/shared/clients/DefaultValueClient.ts +0 -62
  193. package/src/features/shared/components/CustomField/create-custom-field/CreateCustomFieldDrawer.tsx +0 -155
  194. package/src/features/shared/components/CustomField/create-custom-field/create-custom-field-drawer.scss +0 -30
  195. package/src/features/shared/components/CustomField/delete-custom-field/DeleteCustomFieldDrawer.tsx +0 -127
  196. package/src/features/shared/components/CustomField/delete-custom-field/delete-custom-field-drawer.scss +0 -34
  197. package/src/features/shared/components/CustomField/index.ts +0 -6
  198. package/src/features/shared/components/CustomField/selected-card-item/CustomFieldSelectedCardItem.tsx +0 -31
  199. package/src/features/shared/components/CustomField/selected-card-item/custom-field-selected-card-item.scss +0 -53
  200. package/src/features/shared/components/CustomField/settings-drawer/CustomFieldSettingsDrawer.tsx +0 -159
  201. package/src/features/shared/components/CustomField/settings-drawer/custom-field-settings-drawer.scss +0 -98
  202. package/src/features/shared/components/CustomField/table/CustomFieldTable.tsx +0 -151
  203. package/src/features/shared/components/CustomField/table/custom-field-table.scss +0 -41
  204. package/src/features/shared/components/CustomField/update-custom-field/UpdateCustomFieldDrawer.tsx +0 -184
  205. package/src/features/shared/components/CustomField/update-custom-field/update-custom-field-drawer.scss +0 -46
  206. package/src/features/shared/hooks/custom-field/index.ts +0 -11
  207. package/src/features/shared/hooks/custom-field/useAddCustomFieldValueToScope.ts +0 -25
  208. package/src/features/shared/hooks/custom-field/useAddDefaultValue.ts +0 -25
  209. package/src/features/shared/hooks/custom-field/useCreateCustomFieldValue.ts +0 -25
  210. package/src/features/shared/hooks/custom-field/useCustomFieldSettings.ts +0 -18
  211. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValue.ts +0 -25
  212. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValueAndUpdateUnitScope.ts +0 -27
  213. package/src/features/shared/hooks/custom-field/useDeleteCustomFieldValueToScope.ts +0 -27
  214. package/src/features/shared/hooks/custom-field/useGetCustomFieldValues.ts +0 -20
  215. package/src/features/shared/hooks/custom-field/useGetDefaultValue.ts +0 -18
  216. package/src/features/shared/hooks/custom-field/useRemoveDefaultValue.ts +0 -25
  217. package/src/features/shared/hooks/custom-field/useUpdateCustomFieldSettings.ts +0 -27
  218. package/src/features/shared/hooks/custom-field/useUpdateCustomFieldValue.ts +0 -25
  219. package/src/features/shared/layouts/CustomFieldLayout/CustomFieldLayout.tsx +0 -108
  220. package/src/features/shared/layouts/CustomFieldLayout/custom-field-layout.scss +0 -67
  221. package/src/features/shared/services/custom-field/add-custom-field-value-to-scope.service.ts +0 -26
  222. package/src/features/shared/services/custom-field/add-default-value.service.ts +0 -27
  223. package/src/features/shared/services/custom-field/create-custom-field-value.service.ts +0 -26
  224. package/src/features/shared/services/custom-field/delete-custom-field-value-and-update-unit-scope.service.ts +0 -26
  225. package/src/features/shared/services/custom-field/delete-custom-field-value-to-unit-scope.service.ts +0 -26
  226. package/src/features/shared/services/custom-field/delete-custom-field-value.service.ts +0 -26
  227. package/src/features/shared/services/custom-field/get-custom-field-settings.service.ts +0 -22
  228. package/src/features/shared/services/custom-field/get-custom-fields-values.service.ts +0 -30
  229. package/src/features/shared/services/custom-field/get-default-value.service.ts +0 -20
  230. package/src/features/shared/services/custom-field/index.ts +0 -59
  231. package/src/features/shared/services/custom-field/remove-default-value.service.ts +0 -25
  232. package/src/features/shared/services/custom-field/update-custom-field-settings.service.ts +0 -28
  233. package/src/features/shared/services/custom-field/update-custom-field-value.service.ts +0 -34
  234. package/src/features/shared/types/CustomFields.ts +0 -6
  235. package/src/pages/po-numbers.tsx +0 -98
  236. package/src/pages/releases.tsx +0 -98
@@ -26,7 +26,7 @@ jobs:
26
26
  - name: Setup Node.js environment
27
27
  uses: actions/setup-node@v4
28
28
  with:
29
- node-version: '24'
29
+ node-version: "24"
30
30
  cache: "yarn"
31
31
  registry-url: "https://registry.npmjs.org"
32
32
 
@@ -41,12 +41,11 @@ jobs:
41
41
  - name: Update npm to latest
42
42
  run: npm install -g npm@latest
43
43
 
44
- # Temporarily disabled for v2.0.0 major release — restore after publish with [skip ci]
45
- # - name: Generate CHANGELOG and update Version Const
46
- # run: yarn release
44
+ - name: Generate CHANGELOG and update Version Const
45
+ run: yarn release
47
46
 
48
- # - name: Update version to patch
49
- # run: yarn version --patch
47
+ - name: Update version to patch
48
+ run: yarn version --patch
50
49
 
51
50
  - name: Publish
52
51
  run: npm publish
@@ -69,7 +68,7 @@ jobs:
69
68
  - name: Setup Node.js environment
70
69
  uses: actions/setup-node@v4
71
70
  with:
72
- node-version: '24'
71
+ node-version: "24"
73
72
  cache: "yarn"
74
73
  registry-url: "https://registry.npmjs.org"
75
74
 
package/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.1] - 2026-06-02
11
+
12
+ ### Changed
13
+
14
+ - Uncomment release
15
+
16
+ ### Added
17
+
18
+ - Accounting Fields
19
+ - Add submenu in navigation menu with mocked data
20
+ - Include create, delete and edit drawers to accounting field with mocked data
21
+ - Include empty accounting field alert
22
+ - Create accounting field route, page and empty state
23
+ - Include create, edit, delete and remove from unit drawers to accounting values
24
+ - Implement integration for list, details, remove, update and create operations
25
+ - Load Accounting Fields in Budget allocation selector and remove old Custom Fields options
26
+ - Add Accounting Fields criterias to Buying Policy and remove old Custom Fields criterias.
27
+ - Update Address Locations old custom fields endpoints
28
+ - Update the Locations label in Addresses Settings drawer
29
+ - Include Accounting field and value E2E tests
30
+ - Fix Addresses, Locations, Recipients, Budgets and Buying Policies E2E tests
31
+ - Remove legacy Custom Fields components
32
+
10
33
  ## [2.0.0] - Unreleased
11
34
 
12
35
  ### Breaking Changes
@@ -652,7 +675,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
652
675
  - Add CHANGELOG file
653
676
  - Add README file
654
677
 
655
- [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.87...HEAD
678
+ [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/2.0.1...HEAD
656
679
  [1.3.55]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.54...v1.3.55
657
680
  [1.3.54]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.53...v1.3.54
658
681
  [1.3.53]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.52...v1.3.53
@@ -736,6 +759,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
736
759
  [1.3.71]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.70...v1.3.71
737
760
  [1.3.70]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.69...v1.3.70
738
761
  [1.3.85]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.85
739
-
740
762
  [1.3.87]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.86...v1.3.87
741
763
  [1.3.86]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.86
764
+
765
+ [2.0.1]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/2.0.1
@@ -62,7 +62,7 @@ export const TEST_DATA = {
62
62
  },
63
63
  BUYING_POLICIES: {
64
64
  NEW_POLICY: {
65
- NAME: "Test Buying Policy E2E",
65
+ NAME: "Buying Policy",
66
66
  DESCRIPTION: "Test buying policy for E2E testing",
67
67
  CRITERIA: "value > 1000",
68
68
  ACTION_TYPE: "Bypass all buying policies",
@@ -83,7 +83,9 @@ export const TEST_DATA = {
83
83
  ADDRESS: {
84
84
  NEW_ADDRESS_NAME: "VTEX RJ",
85
85
  NEW_ADDRESS_STREET: "Praia de Botafogo, 300",
86
- EDIT_ADDRESS_STREET: "Praia de Botafogo, 400",
86
+ EDIT_ADDRESS_STREET: "Praia de Botafogo",
87
+ NEW_ADDRESS_NUMBER: "400",
88
+ NEW_ADDRESS_NEIGHBORHOOD: "Botafogo",
87
89
  NEW_ADDRESS_COMPLEMENT: "Segundo Andar",
88
90
  NEW_ADDRESS_CITY: "Rio de Janeiro",
89
91
  NEW_ADDRESS_STATE: "RJ",
@@ -127,4 +129,62 @@ export const TEST_DATA = {
127
129
  },
128
130
  ADDRESS_FOR_CREDIT_CARDS_TEST: "Address for Credit Cards Test",
129
131
  },
132
+ ACCOUNTING_FIELDS: {
133
+ ITEMS: [
134
+ {
135
+ id: "cf-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
136
+ enabled: true,
137
+ level: "order",
138
+ name: "Centro de Custo",
139
+ required: true,
140
+ type: "option",
141
+ valueCount: 5,
142
+ },
143
+ {
144
+ id: "cf-b2c3d4e5-f6a7-8901-bcde-f12345678901",
145
+ enabled: true,
146
+ level: "item",
147
+ name: "Departamento",
148
+ required: false,
149
+ type: "option",
150
+ valueCount: 12,
151
+ },
152
+ {
153
+ id: "cf-c3d4e5f6-a7b8-9012-cdef-123456789012",
154
+ enabled: false,
155
+ level: "order",
156
+ name: "Projeto",
157
+ required: false,
158
+ type: "option",
159
+ valueCount: 0,
160
+ },
161
+ {
162
+ id: "cf-d4e5f6a7-b8c9-0123-defa-234567890123",
163
+ enabled: true,
164
+ level: "item",
165
+ name: "Classe de Gasto",
166
+ required: true,
167
+ valueCount: 3,
168
+ type: "option",
169
+ },
170
+ {
171
+ id: "cf-e5f6a7b8-c9d0-1234-efab-345678901234",
172
+ enabled: true,
173
+ level: "order",
174
+ name: "Código de Aprovação",
175
+ required: true,
176
+ type: "option",
177
+ valueCount: 3,
178
+ },
179
+ ],
180
+ VALUE: {
181
+ customFieldId: "CUSTOM_FIELD_ID",
182
+ value: "Accounting Value",
183
+ contractId: "CONTRACT_ID",
184
+ isDefault: false,
185
+ isAllocation: false,
186
+ description: "Lorem ipsum dolor sit amet",
187
+ auxId: "AUX_ID",
188
+ },
189
+ },
130
190
  };
@@ -0,0 +1,219 @@
1
+ /// <reference types="cypress" />
2
+
3
+ import { TEST_CONFIG, TEST_DATA } from "../../../constants";
4
+ import {
5
+ checkActionsDropdownMenu,
6
+ fillCreateFieldForm,
7
+ interceptCreateAccountingField,
8
+ interceptCreateAccountingValue,
9
+ interceptListAccountingFields,
10
+ openCreateFieldDrawerFromHeader,
11
+ waitFetchAccountFieldsAndAssert,
12
+ } from "../../../support/accountingFieldHelper";
13
+
14
+ import type {
15
+ AccountingField,
16
+ AccountingFieldFormData,
17
+ } from "../../../../src/features/accounting-fields/types";
18
+
19
+ describe("Accounting Field - Create", () => {
20
+ let createdField: AccountingField | null;
21
+
22
+ function setCreatedFieldAndInterceptCreateRequest(
23
+ formData: AccountingFieldFormData
24
+ ) {
25
+ createdField = {
26
+ id: `cf-created-${Date.now()}`,
27
+ type: "option",
28
+ valueCount: 0,
29
+ ...formData,
30
+ };
31
+
32
+ interceptCreateAccountingField(createdField);
33
+
34
+ return createdField;
35
+ }
36
+
37
+ function waitForCreateFieldAndAssert(waitForAdd = false) {
38
+ // Wait for create request to finish
39
+ cy.wait("@createAccountingField");
40
+
41
+ if (waitForAdd) {
42
+ cy.wait("@createAccountingValue");
43
+ }
44
+
45
+ // Assert if toast message is visible
46
+ cy.contains("Accounting field added successfully").should("be.visible");
47
+
48
+ // Assert if accounting field list was updated
49
+ waitFetchAccountFieldsAndAssert("[data-fs-bp-contracts-settings-card]", [
50
+ createdField!,
51
+ ...TEST_DATA.ACCOUNTING_FIELDS.ITEMS,
52
+ ]);
53
+ }
54
+
55
+ function interceptRequestsAndFillCreateForm(
56
+ formData: AccountingFieldFormData,
57
+ addValue = false
58
+ ) {
59
+ // Intercept create and list requests and fill create form with mocked data
60
+ const field = setCreatedFieldAndInterceptCreateRequest(formData);
61
+ const mockedFields = [
62
+ field,
63
+ ...TEST_DATA.ACCOUNTING_FIELDS.ITEMS,
64
+ ] as AccountingField[];
65
+
66
+ if (addValue) {
67
+ interceptCreateAccountingValue(field);
68
+ }
69
+
70
+ interceptListAccountingFields(mockedFields);
71
+ fillCreateFieldForm(formData);
72
+ }
73
+
74
+ beforeEach(() => {
75
+ cy.login();
76
+ interceptListAccountingFields();
77
+ cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
78
+
79
+ // Open create drawer using HeaderInside dropdown menu
80
+ openCreateFieldDrawerFromHeader();
81
+ checkActionsDropdownMenu();
82
+ });
83
+
84
+ afterEach(() => {
85
+ createdField = null;
86
+ });
87
+
88
+ // input requirement: required | enable open text input: checked
89
+ it("Should create an accounting field required and enabled to open text input", () => {
90
+ interceptRequestsAndFillCreateForm({
91
+ enabled: true,
92
+ required: true,
93
+ name: "field-required-enabled",
94
+ level: "order",
95
+ });
96
+
97
+ waitForCreateFieldAndAssert();
98
+ });
99
+
100
+ // input requirement: optional | enable open text input: checked
101
+ it("Should create an accounting field optional and enabled to open text input", () => {
102
+ interceptRequestsAndFillCreateForm({
103
+ enabled: true,
104
+ required: false,
105
+ name: "field-optional-enabled",
106
+ level: "order",
107
+ });
108
+
109
+ waitForCreateFieldAndAssert();
110
+ });
111
+
112
+ // input requirement: optional | enable open text input: unchecked
113
+ it("Should create an accounting field optional and disabled to open text input", () => {
114
+ interceptRequestsAndFillCreateForm({
115
+ enabled: false,
116
+ required: false,
117
+ name: "field-optional-disabled",
118
+ level: "order",
119
+ });
120
+
121
+ waitForCreateFieldAndAssert();
122
+ });
123
+
124
+ // input requirement: required | enable open text input: unchecked | skipped
125
+ it("Should create an accounting field required and disabled but skip the next step", () => {
126
+ const formData: AccountingFieldFormData = {
127
+ enabled: false,
128
+ required: true,
129
+ name: "required-disabled-skipped",
130
+ level: "order",
131
+ };
132
+
133
+ interceptRequestsAndFillCreateForm(formData);
134
+
135
+ // Check if accounting field value form is visible
136
+ cy.get("@accountingFieldForm").should("not.exist");
137
+ cy.get("[data-fs-bp-accounting-value-form]").should("be.visible");
138
+
139
+ // Click on button to skip value creation
140
+ cy.get("[data-fs-bp-create-accounting-field-drawer]")
141
+ .contains("[data-fs-bp-basic-drawer-button]", "Skip")
142
+ .should("be.visible")
143
+ .click();
144
+
145
+ waitForCreateFieldAndAssert();
146
+
147
+ // Check if alert is visible and contains the accounting field name
148
+ cy.get("[data-fs-bp-accounting-field-empty-alert]")
149
+ .should("be.visible")
150
+ .contains(formData.name);
151
+
152
+ // Click on Add value and check if create value drawer is open
153
+ cy.get("[data-fs-bp-accounting-field-empty-alert-btn]")
154
+ .should("be.visible")
155
+ .click();
156
+ cy.get("[data-fs-bp-create-accounting-value-drawer]").should("be.visible");
157
+ });
158
+
159
+ // input requirement: required | enable open text input: unchecked | added
160
+ it("Should create an accounting field required, disabled and add a first value", () => {
161
+ const formData: AccountingFieldFormData = {
162
+ enabled: false,
163
+ required: true,
164
+ name: "required-disabled-added",
165
+ level: "order",
166
+ };
167
+
168
+ interceptRequestsAndFillCreateForm(formData, true);
169
+
170
+ // Check if accounting field value form is visible
171
+ cy.get("@accountingFieldForm").should("not.exist");
172
+ cy.get("[data-fs-bp-accounting-value-form]")
173
+ .as("accountingValueForm")
174
+ .should("be.visible");
175
+
176
+ cy.get("@accountingValueForm")
177
+ .find("input[name='value']")
178
+ .type(`${formData.name}-value`);
179
+ cy.get("@accountingValueForm")
180
+ .find("textarea[name='description']")
181
+ .type(`${formData.name}-description`);
182
+
183
+ cy.get("[data-fs-bp-create-accounting-field-drawer]")
184
+ .contains("[data-fs-bp-basic-drawer-button]", "Add")
185
+ .click();
186
+
187
+ waitForCreateFieldAndAssert(true);
188
+
189
+ // Check if alert is visible and contains the accounting field name
190
+ cy.get("[data-fs-bp-accounting-field-empty-alert]").should("not.exist");
191
+ });
192
+
193
+ // input requirement: required | enable open text input: unchecked | name field empty
194
+ it("Should not submit an accounting value form without name", () => {
195
+ interceptRequestsAndFillCreateForm(
196
+ {
197
+ enabled: false,
198
+ required: true,
199
+ name: "required-disabled-validation",
200
+ level: "order",
201
+ },
202
+ true
203
+ );
204
+
205
+ // Check if accounting field value form is visible
206
+ cy.get("@accountingFieldForm").should("not.exist");
207
+ cy.get("[data-fs-bp-accounting-value-form]")
208
+ .as("accountingValueForm")
209
+ .should("be.visible");
210
+
211
+ cy.get("[data-fs-bp-create-accounting-field-drawer]")
212
+ .contains("[data-fs-bp-basic-drawer-button]", "Add")
213
+ .click();
214
+
215
+ cy.get("@accountingValueForm")
216
+ .find("[data-fs-bp-accounting-form-legend]")
217
+ .contains("[data-fs-bp-error-message]", "Name is required");
218
+ });
219
+ });
@@ -0,0 +1,119 @@
1
+ /// <reference types="cypress" />
2
+
3
+ import { TEST_CONFIG, TEST_DATA } from "../../../constants";
4
+ import {
5
+ ACCOUNTING_FIELDS_SECTION,
6
+ accessDetailsPageFromFirstItem,
7
+ confirmDeleteInDrawer,
8
+ interceptDeleteAccountingField,
9
+ interceptDetailsPageRequest,
10
+ interceptListAccountingFields,
11
+ interceptListAccountingValues,
12
+ openDeleteDrawerFromFirstItem,
13
+ } from "../../../support/accountingFieldHelper";
14
+
15
+ import type { AccountingField } from "../../../../src/features/accounting-fields/types";
16
+
17
+ describe("Accounting Field - Delete", () => {
18
+ let deletedFieldId = "";
19
+
20
+ beforeEach(() => {
21
+ cy.login();
22
+ const remainingItems = deletedFieldId
23
+ ? TEST_DATA.ACCOUNTING_FIELDS.ITEMS.filter(
24
+ ({ id }) => id !== deletedFieldId
25
+ )
26
+ : TEST_DATA.ACCOUNTING_FIELDS.ITEMS;
27
+ interceptListAccountingFields(remainingItems as AccountingField[]);
28
+ cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
29
+ });
30
+
31
+ afterEach(() => {
32
+ deletedFieldId = "";
33
+ });
34
+
35
+ it("Should delete an accounting field and update list", () => {
36
+ const accountingField = TEST_DATA.ACCOUNTING_FIELDS
37
+ .ITEMS[0] as AccountingField;
38
+ const remainingItems = TEST_DATA.ACCOUNTING_FIELDS.ITEMS.filter(
39
+ ({ id }) => id !== accountingField.id
40
+ ) as AccountingField[];
41
+
42
+ interceptDeleteAccountingField();
43
+ openDeleteDrawerFromFirstItem();
44
+
45
+ cy.get("[data-fs-bp-delete-accounting-field-drawer]")
46
+ .as("deleteDrawer")
47
+ .should("be.visible")
48
+ .find("[data-fs-bp-basic-drawer-footer]")
49
+ .contains("button[data-fs-bp-basic-drawer-button]", "Delete")
50
+ .as("deleteBtn")
51
+ .should("be.disabled");
52
+
53
+ cy.get("@deleteDrawer")
54
+ .find("input[name='field-label']")
55
+ .type("random name");
56
+
57
+ cy.get("@deleteBtn").should("be.disabled");
58
+
59
+ interceptListAccountingFields(remainingItems);
60
+ confirmDeleteInDrawer(accountingField.name);
61
+
62
+ cy.wait("@deleteAccountingField");
63
+ cy.wait("@getAccountingFields");
64
+
65
+ cy.get("[data-fs-bp-delete-accounting-field-drawer]").should("not.exist");
66
+
67
+ cy.get(ACCOUNTING_FIELDS_SECTION)
68
+ .contains("[data-fs-bp-vertical-submenu-title]", "Accounting fields")
69
+ .next()
70
+ .find("li")
71
+ .should("have.length", remainingItems.length)
72
+ .should("not.contain.text", accountingField.name);
73
+
74
+ cy.contains(`${accountingField.name} deleted successfully`).should(
75
+ "be.visible"
76
+ );
77
+ });
78
+
79
+ it("Should access accounting field details page, remove it and redirect to home", () => {
80
+ const accountingField = TEST_DATA.ACCOUNTING_FIELDS
81
+ .ITEMS[0] as AccountingField;
82
+ interceptDetailsPageRequest();
83
+ interceptListAccountingValues();
84
+ interceptDeleteAccountingField();
85
+
86
+ deletedFieldId = accountingField.id;
87
+
88
+ accessDetailsPageFromFirstItem();
89
+ cy.wait("@detailsAccountingField");
90
+
91
+ cy.location("pathname")
92
+ .should("include", "accounting-field")
93
+ .and("include", accountingField.id);
94
+
95
+ cy.get("[data-fs-bp-accounting-field-header]")
96
+ .contains("h1", accountingField.name)
97
+ .should("be.visible");
98
+
99
+ cy.get("[data-fs-bp-accounting-field-header]")
100
+ .find("button[aria-label='accounting field delete button']")
101
+ .click();
102
+
103
+ confirmDeleteInDrawer(accountingField.name);
104
+
105
+ cy.wait("@deleteAccountingField");
106
+
107
+ cy.contains(`${accountingField.name} deleted successfully`).should(
108
+ "be.visible"
109
+ );
110
+
111
+ cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
112
+
113
+ cy.location("pathname")
114
+ .should("not.include", "accounting-field")
115
+ .and("not.include", accountingField.id);
116
+
117
+ cy.get("[data-fs-bp-delete-accounting-field-drawer]").should("not.exist");
118
+ });
119
+ });
@@ -0,0 +1,78 @@
1
+ /// <reference types="cypress" />
2
+
3
+ import { TEST_CONFIG } from "../../../constants";
4
+ import {
5
+ ACCOUNTING_FIELDS_SECTION,
6
+ checkActionsDropdownMenu,
7
+ checkCreateAccountingFieldDrawer,
8
+ interceptListAccountingFields,
9
+ openCreateFieldDrawerFromHeader,
10
+ waitFetchAccountFieldsAndAssert,
11
+ waitForAccountingFieldsListReady,
12
+ } from "../../../support/accountingFieldHelper";
13
+
14
+ describe("Accounting Field - List", () => {
15
+ beforeEach(() => {
16
+ cy.login();
17
+ interceptListAccountingFields();
18
+ cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
19
+ });
20
+
21
+ it("Should list accounting fields in home page menu", () => {
22
+ waitFetchAccountFieldsAndAssert("[data-fs-bp-contracts-settings-card]");
23
+ });
24
+
25
+ it("Should list accounting fields in navigation drawer menu", () => {
26
+ // Navigate to profile page (could be any internal page)
27
+ cy.contains("[data-fs-vertical-nav-menu-link]", "Profile").click();
28
+
29
+ // Open navigation drawer
30
+ cy.get("[data-fs-bp-sidebar-drawer-btn]").click();
31
+ cy.get("[data-bp-sidebar-menu-drawer-body]")
32
+ .as("navDrawer")
33
+ .should("be.visible");
34
+
35
+ waitFetchAccountFieldsAndAssert("@navDrawer");
36
+ });
37
+
38
+ it("Should list accounting fields in sidebar menu", () => {
39
+ cy.viewport("macbook-15");
40
+
41
+ // Navigate to profile page (could be any internal page)
42
+ cy.contains("[data-fs-vertical-nav-menu-link]", "Profile").click();
43
+
44
+ waitFetchAccountFieldsAndAssert("[data-fs-bp-sidebar-menu]");
45
+ });
46
+
47
+ it("Should open create accounting field drawer in multiple places", () => {
48
+ cy.viewport("macbook-15");
49
+
50
+ waitForAccountingFieldsListReady();
51
+
52
+ cy.get(ACCOUNTING_FIELDS_SECTION)
53
+ .contains("[data-fs-bp-vertical-submenu-title]", "Accounting fields")
54
+ .find("[data-fs-bp-vertical-nav-link-actions]")
55
+ .invoke("css", "visibility", "visible")
56
+ .should("be.visible")
57
+ .find("button[aria-label='add account field']")
58
+ .click();
59
+
60
+ checkCreateAccountingFieldDrawer();
61
+
62
+ // Home header dropdown menu
63
+ openCreateFieldDrawerFromHeader();
64
+ checkActionsDropdownMenu();
65
+ checkCreateAccountingFieldDrawer();
66
+
67
+ // Breadcrumb dropdown
68
+ cy.contains("[data-fs-vertical-nav-menu-link]", "Profile").click();
69
+ cy.wait("@getAccountingFields");
70
+
71
+ cy.get("[data-fs-bp-nav]")
72
+ .find("[data-fs-bp-breadcrumb-dropdown-trigger]")
73
+ .click();
74
+
75
+ checkActionsDropdownMenu();
76
+ checkCreateAccountingFieldDrawer();
77
+ });
78
+ });