demoway-sdk
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -6,2 +6,3 @@ import type { ISDKService } from './lib/service-host'; | ||
accessToken: string; | ||
zIndex: number; | ||
} | ||
@@ -11,3 +12,3 @@ export declare const SERVICE_ENDPOINT: string; | ||
export declare const enableRecord: () => Promise<void>; | ||
export declare function initialize({ accessToken }: ISDKInitializeOptions): Promise<ISDKService>; | ||
export declare function initialize(options: ISDKInitializeOptions): Promise<ISDKService>; | ||
export declare function rageClick(element: HTMLElement, count: number, timeLimit: number): Promise<void>; |
838
dist/sdk.js
@@ -1,25 +0,25 @@ | ||
var C = function(r, n) { | ||
return C = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { | ||
e.__proto__ = t; | ||
} || function(e, t) { | ||
var C = function(e, n) { | ||
return C = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, t) { | ||
r.__proto__ = t; | ||
} || function(r, t) { | ||
for (var i in t) | ||
Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); | ||
}, C(r, n); | ||
Object.prototype.hasOwnProperty.call(t, i) && (r[i] = t[i]); | ||
}, C(e, n); | ||
}; | ||
function Y(r, n) { | ||
function V(e, n) { | ||
if (typeof n != "function" && n !== null) | ||
throw new TypeError("Class extends value " + String(n) + " is not a constructor or null"); | ||
C(r, n); | ||
function e() { | ||
this.constructor = r; | ||
C(e, n); | ||
function r() { | ||
this.constructor = e; | ||
} | ||
r.prototype = n === null ? Object.create(n) : (e.prototype = n.prototype, new e()); | ||
e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r()); | ||
} | ||
function nr(r, n, e, t) { | ||
function ne(e, n, r, t) { | ||
function i(o) { | ||
return o instanceof e ? o : new e(function(u) { | ||
return o instanceof r ? o : new r(function(u) { | ||
u(o); | ||
}); | ||
} | ||
return new (e || (e = Promise))(function(o, u) { | ||
return new (r || (r = Promise))(function(o, u) { | ||
function a(l) { | ||
@@ -42,7 +42,7 @@ try { | ||
} | ||
c((t = t.apply(r, n || [])).next()); | ||
c((t = t.apply(e, n || [])).next()); | ||
}); | ||
} | ||
function W(r, n) { | ||
var e = { label: 0, sent: function() { | ||
function z(e, n) { | ||
var r = { label: 0, sent: function() { | ||
if (o[0] & 1) | ||
@@ -63,3 +63,3 @@ throw o[1]; | ||
throw new TypeError("Generator is already executing."); | ||
for (; u && (u = 0, c[0] && (e = 0)), e; ) | ||
for (; u && (u = 0, c[0] && (r = 0)), r; ) | ||
try { | ||
@@ -74,30 +74,30 @@ if (t = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done) | ||
case 4: | ||
return e.label++, { value: c[1], done: !1 }; | ||
return r.label++, { value: c[1], done: !1 }; | ||
case 5: | ||
e.label++, i = c[1], c = [0]; | ||
r.label++, i = c[1], c = [0]; | ||
continue; | ||
case 7: | ||
c = e.ops.pop(), e.trys.pop(); | ||
c = r.ops.pop(), r.trys.pop(); | ||
continue; | ||
default: | ||
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) { | ||
e = 0; | ||
if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) { | ||
r = 0; | ||
continue; | ||
} | ||
if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) { | ||
e.label = c[1]; | ||
r.label = c[1]; | ||
break; | ||
} | ||
if (c[0] === 6 && e.label < o[1]) { | ||
e.label = o[1], o = c; | ||
if (c[0] === 6 && r.label < o[1]) { | ||
r.label = o[1], o = c; | ||
break; | ||
} | ||
if (o && e.label < o[2]) { | ||
e.label = o[2], e.ops.push(c); | ||
if (o && r.label < o[2]) { | ||
r.label = o[2], r.ops.push(c); | ||
break; | ||
} | ||
o[2] && e.ops.pop(), e.trys.pop(); | ||
o[2] && r.ops.pop(), r.trys.pop(); | ||
continue; | ||
} | ||
c = n.call(r, e); | ||
c = n.call(e, r); | ||
} catch (l) { | ||
@@ -113,10 +113,10 @@ c = [6, l], i = 0; | ||
} | ||
function w(r) { | ||
var n = typeof Symbol == "function" && Symbol.iterator, e = n && r[n], t = 0; | ||
if (e) | ||
return e.call(r); | ||
if (r && typeof r.length == "number") | ||
function w(e) { | ||
var n = typeof Symbol == "function" && Symbol.iterator, r = n && e[n], t = 0; | ||
if (r) | ||
return r.call(e); | ||
if (e && typeof e.length == "number") | ||
return { | ||
next: function() { | ||
return r && t >= r.length && (r = void 0), { value: r && r[t++], done: !r }; | ||
return e && t >= e.length && (e = void 0), { value: e && e[t++], done: !e }; | ||
} | ||
@@ -126,7 +126,7 @@ }; | ||
} | ||
function E(r, n) { | ||
var e = typeof Symbol == "function" && r[Symbol.iterator]; | ||
if (!e) | ||
return r; | ||
var t = e.call(r), i, o = [], u; | ||
function x(e, n) { | ||
var r = typeof Symbol == "function" && e[Symbol.iterator]; | ||
if (!r) | ||
return e; | ||
var t = r.call(e), i, o = [], u; | ||
try { | ||
@@ -139,3 +139,3 @@ for (; (n === void 0 || n-- > 0) && !(i = t.next()).done; ) | ||
try { | ||
i && !i.done && (e = t.return) && e.call(t); | ||
i && !i.done && (r = t.return) && r.call(t); | ||
} finally { | ||
@@ -148,15 +148,15 @@ if (u) | ||
} | ||
function x(r, n, e) { | ||
if (e || arguments.length === 2) | ||
function I(e, n, r) { | ||
if (r || arguments.length === 2) | ||
for (var t = 0, i = n.length, o; t < i; t++) | ||
(o || !(t in n)) && (o || (o = Array.prototype.slice.call(n, 0, t)), o[t] = n[t]); | ||
return r.concat(o || Array.prototype.slice.call(n)); | ||
return e.concat(o || Array.prototype.slice.call(n)); | ||
} | ||
function g(r) { | ||
return this instanceof g ? (this.v = r, this) : new g(r); | ||
function E(e) { | ||
return this instanceof E ? (this.v = e, this) : new E(e); | ||
} | ||
function tr(r, n, e) { | ||
function te(e, n, r) { | ||
if (!Symbol.asyncIterator) | ||
throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var t = e.apply(r, n || []), i, o = []; | ||
var t = r.apply(e, n || []), i, o = []; | ||
return i = {}, u("next"), u("throw"), u("return"), i[Symbol.asyncIterator] = function() { | ||
@@ -180,3 +180,3 @@ return this; | ||
function s(f) { | ||
f.value instanceof g ? Promise.resolve(f.value.v).then(c, l) : y(o[0][2], f); | ||
f.value instanceof E ? Promise.resolve(f.value.v).then(c, l) : y(o[0][2], f); | ||
} | ||
@@ -193,13 +193,13 @@ function c(f) { | ||
} | ||
function or(r) { | ||
function oe(e) { | ||
if (!Symbol.asyncIterator) | ||
throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var n = r[Symbol.asyncIterator], e; | ||
return n ? n.call(r) : (r = typeof w == "function" ? w(r) : r[Symbol.iterator](), e = {}, t("next"), t("throw"), t("return"), e[Symbol.asyncIterator] = function() { | ||
var n = e[Symbol.asyncIterator], r; | ||
return n ? n.call(e) : (e = typeof w == "function" ? w(e) : e[Symbol.iterator](), r = {}, t("next"), t("throw"), t("return"), r[Symbol.asyncIterator] = function() { | ||
return this; | ||
}, e); | ||
}, r); | ||
function t(o) { | ||
e[o] = r[o] && function(u) { | ||
r[o] = e[o] && function(u) { | ||
return new Promise(function(a, s) { | ||
u = r[o](u), i(a, s, u.done, u.value); | ||
u = e[o](u), i(a, s, u.done, u.value); | ||
}); | ||
@@ -214,32 +214,32 @@ }; | ||
} | ||
function d(r) { | ||
return typeof r == "function"; | ||
function d(e) { | ||
return typeof e == "function"; | ||
} | ||
function z(r) { | ||
function W(e) { | ||
var n = function(t) { | ||
Error.call(t), t.stack = new Error().stack; | ||
}, e = r(n); | ||
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e; | ||
}, r = e(n); | ||
return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r; | ||
} | ||
var L = z(function(r) { | ||
return function(e) { | ||
r(this), this.message = e ? e.length + ` errors occurred during unsubscription: | ||
` + e.map(function(t, i) { | ||
var D = W(function(e) { | ||
return function(r) { | ||
e(this), this.message = r ? r.length + ` errors occurred during unsubscription: | ||
` + r.map(function(t, i) { | ||
return i + 1 + ") " + t.toString(); | ||
}).join(` | ||
`) : "", this.name = "UnsubscriptionError", this.errors = e; | ||
`) : "", this.name = "UnsubscriptionError", this.errors = r; | ||
}; | ||
}); | ||
function M(r, n) { | ||
if (r) { | ||
var e = r.indexOf(n); | ||
0 <= e && r.splice(e, 1); | ||
function U(e, n) { | ||
if (e) { | ||
var r = e.indexOf(n); | ||
0 <= r && e.splice(r, 1); | ||
} | ||
} | ||
var H = function() { | ||
function r(n) { | ||
var Y = function() { | ||
function e(n) { | ||
this.initialTeardown = n, this.closed = !1, this._parentage = null, this._finalizers = null; | ||
} | ||
return r.prototype.unsubscribe = function() { | ||
var n, e, t, i, o; | ||
return e.prototype.unsubscribe = function() { | ||
var n, r, t, i, o; | ||
if (!this.closed) { | ||
@@ -259,3 +259,3 @@ this.closed = !0; | ||
try { | ||
s && !s.done && (e = a.return) && e.call(a); | ||
s && !s.done && (r = a.return) && r.call(a); | ||
} finally { | ||
@@ -273,3 +273,3 @@ if (n) | ||
} catch (h) { | ||
o = h instanceof L ? h.errors : [h]; | ||
o = h instanceof D ? h.errors : [h]; | ||
} | ||
@@ -283,5 +283,5 @@ var y = this._finalizers; | ||
try { | ||
K(v); | ||
q(v); | ||
} catch (h) { | ||
o = o ?? [], h instanceof L ? o = x(x([], E(o)), E(h.errors)) : o.push(h); | ||
o = o ?? [], h instanceof D ? o = I(I([], x(o)), x(h.errors)) : o.push(h); | ||
} | ||
@@ -301,11 +301,11 @@ } | ||
if (o) | ||
throw new L(o); | ||
throw new D(o); | ||
} | ||
}, r.prototype.add = function(n) { | ||
var e; | ||
}, e.prototype.add = function(n) { | ||
var r; | ||
if (n && n !== this) | ||
if (this.closed) | ||
K(n); | ||
q(n); | ||
else { | ||
if (n instanceof r) { | ||
if (n instanceof e) { | ||
if (n.closed || n._hasParent(this)) | ||
@@ -315,27 +315,27 @@ return; | ||
} | ||
(this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(n); | ||
(this._finalizers = (r = this._finalizers) !== null && r !== void 0 ? r : []).push(n); | ||
} | ||
}, r.prototype._hasParent = function(n) { | ||
var e = this._parentage; | ||
return e === n || Array.isArray(e) && e.includes(n); | ||
}, r.prototype._addParent = function(n) { | ||
var e = this._parentage; | ||
this._parentage = Array.isArray(e) ? (e.push(n), e) : e ? [e, n] : n; | ||
}, r.prototype._removeParent = function(n) { | ||
var e = this._parentage; | ||
e === n ? this._parentage = null : Array.isArray(e) && M(e, n); | ||
}, r.prototype.remove = function(n) { | ||
var e = this._finalizers; | ||
e && M(e, n), n instanceof r && n._removeParent(this); | ||
}, r.EMPTY = function() { | ||
var n = new r(); | ||
}, e.prototype._hasParent = function(n) { | ||
var r = this._parentage; | ||
return r === n || Array.isArray(r) && r.includes(n); | ||
}, e.prototype._addParent = function(n) { | ||
var r = this._parentage; | ||
this._parentage = Array.isArray(r) ? (r.push(n), r) : r ? [r, n] : n; | ||
}, e.prototype._removeParent = function(n) { | ||
var r = this._parentage; | ||
r === n ? this._parentage = null : Array.isArray(r) && U(r, n); | ||
}, e.prototype.remove = function(n) { | ||
var r = this._finalizers; | ||
r && U(r, n), n instanceof e && n._removeParent(this); | ||
}, e.EMPTY = function() { | ||
var n = new e(); | ||
return n.closed = !0, n; | ||
}(), r; | ||
}(), e; | ||
}(); | ||
H.EMPTY; | ||
function X(r) { | ||
return r instanceof H || r && "closed" in r && d(r.remove) && d(r.add) && d(r.unsubscribe); | ||
Y.EMPTY; | ||
function X(e) { | ||
return e instanceof Y || e && "closed" in e && d(e.remove) && d(e.add) && d(e.unsubscribe); | ||
} | ||
function K(r) { | ||
d(r) ? r() : r.unsubscribe(); | ||
function q(e) { | ||
d(e) ? e() : e.unsubscribe(); | ||
} | ||
@@ -348,46 +348,46 @@ var Z = { | ||
useDeprecatedNextContext: !1 | ||
}, j = { | ||
setTimeout: function(r, n) { | ||
for (var e = [], t = 2; t < arguments.length; t++) | ||
e[t - 2] = arguments[t]; | ||
var i = j.delegate; | ||
return i != null && i.setTimeout ? i.setTimeout.apply(i, x([r, n], E(e))) : setTimeout.apply(void 0, x([r, n], E(e))); | ||
}, M = { | ||
setTimeout: function(e, n) { | ||
for (var r = [], t = 2; t < arguments.length; t++) | ||
r[t - 2] = arguments[t]; | ||
var i = M.delegate; | ||
return i != null && i.setTimeout ? i.setTimeout.apply(i, I([e, n], x(r))) : setTimeout.apply(void 0, I([e, n], x(r))); | ||
}, | ||
clearTimeout: function(r) { | ||
var n = j.delegate; | ||
return ((n == null ? void 0 : n.clearTimeout) || clearTimeout)(r); | ||
clearTimeout: function(e) { | ||
var n = M.delegate; | ||
return ((n == null ? void 0 : n.clearTimeout) || clearTimeout)(e); | ||
}, | ||
delegate: void 0 | ||
}; | ||
function B(r) { | ||
j.setTimeout(function() { | ||
throw r; | ||
function $(e) { | ||
M.setTimeout(function() { | ||
throw e; | ||
}); | ||
} | ||
function F() { | ||
function j() { | ||
} | ||
function ir(r) { | ||
r(); | ||
function ie(e) { | ||
e(); | ||
} | ||
var G = function(r) { | ||
Y(n, r); | ||
function n(e) { | ||
var t = r.call(this) || this; | ||
return t.isStopped = !1, e ? (t.destination = e, X(e) && e.add(t)) : t.destination = sr, t; | ||
var H = function(e) { | ||
V(n, e); | ||
function n(r) { | ||
var t = e.call(this) || this; | ||
return t.isStopped = !1, r ? (t.destination = r, X(r) && r.add(t)) : t.destination = se, t; | ||
} | ||
return n.create = function(e, t, i) { | ||
return new A(e, t, i); | ||
}, n.prototype.next = function(e) { | ||
this.isStopped || this._next(e); | ||
}, n.prototype.error = function(e) { | ||
this.isStopped || (this.isStopped = !0, this._error(e)); | ||
return n.create = function(r, t, i) { | ||
return new O(r, t, i); | ||
}, n.prototype.next = function(r) { | ||
this.isStopped || this._next(r); | ||
}, n.prototype.error = function(r) { | ||
this.isStopped || (this.isStopped = !0, this._error(r)); | ||
}, n.prototype.complete = function() { | ||
this.isStopped || (this.isStopped = !0, this._complete()); | ||
}, n.prototype.unsubscribe = function() { | ||
this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null); | ||
}, n.prototype._next = function(e) { | ||
this.destination.next(e); | ||
}, n.prototype._error = function(e) { | ||
this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null); | ||
}, n.prototype._next = function(r) { | ||
this.destination.next(r); | ||
}, n.prototype._error = function(r) { | ||
try { | ||
this.destination.error(e); | ||
this.destination.error(r); | ||
} finally { | ||
@@ -403,29 +403,29 @@ this.unsubscribe(); | ||
}, n; | ||
}(H), ur = Function.prototype.bind; | ||
function D(r, n) { | ||
return ur.call(r, n); | ||
}(Y), ue = Function.prototype.bind; | ||
function L(e, n) { | ||
return ue.call(e, n); | ||
} | ||
var cr = function() { | ||
function r(n) { | ||
var ce = function() { | ||
function e(n) { | ||
this.partialObserver = n; | ||
} | ||
return r.prototype.next = function(n) { | ||
var e = this.partialObserver; | ||
if (e.next) | ||
return e.prototype.next = function(n) { | ||
var r = this.partialObserver; | ||
if (r.next) | ||
try { | ||
e.next(n); | ||
r.next(n); | ||
} catch (t) { | ||
T(t); | ||
A(t); | ||
} | ||
}, r.prototype.error = function(n) { | ||
var e = this.partialObserver; | ||
if (e.error) | ||
}, e.prototype.error = function(n) { | ||
var r = this.partialObserver; | ||
if (r.error) | ||
try { | ||
e.error(n); | ||
r.error(n); | ||
} catch (t) { | ||
T(t); | ||
A(t); | ||
} | ||
else | ||
T(n); | ||
}, r.prototype.complete = function() { | ||
A(n); | ||
}, e.prototype.complete = function() { | ||
var n = this.partialObserver; | ||
@@ -435,13 +435,13 @@ if (n.complete) | ||
n.complete(); | ||
} catch (e) { | ||
T(e); | ||
} catch (r) { | ||
A(r); | ||
} | ||
}, r; | ||
}(), A = function(r) { | ||
Y(n, r); | ||
function n(e, t, i) { | ||
var o = r.call(this) || this, u; | ||
if (d(e) || !e) | ||
}, e; | ||
}(), O = function(e) { | ||
V(n, e); | ||
function n(r, t, i) { | ||
var o = e.call(this) || this, u; | ||
if (d(r) || !r) | ||
u = { | ||
next: e ?? void 0, | ||
next: r ?? void 0, | ||
error: t ?? void 0, | ||
@@ -452,61 +452,61 @@ complete: i ?? void 0 | ||
var a; | ||
o && Z.useDeprecatedNextContext ? (a = Object.create(e), a.unsubscribe = function() { | ||
o && Z.useDeprecatedNextContext ? (a = Object.create(r), a.unsubscribe = function() { | ||
return o.unsubscribe(); | ||
}, u = { | ||
next: e.next && D(e.next, a), | ||
error: e.error && D(e.error, a), | ||
complete: e.complete && D(e.complete, a) | ||
}) : u = e; | ||
next: r.next && L(r.next, a), | ||
error: r.error && L(r.error, a), | ||
complete: r.complete && L(r.complete, a) | ||
}) : u = r; | ||
} | ||
return o.destination = new cr(u), o; | ||
return o.destination = new ce(u), o; | ||
} | ||
return n; | ||
}(G); | ||
function T(r) { | ||
B(r); | ||
}(H); | ||
function A(e) { | ||
$(e); | ||
} | ||
function ar(r) { | ||
throw r; | ||
function ae(e) { | ||
throw e; | ||
} | ||
var sr = { | ||
var se = { | ||
closed: !0, | ||
next: F, | ||
error: ar, | ||
complete: F | ||
}, _ = function() { | ||
next: j, | ||
error: ae, | ||
complete: j | ||
}, G = function() { | ||
return typeof Symbol == "function" && Symbol.observable || "@@observable"; | ||
}(); | ||
function lr(r) { | ||
return r; | ||
function le(e) { | ||
return e; | ||
} | ||
function fr(r) { | ||
return r.length === 0 ? lr : r.length === 1 ? r[0] : function(e) { | ||
return r.reduce(function(t, i) { | ||
function fe(e) { | ||
return e.length === 0 ? le : e.length === 1 ? e[0] : function(r) { | ||
return e.reduce(function(t, i) { | ||
return i(t); | ||
}, e); | ||
}, r); | ||
}; | ||
} | ||
var S = function() { | ||
function r(n) { | ||
var g = function() { | ||
function e(n) { | ||
n && (this._subscribe = n); | ||
} | ||
return r.prototype.lift = function(n) { | ||
var e = new r(); | ||
return e.source = this, e.operator = n, e; | ||
}, r.prototype.subscribe = function(n, e, t) { | ||
var i = this, o = dr(n) ? n : new A(n, e, t); | ||
return ir(function() { | ||
return e.prototype.lift = function(n) { | ||
var r = new e(); | ||
return r.source = this, r.operator = n, r; | ||
}, e.prototype.subscribe = function(n, r, t) { | ||
var i = this, o = de(n) ? n : new O(n, r, t); | ||
return ie(function() { | ||
var u = i, a = u.operator, s = u.source; | ||
o.add(a ? a.call(o, s) : s ? i._subscribe(o) : i._trySubscribe(o)); | ||
}), o; | ||
}, r.prototype._trySubscribe = function(n) { | ||
}, e.prototype._trySubscribe = function(n) { | ||
try { | ||
return this._subscribe(n); | ||
} catch (e) { | ||
n.error(e); | ||
} catch (r) { | ||
n.error(r); | ||
} | ||
}, r.prototype.forEach = function(n, e) { | ||
}, e.prototype.forEach = function(n, r) { | ||
var t = this; | ||
return e = $(e), new e(function(i, o) { | ||
var u = new A({ | ||
return r = K(r), new r(function(i, o) { | ||
var u = new O({ | ||
next: function(a) { | ||
@@ -524,16 +524,16 @@ try { | ||
}); | ||
}, r.prototype._subscribe = function(n) { | ||
var e; | ||
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(n); | ||
}, r.prototype[_] = function() { | ||
}, e.prototype._subscribe = function(n) { | ||
var r; | ||
return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(n); | ||
}, e.prototype[G] = function() { | ||
return this; | ||
}, r.prototype.pipe = function() { | ||
for (var n = [], e = 0; e < arguments.length; e++) | ||
n[e] = arguments[e]; | ||
return fr(n)(this); | ||
}, r.prototype.toPromise = function(n) { | ||
var e = this; | ||
return n = $(n), new n(function(t, i) { | ||
}, e.prototype.pipe = function() { | ||
for (var n = [], r = 0; r < arguments.length; r++) | ||
n[r] = arguments[r]; | ||
return fe(n)(this); | ||
}, e.prototype.toPromise = function(n) { | ||
var r = this; | ||
return n = K(n), new n(function(t, i) { | ||
var o; | ||
e.subscribe(function(u) { | ||
r.subscribe(function(u) { | ||
return o = u; | ||
@@ -546,25 +546,25 @@ }, function(u) { | ||
}); | ||
}, r.create = function(n) { | ||
return new r(n); | ||
}, r; | ||
}, e.create = function(n) { | ||
return new e(n); | ||
}, e; | ||
}(); | ||
function $(r) { | ||
function K(e) { | ||
var n; | ||
return (n = r ?? Z.Promise) !== null && n !== void 0 ? n : Promise; | ||
return (n = e ?? Z.Promise) !== null && n !== void 0 ? n : Promise; | ||
} | ||
function hr(r) { | ||
return r && d(r.next) && d(r.error) && d(r.complete); | ||
function he(e) { | ||
return e && d(e.next) && d(e.error) && d(e.complete); | ||
} | ||
function dr(r) { | ||
return r && r instanceof G || hr(r) && X(r); | ||
function de(e) { | ||
return e && e instanceof H || he(e) && X(e); | ||
} | ||
function yr(r) { | ||
return d(r == null ? void 0 : r.lift); | ||
function ye(e) { | ||
return d(e == null ? void 0 : e.lift); | ||
} | ||
function k(r) { | ||
function R(e) { | ||
return function(n) { | ||
if (yr(n)) | ||
return n.lift(function(e) { | ||
if (ye(n)) | ||
return n.lift(function(r) { | ||
try { | ||
return r(e, this); | ||
return e(r, this); | ||
} catch (t) { | ||
@@ -577,9 +577,9 @@ this.error(t); | ||
} | ||
function I(r, n, e, t, i) { | ||
return new pr(r, n, e, t, i); | ||
function P(e, n, r, t, i) { | ||
return new pe(e, n, r, t, i); | ||
} | ||
var pr = function(r) { | ||
Y(n, r); | ||
function n(e, t, i, o, u, a) { | ||
var s = r.call(this, e) || this; | ||
var pe = function(e) { | ||
V(n, e); | ||
function n(r, t, i, o, u, a) { | ||
var s = e.call(this, r) || this; | ||
return s.onFinalize = u, s.shouldUnsubscribe = a, s._next = t ? function(c) { | ||
@@ -589,68 +589,68 @@ try { | ||
} catch (l) { | ||
e.error(l); | ||
r.error(l); | ||
} | ||
} : r.prototype._next, s._error = o ? function(c) { | ||
} : e.prototype._next, s._error = o ? function(c) { | ||
try { | ||
o(c); | ||
} catch (l) { | ||
e.error(l); | ||
r.error(l); | ||
} finally { | ||
this.unsubscribe(); | ||
} | ||
} : r.prototype._error, s._complete = i ? function() { | ||
} : e.prototype._error, s._complete = i ? function() { | ||
try { | ||
i(); | ||
} catch (c) { | ||
e.error(c); | ||
r.error(c); | ||
} finally { | ||
this.unsubscribe(); | ||
} | ||
} : r.prototype._complete, s; | ||
} : e.prototype._complete, s; | ||
} | ||
return n.prototype.unsubscribe = function() { | ||
var e; | ||
var r; | ||
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { | ||
var t = this.closed; | ||
r.prototype.unsubscribe.call(this), !t && ((e = this.onFinalize) === null || e === void 0 || e.call(this)); | ||
e.prototype.unsubscribe.call(this), !t && ((r = this.onFinalize) === null || r === void 0 || r.call(this)); | ||
} | ||
}, n; | ||
}(G), N = function(r) { | ||
return r && typeof r.length == "number" && typeof r != "function"; | ||
}(H), B = function(e) { | ||
return e && typeof e.length == "number" && typeof e != "function"; | ||
}; | ||
function vr(r) { | ||
return d(r == null ? void 0 : r.then); | ||
function ve(e) { | ||
return d(e == null ? void 0 : e.then); | ||
} | ||
function mr(r) { | ||
return d(r[_]); | ||
function me(e) { | ||
return d(e[G]); | ||
} | ||
function br(r) { | ||
return Symbol.asyncIterator && d(r == null ? void 0 : r[Symbol.asyncIterator]); | ||
function be(e) { | ||
return Symbol.asyncIterator && d(e == null ? void 0 : e[Symbol.asyncIterator]); | ||
} | ||
function wr(r) { | ||
return new TypeError("You provided " + (r !== null && typeof r == "object" ? "an invalid object" : "'" + r + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); | ||
function we(e) { | ||
return new TypeError("You provided " + (e !== null && typeof e == "object" ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); | ||
} | ||
function Sr() { | ||
function Se() { | ||
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator; | ||
} | ||
var gr = Sr(); | ||
function Er(r) { | ||
return d(r == null ? void 0 : r[gr]); | ||
var ge = Se(); | ||
function Ee(e) { | ||
return d(e == null ? void 0 : e[ge]); | ||
} | ||
function xr(r) { | ||
return tr(this, arguments, function() { | ||
var e, t, i, o; | ||
return W(this, function(u) { | ||
function xe(e) { | ||
return te(this, arguments, function() { | ||
var r, t, i, o; | ||
return z(this, function(u) { | ||
switch (u.label) { | ||
case 0: | ||
e = r.getReader(), u.label = 1; | ||
r = e.getReader(), u.label = 1; | ||
case 1: | ||
u.trys.push([1, , 9, 10]), u.label = 2; | ||
case 2: | ||
return [4, g(e.read())]; | ||
return [4, E(r.read())]; | ||
case 3: | ||
return t = u.sent(), i = t.value, o = t.done, o ? [4, g(void 0)] : [3, 5]; | ||
return t = u.sent(), i = t.value, o = t.done, o ? [4, E(void 0)] : [3, 5]; | ||
case 4: | ||
return [2, u.sent()]; | ||
case 5: | ||
return [4, g(i)]; | ||
return [4, E(i)]; | ||
case 6: | ||
@@ -663,3 +663,3 @@ return [4, u.sent()]; | ||
case 9: | ||
return e.releaseLock(), [7]; | ||
return r.releaseLock(), [7]; | ||
case 10: | ||
@@ -671,53 +671,53 @@ return [2]; | ||
} | ||
function Ir(r) { | ||
return d(r == null ? void 0 : r.getReader); | ||
function Ie(e) { | ||
return d(e == null ? void 0 : e.getReader); | ||
} | ||
function q(r) { | ||
if (r instanceof S) | ||
return r; | ||
if (r != null) { | ||
if (mr(r)) | ||
return Pr(r); | ||
if (N(r)) | ||
return Tr(r); | ||
if (vr(r)) | ||
return Ar(r); | ||
if (br(r)) | ||
return rr(r); | ||
if (Er(r)) | ||
return Or(r); | ||
if (Ir(r)) | ||
return Rr(r); | ||
function _(e) { | ||
if (e instanceof g) | ||
return e; | ||
if (e != null) { | ||
if (me(e)) | ||
return Pe(e); | ||
if (B(e)) | ||
return Te(e); | ||
if (ve(e)) | ||
return Ae(e); | ||
if (be(e)) | ||
return N(e); | ||
if (Ee(e)) | ||
return Oe(e); | ||
if (Ie(e)) | ||
return ke(e); | ||
} | ||
throw wr(r); | ||
throw we(e); | ||
} | ||
function Pr(r) { | ||
return new S(function(n) { | ||
var e = r[_](); | ||
if (d(e.subscribe)) | ||
return e.subscribe(n); | ||
function Pe(e) { | ||
return new g(function(n) { | ||
var r = e[G](); | ||
if (d(r.subscribe)) | ||
return r.subscribe(n); | ||
throw new TypeError("Provided object does not correctly implement Symbol.observable"); | ||
}); | ||
} | ||
function Tr(r) { | ||
return new S(function(n) { | ||
for (var e = 0; e < r.length && !n.closed; e++) | ||
n.next(r[e]); | ||
function Te(e) { | ||
return new g(function(n) { | ||
for (var r = 0; r < e.length && !n.closed; r++) | ||
n.next(e[r]); | ||
n.complete(); | ||
}); | ||
} | ||
function Ar(r) { | ||
return new S(function(n) { | ||
r.then(function(e) { | ||
n.closed || (n.next(e), n.complete()); | ||
}, function(e) { | ||
return n.error(e); | ||
}).then(null, B); | ||
function Ae(e) { | ||
return new g(function(n) { | ||
e.then(function(r) { | ||
n.closed || (n.next(r), n.complete()); | ||
}, function(r) { | ||
return n.error(r); | ||
}).then(null, $); | ||
}); | ||
} | ||
function Or(r) { | ||
return new S(function(n) { | ||
var e, t; | ||
function Oe(e) { | ||
return new g(function(n) { | ||
var r, t; | ||
try { | ||
for (var i = w(r), o = i.next(); !o.done; o = i.next()) { | ||
for (var i = w(e), o = i.next(); !o.done; o = i.next()) { | ||
var u = o.value; | ||
@@ -728,3 +728,3 @@ if (n.next(u), n.closed) | ||
} catch (a) { | ||
e = { error: a }; | ||
r = { error: a }; | ||
} finally { | ||
@@ -734,4 +734,4 @@ try { | ||
} finally { | ||
if (e) | ||
throw e.error; | ||
if (r) | ||
throw r.error; | ||
} | ||
@@ -742,22 +742,22 @@ } | ||
} | ||
function rr(r) { | ||
return new S(function(n) { | ||
kr(r, n).catch(function(e) { | ||
return n.error(e); | ||
function N(e) { | ||
return new g(function(n) { | ||
Re(e, n).catch(function(r) { | ||
return n.error(r); | ||
}); | ||
}); | ||
} | ||
function Rr(r) { | ||
return rr(xr(r)); | ||
function ke(e) { | ||
return N(xe(e)); | ||
} | ||
function kr(r, n) { | ||
var e, t, i, o; | ||
return nr(this, void 0, void 0, function() { | ||
function Re(e, n) { | ||
var r, t, i, o; | ||
return ne(this, void 0, void 0, function() { | ||
var u, a; | ||
return W(this, function(s) { | ||
return z(this, function(s) { | ||
switch (s.label) { | ||
case 0: | ||
s.trys.push([0, 5, 6, 11]), e = or(r), s.label = 1; | ||
s.trys.push([0, 5, 6, 11]), r = oe(e), s.label = 1; | ||
case 1: | ||
return [4, e.next()]; | ||
return [4, r.next()]; | ||
case 2: | ||
@@ -776,3 +776,3 @@ if (t = s.sent(), !!t.done) | ||
case 6: | ||
return s.trys.push([6, , 9, 10]), t && !t.done && (o = e.return) ? [4, o.call(e)] : [3, 8]; | ||
return s.trys.push([6, , 9, 10]), t && !t.done && (o = r.return) ? [4, o.call(r)] : [3, 8]; | ||
case 7: | ||
@@ -794,19 +794,19 @@ s.sent(), s.label = 8; | ||
} | ||
function Lr(r, n, e, t, i) { | ||
function De(e, n, r, t, i) { | ||
t === void 0 && (t = 0), i === void 0 && (i = !1); | ||
var o = n.schedule(function() { | ||
e(), i ? r.add(this.schedule(null, t)) : this.unsubscribe(); | ||
r(), i ? e.add(this.schedule(null, t)) : this.unsubscribe(); | ||
}, t); | ||
if (r.add(o), !i) | ||
if (e.add(o), !i) | ||
return o; | ||
} | ||
var Dr = z(function(r) { | ||
var Le = W(function(e) { | ||
return function() { | ||
r(this), this.name = "EmptyError", this.message = "no elements in sequence"; | ||
e(this), this.name = "EmptyError", this.message = "no elements in sequence"; | ||
}; | ||
}); | ||
function Ur(r, n) { | ||
var e = typeof n == "object"; | ||
function Ce(e, n) { | ||
var r = typeof n == "object"; | ||
return new Promise(function(t, i) { | ||
var o = new A({ | ||
var o = new O({ | ||
next: function(u) { | ||
@@ -817,26 +817,26 @@ t(u), o.unsubscribe(); | ||
complete: function() { | ||
e ? t(n.defaultValue) : i(new Dr()); | ||
r ? t(n.defaultValue) : i(new Le()); | ||
} | ||
}); | ||
r.subscribe(o); | ||
e.subscribe(o); | ||
}); | ||
} | ||
function O(r, n) { | ||
return k(function(e, t) { | ||
function k(e, n) { | ||
return R(function(r, t) { | ||
var i = 0; | ||
e.subscribe(I(t, function(o) { | ||
t.next(r.call(n, o, i++)); | ||
r.subscribe(P(t, function(o) { | ||
t.next(e.call(n, o, i++)); | ||
})); | ||
}); | ||
} | ||
var Cr = Array.isArray; | ||
function Mr(r, n) { | ||
return Cr(n) ? r.apply(void 0, x([], E(n))) : r(n); | ||
var Ue = Array.isArray; | ||
function Me(e, n) { | ||
return Ue(n) ? e.apply(void 0, I([], x(n))) : e(n); | ||
} | ||
function jr(r) { | ||
return O(function(n) { | ||
return Mr(r, n); | ||
function je(e) { | ||
return k(function(n) { | ||
return Me(e, n); | ||
}); | ||
} | ||
function Fr(r, n, e, t, i, o, u, a) { | ||
function Fe(e, n, r, t, i, o, u, a) { | ||
var s = [], c = 0, l = 0, y = !1, f = function() { | ||
@@ -849,3 +849,3 @@ y && !s.length && !c && n.complete(); | ||
var b = !1; | ||
q(e(h, l++)).subscribe(I(n, function(m) { | ||
_(r(h, l++)).subscribe(P(n, function(m) { | ||
i == null || i(m), o ? p(m) : n.next(m); | ||
@@ -859,15 +859,15 @@ }, function() { | ||
for (var m = function() { | ||
var P = s.shift(); | ||
u ? Lr(n, u, function() { | ||
return v(P); | ||
}) : v(P); | ||
var T = s.shift(); | ||
u ? De(n, u, function() { | ||
return v(T); | ||
}) : v(T); | ||
}; s.length && c < t; ) | ||
m(); | ||
f(); | ||
} catch (P) { | ||
n.error(P); | ||
} catch (T) { | ||
n.error(T); | ||
} | ||
})); | ||
}; | ||
return r.subscribe(I(n, p, function() { | ||
return e.subscribe(P(n, p, function() { | ||
y = !0, f(); | ||
@@ -878,27 +878,27 @@ })), function() { | ||
} | ||
function er(r, n, e) { | ||
return e === void 0 && (e = 1 / 0), d(n) ? er(function(t, i) { | ||
return O(function(o, u) { | ||
function ee(e, n, r) { | ||
return r === void 0 && (r = 1 / 0), d(n) ? ee(function(t, i) { | ||
return k(function(o, u) { | ||
return n(t, o, i, u); | ||
})(q(r(t, i))); | ||
}, e) : (typeof n == "number" && (e = n), k(function(t, i) { | ||
return Fr(t, i, r, e); | ||
})(_(e(t, i))); | ||
}, r) : (typeof n == "number" && (r = n), R(function(t, i) { | ||
return Fe(t, i, e, r); | ||
})); | ||
} | ||
var Vr = ["addListener", "removeListener"], Yr = ["addEventListener", "removeEventListener"], Hr = ["on", "off"]; | ||
function V(r, n, e, t) { | ||
if (d(e) && (t = e, e = void 0), t) | ||
return V(r, n, e).pipe(jr(t)); | ||
var i = E(qr(r) ? Yr.map(function(a) { | ||
var Ve = ["addListener", "removeListener"], Ye = ["addEventListener", "removeEventListener"], He = ["on", "off"]; | ||
function F(e, n, r, t) { | ||
if (d(r) && (t = r, r = void 0), t) | ||
return F(e, n, r).pipe(je(t)); | ||
var i = x(qe(e) ? Ye.map(function(a) { | ||
return function(s) { | ||
return r[a](n, s, e); | ||
return e[a](n, s, r); | ||
}; | ||
}) : Gr(r) ? Vr.map(J(r, n)) : _r(r) ? Hr.map(J(r, n)) : [], 2), o = i[0], u = i[1]; | ||
if (!o && N(r)) | ||
return er(function(a) { | ||
return V(a, n, e); | ||
})(q(r)); | ||
}) : Ge(e) ? Ve.map(J(e, n)) : _e(e) ? He.map(J(e, n)) : [], 2), o = i[0], u = i[1]; | ||
if (!o && B(e)) | ||
return ee(function(a) { | ||
return F(a, n, r); | ||
})(_(e)); | ||
if (!o) | ||
throw new TypeError("Invalid event target"); | ||
return new S(function(a) { | ||
return new g(function(a) { | ||
var s = function() { | ||
@@ -914,30 +914,30 @@ for (var c = [], l = 0; l < arguments.length; l++) | ||
} | ||
function J(r, n) { | ||
return function(e) { | ||
function J(e, n) { | ||
return function(r) { | ||
return function(t) { | ||
return r[e](n, t); | ||
return e[r](n, t); | ||
}; | ||
}; | ||
} | ||
function Gr(r) { | ||
return d(r.addListener) && d(r.removeListener); | ||
function Ge(e) { | ||
return d(e.addListener) && d(e.removeListener); | ||
} | ||
function _r(r) { | ||
return d(r.on) && d(r.off); | ||
function _e(e) { | ||
return d(e.on) && d(e.off); | ||
} | ||
function qr(r) { | ||
return d(r.addEventListener) && d(r.removeEventListener); | ||
function qe(e) { | ||
return d(e.addEventListener) && d(e.removeEventListener); | ||
} | ||
function Kr(r, n) { | ||
return k(function(e, t) { | ||
function Ke(e, n) { | ||
return R(function(r, t) { | ||
var i = 0; | ||
e.subscribe(I(t, function(o) { | ||
return r.call(n, o, i++) && t.next(o); | ||
r.subscribe(P(t, function(o) { | ||
return e.call(n, o, i++) && t.next(o); | ||
})); | ||
}); | ||
} | ||
function $r(r, n) { | ||
return n === void 0 && (n = null), n = n ?? r, k(function(e, t) { | ||
function Je(e, n) { | ||
return n === void 0 && (n = null), n = n ?? e, R(function(r, t) { | ||
var i = [], o = 0; | ||
e.subscribe(I(t, function(u) { | ||
r.subscribe(P(t, function(u) { | ||
var a, s, c, l, y = null; | ||
@@ -948,3 +948,3 @@ o++ % n === 0 && i.push([]); | ||
var v = p.value; | ||
v.push(u), r <= v.length && (y = y ?? [], y.push(v)); | ||
v.push(u), e <= v.length && (y = y ?? [], y.push(v)); | ||
} | ||
@@ -965,3 +965,3 @@ } catch (m) { | ||
var v = b.value; | ||
M(i, v), t.next(v); | ||
U(i, v), t.next(v); | ||
} | ||
@@ -1001,26 +1001,26 @@ } catch (m) { | ||
} | ||
const Jr = (r) => { | ||
const Qe = (e) => { | ||
const n = /* @__PURE__ */ new Set(); | ||
do | ||
for (const e of Reflect.ownKeys(r)) | ||
n.add([r, e]); | ||
while ((r = Reflect.getPrototypeOf(r)) && r !== Object.prototype); | ||
for (const r of Reflect.ownKeys(e)) | ||
n.add([e, r]); | ||
while ((e = Reflect.getPrototypeOf(e)) && e !== Object.prototype); | ||
return n; | ||
}; | ||
function Qr(r, { include: n, exclude: e } = {}) { | ||
function ze(e, { include: n, exclude: r } = {}) { | ||
const t = (i) => { | ||
const o = (u) => typeof u == "string" ? i === u : u.test(i); | ||
return n ? n.some(o) : e ? !e.some(o) : !0; | ||
return n ? n.some(o) : r ? !r.some(o) : !0; | ||
}; | ||
for (const [i, o] of Jr(r.constructor.prototype)) { | ||
for (const [i, o] of Qe(e.constructor.prototype)) { | ||
if (o === "constructor" || !t(o)) | ||
continue; | ||
const u = Reflect.getOwnPropertyDescriptor(i, o); | ||
u && typeof u.value == "function" && (r[o] = r[o].bind(r)); | ||
u && typeof u.value == "function" && (e[o] = e[o].bind(e)); | ||
} | ||
return r; | ||
return e; | ||
} | ||
class Wr { | ||
class We { | ||
constructor(n) { | ||
this.delegate = n, Qr(this); | ||
this.delegate = n, ze(this); | ||
} | ||
@@ -1030,32 +1030,32 @@ enableRecord() { | ||
} | ||
openDemoDialog(n, e) { | ||
return this.delegate.then((t) => t.openDemoDialog(n, e)); | ||
openDemoDialog(n, r) { | ||
return this.delegate.then((t) => t.openDemoDialog(n, r)); | ||
} | ||
} | ||
function zr(r) { | ||
return typeof localStorage == "object" ? localStorage.getItem(r) : null; | ||
function Xe(e) { | ||
return typeof localStorage == "object" ? localStorage.getItem(e) : null; | ||
} | ||
const Xr = "MIAOLU_SERVICE_ENDPOINT", U = zr(Xr) || "https://s.demoway.co/sdk/sdk-service/index.js"; | ||
const Ze = "MIAOLU_SERVICE_ENDPOINT", $e = Xe(Ze) || "https://s.demoway.co/sdk/sdk-service/index.js"; | ||
function Q() { | ||
throw new Error("sdk is not initialized"); | ||
} | ||
const R = new Wr( | ||
Promise.resolve({ | ||
openDemoDialog: Q, | ||
enableRecord: Q | ||
}) | ||
), Zr = R.openDemoDialog, Br = R.enableRecord; | ||
function Nr({ accessToken: r }) { | ||
if (!r) | ||
const re = Promise.resolve({ | ||
openDemoDialog: Q, | ||
enableRecord: Q | ||
}), S = new We(re), Be = S.openDemoDialog, Ne = S.enableRecord; | ||
function er(e) { | ||
if (!e.accessToken) | ||
throw new Error("Invalid token"); | ||
const n = U.startsWith("http") ? U : `${location.protocol}${U}`, e = import(new URL(n).toString()).then((t) => t.initialize(r)); | ||
return R.delegate = e, e.then(() => R); | ||
if (S.delegate !== re) | ||
return S.delegate.then(() => S); | ||
const n = import($e).then((r) => r.initialize(e)); | ||
return S.delegate = n, n.then(() => S); | ||
} | ||
function re(r, n, e) { | ||
return Ur( | ||
V(r, "click").pipe( | ||
O(() => Date.now()), | ||
$r(n), | ||
Kr((t) => t[t.length - 1] - t[0] < e), | ||
O(F) | ||
function rr(e, n, r) { | ||
return Ce( | ||
F(e, "click").pipe( | ||
k(() => Date.now()), | ||
Je(n), | ||
Ke((t) => t[t.length - 1] - t[0] < r), | ||
k(j) | ||
) | ||
@@ -1065,7 +1065,7 @@ ); | ||
export { | ||
U as SERVICE_ENDPOINT, | ||
Br as enableRecord, | ||
Nr as initialize, | ||
Zr as openDemoDialog, | ||
re as rageClick | ||
$e as SERVICE_ENDPOINT, | ||
Ne as enableRecord, | ||
er as initialize, | ||
Be as openDemoDialog, | ||
rr as rageClick | ||
}; |
{ | ||
"name": "demoway-sdk", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"type": "module", | ||
@@ -21,18 +21,8 @@ "files": [ | ||
"scripts": { | ||
"dev": "storybook dev -p 6006", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-check --tsconfig ./tsconfig.json", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run check && npm run build" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^7.1.1", | ||
"@storybook/addon-interactions": "^7.1.1", | ||
"@storybook/addon-links": "^7.1.1", | ||
"@storybook/blocks": "^7.1.1", | ||
"@storybook/svelte": "^7.1.1", | ||
"@storybook/svelte-vite": "^7.1.1", | ||
"@storybook/testing-library": "0.0.14-next.2", | ||
"@sveltejs/vite-plugin-svelte": "^2.4.3", | ||
@@ -44,7 +34,4 @@ "@tsconfig/svelte": "^4.0.1", | ||
"prettier-plugin-svelte": "^2.10.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rxjs": "^7.8.1", | ||
"sass": "^1.64.1", | ||
"storybook": "^7.1.1", | ||
"svelte": "^4.1.1", | ||
@@ -51,0 +38,0 @@ "svelte-check": "^3.4.6", |
104
README.md
@@ -1,47 +0,99 @@ | ||
# Svelte + TS + Vite | ||
# Demoway SDK | ||
This template should help get you started developing with Svelte and TypeScript in Vite. | ||
## Install | ||
## Recommended IDE Setup | ||
### pnpm | ||
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). | ||
``` | ||
pnpm add demoway-sdk | ||
``` | ||
## Need an official Svelte framework? | ||
### npm | ||
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more. | ||
``` | ||
npm install demoway-sdk --save | ||
``` | ||
## Technical considerations | ||
### yarn | ||
**Why use this over SvelteKit?** | ||
``` | ||
yarn add demoway-sdk | ||
``` | ||
- It brings its own routing solution which might not be preferable for some users. | ||
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app. | ||
## Initialize DemoWay SDK | ||
This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project. | ||
Initialize DemoWay SDK before application rendering | ||
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate. | ||
### Vue Example | ||
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?** | ||
```js | ||
import { initialize } from 'demoway-sdk'; | ||
import { createApp } from 'vue'; | ||
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information. | ||
initialize({ | ||
accessToken: '', // getting from DemoWay dashboard | ||
}) | ||
/** | ||
* render your app | ||
*/ | ||
createApp(App).mount(); | ||
``` | ||
**Why include `.vscode/extensions.json`?** | ||
### React Example | ||
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project. | ||
```jsx | ||
import { initialize } from 'demoway-sdk'; | ||
import { createRoot } from 'react-dom/client'; | ||
**Why enable `allowJs` in the TS template?** | ||
initialize({ | ||
accessToken: '', // getting from DemoWay dashboard | ||
}); | ||
While `allowJs: false` would indeed prevent the use of `.js` files in the project, it does not prevent the use of JavaScript syntax in `.svelte` files. In addition, it would force `checkJs: false`, bringing the worst of both worlds: not being able to guarantee the entire codebase is TypeScript, and also having worse typechecking for the existing JavaScript. In addition, there are valid use cases in which a mixed codebase may be relevant. | ||
/** | ||
* render your app | ||
*/ | ||
const domNode = document.getElementById('root'); | ||
const root = createRoot(domNode); | ||
root.render(<App />); | ||
``` | ||
**Why is HMR not preserving my local component state?** | ||
## Usage | ||
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/rixo/svelte-hmr#svelte-hmr). | ||
### Open Demo in Dialog | ||
If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR. | ||
<img src="./assets/demo-dialog.png" width="100%" /> | ||
```ts | ||
// store.ts | ||
// An extremely simple external store | ||
import { writable } from 'svelte/store' | ||
export default writable(0) | ||
Open a demo in dialog, which can switch to full screen mode. | ||
```js | ||
import { openDemoDialog } from 'demoway-sdk'; | ||
openDemoDialog('demo-id'); // demo-id is getting from DemoWay dashboard | ||
``` | ||
### Record a New Demo | ||
<img src="./assets/recording-board.png" width="60%" /> | ||
Enable recording feature and show recording board by calling `enableRecord` function. | ||
```js | ||
import { enableRecord } from 'demoway-sdk'; | ||
// enable recording feature and show recording board | ||
enableRecord(); | ||
``` | ||
Enable recording feature and show recording board by rage click. | ||
```js | ||
import { enableRecord, rageClick } from 'demoway-sdk'; | ||
const button = document.querySelector('button'); | ||
// rage click button 5 times with 1000ms interval | ||
rageClick(button, 5, 1000).then(() => { | ||
// enable recording feature and show recording board | ||
return enableRecord(); | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
15
1152
100
50604