@uxbertlabs/reportly 1.0.32 → 1.0.33

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useReducer, useMemo, useCallback, createContext, useContext, forwardRef, createElement, useState, useRef, useEffect } from 'react';
1
+ import React, { useReducer, useMemo, useRef, useEffect, useCallback, createContext, useContext, forwardRef, createElement, useState } from 'react';
2
2
 
3
3
  class DeviceInfo {
4
4
  constructor() {
@@ -9303,6 +9303,12 @@ class Screenshot {
9303
9303
  this.quality = 0.95; // Default quality for JPEG/WebP
9304
9304
  this.format = "png"; // Default format
9305
9305
  this.currentScreenshot = null;
9306
+ console.log("Screenshot module initialized", {
9307
+ hooks,
9308
+ captureDelay,
9309
+ quality,
9310
+ format
9311
+ });
9306
9312
  if (hooks) this.hooks = hooks;
9307
9313
  if (captureDelay !== undefined) this.captureDelay = captureDelay;
9308
9314
  if (quality !== undefined) this.quality = quality;
@@ -9666,6 +9672,13 @@ class Screenshot {
9666
9672
  ...this.hooks,
9667
9673
  ...hooks
9668
9674
  };
9675
+ console.log("[Screenshot] Hooks updated:", {
9676
+ hasBeforeCapture: !!this.hooks.beforeCapture,
9677
+ hasAfterCapture: !!this.hooks.afterCapture,
9678
+ hasOnCaptureStart: !!this.hooks.onCaptureStart,
9679
+ hasOnCaptureComplete: !!this.hooks.onCaptureComplete,
9680
+ hasOnCaptureError: !!this.hooks.onCaptureError
9681
+ });
9669
9682
  }
9670
9683
  /**
9671
9684
  * Get current hooks configuration
@@ -9697,11 +9710,6 @@ class Screenshot {
9697
9710
  }
9698
9711
  }
9699
9712
 
9700
- var screenshot = /*#__PURE__*/Object.freeze({
9701
- __proto__: null,
9702
- default: Screenshot
9703
- });
9704
-
9705
9713
  const initialState = {
9706
9714
  isOpen: false,
9707
9715
  isAnnotating: false,
@@ -9812,7 +9820,30 @@ function ReportlyProvider({
9812
9820
  // Initialize services with useMemo to ensure they're only created once and support SSR
9813
9821
  const deviceInfo = useMemo(() => new DeviceInfo(), []);
9814
9822
  const exportService = useMemo(() => new Export(config.integrations?.n8n), [config.integrations?.n8n]);
9815
- const screenshot = useMemo(() => new Screenshot(config.screenshot?.hooks, config.screenshot?.captureDelay, config.screenshot?.quality, config.screenshot?.format), [config.screenshot?.hooks, config.screenshot?.captureDelay, config.screenshot?.quality, config.screenshot?.format]);
9823
+ // Use ref for Screenshot to prevent recreation on config changes
9824
+ const screenshotRef = useRef(null);
9825
+ // Initialize Screenshot once
9826
+ if (screenshotRef.current === null) {
9827
+ screenshotRef.current = new Screenshot(config.screenshot?.hooks, config.screenshot?.captureDelay, config.screenshot?.quality, config.screenshot?.format);
9828
+ }
9829
+ // Update Screenshot configuration when config changes
9830
+ useEffect(() => {
9831
+ if (screenshotRef.current) {
9832
+ if (config.screenshot?.hooks) {
9833
+ screenshotRef.current.setHooks(config.screenshot.hooks);
9834
+ }
9835
+ if (config.screenshot?.captureDelay !== undefined) {
9836
+ screenshotRef.current.setCaptureDelay(config.screenshot.captureDelay);
9837
+ }
9838
+ if (config.screenshot?.quality !== undefined) {
9839
+ screenshotRef.current.setQuality(config.screenshot.quality);
9840
+ }
9841
+ if (config.screenshot?.format) {
9842
+ screenshotRef.current.setFormat(config.screenshot.format);
9843
+ }
9844
+ }
9845
+ }, [config.screenshot?.hooks, config.screenshot?.captureDelay, config.screenshot?.quality, config.screenshot?.format]);
9846
+ const screenshot = screenshotRef.current;
9816
9847
  const openModal = useCallback(() => {
9817
9848
  dispatch({
9818
9849
  type: "OPEN_MODAL"
@@ -9968,6 +9999,7 @@ function ReportlyProvider({
9968
9999
  }, [annotationManager]);
9969
10000
  const contextValue = {
9970
10001
  state,
10002
+ screenshot,
9971
10003
  annotationManager,
9972
10004
  setAnnotationManager: setAnnotationManagerState,
9973
10005
  openModal,
@@ -10009,7 +10041,7 @@ function cn(...inputs) {
10009
10041
 
10010
10042
  function Butterfly({
10011
10043
  width = "100%",
10012
- height = "auto",
10044
+ height = "100%",
10013
10045
  className = "",
10014
10046
  style = {}
10015
10047
  }) {
@@ -10056,7 +10088,8 @@ function FloatingButton({
10056
10088
  }, /*#__PURE__*/React.createElement(Butterfly, {
10057
10089
  style: {
10058
10090
  color: "currentColor",
10059
- width: "40px"
10091
+ width: "40px",
10092
+ height: "40px"
10060
10093
  }
10061
10094
  }));
10062
10095
  }
@@ -10374,7 +10407,7 @@ const X = createLucideIcon("x", __iconNode);
10374
10407
 
10375
10408
  function AminahUXbertLogo({
10376
10409
  width = "100%",
10377
- height = "auto",
10410
+ height = "100%",
10378
10411
  className = ""
10379
10412
  }) {
10380
10413
  return /*#__PURE__*/React.createElement("svg", {
@@ -10844,7 +10877,7 @@ function IssueModal({
10844
10877
 
10845
10878
  function AminahLogo({
10846
10879
  width = "100%",
10847
- height = "auto",
10880
+ height = "100%",
10848
10881
  className = ""
10849
10882
  }) {
10850
10883
  return /*#__PURE__*/React.createElement("svg", {
@@ -11640,6 +11673,7 @@ class AnnotationManager {
11640
11673
  function ReportlyInner() {
11641
11674
  const {
11642
11675
  state,
11676
+ screenshot,
11643
11677
  endAnnotation,
11644
11678
  updateScreenshot,
11645
11679
  setAnnotationManager
@@ -11685,15 +11719,13 @@ function ReportlyInner() {
11685
11719
  const handleDone = async () => {
11686
11720
  if (!annotationRef.current) return;
11687
11721
  try {
11688
- const Screenshot = (await Promise.resolve().then(function () { return screenshot; })).default;
11689
11722
  // Use the current mode from annotation manager (it has auto-adjusted based on drawing location)
11690
11723
  const captureMode = annotationRef.current.getCurrentMode();
11691
11724
  console.log('Using capture mode from annotation manager:', captureMode);
11692
11725
  // Hide the annotation canvas temporarily
11693
11726
  annotationRef.current.hide();
11694
- // Capture the screenshot
11695
- const screenshotService = new Screenshot();
11696
- const baseScreenshot = await screenshotService.capture(captureMode);
11727
+ // Capture the screenshot using the configured screenshot instance from context
11728
+ const baseScreenshot = await screenshot.capture(captureMode);
11697
11729
  // Export the annotated screenshot (combine base screenshot + annotations)
11698
11730
  // Pass the capture mode so annotations can be positioned correctly
11699
11731
  const annotatedScreenshot = await annotationRef.current.exportAnnotatedScreenshot(baseScreenshot, captureMode);