@magemetrics/ai 0.0.39 → 0.0.40

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.
@@ -32,6 +32,7 @@ declare type PersistenceOptions = "localStorage" | "queryParam" | "none";
32
32
 
33
33
  declare type StartOptions = DisplayControlProps & {
34
34
  label?: string;
35
+ recommendationsLabel?: string;
35
36
  };
36
37
 
37
38
  export { }
@@ -1,4 +1,4 @@
1
- import { g as o } from "./web-component-Bkvh5GBk.js";
1
+ import { g as o } from "./web-component-Do6GLPMb.js";
2
2
  var r, e;
3
3
  function t() {
4
4
  return e || (e = 1, r = function() {
@@ -15928,7 +15928,7 @@ class She {
15928
15928
  close: () => {
15929
15929
  this.conn = null;
15930
15930
  }
15931
- }), import("./browser-6VS_4eco.js").then((t) => t.b).then(({ default: t }) => {
15931
+ }), import("./browser-DSh6QxsE.js").then((t) => t.b).then(({ default: t }) => {
15932
15932
  this.conn = new t(this.endpointURL(), void 0, {
15933
15933
  headers: this.headers
15934
15934
  }), this.setupConnection();
@@ -21910,7 +21910,7 @@ const Yme = (e, t) => {
21910
21910
  loading: !0
21911
21911
  }), o = U.useRef(Symbol("initial")), { data: s } = qme(t), { mutateAsync: l, isPending: u } = Gme();
21912
21912
  U.useEffect(() => {
21913
- rme(r, "0.0.39");
21913
+ rme(r, "0.0.40");
21914
21914
  }, [r]), U.useEffect(() => {
21915
21915
  if (console.debug("Main Supabase auth effect re-running."), console.debug(
21916
21916
  `Effect dependencies: apiInformation=${!!s}, externalJwt='${n}', isExchangingTokens=${u}, processedJwtRef='${String(o.current)}'`
@@ -34826,26 +34826,27 @@ ${n}`);
34826
34826
  },
34827
34827
  staleTime: 60 * 1e3
34828
34828
  }), k1e = () => Pi(U1e()), P1e = ({
34829
- startFlow: e
34829
+ label: e,
34830
+ startFlow: t
34830
34831
  }) => {
34831
- const { data: t, status: n } = k1e(), r = U.useMemo(() => t == null ? void 0 : t.slice(0, 3), [t]);
34832
+ const { data: n, status: r } = k1e(), i = U.useMemo(() => n == null ? void 0 : n.slice(0, 3), [n]);
34832
34833
  return /* @__PURE__ */ I.jsxs("div", { className: "mm:flex mm:flex-col mm:gap-4 mm:flex-1", children: [
34833
- /* @__PURE__ */ I.jsx(ct, { as: "h2", className: "mm:uppercase mm:font-semibold mm:text-base", children: "Recommendations based on your data" }),
34834
+ /* @__PURE__ */ I.jsx(ct, { as: "h2", className: "mm:uppercase mm:font-semibold mm:text-base", children: e }),
34834
34835
  /* @__PURE__ */ I.jsx(
34835
34836
  "div",
34836
34837
  {
34837
34838
  className: st(
34838
34839
  "mm:flex mm:flex-col mm:md:flex-row mm:items-stretch mm:flex-nowrap mm:gap-1.5"
34839
34840
  ),
34840
- children: n === "success" ? r == null ? void 0 : r.map((i) => /* @__PURE__ */ I.jsx(
34841
+ children: r === "success" ? i == null ? void 0 : i.map((a) => /* @__PURE__ */ I.jsx(
34841
34842
  F1e,
34842
34843
  {
34843
- startFlow: e,
34844
- starter: i.starter,
34845
- explanation: i.explanation,
34846
- type: i.type
34844
+ startFlow: t,
34845
+ starter: a.starter,
34846
+ explanation: a.explanation,
34847
+ type: a.type
34847
34848
  },
34848
- i.starter
34849
+ a.starter
34849
34850
  )) : /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
34850
34851
  /* @__PURE__ */ I.jsx(RE, {}),
34851
34852
  /* @__PURE__ */ I.jsx(RE, {}),
@@ -34879,27 +34880,28 @@ ${n}`);
34879
34880
  ) })
34880
34881
  ] }), m5 = ({
34881
34882
  label: e,
34882
- showRecentChats: t,
34883
- showRecommendations: n,
34884
- showBackdrop: r,
34885
- onClose: i
34883
+ recommendationsLabel: t,
34884
+ showRecentChats: n,
34885
+ showRecommendations: r,
34886
+ showBackdrop: i,
34887
+ onClose: a
34886
34888
  }) => {
34887
- const [a, o] = U.useState(""), [s, l] = U.useState(!1), u = U.useRef(null), A = Oh(rA), { mutate: f } = Jge({
34888
- onSuccess: (B) => {
34889
- A(B.flowId);
34890
- }
34891
- }), h = Yve(() => {
34892
- l(!1), i == null || i();
34893
- }), p = (B) => {
34894
- f(B.trim());
34895
- }, v = U.useMemo(
34896
- () => a.length > 30 || /[\r\n]/.test(a) ? a.slice(0, 30).replace(/[\r\n]/g, " ") + "…" : a,
34897
- [a]
34898
- ), g = s && n, w = s && t, b = s && r;
34889
+ const [o, s] = U.useState(""), [l, u] = U.useState(!1), A = U.useRef(null), f = Oh(rA), { mutate: h } = Jge({
34890
+ onSuccess: (x) => {
34891
+ f(x.flowId);
34892
+ }
34893
+ }), p = Yve(() => {
34894
+ u(!1), a == null || a();
34895
+ }), v = (x) => {
34896
+ h(x.trim());
34897
+ }, g = U.useMemo(
34898
+ () => o.length > 30 || /[\r\n]/.test(o) ? o.slice(0, 30).replace(/[\r\n]/g, " ") + "…" : o,
34899
+ [o]
34900
+ ), w = l && r, b = l && n, B = l && i;
34899
34901
  return U.useEffect(() => {
34900
- u.current && (u.current.style.height = "auto", s ? u.current.style.height = `${u.current.scrollHeight}px` : u.current.style.height = "2.25rem");
34901
- }, [a, s]), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
34902
- b && /* @__PURE__ */ I.jsx(
34902
+ A.current && (A.current.style.height = "auto", l ? A.current.style.height = `${A.current.scrollHeight}px` : A.current.style.height = "2.25rem");
34903
+ }, [o, l]), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
34904
+ B && /* @__PURE__ */ I.jsx(
34903
34905
  no.div,
34904
34906
  {
34905
34907
  variants: R$,
@@ -34922,9 +34924,9 @@ ${n}`);
34922
34924
  "div",
34923
34925
  {
34924
34926
  className: "mm:flex mm:flex-col mm:pb-4 mm:flex-1 mm:gap-3",
34925
- ref: h,
34927
+ ref: p,
34926
34928
  children: [
34927
- g && /* @__PURE__ */ I.jsx(ia, { asChild: !0, children: /* @__PURE__ */ I.jsx(
34929
+ w && /* @__PURE__ */ I.jsx(ia, { asChild: !0, children: /* @__PURE__ */ I.jsx(
34928
34930
  no.div,
34929
34931
  {
34930
34932
  initial: { opacity: 0 },
@@ -34936,14 +34938,20 @@ ${n}`);
34936
34938
  },
