Releases: Shopify/shopify-app-js
@shopify/[email protected]
@shopify/[email protected]
@shopify/[email protected]
@shopify/[email protected]
Patch Changes
- e7d9103: Updated
mysql2
dependencies
@shopify/[email protected]
Minor Changes
-
89d803e: # Adds signal as request option
This adds the
signal
option to therequest
method of the GraphQL client, for the shopify-api and shopify-app-remix packages to pass in an AbortSignal to abort requests, and set a timeout.If a request is aborted, an
HttpRequestError
will be thrown.This will allow you to set your own custom timeout, and abort requests.
// Abort the request after 3 seconds await admin.graphql('{ shop { name } }', { signal: AbortSignal.timeout(3000), });
// Abort the request after 3 seconds, and retry the request up to 2 times await admin.graphql('{ shop { name } }', { signal: AbortSignal.timeout(3000), tries: 2, });
-
724f3d9: # Function to authenticate POS UI extension requests
A new API had been added to the
authenticate
module to authenticate POS UI extension requests.The
authenticate.public.pos
function is now available to authenticate POS UI extension requests.It returns the session token that was sent with the request and a
cors
function to ensure your app can respond to POS UI extension requests.//app/routes/pos.jsx import { authenticate } from "../shopify.server"; export const action = async ({ request }) => { const {sessionToken } = await authenticate.public.pos(request); console.log(sessionToken, "sessionToken"); return "hello world" } // extensions/pos-ui/src/Modal.jsx import React, { useEffect, useState } from 'react' import { Text, Screen, ScrollView, Navigator, reactExtension, useApi } from '@shopify/ui-extensions-react/point-of-sale' const Modal = () => { const api = useApi() const {getSessionToken} = api.session; const [token, setToken] = useState(''); const [result, setResult] = useState(''); useEffect(() => { const fetchToken = async () => { const newToken = await getSessionToken(); setToken(newToken); await fetchWithToken(newToken); }; async function fetchWithToken(token) { const result = await fetch( 'https://decor-plasma-showtimes-beverages.trycloudflare.com/pos', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({}) // Add your POST data here }, ); const resultJson = await result.json(); setResult(resultJson); } fetchToken(); }, []); // Empty dependency array means this runs once on mount return ( <Navigator> <Screen name="HelloWorld" title="Hello World!"> <ScrollView> <Text>Welcome to the extension</Text> <Text> The result is: {JSON.stringify(result)}</Text> </ScrollView> </Screen> </Navigator> ) } export default reactExtension('pos.home.modal.render', () => <Modal />);
Patch Changes
- 32b86a3: Updated
@remix-run/server-runtime
dependencies - 54eb408: Updated
isbot
dependencies - a573a6c: Updated
isbot
dependencies - Updated dependencies [54eb408]
- Updated dependencies [a573a6c]
- Updated dependencies [409597b]
- Updated dependencies [89d803e]
- @shopify/[email protected]
- @shopify/[email protected]
- @shopify/[email protected]
- @shopify/[email protected]
@shopify/[email protected]
Patch Changes
- e38c710: Change common logs from info level to debug
- Updated dependencies [54eb408]
- Updated dependencies [a573a6c]
- Updated dependencies [409597b]
- Updated dependencies [89d803e]
- @shopify/[email protected]
- @shopify/[email protected]
- @shopify/[email protected]
@shopify/[email protected]
Minor Changes
-
89d803e: # Adds signal as request option
This adds the
signal
option to therequest
method of the GraphQL client, for the shopify-api and shopify-app-remix packages to pass in an AbortSignal to abort requests, and set a timeout.If a request is aborted, an
HttpRequestError
will be thrown.This will allow you to set your own custom timeout, and abort requests.
// Abort the request after 3 seconds await admin.graphql('{ shop { name } }', { signal: AbortSignal.timeout(3000), });
// Abort the request after 3 seconds, and retry the request up to 2 times await admin.graphql('{ shop { name } }', { signal: AbortSignal.timeout(3000), tries: 2, });
Patch Changes
- 54eb408: Updated
isbot
dependencies - a573a6c: Updated
isbot
dependencies - 409597b: Updated
uuid
dependencies - Updated dependencies [d3531c5]
- @shopify/[email protected]
- @shopify/[email protected]
- @shopify/[email protected]
@shopify/[email protected]
Patch Changes
- d3531c5: Better error handling for missing Response.body in multipart requests. Instead of being "Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)')", it will now be the more useful and accurate message "API multipart response did not return an iterable body".
@shopify/[email protected]
Patch Changes
- Updated dependencies [d3531c5]
- @shopify/[email protected]