Skip to content

Releases: Shopify/shopify-app-js

@shopify/[email protected]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

@shopify/[email protected]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

@shopify/[email protected]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

Patch Changes

  • 1475edf: Updated @aws-sdk/util-dynamodb dependencies
  • 2021f34: Updated @aws-sdk/client-dynamodb dependencies
  • 6fd94f1: Updated @aws-sdk/client-dynamodb, @aws-sdk/util-dynamodb dependencies

@shopify/[email protected]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

Patch Changes

  • e7d9103: Updated mysql2 dependencies

@shopify/[email protected]

23 Jan 19:20
efb9a35
Compare
Choose a tag to compare

Minor Changes

  • 89d803e: # Adds signal as request option

    This adds the signal option to the request 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

@shopify/[email protected]

23 Jan 19:20
efb9a35
Compare
Choose a tag to compare

Patch Changes

@shopify/[email protected]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

Minor Changes

  • 89d803e: # Adds signal as request option

    This adds the signal option to the request 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

@shopify/[email protected]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

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]

23 Jan 19:19
efb9a35
Compare
Choose a tag to compare

Patch Changes

@shopify/[email protected]

07 Jan 20:52
353f486
Compare
Choose a tag to compare