@stripchatdev/ext-helper 0.1.36 → 0.1.38

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +46 -9
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -118,7 +118,7 @@ declare type TV1ChatEvents = {
118
118
 
119
119
  declare type TV1ChatMethods = {
120
120
  /**
121
- * This method should be used to notify a user in the chat about an event related to the extension, for example, showing the result of a game.
121
+ * This method should be used to notify a user in the chat about an event related to the extension, for example, showing the result of a game. Therefore, it should be used only after `v1.payment.tokens.spend.succeeded` event.
122
122
  *
123
123
  * The message is sent locally to each user on behalf of the extension. The message is not sent to the server
124
124
  * and is not broadcasted — each user sees it injected into their own local chat feed.
@@ -132,6 +132,7 @@ declare type TV1ChatMethods = {
132
132
  */
133
133
  'v1.chat.message.send': {
134
134
  params: {
135
+ /** Whether the username should be hidden. Always respect user's anonimity and use data received in `v1.payment.tokens.spend.succeeded'. */
135
136
  isAnonymous: boolean;
136
137
  /**
137
138
  * Chat message text.
@@ -172,7 +173,7 @@ declare type TV1ChatMethods = {
172
173
  };
173
174
  };
174
175
 
175
- export declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents;
176
+ export declare type TV1Events = TV1ExtEvents & TV1PaymentEvents & TV1ModelEvents & TV1SessionEvents & TV1TipEvents & TV1ChatEvents & TV1GoalEvents;
176
177
 
177
178
  export declare type TV1ExtContext = {
178
179
  model?: TV1ExtModel;
@@ -220,6 +221,8 @@ export declare type TV1ExtLoggedInUser = {
220
221
  id: TUserId;
221
222
  /** User is logged in. */
222
223
  isGuest: false;
224
+ /** User is invisible. Do not expose any data of invisible users. */
225
+ isInvisible: boolean;
223
226
  /** User is the highest tipper in the room over past 12 hours. */
224
227
  isKing: boolean;
225
228
  /** User is a knight of the model. */
@@ -305,10 +308,12 @@ declare type TV1ExtMethods = {
305
308
  /** 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 */
306
309
  'v1.ext.whisper': {
307
310
  params: {
308
- /** Any JSON-serializable object to send to every frame */
311
+ /** Any JSON-serializable object to send to every frame.
312
+ * Never send any sensetive data through this field, such as username or user id.
313
+ * */
309
314
  data: TV1WhisperData;
310
- /** Payment data received from the `payment.tokens.spend.succeeded` event
311
- * This field is required for user in public
315
+ /** Payment data returned by the `payment.tokens.spend.succeeded` event.
316
+ * Required for users in public shows. Use it only once for the request it authorizes. Do not store or reuse it.
312
317
  * */
313
318
  paymentData?: TV1PaymentData;
314
319
  };
@@ -374,7 +379,36 @@ export declare type TV1ExtViewers = {
374
379
 
375
380
  export declare type TV1Genders = 'male' | 'female' | 'group' | 'tranny';
376
381
 
377
- export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods;
382
+ /** Regular goal data */
383
+ export declare type TV1GoalData = {
384
+ /** Goal description */
385
+ description: string;
386
+ /** Whether the goal is fully completed */
387
+ isCompleted: boolean;
388
+ /** Amount of tokens already collected */
389
+ tokensCollected: number;
390
+ /** Target amount in tokens */
391
+ tokensTarget: number;
392
+ };
393
+
394
+ declare type TV1GoalEvents = {
395
+ /** Fired when any field of the active goal changes (description, isCompleted, tokensTarget, or tokensCollected), or the active goal is removed. */
396
+ 'v1.goal.updated': {
397
+ goal: TV1GoalData | null;
398
+ };
399
+ };
400
+
401
+ declare type TV1GoalMethods = {
402
+ /** Get the current active goal. Returns null if no goal is active. */
403
+ 'v1.goal.get': {
404
+ params: null;
405
+ result: {
406
+ goal: TV1GoalData | null;
407
+ };
408
+ };
409
+ };
410
+
411
+ export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1SessionMethods & TV1StorageMethods & TV1TipMethods & TV1GoalMethods;
378
412
 
379
413
  declare type TV1ModelEvents = {
380
414
  'v1.model.ext.settings.set.requested': null;
@@ -415,6 +449,7 @@ declare type TV1MonitoringMethods = {
415
449
  };
416
450
  };
417
451
 
452
+ /** Payment data returned after a successful token spend. Use it only once for the request it authorizes. Do not store or reuse it. */
418
453
  export declare type TV1PaymentData = {
419
454
  /** The amount of tokens spent */
420
455
  amount: string;
@@ -429,12 +464,12 @@ export declare type TV1PaymentData = {
429
464
  declare type TV1PaymentEvents = {
430
465
  /**
431
466
  * Received when tokens are successfully spent
432
- * Contains the payment data which is used for validating whisper calls
467
+ * Contains payment data returned after a successful token spend. Use it only once for the request it authorizes. Do not store or reuse it.
433
468
  */
434
469
  'v1.payment.tokens.spend.succeeded': {
435
- /** Was the tip anonymous */
470
+ /** Was the tip anonymous. Use this field in `v1.chat.message.send` */
436
471
  isAnonymous: boolean;
437
- /** Payment data used for validating `ext.whisper` calls */
472
+ /** Payment data returned after a successful token spend. Use it only once for the request it authorizes. Do not store or reuse it. */
438
473
  paymentData: TV1PaymentData;
439
474
  /** Custom data passed in `payment.tokens.spend` method */
440
475
  tokensSpendData: TV1TokenSpendData;
@@ -498,7 +533,9 @@ declare type TV1SessionMethods = {
498
533
  };
499
534
  'v1.session.join.user': {
500
535
  params: {
536
+ /** Payment data returned by the `payment.tokens.spend.succeeded` event. Use it only once for the request it authorizes. Do not store or reuse it. */
501
537
  payment: TV1PaymentData;
538
+ /** Session lifetime in seconds (minimum 1). */
502
539
  ttl: string;
503
540
  };
504
541
  result: null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stripchatdev/ext-helper",
3
3
  "private": false,
4
- "version": "0.1.36",
4
+ "version": "0.1.38",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "module": "./dist/ext-helper.js",