samandesk 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/saman-desk.js +6 -5
- package/dist/saman-desk.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/saman-desk.js
CHANGED
|
@@ -26,15 +26,15 @@ function i() {
|
|
|
26
26
|
function k() {
|
|
27
27
|
return u;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function w(n) {
|
|
30
30
|
u = n;
|
|
31
31
|
}
|
|
32
32
|
function a() {
|
|
33
33
|
return h;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const E = new Event("ready"), x = new Event("open"), v = new Event("close");
|
|
36
36
|
function S() {
|
|
37
|
-
return
|
|
37
|
+
return E;
|
|
38
38
|
}
|
|
39
39
|
function C() {
|
|
40
40
|
return x;
|
|
@@ -113,7 +113,8 @@ class $ {
|
|
|
113
113
|
bottom: "0",
|
|
114
114
|
left: "0",
|
|
115
115
|
top: "0",
|
|
116
|
-
right: "0"
|
|
116
|
+
right: "0",
|
|
117
|
+
width: "100%"
|
|
117
118
|
}), t.width = "100%", t.height = "100%") : Object.assign(t.style, {
|
|
118
119
|
top: "50%",
|
|
119
120
|
left: "50%",
|
|
@@ -131,7 +132,7 @@ class $ {
|
|
|
131
132
|
*/
|
|
132
133
|
open(e) {
|
|
133
134
|
const t = i(), o = a();
|
|
134
|
-
|
|
135
|
+
w(e.theme ?? "light");
|
|
135
136
|
const r = e.link || `${m}/department-selection?token=${y()}`;
|
|
136
137
|
l(r), this.setStyle(e.fullScreen), document.body.appendChild(o), document.body.appendChild(t), o.onclick = () => {
|
|
137
138
|
var s;
|
package/dist/saman-desk.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(r=typeof globalThis<"u"?globalThis:r||self,a(r.SamanDesk={}))})(this,function(r){"use strict";let a;const l=document.createElement("iframe");let p;const h=document.createElement("div"),g={count:0,promises:{}};function y(){return g}function b(n){a=n}function k(){return a}function m(){l.src=""}function u(n){l.src=n}function c(){return l}function
|
|
1
|
+
(function(r,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(r=typeof globalThis<"u"?globalThis:r||self,a(r.SamanDesk={}))})(this,function(r){"use strict";let a;const l=document.createElement("iframe");let p;const h=document.createElement("div"),g={count:0,promises:{}};function y(){return g}function b(n){a=n}function k(){return a}function m(){l.src=""}function u(n){l.src=n}function c(){return l}function w(){return p}function E(n){p=n}function d(){return h}const x=new Event("ready"),v=new Event("open"),S=new Event("close");function T(){return x}function C(){return v}function D(){return S}function O(n){window.addEventListener("message",e=>{if(!e.data.from||e.data.from!=="SamanDesk")return;let t=!1;console.log(`message from (${e.origin})`,e);try{n[e.data.action](e.data),t=!0}catch{console.error("error while run event action")}const o=e.data,i=o.id,s=y();i in s.promises?(s.promises[i](o),delete s.promises[i]):t||console.error("Message from outside of frame is invalid")})}function I(n,e,t){var s;const o={from:"SamanDesk",action:t,data:e,id:n};(s=c().contentWindow)==null||s.postMessage(o,"*")}class j{async init(){O(this)}setToken(e){b(e.data.token),m(),window.dispatchEvent(T())}close(){m();const e=d();document.body.removeChild(e),e.onclick=null,document.body.removeChild(c()),window.dispatchEvent(D())}getTheme(e){I(e.id,{theme:w()},e.action)}}const f={}.VITE_DEV_MODE==="1"?"http://localhost:2525":"https://samandesk.com";class R{async init(e){this.interoperation=new j,this.interoperation.init();const t=c(),o=d();u(`${f}/setup-interoperation/${e}`),t.width="0",t.style.width="0",document.body.appendChild(o),document.body.appendChild(t)}setStyle(e){const t=c(),o=d();t.style.position="fixed",t.style.zIndex="1000";const i={position:"fixed",top:"0",bottom:"0",left:"0",right:"0",backgroundColor:"rgba(0,0,0,0.5)",zIndex:"1000"};Object.assign(o.style,i),e?(Object.assign(t.style,{bottom:"0",left:"0",top:"0",right:"0",width:"100%"}),t.width="100%",t.height="100%"):Object.assign(t.style,{top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",maxWidth:"500px",boxShadow:"0px 0px 100px 0px rgba(0,0,0,0.48)",borderRadius:"24px",height:"100%",maxHeight:"660px"})}open(e){const t=c(),o=d();E(e.theme??"light");const i=e.link||`${f}/department-selection?token=${k()}`;u(i),this.setStyle(e.fullScreen),document.body.appendChild(o),document.body.appendChild(t),o.onclick=()=>{var s;(s=this.interoperation)==null||s.close()},window.dispatchEvent(C())}}r.SamanDesk=R,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|