feat(dashboard, js-sdk, medusa, tax, types): custom tax providers (#12297)

* wip: setup loaders, add endpoints, module work, types, js sdk

* fix: tax module provider loader

* feat: select provider on region create, fix enpoint middleware registration

* feat: edit form

* fix: rename param

* chore: changeset

* fix: don't default to system provider

* fix: admin fixes, dispalt tax provider

* fix: some tests and types

* fix: remove provider from province regions in test

* fix: more tests, optional provider for sublevel regions, fix few types

* fix: OE test

* feat: edit tax region admin, update tax region core flow changes

* feat: migrate script

* fix: refactor

* chore: use query graph

* feat: provider section
This commit is contained in:
Frane Polić
2025-05-06 19:26:33 +02:00
committed by GitHub
parent 405ee7f7f3
commit 9cedeb182d
48 changed files with 847 additions and 116 deletions

View File

@@ -74,6 +74,30 @@ export const useCreateTaxRegion = (
})
}
export const useUpdateTaxRegion = (
id: string,
query?: HttpTypes.AdminTaxRegionParams,
options?: UseMutationOptions<
HttpTypes.AdminTaxRegionResponse,
FetchError,
HttpTypes.AdminUpdateTaxRegion,
QueryKey
>
) => {
return useMutation({
mutationFn: (payload) => sdk.admin.taxRegion.update(id, payload, query),
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({
queryKey: taxRegionsQueryKeys.detail(id),
})
queryClient.invalidateQueries({ queryKey: taxRegionsQueryKeys.lists() })
options?.onSuccess?.(data, variables, context)
},
...options,
})
}
export const useDeleteTaxRegion = (
id: string,
options?: UseMutationOptions<