docs: document when-then name

This commit is contained in:
Shahed Nasser
2024-12-11 11:00:25 +02:00
parent fad85a9d29
commit fd23f13cfd
10 changed files with 2082 additions and 4880 deletions
@@ -599,7 +599,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."],
["44", "transform", "Set the email either to the one in the input or the specified customer's email."],
["48", "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}
@@ -630,9 +630,13 @@ export const createRestockSubscriptionWorkflow = createWorkflow(
}, (data) => {
return data.customer.customer_id || ""
})
const retrievedCustomer = when({ customer }, ({ customer }) => {
return !customer.email
}).then(() => {
const retrievedCustomer = when(
"retrieve-customer-by-id",
{ customer },
({ customer }) => {
return !customer.email
}
).then(() => {
// @ts-ignore
const { data } = useQueryGraphStep({
entity: "customer",