samandesk 1.0.11 → 1.0.12

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.
@@ -6,8 +6,8 @@ const a = document.createElement("iframe"), m = {
6
6
  function p() {
7
7
  return m;
8
8
  }
9
- function u(n) {
10
- l = n;
9
+ function u(o) {
10
+ l = o;
11
11
  }
12
12
  function f() {
13
13
  return l;
@@ -15,35 +15,35 @@ function f() {
15
15
  function c() {
16
16
  a.src = "";
17
17
  }
18
- function d(n) {
19
- a.src = n;
18
+ function d(o) {
19
+ a.src = o;
20
20
  }
21
21
  function s() {
22
22
  return a;
23
23
  }
24
- const h = new Event("ready"), g = new Event("open"), w = new Event("close");
24
+ const h = new Event("ready"), w = new Event("open"), g = new Event("close");
25
25
  function y() {
26
26
  return h;
27
27
  }
28
28
  function E() {
29
- return g;
29
+ return w;
30
30
  }
31
31
  function x() {
32
- return w;
32
+ return g;
33
33
  }
34
- function k(n) {
34
+ function k(o) {
35
35
  window.addEventListener("message", (e) => {
36
36
  if (!e.data.from || e.data.from !== "SamanDesk")
37
37
  return;
38
38
  let t = !1;
39
39
  console.log(`message from (${e.origin})`, e);
40
40
  try {
41
- n[e.data.action](e.data.data), t = !0;
41
+ o[e.data.action](e.data.data), t = !0;
42
42
  } catch {
43
43
  console.error("error while run event action");
44
44
  }
45
- const o = e.data, r = o.id, i = p();
46
- r in i.promises ? (i.promises[r](o), delete i.promises[r]) : t || console.error("Message from outside of frame is invalid");
45
+ const n = e.data, r = n.id, i = p();
46
+ r in i.promises ? (i.promises[r](n), delete i.promises[r]) : t || console.error("Message from outside of frame is invalid");
47
47
  });
48
48
  }
49
49
  class v {
@@ -65,8 +65,8 @@ class S {
65
65
  */
66
66
  async init(e) {
67
67
  new v().init();
68
- const o = s();
69
- d(`https://samandesk.com/setup-interoperation/${e}`), o.width = "0", document.body.appendChild(o);
68
+ const n = s();
69
+ d(`https://samandesk.com/setup-interoperation/${e}`), n.width = "0", n.style.width = "0", document.body.appendChild(n);
70
70
  }
71
71
  /**
72
72
  * استایل مربوط به آیفریم را تنظیم می‌کند
@@ -97,8 +97,8 @@ class S {
97
97
  * این تابع آیفریم را باز می‌کند.
98
98
  */
99
99
  open(e) {
100
- const t = s(), o = e.link || `https://samandesk.com/department-selection?token=${f()}`;
101
- d(o), this.setStyle(e.fullScreen), document.body.appendChild(t), window.dispatchEvent(E());
100
+ const t = s(), n = e.link || `https://samandesk.com/department-selection?token=${f()}`;
101
+ d(n), this.setStyle(e.fullScreen), document.body.appendChild(t), window.dispatchEvent(E());
102
102
  }
103
103
  }
104
104
  export {
@@ -1 +1 @@
1
- (function(s,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(s=typeof globalThis<"u"?globalThis:s||self,i(s.SamanDesk={}))})(this,function(s){"use strict";let i;const a=document.createElement("iframe"),m={count:0,promises:{}};function p(){return m}function u(n){i=n}function h(){return i}function l(){a.src=""}function f(n){a.src=n}function r(){return a}const y=new Event("ready"),g=new Event("open"),w=new Event("close");function E(){return y}function x(){return g}function k(){return w}function b(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.data),t=!0}catch{console.error("error while run event action")}const o=e.data,d=o.id,c=p();d in c.promises?(c.promises[d](o),delete c.promises[d]):t||console.error("Message from outside of frame is invalid")})}class v{async init(){b(this)}setToken(e){u(e.token),l(),window.dispatchEvent(E())}close(){l(),document.body.removeChild(r()),window.dispatchEvent(k())}}class S{async init(e){new v().init();const o=r();f(`https://samandesk.com/setup-interoperation/${e}`),o.width="0",document.body.appendChild(o)}setStyle(e){const t=r();t.style.position="fixed",t.style.zIndex="1000",e?(Object.assign(t.style,{bottom:"0",left:"0",top:"0",right:"0"}),t.width="100%",t.height="100%"):Object.assign(t.style,{top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",maxWidth:"450px",boxShadow:"0px 0px 100px 0px rgba(0,0,0,0.48)",borderRadius:"24px",height:"100%",maxHeight:"660px"})}open(e){const t=r(),o=e.link||`https://samandesk.com/department-selection?token=${h()}`;f(o),this.setStyle(e.fullScreen),document.body.appendChild(t),window.dispatchEvent(x())}}s.SamanDesk=S,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(s=typeof globalThis<"u"?globalThis:s||self,i(s.SamanDesk={}))})(this,function(s){"use strict";let i;const a=document.createElement("iframe"),m={count:0,promises:{}};function p(){return m}function u(o){i=o}function h(){return i}function l(){a.src=""}function f(o){a.src=o}function r(){return a}const y=new Event("ready"),g=new Event("open"),w=new Event("close");function E(){return y}function x(){return g}function k(){return w}function b(o){window.addEventListener("message",e=>{if(!e.data.from||e.data.from!=="SamanDesk")return;let t=!1;console.log(`message from (${e.origin})`,e);try{o[e.data.action](e.data.data),t=!0}catch{console.error("error while run event action")}const n=e.data,d=n.id,c=p();d in c.promises?(c.promises[d](n),delete c.promises[d]):t||console.error("Message from outside of frame is invalid")})}class v{async init(){b(this)}setToken(e){u(e.token),l(),window.dispatchEvent(E())}close(){l(),document.body.removeChild(r()),window.dispatchEvent(k())}}class S{async init(e){new v().init();const n=r();f(`https://samandesk.com/setup-interoperation/${e}`),n.width="0",n.style.width="0",document.body.appendChild(n)}setStyle(e){const t=r();t.style.position="fixed",t.style.zIndex="1000",e?(Object.assign(t.style,{bottom:"0",left:"0",top:"0",right:"0"}),t.width="100%",t.height="100%"):Object.assign(t.style,{top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",maxWidth:"450px",boxShadow:"0px 0px 100px 0px rgba(0,0,0,0.48)",borderRadius:"24px",height:"100%",maxHeight:"660px"})}open(e){const t=r(),n=e.link||`https://samandesk.com/department-selection?token=${h()}`;f(n),this.setStyle(e.fullScreen),document.body.appendChild(t),window.dispatchEvent(x())}}s.SamanDesk=S,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samandesk",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [