@stripchatdev/ext-helper 0.1.4 → 0.1.6
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/ext-helper.js +106 -68
- package/dist/index.d.ts +40 -2
- package/package.json +1 -1
package/dist/ext-helper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const S = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol === "iframe_pubsub" && "version" in e && e.version === "1.0", E = (e, t) => e, w = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
2
2
|
var l;
|
|
3
3
|
(function(e) {
|
|
4
4
|
e.Base32IncorrectEncoding = "B32_ENC_INVALID", e.DecodeTimeInvalidCharacter = "DEC_TIME_CHAR", e.DecodeTimeValueMalformed = "DEC_TIME_MALFORMED", e.EncodeTimeNegative = "ENC_TIME_NEG", e.EncodeTimeSizeExceeded = "ENC_TIME_SIZE_EXCEED", e.EncodeTimeValueMalformed = "ENC_TIME_MALFORMED", e.PRNGDetectFailure = "PRNG_DETECT", e.ULIDInvalid = "ULID_INVALID", e.Unexpected = "UNEXPECTED", e.UUIDInvalid = "UUID_INVALID";
|
|
@@ -8,12 +8,12 @@ class f extends Error {
|
|
|
8
8
|
super(`${r} (${t})`), this.name = "ULIDError", this.code = t;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function T(e) {
|
|
12
12
|
const t = Math.floor(e() * 32) % 32;
|
|
13
13
|
return w.charAt(t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
15
|
+
function _(e) {
|
|
16
|
+
const t = O(), r = t && (t.crypto || t.msCrypto) || null;
|
|
17
17
|
if (typeof (r == null ? void 0 : r.getRandomValues) == "function")
|
|
18
18
|
return () => {
|
|
19
19
|
const n = new Uint8Array(1);
|
|
@@ -23,16 +23,16 @@ function P(e) {
|
|
|
23
23
|
return () => r.randomBytes(1).readUInt8() / 255;
|
|
24
24
|
throw new f(l.PRNGDetectFailure, "Failed to find a reliable PRNG");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function O() {
|
|
27
27
|
return q() ? self : typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : null;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function P(e, t) {
|
|
30
30
|
let r = "";
|
|
31
31
|
for (; e > 0; e--)
|
|
32
|
-
r =
|
|
32
|
+
r = T(t) + r;
|
|
33
33
|
return r;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function H(e, t = 10) {
|
|
36
36
|
if (isNaN(e))
|
|
37
37
|
throw new f(l.EncodeTimeValueMalformed, `Time must be a number: ${e}`);
|
|
38
38
|
if (e > 281474976710655)
|
|
@@ -50,8 +50,8 @@ function q() {
|
|
|
50
50
|
return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope;
|
|
51
51
|
}
|
|
52
52
|
function b(e, t) {
|
|
53
|
-
const r =
|
|
54
|
-
return
|
|
53
|
+
const r = _(), n = Date.now();
|
|
54
|
+
return H(n, 10) + P(16, r);
|
|
55
55
|
}
|
|
56
56
|
const L = ({ seq: e, uniqId: t }) => (r) => ({
|
|
57
57
|
...{
|
|
@@ -62,14 +62,14 @@ const L = ({ seq: e, uniqId: t }) => (r) => ({
|
|
|
62
62
|
timestamp: Date.now()
|
|
63
63
|
},
|
|
64
64
|
...r
|
|
65
|
-
}),
|
|
65
|
+
}), y = L({
|
|
66
66
|
uniqId: () => b(),
|
|
67
67
|
seq: () => b()
|
|
68
68
|
});
|
|
69
69
|
class A {
|
|
70
70
|
constructor(t) {
|
|
71
71
|
this.eventHandlerMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (s, o) => {
|
|
72
|
-
if (
|
|
72
|
+
if (S(s)) {
|
|
73
73
|
if (s.type === "event") {
|
|
74
74
|
const { eventName: i } = s, a = this.eventHandlerMap.get(i);
|
|
75
75
|
if (!a)
|
|
@@ -90,41 +90,41 @@ class A {
|
|
|
90
90
|
this.brokerId = r, this.transport = n, this.transport.onMessage(this.globalMessageHandler);
|
|
91
91
|
}
|
|
92
92
|
subscribe(t, r) {
|
|
93
|
-
const n =
|
|
93
|
+
const n = E(t);
|
|
94
94
|
let s = this.eventHandlerMap.get(n);
|
|
95
95
|
s || (s = /* @__PURE__ */ new Set(), this.eventHandlerMap.set(n, s)), s.add(r);
|
|
96
|
-
const o =
|
|
96
|
+
const o = y({
|
|
97
97
|
type: "subscribe",
|
|
98
98
|
eventName: t
|
|
99
99
|
});
|
|
100
100
|
this.transport.send(this.brokerId, o);
|
|
101
101
|
}
|
|
102
102
|
unsubscribe(t, r) {
|
|
103
|
-
const n =
|
|
103
|
+
const n = E(t);
|
|
104
104
|
let s = this.eventHandlerMap.get(n);
|
|
105
105
|
if (!s)
|
|
106
106
|
return;
|
|
107
107
|
r ? s.delete(r) : this.eventHandlerMap.delete(n);
|
|
108
|
-
const o =
|
|
108
|
+
const o = y({
|
|
109
109
|
type: "unsubscribe",
|
|
110
110
|
eventName: t
|
|
111
111
|
});
|
|
112
112
|
this.transport.send(this.brokerId, o);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
class
|
|
115
|
+
const x = !!Error.captureStackTrace, C = "APP_ERROR";
|
|
116
|
+
class g extends Error {
|
|
117
117
|
constructor(t, r) {
|
|
118
|
-
super(t), this.name = new.target.name ||
|
|
118
|
+
super(t), this.name = new.target.name || C, this.cause = r, x && Error.captureStackTrace(this, this.constructor);
|
|
119
119
|
}
|
|
120
120
|
static serializeCause(t) {
|
|
121
|
-
return t instanceof
|
|
121
|
+
return t instanceof g ? t.toJSON() : t instanceof Error ? { name: t.name, message: t.message } : t !== null && typeof t == "object" ? t : String(t);
|
|
122
122
|
}
|
|
123
123
|
toJSON() {
|
|
124
124
|
return {
|
|
125
125
|
name: this.name,
|
|
126
126
|
message: this.message,
|
|
127
|
-
cause: this.cause ?
|
|
127
|
+
cause: this.cause ? g.serializeCause(this.cause) : void 0
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
toString() {
|
|
@@ -136,12 +136,12 @@ class E extends Error {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const D = {
|
|
140
140
|
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
141
|
-
},
|
|
142
|
-
class
|
|
141
|
+
}, j = "RPC_ERROR";
|
|
142
|
+
class G extends g {
|
|
143
143
|
constructor(t) {
|
|
144
|
-
super(t.message || "rpc error", t.cause), this.name =
|
|
144
|
+
super(t.message || "rpc error", t.cause), this.name = j, this.code = (t == null ? void 0 : t.code) || D.INTERNAL_ERROR, this.method = t.method, this.params = t.params;
|
|
145
145
|
}
|
|
146
146
|
toJSON() {
|
|
147
147
|
return {
|
|
@@ -160,10 +160,10 @@ const F = (e) => !!e && typeof e == "object" && "protocol" in e && e.protocol ==
|
|
|
160
160
|
timestamp: Date.now()
|
|
161
161
|
},
|
|
162
162
|
...t
|
|
163
|
-
}),
|
|
163
|
+
}), z = B({
|
|
164
164
|
uniqId: () => b()
|
|
165
165
|
});
|
|
166
|
-
class
|
|
166
|
+
class X {
|
|
167
167
|
constructor(t) {
|
|
168
168
|
this.pendingEntryMap = /* @__PURE__ */ new Map(), this.globalMessageHandler = (s) => {
|
|
169
169
|
if (F(s)) {
|
|
@@ -182,7 +182,7 @@ class U {
|
|
|
182
182
|
console.error("[RpcClient] globalMessageHandler: got error response without pending request", s);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
this.pendingEntryMap.delete(o), i.reject(new
|
|
185
|
+
this.pendingEntryMap.delete(o), i.reject(new G(s.error));
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
188
|
console.error("[RpcClient] globalMessageHandler: invalid message schema", s);
|
|
@@ -192,7 +192,7 @@ class U {
|
|
|
192
192
|
this.serverId = r, this.transport = n, this.transport.onMessage(this.globalMessageHandler);
|
|
193
193
|
}
|
|
194
194
|
makeRequest(t, r) {
|
|
195
|
-
const n =
|
|
195
|
+
const n = z({
|
|
196
196
|
type: "request",
|
|
197
197
|
method: t,
|
|
198
198
|
params: r
|
|
@@ -269,8 +269,8 @@ class W {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
const p = {
|
|
272
|
-
name: "
|
|
273
|
-
message: "
|
|
272
|
+
name: "unknownError",
|
|
273
|
+
message: "unknown error"
|
|
274
274
|
}, M = (e, t = 3, r = 0) => {
|
|
275
275
|
if (e instanceof Error) {
|
|
276
276
|
const n = r < t && e.cause ? M(e.cause, t, r + 1) : void 0;
|
|
@@ -300,26 +300,67 @@ const p = {
|
|
|
300
300
|
} catch {
|
|
301
301
|
return {
|
|
302
302
|
name: p.name,
|
|
303
|
-
message: "
|
|
303
|
+
message: "failed to serialize error: unserializable error object"
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
306
|
return p;
|
|
307
|
-
},
|
|
307
|
+
}, I = (e) => {
|
|
308
|
+
const t = [];
|
|
309
|
+
if (e instanceof Error)
|
|
310
|
+
t.push(e.message), "cause" in e && t.push(I(e.cause));
|
|
311
|
+
else
|
|
312
|
+
try {
|
|
313
|
+
const r = JSON.stringify(e);
|
|
314
|
+
t.push(r);
|
|
315
|
+
} catch {
|
|
316
|
+
t.push("failed to get chained error message: unserializable error object");
|
|
317
|
+
}
|
|
318
|
+
return t.join(":");
|
|
319
|
+
}, $ = [
|
|
320
|
+
// browser internals — harmless noise
|
|
321
|
+
/resizeObserver loop/ig,
|
|
322
|
+
// cross-origin script errors with zero useful info
|
|
323
|
+
/Script error/ig,
|
|
324
|
+
// browser extensions injecting errors
|
|
325
|
+
/chrome-extension:\/\//ig,
|
|
326
|
+
/moz-extension:\/\//ig,
|
|
327
|
+
/safari-extension:\/\//ig,
|
|
328
|
+
// module/chunk loading failures (network flaky, retries handle it)
|
|
329
|
+
/importing a module script failed/ig,
|
|
330
|
+
/loading chunk [\w.-]+ failed/ig,
|
|
331
|
+
/failed to fetch dynamically imported module/ig,
|
|
332
|
+
/error loading dynamically imported module/ig,
|
|
333
|
+
// canceled navigation / aborted
|
|
334
|
+
/AbortError/ig,
|
|
335
|
+
/the operation was aborted/ig,
|
|
336
|
+
/the user aborted a request/ig,
|
|
337
|
+
// webSocket noise
|
|
338
|
+
/webSocket is closed before the connection is established/ig,
|
|
339
|
+
// generic network noise already captured by fetch/xhr integrations
|
|
340
|
+
/networkError when attempting to fetch resource/ig,
|
|
341
|
+
/load failed/ig
|
|
342
|
+
], J = (e) => $.some((t) => (t.lastIndex = 0, t.test(e))), V = (e) => {
|
|
343
|
+
const t = I(e.error), r = typeof e.data == "object" && "message" in e.data && typeof e.data.message == "string" ? e.data.message : "";
|
|
344
|
+
return [t, r].filter((n) => !!n).join(":");
|
|
345
|
+
}, U = (e) => e.data && typeof e.data == "object" && "filename" in e.data ? String(e.data.filename ?? "") : "", K = (e) => {
|
|
346
|
+
const t = V(e), r = U(e);
|
|
347
|
+
return r && /^(chrome|moz|safari)-extension:\/\//.test(r) ? !0 : !!t && J(t);
|
|
348
|
+
}, Z = "get", Q = (e, t) => {
|
|
308
349
|
var s;
|
|
309
350
|
let r, n;
|
|
310
351
|
return e instanceof Request ? (r = e.url, n = e.method) : e instanceof URL ? r = e.toString() : r = e, {
|
|
311
|
-
method: n || ((s = t == null ? void 0 : t.method) == null ? void 0 : s.toString()) ||
|
|
352
|
+
method: n || ((s = t == null ? void 0 : t.method) == null ? void 0 : s.toString()) || Z,
|
|
312
353
|
url: r
|
|
313
354
|
};
|
|
314
|
-
},
|
|
355
|
+
}, Y = (e, t, r) => ({
|
|
315
356
|
statusCode: r.status,
|
|
316
|
-
...
|
|
317
|
-
}),
|
|
357
|
+
...Q(e, t)
|
|
358
|
+
}), ee = (e) => {
|
|
318
359
|
const t = window.fetch;
|
|
319
360
|
Object.defineProperty(window, "fetch", {
|
|
320
361
|
value: async (n, s) => {
|
|
321
362
|
try {
|
|
322
|
-
const o = new Error("synthetic error"), i = await t(n, s), a = i.clone(), c =
|
|
363
|
+
const o = new Error("synthetic error"), i = await t(n, s), a = i.clone(), c = Y(n, s, a);
|
|
323
364
|
if (i.status >= 500) {
|
|
324
365
|
const u = new Error("fetch response error");
|
|
325
366
|
u.stack = o.stack, e.report({
|
|
@@ -332,12 +373,12 @@ const p = {
|
|
|
332
373
|
const {
|
|
333
374
|
arrayBuffer: h,
|
|
334
375
|
blob: m,
|
|
335
|
-
json:
|
|
376
|
+
json: v,
|
|
336
377
|
text: k
|
|
337
378
|
} = i;
|
|
338
379
|
return i.json = async function() {
|
|
339
380
|
try {
|
|
340
|
-
return await
|
|
381
|
+
return await v.call(this);
|
|
341
382
|
} catch (u) {
|
|
342
383
|
throw e.report({
|
|
343
384
|
type: "network",
|
|
@@ -393,18 +434,13 @@ const p = {
|
|
|
393
434
|
}
|
|
394
435
|
}, i;
|
|
395
436
|
} catch (o) {
|
|
396
|
-
throw o instanceof Error && o.name === "AbortError"
|
|
397
|
-
type: "network",
|
|
398
|
-
kind: "fetchRequestError",
|
|
399
|
-
error: o,
|
|
400
|
-
data: I(n, s)
|
|
401
|
-
}), o;
|
|
437
|
+
throw o instanceof Error && o.name === "AbortError", o;
|
|
402
438
|
}
|
|
403
439
|
},
|
|
404
|
-
configurable: !
|
|
405
|
-
writable: !
|
|
440
|
+
configurable: !0,
|
|
441
|
+
writable: !0
|
|
406
442
|
});
|
|
407
|
-
},
|
|
443
|
+
}, te = (e) => {
|
|
408
444
|
window.addEventListener("unhandledrejection", ({ reason: t }) => {
|
|
409
445
|
e.report({
|
|
410
446
|
type: "runtime",
|
|
@@ -424,18 +460,18 @@ const p = {
|
|
|
424
460
|
}
|
|
425
461
|
});
|
|
426
462
|
});
|
|
427
|
-
},
|
|
463
|
+
}, N = Symbol("patchedXHLHttpRequest"), d = Symbol("requestInfo"), re = (e) => ({
|
|
428
464
|
statusCode: e.status,
|
|
429
465
|
...e[d]
|
|
430
|
-
}),
|
|
431
|
-
e[
|
|
432
|
-
},
|
|
466
|
+
}), ne = (e) => (e[d] || (e[d] = {}), e[d]), se = (e) => {
|
|
467
|
+
e[N] = !0;
|
|
468
|
+
}, oe = (e) => e[N] === !0, ie = (e) => {
|
|
433
469
|
const t = XMLHttpRequest.prototype.send, r = XMLHttpRequest.prototype.open, n = function(...o) {
|
|
434
470
|
const [i, a] = o;
|
|
435
471
|
this[d] = {
|
|
436
472
|
method: i,
|
|
437
473
|
url: typeof a == "string" ? a : a.toString()
|
|
438
|
-
},
|
|
474
|
+
}, oe(this) || (se(this), this.addEventListener("error", () => {
|
|
439
475
|
const c = new Error("XMLHttpRequest network error");
|
|
440
476
|
e.report({
|
|
441
477
|
type: "network",
|
|
@@ -457,7 +493,7 @@ const p = {
|
|
|
457
493
|
e.report({
|
|
458
494
|
type: "network",
|
|
459
495
|
kind: "xmlHttpRequestLoadError",
|
|
460
|
-
data:
|
|
496
|
+
data: re(this),
|
|
461
497
|
error: c
|
|
462
498
|
});
|
|
463
499
|
}
|
|
@@ -474,7 +510,7 @@ const p = {
|
|
|
474
510
|
}
|
|
475
511
|
}, s = function(o) {
|
|
476
512
|
try {
|
|
477
|
-
const i =
|
|
513
|
+
const i = ne(this), a = new Error("XMLHttpRequest request initiator");
|
|
478
514
|
i.requestStack = a.stack, t.call(this, o);
|
|
479
515
|
} catch (i) {
|
|
480
516
|
throw e.report({
|
|
@@ -487,20 +523,22 @@ const p = {
|
|
|
487
523
|
};
|
|
488
524
|
Object.defineProperty(XMLHttpRequest.prototype, "open", {
|
|
489
525
|
value: n,
|
|
490
|
-
configurable: !
|
|
491
|
-
writable: !
|
|
526
|
+
configurable: !0,
|
|
527
|
+
writable: !0
|
|
492
528
|
}), Object.defineProperty(XMLHttpRequest.prototype, "send", {
|
|
493
529
|
value: s,
|
|
494
|
-
configurable: !
|
|
495
|
-
writable: !
|
|
530
|
+
configurable: !0,
|
|
531
|
+
writable: !0
|
|
496
532
|
});
|
|
497
533
|
};
|
|
498
534
|
let R;
|
|
499
|
-
class
|
|
535
|
+
class ae {
|
|
500
536
|
constructor(t) {
|
|
501
537
|
this.onError = t;
|
|
502
538
|
}
|
|
503
539
|
report(t) {
|
|
540
|
+
if (K(t))
|
|
541
|
+
return;
|
|
504
542
|
const { error: r, ...n } = t;
|
|
505
543
|
this.onError({
|
|
506
544
|
...n,
|
|
@@ -511,10 +549,10 @@ class te {
|
|
|
511
549
|
this.applyIntegrations();
|
|
512
550
|
}
|
|
513
551
|
applyIntegrations() {
|
|
514
|
-
R || (R = !0,
|
|
552
|
+
R || (R = !0, te(this), ie(this), ee(this));
|
|
515
553
|
}
|
|
516
554
|
}
|
|
517
|
-
class
|
|
555
|
+
class ce {
|
|
518
556
|
constructor(t) {
|
|
519
557
|
const {
|
|
520
558
|
serverId: r,
|
|
@@ -526,13 +564,13 @@ class re {
|
|
|
526
564
|
origin: n,
|
|
527
565
|
source: s
|
|
528
566
|
}, a = new W({});
|
|
529
|
-
a.addPeer(i), this.rpcClient = new
|
|
567
|
+
a.addPeer(i), this.rpcClient = new X({
|
|
530
568
|
transport: a,
|
|
531
569
|
serverId: r
|
|
532
570
|
}), this.subscriber = new A({
|
|
533
571
|
transport: a,
|
|
534
572
|
brokerId: i.id
|
|
535
|
-
}), document.documentElement.dataset.theme = o, this.crashReporter = new
|
|
573
|
+
}), document.documentElement.dataset.theme = o, this.crashReporter = new ae((c) => {
|
|
536
574
|
this.makeRequest("v1.system.report.crash", c);
|
|
537
575
|
});
|
|
538
576
|
}
|
|
@@ -571,8 +609,8 @@ class re {
|
|
|
571
609
|
}), this.crashReporter.init();
|
|
572
610
|
}
|
|
573
611
|
}
|
|
574
|
-
const
|
|
575
|
-
const e = new URL(window.location.href), t = e.searchParams.get("origin") || "", r = e.searchParams.get("theme") || "dark", n = new
|
|
612
|
+
const ue = () => {
|
|
613
|
+
const e = new URL(window.location.href), t = e.searchParams.get("origin") || "", r = e.searchParams.get("theme") || "dark", n = new ce({
|
|
576
614
|
serverId: "server",
|
|
577
615
|
serverOrigin: t || window.parent.origin,
|
|
578
616
|
serverSource: window.parent,
|
|
@@ -581,5 +619,5 @@ const ne = () => {
|
|
|
581
619
|
return n.bootstrap(), n;
|
|
582
620
|
};
|
|
583
621
|
export {
|
|
584
|
-
|
|
622
|
+
ue as createExtHelper
|
|
585
623
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,15 @@ export declare type TMethods = TV1Methods;
|
|
|
65
65
|
|
|
66
66
|
export declare type TModelId = TUserId;
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Status of the movable overlay.
|
|
70
|
+
* `active` - pulsing green
|
|
71
|
+
* `inactive` - orange
|
|
72
|
+
* `connecting` - green
|
|
73
|
+
* `error` - red
|
|
74
|
+
*/
|
|
75
|
+
export declare type TMovableOverlayStatus = 'active' | 'inactive' | 'connecting' | 'error';
|
|
76
|
+
|
|
68
77
|
export declare type TTheme = 'light' | 'dark';
|
|
69
78
|
|
|
70
79
|
declare type TTransportPeer = {
|
|
@@ -134,7 +143,7 @@ declare type TV1ExtMethods = {
|
|
|
134
143
|
'v1.ext.movableOverlay.update': {
|
|
135
144
|
params: {
|
|
136
145
|
message?: string;
|
|
137
|
-
status?:
|
|
146
|
+
status?: TMovableOverlayStatus;
|
|
138
147
|
};
|
|
139
148
|
result: null;
|
|
140
149
|
};
|
|
@@ -150,12 +159,19 @@ declare type TV1ExtMethods = {
|
|
|
150
159
|
};
|
|
151
160
|
result: null;
|
|
152
161
|
};
|
|
162
|
+
/** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v1.ext.whispered` event */
|
|
153
163
|
'v1.ext.whisper': {
|
|
154
164
|
params: {
|
|
165
|
+
/** Any JSON-serializable object to send to every frame */
|
|
155
166
|
data: TV1WhisperData;
|
|
167
|
+
/** Payment data received from the `payment.tokens.spend.succeeded` event
|
|
168
|
+
* This field is required for user in public
|
|
169
|
+
* */
|
|
170
|
+
paymentData?: TV1PaymentData;
|
|
156
171
|
};
|
|
157
172
|
result: null;
|
|
158
173
|
};
|
|
174
|
+
/** Sends a message to every frame of the current user */
|
|
159
175
|
'v1.ext.whisper.local': {
|
|
160
176
|
params: {
|
|
161
177
|
data: TV1WhisperData;
|
|
@@ -273,18 +289,39 @@ declare type TV1MonitoringMethods = {
|
|
|
273
289
|
};
|
|
274
290
|
};
|
|
275
291
|
|
|
292
|
+
export declare type TV1PaymentData = {
|
|
293
|
+
/** The amount of tokens spent */
|
|
294
|
+
amount: string;
|
|
295
|
+
/** Payment token used for authentication */
|
|
296
|
+
paymentToken: string;
|
|
297
|
+
/** Transaction identifier */
|
|
298
|
+
transactionId: string;
|
|
299
|
+
/** User's ID */
|
|
300
|
+
userId: string;
|
|
301
|
+
};
|
|
302
|
+
|
|
276
303
|
declare type TV1PaymentEvents = {
|
|
304
|
+
/**
|
|
305
|
+
* Received when tokens are successfully spent
|
|
306
|
+
* Contains the payment data which is used for validating whisper calls
|
|
307
|
+
*/
|
|
277
308
|
'v1.payment.tokens.spend.succeeded': {
|
|
309
|
+
/** Was the tip anonymous */
|
|
278
310
|
isAnonymous: boolean;
|
|
279
|
-
|
|
311
|
+
/** Payment data used for validating `ext.whisper` calls */
|
|
312
|
+
paymentData: TV1PaymentData;
|
|
313
|
+
/** Custom data passed in `payment.tokens.spend` method */
|
|
280
314
|
tokensSpendData: TV1TokenSpendData;
|
|
281
315
|
};
|
|
282
316
|
};
|
|
283
317
|
|
|
284
318
|
declare type TV1PaymentMethods = {
|
|
319
|
+
/** Requests a confirmation modal to spend tokens */
|
|
285
320
|
'v1.payment.tokens.spend': {
|
|
286
321
|
params: {
|
|
322
|
+
/** Amount of tokens to spend */
|
|
287
323
|
tokensAmount: number;
|
|
324
|
+
/** Custom data which will be passed back in the `v1.payment.tokens.spend.succeeded` event */
|
|
288
325
|
tokensSpendData: TV1TokenSpendData;
|
|
289
326
|
};
|
|
290
327
|
result: null;
|
|
@@ -379,6 +416,7 @@ declare type TV1TipEvents = {
|
|
|
379
416
|
*/
|
|
380
417
|
declare type TV1TipSource = 'console' | 'tipMenu' | 'goal' | 'epicGoal' | 'fullscreen' | 'interactiveToy' | 'publicChat' | 'privateChat' | 'extension' | 'sendTipButton' | 'feed';
|
|
381
418
|
|
|
419
|
+
/** Custom data that you can pass when requesting token spend. You will receive it on successful payment */
|
|
382
420
|
export declare type TV1TokenSpendData = TUnknownDictionary;
|
|
383
421
|
|
|
384
422
|
/**
|