docs: remove usages of ts-ignore in examples (#12839)
This commit is contained in:
1 parent
7d95eb73d3
commit
f7e4a80c30
25 files changed
+17689
-169
No files matched your search
@@ -622,7 +622,7 @@ export const createBundledProductWorkflowHighlights = [
|
||||
["38", "createRemoteLinkStep", "Create a link between the bundle and the Medusa product."],
|
||||
["47", "transform", "Prepare the data to create links between bundle items and Medusa products."],
|
||||
["61", "createRemoteLinkStep", "Create the links between the bundle items and the Medusa products."],
|
||||
["67", "useQueryGraphStep", "Retrieve the created bundle and its items."],
|
||||
["66", "useQueryGraphStep", "Retrieve the created bundle and its items."],
|
||||
]
|
||||
|
||||
```ts title="src/workflows/create-bundled-product.ts" highlights={createBundledProductWorkflowHighlights}
|
||||
@@ -691,7 +691,6 @@ export const createBundledProductWorkflow = createWorkflow(
|
||||
})
|
||||
|
||||
// retrieve bundled product with items
|
||||
// @ts-ignore
|
||||
const { data } = useQueryGraphStep({
|
||||
entity: "bundle",
|
||||
fields: ["*", "items.*"],
|
||||
@@ -1890,10 +1889,10 @@ You can now create the workflow with the custom add-to-cart logic.
|
||||
To create the workflow, create the file `src/workflows/add-bundle-to-cart.ts` with the following content:
|
||||
|
||||
export const addBundleToCartWorkflowHighlights = [
|
||||
["29", "useQueryGraphStep", "Retrieve the bundle, its items, and their products and variants."],
|
||||
["45", "prepareBundleCartDataStep", "Validate and prepare the items to be added to the cart."],
|
||||
["51", "addToCartWorkflow", "Add the items in the bundle to the cart."],
|
||||
["59", "useQueryGraphStep", "Retrieve the updated cart."],
|
||||
["28", "useQueryGraphStep", "Retrieve the bundle, its items, and their products and variants."],
|
||||
["44", "prepareBundleCartDataStep", "Validate and prepare the items to be added to the cart."],
|
||||
["50", "addToCartWorkflow", "Add the items in the bundle to the cart."],
|
||||
["57", "useQueryGraphStep", "Retrieve the updated cart."],
|
||||
]
|
||||
|
||||
```ts title="src/workflows/add-bundle-to-cart.ts" highlights={addBundleToCartWorkflowHighlights} collapsibleLines="1-14" expandButtonLabel="Show Imports"
|
||||
@@ -1924,7 +1923,6 @@ type AddBundleToCartWorkflowInput = {
|
||||
export const addBundleToCartWorkflow = createWorkflow(
|
||||
"add-bundle-to-cart",
|
||||
({ cart_id, bundle_id, quantity, items }: AddBundleToCartWorkflowInput) => {
|
||||
// @ts-ignore
|
||||
const { data } = useQueryGraphStep({
|
||||
entity: "bundle",
|
||||
fields: [
|
||||
@@ -1954,7 +1952,6 @@ export const addBundleToCartWorkflow = createWorkflow(
|
||||
},
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
const { data: updatedCarts } = useQueryGraphStep({
|
||||
entity: "cart",
|
||||
filters: { id: cart_id },
|
||||
@@ -2804,7 +2801,7 @@ export const removeBundleFromCartWorkflowHighlights = [
|
||||
["19", "useQueryGraphStep", "Retrieve the details of the cart and its items."],
|
||||
["33", "transform", "Prepare the IDs of the items to remove."],
|
||||
["42", "deleteLineItemsWorkflow", "Remove the items in the bundle from the cart."],
|
||||
["51", "useQueryGraphStep", "Retrieve the updated cart."],
|
||||
["50", "useQueryGraphStep", "Retrieve the updated cart."],
|
||||
]
|
||||
|
||||
```ts title="src/workflows/remove-bundle-from-cart.ts" collapsibleLines="1-10" expandButtonLabel="Show Imports" highlights={removeBundleFromCartWorkflowHighlights}
|
||||
@@ -2857,7 +2854,6 @@ export const removeBundleFromCartWorkflow = createWorkflow(
|
||||
})
|
||||
|
||||
// retrieve cart again
|
||||
// @ts-ignore
|
||||
const { data: updatedCarts } = useQueryGraphStep({
|
||||
entity: "cart",
|
||||
fields: [
|
||||
|
||||
@@ -612,7 +612,7 @@ export const subscriptionWorkflow1Highlights = [
|
||||
["16", "createWorkflow", "Create a workflow."],
|
||||
["23", "transform", "Set the customer ID to an empty string if not provided."],
|
||||
["28", "when", "If email is not set, try to retrieve customer by its ID."],
|
||||
["48", "transform", "Set the email either to the one in the input or the specified customer's email."],
|
||||
["47", "transform", "Set the email either to the one in the input or the specified customer's email."],
|
||||
]
|
||||
|
||||
```ts title="src/workflows/create-restock-subscription/index.ts" highlights={subscriptionWorkflow1Highlights}
|
||||
@@ -650,7 +650,6 @@ export const createRestockSubscriptionWorkflow = createWorkflow(
|
||||
return !customer.email
|
||||
}
|
||||
).then(() => {
|
||||
// @ts-ignore
|
||||
const { data } = useQueryGraphStep({
|
||||
entity: "customer",
|
||||
fields: ["email"],
|
||||
@@ -693,13 +692,13 @@ Next, replace the `TODO` with the following:
|
||||
|
||||
export const subscriptionWorkflow2Highlights = [
|
||||
["1", "validateVariantOutOfStockStep", "Validate that the variant is out of stock in the specified sales channel."],
|
||||
["7", "useQueryGraphStep", "Get the restock subscription to check if it already exists."],
|
||||
["17", "when", "Perform an action if the restock subscription doesn't exist."],
|
||||
["21", "createRestockSubscriptionStep", "Create the restock subscription if it doesn't exist."],
|
||||
["29", "when", "Perform an action if the restock subscription exists."],
|
||||
["33", "updateRestockSubscriptionStep", "Update the restock subscription if it exists."],
|
||||
["40", "useQueryGraphStep", "Retrieve the restock subscription again to return it."],
|
||||
["50", "WorkflowResponse", "Return the restock subscription."]
|
||||
["6", "useQueryGraphStep", "Get the restock subscription to check if it already exists."],
|
||||
["16", "when", "Perform an action if the restock subscription doesn't exist."],
|
||||
["20", "createRestockSubscriptionStep", "Create the restock subscription if it doesn't exist."],
|
||||
["28", "when", "Perform an action if the restock subscription exists."],
|
||||
["32", "updateRestockSubscriptionStep", "Update the restock subscription if it exists."],
|
||||
["38", "useQueryGraphStep", "Retrieve the restock subscription again to return it."],
|
||||
["48", "WorkflowResponse", "Return the restock subscription."]
|
||||
]
|
||||
|
||||
```ts title="src/workflows/create-restock-subscription/index.ts" highlights={subscriptionWorkflow2Highlights}
|
||||
@@ -708,7 +707,6 @@ validateVariantOutOfStockStep({
|
||||
sales_channel_id,
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
const { data: restockSubscriptions } = useQueryGraphStep({
|
||||
entity: "restock_subscription",
|
||||
fields: ["*"],
|
||||
@@ -741,7 +739,6 @@ when({ restockSubscriptions }, ({ restockSubscriptions }) => {
|
||||
})
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
const { data: restockSubscription } = useQueryGraphStep({
|
||||
entity: "restock_subscription",
|
||||
fields: ["*"],
|
||||
@@ -1365,7 +1362,6 @@ export const sendRestockNotificationsWorkflow = createWorkflow(
|
||||
return filters
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
const { data: restockedSubscriptionsWithEmails } = useQueryGraphStep({
|
||||
entity: "restock_subscription",
|
||||
fields: ["*", "product_variant.*"],
|
||||
|
||||
Reference in new issue
Block a user