@comergehq/studio 0.1.11 → 0.1.12

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/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _comergehq_studio_control from '@comergehq/studio-control';
2
3
  import { ViewStyle } from 'react-native';
3
4
  import { SupabaseClient } from '@supabase/supabase-js';
4
5
 
@@ -8,8 +9,10 @@ type ComergeStudioProps = {
8
9
  appKey?: string;
9
10
  onNavigateHome?: () => void;
10
11
  style?: ViewStyle;
12
+ showFloatingButton?: boolean;
13
+ studioControlOptions?: _comergehq_studio_control.StudioControlOptions;
11
14
  };
12
- declare function ComergeStudio({ appId, apiKey, appKey, onNavigateHome, style, }: ComergeStudioProps): react_jsx_runtime.JSX.Element;
15
+ declare function ComergeStudio({ appId, apiKey, appKey, onNavigateHome, style, showFloatingButton, studioControlOptions, }: ComergeStudioProps): react_jsx_runtime.JSX.Element;
13
16
 
14
17
  declare function setSupabaseClient(client: SupabaseClient): void;
15
18
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _comergehq_studio_control from '@comergehq/studio-control';
2
3
  import { ViewStyle } from 'react-native';
3
4
  import { SupabaseClient } from '@supabase/supabase-js';
4
5
 
@@ -8,8 +9,10 @@ type ComergeStudioProps = {
8
9
  appKey?: string;
9
10
  onNavigateHome?: () => void;
10
11
  style?: ViewStyle;
12
+ showFloatingButton?: boolean;
13
+ studioControlOptions?: _comergehq_studio_control.StudioControlOptions;
11
14
  };
12
- declare function ComergeStudio({ appId, apiKey, appKey, onNavigateHome, style, }: ComergeStudioProps): react_jsx_runtime.JSX.Element;
15
+ declare function ComergeStudio({ appId, apiKey, appKey, onNavigateHome, style, showFloatingButton, studioControlOptions, }: ComergeStudioProps): react_jsx_runtime.JSX.Element;
13
16
 
14
17
  declare function setSupabaseClient(client: SupabaseClient): void;
15
18
 
package/dist/index.js CHANGED
@@ -6441,6 +6441,7 @@ function useOptimisticChatMessages({
6441
6441
  }
6442
6442
 
6443
6443
  // src/studio/ui/StudioOverlay.tsx
6444
+ var import_studio_control = require("@comergehq/studio-control");
6444
6445
  var import_jsx_runtime57 = require("react/jsx-runtime");
6445
6446
  function StudioOverlay({
6446
6447
  captureTargetRef,
@@ -6468,11 +6469,14 @@ function StudioOverlay({
6468
6469
  chatSending,
6469
6470
  chatShowTypingIndicator,
6470
6471
  onSendChat,
6471
- onNavigateHome
6472
+ onNavigateHome,
6473
+ showFloatingButton,
6474
+ studioControlOptions
6472
6475
  }) {
6473
6476
  const theme = useTheme();
6474
6477
  const { width } = (0, import_react_native54.useWindowDimensions)();
6475
6478
  const [sheetOpen, setSheetOpen] = React41.useState(false);
6479
+ const sheetOpenRef = React41.useRef(sheetOpen);
6476
6480
  const [activePage, setActivePage] = React41.useState("preview");
6477
6481
  const [drawing, setDrawing] = React41.useState(false);
6478
6482
  const [chatAttachments, setChatAttachments] = React41.useState([]);
@@ -6553,6 +6557,20 @@ function StudioOverlay({
6553
6557
  },
6554
6558
  [closeSheet, onTestMr]
6555
6559
  );
6560
+ React41.useEffect(() => {
6561
+ sheetOpenRef.current = sheetOpen;
6562
+ }, [sheetOpen]);
6563
+ React41.useEffect(() => {
6564
+ const poller = (0, import_studio_control.startStudioControlPolling)((action) => {
6565
+ if (action === "show" && !sheetOpenRef.current) openSheet();
6566
+ if (action === "hide" && sheetOpenRef.current) closeSheet();
6567
+ if (action === "toggle") toggleSheet();
6568
+ }, studioControlOptions);
6569
+ return () => poller.stop();
6570
+ }, [closeSheet, openSheet, studioControlOptions, toggleSheet]);
6571
+ React41.useEffect(() => {
6572
+ void (0, import_studio_control.publishComergeStudioUIState)(sheetOpen, studioControlOptions);
6573
+ }, [sheetOpen, studioControlOptions]);
6556
6574
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
6557
6575
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(EdgeGlowFrame, { visible: isTesting, role: "accent", thickness: 40, intensity: 1 }),
6558
6576
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(StudioBottomSheet, { open: sheetOpen, onOpenChange: handleSheetOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
@@ -6609,7 +6627,7 @@ function StudioOverlay({
6609
6627
  )
6610
6628
  }
6611
6629
  ) }),
6612
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6630
+ showFloatingButton && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6613
6631
  FloatingDraggableButton,
6614
6632
  {
6615
6633
  visible: !sheetOpen && !drawing,
@@ -6661,7 +6679,9 @@ function ComergeStudio({
6661
6679
  apiKey,
6662
6680
  appKey = "MicroMain",
6663
6681
  onNavigateHome,
6664
- style
6682
+ style,
6683
+ showFloatingButton = true,
6684
+ studioControlOptions
6665
6685
  }) {
6666
6686
  const [activeAppId, setActiveAppId] = React42.useState(appId);
6667
6687
  const [runtimeAppId, setRuntimeAppId] = React42.useState(appId);
@@ -6687,7 +6707,9 @@ function ComergeStudio({
6687
6707
  platform,
6688
6708
  onNavigateHome,
6689
6709
  captureTargetRef,
6690
- style
6710
+ style,
6711
+ showFloatingButton,
6712
+ studioControlOptions
6691
6713
  }
6692
6714
  ) }) }) });
6693
6715
  }
@@ -6703,7 +6725,9 @@ function ComergeStudioInner({
6703
6725
  platform,
6704
6726
  onNavigateHome,
6705
6727
  captureTargetRef,
6706
- style
6728
+ style,
6729
+ showFloatingButton,
6730
+ studioControlOptions
6707
6731
  }) {
6708
6732
  const { app, loading: appLoading } = useApp(activeAppId);
6709
6733
  const { app: runtimeAppFromHook } = useApp(runtimeAppId, { enabled: runtimeAppId !== activeAppId });
@@ -6853,7 +6877,9 @@ function ComergeStudioInner({
6853
6877
  chatSending: actions.sending,
6854
6878
  chatShowTypingIndicator,
6855
6879
  onSendChat: (text, attachments) => actions.sendEdit({ prompt: text, attachments }),
6856
- onNavigateHome
6880
+ onNavigateHome,
6881
+ showFloatingButton,
6882
+ studioControlOptions
6857
6883
  }
6858
6884
  )
6859
6885
  ] }) });