-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path914.vg_bundle.js
1 lines (1 loc) · 6 KB
/
914.vg_bundle.js
1
"use strict";(self.webpackChunkcustom_vf_nextjs=self.webpackChunkcustom_vf_nextjs||[]).push([[914],{5914:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var o=n(2167),r=n(2982),i=n(885),a=n(7294),l=n(7619),c=n(7828),u=n(8676),s=n(9690),g=n(3850),v=n(1873),d=n(3260),f=n(4925),p=a.createElement;function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){(0,o.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const b=function(e){var t,n=(0,f.B)().config,o=(0,u.useRuntime)(),m=o.runtime,b=o.setRuntime,y=o.formattedTurnsValue,x=(o.handlePushMessage,o.hasLoaded),C=a.useState([]),E=(0,i.Z)(C,2),w=E[0],_=E[1],O=a.useState([]),k=(0,i.Z)(O,2),j=k[0],P=k[1],T=a.useState(!1),N=(0,i.Z)(T,2),Z=N[0],S=N[1],D=null===(t=y[y.length-1])||void 0===t||null===(t=t.messages)||void 0===t?void 0:t.filter((function(e){return"text"===e.type||"choice"===e.type&&(e.content||e.item)})).slice(0,2);return a.useEffect((function(){if(j.forEach((function(e){clearTimeout(e)})),y.length&&!0===x){var e;if(D.length!==(null===(e=w.messages)||void 0===e?void 0:e.length))return D.forEach((function(e,t){if("text"===e.type||"choice"===e.type){var n,o,i=0;D.forEach((function(e,n){var o;t>n&&(i+=e.delay||(null===(o=m.variables)||void 0===o?void 0:o.messageDelayMS)||1e3)}));var a=m.showInstantly||"human"===e.from?0:(e.delay||(null===(n=m.variables)||void 0===n?void 0:n.messageDelayMS)||1e3)+i,l=w[w.length-1];if(!(null==l||null===(o=l.messages)||void 0===o?void 0:o.find((function(n,o){return n.from===e.from&&t===o})))){var c=setTimeout((function(){_((function(t){return[].concat((0,r.Z)(t),[e])}))}),a);P((function(e){return[].concat((0,r.Z)(e),[c])}))}}})),function(){j.forEach((function(e){clearTimeout(e)})),_([])};j.forEach((function(e){clearTimeout(e)})),_([])}else j.forEach((function(e){clearTimeout(e)})),_([]);return function(){j.forEach((function(e){clearTimeout(e)})),_([])}}),[y,x]),a.useEffect((function(){2===(null==w?void 0:w.length)?b((function(e){return h(h({},e),{},{showInstantly:!0})})):b((function(e){return h(h({},e),{},{showInstantly:!1})}))}),[w]),!1!==Z||!1!==m.blockProactive||0===(null==w?void 0:w.length)||e.chatOpen?"":p(a.Fragment,null,p(l.E.button,{onClick:function(){return e.setChatOpen(!0)},key:"dynamic_proactive_container",className:" vg-fixed vg-w-unit-72 vg-rounded-large vg-flex vg-flex-col vg-gap-unit-2 vg-proactive",initial:{opacity:0,bottom:80,right:"popup"===n.render||"bottom-right"===n.render?15:"unset",left:"bottom-left"===n.render?15:"unset",height:"auto"},animate:{opacity:1,bottom:130,right:"popup"===n.render||"bottom-right"===n.render?38:"unset",left:"bottom-left"===n.render?38:"unset",height:"auto"},exit:{opacity:0,bottom:80,right:"popup"===n.render||"bottom-right"===n.render?30:"unset",left:"bottom-left"===n.render?30:"unset",height:"auto"},layout:!0},p(g.Z,{onPress:function(){S(!0),b((function(e){return h(h({},e),{},{blockProactive:!0})}))},className:" vg-place-self-end vg-bg-background/50 vg-text-foreground vg-hover:bg-background/75 vg-proactive-btn--close",variant:"light",size:"sm",isIconOnly:!0,color:"default"},p(v.u5Z,{className:" vg-w-unit-3 vg-h-unit-3 vg-proactive-close--icon"})),p(c.M,null,0!==(null==w?void 0:w.length)&&w.map((function(t,n){return p(l.E.div,{transition:{duration:.5},layout:!0,className:" vg-text-[14px] vg-flex vg-flex-col vg-float-right vg-w-full vg-proactive-message",key:"chat_proactive_messaage_".concat(n)},"text"===t.type&&p(d.Z,{isShort:!0,className:" vg-text-left vg-bg-content2 vg-rounded-tl-[25px] vg-rounded-bl-[25px] vg-rounded-tr-[25px] vg-rounded-br-[5px] vg-place-self-end vg-p-unit-5 vg-w-full vg-proactive-message--text",key:"text_view__proactive_0_".concat(n),message:t}),("buttons"===t.type||"choice"===t.type)&&p(s.Z,{isCarousel:!0,messageTurnIndex:999,size:"sm",item:t.item||t.content,index:n,setChatOpen:e.setChatOpen,className:" vg-tw-ltr vg-proactive-message--btn",containerClassname:" vg-proactive-message-btn-container"}))})))),w.length!==(null==D?void 0:D.length)&&0!==(null==D?void 0:D.length)&&p(l.E.div,{key:"little_proactive_loading",className:" vg-fixed vg-w-unit-8 vg-h-auto vg-z-[10000] vg-bg-content2 vg-flex vg-justify-center vg-rounded-large vg-overflow-hidden vg-proactive-loading-container",initial:{opacity:0,bottom:25,right:"popup"===n.render||"bottom-right"===n.render?30:"unset",left:"bottom-left"===n.render?30:"unset"},animate:{opacity:1,bottom:45,right:"popup"===n.render||"bottom-right"===n.render?30:"unset",left:"bottom-left"===n.render?30:"unset"},exit:{opacity:0,bottom:25,right:"popup"===n.render||"bottom-right"===n.render?30:"unset",left:"bottom-left"===n.render?30:"unset"}},p(c.M,null,p(l.E.div,{initial:{scale:1},animate:{scale:1.1},exit:{scale:1},transition:{repeat:1/0,repeatType:"mirror",duration:1},key:"dots_container",className:" vg-h-unit-4 vg-flex vg-gap-[3px] vg-items-center vg-border-none vg-justify-center vg-rounded-lg vg-w-full ".concat(" vg-bg-transparent "," vg- vg-proactive-loading ")},p(l.E.div,{key:"1_dots_circle",animate:{y:[-1,0,1,0,-1],backgroundColor:["#C8C8C8","#E3E3E3","#C8C8C8"]},transition:{repeat:1/0,repeatType:"reverse",duration:.8},className:" vg-w-unit-1 vg-h-unit-1 vg-rounded-full vg-proactive-loading--dot"}),p(l.E.div,{key:"2_dots_circle",animate:{y:[1,0,-1,0,1],backgroundColor:["#C8C8C8","#E3E3E3","#C8C8C8"]},transition:{repeat:1/0,repeatType:"mirror",delay:.2,duration:.8},className:" vg-w-unit-1 vg-h-unit-1 vg-rounded-full vg-proactive-loading--dot"}),p(l.E.div,{key:"3_dots_circle",animate:{y:[-1,0,1,0,-1],backgroundColor:["#C8C8C8","#E3E3E3","#C8C8C8"]},transition:{repeat:1/0,repeatType:"mirror",delay:.4,duration:.8},className:" vg-w-unit-1 vg-h-unit-1 vg-rounded-full vg-proactive-loading--dot"})))))}}}]);