@desivocal/agents-cdn 0.0.8 → 0.0.9
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/dv-agent.es.js +2 -2
- package/dist/dv-agent.umd.js +1 -1
- package/package.json +1 -1
package/dist/dv-agent.es.js
CHANGED
|
@@ -27579,8 +27579,8 @@ const kz = ({ id: u, playerRef: s, preload: d = !1, wavesurferStyles: v }) => {
|
|
|
27579
27579
|
agentName: "Customer Support",
|
|
27580
27580
|
ctaBeforeCallStart: "Call Support"
|
|
27581
27581
|
}, Dz = ({ agentId: u }) => {
|
|
27582
|
-
const s = $.useRef(null), [d, v] = $.useState(!1), { isRecording: g, recordedUrl: C, startRecording: w, stopRecording: m } = Sz(), { isPlaying: D, isReady: T, load: k, playPause: A } = kz({ id: C, preload: !
|
|
27583
|
-
await P(), A();
|
|
27582
|
+
const s = $.useRef(null), [d, v] = $.useState(!1), { isRecording: g, recordedUrl: C, startRecording: w, stopRecording: m } = Sz(), { isPlaying: D, isReady: T, load: k, playPause: A } = kz({ id: C, preload: !0, playerRef: s }), O = async () => {
|
|
27583
|
+
T || await P(), A();
|
|
27584
27584
|
}, P = async () => {
|
|
27585
27585
|
v(!0), await k(C), v(!1);
|
|
27586
27586
|
}, j = async () => g ? m() : w();
|
package/dist/dv-agent.umd.js
CHANGED
|
@@ -403,4 +403,4 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
403
403
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
404
404
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
405
405
|
PERFORMANCE OF THIS SOFTWARE.
|
|
406
|
-
***************************************************************************** */function JE(u,s){const[d,v]=$.useState(null),g=$.useMemo(()=>Object.entries(s).flat(),[s]);return $.useEffect(()=>{if(!u.current)return;const C=Pg.create(Object.assign(Object.assign({},s),{container:u.current}));return v(C),()=>{C.destroy()}},[u,...g]),d}const ew=/^on([A-Z])/,zD=u=>ew.test(u);function PD(u,s){const d=$.useMemo(()=>Object.entries(s).flat(),[s]);$.useEffect(()=>{if(!u)return;const v=Object.entries(s);if(!v.length)return;const g=v.map(([C,w])=>{const m=C.replace(ew,(D,T)=>T.toLowerCase());return u.on(m,(...D)=>w(u,...D))});return()=>{g.forEach(C=>C())}},[u,...d])}$.memo(u=>{const s=$.useRef(null),[d,v]=function(g){return $.useMemo(()=>{const C=Object.assign({},g),w=Object.assign({},g);for(const m in C)zD(m)?delete C[m]:delete w[m];return[C,w]},[g])}(u);return PD(JE(s,d),v),Ie.jsx("div",{ref:s})});function UD(u){var{container:s}=u;const d=JE(s,function(g,C){var w={};for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&C.indexOf(m)<0&&(w[m]=g[m]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function"){var D=0;for(m=Object.getOwnPropertySymbols(g);D<m.length;D++)C.indexOf(m[D])<0&&Object.prototype.propertyIsEnumerable.call(g,m[D])&&(w[m[D]]=g[m[D]])}return w}(u,["container"])),v=function(g){const[C,w]=$.useState(!1),[m,D]=$.useState(!1),[T,k]=$.useState(0);return $.useEffect(()=>{if(!g)return;const A=[g.on("load",()=>{w(!1),D(!1),k(0)}),g.on("ready",()=>{w(!0),D(!1),k(0)}),g.on("play",()=>{D(!0)}),g.on("pause",()=>{D(!1)}),g.on("timeupdate",()=>{k(g.getCurrentTime())}),g.on("destroy",()=>{w(!1),D(!1)})];return()=>{A.forEach(O=>O())}},[g]),$.useMemo(()=>({isReady:C,isPlaying:m,currentTime:T}),[m,T,C])}(d);return $.useMemo(()=>Object.assign(Object.assign({},v),{wavesurfer:d}),[v,d])}const jD=({id:u,playerRef:s,preload:d=!1,wavesurferStyles:v})=>{const{wavesurfer:g,isReady:C,currentTime:w,isPlaying:m}=UD({container:s,...d&&{url:u},...v||{height:24,barGap:1.75,barRadius:2,barWidth:1.75,waveColor:"#A6A6A6",progressColor:"#2D2D2D"}}),D=async I=>{await(g==null?void 0:g.load(I))},T=()=>{g==null||g.playPause()},k=()=>g==null?void 0:g.play(),A=()=>{g==null||g.stop()},O=I=>{g==null||g.seekTo(I)},P=I=>g==null?void 0:g.setVolume(I),j=I=>{if(!I)return"00:00";const ee=Math.floor(I%60).toString();return`${Math.floor(I/60).toString().padStart(2,"0")}:${ee.padStart(2,"0")}`},z=g==null?void 0:g.getDuration();return{isReady:C,currentTime:w,isPlaying:m,format:j,load:D,playPause:T,stop:A,seek:O,play:k,setVolume:P,duration:z}},Ug={agentId:"",ctaOngoingCall:"End Call",agentName:"Customer Support",ctaBeforeCallStart:"Call Support"},FD=({agentId:u})=>{const s=$.useRef(null),[d,v]=$.useState(!1),{isRecording:g,recordedUrl:C,startRecording:w,stopRecording:m}=DD(),{isPlaying:D,isReady:T,load:k,playPause:A}=jD({id:C,preload:!
|
|
406
|
+
***************************************************************************** */function JE(u,s){const[d,v]=$.useState(null),g=$.useMemo(()=>Object.entries(s).flat(),[s]);return $.useEffect(()=>{if(!u.current)return;const C=Pg.create(Object.assign(Object.assign({},s),{container:u.current}));return v(C),()=>{C.destroy()}},[u,...g]),d}const ew=/^on([A-Z])/,zD=u=>ew.test(u);function PD(u,s){const d=$.useMemo(()=>Object.entries(s).flat(),[s]);$.useEffect(()=>{if(!u)return;const v=Object.entries(s);if(!v.length)return;const g=v.map(([C,w])=>{const m=C.replace(ew,(D,T)=>T.toLowerCase());return u.on(m,(...D)=>w(u,...D))});return()=>{g.forEach(C=>C())}},[u,...d])}$.memo(u=>{const s=$.useRef(null),[d,v]=function(g){return $.useMemo(()=>{const C=Object.assign({},g),w=Object.assign({},g);for(const m in C)zD(m)?delete C[m]:delete w[m];return[C,w]},[g])}(u);return PD(JE(s,d),v),Ie.jsx("div",{ref:s})});function UD(u){var{container:s}=u;const d=JE(s,function(g,C){var w={};for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&C.indexOf(m)<0&&(w[m]=g[m]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function"){var D=0;for(m=Object.getOwnPropertySymbols(g);D<m.length;D++)C.indexOf(m[D])<0&&Object.prototype.propertyIsEnumerable.call(g,m[D])&&(w[m[D]]=g[m[D]])}return w}(u,["container"])),v=function(g){const[C,w]=$.useState(!1),[m,D]=$.useState(!1),[T,k]=$.useState(0);return $.useEffect(()=>{if(!g)return;const A=[g.on("load",()=>{w(!1),D(!1),k(0)}),g.on("ready",()=>{w(!0),D(!1),k(0)}),g.on("play",()=>{D(!0)}),g.on("pause",()=>{D(!1)}),g.on("timeupdate",()=>{k(g.getCurrentTime())}),g.on("destroy",()=>{w(!1),D(!1)})];return()=>{A.forEach(O=>O())}},[g]),$.useMemo(()=>({isReady:C,isPlaying:m,currentTime:T}),[m,T,C])}(d);return $.useMemo(()=>Object.assign(Object.assign({},v),{wavesurfer:d}),[v,d])}const jD=({id:u,playerRef:s,preload:d=!1,wavesurferStyles:v})=>{const{wavesurfer:g,isReady:C,currentTime:w,isPlaying:m}=UD({container:s,...d&&{url:u},...v||{height:24,barGap:1.75,barRadius:2,barWidth:1.75,waveColor:"#A6A6A6",progressColor:"#2D2D2D"}}),D=async I=>{await(g==null?void 0:g.load(I))},T=()=>{g==null||g.playPause()},k=()=>g==null?void 0:g.play(),A=()=>{g==null||g.stop()},O=I=>{g==null||g.seekTo(I)},P=I=>g==null?void 0:g.setVolume(I),j=I=>{if(!I)return"00:00";const ee=Math.floor(I%60).toString();return`${Math.floor(I/60).toString().padStart(2,"0")}:${ee.padStart(2,"0")}`},z=g==null?void 0:g.getDuration();return{isReady:C,currentTime:w,isPlaying:m,format:j,load:D,playPause:T,stop:A,seek:O,play:k,setVolume:P,duration:z}},Ug={agentId:"",ctaOngoingCall:"End Call",agentName:"Customer Support",ctaBeforeCallStart:"Call Support"},FD=({agentId:u})=>{const s=$.useRef(null),[d,v]=$.useState(!1),{isRecording:g,recordedUrl:C,startRecording:w,stopRecording:m}=DD(),{isPlaying:D,isReady:T,load:k,playPause:A}=jD({id:C,preload:!0,playerRef:s}),O=async()=>{T||await P(),A()},P=async()=>{v(!0),await k(C),v(!1)},j=async()=>g?m():w();return Ie.jsx(Ie.Fragment,{children:Ie.jsxs(_D,{children:[Ie.jsx(kD,{className:"fixed bottom-2.5 right-2.5",children:Ie.jsx(Zv,{size:"icon",className:"rounded-full h-12 w-12",children:Ie.jsx(tT,{})})}),Ie.jsxs(QE,{className:"fixed bottom-12 right-4 w-64 rounded-xl",children:[Ie.jsx("h1",{className:"text-lg font-medium",children:Ug.agentName}),Ie.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:u}),Ie.jsx("div",{className:sg("w-full mt-2",T?"visible":"invisible"),ref:s}),Ie.jsxs("div",{className:"flex flex-row justify-between items-center w-full mt-4",children:[Ie.jsx(Zv,{onClick:j,children:g?Ug.ctaOngoingCall:Ug.ctaBeforeCallStart}),C&&Ie.jsxs(Zv,{size:"icon",className:"w-9 h-9",onClick:O,children:[d?null:D?Ie.jsx(eT,{size:20,fill:"#7D7D7D"}):Ie.jsx(nT,{size:20,fill:"#7D7D7D"}),!D&&!T&&d&&Ie.jsx(J1,{size:20,className:"animate-spin"})]})]})]})]})})};(function(u,s){function d(v){const g=s.createElement("div");g.id="desivocal-container",s.body.appendChild(g),kd.createRoot(g).render(Ie.jsx(db.StrictMode,{children:Ie.jsx(FD,{agentId:v.agentId})}))}u.loadAgent=d})(window,document)});
|