@stripchatdev/ext-helper 0.1.5 → 0.1.6

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 +40 -2
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -65,6 +65,15 @@ export declare type TMethods = TV1Methods;
65
65
 
66
66
  export declare type TModelId = TUserId;
67
67
 
68
+ /**
69
+ * Status of the movable overlay.
70
+ * `active` - pulsing green
71
+ * `inactive` - orange
72
+ * `connecting` - green
73
+ * `error` - red
74
+ */
75
+ export declare type TMovableOverlayStatus = 'active' | 'inactive' | 'connecting' | 'error';
76
+
68
77
  export declare type TTheme = 'light' | 'dark';
69
78
 
70
79
  declare type TTransportPeer = {
@@ -134,7 +143,7 @@ declare type TV1ExtMethods = {
134
143
  'v1.ext.movableOverlay.update': {
135
144
  params: {
136
145
  message?: string;
137
- status?: 'active' | 'inactive' | 'connecting' | 'error';
146
+ status?: TMovableOverlayStatus;
138
147
  };
139
148
  result: null;
140
149
  };
@@ -150,12 +159,19 @@ declare type TV1ExtMethods = {
150
159
  };
151
160
  result: null;
152
161
  };
162
+ /** 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 */
153
163
  'v1.ext.whisper': {
154
164
  params: {
165
+ /** Any JSON-serializable object to send to every frame */
155
166
  data: TV1WhisperData;
167
+ /** Payment data received from the `payment.tokens.spend.succeeded` event
168
+ * This field is required for user in public
169
+ * */
170
+ paymentData?: TV1PaymentData;
156
171
  };
157
172
  result: null;
158
173
  };
174
+ /** Sends a message to every frame of the current user */
159
175
  'v1.ext.whisper.local': {
160
176
  params: {
161
177
  data: TV1WhisperData;
@@ -273,18 +289,39 @@ declare type TV1MonitoringMethods = {
273
289
  };
274
290
  };
275
291
 
292
+ export declare type TV1PaymentData = {
293
+ /** The amount of tokens spent */
294
+ amount: string;
295
+ /** Payment token used for authentication */
296
+ paymentToken: string;
297
+ /** Transaction identifier */
298
+ transactionId: string;
299
+ /** User's ID */
300
+ userId: string;
301
+ };
302
+
276
303
  declare type TV1PaymentEvents = {
304
+ /**
305
+ * Received when tokens are successfully spent
306
+ * Contains the payment data which is used for validating whisper calls
307
+ */
277
308
  'v1.payment.tokens.spend.succeeded': {
309
+ /** Was the tip anonymous */
278
310
  isAnonymous: boolean;
279
- tokensAmount: number;
311
+ /** Payment data used for validating `ext.whisper` calls */
312
+ paymentData: TV1PaymentData;
313
+ /** Custom data passed in `payment.tokens.spend` method */
280
314
  tokensSpendData: TV1TokenSpendData;
281
315
  };
282
316
  };
283
317
 
284
318
  declare type TV1PaymentMethods = {
319
+ /** Requests a confirmation modal to spend tokens */
285
320
  'v1.payment.tokens.spend': {
286
321
  params: {
322
+ /** Amount of tokens to spend */
287
323
  tokensAmount: number;
324
+ /** Custom data which will be passed back in the `v1.payment.tokens.spend.succeeded` event */
288
325
  tokensSpendData: TV1TokenSpendData;
289
326
  };
290
327
  result: null;
@@ -379,6 +416,7 @@ declare type TV1TipEvents = {
379
416
  */
380
417
  declare type TV1TipSource = 'console' | 'tipMenu' | 'goal' | 'epicGoal' | 'fullscreen' | 'interactiveToy' | 'publicChat' | 'privateChat' | 'extension' | 'sendTipButton' | 'feed';
381
418
 
419
+ /** Custom data that you can pass when requesting token spend. You will receive it on successful payment */
382
420
  export declare type TV1TokenSpendData = TUnknownDictionary;
383
421
 
384
422
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stripchatdev/ext-helper",
3
3
  "private": false,
4
- "version": "0.1.5",
4
+ "version": "0.1.6",
5
5
  "type": "module",
6
6
  "module": "./dist/ext-helper.js",
7
7
  "types": "./dist/index.d.ts",