med-scribe-alliance-ts-sdk 2.0.4 → 2.0.7

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.d.ts CHANGED
@@ -271,6 +271,7 @@ export interface ResolvedConfig {
271
271
  clientSdkDelivery: boolean;
272
272
  }
273
273
  export interface PatientDetails {
274
+ oid?: string;
274
275
  name?: string;
275
276
  age?: string;
276
277
  gender?: string;
@@ -963,6 +964,11 @@ export declare class RecordingManager {
963
964
  * @returns Stop result with failed uploads and total files
964
965
  */
965
966
  stop(): Promise<StopRecordingResult>;
967
+ /**
968
+ * Stop the recorder locally without calling endSession on the backend.
969
+ * Used by cancelSession — we don't want the server to start processing.
970
+ */
971
+ forceStop(): Promise<void>;
966
972
  /**
967
973
  * Update the auth token for the active recording.
968
974
  * Forwards to the active recorder (which updates WorkerManager/transport).
package/dist/index.mjs CHANGED
@@ -1649,6 +1649,20 @@ var re = class {
1649
1649
  this.cleanupRecordingState();
1650
1650
  }
1651
1651
  }
1652
+ async forceStop() {
1653
+ if (!(!this.recorder || !this._isRecording)) try {
1654
+ await this.recorder.stop();
1655
+ } catch {} finally {
1656
+ this.callbackRegistry.dispatch("onRecordingStateChange", {
1657
+ type: "ended",
1658
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1659
+ data: {
1660
+ failedUploads: [],
1661
+ totalFiles: 0
1662
+ }
1663
+ }), this.cleanupRecordingState();
1664
+ }
1665
+ }
1652
1666
  updateAuthToken(e) {
1653
1667
  this.recorder && this.recorder instanceof Z && this.recorder.updateAuthToken(e), this.transport.setAuthToken(e);
1654
1668
  }
@@ -1825,13 +1839,11 @@ var re = class {
1825
1839
  return this.wrapResult(() => this.sessionManager.processTemplate(n, e, t));
1826
1840
  }
1827
1841
  async cancelSession(e) {
1828
- if (this.recordingManager.isRecording()) try {
1829
- await this.recordingManager.stop();
1830
- } catch {}
1831
- return this.recordingManager.reset(), this.sessionManager.clearCurrentSession(), this.updateSession({
1842
+ let t = e ?? this.recordingManager.getActiveSession()?.session_id ?? this.sessionManager.getCurrentSession()?.session_id;
1843
+ return this.recordingManager.isRecording() && await this.recordingManager.forceStop(), this.recordingManager.reset(), this.sessionManager.clearCurrentSession(), this.updateSession({
1832
1844
  user_status: "cancelled",
1833
1845
  processing_status: "cancelled"
1834
- }, e);
1846
+ }, t);
1835
1847
  }
1836
1848
  getDiscoveryConfig() {
1837
1849
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "med-scribe-alliance-ts-sdk",
3
- "version": "2.0.4",
3
+ "version": "2.0.7",
4
4
  "description": "TypeScript SDK for the MedScribe Alliance Protocol",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",