@stripchatdev/ext-helper 0.3.2 → 0.5.0
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 +285 -161
- package/dist/helpers/index.d.ts +122 -11
- package/dist/helpers/react.d.ts +122 -11
- package/dist/index.d.ts +123 -11
- package/package.json +7 -2
package/dist/helpers/index.d.ts
CHANGED
|
@@ -235,10 +235,15 @@ declare type TV1ChatMethods = {
|
|
|
235
235
|
};
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
|
|
238
|
+
declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents & TV1ShowEvents;
|
|
239
239
|
|
|
240
240
|
declare type TV1ExtContext = {
|
|
241
241
|
model?: TV1ExtModel;
|
|
242
|
+
/**
|
|
243
|
+
* Show the current user takes part in. Always present for the model while they are producing a show,
|
|
244
|
+
* and present for a user only while that user is a participant of the show. Otherwise it is absent.
|
|
245
|
+
*/
|
|
246
|
+
show?: TV1ExtShow;
|
|
242
247
|
/** Unique identifier for the extension. */
|
|
243
248
|
slug?: string;
|
|
244
249
|
user?: TV1ExtUser;
|
|
@@ -247,10 +252,15 @@ declare type TV1ExtContext = {
|
|
|
247
252
|
declare type TV1ExtEvents = {
|
|
248
253
|
'v1.ext.activity.available': null;
|
|
249
254
|
'v1.ext.activity.busy': null;
|
|
255
|
+
'v1.ext.activity.granted': {
|
|
256
|
+
durationMs: number;
|
|
257
|
+
};
|
|
250
258
|
'v1.ext.context.updated': {
|
|
251
259
|
context: TV1ExtContext;
|
|
252
260
|
};
|
|
253
261
|
/**
|
|
262
|
+
* @deprecated This event will be removed in a future release.
|
|
263
|
+
*
|
|
254
264
|
* Fired whenever the viewer counts for the room change.
|
|
255
265
|
* Emitted only for show types: `public`, `groupShow`, `ticketShow`.
|
|
256
266
|
*/
|
|
@@ -308,6 +318,8 @@ declare type TV1ExtLoggedInUser = {
|
|
|
308
318
|
* - `ticketShow` — ticket show context
|
|
309
319
|
* - `off` — offline
|
|
310
320
|
* - `spy` — spying on a private show
|
|
321
|
+
*
|
|
322
|
+
* @deprecated Use `context.show` to check whether the user is a participant of the show. This field will be removed in a future release.
|
|
311
323
|
*/
|
|
312
324
|
status: TV1UserStatus;
|
|
313
325
|
/** User username. */
|
|
@@ -378,6 +390,8 @@ declare type TV1ExtMethods = {
|
|
|
378
390
|
result: null;
|
|
379
391
|
};
|
|
380
392
|
/**
|
|
393
|
+
* @deprecated This method will be removed in a future release.
|
|
394
|
+
*
|
|
381
395
|
* Returns the current viewer counts for the room.
|
|
382
396
|
* Supported only for show types: `public`, `groupShow`, `ticketShow`.
|
|
383
397
|
* Returns `null` for other show types.
|
|
@@ -436,16 +450,13 @@ declare type TV1ExtModel = {
|
|
|
436
450
|
isSpyEnabled: boolean;
|
|
437
451
|
/** Model's name from her profile. If not set, an empty string will be returned */
|
|
438
452
|
name: string;
|
|
439
|
-
/**
|
|
453
|
+
/** Presence of the model on the site. When it is `show`, read `context.show.status` for the type of the show. */
|
|
454
|
+
state: TV1ModelState;
|
|
455
|
+
/**
|
|
456
|
+
* Status of the show.
|
|
440
457
|
*
|
|
441
|
-
*
|
|
442
|
-
|
|
443
|
-
* - `private` - model is in private show
|
|
444
|
-
* - `exclusivePrivate` - model is in exclusive private show
|
|
445
|
-
* - `off` - model is offline
|
|
446
|
-
* - `groupShow` - model is in group show that is not a ticket show
|
|
447
|
-
* - `ticketShow` - model is in ticket show
|
|
448
|
-
* */
|
|
458
|
+
* @deprecated Use `context.show.status` for show-type checks and `state` for the presence of the model.
|
|
459
|
+
*/
|
|
449
460
|
status: TV1ModelStatus;
|
|
450
461
|
/** Model's username */
|
|
451
462
|
username: string;
|
|
@@ -468,6 +479,28 @@ declare type TV1ExtModelTag = {
|
|
|
468
479
|
|
|
469
480
|
declare type TV1ExtSettings = unknown;
|
|
470
481
|
|
|
482
|
+
/**
|
|
483
|
+
* Show that is currently running in the room.
|
|
484
|
+
*
|
|
485
|
+
* Present in the extension context only for participants of the show: always for the model,
|
|
486
|
+
* and for a user only while that user is a participant. It is absent for everyone else,
|
|
487
|
+
* for example for a user watching the room while the model is in a private show with somebody else,
|
|
488
|
+
* or while the user is spying on a private show.
|
|
489
|
+
*
|
|
490
|
+
* A spy viewer is not a participant of the show, so `context.show` remains undefined in that case.
|
|
491
|
+
* Extensions are not running while the user spies on a show, so an extension never observes spy mode
|
|
492
|
+
* and there is no `spy` value in `context.show.status`.
|
|
493
|
+
*
|
|
494
|
+
* Use `context.show` to branch on the type of the show and `v1.show.participants.get` to read who takes part in it.
|
|
495
|
+
*/
|
|
496
|
+
declare type TV1ExtShow = {
|
|
497
|
+
/** Type of the show. */
|
|
498
|
+
status: TV1ExtShowStatus;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
/** Type of the show that is currently running in the room. */
|
|
502
|
+
declare type TV1ExtShowStatus = typeof V1_SHOW_STATUSES.STATUS_PUBLIC | typeof V1_SHOW_STATUSES.STATUS_GROUP_SHOW | typeof V1_SHOW_STATUSES.STATUS_TICKET_SHOW | typeof V1_SHOW_STATUSES.STATUS_PRIVATE | typeof V1_SHOW_STATUSES.STATUS_EXCLUSIVE_PRIVATE;
|
|
503
|
+
|
|
471
504
|
declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
|
|
472
505
|
|
|
473
506
|
/** Viewer counts for the current room. */
|
|
@@ -536,7 +569,7 @@ declare type TV1GoalMethods = {
|
|
|
536
569
|
};
|
|
537
570
|
};
|
|
538
571
|
|
|
539
|
-
declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods;
|
|
572
|
+
declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods & TV1ShowMethods;
|
|
540
573
|
|
|
541
574
|
declare type TV1ModelEvents = {
|
|
542
575
|
'v1.model.ext.settings.set.requested': null;
|
|
@@ -558,6 +591,15 @@ declare type TV1ModelMethods = {
|
|
|
558
591
|
};
|
|
559
592
|
};
|
|
560
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Presence of the model on the site.
|
|
596
|
+
*
|
|
597
|
+
* - `off` — model is not on the site
|
|
598
|
+
* - `idle` — model is on the site but not producing a show
|
|
599
|
+
* - `show` — model is producing a show
|
|
600
|
+
*/
|
|
601
|
+
declare type TV1ModelState = (typeof V1_MODEL_STATES)[keyof typeof V1_MODEL_STATES];
|
|
602
|
+
|
|
561
603
|
/** Status that indicates which type of show model is producing now */
|
|
562
604
|
declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
|
|
563
605
|
|
|
@@ -826,6 +868,42 @@ declare type TV1SessionUpdate = {
|
|
|
826
868
|
*/
|
|
827
869
|
declare type TV1SessionWhisperData = TUnknownDictionary;
|
|
828
870
|
|
|
871
|
+
declare type TV1ShowEvents = {
|
|
872
|
+
/**
|
|
873
|
+
* Fired when the participants of the show change, for example when a user joins or leaves the show.
|
|
874
|
+
*
|
|
875
|
+
* Emitted for the model and for participants of the show.
|
|
876
|
+
*/
|
|
877
|
+
'v1.show.participants.updated': {
|
|
878
|
+
data: {
|
|
879
|
+
/** Logged-in users that take part in the show. */
|
|
880
|
+
participants: TV1ExtLoggedInUser[];
|
|
881
|
+
/** Total number of participants of the show, including guests that are not listed in `participants`. */
|
|
882
|
+
total: number;
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
declare type TV1ShowMethods = {
|
|
888
|
+
/**
|
|
889
|
+
* Returns the users that take part in the show currently running in the room.
|
|
890
|
+
*
|
|
891
|
+
* Available for the model and for participants of the show. Check that `context.show` is present before calling.
|
|
892
|
+
*
|
|
893
|
+
* Guests are never listed in `participants`, but they are counted in `total`.
|
|
894
|
+
* Participants might change during the show, so subscribe to `v1.show.participants.updated` to listen to these changes.
|
|
895
|
+
*/
|
|
896
|
+
'v1.show.participants.get': {
|
|
897
|
+
params: null;
|
|
898
|
+
result: {
|
|
899
|
+
/** Logged-in users that take part in the show. */
|
|
900
|
+
participants: TV1ExtLoggedInUser[];
|
|
901
|
+
/** Total number of participants of the show, including guests that are not listed in `participants`. */
|
|
902
|
+
total: number;
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
|
|
829
907
|
declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
|
|
830
908
|
|
|
831
909
|
declare type TV1StorageMethods = {
|
|
@@ -1049,6 +1127,30 @@ declare type TV1SystemMethods = {
|
|
|
1049
1127
|
};
|
|
1050
1128
|
result: null;
|
|
1051
1129
|
};
|
|
1130
|
+
'v1.system.report.performance': {
|
|
1131
|
+
params: {
|
|
1132
|
+
/** How long the extension held an activity it asked for. */
|
|
1133
|
+
activeMs: number;
|
|
1134
|
+
/** Shared-thread figures: these describe the whole extension tier, not one extension. */
|
|
1135
|
+
blockedMs: number;
|
|
1136
|
+
blocks: number;
|
|
1137
|
+
longestBlockMs: number;
|
|
1138
|
+
/** The worst single callback of this frame's own. */
|
|
1139
|
+
longestTaskMs: number;
|
|
1140
|
+
/** Time spent inside this frame's own callbacks. This one belongs to this extension. */
|
|
1141
|
+
selfTimeMs: number;
|
|
1142
|
+
/** The part of it spent while the extension held an activity. */
|
|
1143
|
+
selfTimeWhileActiveMs: number;
|
|
1144
|
+
/** Callbacks measured: the denominator that separates "idle" from "not instrumented". */
|
|
1145
|
+
tasks: number;
|
|
1146
|
+
/** Watchdog ticks attempted, the denominator for the shared-thread figures. */
|
|
1147
|
+
ticks: number;
|
|
1148
|
+
/** The tab was hidden during the window, where the browser throttles timers. */
|
|
1149
|
+
wasHidden: boolean;
|
|
1150
|
+
windowMs: number;
|
|
1151
|
+
};
|
|
1152
|
+
result: null;
|
|
1153
|
+
};
|
|
1052
1154
|
'v1.system.resize.notify': {
|
|
1053
1155
|
params: {
|
|
1054
1156
|
height: number;
|
|
@@ -1238,6 +1340,15 @@ declare type TV2WhisperData = {
|
|
|
1238
1340
|
tokenSum: number | null;
|
|
1239
1341
|
};
|
|
1240
1342
|
|
|
1343
|
+
declare const V1_MODEL_STATES: {
|
|
1344
|
+
/** Model is not on the site */
|
|
1345
|
+
readonly STATUS_OFF: "off";
|
|
1346
|
+
/** Model is on the site but not producing a show */
|
|
1347
|
+
readonly STATUS_IDLE: "idle";
|
|
1348
|
+
/** Model is producing a show */
|
|
1349
|
+
readonly STATUS_SHOW: "show";
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1241
1352
|
declare const V1_SHOW_STATUSES: {
|
|
1242
1353
|
/** Ticket show */
|
|
1243
1354
|
readonly STATUS_TICKET_SHOW: "ticketShow";
|
package/dist/helpers/react.d.ts
CHANGED
|
@@ -169,10 +169,15 @@ declare type TV1ChatMethods = {
|
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
|
|
172
|
+
declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents & TV1ShowEvents;
|
|
173
173
|
|
|
174
174
|
declare type TV1ExtContext = {
|
|
175
175
|
model?: TV1ExtModel;
|
|
176
|
+
/**
|
|
177
|
+
* Show the current user takes part in. Always present for the model while they are producing a show,
|
|
178
|
+
* and present for a user only while that user is a participant of the show. Otherwise it is absent.
|
|
179
|
+
*/
|
|
180
|
+
show?: TV1ExtShow;
|
|
176
181
|
/** Unique identifier for the extension. */
|
|
177
182
|
slug?: string;
|
|
178
183
|
user?: TV1ExtUser;
|
|
@@ -181,10 +186,15 @@ declare type TV1ExtContext = {
|
|
|
181
186
|
declare type TV1ExtEvents = {
|
|
182
187
|
'v1.ext.activity.available': null;
|
|
183
188
|
'v1.ext.activity.busy': null;
|
|
189
|
+
'v1.ext.activity.granted': {
|
|
190
|
+
durationMs: number;
|
|
191
|
+
};
|
|
184
192
|
'v1.ext.context.updated': {
|
|
185
193
|
context: TV1ExtContext;
|
|
186
194
|
};
|
|
187
195
|
/**
|
|
196
|
+
* @deprecated This event will be removed in a future release.
|
|
197
|
+
*
|
|
188
198
|
* Fired whenever the viewer counts for the room change.
|
|
189
199
|
* Emitted only for show types: `public`, `groupShow`, `ticketShow`.
|
|
190
200
|
*/
|
|
@@ -242,6 +252,8 @@ declare type TV1ExtLoggedInUser = {
|
|
|
242
252
|
* - `ticketShow` — ticket show context
|
|
243
253
|
* - `off` — offline
|
|
244
254
|
* - `spy` — spying on a private show
|
|
255
|
+
*
|
|
256
|
+
* @deprecated Use `context.show` to check whether the user is a participant of the show. This field will be removed in a future release.
|
|
245
257
|
*/
|
|
246
258
|
status: TV1UserStatus;
|
|
247
259
|
/** User username. */
|
|
@@ -312,6 +324,8 @@ declare type TV1ExtMethods = {
|
|
|
312
324
|
result: null;
|
|
313
325
|
};
|
|
314
326
|
/**
|
|
327
|
+
* @deprecated This method will be removed in a future release.
|
|
328
|
+
*
|
|
315
329
|
* Returns the current viewer counts for the room.
|
|
316
330
|
* Supported only for show types: `public`, `groupShow`, `ticketShow`.
|
|
317
331
|
* Returns `null` for other show types.
|
|
@@ -370,16 +384,13 @@ declare type TV1ExtModel = {
|
|
|
370
384
|
isSpyEnabled: boolean;
|
|
371
385
|
/** Model's name from her profile. If not set, an empty string will be returned */
|
|
372
386
|
name: string;
|
|
373
|
-
/**
|
|
387
|
+
/** Presence of the model on the site. When it is `show`, read `context.show.status` for the type of the show. */
|
|
388
|
+
state: TV1ModelState;
|
|
389
|
+
/**
|
|
390
|
+
* Status of the show.
|
|
374
391
|
*
|
|
375
|
-
*
|
|
376
|
-
|
|
377
|
-
* - `private` - model is in private show
|
|
378
|
-
* - `exclusivePrivate` - model is in exclusive private show
|
|
379
|
-
* - `off` - model is offline
|
|
380
|
-
* - `groupShow` - model is in group show that is not a ticket show
|
|
381
|
-
* - `ticketShow` - model is in ticket show
|
|
382
|
-
* */
|
|
392
|
+
* @deprecated Use `context.show.status` for show-type checks and `state` for the presence of the model.
|
|
393
|
+
*/
|
|
383
394
|
status: TV1ModelStatus;
|
|
384
395
|
/** Model's username */
|
|
385
396
|
username: string;
|
|
@@ -402,6 +413,28 @@ declare type TV1ExtModelTag = {
|
|
|
402
413
|
|
|
403
414
|
declare type TV1ExtSettings = unknown;
|
|
404
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Show that is currently running in the room.
|
|
418
|
+
*
|
|
419
|
+
* Present in the extension context only for participants of the show: always for the model,
|
|
420
|
+
* and for a user only while that user is a participant. It is absent for everyone else,
|
|
421
|
+
* for example for a user watching the room while the model is in a private show with somebody else,
|
|
422
|
+
* or while the user is spying on a private show.
|
|
423
|
+
*
|
|
424
|
+
* A spy viewer is not a participant of the show, so `context.show` remains undefined in that case.
|
|
425
|
+
* Extensions are not running while the user spies on a show, so an extension never observes spy mode
|
|
426
|
+
* and there is no `spy` value in `context.show.status`.
|
|
427
|
+
*
|
|
428
|
+
* Use `context.show` to branch on the type of the show and `v1.show.participants.get` to read who takes part in it.
|
|
429
|
+
*/
|
|
430
|
+
declare type TV1ExtShow = {
|
|
431
|
+
/** Type of the show. */
|
|
432
|
+
status: TV1ExtShowStatus;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
/** Type of the show that is currently running in the room. */
|
|
436
|
+
declare type TV1ExtShowStatus = typeof V1_SHOW_STATUSES.STATUS_PUBLIC | typeof V1_SHOW_STATUSES.STATUS_GROUP_SHOW | typeof V1_SHOW_STATUSES.STATUS_TICKET_SHOW | typeof V1_SHOW_STATUSES.STATUS_PRIVATE | typeof V1_SHOW_STATUSES.STATUS_EXCLUSIVE_PRIVATE;
|
|
437
|
+
|
|
405
438
|
declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
|
|
406
439
|
|
|
407
440
|
/** Viewer counts for the current room. */
|
|
@@ -470,7 +503,7 @@ declare type TV1GoalMethods = {
|
|
|
470
503
|
};
|
|
471
504
|
};
|
|
472
505
|
|
|
473
|
-
declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods;
|
|
506
|
+
declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods & TV1ShowMethods;
|
|
474
507
|
|
|
475
508
|
declare type TV1ModelEvents = {
|
|
476
509
|
'v1.model.ext.settings.set.requested': null;
|
|
@@ -492,6 +525,15 @@ declare type TV1ModelMethods = {
|
|
|
492
525
|
};
|
|
493
526
|
};
|
|
494
527
|
|
|
528
|
+
/**
|
|
529
|
+
* Presence of the model on the site.
|
|
530
|
+
*
|
|
531
|
+
* - `off` — model is not on the site
|
|
532
|
+
* - `idle` — model is on the site but not producing a show
|
|
533
|
+
* - `show` — model is producing a show
|
|
534
|
+
*/
|
|
535
|
+
declare type TV1ModelState = (typeof V1_MODEL_STATES)[keyof typeof V1_MODEL_STATES];
|
|
536
|
+
|
|
495
537
|
/** Status that indicates which type of show model is producing now */
|
|
496
538
|
declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
|
|
497
539
|
|
|
@@ -760,6 +802,42 @@ declare type TV1SessionUpdate = {
|
|
|
760
802
|
*/
|
|
761
803
|
declare type TV1SessionWhisperData = TUnknownDictionary;
|
|
762
804
|
|
|
805
|
+
declare type TV1ShowEvents = {
|
|
806
|
+
/**
|
|
807
|
+
* Fired when the participants of the show change, for example when a user joins or leaves the show.
|
|
808
|
+
*
|
|
809
|
+
* Emitted for the model and for participants of the show.
|
|
810
|
+
*/
|
|
811
|
+
'v1.show.participants.updated': {
|
|
812
|
+
data: {
|
|
813
|
+
/** Logged-in users that take part in the show. */
|
|
814
|
+
participants: TV1ExtLoggedInUser[];
|
|
815
|
+
/** Total number of participants of the show, including guests that are not listed in `participants`. */
|
|
816
|
+
total: number;
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
declare type TV1ShowMethods = {
|
|
822
|
+
/**
|
|
823
|
+
* Returns the users that take part in the show currently running in the room.
|
|
824
|
+
*
|
|
825
|
+
* Available for the model and for participants of the show. Check that `context.show` is present before calling.
|
|
826
|
+
*
|
|
827
|
+
* Guests are never listed in `participants`, but they are counted in `total`.
|
|
828
|
+
* Participants might change during the show, so subscribe to `v1.show.participants.updated` to listen to these changes.
|
|
829
|
+
*/
|
|
830
|
+
'v1.show.participants.get': {
|
|
831
|
+
params: null;
|
|
832
|
+
result: {
|
|
833
|
+
/** Logged-in users that take part in the show. */
|
|
834
|
+
participants: TV1ExtLoggedInUser[];
|
|
835
|
+
/** Total number of participants of the show, including guests that are not listed in `participants`. */
|
|
836
|
+
total: number;
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
|
|
763
841
|
declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
|
|
764
842
|
|
|
765
843
|
declare type TV1StorageMethods = {
|
|
@@ -983,6 +1061,30 @@ declare type TV1SystemMethods = {
|
|
|
983
1061
|
};
|
|
984
1062
|
result: null;
|
|
985
1063
|
};
|
|
1064
|
+
'v1.system.report.performance': {
|
|
1065
|
+
params: {
|
|
1066
|
+
/** How long the extension held an activity it asked for. */
|
|
1067
|
+
activeMs: number;
|
|
1068
|
+
/** Shared-thread figures: these describe the whole extension tier, not one extension. */
|
|
1069
|
+
blockedMs: number;
|
|
1070
|
+
blocks: number;
|
|
1071
|
+
longestBlockMs: number;
|
|
1072
|
+
/** The worst single callback of this frame's own. */
|
|
1073
|
+
longestTaskMs: number;
|
|
1074
|
+
/** Time spent inside this frame's own callbacks. This one belongs to this extension. */
|
|
1075
|
+
selfTimeMs: number;
|
|
1076
|
+
/** The part of it spent while the extension held an activity. */
|
|
1077
|
+
selfTimeWhileActiveMs: number;
|
|
1078
|
+
/** Callbacks measured: the denominator that separates "idle" from "not instrumented". */
|
|
1079
|
+
tasks: number;
|
|
1080
|
+
/** Watchdog ticks attempted, the denominator for the shared-thread figures. */
|
|
1081
|
+
ticks: number;
|
|
1082
|
+
/** The tab was hidden during the window, where the browser throttles timers. */
|
|
1083
|
+
wasHidden: boolean;
|
|
1084
|
+
windowMs: number;
|
|
1085
|
+
};
|
|
1086
|
+
result: null;
|
|
1087
|
+
};
|
|
986
1088
|
'v1.system.resize.notify': {
|
|
987
1089
|
params: {
|
|
988
1090
|
height: number;
|
|
@@ -1190,6 +1292,15 @@ export declare const useSlotState: <State extends object>({ channel, extHelper,
|
|
|
1190
1292
|
state: State | null;
|
|
1191
1293
|
};
|
|
1192
1294
|
|
|
1295
|
+
declare const V1_MODEL_STATES: {
|
|
1296
|
+
/** Model is not on the site */
|
|
1297
|
+
readonly STATUS_OFF: "off";
|
|
1298
|
+
/** Model is on the site but not producing a show */
|
|
1299
|
+
readonly STATUS_IDLE: "idle";
|
|
1300
|
+
/** Model is producing a show */
|
|
1301
|
+
readonly STATUS_SHOW: "show";
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1193
1304
|
declare const V1_SHOW_STATUSES: {
|
|
1194
1305
|
/** Ticket show */
|
|
1195
1306
|
readonly STATUS_TICKET_SHOW: "ticketShow";
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare class ExtHelper implements TExtHelper {
|
|
|
4
4
|
private rpcClient;
|
|
5
5
|
private subscriber;
|
|
6
6
|
private crashReporter;
|
|
7
|
+
private performanceReporter;
|
|
7
8
|
constructor(props: TExtHelperProps);
|
|
8
9
|
makeRequest<M extends Extract<keyof TApiContract['methods'], string>>(method: M, params: TApiContract['methods'][M]['params']): Promise<TV1Methods[M]["result"]>;
|
|
9
10
|
subscribe<E extends Extract<keyof TApiContract['events'], string>>(eventName: E, handler: TAnyPubSubHandler<TApiContract['events'][E]>): void;
|
|
@@ -210,10 +211,15 @@ declare type TV1ChatMethods = {
|
|
|
210
211
|
};
|
|
211
212
|
};
|
|
212
213
|
|
|
213
|
-
export declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
|
|
214
|
+
export declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents & TV1ShowEvents;
|
|
214
215
|
|
|
215
216
|
export declare type TV1ExtContext = {
|
|
216
217
|
model?: TV1ExtModel;
|
|
218
|
+
/**
|
|
219
|
+
* Show the current user takes part in. Always present for the model while they are producing a show,
|
|
220
|
+
* and present for a user only while that user is a participant of the show. Otherwise it is absent.
|
|
221
|
+
*/
|
|
222
|
+
show?: TV1ExtShow;
|
|
217
223
|
/** Unique identifier for the extension. */
|
|
218
224
|
slug?: string;
|
|
219
225
|
user?: TV1ExtUser;
|
|
@@ -228,10 +234,15 @@ export declare type TV1ExtensionError<TCode extends string = string, TDetails ex
|
|
|
228
234
|
declare type TV1ExtEvents = {
|
|
229
235
|
'v1.ext.activity.available': null;
|
|
230
236
|
'v1.ext.activity.busy': null;
|
|
237
|
+
'v1.ext.activity.granted': {
|
|
238
|
+
durationMs: number;
|
|
239
|
+
};
|
|
231
240
|
'v1.ext.context.updated': {
|
|
232
241
|
context: TV1ExtContext;
|
|
233
242
|
};
|
|
234
243
|
/**
|
|
244
|
+
* @deprecated This event will be removed in a future release.
|
|
245
|
+
*
|
|
235
246
|
* Fired whenever the viewer counts for the room change.
|
|
236
247
|
* Emitted only for show types: `public`, `groupShow`, `ticketShow`.
|
|
237
248
|
*/
|
|
@@ -289,6 +300,8 @@ export declare type TV1ExtLoggedInUser = {
|
|
|
289
300
|
* - `ticketShow` — ticket show context
|
|
290
301
|
* - `off` — offline
|
|
291
302
|
* - `spy` — spying on a private show
|
|
303
|
+
*
|
|
304
|
+
* @deprecated Use `context.show` to check whether the user is a participant of the show. This field will be removed in a future release.
|
|
292
305
|
*/
|
|
293
306
|
status: TV1UserStatus;
|
|
294
307
|
/** User username. */
|
|
@@ -359,6 +372,8 @@ declare type TV1ExtMethods = {
|
|
|
359
372
|
result: null;
|
|
360
373
|
};
|
|
361
374
|
/**
|
|
375
|
+
* @deprecated This method will be removed in a future release.
|
|
376
|
+
*
|
|
362
377
|
* Returns the current viewer counts for the room.
|
|
363
378
|
* Supported only for show types: `public`, `groupShow`, `ticketShow`.
|
|
364
379
|
* Returns `null` for other show types.
|
|
@@ -417,16 +432,13 @@ export declare type TV1ExtModel = {
|
|
|
417
432
|
isSpyEnabled: boolean;
|
|
418
433
|
/** Model's name from her profile. If not set, an empty string will be returned */
|
|
419
434
|
name: string;
|
|
420
|
-
/**
|
|
435
|
+
/** Presence of the model on the site. When it is `show`, read `context.show.status` for the type of the show. */
|
|
436
|
+
state: TV1ModelState;
|
|
437
|
+
/**
|
|
438
|
+
* Status of the show.
|
|
421
439
|
*
|
|
422
|
-
*
|
|
423
|
-
|
|
424
|
-
* - `private` - model is in private show
|
|
425
|
-
* - `exclusivePrivate` - model is in exclusive private show
|
|
426
|
-
* - `off` - model is offline
|
|
427
|
-
* - `groupShow` - model is in group show that is not a ticket show
|
|
428
|
-
* - `ticketShow` - model is in ticket show
|
|
429
|
-
* */
|
|
440
|
+
* @deprecated Use `context.show.status` for show-type checks and `state` for the presence of the model.
|
|
441
|
+
*/
|
|
430
442
|
status: TV1ModelStatus;
|
|
431
443
|
/** Model's username */
|
|
432
444
|
username: string;
|
|
@@ -449,6 +461,28 @@ export declare type TV1ExtModelTag = {
|
|
|
449
461
|
|
|
450
462
|
export declare type TV1ExtSettings = unknown;
|
|
451
463
|
|
|
464
|
+
/**
|
|
465
|
+
* Show that is currently running in the room.
|
|
466
|
+
*
|
|
467
|
+
* Present in the extension context only for participants of the show: always for the model,
|
|
468
|
+
* and for a user only while that user is a participant. It is absent for everyone else,
|
|
469
|
+
* for example for a user watching the room while the model is in a private show with somebody else,
|
|
470
|
+
* or while the user is spying on a private show.
|
|
471
|
+
*
|
|
472
|
+
* A spy viewer is not a participant of the show, so `context.show` remains undefined in that case.
|
|
473
|
+
* Extensions are not running while the user spies on a show, so an extension never observes spy mode
|
|
474
|
+
* and there is no `spy` value in `context.show.status`.
|
|
475
|
+
*
|
|
476
|
+
* Use `context.show` to branch on the type of the show and `v1.show.participants.get` to read who takes part in it.
|
|
477
|
+
*/
|
|
478
|
+
export declare type TV1ExtShow = {
|
|
479
|
+
/** Type of the show. */
|
|
480
|
+
status: TV1ExtShowStatus;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
/** Type of the show that is currently running in the room. */
|
|
484
|
+
export declare type TV1ExtShowStatus = typeof V1_SHOW_STATUSES.STATUS_PUBLIC | typeof V1_SHOW_STATUSES.STATUS_GROUP_SHOW | typeof V1_SHOW_STATUSES.STATUS_TICKET_SHOW | typeof V1_SHOW_STATUSES.STATUS_PRIVATE | typeof V1_SHOW_STATUSES.STATUS_EXCLUSIVE_PRIVATE;
|
|
485
|
+
|
|
452
486
|
export declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
|
|
453
487
|
|
|
454
488
|
/** Viewer counts for the current room. */
|
|
@@ -522,7 +556,7 @@ export declare type TV1MethodErrors = {
|
|
|
522
556
|
'v1.storage.string.set': TV1StorageStringSetError;
|
|
523
557
|
};
|
|
524
558
|
|
|
525
|
-
export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods;
|
|
559
|
+
export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods & TV1ShowMethods;
|
|
526
560
|
|
|
527
561
|
declare type TV1ModelEvents = {
|
|
528
562
|
'v1.model.ext.settings.set.requested': null;
|
|
@@ -544,6 +578,15 @@ declare type TV1ModelMethods = {
|
|
|
544
578
|
};
|
|
545
579
|
};
|
|
546
580
|
|
|
581
|
+
/**
|
|
582
|
+
* Presence of the model on the site.
|
|
583
|
+
*
|
|
584
|
+
* - `off` — model is not on the site
|
|
585
|
+
* - `idle` — model is on the site but not producing a show
|
|
586
|
+
* - `show` — model is producing a show
|
|
587
|
+
*/
|
|
588
|
+
export declare type TV1ModelState = (typeof V1_MODEL_STATES)[keyof typeof V1_MODEL_STATES];
|
|
589
|
+
|
|
547
590
|
/** Status that indicates which type of show model is producing now */
|
|
548
591
|
export declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
|
|
549
592
|
|
|
@@ -812,6 +855,42 @@ export declare type TV1SessionUpdate = {
|
|
|
812
855
|
*/
|
|
813
856
|
export declare type TV1SessionWhisperData = TUnknownDictionary;
|
|
814
857
|
|
|
858
|
+
declare type TV1ShowEvents = {
|
|
859
|
+
/**
|
|
860
|
+
* Fired when the participants of the show change, for example when a user joins or leaves the show.
|
|
861
|
+
*
|
|
862
|
+
* Emitted for the model and for participants of the show.
|
|
863
|
+
*/
|
|
864
|
+
'v1.show.participants.updated': {
|
|
865
|
+
data: {
|
|
866
|
+
/** Logged-in users that take part in the show. */
|
|
867
|
+
participants: TV1ExtLoggedInUser[];
|
|
868
|
+
/** Total number of participants of the show, including guests that are not listed in `participants`. */
|
|
869
|
+
total: number;
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
declare type TV1ShowMethods = {
|
|
875
|
+
/**
|
|
876
|
+
* Returns the users that take part in the show currently running in the room.
|
|
877
|
+
*
|
|
878
|
+
* Available for the model and for participants of the show. Check that `context.show` is present before calling.
|
|
879
|
+
*
|
|
880
|
+
* Guests are never listed in `participants`, but they are counted in `total`.
|
|
881
|
+
* Participants might change during the show, so subscribe to `v1.show.participants.updated` to listen to these changes.
|
|
882
|
+
*/
|
|
883
|
+
'v1.show.participants.get': {
|
|
884
|
+
params: null;
|
|
885
|
+
result: {
|
|
886
|
+
/** Logged-in users that take part in the show. */
|
|
887
|
+
participants: TV1ExtLoggedInUser[];
|
|
888
|
+
/** Total number of participants of the show, including guests that are not listed in `participants`. */
|
|
889
|
+
total: number;
|
|
890
|
+
};
|
|
891
|
+
};
|
|
892
|
+
};
|
|
893
|
+
|
|
815
894
|
export declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
|
|
816
895
|
|
|
817
896
|
declare type TV1StorageMethods = {
|
|
@@ -1043,6 +1122,30 @@ declare type TV1SystemMethods = {
|
|
|
1043
1122
|
};
|
|
1044
1123
|
result: null;
|
|
1045
1124
|
};
|
|
1125
|
+
'v1.system.report.performance': {
|
|
1126
|
+
params: {
|
|
1127
|
+
/** How long the extension held an activity it asked for. */
|
|
1128
|
+
activeMs: number;
|
|
1129
|
+
/** Shared-thread figures: these describe the whole extension tier, not one extension. */
|
|
1130
|
+
blockedMs: number;
|
|
1131
|
+
blocks: number;
|
|
1132
|
+
longestBlockMs: number;
|
|
1133
|
+
/** The worst single callback of this frame's own. */
|
|
1134
|
+
longestTaskMs: number;
|
|
1135
|
+
/** Time spent inside this frame's own callbacks. This one belongs to this extension. */
|
|
1136
|
+
selfTimeMs: number;
|
|
1137
|
+
/** The part of it spent while the extension held an activity. */
|
|
1138
|
+
selfTimeWhileActiveMs: number;
|
|
1139
|
+
/** Callbacks measured: the denominator that separates "idle" from "not instrumented". */
|
|
1140
|
+
tasks: number;
|
|
1141
|
+
/** Watchdog ticks attempted, the denominator for the shared-thread figures. */
|
|
1142
|
+
ticks: number;
|
|
1143
|
+
/** The tab was hidden during the window, where the browser throttles timers. */
|
|
1144
|
+
wasHidden: boolean;
|
|
1145
|
+
windowMs: number;
|
|
1146
|
+
};
|
|
1147
|
+
result: null;
|
|
1148
|
+
};
|
|
1046
1149
|
'v1.system.resize.notify': {
|
|
1047
1150
|
params: {
|
|
1048
1151
|
height: number;
|
|
@@ -1232,6 +1335,15 @@ export declare type TV2WhisperData = {
|
|
|
1232
1335
|
tokenSum: number | null;
|
|
1233
1336
|
};
|
|
1234
1337
|
|
|
1338
|
+
export declare const V1_MODEL_STATES: {
|
|
1339
|
+
/** Model is not on the site */
|
|
1340
|
+
readonly STATUS_OFF: "off";
|
|
1341
|
+
/** Model is on the site but not producing a show */
|
|
1342
|
+
readonly STATUS_IDLE: "idle";
|
|
1343
|
+
/** Model is producing a show */
|
|
1344
|
+
readonly STATUS_SHOW: "show";
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1235
1347
|
export declare const V1_SHOW_STATUSES: {
|
|
1236
1348
|
/** Ticket show */
|
|
1237
1349
|
readonly STATUS_TICKET_SHOW: "ticketShow";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripchatdev/ext-helper",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "./dist/ext-helper.js",
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"build:clean": "rm -rf ./dist ./dist-types",
|
|
12
12
|
"build:types": "tsc -b --force && api-extractor run --local -c api-extractor.json && api-extractor run --local -c api-extractor.helpers.json && api-extractor run --local -c api-extractor.helpers-react.json",
|
|
13
13
|
"build:clean-artefacts": "rm -rf ./dist-types",
|
|
14
|
-
"build": "npm run build:clean && npm run build:code && npm run build:types && npm run build:clean-artefacts"
|
|
14
|
+
"build": "npm run build:clean && npm run build:code && npm run build:types && npm run build:clean-artefacts",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"dist",
|
|
@@ -49,5 +51,8 @@
|
|
|
49
51
|
"react": {
|
|
50
52
|
"optional": true
|
|
51
53
|
}
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"vitest": "4.1.2"
|
|
52
57
|
}
|
|
53
58
|
}
|