Skip to content

Commit 6923208

Browse files
authored
Fix Direct API access example for POS UI Extensions (#2939)
### Background This PR addresses an issue with the `DirectApiRequestBody` import in the Point of Sale UI extensions examples. ### Solution Fixed the import of `DirectApiRequestBody` in both TypeScript and React examples by: - Moving `DirectApiRequestBody` from a regular import to a type-only import - Using the proper `import type` syntax to ensure it's only used for type checking This change ensures proper type usage without importing unnecessary runtime code. ### 🎩 - Verified that the examples still compile correctly - Confirmed that the GraphQL mutation formatting is consistent ### Checklist - [ ] I have 🎩'd these changes - [ ] I have updated relevant documentation
2 parents 71a823e + 4b15111 commit 6923208

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/ui-extensions/docs/surfaces/point-of-sale/staticPages/examples/direct-api-access/direct-api-access.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import {
55
POSBlockRow,
66
DirectApiRequestBody,
77
} from '@shopify/ui-extensions/point-of-sale';
8+
import type {DirectApiRequestBody} from '@shopify/ui-extensions/point-of-sale';
89

910
async function mutateMetafield(productId: number) {
1011
const requestBody: DirectApiRequestBody = {
1112
query: `
12-
mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {
13+
mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {
1314
metafieldsSet(metafields: $metafields) {
1415
metafields {
1516
key

packages/ui-extensions/docs/surfaces/point-of-sale/staticPages/examples/direct-api-access/direct-api-access.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
Text,
55
POSBlock,
66
POSBlockRow,
7-
DirectApiRequestBody,
87
} from '@shopify/ui-extensions-react/point-of-sale';
8+
import type {DirectApiRequestBody} from '@shopify/ui-extensions-react/point-of-sale';
99
import {useEffect, useState} from 'react';
1010

1111
async function mutateMetafield(productId: number) {
1212
const requestBody: DirectApiRequestBody = {
1313
query: `
14-
mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {
14+
mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {
1515
metafieldsSet(metafields: $metafields) {
1616
metafields {
1717
key

0 commit comments

Comments
 (0)