@ibti-tech/chatbot 0.9.3 → 0.9.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.d.ts CHANGED
@@ -128,7 +128,7 @@ declare module '@ibti-tech/chatbot/components/ChatbotBar/styles' {
128
128
  //# sourceMappingURL=styles.d.ts.map
129
129
  }
130
130
  declare module '@ibti-tech/chatbot/components/ChatbotBar/styles.d.ts' {
131
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/ChatbotBar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAW,MAAM,eAAe,CAAA;AAIpD,eAAO,MAAM,YAAY;;oBAEgB,kBAAmB;;yBADrC,MAAM,GAAG,OAAO;gCACT,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM;aACvD,OAAO;uBACG,KAAK,GAAG,QAAQ;uBAChB,OAAO;iMA4E3B,CAAA;AAED,2GAA2G;AAC3G,eAAO,MAAM,WAAW;iBAA6B,MAAM;gBAAc,MAAM;YAS9E,CAAA;AAED,eAAO,MAAM,OAAO;uBACC,KAAK,GAAG,QAAQ;yBACd,MAAM,GAAG,OAAO;aAC5B,OAAO;cACN,MAAM;iBACH,MAAM,GAAG,MAAM;mBACb,OAAO;uBACH,OAAO;gCACE,MAAM;YAgInC,CAAA"}
131
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/ChatbotBar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAW,MAAM,eAAe,CAAA;AAIpD,eAAO,MAAM,YAAY;;oBAEgB,kBAAmB;;yBADrC,MAAM,GAAG,OAAO;gCACT,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM;aACvD,OAAO;uBACG,KAAK,GAAG,QAAQ;uBAChB,OAAO;iMA4E3B,CAAA;AAED,2GAA2G;AAC3G,eAAO,MAAM,WAAW;iBAA6B,MAAM;gBAAc,MAAM;YAS9E,CAAA;AAED,eAAO,MAAM,OAAO;uBACC,KAAK,GAAG,QAAQ;yBACd,MAAM,GAAG,OAAO;aAC5B,OAAO;cACN,MAAM;iBACH,MAAM,GAAG,MAAM;mBACb,OAAO;uBACH,OAAO;gCACE,MAAM;YAwInC,CAAA"}
132
132
  }
