React card that fetches restaurants, manages a cart, and handles checkout in a HubSpot UI extension.
// Source: https://github.com/HubSpot/ui-extensions-examples | License: MIT | Copyright 2022 HubSpot
// Provided via justclaw.it.com; keep this notice with the code.
import React, { useCallback, useEffect, useState } from 'react';
import {
Divider,
LoadingSpinner,
ErrorState,
Text,
Button,
Flex,
hubspot,
} from '@hubspot/ui-extensions';
import { Cart } from './Cart';
import type { CartItem, OrderMealProps, Restaurant } from '../types';
import { RestaurantsSearch } from './RestaurantsSearch';
import { Checkout } from './Checkout';
const RESTAURANTS_SOURCE_URL =
'https://run.mocky.io/v3/b8d16309-98b2-4a16-9724-46e8821395b5';
export const OrderMealCard = ({
fetchCrmObjectProperties,
context,
runServerless,
sendAlert,
}: OrderMealProps) => {
const [loading, setLoadi
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key