react-covideo-embed 1.0.88 → 1.0.90

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/README.md CHANGED
@@ -62,6 +62,7 @@ Explore the capabilities of react-covideo-embed through our [Demo Project](https
62
62
  - `image`: `string` - The URL of the thumbnail of the inserted video.
63
63
  - `html`: `string` - The HTML representation of the inserted video.
64
64
  - `token`: `string` - The auth token used to fetch the shareData.
65
+ - `videoId`: `string` - The ID of the inserted video
65
66
 
66
67
  ### `onVideoInsertError` (optional)
67
68
 
@@ -90,7 +91,6 @@ Explore the capabilities of react-covideo-embed through our [Demo Project](https
90
91
 
91
92
  - **Type**: `Array<Feature>`
92
93
  - **Description**: Determines which Covideo features to hide. Acceptable values are as follows:
93
-
94
94
  - `insert`
95
95
  - `recordScreen`
96
96
  - `recordBoth`
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@import"https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700;1,800&display=swap";@import"https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700;1,800&display=swap";#covideo-embeddable-recorder{background:#f6f7f9;color:#272a32;font-style:normal;font-weight:400;font-size:15px;line-height:24px;box-sizing:border-box;text-align:left;max-width:100%}#covideo-embeddable-recorder *,#covideo-embeddable-recorder *:before,#covideo-embeddable-recorder *:after{box-sizing:border-box}#covideo-embeddable-recorder input,#covideo-embeddable-recorder button,#covideo-embeddable-recorder textarea,#covideo-embeddable-recorder select{font-family:inherit}#covideo-embeddable-recorder .ai-assist>button{width:32px;height:32px}#covideo-embeddable-recorder .ai-assist>button:hover{opacity:1!important}.ReactModal__Body--open .ai-assist img{width:100%;max-width:400px}.ReactModal__Body--open .ai-assist svg{box-sizing:content-box!important}@media(max-width:768px){.ReactModal__Body--open .ai-assist img{width:100%;height:auto}}@media(max-width:1240px){.ReactModal__Content{padding:0 15px!important;height:100%;display:block;inset:auto!important;position:initial!important;transform:none!important;margin-right:0!important;min-width:auto!important;width:auto!important}}.ai-assist *{font-family:Work Sans,sans-serif}.ai-assist img{width:100%;max-width:400px}@media(max-width:1240px){.ReactModal__Content{padding:0 15px!important;height:100%;display:block;inset:auto;position:initial!important;transform:none!important;margin-right:0!important;min-width:auto!important;width:auto!important}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),Ue=require("react-query"),zr=require("axios"),y=require("react"),U9=require("react-resize-detector"),x0=require("dayjs"),q9=require("dayjs/plugin/utc"),W9=require("dayjs/plugin/timezone"),We=require("react-router-dom"),H9=require("file-saver"),c=require("styled-components"),G9=require("jwt-decode"),he=require("react-icons/md"),X=require("react-covideo-common"),ue=require("react-i18next"),Br=require("lodash"),S1=require("react-icons/ai"),F0=require("i18next");require("react-toastify/dist/ReactToastify.css");const h5=require("react-toastify"),Cd=require("lottie-react"),ot=require("react-icons/io"),Sn=require("react-icons/io5"),C1=require("react-select/creatable"),Bt=require("react-select"),Y9=require("react-slider"),Q9=require("react-modal"),U0=require("react-router"),y5=require("react-icons/bs"),f5=require("color-convert"),g5=require("react-full-screen"),Z9=require("react-icons/bi"),Tt=require("formik"),K9=require("yup"),di=require("react-compound-slider"),Ca=require("react-beautiful-dnd"),ka=require("react-spinners"),ja=require("rc-progress/lib"),kd=require("recordrtc"),_n=require("react-icons/fa"),X9=require("rc-progress"),J9=require("react-scroll"),jd=require("@mediapipe/tasks-vision"),e8=require("react-dropzone"),t8=require("react-infinite-scroll-component"),o8=require("js-cookie"),Ed=require("droplr-api");function m5(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return i.default=e,Object.freeze(i)}const q=m5(y),Dt=m5(K9),v5="React-Covideo-Embed-Version",i1={default:"https://api-sandbox.covideo.com/",development:"https://localhost:3000/api/",sandbox:"https://api-sandbox.covideo.com/",staging:"https://api-staging.covideo.com/",production:"https://api.covideo.com/"};var Qt=(e=>(e.jwt="react-covideo-embed-jwt",e.merge="react-covideo-merge",e.recordSettings="record_settings",e.recordError="react-covideo-record-error",e))(Qt||{});let i0=localStorage.getItem("react-covideo-embed-jwt"),nr=i1.default,ho;const In=(e,i=!1)=>{i||localStorage.setItem("react-covideo-embed-jwt",e),i0=e,Ae.defaults.headers.Authorization=`Bearer ${i0}`,k1.headers.Authorization=`Bearer ${i0}`},r8=e=>{nr=i1[e]||i1.default,Ae.defaults.baseURL=nr},i8=e=>{ho=e,Ae.defaults.headers.ApiKey=ho,k1.headers.ApiKey=ho};let k1={headers:{Authorization:`Bearer ${i0}`,...ho!==void 0?{ApiKey:ho}:{},[v5]:"1.0.88"}};const Ae=zr.create({baseURL:nr,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i0}`,...ho!==void 0?{ApiKey:ho}:{},[v5]:"1.0.88"}});x0.extend(q9);x0.extend(W9);const b5=e=>e&&(Object.keys(e).forEach(i=>{if(typeof e[i]=="object")return b5(e[i]);typeof e[i]!="boolean"&&(e[i]=""+e[i])}),e),Td=(e,i=30)=>{const n=Math.floor(e/3600),a=Math.floor((e-n*3600)/60);let l=e-n*3600-a*60;const d=parseInt((l%1).toFixed(3).substring(2));let u=parseInt(Math.floor(d/(1e3/i)).toFixed(0));if(l=parseInt(Math.floor(l).toFixed(0)),isNaN(a))return"00:00:00:00";let h="";return n<10&&(h="0"),h+=n+":",a<10&&(h+="0"),h+=a+":",l<10&&(h+="0"),h+=l+":",u<10&&(h+="0"),h+u},sr=(e,i=1)=>{const n=Math.floor(e/3600),a=Math.floor((e-n*3600)/60),l=e-n*3600-a*60;if(isNaN(a))return"00:00.0";let d="";return a<10&&(d+="0"),d+=a+":",l<10&&(d+="0"),d+=l.toFixed(i),d},w5=(e,i)=>e.userId+"_"+e.customerId+"_"+(Math.random()+1).toString(36).substring(2)+"."+i,n8=()=>{const e=x0(new Date).date();let i="th";return e===1||e===21||e===31?i="st":e===2||e===22?i="nd":(e===3||e===23)&&(i="rd"),x0(new Date).format(`MMM D[${i}] YYYY @ h:mm A`)},s8=(e,i,n="YYYY-MM-DD HH:mm:ss")=>{const a=i.timeZone||Intl.DateTimeFormat().resolvedOptions().timeZone||x0.tz.guess(),l=x0(e,["M/DD/YYYY h:mm:ss A","M/DD/YYYY, h:mm:ss A","M/D/YYYY h:mm:ss A","M/D/YYYY, h:mm:ss A","MM/DD/YYYY"]),d=-x0().tz("America/New_York").utcOffset(),u=x0().tz(a).utcOffset(),h=l.add(d,"minute");return x0(h).add(u,"minute").format(n)},a8=(e,i,n)=>{const a=Array.from(e),[l]=a.splice(i,1);return a.splice(n,0,l),a},S5=({trimStart:e,trimEnd:i,videoDuration:n})=>n===0||i===0?!1:e!==0||n-i>.3,lr=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Ea=e=>(e/1e3).toFixed(2);function c8(e){return e.charAt(0).toUpperCase()+e.slice(1)}function C5(){for(let e in Qt)localStorage.removeItem(Qt[e])}const l8=(e,i=1)=>{const n=Math.floor(e/60),a=e-n*60;if(isNaN(n))return"00.0";let l="";return n<10&&(l+="0"),l+=n+":",a<10&&(l+="0"),l+=a.toFixed(i),l};function Ur(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}const k5=y.createContext({}),d8=c.createGlobalStyle`
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),Ue=require("react-query"),zr=require("axios"),y=require("react"),U9=require("react-resize-detector"),x0=require("dayjs"),q9=require("dayjs/plugin/utc"),W9=require("dayjs/plugin/timezone"),We=require("react-router-dom"),H9=require("file-saver"),c=require("styled-components"),G9=require("jwt-decode"),he=require("react-icons/md"),X=require("react-covideo-common"),ue=require("react-i18next"),Br=require("lodash"),S1=require("react-icons/ai"),F0=require("i18next");require("react-toastify/dist/ReactToastify.css");const h5=require("react-toastify"),Cd=require("lottie-react"),ot=require("react-icons/io"),Sn=require("react-icons/io5"),C1=require("react-select/creatable"),Bt=require("react-select"),Y9=require("react-slider"),Q9=require("react-modal"),U0=require("react-router"),y5=require("react-icons/bs"),f5=require("color-convert"),g5=require("react-full-screen"),Z9=require("react-icons/bi"),Tt=require("formik"),K9=require("yup"),di=require("react-compound-slider"),Ca=require("react-beautiful-dnd"),ka=require("react-spinners"),ja=require("rc-progress/lib"),kd=require("recordrtc"),_n=require("react-icons/fa"),X9=require("rc-progress"),J9=require("react-scroll"),jd=require("@mediapipe/tasks-vision"),e8=require("react-dropzone"),t8=require("react-infinite-scroll-component"),o8=require("js-cookie"),Ed=require("droplr-api");function m5(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(i,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return i.default=e,Object.freeze(i)}const q=m5(y),Dt=m5(K9),v5="React-Covideo-Embed-Version",i1={default:"https://api-sandbox.covideo.com/",development:"https://localhost:3000/api/",sandbox:"https://api-sandbox.covideo.com/",staging:"https://api-staging.covideo.com/",production:"https://api.covideo.com/"};var Qt=(e=>(e.jwt="react-covideo-embed-jwt",e.merge="react-covideo-merge",e.recordSettings="record_settings",e.recordError="react-covideo-record-error",e))(Qt||{});let i0=localStorage.getItem("react-covideo-embed-jwt"),nr=i1.default,ho;const In=(e,i=!1)=>{i||localStorage.setItem("react-covideo-embed-jwt",e),i0=e,Ae.defaults.headers.Authorization=`Bearer ${i0}`,k1.headers.Authorization=`Bearer ${i0}`},r8=e=>{nr=i1[e]||i1.default,Ae.defaults.baseURL=nr},i8=e=>{ho=e,Ae.defaults.headers.ApiKey=ho,k1.headers.ApiKey=ho};let k1={headers:{Authorization:`Bearer ${i0}`,...ho!==void 0?{ApiKey:ho}:{},[v5]:"1.0.90"}};const Ae=zr.create({baseURL:nr,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i0}`,...ho!==void 0?{ApiKey:ho}:{},[v5]:"1.0.90"}});x0.extend(q9);x0.extend(W9);const b5=e=>e&&(Object.keys(e).forEach(i=>{if(typeof e[i]=="object")return b5(e[i]);typeof e[i]!="boolean"&&(e[i]=""+e[i])}),e),Td=(e,i=30)=>{const n=Math.floor(e/3600),a=Math.floor((e-n*3600)/60);let l=e-n*3600-a*60;const d=parseInt((l%1).toFixed(3).substring(2));let u=parseInt(Math.floor(d/(1e3/i)).toFixed(0));if(l=parseInt(Math.floor(l).toFixed(0)),isNaN(a))return"00:00:00:00";let h="";return n<10&&(h="0"),h+=n+":",a<10&&(h+="0"),h+=a+":",l<10&&(h+="0"),h+=l+":",u<10&&(h+="0"),h+u},sr=(e,i=1)=>{const n=Math.floor(e/3600),a=Math.floor((e-n*3600)/60),l=e-n*3600-a*60;if(isNaN(a))return"00:00.0";let d="";return a<10&&(d+="0"),d+=a+":",l<10&&(d+="0"),d+=l.toFixed(i),d},w5=(e,i)=>e.userId+"_"+e.customerId+"_"+(Math.random()+1).toString(36).substring(2)+"."+i,n8=()=>{const e=x0(new Date).date();let i="th";return e===1||e===21||e===31?i="st":e===2||e===22?i="nd":(e===3||e===23)&&(i="rd"),x0(new Date).format(`MMM D[${i}] YYYY @ h:mm A`)},s8=(e,i,n="YYYY-MM-DD HH:mm:ss")=>{const a=i.timeZone||Intl.DateTimeFormat().resolvedOptions().timeZone||x0.tz.guess(),l=x0(e,["M/DD/YYYY h:mm:ss A","M/DD/YYYY, h:mm:ss A","M/D/YYYY h:mm:ss A","M/D/YYYY, h:mm:ss A","MM/DD/YYYY"]),d=-x0().tz("America/New_York").utcOffset(),u=x0().tz(a).utcOffset(),h=l.add(d,"minute");return x0(h).add(u,"minute").format(n)},a8=(e,i,n)=>{const a=Array.from(e),[l]=a.splice(i,1);return a.splice(n,0,l),a},S5=({trimStart:e,trimEnd:i,videoDuration:n})=>n===0||i===0?!1:e!==0||n-i>.3,lr=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Ea=e=>(e/1e3).toFixed(2);function c8(e){return e.charAt(0).toUpperCase()+e.slice(1)}function C5(){for(let e in Qt)localStorage.removeItem(Qt[e])}const l8=(e,i=1)=>{const n=Math.floor(e/60),a=e-n*60;if(isNaN(n))return"00.0";let l="";return n<10&&(l+="0"),l+=n+":",a<10&&(l+="0"),l+=a.toFixed(i),l};function Ur(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}const k5=y.createContext({}),d8=c.createGlobalStyle`
3
3
  * {
4
4
  font-family: ${e=>e.$isCdk?"'Roboto', sans-serif":"'Work Sans', sans-serif"};
5
5
  }
@@ -1062,7 +1062,7 @@ border-radius: 6px;`,Xo={MESSAGE_CATEGORY:"Select the type of message you’d li
1062
1062
  `,ig=c.section`
1063
1063
  margin-right: 14px;
1064
1064
  height: 100%;
1065
- `,ng=({handleModalClose:e,onShortUrlMarkAsSentMutationHandler:i,isLoadingShortUrlMarkAsSent:n,shortUrlMarkAsSentPayload:a,goToCompanySettings:l})=>{const{userData:d}=ur(),{isCompanyAdmin:u}=d,{t:h}=ue.useTranslation();return o.jsxs(a1,{headerText:h("Mark Video as ‘Sent’?"),closeModal:e,style:{content:{width:"532px",minWidth:"532px"}},children:[o.jsxs(og,{children:[o.jsx(ig,{children:o.jsx(S1.AiFillInfoCircle,{size:24,color:"rgba(0, 27, 83, 0.4)"})}),o.jsx(rg,{children:o.jsx(eg,{children:l?o.jsx(ue.Trans,{i18nKey:"transSplits.preferencesHint",values:{actor:"your admin"},components:[o.jsx("span",{style:{textDecoration:"underline",cursor:"pointer",marginLeft:4},onClick:l})]}):h("transSplits.preferencesHintNoLink",{actor:u?"you":"your admin"})})})]}),o.jsxs(tg,{children:[o.jsx(X.Button,{text:h("Leave as ‘Not Sent’"),variant:"white",disabled:n,onClick:()=>{i({markAsSentConfirmed:!1,...a})}}),o.jsx(X.Button,{text:h("Mark as Sent"),disabled:n,onClick:()=>{i({markAsSentConfirmed:!0,...a})}})]})]})},sg=e=>o.jsx(F5,{...e,children:o.jsx(he.MdCheck,{color:"rgba(30, 164, 95, 1)",size:26,style:{minWidth:26,maxWidth:26}})}),Va=e=>h5.toast(o.jsx(sg,{...e}),{position:e.position||"top-right",closeButton:i=>o.jsx(P5,{defaultProps:e,closeButtonProps:i}),style:{width:"100%"}});var c1=(e=>(e.QUOTE_SEND="Quote-Send",e.OPENED_EMAIL="Opened-Email",e.WATCHED_VIDEO="Watched-Video",e.APPROVED_ITEMS="Approved-Items",e.UPDATE_QUOTE="Update-Quote",e.RECORDED_VIDEO="Recorded-Video",e.APPROVED_VIDEO="Approved-Video",e.DENIED_VIDEO="Denied-Video",e.DELETE_VIDEO="Delete-Video",e.QUOTE_RESEND="Quote-Resend",e.UPDATE_RO="RO-Update",e.QUICKSHARE="Quickshare",e.COPY_SMS="COPY_SMS",e.COPY_EMAIL="COPY_EMAIL",e.CRM_SHARE="Crm-Share",e.WATCHED_VIDEO_UNKNOWN="WATCHED_VIDEO_UNKNOWN",e))(c1||{});const xo={ASK_VERY_TIME:{value:2},NEVER:{value:0},ALWAYS:{value:1}},On=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),ag=async(e,i)=>{const n=a=>{a.clipboardData&&(a.clipboardData.setData("text/html",i||""),a.clipboardData.setData("text/plain",e)),a.preventDefault()};document.addEventListener("copy",a=>n(a),{once:!0}),document.execCommand("copy")},cg=async e=>{const i=async()=>{const{videoId:a,videoId:l,...d}=e,u=await D5(a,{...d});return{url:u.data.url,html:d.generatedText||u.data.html}},n=document.createElement("textArea");await navigator.clipboard.write([await new ClipboardItem({"text/plain":new Promise(async a=>{a(new Blob([(await i()).url],{type:"text/plain"}))}),"text/html":new Promise(async a=>{n.style.visibility="hidden",n.setAttribute("contenteditable","true"),n.value=(await i()).html,document.body.appendChild(n);const l=document.createRange();l.selectNodeContents(n);const d=window.getSelection();d==null||d.removeAllRanges(),d==null||d.addRange(l),n==null||n.setSelectionRange(0,999999),a(new Blob([n.value],{type:"text/html"}))})})]),n&&n.remove&&n.remove()},U5=async(e,i,n)=>{try{On?await cg(n):await ag(e,i)}catch{Mn({title:"Failed to copy to clipboard"})}},lg=async e=>{const{videoId:i,toastType:n,...a}=e,l={...a,...On?{reuseShortUrl:!0}:{},ignoreCrmProvider:!0},{data:d}=await n0.post(`share/quickshare/${i}/mark-as-sent`,l);return d},dg=({handleSubmitGeneratedContent:e,handleOnCopySuccess:i,data:n,onSuccessCallback:a})=>{const{params:l}=_1(),{userData:d}=ur(),u=d.isAutomotive?d.customer.markVideosAsSent===null?xo.ASK_VERY_TIME.value:parseInt(d.customer.markVideosAsSent.toString(),10):xo.NEVER.value;return Ue.useMutation(h=>lg({...h,...l}),{onSuccess:async(h,x)=>{const{generatedText:g,generatedUrl:b,generatedThumnail:v}=n;u===xo.ALWAYS.value&&d.isAutomotive&&Va({title:"Video marked as Sent"}),u===xo.ASK_VERY_TIME.value&&x.markAsSentConfirmed&&d.isAutomotive&&Va({title:"Video marked as Sent"}),On||U5(n.generatedUrl,(n==null?void 0:n.generatedText)||"",{}),x.toastType==="copy"&&(Va({title:"CRM Code Copied"}),i==null||i(g,b,v,!!x.markAsSentConfirmed,l)),x.toastType==="insert"&&(e==null||e(g,b,v,!!x.markAsSentConfirmed,l)),a()},onError:()=>{Mn({title:"Failed to retrieve quickshare link!"})}})},ug=({data:e,setShowModalShortUrlMarkAsSent:i,handleShortUrlMarkAsSentSuccessCallback:n,handleSubmitGeneratedContent:a,handleOnCopySuccess:l})=>{const{userData:d}=ur(),{params:u}=_1(),h=()=>{n==null||n(),i(!1)},{isLoading:x,mutateAsync:g}=dg({onSuccessCallback:h,handleSubmitGeneratedContent:a,handleOnCopySuccess:l,data:e}),b=async({...v})=>{const S={videoActivityType:c1.CRM_SHARE,...v};return On&&await U5("","",{videoActivityType:c1.CRM_SHARE,...v,...u,generatedText:e.generatedText}),await g(S)};return{handleMarkAsSentFlow:v=>{const S=d.isAutomotive?d.customer.markVideosAsSent===null?xo.ASK_VERY_TIME.value:parseInt(d.customer.markVideosAsSent.toString(),10):xo.NEVER.value;if(S===xo.NEVER.value)return b({...v});if(S===xo.ASK_VERY_TIME.value)return i(!0);if(S===xo.ALWAYS.value)return b({...v})},isLoadingShortUrlMarkAsSent:x,onShortUrlMarkAsSentMutationHandler:b}},pg=({closeModal:e,handleSubmitGeneratedContent:i,handleOnCopySuccess:n,goToCompanySettings:a})=>{const l=X.useCovideoTheme(),{promptType:d,promptUseCase:u,changePromptUseCase:h,selectedAiFlexScriptValue:x,changeSelectedAiFlexScript:g,isLoading:b,generateContentWithAi:v,promptsLeft:S,generatedText:C,changeVehicleTitle:k,changeVin:_,crmData:j,sender:E,changeSender:R,senderCompany:M,changeSenderCompany:D,recipient:O,changeRecipient:A,vin:T,nextStep:V,changeNextStep:z,changeFormalityLevel:U,detailLevel:$,changeDetailLevel:B,changeEnthusiasmLevel:Z,changeAdditionalInfo:W,additionalInfo:Q,changeGeneratedText:Y,changeBaseText:H,templateOptions:se,selectedTemplateOption:ce,changeSelectedTemplateOption:Te,linksetOptions:xe,selectedLinksetOption:pe,changeSelectedLinksetOption:le,overlayOptions:Se,selectedOverlayOption:te,changeSelectedOverlayOption:me,generatedThumnail:_e,generatedUrl:Ne,isStreamingResponse:Fe,handleAbort:Qe,videoId:rt}=_1(),{userData:be}=ur(),[Ve,fe]=y.useState(!1),[ae,Oe]=y.useState(null),{t:re}=ue.useTranslation(),Je=()=>{e()},{onShortUrlMarkAsSentMutationHandler:ft,isLoadingShortUrlMarkAsSent:ne,handleMarkAsSentFlow:Re}=ug({setShowModalShortUrlMarkAsSent:fe,handleShortUrlMarkAsSentSuccessCallback:Je,data:{generatedText:C,generatedUrl:Ne,generatedThumnail:_e},handleOnCopySuccess:n,handleSubmitGeneratedContent:i}),{isAutomotiveSalesRole:Pe,customer:nt,isAutomotive:st}=be,De=async()=>{if(Oe("insert"),j!=null&&j.data&&d===Lt.CRM_MESSAGE){Re({videoId:rt,toastType:"insert"});return}i&&(await i(C,Ne,_e),e())},ut=je=>{if(!je){k(""),_("");return}if(!je.itemId){k(je.vin||""),_("");return}k(je.title||""),_(je.vin||"")},xt=async()=>{Oe("copy"),!(!(j!=null&&j.data)||d!==Lt.CRM_MESSAGE)&&Re({videoId:rt,toastType:"copy"})},wt=y.useMemo(()=>{if(!x)return;const je=gi(x);return je?{label:re(je.label),value:je.value}:void 0},[x,re]),Rt=y.useMemo(()=>zy(re),[re]);if(!Number(nt.hasCovideoMagic))return null;const ht=d===Lt.CRM_MESSAGE?er.HTML:er.PLAIN,gt=d===Lt.CRM_MESSAGE,_t=d===Lt.TELEPROPTER_SCRIPT,f0=!!i,R0=d!==Lt.SMS&&$>=lo.MID,$t=S<=0,g0=b||$t||Fe||ne,Kt=b||$t||!C.length||Fe,It=Kt||ne||gt&&!(j!=null&&j.data),Xt=d===Lt.CRM_MESSAGE;return Lt.AI_FLEX_VIDEO===d?o.jsx(a1,{closeModal:e,headerText:re("Generate {{promptType}} with Script Assist",{promptType:re(d)}),style:{content:{width:"1120px"}},headerMargin:"0 0 24px 0",children:o.jsxs(Ef,{className:"ai-assist",children:[o.jsxs(P0,{children:[o.jsx(Aa,{style:{margin:"0px"},children:re("Message category")}),o.jsx(jn,{width:Pd,creatable:!1,value:wt,options:Rt,onChange:je=>g(String(je.value)),placeholder:re("Enter use case"),menuPortalTarget:document.body,menuPosition:"fixed",menuPlacement:"bottom",extendStyles:{container:{width:"100%"},control:{width:"100%"}}})]}),o.jsxs(Bd,{disabled:$t,className:"ai-assist",children:[o.jsxs(Wd,{children:[o.jsx(Mr,{children:o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Aa,{style:{margin:"0px"},children:re("Additional Instructions")}),o.jsx(ui,{text:re(Xo.ADDITIONAL_INSTRUCTIONS)})]}),o.jsx(qd,{value:Q,onChange:je=>W(je.target.value),style:{minHeight:"165px"},placeholder:re(Xo.ADDITIONAL_INFO)})]})}),o.jsxs(Hd,{children:[o.jsxs(Ir,{children:[o.jsx(Aa,{style:{margin:"0px"},children:re("Tone of Voice")}),o.jsx(ui,{text:re(Xo.TONE_OF_VOICE)})]}),o.jsxs(Yd,{style:{marginTop:16},children:[o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Casual")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Formal")})]}),o.jsx(Ct,{children:re("Casual")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:Lo.MID,min:Lo.LOW,max:Lo.HIGH,onChange:je=>U(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Formal")})]}),o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Reserved")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Enthusiastic")})]}),o.jsx(Ct,{children:re("Reserved")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:$o.MID,min:$o.LOW,max:$o.HIGH,onChange:je=>Z(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Enthusiastic")})]}),o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Brief")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Detailed")})]}),o.jsx(Ct,{children:re("Brief")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:lo.MID,min:lo.LOW,max:lo.HIGH,onChange:je=>B(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Detailed")})]})]})]}),o.jsxs(dn,{children:[!$t&&o.jsx(un,{children:re("{{promptsLeft}} prompts left this month",{promptsLeft:S})}),$t&&o.jsxs(un,{color:Ce.red100,children:[o.jsx(Sn.IoWarning,{})," ",o.jsx("span",{children:re("0 prompts left this month")})]}),Fe&&o.jsx(X.Button,{text:re("Stop"),onClick:Qe,icon:o.jsx(he.MdStop,{color:Ce.white}),variant:"primary"}),!Fe&&o.jsx(X.Button,{onClick:v,text:re("Generate"),variant:"gradient",disabled:g0,icon:o.jsx(kn,{color:Ce.white})})]})]}),o.jsxs(Gd,{children:[o.jsxs(Qd,{children:[b&&o.jsx(Ud,{children:o.jsx(Xd,{children:o.jsx(Cd,{animationData:zd,loop:!0,autoplay:!0})})}),!b&&ht===er.PLAIN&&o.jsx(Zd,{disabled:b,value:C,onChange:je=>{Y(je.target.value),H(je.target.value)}}),!b&&ht===er.HTML&&o.jsx(Kd,{disabled:b,dangerouslySetInnerHTML:{__html:C}})]}),o.jsxs(dn,{children:[gt&&o.jsx(X.Button,{onClick:xt,text:re("Copy"),disabled:It}),f0&&o.jsx(X.Button,{onClick:De,text:re("Insert This"),disabled:Kt||ne})]})]})]})]})}):o.jsxs(a1,{closeModal:e,headerText:re("Generate {{promptType}} with Script Assist",{promptType:re(d)}),style:{content:{width:"1120px"}},children:[o.jsxs(Bd,{disabled:$t,className:"ai-assist",children:[o.jsxs(Wd,{children:[o.jsxs(Hd,{children:[Xt&&o.jsx(Kf,{templateOptions:se,selectedTemplate:ce,setSelectedTemplate:Te,ctaOptions:xe,selectedCta:pe,setSelectedCta:le,overlaysOptions:Se,selectedOverlay:te,setSelectedOverlay:me,extraStyle:{label:{color:"#9297a2",marginTop:0},wrapper:{marginTop:0},control:{minHeight:44,maxHeight:64}}}),o.jsxs(Mr,{children:[o.jsxs(P0,{children:[o.jsx(Mo,{children:re("Your name")}),o.jsx(pn,{radius:"6px",value:E,onChange:je=>R(je.target.value),placeholder:re("Enter your name")})]}),o.jsxs(P0,{children:[o.jsx(Mo,{children:re("Company Name")}),o.jsx(pn,{radius:"6px",value:M,onChange:je=>D(je.target.value),placeholder:re("Enter your company name")})]})]}),o.jsxs(Mr,{children:[st&&o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Mo,{children:re("Message category")}),o.jsx(ui,{text:re(Xo.MESSAGE_CATEGORY)})]}),o.jsx(jn,{width:Pd,value:Ld.find(je=>je&&je.value===u),options:Ld,onChange:je=>h(je.value),placeholder:re("Enter use case"),menuPortalTarget:document.body,menuPosition:"fixed",menuPlacement:"bottom",extendStyles:{container:{width:"100%"},control:{width:"100%"}},formatCreateLabel:je=>o.jsxs("div",{style:{color:l.colors.primary[100],display:"flex",alignItems:"center"},children:[o.jsx(he.MdEdit,{color:Ce.blue40}),"  Write"," ",`"${je}"`]})})]}),!_t&&o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Mo,{children:re("Their name")}),o.jsx(ui,{text:re(Xo.CUSTOMER_NAME)})]}),o.jsx(pn,{radius:"6px",value:O,onChange:je=>A(je.target.value),placeholder:re("Enter customer name")})]})]}),o.jsxs(Mr,{children:[Pe&&o.jsxs(P0,{children:[o.jsx(Ir,{children:o.jsx(Mo,{children:re("Vehicle")})}),o.jsx(qf,{onChangeVehicle:ut,selectedVin:T,fetchSold:!1,creatable:d!==Lt.CRM_MESSAGE,placeholder:re("Search vehicles..."),borderRadius:"6px",dropdownOptionLabelMaxWidth:"95%",menuZindex:9999,limitedSingleValueWidth:"218px"})]}),o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Mo,{children:re("Next steps")}),o.jsx(ui,{text:re(Xo.CTA),style:{content:{marginLeft:"50px"}}})]}),o.jsx(pn,{radius:"6px",value:V,onChange:je=>z(je.target.value),placeholder:re("Enter next steps")})]})]}),o.jsxs(Yd,{children:[o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Casual")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Formal")})]}),o.jsx(Ct,{children:re("Casual")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:Lo.MID,min:Lo.LOW,max:Lo.HIGH,onChange:je=>U(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Formal")})]}),o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Reserved")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Enthusiastic")})]}),o.jsx(Ct,{children:re("Reserved")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:$o.MID,min:$o.LOW,max:$o.HIGH,onChange:je=>Z(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Enthusiastic")})]}),d!==Lt.SMS&&o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Brief")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Detailed")})]}),o.jsx(Ct,{children:re("Brief")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:lo.MID,min:lo.LOW,max:lo.HIGH,onChange:je=>B(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Detailed")})]})]}),R0&&o.jsx(Mr,{children:o.jsx(P0,{children:o.jsx(qd,{value:Q,onChange:je=>W(je.target.value),placeholder:re(Xo.ADDITIONAL_INFO)})})})]}),o.jsxs(dn,{children:[!$t&&o.jsx(un,{children:re("{{promptsLeft}} prompts left this month",{promptsLeft:S})}),$t&&o.jsxs(un,{color:Ce.red100,children:[o.jsx(Sn.IoWarning,{})," ",o.jsx("span",{children:re("0 prompts left this month")})]}),Fe&&o.jsx(X.Button,{text:re("Stop"),onClick:Qe,icon:o.jsx(he.MdStop,{color:Ce.white}),variant:"primary"}),!Fe&&o.jsx(X.Button,{onClick:v,text:re("Generate"),variant:"gradient",disabled:g0,icon:o.jsx(kn,{color:Ce.white})})]})]}),o.jsxs(Gd,{children:[o.jsxs(Qd,{children:[b&&o.jsx(Ud,{children:o.jsx(Xd,{children:o.jsx(Cd,{animationData:zd,loop:!0,autoplay:!0})})}),!b&&ht===er.PLAIN&&o.jsx(Zd,{disabled:b,value:C,onChange:je=>{Y(je.target.value),H(je.target.value)}}),!b&&ht===er.HTML&&o.jsx(Kd,{disabled:b,dangerouslySetInnerHTML:{__html:C}})]}),o.jsxs(dn,{children:[gt&&o.jsx(X.Button,{onClick:xt,text:re("Copy"),disabled:It}),f0&&o.jsx(X.Button,{onClick:De,text:re("Insert This"),disabled:Kt||ne})]})]})]}),Ve&&o.jsx(ng,{shortUrlMarkAsSentPayload:{videoId:rt,toastType:ae},isLoadingShortUrlMarkAsSent:ne,onShortUrlMarkAsSentMutationHandler:ft,handleModalClose:()=>{fe(!1)},goToCompanySettings:a})]})},xg=new Ue.QueryClient({defaultOptions:{queries:{retry:0,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1},mutations:{retry:0}}}),hg=({handleSubmitGeneratedContent:e,handleOnCopySuccess:i,defaultPromptType:n,defaultPromptUseCase:a=Rn.INITIAL_REACH_OUT,defaultSelectedAIScriptValue:l,defaultRecipient:d="",defaultVin:u="",userInput:h="",margin:x="0",iconColor:g="white",videoId:b,hoverPopup:v,hoverPosition:S="above",disabled:C,variant:k,text:_,size:j="large",goToCompanySettings:E})=>{const{userData:R}=ur(),{customer:M}=R,D=R.isAutomotiveServiceRole,[O,A]=y.useState(!1),T=()=>A(!0),V=()=>A(!1);return!D&&Number(M.hasCovideoMagic)?o.jsx(Ue.QueryClientProvider,{client:xg,children:o.jsxs("div",{style:{margin:x},className:"ai-assist",children:[v?o.jsx(M5,{showtriangle:!0,position:S,padding:"0",width:"auto",hoverable:o.jsx(X.Button,{onClick:T,variant:k,text:_,size:j,disabled:C,icon:g==="gradient"?o.jsx(Fd,{}):o.jsx(kn,{color:g})}),popup:v}):o.jsx(X.Button,{onClick:T,variant:k,text:_,size:j,disabled:C,icon:g==="gradient"?o.jsx(Fd,{}):o.jsx(kn,{color:g})}),O&&o.jsx(hf,{defaultPromptType:n,defaultPromptUseCase:a,defaultSelectedAIScriptValue:l,defaultRecipient:d,defaultVin:u,userInput:h,videoId:b,children:o.jsx(pg,{closeModal:V,handleSubmitGeneratedContent:e,handleOnCopySuccess:i,goToCompanySettings:E})})]})}):null},q5=({userData:e,token:i,aiAssistTheme:n,env:a,apiKey:l,defaultSelectedAIScriptValue:d,...u})=>(y.useEffect(()=>{s1.changeLanguage((e==null?void 0:e.preferredLanguage)||"en")},[e==null?void 0:e.preferredLanguage]),o.jsx(tf,{userData:e,token:i,env:a||"production",apiKey:l||"",children:o.jsx(ue.I18nextProvider,{i18n:s1,children:o.jsx(X.CovideoThemeProvider,{themeName:n,children:o.jsx(hg,{...u,defaultSelectedAIScriptValue:d})})})}));var A1=(e=>(e.TELEPROPTER_SCRIPT="Teleprompter Script",e.EMAIL="Email",e.SMS="SMS",e.CRM_MESSAGE="CRM Message",e))(A1||{});const yg=async(e,i)=>(await Ae.get(`/share/quickshare/${e}`,{params:i})).data,W5=()=>{const{toast:e}=kt(),{t:i}=ue.useTranslation(),n=async(d,u)=>{const h=x=>{x.clipboardData&&(x.clipboardData.setData("text/html",u||""),x.clipboardData.setData("text/plain",d)),x.preventDefault()};document.addEventListener("copy",x=>h(x),{once:!0}),document.execCommand("copy")},a=async d=>{const u=async()=>{const{videoId:x,toastType:g,...b}=d,v=await yg(x,{...b});return{url:v.data.url,html:v.data.html}},h=document.createElement("textArea");await navigator.clipboard.write([await new ClipboardItem({"text/plain":new Promise(async x=>{x(new Blob([(await u()).url],{type:"text/plain"}))}),"text/html":new Promise(async x=>{h.style.visibility="hidden",h.setAttribute("contenteditable","true"),h.value=(await u()).html,document.body.appendChild(h);const g=document.createRange();g.selectNodeContents(h);const b=window.getSelection();b==null||b.removeAllRanges(),b==null||b.addRange(g),h==null||h.setSelectionRange(0,999999),x(new Blob([h.value],{type:"text/html"}))})})]),h&&h.remove&&h.remove()};return{copyClipboard:async(d,u,h)=>{try{lr?await a(h):await n(d,u)}catch{e({message:i("Failed to copy to clipboard")})}}}},fg=async e=>{const{videoId:i,toastType:n,...a}=e,l={...a,...lr?{reuseShortUrl:!0}:{}},{data:d}=await Ae.post(`/share/quickshare/${i}/mark-as-sent`,l);return d},gg=(e,i)=>{switch(i.toastType){case"crm_code":return{title:"CRM Code Copied!",clipboardText:e.url,clipboardHtml:e.html};case"url":return{title:"URL Copied!",clipboardText:e.url};case"html_code":return{title:"Raw HTML Copied!",clipboardText:e.legacyHtml};case"quickshare":return{title:"Link copied to clipboard!",clipboardText:e.url,clipboardHtml:e.html};case"insert":return{title:"Inserting video..."}}},mg=e=>{const{t:i}=ue.useTranslation(),{userData:n}=it(),{toast:a}=kt(),{copyClipboard:l}=W5(),{onVideoInsert:d,onVideoInsertError:u}=pt(),h=ar(n);return Ue.useMutation(fg,{onSuccess:(x,g)=>{const b=gg(x,g);if(h===B0.ALWAYS.value&&a({message:i("Video marked as Sent")}),h===B0.ASK_VERY_TIME.value&&g.markAsSentConfirmed&&a({message:i("Video marked as Sent")}),b){if(b.clipboardText)try{!lr&&b.clipboardText&&l(b.clipboardText,(b==null?void 0:b.clipboardHtml)||"",{})}catch(v){console.log("Failed to copy to clipboard...",v)}b.title&&setTimeout(()=>{a({message:i(b.title)})},100)}g.toastType==="insert"&&(d==null||d({url:x.url,thumbnail:x.thumbnail,image:(x==null?void 0:x.image)||"",html:x.html,token:i0})),e()},onError:x=>{u==null||u(x)}})},V1=({video:e,videoRequest:i,setShowModalQuickShareMarkAsSent:n,handleOnMarkAsSentSuccessCallback:a})=>{const{userData:l}=it(),{copyClipboard:d}=W5(),u=()=>{a==null||a(),n(!1)},{isLoading:h,mutateAsync:x}=mg(u),g=async({markAsSentConfirmed:v,videoActivityType:S,...C})=>{const k={videoId:typeof e=="number"?e.toString():(e==null?void 0:e.id)||"",vin:(i==null?void 0:i.vin)||"",useAutomotive:!!(i!=null&&i.vin),...S?{videoActivityType:S}:{},...v!==void 0?{markAsSentConfirmed:v}:{},...C};if(lr)try{await d("","",k)}catch(_){console.log("Failed to copy to clipboard...",_)}return await x(k)};return{onQuickShareButtonClick:({videoActivityType:v,...S})=>{const C=ar(l);if(C===B0.NEVER.value)return g({videoActivityType:v,...S});if(C===B0.ASK_VERY_TIME.value)return n(!0);if(C===B0.ALWAYS.value)return g({videoActivityType:v,...S})},isQuickshareLoading:h,onQuickShareMutationHandler:g}},H5=({src:e,onLoad:i})=>{const l=y.useRef(null),[d,u]=y.useState(0),[h,x]=y.useState(!1),g=()=>{var v,S;x(!1),u(0),i&&i(((v=l.current)==null?void 0:v.offsetWidth)??0,((S=l.current)==null?void 0:S.offsetHeight)??0)},b=()=>{if(x(!0),d>=30)return;let v=Math.pow(2,d)*1e3;v>5e3&&(v=5e3),setTimeout(()=>u(d+1),v)};return y.useEffect(()=>(l!=null&&l.current&&(l.current.onload=g,l.current.onerror=b,l.current.src=e),()=>{l!=null&&l.current&&(l.current.onload=null,l.current.onerror=null)}),[e,d]),{imgRef:l,retryCount:d,error:h}};var rr=(e=>(e[e.READY=0]="READY",e[e.PROCESSING=1]="PROCESSING",e[e.FAILED=2]="FAILED",e))(rr||{});const G5=({videoId:e,checkField:i,enabled:n})=>{const[d,u]=y.useState(null),[h,x]=y.useState(0),[g,b]=y.useState(!1);return y.useEffect(()=>{if(!n)return;(async()=>{try{const S=await An(e.toString()),C=(S==null?void 0:S.processing)===rr.FAILED||(S==null?void 0:S.processing)===rr.READY;if(i&&S[i]){u(S);return}if(C){const k=localStorage.getItem(Qt.merge);if(k){const _=JSON.parse(k)||[];_.forEach((j,E)=>{j.id===S.id&&(_[E]=S)}),localStorage.setItem(Qt.merge,JSON.stringify(_))}u(S);return}if(h<30){let k=Math.pow(2,h)*1e3;k>5e3&&(k=5e3),setTimeout(()=>{x(h+1)},k);return}b(!0)}catch{b(!0)}})()},[e,i,h,n]),{videoData:d,retryCount:h,error:g}},vg=c.div`
1065
+ `,ng=({handleModalClose:e,onShortUrlMarkAsSentMutationHandler:i,isLoadingShortUrlMarkAsSent:n,shortUrlMarkAsSentPayload:a,goToCompanySettings:l})=>{const{userData:d}=ur(),{isCompanyAdmin:u}=d,{t:h}=ue.useTranslation();return o.jsxs(a1,{headerText:h("Mark Video as ‘Sent’?"),closeModal:e,style:{content:{width:"532px",minWidth:"532px"}},children:[o.jsxs(og,{children:[o.jsx(ig,{children:o.jsx(S1.AiFillInfoCircle,{size:24,color:"rgba(0, 27, 83, 0.4)"})}),o.jsx(rg,{children:o.jsx(eg,{children:l?o.jsx(ue.Trans,{i18nKey:"transSplits.preferencesHint",values:{actor:"your admin"},components:[o.jsx("span",{style:{textDecoration:"underline",cursor:"pointer",marginLeft:4},onClick:l})]}):h("transSplits.preferencesHintNoLink",{actor:u?"you":"your admin"})})})]}),o.jsxs(tg,{children:[o.jsx(X.Button,{text:h("Leave as ‘Not Sent’"),variant:"white",disabled:n,onClick:()=>{i({markAsSentConfirmed:!1,...a})}}),o.jsx(X.Button,{text:h("Mark as Sent"),disabled:n,onClick:()=>{i({markAsSentConfirmed:!0,...a})}})]})]})},sg=e=>o.jsx(F5,{...e,children:o.jsx(he.MdCheck,{color:"rgba(30, 164, 95, 1)",size:26,style:{minWidth:26,maxWidth:26}})}),Va=e=>h5.toast(o.jsx(sg,{...e}),{position:e.position||"top-right",closeButton:i=>o.jsx(P5,{defaultProps:e,closeButtonProps:i}),style:{width:"100%"}});var c1=(e=>(e.QUOTE_SEND="Quote-Send",e.OPENED_EMAIL="Opened-Email",e.WATCHED_VIDEO="Watched-Video",e.APPROVED_ITEMS="Approved-Items",e.UPDATE_QUOTE="Update-Quote",e.RECORDED_VIDEO="Recorded-Video",e.APPROVED_VIDEO="Approved-Video",e.DENIED_VIDEO="Denied-Video",e.DELETE_VIDEO="Delete-Video",e.QUOTE_RESEND="Quote-Resend",e.UPDATE_RO="RO-Update",e.QUICKSHARE="Quickshare",e.COPY_SMS="COPY_SMS",e.COPY_EMAIL="COPY_EMAIL",e.CRM_SHARE="Crm-Share",e.WATCHED_VIDEO_UNKNOWN="WATCHED_VIDEO_UNKNOWN",e))(c1||{});const xo={ASK_VERY_TIME:{value:2},NEVER:{value:0},ALWAYS:{value:1}},On=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),ag=async(e,i)=>{const n=a=>{a.clipboardData&&(a.clipboardData.setData("text/html",i||""),a.clipboardData.setData("text/plain",e)),a.preventDefault()};document.addEventListener("copy",a=>n(a),{once:!0}),document.execCommand("copy")},cg=async e=>{const i=async()=>{const{videoId:a,videoId:l,...d}=e,u=await D5(a,{...d});return{url:u.data.url,html:d.generatedText||u.data.html}},n=document.createElement("textArea");await navigator.clipboard.write([await new ClipboardItem({"text/plain":new Promise(async a=>{a(new Blob([(await i()).url],{type:"text/plain"}))}),"text/html":new Promise(async a=>{n.style.visibility="hidden",n.setAttribute("contenteditable","true"),n.value=(await i()).html,document.body.appendChild(n);const l=document.createRange();l.selectNodeContents(n);const d=window.getSelection();d==null||d.removeAllRanges(),d==null||d.addRange(l),n==null||n.setSelectionRange(0,999999),a(new Blob([n.value],{type:"text/html"}))})})]),n&&n.remove&&n.remove()},U5=async(e,i,n)=>{try{On?await cg(n):await ag(e,i)}catch{Mn({title:"Failed to copy to clipboard"})}},lg=async e=>{const{videoId:i,toastType:n,...a}=e,l={...a,...On?{reuseShortUrl:!0}:{},ignoreCrmProvider:!0},{data:d}=await n0.post(`share/quickshare/${i}/mark-as-sent`,l);return d},dg=({handleSubmitGeneratedContent:e,handleOnCopySuccess:i,data:n,onSuccessCallback:a})=>{const{params:l}=_1(),{userData:d}=ur(),u=d.isAutomotive?d.customer.markVideosAsSent===null?xo.ASK_VERY_TIME.value:parseInt(d.customer.markVideosAsSent.toString(),10):xo.NEVER.value;return Ue.useMutation(h=>lg({...h,...l}),{onSuccess:async(h,x)=>{const{generatedText:g,generatedUrl:b,generatedThumnail:v}=n;u===xo.ALWAYS.value&&d.isAutomotive&&Va({title:"Video marked as Sent"}),u===xo.ASK_VERY_TIME.value&&x.markAsSentConfirmed&&d.isAutomotive&&Va({title:"Video marked as Sent"}),On||U5(n.generatedUrl,(n==null?void 0:n.generatedText)||"",{}),x.toastType==="copy"&&(Va({title:"CRM Code Copied"}),i==null||i(g,b,v,!!x.markAsSentConfirmed,l)),x.toastType==="insert"&&(e==null||e(g,b,v,!!x.markAsSentConfirmed,l)),a()},onError:()=>{Mn({title:"Failed to retrieve quickshare link!"})}})},ug=({data:e,setShowModalShortUrlMarkAsSent:i,handleShortUrlMarkAsSentSuccessCallback:n,handleSubmitGeneratedContent:a,handleOnCopySuccess:l})=>{const{userData:d}=ur(),{params:u}=_1(),h=()=>{n==null||n(),i(!1)},{isLoading:x,mutateAsync:g}=dg({onSuccessCallback:h,handleSubmitGeneratedContent:a,handleOnCopySuccess:l,data:e}),b=async({...v})=>{const S={videoActivityType:c1.CRM_SHARE,...v};return On&&await U5("","",{videoActivityType:c1.CRM_SHARE,...v,...u,generatedText:e.generatedText}),await g(S)};return{handleMarkAsSentFlow:v=>{const S=d.isAutomotive?d.customer.markVideosAsSent===null?xo.ASK_VERY_TIME.value:parseInt(d.customer.markVideosAsSent.toString(),10):xo.NEVER.value;if(S===xo.NEVER.value)return b({...v});if(S===xo.ASK_VERY_TIME.value)return i(!0);if(S===xo.ALWAYS.value)return b({...v})},isLoadingShortUrlMarkAsSent:x,onShortUrlMarkAsSentMutationHandler:b}},pg=({closeModal:e,handleSubmitGeneratedContent:i,handleOnCopySuccess:n,goToCompanySettings:a})=>{const l=X.useCovideoTheme(),{promptType:d,promptUseCase:u,changePromptUseCase:h,selectedAiFlexScriptValue:x,changeSelectedAiFlexScript:g,isLoading:b,generateContentWithAi:v,promptsLeft:S,generatedText:C,changeVehicleTitle:k,changeVin:_,crmData:j,sender:E,changeSender:R,senderCompany:M,changeSenderCompany:D,recipient:O,changeRecipient:A,vin:T,nextStep:V,changeNextStep:z,changeFormalityLevel:U,detailLevel:$,changeDetailLevel:B,changeEnthusiasmLevel:Z,changeAdditionalInfo:W,additionalInfo:Q,changeGeneratedText:Y,changeBaseText:H,templateOptions:se,selectedTemplateOption:ce,changeSelectedTemplateOption:Te,linksetOptions:xe,selectedLinksetOption:pe,changeSelectedLinksetOption:le,overlayOptions:Se,selectedOverlayOption:te,changeSelectedOverlayOption:me,generatedThumnail:_e,generatedUrl:Ne,isStreamingResponse:Fe,handleAbort:Qe,videoId:rt}=_1(),{userData:be}=ur(),[Ve,fe]=y.useState(!1),[ae,Oe]=y.useState(null),{t:re}=ue.useTranslation(),Je=()=>{e()},{onShortUrlMarkAsSentMutationHandler:ft,isLoadingShortUrlMarkAsSent:ne,handleMarkAsSentFlow:Re}=ug({setShowModalShortUrlMarkAsSent:fe,handleShortUrlMarkAsSentSuccessCallback:Je,data:{generatedText:C,generatedUrl:Ne,generatedThumnail:_e},handleOnCopySuccess:n,handleSubmitGeneratedContent:i}),{isAutomotiveSalesRole:Pe,customer:nt,isAutomotive:st}=be,De=async()=>{if(Oe("insert"),j!=null&&j.data&&d===Lt.CRM_MESSAGE){Re({videoId:rt,toastType:"insert"});return}i&&(await i(C,Ne,_e),e())},ut=je=>{if(!je){k(""),_("");return}if(!je.itemId){k(je.vin||""),_("");return}k(je.title||""),_(je.vin||"")},xt=async()=>{Oe("copy"),!(!(j!=null&&j.data)||d!==Lt.CRM_MESSAGE)&&Re({videoId:rt,toastType:"copy"})},wt=y.useMemo(()=>{if(!x)return;const je=gi(x);return je?{label:re(je.label),value:je.value}:void 0},[x,re]),Rt=y.useMemo(()=>zy(re),[re]);if(!Number(nt.hasCovideoMagic))return null;const ht=d===Lt.CRM_MESSAGE?er.HTML:er.PLAIN,gt=d===Lt.CRM_MESSAGE,_t=d===Lt.TELEPROPTER_SCRIPT,f0=!!i,R0=d!==Lt.SMS&&$>=lo.MID,$t=S<=0,g0=b||$t||Fe||ne,Kt=b||$t||!C.length||Fe,It=Kt||ne||gt&&!(j!=null&&j.data),Xt=d===Lt.CRM_MESSAGE;return Lt.AI_FLEX_VIDEO===d?o.jsx(a1,{closeModal:e,headerText:re("Generate {{promptType}} with Script Assist",{promptType:re(d)}),style:{content:{width:"1120px"}},headerMargin:"0 0 24px 0",children:o.jsxs(Ef,{className:"ai-assist",children:[o.jsxs(P0,{children:[o.jsx(Aa,{style:{margin:"0px"},children:re("Message category")}),o.jsx(jn,{width:Pd,creatable:!1,value:wt,options:Rt,onChange:je=>g(String(je.value)),placeholder:re("Enter use case"),menuPortalTarget:document.body,menuPosition:"fixed",menuPlacement:"bottom",extendStyles:{container:{width:"100%"},control:{width:"100%"}}})]}),o.jsxs(Bd,{disabled:$t,className:"ai-assist",children:[o.jsxs(Wd,{children:[o.jsx(Mr,{children:o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Aa,{style:{margin:"0px"},children:re("Additional Instructions")}),o.jsx(ui,{text:re(Xo.ADDITIONAL_INSTRUCTIONS)})]}),o.jsx(qd,{value:Q,onChange:je=>W(je.target.value),style:{minHeight:"165px"},placeholder:re(Xo.ADDITIONAL_INFO)})]})}),o.jsxs(Hd,{children:[o.jsxs(Ir,{children:[o.jsx(Aa,{style:{margin:"0px"},children:re("Tone of Voice")}),o.jsx(ui,{text:re(Xo.TONE_OF_VOICE)})]}),o.jsxs(Yd,{style:{marginTop:16},children:[o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Casual")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Formal")})]}),o.jsx(Ct,{children:re("Casual")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:Lo.MID,min:Lo.LOW,max:Lo.HIGH,onChange:je=>U(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Formal")})]}),o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Reserved")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Enthusiastic")})]}),o.jsx(Ct,{children:re("Reserved")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:$o.MID,min:$o.LOW,max:$o.HIGH,onChange:je=>Z(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Enthusiastic")})]}),o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Brief")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Detailed")})]}),o.jsx(Ct,{children:re("Brief")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:lo.MID,min:lo.LOW,max:lo.HIGH,onChange:je=>B(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Detailed")})]})]})]}),o.jsxs(dn,{children:[!$t&&o.jsx(un,{children:re("{{promptsLeft}} prompts left this month",{promptsLeft:S})}),$t&&o.jsxs(un,{color:Ce.red100,children:[o.jsx(Sn.IoWarning,{})," ",o.jsx("span",{children:re("0 prompts left this month")})]}),Fe&&o.jsx(X.Button,{text:re("Stop"),onClick:Qe,icon:o.jsx(he.MdStop,{color:Ce.white}),variant:"primary"}),!Fe&&o.jsx(X.Button,{onClick:v,text:re("Generate"),variant:"gradient",disabled:g0,icon:o.jsx(kn,{color:Ce.white})})]})]}),o.jsxs(Gd,{children:[o.jsxs(Qd,{children:[b&&o.jsx(Ud,{children:o.jsx(Xd,{children:o.jsx(Cd,{animationData:zd,loop:!0,autoplay:!0})})}),!b&&ht===er.PLAIN&&o.jsx(Zd,{disabled:b,value:C,onChange:je=>{Y(je.target.value),H(je.target.value)}}),!b&&ht===er.HTML&&o.jsx(Kd,{disabled:b,dangerouslySetInnerHTML:{__html:C}})]}),o.jsxs(dn,{children:[gt&&o.jsx(X.Button,{onClick:xt,text:re("Copy"),disabled:It}),f0&&o.jsx(X.Button,{onClick:De,text:re("Insert This"),disabled:Kt||ne})]})]})]})]})}):o.jsxs(a1,{closeModal:e,headerText:re("Generate {{promptType}} with Script Assist",{promptType:re(d)}),style:{content:{width:"1120px"}},children:[o.jsxs(Bd,{disabled:$t,className:"ai-assist",children:[o.jsxs(Wd,{children:[o.jsxs(Hd,{children:[Xt&&o.jsx(Kf,{templateOptions:se,selectedTemplate:ce,setSelectedTemplate:Te,ctaOptions:xe,selectedCta:pe,setSelectedCta:le,overlaysOptions:Se,selectedOverlay:te,setSelectedOverlay:me,extraStyle:{label:{color:"#9297a2",marginTop:0},wrapper:{marginTop:0},control:{minHeight:44,maxHeight:64}}}),o.jsxs(Mr,{children:[o.jsxs(P0,{children:[o.jsx(Mo,{children:re("Your name")}),o.jsx(pn,{radius:"6px",value:E,onChange:je=>R(je.target.value),placeholder:re("Enter your name")})]}),o.jsxs(P0,{children:[o.jsx(Mo,{children:re("Company Name")}),o.jsx(pn,{radius:"6px",value:M,onChange:je=>D(je.target.value),placeholder:re("Enter your company name")})]})]}),o.jsxs(Mr,{children:[st&&o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Mo,{children:re("Message category")}),o.jsx(ui,{text:re(Xo.MESSAGE_CATEGORY)})]}),o.jsx(jn,{width:Pd,value:Ld.find(je=>je&&je.value===u),options:Ld,onChange:je=>h(je.value),placeholder:re("Enter use case"),menuPortalTarget:document.body,menuPosition:"fixed",menuPlacement:"bottom",extendStyles:{container:{width:"100%"},control:{width:"100%"}},formatCreateLabel:je=>o.jsxs("div",{style:{color:l.colors.primary[100],display:"flex",alignItems:"center"},children:[o.jsx(he.MdEdit,{color:Ce.blue40}),"  Write"," ",`"${je}"`]})})]}),!_t&&o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Mo,{children:re("Their name")}),o.jsx(ui,{text:re(Xo.CUSTOMER_NAME)})]}),o.jsx(pn,{radius:"6px",value:O,onChange:je=>A(je.target.value),placeholder:re("Enter customer name")})]})]}),o.jsxs(Mr,{children:[Pe&&o.jsxs(P0,{children:[o.jsx(Ir,{children:o.jsx(Mo,{children:re("Vehicle")})}),o.jsx(qf,{onChangeVehicle:ut,selectedVin:T,fetchSold:!1,creatable:d!==Lt.CRM_MESSAGE,placeholder:re("Search vehicles..."),borderRadius:"6px",dropdownOptionLabelMaxWidth:"95%",menuZindex:9999,limitedSingleValueWidth:"218px"})]}),o.jsxs(P0,{children:[o.jsxs(Ir,{children:[o.jsx(Mo,{children:re("Next steps")}),o.jsx(ui,{text:re(Xo.CTA),style:{content:{marginLeft:"50px"}}})]}),o.jsx(pn,{radius:"6px",value:V,onChange:je=>z(je.target.value),placeholder:re("Enter next steps")})]})]}),o.jsxs(Yd,{children:[o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Casual")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Formal")})]}),o.jsx(Ct,{children:re("Casual")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:Lo.MID,min:Lo.LOW,max:Lo.HIGH,onChange:je=>U(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Formal")})]}),o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Reserved")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Enthusiastic")})]}),o.jsx(Ct,{children:re("Reserved")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:$o.MID,min:$o.LOW,max:$o.HIGH,onChange:je=>Z(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Enthusiastic")})]}),d!==Lt.SMS&&o.jsxs(Vr,{children:[o.jsxs(Rr,{children:[o.jsx(Ct,{display:"block",children:re("Brief")}),o.jsx(Ct,{textalign:"right",display:"block",children:re("Detailed")})]}),o.jsx(Ct,{children:re("Brief")}),o.jsx(Ar,{children:o.jsx(Lr,{marks:!0,defaultValue:lo.MID,min:lo.LOW,max:lo.HIGH,onChange:je=>B(je),width:`${_r}px`})}),o.jsx(Ct,{textalign:"right",children:re("Detailed")})]})]}),R0&&o.jsx(Mr,{children:o.jsx(P0,{children:o.jsx(qd,{value:Q,onChange:je=>W(je.target.value),placeholder:re(Xo.ADDITIONAL_INFO)})})})]}),o.jsxs(dn,{children:[!$t&&o.jsx(un,{children:re("{{promptsLeft}} prompts left this month",{promptsLeft:S})}),$t&&o.jsxs(un,{color:Ce.red100,children:[o.jsx(Sn.IoWarning,{})," ",o.jsx("span",{children:re("0 prompts left this month")})]}),Fe&&o.jsx(X.Button,{text:re("Stop"),onClick:Qe,icon:o.jsx(he.MdStop,{color:Ce.white}),variant:"primary"}),!Fe&&o.jsx(X.Button,{onClick:v,text:re("Generate"),variant:"gradient",disabled:g0,icon:o.jsx(kn,{color:Ce.white})})]})]}),o.jsxs(Gd,{children:[o.jsxs(Qd,{children:[b&&o.jsx(Ud,{children:o.jsx(Xd,{children:o.jsx(Cd,{animationData:zd,loop:!0,autoplay:!0})})}),!b&&ht===er.PLAIN&&o.jsx(Zd,{disabled:b,value:C,onChange:je=>{Y(je.target.value),H(je.target.value)}}),!b&&ht===er.HTML&&o.jsx(Kd,{disabled:b,dangerouslySetInnerHTML:{__html:C}})]}),o.jsxs(dn,{children:[gt&&o.jsx(X.Button,{onClick:xt,text:re("Copy"),disabled:It}),f0&&o.jsx(X.Button,{onClick:De,text:re("Insert This"),disabled:Kt||ne})]})]})]}),Ve&&o.jsx(ng,{shortUrlMarkAsSentPayload:{videoId:rt,toastType:ae},isLoadingShortUrlMarkAsSent:ne,onShortUrlMarkAsSentMutationHandler:ft,handleModalClose:()=>{fe(!1)},goToCompanySettings:a})]})},xg=new Ue.QueryClient({defaultOptions:{queries:{retry:0,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1},mutations:{retry:0}}}),hg=({handleSubmitGeneratedContent:e,handleOnCopySuccess:i,defaultPromptType:n,defaultPromptUseCase:a=Rn.INITIAL_REACH_OUT,defaultSelectedAIScriptValue:l,defaultRecipient:d="",defaultVin:u="",userInput:h="",margin:x="0",iconColor:g="white",videoId:b,hoverPopup:v,hoverPosition:S="above",disabled:C,variant:k,text:_,size:j="large",goToCompanySettings:E})=>{const{userData:R}=ur(),{customer:M}=R,D=R.isAutomotiveServiceRole,[O,A]=y.useState(!1),T=()=>A(!0),V=()=>A(!1);return!D&&Number(M.hasCovideoMagic)?o.jsx(Ue.QueryClientProvider,{client:xg,children:o.jsxs("div",{style:{margin:x},className:"ai-assist",children:[v?o.jsx(M5,{showtriangle:!0,position:S,padding:"0",width:"auto",hoverable:o.jsx(X.Button,{onClick:T,variant:k,text:_,size:j,disabled:C,icon:g==="gradient"?o.jsx(Fd,{}):o.jsx(kn,{color:g})}),popup:v}):o.jsx(X.Button,{onClick:T,variant:k,text:_,size:j,disabled:C,icon:g==="gradient"?o.jsx(Fd,{}):o.jsx(kn,{color:g})}),O&&o.jsx(hf,{defaultPromptType:n,defaultPromptUseCase:a,defaultSelectedAIScriptValue:l,defaultRecipient:d,defaultVin:u,userInput:h,videoId:b,children:o.jsx(pg,{closeModal:V,handleSubmitGeneratedContent:e,handleOnCopySuccess:i,goToCompanySettings:E})})]})}):null},q5=({userData:e,token:i,aiAssistTheme:n,env:a,apiKey:l,defaultSelectedAIScriptValue:d,...u})=>(y.useEffect(()=>{s1.changeLanguage((e==null?void 0:e.preferredLanguage)||"en")},[e==null?void 0:e.preferredLanguage]),o.jsx(tf,{userData:e,token:i,env:a||"production",apiKey:l||"",children:o.jsx(ue.I18nextProvider,{i18n:s1,children:o.jsx(X.CovideoThemeProvider,{themeName:n,children:o.jsx(hg,{...u,defaultSelectedAIScriptValue:d})})})}));var A1=(e=>(e.TELEPROPTER_SCRIPT="Teleprompter Script",e.EMAIL="Email",e.SMS="SMS",e.CRM_MESSAGE="CRM Message",e))(A1||{});const yg=async(e,i)=>(await Ae.get(`/share/quickshare/${e}`,{params:i})).data,W5=()=>{const{toast:e}=kt(),{t:i}=ue.useTranslation(),n=async(d,u)=>{const h=x=>{x.clipboardData&&(x.clipboardData.setData("text/html",u||""),x.clipboardData.setData("text/plain",d)),x.preventDefault()};document.addEventListener("copy",x=>h(x),{once:!0}),document.execCommand("copy")},a=async d=>{const u=async()=>{const{videoId:x,toastType:g,...b}=d,v=await yg(x,{...b});return{url:v.data.url,html:v.data.html}},h=document.createElement("textArea");await navigator.clipboard.write([await new ClipboardItem({"text/plain":new Promise(async x=>{x(new Blob([(await u()).url],{type:"text/plain"}))}),"text/html":new Promise(async x=>{h.style.visibility="hidden",h.setAttribute("contenteditable","true"),h.value=(await u()).html,document.body.appendChild(h);const g=document.createRange();g.selectNodeContents(h);const b=window.getSelection();b==null||b.removeAllRanges(),b==null||b.addRange(g),h==null||h.setSelectionRange(0,999999),x(new Blob([h.value],{type:"text/html"}))})})]),h&&h.remove&&h.remove()};return{copyClipboard:async(d,u,h)=>{try{lr?await a(h):await n(d,u)}catch{e({message:i("Failed to copy to clipboard")})}}}},fg=async e=>{const{videoId:i,toastType:n,...a}=e,l={...a,...lr?{reuseShortUrl:!0}:{}},{data:d}=await Ae.post(`/share/quickshare/${i}/mark-as-sent`,l);return d},gg=(e,i)=>{switch(i.toastType){case"crm_code":return{title:"CRM Code Copied!",clipboardText:e.url,clipboardHtml:e.html};case"url":return{title:"URL Copied!",clipboardText:e.url};case"html_code":return{title:"Raw HTML Copied!",clipboardText:e.legacyHtml};case"quickshare":return{title:"Link copied to clipboard!",clipboardText:e.url,clipboardHtml:e.html};case"insert":return{title:"Inserting video..."}}},mg=e=>{const{t:i}=ue.useTranslation(),{userData:n}=it(),{toast:a}=kt(),{copyClipboard:l}=W5(),{onVideoInsert:d,onVideoInsertError:u}=pt(),h=ar(n);return Ue.useMutation(fg,{onSuccess:(x,g)=>{const b=gg(x,g);if(h===B0.ALWAYS.value&&a({message:i("Video marked as Sent")}),h===B0.ASK_VERY_TIME.value&&g.markAsSentConfirmed&&a({message:i("Video marked as Sent")}),b){if(b.clipboardText)try{!lr&&b.clipboardText&&l(b.clipboardText,(b==null?void 0:b.clipboardHtml)||"",{})}catch(v){console.log("Failed to copy to clipboard...",v)}b.title&&setTimeout(()=>{a({message:i(b.title)})},100)}g.toastType==="insert"&&(d==null||d({url:x.url,thumbnail:x.thumbnail,image:(x==null?void 0:x.image)||"",html:x.html,token:i0,videoId:g.videoId.toString()})),e()},onError:x=>{u==null||u(x)}})},V1=({video:e,videoRequest:i,setShowModalQuickShareMarkAsSent:n,handleOnMarkAsSentSuccessCallback:a})=>{const{userData:l}=it(),{copyClipboard:d}=W5(),u=()=>{a==null||a(),n(!1)},{isLoading:h,mutateAsync:x}=mg(u),g=async({markAsSentConfirmed:v,videoActivityType:S,...C})=>{const k={videoId:typeof e=="number"?e.toString():(e==null?void 0:e.id)||"",vin:(i==null?void 0:i.vin)||"",useAutomotive:!!(i!=null&&i.vin),...S?{videoActivityType:S}:{},...v!==void 0?{markAsSentConfirmed:v}:{},...C};if(lr)try{await d("","",k)}catch(_){console.log("Failed to copy to clipboard...",_)}return await x(k)};return{onQuickShareButtonClick:({videoActivityType:v,...S})=>{const C=ar(l);if(C===B0.NEVER.value)return g({videoActivityType:v,...S});if(C===B0.ASK_VERY_TIME.value)return n(!0);if(C===B0.ALWAYS.value)return g({videoActivityType:v,...S})},isQuickshareLoading:h,onQuickShareMutationHandler:g}},H5=({src:e,onLoad:i})=>{const l=y.useRef(null),[d,u]=y.useState(0),[h,x]=y.useState(!1),g=()=>{var v,S;x(!1),u(0),i&&i(((v=l.current)==null?void 0:v.offsetWidth)??0,((S=l.current)==null?void 0:S.offsetHeight)??0)},b=()=>{if(x(!0),d>=30)return;let v=Math.pow(2,d)*1e3;v>5e3&&(v=5e3),setTimeout(()=>u(d+1),v)};return y.useEffect(()=>(l!=null&&l.current&&(l.current.onload=g,l.current.onerror=b,l.current.src=e),()=>{l!=null&&l.current&&(l.current.onload=null,l.current.onerror=null)}),[e,d]),{imgRef:l,retryCount:d,error:h}};var rr=(e=>(e[e.READY=0]="READY",e[e.PROCESSING=1]="PROCESSING",e[e.FAILED=2]="FAILED",e))(rr||{});const G5=({videoId:e,checkField:i,enabled:n})=>{const[d,u]=y.useState(null),[h,x]=y.useState(0),[g,b]=y.useState(!1);return y.useEffect(()=>{if(!n)return;(async()=>{try{const S=await An(e.toString()),C=(S==null?void 0:S.processing)===rr.FAILED||(S==null?void 0:S.processing)===rr.READY;if(i&&S[i]){u(S);return}if(C){const k=localStorage.getItem(Qt.merge);if(k){const _=JSON.parse(k)||[];_.forEach((j,E)=>{j.id===S.id&&(_[E]=S)}),localStorage.setItem(Qt.merge,JSON.stringify(_))}u(S);return}if(h<30){let k=Math.pow(2,h)*1e3;k>5e3&&(k=5e3),setTimeout(()=>{x(h+1)},k);return}b(!0)}catch{b(!0)}})()},[e,i,h,n]),{videoData:d,retryCount:h,error:g}},vg=c.div`
1066
1066
  position: relative;
1067
1067
  width: ${e=>e.thumbnailWidth?e.thumbnailWidth:"100%"};
1068
1068
  height: ${e=>e.thumbnailHeight?e.thumbnailHeight:"100%"};
@@ -1558,7 +1558,7 @@ border-radius: 6px;`,Xo={MESSAGE_CATEGORY:"Select the type of message you’d li
1558
1558
  position: absolute;
1559
1559
  top: 10px;
1560
1560
  left: 10px;
1561
- `,K5=({video:e,isMerge:i,selectedVideosData:n,setSelectedVideosData:a})=>{var pe,le,Se,te;const{t:l,i18n:d}=ue.useTranslation(),u=(e==null?void 0:e.folder)===Or.COMPANY,{showQuickshareFeature:h,showVoiceoverFeature:x,showInsertFeature:g,showAiAssistFeature:b,env:v,onVideoInsert:S}=pt(),{userData:C}=it(),k=q0(C),_=X0(C),j=ar(C),E=!!(C!=null&&C.customer.isIMSEnabled),{trackGTMVideoInteractionEvent:R}=y0(),M=_0(C),D=U0.useHistory(),[O,A]=y.useState(!1),[T,V]=y.useState(!1),[z,U]=y.useState(!1),[$,B]=y.useState(!1),{toast:Z}=kt(),{onQuickShareMutationHandler:W,isQuickshareLoading:Q,onQuickShareButtonClick:Y}=V1({video:e,videoRequest:e==null?void 0:e.videoRequest,setShowModalQuickShareMarkAsSent:B}),H=e?s8(e.recordDate,C,"MM/DD/YYYY hh:mm:ss A"):"",se=me=>{let{checked:_e}=me.target;a(_e?[...n,e]:n.filter(Ne=>Ne.id!=e.id))},ce=async()=>{if(e){V(!0);try{await b8(e.id,`${e.title}.mp4`)}catch{Z({message:l("Download failed, please try again later.")})}V(!1)}},Te=({action:me})=>{var Ne,Fe,Qe;if(!e)return;const _e={videoId:Number(e.id),videoType:(Ne=e==null?void 0:e.videoRequest)==null?void 0:Ne.videoType,videoCustomerName:!!((Fe=e==null?void 0:e.videoRequest)!=null&&Fe.customerName),videoLength:e==null?void 0:e.videoLength,videoTitle:e==null?void 0:e.title};R==null||R({videoAttributes:_e,action:me,vehicle:(Qe=e==null?void 0:e.videoRequest)==null?void 0:Qe.inventoryItem})},xe=async()=>{if(e){A(!0);try{await w8(e.id),Z({message:l("Video copied successfully.")})}catch{Z({message:l("Copy failed, please try again later.")})}A(!1)}};return e?o.jsxs(cu,{children:[o.jsxs(lu,{backgroundColor:N.black,children:[o.jsx(Y5,{videoId:e.id,thumbnail:e.thumbnail,duration:e.videoLength||0,processing:e.processing,onClick:()=>{Te({action:Dr.VIEW}),U(!0)}}),!i&&o.jsxs(Im,{children:[o.jsxs(Am,{children:[!u&&o.jsxs(o.Fragment,{children:[g&&o.jsx(X.Button,{onClick:()=>{Te({action:Dr.SEND_AND_SHARE}),D.push(`/insert-video/${e==null?void 0:e.id}`)},icon:o.jsx(ot.IoMdAdd,{size:18}),variant:"white",iconPosition:"middle",size:"small",title:l("Insert")}),h&&o.jsx(X.Button,{onClick:()=>{Te({action:Dr.COPY_VIDEO_URL}),Y({videoActivityType:cr.QUICKSHARE,toastType:"quickshare"})},icon:Q?o.jsx(z0,{size:12}):o.jsx(ot.IoIosShareAlt,{size:18}),disabled:Q,variant:"white",title:l("Copy Video"),size:"small"}),b&&o.jsx(q5,{defaultPromptType:A1.CRM_MESSAGE,handleSubmitGeneratedContent:(me,_e,Ne,Fe)=>{const Qe={url:_e||"",thumbnail:Ne||"",image:e.thumbnail||"",html:me,token:i0};S==null||S(Qe),setTimeout(()=>{Fe||j===B0.ALWAYS.value&&Z({message:l("Video marked as Sent")})},100),Z({message:l("Inserting video...")})},handleOnCopySuccess:(me,_e,Ne,Fe)=>{setTimeout(()=>{Fe||j===B0.ALWAYS.value&&Z({message:l("Video marked as Sent")})},100),Z({message:l("Link copied to clipboard!")})},margin:"0",iconColor:"gradient",videoId:e?e.id:"",defaultVin:((pe=e==null?void 0:e.videoRequest)==null?void 0:pe.vin)||"",token:i0,userData:{customer:{business:C.customer.business,hasCovideoMagic:((Se=(le=C==null?void 0:C.customer)==null?void 0:le.hasCovideoMagic)==null?void 0:Se.toString())==="1",markVideosAsSent:ar(C),phone1:(te=C==null?void 0:C.customer)==null?void 0:te.phone1},firstName:C.firstName,isAutomotiveSalesRole:_,isAutomotiveServiceRole:k,isIMSEnabled:E,isCompanyAdmin:C.isCompanyAdmin,isAutomotive:M,preferredLanguage:d.language},aiAssistTheme:"branding",env:v,apiKey:ho,variant:"white",size:"small"})]}),u&&o.jsxs(o.Fragment,{children:[o.jsx(X.Button,{onClick:xe,icon:O?o.jsx(z0,{size:12}):o.jsx(he.MdCreateNewFolder,{size:18}),disabled:O,variant:"white",title:l("Copy to Primary"),size:"small"}),o.jsx(X.Button,{onClick:ce,title:l("Download"),icon:T?o.jsx(z0,{size:12}):o.jsx(he.MdDownload,{size:18}),disabled:T,variant:"white",size:"small"})]})]}),x&&!u&&o.jsx(X.Button,{title:l("Voiceover"),onClick:()=>{Te({action:Dr.VOICE_OVER}),D.push(`/voiceover/${e.id}`)},icon:o.jsx(ot.IoIosMic,{size:18}),variant:"white",size:"small"})]}),i&&o.jsx(Vm,{children:o.jsx(R5,{width:"24px",checked:n.find(me=>me.id===e.id),onChange:me=>se(me)})})]}),o.jsxs(du,{children:[o.jsx(uu,{children:e.title}),o.jsxs(pu,{children:[o.jsx(ot.IoMdCalendar,{size:16,color:N.gray40,style:{marginRight:6}}),H]})]}),$&&o.jsx(T1,{markAsSentPayload:{toastType:"quickshare"},isQuickShareLoading:Q,quickShareMarkAsSentHandler:W,handleModalClose:async()=>{B(!1)}}),z&&o.jsx(Tm,{video:e,handleModalClose:()=>U(!1)})]}):o.jsxs(cu,{opacity:".3",children:[o.jsx(lu,{backgroundColor:N.gray20,children:o.jsx(_m,{children:" "})}),o.jsxs(du,{children:[o.jsx(uu,{backgroundColor:N.gray20,width:"100%",children:" "}),o.jsx(pu,{backgroundColor:N.gray20,width:"70%",children:" "})]})]})},Rm=c.div`
1561
+ `,K5=({video:e,isMerge:i,selectedVideosData:n,setSelectedVideosData:a})=>{var pe,le,Se,te;const{t:l,i18n:d}=ue.useTranslation(),u=(e==null?void 0:e.folder)===Or.COMPANY,{showQuickshareFeature:h,showVoiceoverFeature:x,showInsertFeature:g,showAiAssistFeature:b,env:v,onVideoInsert:S}=pt(),{userData:C}=it(),k=q0(C),_=X0(C),j=ar(C),E=!!(C!=null&&C.customer.isIMSEnabled),{trackGTMVideoInteractionEvent:R}=y0(),M=_0(C),D=U0.useHistory(),[O,A]=y.useState(!1),[T,V]=y.useState(!1),[z,U]=y.useState(!1),[$,B]=y.useState(!1),{toast:Z}=kt(),{onQuickShareMutationHandler:W,isQuickshareLoading:Q,onQuickShareButtonClick:Y}=V1({video:e,videoRequest:e==null?void 0:e.videoRequest,setShowModalQuickShareMarkAsSent:B}),H=e?s8(e.recordDate,C,"MM/DD/YYYY hh:mm:ss A"):"",se=me=>{let{checked:_e}=me.target;a(_e?[...n,e]:n.filter(Ne=>Ne.id!=e.id))},ce=async()=>{if(e){V(!0);try{await b8(e.id,`${e.title}.mp4`)}catch{Z({message:l("Download failed, please try again later.")})}V(!1)}},Te=({action:me})=>{var Ne,Fe,Qe;if(!e)return;const _e={videoId:Number(e.id),videoType:(Ne=e==null?void 0:e.videoRequest)==null?void 0:Ne.videoType,videoCustomerName:!!((Fe=e==null?void 0:e.videoRequest)!=null&&Fe.customerName),videoLength:e==null?void 0:e.videoLength,videoTitle:e==null?void 0:e.title};R==null||R({videoAttributes:_e,action:me,vehicle:(Qe=e==null?void 0:e.videoRequest)==null?void 0:Qe.inventoryItem})},xe=async()=>{if(e){A(!0);try{await w8(e.id),Z({message:l("Video copied successfully.")})}catch{Z({message:l("Copy failed, please try again later.")})}A(!1)}};return e?o.jsxs(cu,{children:[o.jsxs(lu,{backgroundColor:N.black,children:[o.jsx(Y5,{videoId:e.id,thumbnail:e.thumbnail,duration:e.videoLength||0,processing:e.processing,onClick:()=>{Te({action:Dr.VIEW}),U(!0)}}),!i&&o.jsxs(Im,{children:[o.jsxs(Am,{children:[!u&&o.jsxs(o.Fragment,{children:[g&&o.jsx(X.Button,{onClick:()=>{Te({action:Dr.SEND_AND_SHARE}),D.push(`/insert-video/${e==null?void 0:e.id}`)},icon:o.jsx(ot.IoMdAdd,{size:18}),variant:"white",iconPosition:"middle",size:"small",title:l("Insert")}),h&&o.jsx(X.Button,{onClick:()=>{Te({action:Dr.COPY_VIDEO_URL}),Y({videoActivityType:cr.QUICKSHARE,toastType:"quickshare"})},icon:Q?o.jsx(z0,{size:12}):o.jsx(ot.IoIosShareAlt,{size:18}),disabled:Q,variant:"white",title:l("Copy Video"),size:"small"}),b&&o.jsx(q5,{defaultPromptType:A1.CRM_MESSAGE,handleSubmitGeneratedContent:(me,_e,Ne,Fe)=>{const Qe={url:_e||"",thumbnail:Ne||"",image:e.thumbnail||"",html:me,token:i0,videoId:e.id.toString()};S==null||S(Qe),setTimeout(()=>{Fe||j===B0.ALWAYS.value&&Z({message:l("Video marked as Sent")})},100),Z({message:l("Inserting video...")})},handleOnCopySuccess:(me,_e,Ne,Fe)=>{setTimeout(()=>{Fe||j===B0.ALWAYS.value&&Z({message:l("Video marked as Sent")})},100),Z({message:l("Link copied to clipboard!")})},margin:"0",iconColor:"gradient",videoId:e?e.id:"",defaultVin:((pe=e==null?void 0:e.videoRequest)==null?void 0:pe.vin)||"",token:i0,userData:{customer:{business:C.customer.business,hasCovideoMagic:((Se=(le=C==null?void 0:C.customer)==null?void 0:le.hasCovideoMagic)==null?void 0:Se.toString())==="1",markVideosAsSent:ar(C),phone1:(te=C==null?void 0:C.customer)==null?void 0:te.phone1},firstName:C.firstName,isAutomotiveSalesRole:_,isAutomotiveServiceRole:k,isIMSEnabled:E,isCompanyAdmin:C.isCompanyAdmin,isAutomotive:M,preferredLanguage:d.language},aiAssistTheme:"branding",env:v,apiKey:ho,variant:"white",size:"small"})]}),u&&o.jsxs(o.Fragment,{children:[o.jsx(X.Button,{onClick:xe,icon:O?o.jsx(z0,{size:12}):o.jsx(he.MdCreateNewFolder,{size:18}),disabled:O,variant:"white",title:l("Copy to Primary"),size:"small"}),o.jsx(X.Button,{onClick:ce,title:l("Download"),icon:T?o.jsx(z0,{size:12}):o.jsx(he.MdDownload,{size:18}),disabled:T,variant:"white",size:"small"})]})]}),x&&!u&&o.jsx(X.Button,{title:l("Voiceover"),onClick:()=>{Te({action:Dr.VOICE_OVER}),D.push(`/voiceover/${e.id}`)},icon:o.jsx(ot.IoIosMic,{size:18}),variant:"white",size:"small"})]}),i&&o.jsx(Vm,{children:o.jsx(R5,{width:"24px",checked:n.find(me=>me.id===e.id),onChange:me=>se(me)})})]}),o.jsxs(du,{children:[o.jsx(uu,{children:e.title}),o.jsxs(pu,{children:[o.jsx(ot.IoMdCalendar,{size:16,color:N.gray40,style:{marginRight:6}}),H]})]}),$&&o.jsx(T1,{markAsSentPayload:{toastType:"quickshare"},isQuickShareLoading:Q,quickShareMarkAsSentHandler:W,handleModalClose:async()=>{B(!1)}}),z&&o.jsx(Tm,{video:e,handleModalClose:()=>U(!1)})]}):o.jsxs(cu,{opacity:".3",children:[o.jsx(lu,{backgroundColor:N.gray20,children:o.jsx(_m,{children:" "})}),o.jsxs(du,{children:[o.jsx(uu,{backgroundColor:N.gray20,width:"100%",children:" "}),o.jsx(pu,{backgroundColor:N.gray20,width:"70%",children:" "})]})]})},Rm=c.div`
1562
1562
  position: relative;
1563
1563
  width: 190px;
1564
1564
  ${({theme:e})=>e.containerWidth<de.cmd&&c.css`