@stripchatdev/ext-helper 0.3.1 → 0.3.2

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
  * */
@@ -324,6 +342,19 @@ declare type TV1ExtMethods = {
324
342
  params: null;
325
343
  result: TV1ExtContext;
326
344
  };
345
+ /**
346
+ * Returns the tag from which the user navigated to the model.
347
+ * `tag` is `null` when the source tag is unknown.
348
+ *
349
+ * Required permission:
350
+ * - `modelTag`
351
+ */
352
+ 'v1.ext.modelTag.get': {
353
+ params: null;
354
+ result: {
355
+ tag: TV1ExtModelTag | null;
356
+ };
357
+ };
327
358
  'v1.ext.movableOverlay.update': {
328
359
  params: {
329
360
  message?: string;
@@ -340,6 +371,8 @@ declare type TV1ExtMethods = {
340
371
  /** Opens Stripchat sign-up dialog for anonymous users. Use this when your extension requires a registered account to function */
341
372
  'v1.ext.signup.open': {
342
373
  params: {
374
+ /** Optional source string to identify the origin of the sign-up request. Internal use only */
375
+ source?: string;
343
376
  type: 'user';
344
377
  };
345
378
  result: null;
@@ -418,6 +451,21 @@ declare type TV1ExtModel = {
418
451
  username: string;
419
452
  };
420
453
 
454
+ /**
455
+ * Tag from which the user navigated to the model.
456
+ *
457
+ * Required permission:
458
+ * - `modelTag`
459
+ */
460
+ declare type TV1ExtModelTag = {
461
+ /** Tag identifier, for example `autoTagNew` */
462
+ id: string;
463
+ /** Primary tag the tag belongs to */
464
+ primaryTagId: 'girls' | 'men' | 'trans' | 'couples';
465
+ /** Tag URL path, for example `girls/new` */
466
+ url: string;
467
+ };
468
+
421
469
  declare type TV1ExtSettings = unknown;
422
470
 
423
471
  declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
@@ -593,6 +641,52 @@ declare type TV1PrivateMethods = {
593
641
  };
594
642
  };
595
643
 
644
+ declare type TV1RichMessage = {
645
+ /** The main action appearance. It opens the extension tab on click. If omitted, the default action is a link. */
646
+ action?: {
647
+ text?: string;
648
+ type: 'link' | 'button';
649
+ };
650
+ /** One of the predefined extension icons. If omitted, the icon from the manifest is used. */
651
+ icon?: 'sex-toy-1' | 'sex-toy-2' | 'spicy-pepper';
652
+ /**
653
+ * Rich message subtitle.
654
+ *
655
+ * Supports inline markup tags:
656
+ * - `{#primary}...{/primary}` — uses the primary text color.
657
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
658
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
659
+ * - `{#bold}...{/bold}` — renders bold text.
660
+ *
661
+ * Example: `'won {#accent}Alice{/accent} in'`
662
+ */
663
+ subtitle: string;
664
+ /** Optional custom theme. If omitted, the default theme is used. */
665
+ theme?: {
666
+ [Property in TTheme]?: TV1RichMessageTheme;
667
+ };
668
+ /**
669
+ * Rich message title.
670
+ *
671
+ * Supports inline markup tags:
672
+ * - `{#primary}...{/primary}` — uses the primary text color.
673
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
674
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
675
+ * - `{#bold}...{/bold}` — renders bold text.
676
+ *
677
+ * Example: `'won {#accent}Alice{/accent} in'`
678
+ */
679
+ title: string;
680
+ };
681
+
682
+ declare type TV1RichMessageTheme = {
683
+ /** Rich message background color. Use a hex color. */
684
+ background: string;
685
+ buttonText: 'white' | 'dark';
686
+ /** Main accent color of the rich message, used for the sidebar, highlights, links, and buttons. Use a hex color. */
687
+ main: string;
688
+ };
689
+
596
690
  declare type TV1SerializedError = {
597
691
  cause?: TV1SerializedError;
598
692
  message: string;
@@ -942,6 +1036,10 @@ declare type TV1StorageMethods = {
942
1036
  };
943
1037
 
944
1038
  declare type TV1SystemMethods = {
1039
+ 'v1.system.analytics.track': {
1040
+ params: TV1AnalyticsTrackParams;
1041
+ result: null;
1042
+ };
945
1043
  'v1.system.report.crash': {
946
1044
  params: {
947
1045
  data?: Record<string, unknown>;
@@ -1081,6 +1179,17 @@ declare type TV1TopUserEntry = {
1081
1179
 
1082
1180
  declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D' | 'TOP_UNSPECIFIED';
1083
1181
 
1182
+ declare type TV1UiInteractionTrackParams = {
1183
+ data: {
1184
+ elementId: string;
1185
+ elementType: 'banner' | 'button' | 'tile' | 'popup' | 'extensionButton';
1186
+ interactionType: 'view' | 'click' | 'close' | 'dismiss';
1187
+ optionSelected?: string;
1188
+ pageSection?: string;
1189
+ };
1190
+ type: 'uiInteraction';
1191
+ };
1192
+
1084
1193
  /**
1085
1194
  * User activity league. Ordered from lowest to highest activity rank:
1086
1195
  * - `grey` — new or low-activity users (level 1–9)
@@ -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
  * */
@@ -258,6 +276,19 @@ declare type TV1ExtMethods = {
258
276
  params: null;
259
277
  result: TV1ExtContext;
260
278
  };
279
+ /**
280
+ * Returns the tag from which the user navigated to the model.
281
+ * `tag` is `null` when the source tag is unknown.
282
+ *
283
+ * Required permission:
284
+ * - `modelTag`
285
+ */
286
+ 'v1.ext.modelTag.get': {
287
+ params: null;
288
+ result: {
289
+ tag: TV1ExtModelTag | null;
290
+ };
291
+ };
261
292
  'v1.ext.movableOverlay.update': {
262
293
  params: {
263
294
  message?: string;
@@ -274,6 +305,8 @@ declare type TV1ExtMethods = {
274
305
  /** Opens Stripchat sign-up dialog for anonymous users. Use this when your extension requires a registered account to function */
275
306
  'v1.ext.signup.open': {
276
307
  params: {
308
+ /** Optional source string to identify the origin of the sign-up request. Internal use only */
309
+ source?: string;
277
310
  type: 'user';
278
311
  };
279
312
  result: null;
@@ -352,6 +385,21 @@ declare type TV1ExtModel = {
352
385
  username: string;
353
386
  };
354
387
 
388
+ /**
389
+ * Tag from which the user navigated to the model.
390
+ *
391
+ * Required permission:
392
+ * - `modelTag`
393
+ */
394
+ declare type TV1ExtModelTag = {
395
+ /** Tag identifier, for example `autoTagNew` */
396
+ id: string;
397
+ /** Primary tag the tag belongs to */
398
+ primaryTagId: 'girls' | 'men' | 'trans' | 'couples';
399
+ /** Tag URL path, for example `girls/new` */
400
+ url: string;
401
+ };
402
+
355
403
  declare type TV1ExtSettings = unknown;
356
404
 
357
405
  declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
@@ -527,6 +575,52 @@ declare type TV1PrivateMethods = {
527
575
  };
528
576
  };
529
577
 
578
+ declare type TV1RichMessage = {
579
+ /** The main action appearance. It opens the extension tab on click. If omitted, the default action is a link. */
580
+ action?: {
581
+ text?: string;
582
+ type: 'link' | 'button';
583
+ };
584
+ /** One of the predefined extension icons. If omitted, the icon from the manifest is used. */
585
+ icon?: 'sex-toy-1' | 'sex-toy-2' | 'spicy-pepper';
586
+ /**
587
+ * Rich message subtitle.
588
+ *
589
+ * Supports inline markup tags:
590
+ * - `{#primary}...{/primary}` — uses the primary text color.
591
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
592
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
593
+ * - `{#bold}...{/bold}` — renders bold text.
594
+ *
595
+ * Example: `'won {#accent}Alice{/accent} in'`
596
+ */
597
+ subtitle: string;
598
+ /** Optional custom theme. If omitted, the default theme is used. */
599
+ theme?: {
600
+ [Property in TTheme]?: TV1RichMessageTheme;
601
+ };
602
+ /**
603
+ * Rich message title.
604
+ *
605
+ * Supports inline markup tags:
606
+ * - `{#primary}...{/primary}` — uses the primary text color.
607
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
608
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
609
+ * - `{#bold}...{/bold}` — renders bold text.
610
+ *
611
+ * Example: `'won {#accent}Alice{/accent} in'`
612
+ */
613
+ title: string;
614
+ };
615
+
616
+ declare type TV1RichMessageTheme = {
617
+ /** Rich message background color. Use a hex color. */
618
+ background: string;
619
+ buttonText: 'white' | 'dark';
620
+ /** Main accent color of the rich message, used for the sidebar, highlights, links, and buttons. Use a hex color. */
621
+ main: string;
622
+ };
623
+
530
624
  declare type TV1SerializedError = {
531
625
  cause?: TV1SerializedError;
532
626
  message: string;
@@ -876,6 +970,10 @@ declare type TV1StorageMethods = {
876
970
  };
877
971
 
878
972
  declare type TV1SystemMethods = {
973
+ 'v1.system.analytics.track': {
974
+ params: TV1AnalyticsTrackParams;
975
+ result: null;
976
+ };
879
977
  'v1.system.report.crash': {
880
978
  params: {
881
979
  data?: Record<string, unknown>;
@@ -1015,6 +1113,17 @@ declare type TV1TopUserEntry = {
1015
1113
 
1016
1114
  declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D' | 'TOP_UNSPECIFIED';
1017
1115
 
1116
+ declare type TV1UiInteractionTrackParams = {
1117
+ data: {
1118
+ elementId: string;
1119
+ elementType: 'banner' | 'button' | 'tile' | 'popup' | 'extensionButton';
1120
+ interactionType: 'view' | 'click' | 'close' | 'dismiss';
1121
+ optionSelected?: string;
1122
+ pageSection?: string;
1123
+ };
1124
+ type: 'uiInteraction';
1125
+ };
1126
+
1018
1127
  /**
1019
1128
  * User activity league. Ordered from lowest to highest activity rank:
1020
1129
  * - `grey` — new or low-activity users (level 1–9)
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
  * */
@@ -307,6 +323,19 @@ declare type TV1ExtMethods = {
307
323
  params: null;
308
324
  result: TV1ExtContext;
309
325
  };
326
+ /**
327
+ * Returns the tag from which the user navigated to the model.
328
+ * `tag` is `null` when the source tag is unknown.
329
+ *
330
+ * Required permission:
331
+ * - `modelTag`
332
+ */
333
+ 'v1.ext.modelTag.get': {
334
+ params: null;
335
+ result: {
336
+ tag: TV1ExtModelTag | null;
337
+ };
338
+ };
310
339
  'v1.ext.movableOverlay.update': {
311
340
  params: {
312
341
  message?: string;
@@ -323,6 +352,8 @@ declare type TV1ExtMethods = {
323
352
  /** Opens Stripchat sign-up dialog for anonymous users. Use this when your extension requires a registered account to function */
324
353
  'v1.ext.signup.open': {
325
354
  params: {
355
+ /** Optional source string to identify the origin of the sign-up request. Internal use only */
356
+ source?: string;
326
357
  type: 'user';
327
358
  };
328
359
  result: null;
@@ -401,6 +432,21 @@ export declare type TV1ExtModel = {
401
432
  username: string;
402
433
  };
403
434
 
435
+ /**
436
+ * Tag from which the user navigated to the model.
437
+ *
438
+ * Required permission:
439
+ * - `modelTag`
440
+ */
441
+ export declare type TV1ExtModelTag = {
442
+ /** Tag identifier, for example `autoTagNew` */
443
+ id: string;
444
+ /** Primary tag the tag belongs to */
445
+ primaryTagId: 'girls' | 'men' | 'trans' | 'couples';
446
+ /** Tag URL path, for example `girls/new` */
447
+ url: string;
448
+ };
449
+
404
450
  export declare type TV1ExtSettings = unknown;
405
451
 
406
452
  export declare type TV1ExtUser = TV1ExtGuestUser | TV1ExtLoggedInUser;
@@ -581,6 +627,52 @@ declare type TV1PrivateMethods = {
581
627
  };
582
628
  };
583
629
 
630
+ export declare type TV1RichMessage = {
631
+ /** The main action appearance. It opens the extension tab on click. If omitted, the default action is a link. */
632
+ action?: {
633
+ text?: string;
634
+ type: 'link' | 'button';
635
+ };
636
+ /** One of the predefined extension icons. If omitted, the icon from the manifest is used. */
637
+ icon?: 'sex-toy-1' | 'sex-toy-2' | 'spicy-pepper';
638
+ /**
639
+ * Rich message subtitle.
640
+ *
641
+ * Supports inline markup tags:
642
+ * - `{#primary}...{/primary}` — uses the primary text color.
643
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
644
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
645
+ * - `{#bold}...{/bold}` — renders bold text.
646
+ *
647
+ * Example: `'won {#accent}Alice{/accent} in'`
648
+ */
649
+ subtitle: string;
650
+ /** Optional custom theme. If omitted, the default theme is used. */
651
+ theme?: {
652
+ [Property in TTheme]?: TV1RichMessageTheme;
653
+ };
654
+ /**
655
+ * Rich message title.
656
+ *
657
+ * Supports inline markup tags:
658
+ * - `{#primary}...{/primary}` — uses the primary text color.
659
+ * - `{#secondary}...{/secondary}` — uses the secondary text color.
660
+ * - `{#accent}...{/accent}` — highlights text with an accent color.
661
+ * - `{#bold}...{/bold}` — renders bold text.
662
+ *
663
+ * Example: `'won {#accent}Alice{/accent} in'`
664
+ */
665
+ title: string;
666
+ };
667
+
668
+ export declare type TV1RichMessageTheme = {
669
+ /** Rich message background color. Use a hex color. */
670
+ background: string;
671
+ buttonText: 'white' | 'dark';
672
+ /** Main accent color of the rich message, used for the sidebar, highlights, links, and buttons. Use a hex color. */
673
+ main: string;
674
+ };
675
+
584
676
  declare type TV1SerializedError = {
585
677
  cause?: TV1SerializedError;
586
678
  message: string;
@@ -938,6 +1030,10 @@ export declare type TV1StorageStringSetError = TV1ExtensionError<TV1StorageStrin
938
1030
  export declare type TV1StorageStringSetErrorCode = 'ERR_CODE_UNSPECIFIED' | 'ERR_STORAGE_VALUE_SIZE_LIMIT_EXCEEDED';
939
1031
 
940
1032
  declare type TV1SystemMethods = {
1033
+ 'v1.system.analytics.track': {
1034
+ params: TV1AnalyticsTrackParams;
1035
+ result: null;
1036
+ };
941
1037
  'v1.system.report.crash': {
942
1038
  params: {
943
1039
  data?: Record<string, unknown>;
@@ -1077,6 +1173,17 @@ export declare type TV1TopUserEntry = {
1077
1173
 
1078
1174
  export declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D' | 'TOP_UNSPECIFIED';
1079
1175
 
1176
+ export declare type TV1UiInteractionTrackParams = {
1177
+ data: {
1178
+ elementId: string;
1179
+ elementType: 'banner' | 'button' | 'tile' | 'popup' | 'extensionButton';
1180
+ interactionType: 'view' | 'click' | 'close' | 'dismiss';
1181
+ optionSelected?: string;
1182
+ pageSection?: string;
1183
+ };
1184
+ type: 'uiInteraction';
1185
+ };
1186
+
1080
1187
  /**
1081
1188
  * User activity league. Ordered from lowest to highest activity rank:
1082
1189
  * - `grey` — new or low-activity users (level 1–9)
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.3.2",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "module": "./dist/ext-helper.js",