@chatsystem/client 1.1.65 → 1.1.67
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.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +109 -106
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -98,14 +98,14 @@ For more details see https://formatjs.io/docs/getting-started/message-distributi
|
|
|
98
98
|
rounded-lg
|
|
99
99
|
dark:border-white
|
|
100
100
|
dark:bg-white
|
|
101
|
-
transition-colors`,"data-testid":"send-button",onClick:e,disabled:t,type:"button","aria-label":"Send message",children:N.jsx("span",{className:"","data-state":"closed",children:N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",className:"text-white dark:text-black",children:[N.jsx("path",{d:"M3 20L21 12L3 4L7.5 12L3 20Z",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linejoin":"round"}),N.jsx("path",{d:"M7.5 12H14.75",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"})]})})})});var it=(e=>(e.FRENCH="fr-FR",e.ENGLISH="en-US",e))(it||{});const rx={"generic.language.english":"English","generic.language.french":"French","chatbot.placeholder.content":"Message the assistant...","chatbot.DiscussionLimitReached.title":"Discussion limit reached","chatbot.DiscussionLimitReached.explaination":"The discussion has reached its maximum number of messages. Please start a new one.","chatbot.DiscussionLimitReached.cta":"Restart","chatbot.error.api.409":"Oups ! The discussion if full. Please start a new one.","chatbot.error.api.429":"⏳ The chatbot is a little busy at the time. Please try again later.","chatbot.error.api.500":"Oops ! There has been an error. Please try again later.","chatbot.chatline.label.user":"You","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.genericSearchMessage":"
|
|
101
|
+
transition-colors`,"data-testid":"send-button",onClick:e,disabled:t,type:"button","aria-label":"Send message",children:N.jsx("span",{className:"","data-state":"closed",children:N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",className:"text-white dark:text-black",children:[N.jsx("path",{d:"M3 20L21 12L3 4L7.5 12L3 20Z",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linejoin":"round"}),N.jsx("path",{d:"M7.5 12H14.75",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"})]})})})});var it=(e=>(e.FRENCH="fr-FR",e.ENGLISH="en-US",e))(it||{});const rx={"generic.language.english":"English","generic.language.french":"French","chatbot.placeholder.content":"Message the assistant...","chatbot.DiscussionLimitReached.title":"Discussion limit reached","chatbot.DiscussionLimitReached.explaination":"The discussion has reached its maximum number of messages. Please start a new one.","chatbot.DiscussionLimitReached.cta":"Restart","chatbot.error.api.409":"Oups ! The discussion if full. Please start a new one.","chatbot.error.api.429":"⏳ The chatbot is a little busy at the time. Please try again later.","chatbot.error.api.500":"Oops ! There has been an error. Please try again later.","chatbot.chatline.label.user":"You","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.genericSearchMessage":"Thiking ...","chatbot.chatline.loading.function.search":"Search","chatbot.chatline.loading.function.extractProductName":"Looking into the cavern","chatbot.chatline.loading.function.suggestProductName":"Consulting the shadocks","chatbot.chatline.loading.function.criteriaDefinition":"Looking for ziboublis","chatbot.chatline.loading.function.searchStock":"Searching Stock","chatbot.chatline.loading.function.step":"Step","chatbot.chatline.loading.cancel":"Cancel","chatbot.chatline.seeRecentMessages":"see recent messages","chatbot.infobanner.title":"You have an archived discussion.","chatbot.infobanner.cta":"See"},ix={"generic.language.english":"Anglais","generic.language.french":"Français","chatbot.placeholder.content":"Envoyez un message à l'assistant ...","chatbot.DiscussionLimitReached.title":"Maximum de messages envoyés atteint.","chatbot.DiscussionLimitReached.explaination":"Le robot est à son maximum et ne peut plus envoyer de message. Merci de relancer une conversation.","chatbot.DiscussionLimitReached.cta":"Relancer une nouvelle conversation","chatbot.error.api.409":"Oups ! La discussion est à son maximum. Merci d'en commencer une nouvelle.","chatbot.error.api.429":"⏳ Le robot est un peu occupé actuellement. Merci de réessayer plus tard.","chatbot.error.api.500":"Oups ! Une erreur est survenue. Merci de réessayer plus tard !","chatbot.chatline.label.user":"Vous","chatbot.chatline.label.assistant":"Assistant","chatbot.chatline.loading.function.search":"Recherche","chatbot.chatline.loading.function.genericSearchMessage":"Je réfléchis ...","chatbot.chatline.loading.function.extractProductName":"Recherche dans la caverne","chatbot.chatline.loading.function.suggestProductName":"Consultation des shadocks","chatbot.chatline.loading.function.criteriaDefinition":"Recherche des ziboublis","chatbot.chatline.loading.function.searchStock":"Recherche en stock","chatbot.chatline.loading.function.step":"Etape","chatbot.chatline.loading.cancel":"Annuler","chatbot.chatline.seeRecentMessages":"voir les messages plus récents","chatbot.infobanner.title":"Vous avez une conversation archivée.","chatbot.infobanner.cta":"Voir"},Ur={[it.ENGLISH]:{translatedText:rx,pictureName:it.ENGLISH,langID:0,locale:it.ENGLISH},[it.FRENCH]:{translatedText:ix,pictureName:it.FRENCH,langID:1,locale:it.FRENCH}},ax=Object.keys(Ur);ax.reduce((e,t)=>{const n=Ur[t];return[...e,n]},[]);const sx="languageSettings",cc=O.createContext({appCurrentLang:Ur[it.ENGLISH],setAppCurrentLang:()=>{}}),ux=e=>/(\[.*|\!\[.*)$/.test(e),ox=e=>/\)/.test(e),lx=e=>e.filter(t=>t.userType==="user").length;var Zi=(e=>(e.GET_DISCUSSION_ID="/id",e.RESET_DISCUSSION="/delete",e))(Zi||{});const cx=e=>!!e.startsWith("/"),fx=(e,t,n,r)=>e===Zi.GET_DISCUSSION_ID?t?`Votre ID de discussion est ${t}`:"Votre ID de discussion n'est pas encore défini. Envoyez un premier message pour que ce soit le cas.":e===Zi.RESET_DISCUSSION?(n(r),null):`La commande ${e} n'est pas prise en compte.`;var Cn=(e=>(e.OUTPUT_STREAM_TEXT_TYPE="text",e.OUTPUT_STREAM_NUMBER_OF_STEPS_TYPE="number_of_steps",e.OUTPUT_STREAM_CURRENT_STEP_NUMBER_TYPE="current_step_number",e.OUTPUT_STREAM_CURRENT_STEP_NAME_TYPE="current_step_name",e))(Cn||{});class Zt{constructor(){}static transformStringifiedObjectIntoArrayOfObjects=t=>{const r=t.split("}").map(s=>s.startsWith("{")?s+="}":null),i=r.filter(s=>!!s);let a;try{a=i.map(s=>JSON.parse(s))}catch{console.warn("Could not parse the objects. Objects received :"),console.warn("Initial objects :",t),console.warn("objectsCompleted :",r),console.warn("objectsCleaned :",i)}return a};static isObjectOutputstreamTextDTO=t=>t.type===Cn.OUTPUT_STREAM_TEXT_TYPE;static isObjectOutputstreamLoadingNumberOfStepsDTO=t=>t.type===Cn.OUTPUT_STREAM_NUMBER_OF_STEPS_TYPE;static isObjectOutputstreamLoadingCurrentStepNumberDTO=t=>t.type===Cn.OUTPUT_STREAM_CURRENT_STEP_NUMBER_TYPE;static isObjectOutputstreamLoadingCurrentStepNameDTO=t=>t.type===Cn.OUTPUT_STREAM_CURRENT_STEP_NAME_TYPE;static containsObjectWithLastAnswerToTrue=t=>{for(const n of t)if(this.isObjectOutputstreamTextDTO(n)&&n.isLastAnswer)return!0;return!1}}const fc=()=>{const e=Hn(),t=e.formatMessage({defaultMessage:"Search",id:"chatbot.chatline.loading.function.search"}),n=e.formatMessage({defaultMessage:"Looking into the cavern",id:"chatbot.chatline.loading.function.extractProductName"}),r=e.formatMessage({defaultMessage:"Consulting the shadocks",id:"chatbot.chatline.loading.function.suggestProductName"}),i=e.formatMessage({defaultMessage:"Looking for ziboublis",id:"chatbot.chatline.loading.function.criteriaDefinition"}),a=e.formatMessage({defaultMessage:"Searching Stock",id:"chatbot.chatline.loading.function.searchStock"}),s=e.formatMessage({defaultMessage:"Step",id:"chatbot.chatline.loading.function.step"}),u=e.formatMessage({defaultMessage:"I'm looking for products",id:"chatbot.chatline.loading.function.genericSearchMessage"}),o=e.formatMessage({defaultMessage:"Cancel",id:"chatbot.chatline.loading.cancel"}),c=e.formatMessage({defaultMessage:"see recent messages",id:"chatbot.chatline.seeRecentMessages"}),f=h=>h?h.includes("ExtractProductNames")?n:h.includes("SuggestProductNames")?r:h.includes("CreateCriteriasFromProductNames")||h.includes("CreateCriteriasOrProductNamesFromDiscussion")?i:h.includes("SearchStock")?a:"":t,d=f();return{searchTranslation:t,extractProductNameTranslation:n,criteriaDefinitionTranslation:i,searchStockTranslation:a,stepTranslation:s,getFunctionTranslated:f,defaultStartingStep:d,lookingForProductTranslation:u,cancelTranslation:o,recentMessagesTranslation:c}},dx=({})=>{const{companySettings:e}=O.useContext(fn);return N.jsx("div",{className:`search
|
|
102
102
|
transition
|
|
103
103
|
ease-in-out
|
|
104
104
|
delay-50
|
|
105
105
|
flex
|
|
106
106
|
justify-center
|
|
107
107
|
items-center
|
|
108
|
-
`,children:N.jsx(na,{facet:e.agent.display[We.AgentDisplayFacetRoleType.SEARCH]})})},hx=({loadingStatus:e,currentStepName:t,currentStepNumber:n,numberOfSteps:r})=>{const{getFunctionTranslated:i,stepTranslation:a,lookingForProductTranslation:s}=fc();return N.jsx(N.Fragment,{children:e==="loadingIntermediaryStates"&&N.jsxs("div",{children:[N.jsxs("div",{children:[N.
|
|
108
|
+
`,children:N.jsx(na,{facet:e.agent.display[We.AgentDisplayFacetRoleType.SEARCH]})})},hx=({loadingStatus:e,currentStepName:t,currentStepNumber:n,numberOfSteps:r})=>{const{getFunctionTranslated:i,stepTranslation:a,lookingForProductTranslation:s}=fc();return N.jsx(N.Fragment,{children:e==="loadingIntermediaryStates"&&N.jsxs("div",{children:[N.jsxs("div",{children:[N.jsx("p",{className:"text-center my-2 text-lg",children:s}),N.jsx("p",{className:"text-center my-1 text-md",children:t&&`${i(t)}`}),n&&N.jsxs("p",{className:"text-center my-2",children:[a,N.jsx("span",{children:" "}),n,"/",r]})]}),N.jsx("div",{className:"flex justify-center",children:N.jsx(dx,{})})]})})},mx=({onPressLoadingButton:e})=>N.jsx("div",{children:N.jsx("button",{className:"absolute bg-white md:bottom-2 md:right-3 dark:hover:bg-white right-2 bottom-1.5 disabled:opacity-10 disabled:text-gray-400 enabled:bg-white text-white p-0.5 border border-white rounded-lg dark:border-white dark:bg-white transition-colors","data-testid":"send-button",onClick:e,type:"button",style:{outline:"none"},tabIndex:-1,onMouseDown:t=>t.preventDefault(),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&t.preventDefault()},onKeyUp:t=>{(t.key==="Enter"||t.key===" ")&&t.preventDefault()},children:N.jsx("span",{className:"","data-state":"closed",children:N.jsxs("svg",{fill:"#000000",height:"24",width:"24",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 297 297",children:[N.jsx("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),N.jsx("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),N.jsxs("g",{id:"SVGRepo_iconCarrier",children:[" ",N.jsx("path",{d:"M148.5,0C66.486,0,0,66.486,0,148.5S66.486,297,148.5,297S297,230.514,297,148.5S230.514,0,148.5,0z M213.292,190.121 c0,12.912-10.467,23.379-23.378,23.379H106.67c-12.911,0-23.378-10.467-23.378-23.379v-83.242c0-12.912,10.467-23.379,23.378-23.379 h83.244c12.911,0,23.378,10.467,23.378,23.379V190.121z"})," "]})]})})})}),px=e=>{const t=O.useRef(null),[n,r]=O.useState(!1),i=O.useRef(!0),a=O.useRef(!1),s=O.useRef(0),u=()=>{const f=t.current,d=4;if(f){f.scrollTop<s.current-1&&(a.current=!1);const m=f.scrollHeight>f.clientHeight,E=f.scrollHeight-f.scrollTop<=f.clientHeight+d;r(m&&!E),i.current=E,s.current=f.scrollTop}},o=({smooth:f=!1,sticky:d=!1})=>{const h=t.current;d?(a.current=!0,i.current=!0):h&&h.scrollTo({top:h.scrollHeight,behavior:f?"smooth":"auto"}),h&&a.current&&h.scrollTo({top:h.scrollHeight,behavior:f?"smooth":"auto"})};return O.useEffect(()=>{u()},[e.length]),O.useEffect(()=>{const f=t.current;if(f)return f.addEventListener("scroll",u),u(),()=>{f.removeEventListener("scroll",u)}},[]),O.useLayoutEffect(()=>{a.current&&o({smooth:!1})},[e.length]),{scrollToBottom:o,removeStickyNess:()=>{a.current=!1},messagesContainerRef:t,showScrollButton:n}},gx=()=>{const e=Hn(),t=e.formatMessage({defaultMessage:"Discussion limit reached",id:"chatbot.DiscussionLimitReached.title"}),n=e.formatMessage({defaultMessage:"The discussion has reached its maximum number of messages. Please start a new one.",id:"chatbot.DiscussionLimitReached.explaination"}),r=e.formatMessage({defaultMessage:"Restart",id:"chatbot.DiscussionLimitReached.cta"});return{DiscussionLimitReachedTitleTranslation:t,DiscussionLimitReachedExplainationTranslation:n,DiscussionLimitReachedCtaTranslation:r}},bx=e=>De.createElement("svg",{width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},De.createElement("g",{clipPath:"url(#clip0_1276_7761)"},De.createElement("path",{d:"M19.7285 10.9288C20.4413 13.5978 19.7507 16.5635 17.6569 18.6573C15.1798 21.1344 11.4826 21.6475 8.5 20.1966M18.364 8.05071L17.6569 7.3436C14.5327 4.21941 9.46736 4.21941 6.34316 7.3436C3.42964 10.2571 3.23318 14.8588 5.75376 18M18.364 8.05071H14.1213M18.364 8.05071V3.80807",stroke:"#1C274C",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),De.createElement("defs",null,De.createElement("clipPath",{id:"clip0_1276_7761"},De.createElement("rect",{width:24,height:24,fill:"white"})))),Ex=({resetDiscussion:e,companySettings:t})=>{const{DiscussionLimitReachedCtaTranslation:n,DiscussionLimitReachedExplainationTranslation:r,DiscussionLimitReachedTitleTranslation:i}=gx();return N.jsx(N.Fragment,{children:N.jsx("div",{className:"px-3 mt-4",children:N.jsxs("div",{role:"status","aria-live":"polite",className:"info-banner not-prose flex items-start gap-3 rounded-lg bg-blue-50 border-l-4 border-blue-500 p-4 shadow-sm",children:[N.jsx("div",{className:"flex flex-col justify-center items-center mx-3",children:N.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:"!w-5 !h-5 mt-0.5 flex-shrink-0 pointer-events-none",children:N.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16Zm.75-11.5a.75.75 0 10-1.5 0 .75.75 0 001.5 0ZM9 8.75A.75.75 0 019.75 8h.5a.75.75 0 01.75.75v5a.75.75 0 01-.75.75h-.5A.75.75 0 019 13.75v-5Z",clipRule:"evenodd"})})}),N.jsxs("div",{className:"flex-1 min-w-0",children:[N.jsx("p",{className:"font-semibold",children:i}),N.jsx("p",{className:"text-sm break-words",children:r}),N.jsx("div",{className:"my-2",children:N.jsxs("button",{type:"button",onClick:()=>e(t),title:n,"aria-label":n,className:`group inline-flex items-center gap-2 rounded-full px-3 py-1.5
|
|
109
109
|
font-medium text-blue-700 dark:text-blue-300
|
|
110
110
|
bg-blue-50/70 hover:bg-blue-100 dark:bg-blue-900/20 dark:hover:bg-blue-900/30
|
|
111
111
|
ring-1 ring-inset ring-blue-600/20 hover:ring-blue-600/30
|
|
@@ -1736,6 +1736,12 @@ video {
|
|
|
1736
1736
|
.chatBox hr {
|
|
1737
1737
|
margin: 1.5rem 0;
|
|
1738
1738
|
}
|
|
1739
|
+
|
|
1740
|
+
.chatBox table {
|
|
1741
|
+
margin: 1rem 0;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
|
|
1739
1745
|
`,cy=`/* React-Css Transitions */
|
|
1740
1746
|
.menuTransition-enter {
|
|
1741
1747
|
opacity: 0;
|