API Reference
Types
Key TypeScript types and interfaces exported by shopify-app-nuxt.
Module Options
interface ModuleOptions {
apiKey: string
apiSecretKey: string
scopes?: string[]
appUrl: string
apiVersion?: ApiVersion
authPathPrefix?: string // default: '/_shopify/auth'
distribution?: AppDistribution // default: 'app_store'
useOnlineTokens?: boolean // default: false
authPage?: string | false
navLinks?: NavLink[]
componentPrefix?: string // default: 'Sh'
}
App Distribution
enum AppDistribution {
AppStore = 'app_store',
SingleMerchant = 'single_merchant',
ShopifyAdmin = 'shopify_admin'
}
NavLink
interface NavLink {
label: string
href: string
rel?: 'home'
}
Admin Context
Returned by useShopifyAdmin(event):
interface AdminContext<T extends object = JwtPayload> {
session: Session
admin: AdminApiContext
sessionToken?: T
billing: BillingContext
cors: (response: Response) => Response
redirect: (
url: string,
init?: { target?: '_self' | '_parent' | '_top' | '_blank' }
) => Response
}
Admin API Context
interface AdminApiContext {
graphql: GraphQLClient
}
Billing Context
interface BillingContext {
require: (options: { plans: string | string[] }) => Promise<void>
check: (options?: { plans?: string | string[] }) => Promise<any>
request: (options: {
plan: string
isTest?: boolean
returnUrl?: string
}) => Promise<Response>
}
Webhook Context
Returned by useShopifyWebhook(event):
interface WebhookContext {
topic: string
shop: string
session?: Session
payload: Record<string, any>
apiVersion: string
}
Flow Context
Returned by useShopifyFlow(event):
interface FlowContext {
session: Session
admin: AdminApiContext
payload: Record<string, any>
}
Public Context
Returned by useShopifyPublic(event):
interface PublicContext {
sessionToken: JwtPayload
cors: (response: Response) => Response
}
Login Error
interface LoginError {
shop?: LoginErrorType
}
enum LoginErrorType {
MissingShop = 'MISSING_SHOP',
InvalidShop = 'INVALID_SHOP'
}
Runtime Config
Returned by configureShopify():
interface ShopifyRuntimeConfig {
sessionStorage?: SessionStorage
webhooks?: Record<string, WebhookHandler | WebhookHandler[]>
hooks?: {
afterAuth?: (options: AfterAuthOptions) => void | Promise<void>
}
billing?: Record<string, any>
}
interface AfterAuthOptions {
session: Session
admin: AdminApiContext
}
Nuxt Runtime Config Augmentation
// Server-side (useRuntimeConfig().shopify)
interface ShopifyServerConfig {
apiKey: string
apiSecretKey: string
scopes: string[]
appUrl: string
apiVersion: string
authPathPrefix: string
distribution: string
useOnlineTokens: boolean
}
// Client-side (useRuntimeConfig().public.shopify)
interface ShopifyPublicConfig {
apiKey: string
authPagePath: string
authPathPrefix: string
navLinks: NavLink[]
}