Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/reference/shopify/javascript/create-intent-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify-intent.json",
"inputSchema": {
"type": "object",
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount.json",
"additionalProperties": true,
"properties": {
"functionId": {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we still include mapTo: param here? like in DFT

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"matchValue": "YOUR_FUNCTION_ID"
}
}
},
"outputSchema": {
"type": "object",
"properties": {
"id": {
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount/gid.json"
}
}
}
}
26 changes: 26 additions & 0 deletions docs/reference/shopify/javascript/edit-intent-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify-intent.json",
"value": {
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount/gid.json",
"mapTo": "param",
"fieldName": "id"
},
"inputSchema": {
"type": "object",
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount.json",
"additionalProperties": true,
"properties": {
"functionId": {
"matchValue": "YOUR_FUNCTION_ID"
}
}
},
"outputSchema": {
"type": "object",
"properties": {
"id": {
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount/gid.json"
}
}
}
}
5 changes: 5 additions & 0 deletions docs/reference/shopify/javascript/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Use this app when the merchant wants to create or edit a metafield-configured discount powered by this app's Shopify Function.

When invoking `create:shopify/Discount`, pass `functionId: "YOUR_FUNCTION_ID"` so Shopify resolves directly to this app's create flow.

When invoking `edit:shopify/Discount`, pass the discount's GID (default to the canonical `gid://shopify/DiscountNode/{id}`) and `functionId: "YOUR_FUNCTION_ID"` so Shopify resolves the edit directly to this app.
39 changes: 39 additions & 0 deletions docs/reference/shopify/javascript/shopify.extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,42 @@ handle = "ui-multiclass-metafield-js"
create = "/app/discount/:functionId/new"
details = "/app/discount/:functionId/:id"
# [END discount-function.ui-paths]

# [START discount-function.app-intent-link]
# Register app intent links so Sidekick can create and edit discounts backed by
# this app's Function. Each admin.app.intent.link target maps a shopify/Discount
# action (create or edit) to a page in your app.
[[extensions]]
name = "Create discount"
description = "Create a metafield-configured discount powered by this app's Shopify Function."
handle = "discount-app-intent-link-create"
type = "admin_link"

[[extensions.targeting]]
target = "admin.app.intent.link"
# Hardcode your deployed Function's ID (see "Set your Function ID" below).
url = "/app/discount/YOUR_FUNCTION_ID/new"
instructions = "./instructions.md"

[[extensions.targeting.intents]]
type = "shopify/Discount"
action = "create"
schema = "./create-intent-schema.json"

[[extensions]]
name = "Edit discount"
description = "Edit a metafield-configured discount powered by this app's Shopify Function."
handle = "discount-app-intent-link-edit"
type = "admin_link"

[[extensions.targeting]]
target = "admin.app.intent.link"
# {id} receives the discount ID; the Function ID stays hardcoded.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url = "/app/discount/YOUR_FUNCTION_ID/{id}"
instructions = "./instructions.md"

[[extensions.targeting.intents]]
type = "shopify/Discount"
action = "edit"
schema = "./edit-intent-schema.json"
# [END discount-function.app-intent-link]
21 changes: 21 additions & 0 deletions docs/reference/shopify/rust/create-intent-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify-intent.json",
"inputSchema": {
"type": "object",
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount.json",
"additionalProperties": true,
"properties": {
"functionId": {
"matchValue": "YOUR_FUNCTION_ID"
}
}
},
"outputSchema": {
"type": "object",
"properties": {
"id": {
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount/gid.json"
}
}
}
}
26 changes: 26 additions & 0 deletions docs/reference/shopify/rust/edit-intent-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify-intent.json",
"value": {
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount/gid.json",
"mapTo": "param",
"fieldName": "id"
},
"inputSchema": {
"type": "object",
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount.json",
"additionalProperties": true,
"properties": {
"functionId": {
"matchValue": "YOUR_FUNCTION_ID"
}
}
},
"outputSchema": {
"type": "object",
"properties": {
"id": {
"$ref": "https://extensions.shopifycdn.com/shopifycloud/schemas/v1/shopify/discount/gid.json"
}
}
}
}
5 changes: 5 additions & 0 deletions docs/reference/shopify/rust/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Use this app when the merchant wants to create or edit a metafield-configured discount powered by this app's Shopify Function.

When invoking `create:shopify/Discount`, pass `functionId: "YOUR_FUNCTION_ID"` so Shopify resolves directly to this app's create flow.

When invoking `edit:shopify/Discount`, pass the discount's GID (default to the canonical `gid://shopify/DiscountNode/{id}`) and `functionId: "YOUR_FUNCTION_ID"` so Shopify resolves the edit directly to this app.
39 changes: 39 additions & 0 deletions docs/reference/shopify/rust/shopify.extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,42 @@ key = "function-configuration"
create = "/app/discount/:functionId/new"
details = "/app/discount/:functionId/:id"
# [END discount-function.ui-paths]

# [START discount-function.app-intent-link]
# Register app intent links so Sidekick can create and edit discounts backed by
# this app's Function. Each admin.app.intent.link target maps a shopify/Discount
# action (create or edit) to a page in your app.
[[extensions]]
name = "Create discount"
description = "Create a metafield-configured discount powered by this app's Shopify Function."
handle = "discount-app-intent-link-create"
type = "admin_link"

[[extensions.targeting]]
target = "admin.app.intent.link"
# Hardcode your deployed Function's ID (see "Set your Function ID" below).
url = "/app/discount/YOUR_FUNCTION_ID/new"
instructions = "./instructions.md"

[[extensions.targeting.intents]]
type = "shopify/Discount"
action = "create"
schema = "./create-intent-schema.json"

[[extensions]]
name = "Edit discount"
description = "Edit a metafield-configured discount powered by this app's Shopify Function."
handle = "discount-app-intent-link-edit"
type = "admin_link"

[[extensions.targeting]]
target = "admin.app.intent.link"
# {id} receives the discount ID; the Function ID stays hardcoded.
url = "/app/discount/YOUR_FUNCTION_ID/{id}"
instructions = "./instructions.md"

[[extensions.targeting.intents]]
type = "shopify/Discount"
action = "edit"
schema = "./edit-intent-schema.json"
# [END discount-function.app-intent-link]