@stripchatdev/ext-helper 0.3.1 → 0.4.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.
@@ -119,6 +119,8 @@ export declare type TSlotStateSnapshot<State extends object> = {
119
119
  state: State | null;
120
120
  };
121
121
 
122
+ declare type TTheme = 'light' | 'dark';
123
+
122
124
  declare type TTransportPeer = {
123
125
  id: string;
124
126
  };
@@ -143,6 +145,8 @@ declare type TV1ActionResult = {
143
145
  code: number;
144
146
  };
145
147
 
148
+ declare type TV1AnalyticsTrackParams = TV1UiInteractionTrackParams;
149
+
146
150
  declare type TV1ChatEvents = {
147
151
  /** Triggered on every new message in a chat */
148
152
  'v1.chat.message.received': {
@@ -192,6 +196,20 @@ declare type TV1ChatMethods = {
192
196
  };
193
197
  result: null;
194
198
  };
199
+ /**
200
+ * Send a rich message to the chat with customizable colors.
201
+ *
202
+ * The message is sent locally on behalf of the extension. It is not sent to the server or broadcast — each user sees it only in their own local chat feed.
203
+ *
204
+ * Because the message is local, it is **not persisted**: it disappears from chat history when the page is reloaded.
205
+ *
206
+ * Required permission:
207
+ * - `richMessage`
208
+ */
209
+ 'v1.chat.richMessage.send': {
210
+ params: TV1RichMessage;
211
+ result: null;
212
+ };
195
213
  /** Use this method to send a message in the chat as a bot or model.
196
214
  * The message is sent locally to each user and looks like a normal chat message. The message is **not persisted** and will disappear from the chat after the page is reloaded.
197
215
  * */
@@ -217,10 +235,15 @@ declare type TV1ChatMethods = {
217
235
  };
218
236
  };
219
237
 
220
- declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
238
+ declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents & TV1ShowEvents;
221
239
 
