Skip to content

Commit

Permalink
docs: add Sanity integration guide (#10152)
Browse files Browse the repository at this point in the history
* docs: add integrate to Sanity guide

* address PR feedback

* added more screenshots

* edit introduction

* added meta images + changes
  • Loading branch information
shahednasser authored Nov 20, 2024
1 parent 6680f69 commit a429a26
Show file tree
Hide file tree
Showing 19 changed files with 2,150 additions and 92 deletions.
1 change: 1 addition & 0 deletions www/apps/resources/.content.eslintrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export default [
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-expressions": "warn",
},
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ Create the file `src/modules/my-event/service.ts` that holds the implementation
The Event Module's main service must extend the `AbstractEventBusModuleService` class imported from `@medusajs/framework/utils`:

```ts title="src/modules/my-event/service.ts"
import { AbstractEventBusModuleService } from "@medusajs/framework/utils";
import { Message } from "@medusajs/types";
import { AbstractEventBusModuleService } from "@medusajs/framework/utils"
import { Message } from "@medusajs/types"

class MyEventService extends AbstractEventBusModuleService {
async emit<T>(data: Message<T> | Message<T>[], options: Record<string, unknown>): Promise<void> {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
async releaseGroupedEvents(eventGroupId: string): Promise<void> {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
async clearGroupedEvents(eventGroupId: string): Promise<void> {
throw new Error("Method not implemented.");
throw new Error("Method not implemented.")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions www/apps/resources/app/commerce-modules/cart/extend/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ export const updateCustomFromCustomerWorkflow = createWorkflow(
fields: ["custom.*"],
filters: {
id: input.customer.id,
}
},
})

// TODO create, update, or delete Custom record
Expand Down
16 changes: 8 additions & 8 deletions www/apps/resources/app/commerce-modules/product/extend/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export const updateCustomFromProductWorkflow = createWorkflow(
fields: ["custom.*"],
filters: {
id: input.product.id,
}
},
})

// TODO create, update, or delete Custom record
Expand All @@ -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
Expand Down Expand Up @@ -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 ||
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export const updateCustomFromPromotionWorkflow = createWorkflow(
fields: ["custom.*"],
filters: {
id: input.promotion.id,
}
},
})

// TODO create, update, or delete Custom record
Expand All @@ -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
Expand Down Expand Up @@ -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 ||
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const languages: Language[] = [
code: "da",
display_name: "Danish",
ltr: true,
date_locale: da
}
date_locale: da,
},
]
```

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a429a26

Please sign in to comment.