@callimacus/thamyr-react 4.4.0 → 4.5.0
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/CHANGELOG.core.md +14 -0
- package/CHANGELOG.md +30 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +55 -2
- package/package.json +15 -11
package/CHANGELOG.core.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.5.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.4.1...thamyr-core-v4.5.0) (2026-10-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* **thamyr-core:** Synchronize thamyr versions
|
|
12
|
+
|
|
13
|
+
## [4.4.1](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.4.0...thamyr-core-v4.4.1) (2026-10-10)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **deps:** bump internal @callimacus/intent to 2.1.10, eslint-config-xo 5 ([#813](https://github.com/callimacus/thamyr-sdk/issues/813)) ([db8ade8](https://github.com/callimacus/thamyr-sdk/commit/db8ade80257b8516e64fb3f4ba8bcc0f7c62ee15))
|
|
19
|
+
|
|
6
20
|
## [4.4.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-core-v4.3.5...thamyr-core-v4.4.0) (2026-09-29)
|
|
7
21
|
|
|
8
22
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.5.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-react-v4.4.1...thamyr-react-v4.5.0) (2026-10-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **react:** add CallimacusBar, a themable prompt bar that always shows the Callimacus mark ([#817](https://github.com/callimacus/thamyr-sdk/issues/817)) ([71fd9be](https://github.com/callimacus/thamyr-sdk/commit/71fd9bee1133ccca2021a1c8a6d7370f372576ae))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* The following workspace dependencies were updated
|
|
17
|
+
* dependencies
|
|
18
|
+
* @callimacus/thamyr bumped from ^4.4.1 to ^4.5.0
|
|
19
|
+
* @callimacus/thamyr-core bumped from ^4.4.1 to ^4.5.0
|
|
20
|
+
|
|
21
|
+
## [4.4.1](https://github.com/callimacus/thamyr-sdk/compare/thamyr-react-v4.4.0...thamyr-react-v4.4.1) (2026-10-10)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **deps:** bump internal @callimacus/intent to 2.1.10, eslint-config-xo 5 ([#813](https://github.com/callimacus/thamyr-sdk/issues/813)) ([db8ade8](https://github.com/callimacus/thamyr-sdk/commit/db8ade80257b8516e64fb3f4ba8bcc0f7c62ee15))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
* The following workspace dependencies were updated
|
|
32
|
+
* dependencies
|
|
33
|
+
* @callimacus/thamyr bumped from ^4.4.0 to ^4.4.1
|
|
34
|
+
* @callimacus/thamyr-core bumped from ^4.4.0 to ^4.4.1
|
|
35
|
+
|
|
6
36
|
## [4.4.0](https://github.com/callimacus/thamyr-sdk/compare/thamyr-react-v4.3.5...thamyr-react-v4.4.0) (2026-09-29)
|
|
7
37
|
|
|
8
38
|
|
package/dist/esm/index.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* See LICENSE.md for the full terms.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import{UserInteractionType as e,interactionRound as t,landingRound as n}from"@callimacus/thamyr-core";export{ADD_TO_CART_RESULT_BLOCK,CallimacusEvent,ChapterStatus,ClientEvents,GalleryMode,LANDING_VALUE_MAX_LENGTH,SLInputEventType,ServerEvents,ThamyrHttpError,ThamyrResponseType,UserInteractionType,addToCartResultOf,applyBlockPatch,blockKeyOf,callimacusService,clearIntentSessionId,ensureIntentSessionId,extractTtsAudio,getIntentSessionId,initIntent,interactionRound,isSetProduct,landingRound,logger,receptorsOf,setConsent,setDebug,setDebugPanel,setGeo,setIntentSessionMaxAge,transformImageUrl}from"@callimacus/thamyr-core";import{t as r,w as o,u as a,m as i,a as c,b as s}from"./chunks/api-PeedNYnN.js";import{useMemo as u,useEffect as d,useState as l,useRef as p,useCallback as m}from"react";import"@callimacus/thamyr";function v(e,t){const n=p(t);n.current=t,d(()=>e(e=>{n.current(e)}),[e])}function g(e){const t=a(e=>e.init),n=a(e=>e.reset);c(),d(()=>(s(),t(e),()=>{n(),i()}),[t,n,e.clientId,e.endpoint])}function y(){const r=a(e=>e.messages),o=a(e=>e.sendEvent),i=a(e=>e.sendAudio),c=u(()=>({openLanding(t,r={}){o(e.CREATE_ROUND,n(t,r))},sendInteraction(n,r={}){o(e.CREATE_ROUND,t(n,r))},refresh(n,r,a={}){o(e.CREATE_ROUND,t(r,{...a,block:n}))}}),[o]);return{history:r,sendEvent:o,sendAudio:i,...c}}const f={suggestions:[],loading:!1};function E(e,t={}){const{storyId:n,language:r,debounceMs:o=200}=t,i=a(e=>"connected"===e.connectionStatus),[c,s]=l(f),[u,p]=l(i);return u!==i&&(p(i),i||s(f)),d(()=>{if(!i)return;let t=!1;const c=setTimeout(()=>{s(e=>({...e,loading:!0}));(a.getState()._thamyr?.suggest(e,{storyId:n,language:r})??Promise.resolve(f)).then(({suggestions:e})=>{t||s({suggestions:e,loading:!1})}).catch(()=>{t||s(f)})},""===e?0:o);return()=>{t=!0,clearTimeout(c)}},[e,n,r,o,i]),i?c:f}function h(){return{status:a(e=>e.connectionStatus)}}function T(e){v(a(e=>e.addResponseListener),e)}function I(e){v(a(e=>e.addConnectionListener),e)}function L(e){v(a(e=>e.addErrorListener),e)}function w(){return u(()=>({getCart:async()=>(await o()).cart.getCart(),addItem:async e=>(await o()).cart.addItemToCart({productId:e}),removeItem:async e=>(await o()).cart.removeItemFromCart({productId:e}),updateQuantity:async(e,t)=>(await o()).cart.updateProductQuantity({productId:e,quantity:t})}),[])}function A(){return r}function C(){return u(()=>({similar:async(e,t)=>(await o()).skesis.similar({anchorId:e,...t}),related:async(e,t)=>(await o()).skesis.related({anchorId:e,...t})}),[])}function R(){return u(()=>({getSitemap:async()=>(await o()).sitemap.getSitemap()}),[])}const S=-45,D=1800,b=3e4;function M({silenceThreshold:e=S,silenceDuration:t=D,maxDuration:n=b,onRecordingComplete:r}){const[o,a]=l("idle"),[i,c]=l([]),[s,u]=l(void 0),v=p(void 0),g=p(void 0),y=p(void 0),f=p(void 0),E=p(0),h=p(0),T=p(void 0),I=p([]),L=p(!1),w=m(()=>{if(0!==E.current&&(cancelAnimationFrame(E.current),E.current=0),void 0!==T.current&&(clearTimeout(T.current),T.current=void 0),f.current){for(const e of f.current.getTracks())e.stop();f.current=void 0}"closed"!==g.current?.state&&g.current?.close(),g.current=void 0,y.current=void 0,v.current=void 0,L.current=!1},[]);d(()=>w,[w]);const A=m(()=>{L.current||(L.current=!0,"recording"===v.current?.state&&v.current.stop(),0!==E.current&&(cancelAnimationFrame(E.current),E.current=0),void 0!==T.current&&(clearTimeout(T.current),T.current=void 0))},[]),C=m(async()=>{u(void 0),I.current=[],L.current=!1;try{const o=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});f.current=o;const i=new AudioContext({sampleRate:16e3});g.current=i;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=256,u.smoothingTimeConstant=.7,s.connect(u),y.current=u;const d=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",l=new MediaRecorder(o,{mimeType:d});v.current=l,l.addEventListener("dataavailable",e=>{e.data.size>0&&I.current.push(e.data)}),l.addEventListener("stop",()=>{a("processing");const e=new Blob(I.current,{type:d});w(),r(e)}),l.start(250),a("recording"),h.current=0,T.current=setTimeout(()=>{A()},n);const p=()=>{if(!y.current||L.current)return;const n=y.current.frequencyBinCount,r=new Uint8Array(n);y.current.getByteFrequencyData(r);const o=Math.floor(n/32),a=[];for(let e=0;e<32;e++){let t=0;for(let n=0;n<o;n++)t+=r[e*o+n];a.push(t/o/255)}c(a);let i=0;for(const e of r){const t=e/255;i+=t*t}const s=Math.sqrt(i/n);if((s>0?20*Math.log10(s):-100)<e){if(0===h.current)h.current=Date.now();else if(Date.now()-h.current>t)return void A()}else h.current=0;E.current=requestAnimationFrame(p)};p()}catch{u("Microphone access denied"),a("idle"),w()}},[e,t,n,r,A,w]),R=m(()=>{a("idle"),c([])},[]);return{state:o,audioLevels:i,startRecording:C,stopRecording:A,reset:R,error:s}}function U(e){const t=p(void 0),[n,r]=l("idle"),[o,a]=l(void 0);d(()=>{const n=e?.audioUrl;if("undefined"==typeof Audio||void 0===n||""===n)return t.current=void 0,void r("idle");const o=new Audio(n);o.preload="none",t.current=o,r("idle"),a(void 0);const i=()=>{r("playing")},c=()=>{r("loading")},s=()=>{r(e=>"ended"===e?e:"paused")},u=()=>{r("ended")},d=()=>{a("Audio playback failed"),r("error")};return o.addEventListener("playing",i),o.addEventListener("waiting",c),o.addEventListener("pause",s),o.addEventListener("ended",u),o.addEventListener("error",d),()=>{o.pause(),o.removeEventListener("playing",i),o.removeEventListener("waiting",c),o.removeEventListener("pause",s),o.removeEventListener("ended",u),o.removeEventListener("error",d),o.src="",t.current=void 0}},[e?.audioUrl]);const i=m(async()=>{const e=t.current;if(e)try{a(void 0),r("loading"),await e.play()}catch{a("Audio playback failed"),r("error")}},[]),c=m(()=>{t.current?.pause()},[]),s=m(()=>{const e=t.current;e&&(e.pause(),e.currentTime=0,r("idle"))},[]),u=m(()=>{const e=t.current;e&&(e.paused?i():e.pause())},[i]);return{state:n,isPlaying:"playing"===n||"loading"===n,error:o,play:i,pause:c,toggle:u,stop:s}}export{r as thamyrApi,A as useApi,a as useCallimacusStore,w as useCart,h as useConnection,g as useInitThamyr,I as useOnConnectionChange,L as useOnError,T as useOnResponse,R as useSitemap,C as useSkesis,E as useSuggestions,y as useThamyr,U as useTtsAudio,M as useVoiceRecorder};
|
|
8
|
+
import{UserInteractionType as n,interactionRound as t,landingRound as e}from"@callimacus/thamyr-core";export{ADD_TO_CART_RESULT_BLOCK,CallimacusEvent,ChapterStatus,ClientEvents,GalleryMode,LANDING_VALUE_MAX_LENGTH,SLInputEventType,ServerEvents,ThamyrHttpError,ThamyrResponseType,UserInteractionType,addToCartResultOf,applyBlockPatch,blockKeyOf,callimacusService,clearIntentSessionId,ensureIntentSessionId,extractTtsAudio,getIntentSessionId,initIntent,interactionRound,isSetProduct,landingRound,logger,receptorsOf,setConsent,setDebug,setDebugPanel,setGeo,setIntentSessionMaxAge,transformImageUrl}from"@callimacus/thamyr-core";import{jsx as r,jsxs as a}from"react/jsx-runtime";import{useMemo as i,useEffect as o,useState as c,useRef as s,useCallback as l}from"react";import{t as d,w as u,u as m,m as v,a as p,b as h}from"./chunks/api-PeedNYnN.js";import"@callimacus/thamyr";function g(n,t){const e=s(t);e.current=t,o(()=>n(n=>{e.current(n)}),[n])}function b(n){const t=m(n=>n.init),e=m(n=>n.reset);p(),o(()=>(h(),t(n),()=>{e(),v()}),[t,e,n.clientId,n.endpoint])}function f(){const r=m(n=>n.messages),a=m(n=>n.sendEvent),o=m(n=>n.sendAudio),c=i(()=>({openLanding(t,r={}){a(n.CREATE_ROUND,e(t,r))},sendInteraction(e,r={}){a(n.CREATE_ROUND,t(e,r))},refresh(e,r,i={}){a(n.CREATE_ROUND,t(r,{...i,block:e}))}}),[a]);return{history:r,sendEvent:a,sendAudio:o,...c}}const y={suggestions:[],loading:!1};function q(n,t={}){const{storyId:e,language:r,debounceMs:a=200}=t,i=m(n=>"connected"===n.connectionStatus),[s,l]=c(y),[d,u]=c(i);return d!==i&&(u(i),i||l(y)),o(()=>{if(!i)return;let t=!1;const o=setTimeout(()=>{l(n=>({...n,loading:!0}));(m.getState()._thamyr?.suggest(n,{storyId:e,language:r})??Promise.resolve(y)).then(({suggestions:n})=>{t||l({suggestions:n,loading:!1})}).catch(()=>{t||l(y)})},""===n?0:a);return()=>{t=!0,clearTimeout(o)}},[n,e,r,a,i]),i?s:y}function w(){return{status:m(n=>n.connectionStatus)}}function x(n){g(m(n=>n.addResponseListener),n)}function _(n){g(m(n=>n.addConnectionListener),n)}function z(n){g(m(n=>n.addErrorListener),n)}function L(){return i(()=>({getCart:async()=>(await u()).cart.getCart(),addItem:async n=>(await u()).cart.addItemToCart({productId:n}),removeItem:async n=>(await u()).cart.removeItemFromCart({productId:n}),updateQuantity:async(n,t)=>(await u()).cart.updateProductQuantity({productId:n,quantity:t})}),[])}function k(){return d}function E(){return i(()=>({similar:async(n,t)=>(await u()).skesis.similar({anchorId:n,...t}),related:async(n,t)=>(await u()).skesis.related({anchorId:n,...t})}),[])}function T(){return i(()=>({getSitemap:async()=>(await u()).sitemap.getSitemap()}),[])}const C=-45,I=1800,S=3e4;function A({silenceThreshold:n=C,silenceDuration:t=I,maxDuration:e=S,onRecordingComplete:r}){const[a,i]=c("idle"),[d,u]=c([]),[m,v]=c(void 0),p=s(void 0),h=s(void 0),g=s(void 0),b=s(void 0),f=s(0),y=s(0),q=s(void 0),w=s([]),x=s(!1),_=l(()=>{if(0!==f.current&&(cancelAnimationFrame(f.current),f.current=0),void 0!==q.current&&(clearTimeout(q.current),q.current=void 0),b.current){for(const n of b.current.getTracks())n.stop();b.current=void 0}"closed"!==h.current?.state&&h.current?.close(),h.current=void 0,g.current=void 0,p.current=void 0,x.current=!1},[]);o(()=>_,[_]);const z=l(()=>{x.current||(x.current=!0,"recording"===p.current?.state&&p.current.stop(),0!==f.current&&(cancelAnimationFrame(f.current),f.current=0),void 0!==q.current&&(clearTimeout(q.current),q.current=void 0))},[]),L=l(async()=>{v(void 0),w.current=[],x.current=!1;try{const a=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});b.current=a;const o=new AudioContext({sampleRate:16e3});h.current=o;const c=o.createMediaStreamSource(a),s=o.createAnalyser();s.fftSize=256,s.smoothingTimeConstant=.7,c.connect(s),g.current=s;const l=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(a,{mimeType:l});p.current=d,d.addEventListener("dataavailable",n=>{n.data.size>0&&w.current.push(n.data)}),d.addEventListener("stop",()=>{i("processing");const n=new Blob(w.current,{type:l});_(),r(n)}),d.start(250),i("recording"),y.current=0,q.current=setTimeout(()=>{z()},e);const m=()=>{if(!g.current||x.current)return;const e=g.current.frequencyBinCount,r=new Uint8Array(e);g.current.getByteFrequencyData(r);const a=Math.floor(e/32),i=[];for(let n=0;n<32;n++){let t=0;for(let e=0;e<a;e++)t+=r[n*a+e];i.push(t/a/255)}u(i);let o=0;for(const n of r){const t=n/255;o+=t*t}const c=Math.sqrt(o/e);if((c>0?20*Math.log10(c):-100)<n){if(0===y.current)y.current=Date.now();else if(Date.now()-y.current>t)return void z()}else y.current=0;f.current=requestAnimationFrame(m)};m()}catch{v("Microphone access denied"),i("idle"),_()}},[n,t,e,r,z,_]),k=l(()=>{i("idle"),u([])},[]);return{state:a,audioLevels:d,startRecording:L,stopRecording:z,reset:k,error:m}}function M(n){const t=s(void 0),[e,r]=c("idle"),[a,i]=c(void 0);o(()=>{const e=n?.audioUrl;if("undefined"==typeof Audio||void 0===e||""===e)return t.current=void 0,void r("idle");const a=new Audio(e);a.preload="none",t.current=a,r("idle"),i(void 0);const o=()=>{r("playing")},c=()=>{r("loading")},s=()=>{r(n=>"ended"===n?n:"paused")},l=()=>{r("ended")},d=()=>{i("Audio playback failed"),r("error")};return a.addEventListener("playing",o),a.addEventListener("waiting",c),a.addEventListener("pause",s),a.addEventListener("ended",l),a.addEventListener("error",d),()=>{a.pause(),a.removeEventListener("playing",o),a.removeEventListener("waiting",c),a.removeEventListener("pause",s),a.removeEventListener("ended",l),a.removeEventListener("error",d),a.src="",t.current=void 0}},[n?.audioUrl]);const d=l(async()=>{const n=t.current;if(n)try{i(void 0),r("loading"),await n.play()}catch{i("Audio playback failed"),r("error")}},[]),u=l(()=>{t.current?.pause()},[]),m=l(()=>{const n=t.current;n&&(n.pause(),n.currentTime=0,r("idle"))},[]),v=l(()=>{const n=t.current;n&&(n.paused?d():n.pause())},[d]);return{state:e,isPlaying:"playing"===e||"loading"===e,error:a,play:d,pause:u,toggle:v,stop:m}}function R(n){return r("svg",{viewBox:"0 0 40 45",fill:"currentColor",role:"img","aria-label":"Callimacus",...n,children:r("path",{d:"M39.2 21.6q.8-.6.8-1 0-.2-.3-.2h-1.3l-.5.1h-.3c-.3-.2-.6-1-.9-1.5l-.5-1q-.2-.2-.4-.2t-.3.2l-.2 1.2-.4 1.5h-.1l-.3-.3-.4-.3q-1.5-1.9-2.7-3.8Q27.7 11 23.3 6l-.9-1.1q.1-.4.7-1l.5-.5v-.5l-.4-.1-1 .1h-.4q-.7-.1-.9-1.3-.2-1-.6-1.4L20 0q-.5.4-.6 1.3-.2.8-.5 1-.5.3-1.7.2l-1 .1v.7q0 .3.6.5c.4.2 1 .5 1 .8q-.2.4-1 .8l-.3.3-1.1 1-1 1L13 8.9c-1.9 1.7-4 3.5-5.4 5.7l-2.3.8q-.6-.2-.8-.9h-.4q-.2 0-.1 1v.6l-.1.2v.7L1 18.1v.3l.3.2 2.7.2.5 2.3-.4 2.8-.5 4.2v.3l.1.3-.1.3-.2.3-.1.3c0 .3-.3 1-.4 1H0v.2q0 .3.2.4l.9.5q1 .3 1.3.9l-.2 1-.2.3q-.5.8-.4 1l.1.2q.7-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l-.3.4-.5.2-.4.3h-.2l-.5.4v.1q.5.3.6.8l.2.3q-.3-.1-.8-.5l-1-.5H21L19.3 44q.1-.6.4-1h.2l.2-.3v-.5q-.3-.2-.5-.2h-.3c-.3-.2-1-.7-1.1-1h1.1l.6.1.5-.1.8-2.3.2.8q.1 1 .5 1.3H23m-3.2.2h.1m14.3-17.3-8.6 11.6-1 1.5-2.1 2.8-.3.2-.3-1.2q-.1-1.2-.4-1.3l-.2-.1H21l-1 2.4v-5.9l-.2-5.7 1.8.1.2.1.7.1h.3V28l-.4-.4-.3-.2-.8-1.1L27 25l1.2-.2 2-.5 1.1-.3c1-.4 2.6-.9 3-.9h.1q0 .3-.3.5m4.2-2.1-.4.3-.8.7q.1.4.4.3h.2l.6 1.4-1.8-1.2q-.4 0-.4.3v.1l-1.2.9q0-.8.4-1.4h.1q.3-.2.2-.5-.3-.5-1.2-.7-.8 0-1.1-.5h1l.7.2.5-.1q0-1.4.5-2.4c.2.3.8 1.4.9 1.9v.1l-.1.2h.2l1.8-.2zm-19 1.9.2-2.2zm1.8 3.9zm1.5.9h-.1m.3 15zm12.9-25.5"})})}function D({onSubmit:n,value:t,onValueChange:e,placeholder:i="Ask anything…",sendLabel:o="Send",sendIcon:s,actions:l,tint:d,font:u,loading:m=!1,disabled:v=!1,autoFocus:p,className:h="",style:g}){const[b,f]=c(""),y=t??b,q=n=>{f(n),e?.(n)},w=y.trim(),x=""!==w&&!m&&!v;return a("form",{className:`cm-bar ${h}`.trimEnd(),style:{"--cm-tint":d,"--cm-font":u,...g},"aria-busy":m,onSubmit:t=>{t.preventDefault(),x&&(n(w),q(""))},children:[r("style",{children:H}),r(R,{className:"cm-bar-mark"}),r("textarea",{className:"cm-bar-input",rows:1,value:y,placeholder:i,"aria-label":i,enterKeyHint:"send",disabled:v,autoFocus:p,onChange:n=>{q(n.target.value)},onKeyDown:n=>{"Enter"!==n.key||n.shiftKey||n.nativeEvent.isComposing||(n.preventDefault(),n.currentTarget.form?.requestSubmit())}}),l,r("button",{type:"submit",className:"cm-bar-send",disabled:!x,"aria-label":o,children:s??r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})}const H="\n.cm-bar {\n\t--_tint: var(--cm-tint, linear-gradient(45deg, #d698c7, #ffc691, #a8dfdb, #ddada6));\n\t--_bg: var(--cm-bg, light-dark(#fff, #1c1c1e));\n\t--_fg: var(--cm-fg, light-dark(#212121, #f5f5f5));\n\t--_radius: var(--cm-radius, 1.75rem);\n\t--_size: var(--cm-size, 2.5rem);\n\t--_pad: var(--cm-padding, .375rem);\n\tposition: relative;\n\tisolation: isolate;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\talign-items: flex-end;\n\tgap: .25rem;\n\tmargin: 0;\n\tpadding: var(--_pad);\n\tborder-radius: var(--_radius);\n\tcolor: var(--_fg);\n\tfont-family: var(--cm-font, inherit);\n\tfont-size: var(--cm-font-size, 1rem);\n\tline-height: 1.5;\n}\n\n.cm-bar::before,\n.cm-bar::after {\n\tcontent: '';\n\tposition: absolute;\n\tinset: 0;\n\tz-index: -1;\n\tborder-radius: inherit;\n\tpointer-events: none;\n}\n\n/* Glow, shown on focus and animated while loading. */\n.cm-bar::before {\n\tinset: -2px;\n\tbackground: var(--_tint);\n\tbackground-size: 300% 100%;\n\tfilter: blur(10px);\n\topacity: 0;\n\ttransition: opacity .3s;\n}\n\n/* Surface with a tint border. */\n.cm-bar::after {\n\tborder: var(--cm-border-width, 1px) solid transparent;\n\tbackground: linear-gradient(var(--_bg) 0 0) padding-box, var(--_tint) border-box;\n\tbox-shadow: var(--cm-shadow, 0 15px 20px rgb(0 0 0 / .1));\n}\n\n.cm-bar:has(.cm-bar-input:disabled) {\n\topacity: .5;\n}\n\n.cm-bar:focus-within::before {\n\topacity: var(--cm-glow, .55);\n}\n\n.cm-bar[aria-busy='true']::before {\n\topacity: 1;\n\tanimation: cm-bar-flow 3s ease-in-out infinite;\n}\n\n/* The mark is the one fixed part of the bar: color and size are themable, hiding it is not. */\n.cm-bar-mark {\n\tflex: none;\n\tdisplay: block !important;\n\tvisibility: visible !important;\n\topacity: 1 !important;\n\twidth: calc(var(--_size) * .8);\n\theight: calc(var(--_size) * .8);\n\tmin-width: 1.25rem !important;\n\tmin-height: 1.25rem !important;\n\tmargin: calc(var(--_size) * .1) calc(var(--_size) * .05) calc(var(--_size) * .1) calc(var(--_size) * .15);\n\tcolor: var(--cm-mark-color, currentColor);\n}\n\n.cm-bar[aria-busy='true'] .cm-bar-mark {\n\tanimation: cm-bar-twinkle 1.5s ease-in-out infinite;\n}\n\n.cm-bar-input {\n\tflex: 1;\n\tmin-width: 0;\n\tmin-height: var(--_size);\n\tmax-height: 12rem;\n\tbox-sizing: border-box;\n\tmargin: 0;\n\tpadding: max(0px, calc((var(--_size) - 1lh) / 2)) .25rem;\n\tborder: 0;\n\toutline: 0;\n\tbackground: none;\n\tcolor: inherit;\n\tfont: inherit;\n\tresize: none;\n\tfield-sizing: content;\n}\n\n.cm-bar-input::placeholder {\n\tcolor: inherit;\n\topacity: .5;\n}\n\n.cm-bar-send {\n\tflex: none;\n\tbox-sizing: border-box;\n\tdisplay: grid;\n\tplace-items: center;\n\twidth: var(--_size);\n\theight: var(--_size);\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 1px solid transparent;\n\tborder-radius: max(0px, calc(var(--_radius) - var(--_pad)));\n\tbackground: linear-gradient(var(--_bg) 0 0) padding-box, var(--_tint) border-box;\n\tcolor: inherit;\n\tcursor: pointer;\n\ttransition: background .2s, color .2s, opacity .2s, transform .1s;\n}\n\n.cm-bar-send:enabled {\n\tbackground: linear-gradient(var(--cm-button-bg, var(--_fg)) 0 0) padding-box, var(--_tint) border-box;\n\tcolor: var(--cm-button-fg, var(--_bg));\n}\n\n.cm-bar-send:enabled:active {\n\ttransform: scale(.94);\n}\n\n.cm-bar-send:disabled {\n\tcursor: default;\n\topacity: .5;\n}\n\n.cm-bar-send:focus-visible {\n\toutline: 2px solid var(--_fg);\n\toutline-offset: 2px;\n}\n\n.cm-bar-send svg {\n\twidth: 45%;\n\theight: 45%;\n}\n\n@keyframes cm-bar-flow {\n\t50% {\n\t\tbackground-position: 100% 0;\n\t\topacity: .5;\n\t}\n}\n\n/* Transform only: the mark's opacity is pinned to 1. */\n@keyframes cm-bar-twinkle {\n\t50% {\n\t\ttransform: scale(.85) rotate(-10deg);\n\t}\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.cm-bar::before,\n\t.cm-bar * {\n\t\tanimation: none !important;\n\t\ttransition: none !important;\n\t}\n}\n";export{D as CallimacusBar,R as CallimacusMark,d as thamyrApi,k as useApi,m as useCallimacusStore,L as useCart,w as useConnection,b as useInitThamyr,_ as useOnConnectionChange,z as useOnError,x as useOnResponse,T as useSitemap,E as useSkesis,q as useSuggestions,f as useThamyr,M as useTtsAudio,A as useVoiceRecorder};
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/callimacus/hooks.ts","../../../src/voice/use-voice-recorder.ts","../../../src/audio/use-tts-audio.ts"],"sourcesContent":[null,null,null],"names":["useEventListener","addListener","callback","callbackRef","useRef","current","useEffect","arg","useInitThamyr","config","init","useCallimacusStore","s","reset","markInitRequested","markInitOwnerMounted","markInitOwnerUnmounted","clientId","endpoint","useThamyr","history","messages","sendEvent","sendAudio","rounds","useMemo","openLanding","value","options","UserInteractionType","CREATE_ROUND","landingRound","sendInteraction","id","interactionRound","refresh","block","interaction","NO_SUGGESTIONS","suggestions","loading","useSuggestions","prefix","storyId","language","debounceMs","isConnected","connectionStatus","state","setState","useState","wasConnected","setWasConnected","isStale","timer","setTimeout","getState","_thamyr","suggest","Promise","resolve","then","catch","clearTimeout","useConnection","status","useOnResponse","addResponseListener","useOnConnectionChange","addConnectionListener","useOnError","addErrorListener","useCart","async","waitForInstance","cart","getCart","productId","addItemToCart","removeItemFromCart","quantity","updateProductQuantity","useApi","thamyrApi","useSkesis","anchorId","skesis","similar","related","useSitemap","sitemap","getSitemap","defaultOptions","useVoiceRecorder","silenceThreshold","silenceDuration","maxDuration","onRecordingComplete","audioLevels","setAudioLevels","error","setError","undefined","mediaRecorderRef","audioContextRef","analyserRef","streamRef","animationFrameRef","silenceStartRef","maxDurationTimerRef","chunksRef","stoppingRef","cleanup","useCallback","cancelAnimationFrame","track","getTracks","stop","close","stopRecording","startRecording","stream","navigator","mediaDevices","getUserMedia","audio","echoCancellation","noiseSuppression","sampleRate","audioContext","AudioContext","source","createMediaStreamSource","analyser","createAnalyser","fftSize","smoothingTimeConstant","connect","mimeType","MediaRecorder","isTypeSupported","mediaRecorder","addEventListener","event","data","size","push","audioBlob","Blob","type","start","monitorAudio","bufferLength","frequencyBinCount","dataArray","Uint8Array","getByteFrequencyData","step","Math","floor","levels","i","sum","j","sumSquares","normalized","rms","sqrt","log10","Date","now","requestAnimationFrame","useTtsAudio","audioRef","audioUrl","Audio","element","preload","onPlaying","onWaiting","onPause","previous","onEnded","onError","pause","removeEventListener","src","play","currentTime","toggle","paused","isPlaying"],"mappings":";;;;;;;szBAsCA,SAASA,EACRC,EACAC,GAEA,MAAMC,EAAcC,EAAOF,GAE3BC,EAAYE,QAAUH,EAEtBI,EAAU,IACWL,EAAYM,IAC/BJ,EAAYE,QAAQE,KAGnB,CAACN,GACL,CAyBM,SAAUO,EAAcC,GAC7B,MAAMC,EAAOC,EAAmBC,GAAKA,EAAEF,MACjCG,EAAQF,EAAmBC,GAAKA,EAAEC,OAIxCC,IAEAR,EAAU,KACTS,IACAL,EAAKD,GAEE,KACNI,IAIAG,MAGC,CAACN,EAAMG,EAAOJ,EAAOQ,SAAUR,EAAOS,UAC1C,UAiCgBC,IACf,MAAMC,EAAUT,EAAmBC,GAAKA,EAAES,UACpCC,EAAYX,EAAmBC,GAAKA,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oB,QAASL,GACrCJ,EAAQS,oBAAoB,QAASH,GACrCN,EAAQS,oBAAoB,QAASF,GACrCP,EAAQU,IAAM,GACdb,EAASxK,aAAUiG,IAElB,CAACuB,GAAOiD,WAEX,MAAMa,EAAO1E,EAAYxC,UACxB,MAAMuG,EAAUH,EAASxK,QACzB,GAAK2K,EAIL,IACC3E,OAASC,GACTrD,EAAS,iBACH+H,EAAQW,MACf,CAAE,MACDtF,EAAS,yBACTpD,EAAS,QACV,GACE,IAEGuI,EAAQvE,EAAY,KACzB4D,EAASxK,SAASmL,SAChB,IAEGnE,EAAOJ,EAAY,KACxB,MAAM+D,EAAUH,EAASxK,QACpB2K,IAILA,EAAQQ,QACRR,EAAQY,YAAc,EACtB3I,EAAS,UACP,IAEG4I,EAAS5E,EAAY,KAC1B,MAAM+D,EAAUH,EAASxK,QACpB2K,IAIDA,EAAQc,OACNH,IAELX,EAAQQ,UAEP,CAACG,IAEJ,MAAO,CACN3I,QACA+I,UAAqB,YAAV/I,GAAiC,YAAVA,EAClCoD,QACAuF,OACAH,QACAK,SACAxE,OAEF"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/callimacus/hooks.ts","../../../src/voice/use-voice-recorder.ts","../../../src/audio/use-tts-audio.ts","../../../src/callimacus-bar/callimacus-mark.tsx","../../../src/callimacus-bar/callimacus-bar.tsx"],"sourcesContent":[null,null,null,null,null],"names":["useEventListener","addListener","callback","callbackRef","useRef","current","useEffect","arg","useInitThamyr","config","init","useCallimacusStore","s","reset","markInitRequested","markInitOwnerMounted","markInitOwnerUnmounted","clientId","endpoint","useThamyr","history","messages","sendEvent","sendAudio","rounds","useMemo","openLanding","value","options","UserInteractionType","CREATE_ROUND","landingRound","sendInteraction","id","interactionRound","refresh","block","interaction","NO_SUGGESTIONS","suggestions","loading","useSuggestions","prefix","storyId","language","debounceMs","isConnected","connectionStatus","state","setState","useState","wasConnected","setWasConnected","isStale","timer","setTimeout","getState","_thamyr","suggest","Promise","resolve","then","catch","clearTimeout","useConnection","status","useOnResponse","addResponseListener","useOnConnectionChange","addConnectionListener","useOnError","addErrorListener","useCart","async","waitForInstance","cart","getCart","productId","addItemToCart","removeItemFromCart","quantity","updateProductQuantity","useApi","thamyrApi","useSkesis","anchorId","skesis","similar","related","useSitemap","sitemap","getSitemap","defaultOptions","useVoiceRecorder","silenceThreshold","silenceDuration","maxDuration","onRecordingComplete","audioLevels","setAudioLevels","error","setError","undefined","mediaRecorderRef","audioContextRef","analyserRef","streamRef","animationFrameRef","silenceStartRef","maxDurationTimerRef","chunksRef","stoppingRef","cleanup","useCallback","cancelAnimationFrame","track","getTracks","stop","close","stopRecording","startRecording","stream","navigator","mediaDevices","getUserMedia","audio","echoCancellation","noiseSuppression","sampleRate","audioContext","AudioContext","source","createMediaStreamSource","analyser","createAnalyser","fftSize","smoothingTimeConstant","connect","mimeType","MediaRecorder","isTypeSupported","mediaRecorder","addEventListener","event","data","size","push","audioBlob","Blob","type","start","monitorAudio","bufferLength","frequencyBinCount","dataArray","Uint8Array","getByteFrequencyData","step","Math","floor","levels","i","sum","j","sumSquares","normalized","rms","sqrt","log10","Date","now","requestAnimationFrame","useTtsAudio","audioRef","audioUrl","Audio","element","preload","onPlaying","onWaiting","onPause","previous","onEnded","onError","pause","removeEventListener","src","play","currentTime","toggle","paused","isPlaying","CallimacusMark","props","_jsx","viewBox","fill","role","children","d","CallimacusBar","onSubmit","controlledValue","onValueChange","placeholder","sendLabel","sendIcon","actions","tint","font","disabled","autoFocus","className","style","ownValue","setOwnValue","setValue","next","prompt","trim","canSubmit","_jsxs","trimEnd","preventDefault","css","rows","enterKeyHint","onChange","target","onKeyDown","key","shiftKey","nativeEvent","isComposing","currentTarget","form","requestSubmit","stroke","strokeWidth","strokeLinecap","strokeLinejoin"],"mappings":";;;;;;;w2BAsCA,SAASA,EACRC,EACAC,GAEA,MAAMC,EAAcC,EAAOF,GAE3BC,EAAYE,QAAUH,EAEtBI,EAAU,IACWL,EAAYM,IAC/BJ,EAA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 +10,8 @@ import { UiObserverConfig, RoundOptions, CallimacusApi, ErrorMessage, ThamyrResp
|
|
|
10
10
|
export { ADD_TO_CART_RESULT_BLOCK, AddToCartResult, Block, BlockPatch, BoundingBox, CallimacusEvent, Chapter, ChapterStatus, ClientEvents, ClientInfo, ConnectionStatusCallback, ErrorCallback, ErrorMessage, Gallery, GalleryMode, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LANDING_VALUE_MAX_LENGTH, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, ProductMatch, RiveManifest, RoundOptions, SLDocument, SLDocumentSection, SLInputEvent, SLInputEventType, ServerEvents, ServerResponseCallback, Story, SuggestPayload, Suggestions, ThamyrHttpError, ThamyrInteractionMap, ThamyrResponse, ThamyrResponseType, Topic, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, UserInteractionType, Video, WhisperPayload, addToCartResultOf, applyBlockPatch, blockKeyOf, callimacusService, clearIntentSessionId, ensureIntentSessionId, extractTtsAudio, getIntentSessionId, initIntent, interactionRound, isSetProduct, landingRound, logger, receptorsOf, setConsent, setDebug, setDebugPanel, setGeo, setIntentSessionMaxAge, transformImageUrl } from '@callimacus/thamyr-core';
|
|
11
11
|
import { Thamyr } from '@callimacus/thamyr';
|
|
12
12
|
import * as zustand from 'zustand';
|
|
13
|
+
import * as react from 'react';
|
|
14
|
+
import { ReactNode, CSSProperties, SVGProps } from 'react';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
Represents the current state of the Thamyr SDK connection.
|
|
@@ -2183,5 +2185,56 @@ stream URL.
|
|
|
2183
2185
|
*/
|
|
2184
2186
|
declare function useTtsAudio(audio: TtsAudio | undefined): UseTtsAudioReturn;
|
|
2185
2187
|
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
+
type CallimacusBarProps = {
|
|
2189
|
+
/**
|
|
2190
|
+
Called with the trimmed prompt; the bar then clears itself.
|
|
2191
|
+
*/
|
|
2192
|
+
readonly onSubmit: (prompt: string) => void;
|
|
2193
|
+
/**
|
|
2194
|
+
Makes the text controlled. Omit it to let the bar manage the text itself.
|
|
2195
|
+
*/
|
|
2196
|
+
readonly value?: string;
|
|
2197
|
+
readonly onValueChange?: (value: string) => void;
|
|
2198
|
+
readonly placeholder?: string;
|
|
2199
|
+
/**
|
|
2200
|
+
Accessible name of the send button. Defaults to `Send`.
|
|
2201
|
+
*/
|
|
2202
|
+
readonly sendLabel?: string;
|
|
2203
|
+
/**
|
|
2204
|
+
Replaces the arrow inside the send button.
|
|
2205
|
+
*/
|
|
2206
|
+
readonly sendIcon?: ReactNode;
|
|
2207
|
+
/**
|
|
2208
|
+
Extra controls (microphone, attachments…) rendered just before the send button.
|
|
2209
|
+
*/
|
|
2210
|
+
readonly actions?: ReactNode;
|
|
2211
|
+
/**
|
|
2212
|
+
Any CSS color or gradient. Defaults to the Callimacus gradient. Same as the `--cm-tint` variable.
|
|
2213
|
+
*/
|
|
2214
|
+
readonly tint?: string;
|
|
2215
|
+
/**
|
|
2216
|
+
CSS font-family. Defaults to the host page's font. Same as the `--cm-font` variable.
|
|
2217
|
+
*/
|
|
2218
|
+
readonly font?: string;
|
|
2219
|
+
/**
|
|
2220
|
+
Animates the glow and blocks submitting, e.g. while a reply streams. Typing stays allowed.
|
|
2221
|
+
*/
|
|
2222
|
+
readonly loading?: boolean;
|
|
2223
|
+
readonly disabled?: boolean;
|
|
2224
|
+
readonly autoFocus?: boolean;
|
|
2225
|
+
readonly className?: string;
|
|
2226
|
+
readonly style?: CSSProperties;
|
|
2227
|
+
};
|
|
2228
|
+
/**
|
|
2229
|
+
A prompt input that always carries the Callimacus mark. Everything else is customizable through props,
|
|
2230
|
+
`--cm-*` CSS variables and the `cm-bar*` class names; the mark can be recolored and resized but not removed.
|
|
2231
|
+
*/
|
|
2232
|
+
declare function CallimacusBar({ onSubmit, value: controlledValue, onValueChange, placeholder, sendLabel, sendIcon, actions, tint, font, loading, disabled, autoFocus, className, style, }: CallimacusBarProps): react.JSX.Element;
|
|
2233
|
+
|
|
2234
|
+
/**
|
|
2235
|
+
The Callimacus constellation mark. Inherits `currentColor`.
|
|
2236
|
+
*/
|
|
2237
|
+
declare function CallimacusMark(props: SVGProps<SVGSVGElement>): react.JSX.Element;
|
|
2238
|
+
|
|
2239
|
+
export { CallimacusBar, CallimacusMark, thamyrApi, useApi, useCallimacusStore, useCart, useConnection, useInitThamyr, useOnConnectionChange, useOnError, useOnResponse, useSitemap, useSkesis, useSuggestions, useThamyr, useTtsAudio, useVoiceRecorder };
|
|
2240
|
+
export type { CallimacusBarProps, CallimacusInitConfig, CartActions, ConnectionStatus, SitemapActions, SkesisActions, SuggestionsOptions, SuggestionsState, TtsAudioState, UseTtsAudioReturn, UseVoiceRecorderOptions, UseVoiceRecorderReturn, VoiceRecorderState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callimacus/thamyr-react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React package for Thamyr",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -36,29 +36,33 @@
|
|
|
36
36
|
"dev": "rollup -c -w",
|
|
37
37
|
"clean": "rm -rf dist",
|
|
38
38
|
"test": "vitest run",
|
|
39
|
-
"lint": "eslint src"
|
|
39
|
+
"lint": "eslint src",
|
|
40
|
+
"storybook": "storybook dev -p 6006"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@callimacus/thamyr": "^4.
|
|
43
|
-
"@callimacus/thamyr-core": "^4.
|
|
43
|
+
"@callimacus/thamyr": "^4.5.0",
|
|
44
|
+
"@callimacus/thamyr-core": "^4.5.0",
|
|
44
45
|
"zustand": "^5.0.15"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
|
-
"react": "
|
|
48
|
-
"
|
|
48
|
+
"@tanstack/react-query": "^5",
|
|
49
|
+
"react": ">=18"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@eslint-react/eslint-plugin": "^5.
|
|
52
|
+
"@eslint-react/eslint-plugin": "^5.26.0",
|
|
53
|
+
"@storybook/react-vite": "^10.6.1",
|
|
54
|
+
"@tanstack/react-query": "^5.104.1",
|
|
52
55
|
"@testing-library/react": "^16.3.3",
|
|
53
56
|
"@types/react": "^19.3.0",
|
|
54
57
|
"@types/react-dom": "^19.3.0",
|
|
55
|
-
"eslint-config-xo": "^
|
|
58
|
+
"eslint-config-xo": "^5.0.0",
|
|
56
59
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
57
|
-
"jsdom": "^30.1.
|
|
60
|
+
"jsdom": "^30.1.2",
|
|
58
61
|
"react": "^19.3.0",
|
|
59
62
|
"react-dom": "^19.3.0",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
63
|
+
"storybook": "^10.6.1",
|
|
64
|
+
"vite": "^8.3.4",
|
|
65
|
+
"vitest": "^5.0.3"
|
|
62
66
|
},
|
|
63
67
|
"gitHead": "fafba2c8ca0586f95b1d03c5eede356a53b00886",
|
|
64
68
|
"peerDependenciesMeta": {
|