randmarcomps 1.154.0 → 1.156.0

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.
@@ -50,10 +50,10 @@ export declare interface AiGeneratedContentProps {
50
50
 
51
51
  declare interface ApiKeyContextType {
52
52
  apiKey: string | null;
53
- setApiKey: (key: string) => void;
54
53
  }
55
54
 
56
- export declare const ApiKeyProvider: ({ children }: {
55
+ export declare const ApiKeyProvider: ({ apiKey, children, }: {
56
+ apiKey?: string | null;
57
57
  children: ReactNode;
58
58
  }) => JSX.Element;
59
59
 
@@ -9476,10 +9476,10 @@ function Toaster() {
9476
9476
  /* @__PURE__ */ jsx(ToastViewport, {})
9477
9477
  ] });
9478
9478
  }
9479
- const ApiKeyContext = createContext(void 0), ApiKeyProvider = ({ children: e }) => {
9480
- const [t, n] = useState(null);
9481
- return /* @__PURE__ */ jsx(ApiKeyContext.Provider, { value: { apiKey: t, setApiKey: n }, children: e });
9482
- }, useApiKey = () => {
9479
+ const ApiKeyContext = createContext(void 0), ApiKeyProvider = ({
9480
+ apiKey: e = null,
9481
+ children: t
9482
+ }) => /* @__PURE__ */ jsx(ApiKeyContext.Provider, { value: { apiKey: e }, children: t }), useApiKey = () => {
9483
9483
  const e = useContext(ApiKeyContext);
9484
9484
  if (!e)
9485
9485
  throw new Error("useApiKey must be used within an ApiKeyProvider");
@@ -58864,7 +58864,7 @@ Dt = new WeakMap(), je = new WeakMap(), Ft = new WeakMap(), qt = new WeakMap(),
58864
58864
  });
58865
58865
  var source_default = JsxParser;
58866
58866
  const GetJSXFromAI = async (e, t, n, o = 3) => {
58867
- const l = "In addition to basic html tags, You have access to these beautiful Handmade Components: Button.", u = "Here is the data to display to the user (If a Handmade Component is a perfect fit for the data, use it. Otherwise, use regular html tags):", d = "Only output a single JSX code snippet. Start with <> and end with </>. All other code will be ignored, so make sure to place all CSS styles inline. Use CSS flex layouts when there is a lot of stuff to display.", f = JSON.stringify(n), p = [t, l, d, u, f, d].join(`\r
58867
+ const l = "In addition to basic html tags, You have access to these beautiful Handmade Components: Button.", u = "Here is the data to display to the user (If a Handmade Component is a perfect fit for the data, use it. Otherwise, use regular html tags) (You have access to this data object in React via the data variable):", d = "Only output a single JSX code snippet. Start with <> and end with </>. All other code will be ignored, so make sure to place all CSS styles inline. Use CSS flex layouts when there is a lot of stuff to display.", f = JSON.stringify(n), p = [t, l, d, u, f, d].join(`\r
58868
58868
  `), b = await new GoogleGenAI({ apiKey: e }).chats.create({
58869
58869
  model: "gemini-2.0-flash-lite"
58870
58870
  }).sendMessage({ message: p }), _ = trimJSXString(b.text ?? "");
@@ -58875,24 +58875,24 @@ function trimJSXString(e) {
58875
58875
  return t === -1 || n === -1 ? "" : e.slice(t, e.indexOf(">", n) + 1);
58876
58876
  }
58877
58877
  function AiGeneratedContent(e) {
58878
- const { appID: t } = useParams(), [n, o] = useState(""), { apiKey: l } = useApiKey();
58878
+ const [t, n] = useState(""), { apiKey: o } = useApiKey();
58879
58879
  return useEffect(() => {
58880
- if (!l || !e.prompt || !e.data) return;
58881
- o("");
58882
- let u = !1;
58883
- return GetJSXFromAI(l, e.prompt, e.data).then((d) => {
58884
- u || o(d);
58880
+ if (!o || !e.prompt || !e.data) return;
58881
+ n("");
58882
+ let l = !1;
58883
+ return GetJSXFromAI(o, e.prompt, e.data).then((u) => {
58884
+ l || n(u);
58885
58885
  }), () => {
58886
- u = !0;
58886
+ l = !0;
58887
58887
  };
58888
- }, [e.prompt, e.data, o, l]), n ? /* @__PURE__ */ jsx(
58888
+ }, [e.prompt, e.data, n, o]), t ? /* @__PURE__ */ jsx(
58889
58889
  source_default,
58890
58890
  {
58891
58891
  bindings: {
58892
- appID: t
58892
+ data: e.data
58893
58893
  },
58894
58894
  components: { Button },
58895
- jsx: n
58895
+ jsx: t
58896
58896
  }
58897
58897
  ) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-32", children: /* @__PURE__ */ jsx(Bot, { className: "m-auto align-middle h-full" }) }) });
58898
58898
  }