34937
34939
  style: { overflow: "hidden", originY: 1 },
34938
34940
  className: "mm:border-none",
34939
- children: /* @__PURE__ */ I.jsx(P1e, { startFlow: p })
34941
+ children: /* @__PURE__ */ I.jsx(
34942
+ P1e,
34943
+ {
34944
+ label: t,
34945
+ startFlow: v
34946
+ }
34947
+ )
34940
34948
  }
34941
34949
  ) }),
34942
34950
  /* @__PURE__ */ I.jsx(ia, { className: "mm:relative mm:z-1", children: /* @__PURE__ */ I.jsxs(
34943
34951
  _u,
34944
34952
  {
34945
- direction: s ? "column" : "row",
34946
- className: s ? "mm:gap-2" : "mm:gap-4",
34953
+ direction: l ? "column" : "row",
34954
+ className: l ? "mm:gap-2" : "mm:gap-4",
34947
34955
  children: [
34948
34956
  /* @__PURE__ */ I.jsxs(Yt, { className: "mm:justify-between mm:items-center", children: [
34949
34957
  /* @__PURE__ */ I.jsx(
@@ -34955,18 +34963,18 @@ ${n}`);
34955
34963
  children: e
34956
34964
  }
34957
34965
  ),
34958
- w && /* @__PURE__ */ I.jsx(O1e, {})
34966
+ b && /* @__PURE__ */ I.jsx(O1e, {})
34959
34967
  ] }),
34960
34968
  /* @__PURE__ */ I.jsx(
34961
34969
  "form",
34962
34970
  {
34963
- onSubmit: (B) => {
34964
- B.preventDefault(), a.length > 0 && p(a);
34971
+ onSubmit: (x) => {
34972
+ x.preventDefault(), o.length > 0 && v(o);
34965
34973
  },
34966
34974
  className: st(
34967
34975
  "mm:p-[1px] mm:rounded-[4px] mm:w-full",
34968
- !s && "mm:bg-muted",
34969
- s && "mm-highlight-gradient mm:shadow-secondary/20"
34976
+ !l && "mm:bg-muted",
34977
+ l && "mm-highlight-gradient mm:shadow-secondary/20"
34970
34978
  ),
34971
34979
  children: /* @__PURE__ */ I.jsxs(_u, { className: "mm:bg-background mm:rounded-[3px] mm:flex-grow", children: [
34972
34980
  /* @__PURE__ */ I.jsx(
@@ -34974,18 +34982,18 @@ ${n}`);
34974
34982
  {
34975
34983
  className: st(
34976
34984
  "mm:leading-6 mm:w-full mm:resize-none mm:box-border mm:border-none mm:rounded-[3px] mm:outline-none mm:duration-200 mm:ease-in-out mm:max-h-[500px] mm:px-2 mm:py-1.5 mm:font-serif",
34977
- !s && "mm:overflow-hidden"
34985
+ !l && "mm:overflow-hidden"
34978
34986
  ),
34979
- ref: u,
34980
- onChange: (B) => {
34981
- o(B.target.value);
34987
+ ref: A,
34988
+ onChange: (x) => {
34989
+ s(x.target.value);
34982
34990
  },
34983
- value: s ? a : v,
34991
+ value: l ? o : g,
34984
34992
  onFocus: () => {
34985
- l(!0);
34993
+ u(!0);
34986
34994
  },
34987
- onKeyDown: (B) => {
34988
- B.key === "Enter" && !B.shiftKey && (B.preventDefault(), p(a));
34995
+ onKeyDown: (x) => {
34996
+ x.key === "Enter" && !x.shiftKey && (x.preventDefault(), v(o));
34989
34997
  }
34990
34998
  }
34991
34999
  ),
@@ -34994,13 +35002,13 @@ ${n}`);
34994
35002
  {
34995
35003
  variant: "icon",
34996
35004
  type: "submit",
34997
- className: st(!s && "mm:self-center"),
35005
+ className: st(!l && "mm:self-center"),
34998
35006
  children: /* @__PURE__ */ I.jsx(
34999
35007
  fee,
35000
35008
  {
35001
35009
  size: 18,
35002
35010
  className: st(
35003
- a.length > 0 && "mm:fill-secondary"
35011
+ o.length > 0 && "mm:fill-secondary"
35004
35012
  )
35005
35013
  }
35006
35014
  )
@@ -83366,13 +83374,14 @@ const ort = ({
83366
83374
  onClose: e,
83367
83375
  startOptions: t
83368
83376
  }) => {
83369
- const n = pg(rA), r = pg(Em), a = !!n && r === "conversation", o = (t == null ? void 0 : t.showRecentChats) ?? !1, s = (t == null ? void 0 : t.showRecommendations) ?? !1, l = (t == null ? void 0 : t.showBackdrop) ?? !1, u = (t == null ? void 0 : t.label) || "Ask your data about";
83377
+ const n = pg(rA), r = pg(Em), a = !!n && r === "conversation", o = (t == null ? void 0 : t.showRecentChats) ?? !1, s = (t == null ? void 0 : t.showRecommendations) ?? !1, l = (t == null ? void 0 : t.showBackdrop) ?? !1, u = (t == null ? void 0 : t.label) || "Ask your data about", A = (t == null ? void 0 : t.recommendationsLabel) || "Recommendations based on your data";
83370
83378
  return /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
83371
83379
  /* @__PURE__ */ I.jsx(Q1e, { children: /* @__PURE__ */ I.jsx(Drt, { opened: a }) }),
83372
83380
  !a && /* @__PURE__ */ I.jsx(
83373
83381
  D1e,
83374
83382
  {
83375
83383
  label: u,
83384
+ recommendationsLabel: A,
83376
83385
  showRecentChats: o,
83377
83386
  showRecommendations: s,
83378
83387
  showBackdrop: l,
@@ -34,6 +34,7 @@ export declare type SearchElementAttributes = ComponentPropsWithoutRef<typeof Ma
34
34
 
35
35
  declare type StartOptions = DisplayControlProps & {
36
36
  label?: string;
37
+ recommendationsLabel?: string;
37
38
  };
38
39
 
39
40
  export { }
@@ -1,4 +1,4 @@
1
- import { c as o, l as r } from "./web-component-Bkvh5GBk.js";
1
+ import { c as o, l as r } from "./web-component-Do6GLPMb.js";
2
2
  export {
3
3
  o as createMagemetrics,
4
4
  r as logout
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magemetrics/ai",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@ai-sdk/react": "^1.2.12",