@tscircuit/runframe 0.0.439 → 0.0.441

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.
@@ -1092,7 +1092,7 @@ var RenderLogViewer = ({
1092
1092
  };
1093
1093
 
1094
1094
  // package.json
1095
- var version = "0.0.438";
1095
+ var version = "0.0.440";
1096
1096
 
1097
1097
  // lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
1098
1098
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -1717,6 +1717,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
1717
1717
 
1718
1718
  // lib/components/OrderDialog/InitialOrder.tsx
1719
1719
  import { Loader2 as Loader22 } from "lucide-react";
1720
+ import { GitHubLogoIcon as GitHubLogoIcon2 } from "@radix-ui/react-icons";
1720
1721
  import { useEffect as useEffect3, useState as useState6 } from "react";
1721
1722
 
1722
1723
  // lib/components/OrderDialog/VendorQuoteCard.tsx
@@ -1833,12 +1834,12 @@ var createOrderQuote = async (packageReleaseId) => {
1833
1834
  }
1834
1835
  }).json();
1835
1836
  return order_quote_id;
1836
- } catch (err) {
1837
- if (err instanceof HTTPError) {
1838
- const errorBody = await err.response.json();
1839
- throw new Error(errorBody.message || err.message);
1837
+ } catch (error) {
1838
+ if (error instanceof HTTPError) {
1839
+ const errorBody = await error.response.json();
1840
+ throw errorBody;
1840
1841
  }
1841
- throw err;
1842
+ throw error;
1842
1843
  }
1843
1844
  };
