@sendbird/ai-agent-messenger-react 1.5.0 → 1.6.1

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.
@@ -3,7 +3,7 @@ import { useCallback as p } from "react";
3
3
  import s from "dompurify";
4
4
  import h, { RuleType as x } from "markdown-to-jsx";
5
5
  import g from "styled-components";
6
- import { A as b, c as i } from "./BJDMdOwf.js";
6
+ import { A as b, c as i } from "./CQ8KW62U.js";
7
7
  const m = (d, o, n, t) => o.type === x.textStrikethroughed ? /* @__PURE__ */ r.createElement("span", { key: t.key }, `~~${n(o.children, t)}~~`) : d(), z = ({ className: d, children: o, style: n, onClickImage: t }) => {
8
8
  const a = p(
9
9
  (e) => /* @__PURE__ */ r.createElement("img", { ...e, onClick: () => e.src && (t == null ? void 0 : t(e.src)) }),
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cjs/BH3mOALq.cjs");require("react");exports.AgentProviderContainer=e.AgentProviderContainer;exports.AgentUIProviderContainer=e.AgentUIProviderContainer;exports.AnonymousSessionInfo=e.AnonymousSessionInfo;exports.CSATType=e.CSATType;exports.Commands=e.Commands;exports.Conversation=e.Conversation;exports.ConversationContext=e.ConversationContext;exports.ConversationContextProvider=e.ConversationContextProvider;exports.ConversationLayout=e.ConversationLayout;exports.ConversationList=e.ConversationList;exports.ConversationListContext=e.ConversationListContext;exports.ConversationListContextProvider=e.ConversationListContextProvider;exports.ConversationListItemLayout=e.ConversationListItemLayout;exports.ConversationListLayout=e.ConversationListLayout;exports.DefaultMessenger=e.DefaultMessenger;exports.FixedMessenger=e.FixedMessenger;exports.IncomingMessageLayout=e.IncomingMessageLayout;exports.LauncherBase=e.LauncherBase;exports.LogLevel=e.LogLevel;exports.ManualSessionInfo=e.ManualSessionInfo;exports.MessageLogs=e.MessageLogs;exports.OutgoingMessageLayout=e.OutgoingMessageLayout;exports.SystemMessageLayout=e.SystemMessageLayout;exports.messengerDispatcher=e.messengerDispatcher;exports.useConversationContext=e.useConversationContext;exports.useConversationListContext=e.useConversationListContext;exports.useLocalizationContext=e.useLocalizationContext;exports.useMessengerContext=e.useMessengerContext;exports.useMessengerSessionContext=e.useMessengerSessionContext;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./cjs/Dk7KndGT.cjs");require("react");exports.AgentProviderContainer=e.AgentProviderContainer;exports.AgentUIProviderContainer=e.AgentUIProviderContainer;exports.AnonymousSessionInfo=e.AnonymousSessionInfo;exports.CSATType=e.CSATType;exports.Commands=e.Commands;exports.Conversation=e.Conversation;exports.ConversationContext=e.ConversationContext;exports.ConversationContextProvider=e.ConversationContextProvider;exports.ConversationLayout=e.ConversationLayout;exports.ConversationList=e.ConversationList;exports.ConversationListContext=e.ConversationListContext;exports.ConversationListContextProvider=e.ConversationListContextProvider;exports.ConversationListItemLayout=e.ConversationListItemLayout;exports.ConversationListLayout=e.ConversationListLayout;exports.DefaultMessenger=e.DefaultMessenger;exports.FixedMessenger=e.FixedMessenger;exports.IncomingMessageLayout=e.IncomingMessageLayout;exports.LauncherBase=e.LauncherBase;exports.LogLevel=e.LogLevel;exports.ManualSessionInfo=e.ManualSessionInfo;exports.MessageLogs=e.MessageLogs;exports.OutgoingMessageLayout=e.OutgoingMessageLayout;exports.PlaceholderLayout=e.PlaceholderLayout;exports.SystemMessageLayout=e.SystemMessageLayout;exports.messengerDispatcher=e.messengerDispatcher;exports.useConversationContext=e.useConversationContext;exports.useConversationListContext=e.useConversationListContext;exports.useLocalizationContext=e.useLocalizationContext;exports.useMessengerContext=e.useMessengerContext;exports.useMessengerSessionContext=e.useMessengerSessionContext;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { CSSProperties } from 'react';
10
10
  import { DependencyList } from 'react';
11
11
  import { DeskChannelFilter } from '@sendbird/chat/aiAgent';
12
12
  import { Dispatch } from 'react';
13
+ import { FC } from 'react';
13
14
  import { FileMessage } from '@sendbird/chat/message';
14
15
  import { FileMessageCreateParams } from '@sendbird/chat/message';
15
16
  import { format } from 'date-fns';
@@ -17,6 +18,7 @@ import { ForwardRefExoticComponent } from 'react';
17
18
  import { GroupChannel } from '@sendbird/chat/groupChannel';
18
19
  import { GroupChannelModule } from '@sendbird/chat/groupChannel';
19
20
  import { JSX } from 'react/jsx-runtime';
21
+ import { LazyExoticComponent } from 'react';
20
22
  import { Locale } from 'date-fns';
21
23
  import { LogLevel as LogLevel_2 } from '@sendbird/chat';
22
24
  import { PropsWithChildren } from 'react';
@@ -28,6 +30,7 @@ import { SendbirdChatWith } from '@sendbird/chat';
28
30
  import { SendbirdError } from '@sendbird/chat';
29
31
  import { SessionHandler } from '@sendbird/chat';
30
32
  import { SetStateAction } from 'react';
33
+ import { SVGProps } from 'react';
31
34
  import { UserMessage } from '@sendbird/chat/message';
32
35
  import { UserMessageCreateParams } from '@sendbird/chat/message';
33
36
 
@@ -41,6 +44,7 @@ export declare interface AgentClientHandlers {
41
44
  onMessageSend?: (message: string) => void;
42
45
  onFunctionCallDetailClick?: (func: FunctionCallsInfo) => void;
43
46
  onCustomEvent?: (event: CustomEvent_2) => void;
47
+ onInitializeFailed?: (error: Error) => void;
44
48
  }
45
49
 
46
50
  export declare interface AgentMessageTemplateInfo {
@@ -631,7 +635,7 @@ export declare const ConversationLayout: {
631
635
  components: {
632
636
  Header: () => JSX.Element | null;
633
637
  Body: () => JSX.Element;
634
- Footer: () => JSX.Element | null;
638
+ Footer: () => JSX.Element;
635
639
  };
636
640
  };
637
641
  Template: ({ template, children }: {
@@ -641,12 +645,12 @@ export declare const ConversationLayout: {
641
645
  Context: Context<LayoutContextValue< {
642
646
  Header: () => JSX.Element | null;
643
647
  Body: () => JSX.Element;
644
- Footer: () => JSX.Element | null;
648
+ Footer: () => JSX.Element;
645
649
  }, unknown>>;
646
650
  useContext: () => LayoutContextValue< {
647
651
  Header: () => JSX.Element | null;
648
652
  Body: () => JSX.Element;
649
- Footer: () => JSX.Element | null;
653
+ Footer: () => JSX.Element;
650
654
  }, unknown>;
651
655
  } & {
652
656
  Header: (props: {
@@ -656,7 +660,7 @@ export declare const ConversationLayout: {
656
660
  component: () => JSX.Element;
657
661
  }) => null;
658
662
  Footer: (props: {
659
- component: () => JSX.Element | null;
663
+ component: () => JSX.Element;
660
664
  }) => null;
661
665
  };
662
666
 
@@ -750,7 +754,9 @@ declare type CSATSubmitParams = {
750
754
  csatType: string;
751
755
  csat?: number;
752
756
  csatReason?: string;
757
+ csatStartedAt?: number;
753
758
  isResolved?: boolean;
759
+ resolutionScore?: number;
754
760
  };
755
761
 
756
762
  export declare enum CSATType {
@@ -883,6 +889,31 @@ export declare interface ExtendedMessagePayload {
883
889
  csat: {
884
890
  type: CSATType;
885
891
  visibility: boolean;
892
+ title: string;
893
+ csat_question: string;
894
+ csat_scores: {
895
+ label: string;
896
+ image_url: string;
897
+ }[];
898
+ csat_submit_label: string;
899
+ csat_submitted_label: string;
900
+ cre?: {
901
+ question: string;
902
+ positive_label: string;
903
+ negative_label: string;
904
+ };
905
+ follow_up?: Array<{
906
+ response_type: 'free_text';
907
+ question: string;
908
+ scores: number[];
909
+ required?: boolean;
910
+ } | {
911
+ response_type: 'single_choice';
912
+ question: string;
913
+ scores: number[];
914
+ options: string[];
915
+ required?: boolean;
916
+ }>;
886
917
  };
887
918
  bot_message_type: 'generated' | 'canned' | 'thinking' | 'welcome' | 'resolution_feedback' | 'maintenance' | 'safeguard' | 'error';
888
919
  citations?: CitationInfo[];
@@ -971,6 +1002,53 @@ export declare interface GroundednessInfo {
971
1002
  preview_title: string;
972
1003
  }
973
1004
 
1005
+ /**
1006
+ * frequently used icons are imported statically, and others are imported dynamically.
1007
+ * */
1008
+ declare const icons: {
1009
+ readonly close: FC<SVGProps<SVGElement>>;
1010
+ readonly send: FC<SVGProps<SVGElement>>;
1011
+ readonly menu: FC<SVGProps<SVGElement>>;
1012
+ readonly expand: FC<SVGProps<SVGElement>>;
1013
+ readonly collapse: FC<SVGProps<SVGElement>>;
1014
+ readonly spinner: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1015
+ readonly chat: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1016
+ readonly message: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1017
+ readonly error: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1018
+ readonly info: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1019
+ readonly refresh: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1020
+ readonly 'chevron-down': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1021
+ readonly 'chevron-right': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1022
+ readonly done: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1023
+ readonly user: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1024
+ readonly 'file-document': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1025
+ readonly download: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1026
+ readonly attach: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1027
+ readonly delete: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1028
+ readonly 'close-filled': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1029
+ readonly agent: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1030
+ readonly question: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1031
+ readonly actionbook: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1032
+ readonly function: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1033
+ readonly 'radio-on': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1034
+ readonly 'radio-off': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1035
+ readonly confluence: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1036
+ readonly zendesk: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1037
+ readonly salesforce: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1038
+ readonly sprinklr: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1039
+ readonly website: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1040
+ readonly snippet: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1041
+ readonly template: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1042
+ readonly source: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1043
+ readonly bot: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1044
+ readonly 'bot-filled': LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1045
+ readonly copy: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1046
+ readonly show: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1047
+ readonly mute: LazyExoticComponent<FC<SVGProps<SVGElement>>>;
1048
+ };
1049
+
1050
+ declare type IconType = keyof typeof icons;
1051
+
974
1052
  declare type IncomingBaseMessageProps<T> = T & BaseMessageProps<{
975
1053
  sender: {
976
1054
  nickname: string;
@@ -1528,6 +1606,77 @@ declare type PickMessageProps<Union, T extends Union extends {
1528
1606
  messageType: T;
1529
1607
  } ? Union : never;
1530
1608
 
1609
+ export declare interface PlaceholderBaseProps extends PlaceholderCommonProps {
1610
+ icon?: IconType;
1611
+ label?: string;
1612
+ }
1613
+
1614
+ declare interface PlaceholderCommonProps {
1615
+ className?: string;
1616
+ iconSize?: string | number;
1617
+ children?: ReactNode;
1618
+ }
1619
+
1620
+ export declare interface PlaceholderErrorProps extends PlaceholderBaseProps {
1621
+ action?: {
1622
+ label?: string;
1623
+ onClick: () => void;
1624
+ };
1625
+ }
1626
+
1627
+ export declare const PlaceholderLayout: {
1628
+ (props: PropsWithChildren): ReactNode;
1629
+ defaults: {
1630
+ template: ComponentType<PlaceholderTemplateProps>;
1631
+ components: {
1632
+ Loading: ({ iconSize, className }: PlaceholderLoadingProps) => ReactNode;
1633
+ Error: ({ label, icon, action, ...props }: PlaceholderErrorProps) => ReactNode;
1634
+ NoChannels: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1635
+ NoMessages: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1636
+ };
1637
+ };
1638
+ Template: ({ template, children }: {
1639
+ template?: ComponentType<PlaceholderTemplateProps> | undefined;
1640
+ children?: ReactNode;
1641
+ }) => JSX.Element;
1642
+ Context: Context<LayoutContextValue< {
1643
+ Loading: ({ iconSize, className }: PlaceholderLoadingProps) => ReactNode;
1644
+ Error: ({ label, icon, action, ...props }: PlaceholderErrorProps) => ReactNode;
1645
+ NoChannels: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1646
+ NoMessages: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1647
+ }, PlaceholderTemplateProps>>;
1648
+ useContext: () => LayoutContextValue< {
1649
+ Loading: ({ iconSize, className }: PlaceholderLoadingProps) => ReactNode;
1650
+ Error: ({ label, icon, action, ...props }: PlaceholderErrorProps) => ReactNode;
1651
+ NoChannels: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1652
+ NoMessages: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1653
+ }, PlaceholderTemplateProps>;
1654
+ } & {
1655
+ Loading: (props: {
1656
+ component: ({ iconSize, className }: PlaceholderLoadingProps) => ReactNode;
1657
+ }) => null;
1658
+ Error: (props: {
1659
+ component: ({ label, icon, action, ...props }: PlaceholderErrorProps) => ReactNode;
1660
+ }) => null;
1661
+ NoChannels: (props: {
1662
+ component: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1663
+ }) => null;
1664
+ NoMessages: (props: {
1665
+ component: ({ label, icon, ...props }: PlaceholderBaseProps) => ReactNode;
1666
+ }) => null;
1667
+ };
1668
+
1669
+ export declare interface PlaceholderLoadingProps extends PlaceholderCommonProps {
1670
+ }
1671
+
1672
+ export declare type PlaceholderTemplateProps = ({
1673
+ type: 'loading';
1674
+ } & PlaceholderLoadingProps) | ({
1675
+ type: 'error';
1676
+ } & PlaceholderErrorProps) | ({
1677
+ type: 'noChannels' | 'noMessages';
1678
+ } & PlaceholderBaseProps);
1679
+
1531
1680
  export declare type PositionHorizontal = 'start' | 'end';
1532
1681
 
1533
1682
  export declare type PositionVertical = 'top' | 'bottom';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as o, d as n, y as t, i, C as r, k as C, n as g, o as u, l as v, q as L, s as x, t as m, j as y, r as M, D as d, F as S, h as f, g as l, w as p, x as I, M as c, O as A, S as P, m as h, p as D, v as F, f as O, u as T, e as b } from "./es/BJDMdOwf.js";
1
+ import { a as o, b as n, v as t, f as i, C as r, h as C, j as L, k as u, i as g, n as v, p as x, q as m, g as y, o as M, D as d, F as l, I, L as P, s as S, t as c, M as f, O as p, P as h, S as A, m as D, l as F, r as O, e as T, u as b, d as j } from "./es/CQ8KW62U.js";
2
2
  import "react";
3
3
  export {
4
4
  o as AgentProviderContainer,
@@ -7,27 +7,28 @@ export {
7
7
  i as CSATType,
8
8
  r as Commands,
9
9
  C as Conversation,
10
- g as ConversationContext,
10
+ L as ConversationContext,
11
11
  u as ConversationContextProvider,
12
- v as ConversationLayout,
13
- L as ConversationList,
12
+ g as ConversationLayout,
13
+ v as ConversationList,
14
14
  x as ConversationListContext,
15
15
  m as ConversationListContextProvider,
16
16
  y as ConversationListItemLayout,
17
17
  M as ConversationListLayout,
18
18
  d as DefaultMessenger,
19
- S as FixedMessenger,
20
- f as IncomingMessageLayout,
21
- l as LauncherBase,
22
- p as LogLevel,
23
- I as ManualSessionInfo,
24
- c as MessageLogs,
25
- A as OutgoingMessageLayout,
26
- P as SystemMessageLayout,
27
- h as messengerDispatcher,
28
- D as useConversationContext,
29
- F as useConversationListContext,
30
- O as useLocalizationContext,
31
- T as useMessengerContext,
32
- b as useMessengerSessionContext
19
+ l as FixedMessenger,
20
+ I as IncomingMessageLayout,
21
+ P as LauncherBase,
22
+ S as LogLevel,
23
+ c as ManualSessionInfo,
24
+ f as MessageLogs,
25
+ p as OutgoingMessageLayout,
26
+ h as PlaceholderLayout,
27
+ A as SystemMessageLayout,
28
+ D as messengerDispatcher,
29
+ F as useConversationContext,
30
+ O as useConversationListContext,
31
+ T as useLocalizationContext,
32
+ b as useMessengerContext,
33
+ j as useMessengerSessionContext
33
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/ai-agent-messenger-react",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "Sendbird AI Agent Messenger for React",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,13 +29,13 @@
29
29
  "react-syntax-highlighter": "^15.6.1"
30
30
  },
31
31
  "peerDependencies": {
32
- "@sendbird/chat": "^4.20.0",
32
+ "@sendbird/chat": "^4.20.1",
33
33
  "react": ">=18.0.0",
34
34
  "react-dom": ">=18.0.0",
35
35
  "styled-components": ">=5.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@sendbird/chat": "^4.20.0",
38
+ "@sendbird/chat": "^4.20.1",
39
39
  "@types/react": "^19.0.2",
40
40
  "@types/react-dom": "^19.0.2",
41
41
  "@types/react-syntax-highlighter": "^15.5.13",
@@ -44,9 +44,9 @@
44
44
  "react-dom": "^19.0.0",
45
45
  "strip-json-comments": "^5.0.1",
46
46
  "styled-components": "^6.1.15",
47
- "@sendbird/ai-agent-core": "1.5.0",
48
- "@sendbird/vite-tools": "0.0.1",
49
- "@sendbird/config-editor": "0.1.0"
47
+ "@sendbird/ai-agent-core": "1.6.1",
48
+ "@sendbird/config-editor": "0.1.0",
49
+ "@sendbird/vite-tools": "0.0.1"
50
50
  },
51
51
  "msw": {
52
52
  "workerDirectory": [