docs: update docusaurus to v3 (#5625)

* update dependencies

* update onboarding mdx

* fixes for mdx issues

* fixes for mdx compatibility

* resolve mdx errors

* fixes in reference

* fix check errors

* revert change in vale action

* fix node version in action

* fix summary in markdown
This commit is contained in:
Shahed Nasser
2023-11-13 20:11:50 +02:00
committed by GitHub
parent cedab58339
commit c6dff873de
2265 changed files with 46163 additions and 47195 deletions
File diff suppressed because it is too large Load Diff
@@ -55,69 +55,69 @@ You can learn more about [authenticating as an admin user in the API reference](
You can list all tax providers of a store using the [List Tax Providers API Route](https://docs.medusajs.com/api/admin#store_getstoretaxproviders):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
<TabItem value="client" label="Medusa JS Client" default>
```ts
medusa.admin.store.listTaxProviders()
.then(({ tax_providers }) => {
console.log(tax_providers.length)
})
```
```ts
medusa.admin.store.listTaxProviders()
.then(({ tax_providers }) => {
console.log(tax_providers.length)
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminStoreTaxProviders } from "medusa-react"
```tsx
import { useAdminStoreTaxProviders } from "medusa-react"
const TaxProviders = () => {
const {
tax_providers,
isLoading,
} = useAdminStoreTaxProviders()
const TaxProviders = () => {
const {
tax_providers,
isLoading,
} = useAdminStoreTaxProviders()
return (
<div>
{isLoading && <span>Loading...</span>}
{tax_providers && !tax_providers.length && (
<span>No Tax Providers</span>
)}
{tax_providers && tax_providers.length > 0 && (
<ul>
{tax_providers.map((tax_provider) => (
<li key={tax_provider.id}>{tax_provider.id}</li>
))}
</ul>
)}
</div>
)
}
return (
<div>
{isLoading && <span>Loading...</span>}
{tax_providers && !tax_providers.length && (
<span>No Tax Providers</span>
)}
{tax_providers && tax_providers.length > 0 && (
<ul>
{tax_providers.map((tax_provider) => (
<li key={tax_provider.id}>{tax_provider.id}</li>
))}
</ul>
)}
</div>
)
}
export default TaxProviders
```
export default TaxProviders
```
</TabItem>
<TabItem value="fetch" label="Fetch API">
</TabItem>
<TabItem value="fetch" label="Fetch API">
```ts
fetch(`<BACKEND_URL>/admin/store/tax-providers`, {
credentials: "include",
})
.then((response) => response.json())
.then(({ tax_providers }) => {
console.log(tax_providers.length)
})
```
```ts
fetch(`<BACKEND_URL>/admin/store/tax-providers`, {
credentials: "include",
})
.then((response) => response.json())
.then(({ tax_providers }) => {
console.log(tax_providers.length)
})
```
</TabItem>
<TabItem value="curl" label="cURL">
</TabItem>
<TabItem value="curl" label="cURL">
```bash
curl -L -X GET '<BACKEND_URL>/admin/store/tax-providers' \
-H 'Authorization: Bearer <API_TOKEN>'
```
```bash
curl -L -X GET '<BACKEND_URL>/admin/store/tax-providers' \
-H 'Authorization: Bearer <API_TOKEN>'
```
</TabItem>
</TabItem>
</Tabs>
This API Route doesn't accept any parameters.
@@ -131,72 +131,72 @@ The request returns an array of tax provider objects.
You can change the tax provider of a region using the [Update Region API Route](https://docs.medusajs.com/api/admin#regions_postregionsregion):
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
<TabItem value="client" label="Medusa JS Client" default>
```ts
medusa.admin.regions.update(regionId, {
tax_provider_id,
})
.then(({ region }) => {
console.log(region.id)
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminUpdateRegion } from "medusa-react"
const UpdateRegion = () => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
const handleUpdate = () => {
updateRegion.mutate({
```ts
medusa.admin.regions.update(regionId, {
tax_provider_id,
})
}
.then(({ region }) => {
console.log(region.id)
})
```
// ...
}
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
export default UpdateRegion
```
```tsx
import { useAdminUpdateRegion } from "medusa-react"
</TabItem>
<TabItem value="fetch" label="Fetch API">
const UpdateRegion = () => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
```ts
fetch(`<BACKEND_URL>/admin/regions/${regionId}`, {
credentials: "include",
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
tax_provider_id,
}),
})
.then((response) => response.json())
.then(({ region }) => {
console.log(region.id)
})
```
const handleUpdate = () => {
updateRegion.mutate({
tax_provider_id,
})
}
</TabItem>
<TabItem value="curl" label="cURL">
// ...
}
```bash
curl -L -X POST '<BACKEND_URL>/admin/regions/<REGION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"tax_provider_id": "<TAX_PROVIDER_ID>"
}'
```
export default UpdateRegion
```
</TabItem>
</TabItem>
<TabItem value="fetch" label="Fetch API">
```ts
fetch(`<BACKEND_URL>/admin/regions/${regionId}`, {
credentials: "include",
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
tax_provider_id,
}),
})
.then((response) => response.json())
.then(({ region }) => {
console.log(region.id)
})
```
</TabItem>
<TabItem value="curl" label="cURL">
```bash
curl -L -X POST '<BACKEND_URL>/admin/regions/<REGION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"tax_provider_id": "<TAX_PROVIDER_ID>"
}'
```
</TabItem>
</Tabs>
This API Route requires the ID of the region to be passed as a path parameter.
@@ -212,88 +212,88 @@ The request returns the updated region as an object.
In addition to changing the tax provider, you can use the same [Update Region API Route](https://docs.medusajs.com/api/admin#regions_postregionsregion) to update the regions other tax settings:
<Tabs groupId="request-type" isCodeTabs={true}>
<TabItem value="client" label="Medusa JS Client" default>
<TabItem value="client" label="Medusa JS Client" default>
```ts
medusa.admin.regions.update(regionId, {
tax_provider_id,
automatic_taxes,
gift_cards_taxable,
tax_code,
tax_rate,
})
.then(({ region }) => {
console.log(region.id)
})
```
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
```tsx
import { useAdminUpdateRegion } from "medusa-react"
const UpdateRegion = () => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
const handleUpdate = () => {
updateRegion.mutate({
```ts
medusa.admin.regions.update(regionId, {
tax_provider_id,
automatic_taxes,
gift_cards_taxable,
tax_code,
tax_rate,
})
}
.then(({ region }) => {
console.log(region.id)
})
```
// ...
}
</TabItem>
<TabItem value="medusa-react" label="Medusa React">
export default UpdateRegion
```
```tsx
import { useAdminUpdateRegion } from "medusa-react"
</TabItem>
<TabItem value="fetch" label="Fetch API">
const UpdateRegion = () => {
const updateRegion = useAdminUpdateRegion(regionId)
// ...
```ts
fetch(`<BACKEND_URL>/admin/regions/${regionId}`, {
credentials: "include",
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
tax_provider_id,
automatic_taxes,
gift_cards_taxable,
tax_code,
tax_rate,
}),
})
.then((response) => response.json())
.then(({ region }) => {
console.log(region.id)
})
```
const handleUpdate = () => {
updateRegion.mutate({
tax_provider_id,
automatic_taxes,
gift_cards_taxable,
tax_code,
tax_rate,
})
}
</TabItem>
<TabItem value="curl" label="cURL">
// ...
}
```bash
curl -L -X POST '<BACKEND_URL>/admin/regions/<REGION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"tax_provider_id": "<TAX_PROVIDER_ID>",
"automatic_taxes": true,
"gift_cards_taxable": true,
"tax_code": "<TAX_CODE>",
"tax_rate": 10
}'
```
export default UpdateRegion
```
</TabItem>
</TabItem>
<TabItem value="fetch" label="Fetch API">
```ts
fetch(`<BACKEND_URL>/admin/regions/${regionId}`, {
credentials: "include",
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
tax_provider_id,
automatic_taxes,
gift_cards_taxable,
tax_code,
tax_rate,
}),
})
.then((response) => response.json())
.then(({ region }) => {
console.log(region.id)
})
```
</TabItem>
<TabItem value="curl" label="cURL">
```bash
curl -L -X POST '<BACKEND_URL>/admin/regions/<REGION_ID>' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
--data-raw '{
"tax_provider_id": "<TAX_PROVIDER_ID>",
"automatic_taxes": true,
"gift_cards_taxable": true,
"tax_code": "<TAX_CODE>",
"tax_rate": 10
}'
```
</TabItem>
</Tabs>
You can pass the following parameters in the body of the request that are related to tax settings: