@comergehq/studio 0.1.4 → 0.1.6

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.js CHANGED
@@ -218,7 +218,7 @@ var React = __toESM(require("react"));
218
218
  var import_axios = __toESM(require("axios"));
219
219
 
220
220
  // src/core/services/http/baseUrl.ts
221
- var BASE_URL = "http://192.168.8.175:8080";
221
+ var BASE_URL = "https://comerge.ai";
222
222
 
223
223
  // src/core/services/http/public.ts
224
224
  var CLIENT_KEY_HEADER = "x-comerge-api-key";
@@ -1740,6 +1740,16 @@ function StudioBottomSheet({
1740
1740
  const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
1741
1741
  const internalSheetRef = React8.useRef(null);
1742
1742
  const resolvedSheetRef = sheetRef ?? internalSheetRef;
1743
+ React8.useEffect(() => {
1744
+ if (import_react_native6.Platform.OS !== "ios") return;
1745
+ const sub = import_react_native6.Keyboard.addListener("keyboardDidHide", () => {
1746
+ const sheet = resolvedSheetRef.current;
1747
+ if (!sheet || !open) return;
1748
+ const targetIndex = snapPoints.length - 1;
1749
+ setTimeout(() => sheet.snapToIndex(targetIndex), 10);
1750
+ });
1751
+ return () => sub.remove();
1752
+ }, [open, resolvedSheetRef, snapPoints.length]);
1743
1753
  React8.useEffect(() => {
1744
1754
  const sheet = resolvedSheetRef.current;
1745
1755
  if (!sheet) return;
@@ -1762,12 +1772,12 @@ function StudioBottomSheet({
1762
1772
  index: open ? snapPoints.length - 1 : -1,
1763
1773
  snapPoints,
1764
1774
  enablePanDownToClose: true,
1765
- keyboardBehavior: "extend",
1775
+ keyboardBehavior: import_react_native6.Platform.OS === "ios" ? "interactive" : "extend",
1766
1776
  keyboardBlurBehavior: "restore",
1767
1777
  android_keyboardInputMode: "adjustResize",
1768
1778
  backgroundComponent: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StudioSheetBackground, { ...props, renderBackground: background == null ? void 0 : background.renderBackground }),
1769
1779
  topInset: insets.top,
1770
- bottomInset: insets.bottom,
1780
+ bottomInset: 0,
1771
1781
  handleIndicatorStyle: { backgroundColor: theme.colors.handleIndicator },
1772
1782
  onChange: handleChange,
1773
1783
  ...bottomSheetProps,
@@ -5408,6 +5418,8 @@ var import_react_native48 = require("react-native");
5408
5418
  // src/components/chat/ChatPage.tsx
5409
5419
  var React33 = __toESM(require("react"));
5410
5420
  var import_react_native44 = require("react-native");
5421
+ var import_react_native_safe_area_context4 = require("react-native-safe-area-context");
5422
+ var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
5411
5423
 
5412
5424
  // src/components/chat/ChatMessageList.tsx
5413
5425
  var React32 = __toESM(require("react"));
@@ -5599,7 +5611,34 @@ function ChatPage({
5599
5611
  listRef
5600
5612
  }) {
5601
5613
  const theme = useTheme();
5614
+ const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
5602
5615
  const [composerHeight, setComposerHeight] = React33.useState(0);
5616
+ const [keyboardVisible, setKeyboardVisible] = React33.useState(false);
5617
+ const animatedKeyboard = (0, import_react_native_reanimated2.useAnimatedKeyboard)();
5618
+ React33.useEffect(() => {
5619
+ if (import_react_native44.Platform.OS !== "ios") return;
5620
+ const show = import_react_native44.Keyboard.addListener("keyboardWillShow", () => setKeyboardVisible(true));
5621
+ const hide = import_react_native44.Keyboard.addListener("keyboardWillHide", () => setKeyboardVisible(false));
5622
+ return () => {
5623
+ show.remove();
5624
+ hide.remove();
5625
+ };
5626
+ }, []);
5627
+ const footerBottomPadding = import_react_native44.Platform.OS === "ios" ? keyboardVisible ? 0 : insets.bottom : insets.bottom + 10;
5628
+ const footerAnimatedStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => {
5629
+ if (import_react_native44.Platform.OS !== "ios") return { paddingBottom: insets.bottom + 10 };
5630
+ return { paddingBottom: animatedKeyboard.height.value > 0 ? 0 : insets.bottom };
5631
+ });
5632
+ const overlayBottom = composerHeight + footerBottomPadding + theme.spacing.lg;
5633
+ const resolvedOverlay = React33.useMemo(() => {
5634
+ var _a;
5635
+ if (!overlay) return null;
5636
+ if (!React33.isValidElement(overlay)) return overlay;
5637
+ const prevStyle = (_a = overlay.props) == null ? void 0 : _a.style;
5638
+ return React33.cloneElement(overlay, {
5639
+ style: [prevStyle, { bottom: overlayBottom }]
5640
+ });
5641
+ }, [overlay, overlayBottom]);
5603
5642
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native44.View, { style: [{ flex: 1 }, style], children: [
5604
5643
  header ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native44.View, { children: header }) : null,
5605
5644
  topBanner ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native44.View, { style: { paddingHorizontal: theme.spacing.lg, paddingTop: theme.spacing.sm }, children: topBanner }) : null,
@@ -5612,42 +5651,58 @@ function ChatPage({
5612
5651
  showTypingIndicator,
5613
5652
  renderMessageContent,
5614
5653
  onNearBottomChange,
5615
- contentStyle: { paddingBottom: theme.spacing.xl + composerHeight }
5654
+ contentStyle: { paddingBottom: theme.spacing.xl + composerHeight + footerBottomPadding }
5616
5655
  }
5617
5656
  ),
5618
- overlay
5619
- ] }),
5620
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5621
- ChatComposer,
5622
- {
5623
- ...composer,
5624
- attachments: composer.attachments ?? [],
5625
- onLayout: ({ height }) => setComposerHeight(height)
5626
- }
5627
- )
5657
+ resolvedOverlay,
5658
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5659
+ import_react_native_reanimated2.default.View,
5660
+ {
5661
+ style: [
5662
+ {
5663
+ position: "absolute",
5664
+ left: 0,
5665
+ right: 0,
5666
+ bottom: 0,
5667
+ paddingHorizontal: theme.spacing.lg,
5668
+ paddingTop: theme.spacing.sm
5669
+ },
5670
+ footerAnimatedStyle
5671
+ ],
5672
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5673
+ ChatComposer,
5674
+ {
5675
+ ...composer,
5676
+ attachments: composer.attachments ?? [],
5677
+ onLayout: ({ height }) => setComposerHeight(height)
5678
+ }
5679
+ )
5680
+ }
5681
+ )
5682
+ ] })
5628
5683
  ] });
5629
5684
  }
5630
5685
 
5631
5686
  // src/components/chat/ScrollToBottomButton.tsx
5632
5687
  var React34 = __toESM(require("react"));
5633
5688
  var import_react_native45 = require("react-native");
5634
- var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
5689
+ var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"));
5635
5690
  var import_jsx_runtime48 = require("react/jsx-runtime");
5636
5691
  function ScrollToBottomButton({ visible, onPress, children, style }) {
5637
5692
  const theme = useTheme();
5638
- const progress = (0, import_react_native_reanimated2.useSharedValue)(visible ? 1 : 0);
5693
+ const progress = (0, import_react_native_reanimated3.useSharedValue)(visible ? 1 : 0);
5639
5694
  const [pressed, setPressed] = React34.useState(false);
5640
5695
  React34.useEffect(() => {
5641
- progress.value = (0, import_react_native_reanimated2.withTiming)(visible ? 1 : 0, { duration: 200, easing: import_react_native_reanimated2.Easing.out(import_react_native_reanimated2.Easing.ease) });
5696
+ progress.value = (0, import_react_native_reanimated3.withTiming)(visible ? 1 : 0, { duration: 200, easing: import_react_native_reanimated3.Easing.out(import_react_native_reanimated3.Easing.ease) });
5642
5697
  }, [progress, visible]);
5643
- const animStyle = (0, import_react_native_reanimated2.useAnimatedStyle)(() => ({
5698
+ const animStyle = (0, import_react_native_reanimated3.useAnimatedStyle)(() => ({
5644
5699
  opacity: progress.value,
5645
5700
  transform: [{ translateY: (1 - progress.value) * 20 }]
5646
5701
  }));
5647
5702
  const bg = theme.scheme === "dark" ? "rgba(39,39,42,0.9)" : "rgba(244,244,245,0.95)";
5648
5703
  const border = theme.scheme === "dark" ? withAlpha("#FFFFFF", 0.12) : withAlpha("#000000", 0.08);
5649
5704
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5650
- import_react_native_reanimated2.default.View,
5705
+ import_react_native_reanimated3.default.View,
5651
5706
  {
5652
5707
  pointerEvents: visible ? "auto" : "none",
5653
5708
  style: [
@@ -6132,8 +6187,22 @@ function StudioOverlay({
6132
6187
  openSheet();
6133
6188
  }, [openSheet]);
6134
6189
  const backToPreview = React37.useCallback(() => {
6190
+ if (import_react_native51.Platform.OS !== "ios") {
6191
+ import_react_native51.Keyboard.dismiss();
6192
+ setActivePage("preview");
6193
+ return;
6194
+ }
6195
+ let done = false;
6196
+ const finalize = () => {
6197
+ if (done) return;
6198
+ done = true;
6199
+ sub.remove();
6200
+ clearTimeout(t);
6201
+ setActivePage("preview");
6202
+ };
6203
+ const sub = import_react_native51.Keyboard.addListener("keyboardDidHide", finalize);
6204
+ const t = setTimeout(finalize, 350);
6135
6205
  import_react_native51.Keyboard.dismiss();
6136
- setActivePage("preview");
6137
6206
  }, []);
6138
6207
  const startDraw = React37.useCallback(() => {
6139
6208
  setDrawing(true);