@tscircuit/runframe 0.0.368 → 0.0.370
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-57VLEEKS.js → chunk-MAIBX4W6.js} +96 -221
- package/dist/preview.d.ts +1 -0
- package/dist/preview.js +1 -1
- package/dist/runner.js +84 -64
- package/dist/standalone-preview.min.js +1 -1
- package/dist/standalone.min.js +581 -586
- package/package.json +2 -2
|
@@ -1039,7 +1039,7 @@ var RenderLogViewer = ({
|
|
|
1039
1039
|
};
|
|
1040
1040
|
|
|
1041
1041
|
// package.json
|
|
1042
|
-
var version = "0.0.
|
|
1042
|
+
var version = "0.0.369";
|
|
1043
1043
|
|
|
1044
1044
|
// lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
|
|
1045
1045
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -1669,45 +1669,15 @@ var AlertDialogCancel = React6.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1669
1669
|
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
1670
1670
|
|
|
1671
1671
|
// lib/components/OrderDialog/OrderDialog.tsx
|
|
1672
|
-
import "react";
|
|
1673
1672
|
import { QueryClient, QueryClientProvider } from "react-query";
|
|
1674
1673
|
|
|
1675
|
-
// lib/components/OrderDialog/CheckoutOrder.tsx
|
|
1676
|
-
import { MapPin } from "lucide-react";
|
|
1677
|
-
|
|
1678
|
-
// lib/components/ui/input.tsx
|
|
1679
|
-
import * as React7 from "react";
|
|
1680
|
-
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1681
|
-
var Input = React7.forwardRef(
|
|
1682
|
-
({ className, type, ...props }, ref) => {
|
|
1683
|
-
return /* @__PURE__ */ jsx18(
|
|
1684
|
-
"input",
|
|
1685
|
-
{
|
|
1686
|
-
type,
|
|
1687
|
-
className: cn(
|
|
1688
|
-
"rf-flex rf-h-9 rf-w-full rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-px-3 rf-py-1 rf-text-sm rf-shadow-sm rf-transition-colors file:rf-border-0 file:rf-bg-transparent file:rf-text-sm file:rf-font-medium placeholder:rf-text-zinc-500 focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-placeholder-zinc-400 dark:focus-visible:rf-ring-zinc-300",
|
|
1689
|
-
className
|
|
1690
|
-
),
|
|
1691
|
-
ref,
|
|
1692
|
-
...props
|
|
1693
|
-
}
|
|
1694
|
-
);
|
|
1695
|
-
}
|
|
1696
|
-
);
|
|
1697
|
-
Input.displayName = "Input";
|
|
1698
|
-
|
|
1699
|
-
// lib/components/OrderDialog/CheckoutOrder.tsx
|
|
1700
|
-
import { useState as useState5 } from "react";
|
|
1701
|
-
import { toast } from "react-hot-toast";
|
|
1702
|
-
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1703
|
-
|
|
1704
1674
|
// lib/components/OrderDialog/InitialOrder.tsx
|
|
1705
1675
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
1706
|
-
import { useEffect as useEffect3, useState as
|
|
1676
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
1707
1677
|
|
|
1708
1678
|
// lib/components/OrderDialog/VendorQuoteCard.tsx
|
|
1709
1679
|
import { Truck, Package } from "lucide-react";
|
|
1710
|
-
import { Fragment as Fragment3, jsx as
|
|
1680
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1711
1681
|
function VendorQuoteCard({
|
|
1712
1682
|
vendor,
|
|
1713
1683
|
isActive,
|
|
@@ -1715,8 +1685,7 @@ function VendorQuoteCard({
|
|
|
1715
1685
|
selectedShippingIdx,
|
|
1716
1686
|
onSelectShipping
|
|
1717
1687
|
}) {
|
|
1718
|
-
|
|
1719
|
-
return /* @__PURE__ */ jsxs15(
|
|
1688
|
+
return /* @__PURE__ */ jsxs14(
|
|
1720
1689
|
"div",
|
|
1721
1690
|
{
|
|
1722
1691
|
className: cn(
|
|
@@ -1725,30 +1694,27 @@ function VendorQuoteCard({
|
|
|
1725
1694
|
),
|
|
1726
1695
|
onClick: onSelect,
|
|
1727
1696
|
children: [
|
|
1728
|
-
/* @__PURE__ */
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ jsxs14("div", { className: "rf-flex rf-items-center rf-justify-between rf-px-6 rf-py-4", children: [
|
|
1698
|
+
/* @__PURE__ */ jsxs14("div", { className: "rf-flex rf-items-center rf-gap-2", children: [
|
|
1699
|
+
/* @__PURE__ */ jsx18(Package, { className: "rf-w-6 rf-h-6 rf-text-blue-500" }),
|
|
1700
|
+
/* @__PURE__ */ jsx18("span", { className: "rf-font-semibold rf-text-lg", children: vendor.vendor_name })
|
|
1732
1701
|
] }),
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ jsxs14("div", { className: "rf-flex rf-flex-col rf-items-end", children: [
|
|
1703
|
+
/* @__PURE__ */ jsx18("span", { className: "rf-text-gray-500 rf-text-sm", children: "PCB + Components" }),
|
|
1704
|
+
/* @__PURE__ */ jsxs14("div", { className: "rf-flex rf-items-center rf-gap-2", children: [
|
|
1705
|
+
/* @__PURE__ */ jsxs14("span", { className: "rf-text-gray-400 rf-line-through rf-text-base rf-mr-2", children: [
|
|
1737
1706
|
"$",
|
|
1738
|
-
|
|
1707
|
+
vendor.total_cost.toFixed(2)
|
|
1739
1708
|
] }),
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
"$",
|
|
1742
|
-
vendor.total_cost_after_discount.toFixed(2)
|
|
1743
|
-
] })
|
|
1709
|
+
/* @__PURE__ */ jsx18("span", { className: "rf-font-bold rf-text-xl rf-text-blue-600", children: "$50.00" })
|
|
1744
1710
|
] })
|
|
1745
1711
|
] })
|
|
1746
1712
|
] }),
|
|
1747
|
-
isActive && /* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1713
|
+
isActive && /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
1714
|
+
/* @__PURE__ */ jsx18("hr", { className: "rf-border-gray-200" }),
|
|
1715
|
+
/* @__PURE__ */ jsxs14("div", { className: "rf-px-6 rf-py-2", children: [
|
|
1716
|
+
/* @__PURE__ */ jsx18("div", { className: "rf-mb-2 rf-text-sm rf-font-medium rf-text-gray-700", children: "Shipping Options:" }),
|
|
1717
|
+
/* @__PURE__ */ jsx18("div", { className: "rf-flex rf-gap-4 rf-flex-wrap rf-mb-2", children: vendor.shipping_options.map((ship, idx) => /* @__PURE__ */ jsxs14(
|
|
1752
1718
|
"button",
|
|
1753
1719
|
{
|
|
1754
1720
|
type: "button",
|
|
@@ -1761,10 +1727,10 @@ function VendorQuoteCard({
|
|
|
1761
1727
|
onSelectShipping(idx);
|
|
1762
1728
|
},
|
|
1763
1729
|
children: [
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1730
|
+
/* @__PURE__ */ jsx18(Truck, { className: "rf-w-5 rf-h-5 rf-text-yellow-500" }),
|
|
1731
|
+
/* @__PURE__ */ jsxs14("div", { className: "rf-text-left rf-flex-1", children: [
|
|
1732
|
+
/* @__PURE__ */ jsx18("div", { className: "rf-leading-tight rf-font-medium", children: ship.carrier }),
|
|
1733
|
+
/* @__PURE__ */ jsx18("div", { className: "rf-text-xs rf-text-gray-500", children: ship.service })
|
|
1768
1734
|
] })
|
|
1769
1735
|
]
|
|
1770
1736
|
},
|
|
@@ -1772,11 +1738,11 @@ function VendorQuoteCard({
|
|
|
1772
1738
|
)) })
|
|
1773
1739
|
] })
|
|
1774
1740
|
] }),
|
|
1775
|
-
isActive && selectedShippingIdx !== null && /* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1741
|
+
isActive && selectedShippingIdx !== null && /* @__PURE__ */ jsx18("div", { className: "rf-px-6 rf-pb-3", children: /* @__PURE__ */ jsxs14("div", { className: "rf-flex rf-justify-between rf-items-center rf-mt-2", children: [
|
|
1742
|
+
/* @__PURE__ */ jsx18("span", { className: "rf-text-gray-800 rf-font-medium", children: "Total (incl. shipping):" }),
|
|
1743
|
+
/* @__PURE__ */ jsxs14("span", { className: "rf-font-bold rf-text-lg rf-text-blue-700", children: [
|
|
1778
1744
|
"$",
|
|
1779
|
-
vendor.
|
|
1745
|
+
vendor.total_cost.toFixed(2)
|
|
1780
1746
|
] })
|
|
1781
1747
|
] }) })
|
|
1782
1748
|
]
|
|
@@ -1785,7 +1751,7 @@ function VendorQuoteCard({
|
|
|
1785
1751
|
}
|
|
1786
1752
|
|
|
1787
1753
|
// lib/utils/toast.ts
|
|
1788
|
-
import { toast
|
|
1754
|
+
import { toast } from "react-hot-toast";
|
|
1789
1755
|
|
|
1790
1756
|
// lib/utils/get-registry-ky.ts
|
|
1791
1757
|
import ky from "ky";
|
|
@@ -1812,80 +1778,85 @@ var registryKy = {
|
|
|
1812
1778
|
};
|
|
1813
1779
|
|
|
1814
1780
|
// lib/components/OrderDialog/InitialOrder.tsx
|
|
1815
|
-
import { jsx as
|
|
1781
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1816
1782
|
var InitialOrderScreen = ({
|
|
1817
1783
|
onCancel,
|
|
1818
|
-
|
|
1784
|
+
packageReleaseId
|
|
1819
1785
|
}) => {
|
|
1820
|
-
const [quotes, setQuotes] =
|
|
1821
|
-
const [loading, setLoading] =
|
|
1822
|
-
const [selectedVendorIdx, setSelectedVendorIdx] =
|
|
1786
|
+
const [quotes, setQuotes] = useState5([]);
|
|
1787
|
+
const [loading, setLoading] = useState5(true);
|
|
1788
|
+
const [selectedVendorIdx, setSelectedVendorIdx] = useState5(
|
|
1823
1789
|
null
|
|
1824
1790
|
);
|
|
1825
|
-
const [selectedShippingIdx, setSelectedShippingIdx] =
|
|
1791
|
+
const [selectedShippingIdx, setSelectedShippingIdx] = useState5(
|
|
1826
1792
|
null
|
|
1827
1793
|
);
|
|
1828
|
-
const [fetchError, setFetchError] =
|
|
1794
|
+
const [fetchError, setFetchError] = useState5(null);
|
|
1795
|
+
const [orderQuoteReceived, setOrderQuoteReceived] = useState5(null);
|
|
1829
1796
|
const createOrderQuotes = async () => {
|
|
1830
1797
|
const { order_quote_id } = await registryKy.post("order_quotes/create", {
|
|
1831
1798
|
json: {
|
|
1832
|
-
package_release_id:
|
|
1833
|
-
vendor_name: ""
|
|
1799
|
+
package_release_id: packageReleaseId,
|
|
1800
|
+
vendor_name: "jlcpcb"
|
|
1801
|
+
// TODO: Remove this once we have more vendor
|
|
1834
1802
|
}
|
|
1835
1803
|
}).json();
|
|
1836
1804
|
return order_quote_id;
|
|
1837
1805
|
};
|
|
1838
|
-
const getOrderQuotes = async (
|
|
1839
|
-
const { order_quote } = await registryKy.
|
|
1840
|
-
|
|
1841
|
-
order_quote_id
|
|
1806
|
+
const getOrderQuotes = async (orderQuoteId) => {
|
|
1807
|
+
const { order_quote } = await registryKy.get(`order_quotes/get`, {
|
|
1808
|
+
searchParams: {
|
|
1809
|
+
order_quote_id: orderQuoteId
|
|
1842
1810
|
}
|
|
1843
1811
|
}).json();
|
|
1844
1812
|
return order_quote;
|
|
1845
1813
|
};
|
|
1846
|
-
const
|
|
1847
|
-
const { order_quotes } = await registryKy.post(`_fake/received_quotes`, {
|
|
1848
|
-
json: {
|
|
1849
|
-
order_quote_id
|
|
1850
|
-
}
|
|
1851
|
-
}).json();
|
|
1852
|
-
return order_quotes;
|
|
1853
|
-
};
|
|
1854
|
-
const pollToGetOrderQuotes = async (quoteId, maxAttempts = 2) => {
|
|
1814
|
+
const pollToGetOrderQuotes = async (orderQuoteId, maxAttempts = 10) => {
|
|
1855
1815
|
let attempts = 0;
|
|
1856
1816
|
while (attempts < maxAttempts) {
|
|
1857
1817
|
try {
|
|
1858
|
-
const orderQuote = await getOrderQuotes(
|
|
1859
|
-
if (orderQuote.
|
|
1818
|
+
const orderQuote = await getOrderQuotes(orderQuoteId);
|
|
1819
|
+
if (orderQuote.is_completed) {
|
|
1820
|
+
setOrderQuoteReceived(orderQuote);
|
|
1860
1821
|
return orderQuote;
|
|
1861
1822
|
}
|
|
1862
1823
|
if (orderQuote.has_error) {
|
|
1863
|
-
throw new Error(orderQuote.error);
|
|
1824
|
+
throw new Error(orderQuote.error?.message ?? "Unknown error");
|
|
1864
1825
|
}
|
|
1865
1826
|
attempts++;
|
|
1866
1827
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
1867
1828
|
} catch (error) {
|
|
1829
|
+
attempts++;
|
|
1868
1830
|
console.error("Error polling order quote:", error);
|
|
1831
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
1869
1832
|
}
|
|
1870
1833
|
}
|
|
1871
1834
|
throw new Error("Polling timed out after maximum attempts");
|
|
1872
1835
|
};
|
|
1836
|
+
const redirectToStripeCheckout = async (orderQuoteId) => {
|
|
1837
|
+
const stripeCheckoutBaseUrl = getWindowVar(
|
|
1838
|
+
"TSCIRCUIT_STRIPE_CHECKOUT_BASE_URL"
|
|
1839
|
+
);
|
|
1840
|
+
window.location.href = `${stripeCheckoutBaseUrl}?client_reference_id=${orderQuoteId}`;
|
|
1841
|
+
};
|
|
1873
1842
|
useEffect3(() => {
|
|
1874
1843
|
const fetchQuotes = async () => {
|
|
1875
1844
|
setLoading(true);
|
|
1876
1845
|
setQuotes([]);
|
|
1877
1846
|
setFetchError(null);
|
|
1878
|
-
const
|
|
1879
|
-
if (!
|
|
1880
|
-
|
|
1847
|
+
const orderQuoteId = await createOrderQuotes();
|
|
1848
|
+
if (!orderQuoteId) {
|
|
1849
|
+
toast.error("Failed to create order quote.");
|
|
1881
1850
|
setLoading(false);
|
|
1882
1851
|
return;
|
|
1883
1852
|
}
|
|
1884
1853
|
try {
|
|
1885
|
-
await pollToGetOrderQuotes(
|
|
1854
|
+
const orderQuote = await pollToGetOrderQuotes(orderQuoteId);
|
|
1855
|
+
setQuotes([orderQuote]);
|
|
1856
|
+
setLoading(false);
|
|
1886
1857
|
} catch (error) {
|
|
1887
|
-
|
|
1888
|
-
|
|
1858
|
+
console.error(error);
|
|
1859
|
+
toast.error("Failed to fetch order quotes.");
|
|
1889
1860
|
setLoading(false);
|
|
1890
1861
|
}
|
|
1891
1862
|
};
|
|
@@ -1894,13 +1865,13 @@ var InitialOrderScreen = ({
|
|
|
1894
1865
|
useEffect3(() => {
|
|
1895
1866
|
setSelectedShippingIdx(null);
|
|
1896
1867
|
}, [selectedVendorIdx]);
|
|
1897
|
-
return /* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
loading ? /* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
/* @__PURE__ */
|
|
1903
|
-
] }) : quotes.length === 0 ? /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rf-max-w-lg rf-mx-auto rf-bg-white rf-rounded-2xl rf-p-8 rf-flex rf-flex-col rf-gap-3", children: [
|
|
1869
|
+
/* @__PURE__ */ jsx19("h2", { className: "rf-text-3xl rf-font-bold rf-text-center rf-mb-8", children: "Order PCB \u2013 Choose a Vendor" }),
|
|
1870
|
+
/* @__PURE__ */ jsx19("div", { className: "rf-mb-4 rf-text-gray-700 rf-text-center", children: "Select a quote from below, then pick a shipping method." }),
|
|
1871
|
+
loading ? /* @__PURE__ */ jsxs15("div", { className: "rf-flex rf-flex-col rf-items-center rf-gap-2 rf-my-12", children: [
|
|
1872
|
+
/* @__PURE__ */ jsx19(Loader22, { className: "rf-animate-spin rf-w-8 rf-h-8 rf-text-gray-400" }),
|
|
1873
|
+
/* @__PURE__ */ jsx19("p", { className: "rf-text-gray-600", children: "Fetching quotes..." })
|
|
1874
|
+
] }) : quotes.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "rf-text-red-600 rf-text-center rf-py-12", children: "No quotes available." }) : quotes.map((quote, idx) => /* @__PURE__ */ jsx19(
|
|
1904
1875
|
VendorQuoteCard,
|
|
1905
1876
|
{
|
|
1906
1877
|
vendor: quote,
|
|
@@ -1911,8 +1882,8 @@ var InitialOrderScreen = ({
|
|
|
1911
1882
|
},
|
|
1912
1883
|
quote.order_quote_id
|
|
1913
1884
|
)),
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsxs15("div", { className: "rf-flex rf-justify-between rf-mt-5 rf-gap-4", children: [
|
|
1886
|
+
/* @__PURE__ */ jsx19(
|
|
1916
1887
|
Button,
|
|
1917
1888
|
{
|
|
1918
1889
|
variant: "outline",
|
|
@@ -1922,148 +1893,53 @@ var InitialOrderScreen = ({
|
|
|
1922
1893
|
children: "Cancel"
|
|
1923
1894
|
}
|
|
1924
1895
|
),
|
|
1925
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ jsx19(
|
|
1926
1897
|
Button,
|
|
1927
1898
|
{
|
|
1928
1899
|
type: "button",
|
|
1929
1900
|
className: "rf-w-1/2 rf-bg-blue-600 rf-hover:bg-blue-700",
|
|
1930
|
-
disabled: selectedVendorIdx === null || selectedShippingIdx === null ||
|
|
1901
|
+
disabled: selectedVendorIdx === null || // selectedShippingIdx === null ||
|
|
1902
|
+
loading,
|
|
1931
1903
|
onClick: () => {
|
|
1932
|
-
if (selectedVendorIdx === null || selectedShippingIdx === null ||
|
|
1933
|
-
|
|
1904
|
+
if (selectedVendorIdx === null || // selectedShippingIdx === null ||
|
|
1905
|
+
loading) {
|
|
1906
|
+
toast.error("Please select a vendor and shipping option.");
|
|
1934
1907
|
return;
|
|
1935
1908
|
}
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
});
|
|
1909
|
+
if (orderQuoteReceived) {
|
|
1910
|
+
redirectToStripeCheckout(orderQuoteReceived.order_quote_id);
|
|
1911
|
+
}
|
|
1940
1912
|
},
|
|
1941
1913
|
children: "Continue"
|
|
1942
1914
|
}
|
|
1943
1915
|
)
|
|
1944
1916
|
] }),
|
|
1945
|
-
/* @__PURE__ */
|
|
1917
|
+
/* @__PURE__ */ jsx19("div", { className: "rf-text-xs rf-text-center rf-text-gray-400 rf-mt-4", children: "Pricing may vary based on specifications." })
|
|
1946
1918
|
] });
|
|
1947
1919
|
};
|
|
1948
1920
|
|
|
1949
|
-
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1950
|
-
import ky2 from "ky";
|
|
1951
|
-
|
|
1952
|
-
// lib/components/ui/progress.tsx
|
|
1953
|
-
import * as React8 from "react";
|
|
1954
|
-
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
1955
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1956
|
-
var Progress = React8.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
1957
|
-
ProgressPrimitive.Root,
|
|
1958
|
-
{
|
|
1959
|
-
ref,
|
|
1960
|
-
className: cn(
|
|
1961
|
-
"rf-relative rf-h-2 rf-w-full rf-overflow-hidden rf-rounded-full rf-bg-zinc-100 dark:rf-bg-zinc-800",
|
|
1962
|
-
className
|
|
1963
|
-
),
|
|
1964
|
-
...props,
|
|
1965
|
-
children: /* @__PURE__ */ jsx22(
|
|
1966
|
-
ProgressPrimitive.Indicator,
|
|
1967
|
-
{
|
|
1968
|
-
className: "rf-h-full rf-w-full rf-flex-1 rf-bg-zinc-900 rf-transition-all dark:rf-bg-zinc-50",
|
|
1969
|
-
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
1970
|
-
}
|
|
1971
|
-
)
|
|
1972
|
-
}
|
|
1973
|
-
));
|
|
1974
|
-
Progress.displayName = "Progress";
|
|
1975
|
-
|
|
1976
|
-
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
1977
|
-
import { ArrowDown, Check as Check2, Loader2 as Loader23 } from "lucide-react";
|
|
1978
|
-
import { useQuery } from "react-query";
|
|
1979
|
-
|
|
1980
|
-
// lib/utils/order-steps.ts
|
|
1981
|
-
var orderSteps = [
|
|
1982
|
-
{ order_step_id: 1, key: "are_gerbers_generated", title: "Generate Gerbers" },
|
|
1983
|
-
{ order_step_id: 2, key: "are_gerbers_uploaded", title: "Upload Gerbers" },
|
|
1984
|
-
{ order_step_id: 3, key: "is_gerber_analyzed", title: "Analyze Gerber" },
|
|
1985
|
-
{
|
|
1986
|
-
order_step_id: 4,
|
|
1987
|
-
key: "are_initial_costs_calculated",
|
|
1988
|
-
title: "Calculate Initial Costs"
|
|
1989
|
-
},
|
|
1990
|
-
{ order_step_id: 5, key: "is_pcb_added_to_cart", title: "Add PCB to Cart" },
|
|
1991
|
-
{ order_step_id: 6, key: "is_bom_uploaded", title: "Upload BOM" },
|
|
1992
|
-
{ order_step_id: 7, key: "is_pnp_uploaded", title: "Upload PnP" },
|
|
1993
|
-
{ order_step_id: 8, key: "is_bom_pnp_analyzed", title: "Analyze BOM & PnP" },
|
|
1994
|
-
{
|
|
1995
|
-
order_step_id: 9,
|
|
1996
|
-
key: "is_bom_parsing_complete",
|
|
1997
|
-
title: "BOM Parsing Complete"
|
|
1998
|
-
},
|
|
1999
|
-
{
|
|
2000
|
-
order_step_id: 10,
|
|
2001
|
-
key: "are_components_available",
|
|
2002
|
-
title: "Components Available"
|
|
2003
|
-
},
|
|
2004
|
-
{
|
|
2005
|
-
order_step_id: 11,
|
|
2006
|
-
key: "is_patch_map_generated",
|
|
2007
|
-
title: "Generate Patch Map"
|
|
2008
|
-
},
|
|
2009
|
-
{
|
|
2010
|
-
order_step_id: 12,
|
|
2011
|
-
key: "is_json_merge_file_created",
|
|
2012
|
-
title: "Create JSON Merge File"
|
|
2013
|
-
},
|
|
2014
|
-
{
|
|
2015
|
-
order_step_id: 13,
|
|
2016
|
-
key: "is_dfm_result_generated",
|
|
2017
|
-
title: "Generate DFM Result"
|
|
2018
|
-
},
|
|
2019
|
-
{ order_step_id: 14, key: "are_files_downloaded", title: "Download Files" },
|
|
2020
|
-
{
|
|
2021
|
-
order_step_id: 15,
|
|
2022
|
-
key: "are_product_categories_fetched",
|
|
2023
|
-
title: "Fetch Product Categories"
|
|
2024
|
-
},
|
|
2025
|
-
{
|
|
2026
|
-
order_step_id: 16,
|
|
2027
|
-
key: "are_final_costs_calculated",
|
|
2028
|
-
title: "Calculate Final Costs"
|
|
2029
|
-
},
|
|
2030
|
-
{
|
|
2031
|
-
order_step_id: 17,
|
|
2032
|
-
key: "is_json_merge_file_updated",
|
|
2033
|
-
title: "Update JSON Merge File"
|
|
2034
|
-
},
|
|
2035
|
-
{ order_step_id: 18, key: "is_added_to_cart", title: "Add to Cart" }
|
|
2036
|
-
].map((step, index) => ({
|
|
2037
|
-
...step,
|
|
2038
|
-
completed: false,
|
|
2039
|
-
active: index === 0
|
|
2040
|
-
// First step starts as active
|
|
2041
|
-
}));
|
|
2042
|
-
|
|
2043
|
-
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
2044
|
-
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2045
|
-
|
|
2046
1921
|
// lib/components/OrderDialog/OrderDialog.tsx
|
|
2047
|
-
import { jsx as
|
|
1922
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2048
1923
|
var queryClient = new QueryClient();
|
|
2049
1924
|
var OrderDialog = ({
|
|
2050
1925
|
isOpen,
|
|
2051
1926
|
onClose,
|
|
2052
1927
|
stage,
|
|
2053
1928
|
setStage,
|
|
2054
|
-
circuitJson
|
|
1929
|
+
circuitJson,
|
|
1930
|
+
packageReleaseId
|
|
2055
1931
|
}) => {
|
|
2056
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ jsx20(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx20(AlertDialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx20(AlertDialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */ jsx20("div", { className: "rf-relative rf-w-full", children: stage === "initial" && /* @__PURE__ */ jsx20(
|
|
2057
1933
|
InitialOrderScreen,
|
|
2058
1934
|
{
|
|
2059
1935
|
onCancel: onClose,
|
|
2060
|
-
|
|
1936
|
+
packageReleaseId: packageReleaseId ?? ""
|
|
2061
1937
|
}
|
|
2062
1938
|
) }) }) }) });
|
|
2063
1939
|
};
|
|
2064
1940
|
|
|
2065
1941
|
// lib/components/OrderDialog/CliOrderDialog.tsx
|
|
2066
|
-
import { jsx as
|
|
1942
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2067
1943
|
var CliOrderDialog = ({
|
|
2068
1944
|
isOpen,
|
|
2069
1945
|
onClose,
|
|
@@ -2071,7 +1947,7 @@ var CliOrderDialog = ({
|
|
|
2071
1947
|
setStage
|
|
2072
1948
|
}) => {
|
|
2073
1949
|
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
2074
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ jsx21(
|
|
2075
1951
|
OrderDialog,
|
|
2076
1952
|
{
|
|
2077
1953
|
isOpen,
|
|
@@ -2084,10 +1960,10 @@ var CliOrderDialog = ({
|
|
|
2084
1960
|
};
|
|
2085
1961
|
|
|
2086
1962
|
// lib/components/OrderDialog/useOrderDialog.tsx
|
|
2087
|
-
import { useState as
|
|
1963
|
+
import { useState as useState6 } from "react";
|
|
2088
1964
|
var useOrderDialogCli = () => {
|
|
2089
|
-
const [isOpen, setIsOpen] =
|
|
2090
|
-
const [stage, setStage] =
|
|
1965
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1966
|
+
const [stage, setStage] = useState6("initial");
|
|
2091
1967
|
const handleClose = () => {
|
|
2092
1968
|
setIsOpen(false);
|
|
2093
1969
|
setStage("initial");
|
|
@@ -2103,8 +1979,8 @@ var useOrderDialogCli = () => {
|
|
|
2103
1979
|
};
|
|
2104
1980
|
var useOrderDialog = () => {
|
|
2105
1981
|
useStyles();
|
|
2106
|
-
const [isOpen, setIsOpen] =
|
|
2107
|
-
const [stage, setStage] =
|
|
1982
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1983
|
+
const [stage, setStage] = useState6("initial");
|
|
2108
1984
|
const handleClose = () => {
|
|
2109
1985
|
setIsOpen(false);
|
|
2110
1986
|
setStage("initial");
|
|
@@ -2147,8 +2023,7 @@ export {
|
|
|
2147
2023
|
AlertDialogTitle,
|
|
2148
2024
|
AlertDialogDescription,
|
|
2149
2025
|
AlertDialogCancel,
|
|
2150
|
-
|
|
2151
|
-
toast2 as toast,
|
|
2026
|
+
toast,
|
|
2152
2027
|
useOrderDialogCli,
|
|
2153
2028
|
useOrderDialog,
|
|
2154
2029
|
CadViewer2 as CadViewer,
|
package/dist/preview.d.ts
CHANGED