obi-sdk 0.6.5 → 0.6.8

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.
@@ -481,6 +481,11 @@ class ObiClient {
481
481
  body: data
482
482
  });
483
483
  }
484
+ async getPlanVideoUrl(id) {
485
+ return await this.client.GET("/plans/{id}/video-url", {
486
+ params: { path: { id } }
487
+ });
488
+ }
484
489
  // Sessions
485
490
  async listSessions(token) {
486
491
  return await this.client.GET("/sessions", {
@@ -497,6 +502,11 @@ class ObiClient {
497
502
  params: { path: { id } }
498
503
  });
499
504
  }
505
+ async startSession(id, token) {
506
+ return await this.client.GET("/sessions/{id}/start-session", {
507
+ params: { path: { id }, query: token ? { token } : {} }
508
+ });
509
+ }
500
510
  async getSessionRecording(id) {
501
511
  return await this.client.GET("/sessions/{id}/recording", {
502
512
  params: { path: { id } }
@@ -10108,53 +10118,6 @@ function n$2(t2) {
10108
10118
  function r$1(r2) {
10109
10119
  return n$2({ ...r2, state: true, attribute: false });
10110
10120
  }
10111
- class StorageManager {
10112
- /**
10113
- * Create a new StorageManager with a specific namespace
10114
- * @param namespace The namespace to prefix all keys with
10115
- */
10116
- constructor(namespace) {
10117
- this.namespace = namespace;
10118
- }
10119
- /**
10120
- * Get a value from localStorage with the namespace prefix
10121
- * @param key The key to retrieve
10122
- * @returns The stored value or null if not found
10123
- */
10124
- getItem(key) {
10125
- return localStorage.getItem(`${this.namespace}.${key}`);
10126
- }
10127
- /**
10128
- * Set a value in localStorage with the namespace prefix
10129
- * @param key The key to set
10130
- * @param value The value to store
10131
- */
10132
- setItem(key, value) {
10133
- localStorage.setItem(`${this.namespace}.${key}`, value);
10134
- }
10135
- /**
10136
- * Remove a value from localStorage with the namespace prefix
10137
- * @param key The key to remove
10138
- */
10139
- removeItem(key) {
10140
- localStorage.removeItem(`${this.namespace}.${key}`);
10141
- }
10142
- /**
10143
- * Clear all keys that belong to this namespace
10144
- */
10145
- clear() {
10146
- for (let i3 = 0; i3 < localStorage.length; i3++) {
10147
- const key = localStorage.key(i3);
10148
- if (key && key.startsWith(`${this.namespace}.`)) {
10149
- localStorage.removeItem(key);
10150
- }
10151
- }
10152
- }
10153
- }
10154
- const STORAGE_KEYS = {
10155
- SESSION_DATA: "session_data"
10156
- };
10157
- const storage = new StorageManager("io.obi.widget");
10158
10121
  const DEBUG_BUILD$2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
10159
10122
  const SDK_VERSION = "9.23.0";
10160
10123
  const GLOBAL_OBJ = globalThis;
@@ -16016,6 +15979,53 @@ function withComponentErrorTracking(componentName) {
16016
15979
  }
16017
15980
  };
16018
15981
  }
15982
+ class StorageManager {
15983
+ /**
15984
+ * Create a new StorageManager with a specific namespace
15985
+ * @param namespace The namespace to prefix all keys with
15986
+ */
15987
+ constructor(namespace) {
15988
+ this.namespace = namespace;
15989
+ }
15990
+ /**
15991
+ * Get a value from localStorage with the namespace prefix
15992
+ * @param key The key to retrieve
15993
+ * @returns The stored value or null if not found
15994
+ */
15995
+ getItem(key) {
15996
+ return localStorage.getItem(`${this.namespace}.${key}`);
15997
+ }
15998
+ /**
15999
+ * Set a value in localStorage with the namespace prefix
16000
+ * @param key The key to set
16001
+ * @param value The value to store
16002
+ */
16003
+ setItem(key, value) {
16004
+ localStorage.setItem(`${this.namespace}.${key}`, value);
16005
+ }
16006
+ /**
16007
+ * Remove a value from localStorage with the namespace prefix
16008
+ * @param key The key to remove
16009
+ */
16010
+ removeItem(key) {
16011
+ localStorage.removeItem(`${this.namespace}.${key}`);
16012
+ }
16013
+ /**
16014
+ * Clear all keys that belong to this namespace
16015
+ */
16016
+ clear() {
16017
+ for (let i3 = 0; i3 < localStorage.length; i3++) {
16018
+ const key = localStorage.key(i3);
16019
+ if (key && key.startsWith(`${this.namespace}.`)) {
16020
+ localStorage.removeItem(key);
16021
+ }
16022
+ }
16023
+ }
16024
+ }
16025
+ const STORAGE_KEYS = {
16026
+ SESSION_DATA: "session_data"
16027
+ };
16028
+ const storage = new StorageManager("io.obi.widget");
16019
16029
  var __defProp$7 = Object.defineProperty;
16020
16030
  var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
16021
16031
  var __decorateClass$7 = (decorators, target, key, kind) => {
@@ -16506,6 +16516,7 @@ CourseList.styles = i$4`
16506
16516
  padding: 12px 0px;
16507
16517
  flex: 1 0 0;
16508
16518
  align-self: stretch;
16519
+ min-height: 364px; /* Ensure minimum 2 rows: 2 * 180px + 4px gap */
16509
16520
  }
16510
16521
 
16511
16522
  @media (max-width: 767px) {
@@ -16566,6 +16577,7 @@ class CourseModal extends i$1 {
16566
16577
  this.apiKey = "";
16567
16578
  this.apiBaseUrl = "";
16568
16579
  this.selectedCourse = null;
16580
+ this.agentName = "";
16569
16581
  }
16570
16582
  handleClose() {
16571
16583
  if (this.onClose) {
@@ -16589,13 +16601,20 @@ class CourseModal extends i$1 {
16589
16601
  this.loading = true;
16590
16602
  const raw_response = await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`);
16591
16603
  const response = await raw_response.json();
16592
- const mappedCourses = response.sessions?.map((session) => ({
16593
- id: session.uuid,
16594
- name: session.onboarding_plan.name,
16595
- description: session.onboarding_plan.description,
16596
- duration: session.onboarding_plan.duration
16597
- }));
16604
+ let agentName = "";
16605
+ const mappedCourses = response.sessions?.map((session) => {
16606
+ if (!agentName) {
16607
+ agentName = session.onboarding_plan.product.agent_name;
16608
+ }
16609
+ return {
16610
+ id: session.uuid,
16611
+ name: session.onboarding_plan.name,
16612
+ description: session.onboarding_plan.description,
16613
+ duration: session.onboarding_plan.duration
16614
+ };
16615
+ });
16598
16616
  const filteredCourses = mappedCourses.filter((course) => !!course.name);
16617
+ this.agentName = agentName || "Obi";
16599
16618
  this.courses = [...filteredCourses];
16600
16619
  this.requestUpdate();
16601
16620
  } catch (err) {
@@ -16630,8 +16649,15 @@ class CourseModal extends i$1 {
16630
16649
  <div class="header">
16631
16650
  <div class="icon">${obiIcon}</div>
16632
16651
  <div class="title-section">
16633
- <h1>Give Obi a try!</h1>
16634
- <p class="subtitle">Pick a tour, share your screen, and Obi will take it from there.</p>
16652
+ ${this.loading ? x`
16653
+ <div class="skeleton skeleton-title"></div>
16654
+ <div class="skeleton skeleton-subtitle"></div>
16655
+ ` : x`
16656
+ <h1>Give ${this.agentName} a try!</h1>
16657
+ <p class="subtitle">
16658
+ Pick a tour, share your screen, and ${this.agentName} will take it from there.
16659
+ </p>
16660
+ `}
16635
16661
  </div>
16636
16662
  <button class="close-button" aria-label="Close course modal" @click=${this.handleClose}>
16637
16663
  <svg
@@ -16696,7 +16722,7 @@ class CourseModal extends i$1 {
16696
16722
  CourseModal.styles = i$4`
16697
16723
  :host {
16698
16724
  display: block;
16699
- font-family: "Syne", sans-serif;
16725
+ font-family: "Satoshi", sans-serif;
16700
16726
  }
16701
16727
 
16702
16728
  .backdrop {
@@ -16885,6 +16911,33 @@ CourseModal.styles = i$4`
16885
16911
  margin: 0;
16886
16912
  text-align: center;
16887
16913
  }
16914
+
16915
+ .skeleton {
16916
+ background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
16917
+ background-size: 200% 100%;
16918
+ animation: loading 1.5s infinite;
16919
+ border-radius: 4px;
16920
+ }
16921
+
16922
+ @keyframes loading {
16923
+ 0% {
16924
+ background-position: 200% 0;
16925
+ }
16926
+ 100% {
16927
+ background-position: -200% 0;
16928
+ }
16929
+ }
16930
+
16931
+ .skeleton-title {
16932
+ height: 32px;
16933
+ width: 60%;
16934
+ margin-bottom: 12px;
16935
+ }
16936
+
16937
+ .skeleton-subtitle {
16938
+ height: 20px;
16939
+ width: 80%;
16940
+ }
16888
16941
  `;
16889
16942
  __decorateClass$4([
16890
16943
  n$2({ type: Array })
@@ -16907,6 +16960,9 @@ __decorateClass$4([
16907
16960
  __decorateClass$4([
16908
16961
  r$1()
16909
16962
  ], CourseModal.prototype, "selectedCourse", 2);
16963
+ __decorateClass$4([
16964
+ r$1()
16965
+ ], CourseModal.prototype, "agentName", 2);
16910
16966
  if (!customElements.get("obi-course-modal")) {
16911
16967
  customElements.define("obi-course-modal", CourseModal);
16912
16968
  }
@@ -17601,199 +17657,245 @@ class ObiWidget extends i$1 {
17601
17657
  this.obiClient = null;
17602
17658
  this.closeNavTimeoutRef = null;
17603
17659
  this.researchingTimeoutRef = null;
17604
- this.connectObi = withSentryAsyncHandler(async (sessionToken) => {
17605
- if (this.activeSession) {
17606
- trackEvent("connection_already_exists", { sessionToken }, "ObiWidget");
17607
- console.log("Connection already exists");
17608
- return;
17609
- }
17610
- trackEvent("session_connection_started", { sessionToken }, "ObiWidget");
17611
- setGlobalContext({ sessionId: sessionToken });
17612
- try {
17613
- const session = this.createSession(sessionToken);
17614
- if (!session) {
17615
- this.handleSessionCreationFailure(() => this.removeSessionUrlParams());
17660
+ this.connectObi = withSentryAsyncHandler(
17661
+ async (sessionToken) => {
17662
+ if (this.activeSession) {
17663
+ trackEvent("connection_already_exists", { sessionToken }, "ObiWidget");
17664
+ console.log("Connection already exists");
17616
17665
  return;
17617
17666
  }
17618
- this.setupSessionEventListeners(session, () => this.removeSessionUrlParams());
17619
- session.on("screenCaptureRequested", withSentryAsyncHandler(async () => {
17620
- trackEvent("screen_capture_requested", {}, "ObiWidget");
17621
- try {
17622
- const canvas = await html2canvas(document.documentElement, {
17623
- useCORS: true,
17624
- allowTaint: true,
17625
- foreignObjectRendering: true
17626
- });
17627
- const dataUrl = canvas.toDataURL("image/png");
17628
- this.activeSession.emit("screenCaptureComplete", dataUrl);
17629
- trackEvent("screen_capture_completed", {}, "ObiWidget");
17630
- } catch (e2) {
17631
- captureException(e2, {
17632
- componentName: "ObiWidget",
17633
- handlerName: "screenCaptureRequested",
17634
- sessionToken
17667
+ trackEvent("session_connection_started", { sessionToken }, "ObiWidget");
17668
+ setGlobalContext({ sessionId: sessionToken });
17669
+ try {
17670
+ const session = this.createSession(sessionToken);
17671
+ if (!session) {
17672
+ this.handleSessionCreationFailure(() => this.removeSessionUrlParams());
17673
+ return;
17674
+ }
17675
+ this.setupSessionEventListeners(session, () => this.removeSessionUrlParams());
17676
+ session.on(
17677
+ "screenCaptureRequested",
17678
+ withSentryAsyncHandler(
17679
+ async () => {
17680
+ trackEvent("screen_capture_requested", {}, "ObiWidget");
17681
+ try {
17682
+ const canvas = await html2canvas(document.documentElement, {
17683
+ useCORS: true,
17684
+ allowTaint: true,
17685
+ foreignObjectRendering: true
17686
+ });
17687
+ const dataUrl = canvas.toDataURL("image/png");
17688
+ this.activeSession.emit("screenCaptureComplete", dataUrl);
17689
+ trackEvent("screen_capture_completed", {}, "ObiWidget");
17690
+ } catch (e2) {
17691
+ captureException(e2, {
17692
+ componentName: "ObiWidget",
17693
+ handlerName: "screenCaptureRequested",
17694
+ sessionToken
17695
+ });
17696
+ console.error("[obi] error capturing screen:", e2);
17697
+ this.activeSession.emit("screenCaptureComplete", "error");
17698
+ trackEvent(
17699
+ "screen_capture_failed",
17700
+ {
17701
+ error: e2 instanceof Error ? e2.message : String(e2)
17702
+ },
17703
+ "ObiWidget"
17704
+ );
17705
+ }
17706
+ },
17707
+ "screenCaptureRequested",
17708
+ "ObiWidget"
17709
+ )
17710
+ );
17711
+ const connectionInfo = await session.connect();
17712
+ if (connectionInfo) {
17713
+ this.sessionToken = sessionToken;
17714
+ this.roomToken = connectionInfo.token;
17715
+ this.roomUrl = connectionInfo.url;
17716
+ setGlobalContext({
17717
+ sessionId: sessionToken,
17718
+ widgetState: this.state.toString()
17635
17719
  });
17636
- console.error("[obi] error capturing screen:", e2);
17637
- this.activeSession.emit("screenCaptureComplete", "error");
17638
- trackEvent("screen_capture_failed", {
17639
- error: e2 instanceof Error ? e2.message : String(e2)
17640
- }, "ObiWidget");
17720
+ this.removeSessionUrlParams();
17721
+ trackEvent(
17722
+ "session_connection_established",
17723
+ {
17724
+ sessionToken,
17725
+ hasRoomToken: !!connectionInfo.token
17726
+ },
17727
+ "ObiWidget"
17728
+ );
17641
17729
  }
17642
- }, "screenCaptureRequested", "ObiWidget"));
17643
- const connectionInfo = await session.connect();
17644
- if (connectionInfo) {
17645
- this.sessionToken = sessionToken;
17646
- this.roomToken = connectionInfo.token;
17647
- this.roomUrl = connectionInfo.url;
17648
- setGlobalContext({
17649
- sessionId: sessionToken,
17650
- widgetState: this.state.toString()
17730
+ this.activeSession = session;
17731
+ } catch (error) {
17732
+ console.error("Failed to start session:", error);
17733
+ captureException(error, {
17734
+ componentName: "ObiWidget",
17735
+ handlerName: "connectObi",
17736
+ sessionToken
17651
17737
  });
17652
- this.removeSessionUrlParams();
17653
- trackEvent("session_connection_established", {
17654
- sessionToken,
17655
- hasRoomToken: !!connectionInfo.token
17656
- }, "ObiWidget");
17738
+ this.handleSessionCreationFailure(() => this.removeSessionUrlParams());
17657
17739
  }
17658
- this.activeSession = session;
17659
- } catch (error) {
17660
- console.error("Failed to start session:", error);
17661
- captureException(error, {
17662
- componentName: "ObiWidget",
17663
- handlerName: "connectObi",
17664
- sessionToken
17665
- });
17666
- this.handleSessionCreationFailure(() => this.removeSessionUrlParams());
17667
- }
17668
- }, "connectObi", "ObiWidget");
17740
+ },
17741
+ "connectObi",
17742
+ "ObiWidget"
17743
+ );
17669
17744
  this.handleCourseSelectEvent = (event) => {
17670
17745
  const customEvent = event;
17671
17746
  this.selectedCourse = customEvent.detail;
17672
17747
  this.showCourseModal = false;
17673
17748
  this.showSessionStartModal = true;
17674
17749
  };
17675
- this.handleUrlSessionEvent = withSentryAsyncHandler(async (sessionToken) => {
17676
- trackEvent("url_session_event", { sessionToken }, "ObiWidget");
17677
- try {
17678
- if (!this.obiClient) {
17679
- const error = new Error("ObiClient not initialized");
17750
+ this.handleUrlSessionEvent = withSentryAsyncHandler(
17751
+ async (sessionToken) => {
17752
+ trackEvent("url_session_event", { sessionToken }, "ObiWidget");
17753
+ try {
17754
+ if (!this.obiClient) {
17755
+ const error = new Error("ObiClient not initialized");
17756
+ captureException(error, {
17757
+ componentName: "ObiWidget",
17758
+ handlerName: "handleUrlSessionEvent",
17759
+ sessionToken
17760
+ });
17761
+ console.error("ObiClient not initialized");
17762
+ return;
17763
+ }
17764
+ const sessionsResponse = await this.obiClient.startSession(sessionToken, this.apiKey);
17765
+ if (sessionsResponse.data) {
17766
+ const { session } = sessionsResponse.data;
17767
+ console.log("[obi-sdk] session:", session);
17768
+ trackEvent(
17769
+ "session_started",
17770
+ {
17771
+ sessionId: session?.id,
17772
+ sessionToken
17773
+ },
17774
+ "ObiWidget"
17775
+ );
17776
+ if (session) {
17777
+ const sessionWithPlan = session;
17778
+ this.selectedCourse = {
17779
+ id: sessionToken,
17780
+ name: sessionWithPlan.onboarding_plan?.name || "",
17781
+ description: sessionWithPlan.onboarding_plan?.description || ""
17782
+ };
17783
+ this.state = SDKState.LOADING;
17784
+ this.showSessionStartModal = true;
17785
+ trackEvent(
17786
+ "matching_session_found",
17787
+ {
17788
+ sessionToken,
17789
+ hasOnboardingPlan: !!sessionWithPlan.onboarding_plan
17790
+ },
17791
+ "ObiWidget"
17792
+ );
17793
+ } else {
17794
+ console.log("[obi-sdk] no session found with token:", sessionToken);
17795
+ trackEvent("no_matching_session", { sessionToken }, "ObiWidget");
17796
+ }
17797
+ }
17798
+ } catch (error) {
17799
+ console.error("Failed to fetch session details:", error);
17680
17800
  captureException(error, {
17681
17801
  componentName: "ObiWidget",
17682
17802
  handlerName: "handleUrlSessionEvent",
17683
17803
  sessionToken
17684
17804
  });
17685
- console.error("ObiClient not initialized");
17805
+ }
17806
+ },
17807
+ "handleUrlSessionEvent",
17808
+ "ObiWidget"
17809
+ );
17810
+ this.handleSessionStart = withSentryAsyncHandler(
17811
+ async (sessionToken) => {
17812
+ trackEvent("session_start_requested", { sessionToken }, "ObiWidget");
17813
+ if (this.activeSession) {
17814
+ trackEvent("session_start_blocked", { sessionToken }, "ObiWidget");
17815
+ console.log("Connection already in progress or active session exists");
17686
17816
  return;
17687
17817
  }
17688
- const sessionsResponse = await this.obiClient.listSessions(this.apiKey);
17689
- if (sessionsResponse.data) {
17690
- const sessions = sessionsResponse.data.sessions;
17691
- console.log("[obi-sdk] sessions:", sessions);
17692
- trackEvent("sessions_fetched", {
17693
- sessionCount: sessions?.length || 0,
17694
- sessionToken
17695
- }, "ObiWidget");
17696
- const matchingSession = sessions?.find((session) => session.uuid === sessionToken);
17697
- if (matchingSession) {
17698
- const sessionWithPlan = matchingSession;
17699
- this.selectedCourse = {
17700
- id: sessionToken,
17701
- name: sessionWithPlan.onboarding_plan?.name || "",
17702
- description: sessionWithPlan.onboarding_plan?.description || ""
17703
- };
17704
- this.state = SDKState.LOADING;
17705
- this.showSessionStartModal = true;
17706
- trackEvent("matching_session_found", {
17818
+ this.showSessionStartModal = false;
17819
+ this.state = SDKState.LOADING;
17820
+ setGlobalContext({ widgetState: this.state.toString() });
17821
+ await this.connectObi(sessionToken);
17822
+ },
17823
+ "handleSessionStart",
17824
+ "ObiWidget"
17825
+ );
17826
+ this.checkExistingSession = withSentryAsyncHandler(
17827
+ async () => {
17828
+ trackEvent("checking_existing_session", {}, "ObiWidget");
17829
+ try {
17830
+ const sessionData = JSON.parse(
17831
+ storage.getItem(STORAGE_KEYS.SESSION_DATA) || "{}"
17832
+ );
17833
+ const { sessionToken, roomToken, roomUrl, sessionExpiry, obiState } = sessionData;
17834
+ if (!sessionToken || !roomToken || !roomUrl) {
17835
+ trackEvent("no_existing_session_data", {}, "ObiWidget");
17836
+ return;
17837
+ }
17838
+ console.log("[obi-sdk] using existing session");
17839
+ trackEvent(
17840
+ "existing_session_data_found",
17841
+ {
17707
17842
  sessionToken,
17708
- hasOnboardingPlan: !!sessionWithPlan.onboarding_plan
17709
- }, "ObiWidget");
17710
- } else {
17711
- console.log("[obi-sdk] no session found with token:", sessionToken);
17712
- trackEvent("no_matching_session", { sessionToken }, "ObiWidget");
17843
+ hasExpiry: !!sessionExpiry,
17844
+ obiState
17845
+ },
17846
+ "ObiWidget"
17847
+ );
17848
+ if (sessionExpiry) {
17849
+ const expiryDate = new Date(sessionExpiry);
17850
+ if (expiryDate < /* @__PURE__ */ new Date()) {
17851
+ this.clearSessionStorage();
17852
+ trackEvent("session_expired", { sessionToken }, "ObiWidget");
17853
+ return;
17854
+ }
17713
17855
  }
17714
- }
17715
- } catch (error) {
17716
- console.error("Failed to fetch session details:", error);
17717
- captureException(error, {
17718
- componentName: "ObiWidget",
17719
- handlerName: "handleUrlSessionEvent",
17720
- sessionToken
17721
- });
17722
- }
17723
- }, "handleUrlSessionEvent", "ObiWidget");
17724
- this.handleSessionStart = withSentryAsyncHandler(async (sessionToken) => {
17725
- trackEvent("session_start_requested", { sessionToken }, "ObiWidget");
17726
- if (this.activeSession) {
17727
- trackEvent("session_start_blocked", { sessionToken }, "ObiWidget");
17728
- console.log("Connection already in progress or active session exists");
17729
- return;
17730
- }
17731
- this.showSessionStartModal = false;
17732
- this.state = SDKState.LOADING;
17733
- setGlobalContext({ widgetState: this.state.toString() });
17734
- await this.connectObi(sessionToken);
17735
- }, "handleSessionStart", "ObiWidget");
17736
- this.checkExistingSession = withSentryAsyncHandler(async () => {
17737
- trackEvent("checking_existing_session", {}, "ObiWidget");
17738
- try {
17739
- const sessionData = JSON.parse(
17740
- storage.getItem(STORAGE_KEYS.SESSION_DATA) || "{}"
17741
- );
17742
- const { sessionToken, roomToken, roomUrl, sessionExpiry, obiState } = sessionData;
17743
- if (!sessionToken || !roomToken || !roomUrl) {
17744
- trackEvent("no_existing_session_data", {}, "ObiWidget");
17745
- return;
17746
- }
17747
- console.log("[obi-sdk] using existing session");
17748
- trackEvent("existing_session_data_found", {
17749
- sessionToken,
17750
- hasExpiry: !!sessionExpiry,
17751
- obiState
17752
- }, "ObiWidget");
17753
- if (sessionExpiry) {
17754
- const expiryDate = new Date(sessionExpiry);
17755
- if (expiryDate < /* @__PURE__ */ new Date()) {
17756
- this.clearSessionStorage();
17757
- trackEvent("session_expired", { sessionToken }, "ObiWidget");
17856
+ this.state = SDKState.LOADING;
17857
+ setGlobalContext({
17858
+ sessionId: sessionToken,
17859
+ widgetState: this.state.toString()
17860
+ });
17861
+ const session = this.createSession(sessionToken);
17862
+ if (!session) {
17863
+ this.handleSessionCreationFailure(() => this.clearSessionStorage());
17758
17864
  return;
17759
17865
  }
17760
- }
17761
- this.state = SDKState.LOADING;
17762
- setGlobalContext({
17763
- sessionId: sessionToken,
17764
- widgetState: this.state.toString()
17765
- });
17766
- const session = this.createSession(sessionToken);
17767
- if (!session) {
17866
+ this.setupSessionEventListeners(session, () => this.clearSessionStorage());
17867
+ const reconnected = await session.reconnect(roomUrl, roomToken, obiState);
17868
+ if (reconnected) {
17869
+ this.activeSession = session;
17870
+ this.sessionToken = sessionToken;
17871
+ this.roomToken = roomToken;
17872
+ this.roomUrl = roomUrl;
17873
+ this.state = obiState;
17874
+ this.storedActiveState = obiState;
17875
+ trackEvent(
17876
+ "session_reconnected",
17877
+ {
17878
+ sessionToken,
17879
+ obiState
17880
+ },
17881
+ "ObiWidget"
17882
+ );
17883
+ } else {
17884
+ this.clearSessionStorage();
17885
+ trackEvent("session_reconnection_failed", { sessionToken }, "ObiWidget");
17886
+ }
17887
+ } catch (error) {
17888
+ console.error("Error reconnecting to session:", error);
17889
+ captureException(error, {
17890
+ componentName: "ObiWidget",
17891
+ handlerName: "checkExistingSession"
17892
+ });
17768
17893
  this.handleSessionCreationFailure(() => this.clearSessionStorage());
17769
- return;
17770
17894
  }
17771
- this.setupSessionEventListeners(session, () => this.clearSessionStorage());
17772
- const reconnected = await session.reconnect(roomUrl, roomToken, obiState);
17773
- if (reconnected) {
17774
- this.activeSession = session;
17775
- this.sessionToken = sessionToken;
17776
- this.roomToken = roomToken;
17777
- this.roomUrl = roomUrl;
17778
- this.state = obiState;
17779
- this.storedActiveState = obiState;
17780
- trackEvent("session_reconnected", {
17781
- sessionToken,
17782
- obiState
17783
- }, "ObiWidget");
17784
- } else {
17785
- this.clearSessionStorage();
17786
- trackEvent("session_reconnection_failed", { sessionToken }, "ObiWidget");
17787
- }
17788
- } catch (error) {
17789
- console.error("Error reconnecting to session:", error);
17790
- captureException(error, {
17791
- componentName: "ObiWidget",
17792
- handlerName: "checkExistingSession"
17793
- });
17794
- this.handleSessionCreationFailure(() => this.clearSessionStorage());
17795
- }
17796
- }, "checkExistingSession", "ObiWidget");
17895
+ },
17896
+ "checkExistingSession",
17897
+ "ObiWidget"
17898
+ );
17797
17899
  try {
17798
17900
  const errorTracker = withComponentErrorTracking("ObiWidget");
17799
17901
  errorTracker.setContext();
@@ -18151,7 +18253,7 @@ ObiWidget.styles = i$4`
18151
18253
  }
18152
18254
 
18153
18255
  h1 {
18154
- font-family: "Syne", sans-serif;
18256
+ font-family: "Satoshi", sans-serif;
18155
18257
  }
18156
18258
 
18157
18259
  /* Position-specific styles */
@@ -18355,4 +18457,4 @@ export {
18355
18457
  withSentryAsyncHandler as w,
18356
18458
  x
18357
18459
  };
18358
- //# sourceMappingURL=obi-widget-9e8ccac7.js.map
18460
+ //# sourceMappingURL=obi-widget-46e82ee8.js.map