@stripchatdev/ext-helper 0.1.48 → 0.2.1

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.
@@ -132,7 +132,9 @@ declare type TV1ActionParamValue = string | number | boolean | null | undefined
132
132
  };
133
133
 
134
134
  declare type TV1ActionRequestParams = {
135
+ /** Name of the action as declared in the manifest actions array */
135
136
  actionName: string;
137
+ /** Key-value parameters passed to the action. Used for URL/header placeholders and request body */
136
138
  params: Record<string, TV1ActionParamValue>;
137
139
  };
138
140
 
@@ -169,7 +171,7 @@ declare type TV1ChatMethods = {
169
171
  */
170
172
  'v1.chat.message.send': {
171
173
  params: {
172
- /** Whether the username should be hidden. Always respect user's anonimity and use data received in `v1.payment.tokens.spend.succeeded'. */
174
+ /** Whether to use the anonymous placeholder or not. Always respect the user's anonymity and use data received in `v1.payment.tokens.spend.succeeded`. */
173
175
  isAnonymous: boolean;
174
176
  /**
175
177
  * Chat message text.
@@ -181,6 +183,7 @@ declare type TV1ChatMethods = {
181
183
  * Example: `'won {#accent}Alice{/accent} in'`
182
184
  */
183
185
  message: string;
186
+ /** User to attribute the message to. Pass null if the user is anonymous or if the username is not needed in the message. */
184
187
  user: TV1ExtUser | null;
185
188
  };
186
189
  result: null;
@@ -234,6 +237,7 @@ declare type TV1ExtEvents = {
234
237
  };
235
238
  'v1.ext.whispered': TV1WhisperData;
236
239
  'v1.ext.whispered.local': TV1WhisperData;
240
+ 'v2.ext.whispered': TV2WhisperData;
237
241
  };
238
242
 
239
243
  /** Guest user (not logged in). */
@@ -291,15 +295,18 @@ declare type TV1ExtLoggedInUser = {
291
295
  };
292
296
 
293
297
  declare type TV1ExtMethods = {
298
+ /** Triggers a backend action defined in the manifest.json. Stripchat executes the action server side and returns the response */
294
299
  'v1.ext.actions.call': {
295
300
  params: TV1ActionRequestParams;
296
301
  result: TV1ActionResult;
297
302
  };
298
303
  'v1.ext.activity.request': {
299
304
  params: {
305
+ /** Duration of the activity reservation in milliseconds. Must be a positive finite number up to `30000` (30 seconds) */
300
306
  durationMs: number;
301
307
  };
302
308
  result: {
309
+ /** Identifier of the started activity */
303
310
  activityId: string;
304
311
  };
305
312
  };
@@ -342,7 +349,7 @@ declare type TV1ExtMethods = {
342
349
  params: null;
343
350
  result: TV1ExtViewers | null;
344
351
  };
345
- /** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v1.ext.whispered` event */
352
+ /** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v2.ext.whispered` event */
346
353
  'v1.ext.whisper': {
347
354
  params: {
348
355
  /** Any JSON-serializable object to send to every frame.
@@ -588,34 +595,69 @@ declare type TV1SerializedError = {
588
595
  stack?: string;
589
596
  };
590
597
 
598
+ /**
599
+ * Required permission:
600
+ * - `sessions`
601
+ */
591
602
  declare type TV1Session = TV1SessionSelf | TV1SessionOther;
592
603
 
604
+ /**
605
+ * Required permission:
606
+ * - `sessions`
607
+ */
593
608
  declare type TV1SessionActionType = 'join' | 'finish';
594
609
 
595
610
  declare type TV1SessionEvents = {
611
+ /**
612
+ * Required permission:
613
+ * - `sessions`
614
+ */
596
615
  'v1.session.updated': {
597
616
  data: TV1SessionUpdate;
598
617
  };
618
+ /**
619
+ * Required permission:
620
+ * - `sessions`
621
+ */
599
622
  'v1.session.whispered.model': TV1SessionWhisperData;
600
623
  };
601
624
 
602
625
  declare type TV1SessionMethods = {
626
+ /**
627
+ * Required permission:
628
+ * - `sessions`
629
+ */
603
630
  'v1.session.finish.model': {
604
631
  params: null;
605
632
  result: null;
606
633
  };
634
+ /**
635
+ * Returns the current long-term session.
636
+ *
637
+ * Required permission:
638
+ * - `sessions`
639
+ */
607
640
  'v1.session.get': {
608
641
  params: null;
609
642
  result: {
643
+ /** Current session snapshot. Returns `null` if the session doesn't exist **/
610
644
  session: TV1Session | null;
611
645
  };
612
646
  };
647
+ /**
648
+ * Required permission:
649
+ * - `sessions`
650
+ */
613
651
  'v1.session.join.model': {
614
652
  params: {
615
653
  ttl: string;
616
654
  };
617
655
  result: null;
618
656
  };
657
+ /**
658
+ * Required permission:
659
+ * - `sessions`
660
+ */
619
661
  'v1.session.join.user': {
620
662
  params: {
621
663
  /** @deprecated
@@ -633,6 +675,10 @@ declare type TV1SessionMethods = {
633
675
  };
634
676
  result: null;
635
677
  };
678
+ /**
679
+ * Required permission:
680
+ * - `sessions`
681
+ */
636
682
  'v1.session.whisper.user': {
637
683
  params: {
638
684
  data: TV1SessionWhisperData;
@@ -641,11 +687,19 @@ declare type TV1SessionMethods = {
641
687
  };
642
688
  };
643
689
 
690
+ /**
691
+ * Required permission:
692
+ * - `sessions`
693
+ */
644
694
  declare type TV1SessionOther = {
645
695
  /** The session exists but belongs to a different extension */
646
696
  owner: 'other';
647
697
  };
648
698
 
699
+ /**
700
+ * Required permission:
701
+ * - `sessions`
702
+ */
649
703
  declare type TV1SessionSelf = {
650
704
  meta: {
651
705
  /** Platform session id */
@@ -657,12 +711,20 @@ declare type TV1SessionSelf = {
657
711
  owner: 'self';
658
712
  };
659
713
 
714
+ /**
715
+ * Required permission:
716
+ * - `sessions`
717
+ */
660
718
  declare type TV1SessionUpdate = {
661
719
  action: TV1SessionActionType;
662
720
  session: TV1Session | null;
663
721
  userId: TUserId;
664
722
  };
665
723
 
724
+ /**
725
+ * Required permission:
726
+ * - `sessions`
727
+ */
666
728
  declare type TV1SessionWhisperData = TUnknownDictionary;
667
729
 
668
730
  declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
@@ -1015,6 +1077,15 @@ declare type TV1UserStatus = Exclude<TV1ShowStatus, 'idle'>;
1015
1077
 
1016
1078
  declare type TV1WhisperData = TUnknownDictionary;
1017
1079
 
1080
+ declare type TV2WhisperData = {
1081
+ data: TUnknownDictionary;
1082
+ /**
1083
+ * The authoritative amount of tokens actually paid for the broadcast action. Compare this value with an actual price defined in settings or as a contant in your app.
1084
+ * `null` means no payment occurred, e.g. when the whisper was called by user in a private show or it was called by the model.
1085
+ */
1086
+ tokenSum: number | null;
1087
+ };
1088
+
1018
1089
  declare const V1_SHOW_STATUSES: {
1019
1090
  /** Ticket show */
1020
1091
  readonly STATUS_TICKET_SHOW: "ticketShow";
@@ -66,7 +66,9 @@ declare type TV1ActionParamValue = string | number | boolean | null | undefined
66
66
  };
67
67
 
68
68
  declare type TV1ActionRequestParams = {
69
+ /** Name of the action as declared in the manifest actions array */
69
70
  actionName: string;
71
+ /** Key-value parameters passed to the action. Used for URL/header placeholders and request body */
70
72
  params: Record<string, TV1ActionParamValue>;
71
73
  };
72
74
 
@@ -103,7 +105,7 @@ declare type TV1ChatMethods = {
103
105
  */
104
106
  'v1.chat.message.send': {
105
107
  params: {
106
- /** Whether the username should be hidden. Always respect user's anonimity and use data received in `v1.payment.tokens.spend.succeeded'. */
108
+ /** Whether to use the anonymous placeholder or not. Always respect the user's anonymity and use data received in `v1.payment.tokens.spend.succeeded`. */
107
109
  isAnonymous: boolean;
108
110
  /**
109
111
  * Chat message text.
@@ -115,6 +117,7 @@ declare type TV1ChatMethods = {
115
117
  * Example: `'won {#accent}Alice{/accent} in'`
116
118
  */
117
119
  message: string;
120
+ /** User to attribute the message to. Pass null if the user is anonymous or if the username is not needed in the message. */
118
121
  user: TV1ExtUser | null;
119
122
  };
120
123
  result: null;
@@ -168,6 +171,7 @@ declare type TV1ExtEvents = {
168
171
  };
169
172
  'v1.ext.whispered': TV1WhisperData;
170
173
  'v1.ext.whispered.local': TV1WhisperData;
174
+ 'v2.ext.whispered': TV2WhisperData;
171
175
  };
172
176
 
173
177
  /** Guest user (not logged in). */
@@ -225,15 +229,18 @@ declare type TV1ExtLoggedInUser = {
225
229
  };
226
230
 
227
231
  declare type TV1ExtMethods = {
232
+ /** Triggers a backend action defined in the manifest.json. Stripchat executes the action server side and returns the response */
228
233
  'v1.ext.actions.call': {
229
234
  params: TV1ActionRequestParams;
230
235
  result: TV1ActionResult;
231
236
  };
232
237
  'v1.ext.activity.request': {
233
238
  params: {
239
+ /** Duration of the activity reservation in milliseconds. Must be a positive finite number up to `30000` (30 seconds) */
234
240
  durationMs: number;
235
241
  };
236
242
  result: {
243
+ /** Identifier of the started activity */
237
244
  activityId: string;
238
245
  };
239
246
  };
@@ -276,7 +283,7 @@ declare type TV1ExtMethods = {
276
283
  params: null;
277
284
  result: TV1ExtViewers | null;
278
285
  };
279
- /** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v1.ext.whispered` event */
286
+ /** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v2.ext.whispered` event */
280
287
  'v1.ext.whisper': {
281
288
  params: {
282
289
  /** Any JSON-serializable object to send to every frame.
@@ -522,34 +529,69 @@ declare type TV1SerializedError = {
522
529
  stack?: string;
523
530
  };
524
531
 
532
+ /**
533
+ * Required permission:
534
+ * - `sessions`
535
+ */
525
536
  declare type TV1Session = TV1SessionSelf | TV1SessionOther;
526
537
 
538
+ /**
539
+ * Required permission:
540
+ * - `sessions`
541
+ */
527
542
  declare type TV1SessionActionType = 'join' | 'finish';
528
543
 
529
544
  declare type TV1SessionEvents = {
545
+ /**
546
+ * Required permission:
547
+ * - `sessions`
548
+ */
530
549
  'v1.session.updated': {
531
550
  data: TV1SessionUpdate;
532
551
  };
552
+ /**
553
+ * Required permission:
554
+ * - `sessions`
555
+ */
533
556
  'v1.session.whispered.model': TV1SessionWhisperData;
534
557
  };
535
558
 
536
559
  declare type TV1SessionMethods = {
560
+ /**
561
+ * Required permission:
562
+ * - `sessions`
563
+ */
537
564
  'v1.session.finish.model': {
538
565
  params: null;
539
566
  result: null;
540
567
  };
568
+ /**
569
+ * Returns the current long-term session.
570
+ *
571
+ * Required permission:
572
+ * - `sessions`
573
+ */
541
574
  'v1.session.get': {
542
575
  params: null;
543
576
  result: {
577
+ /** Current session snapshot. Returns `null` if the session doesn't exist **/
544
578
  session: TV1Session | null;
545
579
  };
546
580
  };
581
+ /**
582
+ * Required permission:
583
+ * - `sessions`
584
+ */
547
585
  'v1.session.join.model': {
548
586
  params: {
549
587
  ttl: string;
550
588
  };
551
589
  result: null;
552
590
  };
591
+ /**
592
+ * Required permission:
593
+ * - `sessions`
594
+ */
553
595
  'v1.session.join.user': {
554
596
  params: {
555
597
  /** @deprecated
@@ -567,6 +609,10 @@ declare type TV1SessionMethods = {
567
609
  };
568
610
  result: null;
569
611
  };
612
+ /**
613
+ * Required permission:
614
+ * - `sessions`
615
+ */
570
616
  'v1.session.whisper.user': {
571
617
  params: {
572
618
  data: TV1SessionWhisperData;
@@ -575,11 +621,19 @@ declare type TV1SessionMethods = {
575
621
  };
576
622
  };
577
623
 
624
+ /**
625
+ * Required permission:
626
+ * - `sessions`
627
+ */
578
628
  declare type TV1SessionOther = {
579
629
  /** The session exists but belongs to a different extension */
580
630
  owner: 'other';
581
631
  };
582
632
 
633
+ /**
634
+ * Required permission:
635
+ * - `sessions`
636
+ */
583
637
  declare type TV1SessionSelf = {
584
638
  meta: {
585
639
  /** Platform session id */
@@ -591,12 +645,20 @@ declare type TV1SessionSelf = {
591
645
  owner: 'self';
592
646
  };
593
647
 
648
+ /**
649
+ * Required permission:
650
+ * - `sessions`
651
+ */
594
652
  declare type TV1SessionUpdate = {
595
653
  action: TV1SessionActionType;
596
654
  session: TV1Session | null;
597
655
  userId: TUserId;
598
656
  };
599
657
 
658
+ /**
659
+ * Required permission:
660
+ * - `sessions`
661
+ */
600
662
  declare type TV1SessionWhisperData = TUnknownDictionary;
601
663
 
602
664
  declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
@@ -949,6 +1011,15 @@ declare type TV1UserStatus = Exclude<TV1ShowStatus, 'idle'>;
949
1011
 
950
1012
  declare type TV1WhisperData = TUnknownDictionary;
951
1013
 
1014
+ declare type TV2WhisperData = {
1015
+ data: TUnknownDictionary;
1016
+ /**
1017
+ * The authoritative amount of tokens actually paid for the broadcast action. Compare this value with an actual price defined in settings or as a contant in your app.
1018
+ * `null` means no payment occurred, e.g. when the whisper was called by user in a private show or it was called by the model.
1019
+ */
1020
+ tokenSum: number | null;
1021
+ };
1022
+
952
1023
  /**
953
1024
  * React hook for shared state owned by a background slot.
954
1025
  *
package/dist/index.d.ts CHANGED
@@ -102,7 +102,9 @@ export declare type TV1ActionParamValue = string | number | boolean | null | und
102
102
  };
103
103
 
104
104
  export declare type TV1ActionRequestParams = {
105
+ /** Name of the action as declared in the manifest actions array */
105
106
  actionName: string;
107
+ /** Key-value parameters passed to the action. Used for URL/header placeholders and request body */
106
108
  params: Record<string, TV1ActionParamValue>;
107
109
  };
108
110
 
@@ -139,7 +141,7 @@ declare type TV1ChatMethods = {
139
141
  */
140
142
  'v1.chat.message.send': {
141
143
  params: {
142
- /** Whether the username should be hidden. Always respect user's anonimity and use data received in `v1.payment.tokens.spend.succeeded'. */
144
+ /** Whether to use the anonymous placeholder or not. Always respect the user's anonymity and use data received in `v1.payment.tokens.spend.succeeded`. */
143
145
  isAnonymous: boolean;
144
146
  /**
145
147
  * Chat message text.
@@ -151,6 +153,7 @@ declare type TV1ChatMethods = {
151
153
  * Example: `'won {#accent}Alice{/accent} in'`
152
154
  */
153
155
  message: string;
156
+ /** User to attribute the message to. Pass null if the user is anonymous or if the username is not needed in the message. */
154
157
  user: TV1ExtUser | null;
155
158
  };
156
159
  result: null;
@@ -204,6 +207,7 @@ declare type TV1ExtEvents = {
204
207
  };
205
208
  'v1.ext.whispered': TV1WhisperData;
206
209
  'v1.ext.whispered.local': TV1WhisperData;
210
+ 'v2.ext.whispered': TV2WhisperData;
207
211
  };
208
212
 
209
213
  /** Guest user (not logged in). */
@@ -261,15 +265,18 @@ export declare type TV1ExtLoggedInUser = {
261
265
  };
262
266
 
263
267
  declare type TV1ExtMethods = {
268
+ /** Triggers a backend action defined in the manifest.json. Stripchat executes the action server side and returns the response */
264
269
  'v1.ext.actions.call': {
265
270
  params: TV1ActionRequestParams;
266
271
  result: TV1ActionResult;
267
272
  };
268
273
  'v1.ext.activity.request': {
269
274
  params: {
275
+ /** Duration of the activity reservation in milliseconds. Must be a positive finite number up to `30000` (30 seconds) */
270
276
  durationMs: number;
271
277
  };
272
278
  result: {
279
+ /** Identifier of the started activity */
273
280
  activityId: string;
274
281
  };
275
282
  };
@@ -312,7 +319,7 @@ declare type TV1ExtMethods = {
312
319
  params: null;
313
320
  result: TV1ExtViewers | null;
314
321
  };
315
- /** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v1.ext.whispered` event */
322
+ /** Broadcasts a message through the server to all clients in the room that have this extension loaded. Every slot iframe of every user receives the corresponding `v2.ext.whispered` event */
316
323
  'v1.ext.whisper': {
317
324
  params: {
318
325
  /** Any JSON-serializable object to send to every frame.
@@ -558,34 +565,69 @@ declare type TV1SerializedError = {
558
565
  stack?: string;
559
566
  };
560
567
 
568
+ /**
569
+ * Required permission:
570
+ * - `sessions`
571
+ */
561
572
  export declare type TV1Session = TV1SessionSelf | TV1SessionOther;
562
573
 
574
+ /**
575
+ * Required permission:
576
+ * - `sessions`
577
+ */
563
578
  export declare type TV1SessionActionType = 'join' | 'finish';
564
579
 
565
580
  declare type TV1SessionEvents = {
581
+ /**
582
+ * Required permission:
583
+ * - `sessions`
584
+ */
566
585
  'v1.session.updated': {
567
586
  data: TV1SessionUpdate;
568
587
  };
588
+ /**
589
+ * Required permission:
590
+ * - `sessions`
591
+ */
569
592
  'v1.session.whispered.model': TV1SessionWhisperData;
570
593
  };
571
594
 
572
595
  declare type TV1SessionMethods = {
596
+ /**
597
+ * Required permission:
598
+ * - `sessions`
599
+ */
573
600
  'v1.session.finish.model': {
574
601
  params: null;
575
602
  result: null;
576
603
  };
604
+ /**
605
+ * Returns the current long-term session.
606
+ *
607
+ * Required permission:
608
+ * - `sessions`
609
+ */
577
610
  'v1.session.get': {
578
611
  params: null;
579
612
  result: {
613
+ /** Current session snapshot. Returns `null` if the session doesn't exist **/
580
614
  session: TV1Session | null;
581
615
  };
582
616
  };
617
+ /**
618
+ * Required permission:
619
+ * - `sessions`
620
+ */
583
621
  'v1.session.join.model': {
584
622
  params: {
585
623
  ttl: string;
586
624
  };
587
625
  result: null;
588
626
  };
627
+ /**
628
+ * Required permission:
629
+ * - `sessions`
630
+ */
589
631
  'v1.session.join.user': {
590
632
  params: {
591
633
  /** @deprecated
@@ -603,6 +645,10 @@ declare type TV1SessionMethods = {
603
645
  };
604
646
  result: null;
605
647
  };
648
+ /**
649
+ * Required permission:
650
+ * - `sessions`
651
+ */
606
652
  'v1.session.whisper.user': {
607
653
  params: {
608
654
  data: TV1SessionWhisperData;
@@ -611,11 +657,19 @@ declare type TV1SessionMethods = {
611
657
  };
612
658
  };
613
659
 
660
+ /**
661
+ * Required permission:
662
+ * - `sessions`
663
+ */
614
664
  export declare type TV1SessionOther = {
615
665
  /** The session exists but belongs to a different extension */
616
666
  owner: 'other';
617
667
  };
618
668
 
669
+ /**
670
+ * Required permission:
671
+ * - `sessions`
672
+ */
619
673
  export declare type TV1SessionSelf = {
620
674
  meta: {
621
675
  /** Platform session id */
@@ -627,12 +681,20 @@ export declare type TV1SessionSelf = {
627
681
  owner: 'self';
628
682
  };
629
683
 
684
+ /**
685
+ * Required permission:
686
+ * - `sessions`
687
+ */
630
688
  export declare type TV1SessionUpdate = {
631
689
  action: TV1SessionActionType;
632
690
  session: TV1Session | null;
633
691
  userId: TUserId;
634
692
  };
635
693
 
694
+ /**
695
+ * Required permission:
696
+ * - `sessions`
697
+ */
636
698
  export declare type TV1SessionWhisperData = TUnknownDictionary;
637
699
 
638
700
  export declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
@@ -985,6 +1047,15 @@ export declare type TV1UserStatus = Exclude<TV1ShowStatus, 'idle'>;
985
1047
 
986
1048
  export declare type TV1WhisperData = TUnknownDictionary;
987
1049
 
1050
+ export declare type TV2WhisperData = {
1051
+ data: TUnknownDictionary;
1052
+ /**
1053
+ * The authoritative amount of tokens actually paid for the broadcast action. Compare this value with an actual price defined in settings or as a contant in your app.
1054
+ * `null` means no payment occurred, e.g. when the whisper was called by user in a private show or it was called by the model.
1055
+ */
1056
+ tokenSum: number | null;
1057
+ };
1058
+
988
1059
  export declare const V1_SHOW_STATUSES: {
989
1060
  /** Ticket show */
990
1061
  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.1.48",
4
+ "version": "0.2.1",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "module": "./dist/ext-helper.js",