demoway-sdk
Advanced tools
Comparing version 0.0.1 to 0.0.2
export * from './lib/demo-dialog'; | ||
export interface ISDKInitializeOptions { | ||
accessToken: string; | ||
} | ||
export declare function initialize({ accessToken }: ISDKInitializeOptions): void; |
export interface IDemoDialog { | ||
demoId: string; | ||
close(): void; | ||
} | ||
export declare function openDemoDialog(): IDemoDialog; | ||
export declare function openDemoDialog(demoId: string): IDemoDialog; |
374
dist/sdk.js
@@ -1,129 +0,163 @@ | ||
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".demo-dialog-overlay.svelte-h6ixcg{position:fixed;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center}.demo-dialog-container.svelte-h6ixcg{width:80%;height:80%;overflow:visible;position:relative}.demo-dialog-close.svelte-h6ixcg{position:absolute;width:30px;height:30px;border-radius:50%;top:0;right:0;transform:translate(50%,-50%);border-color:transparent}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); | ||
var M = Object.defineProperty; | ||
var P = (e, t, n) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; | ||
var N = (e, t, n) => (P(e, typeof t != "symbol" ? t + "" : t, n), n); | ||
function g() { | ||
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".demo-dialog-overlay.svelte-170r52r{position:fixed;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;top:0;left:0;background-color:#ffffffb3}.demo-dialog-container.svelte-170r52r{width:80%;height:80%;overflow:visible;position:relative}.demo-dialog-content.svelte-170r52r{border:none}.demo-dialog-close.svelte-170r52r{position:absolute;width:30px;height:30px;border-radius:50%;top:0;right:0;transform:translate(50%,-50%);border:none;cursor:pointer;background-color:#333}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})(); | ||
var B = Object.defineProperty; | ||
var F = (e, t, n) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; | ||
var O = (e, t, n) => (F(e, typeof t != "symbol" ? t + "" : t, n), n); | ||
let T = null; | ||
function M(e) { | ||
T = e; | ||
} | ||
function S(e) { | ||
function U() { | ||
if (!T) | ||
throw new Error("sdk is not initialized"); | ||
return T; | ||
} | ||
function p() { | ||
} | ||
function L(e) { | ||
return e(); | ||
} | ||
function j() { | ||
function A() { | ||
return /* @__PURE__ */ Object.create(null); | ||
} | ||
function w(e) { | ||
e.forEach(S); | ||
function $(e) { | ||
e.forEach(L); | ||
} | ||
function E(e) { | ||
function z(e) { | ||
return typeof e == "function"; | ||
} | ||
function T(e, t) { | ||
function G(e, t) { | ||
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function"; | ||
} | ||
let y; | ||
function z(e, t) { | ||
return y || (y = document.createElement("a")), y.href = t, e === y.href; | ||
let v; | ||
function N(e, t) { | ||
return v || (v = document.createElement("a")), v.href = t, e === v.href; | ||
} | ||
function F(e) { | ||
function H(e) { | ||
return Object.keys(e).length === 0; | ||
} | ||
function G(e) { | ||
return e && E(e.destroy) ? e.destroy : g; | ||
function J(e) { | ||
return e && z(e.destroy) ? e.destroy : p; | ||
} | ||
function b(e, t) { | ||
function w(e, t) { | ||
e.appendChild(t); | ||
} | ||
function H(e, t, n) { | ||
function K(e, t, n) { | ||
e.insertBefore(t, n || null); | ||
} | ||
function q(e) { | ||
function P(e) { | ||
e.parentNode && e.parentNode.removeChild(e); | ||
} | ||
function $(e) { | ||
function E(e) { | ||
return document.createElement(e); | ||
} | ||
function J(e) { | ||
function Q(e) { | ||
return document.createTextNode(e); | ||
} | ||
function K() { | ||
return J(" "); | ||
function V() { | ||
return Q(" "); | ||
} | ||
function u(e, t, n) { | ||
function j(e, t, n, o) { | ||
return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o); | ||
} | ||
function l(e, t, n) { | ||
n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n); | ||
} | ||
function L(e) { | ||
function W(e) { | ||
return Array.from(e.childNodes); | ||
} | ||
let D; | ||
function p(e) { | ||
D = e; | ||
function X(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) { | ||
const c = document.createEvent("CustomEvent"); | ||
return c.initCustomEvent(e, n, o, t), c; | ||
} | ||
const _ = [], C = []; | ||
let m = []; | ||
const R = [], Q = /* @__PURE__ */ Promise.resolve(); | ||
let v = !1; | ||
function U() { | ||
v || (v = !0, Q.then(B)); | ||
let b; | ||
function y(e) { | ||
b = e; | ||
} | ||
function k(e) { | ||
m.push(e); | ||
function Y() { | ||
if (!b) | ||
throw new Error("Function called outside component initialization"); | ||
return b; | ||
} | ||
const x = /* @__PURE__ */ new Set(); | ||
let h = 0; | ||
function B() { | ||
if (h !== 0) | ||
function Z() { | ||
const e = Y(); | ||
return (t, n, { cancelable: o = !1 } = {}) => { | ||
const c = e.$$.callbacks[t]; | ||
if (c) { | ||
const i = X(t, n, { cancelable: o }); | ||
return c.slice().forEach((s) => { | ||
s.call(e, i); | ||
}), !i.defaultPrevented; | ||
} | ||
return !0; | ||
}; | ||
} | ||
const _ = [], R = []; | ||
let g = []; | ||
const q = [], ee = /* @__PURE__ */ Promise.resolve(); | ||
let D = !1; | ||
function te() { | ||
D || (D = !0, ee.then(x)); | ||
} | ||
function S(e) { | ||
g.push(e); | ||
} | ||
const I = /* @__PURE__ */ new Set(); | ||
let m = 0; | ||
function x() { | ||
if (m !== 0) | ||
return; | ||
const e = D; | ||
const e = b; | ||
do { | ||
try { | ||
for (; h < _.length; ) { | ||
const t = _[h]; | ||
h++, p(t), V(t.$$); | ||
for (; m < _.length; ) { | ||
const t = _[m]; | ||
m++, y(t), ne(t.$$); | ||
} | ||
} catch (t) { | ||
throw _.length = 0, h = 0, t; | ||
throw _.length = 0, m = 0, t; | ||
} | ||
for (p(null), _.length = 0, h = 0; C.length; ) | ||
C.pop()(); | ||
for (let t = 0; t < m.length; t += 1) { | ||
const n = m[t]; | ||
x.has(n) || (x.add(n), n()); | ||
for (y(null), _.length = 0, m = 0; R.length; ) | ||
R.pop()(); | ||
for (let t = 0; t < g.length; t += 1) { | ||
const n = g[t]; | ||
I.has(n) || (I.add(n), n()); | ||
} | ||
m.length = 0; | ||
g.length = 0; | ||
} while (_.length); | ||
for (; R.length; ) | ||
R.pop()(); | ||
v = !1, x.clear(), p(e); | ||
for (; q.length; ) | ||
q.pop()(); | ||
D = !1, I.clear(), y(e); | ||
} | ||
function V(e) { | ||
function ne(e) { | ||
if (e.fragment !== null) { | ||
e.update(), w(e.before_update); | ||
e.update(), $(e.before_update); | ||
const t = e.dirty; | ||
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(k); | ||
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(S); | ||
} | ||
} | ||
function W(e) { | ||
function oe(e) { | ||
const t = [], n = []; | ||
m.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), m = t; | ||
g.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), g = t; | ||
} | ||
const X = /* @__PURE__ */ new Set(); | ||
function Y(e, t) { | ||
e && e.i && (X.delete(e), e.i(t)); | ||
const re = /* @__PURE__ */ new Set(); | ||
function ce(e, t) { | ||
e && e.i && (re.delete(e), e.i(t)); | ||
} | ||
function Z(e, t, n, o) { | ||
const { fragment: c, after_update: l } = e.$$; | ||
c && c.m(t, n), o || k(() => { | ||
const i = e.$$.on_mount.map(S).filter(E); | ||
e.$$.on_destroy ? e.$$.on_destroy.push(...i) : w(i), e.$$.on_mount = []; | ||
}), l.forEach(k); | ||
function se(e, t, n, o) { | ||
const { fragment: c, after_update: i } = e.$$; | ||
c && c.m(t, n), o || S(() => { | ||
const s = e.$$.on_mount.map(L).filter(z); | ||
e.$$.on_destroy ? e.$$.on_destroy.push(...s) : $(s), e.$$.on_mount = []; | ||
}), i.forEach(S); | ||
} | ||
function ee(e, t) { | ||
function ie(e, t) { | ||
const n = e.$$; | ||
n.fragment !== null && (W(n.after_update), w(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []); | ||
n.fragment !== null && (oe(n.after_update), $(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []); | ||
} | ||
function te(e, t) { | ||
e.$$.dirty[0] === -1 && (_.push(e), U(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31; | ||
function le(e, t) { | ||
e.$$.dirty[0] === -1 && (_.push(e), te(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31; | ||
} | ||
function ne(e, t, n, o, c, l, i, a = [-1]) { | ||
const s = D; | ||
p(e); | ||
function ue(e, t, n, o, c, i, s, h = [-1]) { | ||
const a = b; | ||
y(e); | ||
const r = e.$$ = { | ||
@@ -133,6 +167,6 @@ fragment: null, | ||
// state | ||
props: l, | ||
update: g, | ||
props: i, | ||
update: p, | ||
not_equal: c, | ||
bound: j(), | ||
bound: A(), | ||
// lifecycle | ||
@@ -144,31 +178,31 @@ on_mount: [], | ||
after_update: [], | ||
context: new Map(t.context || (s ? s.$$.context : [])), | ||
context: new Map(t.context || (a ? a.$$.context : [])), | ||
// everything else | ||
callbacks: j(), | ||
dirty: a, | ||
callbacks: A(), | ||
dirty: h, | ||
skip_bound: !1, | ||
root: t.target || s.$$.root | ||
root: t.target || a.$$.root | ||
}; | ||
i && i(r.root); | ||
let f = !1; | ||
if (r.ctx = n ? n(e, t.props || {}, (d, O, ...A) => { | ||
const I = A.length ? A[0] : O; | ||
return r.ctx && c(r.ctx[d], r.ctx[d] = I) && (!r.skip_bound && r.bound[d] && r.bound[d](I), f && te(e, d)), O; | ||
}) : [], r.update(), f = !0, w(r.before_update), r.fragment = o ? o(r.ctx) : !1, t.target) { | ||
s && s(r.root); | ||
let u = !1; | ||
if (r.ctx = n ? n(e, t.props || {}, (f, k, ...d) => { | ||
const C = d.length ? d[0] : k; | ||
return r.ctx && c(r.ctx[f], r.ctx[f] = C) && (!r.skip_bound && r.bound[f] && r.bound[f](C), u && le(e, f)), k; | ||
}) : [], r.update(), u = !0, $(r.before_update), r.fragment = o ? o(r.ctx) : !1, t.target) { | ||
if (t.hydrate) { | ||
const d = L(t.target); | ||
r.fragment && r.fragment.l(d), d.forEach(q); | ||
const f = W(t.target); | ||
r.fragment && r.fragment.l(f), f.forEach(P); | ||
} else | ||
r.fragment && r.fragment.c(); | ||
t.intro && Y(e.$$.fragment), Z(e, t.target, t.anchor, t.customElement), B(); | ||
t.intro && ce(e.$$.fragment), se(e, t.target, t.anchor, t.customElement), x(); | ||
} | ||
p(s); | ||
y(a); | ||
} | ||
class oe { | ||
class ae { | ||
$destroy() { | ||
ee(this, 1), this.$destroy = g; | ||
ie(this, 1), this.$destroy = p; | ||
} | ||
$on(t, n) { | ||
if (!E(n)) | ||
return g; | ||
if (!z(n)) | ||
return p; | ||
const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []); | ||
@@ -181,6 +215,6 @@ return o.push(n), () => { | ||
$set(t) { | ||
this.$$set && !F(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); | ||
this.$$set && !H(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1); | ||
} | ||
} | ||
const re = (e, t) => { | ||
const fe = (e, t) => { | ||
const n = new ResizeObserver(() => { | ||
@@ -195,8 +229,8 @@ const o = e.getBoundingClientRect(); | ||
}; | ||
}, ce = "https://demoway.co"; | ||
function se(e) { | ||
let t, n, o, c, l, i, a, s; | ||
}, de = "https://demoway.co"; | ||
function he(e) { | ||
let t, n, o, c, i, s, h, a; | ||
return { | ||
c() { | ||
t = $("div"), n = $("div"), o = $("iframe"), l = K(), i = $("button"), u( | ||
t = E("div"), n = E("div"), o = E("iframe"), i = V(), s = E("button"), l(o, "class", "demo-dialog-content svelte-170r52r"), l( | ||
o, | ||
@@ -206,3 +240,3 @@ "width", | ||
e[1] | ||
), u( | ||
), l( | ||
o, | ||
@@ -212,16 +246,30 @@ "height", | ||
e[2] | ||
), z(o.src, c = /*src*/ | ||
e[0]) || u(o, "src", c), u(i, "class", "demo-dialog-close svelte-h6ixcg"), u(n, "class", "demo-dialog-container svelte-h6ixcg"), u(t, "class", "demo-dialog-overlay svelte-h6ixcg"); | ||
), l(o, "title", "demo"), N(o.src, c = /*src*/ | ||
e[0]) || l(o, "src", c), o.allowFullscreen = !0, l(o, "allowtransparency", "true"), l(s, "class", "demo-dialog-close svelte-170r52r"), l(n, "class", "demo-dialog-container svelte-170r52r"), l(t, "class", "demo-dialog-overlay svelte-170r52r"), l(t, "role", "button"); | ||
}, | ||
m(r, f) { | ||
H(r, t, f), b(t, n), b(n, o), b(n, l), b(n, i), a || (s = G(re.call( | ||
null, | ||
n, | ||
/*onResize*/ | ||
e[3] | ||
)), a = !0); | ||
m(r, u) { | ||
K(r, t, u), w(t, n), w(n, o), w(n, i), w(n, s), h || (a = [ | ||
j( | ||
s, | ||
"click", | ||
/*onClose*/ | ||
e[4] | ||
), | ||
J(fe.call( | ||
null, | ||
n, | ||
/*onResize*/ | ||
e[3] | ||
)), | ||
j( | ||
t, | ||
"click", | ||
/*onClose*/ | ||
e[4] | ||
) | ||
], h = !0); | ||
}, | ||
p(r, [f]) { | ||
f & /*width*/ | ||
2 && u( | ||
p(r, [u]) { | ||
u & /*width*/ | ||
2 && l( | ||
o, | ||
@@ -231,4 +279,4 @@ "width", | ||
r[1] | ||
), f & /*height*/ | ||
4 && u( | ||
), u & /*height*/ | ||
4 && l( | ||
o, | ||
@@ -238,47 +286,85 @@ "height", | ||
r[2] | ||
), f & /*src*/ | ||
1 && !z(o.src, c = /*src*/ | ||
r[0]) && u(o, "src", c); | ||
), u & /*src*/ | ||
1 && !N(o.src, c = /*src*/ | ||
r[0]) && l(o, "src", c); | ||
}, | ||
i: g, | ||
o: g, | ||
i: p, | ||
o: p, | ||
d(r) { | ||
r && q(t), a = !1, s(); | ||
r && P(t), h = !1, $(a); | ||
} | ||
}; | ||
} | ||
function ie(e, t, n) { | ||
let { demoId: o = "" } = t, c = "", l = 0, i = 0; | ||
function a(s) { | ||
n(1, l = s.width), n(2, i = s.height); | ||
function me(e, t, n) { | ||
const o = Z(); | ||
let { demoId: c = "" } = t, { accessToken: i = "" } = t; | ||
const s = new URLSearchParams(); | ||
s.set("browser", String(!0)), s.set("scale", String(100)); | ||
let h = "", a = "", r = 0, u = 0; | ||
function f(d) { | ||
n(1, r = d.width), n(2, u = d.height); | ||
} | ||
return e.$$set = (s) => { | ||
"demoId" in s && n(4, o = s.demoId); | ||
function k() { | ||
o("close", void 0); | ||
} | ||
return e.$$set = (d) => { | ||
"demoId" in d && n(5, c = d.demoId), "accessToken" in d && n(6, i = d.accessToken); | ||
}, e.$$.update = () => { | ||
e.$$.dirty & /*demoId*/ | ||
16 && n(0, c = `${ce}/demo/${o}`); | ||
}, [c, l, i, a, o]; | ||
e.$$.dirty & /*accessToken*/ | ||
64 && (s.set("access_token", i), n(7, h = s.toString())), e.$$.dirty & /*demoId, queryString*/ | ||
160 && n(0, a = `${de}/demo/${c}?${h}`); | ||
}, [a, r, u, f, k, c, i, h]; | ||
} | ||
class le extends oe { | ||
class _e extends ae { | ||
constructor(t) { | ||
super(), ne(this, t, ie, se, T, { demoId: 4 }); | ||
super(), ue(this, t, me, he, G, { demoId: 5, accessToken: 6 }); | ||
} | ||
get demoId() { | ||
return this.$$.ctx[5]; | ||
} | ||
set demoId(t) { | ||
this.$$set({ demoId: t }), x(); | ||
} | ||
get accessToken() { | ||
return this.$$.ctx[6]; | ||
} | ||
set accessToken(t) { | ||
this.$$set({ accessToken: t }), x(); | ||
} | ||
} | ||
class ue { | ||
constructor() { | ||
N(this, "component", null); | ||
this.component = new le({ | ||
target: document.body | ||
class ge { | ||
constructor(t) { | ||
O(this, "component"); | ||
this.component = new _e({ | ||
target: document.body, | ||
props: { | ||
demoId: t, | ||
accessToken: U() | ||
} | ||
}), this.component.$on("close", () => { | ||
this.close(); | ||
}); | ||
} | ||
get demoId() { | ||
return this.component.demoId; | ||
} | ||
set demoId(t) { | ||
this.component.$set({ | ||
demoId: t | ||
}); | ||
} | ||
close() { | ||
var t; | ||
(t = this.component) == null || t.$destroy(), this.component = null; | ||
(t = this.component) == null || t.$destroy(); | ||
} | ||
} | ||
function de() { | ||
return new ue(); | ||
function ye(e) { | ||
return new ge(e); | ||
} | ||
function be({ accessToken: e }) { | ||
M(e); | ||
} | ||
export { | ||
de as openDemoDialog | ||
be as initialize, | ||
ye as openDemoDialog | ||
}; |
{ | ||
"name": "demoway-sdk", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"type": "module", | ||
@@ -10,2 +10,12 @@ "files": [ | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/sdk.js", | ||
"require": "./dist/sdk.umd.cjs", | ||
"types": "./dist/sdk.d.ts" | ||
} | ||
}, | ||
"module": "./dist/sdk.js", | ||
"main": "./dist/sdk.umd.cjs", | ||
"types": "./dist/sdk.d.ts", | ||
"scripts": { | ||
@@ -12,0 +22,0 @@ "dev": "vite", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23533
13
429
1