@tscircuit/runframe 0.0.470 → 0.0.472
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-FSAFS3DG.js → chunk-62PYVATA.js} +32 -22
- package/dist/preview.js +1 -1
- package/dist/runner.js +1 -1
- package/dist/standalone-preview.min.js +627 -627
- package/dist/standalone.min.js +674 -674
- package/package.json +2 -2
|
@@ -1094,7 +1094,7 @@ var RenderLogViewer = ({
|
|
|
1094
1094
|
};
|
|
1095
1095
|
|
|
1096
1096
|
// package.json
|
|
1097
|
-
var version = "0.0.
|
|
1097
|
+
var version = "0.0.471";
|
|
1098
1098
|
|
|
1099
1099
|
// lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
|
|
1100
1100
|
import "three";
|
|
@@ -1727,7 +1727,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
|
|
|
1727
1727
|
// lib/components/OrderDialog/InitialOrder.tsx
|
|
1728
1728
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
1729
1729
|
import { GitHubLogoIcon as GitHubLogoIcon2 } from "@radix-ui/react-icons";
|
|
1730
|
-
import { useEffect as
|
|
1730
|
+
import { useEffect as useEffect4, useMemo as useMemo2, useState as useState6 } from "react";
|
|
1731
1731
|
|
|
1732
1732
|
// lib/components/OrderDialog/VendorQuoteCard.tsx
|
|
1733
1733
|
import { Truck, Package } from "lucide-react";
|
|
@@ -1830,6 +1830,7 @@ var registryKy = {
|
|
|
1830
1830
|
|
|
1831
1831
|
// lib/hooks/use-create-order-quote.ts
|
|
1832
1832
|
import { useMutation } from "react-query";
|
|
1833
|
+
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
1833
1834
|
|
|
1834
1835
|
// lib/api/order-quotes.ts
|
|
1835
1836
|
import { HTTPError } from "ky";
|
|
@@ -1866,12 +1867,20 @@ var getOrderQuote = async (orderQuoteId) => {
|
|
|
1866
1867
|
};
|
|
1867
1868
|
|
|
1868
1869
|
// lib/hooks/use-create-order-quote.ts
|
|
1869
|
-
var useCreateOrderQuote = (packageReleaseId) => {
|
|
1870
|
-
|
|
1870
|
+
var useCreateOrderQuote = (packageReleaseId, options) => {
|
|
1871
|
+
const initializedRef = useRef2(false);
|
|
1872
|
+
const mutation = useMutation({
|
|
1871
1873
|
mutationFn: async () => {
|
|
1872
1874
|
return await createOrderQuote(packageReleaseId);
|
|
1873
1875
|
}
|
|
1874
1876
|
});
|
|
1877
|
+
useEffect3(() => {
|
|
1878
|
+
if (options?.executeImmediately && !initializedRef.current) {
|
|
1879
|
+
initializedRef.current = true;
|
|
1880
|
+
mutation.mutate();
|
|
1881
|
+
}
|
|
1882
|
+
}, [packageReleaseId, options?.executeImmediately]);
|
|
1883
|
+
return mutation;
|
|
1875
1884
|
};
|
|
1876
1885
|
|
|
1877
1886
|
// lib/hooks/use-order-quote-polling.ts
|
|
@@ -1912,11 +1921,9 @@ var InitialOrderScreen = ({
|
|
|
1912
1921
|
isLoggedIn
|
|
1913
1922
|
}) => {
|
|
1914
1923
|
const [selectedShippingCarrier, setSelectedShippingCarrier] = useState6(null);
|
|
1915
|
-
const {
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
error: createOrderQuoteError
|
|
1919
|
-
} = useCreateOrderQuote(packageReleaseId);
|
|
1924
|
+
const { data: orderQuoteId, error: createOrderQuoteError } = useCreateOrderQuote(packageReleaseId, {
|
|
1925
|
+
executeImmediately: true
|
|
1926
|
+
});
|
|
1920
1927
|
const { data: orderQuote } = useOrderQuotePolling(orderQuoteId);
|
|
1921
1928
|
const redirectToStripeCheckout = async (orderQuoteId2) => {
|
|
1922
1929
|
const stripeCheckoutBaseUrl = getWindowVar(
|
|
@@ -1924,7 +1931,7 @@ var InitialOrderScreen = ({
|
|
|
1924
1931
|
);
|
|
1925
1932
|
window.location.href = `${stripeCheckoutBaseUrl}?client_reference_id=${orderQuoteId2}&shipping_option=${selectedShippingCarrier}`;
|
|
1926
1933
|
};
|
|
1927
|
-
|
|
1934
|
+
useEffect4(() => {
|
|
1928
1935
|
if (selectedShippingCarrier === null && orderQuote && Array.isArray(orderQuote.shipping_options) && orderQuote.shipping_options.length > 0) {
|
|
1929
1936
|
const lowest = orderQuote.shipping_options.reduce(
|
|
1930
1937
|
(min, curr) => curr.cost < min.cost ? curr : min,
|
|
@@ -1933,13 +1940,12 @@ var InitialOrderScreen = ({
|
|
|
1933
1940
|
setSelectedShippingCarrier(lowest?.carrier || null);
|
|
1934
1941
|
}
|
|
1935
1942
|
}, [orderQuote]);
|
|
1936
|
-
const lowestShippingCarrierCost =
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
}, [packageReleaseId, createOrderQuote2]);
|
|
1943
|
+
const lowestShippingCarrierCost = useMemo2(() => {
|
|
1944
|
+
return orderQuote && Array.isArray(orderQuote.shipping_options) && orderQuote.shipping_options.length > 0 ? orderQuote.shipping_options.reduce(
|
|
1945
|
+
(min, curr) => curr.cost < min.cost ? curr : min,
|
|
1946
|
+
orderQuote.shipping_options[0]
|
|
1947
|
+
).cost : 0;
|
|
1948
|
+
}, [orderQuote]);
|
|
1943
1949
|
const isNoTokenError = (createOrderQuoteError?.error?.error_code?.includes("no_token") || orderQuote?.error?.error_code?.includes("no_token")) && signIn;
|
|
1944
1950
|
if (!isLoggedIn || isNoTokenError) {
|
|
1945
1951
|
return /* @__PURE__ */ jsx19(SignInView, { signIn });
|
|
@@ -2075,7 +2081,7 @@ var CliOrderDialog = ({
|
|
|
2075
2081
|
};
|
|
2076
2082
|
|
|
2077
2083
|
// lib/components/OrderDialog/useOrderDialog.tsx
|
|
2078
|
-
import { useState as useState7 } from "react";
|
|
2084
|
+
import { useState as useState7, useMemo as useMemo3, useCallback as useCallback2 } from "react";
|
|
2079
2085
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2080
2086
|
var useOrderDialogCli = () => {
|
|
2081
2087
|
const [isOpen, setIsOpen] = useState7(false);
|
|
@@ -2100,17 +2106,21 @@ var useOrderDialog = ({
|
|
|
2100
2106
|
useStyles();
|
|
2101
2107
|
const [isOpen, setIsOpen] = useState7(false);
|
|
2102
2108
|
const [stage, setStage] = useState7("initial");
|
|
2103
|
-
const handleClose = () => {
|
|
2109
|
+
const handleClose = useCallback2(() => {
|
|
2104
2110
|
setIsOpen(false);
|
|
2105
2111
|
setStage("initial");
|
|
2106
|
-
};
|
|
2112
|
+
}, []);
|
|
2113
|
+
const open = useCallback2(() => setIsOpen(true), []);
|
|
2114
|
+
const MemoizedOrderDialog = useMemo3(() => {
|
|
2115
|
+
return (props) => /* @__PURE__ */ jsx22(OrderDialog, { ...props, signIn: onSignIn, isLoggedIn });
|
|
2116
|
+
}, [isLoggedIn]);
|
|
2107
2117
|
return {
|
|
2108
2118
|
isOpen,
|
|
2109
2119
|
stage,
|
|
2110
|
-
open
|
|
2120
|
+
open,
|
|
2111
2121
|
close: handleClose,
|
|
2112
2122
|
setStage,
|
|
2113
|
-
OrderDialog:
|
|
2123
|
+
OrderDialog: MemoizedOrderDialog
|
|
2114
2124
|
};
|
|
2115
2125
|
};
|
|
2116
2126
|
|
package/dist/preview.js
CHANGED
package/dist/runner.js
CHANGED