Skip to content

Commit

Permalink
Merge pull request Shopify#1668 from Shopify/templates-api-changes
Browse files Browse the repository at this point in the history
Update template specification
  • Loading branch information
gonzaloriestra authored Mar 28, 2023
2 parents 7884d06 + 4df4ef4 commit 6bbe61b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/app/src/cli/api/graphql/template_specifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const RemoteTemplateSpecificationsQuery = gql`
name
group
supportLinks
url
types {
url
type
extensionPoints
supportedFlavors {
Expand All @@ -26,14 +26,14 @@ export interface TemplateType {
type: string
extensionPoints: string[]
supportedFlavors: ExtensionFlavor[]
url: string
}

export interface RemoteTemplateSpecification {
identifier: string
name: string
group: string
supportLinks: string[]
url: string
types: TemplateType[]
}

Expand Down
16 changes: 8 additions & 8 deletions packages/app/src/cli/models/app/app.test-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ export const testRemoteTemplateSpecifications: RemoteTemplateSpecification[] = [
name: 'Function - Cart and Checkout Validation',
group: 'Discounts and checkout',
supportLinks: ['https://shopify.dev/docs/api/functions/reference/cart-checkout-validation'],
url: 'https://github.com/Shopify/function-examples',
types: [
{
type: 'cart_checkout_validation',
type: 'function',
url: 'https://github.com/Shopify/function-examples',
extensionPoints: [],
supportedFlavors: [
{
Expand All @@ -260,10 +260,10 @@ export const testRemoteTemplateSpecifications: RemoteTemplateSpecification[] = [
name: 'Function - Cart transformer',
group: 'Discounts and checkout',
supportLinks: [],
url: 'https://github.com/Shopify/function-examples',
types: [
{
type: 'cart_transform',
type: 'function',
url: 'https://github.com/Shopify/function-examples',
extensionPoints: [],
supportedFlavors: [
{
Expand All @@ -285,10 +285,10 @@ export const testRemoteTemplateSpecifications: RemoteTemplateSpecification[] = [
name: 'Function - Product discounts',
group: 'Discounts and checkout',
supportLinks: [],
url: 'https://github.com/Shopify/function-examples',
types: [
{
type: 'product_discounts',
type: 'function',
url: 'https://github.com/Shopify/function-examples',
extensionPoints: [],
supportedFlavors: [
{
Expand All @@ -310,10 +310,10 @@ export const testRemoteTemplateSpecifications: RemoteTemplateSpecification[] = [
name: 'Function - Order discounts',
group: 'Discounts and checkout',
supportLinks: [],
url: 'https://github.com/Shopify/function-examples',
types: [
{
type: 'order_discounts',
type: 'function',
url: 'https://github.com/Shopify/function-examples',
extensionPoints: [],
supportedFlavors: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ export function mapRemoteTemplateSpecification(
supportLinks: remoteTemplateSpecification.supportLinks,
types: remoteTemplateSpecification.types.map((extension) => {
return {
identifier: extension.type,
externalIdentifier: extension.type,
externalName: extension.type,
identifier: remoteTemplateSpecification.identifier,
externalIdentifier: remoteTemplateSpecification.identifier,
externalName: remoteTemplateSpecification.identifier,
gated: false,
registrationLimit: blocks.functions.defaultRegistrationLimit,
supportedFlavors: extension.supportedFlavors,
group: remoteTemplateSpecification.group,
category: () => 'function',
configSchema: BaseFunctionConfigurationSchema,
templateURL: remoteTemplateSpecification.url,
templateURL: extension.url,
helpURL: remoteTemplateSpecification.supportLinks[0]!,
templatePath: (flavor: string) => {
const supportedFlavor = extension.supportedFlavors.find((supportedFlavor) => supportedFlavor.value === flavor)
Expand Down

0 comments on commit 6bbe61b

Please sign in to comment.