A static extension target that renders as a menu item on the post-purchase screen
import React from 'react';
import {
reactExtension,
Button,
useApi,
} from '@shopify/ui-extensions-react/point-of-sale';
const ButtonComponent = () => {
const api = useApi<'pos.purchase.post.action.menu-item.render'>();
return <Button onPress={() => api.action.presentModal()} />;
};
export default reactExtension(
'pos.purchase.post.action.menu-item.render',
() => <ButtonComponent />,
);
import {Button, extension} from '@shopify/ui-extensions/point-of-sale';
export default extension(
'pos.purchase.post.action.menu-item.render',
(root, api) => {
const button = root.createComponent(Button, {
onPress: () => {
api.action.presentModal();
},
});
root.append(button);
},
);