@stream-io/video-client 0.7.0 → 0.7.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.
package/dist/index.es.js CHANGED
@@ -9240,6 +9240,22 @@ const flatten$1 = (report) => {
9240
9240
  });
9241
9241
  return stats;
9242
9242
  };
9243
+ const getSdkSignature = (clientDetails) => {
9244
+ const { sdk, ...platform } = clientDetails;
9245
+ const sdkName = sdk && sdk.type === SdkType.REACT
9246
+ ? 'stream-react'
9247
+ : sdk && sdk.type === SdkType.REACT_NATIVE
9248
+ ? 'stream-react-native'
9249
+ : 'stream-js';
9250
+ const sdkVersion = sdk
9251
+ ? `${sdk.major}.${sdk.minor}.${sdk.patch}`
9252
+ : '0.0.0-development';
9253
+ return {
9254
+ sdkName,
9255
+ sdkVersion,
9256
+ ...platform,
9257
+ };
9258
+ };
9243
9259
 
9244
9260
  /**
9245
9261
  * Creates a new StatsReporter instance that collects metrics about the ongoing call and reports them to the state store
@@ -12591,6 +12607,37 @@ class Call {
12591
12607
  const endpoint = `${this.streamClientBasePath}/stats/${callSessionID}`;
12592
12608
  return this.streamClient.get(endpoint);
12593
12609
  };
12610
+ /**
12611
+ * Submit user feedback for the call
12612
+ *
12613
+ * @param rating Rating between 1 and 5 denoting the experience of the user in the call
12614
+ * @param reason The reason/description for the rating
12615
+ * @param custom Custom data
12616
+ * @returns
12617
+ */
12618
+ this.submitFeedback = async (rating, { reason, custom, } = {}) => {
12619
+ if (rating < 1 || rating > 5) {
12620
+ throw new Error('Rating must be between 1 and 5');
12621
+ }
12622
+ const userSessionId = this.sfuClient?.sessionId;
12623
+ const callSessionId = this.state.session?.id;
12624
+ if (!callSessionId || !userSessionId) {
12625
+ throw new Error('Feedback can be submitted only in the context of a call session');
12626
+ }
12627
+ const { sdkName, sdkVersion, ...platform } = getSdkSignature(getClientDetails());
12628
+ const endpoint = `${this.streamClientBasePath}/feedback/${callSessionId}`;
12629
+ return this.streamClient.post(endpoint, {
12630
+ rating,
12631
+ reason,
12632
+ user_session_id: userSessionId,
12633
+ sdk: sdkName,
12634
+ sdk_version: sdkVersion,
12635
+ custom: {
12636
+ ...custom,
12637
+ 'x-stream-platform-data': platform,
12638
+ },
12639
+ });
12640
+ };
12594
12641
  /**
12595
12642
  * Sends a custom event to all call participants.
12596
12643
  *
@@ -14413,7 +14460,7 @@ class StreamClient {
14413
14460
  });
14414
14461
  };
14415
14462
  this.getUserAgent = () => {
14416
- const version = "0.7.0" ;
14463
+ const version = "0.7.2" ;
14417
14464
  return (this.userAgent ||
14418
14465
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14419
14466
  };