@botpress/webchat 5.5.3 → 5.5.5

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @botpress/webchat@5.5.3 build /home/runner/work/genisys/genisys/packages/webchat/components
2
+ > @botpress/webchat@5.5.5 build /home/runner/work/genisys/genisys/packages/webchat/components
3
3
  > vite build
4
4
 
5
5
  vite v5.4.8 building for production...
@@ -9,10 +9,10 @@ rendering chunks...
9
9
 
10
10
  [vite:dts] Start generate declaration files...
11
11
  computing gzip size...
12
- dist/index.js 1,902.64 kB │ gzip: 424.88 kB
12
+ dist/index.js 1,902.69 kB │ gzip: 424.90 kB
13
13
  [vite:dts] Start rollup declaration files...
14
14
  Analysis will use the bundled TypeScript version 5.9.3
15
- [vite:dts] Declaration files built in 27022ms.
15
+ [vite:dts] Declaration files built in 22829ms.
16
16
 
17
- dist/index.umd.cjs 1,213.78 kB │ gzip: 350.17 kB
18
- ✓ built in 34.69s
17
+ dist/index.umd.cjs 1,213.82 kB │ gzip: 350.19 kB
18
+ ✓ built in 29.31s
package/dist/index.d.ts CHANGED
@@ -1121,10 +1121,15 @@ declare type UsePresenceEmitterProps = {
1121
1121
 
1122
1122
  export { User }
1123
1123
 
1124
- export declare function useReadIndicator(): {
1124
+ export declare function useReadIndicator({ enabled }?: UseReadIndicatorProps): {
1125
1125
  onMessageReceived: (messageId: string) => void;
1126
1126
  };
1127
1127
 
1128
+ declare type UseReadIndicatorProps = {
1129
+ /** Gate — only emit when the bot reports presence upstream (agentPresenceEnabled). */
1130
+ enabled?: boolean;
1131
+ };
1132
+
1128
1133
  export declare type UserProfile = Omit<User, 'id' | 'createdAt' | 'updatedAt'>;
1129
1134
 
1130
1135
  export declare type UserResponse = Awaited<ReturnType<Client['getUser']>>['user'];
package/dist/index.js CHANGED
@@ -22215,7 +22215,7 @@ const iR = ({ text: e, options: n, reusable: t, ctx: i }) => {
22215
22215
  ed({
22216
22216
  apply({ rects: $, elements: O, availableHeight: H }) {
22217
22217
  Object.assign(O.floating.style, {
22218
- maxHeight: `${H}px`,
22218
+ maxHeight: `min(200px, ${Math.max(0, H)}px)`,
22219
22219
  minWidth: `${$.reference.width}px`
22220
22220
  });
22221
22221
  },
@@ -74776,45 +74776,45 @@ function $B({
74776
74776
  };
74777
74777
  }
74778
74778
  const jB = (e) => !!e.lastMessage;
74779
- function eH() {
74780
- const { client: e, userCredentials: n, conversationId: t, emitter: i } = Ii(), [r, a] = ve(!0), [o, s] = ve(null), [l, f] = ve(null);
74779
+ function eH({ enabled: e } = {}) {
74780
+ const { client: n, userCredentials: t, conversationId: i, emitter: r } = Ii(), [a, o] = ve(!0), [s, l] = ve(null), [f, c] = ve(null);
74781
74781
  xe(() => {
74782
- const p = i.on("message", (d) => {
74783
- (n == null ? void 0 : n.userId) !== d.authorId && s(d.id);
74782
+ const d = r.on("message", (m) => {
74783
+ (t == null ? void 0 : t.userId) !== m.authorId && l(m.id);
74784
74784
  });
74785
74785
  return () => {
74786
- p();
74786
+ d();
74787
74787
  };
74788
- }, [i, n == null ? void 0 : n.userId]), xe(() => {
74789
- r && c();
74790
- }, [o]);
74791
- const c = () => {
74792
- o !== l ? u(o ?? "") : o === null && l === null && (s(""), u(""));
74793
- }, u = (p) => {
74794
- !t || !e || (f(p), e.createEvent({
74795
- conversationId: t,
74788
+ }, [r, t == null ? void 0 : t.userId]), xe(() => {
74789
+ a && u();
74790
+ }, [s]);
74791
+ const u = () => {
74792
+ s !== f ? p(s ?? "") : s === null && f === null && (l(""), p(""));
74793
+ }, p = (d) => {
74794
+ !e || !i || !n || (c(d), n.createEvent({
74795
+ conversationId: i,
74796
74796
  payload: {
74797
74797
  type: "custom",
74798
74798
  data: {
74799
74799
  type: "lastReadMessageUpdate",
74800
74800
  payload: {
74801
- conversationId: t,
74802
- userKey: n == null ? void 0 : n.userToken
74801
+ conversationId: i,
74802
+ userKey: t == null ? void 0 : t.userToken
74803
74803
  }
74804
74804
  }
74805
74805
  }
74806
74806
  }));
74807
74807
  };
74808
74808
  return xe(() => {
74809
- const p = () => {
74810
- a(!0), c();
74811
- }, d = () => a(!1);
74812
- return window.addEventListener("focus", p), window.addEventListener("blur", d), () => {
74813
- window.removeEventListener("focus", p), window.removeEventListener("blur", d);
74809
+ const d = () => {
74810
+ o(!0), u();
74811
+ }, m = () => o(!1);
74812
+ return window.addEventListener("focus", d), window.addEventListener("blur", m), () => {
74813
+ window.removeEventListener("focus", d), window.removeEventListener("blur", m);
74814
74814
  };
74815
- }, [c]), {
74816
- onMessageReceived: (p) => {
74817
- s(p);
74815
+ }, [u]), {
74816
+ onMessageReceived: (d) => {
74817
+ l(d);
74818
74818
  }
74819
74819
  };
74820
74820
  }