222
240
  declare type TV1ExtContext = {
223
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;
224
247
  /** Unique identifier for the extension. */
225
248
  slug?: string;
226
249
  user?: TV1ExtUser;
@@ -233,6 +256,8 @@ declare type TV1ExtEvents = {
233
256
  context: TV1ExtContext;
234
257
  };
235
258
  /**
259
+ * @deprecated This event will be removed in a future release.
260
+ *
236
261
  * Fired whenever the viewer counts for the room change.
237
262
  * Emitted only for show types: `public`, `groupShow`, `ticketShow`.
238
263
  */
@@ -290,6 +315,8 @@ declare type TV1ExtLoggedInUser = {
290
315
  * - `ticketShow` — ticket show context
291
316
  * - `off` — offline
292
317
  * - `spy` — spying on a private show
318
+ *
319
+ * @deprecated Use `context.show` to check whether the user is a participant of the show. This field will be removed in a future release.
293
320
  */
294
321
  status: TV1UserStatus;
295
322
  /** User username. */
@@ -324,6 +351,19 @@ declare type TV1ExtMethods = {
324
351
  params: null;
325
352
  result: TV1ExtContext;
326
353
  };
354
+ /**
355
+ * Returns the tag from which the user navigated to the model.
356
+ * `tag` is `null` when the source tag is unknown.
357
+ *
358
+ * Required permission:
359
+ * - `modelTag`
360
+ */
361
+ 'v1.ext.modelTag.get': {
362
+ params: null;
363
+ result: {
364
+ tag: TV1ExtModelTag | null;
365
+ };
366
+ };
327
367
  'v1.ext.movableOverlay.update': {
328
368
  params: {
329
369
  message?: string;
@@ -340,11 +380,15 @@ declare type TV1ExtMethods = {
340
380
  /** Opens Stripchat sign-up dialog for anonymous users. Use this when your extension requires a registered account to function */
341
381
  'v1.ext.signup.open': {
342
382
  params: {
383
+ /** Optional source string to identify the origin of the sign-up request. Internal use only */
384
+ source?: string;
343
385
  type: 'user';
344
386
  };
345
387
  result: null;
346
388
  };
347
389
  /**
390
+ * @deprecated This method will be removed in a future release.
391
+ *
348
392
  * Returns the current viewer counts for the room.
349
393
  * Supported only for show types: `public`, `groupShow`, `ticketShow`.
350
394
  * Returns `null` for other show types.
@@ -403,23 +447,57 @@ declare type TV1ExtModel = {
403
447
  isSpyEnabled: boolean;
404
448
  /** Model's name from her profile. If not set, an empty string will be returned */
405
449
  name: string;
406
- /** Status of the show. Possible values:
450
+ /** Presence of the model on the site. When it is `show`, read `context.show.status` for the type of the show. */
451
+ state: TV1ModelState;
452
+ /**
453
+ * Status of the show.
407
454
  *
408
- * - `idle` - model is online but not streaming
409
- * - `public` - model is broadcasting public show
410
- * - `private` - model is in private show
411
- * - `exclusivePrivate` - model is in exclusive private show
412
- * - `off` - model is offline
413
- * - `groupShow` - model is in group show that is not a ticket show
414
- * - `ticketShow` - model is in ticket show
415
- * */
455
+ * @deprecated Use `context.show.status` for show-type checks and `state` for the presence of the model.
456
+ */
416
457
  status: TV1ModelStatus;
417
458
  /** Model's username */
418
459
  username: string;
419
460
  };
420
461
 
462
+ /**
463
+ * Tag from which the user navigated to the model.
464
+ *
465
+ * Required permission:
466
+ * - `modelTag`
467
+ */
468
+ declare type TV1ExtModelTag = {
469
+ /** Tag identifier, for example `autoTagNew` */
470
+ id: string;
471
+ /** Primary tag the tag belongs to */
472
+ primaryTagId: 'girls' | 'men' | 'trans' | 'couples';
473
+ /** Tag URL path, for example `girls/new` */
474
+ url: string;
475
+ };
476
+
421
477
  declare type TV1ExtSettings = unknown;
422
478
 
479
+ /**
480
+ * Show that is currently running in the room.
481
+ *
482
+ * Present in the extension context only for participants of the show: always for the model,
483
+ * and for a user only while that user is a participant. It is absent for everyone else,
484
+ * for example for a user watching the room while the model is in a private show with somebody else,
485
+ * or while the user is spying on a private show.
486
+ *
487
+ * A spy viewer is not a participant of the show, so `context.show` remains undefined in that case.
488
+ * Extensions are not running while the user spies on a show, so an extension never observes spy mode
489
+ * and there is no `spy` value in `context.show.status`.
490
+ *
491
+ * Use `context.show` to branch on the type of the show and `v1.show.participants.get` to read who takes part in it.
492
+ */
493
+ declare type TV1ExtShow = {
494
+ /** Type of the show. */
495
+ status: TV1ExtShowStatus;
496
+ };
497
+
498
+ /** Type of the show that is currently running in the room. */
499
+ 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;
500
+
423
501
  declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
424
502
 
425
503
  /** Viewer counts for the current room. */
@@ -488,7 +566,7 @@ declare type TV1GoalMethods = {
488
566
  };
489
567
  };
490
568
 
491
- declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods;
569
+ declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods & TV1ShowMethods;
492
570
 
493
571
  declare type TV1ModelEvents = {
494
572
  'v1.model.ext.settings.set.requested': null;
@@ -510,6 +588,15 @@ declare type TV1ModelMethods = {
510
588
  };
511
589
  };
512
590
 
591
+ /**
592
+ * Presence of the model on the site.
593
+ *
594
+ * - `off` — model is not on the site
595
+ * - `idle` — model is on the site but not producing a show
596
+ * - `show` — model is producing a show
597
+ */
598
+ declare type TV1ModelState = (typeof V1_MODEL_STATES)[keyof typeof V1_MODEL_STATES];
599
+
513
600
  /** Status that indicates which type of show model is producing now */
514
601
  declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
515
602
 
@@ -593,6 +680,52 @@ declare type TV1PrivateMethods = {
593
680
  };
594
681
  };
595
682
 
683
+ declare type TV1RichMessage = {
684
+ /** The main action appearance. It opens the extension tab on click. If omitted, the default action is a link. */
685
+ action?: {
686
+ text?: string;
687
+ type: 'link' | 'button';
688
+ };
689
+ /** One of the predefined extension icons. If omitted, the icon from the manifest is used. */
690
+ icon?: 'sex-toy-1' | 'sex-toy-2' | 'spicy-pepper';
691
+ /**
692
+ * Rich message subtitle.
693
+ *
694
+ * Supports inline markup tags:
695
+ * - `{#primary}...{/primary}` — uses the primary text color.
696
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
697
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
698
+ * - `{#bold}...{/bold}` — renders bold text.
699
+ *
700
+ * Example: `'won {#accent}Alice{/accent} in'`
701
+ */
702
+ subtitle: string;
703
+ /** Optional custom theme. If omitted, the default theme is used. */
704
+ theme?: {
705
+ [Property in TTheme]?: TV1RichMessageTheme;
706
+ };
707
+ /**
708
+ * Rich message title.
709
+ *
710
+ * Supports inline markup tags:
711
+ * - `{#primary}...{/primary}` — uses the primary text color.
712
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
713
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
714
+ * - `{#bold}...{/bold}` — renders bold text.
715
+ *
716
+ * Example: `'won {#accent}Alice{/accent} in'`
717
+ */
718
+ title: string;
719
+ };
720
+
721
+ declare type TV1RichMessageTheme = {
722
+ /** Rich message background color. Use a hex color. */
723
+ background: string;
724
+ buttonText: 'white' | 'dark';
725
+ /** Main accent color of the rich message, used for the sidebar, highlights, links, and buttons. Use a hex color. */
726
+ main: string;
727
+ };
728
+
596
729
  declare type TV1SerializedError = {
597
730
  cause?: TV1SerializedError;
598
731
  message: string;
@@ -732,6 +865,42 @@ declare type TV1SessionUpdate = {
732
865
  */
733
866
  declare type TV1SessionWhisperData = TUnknownDictionary;
734
867
 
868
+ declare type TV1ShowEvents = {
869
+ /**
870
+ * Fired when the participants of the show change, for example when a user joins or leaves the show.
871
+ *
872
+ * Emitted for the model and for participants of the show.
873
+ */
874
+ 'v1.show.participants.updated': {
875
+ data: {
876
+ /** Logged-in users that take part in the show. */
877
+ participants: TV1ExtLoggedInUser[];
878
+ /** Total number of participants of the show, including guests that are not listed in `participants`. */
879
+ total: number;
880
+ };
881
+ };
882
+ };
883
+
884
+ declare type TV1ShowMethods = {
885
+ /**
886
+ * Returns the users that take part in the show currently running in the room.
887
+ *
888
+ * Available for the model and for participants of the show. Check that `context.show` is present before calling.
889
+ *
890
+ * Guests are never listed in `participants`, but they are counted in `total`.
891
+ * Participants might change during the show, so subscribe to `v1.show.participants.updated` to listen to these changes.
892
+ */
893
+ 'v1.show.participants.get': {
894
+ params: null;
895
+ result: {
896
+ /** Logged-in users that take part in the show. */
897
+ participants: TV1ExtLoggedInUser[];
898
+ /** Total number of participants of the show, including guests that are not listed in `participants`. */
899
+ total: number;
900
+ };
901
+ };
902
+ };
903
+
735
904
  declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
736
905
 
737
906
  declare type TV1StorageMethods = {
@@ -942,6 +1111,10 @@ declare type TV1StorageMethods = {
942
1111
  };
943
1112
 
944
1113
  declare type TV1SystemMethods = {
1114
+ 'v1.system.analytics.track': {
1115
+ params: TV1AnalyticsTrackParams;
1116
+ result: null;
1117
+ };
945
1118
  'v1.system.report.crash': {
946
1119
  params: {
947
1120
  data?: Record<string, unknown>;
@@ -1081,6 +1254,17 @@ declare type TV1TopUserEntry = {
1081
1254
 
1082
1255
  declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D' | 'TOP_UNSPECIFIED';
1083
1256
 
1257
+ declare type TV1UiInteractionTrackParams = {
1258
+ data: {
1259
+ elementId: string;
1260
+ elementType: 'banner' | 'button' | 'tile' | 'popup' | 'extensionButton';
1261
+ interactionType: 'view' | 'click' | 'close' | 'dismiss';
1262
+ optionSelected?: string;
1263
+ pageSection?: string;
1264
+ };
1265
+ type: 'uiInteraction';
1266
+ };
1267
+
1084
1268
  /**
1085
1269
  * User activity league. Ordered from lowest to highest activity rank:
1086
1270
  * - `grey` — new or low-activity users (level 1–9)
@@ -1129,6 +1313,15 @@ declare type TV2WhisperData = {
1129
1313
  tokenSum: number | null;
1130
1314
  };
1131
1315
 
1316
+ declare const V1_MODEL_STATES: {
1317
+ /** Model is not on the site */
1318
+ readonly STATUS_OFF: "off";
1319
+ /** Model is on the site but not producing a show */
1320
+ readonly STATUS_IDLE: "idle";
1321
+ /** Model is producing a show */
1322
+ readonly STATUS_SHOW: "show";
1323
+ };
1324
+
1132
1325
  declare const V1_SHOW_STATUSES: {
1133
1326
  /** Ticket show */
1134
1327
  readonly STATUS_TICKET_SHOW: "ticketShow";
@@ -53,6 +53,8 @@ declare type TMethods = TV1Methods;
53
53
  */
54
54
  declare type TMovableOverlayStatus = 'active' | 'inactive' | 'connecting' | 'error';
55
55
 
56
+ declare type TTheme = 'light' | 'dark';
57
+
56
58
  declare type TTransportPeer = {
57
59
  id: string;
58
60
  };
@@ -77,6 +79,8 @@ declare type TV1ActionResult = {
77
79
  code: number;
78
80
  };
79
81
 
82
+ declare type TV1AnalyticsTrackParams = TV1UiInteractionTrackParams;
83
+
80
84
  declare type TV1ChatEvents = {
81
85
  /** Triggered on every new message in a chat */
82
86
  'v1.chat.message.received': {
@@ -126,6 +130,20 @@ declare type TV1ChatMethods = {
126
130
  };
127
131
  result: null;
128
132
  };
133
+ /**
134
+ * Send a rich message to the chat with customizable colors.
135
+ *
136
+ * The message is sent locally on behalf of the extension. It is not sent to the server or broadcast — each user sees it only in their own local chat feed.
137
+ *
138
+ * Because the message is local, it is **not persisted**: it disappears from chat history when the page is reloaded.
139
+ *
140
+ * Required permission:
141
+ * - `richMessage`
142
+ */
143
+ 'v1.chat.richMessage.send': {
144
+ params: TV1RichMessage;
145
+ result: null;
146
+ };
129
147
  /** Use this method to send a message in the chat as a bot or model.
130
148
  * The message is sent locally to each user and looks like a normal chat message. The message is **not persisted** and will disappear from the chat after the page is reloaded.
131
149
  * */
@@ -151,10 +169,15 @@ declare type TV1ChatMethods = {
151
169
  };
152
170
  };
153
171
 
154
- declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
172
+ declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents & TV1ShowEvents;
155
173
 
156
174
  declare type TV1ExtContext = {
157
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;
158
181
  /** Unique identifier for the extension. */
159
182
  slug?: string;
160
183
  user?: TV1ExtUser;
@@ -167,6 +190,8 @@ declare type TV1ExtEvents = {
167
190
  context: TV1ExtContext;
168
191
  };
169
192
  /**
193
+ * @deprecated This event will be removed in a future release.
194
+ *
170
195
  * Fired whenever the viewer counts for the room change.
171
196
  * Emitted only for show types: `public`, `groupShow`, `ticketShow`.
172
197
  */
@@ -224,6 +249,8 @@ declare type TV1ExtLoggedInUser = {
224
249
  * - `ticketShow` — ticket show context
225
250
  * - `off` — offline
226
251
  * - `spy` — spying on a private show
252
+ *
253
+ * @deprecated Use `context.show` to check whether the user is a participant of the show. This field will be removed in a future release.
227
254
  */
228
255
  status: TV1UserStatus;
229
256
  /** User username. */
@@ -258,6 +285,19 @@ declare type TV1ExtMethods = {
258
285
  params: null;
259
286
  result: TV1ExtContext;
260
287
  };
288
+ /**
289
+ * Returns the tag from which the user navigated to the model.
290
+ * `tag` is `null` when the source tag is unknown.
291
+ *
292
+ * Required permission:
293
+ * - `modelTag`
294
+ */
295
+ 'v1.ext.modelTag.get': {
296
+ params: null;
297
+ result: {
298
+ tag: TV1ExtModelTag | null;
299
+ };
300
+ };
261
301
  'v1.ext.movableOverlay.update': {
262
302
  params: {
263
303
  message?: string;
@@ -274,11 +314,15 @@ declare type TV1ExtMethods = {
274
314
  /** Opens Stripchat sign-up dialog for anonymous users. Use this when your extension requires a registered account to function */
275
315
  'v1.ext.signup.open': {
276
316
  params: {
317
+ /** Optional source string to identify the origin of the sign-up request. Internal use only */
318
+ source?: string;
277
319
  type: 'user';
278
320
  };
279
321
  result: null;
280
322
  };
281
323
  /**
324
+ * @deprecated This method will be removed in a future release.
325
+ *
282
326
  * Returns the current viewer counts for the room.
283
327
  * Supported only for show types: `public`, `groupShow`, `ticketShow`.
284
328
  * Returns `null` for other show types.
@@ -337,23 +381,57 @@ declare type TV1ExtModel = {
337
381
  isSpyEnabled: boolean;
338
382
  /** Model's name from her profile. If not set, an empty string will be returned */
339
383
  name: string;
340
- /** Status of the show. Possible values:
384
+ /** Presence of the model on the site. When it is `show`, read `context.show.status` for the type of the show. */
385
+ state: TV1ModelState;
386
+ /**
387
+ * Status of the show.
341
388
  *
342
- * - `idle` - model is online but not streaming
343
- * - `public` - model is broadcasting public show
344
- * - `private` - model is in private show
345
- * - `exclusivePrivate` - model is in exclusive private show
346
- * - `off` - model is offline
347
- * - `groupShow` - model is in group show that is not a ticket show
348
- * - `ticketShow` - model is in ticket show
349
- * */
389
+ * @deprecated Use `context.show.status` for show-type checks and `state` for the presence of the model.
390
+ */
350
391
  status: TV1ModelStatus;
351
392
  /** Model's username */
352
393
  username: string;
353
394
  };
354
395
 
396
+ /**
397
+ * Tag from which the user navigated to the model.
398
+ *
399
+ * Required permission:
400
+ * - `modelTag`
401
+ */
402
+ declare type TV1ExtModelTag = {
403
+ /** Tag identifier, for example `autoTagNew` */
404
+ id: string;
405
+ /** Primary tag the tag belongs to */
406
+ primaryTagId: 'girls' | 'men' | 'trans' | 'couples';
407
+ /** Tag URL path, for example `girls/new` */
408
+ url: string;
409
+ };
410
+
355
411
  declare type TV1ExtSettings = unknown;
356
412
 
413
+ /**
414
+ * Show that is currently running in the room.
415
+ *
416
+ * Present in the extension context only for participants of the show: always for the model,
417
+ * and for a user only while that user is a participant. It is absent for everyone else,
418
+ * for example for a user watching the room while the model is in a private show with somebody else,
419
+ * or while the user is spying on a private show.
420
+ *
421
+ * A spy viewer is not a participant of the show, so `context.show` remains undefined in that case.
422
+ * Extensions are not running while the user spies on a show, so an extension never observes spy mode
423
+ * and there is no `spy` value in `context.show.status`.
424
+ *
425
+ * Use `context.show` to branch on the type of the show and `v1.show.participants.get` to read who takes part in it.
426
+ */
427
+ declare type TV1ExtShow = {
428
+ /** Type of the show. */
429
+ status: TV1ExtShowStatus;
430
+ };
431
+
432
+ /** Type of the show that is currently running in the room. */
433
+ 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;
434
+
357
435
  declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
358
436
 
359
437
  /** Viewer counts for the current room. */
@@ -422,7 +500,7 @@ declare type TV1GoalMethods = {
422
500
  };
423
501
  };
424
502
 
425
- declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods;
503
+ declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods & TV1ShowMethods;
426
504
 
427
505
  declare type TV1ModelEvents = {
428
506
  'v1.model.ext.settings.set.requested': null;
@@ -444,6 +522,15 @@ declare type TV1ModelMethods = {
444
522
  };
445
523
  };
446
524
 
525
+ /**
526
+ * Presence of the model on the site.
527
+ *
528
+ * - `off` — model is not on the site
529
+ * - `idle` — model is on the site but not producing a show
530
+ * - `show` — model is producing a show
531
+ */
532
+ declare type TV1ModelState = (typeof V1_MODEL_STATES)[keyof typeof V1_MODEL_STATES];
533
+
447
534
  /** Status that indicates which type of show model is producing now */
448
535
  declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
449
536
 
@@ -527,6 +614,52 @@ declare type TV1PrivateMethods = {
527
614
  };
528
615
  };
529
616
 
617
+ declare type TV1RichMessage = {
618
+ /** The main action appearance. It opens the extension tab on click. If omitted, the default action is a link. */
619
+ action?: {
620
+ text?: string;
621
+ type: 'link' | 'button';
622
+ };
623
+ /** One of the predefined extension icons. If omitted, the icon from the manifest is used. */
624
+ icon?: 'sex-toy-1' | 'sex-toy-2' | 'spicy-pepper';
625
+ /**
626
+ * Rich message subtitle.
627
+ *
628
+ * Supports inline markup tags:
629
+ * - `{#primary}...{/primary}` — uses the primary text color.
630
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
631
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
632
+ * - `{#bold}...{/bold}` — renders bold text.
633
+ *
634
+ * Example: `'won {#accent}Alice{/accent} in'`
635
+ */
636
+ subtitle: string;
637
+ /** Optional custom theme. If omitted, the default theme is used. */
638
+ theme?: {
639
+ [Property in TTheme]?: TV1RichMessageTheme;
640
+ };
641
+ /**
642
+ * Rich message title.
643
+ *
644
+ * Supports inline markup tags:
645
+ * - `{#primary}...{/primary}` — uses the primary text color.
646
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
647
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
648
+ * - `{#bold}...{/bold}` — renders bold text.
649
+ *
650
+ * Example: `'won {#accent}Alice{/accent} in'`
651
+ */
652
+ title: string;
653
+ };
654
+
655
+ declare type TV1RichMessageTheme = {
656
+ /** Rich message background color. Use a hex color. */
657
+ background: string;
658
+ buttonText: 'white' | 'dark';
659
+ /** Main accent color of the rich message, used for the sidebar, highlights, links, and buttons. Use a hex color. */
660
+ main: string;
661
+ };
662
+
530
663
  declare type TV1SerializedError = {
531
664
  cause?: TV1SerializedError;
532
665
  message: string;
@@ -666,6 +799,42 @@ declare type TV1SessionUpdate = {
666
799
  */
667
800
  declare type TV1SessionWhisperData = TUnknownDictionary;
668
801
 
802
+ declare type TV1ShowEvents = {
803
+ /**
804
+ * Fired when the participants of the show change, for example when a user joins or leaves the show.
805
+ *
806
+ * Emitted for the model and for participants of the show.
807
+ */
808
+ 'v1.show.participants.updated': {
809
+ data: {
810
+ /** Logged-in users that take part in the show. */
811
+ participants: TV1ExtLoggedInUser[];
812
+ /** Total number of participants of the show, including guests that are not listed in `participants`. */
813
+ total: number;
814
+ };
815
+ };
816
+ };
817
+
818
+ declare type TV1ShowMethods = {
819
+ /**
820
+ * Returns the users that take part in the show currently running in the room.
821
+ *
822
+ * Available for the model and for participants of the show. Check that `context.show` is present before calling.
823
+ *
824
+ * Guests are never listed in `participants`, but they are counted in `total`.
825
+ * Participants might change during the show, so subscribe to `v1.show.participants.updated` to listen to these changes.
826
+ */
827
+ 'v1.show.participants.get': {
828
+ params: null;
829
+ result: {
830
+ /** Logged-in users that take part in the show. */
831
+ participants: TV1ExtLoggedInUser[];
832
+ /** Total number of participants of the show, including guests that are not listed in `participants`. */
833
+ total: number;
834
+ };
835
+ };
836
+ };
837
+
669
838
  declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
670
839
 
671
840
  declare type TV1StorageMethods = {
@@ -876,6 +1045,10 @@ declare type TV1StorageMethods = {
876
1045
  };
877
1046
 
878
1047
  declare type TV1SystemMethods = {
1048
+ 'v1.system.analytics.track': {
1049
+ params: TV1AnalyticsTrackParams;
1050
+ result: null;
1051
+ };
879
1052
  'v1.system.report.crash': {
880
1053
  params: {
881
1054
  data?: Record<string, unknown>;
@@ -1015,6 +1188,17 @@ declare type TV1TopUserEntry = {
1015
1188
 
1016
1189
  declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D' | 'TOP_UNSPECIFIED';
1017
1190
 
1191
+ declare type TV1UiInteractionTrackParams = {
1192
+ data: {
1193
+ elementId: string;
1194
+ elementType: 'banner' | 'button' | 'tile' | 'popup' | 'extensionButton';
1195
+ interactionType: 'view' | 'click' | 'close' | 'dismiss';
1196
+ optionSelected?: string;
1197
+ pageSection?: string;
1198
+ };
1199
+ type: 'uiInteraction';
1200
+ };
1201
+
1018
1202
  /**
1019
1203
  * User activity league. Ordered from lowest to highest activity rank:
1020
1204
  * - `grey` — new or low-activity users (level 1–9)
@@ -1081,6 +1265,15 @@ export declare const useSlotState: <State extends object>({ channel, extHelper,
1081
1265
  state: State | null;
1082
1266
  };
1083
1267
 
1268
+ declare const V1_MODEL_STATES: {
1269
+ /** Model is not on the site */
1270
+ readonly STATUS_OFF: "off";
1271
+ /** Model is on the site but not producing a show */
1272
+ readonly STATUS_IDLE: "idle";
1273
+ /** Model is producing a show */
1274
+ readonly STATUS_SHOW: "show";
1275
+ };
1276
+
1084
1277
  declare const V1_SHOW_STATUSES: {
1085
1278
  /** Ticket show */
1086
1279
  readonly STATUS_TICKET_SHOW: "ticketShow";
package/dist/index.d.ts CHANGED
@@ -120,6 +120,8 @@ export declare type TV1ActionResult = {
120
120
  code: number;
121
121
  };
122
122
 
123
+ export declare type TV1AnalyticsTrackParams = TV1UiInteractionTrackParams;
124
+
123
125
  declare type TV1ChatEvents = {
124
126
  /** Triggered on every new message in a chat */
125
127
  'v1.chat.message.received': {
@@ -169,6 +171,20 @@ declare type TV1ChatMethods = {
169
171
  };
170
172
  result: null;
171
173
  };
174
+ /**
175
+ * Send a rich message to the chat with customizable colors.
176
+ *
177
+ * The message is sent locally on behalf of the extension. It is not sent to the server or broadcast — each user sees it only in their own local chat feed.
178
+ *
179
+ * Because the message is local, it is **not persisted**: it disappears from chat history when the page is reloaded.
180
+ *
181
+ * Required permission:
182
+ * - `richMessage`
183
+ */
184
+ 'v1.chat.richMessage.send': {
185
+ params: TV1RichMessage;
186
+ result: null;
187
+ };
172
188
  /** Use this method to send a message in the chat as a bot or model.
173
189
  * The message is sent locally to each user and looks like a normal chat message. The message is **not persisted** and will disappear from the chat after the page is reloaded.
174
190
  * */
@@ -194,10 +210,15 @@ declare type TV1ChatMethods = {
194
210
  };
195
211
  };
196
212
 
197
- export declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
213
+ export declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents & TV1ShowEvents;
198
214
 
199
215
  export declare type TV1ExtContext = {
200
216
  model?: TV1ExtModel;
217
+ /**
218
+ * Show the current user takes part in. Always present for the model while they are producing a show,
219
+ * and present for a user only while that user is a participant of the show. Otherwise it is absent.
220
+ */
221
+ show?: TV1ExtShow;
201
222
  /** Unique identifier for the extension. */
202
223
  slug?: string;
203
224
  user?: TV1ExtUser;
@@ -216,6 +237,8 @@ declare type TV1ExtEvents = {
216
237
  context: TV1ExtContext;
217
238
  };
218
239
  /**
240
+ * @deprecated This event will be removed in a future release.
241
+ *
219
242
  * Fired whenever the viewer counts for the room change.
220
243
  * Emitted only for show types: `public`, `groupShow`, `ticketShow`.
221
244
  */
@@ -273,6 +296,8 @@ export declare type TV1ExtLoggedInUser = {
273
296
  * - `ticketShow` — ticket show context
274
297
  * - `off` — offline
275
298
  * - `spy` — spying on a private show
299
+ *
300
+ * @deprecated Use `context.show` to check whether the user is a participant of the show. This field will be removed in a future release.
276
301
  */
277
302
  status: TV1UserStatus;
278
303
  /** User username. */
@@ -307,6 +332,19 @@ declare type TV1ExtMethods = {
307
332
  params: null;
308
333
  result: TV1ExtContext;
309
334
  };
335
+ /**
336
+ * Returns the tag from which the user navigated to the model.
337
+ * `tag` is `null` when the source tag is unknown.
338
+ *
339
+ * Required permission:
340
+ * - `modelTag`
341
+ */
342
+ 'v1.ext.modelTag.get': {
343
+ params: null;
344
+ result: {
345
+ tag: TV1ExtModelTag | null;
346
+ };
347
+ };
310
348
  'v1.ext.movableOverlay.update': {
311
349
  params: {
312
350
  message?: string;
@@ -323,11 +361,15 @@ declare type TV1ExtMethods = {
323
361
  /** Opens Stripchat sign-up dialog for anonymous users. Use this when your extension requires a registered account to function */
324
362
  'v1.ext.signup.open': {
325
363
  params: {
364
+ /** Optional source string to identify the origin of the sign-up request. Internal use only */
365
+ source?: string;
326
366
  type: 'user';
327
367
  };
328
368
  result: null;
329
369
  };
330
370
  /**
371
+ * @deprecated This method will be removed in a future release.
372
+ *
331
373
  * Returns the current viewer counts for the room.
332
374
  * Supported only for show types: `public`, `groupShow`, `ticketShow`.
333
375
  * Returns `null` for other show types.
@@ -386,23 +428,57 @@ export declare type TV1ExtModel = {
386
428
  isSpyEnabled: boolean;
387
429
  /** Model's name from her profile. If not set, an empty string will be returned */
388
430
  name: string;
389
- /** Status of the show. Possible values:
431
+ /** Presence of the model on the site. When it is `show`, read `context.show.status` for the type of the show. */
432
+ state: TV1ModelState;
433
+ /**
434
+ * Status of the show.
390
435
  *
391
- * - `idle` - model is online but not streaming
392
- * - `public` - model is broadcasting public show
393
- * - `private` - model is in private show
394
- * - `exclusivePrivate` - model is in exclusive private show
395
- * - `off` - model is offline
396
- * - `groupShow` - model is in group show that is not a ticket show
397
- * - `ticketShow` - model is in ticket show
398
- * */
436
+ * @deprecated Use `context.show.status` for show-type checks and `state` for the presence of the model.
437
+ */
399
438
  status: TV1ModelStatus;
400
439
  /** Model's username */
401
440
  username: string;
402
441
  };
403
442
 
443
+ /**
444
+ * Tag from which the user navigated to the model.
445
+ *
446
+ * Required permission:
447
+ * - `modelTag`
448
+ */
449
+ export declare type TV1ExtModelTag = {
450
+ /** Tag identifier, for example `autoTagNew` */
451
+ id: string;
452
+ /** Primary tag the tag belongs to */
453
+ primaryTagId: 'girls' | 'men' | 'trans' | 'couples';
454
+ /** Tag URL path, for example `girls/new` */
455
+ url: string;
456
+ };
457
+
404
458
  export declare type TV1ExtSettings = unknown;
405
459
 
460
+ /**
461
+ * Show that is currently running in the room.
462
+ *
463
+ * Present in the extension context only for participants of the show: always for the model,
464
+ * and for a user only while that user is a participant. It is absent for everyone else,
465
+ * for example for a user watching the room while the model is in a private show with somebody else,
466
+ * or while the user is spying on a private show.
467
+ *
468
+ * A spy viewer is not a participant of the show, so `context.show` remains undefined in that case.
469
+ * Extensions are not running while the user spies on a show, so an extension never observes spy mode
470
+ * and there is no `spy` value in `context.show.status`.
471
+ *
472
+ * Use `context.show` to branch on the type of the show and `v1.show.participants.get` to read who takes part in it.
473
+ */
474
+ export declare type TV1ExtShow = {
475
+ /** Type of the show. */
476
+ status: TV1ExtShowStatus;
477
+ };
478
+
479
+ /** Type of the show that is currently running in the room. */
480
+ 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;
481
+
406
482
  export declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
407
483
 
408
484
  /** Viewer counts for the current room. */
@@ -476,7 +552,7 @@ export declare type TV1MethodErrors = {
476
552
  'v1.storage.string.set': TV1StorageStringSetError;
477
553
  };
478
554
 
479
- export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods;
555
+ export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods & TV1FanClubMethods & TV1ShowMethods;
480
556
 
481
557
  declare type TV1ModelEvents = {
482
558
  'v1.model.ext.settings.set.requested': null;
@@ -498,6 +574,15 @@ declare type TV1ModelMethods = {
498
574
  };
499
575
  };
500
576
 
577
+ /**
578
+ * Presence of the model on the site.
579
+ *
580
+ * - `off` — model is not on the site
581
+ * - `idle` — model is on the site but not producing a show
582
+ * - `show` — model is producing a show
583
+ */
584
+ export declare type TV1ModelState = (typeof V1_MODEL_STATES)[keyof typeof V1_MODEL_STATES];
585
+
501
586
  /** Status that indicates which type of show model is producing now */
502
587
  export declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
503
588
 
@@ -581,6 +666,52 @@ declare type TV1PrivateMethods = {
581
666
  };
582
667
  };
583
668
 
669
+ export declare type TV1RichMessage = {
670
+ /** The main action appearance. It opens the extension tab on click. If omitted, the default action is a link. */
671
+ action?: {
672
+ text?: string;
673
+ type: 'link' | 'button';
674
+ };
675
+ /** One of the predefined extension icons. If omitted, the icon from the manifest is used. */
676
+ icon?: 'sex-toy-1' | 'sex-toy-2' | 'spicy-pepper';
677
+ /**
678
+ * Rich message subtitle.
679
+ *
680
+ * Supports inline markup tags:
681
+ * - `{#primary}...{/primary}` — uses the primary text color.
682
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
683
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
684
+ * - `{#bold}...{/bold}` — renders bold text.
685
+ *
686
+ * Example: `'won {#accent}Alice{/accent} in'`
687
+ */
688
+ subtitle: string;
689
+ /** Optional custom theme. If omitted, the default theme is used. */
690
+ theme?: {
691
+ [Property in TTheme]?: TV1RichMessageTheme;
692
+ };
693
+ /**
694
+ * Rich message title.
695
+ *
696
+ * Supports inline markup tags:
697
+ * - `{#primary}...{/primary}` — uses the primary text color.
698
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
699
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
700
+ * - `{#bold}...{/bold}` — renders bold text.
701
+ *
702
+ * Example: `'won {#accent}Alice{/accent} in'`
703
+ */
704
+ title: string;
705
+ };
706
+
707
+ export declare type TV1RichMessageTheme = {
708
+ /** Rich message background color. Use a hex color. */
709
+ background: string;
710
+ buttonText: 'white' | 'dark';
711
+ /** Main accent color of the rich message, used for the sidebar, highlights, links, and buttons. Use a hex color. */
712
+ main: string;
713
+ };
714
+
584
715
  declare type TV1SerializedError = {
585
716
  cause?: TV1SerializedError;
586
717
  message: string;
@@ -720,6 +851,42 @@ export declare type TV1SessionUpdate = {
720
851
  */
721
852
  export declare type TV1SessionWhisperData = TUnknownDictionary;
722
853
 
854
+ declare type TV1ShowEvents = {
855
+ /**
856
+ * Fired when the participants of the show change, for example when a user joins or leaves the show.
857
+ *
858
+ * Emitted for the model and for participants of the show.
859
+ */
860
+ 'v1.show.participants.updated': {
861
+ data: {
862
+ /** Logged-in users that take part in the show. */
863
+ participants: TV1ExtLoggedInUser[];
864
+ /** Total number of participants of the show, including guests that are not listed in `participants`. */
865
+ total: number;
866
+ };
867
+ };
868
+ };
869
+
870
+ declare type TV1ShowMethods = {
871
+ /**
872
+ * Returns the users that take part in the show currently running in the room.
873
+ *
874
+ * Available for the model and for participants of the show. Check that `context.show` is present before calling.
875
+ *
876
+ * Guests are never listed in `participants`, but they are counted in `total`.
877
+ * Participants might change during the show, so subscribe to `v1.show.participants.updated` to listen to these changes.
878
+ */
879
+ 'v1.show.participants.get': {
880
+ params: null;
881
+ result: {
882
+ /** Logged-in users that take part in the show. */
883
+ participants: TV1ExtLoggedInUser[];
884
+ /** Total number of participants of the show, including guests that are not listed in `participants`. */
885
+ total: number;
886
+ };
887
+ };
888
+ };
889
+
723
890
  export declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
724
891
 
725
892
  declare type TV1StorageMethods = {
@@ -938,6 +1105,10 @@ export declare type TV1StorageStringSetError = TV1ExtensionError<TV1StorageStrin
938
1105
  export declare type TV1StorageStringSetErrorCode = 'ERR_CODE_UNSPECIFIED' | 'ERR_STORAGE_VALUE_SIZE_LIMIT_EXCEEDED';
939
1106
 
940
1107
  declare type TV1SystemMethods = {
1108
+ 'v1.system.analytics.track': {
1109
+ params: TV1AnalyticsTrackParams;
1110
+ result: null;
1111
+ };
941
1112
  'v1.system.report.crash': {
942
1113
  params: {
943
1114
  data?: Record<string, unknown>;
@@ -1077,6 +1248,17 @@ export declare type TV1TopUserEntry = {
1077
1248
 
1078
1249
  export declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D' | 'TOP_UNSPECIFIED';
1079
1250
 
1251
+ export declare type TV1UiInteractionTrackParams = {
1252
+ data: {
1253
+ elementId: string;
1254
+ elementType: 'banner' | 'button' | 'tile' | 'popup' | 'extensionButton';
1255
+ interactionType: 'view' | 'click' | 'close' | 'dismiss';
1256
+ optionSelected?: string;
1257
+ pageSection?: string;
1258
+ };
1259
+ type: 'uiInteraction';
1260
+ };
1261
+
1080
1262
  /**
1081
1263
  * User activity league. Ordered from lowest to highest activity rank:
1082
1264
  * - `grey` — new or low-activity users (level 1–9)
@@ -1125,6 +1307,15 @@ export declare type TV2WhisperData = {
1125
1307
  tokenSum: number | null;
1126
1308
  };
1127
1309
 
1310
+ export declare const V1_MODEL_STATES: {
1311
+ /** Model is not on the site */
1312
+ readonly STATUS_OFF: "off";
1313
+ /** Model is on the site but not producing a show */
1314
+ readonly STATUS_IDLE: "idle";
1315
+ /** Model is producing a show */
1316
+ readonly STATUS_SHOW: "show";
1317
+ };
1318
+
1128
1319
  export declare const V1_SHOW_STATUSES: {
1129
1320
  /** Ticket show */
1130
1321
  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.3.1",
4
+ "version": "0.4.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "module": "./dist/ext-helper.js",