docs: add Sanity integration guide (#10152)
* docs: add integrate to Sanity guide * address PR feedback * added more screenshots * edit introduction * added meta images + changes
This commit is contained in:
@@ -382,8 +382,8 @@ export const deleteManagerWorkflow = createWorkflow(
|
||||
app_metadata: {
|
||||
// the ID is of the format `{actor_type}_id`.
|
||||
manager_id: input.id,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const authIdentity = transform(
|
||||
|
||||
@@ -513,8 +513,8 @@ export const updateCustomFromCartWorkflow = createWorkflow(
|
||||
entity: "cart",
|
||||
fields: ["custom.*"],
|
||||
filters: {
|
||||
id: input.cart.id
|
||||
}
|
||||
id: input.cart.id,
|
||||
},
|
||||
})
|
||||
|
||||
// TODO create, update, or delete Custom record
|
||||
|
||||
@@ -526,7 +526,7 @@ export const updateCustomFromCustomerWorkflow = createWorkflow(
|
||||
fields: ["custom.*"],
|
||||
filters: {
|
||||
id: input.customer.id,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// TODO create, update, or delete Custom record
|
||||
|
||||
@@ -532,7 +532,7 @@ export const updateCustomFromProductWorkflow = createWorkflow(
|
||||
fields: ["custom.*"],
|
||||
filters: {
|
||||
id: input.product.id,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// TODO create, update, or delete Custom record
|
||||
@@ -549,7 +549,7 @@ Next, replace the `TODO` with the following:
|
||||
```ts title="src/workflows/update-custom-from-product/index.ts"
|
||||
const created = when({
|
||||
input,
|
||||
products
|
||||
products,
|
||||
}, (data) =>
|
||||
!data.products[0].custom &&
|
||||
data.input.additional_data?.custom_name?.length > 0
|
||||
@@ -583,7 +583,7 @@ Next, replace the new `TODO` with the following:
|
||||
```ts title="src/workflows/update-custom-from-product/index.ts"
|
||||
const deleted = when({
|
||||
input,
|
||||
products
|
||||
products,
|
||||
}, (data) =>
|
||||
data.products[0].custom && (
|
||||
data.input.additional_data?.custom_name === null ||
|
||||
@@ -592,13 +592,13 @@ const deleted = when({
|
||||
)
|
||||
.then(() => {
|
||||
deleteCustomStep({
|
||||
custom: products[0].custom
|
||||
custom: products[0].custom,
|
||||
})
|
||||
|
||||
dismissRemoteLinkStep({
|
||||
[HELLO_MODULE]: {
|
||||
custom_id: products[0].custom.id
|
||||
}
|
||||
custom_id: products[0].custom.id,
|
||||
},
|
||||
})
|
||||
|
||||
return products[0].custom.id
|
||||
@@ -614,12 +614,12 @@ Finally, replace the new `TODO` with the following:
|
||||
```ts title="src/workflows/update-custom-from-product/index.ts"
|
||||
const updated = when({
|
||||
input,
|
||||
products
|
||||
products,
|
||||
}, (data) => data.products[0].custom && data.input.additional_data?.custom_name?.length > 0)
|
||||
.then(() => {
|
||||
const custom = updateCustomStep({
|
||||
id: products[0].custom.id,
|
||||
custom_name: input.additional_data.custom_name
|
||||
custom_name: input.additional_data.custom_name,
|
||||
})
|
||||
|
||||
return custom
|
||||
|
||||
@@ -538,7 +538,7 @@ export const updateCustomFromPromotionWorkflow = createWorkflow(
|
||||
fields: ["custom.*"],
|
||||
filters: {
|
||||
id: input.promotion.id,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
// TODO create, update, or delete Custom record
|
||||
@@ -555,7 +555,7 @@ Next, replace the `TODO` with the following:
|
||||
```ts title="src/workflows/update-custom-from-promotion/index.ts"
|
||||
const created = when({
|
||||
input,
|
||||
promotions
|
||||
promotions,
|
||||
}, (data) =>
|
||||
!data.promotions[0].custom &&
|
||||
data.input.additional_data?.custom_name?.length > 0
|
||||
@@ -589,7 +589,7 @@ Next, replace the new `TODO` with the following:
|
||||
```ts title="src/workflows/update-custom-from-promotion/index.ts"
|
||||
const deleted = when({
|
||||
input,
|
||||
promotions
|
||||
promotions,
|
||||
}, (data) =>
|
||||
data.promotions[0].custom && (
|
||||
data.input.additional_data?.custom_name === null ||
|
||||
@@ -598,13 +598,13 @@ const deleted = when({
|
||||
)
|
||||
.then(() => {
|
||||
deleteCustomStep({
|
||||
custom: promotions[0].custom
|
||||
custom: promotions[0].custom,
|
||||
})
|
||||
|
||||
dismissRemoteLinkStep({
|
||||
[HELLO_MODULE]: {
|
||||
custom_id: promotions[0].custom.id
|
||||
}
|
||||
custom_id: promotions[0].custom.id,
|
||||
},
|
||||
})
|
||||
|
||||
return promotions[0].custom.id
|
||||
@@ -620,12 +620,12 @@ Finally, replace the new `TODO` with the following:
|
||||
```ts title="src/workflows/update-custom-from-promotion/index.ts"
|
||||
const updated = when({
|
||||
input,
|
||||
promotions
|
||||
promotions,
|
||||
}, (data) => data.promotions[0].custom && data.input.additional_data?.custom_name?.length > 0)
|
||||
.then(() => {
|
||||
const custom = updateCustomStep({
|
||||
id: promotions[0].custom.id,
|
||||
custom_name: input.additional_data.custom_name
|
||||
custom_name: input.additional_data.custom_name,
|
||||
})
|
||||
|
||||
return custom
|
||||
|
||||
Reference in New Issue
Block a user