@gsc-basic/robot-sdk 1.0.3 → 1.0.5

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 c;function q(E,e,v){let x=e;if(!c){c=document.createElement("robot-previewer");let i=document.createElement("style");i.setAttribute("robot-previewer",""),i.setAttribute("type","text/css"),i.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;
@@ -72,9 +72,58 @@ robot-previewer .___previewer-fade {
72
72
  height: 100vh;
73
73
  z-index: 100000000;
74
74
  }
75
- `,document.head.appendChild(i),c.innerHTML=`
75
+ `,document.head.appendChild(h),y.innerHTML=`
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
- `,(v||document.body).appendChild(c),c.querySelector(".___previewer-close").addEventListener("click",u),c.querySelector(".___previewer-fade").addEventListener("click",u);}function u(){c.style.display="none",c.querySelector(".___previewer-img").src="";}c.querySelector(".___previewer-img").src=E[x],c.style.display="block";}var f={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},F={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},K="https://scc.lenovo.com/download/static/public?filename=robot.gif",X={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},G={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"},U={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},Y={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},V={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)"},B={position:"absolute",top:"-585px",left:"-440px",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"none"},z=1,J=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],Q="robot__iframe";var R;function Z({env:E="prod"}={}){if(R)return R;let e=document.createElement("iframe"),v=!1,x=!0,u,i;function ee(o,t,a=!0){if(v){console.warn("Robot has been initialized, please do not initialize it again.");return}let p=f.prod;E==="prod"?t.env==="test"?p=f.test:t.env==="local"&&(p=f.local):E==="test"&&(p=f.test,t.env==="local"&&(p=f.local)),v=!0,typeof o=="string"?u=document.querySelector(o):o instanceof HTMLElement&&(u=o),i=document.createElement("robot-parent"),i.id=Q,Object.assign(i.style,F),(u||document.body).appendChild(i);let h=document.createElement("img");h.src=t.icon||K,h.setAttribute("alt","IT Support"),Object.assign(h.style,X);let r=document.createElement("div");Object.assign(r.style,G);let I=document.createElement("div");I.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(I.style,U),r.appendChild(I);let O=document.createElement("div");O.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(O.style,Y),r.appendChild(O);let M=document.createElement("div");M.textContent="Open a ticket for more help.",Object.assign(M.style,Y),r.appendChild(M);let H=document.createElement("div");Object.assign(H.style,V),r.appendChild(H),h.addEventListener("mouseover",()=>{e.style.display!=="block"&&(r.style.display="block");}),h.addEventListener("mouseout",()=>{r.style.display="none";}),i.appendChild(h),i.appendChild(r);try{let l=Object.fromEntries(Object.entries({appKey:t.robot_appKey,secret:t.robot_secret,userKey:t.robot_userKey,initLang:t.robot_lang,authMethod:t.robot_auth,chatServiceId:t.chat_serviceId,chatEnable:t.chat_enable,ticketEnable:t.ticket_enable,appTitle:t.app_title,appName:t.app_name}).filter(([_,d])=>d!=null)),n=new URLSearchParams(l);e.src=`${p}?${n.toString()}`,e.frameBorder="0",e.id="robot__iframe",e.title="Ticket Assistant",e.scrolling="no",e.allowTransparency="true",e.allow="autoplay",e.display="none",Object.assign(e.style,B);}catch(l){console.error(l);}let A=typeof t.iframe_width=="number"?`${t.iframe_width}px`:t.iframe_width||"450px",W=typeof t.iframe_height=="number"?`${t.iframe_height}px`:t.iframe_height||"605px";e.style.width=A,e.style.height=W;let $=()=>{i.style.top="",i.style.left="";let l=window.innerHeight,n=450,_=880,d=.51,y=1,s=l<=n?d:l>=_?y:d+(y-d)*((l-n)/(_-n)),S=Number.parseInt(W),T=Number.parseInt(A);e.style.transform=`scale3d(${s}, ${s}, 1)`,e.style.top=`${10*s-S+S*(1-s)/2}px`,e.style.left=`${10*s-T+T*(1-s)/2}px`;let m=Number.parseInt(r.style.height||"0"),b=Number.parseInt(r.style.width||"0");r.style.transform=`scale3d(${s}, ${s}, 1)`,r.style.top=`${-10*s-m+m*(1-s)/2}px`,r.style.left=`${40*s-b+b*(1-s)/2}px`;};i.appendChild(e);let C=!1;h.addEventListener("click",()=>{C||(e.style.display==="none"?(e.style.display="block",r.style.display="none",x&&(e.contentWindow.postMessage({type:"firstOpen"},"*"),x=!1)):(e.style.display="none",e.contentWindow.postMessage({type:"parentClose"},"*")));}),window.addEventListener("resize",$),$();function pe(l){let n=l,_=!1,d,y;n.onmousedown=function(s){_=!0,d=s.clientX-n.offsetLeft,y=s.clientY-n.offsetTop,C=!1;let S=s.clientX,T=s.clientY;return document.onmousemove=function(m){if(_){let b=m.clientX-d,k=m.clientY-y;n.style.left=`${b}px`,n.style.top=`${k}px`;let N=Math.abs(m.clientX-S),L=Math.abs(m.clientY-T);(N>z||L>z)&&(C=!0);}},document.onmouseup=function(){_=!1,document.onmousemove=null,document.onmouseup=null;let m=document.body.clientWidth,b=document.body.clientHeight,k=n.offsetWidth,N=n.offsetHeight,L=0,D=0,P=m-k/2,j=b-N/2,g=Number.parseInt(n.style.left),w=Number.parseInt(n.style.top);g<L?g=L:g>P&&(g=P),w<D?w=D:w>j&&(w=j),n.style.left=`${g}px`,n.style.top=`${w}px`;},!1};}a&&pe(i),window.addEventListener("message",l=>{l.data&&l.data.type==="childClose"&&(e.style.display="none");});}function te(o){e.contentWindow.postMessage({type:"changeRouteKey",routeKey:o},"*");}function oe(o,t="",a="",p=J){e.contentWindow.postMessage({type:"quickSubmitTicket",issue:o,issueDescription:t,customData:a,cursorPositionStrArr:p},"*"),e.style.display="block",x=!1;}function ie(o){e.contentWindow.postMessage({type:"changeLang",lang:o},"*");}let ne=()=>{let o=t=>{var p;let{data:a}=t;a.type==="requestToken"?re():a.type==="viewImages"&&q(a.images||[],(p=a.index)!=null?p:0,i);};return window.addEventListener("message",o),()=>{window.removeEventListener("message",o);}},se=(o,t,a="*")=>{o?o.postMessage(t,a):console.error("postMessage Error: targetWindow is not exist!");},re=()=>{var o,t;e&&se(e.contentWindow,{type:"basicToken",token:(t=window.__BASIC_COMMON_TOKEN__)!=null?t:(o=window.localStorage)==null?void 0:o.getItem("__BASIC_COMMON_TOKEN__")},"*");};function le(o){i?i.style.display=o?"inline-block":"none":console.error("Robot isn't initialized yet!");}let ae=ne();return R={changeRobotLang:ie,destroyTokenListener:ae,initRobot:ee,quickSubmit:oe,setRouteKey:te,toggleRobotVisibility:le},R}var {changeRobotLang:be,destroyTokenListener:fe,initRobot:xe,quickSubmit:ye,setRouteKey:ge,toggleRobotVisibility:we}=Z({env:"prod"});
80
- export{be as changeRobotLang,fe as destroyTokenListener,xe as initRobot,ye as quickSubmit,ge as setRouteKey,we as toggleRobotVisibility};
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=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
+ .resizable-iframe-container {
81
+ position: relative;
82
+ display: inline-block;
83
+ }
84
+ .resizable-iframe {
85
+ width: 100%;
86
+ height: 100%;
87
+ border: none;
88
+ }
89
+ .resize-handle {
90
+ position: absolute;
91
+ background-color: transparent;
92
+ z-index: 99999;
93
+ }
94
+ .resize-handle.rb {
95
+ display: none;
96
+ width: 4px;
97
+ height: 4px;
98
+ right: -8px;
99
+ bottom: -8px;
100
+ cursor: se-resize;
101
+ }
102
+ .resize-handle.lt {
103
+ width: 6px;
104
+ height: 6px;
105
+ left: 1px;
106
+ top: 1px;
107
+ cursor: nw-resize;
108
+ z-index: 100000;
109
+ }
110
+ .resize-handle.l {
111
+ width: 6px;
112
+ height: 100%;
113
+ left: 1px;
114
+ top: 0;
115
+ cursor: w-resize;
116
+ }
117
+ .resize-handle.t {
118
+ width: 100%;
119
+ height: 6px;
120
+ top: 1px;
121
+ left: 0;
122
+ cursor: n-resize;
123
+ }
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
+ <div class="resize-handle rb"></div>
126
+ <div class="resize-handle lt"></div>
127
+ <div class="resize-handle l"></div>
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=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==null?void 0: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 c;function q(E,e,v){let x=e;if(!c){c=document.createElement("robot-previewer");let i=document.createElement("style");i.setAttribute("robot-previewer",""),i.setAttribute("type","text/css"),i.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;
@@ -72,9 +72,58 @@ robot-previewer .___previewer-fade {
72
72
  height: 100vh;
73
73
  z-index: 100000000;
74
74
  }
75
- `,document.head.appendChild(i),c.innerHTML=`
75
+ `,document.head.appendChild(h),y.innerHTML=`
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
- `,(v||document.body).appendChild(c),c.querySelector(".___previewer-close").addEventListener("click",u),c.querySelector(".___previewer-fade").addEventListener("click",u);}function u(){c.style.display="none",c.querySelector(".___previewer-img").src="";}c.querySelector(".___previewer-img").src=E[x],c.style.display="block";}var f={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},F={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},K="https://scc.lenovo.com/download/static/public?filename=robot.gif",X={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},G={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"},U={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},Y={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},V={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)"},B={position:"absolute",top:"-585px",left:"-440px",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"none"},z=1,J=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],Q="robot__iframe";var R;function Z({env:E="prod"}={}){if(R)return R;let e=document.createElement("iframe"),v=!1,x=!0,u,i;function ee(o,t,a=!0){if(v){console.warn("Robot has been initialized, please do not initialize it again.");return}let p=f.prod;E==="prod"?t.env==="test"?p=f.test:t.env==="local"&&(p=f.local):E==="test"&&(p=f.test,t.env==="local"&&(p=f.local)),v=!0,typeof o=="string"?u=document.querySelector(o):o instanceof HTMLElement&&(u=o),i=document.createElement("robot-parent"),i.id=Q,Object.assign(i.style,F),(u||document.body).appendChild(i);let h=document.createElement("img");h.src=t.icon||K,h.setAttribute("alt","IT Support"),Object.assign(h.style,X);let r=document.createElement("div");Object.assign(r.style,G);let I=document.createElement("div");I.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(I.style,U),r.appendChild(I);let O=document.createElement("div");O.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(O.style,Y),r.appendChild(O);let M=document.createElement("div");M.textContent="Open a ticket for more help.",Object.assign(M.style,Y),r.appendChild(M);let H=document.createElement("div");Object.assign(H.style,V),r.appendChild(H),h.addEventListener("mouseover",()=>{e.style.display!=="block"&&(r.style.display="block");}),h.addEventListener("mouseout",()=>{r.style.display="none";}),i.appendChild(h),i.appendChild(r);try{let l=Object.fromEntries(Object.entries({appKey:t.robot_appKey,secret:t.robot_secret,userKey:t.robot_userKey,initLang:t.robot_lang,authMethod:t.robot_auth,chatServiceId:t.chat_serviceId,chatEnable:t.chat_enable,ticketEnable:t.ticket_enable,appTitle:t.app_title,appName:t.app_name}).filter(([_,d])=>d!=null)),n=new URLSearchParams(l);e.src=`${p}?${n.toString()}`,e.frameBorder="0",e.id="robot__iframe",e.title="Ticket Assistant",e.scrolling="no",e.allowTransparency="true",e.allow="autoplay",e.display="none",Object.assign(e.style,B);}catch(l){console.error(l);}let A=typeof t.iframe_width=="number"?`${t.iframe_width}px`:t.iframe_width||"450px",W=typeof t.iframe_height=="number"?`${t.iframe_height}px`:t.iframe_height||"605px";e.style.width=A,e.style.height=W;let $=()=>{i.style.top="",i.style.left="";let l=window.innerHeight,n=450,_=880,d=.51,y=1,s=l<=n?d:l>=_?y:d+(y-d)*((l-n)/(_-n)),S=Number.parseInt(W),T=Number.parseInt(A);e.style.transform=`scale3d(${s}, ${s}, 1)`,e.style.top=`${10*s-S+S*(1-s)/2}px`,e.style.left=`${10*s-T+T*(1-s)/2}px`;let m=Number.parseInt(r.style.height||"0"),b=Number.parseInt(r.style.width||"0");r.style.transform=`scale3d(${s}, ${s}, 1)`,r.style.top=`${-10*s-m+m*(1-s)/2}px`,r.style.left=`${40*s-b+b*(1-s)/2}px`;};i.appendChild(e);let C=!1;h.addEventListener("click",()=>{C||(e.style.display==="none"?(e.style.display="block",r.style.display="none",x&&(e.contentWindow.postMessage({type:"firstOpen"},"*"),x=!1)):(e.style.display="none",e.contentWindow.postMessage({type:"parentClose"},"*")));}),window.addEventListener("resize",$),$();function pe(l){let n=l,_=!1,d,y;n.onmousedown=function(s){_=!0,d=s.clientX-n.offsetLeft,y=s.clientY-n.offsetTop,C=!1;let S=s.clientX,T=s.clientY;return document.onmousemove=function(m){if(_){let b=m.clientX-d,k=m.clientY-y;n.style.left=`${b}px`,n.style.top=`${k}px`;let N=Math.abs(m.clientX-S),L=Math.abs(m.clientY-T);(N>z||L>z)&&(C=!0);}},document.onmouseup=function(){_=!1,document.onmousemove=null,document.onmouseup=null;let m=document.body.clientWidth,b=document.body.clientHeight,k=n.offsetWidth,N=n.offsetHeight,L=0,D=0,P=m-k/2,j=b-N/2,g=Number.parseInt(n.style.left),w=Number.parseInt(n.style.top);g<L?g=L:g>P&&(g=P),w<D?w=D:w>j&&(w=j),n.style.left=`${g}px`,n.style.top=`${w}px`;},!1};}a&&pe(i),window.addEventListener("message",l=>{l.data&&l.data.type==="childClose"&&(e.style.display="none");});}function te(o){e.contentWindow.postMessage({type:"changeRouteKey",routeKey:o},"*");}function oe(o,t="",a="",p=J){e.contentWindow.postMessage({type:"quickSubmitTicket",issue:o,issueDescription:t,customData:a,cursorPositionStrArr:p},"*"),e.style.display="block",x=!1;}function ie(o){e.contentWindow.postMessage({type:"changeLang",lang:o},"*");}let ne=()=>{let o=t=>{var p;let{data:a}=t;a.type==="requestToken"?re():a.type==="viewImages"&&q(a.images||[],(p=a.index)!=null?p:0,i);};return window.addEventListener("message",o),()=>{window.removeEventListener("message",o);}},se=(o,t,a="*")=>{o?o.postMessage(t,a):console.error("postMessage Error: targetWindow is not exist!");},re=()=>{var o,t;e&&se(e.contentWindow,{type:"basicToken",token:(t=window.__BASIC_COMMON_TOKEN__)!=null?t:(o=window.localStorage)==null?void 0:o.getItem("__BASIC_COMMON_TOKEN__")},"*");};function le(o){i?i.style.display=o?"inline-block":"none":console.error("Robot isn't initialized yet!");}let ae=ne();return R={changeRobotLang:ie,destroyTokenListener:ae,initRobot:ee,quickSubmit:oe,setRouteKey:te,toggleRobotVisibility:le},R}var {changeRobotLang:be,destroyTokenListener:fe,initRobot:xe,quickSubmit:ye,setRouteKey:ge,toggleRobotVisibility:we}=Z({env:"prod"});
80
- exports.changeRobotLang=be;exports.destroyTokenListener=fe;exports.initRobot=xe;exports.quickSubmit=ye;exports.setRouteKey=ge;exports.toggleRobotVisibility=we;}));
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=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
+ .resizable-iframe-container {
81
+ position: relative;
82
+ display: inline-block;
83
+ }
84
+ .resizable-iframe {
85
+ width: 100%;
86
+ height: 100%;
87
+ border: none;
88
+ }
89
+ .resize-handle {
90
+ position: absolute;
91
+ background-color: transparent;
92
+ z-index: 99999;
93
+ }
94
+ .resize-handle.rb {
95
+ display: none;
96
+ width: 4px;
97
+ height: 4px;
98
+ right: -8px;
99
+ bottom: -8px;
100
+ cursor: se-resize;
101
+ }
102
+ .resize-handle.lt {
103
+ width: 6px;
104
+ height: 6px;
105
+ left: 1px;
106
+ top: 1px;
107
+ cursor: nw-resize;
108
+ z-index: 100000;
109
+ }
110
+ .resize-handle.l {
111
+ width: 6px;
112
+ height: 100%;
113
+ left: 1px;
114
+ top: 0;
115
+ cursor: w-resize;
116
+ }
117
+ .resize-handle.t {
118
+ width: 100%;
119
+ height: 6px;
120
+ top: 1px;
121
+ left: 0;
122
+ cursor: n-resize;
123
+ }
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
+ <div class="resize-handle rb"></div>
126
+ <div class="resize-handle lt"></div>
127
+ <div class="resize-handle l"></div>
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=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==null?void 0: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 c;function q(E,e,v){let x=e;if(!c){c=document.createElement("robot-previewer");let i=document.createElement("style");i.setAttribute("robot-previewer",""),i.setAttribute("type","text/css"),i.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;
@@ -72,9 +72,58 @@ robot-previewer .___previewer-fade {
72
72
  height: 100vh;
73
73
  z-index: 100000000;
74
74
  }
75
- `,document.head.appendChild(i),c.innerHTML=`
75
+ `,document.head.appendChild(h),y.innerHTML=`
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
- `,(v||document.body).appendChild(c),c.querySelector(".___previewer-close").addEventListener("click",u),c.querySelector(".___previewer-fade").addEventListener("click",u);}function u(){c.style.display="none",c.querySelector(".___previewer-img").src="";}c.querySelector(".___previewer-img").src=E[x],c.style.display="block";}var f={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},F={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},K="https://scc.lenovo.com/download/static/public?filename=robot.gif",X={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},G={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"},U={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},Y={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},V={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)"},B={position:"absolute",top:"-585px",left:"-440px",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"none"},z=1,J=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],Q="robot__iframe";var R;function Z({env:E="prod"}={}){if(R)return R;let e=document.createElement("iframe"),v=!1,x=!0,u,i;function ee(o,t,a=!0){if(v){console.warn("Robot has been initialized, please do not initialize it again.");return}let p=f.prod;E==="prod"?t.env==="test"?p=f.test:t.env==="local"&&(p=f.local):E==="test"&&(p=f.test,t.env==="local"&&(p=f.local)),v=!0,typeof o=="string"?u=document.querySelector(o):o instanceof HTMLElement&&(u=o),i=document.createElement("robot-parent"),i.id=Q,Object.assign(i.style,F),(u||document.body).appendChild(i);let h=document.createElement("img");h.src=t.icon||K,h.setAttribute("alt","IT Support"),Object.assign(h.style,X);let r=document.createElement("div");Object.assign(r.style,G);let I=document.createElement("div");I.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(I.style,U),r.appendChild(I);let O=document.createElement("div");O.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(O.style,Y),r.appendChild(O);let M=document.createElement("div");M.textContent="Open a ticket for more help.",Object.assign(M.style,Y),r.appendChild(M);let H=document.createElement("div");Object.assign(H.style,V),r.appendChild(H),h.addEventListener("mouseover",()=>{e.style.display!=="block"&&(r.style.display="block");}),h.addEventListener("mouseout",()=>{r.style.display="none";}),i.appendChild(h),i.appendChild(r);try{let l=Object.fromEntries(Object.entries({appKey:t.robot_appKey,secret:t.robot_secret,userKey:t.robot_userKey,initLang:t.robot_lang,authMethod:t.robot_auth,chatServiceId:t.chat_serviceId,chatEnable:t.chat_enable,ticketEnable:t.ticket_enable,appTitle:t.app_title,appName:t.app_name}).filter(([_,d])=>d!=null)),n=new URLSearchParams(l);e.src=`${p}?${n.toString()}`,e.frameBorder="0",e.id="robot__iframe",e.title="Ticket Assistant",e.scrolling="no",e.allowTransparency="true",e.allow="autoplay",e.display="none",Object.assign(e.style,B);}catch(l){console.error(l);}let A=typeof t.iframe_width=="number"?`${t.iframe_width}px`:t.iframe_width||"450px",W=typeof t.iframe_height=="number"?`${t.iframe_height}px`:t.iframe_height||"605px";e.style.width=A,e.style.height=W;let $=()=>{i.style.top="",i.style.left="";let l=window.innerHeight,n=450,_=880,d=.51,y=1,s=l<=n?d:l>=_?y:d+(y-d)*((l-n)/(_-n)),S=Number.parseInt(W),T=Number.parseInt(A);e.style.transform=`scale3d(${s}, ${s}, 1)`,e.style.top=`${10*s-S+S*(1-s)/2}px`,e.style.left=`${10*s-T+T*(1-s)/2}px`;let m=Number.parseInt(r.style.height||"0"),b=Number.parseInt(r.style.width||"0");r.style.transform=`scale3d(${s}, ${s}, 1)`,r.style.top=`${-10*s-m+m*(1-s)/2}px`,r.style.left=`${40*s-b+b*(1-s)/2}px`;};i.appendChild(e);let C=!1;h.addEventListener("click",()=>{C||(e.style.display==="none"?(e.style.display="block",r.style.display="none",x&&(e.contentWindow.postMessage({type:"firstOpen"},"*"),x=!1)):(e.style.display="none",e.contentWindow.postMessage({type:"parentClose"},"*")));}),window.addEventListener("resize",$),$();function pe(l){let n=l,_=!1,d,y;n.onmousedown=function(s){_=!0,d=s.clientX-n.offsetLeft,y=s.clientY-n.offsetTop,C=!1;let S=s.clientX,T=s.clientY;return document.onmousemove=function(m){if(_){let b=m.clientX-d,k=m.clientY-y;n.style.left=`${b}px`,n.style.top=`${k}px`;let N=Math.abs(m.clientX-S),L=Math.abs(m.clientY-T);(N>z||L>z)&&(C=!0);}},document.onmouseup=function(){_=!1,document.onmousemove=null,document.onmouseup=null;let m=document.body.clientWidth,b=document.body.clientHeight,k=n.offsetWidth,N=n.offsetHeight,L=0,D=0,P=m-k/2,j=b-N/2,g=Number.parseInt(n.style.left),w=Number.parseInt(n.style.top);g<L?g=L:g>P&&(g=P),w<D?w=D:w>j&&(w=j),n.style.left=`${g}px`,n.style.top=`${w}px`;},!1};}a&&pe(i),window.addEventListener("message",l=>{l.data&&l.data.type==="childClose"&&(e.style.display="none");});}function te(o){e.contentWindow.postMessage({type:"changeRouteKey",routeKey:o},"*");}function oe(o,t="",a="",p=J){e.contentWindow.postMessage({type:"quickSubmitTicket",issue:o,issueDescription:t,customData:a,cursorPositionStrArr:p},"*"),e.style.display="block",x=!1;}function ie(o){e.contentWindow.postMessage({type:"changeLang",lang:o},"*");}let ne=()=>{let o=t=>{var p;let{data:a}=t;a.type==="requestToken"?re():a.type==="viewImages"&&q(a.images||[],(p=a.index)!=null?p:0,i);};return window.addEventListener("message",o),()=>{window.removeEventListener("message",o);}},se=(o,t,a="*")=>{o?o.postMessage(t,a):console.error("postMessage Error: targetWindow is not exist!");},re=()=>{var o,t;e&&se(e.contentWindow,{type:"basicToken",token:(t=window.__BASIC_COMMON_TOKEN__)!=null?t:(o=window.localStorage)==null?void 0:o.getItem("__BASIC_COMMON_TOKEN__")},"*");};function le(o){i?i.style.display=o?"inline-block":"none":console.error("Robot isn't initialized yet!");}let ae=ne();return R={changeRobotLang:ie,destroyTokenListener:ae,initRobot:ee,quickSubmit:oe,setRouteKey:te,toggleRobotVisibility:le},R}var {changeRobotLang:be,destroyTokenListener:fe,initRobot:xe,quickSubmit:ye,setRouteKey:ge,toggleRobotVisibility:we}=Z({env:"test"});
80
- export{be as changeRobotLang,fe as destroyTokenListener,xe as initRobot,ye as quickSubmit,ge as setRouteKey,we as toggleRobotVisibility};
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=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
+ .resizable-iframe-container {
81
+ position: relative;
82
+ display: inline-block;
83
+ }
84
+ .resizable-iframe {
85
+ width: 100%;
86
+ height: 100%;
87
+ border: none;
88
+ }
89
+ .resize-handle {
90
+ position: absolute;
91
+ background-color: transparent;
92
+ z-index: 99999;
93
+ }
94
+ .resize-handle.rb {
95
+ display: none;
96
+ width: 4px;
97
+ height: 4px;
98
+ right: -8px;
99
+ bottom: -8px;
100
+ cursor: se-resize;
101
+ }
102
+ .resize-handle.lt {
103
+ width: 6px;
104
+ height: 6px;
105
+ left: 1px;
106
+ top: 1px;
107
+ cursor: nw-resize;
108
+ z-index: 100000;
109
+ }
110
+ .resize-handle.l {
111
+ width: 6px;
112
+ height: 100%;
113
+ left: 1px;
114
+ top: 0;
115
+ cursor: w-resize;
116
+ }
117
+ .resize-handle.t {
118
+ width: 100%;
119
+ height: 6px;
120
+ top: 1px;
121
+ left: 0;
122
+ cursor: n-resize;
123
+ }
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
+ <div class="resize-handle rb"></div>
126
+ <div class="resize-handle lt"></div>
127
+ <div class="resize-handle l"></div>
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=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==null?void 0: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 c;function q(E,e,v){let x=e;if(!c){c=document.createElement("robot-previewer");let i=document.createElement("style");i.setAttribute("robot-previewer",""),i.setAttribute("type","text/css"),i.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;
@@ -72,9 +72,58 @@ robot-previewer .___previewer-fade {
72
72
  height: 100vh;
73
73
  z-index: 100000000;
74
74
  }
75
- `,document.head.appendChild(i),c.innerHTML=`
75
+ `,document.head.appendChild(h),y.innerHTML=`
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
- `,(v||document.body).appendChild(c),c.querySelector(".___previewer-close").addEventListener("click",u),c.querySelector(".___previewer-fade").addEventListener("click",u);}function u(){c.style.display="none",c.querySelector(".___previewer-img").src="";}c.querySelector(".___previewer-img").src=E[x],c.style.display="block";}var f={prod:"https://scc.lenovo.com/robot",test:"https://sccuat.lenovo.com/robot",local:"http://localhost:5174/robot/"},F={display:"inline-block",position:"fixed",bottom:"8vh",right:"2.5vh",zIndex:"100000",width:"5vh",height:"5vh",userSelect:"none",MozUserSelect:"none",msUserSelect:"none"},K="https://scc.lenovo.com/download/static/public?filename=robot.gif",X={width:"100%",height:"110%",cursor:"pointer",userSelect:"none",MozUserSelect:"none",msUserSelect:"none",position:"relative"},G={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"},U={color:"#1d2129",fontWeight:"600",fontSize:"18px",marginBottom:"0.5vh",whiteSpace:"nowrap"},Y={color:"#4e5969",fontSize:"14px",whiteSpace:"nowrap"},V={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)"},B={position:"absolute",top:"-585px",left:"-440px",zIndex:"9999",width:"450px",height:"605px",boxShadow:"0 2px 6px #00000014,0 1px 3px -2px #0000001f,0 4px 12px 4px #0000000d",borderRadius:"10px",display:"none"},z=1,J=["\u3010\u5907\u6CE8\u3011: ","\u3010Comment\u3011: ","\u3010\u5907\u6CE8\u3011:","\u3010Comment\u3011:"],Q="robot__iframe";var R;function Z({env:E="prod"}={}){if(R)return R;let e=document.createElement("iframe"),v=!1,x=!0,u,i;function ee(o,t,a=!0){if(v){console.warn("Robot has been initialized, please do not initialize it again.");return}let p=f.prod;E==="prod"?t.env==="test"?p=f.test:t.env==="local"&&(p=f.local):E==="test"&&(p=f.test,t.env==="local"&&(p=f.local)),v=!0,typeof o=="string"?u=document.querySelector(o):o instanceof HTMLElement&&(u=o),i=document.createElement("robot-parent"),i.id=Q,Object.assign(i.style,F),(u||document.body).appendChild(i);let h=document.createElement("img");h.src=t.icon||K,h.setAttribute("alt","IT Support"),Object.assign(h.style,X);let r=document.createElement("div");Object.assign(r.style,G);let I=document.createElement("div");I.textContent="\u6280\u672F\u652F\u6301(IT Support)",Object.assign(I.style,U),r.appendChild(I);let O=document.createElement("div");O.textContent="\u63D0\u4EA4\u5DE5\u5355\u4EE5\u83B7\u5F97\u66F4\u591A\u5E2E\u52A9\u3002",Object.assign(O.style,Y),r.appendChild(O);let M=document.createElement("div");M.textContent="Open a ticket for more help.",Object.assign(M.style,Y),r.appendChild(M);let H=document.createElement("div");Object.assign(H.style,V),r.appendChild(H),h.addEventListener("mouseover",()=>{e.style.display!=="block"&&(r.style.display="block");}),h.addEventListener("mouseout",()=>{r.style.display="none";}),i.appendChild(h),i.appendChild(r);try{let l=Object.fromEntries(Object.entries({appKey:t.robot_appKey,secret:t.robot_secret,userKey:t.robot_userKey,initLang:t.robot_lang,authMethod:t.robot_auth,chatServiceId:t.chat_serviceId,chatEnable:t.chat_enable,ticketEnable:t.ticket_enable,appTitle:t.app_title,appName:t.app_name}).filter(([_,d])=>d!=null)),n=new URLSearchParams(l);e.src=`${p}?${n.toString()}`,e.frameBorder="0",e.id="robot__iframe",e.title="Ticket Assistant",e.scrolling="no",e.allowTransparency="true",e.allow="autoplay",e.display="none",Object.assign(e.style,B);}catch(l){console.error(l);}let A=typeof t.iframe_width=="number"?`${t.iframe_width}px`:t.iframe_width||"450px",W=typeof t.iframe_height=="number"?`${t.iframe_height}px`:t.iframe_height||"605px";e.style.width=A,e.style.height=W;let $=()=>{i.style.top="",i.style.left="";let l=window.innerHeight,n=450,_=880,d=.51,y=1,s=l<=n?d:l>=_?y:d+(y-d)*((l-n)/(_-n)),S=Number.parseInt(W),T=Number.parseInt(A);e.style.transform=`scale3d(${s}, ${s}, 1)`,e.style.top=`${10*s-S+S*(1-s)/2}px`,e.style.left=`${10*s-T+T*(1-s)/2}px`;let m=Number.parseInt(r.style.height||"0"),b=Number.parseInt(r.style.width||"0");r.style.transform=`scale3d(${s}, ${s}, 1)`,r.style.top=`${-10*s-m+m*(1-s)/2}px`,r.style.left=`${40*s-b+b*(1-s)/2}px`;};i.appendChild(e);let C=!1;h.addEventListener("click",()=>{C||(e.style.display==="none"?(e.style.display="block",r.style.display="none",x&&(e.contentWindow.postMessage({type:"firstOpen"},"*"),x=!1)):(e.style.display="none",e.contentWindow.postMessage({type:"parentClose"},"*")));}),window.addEventListener("resize",$),$();function pe(l){let n=l,_=!1,d,y;n.onmousedown=function(s){_=!0,d=s.clientX-n.offsetLeft,y=s.clientY-n.offsetTop,C=!1;let S=s.clientX,T=s.clientY;return document.onmousemove=function(m){if(_){let b=m.clientX-d,k=m.clientY-y;n.style.left=`${b}px`,n.style.top=`${k}px`;let N=Math.abs(m.clientX-S),L=Math.abs(m.clientY-T);(N>z||L>z)&&(C=!0);}},document.onmouseup=function(){_=!1,document.onmousemove=null,document.onmouseup=null;let m=document.body.clientWidth,b=document.body.clientHeight,k=n.offsetWidth,N=n.offsetHeight,L=0,D=0,P=m-k/2,j=b-N/2,g=Number.parseInt(n.style.left),w=Number.parseInt(n.style.top);g<L?g=L:g>P&&(g=P),w<D?w=D:w>j&&(w=j),n.style.left=`${g}px`,n.style.top=`${w}px`;},!1};}a&&pe(i),window.addEventListener("message",l=>{l.data&&l.data.type==="childClose"&&(e.style.display="none");});}function te(o){e.contentWindow.postMessage({type:"changeRouteKey",routeKey:o},"*");}function oe(o,t="",a="",p=J){e.contentWindow.postMessage({type:"quickSubmitTicket",issue:o,issueDescription:t,customData:a,cursorPositionStrArr:p},"*"),e.style.display="block",x=!1;}function ie(o){e.contentWindow.postMessage({type:"changeLang",lang:o},"*");}let ne=()=>{let o=t=>{var p;let{data:a}=t;a.type==="requestToken"?re():a.type==="viewImages"&&q(a.images||[],(p=a.index)!=null?p:0,i);};return window.addEventListener("message",o),()=>{window.removeEventListener("message",o);}},se=(o,t,a="*")=>{o?o.postMessage(t,a):console.error("postMessage Error: targetWindow is not exist!");},re=()=>{var o,t;e&&se(e.contentWindow,{type:"basicToken",token:(t=window.__BASIC_COMMON_TOKEN__)!=null?t:(o=window.localStorage)==null?void 0:o.getItem("__BASIC_COMMON_TOKEN__")},"*");};function le(o){i?i.style.display=o?"inline-block":"none":console.error("Robot isn't initialized yet!");}let ae=ne();return R={changeRobotLang:ie,destroyTokenListener:ae,initRobot:ee,quickSubmit:oe,setRouteKey:te,toggleRobotVisibility:le},R}var {changeRobotLang:be,destroyTokenListener:fe,initRobot:xe,quickSubmit:ye,setRouteKey:ge,toggleRobotVisibility:we}=Z({env:"test"});
80
- exports.changeRobotLang=be;exports.destroyTokenListener=fe;exports.initRobot=xe;exports.quickSubmit=ye;exports.setRouteKey=ge;exports.toggleRobotVisibility=we;}));
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=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
+ .resizable-iframe-container {
81
+ position: relative;
82
+ display: inline-block;
83
+ }
84
+ .resizable-iframe {
85
+ width: 100%;
86
+ height: 100%;
87
+ border: none;
88
+ }
89
+ .resize-handle {
90
+ position: absolute;
91
+ background-color: transparent;
92
+ z-index: 99999;
93
+ }
94
+ .resize-handle.rb {
95
+ display: none;
96
+ width: 4px;
97
+ height: 4px;
98
+ right: -8px;
99
+ bottom: -8px;
100
+ cursor: se-resize;
101
+ }
102
+ .resize-handle.lt {
103
+ width: 6px;
104
+ height: 6px;
105
+ left: 1px;
106
+ top: 1px;
107
+ cursor: nw-resize;
108
+ z-index: 100000;
109
+ }
110
+ .resize-handle.l {
111
+ width: 6px;
112
+ height: 100%;
113
+ left: 1px;
114
+ top: 0;
115
+ cursor: w-resize;
116
+ }
117
+ .resize-handle.t {
118
+ width: 100%;
119
+ height: 6px;
120
+ top: 1px;
121
+ left: 0;
122
+ cursor: n-resize;
123
+ }
124
+ `,document.head.appendChild(e);}function be(){let e=document.createElement("div");return e.classList.add("resizable-iframe-container"),e.innerHTML=`
125
+ <div class="resize-handle rb"></div>
126
+ <div class="resize-handle lt"></div>
127
+ <div class="resize-handle l"></div>
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=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==null?void 0: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.3",
4
+ "version": "1.0.5",
5
5
  "description": "GSC Team Ticket Robot SDK",
6
6
  "author": "wangll47 <wangll47@lenovo.com>",
7
7
  "license": "UNLICENSED",