1844
1845
  var getOrderQuote = async (orderQuoteId) => {
@@ -1854,12 +1855,7 @@ var getOrderQuote = async (orderQuoteId) => {
1854
1855
  var useCreateOrderQuote = (packageReleaseId) => {
1855
1856
  return useMutation({
1856
1857
  mutationFn: async () => {
1857
- try {
1858
- return await createOrderQuote(packageReleaseId);
1859
- } catch (error) {
1860
- console.error("Error creating order quote:", error);
1861
- throw error instanceof Error ? error : new Error("Failed to create order quote");
1862
- }
1858
+ return await createOrderQuote(packageReleaseId);
1863
1859
  }
1864
1860
  });
1865
1861
  };
@@ -1897,7 +1893,8 @@ var useOrderQuotePolling = (orderQuoteId) => {
1897
1893
  import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
1898
1894
  var InitialOrderScreen = ({
1899
1895
  onCancel,
1900
- packageReleaseId
1896
+ packageReleaseId,
1897
+ signIn
1901
1898
  }) => {
1902
1899
  const [selectedShippingCarrier, setSelectedShippingCarrier] = useState6(null);
1903
1900
  const {
@@ -1929,6 +1926,10 @@ var InitialOrderScreen = ({
1929
1926
  useEffect3(() => {
1930
1927
  createOrderQuote2();
1931
1928
  }, [packageReleaseId, createOrderQuote2]);
1929
+ const isNoTokenError = (createOrderQuoteError?.error_code?.includes("no_token") || orderQuote?.error?.error_code?.includes("no_token")) && signIn;
1930
+ if (isNoTokenError) {
1931
+ return /* @__PURE__ */ jsx19(SignInView, { signIn });
1932
+ }
1932
1933
  return /* @__PURE__ */ jsxs15("div", { className: "rf-max-w-lg rf-mx-auto rf-bg-white rf-rounded-2xl rf-py-8 rf-flex rf-flex-col rf-gap-3", children: [
1933
1934
  /* @__PURE__ */ jsx19("h2", { className: "rf-text-3xl rf-font-bold rf-text-center", children: "Order PCB" }),
1934
1935
  (!orderQuoteId || !orderQuote || !orderQuote?.is_completed) && !isError && /* @__PURE__ */ jsx19(LoadingMessage, { message: "Fetching quotes..." }),
@@ -1989,6 +1990,16 @@ var LoadingMessage = ({ message }) => /* @__PURE__ */ jsxs15("div", { className:
1989
1990
  /* @__PURE__ */ jsx19("p", { className: "rf-text-gray-600", children: message })
1990
1991
  ] });
1991
1992
  var ErrorMessage = ({ message }) => /* @__PURE__ */ jsx19("div", { className: "rf-text-red-600 rf-text-center rf-py-12", children: message });
1993
+ var SignInView = ({ signIn }) => /* @__PURE__ */ jsxs15("div", { className: "rf-max-w-lg rf-mx-auto rf-bg-white rf-rounded-2xl rf-py-8 rf-flex rf-flex-col rf-gap-3", children: [
1994
+ /* @__PURE__ */ jsx19("h2", { className: "rf-text-3xl rf-font-bold rf-text-center", children: "Order PCB" }),
1995
+ /* @__PURE__ */ jsxs15("div", { className: "rf-flex rf-flex-col rf-items-center rf-gap-4 rf-py-8", children: [
1996
+ /* @__PURE__ */ jsx19("p", { className: "rf-text-gray-600", children: "Please sign in to continue" }),
1997
+ /* @__PURE__ */ jsxs15(Button, { onClick: signIn, className: "rf-flex rf-items-center rf-gap-2", children: [
1998
+ /* @__PURE__ */ jsx19(GitHubLogoIcon2, { className: "rf-w-5 rf-h-5" }),
1999
+ "Sign in with GitHub"
2000
+ ] })
2001
+ ] })
2002
+ ] });
1992
2003
 
1993
2004
  // lib/components/OrderDialog/OrderDialog.tsx
1994
2005
  import { jsx as jsx20 } from "react/jsx-runtime";
@@ -1999,7 +2010,8 @@ var OrderDialog = ({
1999
2010
  stage,
2000
2011
  setStage,
2001
2012
  circuitJson,
2002
- packageReleaseId
2013
+ packageReleaseId,
2014
+ signIn
2003
2015
  }) => {
2004
2016
  return /* @__PURE__ */ jsx20(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx20(
2005
2017
  Dialog,
@@ -2012,7 +2024,9 @@ var OrderDialog = ({
2012
2024
  InitialOrderScreen,
2013
2025
  {
2014
2026
  onCancel: onClose,
2015
- packageReleaseId: packageReleaseId ?? ""
2027
+ packageReleaseId: packageReleaseId ?? "",
2028
+ signIn: signIn ?? (() => {
2029
+ })
2016
2030
  }
2017
2031
  ) }) })
2018
2032
  }
@@ -2025,12 +2039,14 @@ var CliOrderDialog = ({
2025
2039
  isOpen,
2026
2040
  onClose,
2027
2041
  stage,
2028
- setStage
2042
+ setStage,
2043
+ signIn
2029
2044
  }) => {
2030
2045
  const circuitJson = useRunFrameStore((state) => state.circuitJson);
2031
2046
  return /* @__PURE__ */ jsx21(
2032
2047
  OrderDialog,
2033
2048
  {
2049
+ signIn,
2034
2050
  isOpen,
2035
2051
  onClose,
2036
2052
  stage,
@@ -2042,6 +2058,7 @@ var CliOrderDialog = ({
2042
2058
 
2043
2059
  // lib/components/OrderDialog/useOrderDialog.tsx
2044
2060
  import { useState as useState7 } from "react";
2061
+ import { jsx as jsx22 } from "react/jsx-runtime";
2045
2062
  var useOrderDialogCli = () => {
2046
2063
  const [isOpen, setIsOpen] = useState7(false);
2047
2064
  const [stage, setStage] = useState7("initial");
@@ -2058,7 +2075,7 @@ var useOrderDialogCli = () => {
2058
2075
  OrderDialog: CliOrderDialog
2059
2076
  };
2060
2077
  };
2061
- var useOrderDialog = () => {
2078
+ var useOrderDialog = (signIn) => {
2062
2079
  useStyles();
2063
2080
  const [isOpen, setIsOpen] = useState7(false);
2064
2081
  const [stage, setStage] = useState7("initial");
@@ -2072,7 +2089,7 @@ var useOrderDialog = () => {
2072
2089
  open: () => setIsOpen(true),
2073
2090
  close: handleClose,
2074
2091
  setStage,
2075
- OrderDialog
2092
+ OrderDialog: (props) => /* @__PURE__ */ jsx22(OrderDialog, { ...props, signIn })
2076
2093
  };
2077
2094
  };
2078
2095
 
package/dist/preview.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ManualEditEvent } from '@tscircuit/props';
3
3
  import { CircuitJson, AnyCircuitElement } from 'circuit-json';
4
4
  import * as react from 'react';
5
- import { ComponentProps } from 'react';
5
+ import { ComponentProps, FC } from 'react';
6
6
  import { PCBViewer } from '@tscircuit/pcb-viewer';
7
7
  export { PCBViewer as PcbViewer } from '@tscircuit/pcb-viewer';
8
8
  export { CadViewer } from '@tscircuit/3d-viewer';
@@ -87,21 +87,24 @@ declare const PcbViewerWithContainerHeight: ({ containerClassName, ...props }: {
87
87
  containerClassName?: string;
88
88
  } & ComponentProps<typeof PCBViewer>) => react_jsx_runtime.JSX.Element;
89
89
 
90
- interface OrderDialogProps {
90
+ interface CliOrderDialogProps {
91
91
  isOpen: boolean;
92
92
  onClose: () => void;
93
93
  stage: "initial" | "progress" | "checkout";
94
94
  setStage: (stage: "initial" | "progress" | "checkout") => void;
95
- circuitJson?: CircuitJson;
96
- packageReleaseId?: string;
95
+ signIn?: () => void;
97
96
  }
98
97
 
99
- interface CliOrderDialogProps {
98
+ interface OrderDialogProps {
100
99
  isOpen: boolean;
101
100
  onClose: () => void;
102
101
  stage: "initial" | "progress" | "checkout";
103
102
  setStage: (stage: "initial" | "progress" | "checkout") => void;
103
+ circuitJson?: CircuitJson;
104
+ packageReleaseId?: string;
105
+ signIn?: () => void;
104
106
  }
107
+ declare const OrderDialog: FC<OrderDialogProps>;
105
108
 
106
109
  type OrderStage = "initial" | "progress" | "checkout";
107
110
  declare const useOrderDialogCli: () => {
@@ -112,13 +115,13 @@ declare const useOrderDialogCli: () => {
112
115
  setStage: react.Dispatch<react.SetStateAction<OrderStage>>;
113
116
  OrderDialog: react.FC<CliOrderDialogProps>;
114
117
  };
115
- declare const useOrderDialog: () => {
118
+ declare const useOrderDialog: (signIn: () => void) => {
116
119
  isOpen: boolean;
117
120
  stage: OrderStage;
118
121
  open: () => void;
119
122
  close: () => void;
120
123
  setStage: react.Dispatch<react.SetStateAction<OrderStage>>;
121
- OrderDialog: react.FC<OrderDialogProps>;
124
+ OrderDialog: (props: Omit<Parameters<typeof OrderDialog>[0], "signIn">) => react_jsx_runtime.JSX.Element;
122
125
  };
123
126
 
124
127
  export { BomTable, CircuitJsonPreview, PcbViewerWithContainerHeight, type PreviewContentProps, type TabId, linkify, useOrderDialog, useOrderDialogCli };
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-UDQFHNUB.js";
11
+ } from "./chunk-B3RZ5F6N.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  useOrderDialog,
27
27
  useOrderDialogCli,
28
28
  useRunFrameStore
29
- } from "./chunk-UDQFHNUB.js";
29
+ } from "./chunk-B3RZ5F6N.js";
30
30
 
31
31
  // lib/components/RunFrame/RunFrame.tsx
32
32
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";