@gsc-basic/robot-sdk 1.0.6 → 1.0.8

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.
@@ -1,4 +1,4 @@
1
- var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
1
+ var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
2
2
  robot-previewer {
3
3
  display: none;
4
4
  box-sizing: border-box;
@@ -76,7 +76,7 @@ robot-previewer .___previewer-fade {
76
76
  <div class="___previewer-fade"></div>
77
77
  <img src="" alt="" class="___previewer-img" />
78
78
  <div class="___previewer-close"><span>\xD7</span></div>
79
- `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!1},Re=g(g(g(g({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return g(g(g(g(g(g({},Re),t),n),c),m),h)}function be(){let e=document.createElement("style");e.innerHTML=`
79
+ `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!0},Re=b(b(b(b({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return b(b(b(b(b(b({},Re),t),n),c),m),h)}function ge(){let e=document.createElement("style");e.innerHTML=`
80
80
  .resizable-iframe-container {
81
81
  position: relative;
82
82
  display: inline-block;
@@ -121,9 +121,9 @@ robot-previewer .___previewer-fade {
121
121
  left: 0;
122
122
  cursor: n-resize;
123
123
  }
124
- `,document.head.appendChild(e);}function ge(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
125
  <div class="resize-handle rb"></div>
126
126
  <div class="resize-handle lt"></div>
127
127
  <div class="resize-handle l"></div>
128
128
  <div class="resize-handle t"></div>
129
- `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=ge(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,b])=>b!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,b){let E=typeof p=="number"?`${p}px`:p||b;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,b=880,E=.51,k=1,d=a<=w?E:a>=b?k:E+(k-E)*((a-w)/(b-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),be(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),b=!1,E,k;w.onmousedown=function(d){b=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(b){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){b=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if((o==null?void 0:o.draggable)!==!1&&we(l),(o==null?void 0:o.resizable)!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"prod"});export{qe as changeRobotLang,Pe as destroyTokenListener,Xe as initRobot,je as quickSubmit,Fe as setRouteKey,Ue as toggleRobotVisibility};
129
+ `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=be(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,g])=>g!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,g){let E=typeof p=="number"?`${p}px`:p||g;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,g=880,E=.51,k=1,d=a<=w?E:a>=g?k:E+(k-E)*((a-w)/(g-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),ge(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),g=!1,E,k;w.onmousedown=function(d){g=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(g){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){g=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if(o.draggable!==!1&&we(l),o.resizable!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"prod"});export{qe as changeRobotLang,Pe as destroyTokenListener,Xe as initRobot,je as quickSubmit,Fe as setRouteKey,Ue as toggleRobotVisibility};
@@ -1,4 +1,4 @@
1
- (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.ServerRobot={}));})(this,(function(exports){'use strict';var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
1
+ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.ServerRobot={}));})(this,(function(exports){'use strict';var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
2
2
  robot-previewer {
3
3
  display: none;
4
4
  box-sizing: border-box;
@@ -76,7 +76,7 @@ robot-previewer .___previewer-fade {
76
76
  <div class="___previewer-fade"></div>
77
77
  <img src="" alt="" class="___previewer-img" />
78
78
  <div class="___previewer-close"><span>\xD7</span></div>
79
- `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!1},Re=g(g(g(g({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return g(g(g(g(g(g({},Re),t),n),c),m),h)}function be(){let e=document.createElement("style");e.innerHTML=`
79
+ `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!0},Re=b(b(b(b({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return b(b(b(b(b(b({},Re),t),n),c),m),h)}function ge(){let e=document.createElement("style");e.innerHTML=`
80
80
  .resizable-iframe-container {
81
81
  position: relative;
82
82
  display: inline-block;
@@ -121,9 +121,9 @@ robot-previewer .___previewer-fade {
121
121
  left: 0;
122
122
  cursor: n-resize;
123
123
  }
124
- `,document.head.appendChild(e);}function ge(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
125
  <div class="resize-handle rb"></div>
126
126
  <div class="resize-handle lt"></div>
127
127
  <div class="resize-handle l"></div>
128
128
  <div class="resize-handle t"></div>
129
- `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=ge(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,b])=>b!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,b){let E=typeof p=="number"?`${p}px`:p||b;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,b=880,E=.51,k=1,d=a<=w?E:a>=b?k:E+(k-E)*((a-w)/(b-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),be(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),b=!1,E,k;w.onmousedown=function(d){b=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(b){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){b=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if((o==null?void 0:o.draggable)!==!1&&we(l),(o==null?void 0:o.resizable)!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"prod"});exports.changeRobotLang=qe;exports.destroyTokenListener=Pe;exports.initRobot=Xe;exports.quickSubmit=je;exports.setRouteKey=Fe;exports.toggleRobotVisibility=Ue;}));
129
+ `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=be(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,g])=>g!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,g){let E=typeof p=="number"?`${p}px`:p||g;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,g=880,E=.51,k=1,d=a<=w?E:a>=g?k:E+(k-E)*((a-w)/(g-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),ge(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),g=!1,E,k;w.onmousedown=function(d){g=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(g){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){g=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if(o.draggable!==!1&&we(l),o.resizable!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"prod"});exports.changeRobotLang=qe;exports.destroyTokenListener=Pe;exports.initRobot=Xe;exports.quickSubmit=je;exports.setRouteKey=Fe;exports.toggleRobotVisibility=Ue;}));
@@ -1,4 +1,4 @@
1
- var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
1
+ var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
2
2
  robot-previewer {
3
3
  display: none;
4
4
  box-sizing: border-box;
@@ -76,7 +76,7 @@ robot-previewer .___previewer-fade {
76
76
  <div class="___previewer-fade"></div>
77
77
  <img src="" alt="" class="___previewer-img" />
78
78
  <div class="___previewer-close"><span>\xD7</span></div>
79
- `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!1},Re=g(g(g(g({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return g(g(g(g(g(g({},Re),t),n),c),m),h)}function be(){let e=document.createElement("style");e.innerHTML=`
79
+ `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!0},Re=b(b(b(b({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return b(b(b(b(b(b({},Re),t),n),c),m),h)}function ge(){let e=document.createElement("style");e.innerHTML=`
80
80
  .resizable-iframe-container {
81
81
  position: relative;
82
82
  display: inline-block;
@@ -121,9 +121,9 @@ robot-previewer .___previewer-fade {
121
121
  left: 0;
122
122
  cursor: n-resize;
123
123
  }
124
- `,document.head.appendChild(e);}function ge(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
125
  <div class="resize-handle rb"></div>
126
126
  <div class="resize-handle lt"></div>
127
127
  <div class="resize-handle l"></div>
128
128
  <div class="resize-handle t"></div>
129
- `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=ge(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,b])=>b!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,b){let E=typeof p=="number"?`${p}px`:p||b;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,b=880,E=.51,k=1,d=a<=w?E:a>=b?k:E+(k-E)*((a-w)/(b-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),be(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),b=!1,E,k;w.onmousedown=function(d){b=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(b){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){b=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if((o==null?void 0:o.draggable)!==!1&&we(l),(o==null?void 0:o.resizable)!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"test"});export{qe as changeRobotLang,Pe as destroyTokenListener,Xe as initRobot,je as quickSubmit,Fe as setRouteKey,Ue as toggleRobotVisibility};
129
+ `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=be(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,g])=>g!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,g){let E=typeof p=="number"?`${p}px`:p||g;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,g=880,E=.51,k=1,d=a<=w?E:a>=g?k:E+(k-E)*((a-w)/(g-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),ge(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),g=!1,E,k;w.onmousedown=function(d){g=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(g){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){g=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if(o.draggable!==!1&&we(l),o.resizable!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"test"});export{qe as changeRobotLang,Pe as destroyTokenListener,Xe as initRobot,je as quickSubmit,Fe as setRouteKey,Ue as toggleRobotVisibility};
@@ -1,4 +1,4 @@
1
- (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.ServerRobot={}));})(this,(function(exports){'use strict';var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
1
+ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.ServerRobot={}));})(this,(function(exports){'use strict';var Ee=Object.defineProperty;var q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var te=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&te(e,n,t[n]);if(q)for(var n of q(t))ne.call(t,n)&&te(e,n,t[n]);return e};var ie=(e,t)=>{var n={};for(var c in e)oe.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&q)for(var c of q(e))t.indexOf(c)<0&&ne.call(e,c)&&(n[c]=e[c]);return n};var y;function se(e,t,n){let c=t;if(!y){y=document.createElement("robot-previewer");let h=document.createElement("style");h.setAttribute("robot-previewer",""),h.setAttribute("type","text/css"),h.innerHTML=`
2
2
  robot-previewer {
3
3
  display: none;
4
4
  box-sizing: border-box;
@@ -76,7 +76,7 @@ robot-previewer .___previewer-fade {
76
76
  <div class="___previewer-fade"></div>
77
77
  <img src="" alt="" class="___previewer-img" />
78
78
  <div class="___previewer-close"><span>\xD7</span></div>
79
- `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!1},Re=g(g(g(g({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return g(g(g(g(g(g({},Re),t),n),c),m),h)}function be(){let e=document.createElement("style");e.innerHTML=`
79
+ `,(n||document.body).appendChild(y),y.querySelector(".___previewer-close").addEventListener("click",m),y.querySelector(".___previewer-fade").addEventListener("click",m);}function m(){y.style.display="none",y.querySelector(".___previewer-img").src="";}y.querySelector(".___previewer-img").src=e[c],y.style.display="block";}var M={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},re={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},le="https://scc.lenovo.com/download/static/public?filename=robot.gif",ae={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},ce={display:"none",position:"absolute",backgroundColor:"#fff",color:"black",padding:"5px 7px",width:"200px",height:"75px",top:"-10vh",left:"-13.5vh",borderRadius:"0.8vh",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",zIndex:"999"},pe={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},U={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},de={width:"0",height:"0",borderLeft:"1vh solid transparent",borderRight:"1vh solid transparent",borderBottom:"1vh solid white",position:"absolute",top:"100%",left:"85%",transform:"translateX(-50%) rotate(180deg)"},he={position:"absolute",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"block"},G=1,fe=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],ue="robot__iframe";var Se={env:"prod",robot_auth:"basic"},Te={robot_lang:"en"},Le={chat_enable:"yes",ticket_enable:"yes"},ze={draggable:!0,resizable:!0},Re=b(b(b(b({},Se),Te),Le),ze);function me(e){let l=e,{envConfig:t={},appConfig:n={},featureConfig:c={},uiConfig:m={}}=l,h=ie(l,["envConfig","appConfig","featureConfig","uiConfig"]);return b(b(b(b(b(b({},Re),t),n),c),m),h)}function ge(){let e=document.createElement("style");e.innerHTML=`
80
80
  .resizable-iframe-container {
81
81
  position: relative;
82
82
  display: inline-block;
@@ -121,9 +121,9 @@ robot-previewer .___previewer-fade {
121
121
  left: 0;
122
122
  cursor: n-resize;
123
123
  }
124
- `,document.head.appendChild(e);}function ge(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
125
  <div class="resize-handle rb"></div>
126
126
  <div class="resize-handle lt"></div>
127
127
  <div class="resize-handle l"></div>
128
128
  <div class="resize-handle t"></div>
129
- `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=ge(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,b])=>b!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,b){let E=typeof p=="number"?`${p}px`:p||b;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,b=880,E=.51,k=1,d=a<=w?E:a>=b?k:E+(k-E)*((a-w)/(b-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),be(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),b=!1,E,k;w.onmousedown=function(d){b=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(b){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){b=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if((o==null?void 0:o.draggable)!==!1&&we(l),(o==null?void 0:o.resizable)!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"test"});exports.changeRobotLang=qe;exports.destroyTokenListener=Pe;exports.initRobot=Xe;exports.quickSubmit=je;exports.setRouteKey=Fe;exports.toggleRobotVisibility=Ue;}));
129
+ `,e}function xe(){let e=document.createElement("div");return Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.1)",zIndex:"99999",display:"none"}),e}function ye(e,t,n){let c=!1,m,h,l,v,I,O,N;e.querySelectorAll(".resize-handle").forEach(S=>{S.addEventListener("mousedown",x=>{c=!0,N=S.classList[1],m=x.clientX,h=x.clientY,l=e.offsetWidth,v=e.offsetHeight,I=e.offsetLeft,O=e.offsetTop,n.style.display="block",document.addEventListener("mousemove",$),document.addEventListener("mouseup",Y);});});function $(S){if(c){let x=S.clientX-m,T=S.clientY-h,L=400,z=600,i=1100,r=720,o,s,f,u;switch(N){case"rb":o=Math.min(Math.max(l+x,L),i),s=Math.min(Math.max(v+T,z),r),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"lt":o=Math.min(Math.max(l-x,L),i),s=Math.min(Math.max(v-T,z),r),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.width=`${o}px`,e.style.height=`${s}px`;break;case"l":o=Math.min(Math.max(l-x,L),i),o>L&&o<i&&(f=I+x,e.style.left=`${f}px`),e.style.width=`${o}px`;break;case"t":s=Math.min(Math.max(v-T,z),r),s>z&&s<r&&(u=O+T,e.style.top=`${u}px`),e.style.height=`${s}px`;break}t.style.width=e.style.width,t.style.height=e.style.height;}}function Y(){c=!1,n.style.display="none",document.removeEventListener("mousemove",$),document.removeEventListener("mouseup",Y);}}function _e(e,t){new ResizeObserver(t).observe(e);}var P;function ve({env:e="prod"}={}){if(P)return P;let t=document.createElement("iframe"),n=be(),c=!1,m=!0,h,l,v;function I(i,r){let o=me(r);if(c){console.warn("Robot has been initialized, please do not initialize it again.");return}let s=M.prod;e==="prod"?o.env==="test"?s=M.test:o.env==="local"&&(s=M.local):e==="test"&&(s=M.test,o.env==="local"&&(s=M.local)),c=!0,typeof i=="string"?h=document.querySelector(i):i instanceof HTMLElement&&(h=i),l=document.createElement("robot-parent"),l.id=ue,Object.assign(l.style,re),(h||document.body).appendChild(l);let f=document.createElement("img");f.src=o.icon||le,f.setAttribute("alt","IT Support"),Object.assign(f.style,ae);let u=L();z(f,u),l.appendChild(f),l.appendChild(u);try{let p=Object.fromEntries(Object.entries({appKey:o.robot_appKey,secret:o.robot_secret,userKey:o.robot_userKey,initLang:o.robot_lang,authMethod:o.robot_auth,chatServiceId:o.chat_serviceId,chatEnable:o.chat_enable,ticketEnable:o.ticket_enable,appTitle:o.app_title,appName:o.app_name}).filter(([w,g])=>g!=null)),a=new URLSearchParams(p);t.src=`${s}?${a.toString()}`,t.frameBorder="0",t.id="robot__iframe",t.title="Ticket Assistant",t.scrolling="no",t.allowTransparency="true",t.allow="autoplay",t.display="none",Object.assign(t.style,he);}catch(p){console.error(p);}function B(p,a,w,g){let E=typeof p=="number"?`${p}px`:p||g;return Math.max(a,Math.min(w,Number.parseInt(E)))}let V=B(o.iframe_width,400,1100,"450px"),J=B(o.iframe_height,600,720,"605px");t.style.width=`${V}px`,t.style.height=`${J}px`,n.style.width=t.style.width,n.style.height=t.style.height,n.style.display="none",n.appendChild(t);let X=(p=!1)=>{p||(l.style.top="",l.style.left="");let a=window.innerHeight,w=450,g=880,E=.51,k=1,d=a<=w?E:a>=g?k:E+(k-E)*((a-w)/(g-w)),W=t.offsetWidth||V,A=t.offsetHeight||J;n.style.transform=`scale3d(${d}, ${d}, 1)`,n.style.top=`${-40*d-A+A*(1-d)/2}px`,n.style.left=`${10*d-W+W*(1-d)/2}px`;let _=Number.parseInt(u.style.height||"0"),R=Number.parseInt(u.style.width||"0");u.style.transform=`scale3d(${d}, ${d}, 1)`,u.style.top=`${-10*d-_+_*(1-d)/2}px`,u.style.left=`${40*d-R+R*(1-d)/2}px`;};X(!1),l.appendChild(n),ge(),_e(t,()=>{X(!0);}),window.addEventListener("resize",()=>{X(!1);});function we(p){let a=p,w=a.querySelector("img"),g=!1,E,k;w.onmousedown=function(d){g=!0,E=d.clientX-a.offsetLeft,k=d.clientY-a.offsetTop,v=!1;let W=d.clientX,A=d.clientY;return document.onmousemove=function(_){if(g){let R=_.clientX-E,j=_.clientY-k;a.style.left=`${R}px`,a.style.top=`${j}px`;let F=Math.abs(_.clientX-W),D=Math.abs(_.clientY-A);(F>G||D>G)&&(v=!0);}},document.onmouseup=function(){g=!1,document.onmousemove=null,document.onmouseup=null;let _=document.body.clientWidth,R=document.body.clientHeight,j=a.offsetWidth,F=a.offsetHeight,D=0,Q=0,Z=_-j/2,ee=R-F/2,C=Number.parseInt(a.style.left),H=Number.parseInt(a.style.top);C<D?C=D:C>Z&&(C=Z),H<Q?H=Q:H>ee&&(H=ee),a.style.left=`${C}px`,a.style.top=`${H}px`;},!1};}if(o.draggable!==!1&&we(l),o.resizable!==!1){let p=xe();n.appendChild(p),t.classList.add("resizable-iframe"),ye(n,t,p);}else n.querySelectorAll(".resize-handle").forEach(a=>{a.style.cursor="default";});window.addEventListener("message",p=>{p.data&&p.data.type==="childClose"&&(n.style.display="none");});}function O(i){t.contentWindow.postMessage({type:"changeRouteKey",routeKey:i},"*");}function N(i,r="",o="",s=fe){t.contentWindow.postMessage({type:"quickSubmitTicket",issue:i,issueDescription:r,customData:o,cursorPositionStrArr:s},"*"),n.style.display="block",m=!1;}function K(i){t.contentWindow.postMessage({type:"changeLang",lang:i},"*");}let $=()=>{let i=r=>{var s;let{data:o}=r;o.type==="requestToken"?S():o.type==="viewImages"&&se(o.images||[],(s=o.index)!=null?s:0,l);};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i);}},Y=(i,r,o="*")=>{i?i.postMessage(r,o):console.error("postMessage Error: targetWindow is not exist!");},S=()=>{var i,r;t&&Y(t.contentWindow,{type:"basicToken",token:(r=window.__BASIC_COMMON_TOKEN__)!=null?r:(i=window.localStorage)==null?void 0:i.getItem("__BASIC_COMMON_TOKEN__")},"*");};function x(i){l?l.style.display=i?"inline-block":"none":console.error("Robot isn't initialized yet!");}let T=$();function L(){let i=document.createElement("div");Object.assign(i.style,ce);let r=document.createElement("div");r.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(r.style,pe),i.appendChild(r);let o=document.createElement("div");o.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(o.style,U),i.appendChild(o);let s=document.createElement("div");s.textContent="Open a ticket for more help.",Object.assign(s.style,U),i.appendChild(s);let f=document.createElement("div");return Object.assign(f.style,de),i.appendChild(f),i}function z(i,r){i.addEventListener("mouseover",()=>{n.style.display!=="block"&&(r.style.display="block");}),i.addEventListener("mouseout",()=>{r.style.display="none";}),i.addEventListener("click",()=>{v||(n.style.display==="none"?(n.style.display="block",r.style.display="none",m&&(t.contentWindow.postMessage({type:"firstOpen"},"*"),m=!1)):(n.style.display="none",t.contentWindow.postMessage({type:"parentClose"},"*")));});}return P={changeRobotLang:K,destroyTokenListener:T,initRobot:I,quickSubmit:N,setRouteKey:O,toggleRobotVisibility:x},P}var {changeRobotLang:qe,destroyTokenListener:Pe,initRobot:Xe,quickSubmit:je,setRouteKey:Fe,toggleRobotVisibility:Ue}=ve({env:"test"});exports.changeRobotLang=qe;exports.destroyTokenListener=Pe;exports.initRobot=Xe;exports.quickSubmit=je;exports.setRouteKey=Fe;exports.toggleRobotVisibility=Ue;}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gsc-basic/robot-sdk",
3
3
  "type": "module",
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "description": "GSC Team Ticket Robot SDK",
6
6
  "author": "wangll47 <wangll47@lenovo.com>",
7
7
  "license": "UNLICENSED",