133
133
  declare module '@ibti-tech/chatbot/components/ChatbotBody/index' {
134
134
  import React from 'react';
@@ -182,7 +182,7 @@ declare module '@ibti-tech/chatbot/components/ChatbotDevice/styles' {
182
182
  //# sourceMappingURL=styles.d.ts.map
183
183
  }
184
184
  declare module '@ibti-tech/chatbot/components/ChatbotDevice/styles.d.ts' {
185
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/ChatbotDevice/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO;aACT,OAAO;uBACG,KAAK,GAAG,QAAQ;uBAChB,OAAO;0BACJ,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM;gCAC9B,MAAM;YAsPnC,CAAA"}
185
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/ChatbotDevice/styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO;aACT,OAAO;uBACG,KAAK,GAAG,QAAQ;uBAChB,OAAO;0BACJ,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM;gCAC9B,MAAM;YAgQnC,CAAA"}
186
186
  }
187
187
  declare module '@ibti-tech/chatbot/components/ChatbotFooter/index' {
188
188
  import React from 'react';
@@ -286,7 +286,7 @@ declare module '@ibti-tech/chatbot/components/MessageBalloon/index' {
286
286
  //# sourceMappingURL=index.d.ts.map
287
287
  }
288
288
  declare module '@ibti-tech/chatbot/components/MessageBalloon/index.d.ts' {
289
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/MessageBalloon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC,WAAW,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAOD,eAAO,MAAM,cAAc,GAAI,2BAG5B,mBAAmB,sBAiJrB,CAAA;AAED,eAAe,cAAc,CAAA"}
289
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/MessageBalloon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAwBpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC,WAAW,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAOD,eAAO,MAAM,cAAc,GAAI,2BAG5B,mBAAmB,sBAkKrB,CAAA;AAED,eAAe,cAAc,CAAA"}
290
290
  }
291
291
  declare module '@ibti-tech/chatbot/components/MessageBalloon/styles' {
292
292
  export const Time: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
@@ -458,7 +458,7 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/provider' {
458
458
  //# sourceMappingURL=provider.d.ts.map
459
459
  }
460
460
  declare module '@ibti-tech/chatbot/contexts/Chatbot/provider.d.ts' {
461
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASpC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,kCAAkC;IAClC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;IACzB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;IAC1B,8DAA8D;IAC9D,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAA;IACrC,gGAAgG;IAChG,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oFAAoF;IACpF,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,CAAA;IAClC,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,sJAY7B,oBAAoB,sBAgLtB,CAAA"}
461
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASpC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,kCAAkC;IAClC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;IACzB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;IAC1B,8DAA8D;IAC9D,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAA;IACrC,gGAAgG;IAChG,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oFAAoF;IACpF,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,CAAA;IAClC,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,sJAY7B,oBAAoB,sBAiLtB,CAAA"}
462
462
  }
463
463
  declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox' {
464
464
  /** Parameters for sendUserRating from useChatFeedbackBox. */
package/dist/index.mjs CHANGED
@@ -887,7 +887,8 @@ var ChatbotProvider = /* @__PURE__ */ __name(({
887
887
  } = useChatbotMessages_default({
888
888
  apiURL,
889
889
  locale,
890
- publicHash: isReady ? publicHash : void 0,
890
+ // Pass publicHash always so init() can call welcome/completion with hash once visitorId is ready
891
+ publicHash,
891
892
  visitorId: isReady ? visitorId : void 0
892
893
  });
893
894
  const [opened, setOpened] = useState3(isOpen);
@@ -1050,9 +1051,14 @@ var Wrapper = styled.div`
1050
1051
 
1051
1052
  /* Mobile styles */
1052
1053
  @media screen and (max-width: ${breakpoints.tablet}px) {
1054
+ /* Top + opened: use svh so panel fits visible viewport (browser URL bar); padding keeps close button above home indicator */
1053
1055
  ${(props) => props.$opened && props.$verticalPosition === "top" && css`
1054
1056
  max-height: 100vh !important;
1057
+ max-height: 100svh !important;
1055
1058
  height: 100vh !important;
1059
+ height: 100svh !important;
1060
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1061
+ box-sizing: border-box;
1056
1062
  `}
1057
1063
 
1058
1064
  ${(props) => props.$opened && props.$verticalPosition === "bottom" ? css`
@@ -1216,9 +1222,14 @@ var Wrapper = styled.div`
1216
1222
 
1217
1223
  @media screen and (max-width: ${breakpoints.tablet}px) {
1218
1224
  height: 100vh !important;
1225
+ height: 100svh !important;
1219
1226
  max-height: 100vh !important;
1227
+ max-height: 100svh !important;
1220
1228
  min-height: 100vh !important;
1229
+ min-height: 100svh !important;
1230
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1221
1231
  overflow: hidden !important;
1232
+ box-sizing: border-box;
1222
1233
  }
1223
1234
  `}
1224
1235
  `;
@@ -1931,8 +1942,21 @@ var formatMessageTime = /* @__PURE__ */ __name((dateUTC, currentDateUTC, locale)
1931
1942
 
1932
1943
  // src/components/MessageBalloon/index.tsx
1933
1944
  import Markdown from "react-markdown";
1945
+ import remarkGfm from "remark-gfm";
1946
+ import rehypeRaw from "rehype-raw";
1947
+ import rehypeSanitize from "rehype-sanitize";
1934
1948
  import { CircleExclamationIcon } from "@ibti-tech/ui";
1935
1949
  import { Copy, Share2, RotateCw } from "lucide-react";
1950
+ function linkifyBareUrls(text) {
1951
+ return text.replace(
1952
+ /(?<!\]\()(https?:\/\/[^\s<>")\]]+)/gi,
1953
+ (url) => `[${url}](${url})`
1954
+ ).replace(
1955
+ /(?<!\]\()(www\.[^\s<>")\]]+)/gi,
1956
+ (url) => `[${url}](https://${url})`
1957
+ );
1958
+ }
1959
+ __name(linkifyBareUrls, "linkifyBareUrls");
1936
1960
  var messageTypes = {
1937
1961
  assistant: "received",
1938
1962
  user: "sent"
@@ -1997,7 +2021,26 @@ var MessageBalloon = /* @__PURE__ */ __name(({
1997
2021
  onMouseLeave: () => setIsHovered(false),
1998
2022
  $type: messageType
1999
2023
  },
2000
- /* @__PURE__ */ React7.createElement(BalloonContainer, { $type: messageType }, /* @__PURE__ */ React7.createElement(Balloon, { $type: messageType, $error: data.error }, data.error && /* @__PURE__ */ React7.createElement(CircleExclamationIcon, null), /* @__PURE__ */ React7.createElement(Markdown, null, data.content))),
2024
+ /* @__PURE__ */ React7.createElement(BalloonContainer, { $type: messageType }, /* @__PURE__ */ React7.createElement(Balloon, { $type: messageType, $error: data.error }, data.error && /* @__PURE__ */ React7.createElement(CircleExclamationIcon, null), /* @__PURE__ */ React7.createElement(
2025
+ Markdown,
2026
+ {
2027
+ remarkPlugins: [remarkGfm],
2028
+ rehypePlugins: [rehypeRaw, rehypeSanitize],
2029
+ components: {
2030
+ a: /* @__PURE__ */ __name(({ href, children, ...props }) => /* @__PURE__ */ React7.createElement(
2031
+ "a",
2032
+ {
2033
+ href,
2034
+ target: "_blank",
2035
+ rel: "noopener noreferrer",
2036
+ ...props
2037
+ },
2038
+ children
2039
+ ), "a")
2040
+ }
2041
+ },
2042
+ linkifyBareUrls(data.content)
2043
+ ))),
2001
2044
  /* @__PURE__ */ React7.createElement(TimestampAndActionsRow, { $type: messageType }, /* @__PURE__ */ React7.createElement(
2002
2045
  ActionsContainer,
2003
2046
  {
@@ -2788,7 +2831,7 @@ var Wrapper9 = styled10.div`
2788
2831
  // package.json
2789
2832
  var package_default = {
2790
2833
  name: "@ibti-tech/chatbot",
2791
- version: "0.9.3",
2834
+ version: "0.9.6",
2792
2835
  description: "Chatbot system developed to be embedded in any website",
2793
2836
  packageManager: "yarn@3.6.4",
2794
2837
  main: "./dist/index.mjs",
@@ -2828,6 +2871,9 @@ var package_default = {
2828
2871
  "lucide-react": "^0.263.1",
2829
2872
  polished: "^4.3.1",
2830
2873
  "react-markdown": "^9.0.1",
2874
+ "rehype-raw": "^7.0.0",
2875
+ "rehype-sanitize": "^6.0.0",
2876
+ "remark-gfm": "^4.0.0",
2831
2877
  uuid: "^9.0.1"
2832
2878
  },
2833
2879
  devDependencies: {
@@ -3102,8 +3148,10 @@ var Wrapper10 = styled11.div`
3102
3148
  }
3103
3149
  @media screen and (max-width: ${breakpoints3.tablet}px) {
3104
3150
  padding-top: 0 !important;
3105
- top: ${topVal} !important;
3151
+ /* Account for safe area (notch/status bar) and browser chrome on mobile */
3152
+ top: max(${topVal}, env(safe-area-inset-top, 0px)) !important;
3106
3153
  height: 100vh;
3154
+ height: 100svh; /* small viewport: fits visible area with browser URL bar visible */
3107
3155
  }
3108
3156
  `;
3109
3157
  }
@@ -3130,7 +3178,8 @@ var Wrapper10 = styled11.div`
3130
3178
  @media screen and (max-width: ${breakpoints3.tablet}px) {
3131
3179
  height: ${barH}px !important;
3132
3180
  min-height: ${barH}px !important;
3133
- top: ${topVal} !important;
3181
+ /* Keep bar/toggle visible below browser UI and safe area on mobile */
3182
+ top: ${props.$topOffset !== void 0 ? topVal : "max(0px, env(safe-area-inset-top, 0px))"} !important;
3134
3183
  }
3135
3184
  `;
3136
3185
  }
@@ -3147,9 +3196,14 @@ var Wrapper10 = styled11.div`
3147
3196
  @media screen and (max-width: ${breakpoints3.tablet}px) {
3148
3197
  ${props.$opened ? css6`
3149
3198
  padding-top: 0 !important;
3150
- top: 0 !important;
3199
+ /* Safe area + browser chrome: keep close button visible on mobile */
3200
+ top: env(safe-area-inset-top, 0px) !important;
3151
3201
  height: 100vh;
3152
- ` : ""}
3202
+ height: 100svh;
3203
+ ` : css6`
3204
+ /* Bar closed: ensure toggle visible below browser UI */
3205
+ top: env(safe-area-inset-top, 0px) !important;
3206
+ `}
3153
3207
  }
3154
3208
  ` : css6`
3155
3209
  bottom: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibti-tech/chatbot",
3
- "version": "0.9.3",
3
+ "version": "0.9.6",
4
4
  "description": "Chatbot system developed to be embedded in any website",
5
5
  "packageManager": "yarn@3.6.4",
6
6
  "main": "./dist/index.mjs",
@@ -40,6 +40,9 @@
40
40
  "lucide-react": "^0.263.1",
41
41
  "polished": "^4.3.1",
42
42
  "react-markdown": "^9.0.1",
43
+ "rehype-raw": "^7.0.0",
44
+ "rehype-sanitize": "^6.0.0",
45
+ "remark-gfm": "^4.0.0",
43
46
  "uuid": "^9.0.1"
44
47
  },
45
48
  "devDependencies": {